Claim UBI

Every verified person is eligible to claim daily free UBI in the form of G$ tokens.

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.

Every user can claim every day from every chain that has a UBI pool

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.

Need a hand?

Fill out this form to request support:

Last updated