Reward Tokens
Burn Tokens

Burn Tokens

This API endpoint allows you to burn (or destroy) a certain amount of tokens associated with a specific token contract address and account address.

Installation

npm install axios --save

Endpoint

POST /tokens/burn

Request Parameters

The following fields are required in the request body:

  • tokenAddress - The contract address of the token to burn
  • accountAddress - The account address to burn tokens from
  • amount - The amount of tokens to burn

Here's an example request payload:

{
  "tokenAddress": "0x2b7a81EF19a12D214F9563E6c6388a2ef892e09F",
  "accountAddress": "0xB78721b29c028B16ab25f4a2adE1d25fbf8B2d74",
  "amount": "701"
}

Response

If the request is successful, the response will be a 200 OK status code with an empty response body.

If the request is unsuccessful, an appropriate error response will be returned along with the appropriate HTTP status code.

The API will respond with a JSON object containing the following information:

  • burningDetails: Unique identifier for the NFT

Example Response

{
  "burningDetails": "701 tokens successfully burnt from account: 0x1f344b834E2Be81e02A97b06B31fDE585512222 for token: 0xEA3eA1fc21642625f8a07f31304ED821C123449C"
}

Error Responses

In case of an error, the API will respond with a JSON object containing an error message:

{
  "error": "Error message"
}

Conclusion

In conclusion, the Burn Token API allows users to burn a certain amount of tokens associated with a specific token contract address and account address. It requires the token contract address, account address, and the amount of tokens to be burnt as parameters in the request body. If the request is successful, a 200 OK status code will be returned with an empty response body, while an error message will be returned in case of an unsuccessful request.