The Claim SDK enables developers to integrate Universal Basic Income (UBI) claiming functionality into their applications, allowing users to claim GoodDollars (G$) on supported blockchain networks like Celo and Fuse. Built to work seamlessly with the GoodDollar protocol, it relies on the Identity SDK for whitelisting checks and supports both Wagmi (for React) and Viem (for non-React) environments.
Installation
To use the Claim SDK, install the @goodsdks/citizen-sdk package, which includes the necessary components:
npm install @goodsdks/citizen-sdk
Or with Yarn:
yarn add @goodsdks/citizen-sdk
Available Methods
The ClaimSDK class provides the following methods:
Refer to the package documentation for detailed information on each method, including parameters and return types. <todo: add link after PR merge>
Using the Wagmi SDK
The Claim SDK integrates with Wagmi for React applications, leveraging the useIdentitySDK hook for easy setup. Below is an example of initializing the SDK and performing basic operations like checking eligibility and claiming UBI.
For a more comprehensive example, including state management and user feedback, see <link to demo app>
Using the Viem SDK
For non-React environments or backend services, the Viem-based Claim SDK offers a straightforward way to interact with the UBI Scheme Contract. The ClaimSDK.init the method simplifies initialization.