T
T
Tokensoft
Search…
Developer Guide

Introduction

Welcome to Tokensoft's developer documentation. This guide illustrates how our partners can interact with Tokensoft services programmatically in the following use cases:
  • ATS partners whitelisting a user to trade an ERC-1404 digital asset
  • Price feed providers querying current and historical asset prices
Note that certain features are restricted: please contact us for more instructions on accessing this API.

Authentication

Almost all API endpoints require API users to authenticate. Each request must include:
  • an API key
  • the current time
  • a signature of the request information by the API secret
The Tokensoft SDK takes care of this logic, and we encourage you to use it.
This is an example request which provides the access-key, access-sign, and access-timestamp headers.
typescript
const fetch = require('node-fetch')
const crypto = require('crypto')
const url = 'https://platform.stagetokensoft.com/graphql'
// access and secret keys obtained from your admin dashboard
const accessKey = 'your access key'
const secretKey = 'your secret key'
// create a signature for the request body
const createSignature = (body, timestamp, secretKey) => {
const text = timestamp + body
const hmac = crypto.createHmac('sha256', secretKey)
hmac.update(text)
return hmac.digest('hex')
}
const getServerTime = async () => {
const request = {
query: '{ time }'
}
const body = JSON.stringify(request)
const options = {
headers: {
'Content-Type': 'application/json',
},
method: 'post',
body
}
const res = await fetch(url, options)
const { data } = await res.json()
return data.time
}
const run = async () => {
const timestamp = await getServerTime()
const body = JSON.stringify({ query: '{ currentUser { id email } }' })
const signature = createSignature(body, String(timestamp), secretKey)
const options = {
// include signature and timestamp to request headers
headers: {
'access-key': accessKey,
'access-sign': signature,
'access-timestamp': timestamp,
'Content-Type': 'application/json',
},
method: 'post',
body
}
try {
const res = await fetch(url, options)
console.log('res', res)
const { data } = await res.json()
console.log('data', data)
} catch (e) {
console.log('e', e)
}
}
run()

SDK

Tokensoft also has an Javascript SDK which simplifies interactions with the API.
Installation
npm install tokensoft-sdk
import TokensoftSDK from 'tokensoft-sdk'
const issuerEndpoint = 'https://app.arcalabs.com'
const sdk = new TokensoftSDK(issuerEndpoint, process.env.KEY_ID, process.env.SECRET_KEY)

Sandbox Environment

API integrations should be tested against a Tokensoft sandbox environment before being used in any production environment. Tokensoft also supports the GraphQL Playground tool for rapid API testing.

Platform

The Tokensoft Platform supports token issuers managing digital securities and investors purchasing the securities.
Copy link
On this page
Introduction
Authentication
SDK
Sandbox Environment
Platform