Fix new/old proxy detect (args length) (#3592)
This commit is contained in:
parent
b4c24a2abc
commit
7e2bc73ead
@ -75,7 +75,7 @@ function Overview ({ className = '', onStatusChange }: Props): React.ReactElemen
|
||||
const delegations = useCall<Voting[]>(api.query.democracy?.votingOf?.multi, [sortedAddresses]);
|
||||
const proxies = useCall<[ProxyDefinition[], BN][]>(api.query.proxy?.proxies.multi, [sortedAddresses], {
|
||||
transform: (result: [([AccountId, ProxyType] | ProxyDefinition)[], BN][]): [ProxyDefinition[], BN][] =>
|
||||
api.tx.proxy.addProxy.meta.args.length === 4
|
||||
api.tx.proxy.addProxy.meta.args.length === 3
|
||||
? result as [ProxyDefinition[], BN][]
|
||||
: (result as [[AccountId, ProxyType][], BN][]).map(([arr, bn]): [ProxyDefinition[], BN] =>
|
||||
[arr.map(([delegate, proxyType]): ProxyDefinition => api.createType('ProxyDefinition', { delegate, proxyType })), bn]
|
||||
|
||||
@ -54,7 +54,7 @@ export default function useProxies (address?: string | null): State {
|
||||
api.query.proxy
|
||||
.proxies<ITuple<[Vec<ITuple<[AccountId, ProxyType]> | ProxyDefinition>, BalanceOf]>>(address)
|
||||
.then(([_proxies]): void => {
|
||||
const proxies = api.tx.proxy.addProxy.meta.args.length === 4
|
||||
const proxies = api.tx.proxy.addProxy.meta.args.length === 3
|
||||
? (_proxies as ProxyDefinition[]).map(({ delay, delegate, proxyType }) =>
|
||||
createProxy(allAccounts, delegate, proxyType, delay)
|
||||
)
|
||||
|
||||
@ -123,7 +123,7 @@ async function queryForProxy (api: ApiPromise, allAccounts: string[], address: s
|
||||
if (isFunction(api.query.proxy?.proxies)) {
|
||||
const { isProxied } = extractExternal(address);
|
||||
const [_proxies] = await api.query.proxy.proxies<ITuple<[Vec<ITuple<[AccountId, ProxyType]> | ProxyDefinition>, BalanceOf]>>(address);
|
||||
const proxies = api.tx.proxy.addProxy.meta.args.length === 4
|
||||
const proxies = api.tx.proxy.addProxy.meta.args.length === 3
|
||||
? (_proxies as ProxyDefinition[]).map(({ delegate, proxyType }): [string, ProxyType] => [delegate.toString(), proxyType])
|
||||
: (_proxies as [AccountId, ProxyType][]).map(([delegate, proxyType]): [string, ProxyType] => [delegate.toString(), proxyType]);
|
||||
const proxiesFilter = filterProxies(allAccounts, tx, proxies);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user