AstarNetwork / astar.js

Astar network Typescript SDK
Apache License 2.0
30 stars 9 forks source link

Question for getting "estimated reward". #73

Closed johnnyji-dev closed 4 months ago

johnnyji-dev commented 4 months ago

Hi~ I'm updating V2 staking to V3.

I used below API-call to get estimated-reward on V2.

        const estimatedReward = await estimatePendingRewards({
            api: this.client,
            walletAddress: staker
        })

But, I think that it does not work now. (generalEraInfo maybe is deprecated, so undefined).

Can I get some advises for how to get estimated-reward by call api(api.query.dappStaking.???)? Or Is there the other method?

johnnyji-dev commented 4 months ago

Hi~ I'm updating V2 staking to V3.

I used below API-call to get estimated-reward on V2.

        const estimatedReward = await estimatePendingRewards({
            api: this.client,
            walletAddress: staker
        })

But, I think that it does not work now. (generalEraInfo maybe is deprecated, so undefined).

Can I get some advises for how to get estimated-reward by call api(api.query.dappStaking.???)? Or Is there the other method?

I found out "getStakerRewards" & "getBonusRewards" at "astar-app" repository.

bobo-k2 commented 4 months ago

Great, most of the logic is in https://github.com/AstarNetwork/astar-apps/blob/main/src/staking-v3/logic/services/DappStakingService.ts