Dragon Lotto Base SDK
This SDK is intended to build for the convinience of developers whose want to interact with our Sabay Stellar's network.
Features
- Initialize an account based on the provided seed (Create or Load the exists account)
- Top-up (Request top-up from provider)
- Check Balance (Custom & Native assets)
- Clear the custom asset
Installation
Using npm:
npm install dl-base-sdk
Examples
Create a new account or load an existing one from the network.
; const seed = 'some-unique-seed';const development = true; // this is in a development environment // const server = Server.loadProductionServer(); // productionconst server = Server; // development const account = seed server development; // the address that would consider as a parent of user's accountconst source = 'GCSYLEFISTDRFXBMWYKEFWPKM73PGBDUCGJTIS3TLTC3LQ67TJSFEZ3P';const passphrase = 'sabay'; account ;
Response:
Request a top-up for an account by sending a small amout of lumens (0.0000001) to the fund provider.
; const seed = 'some-unique-seed';const development = true; // this is in a development environment // const server = Server.loadProductionServer(); // productionconst server = Server; // development const account = seed server development; // the address of fund providerconst source = 'GCSYLEFISTDRFXBMWYKEFWPKM73PGBDUCGJTIS3TLTC3LQ67TJSFEZ3P';const reference_id = 'some_unique_reference'; // limit 28-byte account ;
On success, this doesn't mean the account get the fund. The client just make a request to top-up to the server of provider. Client itself still need to wait until the server receive the request and send back the fund.
Response:
To check an account's balance:
; const seed = 'some-unique-seed';const development = true; // this is in a development environment // const server = Server.loadProductionServer(); // productionconst server = Server; // development const account = seed server development; const passphrase = 'sabay';const asset_code = 'LTC'; // example 1//// get blace of native and default custom assetaccount ; // example 2//// get blace of native and other custom assetaccount ;
Response:
Clearing an asset:
; const seed = 'some-unique-seed';const development = true; // this is in a development environment // const server = Server.loadProductionServer(); // productionconst server = Server; // development const account = seed server development; // the adress where all the fund will be sent toconst source = 'GCSYLEFISTDRFXBMWYKEFWPKM73PGBDUCGJTIS3TLTC3LQ67TJSFEZ3P';const user_id = 'some_user_id';const passphrase = 'sabay'; // example 1//// to clear all the remaining assets back to its own provider// with the default address and asset_code that has set in the SDKaccount clear ; // example 2//// to clear only some amount of asset// with custom address and asset_codeconst amount = 5;const asset_code = 'LTC';const asset_issuer = 'GCIE6MTOWK37MQGJVLS3QSO67KTU2VUPWWH4D5336UL6YERDPT23U2IJ'; account clearamount asset_code asset_issuer ;
Response: