From 275b05f1b1f180ff1f0e7fc4cc0fce9ea27fcc86 Mon Sep 17 00:00:00 2001 From: Gal Rogozinski Date: Tue, 5 Oct 2021 14:24:47 +0300 Subject: [PATCH] Implement Grade Of Finality Support --- src/app/components/Settings.tsx | 32 ++++++++++++++++++- src/app/components/SettingsState.ts | 5 +++ src/app/components/Wallet.tsx | 4 --- .../api/models/IUnspentOutputsResponse.ts | 18 ++--------- src/models/ISettings.ts | 5 +++ src/models/IWalletBalance.ts | 5 --- src/models/IWalletOutput.ts | 4 +-- src/models/IWalletOutputInclusionState.ts | 6 +--- src/services/settingsService.ts | 5 ++- src/services/walletService.ts | 29 ++++++++--------- 10 files changed, 65 insertions(+), 48 deletions(-) diff --git a/src/app/components/Settings.tsx b/src/app/components/Settings.tsx index 16858fc..5c9fa0a 100644 --- a/src/app/components/Settings.tsx +++ b/src/app/components/Settings.tsx @@ -42,10 +42,22 @@ class Settings extends Component { password: settings.password, accessManaPledgeID: settings.accessManaPledgeID, consensusManaPledgeID: settings.consensusManaPledgeID, + gofConfThreshold: settings.gofConfThreshold, isBusy: false }); } + private static imposeMinMax(el: HTMLInputElement): void { + if (el.value !== "") { + if (parseInt(el.value) < parseInt(el.min)) { + el.value = el.min; + } + if (parseInt(el.value) > parseInt(el.max)) { + el.value = el.max; + } + } + } + /** * Render the component. * @returns The node to render. @@ -139,6 +151,23 @@ class Settings extends Component { onChange={e => this.setState({ consensusManaPledgeID: e.target.value })} /> +
+ Grade Of Finality for confirmation +
+
+ { + Settings.imposeMinMax(e.target); + this.setState({ gofConfThreshold: e.target.valueAsNumber }); + } + } + /> +