Rework isProxied detection (#4695)

This commit is contained in:
Jaco Greeff 2021-02-18 15:58:11 +01:00 committed by GitHub
parent c527e9e3c4
commit ebd18dc04e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -140,11 +140,11 @@ async function wrapTx (api: ApiPromise, currentItem: QueueTx, { isMultiCall, mul
async function extractParams (api: ApiPromise, address: string, options: Partial<SignerOptions>, getLedger: () => Ledger, setQrState: (state: QrState) => void): Promise<['qr' | 'signing', string, Partial<SignerOptions>]> {
const pair = keyring.getPair(address);
const { meta: { accountOffset, addressOffset, isExternal, isHardware, isInjected, source } } = pair;
const { meta: { accountOffset, addressOffset, isExternal, isHardware, isInjected, isProxied, source } } = pair;
if (isHardware) {
return ['signing', address, { ...options, signer: new LedgerSigner(api.registry, getLedger, accountOffset as number || 0, addressOffset as number || 0) }];
} else if (isExternal) {
} else if (isExternal && !isProxied) {
return ['qr', address, { ...options, signer: new QrSigner(api.registry, setQrState) }];
} else if (isInjected) {
const injected = await web3FromSource(source as string);

View File

@ -43,7 +43,8 @@ export function extractExternal (accountId: string | null): AddressFlags {
}
const pair = keyring.getPair(publicKey);
const isUnlockable = !pair.meta.isExternal && !pair.meta.isHardware && !pair.meta.isInjected;
const { isExternal, isHardware, isInjected, isMultisig, isProxied } = pair.meta;
const isUnlockable = !isExternal && !isHardware && !isInjected;
if (isUnlockable) {
const entry = lockCountdown[pair.address];
@ -58,10 +59,10 @@ export function extractExternal (accountId: string | null): AddressFlags {
accountOffset: pair.meta.accountOffset as number || 0,
addressOffset: pair.meta.addressOffset as number || 0,
hardwareType: pair.meta.hardwareType as string,
isHardware: !!pair.meta.isHardware,
isMultisig: !!pair.meta.isMultisig,
isProxied: !!pair.meta.isProxied,
isQr: !!pair.meta.isExternal && !pair.meta.isMultisig && !pair.meta.isProxied && !pair.meta.isHardware,
isHardware: !!isHardware,
isMultisig: !!isMultisig,
isProxied: !!isProxied,
isQr: !!isExternal && !isMultisig && !isProxied && !isHardware && !isInjected,
isUnlockable: isUnlockable && pair.isLocked,
threshold: (pair.meta.threshold as number) || 0,
who: ((pair.meta.who as string[]) || []).map(recodeAddress)