@ampersend_ai/ampersend-sdk 0.0.16 → 0.0.21

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 (128) hide show
  1. package/dist/ampersend/approval.d.ts +8 -8
  2. package/dist/ampersend/approval.d.ts.map +1 -1
  3. package/dist/ampersend/approval.js +10 -15
  4. package/dist/ampersend/approval.js.map +1 -1
  5. package/dist/ampersend/client.d.ts +4 -9
  6. package/dist/ampersend/client.d.ts.map +1 -1
  7. package/dist/ampersend/client.js +25 -21
  8. package/dist/ampersend/client.js.map +1 -1
  9. package/dist/ampersend/treasurer.d.ts +14 -79
  10. package/dist/ampersend/treasurer.d.ts.map +1 -1
  11. package/dist/ampersend/treasurer.js +34 -102
  12. package/dist/ampersend/treasurer.js.map +1 -1
  13. package/dist/ampersend/types.d.ts +356 -338
  14. package/dist/ampersend/types.d.ts.map +1 -1
  15. package/dist/ampersend/types.js +120 -150
  16. package/dist/ampersend/types.js.map +1 -1
  17. package/dist/ampersend/zod-bridge.d.ts +15 -0
  18. package/dist/ampersend/zod-bridge.d.ts.map +1 -0
  19. package/dist/ampersend/zod-bridge.js +29 -0
  20. package/dist/ampersend/zod-bridge.js.map +1 -0
  21. package/dist/cli/commands/fetch.d.ts.map +1 -1
  22. package/dist/cli/commands/fetch.js.map +1 -1
  23. package/dist/cli/commands/setup.d.ts +4 -0
  24. package/dist/cli/commands/setup.d.ts.map +1 -1
  25. package/dist/cli/commands/setup.js +52 -7
  26. package/dist/cli/commands/setup.js.map +1 -1
  27. package/dist/index.d.ts +2 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/mcp/client/client.d.ts +0 -3
  32. package/dist/mcp/client/client.d.ts.map +1 -1
  33. package/dist/mcp/client/client.js +10 -14
  34. package/dist/mcp/client/client.js.map +1 -1
  35. package/dist/mcp/client/factory.d.ts +0 -2
  36. package/dist/mcp/client/factory.d.ts.map +1 -1
  37. package/dist/mcp/client/factory.js +0 -3
  38. package/dist/mcp/client/factory.js.map +1 -1
  39. package/dist/mcp/client/middleware.d.ts +0 -3
  40. package/dist/mcp/client/middleware.d.ts.map +1 -1
  41. package/dist/mcp/client/middleware.js +9 -12
  42. package/dist/mcp/client/middleware.js.map +1 -1
  43. package/dist/mcp/client/protocol.d.ts +81 -85
  44. package/dist/mcp/client/protocol.d.ts.map +1 -1
  45. package/dist/mcp/client/protocol.js +17 -15
  46. package/dist/mcp/client/protocol.js.map +1 -1
  47. package/dist/mcp/client/types.d.ts +6 -19
  48. package/dist/mcp/client/types.d.ts.map +1 -1
  49. package/dist/mcp/proxy/cli.d.ts.map +1 -1
  50. package/dist/mcp/proxy/cli.js +0 -1
  51. package/dist/mcp/proxy/cli.js.map +1 -1
  52. package/dist/mcp/proxy/env.d.ts +0 -9
  53. package/dist/mcp/proxy/env.d.ts.map +1 -1
  54. package/dist/mcp/proxy/env.js +0 -2
  55. package/dist/mcp/proxy/env.js.map +1 -1
  56. package/dist/mcp/proxy/factory.d.ts +0 -2
  57. package/dist/mcp/proxy/factory.d.ts.map +1 -1
  58. package/dist/mcp/proxy/factory.js +0 -3
  59. package/dist/mcp/proxy/factory.js.map +1 -1
  60. package/dist/mcp/server/fastmcp/middleware.d.ts +9 -29
  61. package/dist/mcp/server/fastmcp/middleware.d.ts.map +1 -1
  62. package/dist/mcp/server/fastmcp/middleware.js +10 -42
  63. package/dist/mcp/server/fastmcp/middleware.js.map +1 -1
  64. package/dist/version.d.ts +1 -1
  65. package/dist/version.js +1 -1
  66. package/dist/x402/envelopes.d.ts +62 -0
  67. package/dist/x402/envelopes.d.ts.map +1 -0
  68. package/dist/x402/envelopes.js +73 -0
  69. package/dist/x402/envelopes.js.map +1 -0
  70. package/dist/x402/http/client.d.ts +37 -0
  71. package/dist/x402/http/client.d.ts.map +1 -0
  72. package/dist/x402/http/client.js +159 -0
  73. package/dist/x402/http/client.js.map +1 -0
  74. package/dist/x402/http/factory.d.ts +11 -25
  75. package/dist/x402/http/factory.d.ts.map +1 -1
  76. package/dist/x402/http/factory.js +11 -22
  77. package/dist/x402/http/factory.js.map +1 -1
  78. package/dist/x402/http/index.d.ts +4 -1
  79. package/dist/x402/http/index.d.ts.map +1 -1
  80. package/dist/x402/http/index.js +2 -1
  81. package/dist/x402/http/index.js.map +1 -1
  82. package/dist/x402/index.d.ts +4 -1
  83. package/dist/x402/index.d.ts.map +1 -1
  84. package/dist/x402/index.js +3 -2
  85. package/dist/x402/index.js.map +1 -1
  86. package/dist/x402/treasurer.d.ts +22 -47
  87. package/dist/x402/treasurer.d.ts.map +1 -1
  88. package/dist/x402/treasurers/naive.d.ts +4 -40
  89. package/dist/x402/treasurers/naive.d.ts.map +1 -1
  90. package/dist/x402/treasurers/naive.js +7 -44
  91. package/dist/x402/treasurers/naive.js.map +1 -1
  92. package/dist/x402/wallet.d.ts +7 -32
  93. package/dist/x402/wallet.d.ts.map +1 -1
  94. package/dist/x402/wallet.js +0 -3
  95. package/dist/x402/wallet.js.map +1 -1
  96. package/dist/x402/wallets/account/wallet.d.ts +9 -30
  97. package/dist/x402/wallets/account/wallet.d.ts.map +1 -1
  98. package/dist/x402/wallets/account/wallet.js +30 -37
  99. package/dist/x402/wallets/account/wallet.js.map +1 -1
  100. package/dist/x402/wallets/index.d.ts +0 -1
  101. package/dist/x402/wallets/index.d.ts.map +1 -1
  102. package/dist/x402/wallets/index.js +0 -1
  103. package/dist/x402/wallets/index.js.map +1 -1
  104. package/dist/x402/wallets/smart-account/chain.d.ts +4 -0
  105. package/dist/x402/wallets/smart-account/chain.d.ts.map +1 -0
  106. package/dist/x402/wallets/smart-account/chain.js +12 -0
  107. package/dist/x402/wallets/smart-account/chain.js.map +1 -0
  108. package/dist/x402/wallets/smart-account/cosigned.d.ts +7 -33
  109. package/dist/x402/wallets/smart-account/cosigned.d.ts.map +1 -1
  110. package/dist/x402/wallets/smart-account/cosigned.js +28 -51
  111. package/dist/x402/wallets/smart-account/cosigned.js.map +1 -1
  112. package/dist/x402/wallets/smart-account/exact.d.ts +6 -20
  113. package/dist/x402/wallets/smart-account/exact.d.ts.map +1 -1
  114. package/dist/x402/wallets/smart-account/exact.js +33 -43
  115. package/dist/x402/wallets/smart-account/exact.js.map +1 -1
  116. package/dist/x402/wallets/smart-account/wallet.d.ts +6 -39
  117. package/dist/x402/wallets/smart-account/wallet.d.ts.map +1 -1
  118. package/dist/x402/wallets/smart-account/wallet.js +9 -36
  119. package/dist/x402/wallets/smart-account/wallet.js.map +1 -1
  120. package/package.json +8 -6
  121. package/dist/x402/http/adapter.d.ts +0 -38
  122. package/dist/x402/http/adapter.d.ts.map +0 -1
  123. package/dist/x402/http/adapter.js +0 -199
  124. package/dist/x402/http/adapter.js.map +0 -1
  125. package/dist/x402/http/v2-adapter.d.ts +0 -56
  126. package/dist/x402/http/v2-adapter.d.ts.map +0 -1
  127. package/dist/x402/http/v2-adapter.js +0 -94
  128. package/dist/x402/http/v2-adapter.js.map +0 -1
