@haven_ai/sdk 0.1.4 → 0.1.5
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.
- package/README.md +75 -10
- package/dist/index.cjs +215 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +210 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/index.d.cts +0 -850
- package/dist/index.d.ts +0 -850
package/dist/index.d.ts
DELETED
|
@@ -1,850 +0,0 @@
|
|
|
1
|
-
interface HavenClientConfig {
|
|
2
|
-
/** Haven API key (sk_agent_xxx) */
|
|
3
|
-
apiKey: string;
|
|
4
|
-
/** Agent's delegate EOA private key. If provided, the SDK handles signing automatically. */
|
|
5
|
-
delegateKey?: string;
|
|
6
|
-
/** Haven API base URL (default: http://localhost:3001) */
|
|
7
|
-
baseUrl?: string;
|
|
8
|
-
/** Optional wallet identity to send as the x402-wallet header. */
|
|
9
|
-
x402Wallet?: string;
|
|
10
|
-
/** Timeout in ms for individual HTTP requests (default: 30000) */
|
|
11
|
-
requestTimeout?: number;
|
|
12
|
-
/** Timeout in ms when polling for tx confirmation (default: 90000) */
|
|
13
|
-
confirmationTimeout?: number;
|
|
14
|
-
/** Polling interval in ms when waiting for confirmation (default: 3000) */
|
|
15
|
-
pollingInterval?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Extra headers to attach to every request to the Haven API.
|
|
18
|
-
*
|
|
19
|
-
* Used by the MCP server to tag requests with `X-Haven-MCP-Tool: <name>`
|
|
20
|
-
* so the backend can record an audit-log entry per tool invocation. Has
|
|
21
|
-
* no effect on outbound merchant requests (x402 / MPP) — those are
|
|
22
|
-
* standard HTTP and never carry Haven-internal headers.
|
|
23
|
-
*/
|
|
24
|
-
defaultHeaders?: Record<string, string>;
|
|
25
|
-
}
|
|
26
|
-
interface PaymentRequest {
|
|
27
|
-
/** Token symbol: "EURe", "USDC.e", or "xDAI" */
|
|
28
|
-
token: string;
|
|
29
|
-
/** Amount as a decimal string, e.g. "5.00" */
|
|
30
|
-
amount: string;
|
|
31
|
-
/** Recipient Ethereum address (0x...) */
|
|
32
|
-
to: string;
|
|
33
|
-
}
|
|
34
|
-
interface SignData {
|
|
35
|
-
/** The hash to sign (keccak256, 0x-prefixed) */
|
|
36
|
-
hash: string;
|
|
37
|
-
/** Breakdown of values that were hashed — useful for debugging */
|
|
38
|
-
components: {
|
|
39
|
-
safe: string;
|
|
40
|
-
token: string;
|
|
41
|
-
to: string;
|
|
42
|
-
amount: string;
|
|
43
|
-
payment_token: string;
|
|
44
|
-
payment: string;
|
|
45
|
-
nonce: number;
|
|
46
|
-
};
|
|
47
|
-
/** Human-readable signing instructions */
|
|
48
|
-
instructions: string;
|
|
49
|
-
}
|
|
50
|
-
interface PaymentIntent {
|
|
51
|
-
/** Unique payment ID */
|
|
52
|
-
paymentId: string;
|
|
53
|
-
/** Current status */
|
|
54
|
-
status: 'pending_signature';
|
|
55
|
-
/** ISO 8601 expiry timestamp */
|
|
56
|
-
expiresAt: string;
|
|
57
|
-
/** Data needed to sign the payment */
|
|
58
|
-
signData: SignData;
|
|
59
|
-
}
|
|
60
|
-
type PaymentStatus = 'pending_signature' | 'submitted' | 'confirmed' | 'pending_approval' | 'approved' | 'proposed' | 'executed' | 'rejected' | 'expired' | 'failed';
|
|
61
|
-
interface PaymentResult {
|
|
62
|
-
/** Unique payment ID */
|
|
63
|
-
paymentId: string;
|
|
64
|
-
/** Final status */
|
|
65
|
-
status: PaymentStatus;
|
|
66
|
-
/** Token that was sent */
|
|
67
|
-
token: string;
|
|
68
|
-
/** Amount that was sent (human-readable) */
|
|
69
|
-
amount: string;
|
|
70
|
-
/** Recipient address */
|
|
71
|
-
to: string;
|
|
72
|
-
/** On-chain transaction hash (present when confirmed) */
|
|
73
|
-
txHash: string | null;
|
|
74
|
-
/** Error message (present when failed) */
|
|
75
|
-
errorMessage: string | null;
|
|
76
|
-
/** Block explorer URL for the transaction (chain-dependent) */
|
|
77
|
-
explorerUrl: string | null;
|
|
78
|
-
/** ISO 8601 timestamps */
|
|
79
|
-
createdAt: string;
|
|
80
|
-
signedAt: string | null;
|
|
81
|
-
submittedAt: string | null;
|
|
82
|
-
confirmedAt: string | null;
|
|
83
|
-
expiresAt: string;
|
|
84
|
-
}
|
|
85
|
-
/** Payment requirements from an HTTP 402 response (x402 protocol). */
|
|
86
|
-
interface X402PaymentRequired {
|
|
87
|
-
x402Version: number;
|
|
88
|
-
resource: {
|
|
89
|
-
url: string;
|
|
90
|
-
description?: string;
|
|
91
|
-
mimeType?: string;
|
|
92
|
-
};
|
|
93
|
-
accepts: X402PaymentOption[];
|
|
94
|
-
error?: string;
|
|
95
|
-
}
|
|
96
|
-
/** A single payment option from x402 PaymentRequired. */
|
|
97
|
-
interface X402PaymentOption {
|
|
98
|
-
scheme: string;
|
|
99
|
-
network: string;
|
|
100
|
-
amount: string;
|
|
101
|
-
maxAmountRequired?: string;
|
|
102
|
-
resource?: string;
|
|
103
|
-
description?: string;
|
|
104
|
-
mimeType?: string;
|
|
105
|
-
asset: string;
|
|
106
|
-
payTo: string;
|
|
107
|
-
maxTimeoutSeconds: number;
|
|
108
|
-
extra?: Record<string, unknown>;
|
|
109
|
-
}
|
|
110
|
-
/** Receipt returned after a successful x402 payment. */
|
|
111
|
-
interface X402Receipt {
|
|
112
|
-
success: boolean;
|
|
113
|
-
paymentId: string;
|
|
114
|
-
txHash: string;
|
|
115
|
-
token: string;
|
|
116
|
-
amount: string;
|
|
117
|
-
to: string;
|
|
118
|
-
resourceUrl: string;
|
|
119
|
-
explorerUrl: string;
|
|
120
|
-
accepted?: X402PaymentOption;
|
|
121
|
-
paymentHeader?: string;
|
|
122
|
-
merchantTo?: string | null;
|
|
123
|
-
payer?: string;
|
|
124
|
-
chainId?: number;
|
|
125
|
-
haven?: {
|
|
126
|
-
paymentId: string;
|
|
127
|
-
fundingTxHash: string;
|
|
128
|
-
fundingExplorerUrl: string;
|
|
129
|
-
};
|
|
130
|
-
merchant?: {
|
|
131
|
-
payTo: string | null;
|
|
132
|
-
settlementTxHash?: string | null;
|
|
133
|
-
settlementExplorerUrl?: string | null;
|
|
134
|
-
};
|
|
135
|
-
x402?: {
|
|
136
|
-
amount: string;
|
|
137
|
-
token: string;
|
|
138
|
-
network: string;
|
|
139
|
-
asset: string;
|
|
140
|
-
resource: string;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
interface X402AuthorizationOptions {
|
|
144
|
-
/** Stable caller-supplied key for this user intent. Prevents duplicate approvals across fresh 402 quotes. */
|
|
145
|
-
idempotencyKey?: string;
|
|
146
|
-
}
|
|
147
|
-
/** Serializable HTTP request state for retrying the same x402 merchant request. */
|
|
148
|
-
interface X402RequestSnapshot {
|
|
149
|
-
url: string;
|
|
150
|
-
method: string;
|
|
151
|
-
headers: [string, string][];
|
|
152
|
-
body?: string;
|
|
153
|
-
}
|
|
154
|
-
/** Quote parsed from an HTTP 402 response without creating a Haven payment. */
|
|
155
|
-
interface X402Quote {
|
|
156
|
-
rail: 'x402';
|
|
157
|
-
idempotencyKey: string;
|
|
158
|
-
paymentRequired: X402PaymentRequired;
|
|
159
|
-
accepted: X402PaymentOption;
|
|
160
|
-
request: X402RequestSnapshot;
|
|
161
|
-
resourceUrl: string;
|
|
162
|
-
description: string | null;
|
|
163
|
-
mimeType: string | null;
|
|
164
|
-
amountAtomic: string;
|
|
165
|
-
amount: string;
|
|
166
|
-
token: string;
|
|
167
|
-
asset: string;
|
|
168
|
-
network: string;
|
|
169
|
-
chainId: number | null;
|
|
170
|
-
merchantAddress: string;
|
|
171
|
-
maxTimeoutSeconds: number;
|
|
172
|
-
}
|
|
173
|
-
/** State bundle an agent can persist while waiting for manual x402 approval. */
|
|
174
|
-
interface X402ResumeState {
|
|
175
|
-
rail: 'x402';
|
|
176
|
-
paymentId: string;
|
|
177
|
-
idempotencyKey: string;
|
|
178
|
-
paymentRequired: X402PaymentRequired;
|
|
179
|
-
accepted: X402PaymentOption;
|
|
180
|
-
url: string;
|
|
181
|
-
request?: X402RequestSnapshot;
|
|
182
|
-
resourceUrl: string;
|
|
183
|
-
description: string | null;
|
|
184
|
-
amountAtomic: string;
|
|
185
|
-
amount: string;
|
|
186
|
-
token: string;
|
|
187
|
-
asset: string;
|
|
188
|
-
network: string;
|
|
189
|
-
chainId: number | null;
|
|
190
|
-
merchantAddress: string;
|
|
191
|
-
}
|
|
192
|
-
interface MppAuthorizationOptions {
|
|
193
|
-
/** Stable caller-supplied key for this user intent. Prevents duplicate approvals across retries. */
|
|
194
|
-
idempotencyKey?: string;
|
|
195
|
-
}
|
|
196
|
-
/** Quote parsed from an MPP challenge without creating a Haven payment. */
|
|
197
|
-
interface MppQuote {
|
|
198
|
-
rail: 'mpp';
|
|
199
|
-
paymentRail: MachinePaymentRail;
|
|
200
|
-
idempotencyKey: string;
|
|
201
|
-
challenge: MachinePaymentChallenge;
|
|
202
|
-
request: X402RequestSnapshot;
|
|
203
|
-
resourceUrl: string;
|
|
204
|
-
description: string | null;
|
|
205
|
-
amountAtomic: string;
|
|
206
|
-
amount: string;
|
|
207
|
-
token: string;
|
|
208
|
-
asset: string;
|
|
209
|
-
network: string;
|
|
210
|
-
chainId: number;
|
|
211
|
-
merchantAddress: string;
|
|
212
|
-
expiresAt: string;
|
|
213
|
-
}
|
|
214
|
-
/** State bundle an agent can persist while waiting for manual MPP approval. */
|
|
215
|
-
interface MppResumeState {
|
|
216
|
-
rail: 'mpp';
|
|
217
|
-
paymentRail: MachinePaymentRail;
|
|
218
|
-
paymentId: string;
|
|
219
|
-
idempotencyKey: string;
|
|
220
|
-
challenge: MachinePaymentChallenge;
|
|
221
|
-
url: string;
|
|
222
|
-
request?: X402RequestSnapshot;
|
|
223
|
-
resourceUrl: string;
|
|
224
|
-
description: string | null;
|
|
225
|
-
amountAtomic: string;
|
|
226
|
-
amount: string;
|
|
227
|
-
token: string;
|
|
228
|
-
asset: string;
|
|
229
|
-
network: string;
|
|
230
|
-
chainId: number;
|
|
231
|
-
merchantAddress: string;
|
|
232
|
-
expiresAt: string;
|
|
233
|
-
}
|
|
234
|
-
type PaymentResumeState = X402ResumeState | MppResumeState;
|
|
235
|
-
interface ResumeAuthorizedX402Input extends X402AuthorizationOptions {
|
|
236
|
-
/** Payment or approval request ID returned by authorizeX402 / haven.fetch. */
|
|
237
|
-
paymentId: string;
|
|
238
|
-
/** Original or freshly parsed x402 requirements for the merchant retry. */
|
|
239
|
-
paymentRequired: X402PaymentRequired;
|
|
240
|
-
}
|
|
241
|
-
interface ResumeX402PaymentInput extends X402AuthorizationOptions {
|
|
242
|
-
/** Payment or approval request ID returned by authorizeX402 / haven.fetch. */
|
|
243
|
-
paymentId: string;
|
|
244
|
-
/** Original paid URL. If paymentRequired is omitted, Haven will call it once to re-read the 402 challenge. */
|
|
245
|
-
url: string;
|
|
246
|
-
/** Original fetch options. Reused for the 402 probe and final merchant retry. */
|
|
247
|
-
init?: RequestInit;
|
|
248
|
-
/** Serializable original request captured by quoteX402() / pending approval errors. */
|
|
249
|
-
request?: X402RequestSnapshot;
|
|
250
|
-
/** Original or freshly parsed x402 requirements. Supplying this avoids an extra merchant 402 probe. */
|
|
251
|
-
paymentRequired?: X402PaymentRequired;
|
|
252
|
-
}
|
|
253
|
-
interface ResumeAuthorizedMppInput extends MppAuthorizationOptions {
|
|
254
|
-
/** Payment or approval request ID returned by authorizeMachinePayment / haven.fetch. */
|
|
255
|
-
paymentId: string;
|
|
256
|
-
/** Original MPP challenge returned by the paid resource. */
|
|
257
|
-
challenge: MachinePaymentChallenge;
|
|
258
|
-
}
|
|
259
|
-
interface ResumeMppPaymentInput extends MppAuthorizationOptions {
|
|
260
|
-
/** Payment or approval request ID returned by authorizeMachinePayment / haven.fetch. */
|
|
261
|
-
paymentId: string;
|
|
262
|
-
/** Original paid URL. If challenge is omitted, Haven will call it once to re-read the MPP challenge. */
|
|
263
|
-
url: string;
|
|
264
|
-
/** Original fetch options. Reused for the 402 probe and final merchant retry. */
|
|
265
|
-
init?: RequestInit;
|
|
266
|
-
/** Serializable original request captured by quoteMpp() / pending approval errors. */
|
|
267
|
-
request?: X402RequestSnapshot;
|
|
268
|
-
/** Original MPP challenge. Supplying this avoids an extra paid-resource 402 probe. */
|
|
269
|
-
challenge?: MachinePaymentChallenge;
|
|
270
|
-
}
|
|
271
|
-
type MachinePaymentRail = 'x402' | 'mpp_demo' | 'mpp_crypto' | 'stripe_deposit' | 'spt';
|
|
272
|
-
interface MachinePaymentChallenge {
|
|
273
|
-
rail: MachinePaymentRail;
|
|
274
|
-
version: string;
|
|
275
|
-
challengeId: string;
|
|
276
|
-
resource: string;
|
|
277
|
-
description: string;
|
|
278
|
-
network: {
|
|
279
|
-
chainId: number;
|
|
280
|
-
name: 'base';
|
|
281
|
-
};
|
|
282
|
-
asset: {
|
|
283
|
-
symbol: 'USDC';
|
|
284
|
-
address: string;
|
|
285
|
-
decimals: 6;
|
|
286
|
-
};
|
|
287
|
-
amount: {
|
|
288
|
-
display: string;
|
|
289
|
-
atomic: string;
|
|
290
|
-
};
|
|
291
|
-
recipient: string;
|
|
292
|
-
expiresAt: string;
|
|
293
|
-
metadata?: Record<string, unknown>;
|
|
294
|
-
}
|
|
295
|
-
interface MachinePaymentReceipt {
|
|
296
|
-
success: boolean;
|
|
297
|
-
rail: MachinePaymentRail;
|
|
298
|
-
paymentId: string;
|
|
299
|
-
challengeId: string;
|
|
300
|
-
txHash: string;
|
|
301
|
-
token: string;
|
|
302
|
-
amount: string;
|
|
303
|
-
to: string;
|
|
304
|
-
resourceUrl: string;
|
|
305
|
-
explorerUrl: string;
|
|
306
|
-
payer?: string;
|
|
307
|
-
chainId?: number;
|
|
308
|
-
proofHeader: string;
|
|
309
|
-
}
|
|
310
|
-
interface HavenAgent {
|
|
311
|
-
id: string;
|
|
312
|
-
name: string;
|
|
313
|
-
status: string;
|
|
314
|
-
safeAddress: string;
|
|
315
|
-
delegateAddress: string;
|
|
316
|
-
chainId: number;
|
|
317
|
-
}
|
|
318
|
-
interface HavenAllowance {
|
|
319
|
-
id: string;
|
|
320
|
-
tokenAddress: string;
|
|
321
|
-
tokenSymbol: string;
|
|
322
|
-
configuredAmount: string;
|
|
323
|
-
resetPeriodMin: number;
|
|
324
|
-
onchain: {
|
|
325
|
-
amount: string;
|
|
326
|
-
spent: string;
|
|
327
|
-
remaining: string;
|
|
328
|
-
effectiveSpent: string;
|
|
329
|
-
resetTimeMin: number;
|
|
330
|
-
lastResetMin: number;
|
|
331
|
-
nonce: number;
|
|
332
|
-
isResetPending: boolean;
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
interface HavenAllowanceSummary {
|
|
336
|
-
agentId: string;
|
|
337
|
-
safeAddress: string;
|
|
338
|
-
delegateAddress: string;
|
|
339
|
-
chainId: number;
|
|
340
|
-
allowances: HavenAllowance[];
|
|
341
|
-
}
|
|
342
|
-
interface HavenPaymentReceipt {
|
|
343
|
-
id: string;
|
|
344
|
-
paymentId: string;
|
|
345
|
-
rail: string;
|
|
346
|
-
proofStatus: string;
|
|
347
|
-
txHash: string;
|
|
348
|
-
chainId: number;
|
|
349
|
-
resourceUrl: string;
|
|
350
|
-
merchantAddress: string | null;
|
|
351
|
-
payerAddress: string;
|
|
352
|
-
settlementAddress: string;
|
|
353
|
-
tokenSymbol: string;
|
|
354
|
-
tokenAddress: string;
|
|
355
|
-
amountRaw: string;
|
|
356
|
-
amount: string;
|
|
357
|
-
challengeId: string | null;
|
|
358
|
-
idempotencyKey: string | null;
|
|
359
|
-
challengePayload?: Record<string, unknown> | null;
|
|
360
|
-
selectedPayment?: Record<string, unknown> | null;
|
|
361
|
-
paymentProofHeaderName: string | null;
|
|
362
|
-
protocolReceiptHeaderName: string | null;
|
|
363
|
-
protocolReceiptPayload?: Record<string, unknown> | null;
|
|
364
|
-
merchantStatus: number | null;
|
|
365
|
-
confirmedAt: string | null;
|
|
366
|
-
createdAt: string;
|
|
367
|
-
updatedAt: string;
|
|
368
|
-
}
|
|
369
|
-
type PaymentStateKind = 'payment_intent' | 'approval_request';
|
|
370
|
-
interface AgentPaymentEnumSchema {
|
|
371
|
-
type: 'string';
|
|
372
|
-
enum: readonly string[];
|
|
373
|
-
description: string;
|
|
374
|
-
'x-enumDescriptions': Record<string, string>;
|
|
375
|
-
}
|
|
376
|
-
declare const AgentPaymentPhase: {
|
|
377
|
-
/** The agent must sign and submit the prepared payment before Haven can relay it. */
|
|
378
|
-
readonly AgentSignatureRequired: "agent_signature_required";
|
|
379
|
-
/** Haven has received the signed payment and the agent should poll for confirmation. */
|
|
380
|
-
readonly PaymentSubmitted: "payment_submitted";
|
|
381
|
-
/** The direct payment is confirmed; the agent does not need to do more for this payment id. */
|
|
382
|
-
readonly PaymentConfirmed: "payment_confirmed";
|
|
383
|
-
/** The payment needs wallet owner approval in Haven before it can continue. */
|
|
384
|
-
readonly UserApprovalRequired: "user_approval_required";
|
|
385
|
-
/** The wallet owner approved the request and still needs to complete the funding payment. */
|
|
386
|
-
readonly UserExecutionRequired: "user_execution_required";
|
|
387
|
-
/** The funding payment was proposed and is waiting for the remaining account approvals. */
|
|
388
|
-
readonly WaitingForAdditionalApprovals: "waiting_for_additional_approvals";
|
|
389
|
-
/** The Haven funding leg was sent; the agent can continue the merchant/protocol leg. */
|
|
390
|
-
readonly FundingSent: "funding_sent";
|
|
391
|
-
/** The wallet owner rejected the request; the agent should stop and tell the user. */
|
|
392
|
-
readonly Rejected: "rejected";
|
|
393
|
-
/** The payment or approval request expired before completion. */
|
|
394
|
-
readonly Expired: "expired";
|
|
395
|
-
/** Haven could not complete the payment; the agent should stop and surface the failure. */
|
|
396
|
-
readonly Failed: "failed";
|
|
397
|
-
};
|
|
398
|
-
type AgentPaymentPhase = (typeof AgentPaymentPhase)[keyof typeof AgentPaymentPhase];
|
|
399
|
-
declare const AgentPaymentNextAction: {
|
|
400
|
-
/** Sign with the delegate key and submit the payment to Haven. */
|
|
401
|
-
readonly SignAndSubmitPayment: "sign_and_submit_payment";
|
|
402
|
-
/** Poll getPaymentStatus later using this payment id. */
|
|
403
|
-
readonly CheckStatusLater: "check_status_later";
|
|
404
|
-
/** No further agent action is required for this payment id. */
|
|
405
|
-
readonly None: "none";
|
|
406
|
-
/** Wait for the wallet owner to approve or reject the request in Haven. */
|
|
407
|
-
readonly WaitForUserApproval: "wait_for_user_approval";
|
|
408
|
-
/** Wait for the wallet owner to finish sending the approved funding payment. */
|
|
409
|
-
readonly WaitForUserToCompletePayment: "wait_for_user_to_complete_payment";
|
|
410
|
-
/** Resume this payment id and retry the original x402 request with the merchant payment header. */
|
|
411
|
-
readonly RetryOriginalX402Request: "retry_original_x402_request";
|
|
412
|
-
/** Stop retrying this payment and tell the user what happened. */
|
|
413
|
-
readonly StopAndTellUser: "stop_and_tell_user";
|
|
414
|
-
/** Ask again only if the user still wants the payment after expiry. */
|
|
415
|
-
readonly RequestAgainIfUserStillWantsIt: "request_again_if_user_still_wants_it";
|
|
416
|
-
};
|
|
417
|
-
type AgentPaymentNextAction = (typeof AgentPaymentNextAction)[keyof typeof AgentPaymentNextAction];
|
|
418
|
-
declare const AgentPaymentRail: {
|
|
419
|
-
/** Standard Haven payment from the user's Safe through an approved delegate allowance. */
|
|
420
|
-
readonly Direct: "direct";
|
|
421
|
-
/** x402 HTTP 402 payment flow with a Haven funding leg and merchant retry leg. */
|
|
422
|
-
readonly X402: "x402";
|
|
423
|
-
/** Machine Payment Protocol flow. */
|
|
424
|
-
readonly Mpp: "mpp";
|
|
425
|
-
};
|
|
426
|
-
type AgentPaymentRail = (typeof AgentPaymentRail)[keyof typeof AgentPaymentRail];
|
|
427
|
-
type PaymentPhase = AgentPaymentPhase;
|
|
428
|
-
type PaymentNextAction = AgentPaymentNextAction;
|
|
429
|
-
declare const AGENT_PAYMENT_PHASE_VALUES: ("rejected" | "expired" | "failed" | "agent_signature_required" | "payment_submitted" | "payment_confirmed" | "user_approval_required" | "user_execution_required" | "waiting_for_additional_approvals" | "funding_sent")[];
|
|
430
|
-
declare const AGENT_PAYMENT_NEXT_ACTION_VALUES: ("sign_and_submit_payment" | "check_status_later" | "none" | "wait_for_user_approval" | "wait_for_user_to_complete_payment" | "retry_original_x402_request" | "stop_and_tell_user" | "request_again_if_user_still_wants_it")[];
|
|
431
|
-
declare const AGENT_PAYMENT_RAIL_VALUES: ("x402" | "mpp" | "direct")[];
|
|
432
|
-
declare const AgentPaymentPhaseDescriptions: Record<AgentPaymentPhase, string>;
|
|
433
|
-
declare const AgentPaymentNextActionDescriptions: Record<AgentPaymentNextAction, string>;
|
|
434
|
-
declare const AgentPaymentRailDescriptions: Record<AgentPaymentRail, string>;
|
|
435
|
-
declare const AgentPaymentPhaseSchema: AgentPaymentEnumSchema;
|
|
436
|
-
declare const AgentPaymentNextActionSchema: AgentPaymentEnumSchema;
|
|
437
|
-
declare const AgentPaymentRailSchema: AgentPaymentEnumSchema;
|
|
438
|
-
interface PaymentStatusResult {
|
|
439
|
-
paymentId: string;
|
|
440
|
-
kind: PaymentStateKind;
|
|
441
|
-
rail: string;
|
|
442
|
-
status: PaymentStatus | string;
|
|
443
|
-
phase: PaymentPhase;
|
|
444
|
-
nextAction: PaymentNextAction;
|
|
445
|
-
amount: string;
|
|
446
|
-
token: string;
|
|
447
|
-
resourceUrl: string | null;
|
|
448
|
-
merchantAddress: string | null;
|
|
449
|
-
txHash: string | null;
|
|
450
|
-
expiresAt: string;
|
|
451
|
-
chainId: number;
|
|
452
|
-
message: string;
|
|
453
|
-
amountAtomic?: string | null;
|
|
454
|
-
asset?: string | null;
|
|
455
|
-
network?: string | null;
|
|
456
|
-
description?: string | null;
|
|
457
|
-
idempotencyKey?: string | null;
|
|
458
|
-
x402?: {
|
|
459
|
-
amountAtomic: string | null;
|
|
460
|
-
asset: string | null;
|
|
461
|
-
network: string | null;
|
|
462
|
-
resourceUrl: string | null;
|
|
463
|
-
merchantAddress: string | null;
|
|
464
|
-
description: string | null;
|
|
465
|
-
idempotencyKey: string | null;
|
|
466
|
-
};
|
|
467
|
-
mpp?: {
|
|
468
|
-
amountAtomic: string | null;
|
|
469
|
-
asset: string | null;
|
|
470
|
-
network: string | null;
|
|
471
|
-
resourceUrl: string | null;
|
|
472
|
-
merchantAddress: string | null;
|
|
473
|
-
description: string | null;
|
|
474
|
-
idempotencyKey: string | null;
|
|
475
|
-
challengeId: string | null;
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
interface PendingApproval extends PaymentStatusResult {
|
|
479
|
-
kind: 'approval_request';
|
|
480
|
-
status: 'pending_approval' | 'pending' | string;
|
|
481
|
-
phase: typeof AgentPaymentPhase.UserApprovalRequired;
|
|
482
|
-
nextAction: typeof AgentPaymentNextAction.WaitForUserApproval;
|
|
483
|
-
requested?: string;
|
|
484
|
-
remaining?: string | null;
|
|
485
|
-
}
|
|
486
|
-
declare class HavenError extends Error {
|
|
487
|
-
readonly code: string;
|
|
488
|
-
readonly statusCode?: number | undefined;
|
|
489
|
-
readonly paymentId?: string | undefined;
|
|
490
|
-
constructor(message: string, code: string, statusCode?: number | undefined, paymentId?: string | undefined);
|
|
491
|
-
}
|
|
492
|
-
declare class HavenApiError extends HavenError {
|
|
493
|
-
readonly body?: unknown | undefined;
|
|
494
|
-
constructor(message: string, statusCode: number, body?: unknown | undefined, paymentId?: string);
|
|
495
|
-
}
|
|
496
|
-
declare class HavenPaymentStateError extends HavenApiError {
|
|
497
|
-
readonly state: PaymentStatusResult;
|
|
498
|
-
resumeState?: X402ResumeState | MppResumeState;
|
|
499
|
-
constructor(message: string, statusCode: number, state: PaymentStatusResult, body?: unknown);
|
|
500
|
-
get status(): string;
|
|
501
|
-
get phase(): PaymentPhase;
|
|
502
|
-
get nextAction(): PaymentNextAction;
|
|
503
|
-
}
|
|
504
|
-
declare class HavenSigningError extends HavenError {
|
|
505
|
-
constructor(message: string);
|
|
506
|
-
}
|
|
507
|
-
declare class HavenTimeoutError extends HavenError {
|
|
508
|
-
constructor(paymentId: string);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
declare class HavenClient {
|
|
512
|
-
private readonly apiKey;
|
|
513
|
-
private readonly delegateKey;
|
|
514
|
-
private readonly baseUrl;
|
|
515
|
-
private readonly x402Wallet;
|
|
516
|
-
private readonly requestTimeout;
|
|
517
|
-
private readonly confirmationTimeout;
|
|
518
|
-
private readonly pollingInterval;
|
|
519
|
-
private readonly inFlightX402;
|
|
520
|
-
private readonly x402ReceiptCache;
|
|
521
|
-
private readonly inFlightMachinePayments;
|
|
522
|
-
/**
|
|
523
|
-
* Setup-time headers configured via `HavenClientConfig.defaultHeaders`.
|
|
524
|
-
* Read-only after construction — use `withRequestContext` for per-call
|
|
525
|
-
* scoping so concurrent requests don't race on shared mutable state.
|
|
526
|
-
*/
|
|
527
|
-
private readonly defaultHeaders;
|
|
528
|
-
/**
|
|
529
|
-
* Async-local store for per-request context (currently: extra headers).
|
|
530
|
-
* Each `withRequestContext` invocation produces an isolated store, so
|
|
531
|
-
* overlapping async work — like two MCP tool dispatches in flight at
|
|
532
|
-
* the same time — see their own headers without stepping on each other.
|
|
533
|
-
*/
|
|
534
|
-
private readonly requestContext;
|
|
535
|
-
/** Delegate address derived from the private key (if provided) */
|
|
536
|
-
readonly delegateAddress: string | undefined;
|
|
537
|
-
constructor(config: HavenClientConfig);
|
|
538
|
-
/**
|
|
539
|
-
* Run `fn` with extra Haven-API headers scoped to the async work it
|
|
540
|
-
* performs. Used by the MCP server to tag every Haven API request that
|
|
541
|
-
* a single tool dispatch makes with `X-Haven-MCP-Tool: <name>` so the
|
|
542
|
-
* backend can write an audit-log row attributing the call.
|
|
543
|
-
*
|
|
544
|
-
* The headers are held in an `AsyncLocalStorage` so overlapping
|
|
545
|
-
* dispatches do not leak headers into each other's requests. The store
|
|
546
|
-
* inherits across `await` boundaries, so any Haven API call made while
|
|
547
|
-
* `fn` is awaiting will pick up the right headers.
|
|
548
|
-
*
|
|
549
|
-
* Has no effect on outbound merchant requests (x402 / MPP) — those
|
|
550
|
-
* never go through the internal `request<T>` path that reads the
|
|
551
|
-
* context.
|
|
552
|
-
*/
|
|
553
|
-
withRequestContext<T>(headers: Record<string, string>, fn: () => Promise<T>): Promise<T>;
|
|
554
|
-
/**
|
|
555
|
-
* Send a payment in one call.
|
|
556
|
-
*
|
|
557
|
-
* Creates the intent, signs the hash, submits the signature,
|
|
558
|
-
* and polls until confirmed (or throws on failure/timeout).
|
|
559
|
-
*
|
|
560
|
-
* Requires `delegateKey` to be set in the client config.
|
|
561
|
-
*/
|
|
562
|
-
pay(request: PaymentRequest): Promise<PaymentResult>;
|
|
563
|
-
/**
|
|
564
|
-
* Step 1: Create a payment intent.
|
|
565
|
-
*
|
|
566
|
-
* Returns the intent with the hash to sign.
|
|
567
|
-
*/
|
|
568
|
-
createIntent(request: PaymentRequest): Promise<PaymentIntent>;
|
|
569
|
-
/**
|
|
570
|
-
* Step 2: Sign a hash with the delegate key.
|
|
571
|
-
*
|
|
572
|
-
* Returns the 65-byte signature (0x-prefixed).
|
|
573
|
-
* Requires `delegateKey` to be set in the client config.
|
|
574
|
-
*/
|
|
575
|
-
sign(hash: string): string;
|
|
576
|
-
/**
|
|
577
|
-
* Step 3: Submit a signature to execute the payment.
|
|
578
|
-
*
|
|
579
|
-
* The signature can come from `client.sign()` or from external signing.
|
|
580
|
-
*/
|
|
581
|
-
submitSignature(paymentId: string, signature: string): Promise<{
|
|
582
|
-
status: string;
|
|
583
|
-
txHash?: string;
|
|
584
|
-
}>;
|
|
585
|
-
/**
|
|
586
|
-
* Get the current status of a payment.
|
|
587
|
-
*/
|
|
588
|
-
getPayment(paymentId: string): Promise<PaymentResult>;
|
|
589
|
-
/**
|
|
590
|
-
* Get agent-actionable status for a payment intent or approval request.
|
|
591
|
-
*
|
|
592
|
-
* Use this for IDs returned by agent tools and machine-payment/x402 flows.
|
|
593
|
-
* `getPayment()` remains available for payment-intent-only integrations.
|
|
594
|
-
*/
|
|
595
|
-
getPaymentStatus(paymentId: string): Promise<PaymentStatusResult>;
|
|
596
|
-
/**
|
|
597
|
-
* Get the agent identity tied to this API key.
|
|
598
|
-
*/
|
|
599
|
-
getAgent(): Promise<HavenAgent>;
|
|
600
|
-
/**
|
|
601
|
-
* Get configured and on-chain allowances for the authenticated agent.
|
|
602
|
-
*/
|
|
603
|
-
getAllowances(): Promise<HavenAllowanceSummary>;
|
|
604
|
-
/**
|
|
605
|
-
* List recent machine-payment receipts/evidence for bookkeeping.
|
|
606
|
-
*/
|
|
607
|
-
listReceipts(options?: {
|
|
608
|
-
limit?: number;
|
|
609
|
-
}): Promise<HavenPaymentReceipt[]>;
|
|
610
|
-
/**
|
|
611
|
-
* Rehydrate the x402/MPP resume-state bundle for a payment id.
|
|
612
|
-
*
|
|
613
|
-
* The server returns stored protocol context only. The client still signs the
|
|
614
|
-
* merchant proof locally when resumeX402Payment() or resumeMppPayment() runs.
|
|
615
|
-
*/
|
|
616
|
-
getResumeState(paymentId: string): Promise<PaymentResumeState>;
|
|
617
|
-
/**
|
|
618
|
-
* Poll until a payment reaches a terminal status (confirmed, failed, expired).
|
|
619
|
-
*/
|
|
620
|
-
waitForConfirmation(paymentId: string): Promise<PaymentResult>;
|
|
621
|
-
/**
|
|
622
|
-
* Authorize an x402 payment.
|
|
623
|
-
*
|
|
624
|
-
* Takes the parsed PaymentRequired from a 402 response, selects a compatible
|
|
625
|
-
* option, funds the delegate wallet through Haven, and returns the standard
|
|
626
|
-
* x402 header that the merchant can verify and settle.
|
|
627
|
-
*
|
|
628
|
-
* Requires `delegateKey` to be set in the client config.
|
|
629
|
-
*/
|
|
630
|
-
authorizeX402(paymentRequired: X402PaymentRequired, options?: X402AuthorizationOptions): Promise<X402Receipt>;
|
|
631
|
-
/**
|
|
632
|
-
* Probe a paid endpoint and return its x402 quote without creating a Haven
|
|
633
|
-
* payment or approval request.
|
|
634
|
-
*/
|
|
635
|
-
quoteX402(url: string, init?: RequestInit, options?: X402AuthorizationOptions): Promise<X402Quote>;
|
|
636
|
-
/**
|
|
637
|
-
* Pay a previously inspected x402 quote and retry the exact captured request.
|
|
638
|
-
*/
|
|
639
|
-
payX402Quote(quote: X402Quote, options?: X402AuthorizationOptions): Promise<Response>;
|
|
640
|
-
private authorizeStandardX402;
|
|
641
|
-
resumeAuthorizedX402(input: ResumeAuthorizedX402Input): Promise<X402Receipt>;
|
|
642
|
-
resumeX402Payment(input: ResumeX402PaymentInput | X402ResumeState): Promise<Response>;
|
|
643
|
-
/**
|
|
644
|
-
* Fetch wrapper that automatically handles HTTP 402 responses.
|
|
645
|
-
*
|
|
646
|
-
* Works like the standard `fetch()` but intercepts 402 responses,
|
|
647
|
-
* pays via x402 through Haven, and retries the request.
|
|
648
|
-
*
|
|
649
|
-
* ```ts
|
|
650
|
-
* const response = await haven.fetch('https://paid-api.com/data')
|
|
651
|
-
* const data = await response.json()
|
|
652
|
-
* ```
|
|
653
|
-
*
|
|
654
|
-
* Requires `delegateKey` to be set in the client config.
|
|
655
|
-
*/
|
|
656
|
-
fetch(url: string, init?: RequestInit, options?: X402AuthorizationOptions): Promise<Response>;
|
|
657
|
-
/**
|
|
658
|
-
* Probe a paid MPP endpoint or inspect an existing challenge without creating
|
|
659
|
-
* a Haven payment or approval request.
|
|
660
|
-
*/
|
|
661
|
-
quoteMpp(challengeOrUrl: MachinePaymentChallenge | string, init?: RequestInit, options?: MppAuthorizationOptions): Promise<MppQuote>;
|
|
662
|
-
/**
|
|
663
|
-
* Pay a previously inspected MPP quote and retry the exact captured request.
|
|
664
|
-
*/
|
|
665
|
-
payMppChallenge(quote: MppQuote, options?: MppAuthorizationOptions): Promise<Response>;
|
|
666
|
-
private retryX402Request;
|
|
667
|
-
authorizeMachinePayment(challenge: MachinePaymentChallenge, options?: MppAuthorizationOptions): Promise<MachinePaymentReceipt>;
|
|
668
|
-
private authorizeMppDemoPayment;
|
|
669
|
-
resumeAuthorizedMpp(input: ResumeAuthorizedMppInput): Promise<MachinePaymentReceipt>;
|
|
670
|
-
resumeMppPayment(input: ResumeMppPaymentInput | MppResumeState): Promise<Response>;
|
|
671
|
-
private fetchWithMachinePayment;
|
|
672
|
-
private retryMppRequest;
|
|
673
|
-
private assertCanResumeX402;
|
|
674
|
-
private assertCanResumeMpp;
|
|
675
|
-
private mapX402ReceiptFromAuthorization;
|
|
676
|
-
private mapX402ReceiptFromStatus;
|
|
677
|
-
private buildX402Receipt;
|
|
678
|
-
private createStandardX402Header;
|
|
679
|
-
private cacheX402Receipt;
|
|
680
|
-
private mapMachinePaymentReceipt;
|
|
681
|
-
private mapMachinePaymentReceiptFromStatus;
|
|
682
|
-
private recordMerchantRetryRejected;
|
|
683
|
-
private reportMachinePaymentEvidence;
|
|
684
|
-
private throwIfNonSignableAuthorizationState;
|
|
685
|
-
private throwPaymentStateError;
|
|
686
|
-
private paymentStateFromRaw;
|
|
687
|
-
private x402PayerAddress;
|
|
688
|
-
private snapshotX402Request;
|
|
689
|
-
private snapshotRequestBody;
|
|
690
|
-
private requestInitFromSnapshot;
|
|
691
|
-
private withX402Wallet;
|
|
692
|
-
private buildX402Quote;
|
|
693
|
-
private buildX402ResumeState;
|
|
694
|
-
private buildMppQuote;
|
|
695
|
-
private buildMppResumeState;
|
|
696
|
-
private attachResumeState;
|
|
697
|
-
private attachX402ResumeState;
|
|
698
|
-
private attachMppResumeState;
|
|
699
|
-
/**
|
|
700
|
-
* Execute a tool call by name and input.
|
|
701
|
-
*
|
|
702
|
-
* Designed to plug directly into agent tool-call handlers:
|
|
703
|
-
*
|
|
704
|
-
* ```ts
|
|
705
|
-
* if (block.type === 'tool_use') {
|
|
706
|
-
* const result = await haven.executeTool(block.name, block.input)
|
|
707
|
-
* // send result back to the model
|
|
708
|
-
* }
|
|
709
|
-
* ```
|
|
710
|
-
*/
|
|
711
|
-
executeTool(toolName: string, input: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
712
|
-
private toolX402PaymentRequired;
|
|
713
|
-
private x402ToolReceipt;
|
|
714
|
-
private toolError;
|
|
715
|
-
private post;
|
|
716
|
-
private get;
|
|
717
|
-
private request;
|
|
718
|
-
private mapPaymentResult;
|
|
719
|
-
private mapPaymentStatusResult;
|
|
720
|
-
private mapPaymentReceipt;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* Pre-built tool definitions for AI agent frameworks.
|
|
725
|
-
*
|
|
726
|
-
* These definitions describe the `make_payment` and `get_payment_status` tools
|
|
727
|
-
* in the formats expected by Claude (Anthropic) and OpenAI.
|
|
728
|
-
*
|
|
729
|
-
* Usage with Claude:
|
|
730
|
-
* const response = await anthropic.messages.create({
|
|
731
|
-
* tools: havenTools.claude(),
|
|
732
|
-
* ...
|
|
733
|
-
* })
|
|
734
|
-
*
|
|
735
|
-
* Usage with OpenAI:
|
|
736
|
-
* const response = await openai.chat.completions.create({
|
|
737
|
-
* tools: havenTools.openai(),
|
|
738
|
-
* ...
|
|
739
|
-
* })
|
|
740
|
-
*/
|
|
741
|
-
interface ClaudeTool {
|
|
742
|
-
name: string;
|
|
743
|
-
description: string;
|
|
744
|
-
input_schema: {
|
|
745
|
-
type: 'object';
|
|
746
|
-
properties: Record<string, unknown>;
|
|
747
|
-
required: readonly string[];
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
declare function claudeTools(): ClaudeTool[];
|
|
751
|
-
interface OpenAITool {
|
|
752
|
-
type: 'function';
|
|
753
|
-
function: {
|
|
754
|
-
name: string;
|
|
755
|
-
description: string;
|
|
756
|
-
parameters: {
|
|
757
|
-
type: 'object';
|
|
758
|
-
properties: Record<string, unknown>;
|
|
759
|
-
required: readonly string[];
|
|
760
|
-
};
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
declare function openaiTools(): OpenAITool[];
|
|
764
|
-
declare const havenTools: {
|
|
765
|
-
/** Tool definitions in Anthropic/Claude format */
|
|
766
|
-
claude: typeof claudeTools;
|
|
767
|
-
/** Tool definitions in OpenAI function-calling format */
|
|
768
|
-
openai: typeof openaiTools;
|
|
769
|
-
};
|
|
770
|
-
|
|
771
|
-
/**
|
|
772
|
-
* Sign a hash using raw ECDSA (no Ethereum message prefix).
|
|
773
|
-
*
|
|
774
|
-
* This matches what Safe's AllowanceModule `checkSignature` expects —
|
|
775
|
-
* a direct ecrecover over the hash, NOT the "\x19Ethereum Signed Message" variant.
|
|
776
|
-
*
|
|
777
|
-
* Uses ethers.SigningKey.sign() instead of wallet.signMessage() to avoid the prefix.
|
|
778
|
-
*/
|
|
779
|
-
declare function signHash(privateKey: string, hash: string): string;
|
|
780
|
-
/**
|
|
781
|
-
* Derive the Ethereum address from a private key.
|
|
782
|
-
*/
|
|
783
|
-
declare function addressFromKey(privateKey: string): string;
|
|
784
|
-
/**
|
|
785
|
-
* Verify that a signature over a hash recovers to the expected address.
|
|
786
|
-
*/
|
|
787
|
-
declare function verifySignature(hash: string, signature: string, expectedAddress: string): boolean;
|
|
788
|
-
|
|
789
|
-
/**
|
|
790
|
-
* x402 protocol support for the Haven SDK.
|
|
791
|
-
*
|
|
792
|
-
* Provides:
|
|
793
|
-
* - parsePaymentRequired() — extract payment requirements from a 402 response
|
|
794
|
-
* - parsePaymentRequiredResponse() — async parser with JSON body fallback
|
|
795
|
-
* - encodePaymentProof() — encode a receipt as a PAYMENT-SIGNATURE header
|
|
796
|
-
*
|
|
797
|
-
* The main authorizeX402() and fetchWithPayment() are methods on HavenClient
|
|
798
|
-
* (see client.ts) since they need API access and signing.
|
|
799
|
-
*/
|
|
800
|
-
|
|
801
|
-
/**
|
|
802
|
-
* Parse an HTTP 402 response into x402 PaymentRequired data.
|
|
803
|
-
*
|
|
804
|
-
* Supports:
|
|
805
|
-
* - v2: PAYMENT-REQUIRED header (base64 JSON)
|
|
806
|
-
* - v1 fallback: X-PAYMENT header or response body
|
|
807
|
-
*/
|
|
808
|
-
declare function parsePaymentRequired(response: Response): X402PaymentRequired;
|
|
809
|
-
/**
|
|
810
|
-
* Parse an HTTP 402 response into x402 PaymentRequired data.
|
|
811
|
-
*
|
|
812
|
-
* Soundside and other Bazaar-style MCP endpoints return the PaymentRequired
|
|
813
|
-
* object in the JSON body, while older Haven demos and many x402 examples use
|
|
814
|
-
* base64 headers. This keeps the synchronous header parser intact and adds the
|
|
815
|
-
* body fallback needed for those endpoints.
|
|
816
|
-
*/
|
|
817
|
-
declare function parsePaymentRequiredResponse(response: Response): Promise<X402PaymentRequired>;
|
|
818
|
-
/**
|
|
819
|
-
* Select the best payment option from the x402 accepts array.
|
|
820
|
-
*
|
|
821
|
-
* Preference order:
|
|
822
|
-
* 1. Option on a Haven-supported network with a known token
|
|
823
|
-
* 2. Any option on a Haven-supported network
|
|
824
|
-
* 3. null — no compatible option
|
|
825
|
-
*/
|
|
826
|
-
declare function selectPaymentOption(accepts: X402PaymentOption[]): X402PaymentOption | null;
|
|
827
|
-
/**
|
|
828
|
-
* Encode a payment receipt as a base64 PAYMENT-SIGNATURE header value.
|
|
829
|
-
*
|
|
830
|
-
* This follows the x402 v2 protocol — the server's facilitator will
|
|
831
|
-
* verify the on-chain transaction referenced by tx_hash.
|
|
832
|
-
*/
|
|
833
|
-
declare function encodePaymentProof(receipt: {
|
|
834
|
-
txHash: string;
|
|
835
|
-
paymentId: string;
|
|
836
|
-
token: string;
|
|
837
|
-
amount: string;
|
|
838
|
-
to: string;
|
|
839
|
-
resourceUrl?: string;
|
|
840
|
-
accepted?: X402PaymentOption;
|
|
841
|
-
payer?: string;
|
|
842
|
-
chainId?: number;
|
|
843
|
-
}): string;
|
|
844
|
-
|
|
845
|
-
declare function parseMachinePaymentChallenge(response: Response): MachinePaymentChallenge;
|
|
846
|
-
declare function parseMachinePaymentChallengeResponse(response: Response): Promise<MachinePaymentChallenge>;
|
|
847
|
-
declare function buildMachinePaymentIdempotencyKey(challenge: MachinePaymentChallenge): string;
|
|
848
|
-
declare function encodeMachinePaymentProof(receipt: Omit<MachinePaymentReceipt, 'proofHeader'>): string;
|
|
849
|
-
|
|
850
|
-
export { AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, type AgentPaymentEnumSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, type ClaudeTool, type HavenAgent, type HavenAllowance, type HavenAllowanceSummary, HavenApiError, HavenClient, type HavenClientConfig, HavenError, type HavenPaymentReceipt, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, type MachinePaymentChallenge, type MachinePaymentRail, type MachinePaymentReceipt, type MppAuthorizationOptions, type MppQuote, type MppResumeState, type OpenAITool, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentRequest, type PaymentResult, type PaymentResumeState, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type ResumeAuthorizedMppInput, type ResumeAuthorizedX402Input, type ResumeMppPaymentInput, type ResumeX402PaymentInput, type SignData, type X402AuthorizationOptions, type X402PaymentOption, type X402PaymentRequired, type X402Quote, type X402Receipt, type X402RequestSnapshot, type X402ResumeState, addressFromKey, buildMachinePaymentIdempotencyKey, encodeMachinePaymentProof, encodePaymentProof, havenTools, parseMachinePaymentChallenge, parseMachinePaymentChallengeResponse, parsePaymentRequired, parsePaymentRequiredResponse, selectPaymentOption, signHash, verifySignature };
|