Skip to content

Instantly share code, notes, and snippets.

@kctam
Created November 9, 2020 01:29
Show Gist options
  • Save kctam/41ab161e0c69ff029331df67e0115c08 to your computer and use it in GitHub Desktop.
Save kctam/41ab161e0c69ff029331df67e0115c08 to your computer and use it in GitHub Desktop.
Algorand demonstration with JS 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
};
let client=new algosdk.Algodv2(token,server,port);
let account1 = 'MXSXYFX7XWWVYQHHBLJPJZYUJXY6JXXSOELIVNSRQDFM3NIH73ULFZHQAA';
let account2 = '6NAKWTCPPHB4RZFYS26RT5QDCO6BFNVY3OYJV4WPMGOPDPFOB2GCSR5Z4M';
( async() => {
let account1_info = (await client.accountInformation(account1).do());
console.log("Balance of account 1: " + JSON.stringify(account1_info.amount));
let account2_info = (await client.accountInformation(account2).do());
console.log("Balance of account 2: " + JSON.stringify(account2_info.amount));
})().catch(e => {
console.log(e);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment