Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
/*
* Path needs to be sent in as an derivation path array
*/
address_n: fromString(
derivationPathNormalizer(derivationPath),
true,
).toPathArray(),
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
gas_price: multipleOfTwoHexValueNormalizer(gasPrice.toString(16)),
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
gas_limit: multipleOfTwoHexValueNormalizer(gasLimit.toString(16)),
chain_id: chainId,
/*
* Nonces needs to be sent in as a hex string, and to be padded as a multiple of two.
* Eg: '3' to be '03', `12c` to be `012c`
*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
*/
r: hexSequenceNormalizer(
multipleOfTwoHexValueNormalizer(String(SIGNATURE.R)),
),
s: hexSequenceNormalizer(
multipleOfTwoHexValueNormalizer(String(SIGNATURE.S)),
),
v: hexSequenceNormalizer(
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
multipleOfTwoHexValueNormalizer(chainId.toString(16)),
),
},
to ? { to: addressNormalizer(to) } : {},
),
getChainDefinition(chainId),
);
/*
* Sign the transaction object via your Ledger Wallet
*
* We also warn the user here, since the device will need confirmation, but only in dev mode.
*/
warning(messages.userSignInteractionWarning);
const {
r: rSignatureComponent,
s: sSignatureComponent,
v: recoveryParameter,
* prototype `toString` method
*/
/* $FlowFixMe */
gas_limit: multipleOfTwoHexValueNormalizer(gasLimit.toString(16)),
chain_id: chainId,
/*
* Nonces needs to be sent in as a hex string, and to be padded as a multiple of two.
* Eg: '3' to be '03', `12c` to be `012c`
*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
nonce: multipleOfTwoHexValueNormalizer(nonce.toString(16)),
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
value: multipleOfTwoHexValueNormalizer(value.toString(16)),
/*
* Trezor service requires the prefix from the input data to be stripped
*/
data: hexSequenceNormalizer(inputData, false),
},
/*
* Only send (and normalize) the destingation address if one was
* provided in the initial transaction object.
*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
nonce: multipleOfTwoHexValueNormalizer(nonce.toString(16)),
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
value: multipleOfTwoHexValueNormalizer(value.toString(16)),
/*
* Trezor service requires the prefix from the input data to be stripped
*/
data: hexSequenceNormalizer(inputData, false),
},
/*
* Only send (and normalize) the destingation address if one was
* provided in the initial transaction object.
*
* Trezor service requires the prefix from the address to be stripped
*/
to ? { to: addressNormalizer(to, false) } : {},
);
/*
* We need to catch the cancelled error since it's part of a normal user workflow
*/
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
gas_price: multipleOfTwoHexValueNormalizer(gasPrice.toString(16)),
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
gas_limit: multipleOfTwoHexValueNormalizer(gasLimit.toString(16)),
chain_id: chainId,
/*
* Nonces needs to be sent in as a hex string, and to be padded as a multiple of two.
* Eg: '3' to be '03', `12c` to be `012c`
*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
nonce: multipleOfTwoHexValueNormalizer(nonce.toString(16)),
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
multipleOfTwoHexValueNormalizer(value.toString(16)),
),
data: hexSequenceNormalizer(inputData),
/*
* The transaction object needs to be seeded with the (R) and (S) signature components with
* empty data, and the Reco(V)ery param as the chain id (all, im hex string format).
*
* See this issue for context:
* https://github.com/LedgerHQ/ledgerjs/issues/43
*/
r: hexSequenceNormalizer(
multipleOfTwoHexValueNormalizer(String(SIGNATURE.R)),
),
s: hexSequenceNormalizer(
multipleOfTwoHexValueNormalizer(String(SIGNATURE.S)),
),
v: hexSequenceNormalizer(
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
multipleOfTwoHexValueNormalizer(chainId.toString(16)),
),
},
to ? { to: addressNormalizer(to) } : {},
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
multipleOfTwoHexValueNormalizer(gasPrice.toString(16)),
),
gasLimit: hexSequenceNormalizer(
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
multipleOfTwoHexValueNormalizer(gasLimit.toString(16)),
),
/*
* Nonces needs to be sent in as a hex string, and to be padded as a multiple of two.
* Eg: '3' to be '03', `12c` to be `012c`
*/
nonce: hexSequenceNormalizer(
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
multipleOfTwoHexValueNormalizer(nonce.toString(16)),
),
value: hexSequenceNormalizer(
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
multipleOfTwoHexValueNormalizer(value.toString(16)),
),
data: hexSequenceNormalizer(inputData),
/*
* The transaction object needs to be seeded with the (R) and (S) signature components with
* empty data, and the Reco(V)ery param as the chain id (all, im hex string format).
*
* See this issue for context:
* https://github.com/LedgerHQ/ledgerjs/issues/43
*/
r: hexSequenceNormalizer(
multipleOfTwoHexValueNormalizer(String(SIGNATURE.R)),
),
s: hexSequenceNormalizer(
multipleOfTwoHexValueNormalizer(String(SIGNATURE.S)),
),
v: hexSequenceNormalizer(
/*
* @TODO Add `bigNumber` `toHexString` wrapper method
*
* Flow confuses bigNumber's `toString` with the String object
* prototype `toString` method
*/
/* $FlowFixMe */
multipleOfTwoHexValueNormalizer(chainId.toString(16)),
),
},
getChainDefinition(chainId),