Skip to content

Commit e666179

Browse files
Merge pull request #55 from ostdotcom/base_tokens_api
Add base tokens service.
2 parents 11f5832 + e1c2ac4 commit e666179

6 files changed

Lines changed: 93 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[OST JAVA SDK v2.1.0](https://github.com/ostdotcom/ost-sdk-java/tree/v2.1.0)
2+
---
3+
4+
* Added base tokens module to V2 API's
5+
16
[OST PHP SDK v2.0.0](https://github.com/ostdotcom/ost-sdk-php/tree/v2.0.0)
27
---
38
* OST API V2 interaction layer implementation.

README.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@ OST is a complete technology solution enabling mainstream businesses
99
to easily launch blockchain-based economies without
1010
requiring blockchain development.
1111

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

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

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

271270
#### Price Points Module
272271

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

276275
```php
@@ -336,8 +335,8 @@ $transferAmount = array("150000000000000000", "100000000000000000");
336335
$rawCallData['method'] = 'pay';
337336
$tokenHolderSender = '0xa9632350057c2226c5a10418b1c3bc9acdf7e2ee';
338337
$payCurrencyCode = 'USD';
339-
$ostToUsd = '23757000000000000'; // get price-point response
340-
$rawCallData['parameters'] = array($tokenHolderSender, $transferTo, $transferAmount, $payCurrencyCode, $ostToUsd);
338+
$intendedPricePoint = '23757000000000000'; // get price-point response
339+
$rawCallData['parameters'] = array($tokenHolderSender, $transferTo, $transferAmount, $payCurrencyCode, $intendedPricePoint);
341340
$executeParams['raw_calldata'] = json_encode($rawCallData);
342341
//$executeParams['meta_property'] = $metaPropertyParams;
343342
$response = $transactionsService->execute($executeParams)->wait();
@@ -455,3 +454,21 @@ $getParams['chain_id'] = '2000';
455454
$response = $chainsService->get($getParams)->wait();
456455
echo json_encode($response, JSON_PRETTY_PRINT);
457456
```
457+
458+
### Base Tokens Module
459+
460+
To get information about the value tokens (such as OST, USDC) available on the OST Platform interface, use services
461+
provided by the Base Tokens module. You can use this service to obtain the value token details
462+
on OST Platform interface.
463+
464+
```php
465+
$baseTokensService = $ostObj->services->baseTokens;
466+
```
467+
468+
Get Base Tokens Detail:
469+
470+
```php
471+
$getParams = array();
472+
$response = $baseTokensService->get($getParams)->wait();
473+
echo json_encode($response, JSON_PRETTY_PRINT);
474+
```

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.0
1+
2.1.0

src/Services/BaseTokens.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Base tokens class
4+
*/
5+
6+
namespace OST;
7+
8+
use OST\Base;
9+
10+
/**
11+
* Class encapsulating methods to interact with API's for Base Tokens module
12+
*/
13+
class BaseTokens extends Base
14+
{
15+
const PREFIX = '/base-tokens';
16+
17+
/**
18+
* Get base tokens details
19+
*
20+
* @param array $params params for fetching details of a base tokens
21+
*
22+
* @return object
23+
*
24+
*/
25+
public function get(array $params = array())
26+
{
27+
return $this->requestObj->get($this->getPrefix() . '', $params);
28+
}
29+
}

src/Services/Manifest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class Manifest
4747
/** @var Users object which has methods to fire API's belonging to User module */
4848
public $users;
4949

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

5154
/**
5255
* Constructor
@@ -87,6 +90,8 @@ public function __construct($params)
8790

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

93+
$this->baseTokens = new BaseTokens($requestObj);
94+
9095
}
9196

9297
}

tests/Services/BaseTokensTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: Dhananjay8
5+
* Date: 2019-05-20
6+
* Time: 16:44
7+
*/
8+
$filepath = realpath (dirname(__FILE__));
9+
require_once($filepath."/ServiceTestBase.php");
10+
11+
final class BaseTokensTest extends ServiceTestBase
12+
{
13+
/**
14+
*
15+
* Get Base Tokens
16+
*
17+
* @test
18+
*
19+
* @throws Exception
20+
*/
21+
public function get()
22+
{
23+
$baseTokensService = $this->ostObj->services->baseTokens;
24+
$params = array();
25+
$response = $baseTokensService->get($params)->wait();
26+
$this->isSuccessResponse($response);
27+
}
28+
29+
}

0 commit comments

Comments
 (0)