Emit a simple transfer
The principle of T-REX transfers is that all the validation is performed onchain (compliance and eligibility), 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 "validate transfer" endpoint checks:
- The eligibility, i.e. 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
To leverage the T-REX Servicing API, you will first need to retrieve an authentication token that will allow you to perform this operation. For this use case, please make sure to get an authentication token corresponding to an investor account. If any doubts, please refer to our guide on permissions and roles.
In the testing environment, call the following signin
endpoint:
curl --request POST \
--url https://servicing-api-testing.tokeny.com/api/auth/signin \
--header 'Content-Type: application/json' \
--data '{"email":"[email protected]","password":"MyP@$$word"}'
Response
{
"token": "<jwt>"
}
Validate the transfer feasibility
cURL request
curl 'https://servicing-api-testing.tokeny.com/api/tokens/:token_id/actions/validate-transfer' \
-H 'authorization: Bearer <jwt>' \
-H 'content-type: application/json' \
--data-binary '{
"tokenQuantity":"<quantity>",
"tokenAddress":"<token_address>",
"senderWallet":"<sender_wallet>",
"recipientWallet":"<recipient_wallet>"
}'
Parameters
token_id
: The identifier of the tokenquantity
: The quantity of tokens to be transferredtokenAddress
: 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 agent, you can use the forced transfer function.
Force transfer
Authenticate using your agent account to perform those actions.
cURL request
curl -XPOST 'https://servicing-api-testing.tokeny.com/api/tokens/:token_id/actions/forced-transfer' \
-H 'authorization: Bearer <jwt>' \
-H 'content-type: application/json' \
--data-binary '{
"tokenQuantity":"<quantity>",
"senderWallet":"<sender_wallet>",
"recipientWallet":"<recipient_wallet>"
}'
Parameters
token_id
: The identifier of the token in thequantity
: The quantity of tokens to be transferredsenderWallet
: 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 transaction hash, i.e. the blockchain id. You can find the transaction within the blockchain scanner corresponding to the chain the token is deployed on. Here are the main ones:- Ethereum: https://etherscan.io/tx/:hash
- Ethereum Ropsten (testnet): https://ropsten.etherscan.io/tx/:hash
- Polygon: https://polygonscan.com/tx/:hash
- Polygon Mumbai (testnet): https://mumbai.polygonscan.com/
- Klaytn: https://klaytnfinder.io/
- Klaytn Baobab (testnet): https://baobab.klaytnfinder.io/
- Ethereum: https://etherscan.io/tx/:hash
id
: 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>",
"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 4 months ago