Feature and its Use Cases
The widget currently initializes transaction state and fetches quote-related data in more than one component.
Both TokenDropdown.jsx and TransactionReview.jsx instantiate Transaction, call init(), and in native-token flows may fetch quote data separately.
Why this matters:
- unnecessary duplicate RPC calls for the same network/token selection
- harder-to-maintain state flow
- greater risk of inconsistent quote or transaction state across components
- makes future additions like preflight validation, allowance checks, and multi-Djed support harder
Expected outcome:
- transaction initialization and quote fetching should be owned by a single layer
- components should consume normalized shared state instead of rebuilding it independently
- the widget should perform one consistent initialization flow per network/token selection
Additional Context
Current evidence from the code:
stablepay-sdk/src/widget/TokenDropdown.jsx initializes Transaction and may fetch trade data during token selection
stablepay-sdk/src/widget/TransactionReview.jsx repeats transaction initialization and quote fetching in its own effect
A cleaner design would move this into context and expose:
- loading state
- quote state
- normalized transaction details
- initialization errors
This would also pair well with current and future payment-flow work like stablecoin balance checks, fee configuration cleanup, and support for additional Djed variants.
Code of Conduct
Feature and its Use Cases
The widget currently initializes transaction state and fetches quote-related data in more than one component.
Both
TokenDropdown.jsxandTransactionReview.jsxinstantiateTransaction, callinit(), and in native-token flows may fetch quote data separately.Why this matters:
Expected outcome:
Additional Context
Current evidence from the code:
stablepay-sdk/src/widget/TokenDropdown.jsxinitializesTransactionand may fetch trade data during token selectionstablepay-sdk/src/widget/TransactionReview.jsxrepeats transaction initialization and quote fetching in its own effectA cleaner design would move this into context and expose:
This would also pair well with current and future payment-flow work like stablecoin balance checks, fee configuration cleanup, and support for additional Djed variants.
Code of Conduct