🔐
[Async] POST /tokens/:tokenId/claim
Asynchronously claim an existing Kudos token on behalf of the user
This endpoint exists to claim a Kudos with consent from the claimer (the user) in the form of a signature signed by their wallet.
- 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.
Field | Type | Description |
---|---|---|
claimingAddress | string | The ETH address that is trying to claim the token. The signature generated should be signed by this claiming address, and it should be on the allowlist of the Kudos token. |
signature | string | Signature that proves that the creator address signed the relevant information to claim the Kudos token.
More info on how to generate the signature below. |
Using your Ethereum account’s private key, you are signing the
tokenId
of an existing Kudos token that you are the creator of. This helps us make sure that the claimingAddress
is who they really say they are, and that the claimingAddress
is definitely asking to claim an existing Kudos token.const types = {
Claim: [
{ 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 signature
const signature: string = await signer._signTypedData(domainInfo, types, value);
// status
202 Created
// header
Location: /v1/operations/dc3a7730-53e2-4af6-acc9-d13b2fcf10e2
// body
{}
Last modified 4mo ago