@integraledger/lcp/ccd
The exports of @integraledger/lcp/ccd.
Interfaces
CcdChoice
Properties
| Property | Type |
|---|---|
accepted | PaymentRequirements |
now | number |
required | PaymentRequired |
CcdReader
Bounded, read-only calls against one network's node. Every failure rejects with ReaderError.
Properties
Methods
item()
item(
hash):Promise<CcdItem|null>
gRPC v2 GetBlockItemStatus; null when the node does not know the item.
Parameters
| Parameter | Type |
|---|---|
hash | string |
Returns
Promise<CcdItem | null>
CcdRef
The read keys recorded at claim.
Properties
| Property | Type |
|---|---|
asset | string |
idDigest | `0x${string}` |
network | `ccd:${string}` |
settleBy | number |
transaction? | string |
CcdTransfer
Properties
| Property | Type |
|---|---|
amount | bigint |
kind | "ccd" | "plt" |
memo | Uint8Array<ArrayBufferLike> | null |
receiver | Uint8Array |
tokenId? | string |
CcdUnsigned
Properties
Methods
complete()
complete(
signedTransaction):Refusal|CcdPaymentPayload
Takes the sender-signed V1 sponsored transaction in the SDK's signableToJSON form.
Parameters
| Parameter | Type |
|---|---|
signedTransaction | Json |
Returns
Type Aliases
CcdItem
CcdItem = {
state:"received"; } | {state:"committed"; } | {sender:Uint8Array|null;state:"finalized";success:boolean;transfers: readonlyCcdTransfer[]; }
CcdNetwork
CcdNetwork =
`ccd:${string}`
CAIP-2: ccd: and the first 32 lowercase hex digits of the genesis block hash.
CcdPaymentPayload
CcdPaymentPayload =
object
Properties
| Property | Type |
|---|---|
accepted | PaymentRequirements |
extensions? | PaymentRequired["extensions"] |
payload | object |
payload.signedTransaction | object |
resource? | PaymentRequired["resource"] |
x402Version | 2 |
CcdStatus
CcdStatus = {
finality:"finalized";state:"settled"; } | {state:"pending";why:"not-found"|"received"|"committed"|"unreadable"; } | {state:"failed";why:"rejected"|"not-this-instrument"; }
Variables
exactCcd
constexactCcd:Readonly<{advertise:X402Advertise;bound: (presented) =>Promise<`0x${string}`|Refusal>;build: (c,h) =>Promise<Refusal|CcdUnsigned>;claims:boolean;id:"x402/exact/ccd";pattern:LcpPattern;read: (doc) =>Refusal|X402Read;recover: (ref,reader) =>Promise<`0x${string}`|Refusal>;reference: (presented) =>Promise<Refusal|CcdRef>;status: (ref,reader) =>Promise<CcdStatus>;tie: (accepts,request) => ["x402", {accepts: readonlyPaymentRequirements[];request:RequestCommitment; }];unplaced: (option) =>PaymentRequirements; }>
Functions
accountBytes()
accountBytes(
address):Uint8Array<ArrayBufferLike> |Refusal
The 32 bytes of a base58check account address whose version byte is 1: its last four bytes are the first four of the double SHA-256 of the 33 before them.
Parameters
| Parameter | Type |
|---|---|
address | string |
Returns
Uint8Array<ArrayBufferLike> | Refusal
ccdIdDigest()
ccdIdDigest(
sender,receiver,amount):Promise<`0x${string}`|Refusal>
SHA-256 over the 32 + 32 bytes of the two accounts and the amount as a 32-byte big-endian integer.
Parameters
| Parameter | Type |
|---|---|
sender | Uint8Array |
receiver | Uint8Array |
amount | bigint |
Returns
Promise<`0x${string}` | Refusal>
ccdMemo()
ccdMemo(
h):Uint8Array
The CBOR text string of toLcpString(h): 78 4d and the 77 ASCII bytes.
Parameters
| Parameter | Type |
|---|---|
h | `0x${string}` |
Returns
Uint8Array
ccdOption()
ccdOption(
o):o is PaymentRequirements
The pairing's filter: an exact option on a ccd: network, for CCD or a token symbol, whose payTo and
extra.feePayer are base58check account addresses.
Parameters
| Parameter | Type |
|---|---|
o | unknown |
Returns
o is PaymentRequirements
ccdRecover()
ccdRecover(
ref,reader):Promise<`0x${string}`|Refusal>
The hash from a settlement block item alone: its one memo-carrying transfer's memo, through memoCarrier.
Parameters
| Parameter | Type |
|---|---|
ref | { network: `ccd:${string}`; transaction: string; } |
ref.network | `ccd:${string}` |
ref.transaction | string |
reader | CcdReader |
Returns
Promise<`0x${string}` | Refusal>
ccdStatus()
ccdStatus(
ref,reader):Promise<CcdStatus>
Reads the named block item. Settled when it is finalized and successful, with exactly one transfer whose memo
memoCarrier reads as ref.h (a PLT memo with tag 24 unwrapped) and whose sender, receiver and amount hash to
ref.idDigest. Not final, unknown or unreadable is pending; a reader for another network is pending.
Parameters
Returns
Promise<CcdStatus>
memoCarrier()
memoCarrier(
memo):`0x${string}`|Refusal
The hash a memo carries: exactly one CBOR text string, nothing after it, whose bytes are ccdMemo of the hash it
names (LCP's string form with lowercase hex, under the preferred two-byte head). bound, status and recover all
read a memo through this one function.
Parameters
| Parameter | Type |
|---|---|
memo | Uint8Array |
Returns
`0x${string}` | Refusal
pltMemo()
pltMemo(
h):Uint8Array
CBOR tag 24 around a byte string holding ccdMemo(h): d8 18 58 4f and the 79 bytes.
Parameters
| Parameter | Type |
|---|---|
h | `0x${string}` |
Returns
Uint8Array
Last updated on