Open
Description
The type of the output of getXcmWeight()
seems to be the same as those from paymentInfo()
, but the console.log behavior is different from the original. They can’t be printed with variableName.toJSON(). We need to stick with the original Weight type definition as much as possible. Maybe the output needs to be defined as type WeightV2
in polkadot.js?
Code Reference:
https://github.com/OAK-Foundation/oak.js/blob/764b69ebdc1e82e6c3a8c5f2f3e3c5b1dccfaae1/packages/adapter/src/chains/astar.ts#L56C5-L56C10
Expected
The weight type should be printable with a toJSON() method
const taskPayloadExtrinsic = astarApi.tx.proxy.proxy(keyringPair.addressRaw, 'Any', payload);
const { weight: encodedCallWeight } = await taskPayloadExtrinsic.paymentInfo(keyringPair.address);
console.log('encodedCallWeight.toJSON()', encodedCallWeight.toJSON());
> encodedCallWeight.toJSON() { refTime: 5367272555, proofSize: 58115 }
Actual
const { encodedCallWeight, overallWeight } = await astarAdapter.getXcmWeight(taskPayloadExtrinsic, keyringPair.address, oakTransactXcmInstructionCount);
console.log('encodedCallWeight.toJSON()', encodedCallWeight.toJSON());
> TypeError: encodedCallWeight.toJSON is not a function