Digital Asset SDK

The JavaScript Digital Asset SDK enables developers working with JavaScript to interact easily with the blockchain environment.

Description

The JavaScript Digital Asset SDK is a set of functions that enables developers to interact with the Tymlez supported blockchain providers in an easy way.

Core functions of the SDK include:

  • Creating, reading, and verifying digital asset transactions
  • Transfer of digital assets between accounts
  • Future support for GDPR compliance

Usage

Install the Digital Asset SDK as a npm dependency in your project

  • Install the Digital Asset SDK as a npm dependency - default branch
npm i git+https://gitlab.tymlez.com/sdk/ng-rt-digitalAsset-sdk.git
npm i git+ssh://git@gitlab.tymlez.com:sdk/ng-rt-digitalAsset-sdk.git
  • Install the Digital Asset SDK as a npm dependency from the development branch: 
npm i git+https://gitlab.tymlez.com/sdk/ng-rt-digitalAsset-sdk.git#dev/3.2
npm i git+ssh://git@gitlab.tymlez.com:sdk/ng-rt-digitalAsset-sdk.git#dev/3.2
  • Install globally the Digital Asset SDK as a npm dependency from the production branch:
npm i -g git+https://gitlab.tymlez.com/sdk/ng-rt-digitalAsset-sdk.git#prod/3.2
  • Uninstall
npm -g uninstall ng-rt-digitalAsset-sdk

Generate API documentation for digitalAsset-SDK

  • Install the TYMLEZ dev-tools globally:
npm i -g git+https://gitlab.tymlez.com/sdk/ng-rt-dev-tools.git
  • Clone the digitalAsset SDK:
git clone https://gitlab.tymlez.com/sdk/ng-rt-digitalAsset-sdk.git
cd ng-rt-digitalAsset-sdk
  • Generate JSDOCs in the folder of your directory for git clone
npx tymlez-dev gulp doc-api

This will generate a folder './dist/docs/api'. Now, open ./dist/docs/api/index.html with your browser.

Examples

Sample code illustrating how you can use the Digital Asset SDK can be found here :

https://gitlab.tymlez.com/sdk/ng-rt-digitalasset-sdk-samples.git

Access the Digital Asset API

The route for the Digital Asset API is protected.

To access the route, you will require a JWT token.

To generate this token, you will require an app key.

First, begin with obtaining app key for Digital Asset API with this HTTP call:

apiUtil.appLogin
    {
"appName": "ng-rt-digitalAsset",
"key": "<GENERATE YOUR APP KEY HERE>",
"loginRequired": true
}

Once the app key has been created, generate a JWT token with the app key:

apiUtil.getToken

Call hierarchy

Required objects

const digitalAssetDriver = require('./src/digitalAssetDriver');
const digitalAssetApi = require('./src/digitalAssetApi');
const contextUtil = require('./src/contextUtil');
const fileApi = require('./src/fileApi');
const apiUtil = require('./src/apiUtil');

Basic call - post a CREATE transaction to the Digital Asset API

To post a signed CREATE transaction using the TBSP Javascript Digital Asset SDK, use this HTTP call:

digitalassetApi.postSignedCreateTx 

To post an unsigned CREATE transaction using the TBSP Javascript Digital Asset SDK, use this HTTP call:

digitalassetApi.postUnsignedCreateTx

Basic call - post a TRANSFER transaction to the Digital Asset API

To post a signed TRANSFER transaction using the TBSP Javascript Digital Asset SDK, use this HTTP call:

digitalassetApi.postSignedTransferTx 

To post an unsigned TRANSFER transaction using the TBSP Javascript Digital Asset SDK, use this HTTP call:

digitalassetApi.postUnsignedTransferTx

Advanced calls

Advanced calls include the HTTP call to create a transaction context:

contextUtil.createTxContext

Helper Functions

To get a specific transaction using its ID, use this HTTP call:

  digitalAssetApi.getTxById

See the current owner of an asset:

  digitalAssetApi.getOwnerofAsset

See the history of the asset (You can also see who created the asset):

  digitalAssetApi.getAssetHistory