Closed ioannist closed 6 months ago
Can you provide a reproducible example, that would help a lot with narrowing this down.
Can you provide a reproducible example, that would help a lot with narrowing this down.
import { ApiPromise, WsProvider } from "@polkadot/api";
import { Vec } from "@polkadot/types";
import { EventRecord } from "@polkadot/types/interfaces";
(async () => {
try {
console.log('Results to-> TypeError: Cannot read properties of undefined (reading \'toHuman\') in >=10.13.1')
const provider = new WsProvider('wss://moonbeam.unitedbloc.com');
const api = await ApiPromise.create({ provider, throwOnConnect: true });
for (let blockNumber = 1000000; blockNumber < 1001000; blockNumber++) {
const hash = await api.rpc.chain.getBlockHash(blockNumber);
const apiAt = await api.at(hash);
const allRecords = await apiAt.query.system.events() as Vec<EventRecord>;
for (const record of allRecords) {
record.event.toHuman()
}
const signedBlock = await api.rpc.chain.getBlock(hash);
for (let extrinsicIndex = 0; extrinsicIndex < signedBlock.block.extrinsics.length; extrinsicIndex++) {
const extrinsic = signedBlock.block.extrinsics[extrinsicIndex];
extrinsic.toHuman()
}
}
} catch (err) {
console.error(err)
throw err;
}
})();
Fix will be included in Mondays release
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.
for events and extrinsics:
GenericExtrinsic<AnyTuple> EventRecord.event: Event
callinge.toJSON()
works finecalling
e.toHuman()
This used to work in v10.11.2 and i think it broke in 10.13.1
Version:
Environment:
Language: