feat: populate orders and transactions via get-escrows-by-signer (#316) - #335
Open
Benjtalkshow wants to merge 10 commits into
Open
feat: populate orders and transactions via get-escrows-by-signer (#316)#335Benjtalkshow wants to merge 10 commits into
Benjtalkshow wants to merge 10 commits into
Conversation
Add Stellar wallet connection using the Stellar Wallets Kit. A user can connect an existing external wallet such as Freighter, xBull, Albedo, Lobstr, Rabet, or Hana. The kit opens a modal, the user picks a wallet, and it returns the wallet address. That address is the signer the escrow endpoints need. This flow only connects a wallet. It does not create one. Add the data layer for the two lists. This covers the indexer types from the Trustless Work docs, a helper that derives the status from flags and balance, adapters that map an escrow into the order and transaction shapes, a mock client, and a useEscrows hook with page based pagination. Place the connect button on the orders page and the transactions page. The pages still use mock data. The real call to get-escrows-by-signer is not wired yet. The whole feature sits behind one function so the swap stays small once the API client is ready.
…feature/populate-orders-and-transactions-316 # Conflicts: # p2p-safe-swap/app/p2p/orders/page.tsx
…node#316) Add the getEscrowsBySigner method to the Trustless Work client, following the existing request helper and x-api-key auth. Add a GET /api/escrows server route that validates the signer and filter params, then calls the client so the api key stays on the server and never reaches the browser. Point the escrow fetch seam at the new route in place of the mock data. The hook and adapters stay the same because the function signature did not change.
Replace the mock transaction array with live escrows from the connected wallet. The page reads the signer from the wallet context, calls the useEscrows hook with the single-release filter, and maps each escrow into a transaction row. Add the states the page needs to work: a prompt when no wallet is connected, a loading state, an error state, and page based navigation using the hook pagination.
Add an escrow status panel above the marketplace order list. It reads the signer from the wallet context, loads the escrows for that signer, and shows each one with a status badge for pending, funded, disputed, or released. It includes loading, error, empty, and page based navigation. The panel is additive. The marketplace browse and the trade chat flow keep working. How the marketplace list and a user's escrows should relate is a product decision left for the maintainer. Add a reusable EscrowStatusBadge and export both from the escrows module.
Add a status tab bar to the orders escrow panel, wired to the endpoint status param, so the user can filter by pending, funded, disputed, or released. The status names sent to the api are our assumed values and should be confirmed against the live api. Wire the transactions direction tabs to the endpoint role param. Entradas maps to the receiver and Salidas maps to the service provider, which is the payer into escrow in this model.
…#316) Update the escrow types, status helper, and adapters to match the shape the live API actually returns. On multi release records the flags, amount, and receiver live per milestone, and timestamps arrive as Firestore objects, so the code now reads from milestones and converts timestamps to ISO. Status derivation aggregates flags across milestones. Stop sending the role query param because the live API rejects it with a 400. Transaction direction is filtered on the client instead, and the orders status panel filters on the client too. Trim comments across the wallet and escrow modules and remove the unused mock fixture. Verified with the connected wallet against real single release and multi release records. Typecheck, lint, and production build all pass.
…ture/populate-orders-and-transactions-316 # Conflicts: # p2p-safe-swap/app/p2p/orders/page.tsx
Benjtalkshow
marked this pull request as ready for review
July 26, 2026 09:22
danielcdz
self-requested a review
July 27, 2026 14:22
Contributor
|
Hi @Benjtalkshow could you resolve conflicts please? |
…ture/populate-orders-and-transactions-316 # Conflicts: # p2p-safe-swap/lib/trustless-work.ts
Contributor
Author
@diegoTech14 |
Contributor
|
still conflicts sir @Benjtalkshow |
…feature/populate-orders-and-transactions-316 # Conflicts: # p2p-safe-swap/app/layout.tsx
Contributor
Author
@diegoTech14 |
diegoTech14
approved these changes
Jul 28, 2026
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.
Closes #316
This work is for issue #316. It populates
/transactionsand/p2p/orderswith live escrow data fromGET /helper/get-escrows-by-signer.What this adds
Wallet connection. A user can connect an existing external Stellar wallet using the Stellar Wallets Kit (Freighter, xBull, Albedo, Lobstr, Rabet, or Hana). The kit returns the wallet address, which is the signer the escrow endpoint needs. This flow only connects a wallet. It does not create one.
Client method and server route. A
getEscrowsBySignermethod on the Trustless Work client, plus aGET /api/escrowsroute that calls it so the api key stays on the server and never reaches the browser.Data layer. Escrow types, a helper that derives status from flags and balance, adapters that map an escrow into the transaction and order shapes, and a
useEscrowshook with page based pagination.Transactions page. Lists the connected wallet's escrow history, with a no wallet prompt, loading, error, empty states, and pagination.
Orders page. A "Mis escrows" status panel above the marketplace list shows each escrow with a badge for pending, funded, disputed, or released, plus a status filter and pagination. The panel is additive, so the marketplace browse and the trade chat flow keep working.
Verified against the live API
Tested with a connected testnet wallet against real single release and multi release records:
Notes on the live API shape
Testing showed the live response differs from the docs, and the code handles it:
rolefilter with a 400, so direction and status are filtered on the client instead of the server.For review
TW_API_KEY, matchingapp/api/.env.example. The root README mentionsTRUSTLESS_WORK_API_KEY, which is inconsistent and worth aligning.app/layout.tsx. Issue [FEAT]: Add the app navigation shell to connect all screens #323 also plans to edit the layout, so please review the merge order.Proof