Override conviction display for Polkadot (#3243)
* Override conviction display for Polkadot * Add Polkadot override
This commit is contained in:
parent
ef3bcbdc01
commit
eba8f4c012
@ -33,10 +33,10 @@
|
||||
"afterSign": "electron-builder-notarize"
|
||||
},
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^1.26.0-beta.0",
|
||||
"@polkadot/api-contract": "^1.26.0-beta.0",
|
||||
"@polkadot/api": "^1.26.0-beta.1",
|
||||
"@polkadot/api-contract": "^1.26.0-beta.1",
|
||||
"@polkadot/keyring": "^2.18.1",
|
||||
"@polkadot/types": "^1.26.0-beta.0",
|
||||
"@polkadot/types": "^1.26.0-beta.1",
|
||||
"@polkadot/util": "^2.18.1",
|
||||
"@polkadot/util-crypto": "^2.18.1",
|
||||
"@polkadot/wasm-crypto": "^1.2.1",
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@polkadot/react-components": "0.51.0-beta.2",
|
||||
"@polkadot/vanitygen": "^0.17.0-beta.2",
|
||||
"@polkadot/vanitygen": "^0.17.1",
|
||||
"detect-browser": "^5.1.1",
|
||||
"file-saver": "^2.0.2"
|
||||
}
|
||||
|
||||
@ -12,6 +12,6 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@polkadot/api-contract": "^1.26.0-beta.0"
|
||||
"@polkadot/api-contract": "^1.26.0-beta.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.10.5",
|
||||
"@polkadot/api": "^1.26.0-beta.0",
|
||||
"@polkadot/api": "^1.26.0-beta.1",
|
||||
"@polkadot/extension-dapp": "^0.32.0-beta.8",
|
||||
"rxjs-compat": "^6.6.0"
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import BN from 'bn.js';
|
||||
import React, { useState, useMemo } from 'react';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
|
||||
@ -17,12 +18,18 @@ export interface Props {
|
||||
}
|
||||
|
||||
const CONVICTIONS: [number, number][] = [1, 2, 4, 8, 16, 32].map((lock, index) => [index + 1, lock]);
|
||||
const SEC_DAY = 60 * 60 * 24;
|
||||
|
||||
// REMOVE once Polkadot is upgraded with the correct conviction
|
||||
const PERIODS: Record<string, BN> = {
|
||||
'0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3': new BN(403200)
|
||||
};
|
||||
|
||||
function AvailableDisplay ({ className = '', help, label, onChange, value }: Props): React.ReactElement<Props> | null {
|
||||
const { api } = useApi();
|
||||
const { t } = useTranslation();
|
||||
const [enact] = useState(
|
||||
(api.consts.democracy.enactmentPeriod.toNumber() * api.consts.timestamp.minimumPeriod.toNumber() / 1000 * 2) / 60 / 60 / 24
|
||||
((PERIODS[api.genesisHash.toHex()] || api.consts.democracy.enactmentPeriod).toNumber() * api.consts.timestamp.minimumPeriod.toNumber() / 1000 * 2) / SEC_DAY
|
||||
);
|
||||
|
||||
const convictionOpts = useMemo(() => [
|
||||
|
||||
20
yarn.lock
20
yarn.lock
@ -2936,7 +2936,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/api-contract@npm:^1.26.0-beta.0":
|
||||
"@polkadot/api-contract@npm:^1.26.0-beta.1":
|
||||
version: 1.26.0-beta.1
|
||||
resolution: "@polkadot/api-contract@npm:1.26.0-beta.1"
|
||||
dependencies:
|
||||
@ -2969,7 +2969,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/api@npm:^1.26.0-beta.0":
|
||||
"@polkadot/api@npm:^1.26.0-beta.1":
|
||||
version: 1.26.0-beta.1
|
||||
resolution: "@polkadot/api@npm:1.26.0-beta.1"
|
||||
dependencies:
|
||||
@ -2996,7 +2996,7 @@ __metadata:
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/react-components": 0.51.0-beta.2
|
||||
"@polkadot/vanitygen": ^0.17.0-beta.2
|
||||
"@polkadot/vanitygen": ^0.17.1
|
||||
detect-browser: ^5.1.1
|
||||
file-saver: ^2.0.2
|
||||
languageName: unknown
|
||||
@ -3017,7 +3017,7 @@ __metadata:
|
||||
resolution: "@polkadot/app-contracts@workspace:packages/page-contracts"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/api-contract": ^1.26.0-beta.0
|
||||
"@polkadot/api-contract": ^1.26.0-beta.1
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@ -3401,7 +3401,7 @@ __metadata:
|
||||
resolution: "@polkadot/react-api@workspace:packages/react-api"
|
||||
dependencies:
|
||||
"@babel/runtime": ^7.10.5
|
||||
"@polkadot/api": ^1.26.0-beta.0
|
||||
"@polkadot/api": ^1.26.0-beta.1
|
||||
"@polkadot/extension-dapp": ^0.32.0-beta.8
|
||||
rxjs-compat: ^6.6.0
|
||||
languageName: unknown
|
||||
@ -3577,7 +3577,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/types@npm:^1.26.0-beta.0":
|
||||
"@polkadot/types@npm:^1.26.0-beta.1":
|
||||
version: 1.26.0-beta.1
|
||||
resolution: "@polkadot/types@npm:1.26.0-beta.1"
|
||||
dependencies:
|
||||
@ -3675,9 +3675,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/vanitygen@npm:^0.17.0-beta.2":
|
||||
version: 0.17.0-beta.2
|
||||
resolution: "@polkadot/vanitygen@npm:0.17.0-beta.2"
|
||||
"@polkadot/vanitygen@npm:^0.17.1":
|
||||
version: 0.17.1
|
||||
resolution: "@polkadot/vanitygen@npm:0.17.1"
|
||||
dependencies:
|
||||
"@babel/core": ^7.10.5
|
||||
"@babel/runtime": ^7.10.5
|
||||
@ -3687,7 +3687,7 @@ __metadata:
|
||||
yargs: ^15.4.1
|
||||
bin:
|
||||
polkadot-js-vanitygen: index.js
|
||||
checksum: 3/0736064608949fb261d39b0bcdae884ad8b47242cd2ff3ced7c1fd170bd4ceed6faf53861597b836c9d6300b3f68303772f97112612aaa7282afcbd2c0fd36bd
|
||||
checksum: 3/e2096997145a58e8887d38c12a613e51846b3ff56e817154eba2e04d217f577f81f230c77874793a57af929db178876e737fbaa2a64ac85e697d2de53b6059f5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user