@@ -7,6 +7,12 @@ export declare const TxHash: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
7
7
  export type TxHash = typeof TxHash.Type;
8
8
  export declare const Caip2ID: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
9
9
  export type Caip2ID = typeof Caip2ID.Type;
10
+ export declare const Hex32Bytes: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
11
+ export type Hex32Bytes = typeof Hex32Bytes.Type;
12
+ export declare const Hex65Bytes: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
13
+ export type Hex65Bytes = typeof Hex65Bytes.Type;
14
+ export declare const NonNegativeIntegerString: Schema.filter<typeof Schema.NonEmptyTrimmedString>;
15
+ export type NonNegativeIntegerString = typeof NonNegativeIntegerString.Type;
10
16
  declare const SIWENonceResponse_base: Schema.Class<SIWENonceResponse, {
11
17
  nonce: Schema.refine<string, typeof Schema.Trimmed>;
12
18
  sessionId: Schema.refine<string, typeof Schema.Trimmed>;
@@ -58,67 +64,20 @@ declare const SIWELoginResponse_base: Schema.Class<SIWELoginResponse, {
58
64
  }, {}, {}>;
59
65
  export declare class SIWELoginResponse extends SIWELoginResponse_base {
60
66
  }
61
- declare const PaymentRequirements_base: Schema.Class<PaymentRequirements, {
62
- scheme: Schema.Literal<["exact"]>;
63
- network: Schema.refine<string, typeof Schema.Trimmed>;
64
- maxAmountRequired: Schema.refine<string, typeof Schema.Trimmed>;
65
- resource: Schema.refine<string, typeof Schema.Trimmed>;
66
- description: Schema.refine<string, typeof Schema.Trimmed>;
67
- mimeType: Schema.SchemaClass<string, string, never>;
68
- payTo: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
69
- maxTimeoutSeconds: Schema.SchemaClass<number, number, never>;
70
- asset: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
71
- extra: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
72
- }, Schema.Struct.Encoded<{
73
- scheme: Schema.Literal<["exact"]>;
74
- network: Schema.refine<string, typeof Schema.Trimmed>;
75
- maxAmountRequired: Schema.refine<string, typeof Schema.Trimmed>;
76
- resource: Schema.refine<string, typeof Schema.Trimmed>;
77
- description: Schema.refine<string, typeof Schema.Trimmed>;
78
- mimeType: Schema.SchemaClass<string, string, never>;
79
- payTo: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
80
- maxTimeoutSeconds: Schema.SchemaClass<number, number, never>;
81
- asset: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
82
- extra: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
83
- }>, never, {
84
- readonly description: string;
85
- } & {
86
- readonly scheme: "exact";
87
- } & {
88
- readonly network: string;
89
- } & {
90
- readonly maxAmountRequired: string;
91
- } & {
92
- readonly resource: string;
93
- } & {
94
- readonly mimeType: string;
95
- } & {
96
- readonly payTo: string;
97
- } & {
98
- readonly maxTimeoutSeconds: number;
99
- } & {
100
- readonly asset: string;
101
- } & {
102
- readonly extra?: {
103
- readonly [x: string]: unknown;
104
- } | undefined;
105
- }, {}, {}>;
106
- export declare class PaymentRequirements extends PaymentRequirements_base {
107
- }
108
67
  declare const ERC3009AuthorizationData_base: Schema.Class<ERC3009AuthorizationData, {
109
68
  from: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
110
69
  to: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
111
- value: Schema.SchemaClass<string, string, never>;
112
- validAfter: Schema.SchemaClass<string, string, never>;
113
- validBefore: Schema.SchemaClass<string, string, never>;
114
- nonce: Schema.SchemaClass<string, string, never>;
70
+ value: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
71
+ validAfter: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
72
+ validBefore: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
73
+ nonce: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
115
74
  }, Schema.Struct.Encoded<{
116
75
  from: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
117
76
  to: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
118
- value: Schema.SchemaClass<string, string, never>;
119
- validAfter: Schema.SchemaClass<string, string, never>;
120
- validBefore: Schema.SchemaClass<string, string, never>;
121
- nonce: Schema.SchemaClass<string, string, never>;
77
+ value: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
78
+ validAfter: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
79
+ validBefore: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
80
+ nonce: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
122
81
  }>, never, {
123
82
  readonly nonce: string;
124
83
  } & {
@@ -143,7 +102,7 @@ declare const ServerAuthorizationData_base: Schema.Class<ServerAuthorizationData
143
102
  readonly validAfter: string;
144
103
  readonly validBefore: string;
145
104
  }, never>;
146
- serverSignature: Schema.SchemaClass<string, string, never>;
105
+ serverSignature: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
147
106
  }, Schema.Struct.Encoded<{
148
107
  authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
149
108
  readonly nonce: string;
@@ -153,7 +112,7 @@ declare const ServerAuthorizationData_base: Schema.Class<ServerAuthorizationData
153
112
  readonly validAfter: string;
154
113
  readonly validBefore: string;
155
114
  }, never>;
