Skip to content
Integra Protocol
API

@integraledger/lcp/sui

The exports of @integraledger/lcp/sui.

Interfaces

SuiExecuted

Properties

PropertyType
checkpointbigint | null
status"SUCCESS" | "FAILURE"
transactionBcsUint8Array

SuiPayload

The payload x402's Sui scheme defines.

Properties

PropertyType
signaturestring
transactionstring

SuiPaymentPayload

Properties

PropertyType
acceptedPaymentRequirements
extensions?object
payloadSuiPayload
resource?object
resource.urlstring
x402Version2

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

PropertyModifierType
networkreadonlySuiNetwork

Methods

read()

read(digest): Promise<{ epoch: bigint; tx: SuiExecuted | null; }>

Parameters
ParameterType
digeststring
Returns

Promise<{ epoch: bigint; tx: SuiExecuted | null; }>


SuiRef

Properties

PropertyTypeDescription
digeststring-
networkSuiNetwork-
untilEpochstringThe 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

PropertyTypeDescription
bytesUint8Array-
digeststringBase58 of Blake2b-256 over "TransactionData::" followed by the bytes.
untilEpochbigint | null-
unusedPurereadonly Uint8Array<ArrayBufferLike>[]-

SuiUnsigned

What build hands the payer's wallet, and how it checks what comes back.

Properties

PropertyType
requestobject
request.acceptedPaymentRequirements
request.expiration"epoch-bounded"
request.kind"sui-transaction"
request.pureInputUint8Array

Methods

complete()

complete(signed): Refusal | SuiPaymentPayload

Parameters
ParameterType
signedSuiPayload
Returns

Refusal | SuiPaymentPayload

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

const exactSui: 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: readonly PaymentRequirements[]; request: RequestCommitment; }]; unplaced: (option) => PaymentRequirements; }>

Functions

decodeSuiTx()

decodeSuiTx(base64): Refusal | SuiTx

Decodes a base64 TransactionData V1 with a programmable kind.

Parameters

ParameterType
base64string

Returns

Refusal | SuiTx


suiCarrier()

suiCarrier(tx): `0x${string}` | Refusal

The hash carried by exactly one unused Pure input of exactly 32 bytes.

Parameters

ParameterType
txSuiTx

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

ParameterType
optionunknown

Returns

Refusal | undefined


suiPairingOf()

suiPairingOf(option): "x402/exact/sui" | undefined

This pairing's id for an option it can pay, or undefined.

Parameters

ParameterType
optionPaymentRequirements

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

ParameterType
ref{ digest: string; network: SuiNetwork; }
ref.digeststring
ref.networkSuiNetwork
readerSuiReader

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

ParameterType
refSuiRef & object
readerSuiReader

Returns

Promise<SuiStatus>

Last updated on

On this page