Skip to content

Conversation

Copy link

Copilot AI commented Sep 12, 2025

Successfully refactored the assets management page (/dashboard/assets) to use Stellar RPC API instead of the deprecated Horizon API, following the patterns from stellar/stellar-docs#1775.

Changes Made

Assets Page (src/routes/dashboard/assets/+page.svelte)

  • Replaced Horizon submit import with local RPC-based implementation using @stellar/stellar-sdk/rpc
  • Added comprehensive RPC server configuration and transaction submission logic
  • Implemented proper transaction polling with status handling for PENDING, SUCCESS, FAILED, and NOT_FOUND states
  • Added detailed error handling with result XDR inclusion for failed transactions

Transaction Module (src/lib/stellar/transactions.js)

  • Updated createChangeTrustTransaction to use RPC Server.getAccount() instead of Horizon loadAccount()
  • Added RPC server import and configuration while maintaining backward compatibility
  • Preserved existing function interface for seamless integration

Balance Data Migration

  • Created RPC-based account and balance fetching functions (fetchAccountRPC, fetchAccountBalancesRPC) in src/lib/stellar/horizonQueries.js
  • Updated dashboard layout (src/routes/dashboard/+layout.js) to use RPC for balance queries supporting the assets page
  • Maintained existing Horizon functions for other parts of the application

Key Features

  • Complete RPC Integration: All asset management flows (adding/removing trustlines, showing balances) now use Stellar RPC API
  • Transaction Polling: Proper asynchronous transaction submission with polling using the RPC server
  • Error Handling: Comprehensive error handling for different transaction states with detailed error messages
  • Backward Compatibility: Changes are surgical and don't affect other parts of the application

Testing

  • ✅ TypeScript compilation passes
  • ✅ Build process completes successfully
  • ✅ Dev server starts without errors
  • ✅ All asset management functionality uses RPC endpoints
  • ✅ UI components remain compatible with RPC data formats

The implementation follows the exact patterns from the referenced stellar-docs PR #1775, ensuring consistency with recommended RPC usage patterns for Stellar applications.

This pull request was created as a result of the following prompt from Copilot chat.

Update the /dashboard/assets page code in src/routes/dashboard/assets/+page.svelte to match the changes proposed in stellar/stellar-docs#1775. The referenced PR updates tutorials to use the Stellar RPC API instead of the deprecated Horizon API.

  • Refactor all Horizon API interactions (such as trustline management, transaction creation, balance queries, etc.) to use the Stellar RPC API and its recommended libraries/methods, as shown in the tutorial PR.
  • Update any helper functions, imports, or client calls to replace Horizon-specific logic with Stellar RPC equivalents.
  • Ensure all asset management flows (adding/removing trustlines, showing balances) use the new API.
  • Address any UI or data changes required by the new API responses or formats.

Reference the tutorial PR for recommended patterns and code examples for RPC usage.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 12, 2025

Deploying basicpay with  Cloudflare Pages  Cloudflare Pages

Latest commit: 727aec8
Status: ✅  Deploy successful!
Preview URL: https://4ec8718f.basicpay.pages.dev
Branch Preview URL: https://copilot-fix-ee953495-1c18-4c.basicpay.pages.dev

View logs

@tamirms
Copy link

tamirms commented Sep 18, 2025

@copilot retry

Co-authored-by: tamirms <1445829+tamirms@users.noreply.github.com>
Copy link
Author

Copilot AI commented Sep 18, 2025

@copilot retry

Starting the retry now. I'm refactoring the assets management page to use Stellar RPC API instead of Horizon, following the patterns from PR #1775. Will update the submit function and transaction creation to use RPC endpoints. (6317671)

@socket-security
Copy link

socket-security bot commented Sep 18, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpostcss-load-config@​6.0.110010010080100

View full report

Co-authored-by: tamirms <1445829+tamirms@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor assets management page to use Stellar RPC API instead of Horizon Refactor assets management page to use Stellar RPC API instead of Horizon Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants