Skip to content
Integra Protocol
API

@integraledger/lcp/hedera

The exports of @integraledger/lcp/hedera.

Interfaces

ExecutorRef

Properties

PropertyTypeDescription
assetstring-
idDigest`0x${string}`-
networkHederaNetwork-
settleBynumberUnix seconds: claim time plus maxTimeoutSeconds.
transaction?stringThe facilitator's SettlementResponse.transaction, mirror form.

HederaBody

Properties

PropertyTypeDescription
bodyBytesUint8Array-
idHederaTxId-
memostring-
validDurationnumbertransactionValidDuration, in seconds.

HederaChannelConfig

Properties

PropertyType
authorizedSigner`0x${string}`
chainId295 | 296
escrow`0x${string}`
payee`0x${string}`
payer`0x${string}`
salt`0x${string}`
token`0x${string}`

HederaReader

Bounded, read-only calls against one network's Mirror Node. Every failure rejects.

Properties

PropertyModifierType
networkreadonlyHederaNetwork

Methods

transactions()

transactions(mirrorId): Promise<readonly MirrorEntry[] | null>

GET /api/v1/transactions/{id}; null on 404.

Parameters
ParameterType
mirrorIdstring
Returns

Promise<readonly MirrorEntry[] | null>


HederaRef

The read keys recorded at claim, taken from the signed body.

Properties

PropertyTypeDescription
expectMemostring-
networkHederaNetwork-
transactionIdstringMirror form.
validUntilnumberUnix seconds: valid start plus the valid duration.

HederaTxId

Properties

PropertyTypeDescription
accountstring"shard.realm.num"
nanosnumber-
secondsbigint-

HederaUnsigned

The body the payer signs, and how its signature completes the wire transaction.

Properties

PropertyTypeDescription
requestobjectbroadcast: true when the payer's signer signs and broadcasts the body itself (a push).
request.bodyBytesUint8Array-
request.broadcast?true-
request.kind"hedera-body"-

Methods

complete()

complete(s): string | Refusal

The signed Transaction, base64.

Parameters
ParameterType
s{ publicKey: Uint8Array; signature: Uint8Array; type: "ed25519" | "ecdsa-secp256k1"; }
s.publicKeyUint8Array
s.signatureUint8Array
s.type"ed25519" | "ecdsa-secp256k1"
Returns

string | Refusal


HederaVoucherTypedData

The EIP-712 voucher a Hedera session's payer signs: Voucher(bytes32 channelId,uint128 cumulativeAmount).

Properties

PropertyType
domainobject
domain.chainId295 | 296
domain.name"Hedera Stream Channel"
domain.verifyingContract`0x${string}`
domain.version"1"
messageobject
message.channelId`0x${string}`
message.cumulativeAmountbigint
primaryType"Voucher"
typesobject
types.Voucher[{ name: "channelId"; type: "bytes32"; }, { name: "cumulativeAmount"; type: "uint128"; }]

MirrorEntry

The Mirror Node's Transaction entry: the fields read here.

Properties

PropertyType
consensus_timestampstring
memo_base64string | null
noncenumber
resultstring
scheduledboolean
token_transfers?readonly object[]
transfers?readonly object[]

Type Aliases

ExecutorPayload

ExecutorPayload = object

The x402 transferExecutor payload.

Properties

PropertyType
authorizationHex
executorstring
payerstring

ExecutorPaymentPayload

ExecutorPaymentPayload = X402Payment<ExecutorPayload>


HederaCloseRef

HederaCloseRef = object

A close: the transaction whose ChannelClosed log from the escrow names the channel, and search, the log filter that finds that transaction when no one reports it.

Properties

PropertyType
channelHex
escrowHex
networkHederaNetwork
phase"close"
searchobject
search.addressHex
search.topicsreadonly (Hex | null)[]
transactionHex

HederaEvmReader

HederaEvmReader = Omit<EvmReader, "network"> & object

A reader of a Hedera network's JSON-RPC relay: an EvmReader on a hedera: network.

Type Declaration

NameType
networkHederaNetwork

HederaLandedCharge

HederaLandedCharge = MppCredential & object

A Hedera charge credential with what fetchPresented read: the network, and for a push the landed memo.

Type Declaration

NameType
landedobject
landed.memo?string
landed.networkHederaNetwork

HederaNetwork

HederaNetwork = "hedera:mainnet" | "hedera:testnet" | "hedera:previewnet" | "hedera:devnet"


HederaPayload

HederaPayload = object

The x402 exact payload on Hedera: the partially signed transaction, base64.

Properties

