@integraledger/lcp/hedera
The exports of @integraledger/lcp/hedera.
Interfaces
ExecutorRef
Properties
| Property | Type | Description |
|---|---|---|
asset | string | - |
idDigest | `0x${string}` | - |
network | HederaNetwork | - |
settleBy | number | Unix seconds: claim time plus maxTimeoutSeconds. |
transaction? | string | The facilitator's SettlementResponse.transaction, mirror form. |
HederaBody
Properties
| Property | Type | Description |
|---|---|---|
bodyBytes | Uint8Array | - |
id | HederaTxId | - |
memo | string | - |
validDuration | number | transactionValidDuration, in seconds. |
HederaChannelConfig
Properties
| Property | Type |
|---|---|
authorizedSigner | `0x${string}` |
chainId | 295 | 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
| Property | Modifier | Type |
|---|---|---|
network | readonly | HederaNetwork |
Methods
transactions()
transactions(
mirrorId):Promise<readonlyMirrorEntry[] |null>
GET /api/v1/transactions/{id}; null on 404.
Parameters
| Parameter | Type |
|---|---|
mirrorId | string |
Returns
Promise<readonly MirrorEntry[] | null>
HederaRef
The read keys recorded at claim, taken from the signed body.
Properties
| Property | Type | Description |
|---|---|---|
expectMemo | string | - |
network | HederaNetwork | - |
transactionId | string | Mirror form. |
validUntil | number | Unix seconds: valid start plus the valid duration. |
HederaTxId
Properties
HederaUnsigned
The body the payer signs, and how its signature completes the wire transaction.
Properties
Methods
complete()
complete(
s):string|Refusal
The signed Transaction, base64.
Parameters
| Parameter | Type |
|---|---|
s | { publicKey: Uint8Array; signature: Uint8Array; type: "ed25519" | "ecdsa-secp256k1"; } |
s.publicKey | Uint8Array |
s.signature | Uint8Array |
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
MirrorEntry
The Mirror Node's Transaction entry: the fields read here.
Properties
| Property | Type |
|---|---|
consensus_timestamp | string |
memo_base64 | string | null |
nonce | number |
result | string |
scheduled | boolean |
token_transfers? | readonly object[] |
transfers? | readonly object[] |
Type Aliases
ExecutorPayload
ExecutorPayload =
object
The x402 transferExecutor payload.
Properties
| Property | Type |
|---|---|
authorization | Hex |
executor | string |
payer | string |
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
| Property | Type |
|---|---|
channel | Hex |
escrow | Hex |
network | HederaNetwork |
phase | "close" |
search | object |
search.address | Hex |
search.topics | readonly (Hex | null)[] |
transaction | Hex |
HederaEvmReader
HederaEvmReader =
Omit<EvmReader,"network"> &object
A reader of a Hedera network's JSON-RPC relay: an EvmReader on a hedera: network.
Type Declaration
| Name | Type |
|---|---|
network | HederaNetwork |
HederaLandedCharge
HederaLandedCharge =
MppCredential&object
A Hedera charge credential with what fetchPresented read: the network, and for a push the landed memo.
Type Declaration
| Name | Type |
|---|---|
landed | object |
landed.memo? | string |
landed.network | HederaNetwork |
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
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
| Name | Type |
|---|---|
network | HederaNetwork |
transaction | Hex |
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
constAPPROVE_SELECTOR:"0x095ea7b3"="0x095ea7b3"
CHANNEL_CLOSED_TOPIC
constCHANNEL_CLOSED_TOPIC:"0x92ed5fe0fe56b3f4185e688efb342e92a4492b9df29ad5de596c44e64d097b51"="0x92ed5fe0fe56b3f4185e688efb342e92a4492b9df29ad5de596c44e64d097b51"
CHANNEL_OPENED_TOPIC
constCHANNEL_OPENED_TOPIC:"0xcd6e60364f8ee4c2b0d62afc07a1fb04fd267ce94693f93f8f85daaa099b5c94"="0xcd6e60364f8ee4c2b0d62afc07a1fb04fd267ce94693f93f8f85daaa099b5c94"
ChannelOpened(bytes32,address,address,address,address,bytes32,uint256): channel, payer, payee indexed.
chargeHedera
constchargeHedera: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
constESCROW_OPEN_SELECTOR:"0xc79ea485"="0xc79ea485"
open(address,address,uint128,bytes32,address).
exactHedera
constexactHedera: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: readonlyPaymentRequirements[];request:RequestCommitment; }];unplaced: (option) =>PaymentRequirements; }>
exactHederaExecutor
constexactHederaExecutor: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: readonlystring[];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: readonlyPaymentRequirements[];request:RequestCommitment; }];unplaced: (option) =>PaymentRequirements; }>
HEDERA_CHAIN_IDS
constHEDERA_CHAIN_IDS:Readonly<Record<number,HederaNetwork>>
MPP's EIP-155 chain ids for Hedera, mapped to their CAIP-2 networks.
HEDERA_NETWORKS
constHEDERA_NETWORKS: readonlyHederaNetwork[]
Functions
approveCalldata()
approveCalldata(
spender,amount):`0x${string}`
approve(spender, amount) calldata.
Parameters
| Parameter | Type |
|---|---|
spender | `0x${string}` |
amount | bigint |
Returns
`0x${string}`
decodeHederaTx()
decodeHederaTx(
wire):Refusal| {bodies: readonlyHederaBody[]; }
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
| Parameter | Type |
|---|---|
wire | Uint8Array |
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
| Parameter | Type |
|---|---|
ref | ExecutorRef & object |
reader | HederaReader |
Returns
Promise<HederaStatus>
hederaChannelId()
hederaChannelId(
c):`0x${string}`
keccak256(abi.encode(payer, payee, token, salt, authorizedSigner, escrow, chainId)), lowercase.
Parameters
| Parameter | Type |
|---|---|
c | HederaChannelConfig |
Returns
`0x${string}`
hederaChargeRequest()
hederaChargeRequest(
c):true|Refusal
The Hedera request checks a charge challenge must pass before it is placed.
Parameters
| Parameter | Type |
|---|---|
c | MppChallenge |
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
| Parameter | Type |
|---|---|
payer | string |
payTo | string |
amount | string |
Returns
Promise<`0x${string}`>
hederaNetworkOfChainId()
hederaNetworkOfChainId(
chainId):Refusal|HederaNetwork
The CAIP-2 network of an MPP methodDetails.chainId: 295 and 296 only.
Parameters
| Parameter | Type |
|---|---|
chainId | unknown |
Returns
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
| Parameter | Type |
|---|---|
o | PaymentRequirements |
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
| Parameter | Type |
|---|---|
ref | HederaRef |
reader | HederaReader |
Returns
Promise<HederaStatus>
hederaVoucher()
hederaVoucher(
c,cumulative):HederaVoucherTypedData
The voucher for cumulative on a channel, under the escrow's domain.
Parameters
| Parameter | Type |
|---|---|
c | { chainId: 295 | 296; channelId: `0x${string}`; escrow: `0x${string}`; } |
c.chainId | 295 | 296 |
c.channelId | `0x${string}` |
c.escrow | `0x${string}` |
cumulative | bigint |
Returns
openCalldata()
openCalldata(
payee,token,deposit,salt,authorizedSigner):`0x${string}`
The escrow's open(payee, token, deposit, salt, authorizedSigner) calldata.
Parameters
| Parameter | Type |
|---|---|
payee | `0x${string}` |
token | `0x${string}` |
deposit | bigint |
salt | `0x${string}` |
authorizedSigner | `0x${string}` |
Returns
`0x${string}`
txIdMirror()
txIdMirror(
id):string
"0.0.1235-1700000000-000000000", the Mirror Node's form.
Parameters
| Parameter | Type |
|---|---|
id | HederaTxId |
Returns
string
txIdText()
txIdText(
id):string
"0.0.1235@1700000000.000000000"
Parameters
| Parameter | Type |
|---|---|
id | HederaTxId |
Returns
string
Last updated on