@solana/mpp 0.1.1 → 0.2.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 (91) hide show
  1. package/dist/Methods.d.ts +1 -213
  2. package/dist/Methods.d.ts.map +1 -1
  3. package/dist/Methods.js +1 -158
  4. package/dist/Methods.js.map +1 -1
  5. package/dist/client/Methods.d.ts +0 -2
  6. package/dist/client/Methods.d.ts.map +1 -1
  7. package/dist/client/Methods.js +0 -2
  8. package/dist/client/Methods.js.map +1 -1
  9. package/dist/client/index.d.ts +0 -1
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +0 -1
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/index.d.ts +0 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +0 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/server/Charge.d.ts +2 -2
  18. package/dist/server/Charge.d.ts.map +1 -1
  19. package/dist/server/Charge.js +4 -0
  20. package/dist/server/Charge.js.map +1 -1
  21. package/dist/server/Methods.d.ts +0 -2
  22. package/dist/server/Methods.d.ts.map +1 -1
  23. package/dist/server/Methods.js +0 -2
  24. package/dist/server/Methods.js.map +1 -1
  25. package/dist/server/index.d.ts +0 -1
  26. package/dist/server/index.d.ts.map +1 -1
  27. package/dist/server/index.js +0 -1
  28. package/dist/server/index.js.map +1 -1
  29. package/package.json +1 -9
  30. package/src/Methods.ts +1 -171
  31. package/src/client/Methods.ts +0 -3
  32. package/src/client/index.ts +0 -1
  33. package/src/index.ts +0 -29
  34. package/src/server/Charge.ts +7 -2
  35. package/src/server/Methods.ts +0 -3
  36. package/src/server/index.ts +0 -1
  37. package/dist/client/Session.d.ts +0 -195
  38. package/dist/client/Session.d.ts.map +0 -1
  39. package/dist/client/Session.js +0 -411
  40. package/dist/client/Session.js.map +0 -1
  41. package/dist/server/Session.d.ts +0 -171
  42. package/dist/server/Session.d.ts.map +0 -1
  43. package/dist/server/Session.js +0 -430
  44. package/dist/server/Session.js.map +0 -1
  45. package/dist/session/ChannelStore.d.ts +0 -12
  46. package/dist/session/ChannelStore.d.ts.map +0 -1
  47. package/dist/session/ChannelStore.js +0 -88
  48. package/dist/session/ChannelStore.js.map +0 -1
  49. package/dist/session/Types.d.ts +0 -179
  50. package/dist/session/Types.d.ts.map +0 -1
  51. package/dist/session/Types.js +0 -2
  52. package/dist/session/Types.js.map +0 -1
  53. package/dist/session/Voucher.d.ts +0 -7
  54. package/dist/session/Voucher.d.ts.map +0 -1
  55. package/dist/session/Voucher.js +0 -118
  56. package/dist/session/Voucher.js.map +0 -1
  57. package/dist/session/authorizers/BudgetAuthorizer.d.ts +0 -90
  58. package/dist/session/authorizers/BudgetAuthorizer.d.ts.map +0 -1
  59. package/dist/session/authorizers/BudgetAuthorizer.js +0 -398
  60. package/dist/session/authorizers/BudgetAuthorizer.js.map +0 -1
  61. package/dist/session/authorizers/SwigSessionAuthorizer.d.ts +0 -104
  62. package/dist/session/authorizers/SwigSessionAuthorizer.d.ts.map +0 -1
  63. package/dist/session/authorizers/SwigSessionAuthorizer.js +0 -522
  64. package/dist/session/authorizers/SwigSessionAuthorizer.js.map +0 -1
  65. package/dist/session/authorizers/UnboundedAuthorizer.d.ts +0 -36
  66. package/dist/session/authorizers/UnboundedAuthorizer.d.ts.map +0 -1
  67. package/dist/session/authorizers/UnboundedAuthorizer.js +0 -204
  68. package/dist/session/authorizers/UnboundedAuthorizer.js.map +0 -1
  69. package/dist/session/authorizers/index.d.ts +0 -5
  70. package/dist/session/authorizers/index.d.ts.map +0 -1
  71. package/dist/session/authorizers/index.js +0 -5
  72. package/dist/session/authorizers/index.js.map +0 -1
  73. package/dist/session/authorizers/makeSessionAuthorizer.d.ts +0 -19
  74. package/dist/session/authorizers/makeSessionAuthorizer.d.ts.map +0 -1
  75. package/dist/session/authorizers/makeSessionAuthorizer.js +0 -72
  76. package/dist/session/authorizers/makeSessionAuthorizer.js.map +0 -1
  77. package/dist/session/index.d.ts +0 -5
  78. package/dist/session/index.d.ts.map +0 -1
  79. package/dist/session/index.js +0 -5
  80. package/dist/session/index.js.map +0 -1
  81. package/src/client/Session.ts +0 -630
  82. package/src/server/Session.ts +0 -687
  83. package/src/session/ChannelStore.ts +0 -128
  84. package/src/session/Types.ts +0 -189
  85. package/src/session/Voucher.ts +0 -158
  86. package/src/session/authorizers/BudgetAuthorizer.ts +0 -574
  87. package/src/session/authorizers/SwigSessionAuthorizer.ts +0 -767
  88. package/src/session/authorizers/UnboundedAuthorizer.ts +0 -284
  89. package/src/session/authorizers/index.ts +0 -4
  90. package/src/session/authorizers/makeSessionAuthorizer.ts +0 -104
  91. package/src/session/index.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"Methods.d.ts","sourceRoot":"","sources":["../../src/server/Methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,EAAE;IACjB,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;IAC5D,MAAM,EAAE,OAAO,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,QAAQ,CAAC;CAI3B,CAAC;AAEH,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC5B,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CACxC"}
