Using web-sdk api - error while get account info

This code:

console.log("Connecting to CCD… mainnet " + mainnet);
const provider = await concordiumHelpers.detectConcordiumProvider();
const accountAddress = await provider.connect();
console.log("Connecting to CCD… accountAddress " + accountAddress);
const client = await provider.getJsonRpcClient();
const consensusStatus = await client.getConsensusStatus();
const lastFinalizedBlock = await consensusStatus.lastFinalizedBlock;
console.log("Connecting to CCD… lastFinalizedBlock " + lastFinalizedBlock);
const acct = new concordiumSDK.AccountAddress(accountAddress);
console.log("Connecting to CCD… acct " + acct);

const accountInfo = await client.getAccountInfo(acct, lastFinalizedBlock);

Produce error:
Error: -32602: Missing ‘address’ parameter (id: 72a39549-3a03-4d03-9405-147949d2e27d)

Please advise

Hi Oleksii,

I think you have discovered a bug.

I’ll improve this for the next version of the SDK/Wallet, but for now can you try using the 2.1.0 version of the SDK? (and let me know if it fixes the problem)

I think you need to use the same version as the wallet uses (which is 2.1.0).
I can see that I’ve used instanceOf to check whether the input is an AccountAddress, which might actually be a problem.

  • Søren

Latest version are used
src="//unpkg.com/@concordium/browser-wallet-api-helpers@1.0.0/lib/concordiumHelpers.min.js">
src="//unpkg.com/@concordium/web-sdk@2.1.0/lib/concordium.min.js">

Okay, I think I’ll have to fix it in an update to the wallet extension.

A (very not nice) workaround you can use for now is to, instead of
acct = new AccountAddress(accountAddress)
then:
acct = { credId: accountAddress }

It mimics the CredentialRegistrationId class that the wallet assumes it is given, if it is not an AccountAddress.

I have tested that it should definitely work. And I’ll see that we fix this for the next version.

Thanks

  • Søren

working. I guess API documentation must be updated

Hey. Its stop working again:
Right-hand side of ‘instanceof’ is not callable

const acct = { credId: accountAddress };//new concordiumSDK.AccountAddress(accountAddress);
console.log("Connecting to CCD… acct " + acct);

const accountInfo = await client.getAccountInfo(acct);