From 272fc1706a947e2531f670f13d333e17cdd55502 Mon Sep 17 00:00:00 2001 From: agoltzman <106151463+agoltzman@users.noreply.github.com> Date: Sun, 6 Aug 2023 12:42:34 +0300 Subject: [PATCH 1/2] fix: removed controller references --- src/dot-staker.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/dot-staker.ts b/src/dot-staker.ts index 446008c..09e0148 100644 --- a/src/dot-staker.ts +++ b/src/dot-staker.ts @@ -64,10 +64,9 @@ export class DOTStaker { * Bond an amount of DOT from the stash to the controller * @param vaultAccountId - Stash vault account ID * @param amount - the amount to bond (Default is the entire available balance) - * @param controllerAddress - the controller's address * @param rewardDestination - rewards destination (Stash, Staked or Controller) */ - public async bond(vaultAccountId: string, amount?: number, controllerAddress?: string, rewardDestination?: string) { + public async bond(vaultAccountId: string, amount?: number, rewardDestination?: string) { if(!amount) { await this.refreshBalance(vaultAccountId) @@ -77,12 +76,12 @@ export class DOTStaker { const amountToBond = amount ? amount : this.availableBalance; - const txNote = controllerAddress ? `Bond ${amountToBond} DOT to ${controllerAddress}` : `Bond ${amountToBond} DOT`; + const txNote = `Bond ${amountToBond} DOT`; await this.sendTransaction({ vaultAccountId, params: [ - 'staking.bond', controllerAddress || await this.getPermanentAddress(vaultAccountId), + 'staking.bond', (this.testnet? amountToBond * 1000000000000 : amountToBond * 10000000000).toString(), rewardDestination? rewardDestination: 'Stash' ], @@ -196,7 +195,7 @@ export class DOTStaker { * @param controllerAddress - new controller address */ public async setController(vaultAccountId: string, controllerAddress: string){ - await this.sendTransaction({params: ['staking.setController', controllerAddress], vaultAccountId, txNote: `Setting ${controllerAddress} as contoller`}) + throw new Error("setController is no longer supported in DOT / KSM / WND, for more information: https://forum.polkadot.network/t/staking-controller-deprecation-plan-staking-ui-leads-comms/2748") } From 42f8231eec0d7765275ac1701bda850c8a4e87b0 Mon Sep 17 00:00:00 2001 From: agoltzman <106151463+agoltzman@users.noreply.github.com> Date: Sun, 6 Aug 2023 15:49:19 +0300 Subject: [PATCH 2/2] fix: updated readme --- README.md | 6 ++++++ package.json | 7 ++++--- src/dot-staker.ts | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1cc72d2..77e01e1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ This script allows to stake DOT 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) + ## Getting started 1. Clone this repo locally diff --git a/package.json b/package.json index 868e73b..7231027 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,16 @@ { "name": "dot_staking", - "version": "1.0.0", + "version": "2.0.0", "description": "FB DOT Staking", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "postinstall": "echo \"!!!Breaking Change Introduced!!!\nPlease see README.md\"" }, "author": "", "license": "ISC", "dependencies": { - "@polkadot/api": "^10.2.1", + "@polkadot/api": "^10.9.1", "fireblocks-sdk": ">=1.7.1", "fs": "0.0.1-security", "path": "^0.12.7", diff --git a/src/dot-staker.ts b/src/dot-staker.ts index 09e0148..1dbc18a 100644 --- a/src/dot-staker.ts +++ b/src/dot-staker.ts @@ -195,7 +195,7 @@ export class DOTStaker { * @param controllerAddress - new controller address */ public async setController(vaultAccountId: string, controllerAddress: string){ - throw new Error("setController is no longer supported in DOT / KSM / WND, for more information: https://forum.polkadot.network/t/staking-controller-deprecation-plan-staking-ui-leads-comms/2748") + throw new Error("setController is no longer supported in DOT / KSM / WND, for more information see README.md") }