ASA compiling error in node - General - Algorand

ASA compiling error in node

post by harish on Jul 13, 2021

I compiled the below code which is ASA in purestake API which is successfully compiled.

But I run the code using a node make an error.

code link:

Error:

What I have to change?Can anyone help me?

post by JasonW on Jul 13, 2021

Did you change that code sample at all?

post by harish on Jul 13, 2021

I changed the coding for to replace a token,server, port variable, and three address of mine.

post by rfustino on Jul 13, 2021

Assuming your working code is is similar to the Purestake sample:


const baseServer = 'https://testnet-algorand.api.purestake.io/ps2'
const port = '';
const token = {
    'X-API-Key': 'YOUR API KEY'
}

const algodclient = new algosdk.Algodv2(token, baseServer, port);

I am guessing it is the X-API-Key literal, as only Purestake uses that.

Try this replacing the sandbox values with your values as follows:

// Sandbox


const token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
const server = "http://localhost";
const port = 4001;
let algodclient = new algosdk.Algodv2(token, server, port);

If that does not work replace ‘X-API-Key’ with ‘X-Algo-API-Token’

If neither of those work, send the client instantiation code snippet that is causing the error.