Skip to content

fix(horizon): map real payments amount, asset and counterparty (#6, #17) - #99

Open
ghzhost wants to merge 1 commit into
StellarSend:mainfrom
ghzhost:fix/horizon-payments-amount-counterparty-6-17
Open

fix(horizon): map real payments amount, asset and counterparty (#6, #17)#99
ghzhost wants to merge 1 commit into
StellarSend:mainfrom
ghzhost:fix/horizon-payments-amount-counterparty-6-17

Conversation

@ghzhost

@ghzhost ghzhost commented Sep 2, 2026

Copy link
Copy Markdown

Summary

Resolves #6 and #17 by updating in :

  1. Switch to endpoint:
    • The endpoint in Horizon does not contain per-operation payment data (amounts, destinations). Switched fallback querying to .
  2. Proper amount & asset mapping (fixes fetchTransactionsFromHorizon hardcodes transaction amount to '0' #6):
    • Reads real payment amounts (, for , , ).
    • Maps native XLM vs credit assets (, ).
    • Populates path-payment specific attributes when applicable (, , , etc.).
  3. Correct counterparty & direction derivation (fixes fetchTransactionsFromHorizon sets counterparty to the user's own address for sent transactions (distinct from the hardcoded-amount bug in #6) #17):
    • Derives by checking if the connected wallet is the sender ( / ).
    • Derives as the opposite party (destination when sent, sender when received), avoiding displaying the wallet's own public key as counterparty for outgoing transactions.
  4. Unit test coverage:
    • Added unit tests in verifying sent credit asset payments, received native XLM payments, and operations.

…arSend#6, StellarSend#17)

- Switch Horizon fallback endpoint from /accounts/{id}/transactions to /accounts/{id}/payments
- Map operation amounts (amount, starting_balance, dest_amount, source_amount) instead of hardcoding '0'
- Map operation asset code and issuer (native XLM vs credit assets)
- Correctly compute counterparty and direction based on payment sender and receiver
- Map path payment source/destination asset details and operation types (payment, path_payment, create_account, change_trust, manage_offer)
- Add comprehensive test coverage verifying /payments mapping, amounts, assets, and counterparties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant