@chainpayhq/sdk 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -2
  3. package/dist/accounts.d.ts +23 -0
  4. package/dist/accounts.js +148 -0
  5. package/dist/cards/accounts.d.ts +156 -0
  6. package/dist/cards/accounts.js +346 -0
  7. package/dist/cards/api.d.ts +379 -0
  8. package/dist/cards/api.js +241 -0
  9. package/dist/cards/commitment.d.ts +86 -0
  10. package/dist/cards/commitment.js +288 -0
  11. package/dist/cards/constants.d.ts +160 -0
  12. package/dist/cards/constants.js +163 -0
  13. package/dist/cards/draft.d.ts +57 -0
  14. package/dist/cards/draft.js +131 -0
  15. package/dist/cards/evidence.d.ts +69 -0
  16. package/dist/cards/evidence.js +41 -0
  17. package/dist/cards/hash.d.ts +9 -0
  18. package/dist/cards/hash.js +47 -0
  19. package/dist/cards/index.d.ts +14 -0
  20. package/dist/cards/index.js +14 -0
  21. package/dist/cards/instructions.d.ts +302 -0
  22. package/dist/cards/instructions.js +474 -0
  23. package/dist/cards/layout.d.ts +33 -0
  24. package/dist/cards/layout.js +137 -0
  25. package/dist/cards/math.d.ts +67 -0
  26. package/dist/cards/math.js +138 -0
  27. package/dist/cards/merchants.d.ts +23 -0
  28. package/dist/cards/merchants.js +38 -0
  29. package/dist/cards/pda.d.ts +42 -0
  30. package/dist/cards/pda.js +93 -0
  31. package/dist/cards/private-repayment.d.ts +198 -0
  32. package/dist/cards/private-repayment.js +485 -0
  33. package/dist/cards/redact.d.ts +18 -0
  34. package/dist/cards/redact.js +103 -0
  35. package/dist/cards/tee.d.ts +253 -0
  36. package/dist/cards/tee.js +605 -0
  37. package/dist/cli.d.ts +31 -0
  38. package/dist/cli.js +351 -0
  39. package/dist/client.d.ts +80 -0
  40. package/dist/client.js +493 -0
  41. package/dist/constants.d.ts +44 -0
  42. package/dist/constants.js +43 -0
  43. package/dist/crossmint-adapt.d.ts +43 -0
  44. package/dist/crossmint-adapt.js +68 -0
  45. package/dist/crossmint-order.d.ts +220 -0
  46. package/dist/crossmint-order.js +638 -0
  47. package/dist/delivery.d.ts +66 -0
  48. package/dist/delivery.js +232 -0
  49. package/dist/encoding.d.ts +51 -0
  50. package/dist/encoding.js +128 -0
  51. package/dist/index.d.ts +27 -0
  52. package/dist/index.js +26 -0
  53. package/dist/known-assets.d.ts +30 -0
  54. package/dist/known-assets.js +49 -0
  55. package/dist/mandate-request.d.ts +123 -0
  56. package/dist/mandate-request.js +401 -0
  57. package/dist/mandate.d.ts +44 -0
  58. package/dist/mandate.js +157 -0
  59. package/dist/ops-snapshot.d.ts +157 -0
  60. package/dist/ops-snapshot.js +356 -0
  61. package/dist/payment-request.d.ts +37 -0
  62. package/dist/payment-request.js +218 -0
  63. package/dist/payment.d.ts +40 -0
  64. package/dist/payment.js +214 -0
  65. package/dist/pda.d.ts +13 -0
  66. package/dist/pda.js +36 -0
  67. package/dist/receipt-export.d.ts +55 -0
  68. package/dist/receipt-export.js +149 -0
  69. package/dist/receipt.d.ts +108 -0
  70. package/dist/receipt.js +213 -0
  71. package/dist/solana.d.ts +5 -0
  72. package/dist/solana.js +20 -0
  73. package/dist/token-capabilities.d.ts +9 -0
  74. package/dist/token-capabilities.js +139 -0
  75. package/dist/token.d.ts +18 -0
  76. package/dist/token.js +55 -0
  77. package/dist/transaction-reader.d.ts +10 -0
  78. package/dist/transaction-reader.js +18 -0
  79. package/dist/transaction-v1.d.ts +18 -0
  80. package/dist/transaction-v1.js +73 -0
  81. package/dist/types.d.ts +267 -0
  82. package/dist/types.js +1 -0
  83. package/dist/x402-adapt.d.ts +20 -0
  84. package/dist/x402-adapt.js +62 -0
  85. package/dist/x402-challenge.d.ts +116 -0
  86. package/dist/x402-challenge.js +385 -0
  87. package/dist/x402.d.ts +18 -0
  88. package/dist/x402.js +35 -0
  89. package/package.json +54 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ChainPay contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ # ChainPay SDK
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ TypeScript tools for reading mandates and receipts and building Solana payment
4
+ transactions. Wallets and approved signer providers sign outside the SDK.
5
+
6
+ **Start with [a read-only SDK example](https://github.com/stawuah/chainpay-mcp-sdk/blob/master/docs/guides/use-the-sdk.md).**
7
+
8
+ Install the public package:
9
+
10
+ ```bash
11
+ npm install @chainpayhq/sdk
12
+ ```
13
+
14
+ The package targets ChainPay on Solana Devnet. It prepares transactions and
15
+ reads protocol state; signing and submission require your wallet or approved
16
+ provider.
17
+
18
+ ## Develop from this repository
19
+
20
+ From the repository root:
21
+
22
+ ```bash
23
+ npm ci --include=dev --ignore-scripts
24
+ npm --prefix sdk run build
25
+ npm --prefix sdk run test
26
+ ```
27
+
28
+ - [Integration guide](https://github.com/stawuah/chainpay-mcp-sdk/blob/master/docs/guides/use-the-sdk.md): first read, signing boundary, token support, and transaction codecs.
29
+ - [Public exports](https://github.com/stawuah/chainpay-mcp-sdk/blob/master/sdk/src/index.ts), [client methods](https://github.com/stawuah/chainpay-mcp-sdk/blob/master/sdk/src/client.ts), and [types](https://github.com/stawuah/chainpay-mcp-sdk/blob/master/sdk/src/types.ts): implementation reference.
30
+ - [Payment-agent guide](https://github.com/stawuah/chainpay-mcp-sdk/blob/master/docs/guides/connect-an-agent.md): MCP integration and caller authorization.
31
+ - [Documentation index](https://github.com/stawuah/chainpay-mcp-sdk/blob/master/docs/README.md).
32
+
33
+ ## Preparing wallet token accounts
34
+
35
+ `prepareAssociatedTokenAccount({ owner, mint, payer })` checks that the mint is
36
+ enabled in the on-chain asset registry, validates its token program, and checks
37
+ the owner's canonical associated token account. It returns `status: "ready"`
38
+ when the account exists or an unsigned, single-instruction transaction when it
39
+ is missing. The caller must show that transaction to the wallet for approval.
40
+
41
+ `prepareRegisteredAssetTokenAccounts(owner)` performs the same inspection for
42
+ every enabled registry asset. Disabled assets are excluded. Neither method
43
+ submits a transaction, funds an account, or grants a spending permission.
@@ -0,0 +1,23 @@
1
+ import type { Address, Mandate, PaymentReceipt, ReceiptPolicySnapshot, SupportedAsset, TokenProgram } from "./types.js";
2
+ export declare function decodeProtocolConfig(data: Uint8Array | Buffer, configAddress?: Address): {
3
+ address: string | undefined;
4
+ authority: string;
5
+ supportedMints: string[];
6
+ bump: number;
7
+ };
8
+ export declare function decodeSupportedAsset(data: Uint8Array | Buffer, assetAddress: Address): SupportedAsset;
9
+ export declare function decodeMandate(data: Uint8Array | Buffer, mandateAddress: Address, currentSlot?: bigint, tokenProgram?: TokenProgram): Mandate;
10
+ /**
11
+ * Read the policy tail of a v2 receipt. An original 282-byte receipt, or a v2
12
+ * receipt whose version byte is 0, has no snapshot: return null rather than
13
+ * reading zeroes as limits.
14
+ */
15
+ export declare function decodeReceiptPolicySnapshot(data: Uint8Array | Buffer): ReceiptPolicySnapshot | null;
16
+ export declare function decodePaymentReceipt(data: Uint8Array | Buffer, receiptAddress: Address, transactionSignature?: string): PaymentReceipt;
17
+ /**
18
+ * Decode the current mandate account only. Independent of paginated
19
+ * creation history and source token metadata. Public receipt cards may
20
+ * attach these fields as optional enrichment; a decode failure must not
21
+ * invent limits or invalidate a settled payment.
22
+ */
23
+ export declare function decodeCurrentMandateFields(data: Uint8Array | Buffer, mandateAddress: Address, currentSlot?: bigint): Mandate;
@@ -0,0 +1,148 @@
1
+ import { PublicKey } from "@solana/web3.js";
2
+ import { ACCOUNT_DISCRIMINATORS, MANDATE_ACCOUNT_LENGTH, RECEIPT_ACCOUNT_LENGTH, RECEIPT_ACCOUNT_LENGTH_V2, RECEIPT_STATUS_SETTLED, } from "./constants.js";
3
+ import { address, assertDiscriminator, isMandateNonce, readBytes32, readPublicKey, readU8, readU64, } from "./encoding.js";
4
+ const ACCOUNT_DISCRIMINATOR_LENGTH = 8;
5
+ const DEFAULT_ADDRESS = PublicKey.default.toBase58();
6
+ function accountBytes(data) {
7
+ return data instanceof Uint8Array ? data : new Uint8Array(data);
8
+ }
9
+ function requireLength(data, length, accountName) {
10
+ if (data.length < length)
11
+ throw new Error(`${accountName} account data is truncated`);
12
+ }
13
+ function mandateStatus(paused, revoked, expiresAtSlot, currentSlot) {
14
+ if (revoked)
15
+ return "revoked";
16
+ if (paused)
17
+ return "paused";
18
+ if (currentSlot !== undefined && expiresAtSlot <= currentSlot)
19
+ return "expired";
20
+ return "active";
21
+ }
22
+ export function decodeProtocolConfig(data, configAddress) {
23
+ const bytes = accountBytes(data);
24
+ assertDiscriminator(bytes, ACCOUNT_DISCRIMINATORS.protocolConfig, "ProtocolConfig");
25
+ requireLength(bytes, 137, "ProtocolConfig");
26
+ const supportedMints = [
27
+ readPublicKey(bytes, 40),
28
+ readPublicKey(bytes, 72),
29
+ readPublicKey(bytes, 104),
30
+ ].filter((mint) => mint !== DEFAULT_ADDRESS);
31
+ return {
32
+ address: configAddress ? address(configAddress) : undefined,
33
+ authority: readPublicKey(bytes, ACCOUNT_DISCRIMINATOR_LENGTH),
34
+ supportedMints,
35
+ bump: readU8(bytes, 136),
36
+ };
37
+ }
38
+ export function decodeSupportedAsset(data, assetAddress) {
39
+ const bytes = accountBytes(data);
40
+ assertDiscriminator(bytes, ACCOUNT_DISCRIMINATORS.supportedAsset, "SupportedAsset");
41
+ requireLength(bytes, 106, "SupportedAsset");
42
+ return {
43
+ address: address(assetAddress),
44
+ authority: readPublicKey(bytes, 8),
45
+ mint: readPublicKey(bytes, 40),
46
+ tokenProgram: readPublicKey(bytes, 72),
47
+ enabled: readU8(bytes, 104) !== 0,
48
+ bump: readU8(bytes, 105),
49
+ };
50
+ }
51
+ export function decodeMandate(data, mandateAddress, currentSlot, tokenProgram) {
52
+ const bytes = accountBytes(data);
53
+ assertDiscriminator(bytes, ACCOUNT_DISCRIMINATORS.paymentMandate, "PaymentMandate");
54
+ requireLength(bytes, MANDATE_ACCOUNT_LENGTH, "PaymentMandate");
55
+ const expiresAtSlot = readU64(bytes, 200);
56
+ const maxPaymentCount = readU64(bytes, 208);
57
+ const cooldownSlots = readU64(bytes, 216);
58
+ const lastPaymentSlot = readU64(bytes, 224);
59
+ const paused = readU8(bytes, 232) !== 0;
60
+ const revoked = readU8(bytes, 233) !== 0;
61
+ const legacyAllowedRecipient = readPublicKey(bytes, 136);
62
+ const mandateNonce = isMandateNonce(legacyAllowedRecipient) ? legacyAllowedRecipient : undefined;
63
+ return {
64
+ address: address(mandateAddress),
65
+ owner: readPublicKey(bytes, 8),
66
+ approvedAgent: readPublicKey(bytes, 40),
67
+ sourceTokenAccount: readPublicKey(bytes, 72),
68
+ allowedMint: readPublicKey(bytes, 104),
69
+ legacyAllowedRecipient: mandateNonce || legacyAllowedRecipient === DEFAULT_ADDRESS ? undefined : legacyAllowedRecipient,
70
+ maxPerPayment: readU64(bytes, 168),
71
+ totalLimit: readU64(bytes, 176),
72
+ amountSpent: readU64(bytes, 184),
73
+ paymentCount: readU64(bytes, 192),
74
+ expiresAtSlot,
75
+ maxPaymentCount,
76
+ cooldownSlots,
77
+ lastPaymentSlot,
78
+ paused,
79
+ revoked,
80
+ status: mandateStatus(paused, revoked, expiresAtSlot, currentSlot),
81
+ tokenProgram,
82
+ mandateNonce,
83
+ };
84
+ }
85
+ function paymentStatus(onChainStatus) {
86
+ return onChainStatus === RECEIPT_STATUS_SETTLED ? "confirmed" : "failed";
87
+ }
88
+ /** Offset of `snapshot_version`, the first byte after the original receipt. */
89
+ const RECEIPT_SNAPSHOT_VERSION_OFFSET = RECEIPT_ACCOUNT_LENGTH;
90
+ /**
91
+ * Read the policy tail of a v2 receipt. An original 282-byte receipt, or a v2
92
+ * receipt whose version byte is 0, has no snapshot: return null rather than
93
+ * reading zeroes as limits.
94
+ */
95
+ export function decodeReceiptPolicySnapshot(data) {
96
+ const bytes = accountBytes(data);
97
+ if (bytes.length < RECEIPT_ACCOUNT_LENGTH_V2)
98
+ return null;
99
+ const version = readU8(bytes, RECEIPT_SNAPSHOT_VERSION_OFFSET);
100
+ if (version === 0)
101
+ return null;
102
+ return {
103
+ version,
104
+ maxPerPayment: readU64(bytes, 283),
105
+ totalLimit: readU64(bytes, 291),
106
+ amountSpentAfter: readU64(bytes, 299),
107
+ paymentCountAfter: readU64(bytes, 307),
108
+ maxPaymentCount: readU64(bytes, 315),
109
+ expiresAtSlot: readU64(bytes, 323),
110
+ cooldownSlots: readU64(bytes, 331),
111
+ };
112
+ }
113
+ export function decodePaymentReceipt(data, receiptAddress, transactionSignature) {
114
+ const bytes = accountBytes(data);
115
+ assertDiscriminator(bytes, ACCOUNT_DISCRIMINATORS.paymentReceipt, "PaymentReceipt");
116
+ requireLength(bytes, RECEIPT_ACCOUNT_LENGTH, "PaymentReceipt");
117
+ const onChainStatus = readU8(bytes, 280);
118
+ return {
119
+ address: address(receiptAddress),
120
+ mandate: readPublicKey(bytes, 8),
121
+ invoiceHash: readBytes32(bytes, 40, "invoiceHash"),
122
+ paymentId: readBytes32(bytes, 72, "paymentId"),
123
+ mint: readPublicKey(bytes, 104),
124
+ sourceTokenAccount: readPublicKey(bytes, 136),
125
+ recipientTokenAccount: readPublicKey(bytes, 168),
126
+ recipient: readPublicKey(bytes, 168),
127
+ amount: readU64(bytes, 200),
128
+ agent: readPublicKey(bytes, 208),
129
+ executedAtSlot: readU64(bytes, 240),
130
+ // Replay lock supplied at settle. Not seller delivery and not the
131
+ // Solana transaction signature.
132
+ signatureReference: readBytes32(bytes, 248, "signatureReference"),
133
+ status: paymentStatus(onChainStatus),
134
+ onChainStatus,
135
+ bump: readU8(bytes, 281),
136
+ transactionSignature,
137
+ policySnapshot: decodeReceiptPolicySnapshot(bytes),
138
+ };
139
+ }
140
+ /**
141
+ * Decode the current mandate account only. Independent of paginated
142
+ * creation history and source token metadata. Public receipt cards may
143
+ * attach these fields as optional enrichment; a decode failure must not
144
+ * invent limits or invalidate a settled payment.
145
+ */
146
+ export function decodeCurrentMandateFields(data, mandateAddress, currentSlot) {
147
+ return decodeMandate(data, mandateAddress, currentSlot);
148
+ }
@@ -0,0 +1,156 @@
1
+ import type { Address } from "../types.js";
2
+ export type CardBindingStatus = "active" | "closing" | "closed";
3
+ export type CardFreezeReason = "none" | "owner" | "authorizer_safety" | "recovery" | "expiry";
4
+ export type CardRecoveryState = "normal" | "recovery_frozen" | "restored_pending_reconcile";
5
+ export type OnChainReservationState = number;
6
+ /** On-chain ReservationState bytes as card_policy defines them (0 is never written). */
7
+ export declare const RESERVATION_STATES: {
8
+ readonly 1: "reserved";
9
+ readonly 2: "partially_captured";
10
+ readonly 3: "captured";
11
+ readonly 4: "reversed";
12
+ readonly 5: "expired";
13
+ };
14
+ export type ReservationStateName = (typeof RESERVATION_STATES)[keyof typeof RESERVATION_STATES];
15
+ export declare function reservationStateName(state: number): ReservationStateName | undefined;
16
+ export type IntentState = "open" | "consumed" | "expired" | "cancelled";
17
+ export type DisputeState = "none" | "open" | "won" | "lost" | "withdrawn";
18
+ export declare function currencyBytes(currency: string): Uint8Array;
19
+ export type CardBinding = {
20
+ version: number;
21
+ owner: Address;
22
+ cardId: Uint8Array;
23
+ issuer: number;
24
+ issuerCardRefHash: Uint8Array;
25
+ policy: Address;
26
+ period: Address;
27
+ commitment: Address;
28
+ status: CardBindingStatus;
29
+ createdAt: bigint;
30
+ bump: number;
31
+ };
32
+ export declare const CARD_BINDING_LENGTH: number;
33
+ export declare function decodeCardBinding(data: Uint8Array | Buffer): CardBinding;
34
+ export declare function encodeCardBinding(value: CardBinding): Uint8Array;
35
+ export type CardPolicyMember = {
36
+ pubkey: Address;
37
+ flags: number;
38
+ };
39
+ export type CardPolicy = {
40
+ binding: Address;
41
+ owner: Address;
42
+ /** Zero address until the first `set_policy`; every authorization fails until then. */
43
+ authorizer: Address;
44
+ policyVersion: number;
45
+ budgetCents: bigint;
46
+ maxPurchaseCents: bigint;
47
+ /** 0 = no count limit. */
48
+ maxPurchasesPerPeriod: number;
49
+ periodSeconds: number;
50
+ currency: string;
51
+ merchantIdHashes: Uint8Array[];
52
+ mccs: number[];
53
+ /** 0 = no expiry. Unix seconds on the PER clock. */
54
+ expiresAt: bigint;
55
+ recurringAllowed: boolean;
56
+ feeBps: number;
57
+ frozen: boolean;
58
+ freezeReason: CardFreezeReason;
59
+ recoveryState: CardRecoveryState;
60
+ statementOutstandingCents: bigint;
61
+ exceptionsOpen: number;
62
+ members: CardPolicyMember[];
63
+ ledgerHead: Uint8Array;
64
+ ledgerSeq: bigint;
65
+ commitSeq: bigint;
66
+ bump: number;
67
+ /**
68
+ * Program-appended tail (not in contracts.md §1.2): last reconciliation
69
+ * digest and the ring of used repayment digests. Present only when the
70
+ * account is long enough; encoders never write it.
71
+ */
72
+ tail?: {
73
+ reconDigest: Uint8Array;
74
+ repaymentDigests: Uint8Array[];
75
+ };
76
+ };
77
+ export declare const CARD_POLICY_LENGTH: number;
78
+ export declare function decodeCardPolicy(data: Uint8Array | Buffer): CardPolicy;
79
+ export declare function encodeCardPolicy(value: CardPolicy): Uint8Array;
80
+ export type CardPeriod = {
81
+ policy: Address;
82
+ /** 0 before the first set_policy; 1.. thereafter. */
83
+ periodIndex: number;
84
+ periodStart: bigint;
85
+ periodEnd: bigint;
86
+ capturedCents: bigint;
87
+ reservedCents: bigint;
88
+ refundedCents: bigint;
89
+ purchasesCount: number;
90
+ exceptionCents: bigint;
91
+ bump: number;
92
+ };
93
+ export declare const CARD_PERIOD_LENGTH: number;
94
+ export declare function decodeCardPeriod(data: Uint8Array | Buffer): CardPeriod;
95
+ export declare function encodeCardPeriod(value: CardPeriod): Uint8Array;
96
+ /** Reservation.flags bits (contracts.md §1.2). */
97
+ export declare const RESERVATION_FLAGS: {
98
+ readonly lateCapture: number;
99
+ readonly overCapture: number;
100
+ readonly singleMessage: number;
101
+ readonly recurring: number;
102
+ };
103
+ export type Reservation = {
104
+ policy: Address;
105
+ authIdHash: Uint8Array;
106
+ intent: Address;
107
+ periodIndex: number;
108
+ amountReservedCents: bigint;
109
+ capturedCents: bigint;
110
+ reversedCents: bigint;
111
+ refundedCents: bigint;
112
+ /** On-chain ReservationState byte (§4.1). Off-chain states (pending, ambiguous) never appear here. */
113
+ state: OnChainReservationState;
114
+ disputeState: DisputeState;
115
+ flags: number;
116
+ createdAt: bigint;
117
+ holdExpiresAt: bigint;
118
+ bump: number;
119
+ /** Program-appended capture-id ring (replay guard for `capture`). Present only when the account is long enough. */
120
+ captureIdHashes?: Uint8Array[];
121
+ /** Program-appended: the checkout intent's max; `adjust_reservation` never grows the hold past it. */
122
+ maxAmountCents?: bigint;
123
+ };
124
+ export declare const RESERVATION_LENGTH: number;
125
+ export declare function decodeReservation(data: Uint8Array | Buffer): Reservation;
126
+ export declare function encodeReservation(value: Reservation): Uint8Array;
127
+ export type CheckoutIntent = {
128
+ policy: Address;
129
+ intentId: Uint8Array;
130
+ agent: Address;
131
+ merchantIdHash: Uint8Array;
132
+ /** 0 = any allowed MCC. */
133
+ mcc: number;
134
+ maxAmountCents: bigint;
135
+ currency: string;
136
+ policyVersion: number;
137
+ expiresAt: bigint;
138
+ state: IntentState;
139
+ reservation: Address;
140
+ bump: number;
141
+ };
142
+ export declare const CHECKOUT_INTENT_LENGTH: number;
143
+ export declare function decodeCheckoutIntent(data: Uint8Array | Buffer): CheckoutIntent;
144
+ export declare function encodeCheckoutIntent(value: CheckoutIntent): Uint8Array;
145
+ export type CardCommitment = {
146
+ binding: Address;
147
+ seq: bigint;
148
+ root: Uint8Array;
149
+ policyVersion: number;
150
+ periodIndex: number;
151
+ writtenSlot: bigint;
152
+ bump: number;
153
+ };
154
+ export declare const CARD_COMMITMENT_LENGTH: number;
155
+ export declare function decodeCardCommitment(data: Uint8Array | Buffer): CardCommitment;
156
+ export declare function encodeCardCommitment(value: CardCommitment): Uint8Array;