-
Notifications
You must be signed in to change notification settings - Fork 13
Fix: Connected accounts can now claim via whitelisted root (#24) #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
L03TJ3
merged 28 commits into
GoodDollar:main
from
Ryjen1:fix/connected-accounts-claiming-flow
Feb 24, 2026
Merged
Changes from 13 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
5bb6618
fix(citizen-sdk): resolve whitelisted root for connected accounts
Ryjen1 e480b45
docs(citizen-sdk): add connected accounts claiming flow guide
Ryjen1 e5ac108
Adding a standalone script to verify connected account logic off-chain
Ryjen1 9bd79df
Adding documentation for the new connected accounts test script
Ryjen1 c1df3a9
Adding a simple shell script to make running the connected account te…
Ryjen1 e448c83
Updating test script defaults to use a real verified whitelisted address
Ryjen1 d7f059e
chore(citizen-sdk): remove hardcoded test addresses in favor of envir…
Ryjen1 902eddd
chore(citizen-sdk): use zero-address placeholders in test scripts for…
Ryjen1 ccae930
Address PR review feedback
Ryjen1 8d179ce
Implement comprehensive error handling and address all review feedback
Ryjen1 3f0642f
refactor(citizen-sdk): convert connected accounts test to TypeScript …
Ryjen1 edc8094
chore(citizen-sdk): update test runner and docs for TypeScript migration
Ryjen1 efd20d6
chore(citizen-sdk): bump version and add tsx devDependency
Ryjen1 e218df6
Move test files to test directory
0955bef
Chore: Update yarn.lock and cleanup test script
a1f19d2
move tests to main test folder
7e52bd0
add support for connected accounts to claim SDK
0fe046d
add env file for test accounts
a927b9a
chore: final cleanup for connected accounts
547951f
docs: simplify test README
18bde41
chore: fix pre-existing linting errors and add missing config
aca253c
Fix lint issues in engagement app hooks
1cfd097
Refine SDK logic and remove caching
0344180
Migrate tests to Vitest and cleanup old test suite
5096bf4
refactor: use identitySDK directly for root address resolution
f6eb039
build: remove unused tsx dependency and update test script
7442ed9
test: relocate connected accounts tests to package root
6132ef6
feat(demo): support connected accounts in IdentityCard via getWhiteli…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/bin/bash | ||
| # Helper script to run connected accounts tests with example addresses | ||
| # | ||
| # Usage: | ||
| # ./run-test.sh | ||
| # | ||
| # Or with custom addresses: | ||
| # MAIN_ACCOUNT=0x... CONNECTED_ACCOUNT=0x... ./run-test.sh | ||
|
|
||
| # Example test addresses (replace with real ones) | ||
| # These are example addresses - you need to replace them with actual test accounts | ||
| MAIN_ACCOUNT=${MAIN_ACCOUNT:-"0x0000000000000000000000000000000000000000"} | ||
| CONNECTED_ACCOUNT=${CONNECTED_ACCOUNT:-"0x0000000000000000000000000000000000000000"} | ||
| NON_WHITELISTED_ACCOUNT=${NON_WHITELISTED_ACCOUNT:-"0x0000000000000000000000000000000000000000"} | ||
| ENV=${ENV:-"development"} | ||
|
|
||
| echo "🧪 Running Connected Accounts SDK Test (TypeScript)" | ||
| echo "" | ||
| echo "Configuration:" | ||
| echo " Main Account: $MAIN_ACCOUNT" | ||
| echo " Connected Account: $CONNECTED_ACCOUNT" | ||
| echo " Non-Whitelisted: $NON_WHITELISTED_ACCOUNT" | ||
| echo " Environment: $ENV" | ||
| echo "" | ||
|
|
||
| MAIN_ACCOUNT=$MAIN_ACCOUNT \ | ||
| CONNECTED_ACCOUNT=$CONNECTED_ACCOUNT \ | ||
| NON_WHITELISTED_ACCOUNT=$NON_WHITELISTED_ACCOUNT \ | ||
| ENV=$ENV \ | ||
| npx tsx test-connected-accounts.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| # Connected Accounts Test Script | ||
|
|
||
| This directory contains a standalone test script to verify the connected accounts claiming flow works correctly. | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Basic Usage | ||
|
|
||
| ```bash | ||
| npx tsx test-connected-accounts.ts | ||
| ``` | ||
|
|
||
| ### With Environment Variables | ||
|
|
||
| ```bash | ||
| MAIN_ACCOUNT=0x1234... \ | ||
| CONNECTED_ACCOUNT=0x5678... \ | ||
| NON_WHITELISTED_ACCOUNT=0x9abc... \ | ||
| ENV=development \ | ||
| npx tsx test-connected-accounts.ts | ||
| ``` | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| | Variable | Description | Required | Default | | ||
| |----------|-------------|----------|---------| | ||
| | `MAIN_ACCOUNT` | Main whitelisted account address | No | 0x0...0 | | ||
| | `CONNECTED_ACCOUNT` | Account connected to main account | No | 0x0...0 | | ||
| | `NON_WHITELISTED_ACCOUNT` | Non-whitelisted account | No | 0x0...0 | | ||
| | `ENV` | Environment (development/staging/production) | No | development | | ||
| | `RPC_URL` | Custom RPC URL | No | https://forno.celo.org | | ||
|
|
||
| ## What It Tests | ||
|
|
||
| 1. **Main Account Resolution** - Verifies main whitelisted account returns itself as root | ||
| 2. **Connected Account Resolution** - Verifies connected account returns main account as root | ||
| 3. **Non-Whitelisted Account** - Verifies non-whitelisted account returns 0x0 | ||
| 4. **Main Account Entitlement** - Verifies entitlement check works for main account | ||
| 5. **Connected Account Entitlement** - Verifies entitlement check uses root address (simulating SDK behavior) | ||
|
|
||
| ## Example Output | ||
|
|
||
| ``` | ||
| 🧪 Testing Connected Accounts Claiming Flow | ||
|
|
||
| Environment: development | ||
| RPC: https://forno.celo.org | ||
| Identity Contract: 0xF25fA0D4896271228193E782831F6f3CFCcF169C | ||
| UBI Contract: 0x6B86F82293552C3B9FE380FC038A89e0328C7C5f | ||
|
|
||
| Test 1: Main whitelisted account | ||
| ✓ Main account is whitelisted | ||
| Root: 0x1234... | ||
|
|
||
| Test 2: Connected account resolution | ||
| ✓ Connected account resolves to main | ||
| Root: 0x1234... | ||
|
|
||
| Test 3: Non-whitelisted account | ||
| ✓ Non-whitelisted account returns 0x0 | ||
| Root: 0x0000000000000000000000000000000000000000 | ||
|
|
||
| Test 4: Entitlement check (main account) | ||
| ✓ Main account entitlement retrieved | ||
| Entitlement: 1000000000000000000 | ||
|
|
||
| Test 5: Entitlement check (connected account → root) | ||
| ✓ Connected account entitlement via root | ||
| Root: 0x1234..., Entitlement: 1000000000000000000 | ||
|
|
||
| ================================================== | ||
|
|
||
| Test Results: 5/5 passed | ||
|
|
||
| ✅ All tests passed! Connected accounts flow is working correctly. | ||
| ``` | ||
|
|
||
| ## Integration with CI/CD | ||
|
|
||
| Add to your CI pipeline: | ||
|
|
||
| ```yaml | ||
| # .github/workflows/test.yml | ||
| - name: Test Connected Accounts | ||
| run: | | ||
| cd packages/citizen-sdk | ||
| MAIN_ACCOUNT=${{ secrets.TEST_MAIN_ACCOUNT }} \ | ||
| CONNECTED_ACCOUNT=${{ secrets.TEST_CONNECTED_ACCOUNT }} \ | ||
| NON_WHITELISTED_ACCOUNT=${{ secrets.TEST_NON_WHITELISTED }} \ | ||
| ENV=development \ | ||
| node test-connected-accounts.js | ||
| ``` | ||
|
|
||
| ## Notes | ||
|
|
||
| - This script only tests contract interactions, not the full SDK | ||
| - Requires valid test accounts to be set via environment variables | ||
| - Uses read-only contract calls (no transactions) | ||
| - No private key needed (read-only operations) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.