Issue of getting Account Information

After getting the update and update my @concordium/web-sdk in my code I am facing issue like when I connect the wallet from the extension it Is giving me this error


the function is this
export const getCCDBalance = () => async (_, getState) => {
const { account, provider } = getState().connect;

if (!account || !provider) return;

const client = provider.getGrpcClient();
console.log(provider, “Provider”);
const accountAddress = new AccountAddress(account);
console.log(accountAddress, “Account Address”);
const blockHash = (await client.getConsensusStatus()).bestBlock;
console.log(blockHash, “Block hash”);

const accountInfo = await client.getAccountInfo(accountAddress, blockHash);

console.log(accountInfo, “Account info”);

return accountInfo.accountAmount;
};
the getAccountInfo is not working in this function.

In the newest version of the concordium wallet extension, the way you access the GRPC client directly on the wallet provider has been deprecated due to the inability to update the grpc client version without breaking existing apps relying on it.

The recommended way to construct the grpc client is:

import { ConcordiumGRPCClient } from '@concordium/web-sdk/grpc';
...
const client = new ConcordiumGRPCClient(provider.grpcTransport);

Hope this helps.

1 Like