Skip to content
Integra Protocol
API

@integraledger/lcp/tempo

Tempo rail pieces: the `0x76` transaction's calls, the TIP-20 `transferWithMemo` calldata, the TIP-20 channel reserve's descriptor and ids, and the account keychain's key authorizations.

For AI agents: this page as Markdown, and llms.txt, the index of every page.

Tempo rail pieces: the 0x76 transaction's calls, the TIP-20 transferWithMemo calldata, the TIP-20 channel reserve's descriptor and ids, and the account keychain's key authorizations.

Tempo serves eip155 JSON-RPC, so the reader is EvmReader. Nothing here throws on a caller's value; refusals are values.

Interfaces

KeyAuthorizationUnsigned

Properties

PropertyTypeDescription
requestobjectdigest is keccak256(rlp(authorization)); the root key signs it.
request.authorizationTempoKeyAuthorization-
request.digest`0x${string}`-
request.kind"tempo-key-authorization"-

Methods

complete()

complete(rootSignature): Refusal | MppCredential

The credential for the root key's signature over digest, checked in bound's order: a credential over the credential size bound, 64 KiB, its echoed challenge included, is mpp/credential-malformed, then a signed key authorization over 8,192 bytes is tempo/key-authorization-malformed, as bound refuses each.

Parameters
ParameterType
rootSignature`0x${string}`
Returns

Refusal | MppCredential


TempoCall

Properties

PropertyType
inputUint8Array<ArrayBuffer>
to`0x${string}` | null
valuebigint

TempoDescriptor

Properties

PropertyType
authorizedSigner`0x${string}`
expiringNonceHash`0x${string}`
operator`0x${string}`
payee`0x${string}`
payer`0x${string}`
salt`0x${string}`
token`0x${string}`

TempoKeyAuthorization

Properties

PropertyType
allowedCallsobject[]
chainIdbigint
expirybigint
keyId`0x${string}`
keyType0 | 1 | 2
limitsobject[]
witness`0x${string}`

TempoSearchReader

A reader of a Tempo network: an EvmSearchReader that also reads a storage slot, an account's protocol nonce and the transactions of a block, each in the state after the block named. Every failure rejects.

Extends

Properties

PropertyModifierTypeInherited from
networkreadonly`eip155:${string}` | HederaNetworkEvmSearchReader.network

Methods

block()

block(at): Promise<{ number: bigint; timestamp: bigint; }>

eth_getBlockByNumber(at, false): the block's number and its timestamp, in seconds.

Parameters
ParameterType
atbigint | "safe" | "finalized" | "latest"
Returns

Promise<{ number: bigint; timestamp: bigint; }>

Inherited from

EvmSearchReader.block

blockNumber()

blockNumber(tag): Promise<bigint>

eth_getBlockByNumber(tag, false).number.

Parameters
ParameterType
tag"safe" | "finalized"
Returns

Promise<bigint>

Inherited from

EvmSearchReader.blockNumber

blockTransactions()

blockTransactions(block): Promise<readonly `0x${string}`[]>

eth_getBlockByNumber(block, false)'s transactions: the hashes of the block's transactions, in its order.

Parameters
ParameterType
blockbigint
Returns

Promise<readonly `0x${string}`[]>

call()

call(to, data, block): Promise<`0x${string}`>

eth_call of data to the contract to, in the state after block block: the return data.

Parameters
ParameterType
to`0x${string}`
data`0x${string}`
blockbigint
Returns

Promise<`0x${string}`>

Inherited from

EvmSearchReader.call

logs()

logs(filter): Promise<readonly EvmLogEntry[]>

eth_getLogs over [fromBlock, toBlock]: address absent reads every contract, and each topic is matched by its position, null matching any.

Parameters
ParameterType
filter{ address?: `0x${string}`; fromBlock: bigint; toBlock: bigint; topics: readonly (`0x${string}` | null)[]; }
filter.address?`0x${string}`
filter.fromBlockbigint
filter.toBlockbigint
filter.topicsreadonly (`0x${string}` | null)[]
Returns

Promise<readonly EvmLogEntry[]>

Inherited from

EvmSearchReader.logs

nonceAt()

nonceAt(account, block): Promise<bigint>

eth_getTransactionCount(account, block).

Parameters
ParameterType
account`0x${string}`
blockbigint
Returns

Promise<bigint>

raw()

raw(tx): Promise<`0x${string}` | null>

eth_getRawTransactionByHash: the signed transaction's bytes; null when the node holds none.

Parameters
ParameterType
tx`0x${string}`
Returns

Promise<`0x${string}` | null>

Inherited from

EvmSearchReader.raw

receipt()

receipt(tx): Promise<EvmReceipt | null>

