@solana/mpp 0.0.0 → 0.1.0-beta.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 (108) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +227 -0
  3. package/dist/Methods.d.ts +272 -0
  4. package/dist/Methods.d.ts.map +1 -0
  5. package/dist/Methods.js +217 -0
  6. package/dist/Methods.js.map +1 -0
  7. package/dist/client/Charge.d.ts +112 -0
  8. package/dist/client/Charge.d.ts.map +1 -0
  9. package/dist/client/Charge.js +216 -0
  10. package/dist/client/Charge.js.map +1 -0
  11. package/dist/client/Methods.d.ts +27 -0
  12. package/dist/client/Methods.d.ts.map +1 -0
  13. package/dist/client/Methods.js +23 -0
  14. package/dist/client/Methods.js.map +1 -0
  15. package/dist/client/Session.d.ts +195 -0
  16. package/dist/client/Session.d.ts.map +1 -0
  17. package/dist/client/Session.js +411 -0
  18. package/dist/client/Session.js.map +1 -0
  19. package/dist/client/index.d.ts +5 -0
  20. package/dist/client/index.d.ts.map +1 -0
  21. package/dist/client/index.js +6 -0
  22. package/dist/client/index.js.map +1 -0
  23. package/dist/constants.d.ts +7 -0
  24. package/dist/constants.d.ts.map +1 -0
  25. package/dist/constants.js +14 -0
  26. package/dist/constants.js.map +1 -0
  27. package/dist/index.d.ts +7 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +8 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/server/Charge.d.ts +103 -0
  32. package/dist/server/Charge.d.ts.map +1 -0
  33. package/dist/server/Charge.js +318 -0
  34. package/dist/server/Charge.js.map +1 -0
  35. package/dist/server/Methods.d.ts +23 -0
  36. package/dist/server/Methods.d.ts.map +1 -0
  37. package/dist/server/Methods.js +19 -0
  38. package/dist/server/Methods.js.map +1 -0
  39. package/dist/server/Session.d.ts +171 -0
  40. package/dist/server/Session.d.ts.map +1 -0
  41. package/dist/server/Session.js +430 -0
  42. package/dist/server/Session.js.map +1 -0
  43. package/dist/server/index.d.ts +5 -0
  44. package/dist/server/index.d.ts.map +1 -0
  45. package/dist/server/index.js +6 -0
  46. package/dist/server/index.js.map +1 -0
  47. package/dist/session/ChannelStore.d.ts +12 -0
  48. package/dist/session/ChannelStore.d.ts.map +1 -0
  49. package/dist/session/ChannelStore.js +88 -0
  50. package/dist/session/ChannelStore.js.map +1 -0
  51. package/dist/session/Types.d.ts +179 -0
  52. package/dist/session/Types.d.ts.map +1 -0
  53. package/dist/session/Types.js +2 -0
  54. package/dist/session/Types.js.map +1 -0
  55. package/dist/session/Voucher.d.ts +7 -0
  56. package/dist/session/Voucher.d.ts.map +1 -0
  57. package/dist/session/Voucher.js +118 -0
  58. package/dist/session/Voucher.js.map +1 -0
  59. package/dist/session/authorizers/BudgetAuthorizer.d.ts +90 -0
  60. package/dist/session/authorizers/BudgetAuthorizer.d.ts.map +1 -0
  61. package/dist/session/authorizers/BudgetAuthorizer.js +398 -0
  62. package/dist/session/authorizers/BudgetAuthorizer.js.map +1 -0
  63. package/dist/session/authorizers/SwigSessionAuthorizer.d.ts +104 -0
  64. package/dist/session/authorizers/SwigSessionAuthorizer.d.ts.map +1 -0
  65. package/dist/session/authorizers/SwigSessionAuthorizer.js +522 -0
  66. package/dist/session/authorizers/SwigSessionAuthorizer.js.map +1 -0
  67. package/dist/session/authorizers/UnboundedAuthorizer.d.ts +36 -0
  68. package/dist/session/authorizers/UnboundedAuthorizer.d.ts.map +1 -0
  69. package/dist/session/authorizers/UnboundedAuthorizer.js +204 -0
  70. package/dist/session/authorizers/UnboundedAuthorizer.js.map +1 -0
  71. package/dist/session/authorizers/index.d.ts +5 -0
  72. package/dist/session/authorizers/index.d.ts.map +1 -0
  73. package/dist/session/authorizers/index.js +5 -0
  74. package/dist/session/authorizers/index.js.map +1 -0
  75. package/dist/session/authorizers/makeSessionAuthorizer.d.ts +19 -0
  76. package/dist/session/authorizers/makeSessionAuthorizer.d.ts.map +1 -0
  77. package/dist/session/authorizers/makeSessionAuthorizer.js +72 -0
  78. package/dist/session/authorizers/makeSessionAuthorizer.js.map +1 -0
  79. package/dist/session/index.d.ts +5 -0
  80. package/dist/session/index.d.ts.map +1 -0
  81. package/dist/session/index.js +5 -0
  82. package/dist/session/index.js.map +1 -0
  83. package/dist/utils/transactions.d.ts +11 -0
  84. package/dist/utils/transactions.d.ts.map +1 -0
  85. package/dist/utils/transactions.js +16 -0
  86. package/dist/utils/transactions.js.map +1 -0
  87. package/package.json +75 -8
  88. package/sdk/src/Methods.ts +230 -0
  89. package/sdk/src/client/Charge.ts +353 -0
  90. package/sdk/src/client/Methods.ts +31 -0
  91. package/sdk/src/client/Session.ts +630 -0
  92. package/sdk/src/client/index.ts +5 -0
  93. package/sdk/src/constants.ts +15 -0
  94. package/sdk/src/index.ts +35 -0
  95. package/sdk/src/server/Charge.ts +484 -0
  96. package/sdk/src/server/Methods.ts +27 -0
  97. package/sdk/src/server/Session.ts +687 -0
  98. package/sdk/src/server/index.ts +5 -0
  99. package/sdk/src/session/ChannelStore.ts +128 -0
  100. package/sdk/src/session/Types.ts +189 -0
  101. package/sdk/src/session/Voucher.ts +158 -0
  102. package/sdk/src/session/authorizers/BudgetAuthorizer.ts +574 -0
  103. package/sdk/src/session/authorizers/SwigSessionAuthorizer.ts +767 -0
  104. package/sdk/src/session/authorizers/UnboundedAuthorizer.ts +284 -0
  105. package/sdk/src/session/authorizers/index.ts +4 -0
  106. package/sdk/src/session/authorizers/makeSessionAuthorizer.ts +104 -0
  107. package/sdk/src/session/index.ts +4 -0
  108. package/sdk/src/utils/transactions.ts +26 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 solana-mpp-sdk 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 ADDED
