@integraledger/lcp/sui
The exports of @integraledger/lcp/sui.
Interfaces
SuiExecuted
Properties
SuiPayload
The payload x402's Sui scheme defines.
Properties
SuiPaymentPayload
Properties
| Property | Type |
|---|---|
accepted | PaymentRequirements |
extensions? | object |
payload | SuiPayload |
resource? | object |
resource.url | string |
x402Version | 2 |
SuiReader
Bounded, read-only calls against one network's GraphQL endpoint. Every failure rejects with ReaderError.
read is one request, so one snapshot:
query($d:String!){transaction(digest:$d){transactionBcs effects{status checkpoint{sequenceNumber}}} checkpoint{epoch{epochId}}}, where the last field is the latest checkpoint's epoch.
Properties
| Property | Modifier | Type |
|---|---|---|
network | readonly | SuiNetwork |
Methods
read()
read(
digest):Promise<{epoch:bigint;tx:SuiExecuted|null; }>
Parameters
| Parameter | Type |
|---|---|
digest | string |
Returns
Promise<{ epoch: bigint; tx: SuiExecuted | null; }>
SuiRef
Properties
| Property | Type | Description |
|---|---|---|
digest | string | - |
network | SuiNetwork | - |
untilEpoch | string | The last epoch the transaction can execute in, as a decimal string. |
SuiTx
A decoded TransactionData: the bytes as received, their digest, the unused Pure inputs, and the epoch bound.
Properties
| Property | Type | Description |
|---|---|---|
bytes | Uint8Array | - |
digest | string | Base58 of Blake2b-256 over "TransactionData::" followed by the bytes. |
untilEpoch | bigint | null | - |
unusedPure | readonly Uint8Array<ArrayBufferLike>[] | - |
SuiUnsigned
What build hands the payer's wallet, and how it checks what comes back.
Properties
| Property | Type |
|---|---|
request | object |
request.accepted | PaymentRequirements |
request.expiration | "epoch-bounded" |
request.kind | "sui-transaction" |
request.pureInput | Uint8Array |
Methods
complete()
complete(
signed):Refusal|SuiPaymentPayload
Parameters
| Parameter | Type |
|---|---|
signed | SuiPayload |
Returns
Type Aliases
SuiNetwork
SuiNetwork =
"sui:mainnet"|"sui:testnet"|"sui:devnet"
SuiStatus
SuiStatus = {
checkpoint:bigint|null;state:"settled"; } | {state:"pending";why:"not-found"|"unreadable"; } | {state:"failed";why:"aborted"|"expired"|"not-this-instrument"; }
Variables
exactSui
constexactSui:Readonly<{advertise: (doc,h,link,offer,agreementUrl?) =>Refusal|PaymentRequired;bound: (presented) =>Promise<`0x${string}`|Refusal>;build: (choice,h) =>Promise<Refusal|SuiUnsigned>;carrier:null;claims:boolean;id:"x402/exact/sui";pattern:LcpPattern;read: (doc) =>Refusal|X402Read;recover: (ref,reader) =>Promise<`0x${string}`|Refusal>;reference: (presented) =>Promise<Refusal|SuiRef>;status: (ref,reader) =>Promise<SuiStatus>;tie: (accepts,request) => ["x402", {accepts: readonlyPaymentRequirements[];request:RequestCommitment; }];unplaced: (option) =>PaymentRequirements; }>
Functions
decodeSuiTx()
Decodes a base64 TransactionData V1 with a programmable kind.
Parameters
| Parameter | Type |
|---|---|
base64 | string |
Returns
suiCarrier()
suiCarrier(
tx):`0x${string}`|Refusal
The hash carried by exactly one unused Pure input of exactly 32 bytes.
Parameters
| Parameter | Type |
|---|---|
tx | SuiTx |
Returns
`0x${string}` | Refusal
suiOptionCheck()
suiOptionCheck(
option):Refusal|undefined
The pairing's filter: undefined for an option this pairing can pay, or the refusal naming why not.
Parameters
| Parameter | Type |
|---|---|
option | unknown |
Returns
Refusal | undefined
suiPairingOf()
suiPairingOf(
option):"x402/exact/sui"|undefined
This pairing's id for an option it can pay, or undefined.
Parameters
| Parameter | Type |
|---|---|
option | PaymentRequirements |
Returns
"x402/exact/sui" | undefined
suiRecover()
suiRecover(
ref,reader):Promise<`0x${string}`|Refusal>
Reads the hash back from the executed transaction alone, by its digest. One call.
Parameters
| Parameter | Type |
|---|---|
ref | { digest: string; network: SuiNetwork; } |
ref.digest | string |
ref.network | SuiNetwork |
reader | SuiReader |
Returns
Promise<`0x${string}` | Refusal>
suiStatus()
suiStatus(
ref,reader):Promise<SuiStatus>
Reads the recorded digest. A failed read, or a reader for another network, is pending. An absent transaction is expired once the latest epoch is past its bound; a present one must be these bytes carrying this hash, and its effects' status decides. One call.
Parameters
Returns
Promise<SuiStatus>
Last updated on