Last active
March 31, 2020 20:24
-
-
Save ernestognw/bea18e3252102a8114ebe1745d7fff13 to your computer and use it in GitHub Desktop.
Stellar destination address balance checker
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
// utils/check-recipient-balance.js | |
const StellarSdk = require("stellar-sdk"); | |
const server = new StellarSdk.Server("https://horizon-testnet.stellar.org"); | |
const checkRecipientBalance = async () => { | |
// Cargamos la cuenta a través del sdk de Stellar | |
const account = await server.loadAccount( | |
"GDC75JQ6SOC3EJU5FL2IO6JL5Y2HUEPZQBVAM2TESCLG5NMYPSX6JJRP" | |
); | |
console.log( | |
"Balances for account: " + | |
"GDC75JQ6SOC3EJU5FL2IO6JL5Y2HUEPZQBVAM2TESCLG5NMYPSX6JJRP" | |
); | |
// Checamos cada una de las cuentas y su balance | |
account.balances.forEach(balance => { | |
console.log("Type:", balance.asset_type, ", Balance:", balance.balance); | |
}); | |
}; | |
checkRecipientBalance(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment