William Best
William Best

Reputation: 11

AvalancheJS getUTXOS: couldn't unmarshal an argument

Hoping somone could explain what's going on here.

I am getting this error Error: couldn't unmarshal an argument. Ensure arguments are valid and properly formatted.

with this code, seems like something is wrong with xAddresses format?

const xAddresses:any = xchain.keyChain().getAddresses();

**const utxos:any = await xchain.getUTXOs(xAddresses)**
    .then(element => {console.log("sucess" + element)})
    .catch(Error => {console.log("Error in createSingedTX: " + Error)});

Upvotes: 1

Views: 126

Answers (1)

Matricore
Matricore

Reputation: 593

Avalanche default documentation and AvalancheJs examples are both uses wrong variables which is a buffer[] of your keychain addresses. Use string addresses array instead of buffer. It works!

const addressStrings = myKeychain.getAddressStrings();
const utxos = (await avmApi.getUTXOs(addressStrings)).utxos

Upvotes: 1

Related Questions