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
1
const fetch = require('node-fetch')
2
const crypto = require('crypto')
3
4
const url = 'https://platform.stagetokensoft.com/graphql'
5
// access and secret keys obtained from your admin dashboard
6
const accessKey = 'your access key'
7
const secretKey = 'your secret key'
8
9
// create a signature for the request body
10
const createSignature = (body, timestamp, secretKey) => {
11
const text = timestamp + body
12
const hmac = crypto.createHmac('sha256', secretKey)
13
hmac.update(text)
14
return hmac.digest('hex')
15
}
16
17
const getServerTime = async () => {
18
const request = {
19
query: '{ time }'
20
}
21
const body = JSON.stringify(request)
22
const options = {
23
headers: {
24
'Content-Type': 'application/json',
25
},
26
method: 'post',
27
body
28
}
29
30
const res = await fetch(url, options)
31
const { data } = await res.json()
32
return data.time
33
}
34
35
const run = async () => {
36
const timestamp = await getServerTime()
37
const body = JSON.stringify({ query: '{ currentUser { id email } }' })
38
const signature = createSignature(body, String(timestamp), secretKey)
39
40
const options = {
41
// include signature and timestamp to request headers
42
headers: {
43
'access-key': accessKey,
44
'access-sign': signature,
45
'access-timestamp': timestamp,
46
'Content-Type': 'application/json',
47
},
48
method: 'post',
49
body
50
}
51
52
try {
53
const res = await fetch(url, options)
54
console.log('res', res)
55
const { data } = await res.json()
56
console.log('data', data)
57
} catch (e) {
58
console.log('e', e)
59
}
60
}
61
62
run()
Copied!

SDK

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

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.