eth_getTransactionReceipt; null when the node holds none.

Parameters
ParameterType
tx`0x${string}`
Returns

Promise<EvmReceipt | null>

Inherited from

EvmSearchReader.receipt

storageAt()

storageAt(address, slot, block): Promise<`0x${string}`>

eth_getStorageAt(address, slot, block): the 32-byte word.

Parameters
ParameterType
address`0x${string}`
slot`0x${string}`
blockbigint
Returns

Promise<`0x${string}`>

transaction()

transaction(tx): Promise<EvmTransaction | null>

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

Parameters
ParameterType
tx`0x${string}`
Returns

Promise<EvmTransaction | null>

Inherited from

EvmSearchReader.transaction

Variables

ACCESS_KEY_SPEND_TOPIC

const ACCESS_KEY_SPEND_TOPIC: "0xe0815e3aaadddf4dd75bde97fc060f0c38afe18e87a169be86a3f5c28247f192"

AccessKeySpend(address,address,address,uint256,uint256): the account, the key id and the token are topics 1 to 3; the keychain emits it for each spend an access key with enforced limits makes against its limit.


ACCOUNT_KEYCHAIN

const ACCOUNT_KEYCHAIN: "0xaaaaaaaa00000000000000000000000000000000"

The account keychain precompile.


CHANNEL_CLOSED_V1_TOPIC

const CHANNEL_CLOSED_V1_TOPIC: "0x92ed5fe0fe56b3f4185e688efb342e92a4492b9df29ad5de596c44e64d097b51"

ChannelClosed(bytes32,address,address,uint256,uint256), the v1 escrow's event.


CHANNEL_CLOSED_V2_TOPIC

const CHANNEL_CLOSED_V2_TOPIC: "0x5613aed96d5bf39f928408dbe1d4143490b9bb5957eac2dd8e69b5dc4b2206e6"

ChannelClosed(bytes32,address,address,uint96,uint96)


CHANNEL_OPENED_V1_TOPIC

const CHANNEL_OPENED_V1_TOPIC: "0xcd6e60364f8ee4c2b0d62afc07a1fb04fd267ce94693f93f8f85daaa099b5c94"

ChannelOpened(bytes32,address,address,address,address,bytes32,uint256), the v1 escrow's event as it is deployed and as mppx's legacy escrow ABI has it (0.15.0 dist/tempo/legacy/session/escrow.abi.js:517-561): the channel id, the payer and the payee indexed; the token, the authorized signer, the salt and the deposit, data words 0 to 3.


CHANNEL_OPENED_V2_TOPIC

const CHANNEL_OPENED_V2_TOPIC: "0xdebaba36f0e9c7978f536fed432d9360b1f9646d7ca88531c34c3eae43f154a7"

ChannelOpened(bytes32,address,address,address,address,address,bytes32,bytes32,uint96)


KEY_AUTHORIZATION_WITNESS_TOPIC

const KEY_AUTHORIZATION_WITNESS_TOPIC: "0x1f09d8956d18ea185372a3f7f40aca24bb45f303920c37c5f0605f4871da41f6"

KeyAuthorizationWitness(address,bytes32)


KEY_REVOKED_TOPIC

const KEY_REVOKED_TOPIC: "0x14ce4f0c8c12936436b733974fb13d10fc13e8c41c06dc8e19d82001c93d7989"

KeyRevoked(address,address)


OPEN_V1_SELECTOR

const OPEN_V1_SELECTOR: "0xc79ea485"

open(address,address,uint128,bytes32,address)


OPEN_V2_SELECTOR

const OPEN_V2_SELECTOR: "0xedc53b00"

open(address,address,address,uint96,bytes32,address)


RECEIVE_POLICY_GUARD

const RECEIVE_POLICY_GUARD: "0xb10c000000000000000000000000000000000000"

Where a Tempo receive policy sends a blocked transfer.


TIP20_CHANNEL_RESERVE

const TIP20_CHANNEL_RESERVE: "0x4d50500000000000000000000000000000000000"

The TIP-20 channel reserve precompile.


TRANSFER_WITH_MEMO_SELECTOR

const TRANSFER_WITH_MEMO_SELECTOR: "0x95777d59"

The first four bytes of keccak256("transferWithMemo(address,uint256,bytes32)").


TRANSFER_WITH_MEMO_TOPIC

const TRANSFER_WITH_MEMO_TOPIC: "0x57bc7354aa85aed339e000bccffabbc529466af35f0772c8f8ee1145927de7f0"

keccak256("TransferWithMemo(address,address,uint256,bytes32)")

Functions

decodeKeyAuthorization()

