Emit a simple transfer
The principle of T-REX transfers is that all the validation is performed onchain, without any form of offchain validation done by Tokeny.
Thus we do not offer any transfer endpoint for the investor, but we created a "validate transfer" endpoint to make sure you are not issuing a transfer that will fail onchain.
This endpoint checks:
- The validity of the receiver ONCHAINID and wallet: is it whitelisted, does it hold the required claims for this T-REX?
- That the balance is sufficient on the emitter wallet
- That the transfer doesn't break the compliance rules linked to the T-REX (the recipient is not from a blacklisted country, the amount doesn't break daily/monthly limits, etc).
Authentication
cURL request
The first thing you need to use the T-REX Servicing API is to retrieve an authentication token that will allow you to retrieve the data. To do so, simple call the signin
endpoint.
curl --request POST \
--url https://servicing-api-staging.tokeny.com/api/auth/signin \
--header 'Content-Type: application/json' \
--data '{"email":"[email protected]","password":"[email protected]$$word"}'
Response
{
"token": "<jwt>"
}
Validate the transfer feasibility
cURL request
curl 'https://servicing-api-staging.tokeny.com/api/tokens/:token_id/actions/validate-transfer' \
-H 'authorization: Bearer <jwt>' \
-H 'content-type: application/json' \
--data-binary '{
"tokenQuantity":"<quantity>",
"ethereumNetwork":"<network>",
"tokenAddress":"<token_address>",
"senderWallet":"<sender_wallet>",
"recipientWallet":"<recipient_wallet>"
}'
Parameters
token_id
: The identifier of the token in thequantity
: The quantity of tokens to be transferrednetwork
: The network on which to emit the transaction. For testing purpose, useROPSTEN
tokenAddress
: The address of the T-REXsenderWallet
: The wallet sending the T-REXrecipientWallet
: The wallet receiving the T-REX
Response
{
"valid":true
}
Troubleshooting
{
"statusCode": 400,
"timestamp": "2020-12-08T15:58:16.371Z",
"path": "/api/tokens/:token_id/actions/validate-transfer",
"errors": [
{
"target": {
"tokenQuantity": "<quantity>",
"ethereumNetwork": "<network>",
"tokenAddress": "<token_address>",
"senderWallet": "<sender_wallet>",
"recipientWallet": "<recipient_wallet>"
},
"value": "-1",
"property": "tokenQuantity",
"children": [],
"constraints": {
"notContains": "tokenQuantity should not contain a - string"
}
}
],
"message": "error found while validating input data.",
"name": "REST_VALIDATION_ERROR"
}
The errors.constraints
contains the validation errors and the constraint violated by the request.
In errors.property
, you will find the property causing the error.
In errors.target
, you will see your request.
Issue a simple transfer
We currently do not offer an investor endpoint for transfer, as everything is done directly using their wallet (for example, using Metamask).
Though, as an issuer, you can use the forced transfer function.
Force transfer
Authenticate using your issuer account to perform those actions.
cURL request
curl -XPOST 'https://servicing-api-staging.tokeny.com/api/tokens/:token_id/actions/forced-transfer' \
-H 'authorization: Bearer <jwt>' \
-H 'content-type: application/json' \
--data-binary '{
"tokenQuantity":"<quantity>",
"ethereumNetwork":"<network>",
"senderWallet":"<sender_wallet>",
"recipientWallet":"<recipient_wallet>"
}'
Parameters
token_id
: The identifier of the token in thequantity
: The quantity of tokens to be transferrednetwork
: The network on which to emit the transaction. For testing purpose, useROPSTEN
senderWallet
: The wallet sending the T-REXrecipientWallet
: The wallet receiving the T-REX
Response
As a response, you will receive the following structure accompanied with a HTTP 202
code.
{
"transactionId":"<transaction_id>",
"hash":"<transaction_hash>",
"id":"<id>"
}
transactionId
: The id of the transaction in the T-REX Servicing ecosystem (see previous page for more information about transactions)hash
: The ethereum transaction hash. You can use it to check the status of the transaction on Etherscanid
: The id of the operation in the T-REX Servicing ecosystem
Troubleshooting
You will receive an HTTP 400
when the data of the transfer is not valid, with the following structure:
{
"statusCode": 400,
"timestamp": "2020-12-08T15:58:16.371Z",
"path": "/api/tokens/:token_id/actions/validate-transfer",
"errors": [
{
"target": {
"tokenQuantity": "<quantity>",
"ethereumNetwork": "<network>",
"senderWallet": "<sender_wallet>",
"recipientWallet": "<recipient_wallet>"
},
"value": "-1",
"property": "tokenQuantity",
"children": [],
"constraints": {
"notContains": "tokenQuantity should not contain a - string"
}
}
],
"message": "error found while validating input data.",
"name": "REST_VALIDATION_ERROR"
}
The errors.constraints
contains the validation errors and the constraint violated by the request.
In errors.property
, you will find the property causing the error.
In errors.target
, you will see your request.
Updated almost 2 years ago