Merkle Distributions
Functionalities that allow users to claim a Merkle distribution.
Introduction
Functionalities that allow users to claim a Merkle distribution. A comprehensive example may be found here: merkleClaimExample.tsx
merkleClaim
This function allows a user to claim a distribution and requires data from our API to create the proofs and fetch the hashes. E.g.https://api.sevenseas.capital/usual-bera/ethereum/merkle/0xbDAc05564bB5D299A0aeF8bB81D1f2701364193D
Inputs
- signer: an ethers
JsonRPCSigner
. If you are using viem, you may use this example to create an ethers signer out of a viem wallet client: ethers.tsx - merkleData: the relevant metadata needed to complete a claim. All data can be fetched from our API.
- rootHashes: a list of relevant hashes to claim
- tokens: list of rewards token addresses mapped to each claim
- balances: list of balances to claim per reward
- merkleProofs: list of proofs
Outputs
- A promise that returns a
MerkleClaimStatus
- initiated: boolean representing if the claim function has been called and is in progress of being executed
- loading: boolean representing if there is a relevant claim transaction ongoing
- success (optional): boolean representing if the claim action succeeded
- error (optional): string representing why a claim failed
- tx_hash (optional): the string of a successful claim transaction hash
Example
checkClaimStatuses
This object returns an array of relevant metadata for a users claims. Input data can be gleaned from our API as mentioned above.
Inputs
- address: address of the user
- rootHashes: a list of root hashes to check
- balances: a list of balances corresponding to each root has
Outputs
- Returns relevant metadata in an array
- rootHash: the relevant root hash
- claimed: a boolean of if the root hash has been claimed or not
- balance: the balance of the reward at the root hash