API to Query both sides of a "swap_within_batch" operation?

Hello,

So I am developing an app that will take a user’s COSMOS address and see all their balances (including tokens) and transactions.

One issue I came across is an operation called “swap_within_batch”.
Here is a transaction including that operation:

https://node.atomscan.com/txs/DE4565BC673DE5133F8293C0E88526289C486D5237D146E1DB4DF74DEAE9A1AC

You can see that we are swapping ATOM for a token. There is a transfer to represent the sending of the “80120uatom”. But their is no corresponding transfer for the receiving of the token.

Without this information, the net sum of the transactions I can show the user will not add up to the total balance, creating a confusing discrepancy.

Is there information missing from that query, or is there another way to find this information?
Note that I query all the transactions for the address using this:

https://api.cosmostation.io/v1/account/new_txs/cosmos1aj2yhukrny6l2es489qyt0uvna4zsr7fmpmpsv?limit=50

And there isn’t anything else there to take this into account.

1 Like