Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//
// Code borrowed and extended from https://developer.algorand.org/docs/javascript-sdk
//
// Example using PureStake token object, replacing the token as a string
//
// DEPRECATED 12/30/20 with Algod v1 API Shutdown
const algosdk = require('algosdk');
const baseServer = "https://testnet-algorand.api.purestake.io/ps1"
const port = "";
const token = {
'X-API-Key': 'B3SU4KcVKi94Jap2VXkK83xx38bsv95K5UZm2lab'
}
const algodclient = new algosdk.Algod(token, baseServer, port);
(async () => {
console.log(await algodclient.versions());
})().catch(e => {
console.log(e);
});
// Both algodclient objects are necessary, as the params call is application/json and the SDK does not allow by request header assignment
// The TestNet account in this example is U2VHSZL3LNGATL3IBCXFCPBTYSXYZBW2J4OGMPLTA4NA2CB4PR7AW7C77E - PureStake cannot guarantee any funds will exist to execute this example
// To add Algo's - https://bank.testnet.algorand.network
// DEPRECATED 12/30/20 with Algod v1 API Shutdown
const algosdk = require('algosdk');
const baseServer = "https://testnet-algorand.api.purestake.io/ps1"
const port = "";
const token = {
'X-API-key' : 'B3SU4KcVKi94Jap2VXkK83xx38bsv95K5UZm2lab',
}
const algodclient = new algosdk.Algod(token, baseServer, port);
var mnemonic = "code thrive mouse code badge example pride stereo sell viable adjust planet text close erupt embrace nature upon february weekend humble surprise shrug absorb faint";
var recoveredAccount = algosdk.mnemonicToSecretKey(mnemonic);
console.log(recoveredAccount.addr);
(async() => {
let params = await algodclient.getTransactionParams();
let endRound = params.lastRound + parseInt(1000);
let txn = {
"from": recoveredAccount.addr,
"to": "AEC4WDHXCDF4B5LBNXXRTB3IJTVJSWUZ4VJ4THPU2QGRJGTA3MIDFN3CQA",
"fee": 10,
"amount": 2,
//
// Code borrowed and extended from https://developer.algorand.org/docs/javascript-sdk
//
// Example using PureStake token object
//
// DEPRECATED 12/30/20 with Algod v1 API Shutdown
const algosdk = require('algosdk');
const baseServer = "https://testnet-algorand.api.purestake.io/ps1"
const port = "";
const token = {
'X-API-Key': 'B3SU4KcVKi94Jap2VXkK83xx38bsv95K5UZm2lab'
}
const algodclient = new algosdk.Algod(token, baseServer, port);
(async () => {
console.log(await algodclient.transactionById('3J7Z46VKGJ6VATCHOE3I2JZXVDXKAWOKO3JJCR6R7EEX5VBKEATQ'));
})().catch(e => {
console.log(e);
});