Minting tokens to qualified investors

Once your investors have been qualified, you can increase the total supply of existing tokens by minting new tokens to selected investors.

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":"MyP@$$word"}'

Response

{
    "token": "<jwt>"
}

Mint tokens to an array of wallets with the ONCHAINID Wallet

This endpoint lets the Agent mint tokens with a built-in integrated Wallet.

cURL request

curl 'https://servicing-api-staging.tokeny.com/api/tokens/:token_id/actions/mint/batch' \
  -H 'authorization: Bearer <jwt>' \
  -H 'content-type: application/json' \
  --data-binary '{
   "ethereumNetwork":"MUMBAI",
   "transactions":[
      {
         "address":"<receiver_wallet>",
         "amount":"<amount_of_tokens>"
      }
   ]
}' \
  --compressed

Parameters

  • token_id: The identifier of the T-REX
  • jwt: The authentication token
  • ethereumNetwork: The network on which to emit the transactions. Use MUMBAI for the testing environment.
  • transactions: The list of transactions. One object per minting operation, composed of:
    • address: The wallet address of the receiver
    • amount: The amount of tokens to mint, with the decimals. For example, if your token has 2 decimals and you want to mint 100 tokens, input 100.00.

Response

{
   "transactionId":"e0f44ff4-3a9b-41b4-aa29-15f134fd2d91",
   "hash":"0xcff8e6115c853a4eaa17f4087b1c89858d6400d580d226fa9ba4ddea5fdfa691",
   "id":"044f46a0-afe8-48b7-a1e0-e52eedeeb562"
}
  • transactionId: The identifier of the transaction in the T-REX Servicing ecosystem
  • hash: The hash of the transaction on the blockchain. You can see it on etherscan by accessing this URL: https://ropsten.etherscan.io/tx/:hash

Troubleshooting

{
   "statusCode":502,
   "timestamp":"2020-12-10T13:48:24.125Z",
   "path":"/api/tokens/:token_id/actions/mint/batch",
   "errors":[
      {
         "statusCode":402,
         "timestamp":"2020-12-10T13:48:24.110Z",
        "path":"/api/v1/token/:token_address/wallet/mint",
         "message":"Identity is not compliant with token.",
         "name":"REST_IDENTITY_NOT_COMPLIANT"
      }
   ],
   "message":"The call to the TREX Service API endpoint raised an error: Identity is not compliant with token.",
   "name":"REST_BAD_GATEWAY_ERROR",
   "stack":"Error: The call to the TREX Service API endpoint raised an error: Identity is not compliant with token.
}

The errors array will give you a list of all errors found in the input of your import. Consult the message field to get more information about the content of the error.
Identity not compliance with token means that you are trying to mint tokens to an investor that:

  • Don't have an ONCHAINID
  • Don't have the right claim on their ONCHAINID
  • Are not registered in the T-REX
  • Are from a non-compliant country as defined in the Compliance smart contract attached to the T-REX

To fix the first three points, please refer to the Qualify new investors page.

Mint tokens to an array of wallets with an external wallet

This endpoint lets you perform a minting with your own wallet.

cURL request

curl 'https://servicing-api-testing.tokeny.com/api/tokens/:token_id/actions/validate/mint' \
  -H 'authorization: Bearer <jwt>' \
  -H 'content-type: application/json' \
  --data-binary '{
   "ethereumNetwork":"MUMBAI",
   "transactions":[
      {
         "address":"<receiver_wallet>",
         "amount":"<amount_of_tokens>"
     }
   ]
}' \
  --compressed

Parameters

  • token_id: The identifier of the T-REX
  • jwt: The authentication token
  • ethereumNetwork: The network on which to emit the transactions. Use MUMBAI for the testing environment. Visit Choosing your network to know which value you should put here.
  • transactions: The list of transactions. One object per minting operation, composed of:
    • address: The wallet address of the receiver
    • amount: The amount of tokens to mint, with the decimals. For example, if your token has 2 decimals and you want to mint 100 tokens, input 100.00.

Response

{
   "gasEstimation":":gas_estimation",
   "transactionData":":data"
}

Where:

  • gas_estimation is an estimation of the cost of the transaction
  • data is the payload of the transaction to be emitted on the blockchain, using your own wallet.

Troubleshooting

{
   "statusCode":400,
   "timestamp":"2021-12-24T10:40:42.754Z",
   "path":"/api/v1/token/:token_address/wallets/validation/mint",
   "errors":[
      "Wallet :wallet_address is not registered in token :token_address",
      "Wallet :wallet_address is not compliant in token :token_address"
   ],
   "message":"Validate batch mint request failed due to invalid data.",
   "name":"REST_VALIDATION_ERROR"
}

If your minting operation is not compliant with the token rules (wallet not registered for example), you will receive this error message, where errors contains the list of issues in your batch request.