Updating a non-deployed T-REX

The T-REX Factory API allows you to update the information of your T-REX as long as it is not yet deployed. After deployment, the information are read-only.

Authentication

The first step to use the T-REX Factory is to authenticate thanks to the account that has been assigned to you by your account manager. If you don't have any account, please contact your account manager or [email protected].

To authenticate, use the following cURL snippet. Don't forget to replace with your own credentials.

curl -XPOST 'https://servicing-api-staging.tokeny.com/api/auth/signin' \
  -H 'Content-Type: application/json'
  --data '{"email":"[email protected]","password":"My-p@$$w0rd"}'

Update the basic T-REX information

You can update the basic information of the T-REX (token name, token symbol and number of decimals) by calling the following endpoint.

cURL

curl 'https://trex-factory-api-staging.tokeny.com/api/tokens/<token_id>' \
  -X 'PUT' \
  -H 'authorization: Bearer <jwt>' \
  -H 'content-type: application/json' \
  -H 'accept: */*' \
  --data-binary '{"name":"<token_name>","symbol":"<token_symbol>","decimals":<token_decimals>,"securityId":null}' \
  --compressed

Parameters

  • token_id: The identifier of the token
  • jwt: The authorization token from the authentication endpoint
  • token_name: The updated name of the token
  • token_symbol: The updated symbol of the token
  • token_decimals: The updated number of decimals

Response

  • 204 if everything went well

Troubleshooting

The format of the error message is the following:

{
    "code":"E_TOKEN_DECIMALS_NOT_INTEGER"
    "message":"Token decimals is not an integer"
}

You can receive the following HTTP error codes:

  • 400 with code:
    • E_TOKEN_NAME_NOT_ALPHANUMERIC: you have unauthorized character(s) in your token name. Make sure you are not introducing any special character in it.
    • E_TOKEN_SYMBOL_NOT_ALPHANUMBERIC: you have unauthorized character(s) in your token symbol (ticker). Make you are not introducing any special character in it.
    • E_TOKEN_DECIMALS_NEGATIVE: you have input a negative number of decimals which is not allowed
    • E_TOKEN_DECIMALS_TOO_HIGH: you have input a number of decimals which exceeds the limit of 18
    • E_TOKEN_DECIMALS_NOT_INTEGER : you have input a non-numeric number of decimals
    • E_TOKEN_NAME_TOO_LONG: The length of the name of the token exceeds the maximum limit of 32 characters
    • E_TOKEN_SYMBOL_TOO_SHORT: The length of the symbol of the token is too short (minimum is 2 characters)
    • E_TOKEN_SYMBOL_TOO_LONG: The length of the symbol of the token exceeds the maximum limit of 32 characters
  • 401 with code:
    • E_UNAUTHORIZED: you are not authenticated or your authentication has expired. Please authenticate again. If error persists, please open a ticket on the support website.
  • 404 with code:
    • E_TOKEN_NOT_FOUND: The token you are trying to update does not exist. Verify the token_id parameter.
  • 500 with code
    • E_INTERNAL_ERROR: An internal server error happened. Please retrieve the correlation_id from the header response and open a ticket on the support website.

Update the compliance smart contract

The compliance smart contract can be updated by calling the same endpoint as for the creation, except using a PUT method instead of POST.

cURL

curl -XPUT 'https://trex-factory-api-staging.tokeny.com/api/tokens/<token_id>/compliance' \
  -H 'authorization: Bearer <jwt>' \
  -H 'content-type: application/json' \
  -H 'accept: */*' \
  --data-binary '{"complianceSmartContractAddress":<compliance_address>}' \
  --compressed

Parameters

  • token_id: The identifier of the token
  • jwt: The authorization token from the authentication endpoint
  • compliance_address: The compliance smart contract address (or null to the default compliance)

Reponse

  • 204 if everything went well

Troubleshooting

The format of the error message is the following:

{
    "code":"E_UNAUTHORIZED"
    "message":"Authentication is wrong"
}

You can receive the following HTTP error codes:

  • 400 with code:
    • E_ETHEREUM_ADDRESS_INVALID: the smart contract address specified is not a valid ethereum address.
  • 401 with code:
    • E_UNAUTHORIZED: you are not authenticated or your authentication has expired. Please authenticate again. If error persists, please open a ticket on the support website.
  • 404 with code:
    • E_TOKEN_NOT_FOUND: The token you are trying to update does not exist. Verify the token_id parameter.
  • 500 with code
    • E_INTERNAL_ERROR: An internal server error happened. Please retrieve the correlation_id from the header response and open a ticket on the support website.

Update the identity storage smart contract

The compliance smart contract can be updated by calling the same endpoint as for the creation, except using a PUT method instead of POST.

cURL

curl -XPUT 'https://trex-factory-api-staging.tokeny.com/api/tokens/<token_id>/identityStorage' \
  -H 'authority: trex-factory-api-develop.tokeny.com' \
  -H 'authorization: Bearer <jwt>' \
  -H 'content-type: application/json' \
  -H 'accept: */*' \
  --data-binary '{"identityStorageSmartContractAddress":<identity_address>}' \
  --compressed

Parameters

  • token_id: The identifier of the token
  • jwt: The authorization token from the authentication endpoint
  • identity_address: The compliance smart contract address (or null to the default compliance)

Reponse

  • 204 if everything went well

Troubleshooting

The format of the error message is the following:

{
   "code":"E_UNAUTHORIZED"
   "message":"Authentication is wrong"
}

You can receive the following HTTP error codes:

  • 400 with code:
    • E_ETHEREUM_ADDRESS_INVALID: the smart contract address specified is not a valid ethereum address.
  • 401 with code:
    • E_UNAUTHORIZED: you are not authenticated or your authentication has expired. Please authenticate again. If error persists, please open a ticket on the support website.
  • 404 with code:
    • E_TOKEN_NOT_FOUND: The token you are trying to update does not exist. Verify the token_id parameter.
  • 500 with code
    • E_INTERNAL_ERROR: An internal server error happened. Please retrieve the correlation_id from the header response and open a ticket on the support website.