156
- serverSignature: Schema.SchemaClass<string, string, never>;
115
+ serverSignature: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
157
116
  }>, never, {
158
117
  readonly authorizationData: ERC3009AuthorizationData;
159
118
  } & {
@@ -161,115 +120,284 @@ declare const ServerAuthorizationData_base: Schema.Class<ServerAuthorizationData
161
120
  }, {}, {}>;
162
121
  export declare class ServerAuthorizationData extends ServerAuthorizationData_base {
163
122
  }
164
- declare const AgentPaymentAuthRequest_base: Schema.Class<AgentPaymentAuthRequest, {
165
- requirements: Schema.NonEmptyArray<typeof PaymentRequirements>;
123
+ /** Dispatch tag on wire envelopes. Distinct from any individual protocol's internal version. */
124
+ export declare const Protocol: Schema.Literal<["x402-v1", "x402-v2"]>;
125
+ export type Protocol = typeof Protocol.Type;
126
+ /** Wire envelope for a {@link PaymentRequest}; `data` validated via `@x402/core/schemas` on decode. */
127
+ export declare const PaymentRequestEnvelope: Schema.Union<[Schema.Struct<{
128
+ protocol: Schema.Literal<["x402-v1"]>;
129
+ data: Schema.Schema<{
130
+ x402Version: 1;
131
+ accepts: {
132
+ description: string;
133
+ scheme: string;
134
+ network: string;
135
+ maxAmountRequired: string;
136
+ resource: string;
137
+ payTo: string;
138
+ maxTimeoutSeconds: number;
139
+ asset: string;
140
+ mimeType?: string | undefined;
141
+ outputSchema?: Record<string, unknown> | null | undefined;
142
+ extra?: Record<string, unknown> | null | undefined;
143
+ }[];
144
+ error?: string | undefined;
145
+ }, {
146
+ x402Version: 1;
147
+ accepts: {
148
+ description: string;
149
+ scheme: string;
150
+ network: string;
151
+ maxAmountRequired: string;
152
+ resource: string;
153
+ payTo: string;
154
+ maxTimeoutSeconds: number;
155
+ asset: string;
156
+ mimeType?: string | undefined;
157
+ outputSchema?: Record<string, unknown> | null | undefined;
158
+ extra?: Record<string, unknown> | null | undefined;
159
+ }[];
160
+ error?: string | undefined;
161
+ }, never>;
162
+ }>, Schema.Struct<{
163
+ protocol: Schema.Literal<["x402-v2"]>;
164
+ data: Schema.Schema<{
165
+ resource: {
166
+ url: string;
167
+ description?: string | undefined;
168
+ mimeType?: string | undefined;
169
+ };
170
+ x402Version: 2;
171
+ accepts: {
172
+ scheme: string;
173
+ network: string;
174
+ payTo: string;
175
+ maxTimeoutSeconds: number;
176
+ asset: string;
177
+ amount: string;
178
+ extra?: Record<string, unknown> | null | undefined;
179
+ }[];
180
+ error?: string | undefined;
181
+ extensions?: Record<string, unknown> | null | undefined;
182
+ }, {
183
+ resource: {
184
+ url: string;
185
+ description?: string | undefined;
186
+ mimeType?: string | undefined;
187
+ };
188
+ x402Version: 2;
189
+ accepts: {
190
+ scheme: string;
191
+ network: string;
192
+ payTo: string;
193
+ maxTimeoutSeconds: number;
194
+ asset: string;
195
+ amount: string;
196
+ extra?: Record<string, unknown> | null | undefined;
197
+ }[];
198
+ error?: string | undefined;
199
+ extensions?: Record<string, unknown> | null | undefined;
200
+ }, never>;
201
+ }>]>;
202
+ export type PaymentRequestEnvelope = typeof PaymentRequestEnvelope.Type;
203
+ /** Wire envelope for a signed {@link PaymentAuthorization}. */
204
+ export declare const PaymentAuthorizationEnvelope: Schema.Union<[Schema.Struct<{
205
+ protocol: Schema.Literal<["x402-v1"]>;
206
+ data: Schema.Schema<{
207
+ scheme: string;
208
+ network: string;
209
+ x402Version: 1;
210
+ payload: Record<string, unknown>;
211
+ }, {
212
+ scheme: string;
213
+ network: string;
214
+ x402Version: 1;
215
+ payload: Record<string, unknown>;
216
+ }, never>;
217
+ }>, Schema.Struct<{
218
+ protocol: Schema.Literal<["x402-v2"]>;
219
+ data: Schema.Schema<{
220
+ x402Version: 2;
221
+ payload: Record<string, unknown>;
222
+ accepted: {
223
+ scheme: string;
224
+ network: string;
225
+ payTo: string;
226
+ maxTimeoutSeconds: number;
227
+ asset: string;
228
+ amount: string;
229
+ extra?: Record<string, unknown> | null | undefined;
230
+ };
231
+ resource?: {
232
+ url: string;
233
+ description?: string | undefined;
234
+ mimeType?: string | undefined;
235
+ } | undefined;
236
+ extensions?: Record<string, unknown> | null | undefined;
237
+ }, {
238
+ x402Version: 2;
239
+ payload: Record<string, unknown>;
240
+ accepted: {
241
+ scheme: string;
242
+ network: string;
243
+ payTo: string;
244
+ maxTimeoutSeconds: number;
245
+ asset: string;
246
+ amount: string;
247
+ extra?: Record<string, unknown> | null | undefined;
248
+ };
249
+ resource?: {
250
+ url: string;
251
+ description?: string | undefined;
252
+ mimeType?: string | undefined;
253
+ } | undefined;
254
+ extensions?: Record<string, unknown> | null | undefined;
255
+ }, never>;
256
+ }>]>;
257
+ export type PaymentAuthorizationEnvelope = typeof PaymentAuthorizationEnvelope.Type;
258
+ /** Request body for `POST /api/v1/agents/:agent/payment/authorize`. */
259
+ export declare const AgentAuthorizeRequest: Schema.Struct<{
260
+ paymentRequest: Schema.Union<[Schema.Struct<{
261
+ protocol: Schema.Literal<["x402-v1"]>;
262
+ data: Schema.Schema<{
263
+ x402Version: 1;
264
+ accepts: {
265
+ description: string;
266
+ scheme: string;
267
+ network: string;
268
+ maxAmountRequired: string;
269
+ resource: string;
270
+ payTo: string;
271
+ maxTimeoutSeconds: number;
272
+ asset: string;
273
+ mimeType?: string | undefined;
274
+ outputSchema?: Record<string, unknown> | null | undefined;
275
+ extra?: Record<string, unknown> | null | undefined;
276
+ }[];
277
+ error?: string | undefined;
278
+ }, {
279
+ x402Version: 1;
280
+ accepts: {
281
+ description: string;
282
+ scheme: string;
283
+ network: string;
284
+ maxAmountRequired: string;
285
+ resource: string;
286
+ payTo: string;
287
+ maxTimeoutSeconds: number;
288
+ asset: string;
289
+ mimeType?: string | undefined;
290
+ outputSchema?: Record<string, unknown> | null | undefined;
291
+ extra?: Record<string, unknown> | null | undefined;
292
+ }[];
293
+ error?: string | undefined;
294
+ }, never>;
295
+ }>, Schema.Struct<{
296
+ protocol: Schema.Literal<["x402-v2"]>;
297
+ data: Schema.Schema<{
298
+ resource: {
299
+ url: string;
300
+ description?: string | undefined;
301
+ mimeType?: string | undefined;
302
+ };
303
+ x402Version: 2;
304
+ accepts: {
305
+ scheme: string;
306
+ network: string;
307
+ payTo: string;
308
+ maxTimeoutSeconds: number;
309
+ asset: string;
310
+ amount: string;
311
+ extra?: Record<string, unknown> | null | undefined;
312
+ }[];
313
+ error?: string | undefined;
314
+ extensions?: Record<string, unknown> | null | undefined;
315
+ }, {
316
+ resource: {
317
+ url: string;
318
+ description?: string | undefined;
319
+ mimeType?: string | undefined;
320
+ };
321
+ x402Version: 2;
322
+ accepts: {
323
+ scheme: string;
324
+ network: string;
325
+ payTo: string;
326
+ maxTimeoutSeconds: number;
327
+ asset: string;
328
+ amount: string;
329
+ extra?: Record<string, unknown> | null | undefined;
330
+ }[];
331
+ error?: string | undefined;
332
+ extensions?: Record<string, unknown> | null | undefined;
333
+ }, never>;
334
+ }>]>;
166
335
  context: Schema.optional<Schema.Struct<{
167
336
  method: Schema.optional<typeof Schema.NonEmptyTrimmedString>;
168
337
  serverUrl: Schema.optional<typeof Schema.NonEmptyTrimmedString>;
169
338
  params: Schema.optional<typeof Schema.Unknown>;
170
339
  }>>;
340
+ }>;
341
+ export type AgentAuthorizeRequest = typeof AgentAuthorizeRequest.Type;
342
+ declare const CoSignature_base: Schema.Class<CoSignature, {
343
+ authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
344
+ readonly nonce: string;
345
+ readonly from: string;
346
+ readonly to: string;
347
+ readonly value: string;
348
+ readonly validAfter: string;
349
+ readonly validBefore: string;
350
+ }, never>;
351
+ serverSignature: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
171
352
  }, Schema.Struct.Encoded<{
172
- requirements: Schema.NonEmptyArray<typeof PaymentRequirements>;
173
- context: Schema.optional<Schema.Struct<{
174
- method: Schema.optional<typeof Schema.NonEmptyTrimmedString>;
175
- serverUrl: Schema.optional<typeof Schema.NonEmptyTrimmedString>;
176
- params: Schema.optional<typeof Schema.Unknown>;
177
- }>>;
353
+ authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
354
+ readonly nonce: string;
355
+ readonly from: string;
356
+ readonly to: string;
357
+ readonly value: string;
358
+ readonly validAfter: string;
359
+ readonly validBefore: string;
360
+ }, never>;
361
+ serverSignature: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
178
362
  }>, never, {
179
- readonly requirements: readonly [PaymentRequirements, ...PaymentRequirements[]];
363
+ readonly authorizationData: ERC3009AuthorizationData;
180
364
  } & {
181
- readonly context?: {
182
- readonly method?: string | undefined;
183
- readonly serverUrl?: string | undefined;
184
- readonly params?: unknown;
185
- } | undefined;
365
+ readonly serverSignature: string;
186
366
  }, {}, {}>;
