parent
c7718d2270
commit
140189c710
58
package.json
58
package.json
@ -68,7 +68,7 @@
|
||||
"devDependencies": {
|
||||
"@crustio/crust-pin": "^1.0.0",
|
||||
"@pinata/sdk": "^1.2.1",
|
||||
"@polkadot/dev": "^0.73.16",
|
||||
"@polkadot/dev": "^0.73.17",
|
||||
"@types/chart.js": "^2.9.37",
|
||||
"@types/file-saver": "^2.0.5",
|
||||
"@types/react-beautiful-dnd": "^13.1.4",
|
||||
@ -93,34 +93,34 @@
|
||||
"styled-components": "^5.3.10"
|
||||
},
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^10.6.1",
|
||||
"@polkadot/api-augment": "^10.6.1",
|
||||
"@polkadot/api-base": "^10.6.1",
|
||||
"@polkadot/api-contract": "^10.6.1",
|
||||
"@polkadot/api-derive": "^10.6.1",
|
||||
"@polkadot/hw-ledger": "^12.1.2",
|
||||
"@polkadot/keyring": "^12.1.2",
|
||||
"@polkadot/networks": "^12.1.2",
|
||||
"@polkadot/phishing": "^0.21.2",
|
||||
"@polkadot/rpc-augment": "^10.6.1",
|
||||
"@polkadot/rpc-core": "^10.6.1",
|
||||
"@polkadot/rpc-provider": "^10.6.1",
|
||||
"@polkadot/types": "^10.6.1",
|
||||
"@polkadot/types-augment": "^10.6.1",
|
||||
"@polkadot/types-codec": "^10.6.1",
|
||||
"@polkadot/types-create": "^10.6.1",
|
||||
"@polkadot/types-known": "^10.6.1",
|
||||
"@polkadot/types-support": "^10.6.1",
|
||||
"@polkadot/util": "^12.1.2",
|
||||
"@polkadot/util-crypto": "^12.1.2",
|
||||
"@polkadot/wasm-crypto": "^7.1.2",
|
||||
"@polkadot/x-bigint": "^12.1.2",
|
||||
"@polkadot/x-fetch": "^12.1.2",
|
||||
"@polkadot/x-global": "^12.1.2",
|
||||
"@polkadot/x-randomvalues": "^12.1.2",
|
||||
"@polkadot/x-textdecoder": "^12.1.2",
|
||||
"@polkadot/x-textencoder": "^12.1.2",
|
||||
"@polkadot/x-ws": "^12.1.2",
|
||||
"@polkadot/api": "^10.7.1",
|
||||
"@polkadot/api-augment": "^10.7.1",
|
||||
"@polkadot/api-base": "^10.7.1",
|
||||
"@polkadot/api-contract": "^10.7.1",
|
||||
"@polkadot/api-derive": "^10.7.1",
|
||||
"@polkadot/hw-ledger": "^12.2.1",
|
||||
"@polkadot/keyring": "^12.2.1",
|
||||
"@polkadot/networks": "^12.2.1",
|
||||
"@polkadot/phishing": "^0.21.3",
|
||||
"@polkadot/rpc-augment": "^10.7.1",
|
||||
"@polkadot/rpc-core": "^10.7.1",
|
||||
"@polkadot/rpc-provider": "^10.7.1",
|
||||
"@polkadot/types": "^10.7.1",
|
||||
"@polkadot/types-augment": "^10.7.1",
|
||||
"@polkadot/types-codec": "^10.7.1",
|
||||
"@polkadot/types-create": "^10.7.1",
|
||||
"@polkadot/types-known": "^10.7.1",
|
||||
"@polkadot/types-support": "^10.7.1",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/util-crypto": "^12.2.1",
|
||||
"@polkadot/wasm-crypto": "^7.2.1",
|
||||
"@polkadot/x-bigint": "^12.2.1",
|
||||
"@polkadot/x-fetch": "^12.2.1",
|
||||
"@polkadot/x-global": "^12.2.1",
|
||||
"@polkadot/x-randomvalues": "^12.2.1",
|
||||
"@polkadot/x-textdecoder": "^12.2.1",
|
||||
"@polkadot/x-textencoder": "^12.2.1",
|
||||
"@polkadot/x-ws": "^12.2.1",
|
||||
"styled-components": "^5.3.1",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
|
||||
@ -34,14 +34,14 @@
|
||||
"@metaverse-network-sdk/type-definitions": "0.0.1-16",
|
||||
"@parallel-finance/type-definitions": "1.7.17",
|
||||
"@phala/typedefs": "0.2.33",
|
||||
"@polkadot/api": "^10.6.1",
|
||||
"@polkadot/api-derive": "^10.6.1",
|
||||
"@polkadot/networks": "^12.1.2",
|
||||
"@polkadot/types": "^10.6.1",
|
||||
"@polkadot/util": "^12.1.2",
|
||||
"@polkadot/wasm-util": "^7.1.2",
|
||||
"@polkadot/x-fetch": "^12.1.2",
|
||||
"@polkadot/x-ws": "^12.1.2",
|
||||
"@polkadot/api": "^10.7.1",
|
||||
"@polkadot/api-derive": "^10.7.1",
|
||||
"@polkadot/networks": "^12.2.1",
|
||||
"@polkadot/types": "^10.7.1",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/wasm-util": "^7.2.1",
|
||||
"@polkadot/x-fetch": "^12.2.1",
|
||||
"@polkadot/x-ws": "^12.2.1",
|
||||
"@polymeshassociation/polymesh-types": "5.4.0",
|
||||
"@snowfork/snowbridge-types": "0.2.7",
|
||||
"@sora-substrate/type-definitions": "1.17.5",
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
"sideEffects": false,
|
||||
"version": "0.130.2-2-x",
|
||||
"dependencies": {
|
||||
"@polkadot/dev": "^0.73.16",
|
||||
"@polkadot/dev": "^0.73.17",
|
||||
"@polkadot/react-components": "^0.130.2-2-x",
|
||||
"electron-log": "^5.0.0-beta.23",
|
||||
"electron-updater": "^5.3.0",
|
||||
|
||||
@ -28,7 +28,17 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
|
||||
try {
|
||||
// we need to be able to bond
|
||||
api.tx.staking.bond(ZERO_ACCOUNT, BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
if (api.tx.staking.bond.meta.args.length === 3) {
|
||||
// previous generation, controller account is required
|
||||
// @ts-expect-error Previous generation
|
||||
api.tx.staking.bond(ZERO_ACCOUNT, BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else if (api.tx.staking.bond.meta.args.length === 2) {
|
||||
// current, no controller account
|
||||
api.tx.staking.bond(BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else {
|
||||
// unknown
|
||||
return false;
|
||||
}
|
||||
} catch {
|
||||
console.warn('Unable to create staking bond transaction, disabling staking route');
|
||||
|
||||
|
||||
@ -28,7 +28,17 @@ function needsApiCheck (api: ApiPromise): boolean {
|
||||
|
||||
try {
|
||||
// we need to be able to bond
|
||||
api.tx.staking.bond(ZERO_ACCOUNT, BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
if (api.tx.staking.bond.meta.args.length === 3) {
|
||||
// previous generation, controller account is required
|
||||
// @ts-expect-error Previous generation
|
||||
api.tx.staking.bond(ZERO_ACCOUNT, BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else if (api.tx.staking.bond.meta.args.length === 2) {
|
||||
// current, no controller account
|
||||
api.tx.staking.bond(BN_ONE, { Account: ZERO_ACCOUNT });
|
||||
} else {
|
||||
// unknown
|
||||
return false;
|
||||
}
|
||||
} catch {
|
||||
console.warn('Unable to create staking bond transaction, disabling staking route');
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
"dependencies": {
|
||||
"@polkadot/apps-config": "^0.130.2-2-x",
|
||||
"@polkadot/apps-routing": "^0.130.2-2-x",
|
||||
"@polkadot/dev": "^0.73.16",
|
||||
"@polkadot/dev": "^0.73.17",
|
||||
"@polkadot/react-api": "^0.130.2-2-x",
|
||||
"@polkadot/react-components": "^0.130.2-2-x",
|
||||
"@polkadot/react-hooks": "^0.130.2-2-x",
|
||||
|
||||
@ -16,12 +16,12 @@
|
||||
"type": "module",
|
||||
"version": "0.130.2-2-x",
|
||||
"dependencies": {
|
||||
"@polkadot/hw-ledger": "^12.1.2",
|
||||
"@polkadot/phishing": "^0.21.2",
|
||||
"@polkadot/hw-ledger": "^12.2.1",
|
||||
"@polkadot/phishing": "^0.21.3",
|
||||
"@polkadot/react-components": "^0.130.2-2-x",
|
||||
"@polkadot/react-hooks": "^0.130.2-2-x",
|
||||
"@polkadot/util": "^12.1.2",
|
||||
"@polkadot/vanitygen": "^0.54.3",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/vanitygen": "^0.54.4",
|
||||
"detect-browser": "^5.3.0",
|
||||
"file-saver": "^2.0.5"
|
||||
},
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
"type": "module",
|
||||
"version": "0.130.2-2-x",
|
||||
"dependencies": {
|
||||
"@polkadot/api-contract": "^10.6.1",
|
||||
"@polkadot/api-contract": "^10.7.1",
|
||||
"eventemitter3": "^5.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2023 @polkadot/app-staking authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
|
||||
import { InputAddress, Modal, TxButton } from '@polkadot/react-components';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
@ -26,6 +26,11 @@ function SetControllerAccount ({ defaultControllerId, onClose, stashId }: Props)
|
||||
[]
|
||||
);
|
||||
|
||||
const needsController = useMemo(
|
||||
() => api.tx.staking.setController.meta.args.length === 1,
|
||||
[api]
|
||||
);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
header={t<string>('Change controller account')}
|
||||
@ -40,30 +45,43 @@ function SetControllerAccount ({ defaultControllerId, onClose, stashId }: Props)
|
||||
value={stashId}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
<Modal.Columns hint={t<string>('The selected controller tied to this stash. Once set, this account will be able to control the actions performed by the stash account.')}>
|
||||
<InputAddress
|
||||
defaultValue={defaultControllerId}
|
||||
label={t<string>('controller account')}
|
||||
onChange={setControllerId}
|
||||
type='account'
|
||||
value={controllerId}
|
||||
/>
|
||||
<InputValidationController
|
||||
accountId={stashId}
|
||||
controllerId={controllerId}
|
||||
defaultController={defaultControllerId}
|
||||
onError={_setError}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
{needsController && (
|
||||
<Modal.Columns hint={t<string>('The selected controller tied to this stash. Once set, this account will be able to control the actions performed by the stash account.')}>
|
||||
<InputAddress
|
||||
defaultValue={defaultControllerId}
|
||||
label={t<string>('controller account')}
|
||||
onChange={setControllerId}
|
||||
type='account'
|
||||
value={controllerId}
|
||||
/>
|
||||
<InputValidationController
|
||||
accountId={stashId}
|
||||
controllerId={controllerId}
|
||||
defaultController={defaultControllerId}
|
||||
onError={_setError}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
)}
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
<TxButton
|
||||
accountId={stashId}
|
||||
icon='sign-in-alt'
|
||||
isDisabled={!controllerId || isFatal}
|
||||
isDisabled={
|
||||
isFatal ||
|
||||
(
|
||||
needsController
|
||||
? !controllerId
|
||||
: false
|
||||
)
|
||||
}
|
||||
label={t<string>('Set controller')}
|
||||
onStart={onClose}
|
||||
params={[controllerId]}
|
||||
params={
|
||||
needsController
|
||||
? [controllerId]
|
||||
: []
|
||||
}
|
||||
tx={api.tx.staking.setController}
|
||||
/>
|
||||
</Modal.Actions>
|
||||
|
||||
@ -12,6 +12,7 @@ import { useApi, useCall } from '@polkadot/react-hooks';
|
||||
|
||||
import { useTranslation } from '../../translate.js';
|
||||
import { createDestCurr } from '../destOptions.js';
|
||||
import SenderInfo from '../partials/SenderInfo.js';
|
||||
|
||||
interface Props {
|
||||
defaultDestination?: RewardDestination;
|
||||
@ -42,18 +43,10 @@ function SetRewardDestination ({ controllerId, defaultDestination, onClose, stas
|
||||
size='large'
|
||||
>
|
||||
<Modal.Content>
|
||||
<Modal.Columns hint={t<string>('The stash and controller pair as linked. This operation will be performed via the controller.')}>
|
||||
<InputAddress
|
||||
defaultValue={stashId}
|
||||
isDisabled
|
||||
label={t<string>('stash account')}
|
||||
/>
|
||||
<InputAddress
|
||||
defaultValue={controllerId}
|
||||
isDisabled
|
||||
label={t<string>('controller account')}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
<SenderInfo
|
||||
controllerId={controllerId}
|
||||
stashId={stashId}
|
||||
/>
|
||||
<Modal.Columns hint={t<string>('All rewards will go towards the selected output destination when a payout is made.')}>
|
||||
<Dropdown
|
||||
defaultValue={defaultDestination?.toString()}
|
||||
|
||||
@ -1,21 +1,22 @@
|
||||
// Copyright 2017-2023 @polkadot/app-staking authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AccountId, StakingLedger } from '@polkadot/types/interfaces';
|
||||
import type { StakingLedger } from '@polkadot/types/interfaces';
|
||||
import type { BN } from '@polkadot/util';
|
||||
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { InputAddress, InputBalance, Modal, Static, styled, TxButton } from '@polkadot/react-components';
|
||||
import { InputBalance, Modal, Static, styled, TxButton } from '@polkadot/react-components';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import { BlockToTime, FormatBalance } from '@polkadot/react-query';
|
||||
import { BN_ZERO } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../../translate.js';
|
||||
import SenderInfo from '../partials/SenderInfo.js';
|
||||
import useUnbondDuration from '../useUnbondDuration.js';
|
||||
|
||||
interface Props {
|
||||
controllerId?: AccountId | string | null;
|
||||
controllerId?: string | null;
|
||||
onClose: () => void;
|
||||
stakingLedger?: StakingLedger;
|
||||
stashId: string;
|
||||
@ -35,18 +36,10 @@ function Unbond ({ controllerId, onClose, stakingLedger, stashId }: Props): Reac
|
||||
size='large'
|
||||
>
|
||||
<Modal.Content>
|
||||
<Modal.Columns hint={t<string>('The stash and controller pair, here the controller will be used to send the transaction.')}>
|
||||
<InputAddress
|
||||
defaultValue={stashId}
|
||||
isDisabled
|
||||
label={t<string>('stash account')}
|
||||
/>
|
||||
<InputAddress
|
||||
defaultValue={controllerId}
|
||||
isDisabled
|
||||
label={t<string>('controller account')}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
<SenderInfo
|
||||
controllerId={controllerId}
|
||||
stashId={stashId}
|
||||
/>
|
||||
<Modal.Columns hint={t<string>('The funds will only be available for withdrawal after the unbonding period, however will not be part of the staked amount after the next validator election. You can follow the unlock countdown in the UI.')}>
|
||||
<InputBalance
|
||||
autoFocus
|
||||
|
||||
@ -77,6 +77,11 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio
|
||||
const [isValidateOpen, toggleValidate] = useToggle();
|
||||
const { balancesAll, spanCount, stakingAccount } = useStashCalls(api, stashId);
|
||||
|
||||
const needsSetController = useMemo(
|
||||
() => (api.tx.staking.setController.meta.args.length === 1) || (stashId !== controllerId),
|
||||
[api, controllerId, stashId]
|
||||
);
|
||||
|
||||
const slashes = useMemo(
|
||||
() => extractSlashes(stashId, allSlashes),
|
||||
[allSlashes, stashId]
|
||||
@ -87,8 +92,7 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio
|
||||
accountId: controllerId,
|
||||
extrinsic: api.tx.staking.withdrawUnbonded.meta.args.length === 1
|
||||
? api.tx.staking.withdrawUnbonded(spanCount)
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore (We are doing toHex here since we have a Vec<u8> input)
|
||||
// @ts-expect-error Previous generation
|
||||
: api.tx.staking.withdrawUnbonded()
|
||||
}),
|
||||
[api, controllerId, queueExtrinsic, spanCount]
|
||||
@ -306,7 +310,7 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio
|
||||
/>
|
||||
<Menu.Divider />
|
||||
<Menu.Item
|
||||
isDisabled={!isOwnStash}
|
||||
isDisabled={!isOwnStash || !needsSetController}
|
||||
label={t<string>('Change controller account')}
|
||||
onClick={toggleSetController}
|
||||
/>
|
||||
|
||||
@ -26,7 +26,7 @@ function NewNominator ({ isInElection, targets }: Props): React.ReactElement<Pro
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
const [isVisible, toggleVisible] = useToggle();
|
||||
const [{ bondOwnTx, bondTx, controllerId, controllerTx, stashId }, setBondInfo] = useState<BondInfo>({});
|
||||
const [{ bondTx, controllerId, controllerTx, stashId }, setBondInfo] = useState<BondInfo>({});
|
||||
const [{ nominateTx }, setNominateInfo] = useState<NominateInfo>({});
|
||||
const [step, setStep] = useState(1);
|
||||
const isDisabled = isInElection || !isFunction(api.tx.utility?.batch);
|
||||
@ -111,7 +111,7 @@ function NewNominator ({ isInElection, targets }: Props): React.ReactElement<Pro
|
||||
params={[
|
||||
stashId === controllerId
|
||||
? [bondTx, nominateTx]
|
||||
: [bondOwnTx, nominateTx, controllerTx]
|
||||
: [bondTx, nominateTx, controllerTx]
|
||||
]}
|
||||
tx={api.tx.utility.batchAll || api.tx.utility.batch}
|
||||
/>
|
||||
|
||||
@ -28,7 +28,7 @@ function NewValidator ({ isInElection, minCommission, targets }: Props): React.R
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
const [isVisible, toggleVisible] = useToggle();
|
||||
const [{ bondOwnTx, bondTx, controllerId, controllerTx, stashId }, setBondInfo] = useState<BondInfo>({});
|
||||
const [{ bondTx, controllerId, controllerTx, stashId }, setBondInfo] = useState<BondInfo>({});
|
||||
const [{ sessionTx }, setSessionInfo] = useState<SessionInfo>({});
|
||||
const [{ validateTx }, setValidateInfo] = useState<ValidateInfo>({});
|
||||
const [step, setStep] = useState(1);
|
||||
@ -120,7 +120,7 @@ function NewValidator ({ isInElection, minCommission, targets }: Props): React.R
|
||||
params={[
|
||||
controllerId === stashId
|
||||
? [bondTx, sessionTx, validateTx]
|
||||
: [bondOwnTx, sessionTx, validateTx, controllerTx]
|
||||
: [bondTx, sessionTx, validateTx, controllerTx]
|
||||
]}
|
||||
tx={api.tx.utility.batchAll || api.tx.utility.batch}
|
||||
/>
|
||||
|
||||
@ -28,8 +28,7 @@ interface Props {
|
||||
onChange: (info: BondInfo) => void;
|
||||
}
|
||||
|
||||
const EMPTY_INFO = {
|
||||
bondOwnTx: null,
|
||||
const EMPTY_INFO: BondInfo = {
|
||||
bondTx: null,
|
||||
controllerId: null,
|
||||
controllerTx: null,
|
||||
@ -51,6 +50,11 @@ function Bond ({ className = '', isNominating, minNominated, minNominatorBond, m
|
||||
const destBalance = useCall<DeriveBalancesAll>(api.derive.balances?.all, [destAccount]);
|
||||
const bondedBlocks = useUnbondDuration();
|
||||
|
||||
const needsController = useMemo(
|
||||
() => api.tx.staking.bond.meta.args.length === 3,
|
||||
[api]
|
||||
);
|
||||
|
||||
const options = useMemo(
|
||||
() => createDestCurr(t),
|
||||
[t]
|
||||
@ -77,19 +81,29 @@ function Bond ({ className = '', isNominating, minNominated, minNominatorBond, m
|
||||
const bondDest = destination === 'Account'
|
||||
? { Account: destAccount }
|
||||
: destination;
|
||||
const [mapControllerId, mapControllerError] = needsController
|
||||
? [controllerId, controllerError]
|
||||
: [stashId, null];
|
||||
|
||||
onChange(
|
||||
(amount && amount.gtn(0) && !amountError?.error && !controllerError && controllerId && stashId)
|
||||
(amount && amount.gtn(0) && !amountError?.error && !mapControllerError && mapControllerId && stashId)
|
||||
? {
|
||||
bondOwnTx: api.tx.staking.bond(stashId, amount, bondDest),
|
||||
bondTx: api.tx.staking.bond(controllerId, amount, bondDest),
|
||||
controllerId,
|
||||
controllerTx: api.tx.staking.setController(controllerId),
|
||||
bondTx: needsController
|
||||
// The bond always goes through first, if a controller is used
|
||||
// we have a batch with setController at the end
|
||||
// @ts-expect-error Previous generation
|
||||
? api.tx.staking.bond(stashId, amount, bondDest)
|
||||
: api.tx.staking.bond(amount, bondDest),
|
||||
controllerId: mapControllerId,
|
||||
controllerTx: needsController
|
||||
// @ts-expect-error Previous generation
|
||||
? api.tx.staking.setController(mapControllerId)
|
||||
: null,
|
||||
stashId
|
||||
}
|
||||
: EMPTY_INFO
|
||||
);
|
||||
}, [api, amount, amountError, controllerError, controllerId, destination, destAccount, stashId, onChange]);
|
||||
}, [api, amount, amountError, controllerError, controllerId, destination, destAccount, needsController, onChange, stashId]);
|
||||
|
||||
const hasValue = !!amount?.gtn(0);
|
||||
const isAccount = destination === 'Account';
|
||||
@ -99,10 +113,19 @@ function Bond ({ className = '', isNominating, minNominated, minNominatorBond, m
|
||||
<div className={className}>
|
||||
<Modal.Columns
|
||||
hint={
|
||||
<>
|
||||
<p>{t<string>('Think of the stash as your cold wallet and the controller as your hot wallet. Funding operations are controlled by the stash, any other non-funding actions by the controller itself.')}</p>
|
||||
<p>{t<string>('To ensure optimal fund security using the same stash/controller is strongly discouraged, but not forbidden.')}</p>
|
||||
</>
|
||||
needsController
|
||||
? (
|
||||
<>
|
||||
<p>{t<string>('Think of the stash as your cold wallet and the controller as your hot wallet. Funding operations are controlled by the stash, any other non-funding actions by the controller itself.')}</p>
|
||||
<p>{t<string>('To ensure optimal fund security using the same stash/controller is strongly discouraged, but not forbidden.')}</p>
|
||||
</>
|
||||
)
|
||||
: (
|
||||
<>
|
||||
<p>{t<string>('The stash should be treated as a cold wallet.')}</p>
|
||||
<p>{t<string>('As such it is recommended that you setup a proxy to control operations via the stash.')}</p>
|
||||
</>
|
||||
)
|
||||
}
|
||||
>
|
||||
<InputAddress
|
||||
@ -111,17 +134,21 @@ function Bond ({ className = '', isNominating, minNominated, minNominatorBond, m
|
||||
type='account'
|
||||
value={stashId}
|
||||
/>
|
||||
<InputAddress
|
||||
label={t<string>('controller account')}
|
||||
onChange={setControllerId}
|
||||
type='account'
|
||||
value={controllerId}
|
||||
/>
|
||||
<InputValidationController
|
||||
accountId={stashId}
|
||||
controllerId={controllerId}
|
||||
onError={_setError}
|
||||
/>
|
||||
{needsController && (
|
||||
<>
|
||||
<InputAddress
|
||||
label={t<string>('controller account')}
|
||||
onChange={setControllerId}
|
||||
type='account'
|
||||
value={controllerId}
|
||||
/>
|
||||
<InputValidationController
|
||||
accountId={stashId}
|
||||
controllerId={controllerId}
|
||||
onError={_setError}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Modal.Columns>
|
||||
{startBalance && (
|
||||
<Modal.Columns
|
||||
|
||||
@ -20,21 +20,29 @@ function SenderInfo ({ className = '', controllerId, stashId }: Props): React.Re
|
||||
return null;
|
||||
}
|
||||
|
||||
const showController = stashId !== controllerId;
|
||||
|
||||
return (
|
||||
<Modal.Columns
|
||||
className={className}
|
||||
hint={t<string>('The stash that is to be affected. The transaction will be sent from the associated controller account.')}
|
||||
hint={
|
||||
showController
|
||||
? t<string>('The stash that is to be affected. The transaction will be sent from the associated controller account.')
|
||||
: t<string>('The stash that is to be affected.')
|
||||
}
|
||||
>
|
||||
<InputAddress
|
||||
defaultValue={stashId}
|
||||
isDisabled
|
||||
label={t<string>('stash account')}
|
||||
/>
|
||||
<InputAddress
|
||||
defaultValue={controllerId}
|
||||
isDisabled
|
||||
label={t<string>('controller account')}
|
||||
/>
|
||||
{showController && (
|
||||
<InputAddress
|
||||
defaultValue={controllerId}
|
||||
isDisabled
|
||||
label={t<string>('controller account')}
|
||||
/>
|
||||
)}
|
||||
</Modal.Columns>
|
||||
);
|
||||
}
|
||||
|
||||
@ -5,11 +5,12 @@ import type { SessionInfo } from './types.js';
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import { Input, InputAddress, Modal } from '@polkadot/react-components';
|
||||
import { Input, Modal } from '@polkadot/react-components';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import { isHex } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../../translate.js';
|
||||
import SenderInfo from './SenderInfo.js';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
@ -42,19 +43,10 @@ function SessionKey ({ className = '', controllerId, onChange, stashId, withFocu
|
||||
return (
|
||||
<div className={className}>
|
||||
{withSenders && (
|
||||
<Modal.Columns hint={t<string>('The stash and controller pair. This transaction, setting the session keys, will be sent from the controller.')}>
|
||||
<InputAddress
|
||||
defaultValue={stashId}
|
||||
isDisabled
|
||||
label={t<string>('stash account')}
|
||||
/>
|
||||
<InputAddress
|
||||
className='medium'
|
||||
defaultValue={controllerId}
|
||||
isDisabled
|
||||
label={t<string>('controller account')}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
<SenderInfo
|
||||
controllerId={controllerId}
|
||||
stashId={stashId}
|
||||
/>
|
||||
)}
|
||||
<Modal.Columns hint={t<string>('The hex output from author_rotateKeys, as executed on the validator node. The keys will show as pending until applied at the start of a new session.')}>
|
||||
<Input
|
||||
|
||||
@ -5,11 +5,12 @@ import type { ValidateInfo } from './types.js';
|
||||
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
|
||||
import { Dropdown, InputAddress, InputNumber, MarkError, Modal } from '@polkadot/react-components';
|
||||
import { Dropdown, InputNumber, MarkError, Modal } from '@polkadot/react-components';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import { BN, BN_HUNDRED as MAX_COMM, BN_ONE, bnMax, isFunction } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../../translate.js';
|
||||
import SenderInfo from './SenderInfo.js';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
@ -67,18 +68,10 @@ function Validate ({ className = '', controllerId, minCommission, onChange, stas
|
||||
return (
|
||||
<div className={className}>
|
||||
{withSenders && (
|
||||
<Modal.Columns hint={t<string>('The stash and controller pair. This transaction, managing preferences, will be sent from the controller.')}>
|
||||
<InputAddress
|
||||
defaultValue={stashId}
|
||||
isDisabled
|
||||
label={t<string>('stash account')}
|
||||
/>
|
||||
<InputAddress
|
||||
defaultValue={controllerId}
|
||||
isDisabled
|
||||
label={t<string>('controller account')}
|
||||
/>
|
||||
</Modal.Columns>
|
||||
<SenderInfo
|
||||
controllerId={controllerId}
|
||||
stashId={stashId}
|
||||
/>
|
||||
)}
|
||||
<Modal.Columns hint={t<string>('The commission is deducted from all rewards before the remainder is split with nominators.')}>
|
||||
<InputNumber
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
import type { SubmittableExtrinsic } from '@polkadot/api/types';
|
||||
|
||||
export interface BondInfo {
|
||||
bondOwnTx?: SubmittableExtrinsic<'promise'> | null;
|
||||
bondTx?: SubmittableExtrinsic<'promise'> | null;
|
||||
controllerId?: string | null;
|
||||
controllerTx?: SubmittableExtrinsic<'promise'> | null;
|
||||
|
||||
@ -20,10 +20,10 @@
|
||||
"path": false
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^10.6.1",
|
||||
"@polkadot/extension-compat-metamask": "^0.46.2",
|
||||
"@polkadot/extension-dapp": "^0.46.2",
|
||||
"@polkadot/rpc-provider": "^10.6.1",
|
||||
"@polkadot/api": "^10.7.1",
|
||||
"@polkadot/extension-compat-metamask": "^0.46.3",
|
||||
"@polkadot/extension-dapp": "^0.46.3",
|
||||
"@polkadot/rpc-provider": "^10.7.1",
|
||||
"fflate": "^0.7.4",
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
|
||||
@ -19,15 +19,15 @@
|
||||
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@polkadot/keyring": "^12.1.2",
|
||||
"@polkadot/keyring": "^12.2.1",
|
||||
"@polkadot/react-api": "^0.130.2-2-x",
|
||||
"@polkadot/react-identicon": "^3.3.1",
|
||||
"@polkadot/react-qr": "^3.3.1",
|
||||
"@polkadot/react-identicon": "^3.4.1",
|
||||
"@polkadot/react-qr": "^3.4.1",
|
||||
"@polkadot/react-query": "^0.130.2-2-x",
|
||||
"@polkadot/ui-keyring": "^3.3.1",
|
||||
"@polkadot/ui-settings": "^3.3.1",
|
||||
"@polkadot/util": "^12.1.2",
|
||||
"@polkadot/util-crypto": "^12.1.2",
|
||||
"@polkadot/ui-keyring": "^3.4.1",
|
||||
"@polkadot/ui-settings": "^3.4.1",
|
||||
"@polkadot/util": "^12.2.1",
|
||||
"@polkadot/util-crypto": "^12.2.1",
|
||||
"chart.js": "^4.3.0",
|
||||
"chartjs-plugin-annotation": "^2.2.1",
|
||||
"chartjs-plugin-crosshair": "^1.2.0",
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
"type": "module",
|
||||
"version": "0.130.2-2-x",
|
||||
"dependencies": {
|
||||
"@polkadot/hw-ledger": "^12.1.2",
|
||||
"@polkadot/hw-ledger-transports": "^12.1.2",
|
||||
"@polkadot/hw-ledger": "^12.2.1",
|
||||
"@polkadot/hw-ledger-transports": "^12.2.1",
|
||||
"is-ipfs": "^8.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
"type": "module",
|
||||
"version": "0.130.2-2-x",
|
||||
"dependencies": {
|
||||
"@polkadot/hw-ledger": "^12.1.2",
|
||||
"@polkadot/hw-ledger": "^12.2.1",
|
||||
"@polkadot/react-components": "^0.130.2-2-x"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
"testcontainers": "^9.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/types-support": "^10.6.1",
|
||||
"@polkadot/types-support": "^10.7.1",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"tsconfig-paths": "^4.2.0"
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user