Error with both avail and polkadot sdk calling api.rpc.chain.getBlock

Hello, i am trying to interact with blockchain via @polkadot ts library and the starting point is to get the latest finalized block. However, i could not manage to get a block with
(I am connecting to testnet with wss://goldberg.avail.tools/ws)

    const signedBlock = await this.api.rpc.chain.getBlock(
      blockHash,
    );

the error message is:

createType(SignedBlock):: Struct: failed on block: {\"header\":\"Header\",\"extrinsics\":\"Vec<Extrinsic>\"}:: Struct: failed on extrinsics: Vec<Extrinsic>:: createType(ExtrinsicV4):: createType(Call):: findMetaCall: Unable to find Call with index [0, 29]/[0,29]

The api.rpc.chain.getFinalizedHead function retrieves the correct blockhash.

can anyone help me about this?

1 Like

Hey, I tried recreating your issue with avail-js, and it works fine for me.

Please try running the same query with avail/avail-js at main · availproject/avail · GitHub

The Avail DA chain has some modifications that make it slightly different when compared to out-of-the-box Substrate chains. So it’s best to use AvailJS wherever possible to interact with the chain.

Hello, looks like i did something wrong with the avail-js libarary. This time it worked. I looked into the library code and i saw that it creates the api with some additional parameters: rpc, types and signedExtentions. Copied those and used with @polkadot library and it works.

      const api = await ApiPromise.create({
        provider,
        throwOnConnect: true,
        noInitWarn: true, // prob optional
        types,
        rpc,
        signedExtensions,
      });
1 Like