Skip to content

Fix wallet transaction invalid error, add real multi-token trading, marketplace fork, and dashboard PnL charts - #9

Merged
mesayanroy merged 3 commits into
mainfrom
copilot/fix-invalid-transaction-error
Mar 30, 2026
Merged

Fix wallet transaction invalid error, add real multi-token trading, marketplace fork, and dashboard PnL charts#9
mesayanroy merged 3 commits into
mainfrom
copilot/fix-invalid-transaction-error

Conversation

Copilot AI commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Transaction failures ("Invalid error") when running paid agents stemmed from a hardcoded TESTNET network passphrase and a race condition where the server verified the tx before Horizon indexed it. The trading page used fake price data and only supported XLM.

Critical Fixes

PaymentModal — transaction invalid error

  • Was hardcoding StellarSdk.Networks.TESTNET; now reads NEXT_PUBLIC_STELLAR_NETWORK to pick mainnet/testnet passphrase at runtime
  • Added confirming step: polls Horizon until the tx appears on-ledger before handing the hash to the agent run route — eliminates the "Transaction not found" verification failure
  • Extracts response.data.extras.result_codes from Stellar errors for actionable messages instead of String(err)
  • Shows Stellar Expert explorer link after successful payment

verifyPaymentTransaction — server-side retry

  • Added 6-attempt polling loop (3 s intervals) so the run route can find the tx even under brief Horizon propagation lag

Trading Page

  • Real-time prices for 8 pairs (XLM, BTC, ETH, SOL, BNB, XRP, USDT, USDC) via CoinGecko free API (60 s refresh); falls back to static prices when rate-limited
  • Token pair selector with live 24 h % change badges
  • Real Freighter wallet XLM balance displayed in header and order panel
  • Volume bar chart below price chart
  • 4 new agent templates: MEV Scanner, Mempool Monitor, Liquidity & Slippage Tracker, Multi-Token Arbitrage
  • Category filter for agent templates (strategy / arbitrage / mev / monitor)

Marketplace

  • Loads agents from /api/agents/list dynamically instead of hardcoded static arrays
  • ForkModal: pays the agent owner's fork fee in XLM via Freighter signature, then lets the user customise the agent name and system prompt

Dashboard

  • Cumulative PnL area chart built from earnings array in the analytics API
  • Request type pie chart: paid vs free breakdown
  • XLM → USD conversion using live CoinGecko XLM price
  • Refresh interval tightened to 10 s; last-fetched timestamp shown
// Before — hardcoded, breaks on mainnet or when tx not yet indexed
const networkPassphrase = StellarSdk.Networks.TESTNET;
const tx = await server.transactions().transaction(txHash).call(); // throws 404

// After — dynamic network + retry
const networkPassphrase = isMainnet ? StellarSdk.Networks.PUBLIC : StellarSdk.Networks.TESTNET;
// server polls up to 6× before giving up
for (let attempt = 0; attempt < 6; attempt++) {
  try { tx = await server.transactions().transaction(txHash).call(); break; }
  catch { await new Promise(r => setTimeout(r, 3_000)); }
}

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

@vercel

vercel Bot commented Mar 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
0x402-pubsub Ready Ready Preview, Comment Mar 30, 2026 1:37am

…tplace fork, dashboard PnL charts

Agent-Logs-Url: https://github.com/mesayanroy/0x402-pubsub/sessions/a5017868-1cf9-406e-87a5-d8afd60c61af

Co-authored-by: mesayanroy <169074736+mesayanroy@users.noreply.github.com>
…ing, candle seed using fallback

Agent-Logs-Url: https://github.com/mesayanroy/0x402-pubsub/sessions/a5017868-1cf9-406e-87a5-d8afd60c61af

Co-authored-by: mesayanroy <169074736+mesayanroy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix invalid transaction error in wallet integration Fix wallet transaction invalid error, add real multi-token trading, marketplace fork, and dashboard PnL charts Mar 30, 2026
Copilot AI requested a review from mesayanroy March 30, 2026 01:37
@mesayanroy
mesayanroy marked this pull request as ready for review March 30, 2026 01:39
@mesayanroy
mesayanroy merged commit 75cbee9 into main Mar 30, 2026
4 checks passed
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