Skip to content

Commit ea23955

Browse files
committed
chore: skip queryInfo on sudo module
1 parent 2aafe65 commit ea23955

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/ApiHandler.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,20 @@ export default class ApiHandler {
4949
});
5050

5151
const defaultSuccess = typeof events === 'string' ? events : false;
52-
const queryInfo = await Promise.all(block.extrinsics.map((extrinsic) => {
53-
if (extrinsic.isSigned) {
54-
return api.rpc.payment.queryInfo(extrinsic.toHex(), hash);
55-
} else {
56-
return Promise.resolve({});
52+
const queryInfo = await Promise.all(block.extrinsics.map(async (extrinsic) => {
53+
if (extrinsic.isSigned && extrinsic.method.sectionName !== 'sudo') {
54+
try {
55+
return await api.rpc.payment.queryInfo(extrinsic.toHex(), hash);
56+
} catch (err) {
57+
console.error(err);
58+
59+
return {
60+
error: 'Unable to fetch fee info',
61+
}
62+
}
5763
}
64+
65+
return {};
5866
}));
5967
const extrinsics = block.extrinsics.map((extrinsic, idx) => {
6068
const { method, nonce, signature, signer, isSigned, tip, args } = extrinsic;

0 commit comments

Comments
 (0)