@aurigami/sdk 1.5.9 → 1.5.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk.cjs.development.js +17 -2
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +17 -2
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/Staking.ts +10 -1
package/package.json
CHANGED
package/src/Staking.ts
CHANGED
|
@@ -154,9 +154,18 @@ export class StakingReadWrite extends StakingRead {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
public async unstake(amount: TokenAmount): Promise<TransactionResponse> {
|
|
157
|
+
const msgSender = await this._networkConnection.signer!.getAddress();
|
|
158
|
+
const amountInput = BN.from(amount.rawAmount());
|
|
159
|
+
const stakedAmount = BN.from(
|
|
160
|
+
(await this.stakeBalanceOf(msgSender)).rawAmount()
|
|
161
|
+
);
|
|
162
|
+
// unstakeAmount = min(amountInput, stakedAmount - 1)
|
|
163
|
+
const unstakeAmount = amountInput.lt(stakedAmount)
|
|
164
|
+
? amountInput
|
|
165
|
+
: stakedAmount.sub(1);
|
|
157
166
|
return this._auriFairLaunch
|
|
158
167
|
.connect(this._networkConnection.signer!)
|
|
159
|
-
.withdraw(PLYWNEAR_POOL_ID,
|
|
168
|
+
.withdraw(PLYWNEAR_POOL_ID, unstakeAmount);
|
|
160
169
|
}
|
|
161
170
|
}
|
|
162
171
|
|