-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Motivation
Users can connect other wallets to their main whitelisted wallet.
effectively, this allows a connected wallet to claim on behalf of the main whitelisted wallet.
We cannot rely on isWhitelisted for a connected account because it will return false.
We need to fix the flow so that claiming is available to connected accounts as well.
getWhitelistedRoot is already used in the sdks, what is not properly done is verifying 'checkEntitlement'
Details
-
Review the flows that rely on claiming and identity sdk and make sure getWhitelistedRoot is properly handled.
returns 0x0 = not connected and not whitelisted
returns input address = is whitelisted and input address is the main whitelisted account
returns a different wallet address then input adddress = connected account. -
Update flows that use checkEntitlement. checkEntitlement check should not be done against the connected address but against the address returned from
.getWhitelistedRoot
Possible affected areas to be reviewed
Claim Flow Refactor – Impact Summary & Tasks
What the code currently does (confirming the whitelist check)
- The claim flow uses
IdentitySDK.getWhitelistedRoot(which calls the IdentityV2getWhitelistedRootcontract method) to determine whitelist status. - There is no usage of a
contract.isWhitelisted(...)method in this repo.
Sections that will be affected by a refactor
Core SDK (claim + identity)
packages/citizen-sdk/src/sdks/viem-identity-sdk.tsgetWhitelistedRoot(...)is the sole whitelist check used by the claim flow.
packages/citizen-sdk/src/sdks/viem-claim-sdk.tsgetWalletClaimStatus()andclaim()callidentitySDK.getWhitelistedRoot(...).checkEntitlement(...)defines how entitlements are resolved and how fallback chains are suggested.nextClaimTime()depends on the entitlement flow.
packages/citizen-sdk/src/constants.ts- Identity ABI (includes
getWhitelistedRoot) and UBI ABI (checkEntitlement) live here.
- Identity ABI (includes
packages/citizen-sdk/src/types.tsWalletClaimStatusshape is referenced by SDKs; may need changes if statuses or flow semantics change.
packages/citizen-sdk/src/sdks/viem-custodial-claim-sdk.ts- Extends
ClaimSDK, so any interface or behavior change inClaimSDKaffects this class.
- Extends
UI / App integrations
packages/ui-components/src/ClaimButton.ts- Calls
checkEntitlement()andnextClaimTime(). - Uses
altClaimAvailable/altChainIdfor suggested chain switching. - Calls
claim()and handles success / timer states based on entitlement results.
- Calls
packages/react-hooks/src/citizen-sdk/wagmi-claim-sdk.ts- Builds
ClaimSDK(depends on identity flow being compatible).
- Builds
apps/demo-identity-app/src/components/ClaimButton.tsx- Uses
checkEntitlement()andclaim()directly; displays alternative chain hints.
- Uses
apps/demo-identity-app/src/App.tsx- Uses
identitySDK.getWhitelistedRoot(...)to set verified / whitelisted UI states.
- Uses
Docs / Guidance
packages/citizen-sdk/README.md- Shows
getWhitelistedRoot(...)and explains the whitelist check.
- Shows
packages/citizen-sdk/README-ClaimSDK.md- Flow diagram and text reference
IdentitySDK.getWhitelistedRoot+checkEntitlement.
- Flow diagram and text reference
packages/react-hooks/README.md- Describes claim usage and mentions
getWhitelistedRoot.
- Describes claim usage and mentions
packages/ui-components/README.md- Explains claim-button behavior; may need updates if flow logic changes.
Built outputs (regenerate after refactor)
packages/ui-components/iife/claim-button.index.js- Generated bundle; should be rebuilt, not edited by hand, if claim flow behavior changes.
Refactor tasks (high level)
-
Confirm the intended whitelist method
- Decide whether we keep
getWhitelistedRoot(current) or switch to a newisWhitelistedcall. - If switching, update Identity ABI and SDK methods accordingly.
- Decide whether we keep
-
Adjust ClaimSDK flow
- Update
getWalletClaimStatus()andclaim()to match new whitelist semantics. - Update
checkEntitlement()if entitlement logic or fallback strategy changes. - Reconcile any return shape changes with
WalletClaimStatusand UI usage.
- Update
-
Update UI state machine assumptions
- Update
ClaimButton(web component + demo app) to align with new status outputs and entitlement logic. - Revisit alt-chain suggestions if fallback logic changes.
- Update
-
Update React hooks behavior if needed
- Ensure
useClaimSDKhandles any new init requirements and preserves error/loading behavior.
- Ensure
-
Docs and examples
- Update README flow diagrams and example snippets to reflect the new whitelist and entitlement steps.
-
Validation
- Manually exercise the demo claim flow (or add tests) to confirm:
- whitelist/identity gating works
- entitlement calculation matches expectations
- fallback chain suggestion is accurate
- claim + faucet behavior still matches product expectations
- Manually exercise the demo claim flow (or add tests) to confirm:
Metadata
Metadata
Assignees
Labels
Type
Projects
Status