diff --git a/README.md b/README.md index 33846c9..b588307 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,17 @@ This script allows to stake KSM via the Fireblocks system using the RAW signing API feature. +## :warning: Breaking Change in 2.0.0 :warning: +Version 2.0.0 introduces a breaking change; as per [this forum post](https://forum.polkadot.network/t/staking-controller-deprecation-plan-staking-ui-leads-comms/2748) on Polkadot - the controller is being deprecated.
+As a result the following breaking changes were introduced: +* The function `setController` will no longer work and will results in an error +* The function `bond` no longer accepts 4 arguments, instead only 3 arguments - `vaultAccountId: string, amount?: number, rewardDestination?: string` (the `controller` argument was removed) + **Prerequisites:** 1. Run `npm i` from the project's directory to install all needed dependencies. -2. Create the following vault accounts with KSM wallet within each: - - a. Stash Account - holds the amount to stake - - b. Controller Account - has the permissions to run nominations (should have balance of 25 KSM) +2. Create a vault account with KSM wallet which will act as a stash and controller account 3. Enable RAW signing feature by contacting Fireblocks's support team @@ -28,9 +30,9 @@ This script allows to stake KSM via the Fireblocks system using the RAW signing **How to stake KSM** -1. addProxy(, ); +1. addProxy(, ); -2. bond(, , , **optional** - ); +2. bond(, , **optional** - ); reward_destination - Can be one of the following: @@ -38,20 +40,18 @@ reward_destination - Can be one of the following: 2. Staked - the rewards are sent back to the Stash and automatically bonded - 3. Controller - the rewards are sent back to the Controller account - **How to stake extra KSM** 1. bondExtra(, ) **How to stop staking** -1. chill(); +1. chill(); -2. unbond(, ); +2. unbond(, ); -3. **7 days after** unbond() - withdrawUnbonded(); +3. **7 days after** unbond() - withdrawUnbonded(); -4. **Optional** - removeProxy(, ); +4. **Optional** - removeProxy(, ); **How to change controller** diff --git a/package.json b/package.json index ffdde6a..c940f15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ksm_staking", - "version": "1.0.0", + "version": "2.0.0", "description": "FB KSM Staking", "main": "index.js", "scripts": { @@ -9,7 +9,7 @@ "author": "", "license": "ISC", "dependencies": { - "@polkadot/api": "6.3.1", + "@polkadot/api": "^10.9.1", "fireblocks-sdk": ">=1.7.1", "fs": "0.0.1-security", "path": "^0.12.7", diff --git a/src/ksm-staker.ts b/src/ksm-staker.ts index 0a134d1..f59bb63 100644 --- a/src/ksm-staker.ts +++ b/src/ksm-staker.ts @@ -28,23 +28,22 @@ export class KSMStaker { * Bond an amount of KSM from the stash to the controller * @param vaultAccountId - Stash vault account ID * @param amount - the amount to bond - * @param controllerAddress - the controller's address * @param rewardDestination - rewards destination (Stash, Staked or Controller) */ - async bond(vaultAccountId, amount?: number, controllerAddress?: string, rewardDestination?: string) { + async bond(vaultAccountId, amount?: number, rewardDestination?: string) { if(!amount) { const availableBalance = (await this.apiClient.getVaultAccountAsset(vaultAccountId, this.getAssetId())).available; amount = Number.parseFloat(availableBalance); } - const txNote = controllerAddress ? `Bond ${amount} KSM to ${controllerAddress}` : `Bond ${amount} KSM`; + const txNote = `Bond ${amount} KSM`; console.log(txNote); await this.sendTransaction({ vaultAccountId, params: [ - 'staking.bond', controllerAddress || await this.getPermanentAddress(vaultAccountId), + 'staking.bond', (amount * 1000000000000).toString(), rewardDestination? rewardDestination: 'Stash' ], @@ -120,8 +119,8 @@ export class KSMStaker { * @param controllerAddress - new controller address */ - async setController(vaultAccountId, controllerAddress){ - await this.sendTransaction({params: ['staking.setController', controllerAddress], vaultAccountId, txNote: `Setting ${controllerAddress} as controller`}) + async setController(vaultAccountId){ + throw new Error("setController is no longer supported in DOT / KSM / WND, for more information see README.md") } }