Skip to content

GoodDollar/GoodSDKs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

GoodDollar SDKs

Welcome to the GoodDollar SDKs, a comprehensive collection of libraries and tools designed to integrate the GoodDollar Protocol into your applications. This monorepo provides everything you need to work with GoodDollar's Identity verification and Universal Basic Income (UBI) claiming systems.

๐ŸŽฏ What is GoodDollar?

GoodDollar is a protocol that aims to reduce wealth inequality through blockchain technology by providing Universal Basic Income (UBI) to verified users. The protocol uses identity verification to ensure fair distribution of G$ tokens.

๐Ÿ“‹ Overview

The GoodSDK's Monorepo is structured to facilitate seamless development, testing, and deployment of identity-related functionalities across various applications. By centralizing shared packages and utilities, it ensures consistency and reusability, reducing redundancy and enhancing maintainability.

Key Components

  • Packages: Reusable libraries and SDKs that provide core functionalities.
  • Applications: Frontend and backend applications that utilize the packages to deliver complete solutions.

๐Ÿ“ฆ SDK Components

1. Identity SDK (@goodsdks/citizen-sdk)

The Identity SDK provides tools for managing user identity verification and whitelist status. It's the foundation for all GoodDollar integrations.

Key Features:

  • โœ… Identity verification and whitelist management
  • โœ… Face verification link generation
  • โœ… Identity expiry tracking
  • โœ… Support for both Wagmi (React) and Viem (backend) integrations

Use Cases:

  • Verify user identity before allowing UBI claims
  • Check whitelist status for access control
  • Generate face verification links for new users

2. Claim SDK (@goodsdks/citizen-sdk)

The Claim SDK is part of the same @goodsdks/citizen-sdk package and handles Universal Basic Income (UBI) claiming functionality. It works in conjunction with the Identity SDK to ensure only verified users can claim their daily UBI.

Key Features:

  • โœ… Daily UBI claiming with automatic balance checks
  • โœ… Entitlement verification
  • โœ… Next claim time tracking
  • โœ… Daily statistics

Use Cases:

  • Allow verified users to claim their daily UBI
  • Show users when they can next claim
  • Display claiming statistics

๐Ÿ”„ Claim Flow Logic

The GoodDollar SDK implements a sophisticated claim flow that ensures fair and secure UBI distribution:

Flow States:

  1. ๐Ÿ” Verify Button - When user is NOT whitelisted

    • User needs to complete identity verification
    • Shows "Verify Me" button
    • Redirects to face verification process
  2. โฐ Timer State - When user is whitelisted but already claimed

    • User has already claimed UBI for the current period
    • Shows countdown to next claim time
    • Displays "Come back tomorrow to claim your UBI!"
  3. ๐Ÿ’ฐ Claim Button - When user is whitelisted and can claim

    • User is verified and eligible for UBI
    • Shows claimable amount
    • Displays "Claim UBI [amount]" button

For complete implementation details and code examples, see our Claim Flow Implementation Guide.

๐Ÿš€ Quick Start

Installation

npm install @goodsdks/citizen-sdk
# or
yarn add @goodsdks/citizen-sdk

Basic Usage

import { useIdentitySDK, useClaimSDK } from '@goodsdks/citizen-sdk';

function App() {
  const identitySDK = useIdentitySDK('production');
  const claimSDK = useClaimSDK('production');
  
  // Check if user is whitelisted
  const checkWhitelist = async (address: string) => {
    const { isWhitelisted } = await identitySDK.getWhitelistedRoot(address);
    return isWhitelisted;
  };
  
  // Claim UBI
  const claimUBI = async () => {
    const receipt = await claimSDK.claim();
    console.log('UBI claimed!', receipt);
  };
  
  return (
    <div>
      {/* Your UI components */}
    </div>
  );
}

๐Ÿ“š Documentation

๐ŸŽฎ Live Demos

๐Ÿ› ๏ธ Development

Prerequisites

  • Node.js >= 18
  • Yarn package manager

Setup

# Clone the repository
git clone https://github.com/GoodDollar/GoodSDKs.git
cd GoodSDKs

# Install dependencies
yarn install --immutable

# Build all packages
yarn build

# Start development server
cd apps/demo-identity-app
yarn dev

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Getting Started with Contributions

  1. Fork and clone the repository
  2. Create a feature branch for your work
  3. Make your changes following the existing patterns
  4. Test thoroughly using the demo applications
  5. Submit a pull request with clear descriptions

Scoutgame Rewards

We offer rewards for contributions through our Scoutgame Program. Look for issues labeled with scoutgame to get started!

๐ŸŒ Community

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7