Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The custom bridge adds retries on top of the fallback transport’s existing policy, multiplying RPC requests and delaying the widget’s error state when endpoints are unreachable or rate-limited.
1 open issue
What changed in this PR
Adopts core’s createViemFallbackClient across selected widget read clients and the Storybook custodial fixture for #167, while retaining provider-backed signing and primary RPC ordering.
Changes:
- Migrates GoodReserve, Streaming, Citizen Claim, and Staking Migration read clients to fallback-enabled construction.
- Updates custodial fixture clients and binds transactions to the selected client’s chain.
- Makes Citizen Claim error tests block deterministic discovered RPCs alongside primary endpoints.
| File | Description |
|---|---|
tests/widgets/citizen-claim-widget/states.spec.ts |
Controls RPC discovery and blocks fallback endpoints in error tests. |
packages/streaming-widget/src/adapter/useStreamingClients.ts |
Uses fallback-enabled reads while preserving wallet transport. |
packages/streaming-widget/src/adapter/chains.ts |
Adds fallback client builders with a synchronous public-client interface. |
packages/staking-migration-widget/src/adapter.ts |
Uses asynchronous fallback clients for Fuse reads and receipts. |
packages/goodreserve-widget/src/useReserveBootstrap.ts |
Initializes reserve reads through the fallback helper. |
packages/citizen-claim-widget/src/adapter.ts |
Migrates read clients and awaits their construction. |
examples/storybook/src/fixtures/custodialEip1193.ts |
Adds fallback clients and preserves transaction chain binding. |
Review effort: Balanced
| transport: custom({ | ||
| async request(args) { | ||
| const resolved = await clientPromise | ||
| return resolved.transport.request(args) | ||
| }, | ||
| }), |
There was a problem hiding this comment.
Applied in commit 92a18dd: configured retryCount: 0 on the forwarding custom transport in packages/streaming-widget/src/adapter/chains.ts so the resolved fallback transport exclusively manages retries without duplication.
92a18dd to
975812f
Compare
… and make RPC error tests deterministic
…id duplicate RPC attempts Configure retryCount: 0 on custom bridge transport forwarding to createStreamingFallbackClient so viem's default outer retry policy does not duplicate the underlying fallback transport's retry policy, preventing request multiplication and delays in error state.
975812f to
c7431ec
Compare
Linked issuesChecked at commit 56c2bd8 #167 Adopt createViemFallbackClient in manual viem client call sites · 4 of 5 met
|
…GoodDollar#167) Remove explicit rank: false overrides so createViemFallbackClient enables ranking by measured health across all adopted widgets as required by GoodDollar#167. Signed-off-by: deamybro <deamybro@users.noreply.github.com> Payout: 0x759797593fed8f313d8fdba7a3a0d491f0e4b9f7 (USDC on Base L2)
| await page.route('https://forno.celo.org/**', (route) => route.abort()) | ||
| await page.route('https://rpc.fuse.io/**', (route) => route.abort()) | ||
| await page.route('https://rpc.ankr.com/**', (route) => route.abort()) | ||
| // Seed deterministic Chainlist discovery and block all primary + fallback RPC endpoints |
There was a problem hiding this comment.
🟡 Medium · Missing client-path tests
The changed test makes Citizen Claim's RPC-error path deterministic, but the adopted Reserve, Streaming, Staking Migration, and Storybook client-construction paths have no targeted tests in this diff.
Prompt for AI agents
In `tests/widgets/citizen-claim-widget/states.spec.ts` at line 207:
**Missing client-path tests**
The changed test makes Citizen Claim's RPC-error path deterministic, but the adopted Reserve, Streaming, Staking Migration, and Storybook client-construction paths have no targeted tests in this diff.From #167:
Keep existing tests passing and add targeted tests for adopted client-construction paths.
Resolves #167
Summary
Adopts
createViemFallbackClientfrom@goodwidget/coreacross remaining manualhttp()viem read-client call sites while preserving provider-backedcustom(provider)wallet clients and explicit RPC override precedence:packages/goodreserve-widget/src/useReserveBootstrap.ts:createPublicClient({ chain, transport: http() })inbootstrapSdkwithcreateReserveFallbackClient().createPublicClient({ chain })(rank: false, tracked chains[CELO_CHAIN_ID, XDC_CHAIN_ID]).walletClientoncustom(provider).packages/streaming-widget/src/adapter/chains.ts&useStreamingClients.ts:createStreamingFallbackClient()andcreateStreamingPublicClient(chain, fallbackRpcs)backed bycreateViemFallbackClientwith chain default RPCs as primaryfallbackRpcs.createBasePublicClient()anduseStreamingClients()to usecreateStreamingPublicClient(...)while keepingwalletClientoncustom(provider).packages/citizen-claim-widget/src/adapter.ts:http(rpcUrl)read clients ingetPublicClientForChain()andcreateReadOnlyClientsForChain()withcreateCitizenClaimFallbackClient()while leaving custodial and integrator-suppliedclientFactorybundles untouched.packages/staking-migration-widget/src/adapter.ts:http(...)public client withcreateStakingMigrationFallbackClient().createPublicClient({ chain: FUSE_CHAIN, fallbackRpcs })while keepingwalletClientoncustom(provider).examples/storybook/src/fixtures/custodialEip1193.ts:http(config.rpcUrl)public and wallet clients withcreateCustodialFallbackClient()keepingconfig.rpcUrlas primaryfallbackRpcs.sendTransactionchain binding to selected client and ensures deterministic RPC error testing.Verification
@goodwidget/coreunit tests (pnpm --filter @goodwidget/core test— all 17 tests pass).@goodwidget/goodreserve-widget,@goodwidget/streaming-widget,@goodwidget/citizen-claim-widget,@goodwidget/staking-migration-widget).Summary by Sourcery
Adopt shared Viem fallback clients across widget read paths while preserving existing wallet-provider integrations and RPC override behavior.
Bug Fixes:
Enhancements:
Tests: