Claim UBI (Ethers v5/ React)
Every verified person is eligible to claim daily free UBI in the form of G$ tokens.
Please ensure you have followed the steps to set up the context provider for this SDK.
Make sure user wallet is whitelisted, see Identity.
First, create the SDK. The first argument should be an ethers Web3Provider, since the user will need to sign transactions. Second argument is which environment and chain contract set to use.
import { ClaimSDK } from "@gooddollar/web3sdk-v2"
const sdk = new ClaimSDK(web3provider, "production" | "production-celo")
Check if the user is currently eligible to claim today:
const claimAmount = await sdk.checkEntitlement() // if claimAmount > 0 user can claim
Then, perform claim:
await sdk.claim()
You can also get the next Date
when the user will be eligible to claim again
const nextClaimTime = await sdk.getNextClaimTime()
React hooks
You can also use our react hooks to manage claim.
See the Claim/Identity react hooks code here. Storybook examples here. You will need to first setup our context provider as explained here.
Win Rewards: Building something on GoodDollar!
Share your ideas, or ask for development support. Be sure to check out the GoodBuilders Program! For discussion on Discord or various program events: GoodDollar Discord Development We are also on Telegram: GoodDollar Builders
Last updated
Was this helpful?