Web3 API
In this section, you can learn more about the technical details of our API
Introduction
Domain - https://router.chainspot.io/
Test domain - https://testrouter.chainspot.io/
Required headings - {Accepts: application/json, ApiKey: your-api-key}
Before you can use the client API, you need to submit an application to add a client to the system. After registration, the client is provided with the following private data:
Api key - the key to access the API of the system, without it API methods will not work. In the header of each request, you need to add the field {ApiKey: “your-api-key”}
Encryption key - the key needed to encrypt the private key for its subsequent submission to the system (one of the options for conducting the transfer)
To make a transfer the client should perform 2 actions (call 2 API methods):
Send a request to create a transfer (with simple or advanced option), and receive the data of the created transfer
Initialize the transfer you need to sign, and send the transaction on the side of the Web 3.0 wallet that you use
After successful execution of these methods, the transfer will be initiated, and after that, the amount will be sent to your address in the destination network (execution time depends on many factors, not all of them depend on our service).
After creating a transaction, a method of obtaining the status of the transaction will be available, which can be used to obtain the actual data of the execution of the transfer.
Additional methods are also available: method for obtaining a list of supported networks and tokens.
Options for searching routes
There are several options for obtaining routes:
Simple option - get the recommended Chainspot router route. The best route is determined by a combination of many factors, such as transfer execution time, the amount received in the destination network, fees, etc. To obtain the route using this method, one API request is sufficient.
Advanced option - get a list of all available routes based on the given parameters, select the desired one according to your internal logic, and then retrieve the details of the selected route with a second request. To obtain the route using this method, you need to make 2 API requests—first, to get the list of available routes, and then to retrieve the details of the selected route.
Loyalty logic
Users of the Chainspot router can participate in a loyalty program, where by making transactions that meet certain conditions, they gain experience, level up, and receive bonuses. You can read more about this system here. Users of the client using the Chainspot API also gain experience, allowing our clients to use this bonus as an additional motivator to stay in the system.
However, not all routes support the loyalty program. Those that do have a flag in the parameters: useLoyalty: true.
Transaction initiation call (simple option)
POST /2.0/client/create-recommended-transaction
Accepts the following parameters:
networkFrom (string, required) - departure network symbol
(for example, Ethereum - ETH, Polygon - POL etc.)
networkTo (string, required) - destination network symbol (similar to networkFrom)
cryptoFrom (string, required) - departure token symbol (for example, Ethereum - ETH, USDT - USDT etc.)
cryptoTo (string, required) - destination token symbol (similar to cryptoFrom)
addressFrom (string, required) - the address from which tokens are sent in the departure network, as well as the address to which the tokens arrive in the destination network
addressTo (string, not required) - the user's address in the destination network; the funds will be delivered to this address once the transfer is fully completed
amount (string, required) - the number of tokens to be sent from the departure network, accepts the amount in the minimum unit (for example, the decimal of Ethereum is 18, so in order to send 1 ETH, you should enter 1000000000000000000; the decimal of USDT is 6, so in order to send 100 USDT you should enter 100000000).
This call creates a new transaction in the system and returns the transfer data. An example of a successful response (HTTP Code 200):
Example of sent data validation error (HTTP code 400):
Example of a common request error (HTTP code 400):
Example of server error (HTTP code 500):
Transaction routers list (advanced option, first step)
POST /2.0/client/create-transactions
Accepts the following parameters:
networkFrom (string, required) - departure network symbol
(for example, Ethereum - ETH, Polygon - POL etc.)
networkTo (string, required) - destination network symbol (similar to networkFrom)
cryptoFrom (string, required) - departure token symbol (for example, Ethereum - ETH, USDT - USDT etc.)
cryptoTo (string, required) - destination token symbol (similar to cryptoFrom)
addressFrom (string, required) - the address from which tokens are sent in the departure network, as well as the address to which the tokens arrive in the destination network
addressTo (string, not required) - the user's address in the destination network; the funds will be delivered to this address once the transfer is fully completed
amount (string, required) - the number of tokens to be sent from the departure network, accepts the amount in the minimum unit (for example, the decimal of Ethereum is 18, so in order to send 1 ETH, you should enter 1000000000000000000; the decimal of USDT is 6, so in order to send 100 USDT you should enter 100000000).
This call creates a new transactions in the system and returns the transfer data for all routers
An example of a successful response (HTTP Code 200):
Example of sent data validation error (HTTP code 400):
Example of a common request error (HTTP code 400):
Example of server error (HTTP code 500):
Transfer data request (advanced option, second step)
GET /2.0/client/transaction-data
Accepts the following parameters:
id (string, required) - transaction id (from transaction routers list request)
This call returns the data of the requested transaction for subsequent signing and sending to the network
An example of a successful response (HTTP Code 200):
Example of sent data validation error (HTTP code 400):
Example of a common request error (HTTP code 400):
Example of server error (HTTP code 500):
Transaction status request
GET /2.0/client/transaction-status
Accepts the following parameters:
id (string, required) - transaction id
This request returns the status of the created transaction
The list of statuses:
new - new transaction
in_progress - the transfer was initialized
finished - the transfer has been successfully completed, and the tokens have been transferred to the destination network
rejected - an error occurred during the transfer
An example of a successful request (HTTP code 200):
Example of sent data validation error (HTTP code 400):
Example of a common request error (HTTP code 400):
Example of server error (HTTP code 500):
Networks and tokens list request
GET /2.0/client/networks-list
No parameters.
This request returns a list of networks and tokens supported by the service
An example of a successful response (HTTP Code 200):
Example of server error (HTTP code 500):
Last updated