# Claim UBI (Ethers v5/ React)

{% hint style="warning" %}
Please ensure you have [followed the steps to set up the context provider](/for-developers/developer-guides/ethers-v5-usedapp-context-setup.md) for this SDK.
{% endhint %}

Make sure user wallet is whitelisted, see [Identity](/for-developers/apis-and-sdks/sybil-resistance.md).

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.<br>

{% hint style="info" %}
Every user can claim every day from every chain that has a UBI pool
{% endhint %}

```typescript
import { ClaimSDK } from "@gooddollar/web3sdk-v2"

const sdk = new ClaimSDK(web3provider, "production" | "production-celo")
```

Check if the user is currently eligible to claim today:

```typescript
const claimAmount = await sdk.checkEntitlement() // if claimAmount > 0 user can claim
```

Then, perform claim:

```typescript
await sdk.claim()
```

You can also get the next `Date` when the user will be eligible to claim again

```typescript
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](https://github.com/GoodDollar/GoodWeb3-Mono/blob/master/packages/sdk-v2/src/sdk/claim/react.ts).\
Storybook examples [here](https://github.com/GoodDollar/GoodWeb3-Mono/tree/master/packages/sdk-v2/src/stories/claim).\
You will need to first setup our context provider as explained [here](/for-developers/developer-guides/ethers-v5-usedapp-context-setup.md).

## Win Rewards: Building something on GoodDollar!

There are various ways to earn rewards while working within the GoodDollar Ecosystem.\
\
\&#xNAN;*Scoutgame:*\
Scoutgame rewards builders who take up pre-defined tasks.\
Contribute to GoodDollar repositories and earn bounty rewards!\
More information about the program can be found on our ScoutGame[ page.](https://scoutgame.xyz/info/partner-rewards/gooddollar)\
\
\&#xNAN;*GoodDollar OpenSource Contributors Pool:*\
The GoodDollar OpenSource Contributors pool is for anyone who wants to contribute more autonomously.\
Maybe you have ideas of your own to build into GoodDapp or GoodCollective?\
Maybe you have ideas for expanding the core protocol?\
Please read up on our [GoodDollar OpenSource Contributors](https://app.gardens.fund/gardens/42220/0x62b8b11039fcfe5ab0c56e502b1c372a3d2a9c7a/0xf42c9ca2b10010142e2bac34ebdddb0b82177684/94) covenant on how to participate and apply.\
\
\&#xNAN;*GoodBuilders program:*\
Be sure to check out the [GoodBuilders Program!](https://ubi.gd/goodbuilders) offering mentorship and funding to support promising projects in their growth. Any project that demonstrates meaningful new integrations with the GoodDollar Protocol is eligible to apply!\
\
**Share your ideas, or ask for development support:**\
For discussion on Discord or various program events: [GoodDollar Builders](https://t.me/gooddollarbounties)\
We are also on Discord:  [GoodDollar Discord Development](https://discord.gg/B4bj9eXuWU)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gooddollar.org/for-developers/apis-and-sdks/ubi/claim-ubi-ethers-v5-react.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
