Rewrite yarn.lock (#2504)
This commit is contained in:
parent
077e896374
commit
67b70b075e
@ -36,7 +36,7 @@
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/register": "^7.9.0",
|
||||
"@babel/runtime": "^7.9.2",
|
||||
"@polkadot/dev": "^0.52.3",
|
||||
"@polkadot/dev": "^0.52.4",
|
||||
"@polkadot/ts": "^0.3.14",
|
||||
"@types/bn.js": "^4.11.6",
|
||||
"@types/chart.js": "^2.9.16",
|
||||
|
||||
@ -8,6 +8,7 @@ import { identityNodes } from './identityIcons';
|
||||
function sanitize (value?: string): string {
|
||||
return value?.toLowerCase().replace('-', ' ') || '';
|
||||
}
|
||||
|
||||
export function getSystemIcon (systemName: string): 'beachball' | 'polkadot' | 'substrate' {
|
||||
return (identityNodes[systemName.toLowerCase().replace(/-/g, ' ')] || 'substrate') as 'substrate';
|
||||
}
|
||||
|
||||
@ -55,6 +55,7 @@ function checkVisible (name: string, { api, isApiConnected, isApiReady }: ApiPro
|
||||
return false;
|
||||
} else if (needsSudo && !hasSudo) {
|
||||
logDisabled(name, 'Sudo key not available');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -42,6 +42,7 @@ function Backup ({ address, onClose }: Props): React.ReactElement<Props> {
|
||||
setBackupFailed(false);
|
||||
setPassword(value);
|
||||
};
|
||||
|
||||
const _doBackup = (): void => {
|
||||
try {
|
||||
const addressKeyring = address && keyring.getPair(address);
|
||||
@ -52,6 +53,7 @@ function Backup ({ address, onClose }: Props): React.ReactElement<Props> {
|
||||
} catch (error) {
|
||||
setBackupFailed(true);
|
||||
console.error(error);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -176,20 +176,27 @@ function Create ({ className, onClose, onStatusChange, seed: propsSeed, type: pr
|
||||
|
||||
const _onChangePass = (password: string): void =>
|
||||
setPassword({ isPassValid: keyring.isPassValid(password), password });
|
||||
|
||||
const _onChangePass2 = (password2: string): void =>
|
||||
setPassword2({ isPass2Valid: keyring.isPassValid(password2) && (password2 === password), password2 });
|
||||
|
||||
const _onChangeDerive = (newDerivePath: string): void =>
|
||||
setAddress(updateAddress(seed, newDerivePath, seedType, pairType));
|
||||
|
||||
const _onChangeSeed = (newSeed: string): void =>
|
||||
setAddress(updateAddress(newSeed, derivePath, seedType, pairType));
|
||||
|
||||
const _onChangePairType = (newPairType: KeypairType): void =>
|
||||
setAddress(updateAddress(seed, derivePath, seedType, newPairType));
|
||||
|
||||
const _selectSeedType = (newSeedType: SeedType): void => {
|
||||
if (newSeedType !== seedType) {
|
||||
setAddress(generateSeed(null, derivePath, newSeedType, pairType));
|
||||
}
|
||||
};
|
||||
|
||||
const _onChangeName = (name: string): void => setName({ isNameValid: !!name.trim(), name });
|
||||
|
||||
const _toggleConfirmation = (): void => setIsConfirmationOpen(!isConfirmationOpen);
|
||||
|
||||
const _onCommit = (): void => {
|
||||
|
||||
@ -103,11 +103,15 @@ function Derive ({ className, from, onClose }: Props): React.ReactElement {
|
||||
|
||||
const _onChangeName = (name: string): void =>
|
||||
setName({ isNameValid: !!name.trim(), name });
|
||||
|
||||
const _onChangePass = (password: string): void =>
|
||||
setPassword({ isPassValid: keyring.isPassValid(password), password });
|
||||
|
||||
const _onChangePass2 = (password2: string): void =>
|
||||
setPassword2({ isPass2Valid: keyring.isPassValid(password2) && (password2 === password), password2 });
|
||||
|
||||
const _toggleConfirmation = (): void => setIsConfirmationOpen(!isConfirmationOpen);
|
||||
|
||||
const _onUnlock = (): void => {
|
||||
try {
|
||||
source.decodePkcs8(rootPass);
|
||||
|
||||
@ -28,6 +28,7 @@ function QrModal ({ className, onClose, onStatusChange }: Props): React.ReactEle
|
||||
const [scanned, setScanned] = useState<Scanned | null>(null);
|
||||
|
||||
const _onNameChange = (name: string): void => setName({ isNameValid: !!name.trim(), name });
|
||||
|
||||
const _onScan = (scanned: Scanned): void => {
|
||||
setScanned(scanned);
|
||||
|
||||
@ -35,6 +36,7 @@ function QrModal ({ className, onClose, onStatusChange }: Props): React.ReactEle
|
||||
_onNameChange(scanned.name);
|
||||
}
|
||||
};
|
||||
|
||||
const _onSave = (): void => {
|
||||
if (!scanned || !isNameValid) {
|
||||
return;
|
||||
|
||||
@ -96,6 +96,7 @@ function Address ({ address, className, filter, isFavorite, toggleFavorite }: Pr
|
||||
const _toggleForget = (): void => setIsForgetOpen(!isForgetOpen);
|
||||
const _toggleSettingPopup = (): void => setIsSettingPopupOpen(!isSettingPopupOpen);
|
||||
const _toggleTransfer = (): void => setIsTransferOpen(!isTransferOpen);
|
||||
|
||||
const _onForget = (): void => {
|
||||
if (address) {
|
||||
const status: Partial<ActionStatus> = {
|
||||
@ -113,6 +114,7 @@ function Address ({ address, className, filter, isFavorite, toggleFavorite }: Pr
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const _onGenesisChange = (genesisHash: string | null): void => {
|
||||
setGenesisHash(genesisHash);
|
||||
|
||||
@ -122,7 +124,9 @@ function Address ({ address, className, filter, isFavorite, toggleFavorite }: Pr
|
||||
|
||||
setGenesisHash(genesisHash);
|
||||
};
|
||||
|
||||
const _onFavorite = (): void => toggleFavorite(address);
|
||||
|
||||
const _saveName = (): void => {
|
||||
_toggleEditName();
|
||||
|
||||
@ -138,6 +142,7 @@ function Address ({ address, className, filter, isFavorite, toggleFavorite }: Pr
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const _saveTags = (): void => {
|
||||
_toggleEditTags();
|
||||
|
||||
|
||||
@ -47,7 +47,9 @@ function Create ({ onClose, onStatusChange }: Props): React.ReactElement<Props>
|
||||
|
||||
setAddress({ address: address || input, isAddressExisting, isAddressValid });
|
||||
};
|
||||
|
||||
const _onChangeName = (name: string): void => setName({ isNameValid: !!name.trim(), name });
|
||||
|
||||
const _onCommit = (): void => {
|
||||
const status = { action: 'create' } as ActionStatus;
|
||||
|
||||
|
||||
@ -70,6 +70,7 @@ class ABI extends React.PureComponent<Props, State> {
|
||||
isError: false
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -149,6 +150,7 @@ class ABI extends React.PureComponent<Props, State> {
|
||||
private onChange = (u8a: Uint8Array): void => {
|
||||
const { onChange, t } = this.props;
|
||||
const json = u8aToString(u8a);
|
||||
|
||||
try {
|
||||
const abi = JSON.parse(json);
|
||||
|
||||
|
||||
@ -105,6 +105,7 @@ function Call (props: Props): React.ReactElement<Props> | null {
|
||||
};
|
||||
|
||||
const _onClearOutcomes = (): void => setOutcomes([]);
|
||||
|
||||
const _onClearOutcome = (outcomeIndex: number) => (): void => {
|
||||
setOutcomes(outcomes.slice(0, outcomeIndex).concat(outcomes.slice(outcomeIndex + 1)));
|
||||
};
|
||||
|
||||
@ -38,6 +38,7 @@ function Contract (props: Props): React.ReactElement<Props> | null {
|
||||
}
|
||||
|
||||
const _toggleForget = (): void => setIsForgetOpen(!isForgetOpen);
|
||||
|
||||
const _onForget = (): void => {
|
||||
if (!address) {
|
||||
return;
|
||||
@ -56,6 +57,7 @@ function Contract (props: Props): React.ReactElement<Props> | null {
|
||||
status.status = 'error';
|
||||
status.message = error.message;
|
||||
}
|
||||
|
||||
_toggleForget();
|
||||
};
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ export function getContractForAddress (api: ApiPromise, address: StringOrNull):
|
||||
return null;
|
||||
} else {
|
||||
const abi = getContractAbi(address);
|
||||
|
||||
return abi
|
||||
? new Contract(api, abi, address)
|
||||
: null;
|
||||
|
||||
@ -114,6 +114,7 @@ class Deploy extends ContractModal<Props, State> {
|
||||
|
||||
private static getConstructorState = (contractAbi: Abi | null = null, ci = 0): Pick<State, never> => {
|
||||
const constructorIndex = Math.max(ci, 0);
|
||||
|
||||
if (!contractAbi || constructorIndex < 0 || constructorIndex >= contractAbi.constructors.length) {
|
||||
return {
|
||||
constructOptions: [],
|
||||
|
||||
@ -177,6 +177,7 @@ class ContractModal<P extends ContractModalProps, S extends ContractModalState>
|
||||
const { isBusy } = this.state;
|
||||
|
||||
onClose && onClose();
|
||||
|
||||
if (!isBusy) {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
@ -74,7 +74,10 @@ class Store extends EventEmitter {
|
||||
|
||||
private addCode (json: CodeJson): void {
|
||||
try {
|
||||
const abi = json.abi ? JSON.parse(json.abi) : null;
|
||||
const abi = json.abi
|
||||
? JSON.parse(json.abi)
|
||||
: null;
|
||||
|
||||
this.allCode[json.codeHash] = {
|
||||
contractAbi: abi
|
||||
? new Abi(registry, abi)
|
||||
|
||||
@ -11,6 +11,7 @@ interface Result {
|
||||
isMember: boolean;
|
||||
members: string[];
|
||||
}
|
||||
|
||||
function transform (allAccounts: string[], queryMembers: [AccountId, Balance][]): Result {
|
||||
const members = queryMembers.map((accountId): string => accountId.toString());
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ function Query ({ className, value: propsValue }: Props): React.ReactElement<Pro
|
||||
const [{ isValid, value }, setState] = useState(stateFromValue(propsValue || ''));
|
||||
|
||||
const _setHash = (value: string): void => setState(stateFromValue(value));
|
||||
|
||||
const _onQuery = (): void => {
|
||||
if (isValid && value.length !== 0) {
|
||||
window.location.hash = `/explorer/query/${value}`;
|
||||
|
||||
@ -12,6 +12,7 @@ let initalAssets: AssetsSubjectInfo = {};
|
||||
|
||||
try {
|
||||
const storedAsset = localStorage.getItem(ASSETS_KEY);
|
||||
|
||||
if (storedAsset) {
|
||||
initalAssets = JSON.parse(storedAsset);
|
||||
}
|
||||
@ -28,6 +29,7 @@ subject.subscribe((assets): void =>
|
||||
export default {
|
||||
add: (id: string, name: string): void => {
|
||||
const assets = subject.getValue();
|
||||
|
||||
subject.next({
|
||||
...assets,
|
||||
[id]: name
|
||||
@ -35,9 +37,11 @@ export default {
|
||||
},
|
||||
getAssets: (): AssetsSubjectInfo[] =>
|
||||
Object.entries(subject.getValue()).map(([id, name]): AssetsSubjectInfo => ({ id, name })),
|
||||
|
||||
remove: (id: string): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { [id]: ignore, ...assets } = subject.getValue();
|
||||
|
||||
subject.next(assets);
|
||||
},
|
||||
subject
|
||||
|
||||
@ -23,6 +23,7 @@ function Create ({ onClose, onRegister }: Props): React.ReactElement<Props> {
|
||||
const [name, setName] = useState('new asset');
|
||||
|
||||
const _onChangeAssetId = (assetId: BN | undefined): void => setAssetId(assetId || new BN(0));
|
||||
|
||||
const _onCommit = (): void => {
|
||||
onRegister(assetId, name);
|
||||
onClose();
|
||||
|
||||
@ -28,13 +28,16 @@ function ActionButtons ({ className, isCustomExample, isRunning, removeSnippet,
|
||||
const _onChangeName = (snippetName: string): void => {
|
||||
setSnippetName(snippetName);
|
||||
};
|
||||
|
||||
const _onPopupOpen = (): void => {
|
||||
setIsOpen(true);
|
||||
};
|
||||
|
||||
const _onPopupClose = (): void => {
|
||||
setSnippetName('');
|
||||
setIsOpen(false);
|
||||
};
|
||||
|
||||
const _saveSnippet = (): void => {
|
||||
saveSnippet(snippetName);
|
||||
_onPopupClose();
|
||||
|
||||
@ -114,10 +114,12 @@ function Playground ({ className }: Props): React.ReactElement<Props> {
|
||||
}, [selected]);
|
||||
|
||||
const _clearConsole = (): void => setLogs([]);
|
||||
|
||||
const _hookConsole = (type: LogType, args: any[]): void => {
|
||||
logs.push({ args, type });
|
||||
setLogs(logs.slice(0));
|
||||
};
|
||||
|
||||
const _stopJs = (): void => {
|
||||
if (injectedRef.current) {
|
||||
injectedRef.current.api.disconnect();
|
||||
@ -126,6 +128,7 @@ function Playground ({ className }: Props): React.ReactElement<Props> {
|
||||
|
||||
setIsRunning(false);
|
||||
};
|
||||
|
||||
const _runJs = async (): Promise<void> => {
|
||||
setIsRunning(true);
|
||||
_clearConsole();
|
||||
@ -148,6 +151,7 @@ function Playground ({ className }: Props): React.ReactElement<Props> {
|
||||
|
||||
setIsRunning(false);
|
||||
};
|
||||
|
||||
const _selectExample = (value: string): void => {
|
||||
_stopJs();
|
||||
|
||||
@ -163,6 +167,7 @@ function Playground ({ className }: Props): React.ReactElement<Props> {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const _removeSnippet = (): void => {
|
||||
const filtered = customExamples.filter((value): boolean => value.value !== selected.value);
|
||||
const nextOptions = [...filtered, ...snippets];
|
||||
@ -173,6 +178,7 @@ function Playground ({ className }: Props): React.ReactElement<Props> {
|
||||
_selectExample(nextOptions[0].value);
|
||||
localStorage.setItem(STORE_EXAMPLES, JSON.stringify(filtered));
|
||||
};
|
||||
|
||||
const _saveSnippet = (snippetName: string): void => {
|
||||
// The <Dropdown> component doesn't take boolean custom props and no
|
||||
// camelCase keys, that's why 'custom' is passed as a string here
|
||||
|
||||
@ -4,28 +4,10 @@
|
||||
|
||||
import { Snippet } from './../types';
|
||||
|
||||
import {
|
||||
rpcNetworkAuthoring,
|
||||
rpcNewHead,
|
||||
rpcQueryState,
|
||||
rpcSysthemInfo
|
||||
} from './rpc-examples';
|
||||
|
||||
import {
|
||||
storageGetInfo,
|
||||
storageSystemEvents,
|
||||
storageListenToBalanceChange,
|
||||
storageListenToMultipleBalancesChange,
|
||||
storageRetrieveInfoOnQueryKeys
|
||||
} from './storage-examples';
|
||||
|
||||
import {
|
||||
constsStakingParameters
|
||||
} from './consts-examples';
|
||||
|
||||
import {
|
||||
extrinsicMakeTransfer
|
||||
} from './extrinsics-examples';
|
||||
import { constsStakingParameters } from './consts-examples';
|
||||
import { extrinsicMakeTransfer } from './extrinsics-examples';
|
||||
import { rpcNetworkAuthoring, rpcNewHead, rpcQueryState, rpcSysthemInfo } from './rpc-examples';
|
||||
import { storageGetInfo, storageSystemEvents, storageListenToBalanceChange, storageListenToMultipleBalancesChange, storageRetrieveInfoOnQueryKeys } from './storage-examples';
|
||||
|
||||
const snippets: Snippet[] = [
|
||||
rpcNetworkAuthoring,
|
||||
|
||||
@ -69,6 +69,7 @@ function Register ({ nextFreeId = ONE_THOUSAND, sudoKey }: Props): React.ReactEl
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
@ -34,6 +34,7 @@ function Deregister ({ id, info, isOpen, onClose, onSubmit, sudoKey }: Props): R
|
||||
return api.tx.registrar.deregisterPara(id);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
@ -42,6 +42,7 @@ function Developer ({ className, onStatusChange }: Props): React.ReactElement<Pr
|
||||
setTypes(types);
|
||||
setTypesPlaceholder(typesPlaceholder);
|
||||
};
|
||||
|
||||
const _clearTypes = (): void => {
|
||||
store.remove('types');
|
||||
|
||||
@ -53,6 +54,7 @@ function Developer ({ className, onStatusChange }: Props): React.ReactElement<Pr
|
||||
typesPlaceholder: null
|
||||
});
|
||||
};
|
||||
|
||||
const _onChangeTypes = (data: Uint8Array): void => {
|
||||
const code = u8aToString(data);
|
||||
|
||||
@ -81,6 +83,7 @@ function Developer ({ className, onStatusChange }: Props): React.ReactElement<Pr
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const _onEditTypes = (code: string): void => {
|
||||
try {
|
||||
if (!isJsonObject(code)) {
|
||||
@ -94,6 +97,7 @@ function Developer ({ className, onStatusChange }: Props): React.ReactElement<Pr
|
||||
setTypesPlaceholder(e.message);
|
||||
}
|
||||
};
|
||||
|
||||
const _saveDeveloper = (): void => {
|
||||
try {
|
||||
registry.register(types);
|
||||
|
||||
@ -44,14 +44,18 @@ function NetworkSpecs ({ chainInfo, className }: Props): React.ReactElement<Prop
|
||||
const { isApiReady, systemChain } = useApi();
|
||||
const [qrData, setQrData] = useState<NetworkSpecsStruct>(initialState);
|
||||
const debouncedQrData = useDebounce(qrData, 500);
|
||||
|
||||
const reducer = (state: NetworkSpecsStruct, delta: Partial<NetworkSpecsStruct>): NetworkSpecsStruct => {
|
||||
const newState = {
|
||||
...state,
|
||||
...delta
|
||||
};
|
||||
|
||||
setQrData(newState);
|
||||
|
||||
return newState;
|
||||
};
|
||||
|
||||
const [networkSpecs, setNetworkSpecs] = useReducer(reducer, initialState);
|
||||
|
||||
useEffect((): void => {
|
||||
|
||||
@ -174,6 +174,7 @@ function Query ({ className, onRemove, value }: Props): React.ReactElement<Props
|
||||
setSpread({ ...spread });
|
||||
};
|
||||
};
|
||||
|
||||
const _onRemove = (): void => {
|
||||
delete cache[value.id];
|
||||
|
||||
|
||||
@ -77,11 +77,13 @@ function Modules ({ onAdd }: Props): React.ReactElement<Props> {
|
||||
params: values.filter(({ value }): boolean => !isIterable || !isNull(value))
|
||||
});
|
||||
};
|
||||
|
||||
const _onChangeValues = (values: RawParams): void =>
|
||||
setValues({
|
||||
isValid: areParamsValid(key, values),
|
||||
values
|
||||
});
|
||||
|
||||
const _onChangeKey = (key: StorageEntryPromise): void => {
|
||||
setKey(expandKey(api, key));
|
||||
_onChangeValues([]);
|
||||
|
||||
@ -18,6 +18,7 @@ function Raw ({ onAdd }: Props): React.ReactElement<Props> {
|
||||
const _onAdd = (): void => {
|
||||
isValid && onAdd({ isConst: false, key });
|
||||
};
|
||||
|
||||
const _onChangeKey = (key: string): void => {
|
||||
const u8a = u8aToU8a(key);
|
||||
const isValid = u8a.length !== 0;
|
||||
|
||||
@ -26,6 +26,7 @@ function Account ({ className, defaultValue, isError, onChange }: Props): React.
|
||||
setAccountId(accountId);
|
||||
onChange(accountId, accountNonce);
|
||||
};
|
||||
|
||||
const _onChangeAccountNonce = (accountNonce: BN): void => {
|
||||
setAccountNonce(accountNonce);
|
||||
onChange(accountId, accountNonce);
|
||||
|
||||
@ -74,6 +74,7 @@ function Sign ({ className }: Props): React.ReactElement<Props> {
|
||||
const _toggleUnlock = (): void => setIsUnlockVisible(!isUnlockVisible);
|
||||
const _onChangeAccount = (accountId: string | null): void => setCurrentPair(keyring.getPair(accountId || ''));
|
||||
const _onChangeData = (data: string): void => setData({ data, isHexData: isHex(data) });
|
||||
|
||||
const _onSign = (): void => {
|
||||
if (isLocked || !isUsable || !currentPair) {
|
||||
return;
|
||||
@ -101,6 +102,7 @@ function Sign ({ className }: Props): React.ReactElement<Props> {
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
const _onUnlock = (): void => {
|
||||
setIsLocked(false);
|
||||
_toggleUnlock();
|
||||
|
||||
@ -132,6 +132,7 @@ class Unlock extends TxComponent<Props, State> {
|
||||
|
||||
if (unlockError) {
|
||||
this.setState({ unlockError });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,9 @@ function Voting ({ councilProposals, isDisabled }: Props): React.ReactElement<Pr
|
||||
return null;
|
||||
}
|
||||
|
||||
const _onChangeVote = (vote?: boolean): void => setVoteValue(isBoolean(vote) ? vote : true);
|
||||
const _onChangeVote = (vote?: boolean): void =>
|
||||
setVoteValue(isBoolean(vote) ? vote : true);
|
||||
|
||||
const _onChangeProposal = (optionId: number): void => {
|
||||
const councilProp = councilProposals.find(({ votes }): boolean => !!(votes?.index.eq(optionId)));
|
||||
|
||||
|
||||
@ -148,6 +148,7 @@ export default function withCall<P extends ApiProps> (endpoint: string, {
|
||||
? paramValue
|
||||
: [paramValue]
|
||||
);
|
||||
|
||||
return [true, values];
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ interface Props {
|
||||
onClick: () => void;
|
||||
tabIndex?: number;
|
||||
}
|
||||
|
||||
function ButtonCancel ({ className, isDisabled, label, onClick, tabIndex }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
@ -112,6 +112,7 @@ export default class Collection<P extends CollectionProps, S extends CollectionS
|
||||
|
||||
protected renderCollection (): React.ReactNode {
|
||||
const { children } = this.props;
|
||||
|
||||
return children;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,12 +96,15 @@ function Input ({ autoFocus = false, children, className, defaultValue, help, ic
|
||||
const _onBlur = (): void => {
|
||||
onBlur && onBlur();
|
||||
};
|
||||
|
||||
const _onChange = ({ target }: React.SyntheticEvent<HTMLInputElement>): void => {
|
||||
onChange && onChange((target as HTMLInputElement).value);
|
||||
};
|
||||
|
||||
const _onKeyDown = (event: React.KeyboardEvent<HTMLInputElement>): void => {
|
||||
onKeyDown && onKeyDown(event);
|
||||
};
|
||||
|
||||
const _onKeyUp = (event: React.KeyboardEvent<HTMLInputElement>): void => {
|
||||
onKeyUp && onKeyUp(event);
|
||||
|
||||
@ -115,6 +118,7 @@ function Input ({ autoFocus = false, children, className, defaultValue, help, ic
|
||||
onEscape();
|
||||
}
|
||||
};
|
||||
|
||||
const _onPaste = (event: React.ClipboardEvent<HTMLInputElement>): void => {
|
||||
onPaste && onPaste(event);
|
||||
};
|
||||
|
||||
@ -58,6 +58,7 @@ function InputAddressMulti ({ available: propsAvailable = [], className, help, m
|
||||
const onReorder = (source: DraggableLocation, destination: DraggableLocation): void => {
|
||||
const result = Array.from(value);
|
||||
const [removed] = result.splice(source.index, 1);
|
||||
|
||||
result.splice(destination.index, 0, removed);
|
||||
|
||||
onChange(uniquesOf(result));
|
||||
|
||||
@ -58,6 +58,7 @@ function InputConsts ({ className, defaultValue, help, label, onChange, style, w
|
||||
setValue(updated);
|
||||
onChange && onChange(updated);
|
||||
};
|
||||
|
||||
const _onSectionChange = (section: string): void => {
|
||||
if (section === value.section) {
|
||||
return;
|
||||
|
||||
@ -42,6 +42,7 @@ function InputExtrinsic ({ className, defaultValue, help, label, onChange, style
|
||||
setValue((): SubmittableExtrinsicFunction<'promise'> => newValue);
|
||||
onChange(newValue);
|
||||
};
|
||||
|
||||
const _onSectionChange = (section: string): void => {
|
||||
if (section === value.section) {
|
||||
return;
|
||||
|
||||
@ -227,6 +227,7 @@ function InputNumber (props: Props): React.ReactElement<Props> {
|
||||
const _onKeyDown = (event: React.KeyboardEvent<Element>): void => {
|
||||
if (KEYS_PRE.includes(event.key)) {
|
||||
setIsPreKeyDown(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ interface Props extends BareProps {
|
||||
options: DropdownOptions;
|
||||
value: DefinitionRpcExt;
|
||||
}
|
||||
|
||||
function SelectSection ({ className, defaultValue, isError, onChange, options, style, value }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<Dropdown
|
||||
|
||||
@ -43,6 +43,7 @@ function InputRpc ({ className, defaultValue, help, label, onChange, style, with
|
||||
setValue((): DefinitionRpcExt => newValue);
|
||||
onChange && onChange(newValue);
|
||||
};
|
||||
|
||||
const _onSectionChange = (section: string): void => {
|
||||
if (section === value.section) {
|
||||
return;
|
||||
|
||||
@ -42,6 +42,7 @@ function InputStorage ({ className, defaultValue, help, label, onChange, style,
|
||||
setValue((): StorageEntryPromise => newValue);
|
||||
onChange && onChange(newValue);
|
||||
};
|
||||
|
||||
const _onSectionChange = (section: string): void => {
|
||||
if (section === value.creator.section) {
|
||||
return;
|
||||
|
||||
@ -32,6 +32,7 @@ function Inset ({ children, className, header, href, isCollapsible, isError, isS
|
||||
const _onClick = (): void => {
|
||||
href && history.push(href);
|
||||
};
|
||||
|
||||
const _toggleCollapsed = (): void => setIsCollapsed(!isCollapsed);
|
||||
|
||||
return (
|
||||
|
||||
@ -10,6 +10,7 @@ import { initReactI18next } from 'react-i18next';
|
||||
import uiSettings, { LANGUAGE_DEFAULT } from '@polkadot/ui-settings';
|
||||
|
||||
const languageDetector = new LanguageDetector();
|
||||
|
||||
languageDetector.addDetector({
|
||||
lookup: () => {
|
||||
const i18nLang = uiSettings.i18nLang;
|
||||
|
||||
@ -17,6 +17,7 @@ export default function getContractAbi (address: string | null): Abi | null {
|
||||
|
||||
try {
|
||||
const data = meta.contract && JSON.parse(meta.contract.abi);
|
||||
|
||||
abi = new Abi(registry, data);
|
||||
} catch (error) {
|
||||
// invalid address, maybe
|
||||
|
||||
@ -19,8 +19,10 @@ function StructParam (props: Props): React.ReactElement<Props> {
|
||||
|
||||
useEffect((): void => {
|
||||
let typeDef;
|
||||
|
||||
try {
|
||||
const rawType = createType(registry, type.type as any).toRawType();
|
||||
|
||||
typeDef = getTypeDef(rawType);
|
||||
} catch (e) {
|
||||
typeDef = type;
|
||||
|
||||
@ -101,6 +101,7 @@ export default function findComponent (def: TypeDef, overrides: ComponentMap = {
|
||||
if (components[type] === Account) {
|
||||
return type;
|
||||
}
|
||||
|
||||
return 'Tuple';
|
||||
|
||||
case TypeDefInfo.Vec:
|
||||
|
||||
@ -572,6 +572,7 @@ class Signer extends React.PureComponent<Props, State> {
|
||||
|
||||
if (unlockError) {
|
||||
this.setState({ unlockError });
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -740,6 +741,7 @@ class Signer extends React.PureComponent<Props, State> {
|
||||
signer = { signPayload: this.signQrPayload };
|
||||
} else if (isInjected) {
|
||||
const injected = await web3FromSource(source);
|
||||
|
||||
signer = injected?.signer;
|
||||
}
|
||||
|
||||
@ -759,6 +761,7 @@ class Signer extends React.PureComponent<Props, State> {
|
||||
this.setState({ signedTx });
|
||||
} catch (e) {
|
||||
queueSetTxStatus(id, 'error', undefined, e);
|
||||
|
||||
if (isFunction(txFailedCb)) {
|
||||
txFailedCb(e);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user