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

Sdk: add claim rewards #932

Merged
merged 2 commits into from
Jul 24, 2024
Merged

Sdk: add claim rewards #932

merged 2 commits into from
Jul 24, 2024

Conversation

emccorson
Copy link
Contributor

@emccorson emccorson commented Jul 16, 2024

Closes #679.


Added

  • Support claim rewards tx in SDK

Testing

  1. Stake some NAM.
  2. Check that you have rewards available with namadac rewards.
  3. In Namadillo, add window.sdk = sdk; window.BigNumber = BigNumber; and then in the console something like:
var built = await sdk.tx.buildClaimRewards(
  {
    token: sdk.nativeToken,
    feeAmount: BigNumber(0),
    gasLimit: BigNumber(20_000),
    chainId: "localnet.4918ab9bafd7c5a6ac91c",
    publicKey: "tpknam1qptrn64myunqr4847yq4cn0uwek5ecwc7eeexjfc5npmd5kmg6ex563n5as"
  },
  {
    validator: "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx",
    source: "tnam1qz4sdx5jlh909j44uz46pf29ty0ztftfzc98s8dx"
  }
);

var signed = await namada.sign({
  txType: built.tx.tx_type(),
  signer: "tnam1qz4sdx5jlh909j44uz46pf29ty0ztftfzc98s8dx",
  tx: {
    txBytes: built.tx.tx_bytes(),
    signingDataBytes: built.tx.signing_data_bytes(),
  },
  wrapperTxMsg: built.tx.wrapper_tx_msg()
});

var processed = await sdk.rpc.broadcastTx({
  wrapperTxMsg: built.tx.wrapper_tx_msg(),
  tx: signed
})
  1. Refresh Namadillo and check that your balance has increased.

@emccorson emccorson force-pushed the sdk-claim-rewards branch from 798e4e8 to 5827ce9 Compare July 16, 2024 02:07
Copy link
Contributor

github-actions bot commented Jul 16, 2024

@github-actions github-actions bot temporarily deployed to pull request July 16, 2024 02:17 Inactive
@emccorson emccorson force-pushed the sdk-claim-rewards branch 2 times, most recently from 248669a to 71427dc Compare July 16, 2024 03:38
@emccorson emccorson mentioned this pull request Jul 16, 2024
@github-actions github-actions bot temporarily deployed to pull request July 16, 2024 03:43 Inactive
@emccorson emccorson force-pushed the sdk-claim-rewards branch from 71427dc to e919505 Compare July 16, 2024 04:10
@github-actions github-actions bot temporarily deployed to pull request July 16, 2024 04:16 Inactive
@emccorson emccorson force-pushed the sdk-claim-rewards branch from e919505 to fd29ef4 Compare July 22, 2024 00:48
@github-actions github-actions bot temporarily deployed to pull request July 22, 2024 00:53 Inactive
@emccorson emccorson marked this pull request as ready for review July 22, 2024 01:09
@emccorson emccorson requested review from jurevans, mateuszjasiuk, euharrison and pedrorezende and removed request for jurevans July 22, 2024 01:09
Copy link
Collaborator

@jurevans jurevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM! Just left a note about docs/README.md, I think we can just remove those changes for now

@emccorson emccorson force-pushed the sdk-claim-rewards branch from fd29ef4 to 675ea28 Compare July 23, 2024 01:32
@github-actions github-actions bot temporarily deployed to pull request July 23, 2024 01:37 Inactive
Copy link
Collaborator

@mateuszjasiuk mateuszjasiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT! :)

- Show real dates/times for proposals instead of epochs
- Show the time remaining for ongoing proposals
@emccorson emccorson force-pushed the sdk-claim-rewards branch from 675ea28 to 59d0ea9 Compare July 24, 2024 00:26
@github-actions github-actions bot temporarily deployed to pull request July 24, 2024 00:31 Inactive
@emccorson emccorson merged commit 59d0ea9 into main Jul 24, 2024
8 checks passed
@mateuszjasiuk mateuszjasiuk deleted the sdk-claim-rewards branch September 13, 2024 09:38
This was referenced Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDK: Claim staking rewards
3 participants