Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Weight type in getXcmWeight is not printable #73

Open
chrisli30 opened this issue Sep 18, 2023 · 4 comments
Open

The Weight type in getXcmWeight is not printable #73

chrisli30 opened this issue Sep 18, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request Stale

Comments

@chrisli30
Copy link
Member

chrisli30 commented Sep 18, 2023

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
@chrisli30 chrisli30 added the enhancement New feature or request label Sep 18, 2023
@chrisli30
Copy link
Member Author

@imstar15 did we fix this issue?

Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jul 18, 2024
@chrisli30 chrisli30 removed the Stale label Jul 18, 2024
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Aug 18, 2024
@chrisli30 chrisli30 removed the Stale label Aug 19, 2024
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale
Projects
None yet
Development

No branches or pull requests

2 participants