I am using V2 api and my transaction does go through successfully but when I try to get the status I get the following error:
Error: Parser is unable to parse the response
at Request.<anonymous> (client.js:402)
at Request.push../node_modules/component-emitter/index.js.Emitter.emit (index.js:145)
at XMLHttpRequest.xhr.onreadystatechange (client.js:707)
The error is generated at
const pendingInfo = await algodclient.pendingTransactionInformation(txId).do();
I am using algosdk version 1.6.2
const api = "https://testnet-algorand.api.purestake.io/ps2";
const algodclient = new algosdk.Algodv2(
token,
api,
port
);
The problem seems that the call to algodclient.pendingTransactionInformation() goes to /node_modules/algosdk/src/client/algod.js
which in turn calls await c.get("/v1/transactions/pending/" + txid, {}, headers);
Now here it says “v1” … I guess this is causing the error
FYI, I can not use the more latest version of the sdk 1.7.0 as I have a bigger error there.
Any thoughts on how to resolve this?
Are you able to update to 1.7.0? I ran that version and it does work, although there is a known bug in the client (https://github.com/algorand/js-algorand-sdk/issues/173) that is resolve in 1.7.1 (not yet available in NPM).
To temporarily resolve that, you can either use the method in the PR of the linked issue, or just edit the client.js file and in the HTTPclient declaration switch .set('Accept', 'application/json') to .set('Accept', 'application/*')