This commit is contained in:
Jaco 2022-08-06 15:42:53 +02:00 committed by GitHub
parent d63b7cad83
commit 7659cadc64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 589 additions and 537 deletions

View File

@ -69,7 +69,7 @@
"@babel/runtime": "^7.18.9",
"@crustio/crust-pin": "^1.0.0",
"@pinata/sdk": "^1.1.26",
"@polkadot/dev": "^0.67.86",
"@polkadot/dev": "^0.67.88",
"@types/chart.js": "^2.9.37",
"@types/file-saver": "^2.0.5",
"@types/jest": "^28.1.6",
@ -96,26 +96,26 @@
"webpack-cli": "^4.10.0"
},
"resolutions": {
"@polkadot/api": "^9.0.1",
"@polkadot/api-augment": "^9.0.1",
"@polkadot/api-base": "^9.0.1",
"@polkadot/api-contract": "^9.0.1",
"@polkadot/api-derive": "^9.0.1",
"@polkadot/hw-ledger": "^10.1.2",
"@polkadot/keyring": "^10.1.2",
"@polkadot/networks": "^10.1.2",
"@polkadot/api": "^9.1.1",
"@polkadot/api-augment": "^9.1.1",
"@polkadot/api-base": "^9.1.1",
"@polkadot/api-contract": "^9.1.1",
"@polkadot/api-derive": "^9.1.1",
"@polkadot/hw-ledger": "^10.1.3",
"@polkadot/keyring": "^10.1.3",
"@polkadot/networks": "^10.1.3",
"@polkadot/phishing": "^0.18.2",
"@polkadot/rpc-augment": "^9.0.1",
"@polkadot/rpc-core": "^9.0.1",
"@polkadot/rpc-provider": "^9.0.1",
"@polkadot/types": "^9.0.1",
"@polkadot/types-augment": "^9.0.1",
"@polkadot/types-codec": "^9.0.1",
"@polkadot/types-create": "^9.0.1",
"@polkadot/types-known": "^9.0.1",
"@polkadot/types-support": "^9.0.1",
"@polkadot/util": "^10.1.2",
"@polkadot/util-crypto": "^10.1.2",
"@polkadot/rpc-augment": "^9.1.1",
"@polkadot/rpc-core": "^9.1.1",
"@polkadot/rpc-provider": "^9.1.1",
"@polkadot/types": "^9.1.1",
"@polkadot/types-augment": "^9.1.1",
"@polkadot/types-codec": "^9.1.1",
"@polkadot/types-create": "^9.1.1",
"@polkadot/types-known": "^9.1.1",
"@polkadot/types-support": "^9.1.1",
"@polkadot/util": "^10.1.3",
"@polkadot/util-crypto": "^10.1.3",
"@polkadot/wasm-crypto": "^6.3.1",
"babel-core": "^7.0.0-bridge.0",
"styled-components": "^5.3.1",

View File

@ -31,12 +31,12 @@
"@metaverse-network-sdk/type-definitions": "^0.0.1-13",
"@parallel-finance/type-definitions": "1.7.7",
"@phala/typedefs": "0.2.30",
"@polkadot/api": "^9.0.1",
"@polkadot/api-derive": "^9.0.1",
"@polkadot/networks": "^10.1.2",
"@polkadot/types": "^9.0.1",
"@polkadot/util": "^10.1.2",
"@polkadot/x-fetch": "^10.1.2",
"@polkadot/api": "^9.1.1",
"@polkadot/api-derive": "^9.1.1",
"@polkadot/networks": "^10.1.3",
"@polkadot/types": "^9.1.1",
"@polkadot/util": "^10.1.3",
"@polkadot/x-fetch": "^10.1.3",
"@polymathnetwork/polymesh-types": "0.0.2",
"@snowfork/snowbridge-types": "0.2.7",
"@sora-substrate/type-definitions": "1.10.0-beta.7",

View File

@ -14,7 +14,7 @@
"dependencies": {
"@babel/core": "^7.18.10",
"@babel/polyfill": "^7.12.1",
"@polkadot/dev": "^0.67.86",
"@polkadot/dev": "^0.67.88",
"@polkadot/react-components": "^0.119.2-20-x",
"electron-log": "^4.4.8",
"electron-updater": "^4.6.5"

View File

@ -18,7 +18,7 @@
"@babel/runtime": "^7.18.9",
"@polkadot/apps-config": "^0.119.2-20-x",
"@polkadot/apps-routing": "^0.119.2-20-x",
"@polkadot/dev": "^0.67.86",
"@polkadot/dev": "^0.67.88",
"@polkadot/react-api": "^0.119.2-20-x",
"@polkadot/react-components": "^0.119.2-20-x",
"@polkadot/react-hooks": "^0.119.2-20-x",

View File

@ -14,11 +14,11 @@
"version": "0.119.2-20-x",
"dependencies": {
"@babel/runtime": "^7.18.9",
"@polkadot/hw-ledger": "^10.1.2",
"@polkadot/hw-ledger": "^10.1.3",
"@polkadot/phishing": "^0.18.2",
"@polkadot/react-components": "^0.119.2-20-x",
"@polkadot/react-hooks": "^0.119.2-20-x",
"@polkadot/util": "^10.1.2",
"@polkadot/util": "^10.1.3",
"@polkadot/vanitygen": "^0.52.1",
"detect-browser": "^5.3.0",
"file-saver": "^2.0.5"

View File

@ -3,7 +3,7 @@
import type { Vec } from '@polkadot/types';
import type { AccountId, BalanceOf } from '@polkadot/types/interfaces';
import type { NodeRuntimeProxyType, PalletProxyProxyDefinition } from '@polkadot/types/lookup';
import type { KitchensinkRuntimeProxyType, PalletProxyProxyDefinition } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
@ -16,7 +16,7 @@ interface Proxy {
address: string;
delay: BN;
isOwned: boolean;
type: NodeRuntimeProxyType;
type: KitchensinkRuntimeProxyType;
}
interface State {
@ -31,7 +31,7 @@ const EMPTY_STATE: State = {
proxies: []
};
function createProxy (allAccounts: string[], delegate: AccountId, type: NodeRuntimeProxyType, delay = BN_ZERO): Proxy {
function createProxy (allAccounts: string[], delegate: AccountId, type: KitchensinkRuntimeProxyType, delay = BN_ZERO): Proxy {
const address = delegate.toString();
return {
@ -53,13 +53,13 @@ function useProxiesImpl (address?: string | null): State {
address && api.query.proxy &&
api.query.proxy
.proxies<ITuple<[Vec<ITuple<[AccountId, NodeRuntimeProxyType]> | PalletProxyProxyDefinition>, BalanceOf]>>(address)
.proxies<ITuple<[Vec<ITuple<[AccountId, KitchensinkRuntimeProxyType]> | PalletProxyProxyDefinition>, BalanceOf]>>(address)
.then(([_proxies]): void => {
const proxies = api.tx.proxy.addProxy.meta.args.length === 3
? (_proxies as PalletProxyProxyDefinition[]).map(({ delay, delegate, proxyType }) =>
createProxy(allAccounts, delegate, proxyType, delay)
)
: (_proxies as [AccountId, NodeRuntimeProxyType][]).map(([delegate, proxyType]) =>
: (_proxies as [AccountId, KitchensinkRuntimeProxyType][]).map(([delegate, proxyType]) =>
createProxy(allAccounts, delegate, proxyType)
);
const owned = proxies.filter(({ isOwned }) => isOwned);

View File

@ -5,7 +5,7 @@ import type { ApiPromise } from '@polkadot/api';
import type { SubmittableExtrinsic } from '@polkadot/api/types';
import type { BatchOptions } from '@polkadot/react-hooks/types';
import type { AccountId } from '@polkadot/types/interfaces';
import type { NodeRuntimeProxyType, PalletProxyProxyDefinition } from '@polkadot/types/lookup';
import type { KitchensinkRuntimeProxyType, PalletProxyProxyDefinition } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
@ -17,7 +17,7 @@ import { BN_ZERO } from '@polkadot/util';
import { useTranslation } from '../translate';
type PrevProxy = [AccountId | null, NodeRuntimeProxyType];
type PrevProxy = [AccountId | null, KitchensinkRuntimeProxyType];
interface Props {
className?: string;
@ -40,13 +40,13 @@ interface NewProxyProps extends ValueProps {
}
interface PrevProxyProps extends ValueProps {
onRemove: (accountId: AccountId, type: NodeRuntimeProxyType, index: number) => void;
onRemove: (accountId: AccountId, type: KitchensinkRuntimeProxyType, index: number) => void;
}
const BATCH_OPTS: BatchOptions = { type: 'all' };
const EMPTY_EXISTING: [PalletProxyProxyDefinition[], BN] = [[], BN_ZERO];
function createAddProxy (api: ApiPromise, account: AccountId, type: NodeRuntimeProxyType, delay = 0): SubmittableExtrinsic<'promise'> {
function createAddProxy (api: ApiPromise, account: AccountId, type: KitchensinkRuntimeProxyType, delay = 0): SubmittableExtrinsic<'promise'> {
return api.tx.proxy.addProxy.meta.args.length === 2
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore old version
@ -54,7 +54,7 @@ function createAddProxy (api: ApiPromise, account: AccountId, type: NodeRuntimeP
: api.tx.proxy.addProxy(account, type, delay);
}
function createRmProxy (api: ApiPromise, account: AccountId, type: NodeRuntimeProxyType, delay = 0): SubmittableExtrinsic<'promise'> {
function createRmProxy (api: ApiPromise, account: AccountId, type: KitchensinkRuntimeProxyType, delay = 0): SubmittableExtrinsic<'promise'> {
return api.tx.proxy.removeProxy.meta.args.length === 2
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore old version
@ -150,12 +150,12 @@ function NewProxy ({ index, onChangeAccount, onChangeType, onRemove, proxiedAcco
);
}
function getProxyTypeInstance (api: ApiPromise, index = 0): NodeRuntimeProxyType {
function getProxyTypeInstance (api: ApiPromise, index = 0): KitchensinkRuntimeProxyType {
// This is not perfect, but should work for `{Kusama, Node, Polkadot}RuntimeProxyType`
const proxyNames = api.registry.lookup.names.filter((name) => name.endsWith('RuntimeProxyType'));
// fallback to previous version (may be Substrate default), when not found
return api.createType<NodeRuntimeProxyType>(proxyNames.length ? proxyNames[0] : 'ProxyType', index);
return api.createType<KitchensinkRuntimeProxyType>(proxyNames.length ? proxyNames[0] : 'ProxyType', index);
}
function getProxyOptions (api: ApiPromise): { text: string; value: number; }[] {
@ -187,7 +187,7 @@ function ProxyOverview ({ className, onClose, previousProxy: [existing] = EMPTY_
useEffect((): void => {
setBatchAdded(
added
.filter((f): f is [AccountId, NodeRuntimeProxyType] => !!f[0])
.filter((f): f is [AccountId, KitchensinkRuntimeProxyType] => !!f[0])
.map(([newAccount, newType]) => createAddProxy(api, newAccount, newType))
);
}, [api, added]);
@ -216,7 +216,7 @@ function ProxyOverview ({ className, onClose, previousProxy: [existing] = EMPTY_
);
const _delPrev = useCallback(
(accountId: AccountId, type: NodeRuntimeProxyType, index: number): void => {
(accountId: AccountId, type: KitchensinkRuntimeProxyType, index: number): void => {
setPrevious((previous) => previous.filter((_, i) => i !== index));
setBatchPrevious((previous) => [...previous, createRmProxy(api, accountId, type)]);
},

View File

@ -14,6 +14,6 @@
"version": "0.119.2-20-x",
"dependencies": {
"@babel/runtime": "^7.18.9",
"@polkadot/api-contract": "^9.0.1"
"@polkadot/api-contract": "^9.1.1"
}
}

View File

@ -14,10 +14,10 @@
"version": "0.119.2-20-x",
"dependencies": {
"@babel/runtime": "^7.18.9",
"@polkadot/api": "^9.0.1",
"@polkadot/api": "^9.1.1",
"@polkadot/extension-compat-metamask": "^0.44.3",
"@polkadot/extension-dapp": "^0.44.3",
"@polkadot/rpc-provider": "^9.0.1",
"@polkadot/rpc-provider": "^9.1.1",
"fflate": "^0.7.3",
"rxjs": "^7.5.6"
}

View File

@ -17,15 +17,15 @@
"@fortawesome/fontawesome-svg-core": "^6.1.2",
"@fortawesome/free-solid-svg-icons": "^6.1.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@polkadot/keyring": "^10.1.2",
"@polkadot/keyring": "^10.1.3",
"@polkadot/react-api": "^0.119.2-20-x",
"@polkadot/react-identicon": "^2.9.3",
"@polkadot/react-qr": "^2.9.3",
"@polkadot/react-identicon": "^2.9.4",
"@polkadot/react-qr": "^2.9.4",
"@polkadot/react-query": "^0.119.2-20-x",
"@polkadot/ui-keyring": "^2.9.3",
"@polkadot/ui-settings": "^2.9.3",
"@polkadot/util": "^10.1.2",
"@polkadot/util-crypto": "^10.1.2",
"@polkadot/ui-keyring": "^2.9.4",
"@polkadot/ui-settings": "^2.9.4",
"@polkadot/util": "^10.1.3",
"@polkadot/util-crypto": "^10.1.3",
"chart.js": "^3.9.0",
"codeflask": "^1.4.1",
"i18next": "^21.8.16",

View File

@ -14,7 +14,7 @@
"version": "0.119.2-20-x",
"dependencies": {
"@babel/runtime": "^7.18.9",
"@polkadot/hw-ledger": "^10.1.2",
"@polkadot/hw-ledger": "^10.1.3",
"is-ipfs": "6.0.2"
}
}

View File

@ -3,7 +3,7 @@
import type { ApiPromise } from '@polkadot/api';
import type { AccountId } from '@polkadot/types/interfaces';
import type { NodeRuntimeProxyType, PalletProxyProxyDefinition } from '@polkadot/types/lookup';
import type { KitchensinkRuntimeProxyType, PalletProxyProxyDefinition } from '@polkadot/types/lookup';
import type { BN } from '@polkadot/util';
import { createNamedHook } from './createNamedHook';
@ -12,10 +12,10 @@ import { useApi } from './useApi';
import { useCall } from './useCall';
const OPTS = {
transform: (result: [([AccountId, NodeRuntimeProxyType] | PalletProxyProxyDefinition)[], BN][], api: ApiPromise): [PalletProxyProxyDefinition[], BN][] =>
transform: (result: [([AccountId, KitchensinkRuntimeProxyType] | PalletProxyProxyDefinition)[], BN][], api: ApiPromise): [PalletProxyProxyDefinition[], BN][] =>
api.tx.proxy.addProxy.meta.args.length === 3
? result as [PalletProxyProxyDefinition[], BN][]
: (result as [[AccountId, NodeRuntimeProxyType][], BN][]).map(([arr, bn]): [PalletProxyProxyDefinition[], BN] =>
: (result as [[AccountId, KitchensinkRuntimeProxyType][], BN][]).map(([arr, bn]): [PalletProxyProxyDefinition[], BN] =>
[arr.map(([delegate, proxyType]): PalletProxyProxyDefinition =>
api.createType('ProxyDefinition', {
delegate,

View File

@ -14,7 +14,7 @@
"version": "0.119.2-20-x",
"dependencies": {
"@babel/runtime": "^7.18.9",
"@polkadot/hw-ledger": "^10.1.2",
"@polkadot/hw-ledger": "^10.1.3",
"@polkadot/react-components": "^0.119.2-20-x"
}
}

View File

@ -5,7 +5,7 @@ import type { SubmittableExtrinsic } from '@polkadot/api/types';
import type { QueueTx } from '@polkadot/react-components/Status/types';
import type { Option, Vec } from '@polkadot/types';
import type { AccountId, BalanceOf, Call, Multisig } from '@polkadot/types/interfaces';
import type { NodeRuntimeProxyType, PalletProxyProxyDefinition } from '@polkadot/types/lookup';
import type { KitchensinkRuntimeProxyType, PalletProxyProxyDefinition } from '@polkadot/types/lookup';
import type { ITuple } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import type { AddressFlags, AddressProxy } from './types';
@ -45,7 +45,7 @@ interface PasswordState {
interface ProxyState {
address: string;
isProxied: boolean;
proxies: [string, BN, NodeRuntimeProxyType][];
proxies: [string, BN, KitchensinkRuntimeProxyType][];
proxiesFilter: string[];
}
@ -59,7 +59,7 @@ function findCall (tx: Call | SubmittableExtrinsic<'promise'>): { method: string
}
}
function filterProxies (allAccounts: string[], tx: Call | SubmittableExtrinsic<'promise'>, proxies: [string, BN, NodeRuntimeProxyType][]): string[] {
function filterProxies (allAccounts: string[], tx: Call | SubmittableExtrinsic<'promise'>, proxies: [string, BN, KitchensinkRuntimeProxyType][]): string[] {
// get the call info
const { method, section } = findCall(tx);
@ -167,10 +167,10 @@ async function queryForMultisig (api: ApiPromise, requestAddress: string, proxyA
async function queryForProxy (api: ApiPromise, allAccounts: string[], address: string, tx: SubmittableExtrinsic<'promise'>): Promise<ProxyState | null> {
if (isFunction(api.query.proxy?.proxies)) {
const { isProxied } = extractExternal(address);
const [_proxies] = await api.query.proxy.proxies<ITuple<[Vec<ITuple<[AccountId, NodeRuntimeProxyType]> | PalletProxyProxyDefinition>, BalanceOf]>>(address);
const [_proxies] = await api.query.proxy.proxies<ITuple<[Vec<ITuple<[AccountId, KitchensinkRuntimeProxyType]> | PalletProxyProxyDefinition>, BalanceOf]>>(address);
const proxies = api.tx.proxy.addProxy.meta.args.length === 3
? (_proxies as PalletProxyProxyDefinition[]).map(({ delay, delegate, proxyType }): [string, BN, NodeRuntimeProxyType] => [delegate.toString(), delay, proxyType])
: (_proxies as [AccountId, NodeRuntimeProxyType][]).map(([delegate, proxyType]): [string, BN, NodeRuntimeProxyType] => [delegate.toString(), BN_ZERO, proxyType]);
? (_proxies as PalletProxyProxyDefinition[]).map(({ delay, delegate, proxyType }): [string, BN, KitchensinkRuntimeProxyType] => [delegate.toString(), delay, proxyType])
: (_proxies as [AccountId, KitchensinkRuntimeProxyType][]).map(([delegate, proxyType]): [string, BN, KitchensinkRuntimeProxyType] => [delegate.toString(), BN_ZERO, proxyType]);
const proxiesFilter = filterProxies(allAccounts, tx, proxies);
if (proxiesFilter.length) {

View File

@ -17,7 +17,7 @@
"testcontainers": "^8.12.0"
},
"devDependencies": {
"@polkadot/types-support": "^9.0.1",
"@polkadot/types-support": "^9.1.1",
"@testing-library/jest-dom": "^5.16.4",
"tsconfig-paths": "^4.0.0"
}

994
yarn.lock

File diff suppressed because it is too large Load Diff