🔐

[Async] POST /tokens/:tokenId/burn

Asynchronously burn a token
This endpoint allows a token owner to burn that token.

Caveat

  • This endpoint requires an API key. Refer to the Authentication doc for more info.
  • This endpoint also is an asynchronous endpoint, which means the initial call does not return the response immediately. Please refer to the Async Endpoint doc for more information about how to use these APIs.

Body

Field
Type
Description
burningAddress
string
The ETH address that owns the token to be burned.
signature
string
Signature that proves that the owning address signed the relevant information to burn the token. More info on how to generate the signature below.

How to generate the burn Kudos signature

What am I signing?

Using your Ethereum account’s private key, you are signing that you are trying to burn your token of tokenId. You can only do this if you own the token in question.

Signing with Ethers.js

const burnTypes = {
Burn: [
{ name: "tokenId", type: "uint256" },
],
};
// The data to sign
const value = {
tokenId: tokenId, // mandatory
};
// Domain info (if you're using the sandbox environment)
const domainInfo = {
name: 'Kudos',
// Mumbai
chainId: 80001,
verifyingContract: "0xB876baF8F69cD35fb96A17a599b070FBdD18A6a1"
};
// Domain info (if you're using the production environment)
const domainInfo = {
name: 'Kudos',
// Polygon - comment this out if you're on Mumbai
chainId: 137,
verifyingContract: "0x60576A64851C5B42e8c57E3E4A5cF3CF4eEb2ED6"
};
// Get signer
const provider = new ethers.providers.JsonRpcProvider(/* constructor params */);
const signer = provider.getSigner(/* address */);
// Obtain signatures
const burnSignature: string = await adminSigner._signTypedData(domainInfo, burnTypes, value);

Example Response

// status
202 Created
// header
Location: /v1/operations/dc3a7730-53e2-4af6-acc9-d13b2fcf10e2
// body
{}