1
+ {"version":3,"file":"Methods.d.ts","sourceRoot":"","sources":["../../src/server/Methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,EAAE;IACjB,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;IAC5D,MAAM,EAAE,OAAO,OAAO,CAAC;CAGzB,CAAC;AAEH,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC5B,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CACxC"}
@@ -1,5 +1,4 @@
1
1
  import { charge as charge_ } from './Charge.js';
2
- import { session as session_ } from './Session.js';
3
2
  /**
4
3
  * Creates Solana payment methods for usage on the server.
5
4
  *
@@ -14,6 +13,5 @@ import { session as session_ } from './Session.js';
14
13
  */
15
14
  export const solana = Object.assign((parameters) => solana.charge(parameters), {
16
15
  charge: charge_,
17
- session: session_,
18
16
  });
19
17
  //# sourceMappingURL=Methods.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Methods.js","sourceRoot":"","sources":["../../src/server/Methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GAIf,MAAM,CAAC,MAAM,CAAC,CAAC,UAA6B,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;IAC5E,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,QAAQ;CACpB,CAAC,CAAC"}
1
+ {"version":3,"file":"Methods.js","sourceRoot":"","sources":["../../src/server/Methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GAGf,MAAM,CAAC,MAAM,CAAC,CAAC,UAA6B,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;IAC5E,MAAM,EAAE,OAAO;CAClB,CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export { charge } from './Charge.js';
2
- export { session } from './Session.js';
3
2
  export { solana } from './Methods.js';
4
3
  export { Mppx, Expires, Store } from 'mppx/server';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export { charge } from './Charge.js';
2
- export { session } from './Session.js';
3
2
  export { solana } from './Methods.js';
4
3
  // Re-export Mppx so consumers can do: import { Mppx, solana } from 'solana-mpp-sdk/server'
5
4
  export { Mppx, Expires, Store } from 'mppx/server';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,2FAA2F;AAC3F,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,2FAA2F;AAC3F,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/mpp",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Solana payment method for the MPP protocol",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,19 +33,11 @@
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@solana/kit": ">=6.5.0",
36
- "@swig-wallet/kit": ">=1.7.0",
37
36
  "mppx": ">=0.3.15"
38
37
  },
39
- "peerDependenciesMeta": {
40
- "@swig-wallet/kit": {
41
- "optional": true
42
- }
43
- },
44
38
  "devDependencies": {
45
39
  "@solana/kit": "^6.5.0",
46
40
  "@solana/kit-client-rpc": "^0.8.0",
47
- "@swig-wallet/kit": "^1.7.1",
48
- "@swig-wallet/lib": "^1.7.1",
49
41
  "@types/node": "^25.5.0",
50
42
  "mppx": "^0.3.15",
51
43
  "tsx": "^4.19.0"
package/src/Methods.ts CHANGED
@@ -29,7 +29,7 @@ export const charge = Method.from({
29
29
  request: z.object({
30
30
  /** Amount in smallest unit (lamports for SOL, base units for SPL tokens). */
31
31
  amount: z.string(),
32
- /** Identifies the unit for amount. "SOL" for native, or token symbol/mint (e.g. "USDC"). */
32
+ /** Identifies the unit for amount. "sol" (lowercase) for native SOL, or the token mint address for SPL tokens. */
33
33
  currency: z.string(),
34
34
  /** Human-readable memo describing the resource or service being paid for. */
35
35
  description: z.optional(z.string()),
@@ -67,173 +67,3 @@ export const charge = Method.from({
67
67
  }),
68
68
  },
69
69
  });
70
-
71
- const voucherSchema = z.object({
72
- /** Chain identifier, for example `solana:mainnet-beta`. */
73
- chainId: z.string(),
74
- /** Channel identifier bound to this voucher. */
75
- channelId: z.string(),
76
- /** Channel program address expected by server verifier. */
77
- channelProgram: z.string(),
78
- /** Monotonic cumulative authorized amount. */
79
- cumulativeAmount: z.string(),
80
- /** Optional voucher expiration timestamp in ISO-8601 format. */
81
- expiresAt: z.optional(z.string()),
82
- /** Meter name for priced usage tracking. */
83
- meter: z.string(),
84
- /** Wallet payer bound to this voucher. */
85
- payer: z.string(),
86
- /** Channel recipient service wallet. */
87
- recipient: z.string(),
88
- /** Monotonic sequence number for replay protection. */
89
- sequence: z.number(),
90
- /** Server-provided nonce for challenge binding. */
91
- serverNonce: z.string(),
92
- /** Meter units associated with this authorization update. */
93
- units: z.string(),
94
- });
95
-
96
- const signedVoucherSchema = z.object({
97
- /** Base58/encoded signature over canonical voucher bytes. */
98
- signature: z.string(),
99
- /** Signature scheme discriminator (`ed25519` or `swig-session`). */
100
- signatureType: z.string(),
101
- /** Voucher signer public key. */
102
- signer: z.string(),
103
- voucher: voucherSchema,
104
- });
105
-
106
- /**
107
- * Solana session method shared schema used by both server and client.
108
- *
109
- * Supports four credential actions:
110
- *
111
- * - **open**: opens a payment channel, records deposit, and anchors setup tx.
112
- * - **update**: submits a new monotonic voucher for cumulative usage.
113
- * - **topup**: increases channel escrow using a separate topup transaction.
114
- * - **close**: final voucher update used to finalize channel settlement.
115
- */
116
- export const session = Method.from({
117
- intent: 'session',
118
- name: 'solana',
119
- schema: {
120
- credential: {
121
- payload: z.discriminatedUnion('action', [
122
- z.object({
123
- /** Session lifecycle action. */
124
- action: z.literal('open'),
125
- /** Authorization mode selected by the authorizer implementation. */
126
- authorizationMode: z.string(),
127
- /** Optional advertised authorizer capabilities for client hints. */
128
- capabilities: z.optional(
129
- z.object({
130
- /** Allowed action subset advertised by the authorizer. */
131
- allowedActions: z.optional(z.array(z.string())),
132
- /** Maximum cumulative authorized amount for this channel. */
133
- maxCumulativeAmount: z.optional(z.string()),
134
- }),
135
- ),
136
- /** Unique channel identifier generated by the client authorizer. */
137
- channelId: z.string(),
138
- /** Initial escrow amount committed for this channel. */
139
- depositAmount: z.string(),
140
- /** Optional voucher expiration timestamp in ISO-8601 format. */
141
- expiresAt: z.optional(z.string()),
142
- /** On-chain transaction reference proving open/setup step. */
143
- openTx: z.string(),
144
- /** Wallet payer for this channel (base58 public key). */
145
- payer: z.string(),
146
- /** Signed session voucher payload for open action. */
147
- voucher: signedVoucherSchema,
148
- }),
149
- z.object({
150
- /** Session lifecycle action. */
151
- action: z.literal('update'),
152
- /** Existing channel identifier targeted by this update. */
153
- channelId: z.string(),
154
- /** Signed session voucher payload for usage update. */
155
- voucher: signedVoucherSchema,
156
- }),
157
- z.object({
158
- /** Session lifecycle action. */
159
- action: z.literal('topup'),
160
- /** Additional escrow amount to add to channel deposit. */
161
- additionalAmount: z.string(),
162
- /** Existing channel identifier targeted by this topup. */
163
- channelId: z.string(),
164
- /** On-chain transaction reference proving topup execution. */
165
- topupTx: z.string(),
166
- }),
167
- z.object({
168
- /** Session lifecycle action. */
169
- action: z.literal('close'),
170
- /** Existing channel identifier targeted by this close. */
171
- channelId: z.string(),
172
- /** Optional on-chain settlement transaction reference for this close. */
173
- closeTx: z.optional(z.string()),
174
- /** Signed final voucher payload for close action. */
175
- voucher: signedVoucherSchema,
176
- }),
177
- ]),
178
- },
179
- request: z.object({
180
- asset: z.object({
181
- /** Token decimals for amount normalization. */
182
- decimals: z.number(),
183
- /** Asset kind: native SOL or SPL token. */
184
- kind: z.string(),
185
- /** SPL mint address when kind is `spl`. */
186
- mint: z.optional(z.string()),
187
- /** Optional ticker/symbol used for display. */
188
- symbol: z.optional(z.string()),
189
- }),
190
- /** Channel program address used to verify vouchers and actions. */
191
- channelProgram: z.string(),
192
- /** Solana network name, for example mainnet-beta, devnet, localnet. */
193
- network: z.optional(z.string()),
194
- /** Optional pricing contract used to derive debit increments. */
195
- pricing: z.optional(
196
- z.object({
197
- /** Price per unit in asset base units. */
198
- amountPerUnit: z.string(),
199
- /** Meter identifier for usage accounting. */
200
- meter: z.string(),
201
- /** Optional minimum debit to apply per request. */
202
- minDebit: z.optional(z.string()),
203
- /** Logical unit name charged by the service. */
204
- unit: z.string(),
205
- }),
206
- ),
207
- /** Service recipient wallet that receives settlement funds. */
208
- recipient: z.string(),
209
- /** Optional server hints for default session behavior. */
210
- sessionDefaults: z.optional(
211
- z.object({
212
- /** Optional close behavior hint for client UX. */
213
- closeBehavior: z.optional(z.string()),
214
- /** Optional settlement cadence policy hints. */
215
- settleInterval: z.optional(
216
- z.object({
217
- kind: z.string(),
218
- minIncrement: z.optional(z.string()),
219
- seconds: z.optional(z.number()),
220
- }),
221
- ),
222
- /** Suggested channel deposit to use on auto-open. */
223
- suggestedDeposit: z.optional(z.string()),
224
- /** Suggested time-to-live for channel/session in seconds. */
225
- ttlSeconds: z.optional(z.number()),
226
- }),
227
- ),
228
- /** Optional server-side verifier policy hints. */
229
- verifier: z.optional(
230
- z.object({
231
- /** Supported authorization modes for this endpoint. */
232
- acceptAuthorizationModes: z.optional(z.array(z.string())),
233
- /** Maximum allowable client/server clock skew in seconds. */
234
- maxClockSkewSeconds: z.optional(z.number()),
235
- }),
236
- ),
237
- }),
238
- },
239
- });
@@ -1,5 +1,4 @@
1
1
  import { charge as charge_ } from './Charge.js';
2
- import { session as session_ } from './Session.js';
3
2
 
4
3
  /**
5
4
  * Creates a Solana `charge` method for usage on the client.
@@ -20,10 +19,8 @@ import { session as session_ } from './Session.js';
20
19
  export const solana: {
21
20
  (parameters: solana.Parameters): ReturnType<typeof charge_>;
22
21
  charge: typeof charge_;
23
- session: typeof session_;
24
22
  } = Object.assign((parameters: solana.Parameters) => charge_(parameters), {
25
23
  charge: charge_,
26
- session: session_,
27
24
  });
28
25
 
29
26
  export declare namespace solana {
@@ -1,5 +1,4 @@
1
1
  export { charge } from './Charge.js';
2
- export { session } from './Session.js';
3
2
  export { solana } from './Methods.js';
4
3
  // Re-export Mppx so consumers can do: import { Mppx, solana } from 'solana-mpp-sdk/client'
5
4
  export { Mppx } from 'mppx/client';
package/src/index.ts CHANGED
@@ -1,31 +1,2 @@
1
1
  // Shared types and method definition
2
2
  export { charge } from './Methods.js';
3
- export { session } from './Methods.js';
4
-
5
- // Session types and authorizer utilities
6
- export type {
7
- AuthorizationMode,
8
- SessionVoucher,
9
- SignedSessionVoucher,
10
- ChannelState,
11
- SessionCredentialPayload,
12
- VoucherVerifier,
13
- SessionAuthorizer,
14
- AuthorizeOpenInput,
15
- AuthorizedOpen,
16
- AuthorizeUpdateInput,
17
- AuthorizedUpdate,
18
- AuthorizeTopupInput,
19
- AuthorizedTopup,
20
- AuthorizeCloseInput,
21
- AuthorizedClose,
22
- AuthorizerCapabilities,
23
- SessionPolicyProfile,
24
- } from './session/Types.js';
25
-
26
- export {
27
- BudgetAuthorizer,
28
- SwigSessionAuthorizer,
29
- UnboundedAuthorizer,
30
- makeSessionAuthorizer,
31
- } from './session/authorizers/index.js';
@@ -189,7 +189,9 @@ async function verifyTransaction(
189
189
 
190
190
  return Receipt.from({
191
191
  method: 'solana',
192
+ ...(credential.challenge.id ? { challengeId: credential.challenge.id } : {}),
192
193
  reference: signature,
194
+ ...(challenge.externalId ? { externalId: challenge.externalId } : {}),
193
195
  status: 'success',
194
196
  timestamp: new Date().toISOString(),
195
197
  });
@@ -228,7 +230,9 @@ async function verifySignature(
228
230
 
229
231
  return Receipt.from({
230
232
  method: 'solana',
233
+ ...(credential.challenge.id ? { challengeId: credential.challenge.id } : {}),
231
234
  reference: signature,
235
+ ...(challenge.externalId ? { externalId: challenge.externalId } : {}),
232
236
  status: 'success',
233
237
  timestamp: new Date().toISOString(),
234
238
  });
@@ -358,6 +362,7 @@ type CredentialPayload = {
358
362
  type ChallengeRequest = {
359
363
  amount: string;
360
364
  currency: string;
365
+ externalId?: string;
361
366
  methodDetails: {
362
367
  decimals?: number;
363
368
  feePayer?: boolean;
@@ -498,8 +503,8 @@ async function waitForConfirmation(rpcUrl: string, signature: string, timeoutMs
498
503
  export declare namespace charge {
499
504
  type Parameters = {
500
505
  /**
501
- * Currency identifier. "SOL" for native SOL, or a base58-encoded
502
- * SPL token mint address (e.g. USDC mint). Defaults to "SOL".
506
+ * Currency identifier. "sol" (lowercase) for native SOL, or a
507
+ * base58-encoded SPL token mint address. Defaults to "sol".
503
508
  */
504
509
  currency?: string;
505
510
  /** Token decimals (required when currency is a mint address). */
@@ -1,5 +1,4 @@
1
1
  import { charge as charge_ } from './Charge.js';
2
- import { session as session_ } from './Session.js';
3
2
 
4
3
  /**
5
4
  * Creates Solana payment methods for usage on the server.
@@ -16,10 +15,8 @@ import { session as session_ } from './Session.js';
16
15
  export const solana: {
17
16
  (parameters: solana.Parameters): ReturnType<typeof charge_>;
18
17
  charge: typeof charge_;
19
- session: typeof session_;
20
18
  } = Object.assign((parameters: solana.Parameters) => solana.charge(parameters), {
21
19
  charge: charge_,
22
- session: session_,
23
20
  });
24
21
 
25
22
  export declare namespace solana {
@@ -1,5 +1,4 @@
1
1
  export { charge } from './Charge.js';
2
- export { session } from './Session.js';
3
2
  export { solana } from './Methods.js';
4
3
  // Re-export Mppx so consumers can do: import { Mppx, solana } from 'solana-mpp-sdk/server'
5
4
  export { Mppx, Expires, Store } from 'mppx/server';
@@ -1,195 +0,0 @@
1
- import type { TransactionSigner } from '@solana/kit';
2
- import { Method, z } from 'mppx';
3
- import type { SessionAuthorizer } from '../session/Types.js';
4
- type SessionAsset = {
5
- decimals: number;
6
- kind: 'sol' | 'spl';
7
- mint?: string;
8
- symbol?: string;
9
- };
10
- export declare const sessionContextSchema: z.ZodMiniObject<{
11
- action: z.ZodMiniOptional<z.ZodMiniEnum<{
12
- open: "open";
13
- update: "update";
14
- topup: "topup";
15
- close: "close";
16
- }>>;
17
- additionalAmount: z.ZodMiniOptional<z.ZodMiniString<string>>;
18
- channelId: z.ZodMiniOptional<z.ZodMiniString<string>>;
19
- cumulativeAmount: z.ZodMiniOptional<z.ZodMiniString<string>>;
20
- depositAmount: z.ZodMiniOptional<z.ZodMiniString<string>>;
21
- openTx: z.ZodMiniOptional<z.ZodMiniString<string>>;
22
- sequence: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
23
- topupTx: z.ZodMiniOptional<z.ZodMiniString<string>>;
24
- }, z.core.$strip>;
25
- export type SessionContext = z.infer<typeof sessionContextSchema>;
26
- export declare function session(parameters: session.Parameters): Method.Client<{
27
- readonly intent: "session";
28
- readonly name: "solana";
29
- readonly schema: {
30
- readonly credential: {
31
- readonly payload: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
32
- action: z.ZodMiniLiteral<"open">;
33
- authorizationMode: z.ZodMiniString<string>;
34
- capabilities: z.ZodMiniOptional<z.ZodMiniObject<{
35
- allowedActions: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
36
- maxCumulativeAmount: z.ZodMiniOptional<z.ZodMiniString<string>>;
37
- }, z.core.$strip>>;
38
- channelId: z.ZodMiniString<string>;
39
- depositAmount: z.ZodMiniString<string>;
40
- expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
41
- openTx: z.ZodMiniString<string>;
42
- payer: z.ZodMiniString<string>;
43
- voucher: z.ZodMiniObject<{
44
- signature: z.ZodMiniString<string>;
45
- signatureType: z.ZodMiniString<string>;
46
- signer: z.ZodMiniString<string>;
47
- voucher: z.ZodMiniObject<{
48
- chainId: z.ZodMiniString<string>;
49
- channelId: z.ZodMiniString<string>;
50
- channelProgram: z.ZodMiniString<string>;
51
- cumulativeAmount: z.ZodMiniString<string>;
52
- expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
53
- meter: z.ZodMiniString<string>;
54
- payer: z.ZodMiniString<string>;
55
- recipient: z.ZodMiniString<string>;
56
- sequence: z.ZodMiniNumber<number>;
57
- serverNonce: z.ZodMiniString<string>;
58
- units: z.ZodMiniString<string>;
59
- }, z.core.$strip>;
60
- }, z.core.$strip>;
61
- }, z.core.$strip>, z.ZodMiniObject<{
62
- action: z.ZodMiniLiteral<"update">;
63
- channelId: z.ZodMiniString<string>;
64
- voucher: z.ZodMiniObject<{
65
- signature: z.ZodMiniString<string>;
66
- signatureType: z.ZodMiniString<string>;
67
- signer: z.ZodMiniString<string>;
68
- voucher: z.ZodMiniObject<{
69
- chainId: z.ZodMiniString<string>;
70
- channelId: z.ZodMiniString<string>;
71
- channelProgram: z.ZodMiniString<string>;
72
- cumulativeAmount: z.ZodMiniString<string>;
73
- expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
74
- meter: z.ZodMiniString<string>;
75
- payer: z.ZodMiniString<string>;
76
- recipient: z.ZodMiniString<string>;
77
- sequence: z.ZodMiniNumber<number>;
78
- serverNonce: z.ZodMiniString<string>;
79
- units: z.ZodMiniString<string>;
80
- }, z.core.$strip>;
81
- }, z.core.$strip>;
82
- }, z.core.$strip>, z.ZodMiniObject<{
83
- action: z.ZodMiniLiteral<"topup">;
84
- additionalAmount: z.ZodMiniString<string>;
85
- channelId: z.ZodMiniString<string>;
86
- topupTx: z.ZodMiniString<string>;
87
- }, z.core.$strip>, z.ZodMiniObject<{
88
- action: z.ZodMiniLiteral<"close">;
89
- channelId: z.ZodMiniString<string>;
90
- closeTx: z.ZodMiniOptional<z.ZodMiniString<string>>;
91
- voucher: z.ZodMiniObject<{
92
- signature: z.ZodMiniString<string>;
93
- signatureType: z.ZodMiniString<string>;
94
- signer: z.ZodMiniString<string>;
95
- voucher: z.ZodMiniObject<{
96
- chainId: z.ZodMiniString<string>;
97
- channelId: z.ZodMiniString<string>;
98
- channelProgram: z.ZodMiniString<string>;
99
- cumulativeAmount: z.ZodMiniString<string>;
100
- expiresAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
101
- meter: z.ZodMiniString<string>;
102
- payer: z.ZodMiniString<string>;
103
- recipient: z.ZodMiniString<string>;
104
- sequence: z.ZodMiniNumber<number>;
105
- serverNonce: z.ZodMiniString<string>;
106
- units: z.ZodMiniString<string>;
107
- }, z.core.$strip>;
108
- }, z.core.$strip>;
109
- }, z.core.$strip>], "action">;
110
- };
111
- readonly request: z.ZodMiniObject<{
112
- asset: z.ZodMiniObject<{
113
- decimals: z.ZodMiniNumber<number>;
114
- kind: z.ZodMiniString<string>;
115
- mint: z.ZodMiniOptional<z.ZodMiniString<string>>;
116
- symbol: z.ZodMiniOptional<z.ZodMiniString<string>>;
117
- }, z.core.$strip>;
118
- channelProgram: z.ZodMiniString<string>;
119
- network: z.ZodMiniOptional<z.ZodMiniString<string>>;
120
- pricing: z.ZodMiniOptional<z.ZodMiniObject<{
121
- amountPerUnit: z.ZodMiniString<string>;
122
- meter: z.ZodMiniString<string>;
123
- minDebit: z.ZodMiniOptional<z.ZodMiniString<string>>;
124
- unit: z.ZodMiniString<string>;
125
- }, z.core.$strip>>;
126
- recipient: z.ZodMiniString<string>;
127
- sessionDefaults: z.ZodMiniOptional<z.ZodMiniObject<{
128
- closeBehavior: z.ZodMiniOptional<z.ZodMiniString<string>>;
129
- settleInterval: z.ZodMiniOptional<z.ZodMiniObject<{
130
- kind: z.ZodMiniString<string>;
131
- minIncrement: z.ZodMiniOptional<z.ZodMiniString<string>>;
132
- seconds: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
133
- }, z.core.$strip>>;
134
- suggestedDeposit: z.ZodMiniOptional<z.ZodMiniString<string>>;
135
- ttlSeconds: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
136
- }, z.core.$strip>>;
137
- verifier: z.ZodMiniOptional<z.ZodMiniObject<{
138
- acceptAuthorizationModes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
139
- maxClockSkewSeconds: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
140
- }, z.core.$strip>>;
141
- }, z.core.$strip>;
142
- };
143
- }, z.ZodMiniObject<{
144
- action: z.ZodMiniOptional<z.ZodMiniEnum<{
145
- open: "open";
146
- update: "update";
147
- topup: "topup";
148
- close: "close";
149
- }>>;
150
- additionalAmount: z.ZodMiniOptional<z.ZodMiniString<string>>;
151
- channelId: z.ZodMiniOptional<z.ZodMiniString<string>>;
152
- cumulativeAmount: z.ZodMiniOptional<z.ZodMiniString<string>>;
153
- depositAmount: z.ZodMiniOptional<z.ZodMiniString<string>>;
154
- openTx: z.ZodMiniOptional<z.ZodMiniString<string>>;
155
- sequence: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
156
- topupTx: z.ZodMiniOptional<z.ZodMiniString<string>>;
157
- }, z.core.$strip>>;
158
- export declare namespace session {
159
- type Parameters = {
160
- authorizer: SessionAuthorizer;
161
- autoOpen?: boolean;
162
- autoTopup?: boolean;
163
- onProgress?: (event: ProgressEvent) => void;
164
- settleOnLimitHit?: boolean;
165
- signer?: TransactionSigner;
166
- };
167
- type ProgressEvent = {
168
- asset: SessionAsset;
169
- network: string;
170
- recipient: string;
171
- type: 'challenge';
172
- } | {
173
- channelId: string;
174
- cumulativeAmount: string;
175
- type: 'updated';
176
- } | {
177
- channelId: string;
178
- cumulativeAmount: string;
179
- type: 'updating';
180
- } | {
181
- channelId: string;
182
- type: 'closed';
183
- } | {
184
- channelId: string;
185
- type: 'closing';
186
- } | {
187
- channelId: string;
188
- type: 'opened';
189
- } | {
190
- channelId: string;
191
- type: 'opening';
192
- };
193
- }
194
- export {};
195
- //# sourceMappingURL=Session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/client/Session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAA8B,MAAM,EAAE,CAAC,EAAE,MAAM,MAAM,CAAC;AAG7D,OAAO,KAAK,EAAE,iBAAiB,EAA4B,MAAM,qBAAqB,CAAC;AAEvF,KAAK,YAAY,GAAG;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAmCF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;iBAS/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,wBAAgB,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2WrD;AA6LD,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC7B,KAAK,UAAU,GAAG;QACd,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;QAC5C,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,MAAM,CAAC,EAAE,iBAAiB,CAAC;KAC9B,CAAC;IAEF,KAAK,aAAa,GACZ;QAAE,KAAK,EAAE,YAAY,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,WAAW,CAAA;KAAE,GAC9E;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,GAChE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,GACjE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,GACrC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,GACtC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,GACrC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;CAChD"}