Jump to content
Sign in to follow this  
Guest1

How to get XRP balance in a wallet filtered by Destination Tag?

Recommended Posts

I have the following javascript code to obtain wallet XRP balance.

I would like to filter this balance by only 1 destination tag so that I get the wallet balance just for that specific destination tag. Does anyone know how to do this in javascript by modifying the code below?

 

------------------------------------

 

const RippleAPI = require('ripple-lib').RippleAPI;

const api = new RippleAPI({ server: 'wss://s.altnet.rippletest.net:51233' });

const myAddress1 = <XRP wallet address>;

 

api.connect().then(() => {

console.log('getting account info for', myAddress1);

return api.getAccountInfo(myAddress1);

})

.then(info => {

console.log(info);

console.log('getAccountInfo done');

})

.then(() => {

return api.disconnect();

})

.then(() => {

console.log('done and disconnected.');

})

.catch(console.error);

Edited by Guest1

Share this post


Link to post
Share on other sites

A destination tag doesn’t have a “balance”.  It’s not a “subwallet” within a wallet.

It’s just a number that can be used by the recipient. Many exchanges use destination tags for deposits so that they don’t need a separate deposit address (aka wallet) for each user.

But any funds sent to that destination tag are stored inside the wallet itself, and the destination tag is not attached to them in any way; it is only visible in the transaction.

At best, what you can do is walk back all transactions made against a given account and see how many of them specify a destination tag.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×
×
  • Create New...