Creating a Token Claim using the Hedgey APIs

Reference: The Hedgey smart contract for token claims.

The token claim contract uses a merkle tree to efficiently manage many thousands of addresses and amounts that can claim.

This merkle tree can be created manually using something like the following library

Or the Hedgey API can be used, if the API is used a CSV file is uploaded and Hedgey will manage the process of creating the merkle tree and storing the proofs (which are needed for claiming).

Make a POST request to the content type should multipart form data, this should include a uuid (generated by the client), the csv data, decimals (the number of decimals the token uses) and endDate (the date the token claim is to end)

The CSV file should contain a list with two columns: address and amount:


This endpoint will return the following response on success:


Below is an example of using FormData to build up the request and post it.

const id = uuidv4();

const formData = new FormData();
formData.append('uuid', id);
if (!file) {
  throw new Error('No file provided');

formData.append('csv', file);
if (decimals) {
  formData.append('decimals', decimals.toString());

if (endDate) {
  formData.append('endDate', getUnixTime(new Date(endDate)).toString());

try {
  const response = await fetch(endpointURL, {
    method: 'POST',
    body: formData,

  if (!response.ok) {
    throw new Error('Unable to verify recipient list from Campaign Verification service');

When this request has been done the root can be used in the web3 call to create the token claim.

Last updated