Skip to content

Instantly share code, notes, and snippets.

@ernestognw
Last active March 31, 2020 20:24
Show Gist options
  • Save ernestognw/bea18e3252102a8114ebe1745d7fff13 to your computer and use it in GitHub Desktop.
Save ernestognw/bea18e3252102a8114ebe1745d7fff13 to your computer and use it in GitHub Desktop.
Stellar destination address balance checker
// 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