187
- export declare class AgentPaymentAuthRequest extends AgentPaymentAuthRequest_base {
367
+ /**
368
+ * ERC-3009 authorization data + server signature for co-signed agent keys;
369
+ * the agent signs alongside. Scheme-specific today (exact EVM).
370
+ */
371
+ export declare class CoSignature extends CoSignature_base {
188
372
  }
189
- declare const AgentPaymentAuthResponse_base: Schema.Class<AgentPaymentAuthResponse, {
373
+ /**
374
+ * Response body for `POST /api/v1/agents/:agent/payment/authorize`. Returns
375
+ * *indices* into the request's `accepts[]` — the client has the original
376
+ * line-items, so byte-exact echo doesn't require re-serialization.
377
+ *
378
+ * ```
379
+ * {
380
+ * authorized: {
381
+ * selected: { acceptsIndex, limits, coSignature? } | null,
382
+ * alternatives: [{ acceptsIndex, limits }],
383
+ * },
384
+ * rejected: [{ acceptsIndex, reason }],
385
+ * suggested?: { nonce, validBefore },
386
+ * }
387
+ * ```
388
+ */
389
+ export declare const AgentAuthorizeResponse: Schema.Struct<{
190
390
  authorized: Schema.Struct<{
191
- recommended: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative>>;
192
- requirements: Schema.Array$<Schema.Struct<{
193
- requirement: Schema.SchemaClass<PaymentRequirements, {
194
- readonly description: string;
195
- readonly scheme: "exact";
196
- readonly network: string;
197
- readonly maxAmountRequired: string;
198
- readonly resource: string;
199
- readonly mimeType: string;
200
- readonly payTo: string;
201
- readonly maxTimeoutSeconds: number;
202
- readonly asset: string;
203
- readonly extra?: {
204
- readonly [x: string]: unknown;
205
- } | undefined;
206
- }, never>;
391
+ selected: Schema.NullOr<Schema.Struct<{
392
+ acceptsIndex: Schema.refine<number, typeof Schema.NonNegative>;
207
393
  limits: Schema.Struct<{
208
394
  dailyRemaining: Schema.refine<string, typeof Schema.Trimmed>;
209
395
  monthlyRemaining: Schema.refine<string, typeof Schema.Trimmed>;
210
396
  }>;
397
+ coSignature: Schema.optional<typeof CoSignature>;
211
398
  }>>;
212
- }>;
213
- rejected: Schema.Array$<Schema.Struct<{
214
- requirement: Schema.SchemaClass<PaymentRequirements, {
215
- readonly description: string;
216
- readonly scheme: "exact";
217
- readonly network: string;
218
- readonly maxAmountRequired: string;
219
- readonly resource: string;
220
- readonly mimeType: string;
221
- readonly payTo: string;
222
- readonly maxTimeoutSeconds: number;
223
- readonly asset: string;
224
- readonly extra?: {
225
- readonly [x: string]: unknown;
226
- } | undefined;
227
- }, never>;
228
- reason: Schema.refine<string, typeof Schema.Trimmed>;
229
- }>>;
230
- payment: Schema.optional<Schema.NullOr<Schema.Struct<{
231
- authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
232
- readonly nonce: string;
233
- readonly from: string;
234
- readonly to: string;
235
- readonly value: string;
236
- readonly validAfter: string;
237
- readonly validBefore: string;
238
- }, never>;
239
- serverSignature: Schema.SchemaClass<string, string, never>;
240
- requirement: Schema.SchemaClass<PaymentRequirements, {
241
- readonly description: string;
242
- readonly scheme: "exact";
243
- readonly network: string;
244
- readonly maxAmountRequired: string;
245
- readonly resource: string;
246
- readonly mimeType: string;
247
- readonly payTo: string;
248
- readonly maxTimeoutSeconds: number;
249
- readonly asset: string;
250
- readonly extra?: {
251
- readonly [x: string]: unknown;
252
- } | undefined;
253
- }, never>;
254
- }>>>;
255
- }, Schema.Struct.Encoded<{
256
- authorized: Schema.Struct<{
257
- recommended: Schema.NullOr<Schema.refine<number, typeof Schema.NonNegative>>;
258
- requirements: Schema.Array$<Schema.Struct<{
259
- requirement: Schema.SchemaClass<PaymentRequirements, {
260
- readonly description: string;
261
- readonly scheme: "exact";
262
- readonly network: string;
263
- readonly maxAmountRequired: string;
264
- readonly resource: string;
265
- readonly mimeType: string;
266
- readonly payTo: string;
267
- readonly maxTimeoutSeconds: number;
268
- readonly asset: string;
269
- readonly extra?: {
270
- readonly [x: string]: unknown;
271
- } | undefined;
272
- }, never>;
399
+ alternatives: Schema.Array$<Schema.Struct<{
400
+ acceptsIndex: Schema.refine<number, typeof Schema.NonNegative>;
273
401
  limits: Schema.Struct<{
274
402
  dailyRemaining: Schema.refine<string, typeof Schema.Trimmed>;
275
403
  monthlyRemaining: Schema.refine<string, typeof Schema.Trimmed>;
@@ -277,72 +405,15 @@ declare const AgentPaymentAuthResponse_base: Schema.Class<AgentPaymentAuthRespon
277
405
  }>>;
278
406
  }>;
279
407
  rejected: Schema.Array$<Schema.Struct<{
280
- requirement: Schema.SchemaClass<PaymentRequirements, {
281
- readonly description: string;
282
- readonly scheme: "exact";
283
- readonly network: string;
284
- readonly maxAmountRequired: string;
285
- readonly resource: string;
286
- readonly mimeType: string;
287
- readonly payTo: string;
288
- readonly maxTimeoutSeconds: number;
289
- readonly asset: string;
290
- readonly extra?: {
291
- readonly [x: string]: unknown;
292
- } | undefined;
293
- }, never>;
294
- reason: Schema.refine<string, typeof Schema.Trimmed>;
408
+ acceptsIndex: Schema.refine<number, typeof Schema.NonNegative>;
409
+ reason: typeof Schema.NonEmptyTrimmedString;
295
410
  }>>;
296
- payment: Schema.optional<Schema.NullOr<Schema.Struct<{
297
- authorizationData: Schema.SchemaClass<ERC3009AuthorizationData, {
298
- readonly nonce: string;
299
- readonly from: string;
300
- readonly to: string;
301
- readonly value: string;
302
- readonly validAfter: string;
303
- readonly validBefore: string;
304
- }, never>;
305
- serverSignature: Schema.SchemaClass<string, string, never>;
306
- requirement: Schema.SchemaClass<PaymentRequirements, {
307
- readonly description: string;
308
- readonly scheme: "exact";
309
- readonly network: string;
310
- readonly maxAmountRequired: string;
311
- readonly resource: string;
312
- readonly mimeType: string;
313
- readonly payTo: string;
314
- readonly maxTimeoutSeconds: number;
315
- readonly asset: string;
316
- readonly extra?: {
317
- readonly [x: string]: unknown;
318
- } | undefined;
319
- }, never>;
320
- }>>>;
321
- }>, never, {
322
- readonly authorized: {
323
- readonly requirements: readonly {
324
- readonly requirement: PaymentRequirements;
325
- readonly limits: {
326
- readonly dailyRemaining: string;
327
- readonly monthlyRemaining: string;
328
- };
329
- }[];
330
- readonly recommended: number | null;
331
- };
332
- } & {
333
- readonly rejected: readonly {
334
- readonly requirement: PaymentRequirements;
335
- readonly reason: string;
336
- }[];
337
- } & {
338
- readonly payment?: {
339
- readonly authorizationData: ERC3009AuthorizationData;
340
- readonly serverSignature: string;
341
- readonly requirement: PaymentRequirements;
342
- } | null | undefined;
343
- }, {}, {}>;
344
- export declare class AgentPaymentAuthResponse extends AgentPaymentAuthResponse_base {
345
- }
411
+ suggested: Schema.optional<Schema.Struct<{
412
+ nonce: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
413
+ validBefore: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
414
+ }>>;
415
+ }>;
416
+ export type AgentAuthorizeResponse = typeof AgentAuthorizeResponse.Type;
346
417
  export declare const PaymentEventType: Schema.Union<[Schema.Struct<{
347
418
  type: Schema.Literal<["sending"]>;
348
419
  }>, Schema.Struct<{
@@ -355,110 +426,63 @@ export declare const PaymentEventType: Schema.Union<[Schema.Struct<{
355
426
  reason: Schema.refine<string, typeof Schema.Trimmed>;
356
427
  }>]>;
357
428
  export type PaymentEventType = typeof PaymentEventType.Type;
358
- declare const ExactEvmAuthorization_base: Schema.Class<ExactEvmAuthorization, {
359
- from: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
360
- to: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
361
- value: Schema.refine<string, typeof Schema.Trimmed>;
362
- validAfter: Schema.refine<string, typeof Schema.Trimmed>;
363
- validBefore: Schema.refine<string, typeof Schema.Trimmed>;
364
- nonce: Schema.refine<string, typeof Schema.Trimmed>;
365
- }, Schema.Struct.Encoded<{
366
- from: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
367
- to: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
368
- value: Schema.refine<string, typeof Schema.Trimmed>;
369
- validAfter: Schema.refine<string, typeof Schema.Trimmed>;
370
- validBefore: Schema.refine<string, typeof Schema.Trimmed>;
371
- nonce: Schema.refine<string, typeof Schema.Trimmed>;
372
- }>, never, {
373
- readonly nonce: string;
374
- } & {
375
- readonly from: string;
376
- } & {
377
- readonly to: string;
378
- } & {
379
- readonly value: string;
380
- } & {
381
- readonly validAfter: string;
382
- } & {
383
- readonly validBefore: string;
384
- }, {}, {}>;
385
- export declare class ExactEvmAuthorization extends ExactEvmAuthorization_base {
386
- }
387
- declare const ExactEvmPayload_base: Schema.Class<ExactEvmPayload, {
388
- signature: Schema.refine<string, typeof Schema.Trimmed>;
389
- authorization: Schema.SchemaClass<ExactEvmAuthorization, {
390
- readonly nonce: string;
391
- readonly from: string;
392
- readonly to: string;
393
- readonly value: string;
394
- readonly validAfter: string;
395
- readonly validBefore: string;
396
- }, never>;
397
- }, Schema.Struct.Encoded<{
398
- signature: Schema.refine<string, typeof Schema.Trimmed>;
399
- authorization: Schema.SchemaClass<ExactEvmAuthorization, {
400
- readonly nonce: string;
401
- readonly from: string;
402
- readonly to: string;
403
- readonly value: string;
404
- readonly validAfter: string;
405
- readonly validBefore: string;
406
- }, never>;
407
- }>, never, {
408
- readonly signature: string;
409
- } & {
410
- readonly authorization: ExactEvmAuthorization;
411
- }, {}, {}>;
412
- export declare class ExactEvmPayload extends ExactEvmPayload_base {
413
- }
414
- declare const PaymentPayload_base: Schema.Class<PaymentPayload, {
415
- x402Version: Schema.SchemaClass<number, number, never>;
416
- scheme: Schema.refine<string, typeof Schema.Trimmed>;
417
- network: Schema.refine<string, typeof Schema.Trimmed>;
418
- payload: Schema.Union<[typeof ExactEvmPayload, typeof Schema.Unknown]>;
419
- }, Schema.Struct.Encoded<{
420
- x402Version: Schema.SchemaClass<number, number, never>;
421
- scheme: Schema.refine<string, typeof Schema.Trimmed>;
422
- network: Schema.refine<string, typeof Schema.Trimmed>;
423
- payload: Schema.Union<[typeof ExactEvmPayload, typeof Schema.Unknown]>;
424
- }>, never, {
425
- readonly scheme: string;
426
- } & {
427
- readonly network: string;
428
- } & {
429
- readonly x402Version: number;
430
- } & {
431
- readonly payload: unknown;
432
- }, {}, {}>;
433
- export declare class PaymentPayload extends PaymentPayload_base {
434
- }
435
- declare const AgentPaymentEventReport_base: Schema.Class<AgentPaymentEventReport, {
429
+ export type PaymentEvent = PaymentEventType;
430
+ /** Request body for `POST /api/v1/agents/:agent/payment/events`. */
431
+ export declare const AgentPaymentEventReport: Schema.Struct<{
436
432
  id: Schema.refine<string, typeof Schema.Trimmed>;
437
- payment: Schema.SchemaClass<PaymentPayload, {
438
- readonly scheme: string;
439
- readonly network: string;
440
- readonly x402Version: number;
441
- readonly payload: unknown;
442
- }, never>;
443
- event: Schema.Union<[Schema.Struct<{
444
- type: Schema.Literal<["sending"]>;
445
- }>, Schema.Struct<{
446
- type: Schema.Literal<["accepted"]>;
447
- }>, Schema.Struct<{
448
- type: Schema.Literal<["rejected"]>;
449
- reason: Schema.refine<string, typeof Schema.Trimmed>;
433
+ payment: Schema.Union<[Schema.Struct<{
434
+ protocol: Schema.Literal<["x402-v1"]>;
435
+ data: Schema.Schema<{
436
+ scheme: string;
437
+ network: string;
438
+ x402Version: 1;
439
+ payload: Record<string, unknown>;
440
+ }, {
441
+ scheme: string;
442
+ network: string;
443
+ x402Version: 1;
444
+ payload: Record<string, unknown>;
445
+ }, never>;
450
446
  }>, Schema.Struct<{
451
- type: Schema.Literal<["error"]>;
452
- reason: Schema.refine<string, typeof Schema.Trimmed>;
447
+ protocol: Schema.Literal<["x402-v2"]>;
448
+ data: Schema.Schema<{
449
+ x402Version: 2;
450
+ payload: Record<string, unknown>;
451
+ accepted: {
452
+ scheme: string;
453
+ network: string;
454
+ payTo: string;
455
+ maxTimeoutSeconds: number;
456
+ asset: string;
457
+ amount: string;
458
+ extra?: Record<string, unknown> | null | undefined;
459
+ };
460
+ resource?: {
461
+ url: string;
462
+ description?: string | undefined;
463
+ mimeType?: string | undefined;
464
+ } | undefined;
465
+ extensions?: Record<string, unknown> | null | undefined;
466
+ }, {
467
+ x402Version: 2;
468
+ payload: Record<string, unknown>;
469
+ accepted: {
470
+ scheme: string;
471
+ network: string;
472
+ payTo: string;
473
+ maxTimeoutSeconds: number;
474
+ asset: string;
475
+ amount: string;
476
+ extra?: Record<string, unknown> | null | undefined;
477
+ };
478
+ resource?: {
479
+ url: string;
480
+ description?: string | undefined;
481
+ mimeType?: string | undefined;
482
+ } | undefined;
483
+ extensions?: Record<string, unknown> | null | undefined;
484
+ }, never>;
453
485
  }>]>;
454
- }, Schema.Struct.Encoded<{
455
- id: Schema.refine<string, typeof Schema.Trimmed>;
456
- payment: Schema.SchemaClass<PaymentPayload, {
457
- readonly scheme: string;
458
- readonly network: string;
459
- readonly x402Version: number;
460
- readonly payload: unknown;
461
- }, never>;
462
486
  event: Schema.Union<[Schema.Struct<{
463
487
  type: Schema.Literal<["sending"]>;
464
488
  }>, Schema.Struct<{
@@ -470,25 +494,8 @@ declare const AgentPaymentEventReport_base: Schema.Class<AgentPaymentEventReport
470
494
  type: Schema.Literal<["error"]>;
471
495
  reason: Schema.refine<string, typeof Schema.Trimmed>;
472
496
  }>]>;
473
- }>, never, {
474
- readonly payment: PaymentPayload;
475
- } & {
476
- readonly id: string;
477
- } & {
478
- readonly event: {
479
- readonly type: "sending";
480
- } | {
481
- readonly type: "accepted";
482
- } | {
483
- readonly type: "rejected";
484
- readonly reason: string;
485
- } | {
486
- readonly type: "error";
487
- readonly reason: string;
488
- };
489
- }, {}, {}>;
490
- export declare class AgentPaymentEventReport extends AgentPaymentEventReport_base {
491
- }
497
+ }>;
498
+ export type AgentPaymentEventReport = typeof AgentPaymentEventReport.Type;
492
499
  declare const AgentPaymentEventResponse_base: Schema.Class<AgentPaymentEventResponse, {
493
500
  received: Schema.SchemaClass<boolean, boolean, never>;
494
501
  paymentId: Schema.optional<typeof Schema.UUID>;
@@ -517,35 +524,42 @@ export declare class ApiError extends Error {
517
524
  response?: Response | undefined;
518
525
  constructor(message: string, status?: number | undefined, response?: Response | undefined);
519
526
  }
520
- export type PaymentEvent = PaymentEventType;
521
527
  export declare const SpendConfigInput: Schema.Struct<{
522
528
  auto_topup_allowed: Schema.SchemaClass<boolean, boolean, never>;
523
529
  daily_limit: Schema.NullOr<typeof Schema.String>;
524
530
  monthly_limit: Schema.NullOr<typeof Schema.String>;
525
531
  per_transaction_limit: Schema.NullOr<typeof Schema.String>;
526
532
  }>;
527
- declare const CreateAgentApprovalRequest_base: Schema.Class<CreateAgentApprovalRequest, {
533
+ declare const AgentApprovalRequest_base: Schema.Class<AgentApprovalRequest, {
528
534
  name: Schema.NullOr<typeof Schema.String>;
529
535
  agent_key_address: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
536
+ key_name: Schema.optional<Schema.SchemaClass<string, string, never>>;
530
537
  spend_config: Schema.optional<Schema.NullOr<Schema.Struct<{
531
538
  auto_topup_allowed: Schema.SchemaClass<boolean, boolean, never>;
532
539
  daily_limit: Schema.NullOr<typeof Schema.String>;
533
540
  monthly_limit: Schema.NullOr<typeof Schema.String>;
534
541
  per_transaction_limit: Schema.NullOr<typeof Schema.String>;
535
542
  }>>>;
543
+ mode: Schema.optional<Schema.Literal<["create", "connect", "connect_choose"]>>;
544
+ agent_address: Schema.optional<Schema.refine<string, typeof Schema.NonEmptyTrimmedString>>;
536
545
  }, Schema.Struct.Encoded<{
537
546
  name: Schema.NullOr<typeof Schema.String>;
538
547
  agent_key_address: Schema.refine<string, typeof Schema.NonEmptyTrimmedString>;
548
+ key_name: Schema.optional<Schema.SchemaClass<string, string, never>>;
539
549
  spend_config: Schema.optional<Schema.NullOr<Schema.Struct<{
540
550
  auto_topup_allowed: Schema.SchemaClass<boolean, boolean, never>;
541
551
  daily_limit: Schema.NullOr<typeof Schema.String>;
542
552
  monthly_limit: Schema.NullOr<typeof Schema.String>;
543
553
  per_transaction_limit: Schema.NullOr<typeof Schema.String>;
544
554
  }>>>;
555
+ mode: Schema.optional<Schema.Literal<["create", "connect", "connect_choose"]>>;
556
+ agent_address: Schema.optional<Schema.refine<string, typeof Schema.NonEmptyTrimmedString>>;
545
557
  }>, never, {
546
558
  readonly name: string | null;
547
559
  } & {
548
560
  readonly agent_key_address: string;
561
+ } & {
562
+ readonly key_name?: string | undefined;
549
563
  } & {
550
564
  readonly spend_config?: {
551
565
  readonly auto_topup_allowed: boolean;
@@ -553,8 +567,12 @@ declare const CreateAgentApprovalRequest_base: Schema.Class<CreateAgentApprovalR
553
567
  readonly monthly_limit: string | null;
554
568
  readonly per_transaction_limit: string | null;
555
569
  } | null | undefined;
570
+ } & {
571
+ readonly mode?: "create" | "connect" | "connect_choose" | undefined;
572
+ } & {
573
+ readonly agent_address?: string | undefined;
556
574
  }, {}, {}>;
557
- export declare class CreateAgentApprovalRequest extends CreateAgentApprovalRequest_base {
575
+ export declare class AgentApprovalRequest extends AgentApprovalRequest_base {
558
576
  }
559
577
  declare const ApprovalResponse_base: Schema.Class<ApprovalResponse, {
560
578
  token: Schema.refine<string, typeof Schema.Trimmed>;