Skip to main content

Module: util

Functionsโ€‹

fetchCalldataDecoderโ€‹

โ–ธ fetchCalldataDecoder(_data, to, _chainId, recurse?): Promise<{ abi: any ; def: Buffer }>

Fetches calldata from a remote scanner based on the transaction's chainId

Parametersโ€‹

NameTypeDefault value
_datastring | Uint8Arrayundefined
tostringundefined
_chainIdstring | numberundefined
recursebooleantrue

Returnsโ€‹

Promise<{ abi: any ; def: Buffer }>

Defined inโ€‹

src/util.ts:575


fetchWithTimeoutโ€‹

โ–ธ fetchWithTimeout(url, options): Promise<Response>

Parametersโ€‹

NameType
urlany
optionsany

Returnsโ€‹

Promise<Response>

Defined inโ€‹

src/util.ts:389


generateAppSecretโ€‹

โ–ธ generateAppSecret(deviceId, password, appName): Buffer

Generates an application secret for use in maintaining connection to device.

Parametersโ€‹

NameTypeDescription
deviceIdstring | BufferThe device ID of the device you want to generate a token for.
passwordstring | BufferThe password entered when connecting to the device.
appNamestring | BufferThe name of the application.

Returnsโ€‹

Buffer

an application secret as a Buffer

Defined inโ€‹

src/util.ts:637


getVโ€‹

โ–ธ getV(tx, resp): any

Generic signing does not return a v value like legacy ETH signing requests did. Get the v component of the signature as well as an initV parameter, which is what you need to use to re-create an @ethereumjs/tx object. There is a lot of tech debt in @ethereumjs/tx which also inherits the tech debt of ethereumjs-util.

  1. The legacy Transaction type can call _processSignature with the regular v value.
  2. Newer transaction types such as FeeMarketEIP1559Transaction will subtract 27 from the v that gets passed in, so we need to add 27 to create initV

Parametersโ€‹

NameTypeDescription
txanyAn @ethereumjs/tx Transaction object or Buffer (serialized tx)
respanyresponse from Lattice. Can be either legacy or generic signing variety

Returnsโ€‹

any

bn.js BN object containing the v param

Defined inโ€‹

src/util.ts:672


selectDefFrom4byteABIโ€‹

โ–ธ selectDefFrom4byteABI(abiData, selector): any

Takes a list of ABI data objects and a selector, and returns the earliest ABI data object that matches the selector.

Parametersโ€‹

NameType
abiDataany[]
selectorstring

Returnsโ€‹

any

Defined inโ€‹

src/util.ts:359