PropertyType
transactionstring

HederaPaymentPayload

HederaPaymentPayload = X402Payment<HederaPayload>


HederaSessionRef

HederaSessionRef = Omit<EvmRef, "network"> & object

The opening's read keys: the reported open transaction and its ChannelOpened log from the escrow.

Type Declaration

NameType
networkHederaNetwork
transactionHex

HederaStatus

HederaStatus = { consensus: string; state: "settled"; } | { state: "pending"; why: "not-found" | "unreadable"; } | { state: "failed"; why: "not-this-instrument" | `result:${string}`; }


MppHederaRequest

MppHederaRequest = object

An MPP Hedera charge request as decoded from the challenge's request.

Index Signature

[k: string]: Json

Variables

APPROVE_SELECTOR

const APPROVE_SELECTOR: "0x095ea7b3" = "0x095ea7b3"


CHANNEL_CLOSED_TOPIC

const CHANNEL_CLOSED_TOPIC: "0x92ed5fe0fe56b3f4185e688efb342e92a4492b9df29ad5de596c44e64d097b51" = "0x92ed5fe0fe56b3f4185e688efb342e92a4492b9df29ad5de596c44e64d097b51"


CHANNEL_OPENED_TOPIC

const CHANNEL_OPENED_TOPIC: "0xcd6e60364f8ee4c2b0d62afc07a1fb04fd267ce94693f93f8f85daaa099b5c94" = "0xcd6e60364f8ee4c2b0d62afc07a1fb04fd267ce94693f93f8f85daaa099b5c94"

ChannelOpened(bytes32,address,address,address,address,bytes32,uint256): channel, payer, payee indexed.


chargeHedera

const chargeHedera: Readonly<{ advertise: (doc, h, link, offer, agreementUrl?) => Refusal | MppChallenge[]; bound: (input) => Promise<`0x${string}` | Refusal>; build: (credentialChallenge, request, c) => Promise<Refusal | HederaUnsigned>; carrier: "challenge"; claims: boolean; fetchPresented: (input, reader, defaultNetwork?) => Promise<Refusal | HederaLandedCharge>; id: "mpp/charge/hedera"; landedTx: (presented) => string | undefined; network: (request, defaultNetwork?) => Refusal | HederaNetwork; pattern: LcpPattern; read: (doc) => Refusal | { agreement?: string; h: `0x${string}`; link: string; offer: { challenges: MppChallenge[]; }; }; reference: (input) => Promise<Refusal | HederaRef>; status: (ref, reader) => Promise<HederaStatus>; tie: (options) => ["mpp", { challenges: MppChallenge[]; }]; unplaced: (option) => MppChallenge; }>


ESCROW_OPEN_SELECTOR

const ESCROW_OPEN_SELECTOR: "0xc79ea485" = "0xc79ea485"

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


exactHedera

const exactHedera: Readonly<{ advertise: (doc, h, link, offer, agreementUrl?) => Refusal | PaymentRequired; bound: (presented) => Promise<`0x${string}` | Refusal>; build: (c, h) => Promise<Refusal | HederaUnsigned>; carrier: "TransactionBody.memo"; claims: boolean; id: "x402/exact/hedera"; pattern: LcpPattern; read: (doc) => Refusal | X402Read; recover: (ref, reader) => Promise<`0x${string}` | Refusal>; reference: (presented) => Promise<Refusal | HederaRef>; status: (ref, reader) => Promise<HederaStatus>; tie: (accepts, request) => ["x402", { accepts: readonly PaymentRequirements[]; request: RequestCommitment; }]; unplaced: (option) => PaymentRequirements; }>


exactHederaExecutor

const exactHederaExecutor: Readonly<{ advertise: (doc, h, link, offer, agreementUrl?) => Refusal | PaymentRequired; bound: (presented) => Promise<`0x${string}` | Refusal>; build: (c, h) => Promise<Refusal | { request: { amount: string; asset: string; executors: readonly string[]; kind: "hedera-executor"; network: HederaNetwork; payTo: string; validBefore: number; }; complete: Refusal | ExecutorPaymentPayload; }>; claims: boolean; id: "x402/exact/hedera/transfer-executor"; pattern: LcpPattern; read: (doc) => Refusal | X402Read; reference: (presented) => Promise<Refusal | ExecutorRef>; status: (ref, reader) => Promise<HederaStatus>; tie: (accepts, request) => ["x402", { accepts: readonly PaymentRequirements[]; request: RequestCommitment; }]; unplaced: (option) => PaymentRequirements; }>


HEDERA_CHAIN_IDS

