Last active
March 31, 2021 14:58
-
-
Save downing034/5413ec23edb6bf5d636c91ce4afbf96a to your computer and use it in GitHub Desktop.
Peter Code Samples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // deposit example | |
| // Start new Kava client | |
| kavaClient = new KavaClient(Env.KavaEndpoints.Mainnet); | |
| kavaClient.setWallet(Env.KavaAccount.Mainnet.Mnemonic); | |
| await kavaClient.initChain(); | |
| // Deposit coins into Hard's BNB pool | |
| const coins = kavaUtils.formatCoins(100, "bnb"); | |
| const tx = await kavaClient.hard.deposit(coins); | |
| console.log("Deposit Transaction Hash: ", tx) | |
| // Deposit Transaction Hash: A14D3C80D5DF7241A84D67830F6129DA9EC5B35A5D8CA7F6004E0A9E4E467FC7 | |
| // Claim Hard rewards | |
| // Start new Kava client | |
| kavaClient = new KavaClient(Env.KavaEndpoints.Mainnet); | |
| kavaClient.setWallet(Env.KavaAccount.Mainnet.Mnemonic); | |
| await kavaClient.initChain(); | |
| // claim hard reward | |
| const args = {"owner": Env.KavaAccount.Mainnet.Address, "type": "hard"}; | |
| const claim = await kavaClient.getRewards(args); | |
| if (claim) { | |
| const tx = await kavaClient.newMsgClaimHardReward('large'); | |
| console.log("Claim Transaction Hash: ", tx); | |
| } | |
| // Claim Transaction Hash: A14D3C80D5DF7241A84D67830F6129DA9EC5B35A5D8CA7F6004E0A9E4E467FC7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment