Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (pair) {
const { address, meta: { isExternal, isHardware, isInjected, source } } = pair;
queueSetTxStatus(id, 'signing');
// set the signer
if (isHardware) {
api.setSigner(ledgerSigner);
params.push(address);
} else if (isExternal) {
queueSetTxStatus(id, 'qr');
api.setSigner({ signPayload: this.signQrPayload });
params.push(address);
} else if (isInjected) {
const injected = await web3FromSource(source);
assert(injected, `Unable to find a signer for ${address}`);
api.setSigner(injected.signer);
params.push(address);
} else {
params.push(pair);
}
}
if (isV2 && tip) {
params.push({ tip } as Partial);
}
if (isFunction(txStartCb)) {
txStartCb();
const isUsable = !(isExternal || isHardware || isInjected);
setAccountState({ isExternal, isHardware, isInjected });
setIsLocked(
isInjected
? false
: currentPair?.isLocked || false
);
setSignature('');
setSigner({ isUsable, signer: null });
// for injected, retrieve the signer
if (currentPair && isInjected) {
const { meta: { source } } = currentPair;
web3FromSource(source)
.catch((): null => null)
.then((injected): void => setSigner({
isUsable: isFunction(injected?.signer?.signRaw),
signer: injected?.signer || null
}));
}
}, [currentPair]);
isHardware,
isInjected
});
setIsLocked(
isInjected
? false
: currentPair?.isLocked || false
);
setSignature('');
setSigner({ isUsable, signer: null });
// for injected, retrieve the signer
if (currentPair && isInjected) {
const { meta: { source } } = currentPair;
web3FromSource(source)
.catch((): null => null)
.then((injected): void => setSigner({
isUsable: isFunction(injected?.signer?.signRaw),
signer: injected?.signer || null
}));
}
}, [currentPair]);