decodeKeyAuthorization(signed): Refusal | { allowedCalls: object[]; digest: `0x${string}`; keyId: `0x${string}`; limits: object[]; witness?: `0x${string}`; }

Reads a signed key authorization: an RLP list of the authorization (3 to 9 items) and a byte-string signature. The digest is keccak256 over the authorization's bytes as received. The witness is item 6, 32 bytes, when present. The scope the payer signed is item 4, the limits (each a 20-byte token, a limit and, when non-zero, a period; an absent period is 0), and item 5, the allowed calls (each a 20-byte target and its selector rules, each a 4-byte selector and 20-byte recipients). An absent item and an empty list both read as an empty list, though Tempo gives them opposite meanings (absent: no limit or no call restriction; empty: no spending or no calls).

Parameters

ParameterType
signed`0x${string}`

Returns

Refusal | { allowedCalls: object[]; digest: `0x${string}`; keyId: `0x${string}`; limits: object[]; witness?: `0x${string}`; }


decodeTempoTx()

decodeTempoTx(wire): Refusal | { calls: TempoCall[]; chainId: bigint; validBefore: bigint | null; }

The chain id, the calls and valid_before of a signed 0x76 transaction. Each call is rlp([to, value, input]), with an empty to read as null and input a copy of wire's bytes. valid_before written empty is null.

Parameters

ParameterType
wireUint8Array

Returns

Refusal | { calls: TempoCall[]; chainId: bigint; validBefore: bigint | null; }


encodeKeyAuthorization()

encodeKeyAuthorization(a, signature?): Uint8Array<ArrayBuffer> | Refusal

rlp([chain_id, key_type, key_id, expiry, limits, allowed_calls, witness]); with a signature, rlp([that list, signature]). At most 16 limits and 16 scopes, 16 selector rules each and 16 recipients each. Every item is written, the empty ones included: an expiry of 0 as 0x80, which Tempo reads as no expiry, and an empty limits or allowedCalls as an empty list, which Tempo reads as no spending or no calls, never as the absent item.

Parameters

ParameterType
aTempoKeyAuthorization
signature?`0x${string}`

Returns

Uint8Array<ArrayBuffer> | Refusal


expiringNonceHash()

expiringNonceHash(signedTx, sender): Refusal | `0x${string}`

keccak256(0x76 ‖ rlp(every envelope field before the sender's signature) ‖ sender). When a fee payer has signed, fee_token is written as 0x80 and the fee payer's signature as 0x00, as the sender signed them.

Parameters

ParameterType
signedTxUint8Array
sender`0x${string}`

Returns

Refusal | `0x${string}`


keyAuthorizationDigest()

keyAuthorizationDigest(a): Refusal | `0x${string}`

The digest a key authorization's root key signs: keccak256 of encodeKeyAuthorization(a), the authorization with no signature, the digest of KeyAuthorizationUnsigned's request. An authorization encodeKeyAuthorization refuses is refused the same way.

Parameters

ParameterType
aTempoKeyAuthorization

Returns

Refusal | `0x${string}`


memoCalldata()

memoCalldata(to, amount, memo): Refusal | `0x${string}`

transferWithMemo(to, amount, memo) calldata: the selector, then the three 32-byte words.

Parameters

ParameterType
to`0x${string}`
amountbigint
memo`0x${string}`

Returns

Refusal | `0x${string}`


tempoChannelId()

tempoChannelId(d): Refusal | `0x${string}`

The TIP-20 channel reserve's channel id: keccak256(abi.encode(payer, payee, operator, token, salt, authorizedSigner, expiringNonceHash, escrow, chainId)).

Parameters

ParameterType
dTempoDescriptor & object

Returns

Refusal | `0x${string}`


witnessRecover()

witnessRecover(input, reader): Promise<Refusal | `0x${string}`>

Reads the transaction's receipt and returns topic 2 of its one KeyAuthorizationWitness log from the account keychain: none is tempo/no-witness, and more than one tempo/ambiguous. A failed read is tempo/unreadable, no receipt tempo/not-found and a revert tempo/reverted, as readReceiptAtMark answers. A revert, tempo/no-witness and tempo/ambiguous are given only where the receipt's block is at or below the reader's finalized mark: above it, or where that mark cannot be read, each is tempo/not-final, a read to repeat, since a block above the mark can be replaced by one in which the transaction succeeds or holds other logs. The mark is read only for those. The challenge is not read. An input or reader that is not an object, an input whose tx is not a 32-byte hash, or a reader for another network than the input names, is tempo/wrong-reader, with nothing read. At most two calls.

Parameters

ParameterType
inputRecoverInput<string, MppChallenge>
readerEvmReader

Returns

Promise<Refusal | `0x${string}`>

Last updated on

On this page