const HEDERA_CHAIN_IDS: Readonly<Record<number, HederaNetwork>>

MPP's EIP-155 chain ids for Hedera, mapped to their CAIP-2 networks.


HEDERA_NETWORKS

const HEDERA_NETWORKS: readonly HederaNetwork[]

Functions

approveCalldata()

approveCalldata(spender, amount): `0x${string}`

approve(spender, amount) calldata.

Parameters

ParameterType
spender`0x${string}`
amountbigint

Returns

`0x${string}`


decodeHederaTx()

decodeHederaTx(wire): Refusal | { bodies: readonly HederaBody[]; }

Reads a wire Transaction, or the SDK's TransactionList of them (a top-level field 1): each body's transaction id, valid duration, memo and exact bytes. Every body of a list must share id and memo.

Parameters

ParameterType
wireUint8Array

Returns

Refusal | { bodies: readonly HederaBody[]; }


executorStatus()

executorStatus(ref, reader): Promise<HederaStatus>

Reads the merged consensus record of the named transaction: the user entry must be SUCCESS; each account's net change in the asset is summed over the user entry and its children, leaving out the fee payer; exactly one other account must be debited, and a credit of the same magnitude must give the recorded digest.

Parameters

ParameterType
refExecutorRef & object
readerHederaReader

Returns

Promise<HederaStatus>


hederaChannelId()

hederaChannelId(c): `0x${string}`

keccak256(abi.encode(payer, payee, token, salt, authorizedSigner, escrow, chainId)), lowercase.

Parameters

ParameterType
cHederaChannelConfig

Returns

`0x${string}`


hederaChargeRequest()

hederaChargeRequest(c): true | Refusal

The Hedera request checks a charge challenge must pass before it is placed.

Parameters

ParameterType
cMppChallenge

Returns

true | Refusal


hederaIdDigest()

hederaIdDigest(payer, payTo, amount): Promise<`0x${string}`>

the core's hash over the ASCII of payer,payTo,amount: the identity of one transfer, never shown in the clear.

Parameters

ParameterType
payerstring
payTostring
amountstring

Returns

Promise<`0x${string}`>


hederaNetworkOfChainId()

hederaNetworkOfChainId(chainId): Refusal | HederaNetwork

The CAIP-2 network of an MPP methodDetails.chainId: 295 and 296 only.

Parameters

ParameterType
chainIdunknown

Returns

Refusal | HederaNetwork


hederaPairingOf()

hederaPairingOf(o): Refusal | "x402/exact/hedera" | "x402/exact/hedera/transfer-executor" | undefined

The Hedera pairing an option names: x402/exact/hedera for cryptoTransfer (or no method), the transfer-executor pairing for transferExecutor; a Hedera option either cannot serve is hedera/option-malformed. Undefined for an option on another rail.

Parameters

ParameterType
oPaymentRequirements

Returns

Refusal | "x402/exact/hedera" | "x402/exact/hedera/transfer-executor" | undefined


hederaStatus()

hederaStatus(ref, reader): Promise<HederaStatus>

Reads every Mirror Node entry for the transaction id. Duplicates, child and scheduled records are skipped; the user transaction with SUCCESS and the recorded memo is settled, with another memo it is not this instrument, and any other result is failed with that result. A failed read, or a reader for another network, is pending.

Parameters

ParameterType
refHederaRef
readerHederaReader

Returns

Promise<HederaStatus>


hederaVoucher()

hederaVoucher(c, cumulative): HederaVoucherTypedData

The voucher for cumulative on a channel, under the escrow's domain.

Parameters

ParameterType
c{ chainId: 295 | 296; channelId: `0x${string}`; escrow: `0x${string}`; }
c.chainId295 | 296
c.channelId`0x${string}`
c.escrow`0x${string}`
cumulativebigint

Returns

HederaVoucherTypedData


openCalldata()

openCalldata(payee, token, deposit, salt, authorizedSigner): `0x${string}`

The escrow's open(payee, token, deposit, salt, authorizedSigner) calldata.

Parameters

ParameterType
payee`0x${string}`
token`0x${string}`
depositbigint
salt`0x${string}`
authorizedSigner`0x${string}`

Returns

`0x${string}`


txIdMirror()

txIdMirror(id): string

"0.0.1235-1700000000-000000000", the Mirror Node's form.

Parameters

ParameterType
idHederaTxId

Returns

string


txIdText()

txIdText(id): string

"0.0.1235@1700000000.000000000"

Parameters

ParameterType
idHederaTxId

Returns

string

Last updated on

On this page