# @integraledger/lcp/evm

> The exports of @integraledger/lcp/evm.

Source: https://lcp.integraledger.com/reference/api/evm

## Classes

### ReaderError

#### Extends

* `Error`

#### Constructors

##### Constructor

> **new ReaderError**(`kind`, `message?`): [`ReaderError`](#readererror)

###### Parameters

| Parameter  | Type                                                           |
| ---------- | -------------------------------------------------------------- |
| `kind`     | `"transport"` \| `"timeout"` \| `"too-large"` \| `"malformed"` |
| `message?` | `string`                                                       |

###### Returns

[`ReaderError`](#readererror)

###### Overrides

`Error.constructor`

#### Properties

| Property           | Modifier   | Type                                                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                       | Inherited from          |
| ------------------ | ---------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
|  `cause?`          | `public`   | `unknown`                                                      | -                                                                                                                                                                                                                                                                                                                                                                                                                                                 | `Error.cause`           |
|  `kind`            | `readonly` | `"transport"` \| `"timeout"` \| `"too-large"` \| `"malformed"` | -                                                                                                                                                                                                                                                                                                                                                                                                                                                 | -                       |
|  `message`         | `public`   | `string`                                                       | -                                                                                                                                                                                                                                                                                                                                                                                                                                                 | `Error.message`         |
|  `name`            | `public`   | `string`                                                       | -                                                                                                                                                                                                                                                                                                                                                                                                                                                 | `Error.name`            |
|  `stack?`          | `public`   | `string`                                                       | -                                                                                                                                                                                                                                                                                                                                                                                                                                                 | `Error.stack`           |
|  `stackTraceLimit` | `static`   | `number`                                                       | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured *after* the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` |

#### Methods

##### captureStackTrace()

> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`

Creates a `.stack` property on `targetObject`, which when accessed returns
a string representing the location in the code at which
`Error.captureStackTrace()` was called.

```js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`
```

The first line of the trace will be prefixed with
`${myObject.name}: ${myObject.message}`.

The optional `constructorOpt` argument accepts a function. If given, all frames
above `constructorOpt`, including `constructorOpt`, will be omitted from the
generated stack trace.

The `constructorOpt` argument is useful for hiding implementation
details of error generation from the user. For instance:

```js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
```

###### Parameters

| Parameter         | Type       |
| ----------------- | ---------- |
| `targetObject`    | `object`   |
| `constructorOpt?` | `Function` |

###### Returns

`void`

###### Inherited from

`Error.captureStackTrace`

##### prepareStackTrace()

> `static` **prepareStackTrace**(`err`, `stackTraces`): `any`

###### Parameters

| Parameter     | Type          |
| ------------- | ------------- |
| `err`         | `Error`       |
| `stackTraces` | `CallSite`\[] |

###### Returns

`any`

###### See

[https://v8.dev/docs/stack-trace-api#customizing-stack-traces](https://v8.dev/docs/stack-trace-api#customizing-stack-traces)

###### Inherited from

`Error.prepareStackTrace`

## Interfaces

### Delegation

#### Properties

| Property     | Type                |
| ------------ | ------------------- |
|  `authority` | `` `0x${string}` `` |
|  `caveats`   | `object`\[]         |
|  `delegate`  | `` `0x${string}` `` |
|  `delegator` | `` `0x${string}` `` |
|  `salt`      | `` `0x${string}` `` |
|  `signature` | `` `0x${string}` `` |

***

### Eip3009TypedData

#### Properties

| Property                          | Type                          |
| --------------------------------- | ----------------------------- |
|  `domain`                         | `object`                      |
| `domain.chainId`                  | `number`                      |
| `domain.name`                     | `string`                      |
| `domain.verifyingContract`        | `` `0x${string}` ``           |
| `domain.version`                  | `string`                      |
|  `message`                        | `object`                      |
| `message.from`                    | `` `0x${string}` ``           |
| `message.nonce`                   | `` `0x${string}` ``           |
| `message.to`                      | `` `0x${string}` ``           |
| `message.validAfter`              | `bigint`                      |
| `message.validBefore`             | `bigint`                      |
| `message.value`                   | `bigint`                      |
|  `primaryType`                    | `"TransferWithAuthorization"` |
|  `types`                          | `object`                      |
| `types.EIP712Domain`              | [`Field`](#field)\[]          |
| `types.TransferWithAuthorization` | [`Field`](#field)\[]          |

***

### EvmLog

One receipt log: the emitter, its topics and its data.

#### Properties

| Property   | Type                            |
| ---------- | ------------------------------- |
|  `address` | `` `0x${string}` ``             |
|  `data`    | `` `0x${string}` ``             |
|  `topics`  | readonly `` `0x${string}` ``\[] |

***

### EvmReader

Bounded, read-only calls against one network's endpoint. Every failure rejects with `ReaderError`.

#### Properties

| Property   | Modifier   | Type                                        |
| ---------- | ---------- | ------------------------------------------- |
|  `network` | `readonly` | `` `eip155:${string}` `` \| `HederaNetwork` |

#### Methods

##### blockNumber()

> **blockNumber**(`tag`): `Promise`\<`bigint`>

`eth_getBlockByNumber(tag, false).number`.

###### Parameters

| Parameter | Type                      |
| --------- | ------------------------- |
| `tag`     | `"safe"` \| `"finalized"` |

###### Returns

`Promise`\<`bigint`>

##### receipt()

> **receipt**(`tx`): `Promise`\<[`EvmReceipt`](#evmreceipt) | `null`>

`eth_getTransactionReceipt`; null when the node holds none.

###### Parameters

| Parameter | Type                |
| --------- | ------------------- |
| `tx`      | `` `0x${string}` `` |

###### Returns

`Promise`\<[`EvmReceipt`](#evmreceipt) | `null`>

##### transaction()

> **transaction**(`tx`): `Promise`\<[`EvmTransaction`](#evmtransaction) | `null`>

`eth_getTransactionByHash`: the recipient (null for a contract creation) and the calldata; null when none.

###### Parameters

| Parameter | Type                |
| --------- | ------------------- |
| `tx`      | `` `0x${string}` `` |

###### Returns

`Promise`\<[`EvmTransaction`](#evmtransaction) | `null`>

***

### EvmReceipt

#### Properties

| Property       | Type                            |
| -------------- | ------------------------------- |
|  `blockNumber` | `bigint`                        |
|  `logs`        | readonly [`EvmLog`](#evmlog)\[] |
|  `status`      | `0` \| `1`                      |

***

### EvmRef

What the issuer records at claim for an EVM payment: read keys only.

#### Extended by

* [`SessionRef`](https://lcp.integraledger.com/reference/api/mpp#sessionref)

#### Properties

| Property               | Type                                                                                                                                      | Description                                                                                             |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|  `bindingLog?`         | \{ address: \`0x$\{string}\`; topic0: \`0x$\{string}\`; value: \`0x$\{string}\`; } & (\{ index: 2 \| 1 \| 3; } \| \{ dataWord: number; }) | The log carrying H or its commitment: in topic `index`, or in 32-byte data word `dataWord`.             |
|  `network`             | `` `eip155:${string}` `` \| `HederaNetwork`                                                                                               | -                                                                                                       |
|  `search?`             | `object`                                                                                                                                  | The log filter that finds the transaction when none is named; absent, only a named transaction is read. |
| `search.address`       | `` `0x${string}` ``                                                                                                                       | -                                                                                                       |
| `search.topics`        | readonly (`` `0x${string}` `` \| `null`)\[]                                                                                               | -                                                                                                       |
|  `settleBy?`           | `string`                                                                                                                                  | Decimal Unix seconds after which the payment can no longer execute.                                     |
|  `transferLog?`        | `object`                                                                                                                                  | The token transfer this payment made, identified by the digest of the named fields.                     |
| `transferLog.address`  | `` `0x${string}` ``                                                                                                                       | -                                                                                                       |
| `transferLog.digest`   | `` `0x${string}` ``                                                                                                                       | -                                                                                                       |
| `transferLog.identity` | [`TransferIdentity`](#transferidentity)                                                                                                   | -                                                                                                       |
| `transferLog.topic0`   | `` `0x${string}` ``                                                                                                                       | -                                                                                                       |

***

### EvmTransaction

A transaction as `eth_getTransactionByHash` gives it: `to` and `input`.

#### Properties

| Property | Type                          |
| -------- | ----------------------------- |
|  `input` | `` `0x${string}` ``           |
|  `to`    | `` `0x${string}` `` \| `null` |

***

### EvmTxRef

#### Properties

| Property       | Type                     |
| -------------- | ------------------------ |
|  `asset`       | `` `0x${string}` ``      |
|  `network`     | `` `eip155:${string}` `` |
|  `transaction` | `` `0x${string}` ``      |

***

### Field

#### Properties

| Property | Type     |
| -------- | -------- |
|  `name`  | `string` |
|  `type`  | `string` |

***

### PaymentInfo

#### Properties

| Property               | Type                |
| ---------------------- | ------------------- |
|  `authorizationExpiry` | `bigint`            |
|  `feeReceiver`         | `` `0x${string}` `` |
|  `maxAmount`           | `bigint`            |
|  `maxFeeBps`           | `number`            |
|  `minFeeBps`           | `number`            |
|  `operator`            | `` `0x${string}` `` |
|  `payer`               | `` `0x${string}` `` |
|  `preApprovalExpiry`   | `bigint`            |
|  `receiver`            | `` `0x${string}` `` |
|  `refundExpiry`        | `bigint`            |
|  `salt`                | `` `0x${string}` `` |
|  `token`               | `` `0x${string}` `` |

***

### Permit2TypedData

#### Properties

| Property                   | Type                                                                                          |
| -------------------------- | --------------------------------------------------------------------------------------------- |
|  `domain`                  | `object`                                                                                      |
| `domain.chainId`           | `number`                                                                                      |
| `domain.name`              | `"Permit2"`                                                                                   |
| `domain.verifyingContract` | `` `0x${string}` ``                                                                           |
|  `message`                 | `object`                                                                                      |
| `message.deadline`         | `bigint`                                                                                      |
| `message.nonce`            | `bigint`                                                                                      |
| `message.permitted`        | \{ `amount`: `bigint`; `token`: `` `0x${string}` ``; } \| `object`\[]                         |
| `message.spender`          | `` `0x${string}` ``                                                                           |
| `message.witness?`         | `object`                                                                                      |
|  `primaryType`             | `"PermitTransferFrom"` \| `"PermitWitnessTransferFrom"` \| `"PermitBatchWitnessTransferFrom"` |
|  `types`                   | `object`                                                                                      |
| `types.EIP712Domain`       | [`Field`](#field)\[]                                                                          |
| `types.TokenPermissions`   | [`Field`](#field)\[]                                                                          |

## Type Aliases

### Eip155

> **Eip155** = `` `eip155:${string}` ``

CAIP-2 for EVM chains; the reference is the decimal chain id.

***

### Eip3009Ref

> **Eip3009Ref** = [`EvmRef`](#evmref) & `object`

What a settlement reference holds for an EIP-3009 payment: read keys only. It is an `EvmRef` naming the
`AuthorizationUsed` log and the transfer's identity, with the token, `validBefore` and the transfer digest.

#### Type Declaration

| Name                | Type                | Description                                                                                             |
| ------------------- | ------------------- | ------------------------------------------------------------------------------------------------------- |
| `asset`             | [`Hex`](#hex)       | -                                                                                                       |
| `idDigest`          | [`Hex`](#hex)       | -                                                                                                       |
| `maxTimeoutSeconds` | `number`            | The option's `maxTimeoutSeconds`: the authorization was signed no earlier than `validBefore` less this. |
| `network`           | [`Eip155`](#eip155) | -                                                                                                       |
| `validBefore`       | `string`            | -                                                                                                       |

***

### EvmBreadthStatus

> **EvmBreadthStatus** = [`EvmStatus`](#evmstatus) | \{ `state`: `"failed"`; `why`: `"binding-log-not-found"` | `"transfer-not-found"` | `"receive-policy-blocked"`; }

***

### EvmStatus

> **EvmStatus** = \{ `blockNumber`: `bigint`; `finality`: `"latest"` | `"safe"` | `"finalized"`; `state`: `"settled"`; } | \{ `state`: `"pending"`; `why`: `"not-found"` | `"unreadable"`; } | \{ `state`: `"failed"`; `why`: `"reverted"` | `"authorization-not-used"`; }

***

### Hex

> **Hex** = `` `0x${string}` ``

***

### ReceiveTypedData

> **ReceiveTypedData** = `Omit`\<[`Eip3009TypedData`](#eip3009typeddata), `"primaryType"` | `"types"`> & `object`

EIP-3009's `ReceiveWithAuthorization`: the same fields as `TransferWithAuthorization`, for a payee contract.

#### Type Declaration

| Name                             | Type                         |
| -------------------------------- | ---------------------------- |
| `primaryType`                    | `"ReceiveWithAuthorization"` |
| `types`                          | `object`                     |
| `types.EIP712Domain`             | [`Field`](#field)\[]         |
| `types.ReceiveWithAuthorization` | [`Field`](#field)\[]         |

***

### TransferIdentity

> **TransferIdentity** = `"from,to,value"` | `"from,to"` | `"from"` | `"to,value"` | `"to"`

## Variables

### AUTHORIZATION\_USED\_TOPIC

> `const` **AUTHORIZATION\_USED\_TOPIC**: `"0x98de503528ee59b575ef0c0a2576a82497bfc029a5685b209e9ec333479b10a5"`

keccak256("AuthorizationUsed(address,bytes32)")

***

### DELEGATION\_MANAGER

> `const` **DELEGATION\_MANAGER**: `"0xdb9B1e94B5b69Df7e401DDbedE43491141047dB3"`

MetaMask's reference DelegationManager, v1.3.0, at one CREATE2 address.

***

### DELEGATION\_MANAGER\_CHAINS

> `const` **DELEGATION\_MANAGER\_CHAINS**: readonly `number`\[]

The chain ids whose deployment record holds a DelegationManager at `DELEGATION_MANAGER`.

***

### ESCROW

> `const` **ESCROW**: \{ readonly \[d in "v1.1" | "v1.0"]: \{ chargedTopic: Hex; eip3009Collector: Hex; escrow: Hex; permit2Collector: Hex } }

The commerce-payments escrow's two deployments: the escrow, its two token collectors, and `PaymentCharged`'s topic.

***

### EXACT\_PERMIT2\_PROXY

> `const` **EXACT\_PERMIT2\_PROXY**: `"0x402085c248EeA27D92E8b30b2C58ed07f9E20001"`

***

### PAYMENT\_AUTHORIZED\_TOPIC

> `const` **PAYMENT\_AUTHORIZED\_TOPIC**: `"0x1c81fb2e3bab27f6bb09bee9a0dddf61600b7cbaf2c12683e4864e0cbdb9d284"`

***

### PAYMENT\_INFO\_TYPEHASH

> `const` **PAYMENT\_INFO\_TYPEHASH**: `"0xae68ac7ce30c86ece8196b61a7c486d8f0061f575037fbd34e7fe4e2820c6591"`

***

### PERMIT2

> `const` **PERMIT2**: `"0x000000000022D473030F116dDEE9F6B43aC78BA3"`

***

### RECEIVE\_POLICY\_GUARD

> `const` **RECEIVE\_POLICY\_GUARD**: `"0xb10c000000000000000000000000000000000000"`

Where a Tempo receive policy sends a blocked transfer.

***

### REDEEMED\_DELEGATION\_TOPIC

> `const` **REDEEMED\_DELEGATION\_TOPIC**: `"0x40dadaa36c6c2e3d7317e24757451ffb2d603d875f0ad5e92c5dd156573b1873"`

***

### SALT\_BINDING\_TYPEHASH

> `const` **SALT\_BINDING\_TYPEHASH**: `"0x8a2a7e41a0bda000ded071ff38b79401d2603e1826516ff2635b11fe9e30877f"`

***

### TRANSFER\_TOPIC

> `const` **TRANSFER\_TOPIC**: `"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"`

keccak256("Transfer(address,address,uint256)")

***

### TRANSFER\_WITH\_AUTHORIZATION\_TYPEHASH

> `const` **TRANSFER\_WITH\_AUTHORIZATION\_TYPEHASH**: `"0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267"`

keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)")

***

### UPTO\_PERMIT2\_PROXY

> `const` **UPTO\_PERMIT2\_PROXY**: `"0x4020A4f3b7b90ccA423B9fabCc0CE57C6C240002"`

## Functions

### authorizationIdDigest()

> **authorizationIdDigest**(`from`, `to`, `value`): `Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

SHA-256 over the 72 bytes of `abi.encodePacked(address from, address to, uint256 value)`: the identity of one
transfer, which a `Transfer(from, to, value)` log in the settlement transaction reproduces.

#### Parameters

| Parameter | Type                 |
| --------- | -------------------- |
| `from`    | `` `0x${string}` ``  |
| `to`      | `` `0x${string}` ``  |
| `value`   | `string` \| `bigint` |

#### Returns

`Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

***

### bindSalt()

> **bindSalt**(`receiverAuthorizer`, `policy`, `h`): `` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)

keccak256(abi.encode(SALT\_BINDING\_TYPEHASH, receiverAuthorizer, policy, h)).

#### Parameters

| Parameter            | Type                |
| -------------------- | ------------------- |
| `receiverAuthorizer` | `` `0x${string}` `` |
| `policy`             | `` `0x${string}` `` |
| `h`                  | `` `0x${string}` `` |

#### Returns

`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)

***

### carriesBinding()

> **carriesBinding**(`log`, `b`): `boolean`

A log from `address` whose topic `index`, or data word `dataWord`, equals `value` by bytes, under `topic0`.

#### Parameters

| Parameter | Type                                                                                                                                                                     |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `log`     | [`EvmLog`](#evmlog)                                                                                                                                                      |
| `b`       | `NonNullable`\<\{ address: \`0x$\{string}\`; topic0: \`0x$\{string}\`; value: \`0x$\{string}\`; } & (\{ index: 2 \| 1 \| 3; } \| \{ dataWord: number; }) \| `undefined`> |

#### Returns

`boolean`

***

### decodePermissionContext()

> **decodePermissionContext**(`ctx`): [`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Delegation`](#delegation)\[]

Decodes `abi.encode(Delegation[])`, strictly: every offset and length lies inside the input and is 32-byte aligned,
address words carry 12 zero bytes, and there are at most 8 delegations, 16 caveats each, and 8 KiB per `bytes`. The
array is returned in the input's order, leaf first. An empty array decodes to `[]`.

#### Parameters

| Parameter | Type                |
| --------- | ------------------- |
| `ctx`     | `` `0x${string}` `` |

#### Returns

[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Delegation`](#delegation)\[]

***

### eip3009Recover()

> **eip3009Recover**(`ref`, `reader`): `Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

Recovers the hash from a settlement transaction alone: the one distinct nonce among the `AuthorizationUsed` logs
that `asset` emitted in it. One call.

#### Parameters

| Parameter | Type                      |
| --------- | ------------------------- |
| `ref`     | [`EvmTxRef`](#evmtxref)   |
| `reader`  | [`EvmReader`](#evmreader) |

#### Returns

`Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

***

### eip3009Status()

> **eip3009Status**(`ref`, `reader`): `Promise`\<[`EvmStatus`](#evmstatus)>

Reads the named transaction. Settled when its receipt succeeded and holds a log from `asset` with exactly three
topics, the first `AuthorizationUsed` and the third equal to `h`; the finality is the highest block mark at or above
the receipt's block. A failed read, or a reader for another network, is pending, never failed. At most three calls.

#### Parameters

| Parameter | Type                               |
| --------- | ---------------------------------- |
| `ref`     | [`EvmTxRef`](#evmtxref) & `object` |
| `reader`  | [`EvmReader`](#evmreader)          |

#### Returns

`Promise`\<[`EvmStatus`](#evmstatus)>

***

### eip3009TypedData()

> **eip3009TypedData**(`a`): [`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Eip3009TypedData`](#eip3009typeddata)

The EIP-712 typed data for `TransferWithAuthorization`, with the field lists in ERC-3009's order. The domain's
`verifyingContract` is the token.

#### Parameters

| Parameter       | Type                                                                                                                                                                                                                                                                     |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `a`             | \{ `asset`: `` `0x${string}` ``; `from`: `` `0x${string}` ``; `name`: `string`; `network`: `` `eip155:${string}` ``; `nonce`: `` `0x${string}` ``; `to`: `` `0x${string}` ``; `validAfter`: `bigint`; `validBefore`: `bigint`; `value`: `string`; `version`: `string`; } |
| `a.asset`       | `` `0x${string}` ``                                                                                                                                                                                                                                                      |
| `a.from`        | `` `0x${string}` ``                                                                                                                                                                                                                                                      |
| `a.name`        | `string`                                                                                                                                                                                                                                                                 |
| `a.network`     | `` `eip155:${string}` ``                                                                                                                                                                                                                                                 |
| `a.nonce`       | `` `0x${string}` ``                                                                                                                                                                                                                                                      |
| `a.to`          | `` `0x${string}` ``                                                                                                                                                                                                                                                      |
| `a.validAfter`  | `bigint`                                                                                                                                                                                                                                                                 |
| `a.validBefore` | `bigint`                                                                                                                                                                                                                                                                 |
| `a.value`       | `string`                                                                                                                                                                                                                                                                 |
| `a.version`     | `string`                                                                                                                                                                                                                                                                 |

#### Returns

[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Eip3009TypedData`](#eip3009typeddata)

***

### evmStatus()

> **evmStatus**(`ref`, `reader`): `Promise`\<[`EvmBreadthStatus`](#evmbreadthstatus)>

Reads the named transaction. A reader for another network, or a failed read, is pending; no receipt is pending
`not-found`; a revert is failed. On success each log the ref names must be present, emitted by the named contract:
the binding log with `value` in its topic or data word, and the transfer log whose `from`, `to` and `value` hash to
the digest. Settled carries the highest finality mark reached. At most three calls.

#### Parameters

| Parameter | Type                           |
| --------- | ------------------------------ |
| `ref`     | [`EvmRef`](#evmref) & `object` |
| `reader`  | [`EvmReader`](#evmreader)      |

#### Returns

`Promise`\<[`EvmBreadthStatus`](#evmbreadthstatus)>

***

### isLog()

> **isLog**(`l`): `l is EvmLog`

True for a log with a string address, string topics and string data.

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `l`       | `unknown` |

#### Returns

`l is EvmLog`

***

### isReceipt()

> **isReceipt**(`r`): `r is EvmReceipt`

True for a receipt with a 0 or 1 status, a bigint block number and a list of logs.

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `r`       | `unknown` |

#### Returns

`r is EvmReceipt`

***

### paymentHash()

> **paymentHash**(`chainId`, `escrow`, `p`): `` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)

The escrow's `getHash`: keccak256(abi.encode(chainId, escrow, keccak256(abi.encode(PAYMENT\_INFO\_TYPEHASH, p)))).
With `payer` zero it is x402's `signatureNonce`.

#### Parameters

| Parameter | Type                          |
| --------- | ----------------------------- |
| `chainId` | `number`                      |
| `escrow`  | `` `0x${string}` ``           |
| `p`       | [`PaymentInfo`](#paymentinfo) |

#### Returns

`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)

***

### permit2TypedData()

> **permit2TypedData**(`a`): [`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Permit2TypedData`](#permit2typeddata)

Permit2's typed data under its domain (`name` "Permit2", no version). No witness gives `PermitTransferFrom`; a
witness gives `PermitWitnessTransferFrom`, or `PermitBatchWitnessTransferFrom` when `permitted` is an array.

#### Parameters

| Parameter              | Type                                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `a`                    | \{ `chainId`: `number`; `deadline`: `bigint`; `nonce`: `bigint`; `permitted`: \{ `amount`: `bigint`; `token`: `` `0x${string}` ``; } \| readonly `object`\[]; `spender`: `` `0x${string}` ``; `verifyingContract?`: `` `0x${string}` ``; `witness?`: \{ `fields`: readonly [`Field`](#field)\[]; `type`: `string`; `value`: \{\[`k`: `string`]: [`Json`](https://lcp.integraledger.com/reference/api#json); }; }; } |
| `a.chainId`            | `number`                                                                                                                                                                                                                                                                                                                                                                               |
| `a.deadline`           | `bigint`                                                                                                                                                                                                                                                                                                                                                                               |
| `a.nonce`              | `bigint`                                                                                                                                                                                                                                                                                                                                                                               |
| `a.permitted`          | \{ `amount`: `bigint`; `token`: `` `0x${string}` ``; } \| readonly `object`\[]                                                                                                                                                                                                                                                                                                         |
| `a.spender`            | `` `0x${string}` ``                                                                                                                                                                                                                                                                                                                                                                    |
| `a.verifyingContract?` | `` `0x${string}` ``                                                                                                                                                                                                                                                                                                                                                                    |
| `a.witness?`           | \{ `fields`: readonly [`Field`](#field)\[]; `type`: `string`; `value`: \{\[`k`: `string`]: [`Json`](https://lcp.integraledger.com/reference/api#json); }; }                                                                                                                                                                                                                                                         |
| `a.witness.fields`     | readonly [`Field`](#field)\[]                                                                                                                                                                                                                                                                                                                                                          |
| `a.witness.type`       | `string`                                                                                                                                                                                                                                                                                                                                                                               |
| `a.witness.value`      | \{\[`k`: `string`]: [`Json`](https://lcp.integraledger.com/reference/api#json); }                                                                                                                                                                                                                                                                                                                                   |

#### Returns

[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`Permit2TypedData`](#permit2typeddata)

***

### receiveTypedData()

> **receiveTypedData**(`a`): [`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`ReceiveTypedData`](#receivetypeddata)

The EIP-712 typed data for `ReceiveWithAuthorization`, built as `eip3009TypedData` builds its transfer form.

#### Parameters

| Parameter       | Type                                                                                                                                                                                                                                                                     |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `a`             | \{ `asset`: `` `0x${string}` ``; `from`: `` `0x${string}` ``; `name`: `string`; `network`: `` `eip155:${string}` ``; `nonce`: `` `0x${string}` ``; `to`: `` `0x${string}` ``; `validAfter`: `bigint`; `validBefore`: `bigint`; `value`: `string`; `version`: `string`; } |
| `a.asset`       | `` `0x${string}` ``                                                                                                                                                                                                                                                      |
| `a.from`        | `` `0x${string}` ``                                                                                                                                                                                                                                                      |
| `a.name`        | `string`                                                                                                                                                                                                                                                                 |
| `a.network`     | `` `eip155:${string}` ``                                                                                                                                                                                                                                                 |
| `a.nonce`       | `` `0x${string}` ``                                                                                                                                                                                                                                                      |
| `a.to`          | `` `0x${string}` ``                                                                                                                                                                                                                                                      |
| `a.validAfter`  | `bigint`                                                                                                                                                                                                                                                                 |
| `a.validBefore` | `bigint`                                                                                                                                                                                                                                                                 |
| `a.value`       | `string`                                                                                                                                                                                                                                                                 |
| `a.version`     | `string`                                                                                                                                                                                                                                                                 |

#### Returns

[`Refusal`](https://lcp.integraledger.com/reference/api#refusal) | [`ReceiveTypedData`](#receivetypeddata)

***

### redeemedLeafRecover()

> **redeemedLeafRecover**(`ref`, `reader`): `Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

Recovers H from a settlement transaction through MetaMask's DelegationManager: among its `RedeemedDelegation` logs,
the leaves are those whose data word 1 (the delegate) is the redeemer in topic 2 or the wildcard delegate; exactly
one distinct leaf salt (data word 5) is H. One call.

#### Parameters

| Parameter         | Type                                                                          |
| ----------------- | ----------------------------------------------------------------------------- |
| `ref`             | \{ `network`: `` `eip155:${string}` ``; `transaction`: `` `0x${string}` ``; } |
| `ref.network`     | `` `eip155:${string}` ``                                                      |
| `ref.transaction` | `` `0x${string}` ``                                                           |
| `reader`          | [`EvmReader`](#evmreader)                                                     |

#### Returns

`Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

***

### settledAt()

> **settledAt**(`at`, `reader`): `Promise`\<[`EvmStatus`](#evmstatus) & `object`>

Settled at the highest finality mark whose block is at or above `at`; a failed mark read counts as not reached.

#### Parameters

| Parameter | Type                      |
| --------- | ------------------------- |
| `at`      | `bigint`                  |
| `reader`  | [`EvmReader`](#evmreader) |

#### Returns

`Promise`\<[`EvmStatus`](#evmstatus) & `object`>

***

### transferDigest()

> **transferDigest**(`v`): `Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

the core's `hash` over the fields present, in the order `from`, `to`, `value`: 20, 20 and 32 bytes, the value as a
big-endian uint256. `authorizationIdDigest(from, to, value)` equals `transferDigest({from, to, value})`.

#### Parameters

| Parameter  | Type                                                                               |
| ---------- | ---------------------------------------------------------------------------------- |
| `v`        | \{ `from?`: `` `0x${string}` ``; `to?`: `` `0x${string}` ``; `value?`: `bigint`; } |
| `v.from?`  | `` `0x${string}` ``                                                                |
| `v.to?`    | `` `0x${string}` ``                                                                |
| `v.value?` | `bigint`                                                                           |

#### Returns

`Promise`\<`` `0x${string}` `` | [`Refusal`](https://lcp.integraledger.com/reference/api#refusal)>

***

### transferParts()

> **transferParts**(`log`, `address`, `topic0`): \{ `from`: `` `0x${string}` ``; `to`: `` `0x${string}` ``; `value`: `bigint`; } | `undefined`

`from` and `to` from topics 1 and 2 (their low 20 bytes) and `value` from data word 0, for a log from `address`
under `topic0`. An ERC-20 `Transfer` has exactly three topics; an event that also indexes a memo has four.

#### Parameters

| Parameter | Type                |
| --------- | ------------------- |
| `log`     | [`EvmLog`](#evmlog) |
| `address` | `` `0x${string}` `` |
| `topic0`  | `` `0x${string}` `` |

#### Returns

\{ `from`: `` `0x${string}` ``; `to`: `` `0x${string}` ``; `value`: `bigint`; } | `undefined`
