Tokensoft
  • Introduction 2.0
  • Introduction
  • What We Offer
  • Setting up a Client Profile
    • KYB
  • Events
    • Launch Event
    • Setting up an Identity Event
      • General Information
    • Setting up a Raise Event
      • General Information
      • Eligibility
      • Document Setup
      • Event Page Setup
      • Event Details Confirmation
      • Onchain Configuration
      • Network & Payment Configuration
      • Sale Basics
      • Participants
      • Deploy
    • Setting up a Distribution Event
      • General Information
  • Managing Post Event Activities
    • Admin Dashboard: Advanced Usage
    • Managing Users and Events Post-Launch
  • Additional Resources
    • Frequently Asked Questions
    • How to Get Further Assistance
  • API
    • Developer Guide
    • Use Cases
Powered by GitBook
On this page
  • Introduction
  • Authentication
  • SDK
  • Sandbox Environment
  • Platform

Was this helpful?

  1. API

Developer Guide

PreviousHow to Get Further AssistanceNextUse Cases

Last updated 3 years ago

Was this helpful?

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 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.

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

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

Platform

The Tokensoft Platform supports token issuers managing digital securities and investors purchasing the securities.

Tokensoft also has an which simplifies interactions with the API.

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

URL:

GraphQL Playground:

contact us
Javascript SDK
GraphQL Playground
demo.stagetokensoft.com
demo.stagetokensoft.com/graphql