Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ethereumSignTransaction (path, transaction, cb) {
TrezorConnect.ethereumSignTransaction({ device: this.device, path, transaction }).then(res => {
if (!res.success) return cb(new Error(res.payload.error))
cb(null, res.payload)
}).catch(err => cb(err))
}
signEthereumTx(
derivationPath: string,
tx: {
to: string,
value: string | number,
gasPrice: string | number,
gas: string | number,
nonce: string | number,
data?: string,
chainId?: number,
},
): Promise {
const { to, value, gas, gasPrice, nonce, data, chainId } = tx
return TrezorConnect.ethereumSignTransaction(log.debugInline('TrezorConnect.ethereumSignTransaction', {
path: derivationPath,
transaction: {
to,
value: toHex(value),
gasLimit: toHex(gas),
gasPrice: toHex(gasPrice),
nonce: toHex(nonce),
data,
chainId,
},
})).then(handleResult)
}
async signTransaction(path, networkPassphrase, transaction) {
let result;
const paramsStellar = { path, networkPassphrase, transaction };
const paramsEthereum = { path, transaction };
if (this.currency === 'ethereum') {
result = await TrezorConnect.ethereumSignTransaction(paramsEthereum);
} else {
result = await TrezorConnect.stellarSignTransaction(paramsStellar);
}
return result;
}