Repository navigation
feat(react): trigger automated balance and role polling on wallet con… - #1295
Open
adams813 wants to merge 1 commit into
Conversation
|
@adams813 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Author
|
@p3ris0n , pls review pr |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements automated eager balance and RBAC role polling when a wallet transitions to the
'connected'state.Closes #1179
Closes #1178
Closes #1177
Closes #1176
Changes Made
react/src/hooks.ts):useBalance(address?, options?)to automatically subscribe touseWallet()when no explicitaddressis passed, dispatching eager concurrent queries for both the forge token balance and native XLM balance immediately upon transitioning to'connected'.useWalletBalancePolling(options?)hook to eagerly fetch and periodically poll forge token balances, native XLM balances, and RBACRoleHierarchy(getRoleHierarchy) while connected (defaulting toDEFAULT_BALANCE_POLL_INTERVAL_MS = 15_000).isValidStellarAddress()to validate StellarG...andC...addresses prior to RPC invocation.withRpcTimeout()guard (DEFAULT_BALANCE_TIMEOUT_MS = 10_000) to prevent hung Soroban RPC requests.'wrong-network'/'error'.alertMessageviaparseWalletError()for seamless integration with UI<Alert>components.react/src/hooks.test.tsx):react/README.md):useWalletBalancePollingandisValidStellarAddressexports.Acceptance Criteria Checklist
UseBalanceOptions,WalletBalancesSnapshot,UseBalanceResult) and exports with strict TypeScript compliance.Testing
npm run build --workspace @bc-forge/sdk npm test --workspace @bc-forge/react npm run build --workspace @bc