@@ -0,0 +1,227 @@
1
+ <p align="center">
2
+ <img src="assets/banner.png" alt="MPP" width="100%" />
3
+ </p>
4
+
5
+ # @solana/mpp
6
+
7
+ Solana payment method for the [Machine Payments Protocol](https://mpp.dev).
8
+
9
+ **MPP** is [an open protocol proposal](https://paymentauth.org) that lets any HTTP API accept payments using the `402 Payment Required` flow.
10
+
11
+ > [!IMPORTANT]
12
+ > This repository is under active development. The [Solana MPP spec](https://github.com/tempoxyz/mpp-specs/pull/188) is not yet finalized — APIs and wire formats are subject to change.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pnpm add @solana/mpp
18
+ ```
19
+
20
+ Peer dependencies:
21
+
22
+ ```bash
23
+ pnpm add @solana/kit mppx
24
+ # Optional — for Swig session authorization:
25
+ pnpm add @swig-wallet/kit
26
+ ```
27
+
28
+ ## Features
29
+
30
+ **Charge** (one-time payments)
31
+ - Native SOL and SPL token transfers (USDC, PYUSD, Token-2022, etc.)
32
+ - Two settlement modes: pull (`type="transaction"`, default) and push (`type="signature"`)
33
+ - Fee sponsorship: server pays transaction fees on behalf of clients
34
+ - Replay protection via consumed transaction signatures
35
+
36
+ **Session** (metered / streaming payments)
37
+ - Voucher-based payment channels with monotonic cumulative amounts
38
+ - Multiple authorization modes: `unbounded`, `regular_budget`, `swig_session`
39
+ - Auto-open, auto-topup, and close lifecycle
40
+ - [Swig](https://build.onswig.com) smart wallet integration for on-chain spend limits
41
+
42
+ **General**
43
+ - Works with [ConnectorKit](https://www.connectorkit.dev), `@solana/kit` keypair signers, and [Solana Keychain](https://github.com/solana-foundation/solana-keychain) remote signers
44
+ - Server pre-fetches `recentBlockhash` to save client an RPC round-trip
45
+ - Transaction simulation before broadcast to prevent wasted fees
46
+
47
+ ## Architecture
48
+
49
+ ```
50
+ sdk/src/
51
+ ├── Methods.ts # Shared charge + session schemas
52
+ ├── constants.ts # Token programs, USDC mints, RPC URLs
53
+ ├── server/
54
+ │ ├── Charge.ts # Server: challenge, verify, broadcast
55
+ │ └── Session.ts # Server: session channel management
56
+ ├── client/
57
+ │ ├── Charge.ts # Client: build tx, sign, send
58
+ │ └── Session.ts # Client: session lifecycle
59
+ └── session/
60
+ ├── Types.ts # Session types and interfaces
61
+ ├── Voucher.ts # Voucher signing and verification
62
+ ├── ChannelStore.ts # Persistent channel state
63
+ └── authorizers/ # Pluggable authorization strategies
64
+ ├── UnboundedAuthorizer.ts
65
+ ├── BudgetAuthorizer.ts
66
+ └── SwigSessionAuthorizer.ts
67
+ ```
68
+
69
+ **Exports:**
70
+ - `@solana/mpp` — shared schemas, session types, and authorizers
71
+ - `@solana/mpp/server` — server-side charge + session, `Mppx`, `Store`
72
+ - `@solana/mpp/client` — client-side charge + session, `Mppx`
73
+
74
+ ## Quick Start
75
+
76
+ ### Charge (one-time payment)
77
+
78
+ **Server:**
79
+
80
+ ```ts
81
+ import { Mppx, solana } from '@solana/mpp/server'
82
+
83
+ const mppx = Mppx.create({
84
+ secretKey: process.env.MPP_SECRET_KEY,
85
+ methods: [
86
+ solana.charge({
87
+ recipient: 'RecipientPubkey...',
88
+ splToken: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
89
+ decimals: 6,
90
+ }),
91
+ ],
92
+ })
93
+
94
+ const result = await mppx.charge({
95
+ amount: '1000000', // 1 USDC
96
+ currency: 'USDC',
97
+ })(request)
98
+
99
+ if (result.status === 402) return result.challenge
100
+ return result.withReceipt(Response.json({ data: '...' }))
101
+ ```
102
+
103
+ **Client:**
104
+
105
+ ```ts
106
+ import { Mppx, solana } from '@solana/mpp/client'
107
+
108
+ const mppx = Mppx.create({
109
+ methods: [solana.charge({ signer })], // any TransactionSigner
110
+ })
111
+
112
+ const response = await mppx.fetch('https://api.example.com/paid-endpoint')
113
+ ```
114
+
115
+ ### Session (metered payments)
116
+
117
+ **Server:**
118
+
119
+ ```ts
120
+ import { Mppx, solana } from '@solana/mpp/server'
121
+
122
+ const mppx = Mppx.create({
123
+ secretKey: process.env.MPP_SECRET_KEY,
124
+ methods: [
125
+ solana.session({
126
+ recipient: 'RecipientPubkey...',
127
+ asset: { kind: 'sol', decimals: 9 },
128
+ channelProgram: 'ChannelProgramId...',
129
+ pricing: { unit: 'request', amountPerUnit: '10', meter: 'api_calls' },
130
+ sessionDefaults: { suggestedDeposit: '1000', ttlSeconds: 60 },
131
+ }),
132
+ ],
133
+ })
134
+ ```
135
+
136
+ **Client:**
137
+
138
+ ```ts
139
+ import { Mppx, solana } from '@solana/mpp/client'
140
+ import { UnboundedAuthorizer } from '@solana/mpp'
141
+
142
+ const mppx = Mppx.create({
143
+ methods: [
144
+ solana.session({
145
+ signer,
146
+ authorizer: new UnboundedAuthorizer({ signer, buildOpenTx, buildTopupTx }),
147
+ }),
148
+ ],
149
+ })
150
+
151
+ const response = await mppx.fetch('https://api.example.com/metered-endpoint')
152
+ ```
153
+
154
+ ### Fee Sponsorship (charge)
155
+
156
+ The server can pay transaction fees on behalf of clients:
157
+
158
+ ```ts
159
+ // Server — pass a TransactionPartialSigner to cover fees
160
+ solana.charge({
161
+ recipient: '...',
162
+ signer: feePayerSigner, // KeyPairSigner, Keychain SolanaSigner, etc.
163
+ })
164
+
165
+ // Client — no changes needed, fee payer is handled automatically
166
+ ```
167
+
168
+ ## How It Works
169
+
170
+ ### Charge Flow
171
+
172
+ 1. Client requests a resource
173
+ 2. Server returns **402 Payment Required** with a challenge (`recipient`, `amount`, `currency`, `recentBlockhash`)
174
+ 3. Client builds and signs a Solana transfer transaction
175
+ 4. Server simulates, broadcasts, confirms on-chain, and verifies the transfer
176
+ 5. Server returns the resource with a `Payment-Receipt` header
177
+
178
+ With fee sponsorship, the client partially signs (transfer authority only) and the server co-signs as fee payer before broadcasting.
179
+
180
+ ### Session Flow
181
+
182
+ 1. First request: server returns 402, client opens a channel (deposit + voucher)
183
+ 2. Subsequent requests: client sends updated vouchers with monotonic cumulative amounts
184
+ 3. Server deducts from the channel balance per its pricing config
185
+ 4. When balance runs low: client tops up the channel
186
+ 5. On close: final voucher settles the channel
187
+
188
+ ## Demo
189
+
190
+ An interactive playground with a React frontend and Express backend, running against [Surfpool](https://surfpool.run).
191
+
192
+ - Charge flow demo: `http://localhost:5173/charges`
193
+ - Session flow demo: `http://localhost:5173/sessions`
194
+
195
+ ```bash
196
+ surfpool start
197
+ pnpm demo:install
198
+ pnpm demo:server
199
+ pnpm demo:app
200
+ ```
201
+
202
+ See [demo/README.md](demo/README.md) for full details.
203
+
204
+ ## Development
205
+
206
+ ```bash
207
+ pnpm install
208
+
209
+ just fmt # Format and lint
210
+ just build # Typecheck
211
+ just test # Unit tests (charge + session, no network)
212
+ just test-integration # Integration tests (requires Surfpool)
213
+ just test-all # All tests
214
+ just pre-commit # fmt + typecheck + unit tests
215
+ ```
216
+
217
+ ## Spec
218
+
219
+ This SDK implements the [Solana Charge Intent](https://github.com/tempoxyz/mpp-specs/pull/188) for the [HTTP Payment Authentication Scheme](https://paymentauth.org).
220
+
221
+ Session method docs and implementation notes:
222
+
223
+ - [docs/methods/sessions.md](docs/methods/sessions.md)
224
+
225
+ ## License
226
+
227
+ MIT
@@ -0,0 +1,272 @@
1
+ import { z } from 'mppx';
2
+ /**
3
+ * Solana charge method — shared schema used by both server and client.
4
+ *
5
+ * Supports two settlement modes:
6
+ *
7
+ * - **Pull mode** (`type="transaction"`, default): Client signs the
8
+ * transaction and sends the bytes to the server. The server broadcasts,
9
+ * confirms, and verifies the transfer on-chain.
10
+ *
11
+ * - **Push mode** (`type="signature"`): Client broadcasts the transaction
12
+ * itself and sends the confirmed signature. The server verifies on-chain.
13
+ */
14
+ export declare const charge: {
15
+ readonly intent: "charge";
16
+ readonly name: "solana";
17
+ readonly schema: {
18
+ readonly credential: {
19
+ readonly payload: z.ZodMiniObject<{
20
+ /** Base58-encoded transaction signature (when type="signature"). */
21
+ signature: z.ZodMiniOptional<z.ZodMiniString<string>>;
22
+ /** Base64-encoded serialized signed transaction (when type="transaction"). */
23
+ transaction: z.ZodMiniOptional<z.ZodMiniString<string>>;
24
+ /** Payload type: "transaction" (server broadcasts) or "signature" (client already broadcast). */
25
+ type: z.ZodMiniString<string>;
26
+ }, z.core.$strip>;
27
+ };
28
+ readonly request: z.ZodMiniObject<{
29
+ /** Amount in smallest unit (lamports for SOL, base units for SPL tokens). */
30
+ amount: z.ZodMiniString<string>;
31
+ /** Identifies the unit for amount. "SOL" for native, or token symbol/mint (e.g. "USDC"). */
32
+ currency: z.ZodMiniString<string>;
33
+ /** Human-readable memo describing the resource or service being paid for. */
34
+ description: z.ZodMiniOptional<z.ZodMiniString<string>>;
35
+ /** Merchant's reference (e.g., order ID, invoice number) for reconciliation. */
36
+ externalId: z.ZodMiniOptional<z.ZodMiniString<string>>;
37
+ methodDetails: z.ZodMiniObject<{
38
+ /** Token decimals (required for SPL token transfers). */
39
+ decimals: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
40
+ /** If true, server pays transaction fees. Client must use the server's feePayerKey. */
41
+ feePayer: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
42
+ /** Server's base58-encoded public key for fee payment. Present when feePayer is true. */
43
+ feePayerKey: z.ZodMiniOptional<z.ZodMiniString<string>>;
44
+ /** Solana network: mainnet-beta, devnet, or localnet. */
45
+ network: z.ZodMiniOptional<z.ZodMiniString<string>>;
46
+ /** Server-provided base58-encoded recent blockhash. Saves the client an RPC round-trip. */
47
+ recentBlockhash: z.ZodMiniOptional<z.ZodMiniString<string>>;
48
+ /** Unique reference ID for this charge (server-generated, used for tracking). */
49
+ reference: z.ZodMiniString<string>;
50
+ /** SPL token mint address. If absent, payment is in native SOL. */
51
+ splToken: z.ZodMiniOptional<z.ZodMiniString<string>>;
52
+ /** Token program address (TOKEN_PROGRAM or TOKEN_2022_PROGRAM). Defaults to TOKEN_PROGRAM. */
53
+ tokenProgram: z.ZodMiniOptional<z.ZodMiniString<string>>;
54
+ }, z.core.$strip>;
55
+ /** Base58-encoded recipient public key. */
56
+ recipient: z.ZodMiniString<string>;
57
+ }, z.core.$strip>;
58
+ };
59
+ };
60
+ /**
61
+ * Solana session method shared schema used by both server and client.
62
+ *
63
+ * Supports four credential actions:
64
+ *
65
+ * - **open**: opens a payment channel, records deposit, and anchors setup tx.
66
+ * - **update**: submits a new monotonic voucher for cumulative usage.
67
+ * - **topup**: increases channel escrow using a separate topup transaction.
68
+ * - **close**: final voucher update used to finalize channel settlement.
69
+ */
70
+ export declare const session: {
71
+ readonly intent: "session";
72
+ readonly name: "solana";
73
+ readonly schema: {
74
+ readonly credential: {
75
+ readonly payload: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
76
+ /** Session lifecycle action. */
77
+ action: z.ZodMiniLiteral<"open">;
78
+ /** Authorization mode selected by the authorizer implementation. */
79
+ authorizationMode: z.ZodMiniString<string>;
80
+ /** Optional advertised authorizer capabilities for client hints. */
81
+ capabilities: z.ZodMiniOptional<z.ZodMiniObject<{
82
+ /** Allowed action subset advertised by the authorizer. */
83
+ allowedActions: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
84
+ /** Maximum cumulative authorized amount for this channel. */
85
+ maxCumulativeAmount: z.ZodMiniOptional<z.ZodMiniString<string>>;
86
+ }, z.core.$strip>>;
87
+ /** Unique channel identifier generated by the client authorizer. */
88
+ channelId: z.ZodMiniString<string>;
89
+ /** Initial escrow amount committed for this channel. */
90
+ depositAmount: z.ZodMiniString<string>;
91
+ /** Optional voucher expiration timestamp in ISO-8601 format. */
92
+ expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
93
+ /** On-chain transaction reference proving open/setup step. */
94
+ openTx: z.ZodMiniString<string>;
95
+ /** Wallet payer for this channel (base58 public key). */
96
+ payer: z.ZodMiniString<string>;
97
+ /** Signed session voucher payload for open action. */
98
+ voucher: z.ZodMiniObject<{
99
+ /** Base58/encoded signature over canonical voucher bytes. */
100
+ signature: z.ZodMiniString<string>;
101
+ /** Signature scheme discriminator (`ed25519` or `swig-session`). */
102
+ signatureType: z.ZodMiniString<string>;
103
+ /** Voucher signer public key. */
104
+ signer: z.ZodMiniString<string>;
105
+ voucher: z.ZodMiniObject<{
106
+ /** Chain identifier, for example `solana:mainnet-beta`. */
107
+ chainId: z.ZodMiniString<string>;
108
+ /** Channel identifier bound to this voucher. */
109
+ channelId: z.ZodMiniString<string>;
110
+ /** Channel program address expected by server verifier. */
111
+ channelProgram: z.ZodMiniString<string>;
112
+ /** Monotonic cumulative authorized amount. */
113
+ cumulativeAmount: z.ZodMiniString<string>;
114
+ /** Optional voucher expiration timestamp in ISO-8601 format. */
115
+ expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
116
+ /** Meter name for priced usage tracking. */
117
+ meter: z.ZodMiniString<string>;
118
+ /** Wallet payer bound to this voucher. */
119
+ payer: z.ZodMiniString<string>;
120
+ /** Channel recipient service wallet. */
121
+ recipient: z.ZodMiniString<string>;
122
+ /** Monotonic sequence number for replay protection. */
123
+ sequence: z.ZodMiniNumber<number>;
124
+ /** Server-provided nonce for challenge binding. */
125
+ serverNonce: z.ZodMiniString<string>;
126
+ /** Meter units associated with this authorization update. */
127
+ units: z.ZodMiniString<string>;
128
+ }, z.core.$strip>;
129
+ }, z.core.$strip>;
130
+ }, z.core.$strip>, z.ZodMiniObject<{
131
+ /** Session lifecycle action. */
132
+ action: z.ZodMiniLiteral<"update">;
133
+ /** Existing channel identifier targeted by this update. */
134
+ channelId: z.ZodMiniString<string>;
135
+ /** Signed session voucher payload for usage update. */
136
+ voucher: z.ZodMiniObject<{
137
+ /** Base58/encoded signature over canonical voucher bytes. */
138
+ signature: z.ZodMiniString<string>;
139
+ /** Signature scheme discriminator (`ed25519` or `swig-session`). */
140
+ signatureType: z.ZodMiniString<string>;
141
+ /** Voucher signer public key. */
142
+ signer: z.ZodMiniString<string>;
143
+ voucher: z.ZodMiniObject<{
144
+ /** Chain identifier, for example `solana:mainnet-beta`. */
145
+ chainId: z.ZodMiniString<string>;
146
+ /** Channel identifier bound to this voucher. */
147
+ channelId: z.ZodMiniString<string>;
148
+ /** Channel program address expected by server verifier. */
149
+ channelProgram: z.ZodMiniString<string>;
150
+ /** Monotonic cumulative authorized amount. */
151
+ cumulativeAmount: z.ZodMiniString<string>;
152
+ /** Optional voucher expiration timestamp in ISO-8601 format. */
153
+ expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
154
+ /** Meter name for priced usage tracking. */
155
+ meter: z.ZodMiniString<string>;
156
+ /** Wallet payer bound to this voucher. */
157
+ payer: z.ZodMiniString<string>;
158
+ /** Channel recipient service wallet. */
159
+ recipient: z.ZodMiniString<string>;
160
+ /** Monotonic sequence number for replay protection. */
161
+ sequence: z.ZodMiniNumber<number>;
162
+ /** Server-provided nonce for challenge binding. */
163
+ serverNonce: z.ZodMiniString<string>;
164
+ /** Meter units associated with this authorization update. */
165
+ units: z.ZodMiniString<string>;
166
+ }, z.core.$strip>;
167
+ }, z.core.$strip>;
168
+ }, z.core.$strip>, z.ZodMiniObject<{
169
+ /** Session lifecycle action. */
170
+ action: z.ZodMiniLiteral<"topup">;
171
+ /** Additional escrow amount to add to channel deposit. */
172
+ additionalAmount: z.ZodMiniString<string>;
173
+ /** Existing channel identifier targeted by this topup. */
174
+ channelId: z.ZodMiniString<string>;
175
+ /** On-chain transaction reference proving topup execution. */
176
+ topupTx: z.ZodMiniString<string>;
177
+ }, z.core.$strip>, z.ZodMiniObject<{
178
+ /** Session lifecycle action. */
179
+ action: z.ZodMiniLiteral<"close">;
180
+ /** Existing channel identifier targeted by this close. */
181
+ channelId: z.ZodMiniString<string>;
182
+ /** Optional on-chain settlement transaction reference for this close. */
183
+ closeTx: z.ZodMiniOptional<z.ZodMiniString<string>>;
184
+ /** Signed final voucher payload for close action. */
185
+ voucher: z.ZodMiniObject<{
186
+ /** Base58/encoded signature over canonical voucher bytes. */
187
+ signature: z.ZodMiniString<string>;
188
+ /** Signature scheme discriminator (`ed25519` or `swig-session`). */
189
+ signatureType: z.ZodMiniString<string>;
190
+ /** Voucher signer public key. */
191
+ signer: z.ZodMiniString<string>;
192
+ voucher: z.ZodMiniObject<{
193
+ /** Chain identifier, for example `solana:mainnet-beta`. */
194
+ chainId: z.ZodMiniString<string>;
195
+ /** Channel identifier bound to this voucher. */
196
+ channelId: z.ZodMiniString<string>;
197
+ /** Channel program address expected by server verifier. */
198
+ channelProgram: z.ZodMiniString<string>;
199
+ /** Monotonic cumulative authorized amount. */
200
+ cumulativeAmount: z.ZodMiniString<string>;
201
+ /** Optional voucher expiration timestamp in ISO-8601 format. */
202
+ expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
203
+ /** Meter name for priced usage tracking. */
204
+ meter: z.ZodMiniString<string>;
205
+ /** Wallet payer bound to this voucher. */
206
+ payer: z.ZodMiniString<string>;
207
+ /** Channel recipient service wallet. */
208
+ recipient: z.ZodMiniString<string>;
209
+ /** Monotonic sequence number for replay protection. */
210
+ sequence: z.ZodMiniNumber<number>;
211
+ /** Server-provided nonce for challenge binding. */
212
+ serverNonce: z.ZodMiniString<string>;
213
+ /** Meter units associated with this authorization update. */
214
+ units: z.ZodMiniString<string>;
215
+ }, z.core.$strip>;
216
+ }, z.core.$strip>;
217
+ }, z.core.$strip>], "action">;
218
+ };
219
+ readonly request: z.ZodMiniObject<{
220
+ asset: z.ZodMiniObject<{
221
+ /** Token decimals for amount normalization. */
222
+ decimals: z.ZodMiniNumber<number>;
223
+ /** Asset kind: native SOL or SPL token. */
224
+ kind: z.ZodMiniString<string>;
225
+ /** SPL mint address when kind is `spl`. */
226
+ mint: z.ZodMiniOptional<z.ZodMiniString<string>>;
227
+ /** Optional ticker/symbol used for display. */
228
+ symbol: z.ZodMiniOptional<z.ZodMiniString<string>>;
229
+ }, z.core.$strip>;
230
+ /** Channel program address used to verify vouchers and actions. */
231
+ channelProgram: z.ZodMiniString<string>;
232
+ /** Solana network name, for example mainnet-beta, devnet, localnet. */
233
+ network: z.ZodMiniOptional<z.ZodMiniString<string>>;
234
+ /** Optional pricing contract used to derive debit increments. */
235
+ pricing: z.ZodMiniOptional<z.ZodMiniObject<{
236
+ /** Price per unit in asset base units. */
237
+ amountPerUnit: z.ZodMiniString<string>;
238
+ /** Meter identifier for usage accounting. */
239
+ meter: z.ZodMiniString<string>;
240
+ /** Optional minimum debit to apply per request. */
241
+ minDebit: z.ZodMiniOptional<z.ZodMiniString<string>>;
242
+ /** Logical unit name charged by the service. */
243
+ unit: z.ZodMiniString<string>;
244
+ }, z.core.$strip>>;
245
+ /** Service recipient wallet that receives settlement funds. */
246
+ recipient: z.ZodMiniString<string>;
247
+ /** Optional server hints for default session behavior. */
248
+ sessionDefaults: z.ZodMiniOptional<z.ZodMiniObject<{
249
+ /** Optional close behavior hint for client UX. */
250
+ closeBehavior: z.ZodMiniOptional<z.ZodMiniString<string>>;
251
+ /** Optional settlement cadence policy hints. */
252
+ settleInterval: z.ZodMiniOptional<z.ZodMiniObject<{
253
+ kind: z.ZodMiniString<string>;
254
+ minIncrement: z.ZodMiniOptional<z.ZodMiniString<string>>;
255
+ seconds: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
256
+ }, z.core.$strip>>;
257
+ /** Suggested channel deposit to use on auto-open. */
258
+ suggestedDeposit: z.ZodMiniOptional<z.ZodMiniString<string>>;
259
+ /** Suggested time-to-live for channel/session in seconds. */
260
+ ttlSeconds: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
261
+ }, z.core.$strip>>;
262
+ /** Optional server-side verifier policy hints. */
263
+ verifier: z.ZodMiniOptional<z.ZodMiniObject<{
264
+ /** Supported authorization modes for this endpoint. */
265
+ acceptAuthorizationModes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
266
+ /** Maximum allowable client/server clock skew in seconds. */
267
+ maxClockSkewSeconds: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
268
+ }, z.core.$strip>>;
269
+ }, z.core.$strip>;
270
+ };
271
+ };
272
+ //# sourceMappingURL=Methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Methods.d.ts","sourceRoot":"","sources":["../sdk/src/Methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,CAAC,EAAE,MAAM,MAAM,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM;;;;;;gBAMH,oEAAoE;;gBAEpE,8EAA8E;;gBAE9E,iGAAiG;;;;;YAKrG,6EAA6E;;YAE7E,4FAA4F;;YAE5F,6EAA6E;;YAE7E,gFAAgF;;;gBAG5E,yDAAyD;;gBAEzD,uFAAuF;;gBAEvF,yFAAyF;;gBAEzF,yDAAyD;;gBAEzD,2FAA2F;;gBAE3F,iFAAiF;;gBAEjF,mEAAmE;;gBAEnE,8FAA8F;;;YAGlG,2CAA2C;;;;CAIrD,CAAC;AAqCH;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO;;;;;;gBAOA,gCAAgC;;gBAEhC,oEAAoE;;gBAEpE,oEAAoE;;oBAG5D,0DAA0D;;oBAE1D,6DAA6D;;;gBAIrE,oEAAoE;;gBAEpE,wDAAwD;;gBAExD,gEAAgE;;gBAEhE,8DAA8D;;gBAE9D,yDAAyD;;gBAEzD,sDAAsD;;oBAjDtE,6DAA6D;;oBAE7D,oEAAoE;;oBAEpE,iCAAiC;;;wBA7BjC,2DAA2D;;wBAE3D,gDAAgD;;wBAEhD,2DAA2D;;wBAE3D,8CAA8C;;wBAE9C,gEAAgE;;wBAEhE,4CAA4C;;wBAE5C,0CAA0C;;wBAE1C,wCAAwC;;wBAExC,uDAAuD;;wBAEvD,mDAAmD;;wBAEnD,6DAA6D;;;;;gBA0D7C,gCAAgC;;gBAEhC,2DAA2D;;gBAE3D,uDAAuD;;oBAzDvE,6DAA6D;;oBAE7D,oEAAoE;;oBAEpE,iCAAiC;;;wBA7BjC,2DAA2D;;wBAE3D,gDAAgD;;wBAEhD,2DAA2D;;wBAE3D,8CAA8C;;wBAE9C,gEAAgE;;wBAEhE,4CAA4C;;wBAE5C,0CAA0C;;wBAE1C,wCAAwC;;wBAExC,uDAAuD;;wBAEvD,mDAAmD;;wBAEnD,6DAA6D;;;;;gBAkE7C,gCAAgC;;gBAEhC,0DAA0D;;gBAE1D,0DAA0D;;gBAE1D,8DAA8D;;;gBAI9D,gCAAgC;;gBAEhC,0DAA0D;;gBAE1D,yEAAyE;;gBAEzE,qDAAqD;;oBA7ErE,6DAA6D;;oBAE7D,oEAAoE;;oBAEpE,iCAAiC;;;wBA7BjC,2DAA2D;;wBAE3D,gDAAgD;;wBAEhD,2DAA2D;;wBAE3D,8CAA8C;;wBAE9C,gEAAgE;;wBAEhE,4CAA4C;;wBAE5C,0CAA0C;;wBAE1C,wCAAwC;;wBAExC,uDAAuD;;wBAEvD,mDAAmD;;wBAEnD,6DAA6D;;;;;;;;gBAyFjD,+CAA+C;;gBAE/C,2CAA2C;;gBAE3C,2CAA2C;;gBAE3C,+CAA+C;;;YAGnD,mEAAmE;;YAEnE,uEAAuE;;YAEvE,iEAAiE;;gBAGzD,0CAA0C;;gBAE1C,6CAA6C;;gBAE7C,mDAAmD;;gBAEnD,gDAAgD;;;YAIxD,+DAA+D;;YAE/D,0DAA0D;;gBAGlD,kDAAkD;;gBAElD,gDAAgD;;;;;;gBAQhD,qDAAqD;;gBAErD,6DAA6D;;;YAIrE,kDAAkD;;gBAG1C,uDAAuD;;gBAEvD,6DAA6D;;;;;CAM/E,CAAC"}