Skip to content

Commit

Permalink
Merge pull request #56 from ostdotcom/develop
Browse files Browse the repository at this point in the history
Support for new API endpoint - /base-tokens
  • Loading branch information
kedarchandrayan authored Jun 3, 2019
2 parents b2a6364 + e666179 commit 11adb13
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[OST JAVA SDK v2.1.0](https://github.com/ostdotcom/ost-sdk-java/tree/v2.1.0)
---

* Added base tokens module to V2 API's

[OST PHP SDK v2.0.0](https://github.com/ostdotcom/ost-sdk-php/tree/v2.0.0)
---
* OST API V2 interaction layer implementation.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018 OST.com Ltd.
Copyright (c) 2019 OST.com Inc.

MIT License

Expand Down
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# OST PHP SDK
[![Build Status](https://travis-ci.org/ostdotcom/ost-sdk-php.svg?branch=develop)](https://travis-ci.org/ostdotcom/ost-sdk-php)

The official [OST](https://dev.ost.com/) PHP SDK.
[OST](https://dev.ost.com/) Platform SDK for PHP.

## Introduction

OST is a complete technology solution enabling mainstream businesses
to easily launch blockchain-based economies without
requiring blockchain development.

At the core of OST is the concept of OST-powered Brand Tokens (BTs).
BTs are white-label cryptocurrency tokens with utility representations
Brand Tokens (BTs) are white-label cryptocurrency tokens with utility representations
running on highly-scalable Ethereum-based side blockchains,
backed by OST tokens staked on Ethereum mainnet. Within a business’s
backed by value token (such as OST, USDC) staked on Ethereum mainnet. Within a business’s
token economy, BTs can only be transferred to whitelisted user addresses.
This ensures that they stay within the token economy.

The OST technology stack is designed to give businesses everything they need
to integrate, test, and deploy BTs. Within the OST suite of products, developers
can use OST Platform to create, test, and launch Brand Tokens backed by OST.
can use OST Platform to create, test, and launch Brand Tokens backed by value token (such as OST, USDC).

OST APIs and server-side SDKs make it simple and easy for developers to
integrate blockchain tokens into their apps.
Expand Down Expand Up @@ -270,7 +269,7 @@ echo json_encode($response, JSON_PRETTY_PRINT);

#### Price Points Module

To know the OST price point in USD and when it was last updated,
To know the value token (such as OST, USDC) price point in pay currency and when it was last updated,
use services provided by the Price Points module.

```php
Expand Down Expand Up @@ -336,8 +335,8 @@ $transferAmount = array("150000000000000000", "100000000000000000");
$rawCallData['method'] = 'pay';
$tokenHolderSender = '0xa9632350057c2226c5a10418b1c3bc9acdf7e2ee';
$payCurrencyCode = 'USD';
$ostToUsd = '23757000000000000'; // get price-point response
$rawCallData['parameters'] = array($tokenHolderSender, $transferTo, $transferAmount, $payCurrencyCode, $ostToUsd);
$intendedPricePoint = '23757000000000000'; // get price-point response
$rawCallData['parameters'] = array($tokenHolderSender, $transferTo, $transferAmount, $payCurrencyCode, $intendedPricePoint);
$executeParams['raw_calldata'] = json_encode($rawCallData);
//$executeParams['meta_property'] = $metaPropertyParams;
$response = $transactionsService->execute($executeParams)->wait();
Expand Down Expand Up @@ -455,3 +454,21 @@ $getParams['chain_id'] = '2000';
$response = $chainsService->get($getParams)->wait();
echo json_encode($response, JSON_PRETTY_PRINT);
```

### Base Tokens Module

To get information about the value tokens (such as OST, USDC) available on the OST Platform interface, use services
provided by the Base Tokens module. You can use this service to obtain the value token details
on OST Platform interface.

```php
$baseTokensService = $ostObj->services->baseTokens;
```

Get Base Tokens Detail:

```php
$getParams = array();
$response = $baseTokensService->get($getParams)->wait();
echo json_encode($response, JSON_PRETTY_PRINT);
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0
2.1.0
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ostdotcom/ost-sdk-php",
"homepage": "https://kit.ost.com/",
"description": "The official OST PHP SDK",
"keywords": ["ost","simpletoken","sdk","php"],
"homepage": "https://platform.ost.com/",
"description": "OST Platform SDK for PHP",
"keywords": ["OST","Simple Token","SDK","PHP"],
"type": "library",
"license": "MIT",
"authors": [
{
"name": "OST.COM LTD."
"name": "OST.com Inc."
}
],
"support": {
Expand Down
29 changes: 29 additions & 0 deletions src/Services/BaseTokens.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Base tokens class
*/

namespace OST;

use OST\Base;

/**
* Class encapsulating methods to interact with API's for Base Tokens module
*/
class BaseTokens extends Base
{
const PREFIX = '/base-tokens';

/**
* Get base tokens details
*
* @param array $params params for fetching details of a base tokens
*
* @return object
*
*/
public function get(array $params = array())
{
return $this->requestObj->get($this->getPrefix() . '', $params);
}
}
5 changes: 5 additions & 0 deletions src/Services/Manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class Manifest
/** @var Users object which has methods to fire API's belonging to User module */
public $users;

/** @var BaseTokens object which has methods to fire API's belonging to Base Tokens module */
public $baseTokens;


/**
* Constructor
Expand Down Expand Up @@ -87,6 +90,8 @@ public function __construct($params)

$this->users = new Users($requestObj);

$this->baseTokens = new BaseTokens($requestObj);

}

}
29 changes: 29 additions & 0 deletions tests/Services/BaseTokensTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* Created by PhpStorm.
* User: Dhananjay8
* Date: 2019-05-20
* Time: 16:44
*/
$filepath = realpath (dirname(__FILE__));
require_once($filepath."/ServiceTestBase.php");

final class BaseTokensTest extends ServiceTestBase
{
/**
*
* Get Base Tokens
*
* @test
*
* @throws Exception
*/
public function get()
{
$baseTokensService = $this->ostObj->services->baseTokens;
$params = array();
$response = $baseTokensService->get($params)->wait();
$this->isSuccessResponse($response);
}

}

0 comments on commit 11adb13

Please sign in to comment.