Skip to content

Commit

Permalink
Merge pull request #5 from agoltzman/patch-3
Browse files Browse the repository at this point in the history
Fix bond and note in bondExtra
  • Loading branch information
SlavaSereb authored Jun 20, 2023
2 parents d1888ec + ebc58b2 commit 2aa7724
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dot-staker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ export class DOTStaker {
await this.getAvailableBalance(vaultAccountId) as unknown as string)
}

const txNote = controllerAddress ? `Bond ${amount} DOT to ${controllerAddress}` : `Bond ${amount} DOT`;
const amountToBond = amount ? amount : this.availableBalance;

const txNote = controllerAddress ? `Bond ${amountToBond} DOT to ${controllerAddress}` : `Bond ${amountToBond} DOT`;

await this.sendTransaction({
vaultAccountId,
params: [
'staking.bond', controllerAddress || await this.getPermanentAddress(vaultAccountId),
(this.testnet? this.availableBalance * 1000000000000 : this.availableBalance * 10000000000).toString(),
(this.testnet? amountToBond * 1000000000000 : amountToBond * 10000000000).toString(),
rewardDestination? rewardDestination: 'Stash'
],
txNote
Expand Down Expand Up @@ -128,7 +130,7 @@ export class DOTStaker {
(this.testnet? amountToBond * 1000000000000 : amountToBond * 10000000000).toString()
],
vaultAccountId,
txNote: `Bond extra ${this.availableBalance} DOT`});
txNote: `Bond extra ${amountToBond} DOT`});
}


Expand Down

0 comments on commit 2aa7724

Please sign in to comment.