1- # OST Javascript SDK
2- The official [ OST Javascript SDK] ( https://dev.ost.com/ ) .
1+ # OST JavaScript SDK
2+ The official [ OST JavaScript SDK] ( https://dev.ost.com/ ) .
33
44## Requirements
55
@@ -14,23 +14,24 @@ To use this node module, developers will need to:
1414
1515## Installation
1616
17- Install OST Javascript SDK
17+ Install OST JavaScript SDK
1818
1919``` bash
20- > npm install @ostdotcom/ost-sdk
20+ > npm install @ostdotcom/ost-sdk-js
2121```
2222
2323## Example Usage
2424
2525Require the SDK:
2626
2727``` node.js
28- const OSTSDK = require (' @ostdotcom/ost-sdk' );
28+ const OSTSDK = require (' @ostdotcom/ost-sdk-js ' );
2929```
3030
3131Initialize the SDK object:
3232
3333``` node.js
34+ // the currently valid API endpoint is "https://playgroundapi.ost.com", this may change in the future
3435const ostObj = new OSTSDK ({apiKey: < api_key> , apiSecret: < api_secret> , apiEndpoint: < api_endpoint> });
3536```
3637
@@ -45,39 +46,39 @@ const transactionKindService = ostObj.services.transactionKind;
4546Create new transaction types:
4647
4748``` node.js
48- transactionKindService .create ({name: ' Like' , kind: ' user_to_user' , currency_type: ' usd' , currency_value: ' 1.25' , commission_percent: ' 12' }).then (console .log ) .catch (console .log );
49+ transactionKindService .create ({name: ' Like' , kind: ' user_to_user' , currency_type: ' usd' , currency_value: ' 1.25' , commission_percent: ' 12' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
4950```
5051
5152``` node.js
52- transactionKindService .create ({name: ' Grant' , kind: ' company_to_user' , currency_type: ' bt' , currency_value: ' 12' , commission_percent: ' 0' }).then (console .log ) .catch (console .log );
53+ transactionKindService .create ({name: ' Grant' , kind: ' company_to_user' , currency_type: ' bt' , currency_value: ' 12' , commission_percent: ' 0' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
5354```
5455
5556``` node.js
56- transactionKindService .create ({name: ' Buy' , kind: ' user_to_company' , currency_type: ' bt' , currency_value: ' 100' , commission_percent: ' 0' }).then (console .log ) .catch (console .log );
57+ transactionKindService .create ({name: ' Buy' , kind: ' user_to_company' , currency_type: ' bt' , currency_value: ' 100' , commission_percent: ' 0' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
5758```
5859
5960Get a list of existing transaction kinds and other data:
6061
6162``` node.js
62- transactionKindService .list ().then (console .log ) .catch (console .log );
63+ transactionKindService .list ().then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
6364```
6465
6566Edit an existing transaction kind:
6667
6768``` node.js
68- transactionKindService .edit ({client_transaction_id: ' 12' , name: ' New Transaction Kind' }).then (console .log ) .catch (console .log );
69+ transactionKindService .edit ({client_transaction_id: ' 12' , name: ' New Transaction Kind' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
6970```
7071
7172Execute a branded token transfer by transaction kind:
7273
7374``` node.js
74- transactionKindService .execute ({from_uuid: ' 1234-1928-1081dsds-djhksjd' , to_uuid: ' 1234-1928-1081-1223232' , transaction_kind: ' Purchase' }).then (console .log ) .catch (console .log );
75+ transactionKindService .execute ({from_uuid: ' 1234-1928-1081dsds-djhksjd' , to_uuid: ' 1234-1928-1081-1223232' , transaction_kind: ' Purchase' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
7576```
7677
7778Get the status of an executed transaction:
7879
7980``` node.js
80- transactionKindService .status ({transaction_uuids: [' 5f79063f-e22a-4d28-99d7-dd095f02c72e' ]}).then (console .log ) .catch (console .log );
81+ transactionKindService .status ({transaction_uuids: [' 5f79063f-e22a-4d28-99d7-dd095f02c72e' ]}).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
8182```
8283
8384### User Module
@@ -91,29 +92,29 @@ const userService = ostObj.services.user;
9192Create a new user:
9293
9394``` node.js
94- userService .create ({name: ' Alice' }).then (console .log ) .catch (console .log );
95+ userService .create ({name: ' Alice' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
9596```
9697
9798Get a list of users and other data:
9899
99100``` node.js
100- userService .list ().then (console .log ) .catch (console .log );
101+ userService .list ().then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
101102```
102103
103104Edit an existing user:
104105
105106``` node.js
106- userService .edit ({uuid: ' 1234-1928-1081dsds-djhksjd' , name: ' Bob' }).then (console .log ) .catch (console .log );
107+ userService .edit ({uuid: ' 1234-1928-1081dsds-djhksjd' , name: ' Bob' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
107108```
108109
109110Airdrop branded tokens to users:
110111
111112``` node.js
112- userService .airdropTokens ({amount: 1 , list_type: ' all' }).then (console .log ) .catch (console .log );
113+ userService .airdropTokens ({amount: 1 , list_type: ' all' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
113114```
114115
115116As airdropping tokens is an asynchronous task, you can check the airdrop's status:
116117
117118``` node.js
118- userService .airdropStatus ({airdrop_uuid: ' d8303e01-5ce0-401f-8ae4-d6a0bcdb2e24' }).then (console .log ) .catch (console .log );
119+ userService .airdropStatus ({airdrop_uuid: ' d8303e01-5ce0-401f-8ae4-d6a0bcdb2e24' }).then (function ( res ) { console .log ( JSON . stringify (res)); }) .catch (function ( err ) { console .log ( JSON . stringify (err)); } );
119120```
0 commit comments