[FEATURE]: Centralize transaction initialization and quote fetching to avoid duplicate RPC calls in the widget

Aperta
#101 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

@CaptainLevi2k04 ci sta già lavorando.

Dal 1/9/2026.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript, react

Direzione di ricerca

Read stablepay-sdk/src/widget/TokenDropdown.jsx and stablepay-sdk/src/widget/TransactionReview.jsx to trace the duplicate Transaction initialization and quote fetching. Then inspect the widget context entry point to see how shared state is exposed. Done means initialization and quote fetching have a single owner and both components consume the same normalized state.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
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
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
Lingua principale
JavaScript
Stelle
16
Fork
29
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di StabilityNexus/StablePay

Tutte le issue di StabilityNexus/StablePay

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.