Skip to content

Commit c54d05d

Browse files
Merge pull request #31 from ostdotcom/base_tokens_api
Added base tokens module to V2 API's
2 parents aa8a484 + 763559f commit c54d05d

8 files changed

Lines changed: 101 additions & 13 deletions

File tree

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
language: java
2+
dist: xenial
23
# The cross product of the jdk and env settings form the matrix of builds Travis will run.
34
jdk:
4-
- oraclejdk8
5-
- oraclejdk9
6-
- openjdk7
75
- openjdk8
6+
- openjdk9
87
notifications:
98
email:
109
recipients:

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 JAVA SDK v2.0.0](https://github.com/ostdotcom/ost-sdk-java/tree/v2.0.0)
27
---
38

README.md

Lines changed: 25 additions & 8 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.
@@ -43,7 +42,7 @@ with OST Platform, requiring only three steps:
4342
<dependency>
4443
<groupId>com.ost</groupId>
4544
<artifactId>ost-sdk-java</artifactId>
46-
<version>2.0.0</version>
45+
<version>2.1.0</version>
4746
</dependency>
4847
```
4948

@@ -293,7 +292,7 @@ System.out.println("response: " + response.toString() );
293292

294293
#### Price Points Module
295294

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

299298
```java
@@ -414,12 +413,12 @@ arrayListAmount.add(amount);
414413
Gson gsonObj = new Gson();
415414
String tokenHolderSender = "0xa9632350057c2226c5a10418b1c3bc9acdf7e2ee";
416415
String payCurrencyCode = "USD";
417-
String ostToUsd = "23757000000000000";
416+
String intendedPricePoint = "23757000000000000";
418417
nestedarraylist.add(tokenHolderSender);
419418
nestedarraylist.add(arrayListForUser2TokenHolderAddress);
420419
nestedarraylist.add(arrayListAmount);
421420
nestedarraylist.add(payCurrencyCode);
422-
nestedarraylist.add(ostToUsd);
421+
nestedarraylist.add(intendedPricePoint);
423422
nestedparams.put("parameters", nestedarraylist);
424423
String jsonStr = gsonObj.toJson(nestedparams);
425424
params.put("raw_calldata", jsonStr);
@@ -543,3 +542,21 @@ params.put("chain_id", "200");
543542
JsonObject response = chainsService.get( params );
544543
System.out.println("response: " + response.toString() );
545544
```
545+
546+
### Base Tokens Module
547+
548+
To get information about the value tokens (such as OST, USDC) available on the OST Platform interface, use services
549+
provided by the Base Tokens module. You can use this service to obtain the base token details
550+
on OST Platform interface.
551+
552+
```java
553+
com.ost.services.BaseTokens baseTokensService = services.baseTokens;
554+
```
555+
556+
Get Base Token Detail:
557+
558+
```java
559+
HashMap <String,Object> params = new HashMap<String,Object>();
560+
JsonObject response = baseTokensService.get( params );
561+
System.out.println("response: " + response.toString() );
562+
```

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

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.ost</groupId>
55
<artifactId>ost-sdk-java</artifactId>
6-
<version>2.0.0-SNAPSHOT</version>
6+
<version>2.1.0-SNAPSHOT</version>
77
<name>OST SDK for Java</name>
88
<description>OST Platform SDK for Java</description>
99
<packaging>jar</packaging>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.ost.services;
2+
3+
import com.google.gson.JsonObject;
4+
import com.ost.lib.OSTRequestClient;
5+
6+
import java.io.IOException;
7+
import java.util.Map;
8+
9+
public class BaseTokens extends OSTAPIService {
10+
private static String servicePrefix = "/base-tokens";
11+
private static String serviceSuffix = "";
12+
13+
14+
public BaseTokens(OSTRequestClient ostRequestClient) {
15+
super(ostRequestClient, servicePrefix, serviceSuffix);
16+
}
17+
18+
/**
19+
* Get base token details
20+
* @param params Request Params
21+
* @return API Response
22+
*/
23+
public JsonObject get( Map<String,Object> params ) throws MissingParameter, IOException {
24+
String resource = this.urlPrefix + "/";
25+
return this.request.get(resource, params);
26+
}
27+
}

src/main/java/com/ost/services/Manifest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class Manifest extends OSTServiceManifest {
1515
public RecoveryOwners recoveryOwners;
1616
public Devices devices;
1717
public Chains chains;
18+
public BaseTokens baseTokens;
1819

1920

2021
public Manifest( Map<String, Object> params) {
@@ -34,6 +35,7 @@ protected void init() {
3435
this.recoveryOwners = new RecoveryOwners( this.request );
3536
this.devices = new Devices( this.request );
3637
this.chains = new Chains( this.request );
38+
this.baseTokens = new BaseTokens( this.request );
3739
}
3840

3941
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.ost.services;
2+
3+
import com.google.gson.JsonObject;
4+
import org.junit.Before;
5+
import org.junit.Test;
6+
7+
import java.util.HashMap;
8+
9+
public class BaseTokensTest extends ServiceTestBase {
10+
@Override
11+
public BaseTokens getService() {
12+
return (BaseTokens) super.getService();
13+
}
14+
15+
@Before
16+
@Override
17+
public void setUp() throws Exception {
18+
super.setUp();
19+
setService(getServiceManifest().baseTokens);
20+
}
21+
22+
@Override
23+
public Manifest getServiceManifest() {
24+
return (Manifest) super.getServiceManifest();
25+
}
26+
27+
@Test
28+
public void get() throws Exception {
29+
HashMap<String, Object> params = new HashMap<String, Object>();
30+
31+
// Test-Case: Get a Base Token.
32+
JsonObject response;
33+
response = getService().get(params);
34+
validateResponseWithSuccess(response);
35+
36+
}
37+
38+
}

0 commit comments

Comments
 (0)