Skip to content

Instantly share code, notes, and snippets.

@kctam
Created December 18, 2020 05:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kctam/1f076551ef40b8a84688b78d172231bc to your computer and use it in GitHub Desktop.
Save kctam/1f076551ef40b8a84688b78d172231bc to your computer and use it in GitHub Desktop.
Algorand ASA demo in JavaScript SDK
const algosdk=require('algosdk');
const server="https://testnet-algorand.api.purestake.io/ps2";
const port="";
const token={
"x-api-key": "mV *** BY" // fill in yours
};
var aliceAddress = '5SL7MUMPYFNDBHUD4L7J4LJRQCQWXQUD3RDK7SBGIDWPH3ZFK47BTH43HE'; // change to yours
var bobAddress = 'BDGUP3RKI3DJVM327B3R4SYT6PQUJBMDMQWHQICKSEQQT6PWCMNAYWEY4M'; // change to yours
let client=new algosdk.Algodv2(token, server, port);
( async() => {
let alice_account_info = (await client.accountInformation(aliceAddress).do());
console.log("Asset of Alice: ");
console.log(alice_account_info.assets);
let bob_account_info = (await client.accountInformation(bobAddress).do());
console.log("Asset of Bob: ");
console.log(bob_account_info.assets);
})().catch(e => {
console.log(e);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment