-
Notifications
You must be signed in to change notification settings - Fork 9
Add final rewards+final used fee #75
base: main
Are you sure you want to change the base?
Add final rewards+final used fee #75
Conversation
- After completing transaction, need to retrieve a final claimed reward and used fee.
Hi @johnnyji-dev thank you for your contribution. Can you please add the PR dscription? |
Is there any template for PR description? Is there no format? I completed to update and test that method. |
Hi, you can write summary of updates in this PR without template. Please update the description and check that claimedReward method (and why it's needed) thank you for your contribution. |
and also, please run lint before commit your updates. thank you |
@gtg7784
It need to merge the commit (77dc1cec6fb9c32a32c7820c0aacc1cecdb08e24). |
Hi @johnnyji-dev on more thing. Can you please uplift version in |
I uplifted version in package.json (there are multiple files) to 0.3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @johnnyji-dev
Thank you for your contribution. Could you help update the version number to 0.3.0 (there are required updating in multiple package.json files)? Thanks in advance.
Ref:
https://github.com/AstarNetwork/astar.js/pull/69/files
let usedFee = BigInt('0'); | ||
|
||
extrinsicEvents.map((e) => { | ||
if (e.toHuman()?.event?.method == method && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you avoid using toHuman
and use polkadot.js types instead. This will also remove need for commaStrToBigInt
The same applies for the method above
Could you run |
After work, I will check them out. Thx~
2024년 7월 8일 (월) 오후 5:22, Roy ***@***.***>님이 작성:
… Could you run yarn lint? CI failed in lint and build .
—
Reply to this email directly, view it on GitHub
<#75 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A53U4LRLMGZCEN2RX4A3RUTZLJD27AVCNFSM6AAAAABELFDJAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJTGM2DENBXGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @johnnyji-dev, please address the following
- fix build errors
- provide PR description and explain what you did and why those changes are needed
- Update
SDK-Core Library Functions
section inREADME.md
- Have in mind that there are actually three different reward events in case you want to also handle the third one https://github.com/AstarNetwork/Astar/blob/150b11c4ffabaf82f6c1ec165bfa5d99340c8358/pallets/dapp-staking-v3/src/lib.rs#L301
|
Hi @johnnyji-dev you forgot the most important point. The code is not building |
Oh, I missed that part!! And complete to update it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still missing the PR description. Explain reasons for the change
@@ -321,7 +322,7 @@ export const getUsedFee = async ( | |||
const blockHash = await api.rpc.chain.getBlockHash(height); | |||
const signedBlock = await api.rpc.chain.getBlock(blockHash); | |||
const apiAt = await api.at(signedBlock.block.header.hash); | |||
const allRecords = (await apiAt.query.system.events()).toArray(); | |||
const allRecords: any = await apiAt.query.system.events(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use any
Applicable to multiple locations within the code
https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bobo-k2
BTW, Property 'map' does not exist on type 'Codec'.
The type of 'allRecords' is Codec.
I tried to iterate the data by using 'filter' or 'map'. But that make build error(yarn polkadot-exec-tsc --build tsconfig.build.json).
How can I handle this? Can you suggest any reference docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codec is a base type from which all polkadot.js types are inherited. System.events
are of type Vec<FrameSystemEventRecord>
so you can change your line to
const allRecords = await api.query.system.events<Vec<FrameSystemEventRecord>>();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When '<Vec>' applied, can not import the member like below error message.
packages/sdk-core/src/modules/dapp-staking/pending-rewards/index.ts:7:10 - error TS2305: Module '"@polkadot/types/lookup"' has no exported member 'FrameSystemEventRecord'.
Alternative, I used the 'EventRecord' and got properties(actualFee, amount) by index.
No description provided.