@haven_ai/sdk 0.11.0-alpha.0 → 0.13.0-alpha.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.
- package/README.md +37 -4
- package/dist/{base64-D4VZhgUg.d.ts → base64-C3mJNLYR.d.cts} +10 -2
- package/dist/{base64-DR4Gl8cD.d.cts → base64-CxzIc3KH.d.ts} +10 -2
- package/dist/{chunk-IKQIIMM6.cjs → chunk-4Z7PKLFD.cjs} +38 -37
- package/dist/chunk-4Z7PKLFD.cjs.map +1 -0
- package/dist/{chunk-34YJQFCM.js → chunk-CK6VRIPR.js} +3 -3
- package/dist/chunk-CK6VRIPR.js.map +1 -0
- package/dist/{chunk-ZDJ55LR7.js → chunk-CXQ42FOA.js} +7 -6
- package/dist/chunk-CXQ42FOA.js.map +1 -0
- package/dist/{chunk-MZKLAHBK.cjs → chunk-LZHCIK7L.cjs} +56 -4
- package/dist/chunk-LZHCIK7L.cjs.map +1 -0
- package/dist/{chunk-I7SL4A6X.js → chunk-MI7LVP56.js} +55 -5
- package/dist/chunk-MI7LVP56.js.map +1 -0
- package/dist/{chunk-DXBAN4SN.cjs → chunk-Z5MTKU6O.cjs} +4 -4
- package/dist/chunk-Z5MTKU6O.cjs.map +1 -0
- package/dist/edge.cjs +93 -93
- package/dist/edge.d.cts +11 -8
- package/dist/edge.d.ts +11 -8
- package/dist/edge.js +4 -4
- package/dist/index.cjs +456 -356
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -15
- package/dist/index.d.ts +26 -15
- package/dist/index.js +140 -48
- package/dist/index.js.map +1 -1
- package/dist/{receipt-CbD8L0WL.d.ts → receipt-CTOPh2fm.d.ts} +5 -4
- package/dist/{receipt-_bWCELEH.d.cts → receipt-DwRqGjGb.d.cts} +5 -4
- package/dist/test-support.cjs +58 -21
- package/dist/test-support.cjs.map +1 -1
- package/dist/test-support.d.cts +47 -3
- package/dist/test-support.d.ts +47 -3
- package/dist/test-support.js +37 -3
- package/dist/test-support.js.map +1 -1
- package/dist/{types-DKmvjXK6.d.cts → types-3vUBmumz.d.cts} +163 -2
- package/dist/{types-DKmvjXK6.d.ts → types-3vUBmumz.d.ts} +163 -2
- package/package.json +2 -2
- package/dist/chunk-34YJQFCM.js.map +0 -1
- package/dist/chunk-DXBAN4SN.cjs.map +0 -1
- package/dist/chunk-I7SL4A6X.js.map +0 -1
- package/dist/chunk-IKQIIMM6.cjs.map +0 -1
- package/dist/chunk-MZKLAHBK.cjs.map +0 -1
- package/dist/chunk-ZDJ55LR7.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk4Z7PKLFD_cjs = require('./chunk-4Z7PKLFD.cjs');
|
|
4
|
+
var chunkZ5MTKU6O_cjs = require('./chunk-Z5MTKU6O.cjs');
|
|
5
|
+
var chunkLZHCIK7L_cjs = require('./chunk-LZHCIK7L.cjs');
|
|
6
6
|
var viem = require('viem');
|
|
7
7
|
var ethers = require('ethers');
|
|
8
8
|
var async_hooks = require('async_hooks');
|
|
@@ -15,7 +15,7 @@ function signHash(privateKey, hash) {
|
|
|
15
15
|
const sig = signingKey.sign(hash);
|
|
16
16
|
return sig.serialized;
|
|
17
17
|
} catch (err) {
|
|
18
|
-
throw new
|
|
18
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
19
19
|
`Failed to sign hash: ${err instanceof Error ? err.message : String(err)}`
|
|
20
20
|
);
|
|
21
21
|
}
|
|
@@ -31,7 +31,7 @@ async function signTypedDataVerbatim(privateKey, typedData, label) {
|
|
|
31
31
|
typedData.message
|
|
32
32
|
);
|
|
33
33
|
} catch (err) {
|
|
34
|
-
throw new
|
|
34
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
35
35
|
`Failed to sign ${label}: ${err instanceof Error ? err.message : String(err)}`
|
|
36
36
|
);
|
|
37
37
|
}
|
|
@@ -46,7 +46,7 @@ function addressFromKey(privateKey) {
|
|
|
46
46
|
try {
|
|
47
47
|
return new ethers.ethers.Wallet(privateKey).address;
|
|
48
48
|
} catch (err) {
|
|
49
|
-
throw new
|
|
49
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
50
50
|
`Invalid private key: ${err instanceof Error ? err.message : String(err)}`
|
|
51
51
|
);
|
|
52
52
|
}
|
|
@@ -62,7 +62,7 @@ function verifySignature(hash, signature, expectedAddress) {
|
|
|
62
62
|
var DEFAULT_BASE_URL = "http://localhost:3001";
|
|
63
63
|
var DEFAULT_REQUEST_TIMEOUT = 3e4;
|
|
64
64
|
function withoutClientHeader(headers) {
|
|
65
|
-
const target =
|
|
65
|
+
const target = chunk4Z7PKLFD_cjs.HAVEN_CLIENT_HEADER.toLowerCase();
|
|
66
66
|
return Object.fromEntries(Object.entries(headers).filter(([name]) => name.toLowerCase() !== target));
|
|
67
67
|
}
|
|
68
68
|
var HavenApiTransport = class {
|
|
@@ -78,7 +78,7 @@ var HavenApiTransport = class {
|
|
|
78
78
|
this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
79
79
|
this.requestTimeout = config.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;
|
|
80
80
|
this.defaultHeaders = { ...config.defaultHeaders ?? {} };
|
|
81
|
-
this.clientIdentity = config.clientIdentity ??
|
|
81
|
+
this.clientIdentity = config.clientIdentity ?? chunk4Z7PKLFD_cjs.SDK_CLIENT_IDENTITY;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* The newest `client_update` the backend sent (#3303): inside a
|
|
@@ -91,7 +91,7 @@ var HavenApiTransport = class {
|
|
|
91
91
|
}
|
|
92
92
|
recordClientUpdate(data) {
|
|
93
93
|
if (data === null || typeof data !== "object" || Array.isArray(data)) return;
|
|
94
|
-
const hint =
|
|
94
|
+
const hint = chunk4Z7PKLFD_cjs.readClientUpdate(data.client_update);
|
|
95
95
|
if (!hint) return;
|
|
96
96
|
this.lastClientUpdate = hint;
|
|
97
97
|
const store = this.requestContext.getStore();
|
|
@@ -124,7 +124,7 @@ var HavenApiTransport = class {
|
|
|
124
124
|
// JOIN `x-haven-client` and `X-Haven-Client` into one unparseable
|
|
125
125
|
// value), so neither `defaultHeaders` nor a dispatch context can
|
|
126
126
|
// misname the client; `clientIdentity` is the one way to set it.
|
|
127
|
-
[
|
|
127
|
+
[chunk4Z7PKLFD_cjs.HAVEN_CLIENT_HEADER]: this.clientIdentity
|
|
128
128
|
},
|
|
129
129
|
body: body ? JSON.stringify(body) : void 0,
|
|
130
130
|
signal: controller.signal
|
|
@@ -137,17 +137,21 @@ var HavenApiTransport = class {
|
|
|
137
137
|
const rawDetails = record.details ?? record.detail;
|
|
138
138
|
const detailsText = typeof rawDetails === "string" ? rawDetails : rawDetails != null ? JSON.stringify(rawDetails) : void 0;
|
|
139
139
|
const message = errorText && detailsText ? `${errorText}: ${detailsText}` : errorText ?? detailsText ?? "API request failed";
|
|
140
|
-
throw new
|
|
140
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(message, res.status, data);
|
|
141
141
|
}
|
|
142
142
|
return data;
|
|
143
143
|
} catch (err) {
|
|
144
|
-
if (err instanceof
|
|
144
|
+
if (err instanceof chunkLZHCIK7L_cjs.HavenApiError) throw err;
|
|
145
|
+
const failureCause = { kind: "no_answer", method };
|
|
145
146
|
if (err instanceof Error && err.name === "AbortError") {
|
|
146
|
-
throw new
|
|
147
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(`Request to ${path} timed out`, 408, void 0, void 0, failureCause);
|
|
147
148
|
}
|
|
148
|
-
throw new
|
|
149
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
149
150
|
`Request to ${path} failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
150
|
-
0
|
|
151
|
+
0,
|
|
152
|
+
void 0,
|
|
153
|
+
void 0,
|
|
154
|
+
failureCause
|
|
151
155
|
);
|
|
152
156
|
} finally {
|
|
153
157
|
clearTimeout(timeout);
|
|
@@ -168,13 +172,13 @@ async function fetchUnsignedTaxDeclaration(client) {
|
|
|
168
172
|
if (reason === "feature_disabled" || reason === "disabled" || reason === "no_company_details" || reason === "vies_not_valid") {
|
|
169
173
|
return { available: false, reason };
|
|
170
174
|
}
|
|
171
|
-
throw new
|
|
175
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
172
176
|
"The tax-declaration endpoint answered a body that is neither the \xA72.1 content nor a named unavailability reason.",
|
|
173
177
|
502
|
|
174
178
|
);
|
|
175
179
|
}
|
|
176
180
|
async function resolveTaxDeclarationHeader(client, input) {
|
|
177
|
-
if (
|
|
181
|
+
if (chunk4Z7PKLFD_cjs.isErc7710Option(input.accepted)) {
|
|
178
182
|
return { header: void 0 };
|
|
179
183
|
}
|
|
180
184
|
let content;
|
|
@@ -186,7 +190,7 @@ async function resolveTaxDeclarationHeader(client, input) {
|
|
|
186
190
|
if (!content.available) {
|
|
187
191
|
return { header: void 0 };
|
|
188
192
|
}
|
|
189
|
-
const signed =
|
|
193
|
+
const signed = chunk4Z7PKLFD_cjs.buildSignedTaxDeclaration({
|
|
190
194
|
content: content.declaration,
|
|
191
195
|
network: input.accepted.network,
|
|
192
196
|
delegateKey: input.delegateKey
|
|
@@ -195,19 +199,19 @@ async function resolveTaxDeclarationHeader(client, input) {
|
|
|
195
199
|
`[haven-sdk] signing x402 tax declaration taxId=${JSON.stringify(content.declaration.taxId)} jurisdiction=${JSON.stringify(content.declaration.jurisdiction)} principalId=${signed.declaration.principalId}
|
|
196
200
|
`
|
|
197
201
|
);
|
|
198
|
-
return { header:
|
|
202
|
+
return { header: chunk4Z7PKLFD_cjs.encodeTaxDeclarationHeader(signed) };
|
|
199
203
|
}
|
|
200
204
|
function withTaxDeclarationHeader(init, header) {
|
|
201
205
|
if (!header) {
|
|
202
|
-
if (init?.headers && new Headers(init.headers).has(
|
|
206
|
+
if (init?.headers && new Headers(init.headers).has(chunk4Z7PKLFD_cjs.X_TAX_DECLARATION_HEADER)) {
|
|
203
207
|
const headers2 = new Headers(init.headers);
|
|
204
|
-
headers2.delete(
|
|
208
|
+
headers2.delete(chunk4Z7PKLFD_cjs.X_TAX_DECLARATION_HEADER);
|
|
205
209
|
return { ...init, headers: headers2 };
|
|
206
210
|
}
|
|
207
211
|
return init ?? {};
|
|
208
212
|
}
|
|
209
213
|
const headers = new Headers(init?.headers);
|
|
210
|
-
headers.set(
|
|
214
|
+
headers.set(chunk4Z7PKLFD_cjs.X_TAX_DECLARATION_HEADER, header);
|
|
211
215
|
return { ...init, headers };
|
|
212
216
|
}
|
|
213
217
|
|
|
@@ -281,6 +285,10 @@ function mapPaymentStatusResult(raw) {
|
|
|
281
285
|
// carried through even when `null` (a real, known answer).
|
|
282
286
|
...raw.settlement_scheme !== void 0 ? { settlementScheme: raw.settlement_scheme } : {},
|
|
283
287
|
...raw.merchant_settlement_recorded === true ? { merchantSettlementRecorded: true } : {},
|
|
288
|
+
// #4530: the recorded transaction itself — absent from the raw payload
|
|
289
|
+
// (older backend, or nothing recorded) stays absent here, so the field
|
|
290
|
+
// never claims a hash the backend did not record.
|
|
291
|
+
...typeof raw.merchant_settlement_tx_hash === "string" ? { merchantSettlementTxHash: raw.merchant_settlement_tx_hash } : {},
|
|
284
292
|
// #3494: additive, mirrors the backend's own `status === 'failed'` gate —
|
|
285
293
|
// absent from the raw payload (older backend, or any non-failed status)
|
|
286
294
|
// stays absent here.
|
|
@@ -353,6 +361,30 @@ function mapPaymentReceipt(raw) {
|
|
|
353
361
|
if ("approval_request_id" in raw) {
|
|
354
362
|
receipt.approvalRequestId = raw.approval_request_id ?? null;
|
|
355
363
|
}
|
|
364
|
+
if ("settlement_scheme" in raw) {
|
|
365
|
+
receipt.settlementScheme = raw.settlement_scheme ?? null;
|
|
366
|
+
}
|
|
367
|
+
if ("budget_delegation_hash" in raw) {
|
|
368
|
+
receipt.budgetDelegationHash = raw.budget_delegation_hash ?? null;
|
|
369
|
+
}
|
|
370
|
+
if ("delivery_quality" in raw) {
|
|
371
|
+
receipt.deliveryQuality = raw.delivery_quality ?? null;
|
|
372
|
+
}
|
|
373
|
+
if ("delivery_note" in raw) {
|
|
374
|
+
receipt.deliveryNote = raw.delivery_note ?? null;
|
|
375
|
+
}
|
|
376
|
+
if ("delivery_reported_at" in raw) {
|
|
377
|
+
receipt.deliveryReportedAt = raw.delivery_reported_at ?? null;
|
|
378
|
+
}
|
|
379
|
+
if ("delivery_reference" in raw) {
|
|
380
|
+
receipt.deliveryReference = raw.delivery_reference ?? null;
|
|
381
|
+
}
|
|
382
|
+
if ("purchase_group_id" in raw) {
|
|
383
|
+
receipt.purchaseGroupId = raw.purchase_group_id ?? null;
|
|
384
|
+
}
|
|
385
|
+
if ("parent_payment_id" in raw) {
|
|
386
|
+
receipt.parentPaymentId = raw.parent_payment_id ?? null;
|
|
387
|
+
}
|
|
356
388
|
return receipt;
|
|
357
389
|
}
|
|
358
390
|
|
|
@@ -373,29 +405,29 @@ function paymentStateStatusCode(status, fallback = 502) {
|
|
|
373
405
|
return PAYMENT_STATE_STATUS_CODES[status] ?? fallback;
|
|
374
406
|
}
|
|
375
407
|
function phaseForStatus(status) {
|
|
376
|
-
if (status === "pending_signature") return
|
|
377
|
-
if (status === "submitted") return
|
|
378
|
-
if (status === "confirmed") return
|
|
379
|
-
if (status === "pending" || status === "pending_approval") return
|
|
380
|
-
if (status === "approved") return
|
|
381
|
-
if (status === "proposed") return
|
|
382
|
-
if (status === "executed") return
|
|
383
|
-
if (status === "rejected") return
|
|
384
|
-
if (status === "expired") return
|
|
385
|
-
if (status === "failed") return
|
|
408
|
+
if (status === "pending_signature") return chunkLZHCIK7L_cjs.AgentPaymentPhase.AgentSignatureRequired;
|
|
409
|
+
if (status === "submitted") return chunkLZHCIK7L_cjs.AgentPaymentPhase.PaymentSubmitted;
|
|
410
|
+
if (status === "confirmed") return chunkLZHCIK7L_cjs.AgentPaymentPhase.PaymentConfirmed;
|
|
411
|
+
if (status === "pending" || status === "pending_approval") return chunkLZHCIK7L_cjs.AgentPaymentPhase.UserApprovalRequired;
|
|
412
|
+
if (status === "approved") return chunkLZHCIK7L_cjs.AgentPaymentPhase.UserExecutionRequired;
|
|
413
|
+
if (status === "proposed") return chunkLZHCIK7L_cjs.AgentPaymentPhase.WaitingForAdditionalApprovals;
|
|
414
|
+
if (status === "executed") return chunkLZHCIK7L_cjs.AgentPaymentPhase.FundingSent;
|
|
415
|
+
if (status === "rejected") return chunkLZHCIK7L_cjs.AgentPaymentPhase.Rejected;
|
|
416
|
+
if (status === "expired") return chunkLZHCIK7L_cjs.AgentPaymentPhase.Expired;
|
|
417
|
+
if (status === "failed") return chunkLZHCIK7L_cjs.AgentPaymentPhase.Failed;
|
|
386
418
|
return null;
|
|
387
419
|
}
|
|
388
420
|
function nextActionForStatus(status) {
|
|
389
|
-
if (status === "pending_signature") return
|
|
390
|
-
if (status === "submitted") return
|
|
391
|
-
if (status === "confirmed") return
|
|
392
|
-
if (status === "pending" || status === "pending_approval") return
|
|
393
|
-
if (status === "approved") return
|
|
394
|
-
if (status === "proposed") return
|
|
395
|
-
if (status === "executed") return
|
|
396
|
-
if (status === "rejected") return
|
|
397
|
-
if (status === "expired") return
|
|
398
|
-
if (status === "failed") return
|
|
421
|
+
if (status === "pending_signature") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.SignAndSubmitPayment;
|
|
422
|
+
if (status === "submitted") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.CheckStatusLater;
|
|
423
|
+
if (status === "confirmed") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.None;
|
|
424
|
+
if (status === "pending" || status === "pending_approval") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
425
|
+
if (status === "approved") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
426
|
+
if (status === "proposed") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
427
|
+
if (status === "executed") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
428
|
+
if (status === "rejected") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
429
|
+
if (status === "expired") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.RequestAgainIfUserStillWantsIt;
|
|
430
|
+
if (status === "failed") return chunkLZHCIK7L_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
399
431
|
return null;
|
|
400
432
|
}
|
|
401
433
|
function messageForState(label, status, paymentId, nextAction) {
|
|
@@ -469,17 +501,17 @@ function throwPaymentStateError(label, raw) {
|
|
|
469
501
|
const statusCode = paymentStateStatusCode(raw.status);
|
|
470
502
|
const state = paymentStateFromRaw(label, raw);
|
|
471
503
|
if (state) {
|
|
472
|
-
throw new
|
|
504
|
+
throw new chunkLZHCIK7L_cjs.HavenPaymentStateError(state.message, statusCode, state, raw);
|
|
473
505
|
}
|
|
474
506
|
if (raw.status === "pending_approval") {
|
|
475
|
-
throw
|
|
507
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic(
|
|
476
508
|
`${label} exceeds the agent's on-chain budget and was declined; no approval is pending and none will arrive (payment_id: ${raw.payment_id}).`,
|
|
477
509
|
statusCode,
|
|
478
510
|
raw
|
|
479
511
|
);
|
|
480
512
|
}
|
|
481
513
|
if (raw.status === "expired") {
|
|
482
|
-
throw new
|
|
514
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
483
515
|
`${label} expired before it could be completed (payment_id: ${raw.payment_id}).`,
|
|
484
516
|
statusCode,
|
|
485
517
|
raw
|
|
@@ -487,7 +519,8 @@ function throwPaymentStateError(label, raw) {
|
|
|
487
519
|
}
|
|
488
520
|
const paymentId = raw.payment_id ? ` (payment_id: ${raw.payment_id})` : "";
|
|
489
521
|
const message = raw.error ?? `${label} ${raw.status}${paymentId}`;
|
|
490
|
-
throw
|
|
522
|
+
if (statusCode >= 500) throw chunkLZHCIK7L_cjs.HavenApiError.deterministic(message, statusCode, raw);
|
|
523
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(message, statusCode, raw);
|
|
491
524
|
}
|
|
492
525
|
|
|
493
526
|
// src/x402-retry-target.ts
|
|
@@ -519,7 +552,7 @@ function isSecureX402RetryTarget(url) {
|
|
|
519
552
|
return RESERVED_SUFFIXES.some((suffix) => host.endsWith(suffix));
|
|
520
553
|
}
|
|
521
554
|
var INSECURE_RETRY_TARGET_CODE = "INSECURE_RETRY_TARGET";
|
|
522
|
-
var HavenInsecureRetryTargetError = class extends
|
|
555
|
+
var HavenInsecureRetryTargetError = class extends chunkLZHCIK7L_cjs.HavenError {
|
|
523
556
|
constructor(url) {
|
|
524
557
|
super(
|
|
525
558
|
`Refusing to send a payment header to ${url}: the paid x402 retry must go to an https URL (or a loopback / reserved test host). The merchant's challenge declared this resource URL; retry with the https URL you quoted (pass it as \`url\`), and report a merchant whose challenge downgrades the scheme.`,
|
|
@@ -537,7 +570,7 @@ function assertSecureX402RetryTarget(url) {
|
|
|
537
570
|
|
|
538
571
|
// src/merchant-egress.ts
|
|
539
572
|
var MERCHANT_EGRESS_REFUSED_CODE = "MERCHANT_EGRESS_REFUSED";
|
|
540
|
-
var MerchantEgressRefusedError = class extends
|
|
573
|
+
var MerchantEgressRefusedError = class extends chunkLZHCIK7L_cjs.HavenError {
|
|
541
574
|
url;
|
|
542
575
|
refusal;
|
|
543
576
|
beforeRequest;
|
|
@@ -568,7 +601,7 @@ var MerchantEgressRefusedError = class extends chunkMZKLAHBK_cjs.HavenError {
|
|
|
568
601
|
}
|
|
569
602
|
};
|
|
570
603
|
var MERCHANT_EGRESS_RESPONSE_CAP_CODE = "MERCHANT_EGRESS_RESPONSE_CAP";
|
|
571
|
-
var MerchantEgressResponseCapError = class extends
|
|
604
|
+
var MerchantEgressResponseCapError = class extends chunkLZHCIK7L_cjs.HavenError {
|
|
572
605
|
url;
|
|
573
606
|
limitBytes;
|
|
574
607
|
constructor(message, limitBytes, url) {
|
|
@@ -752,7 +785,7 @@ var McpMerchantTransport = class {
|
|
|
752
785
|
return await this.followRedirects(url, init, signal, void 0, carriesPayment);
|
|
753
786
|
} catch (err) {
|
|
754
787
|
if (timeoutSignal.aborted) {
|
|
755
|
-
throw new
|
|
788
|
+
throw new chunkLZHCIK7L_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${url}`);
|
|
756
789
|
}
|
|
757
790
|
throw err;
|
|
758
791
|
}
|
|
@@ -786,7 +819,7 @@ var McpMerchantTransport = class {
|
|
|
786
819
|
return this.capResponse(response, finalUrl, maxBytes);
|
|
787
820
|
} catch (err) {
|
|
788
821
|
if (timeoutSignal.aborted) {
|
|
789
|
-
throw new
|
|
822
|
+
throw new chunkLZHCIK7L_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${finalUrl}`);
|
|
790
823
|
}
|
|
791
824
|
throw err;
|
|
792
825
|
}
|
|
@@ -980,7 +1013,7 @@ var McpMerchantTransport = class {
|
|
|
980
1013
|
text = await response.clone().text();
|
|
981
1014
|
} catch (err) {
|
|
982
1015
|
if (err instanceof MerchantEgressResponseCapError) throw err;
|
|
983
|
-
if (isBodyPhaseTimeout(err)) throw new
|
|
1016
|
+
if (isBodyPhaseTimeout(err)) throw new chunkLZHCIK7L_cjs.MerchantTimeoutError(`Merchant response body read timed out.`);
|
|
984
1017
|
return void 0;
|
|
985
1018
|
}
|
|
986
1019
|
if ((response.headers.get("content-type") ?? "").includes("text/event-stream")) {
|
|
@@ -1005,7 +1038,7 @@ var McpMerchantTransport = class {
|
|
|
1005
1038
|
text = await response.clone().text();
|
|
1006
1039
|
} catch (err) {
|
|
1007
1040
|
if (err instanceof MerchantEgressResponseCapError) throw err;
|
|
1008
|
-
if (isBodyPhaseTimeout(err)) throw new
|
|
1041
|
+
if (isBodyPhaseTimeout(err)) throw new chunkLZHCIK7L_cjs.MerchantTimeoutError(`Merchant response body read timed out.`);
|
|
1009
1042
|
return response;
|
|
1010
1043
|
}
|
|
1011
1044
|
const message = selectJsonRpcResult(parseSseJsonRpcMessages(text));
|
|
@@ -1067,8 +1100,8 @@ var McpMerchantTransport = class {
|
|
|
1067
1100
|
async deliverPayment(url, init, paymentHeader) {
|
|
1068
1101
|
assertSecureX402RetryTarget(url);
|
|
1069
1102
|
const headers = new Headers(init?.headers);
|
|
1070
|
-
const send =
|
|
1071
|
-
for (const name of
|
|
1103
|
+
const send = chunk4Z7PKLFD_cjs.x402PaymentHeaderNamesFor(paymentHeader);
|
|
1104
|
+
for (const name of chunk4Z7PKLFD_cjs.X402_PAYMENT_HEADER_NAMES) {
|
|
1072
1105
|
if (send.includes(name)) headers.set(name, paymentHeader);
|
|
1073
1106
|
else headers.delete(name);
|
|
1074
1107
|
}
|
|
@@ -1155,7 +1188,7 @@ function mcpToolResultOf(value) {
|
|
|
1155
1188
|
function extractMcpPaymentRequired(toolResult) {
|
|
1156
1189
|
if (toolResult.isError !== true) return void 0;
|
|
1157
1190
|
if (isRecord(toolResult.structuredContent)) {
|
|
1158
|
-
const parsed =
|
|
1191
|
+
const parsed = chunk4Z7PKLFD_cjs.normalizePaymentRequired(toolResult.structuredContent);
|
|
1159
1192
|
if (parsed) return parsed;
|
|
1160
1193
|
}
|
|
1161
1194
|
if (Array.isArray(toolResult.content)) {
|
|
@@ -1167,7 +1200,7 @@ function extractMcpPaymentRequired(toolResult) {
|
|
|
1167
1200
|
} catch {
|
|
1168
1201
|
continue;
|
|
1169
1202
|
}
|
|
1170
|
-
const parsed =
|
|
1203
|
+
const parsed = chunk4Z7PKLFD_cjs.normalizePaymentRequired(candidate);
|
|
1171
1204
|
if (parsed) return parsed;
|
|
1172
1205
|
}
|
|
1173
1206
|
}
|
|
@@ -1191,7 +1224,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
|
|
|
1191
1224
|
if (!request) return init;
|
|
1192
1225
|
let envelope;
|
|
1193
1226
|
try {
|
|
1194
|
-
envelope =
|
|
1227
|
+
envelope = chunk4Z7PKLFD_cjs.decodeBase64Json(paymentHeader);
|
|
1195
1228
|
} catch {
|
|
1196
1229
|
return init;
|
|
1197
1230
|
}
|
|
@@ -1207,7 +1240,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
|
|
|
1207
1240
|
};
|
|
1208
1241
|
}
|
|
1209
1242
|
function encodeMcpSettlementReceipt(settlement) {
|
|
1210
|
-
return
|
|
1243
|
+
return chunk4Z7PKLFD_cjs.encodeBase64Json(settlement);
|
|
1211
1244
|
}
|
|
1212
1245
|
function bodyCarriesX402Payment(body) {
|
|
1213
1246
|
let text;
|
|
@@ -1345,8 +1378,19 @@ function deriveReadiness(status, allowances) {
|
|
|
1345
1378
|
if (status !== "active") return "revoked";
|
|
1346
1379
|
return allowances.some((allowance) => safeBigInt(allowance.remainingAtomic) > 0n) ? "ready" : "needs_approval";
|
|
1347
1380
|
}
|
|
1381
|
+
function deriveBudgetRefillsAt(readiness, allowances) {
|
|
1382
|
+
if (readiness !== "needs_approval" || allowances.length === 0) return null;
|
|
1383
|
+
const times = allowances.map((allowance) => allowance.nextRefillAt).filter((at) => at !== null && !Number.isNaN(Date.parse(at)));
|
|
1384
|
+
if (times.length === 0) return null;
|
|
1385
|
+
return times.reduce((earliest, at) => Date.parse(at) < Date.parse(earliest) ? at : earliest);
|
|
1386
|
+
}
|
|
1387
|
+
function deriveBudgetEndedAt(readiness, allowances, budgetEndedAt) {
|
|
1388
|
+
if (readiness !== "needs_approval" || allowances.length > 0) return null;
|
|
1389
|
+
if (!budgetEndedAt || Number.isNaN(Date.parse(budgetEndedAt))) return null;
|
|
1390
|
+
return budgetEndedAt;
|
|
1391
|
+
}
|
|
1348
1392
|
function formatRemainingDisplay(tokenAddress, tokenSymbol, remainingAtomic) {
|
|
1349
|
-
const token =
|
|
1393
|
+
const token = chunk4Z7PKLFD_cjs.resolveTokenFromAddress(tokenAddress);
|
|
1350
1394
|
return token ? `${formatAtomicAmount(safeBigInt(remainingAtomic), token.decimals)} ${tokenSymbol}` : `${remainingAtomic} ${tokenSymbol} (atomic; unknown decimals)`;
|
|
1351
1395
|
}
|
|
1352
1396
|
function formatTokenAmount(atomic, decimals) {
|
|
@@ -1366,7 +1410,7 @@ function mapSupersession(raw) {
|
|
|
1366
1410
|
replacementAgentId,
|
|
1367
1411
|
supersededAt,
|
|
1368
1412
|
warning: `This agent was replaced on its machine by agent ${replacementAgentId} at ${supersededAt}. This session is still running as the old agent: restart the agent runtime so it loads the new agent, and ask the user to remove this agent on its Haven agent page if it is no longer used \u2014 it keeps any budget it still holds until then.`,
|
|
1369
|
-
nextAction:
|
|
1413
|
+
nextAction: chunkLZHCIK7L_cjs.AgentPaymentNextAction.StopAndTellUser,
|
|
1370
1414
|
nextToolOmittedReason: "The next step is the user's: restart this session, and remove the superseded agent in the Haven dashboard. No Haven tool does either."
|
|
1371
1415
|
};
|
|
1372
1416
|
}
|
|
@@ -1436,7 +1480,7 @@ function summarizePendingSubBudget(row) {
|
|
|
1436
1480
|
};
|
|
1437
1481
|
}
|
|
1438
1482
|
function summarizeTaskBudget(taskBudget) {
|
|
1439
|
-
const token =
|
|
1483
|
+
const token = chunk4Z7PKLFD_cjs.resolveTokenFromAddress(taskBudget.tokenAddress);
|
|
1440
1484
|
const maxDisplay = token ? `${formatAtomicAmount(safeBigInt(taskBudget.maxAtomic), token.decimals)} ${token.symbol}` : `${taskBudget.maxAtomic} (atomic; unknown decimals)`;
|
|
1441
1485
|
const spendDisplay = (atomic) => {
|
|
1442
1486
|
if (atomic === null) return null;
|
|
@@ -1513,11 +1557,23 @@ var AccountReads = class {
|
|
|
1513
1557
|
isResetPending: allowance.onchain.isResetPending,
|
|
1514
1558
|
// #3731: same provenance as the detailed read's field — the compact
|
|
1515
1559
|
// row is a projection of the same allowance, never a second source.
|
|
1516
|
-
fundsCoverRemaining: allowance.fundsCoverRemaining
|
|
1560
|
+
fundsCoverRemaining: allowance.fundsCoverRemaining,
|
|
1561
|
+
nextRefillAt: allowance.nextRefillAt
|
|
1517
1562
|
};
|
|
1518
1563
|
});
|
|
1519
1564
|
const readiness = deriveReadiness(agent.status, allowances);
|
|
1520
|
-
|
|
1565
|
+
const budgetRefillsAt = deriveBudgetRefillsAt(readiness, allowances);
|
|
1566
|
+
const budgetEndedAt = deriveBudgetEndedAt(readiness, allowances, allowanceSummary.budgetEndedAt);
|
|
1567
|
+
return {
|
|
1568
|
+
...agent,
|
|
1569
|
+
readiness,
|
|
1570
|
+
spend_authority_readiness: readiness,
|
|
1571
|
+
budgetRefillsAt,
|
|
1572
|
+
budgetEndedAt,
|
|
1573
|
+
allowances,
|
|
1574
|
+
taskBudgets,
|
|
1575
|
+
pendingSubBudgetSignatures
|
|
1576
|
+
};
|
|
1521
1577
|
}
|
|
1522
1578
|
/**
|
|
1523
1579
|
* #3329: `GET /task-budgets?status=open`, mapped to the condensed summary
|
|
@@ -1569,7 +1625,7 @@ var AccountReads = class {
|
|
|
1569
1625
|
async listTaskBudgetsSummary() {
|
|
1570
1626
|
try {
|
|
1571
1627
|
const raw = await this.transport.get("/task-budgets?status=live").catch((error) => {
|
|
1572
|
-
if (error instanceof
|
|
1628
|
+
if (error instanceof chunkLZHCIK7L_cjs.HavenApiError && error.statusCode === 400) {
|
|
1573
1629
|
return this.transport.get("/task-budgets?status=all");
|
|
1574
1630
|
}
|
|
1575
1631
|
throw error;
|
|
@@ -1613,6 +1669,9 @@ var AccountReads = class {
|
|
|
1613
1669
|
accountAddress: raw.account_address,
|
|
1614
1670
|
delegateAddress: raw.delegate_address,
|
|
1615
1671
|
chainId: raw.chain_id,
|
|
1672
|
+
// #4352: a non-empty parseable date → itself; anything else (absent on
|
|
1673
|
+
// an older backend, null when no budget has ended) → null.
|
|
1674
|
+
budgetEndedAt: typeof raw.budget_ended_at === "string" && !Number.isNaN(Date.parse(raw.budget_ended_at)) ? raw.budget_ended_at : null,
|
|
1616
1675
|
supersededBy: mapSupersession(raw.superseded_by),
|
|
1617
1676
|
allowances: raw.allowances.map((allowance) => ({
|
|
1618
1677
|
id: allowance.id,
|
|
@@ -1631,6 +1690,9 @@ var AccountReads = class {
|
|
|
1631
1690
|
// "unverifiable", not a missing key. The key is absent on the wire
|
|
1632
1691
|
// when the remaining is 0; that maps to null here too.
|
|
1633
1692
|
fundsCoverRemaining: allowance.funds_cover_remaining === true || allowance.funds_cover_remaining === false ? allowance.funds_cover_remaining : null,
|
|
1693
|
+
// #4355: a non-empty string → itself; anything else (absent on an
|
|
1694
|
+
// older backend, null when the budget never refills) → null.
|
|
1695
|
+
nextRefillAt: typeof allowance.next_refill_at === "string" && allowance.next_refill_at !== "" ? allowance.next_refill_at : null,
|
|
1634
1696
|
remainingDisplay: formatRemainingDisplay(allowance.token_address, allowance.token_symbol, allowance.onchain.remaining),
|
|
1635
1697
|
onchain: {
|
|
1636
1698
|
amount: allowance.onchain.amount,
|
|
@@ -1679,7 +1741,7 @@ var AccountReads = class {
|
|
|
1679
1741
|
payment: payment2,
|
|
1680
1742
|
allowance: null,
|
|
1681
1743
|
warnings: [{
|
|
1682
|
-
code:
|
|
1744
|
+
code: chunkLZHCIK7L_cjs.AgentPaymentWarningCode.AllowanceCheckUnavailable,
|
|
1683
1745
|
message: `Could not read the post-purchase allowance/budget for payment ${paymentId} (${detail}). The payment itself succeeded \u2014 the on-chain policy remains the actual spend gate; this only affects the remaining-budget figure reported here.`
|
|
1684
1746
|
}]
|
|
1685
1747
|
});
|
|
@@ -1772,7 +1834,7 @@ var AccountReads = class {
|
|
|
1772
1834
|
*/
|
|
1773
1835
|
async getReceipt(paymentId) {
|
|
1774
1836
|
const { receipt } = await this.transport.get(`/payments/${paymentId}/receipt`);
|
|
1775
|
-
return { receipt, verification:
|
|
1837
|
+
return { receipt, verification: chunkZ5MTKU6O_cjs.verifyPaymentReceipt(receipt) };
|
|
1776
1838
|
}
|
|
1777
1839
|
async fetchAgent() {
|
|
1778
1840
|
const raw = await this.transport.get("/machine-payments/agent");
|
|
@@ -1808,7 +1870,7 @@ function isWaitTimeout(err) {
|
|
|
1808
1870
|
async function waitForSweepTx(tx) {
|
|
1809
1871
|
let receipt;
|
|
1810
1872
|
try {
|
|
1811
|
-
receipt = await tx.wait(1,
|
|
1873
|
+
receipt = await tx.wait(1, chunkLZHCIK7L_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS);
|
|
1812
1874
|
} catch (err) {
|
|
1813
1875
|
if (!isWaitTimeout(err)) throw err;
|
|
1814
1876
|
return { txHash: tx.hash, confirmation: "unconfirmed" };
|
|
@@ -1822,16 +1884,16 @@ var DelegateSweepApi = class {
|
|
|
1822
1884
|
}
|
|
1823
1885
|
options;
|
|
1824
1886
|
async sweepDelegate() {
|
|
1825
|
-
if (!this.options.delegateKey) throw new
|
|
1887
|
+
if (!this.options.delegateKey) throw new chunkLZHCIK7L_cjs.HavenSigningError("delegateKey is required for sweepDelegate.");
|
|
1826
1888
|
const agent = await this.options.getAgent();
|
|
1827
|
-
if (!agent.delegateAddress) throw new
|
|
1889
|
+
if (!agent.delegateAddress) throw new chunkLZHCIK7L_cjs.HavenApiError("Agent has no delegate address.", 422);
|
|
1828
1890
|
const rpcUrl = this.options.chainRpcs[agent.chainId];
|
|
1829
|
-
if (!rpcUrl) throw new
|
|
1891
|
+
if (!rpcUrl) throw new chunkLZHCIK7L_cjs.HavenApiError(`chainRpcs[${agent.chainId}] must be configured to sweep the delegate wallet.`, 422);
|
|
1830
1892
|
const provider = createJsonRpcProvider(rpcUrl);
|
|
1831
1893
|
const wallet = createWallet(this.options.delegateKey, provider);
|
|
1832
1894
|
const transfers = [];
|
|
1833
|
-
if (
|
|
1834
|
-
const contract = createErc20Contract(
|
|
1895
|
+
if (chunk4Z7PKLFD_cjs.isSweepableChain(agent.chainId)) {
|
|
1896
|
+
const contract = createErc20Contract(chunk4Z7PKLFD_cjs.sweepUsdcAddress(agent.chainId), ["function balanceOf(address) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)"], wallet);
|
|
1835
1897
|
const balance2 = await contract.balanceOf(agent.delegateAddress);
|
|
1836
1898
|
if (balance2 > 0n) {
|
|
1837
1899
|
const tx = await contract.transfer(agent.accountAddress, balance2);
|
|
@@ -1919,7 +1981,7 @@ function snapshotRequestBody(body) {
|
|
|
1919
1981
|
if (body == null) return void 0;
|
|
1920
1982
|
if (typeof body === "string") return body;
|
|
1921
1983
|
if (body instanceof URLSearchParams) return body.toString();
|
|
1922
|
-
throw new
|
|
1984
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
1923
1985
|
"Quote helpers can only capture resumable request bodies that are strings or URLSearchParams. For streams, blobs, or binary bodies, preserve the original request yourself and call the matching resume method with fresh init.",
|
|
1924
1986
|
400
|
|
1925
1987
|
);
|
|
@@ -1940,12 +2002,12 @@ function requestInitFromSnapshot(request) {
|
|
|
1940
2002
|
};
|
|
1941
2003
|
}
|
|
1942
2004
|
function noCompatiblePaymentOptionError(accepts) {
|
|
1943
|
-
const erc7710Only =
|
|
2005
|
+
const erc7710Only = chunk4Z7PKLFD_cjs.selectErc7710PaymentOption(accepts) !== null;
|
|
1944
2006
|
const unsupportedOnly = !erc7710Only && accepts.some(
|
|
1945
|
-
(opt) => opt !== null && typeof opt === "object" && !
|
|
2007
|
+
(opt) => opt !== null && typeof opt === "object" && !chunk4Z7PKLFD_cjs.isErc7710Option(opt) && (chunk4Z7PKLFD_cjs.x402AssetTransferMethod(opt) !== null || opt.extra?.paymentFlow !== void 0)
|
|
1946
2008
|
);
|
|
1947
2009
|
const offeredSchemes = nonExactSchemesOnly(accepts);
|
|
1948
|
-
return new
|
|
2010
|
+
return new chunkLZHCIK7L_cjs.HavenApiError(
|
|
1949
2011
|
"No compatible payment option found in x402 requirements. Haven supports standard x402 exact payments on Base USDC." + (offeredSchemes ? ` The merchant offered only ${offeredSchemes}; Haven pays only the 'exact' scheme. For a request with a body, this often means the body or its Content-Type was missing or invalid: send the full request again (method, body, and Content-Type: application/json for a JSON API).` : erc7710Only ? " The only Haven-compatible option this merchant advertises is tagged extra.assetTransferMethod: 'erc7710' (direct settlement), which this EIP-3009 payment path cannot settle \u2014 the limitation is the settlement scheme, not the asset. Paying this merchant requires a delegation-rail erc7710 flow (settleX402Erc7710, or the hosted MCP purchase tools)." : unsupportedOnly ? " Every option this merchant advertises asks for a transfer method or payment flow Haven cannot construct (for example extra.assetTransferMethod: 'permit2', or an unrecognized extra.paymentFlow). No payment intent was created and no funds moved." : ""),
|
|
1950
2012
|
400
|
|
1951
2013
|
);
|
|
@@ -1964,15 +2026,15 @@ function nonExactSchemesOnly(accepts) {
|
|
|
1964
2026
|
return schemes.map((s) => `'${s}'`).join(", ");
|
|
1965
2027
|
}
|
|
1966
2028
|
function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport) {
|
|
1967
|
-
const standard =
|
|
1968
|
-
const option = standard ??
|
|
2029
|
+
const standard = chunk4Z7PKLFD_cjs.selectStandardPaymentOption(paymentRequired.accepts);
|
|
2030
|
+
const option = standard ?? chunk4Z7PKLFD_cjs.selectErc7710PaymentOption(paymentRequired.accepts);
|
|
1969
2031
|
if (!option) {
|
|
1970
2032
|
throw noCompatiblePaymentOptionError(paymentRequired.accepts);
|
|
1971
2033
|
}
|
|
1972
|
-
const token =
|
|
2034
|
+
const token = chunk4Z7PKLFD_cjs.resolveTokenFromAddress(option.asset, option.network);
|
|
1973
2035
|
return {
|
|
1974
2036
|
rail: "x402",
|
|
1975
|
-
idempotencyKey: idempotencyKey ??
|
|
2037
|
+
idempotencyKey: idempotencyKey ?? chunk4Z7PKLFD_cjs.buildX402IdempotencyKey(paymentRequired, option),
|
|
1976
2038
|
paymentRequired,
|
|
1977
2039
|
accepted: option,
|
|
1978
2040
|
acceptedScheme: standard ? "standard" : "erc7710",
|
|
@@ -1986,8 +2048,8 @@ function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport)
|
|
|
1986
2048
|
resourceUrlDiffersFromRequest: paymentRequired.resource.url !== request.url,
|
|
1987
2049
|
description: paymentRequired.resource.description ?? option.description ?? null,
|
|
1988
2050
|
mimeType: paymentRequired.resource.mimeType ?? option.mimeType ?? null,
|
|
1989
|
-
amountAtomic:
|
|
1990
|
-
amount: decimalFromUsdcAtomic(
|
|
2051
|
+
amountAtomic: chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option),
|
|
2052
|
+
amount: decimalFromUsdcAtomic(chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option)),
|
|
1991
2053
|
token: token?.symbol ?? "USDC",
|
|
1992
2054
|
// #1351: null when the asset is unrecognised on this network — the
|
|
1993
2055
|
// `token` fallback above is a LABEL, not evidence of 6 decimals, and a
|
|
@@ -2026,7 +2088,7 @@ function buildX402Receipt(input) {
|
|
|
2026
2088
|
payTo: input.merchantTo ?? input.accepted.payTo
|
|
2027
2089
|
},
|
|
2028
2090
|
x402: {
|
|
2029
|
-
amount:
|
|
2091
|
+
amount: chunk4Z7PKLFD_cjs.x402AuthorizationAmount(input.accepted),
|
|
2030
2092
|
token: input.token,
|
|
2031
2093
|
network: input.accepted.network,
|
|
2032
2094
|
asset: input.accepted.asset,
|
|
@@ -2035,7 +2097,7 @@ function buildX402Receipt(input) {
|
|
|
2035
2097
|
};
|
|
2036
2098
|
}
|
|
2037
2099
|
function buildX402ResumeState(input) {
|
|
2038
|
-
const token =
|
|
2100
|
+
const token = chunk4Z7PKLFD_cjs.resolveTokenFromAddress(input.accepted.asset, input.accepted.network);
|
|
2039
2101
|
return {
|
|
2040
2102
|
rail: "x402",
|
|
2041
2103
|
paymentId: input.paymentId,
|
|
@@ -2046,8 +2108,8 @@ function buildX402ResumeState(input) {
|
|
|
2046
2108
|
request: input.request,
|
|
2047
2109
|
resourceUrl: input.paymentRequired.resource.url,
|
|
2048
2110
|
description: input.paymentRequired.resource.description ?? input.accepted.description ?? null,
|
|
2049
|
-
amountAtomic:
|
|
2050
|
-
amount: decimalFromUsdcAtomic(
|
|
2111
|
+
amountAtomic: chunk4Z7PKLFD_cjs.x402AuthorizationAmount(input.accepted),
|
|
2112
|
+
amount: decimalFromUsdcAtomic(chunk4Z7PKLFD_cjs.x402AuthorizationAmount(input.accepted)),
|
|
2051
2113
|
token: token?.symbol ?? "USDC",
|
|
2052
2114
|
asset: input.accepted.asset,
|
|
2053
2115
|
network: input.accepted.network,
|
|
@@ -2056,7 +2118,7 @@ function buildX402ResumeState(input) {
|
|
|
2056
2118
|
};
|
|
2057
2119
|
}
|
|
2058
2120
|
function attachX402ResumeState(err, paymentRequired, accepted, idempotencyKey, request) {
|
|
2059
|
-
if (!(err instanceof
|
|
2121
|
+
if (!(err instanceof chunkLZHCIK7L_cjs.HavenPaymentStateError)) return;
|
|
2060
2122
|
if (err.state.rail !== "x402") return;
|
|
2061
2123
|
err.resumeState = buildX402ResumeState({
|
|
2062
2124
|
paymentId: err.state.paymentId,
|
|
@@ -2077,17 +2139,17 @@ function attachResumeState(err, input) {
|
|
|
2077
2139
|
}
|
|
2078
2140
|
function assertCanResumeX402(status, paymentRequired, option) {
|
|
2079
2141
|
if (status.rail !== "x402") {
|
|
2080
|
-
throw new
|
|
2142
|
+
throw new chunkLZHCIK7L_cjs.HavenPaymentStateError(
|
|
2081
2143
|
`Payment ${status.paymentId} is ${status.rail}, not x402.`,
|
|
2082
2144
|
409,
|
|
2083
2145
|
status
|
|
2084
2146
|
);
|
|
2085
2147
|
}
|
|
2086
|
-
if (status.nextAction !==
|
|
2087
|
-
throw new
|
|
2148
|
+
if (status.nextAction !== chunkLZHCIK7L_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
|
|
2149
|
+
throw new chunkLZHCIK7L_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
|
|
2088
2150
|
}
|
|
2089
2151
|
if (!status.txHash) {
|
|
2090
|
-
throw new
|
|
2152
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2091
2153
|
`x402 payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
|
|
2092
2154
|
502,
|
|
2093
2155
|
status,
|
|
@@ -2095,7 +2157,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
2095
2157
|
);
|
|
2096
2158
|
}
|
|
2097
2159
|
if (status.resourceUrl && status.resourceUrl !== paymentRequired.resource.url) {
|
|
2098
|
-
throw new
|
|
2160
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2099
2161
|
"x402 resume request does not match the approved resource URL.",
|
|
2100
2162
|
409,
|
|
2101
2163
|
{ status, paymentRequired },
|
|
@@ -2103,7 +2165,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
2103
2165
|
);
|
|
2104
2166
|
}
|
|
2105
2167
|
if (status.merchantAddress && !sameAddress(status.merchantAddress, option.payTo)) {
|
|
2106
|
-
throw new
|
|
2168
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2107
2169
|
"x402 resume request does not match the approved merchant.",
|
|
2108
2170
|
409,
|
|
2109
2171
|
{ status, selectedPayment: option },
|
|
@@ -2112,7 +2174,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
2112
2174
|
}
|
|
2113
2175
|
const optionChainId = chainIdFromNetwork(option.network);
|
|
2114
2176
|
if (status.chainId && optionChainId && status.chainId !== optionChainId) {
|
|
2115
|
-
throw new
|
|
2177
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2116
2178
|
"x402 resume request does not match the approved network.",
|
|
2117
2179
|
409,
|
|
2118
2180
|
{ status, selectedPayment: option },
|
|
@@ -2120,7 +2182,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
2120
2182
|
);
|
|
2121
2183
|
}
|
|
2122
2184
|
if (status.token && status.token !== "USDC") {
|
|
2123
|
-
throw new
|
|
2185
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2124
2186
|
"x402 resume request does not match the approved token.",
|
|
2125
2187
|
409,
|
|
2126
2188
|
{ status, selectedPayment: option },
|
|
@@ -2128,9 +2190,9 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
2128
2190
|
);
|
|
2129
2191
|
}
|
|
2130
2192
|
const approvedAmount = status.amount ? normalizeDecimal(status.amount) : "";
|
|
2131
|
-
const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(
|
|
2193
|
+
const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option)));
|
|
2132
2194
|
if (approvedAmount && approvedAmount !== requestedAmount) {
|
|
2133
|
-
throw new
|
|
2195
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2134
2196
|
"x402 resume request does not match the approved amount.",
|
|
2135
2197
|
409,
|
|
2136
2198
|
{ status, selectedPayment: option },
|
|
@@ -2186,7 +2248,7 @@ var X402FundingLeg = class {
|
|
|
2186
2248
|
const cached = this.receiptCache.get(idempotencyKey);
|
|
2187
2249
|
if (!cached || cached.expiresAt <= Date.now()) return void 0;
|
|
2188
2250
|
if (!sameX402TaskBudget(cached.taskBudgetId, taskBudgetId) || !sameX402TaskBudget(cached.subBudgetId, subBudgetId)) {
|
|
2189
|
-
throw new
|
|
2251
|
+
throw new chunkLZHCIK7L_cjs.X402TaskBudgetMismatchError(
|
|
2190
2252
|
`The x402 idempotency key '${idempotencyKey}' was already used under a different authorizing budget (task '${cached.taskBudgetId ?? "none"}' vs '${taskBudgetId ?? "none"}', sub '${cached.subBudgetId ?? "none"}' vs '${subBudgetId ?? "none"}'). Pass a new idempotencyKey to pay under this budget.`,
|
|
2191
2253
|
idempotencyKey,
|
|
2192
2254
|
cached.taskBudgetId,
|
|
@@ -2207,7 +2269,7 @@ var X402FundingLeg = class {
|
|
|
2207
2269
|
url: paymentRequired.resource.url,
|
|
2208
2270
|
payTo: this.delegateAddress,
|
|
2209
2271
|
merchantPayTo: option.payTo,
|
|
2210
|
-
amount:
|
|
2272
|
+
amount: chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option),
|
|
2211
2273
|
asset: option.asset,
|
|
2212
2274
|
network: option.network,
|
|
2213
2275
|
description: paymentRequired.resource.description,
|
|
@@ -2226,17 +2288,17 @@ var X402FundingLeg = class {
|
|
|
2226
2288
|
...subBudgetId ? { subBudgetId } : {}
|
|
2227
2289
|
});
|
|
2228
2290
|
const state = paymentStateFromRaw("x402 payment", raw);
|
|
2229
|
-
const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction ===
|
|
2291
|
+
const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction === chunkLZHCIK7L_cjs.AgentPaymentNextAction.RetryOriginalX402Request ? "approval-resume" : null;
|
|
2230
2292
|
if (executedReplay) {
|
|
2231
2293
|
const canFund = await this.delegateCanFund(
|
|
2232
2294
|
raw.chain_id ?? state?.chainId ?? chainIdFromNetwork(option.network),
|
|
2233
2295
|
option.asset,
|
|
2234
|
-
|
|
2296
|
+
chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option)
|
|
2235
2297
|
);
|
|
2236
2298
|
const refuse = executedReplay === "idempotency-collision" ? canFund !== true : canFund === false;
|
|
2237
2299
|
if (refuse) {
|
|
2238
2300
|
const settledReceipt = state && executedReplay === "approval-resume" ? this.receiptFromStatus(paymentRequired, option, void 0, state) : this.receiptFromAuthorization(paymentRequired, option, void 0, raw);
|
|
2239
|
-
throw new
|
|
2301
|
+
throw new chunkLZHCIK7L_cjs.X402AlreadySettledError(
|
|
2240
2302
|
canFund === false ? "This x402 payment already settled \u2014 the delegate no longer holds the funds to authorize it again. To buy the same item a second time, pass a distinct `idempotencyKey`; the synthesised key intentionally collapses repeat calls for the same product within a 5-minute window so a retried request cannot pay twice." : "This x402 payment already settled, and whether the delegate can still fund a new authorization could not be verified (no `chainRpcs` entry for this chain). Refusing rather than issue an authorization that may be unfundable. To buy the same item a second time, pass a distinct `idempotencyKey`; to finish an interrupted payment, resume it by `paymentId`.",
|
|
2241
2303
|
settledReceipt,
|
|
2242
2304
|
canFund === false ? "settled" : "unverifiable"
|
|
@@ -2249,18 +2311,18 @@ var X402FundingLeg = class {
|
|
|
2249
2311
|
this.cacheReceipt(idempotencyKey, paymentHeader, receipt2, taskBudgetId, subBudgetId);
|
|
2250
2312
|
return receipt2;
|
|
2251
2313
|
}
|
|
2252
|
-
if (state?.nextAction ===
|
|
2314
|
+
if (state?.nextAction === chunkLZHCIK7L_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
|
|
2253
2315
|
const receipt2 = this.receiptFromStatus(paymentRequired, option, paymentHeader, state);
|
|
2254
2316
|
this.cacheReceipt(idempotencyKey, paymentHeader, receipt2, taskBudgetId, subBudgetId);
|
|
2255
2317
|
return receipt2;
|
|
2256
2318
|
}
|
|
2257
2319
|
this.assertSignableAuthorizationState("x402 payment", raw);
|
|
2258
2320
|
if (!raw.sign_data?.hash) {
|
|
2259
|
-
throw
|
|
2321
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic("No sign_hash returned from x402/authorize", 500, raw);
|
|
2260
2322
|
}
|
|
2261
2323
|
const sig = await this.signForData(raw.sign_data, {
|
|
2262
2324
|
asset: option.asset,
|
|
2263
|
-
amount:
|
|
2325
|
+
amount: chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option)
|
|
2264
2326
|
});
|
|
2265
2327
|
const execResult = await this.post(
|
|
2266
2328
|
`/payments/${raw.payment_id}/sign`,
|
|
@@ -2295,10 +2357,10 @@ var X402FundingLeg = class {
|
|
|
2295
2357
|
*/
|
|
2296
2358
|
async createPaymentHeader(paymentRequired, option, paymentId) {
|
|
2297
2359
|
if (!this.delegateKey) {
|
|
2298
|
-
throw new
|
|
2360
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError("delegateKey is required to sign x402 payment headers.");
|
|
2299
2361
|
}
|
|
2300
2362
|
const account = accounts.privateKeyToAccount(this.delegateKey);
|
|
2301
|
-
const requirements =
|
|
2363
|
+
const requirements = chunk4Z7PKLFD_cjs.toStandardPaymentRequirements(paymentRequired, option);
|
|
2302
2364
|
let header;
|
|
2303
2365
|
if (paymentId) {
|
|
2304
2366
|
const unsigned = schemes.exact.evm.preparePaymentHeader(
|
|
@@ -2306,7 +2368,7 @@ var X402FundingLeg = class {
|
|
|
2306
2368
|
paymentRequired.x402Version,
|
|
2307
2369
|
requirements
|
|
2308
2370
|
);
|
|
2309
|
-
unsigned.payload.authorization.nonce =
|
|
2371
|
+
unsigned.payload.authorization.nonce = chunk4Z7PKLFD_cjs.deriveX402PaymentNonce(paymentId);
|
|
2310
2372
|
const signed = await schemes.exact.evm.signPaymentHeader(account, requirements, unsigned);
|
|
2311
2373
|
header = schemes.exact.evm.encodePayment(signed);
|
|
2312
2374
|
} else {
|
|
@@ -2317,15 +2379,15 @@ var X402FundingLeg = class {
|
|
|
2317
2379
|
);
|
|
2318
2380
|
}
|
|
2319
2381
|
if (paymentRequired.x402Version < 2) return header;
|
|
2320
|
-
const payment =
|
|
2321
|
-
return
|
|
2382
|
+
const payment = chunk4Z7PKLFD_cjs.decodeBase64Json(header);
|
|
2383
|
+
return chunk4Z7PKLFD_cjs.encodeBase64Json(chunk4Z7PKLFD_cjs.x402V2PaymentEnvelope(paymentRequired, option, payment.payload));
|
|
2322
2384
|
}
|
|
2323
2385
|
// ── Receipt mapping ──────────────────────────────────────────────
|
|
2324
2386
|
receiptFromAuthorization(paymentRequired, option, paymentHeader, raw, execResult) {
|
|
2325
2387
|
const txHash = execResult?.tx_hash ?? raw.tx_hash ?? "";
|
|
2326
2388
|
const chainId = execResult?.chain_id ?? raw.chain_id ?? chainIdFromNetwork(option.network);
|
|
2327
2389
|
const token = execResult?.token ?? raw.token ?? "USDC";
|
|
2328
|
-
const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(
|
|
2390
|
+
const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option));
|
|
2329
2391
|
const to = execResult?.to ?? raw.to ?? this.delegateAddress ?? "";
|
|
2330
2392
|
const explorerUrl = execResult?.explorer_url ?? raw.explorer_url ?? explorerUrlOrEmpty(chainId, txHash);
|
|
2331
2393
|
const merchantTo = execResult?.merchant_to ?? raw.merchant_to ?? option.payTo;
|
|
@@ -2347,7 +2409,7 @@ var X402FundingLeg = class {
|
|
|
2347
2409
|
}
|
|
2348
2410
|
receiptFromStatus(paymentRequired, option, paymentHeader, status) {
|
|
2349
2411
|
if (!status.txHash) {
|
|
2350
|
-
throw new
|
|
2412
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2351
2413
|
`x402 payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
|
|
2352
2414
|
502,
|
|
2353
2415
|
status,
|
|
@@ -2358,7 +2420,7 @@ var X402FundingLeg = class {
|
|
|
2358
2420
|
paymentId: status.paymentId,
|
|
2359
2421
|
txHash: status.txHash,
|
|
2360
2422
|
token: status.token || "USDC",
|
|
2361
|
-
amount: status.amount || decimalFromUsdcAtomic(
|
|
2423
|
+
amount: status.amount || decimalFromUsdcAtomic(chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option)),
|
|
2362
2424
|
to: this.delegateAddress ?? "",
|
|
2363
2425
|
resourceUrl: paymentRequired.resource.url,
|
|
2364
2426
|
explorerUrl: explorerUrlOrEmpty(status.chainId, status.txHash),
|
|
@@ -2378,20 +2440,27 @@ var X402FundingLeg = class {
|
|
|
2378
2440
|
* Skipped when `chainRpcs` does not include the chain; in that case Haven's
|
|
2379
2441
|
* backend has already confirmed on-chain submission and callers accept the
|
|
2380
2442
|
* small propagation window as a trade-off for not configuring an RPC URL.
|
|
2443
|
+
*
|
|
2444
|
+
* #4470: the two outcomes are typed apart. ethers 6 `waitForTransaction`
|
|
2445
|
+
* REJECTS on its timeout (and on an RPC failure) rather than resolving
|
|
2446
|
+
* null, so that path is `FundingConfirmationUnknownError` — funding may
|
|
2447
|
+
* have moved. A mined receipt with `status !== 1` is `FundingRevertedError`.
|
|
2381
2448
|
*/
|
|
2382
2449
|
async waitForFundingTx(txHash, chainId, timeoutMs = 3e4) {
|
|
2383
2450
|
if (!txHash || !chainId) return;
|
|
2384
2451
|
const rpcUrl = this.chainRpcs[chainId];
|
|
2385
2452
|
if (!rpcUrl) return;
|
|
2386
2453
|
const provider = createJsonRpcProvider(rpcUrl);
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2454
|
+
let onChainReceipt;
|
|
2455
|
+
try {
|
|
2456
|
+
onChainReceipt = await provider.waitForTransaction(txHash, 1, timeoutMs);
|
|
2457
|
+
} catch (err) {
|
|
2458
|
+
throw new chunkLZHCIK7L_cjs.FundingConfirmationUnknownError(txHash, chainId, err instanceof Error ? err.message : String(err));
|
|
2459
|
+
}
|
|
2460
|
+
if (!onChainReceipt) {
|
|
2461
|
+
throw new chunkLZHCIK7L_cjs.FundingConfirmationUnknownError(txHash, chainId, "no receipt within the timeout window");
|
|
2394
2462
|
}
|
|
2463
|
+
if (onChainReceipt.status !== 1) throw new chunkLZHCIK7L_cjs.FundingRevertedError(txHash, chainId);
|
|
2395
2464
|
}
|
|
2396
2465
|
/**
|
|
2397
2466
|
* Can the delegate EOA still fund an authorization for `amountAtomic`?
|
|
@@ -2435,7 +2504,7 @@ var X402FundingLeg = class {
|
|
|
2435
2504
|
};
|
|
2436
2505
|
function getPaymentHeaderValidBefore(paymentHeader) {
|
|
2437
2506
|
try {
|
|
2438
|
-
const payment =
|
|
2507
|
+
const payment = chunk4Z7PKLFD_cjs.decodeBase64Json(
|
|
2439
2508
|
paymentHeader
|
|
2440
2509
|
);
|
|
2441
2510
|
const payload = payment.payload;
|
|
@@ -2490,7 +2559,7 @@ var X402Erc7710 = class {
|
|
|
2490
2559
|
*/
|
|
2491
2560
|
async settle(paymentRequired, options = {}) {
|
|
2492
2561
|
if (!this.delegateKey) {
|
|
2493
|
-
throw new
|
|
2562
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
2494
2563
|
"delegateKey is required for x402 payments. Pass it in the HavenClient config."
|
|
2495
2564
|
);
|
|
2496
2565
|
}
|
|
@@ -2515,21 +2584,21 @@ var X402Erc7710 = class {
|
|
|
2515
2584
|
async prepare(paymentRequired, options = {}) {
|
|
2516
2585
|
const delegationRail = options.delegationRail ?? (await this.getAgent()).executionRail === "delegation";
|
|
2517
2586
|
if (!delegationRail) {
|
|
2518
|
-
throw new
|
|
2587
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2519
2588
|
"erc7710 settlement requires a delegation-rail account; this one is not on it. Use authorizeX402() for the standard EIP-3009 path.",
|
|
2520
2589
|
400
|
|
2521
2590
|
);
|
|
2522
2591
|
}
|
|
2523
|
-
const selection =
|
|
2592
|
+
const selection = chunk4Z7PKLFD_cjs.selectX402SettlementScheme(paymentRequired.accepts, { delegationRail });
|
|
2524
2593
|
if (!selection || selection.scheme !== "erc7710") {
|
|
2525
|
-
throw new
|
|
2594
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2526
2595
|
"This merchant does not advertise an erc7710 settlement option (no accepts[] entry carries extra.assetTransferMethod: 'erc7710'). Use authorizeX402() for the standard EIP-3009 path.",
|
|
2527
2596
|
400
|
|
2528
2597
|
);
|
|
2529
2598
|
}
|
|
2530
2599
|
const option = selection.option;
|
|
2531
2600
|
const merchantPayTo = option.payTo;
|
|
2532
|
-
const amountAtomic =
|
|
2601
|
+
const amountAtomic = chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option);
|
|
2533
2602
|
const raw = await this.post("/x402", {
|
|
2534
2603
|
url: options.resourceUrl ?? paymentRequired.resource?.url,
|
|
2535
2604
|
// #2373: the full 402 challenge, persisted verbatim by the backend
|
|
@@ -2573,24 +2642,24 @@ var X402Erc7710 = class {
|
|
|
2573
2642
|
...options.subBudgetId ? { subBudgetId: options.subBudgetId } : {}
|
|
2574
2643
|
});
|
|
2575
2644
|
if (!raw.payment_id) {
|
|
2576
|
-
throw
|
|
2645
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic("No payment_id returned from x402/authorize", 500, raw);
|
|
2577
2646
|
}
|
|
2578
2647
|
if (raw.status === "confirmed" && raw.tx_hash) {
|
|
2579
2648
|
const requestedUrl = options.resourceUrl ?? paymentRequired.resource?.url;
|
|
2580
2649
|
const samePurchase = typeof raw.to === "string" && raw.to.toLowerCase() === merchantPayTo.toLowerCase() && raw.resource_url === requestedUrl;
|
|
2581
2650
|
if (!samePurchase) {
|
|
2582
|
-
throw new
|
|
2651
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2583
2652
|
`Idempotency key already belongs to confirmed payment ${raw.payment_id}, which is not this erc7710 purchase (different payee or resource). Nothing was signed and nothing was charged. Check that payment's status before buying again: a funded but undelivered EIP-3009 payment is recovered, not paid twice. Otherwise use a new idempotency key for this purchase.`,
|
|
2584
2653
|
409,
|
|
2585
2654
|
raw,
|
|
2586
2655
|
raw.payment_id
|
|
2587
2656
|
);
|
|
2588
2657
|
}
|
|
2589
|
-
throw new
|
|
2658
|
+
throw new chunkLZHCIK7L_cjs.X402Erc7710AlreadySettledError(raw.payment_id, raw.tx_hash, raw);
|
|
2590
2659
|
}
|
|
2591
2660
|
const signData = raw.sign_data;
|
|
2592
2661
|
if (signData?.signature_scheme !== "eip712_delegation" || !signData.typed_data) {
|
|
2593
|
-
throw
|
|
2662
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic(
|
|
2594
2663
|
`x402/authorize did not return an erc7710 settlement child (signature_scheme was ${JSON.stringify(signData?.signature_scheme)}). Refusing to sign a payload this path did not ask for.`,
|
|
2595
2664
|
500,
|
|
2596
2665
|
raw
|
|
@@ -2622,9 +2691,9 @@ var X402Erc7710 = class {
|
|
|
2622
2691
|
try {
|
|
2623
2692
|
settled = await this.post(`/x402/${paymentId}/settle`, { signature });
|
|
2624
2693
|
} catch (err) {
|
|
2625
|
-
const body = err instanceof
|
|
2626
|
-
if (err instanceof
|
|
2627
|
-
throw new
|
|
2694
|
+
const body = err instanceof chunkLZHCIK7L_cjs.HavenApiError ? err.body : void 0;
|
|
2695
|
+
if (err instanceof chunkLZHCIK7L_cjs.HavenApiError && err.statusCode === 409 && body?.code === "payment_already_settled" && typeof body.tx_hash === "string") {
|
|
2696
|
+
throw new chunkLZHCIK7L_cjs.X402Erc7710AlreadySettledError(
|
|
2628
2697
|
typeof body.payment_id === "string" ? body.payment_id : paymentId,
|
|
2629
2698
|
body.tx_hash,
|
|
2630
2699
|
body
|
|
@@ -2633,7 +2702,7 @@ var X402Erc7710 = class {
|
|
|
2633
2702
|
throw err;
|
|
2634
2703
|
}
|
|
2635
2704
|
if (!settled.payment_header) {
|
|
2636
|
-
throw
|
|
2705
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic(
|
|
2637
2706
|
"x402 settle returned no payment_header \u2014 the merchant cannot be retried.",
|
|
2638
2707
|
500,
|
|
2639
2708
|
settled
|
|
@@ -2643,9 +2712,9 @@ var X402Erc7710 = class {
|
|
|
2643
2712
|
}
|
|
2644
2713
|
};
|
|
2645
2714
|
function settlementExpectationFromQuote(settlement) {
|
|
2646
|
-
const chainId =
|
|
2715
|
+
const chainId = chunkLZHCIK7L_cjs.chainIdForNetwork(settlement.network);
|
|
2647
2716
|
if (chainId === void 0) {
|
|
2648
|
-
throw new
|
|
2717
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
2649
2718
|
`Refusing to sign the x402 settlement child: the merchant's network ${JSON.stringify(settlement.network)} is not one this SDK can verify a settlement child on.`
|
|
2650
2719
|
);
|
|
2651
2720
|
}
|
|
@@ -2695,7 +2764,7 @@ function x402ToolReceipt(receipt) {
|
|
|
2695
2764
|
};
|
|
2696
2765
|
}
|
|
2697
2766
|
function toolError(err) {
|
|
2698
|
-
if (err instanceof
|
|
2767
|
+
if (err instanceof chunkLZHCIK7L_cjs.HavenPaymentStateError) {
|
|
2699
2768
|
return {
|
|
2700
2769
|
success: false,
|
|
2701
2770
|
payment_id: err.state.paymentId,
|
|
@@ -2740,7 +2809,7 @@ function toolError(err) {
|
|
|
2740
2809
|
error: err.message
|
|
2741
2810
|
};
|
|
2742
2811
|
}
|
|
2743
|
-
if (err instanceof
|
|
2812
|
+
if (err instanceof chunkLZHCIK7L_cjs.HavenApiError) {
|
|
2744
2813
|
return {
|
|
2745
2814
|
success: false,
|
|
2746
2815
|
status_code: err.statusCode,
|
|
@@ -2804,14 +2873,14 @@ var MerchantCompletion = class {
|
|
|
2804
2873
|
}
|
|
2805
2874
|
async retryRequest(url, initialInit, paymentRequired, receipt) {
|
|
2806
2875
|
if (!receipt.accepted) {
|
|
2807
|
-
throw
|
|
2876
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic("No accepted x402 option was recorded for payment retry", 500);
|
|
2808
2877
|
}
|
|
2809
2878
|
if (!receipt.paymentHeader) {
|
|
2810
|
-
throw
|
|
2879
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic("No x402 payment header was returned for payment retry", 500);
|
|
2811
2880
|
}
|
|
2812
2881
|
let retryInit = initialInit;
|
|
2813
2882
|
if (this.getTaxDeclarationHeader && this.delegateKey) {
|
|
2814
|
-
const scheme =
|
|
2883
|
+
const scheme = chunk4Z7PKLFD_cjs.x402PaymentHeaderNamesFor(receipt.paymentHeader);
|
|
2815
2884
|
const isEip3009 = scheme.length > 1;
|
|
2816
2885
|
if (isEip3009) {
|
|
2817
2886
|
const resolved = await this.getTaxDeclarationHeader({
|
|
@@ -2861,7 +2930,7 @@ var MerchantCompletion = class {
|
|
|
2861
2930
|
delegate_to: receipt.to
|
|
2862
2931
|
}
|
|
2863
2932
|
});
|
|
2864
|
-
throw new
|
|
2933
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2865
2934
|
"x402 retry failed after Haven funded the delegate wallet; reconciliation may be required. The merchant may still settle late: check the payment status before sweeping the delegate.",
|
|
2866
2935
|
inBandRejection ? X402_RETRY_REJECTED_STATUS : merchant.merchant_status,
|
|
2867
2936
|
{
|
|
@@ -2891,7 +2960,7 @@ var MerchantCompletion = class {
|
|
|
2891
2960
|
merchantStatus: retryResponse.status,
|
|
2892
2961
|
challengePayload: paymentRequired,
|
|
2893
2962
|
selectedPayment: receipt.accepted,
|
|
2894
|
-
paymentProofHeaderName:
|
|
2963
|
+
paymentProofHeaderName: chunk4Z7PKLFD_cjs.x402PaymentHeaderNamesSent(receipt.paymentHeader),
|
|
2895
2964
|
paymentProofHeader: receipt.paymentHeader,
|
|
2896
2965
|
protocolReceiptHeaderName,
|
|
2897
2966
|
protocolReceiptHeader
|
|
@@ -2955,18 +3024,18 @@ var MerchantCompletion = class {
|
|
|
2955
3024
|
async resolveCompletionContext(input) {
|
|
2956
3025
|
const status = await this.getPaymentStatus(input.paymentId);
|
|
2957
3026
|
if (status.rail !== "x402") {
|
|
2958
|
-
throw new
|
|
3027
|
+
throw new chunkLZHCIK7L_cjs.HavenPaymentStateError(
|
|
2959
3028
|
`Payment ${status.paymentId} is ${status.rail}, not x402.`,
|
|
2960
3029
|
409,
|
|
2961
3030
|
status
|
|
2962
3031
|
);
|
|
2963
3032
|
}
|
|
2964
|
-
const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction ===
|
|
3033
|
+
const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction === chunkLZHCIK7L_cjs.AgentPaymentNextAction.RetryOriginalX402Request || status.kind === "payment_intent" && status.status === "confirmed" && status.phase === chunkLZHCIK7L_cjs.AgentPaymentPhase.PaymentConfirmed && status.nextAction === chunkLZHCIK7L_cjs.AgentPaymentNextAction.None;
|
|
2965
3034
|
if (!readyForMerchantCompletion) {
|
|
2966
|
-
throw new
|
|
3035
|
+
throw new chunkLZHCIK7L_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
|
|
2967
3036
|
}
|
|
2968
3037
|
if (!input.noFundingLeg && !status.txHash) {
|
|
2969
|
-
throw new
|
|
3038
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2970
3039
|
`x402 payment ${status.paymentId} is ready for merchant completion but has no Haven transaction hash.`,
|
|
2971
3040
|
502,
|
|
2972
3041
|
status,
|
|
@@ -2975,7 +3044,7 @@ var MerchantCompletion = class {
|
|
|
2975
3044
|
}
|
|
2976
3045
|
const approvedResourceUrl = status.resourceUrl ?? status.x402?.resourceUrl ?? null;
|
|
2977
3046
|
if (approvedResourceUrl && approvedResourceUrl !== input.url) {
|
|
2978
|
-
throw new
|
|
3047
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
2979
3048
|
"x402 merchant completion does not match the approved resource URL.",
|
|
2980
3049
|
409,
|
|
2981
3050
|
{ status, url: input.url },
|
|
@@ -3019,7 +3088,7 @@ var MerchantCompletion = class {
|
|
|
3019
3088
|
* reads as funded and undelivered.
|
|
3020
3089
|
*/
|
|
3021
3090
|
async paidDeliveryInterrupted(err, url, receipt, paymentHeader, hasBody) {
|
|
3022
|
-
const scheme =
|
|
3091
|
+
const scheme = chunk4Z7PKLFD_cjs.x402PaymentHeaderNamesFor(paymentHeader).length > 1 ? "eip3009" : "erc7710";
|
|
3023
3092
|
const status = err.redirectStatus ?? 0;
|
|
3024
3093
|
await this.recordRetryRejected({
|
|
3025
3094
|
rail: "x402",
|
|
@@ -3106,7 +3175,7 @@ var MerchantCompletion = class {
|
|
|
3106
3175
|
*/
|
|
3107
3176
|
async reportMerchantOutcome(input) {
|
|
3108
3177
|
if (!Number.isInteger(input.merchantStatus) || input.merchantStatus < 100 || input.merchantStatus > 599) {
|
|
3109
|
-
throw new
|
|
3178
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
3110
3179
|
`merchant_status must be an integer HTTP status from 100 to 599 (received ${input.merchantStatus}).`,
|
|
3111
3180
|
400,
|
|
3112
3181
|
void 0,
|
|
@@ -3115,7 +3184,7 @@ var MerchantCompletion = class {
|
|
|
3115
3184
|
}
|
|
3116
3185
|
const looksAccepted = input.merchantStatus >= 200 && input.merchantStatus < 300;
|
|
3117
3186
|
if (looksAccepted !== (input.outcome === "accepted")) {
|
|
3118
|
-
throw new
|
|
3187
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
3119
3188
|
`outcome "${input.outcome}" contradicts merchant_status ${input.merchantStatus}: report "accepted" only for a 2xx and "rejected" only for a non-2xx.`,
|
|
3120
3189
|
400,
|
|
3121
3190
|
void 0,
|
|
@@ -3124,14 +3193,14 @@ var MerchantCompletion = class {
|
|
|
3124
3193
|
}
|
|
3125
3194
|
const status = await this.getPaymentStatus(input.paymentId);
|
|
3126
3195
|
if (status.rail !== "x402") {
|
|
3127
|
-
throw new
|
|
3196
|
+
throw new chunkLZHCIK7L_cjs.HavenPaymentStateError(
|
|
3128
3197
|
`Payment ${status.paymentId} is ${status.rail}, not x402 \u2014 there is no merchant retry to report.`,
|
|
3129
3198
|
409,
|
|
3130
3199
|
status
|
|
3131
3200
|
);
|
|
3132
3201
|
}
|
|
3133
3202
|
if (status.status !== "confirmed" || !status.txHash) {
|
|
3134
|
-
throw new
|
|
3203
|
+
throw new chunkLZHCIK7L_cjs.HavenPaymentStateError(
|
|
3135
3204
|
`Payment ${status.paymentId} has no confirmed Haven funding transaction to anchor a merchant report to (status ${status.status}). ${status.message}`,
|
|
3136
3205
|
paymentStateStatusCode(status.status, 409),
|
|
3137
3206
|
status
|
|
@@ -3139,7 +3208,7 @@ var MerchantCompletion = class {
|
|
|
3139
3208
|
}
|
|
3140
3209
|
const resourceUrl = status.resourceUrl ?? status.x402?.resourceUrl ?? null;
|
|
3141
3210
|
if (!resourceUrl) {
|
|
3142
|
-
throw new
|
|
3211
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
3143
3212
|
`Payment ${status.paymentId} has no recorded resource URL, so a merchant report cannot be stored.`,
|
|
3144
3213
|
409,
|
|
3145
3214
|
status,
|
|
@@ -3171,7 +3240,11 @@ var MerchantCompletion = class {
|
|
|
3171
3240
|
merchantStatus: input.merchantStatus,
|
|
3172
3241
|
// #3778: accepted outcomes only — a rejection delivered nothing, so
|
|
3173
3242
|
// there is no deliverable to point at.
|
|
3174
|
-
...input.deliveryReference ? { deliveryReference: input.deliveryReference } : {}
|
|
3243
|
+
...input.deliveryReference ? { deliveryReference: input.deliveryReference } : {},
|
|
3244
|
+
// #4534: the purchase correlation key — accepted outcomes only, for the
|
|
3245
|
+
// same reason: a rejected retry bought nothing to group.
|
|
3246
|
+
...input.purchaseGroupId ? { purchaseGroupId: input.purchaseGroupId } : {},
|
|
3247
|
+
...input.merchantResponse ? { merchantResponse: input.merchantResponse } : {}
|
|
3175
3248
|
});
|
|
3176
3249
|
return { paymentId: status.paymentId, outcome: "accepted", txHash, resourceUrl, recorded: "evidence" };
|
|
3177
3250
|
}
|
|
@@ -3193,15 +3266,16 @@ var MerchantCompletion = class {
|
|
|
3193
3266
|
};
|
|
3194
3267
|
for (let attempt = 0; ; attempt += 1) {
|
|
3195
3268
|
const result = await this.postEvidenceOnce(body);
|
|
3196
|
-
if (result.outcome !== "retryable" || attempt >= EVIDENCE_RETRY_DELAYS_MS.length) {
|
|
3269
|
+
if (result.outcome !== "retryable" || result.statusCode !== EVIDENCE_RETRYABLE_STATUS || attempt >= EVIDENCE_RETRY_DELAYS_MS.length) {
|
|
3197
3270
|
return result;
|
|
3198
3271
|
}
|
|
3199
3272
|
await this.sleep(EVIDENCE_RETRY_DELAYS_MS[attempt]);
|
|
3200
3273
|
}
|
|
3201
3274
|
}
|
|
3202
3275
|
/**
|
|
3203
|
-
* ONE evidence attempt — the body of `reportEvidence`'s loop above. A 503
|
|
3204
|
-
*
|
|
3276
|
+
* ONE evidence attempt — the body of `reportEvidence`'s loop above. A 503,
|
|
3277
|
+
* or no verdict at all (a non-answer or a 408, #4470), answers `retryable`
|
|
3278
|
+
* immediately; the caller decides whether to sleep and
|
|
3205
3279
|
* re-attempt (`reportEvidence`, and — #4215 — the local settlement report
|
|
3206
3280
|
* in `retryRequest`) or hand the outcome to its consumer (#3764 D2, the
|
|
3207
3281
|
* hosted settlement report).
|
|
@@ -3211,8 +3285,9 @@ var MerchantCompletion = class {
|
|
|
3211
3285
|
await this.post("/machine-payments/evidence", body);
|
|
3212
3286
|
return { outcome: "confirmed" };
|
|
3213
3287
|
} catch (err) {
|
|
3214
|
-
const statusCode = err instanceof
|
|
3215
|
-
|
|
3288
|
+
const statusCode = err instanceof chunkLZHCIK7L_cjs.HavenApiError ? err.statusCode : void 0;
|
|
3289
|
+
const noVerdict = statusCode === 408 || err instanceof chunkLZHCIK7L_cjs.HavenApiError && err.failureCause?.kind === "no_answer";
|
|
3290
|
+
if (statusCode !== EVIDENCE_RETRYABLE_STATUS && !noVerdict) {
|
|
3216
3291
|
const reason = refusalReasonFromBody(err);
|
|
3217
3292
|
const errorCode = refusalErrorCodeFromBody(err);
|
|
3218
3293
|
return {
|
|
@@ -3268,7 +3343,7 @@ var MerchantCompletion = class {
|
|
|
3268
3343
|
*/
|
|
3269
3344
|
async reportSettlementEvidence(paymentId, settlementTxHash, options = {}) {
|
|
3270
3345
|
if (isZeroSettlementTxHash(settlementTxHash)) {
|
|
3271
|
-
throw new
|
|
3346
|
+
throw new chunkLZHCIK7L_cjs.HavenZeroSettlementHashError(paymentId);
|
|
3272
3347
|
}
|
|
3273
3348
|
return this.reportEvidence({
|
|
3274
3349
|
paymentId,
|
|
@@ -3310,19 +3385,19 @@ var MerchantCompletion = class {
|
|
|
3310
3385
|
function settlementProofFields(paymentHeader) {
|
|
3311
3386
|
if (!paymentHeader || !paymentHeader.trim()) return {};
|
|
3312
3387
|
return {
|
|
3313
|
-
paymentProofHeaderName:
|
|
3388
|
+
paymentProofHeaderName: chunk4Z7PKLFD_cjs.x402PaymentHeaderNamesSent(paymentHeader),
|
|
3314
3389
|
paymentProofHeader: paymentHeader
|
|
3315
3390
|
};
|
|
3316
3391
|
}
|
|
3317
3392
|
function refusalReasonFromBody(err) {
|
|
3318
|
-
if (!(err instanceof
|
|
3393
|
+
if (!(err instanceof chunkLZHCIK7L_cjs.HavenApiError)) return void 0;
|
|
3319
3394
|
const body = err.body;
|
|
3320
3395
|
if (body === null || typeof body !== "object" || Array.isArray(body)) return void 0;
|
|
3321
3396
|
const reason = body.reason;
|
|
3322
3397
|
return typeof reason === "string" && reason.length > 0 ? reason : void 0;
|
|
3323
3398
|
}
|
|
3324
3399
|
function refusalErrorCodeFromBody(err) {
|
|
3325
|
-
if (!(err instanceof
|
|
3400
|
+
if (!(err instanceof chunkLZHCIK7L_cjs.HavenApiError)) return void 0;
|
|
3326
3401
|
const body = err.body;
|
|
3327
3402
|
if (body === null || typeof body !== "object" || Array.isArray(body)) return void 0;
|
|
3328
3403
|
const code = body.error_code;
|
|
@@ -3339,7 +3414,7 @@ function parseMerchantSettlement(header) {
|
|
|
3339
3414
|
}
|
|
3340
3415
|
function parseProtocolReceiptHeader(value) {
|
|
3341
3416
|
try {
|
|
3342
|
-
return
|
|
3417
|
+
return chunk4Z7PKLFD_cjs.decodeBase64Json(value);
|
|
3343
3418
|
} catch {
|
|
3344
3419
|
try {
|
|
3345
3420
|
return JSON.parse(value);
|
|
@@ -3375,7 +3450,7 @@ function x402TypedDataDigest(typedData) {
|
|
|
3375
3450
|
try {
|
|
3376
3451
|
return viem.hashTypedData(typedData);
|
|
3377
3452
|
} catch (err) {
|
|
3378
|
-
throw new
|
|
3453
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3379
3454
|
`The x402 funding intent carried a sign_data.typed_data that is not a valid EIP-712 payload (needs domain, types, primaryType, message), so its digest cannot be derived and no signer could accept it. Underlying error: ${err instanceof Error ? err.message : String(err)}`
|
|
3380
3455
|
);
|
|
3381
3456
|
}
|
|
@@ -3490,7 +3565,7 @@ var HavenClient = class {
|
|
|
3490
3565
|
this.x402Wallet = config.x402Wallet;
|
|
3491
3566
|
this.egressPolicy = config.merchantEgress;
|
|
3492
3567
|
this.merchantTransport = new McpMerchantTransport({ merchantTimeout: config.merchantTimeout, egress: config.merchantEgress });
|
|
3493
|
-
this.confirmationTimeout = config.confirmationTimeout ??
|
|
3568
|
+
this.confirmationTimeout = config.confirmationTimeout ?? chunkLZHCIK7L_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS;
|
|
3494
3569
|
this.pollingInterval = config.pollingInterval ?? DEFAULT_POLLING_INTERVAL;
|
|
3495
3570
|
this.chainRpcs = config.chainRpcs ?? {};
|
|
3496
3571
|
if (this.delegateKey) {
|
|
@@ -3571,7 +3646,7 @@ var HavenClient = class {
|
|
|
3571
3646
|
*/
|
|
3572
3647
|
async pay(request) {
|
|
3573
3648
|
if (!this.delegateKey) {
|
|
3574
|
-
throw new
|
|
3649
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3575
3650
|
"Cannot use pay() without a delegateKey. Use createIntent() + submitSignature() for manual signing."
|
|
3576
3651
|
);
|
|
3577
3652
|
}
|
|
@@ -3627,15 +3702,15 @@ var HavenClient = class {
|
|
|
3627
3702
|
* on-chain allowance — there is nothing to sign until the user approves.
|
|
3628
3703
|
*/
|
|
3629
3704
|
async createX402Intent(paymentRequired, options = {}) {
|
|
3630
|
-
const option =
|
|
3705
|
+
const option = chunk4Z7PKLFD_cjs.selectStandardPaymentOption(paymentRequired.accepts);
|
|
3631
3706
|
if (!option) {
|
|
3632
3707
|
throw noCompatiblePaymentOptionError(paymentRequired.accepts);
|
|
3633
3708
|
}
|
|
3634
3709
|
const fundingTo = options.delegateAddress ?? (await this.getAgent()).delegateAddress;
|
|
3635
3710
|
if (!fundingTo) {
|
|
3636
|
-
throw
|
|
3711
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic("Authenticated agent has no delegate address registered.", 502);
|
|
3637
3712
|
}
|
|
3638
|
-
const idempotencyKey = options.idempotencyKey ??
|
|
3713
|
+
const idempotencyKey = options.idempotencyKey ?? chunk4Z7PKLFD_cjs.buildX402IdempotencyKey(paymentRequired, option);
|
|
3639
3714
|
const raw = await this.post("/x402", {
|
|
3640
3715
|
url: paymentRequired.resource.url,
|
|
3641
3716
|
payTo: fundingTo,
|
|
@@ -3646,7 +3721,7 @@ var HavenClient = class {
|
|
|
3646
3721
|
// of a silent reroute to the erc7710 settlement branch (the #1358
|
|
3647
3722
|
// review's open-budget misroute). Legacy-rail backends ignore the field.
|
|
3648
3723
|
settlementScheme: "eip3009",
|
|
3649
|
-
amount:
|
|
3724
|
+
amount: chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option),
|
|
3650
3725
|
asset: option.asset,
|
|
3651
3726
|
network: option.network,
|
|
3652
3727
|
description: paymentRequired.resource.description,
|
|
@@ -3671,15 +3746,15 @@ var HavenClient = class {
|
|
|
3671
3746
|
throwPaymentStateError("x402 payment", raw);
|
|
3672
3747
|
}
|
|
3673
3748
|
if (!raw.sign_data?.hash) {
|
|
3674
|
-
throw
|
|
3749
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic("No sign_hash returned from x402/authorize", 500, raw);
|
|
3675
3750
|
}
|
|
3676
3751
|
if (raw.sign_data.signature_scheme !== void 0 && !raw.sign_data.typed_data) {
|
|
3677
|
-
throw new
|
|
3752
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3678
3753
|
`This account's x402 funding intent declares signature scheme '${raw.sign_data.signature_scheme}' but carried no typed_data to sign. Refusing to fall back to the bare hash \u2014 the account would reject that signature on-chain. This is a backend contract violation; report it rather than working around it.`
|
|
3679
3754
|
);
|
|
3680
3755
|
}
|
|
3681
3756
|
if (!raw.x402_expected_auth) {
|
|
3682
|
-
throw
|
|
3757
|
+
throw chunkLZHCIK7L_cjs.HavenApiError.deterministic("No x402 expected-context binding returned from x402/authorize", 500, raw);
|
|
3683
3758
|
}
|
|
3684
3759
|
return {
|
|
3685
3760
|
paymentId: raw.payment_id,
|
|
@@ -3690,7 +3765,7 @@ var HavenClient = class {
|
|
|
3690
3765
|
accepted: option,
|
|
3691
3766
|
resourceUrl: paymentRequired.resource.url,
|
|
3692
3767
|
merchantTo: raw.merchant_to ?? option.payTo,
|
|
3693
|
-
amountAtomic:
|
|
3768
|
+
amountAtomic: chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option),
|
|
3694
3769
|
asset: option.asset,
|
|
3695
3770
|
network: option.network,
|
|
3696
3771
|
expectedAuth: raw.x402_expected_auth,
|
|
@@ -3715,13 +3790,13 @@ var HavenClient = class {
|
|
|
3715
3790
|
*/
|
|
3716
3791
|
sign(hash) {
|
|
3717
3792
|
if (!this.delegateKey) {
|
|
3718
|
-
throw new
|
|
3793
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3719
3794
|
"Cannot sign without a delegateKey. Pass the private key in HavenClient config, or sign externally."
|
|
3720
3795
|
);
|
|
3721
3796
|
}
|
|
3722
3797
|
const signature = signHash(this.delegateKey, hash);
|
|
3723
3798
|
if (!verifySignature(hash, signature, this.delegateAddress)) {
|
|
3724
|
-
throw new
|
|
3799
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3725
3800
|
"Local signature verification failed \u2014 recovered address does not match delegate key."
|
|
3726
3801
|
);
|
|
3727
3802
|
}
|
|
@@ -3739,29 +3814,29 @@ var HavenClient = class {
|
|
|
3739
3814
|
*/
|
|
3740
3815
|
async signForData(signData, settlementExpectation, fundingExpectation) {
|
|
3741
3816
|
if (!this.delegateKey) {
|
|
3742
|
-
throw new
|
|
3817
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3743
3818
|
"Cannot sign without a delegateKey. Pass the private key in HavenClient config, or sign externally."
|
|
3744
3819
|
);
|
|
3745
3820
|
}
|
|
3746
3821
|
const scheme = signData.signature_scheme;
|
|
3747
3822
|
if (scheme === "eip191_userop") {
|
|
3748
|
-
throw new
|
|
3823
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3749
3824
|
"The session rail is retired \u2014 'eip191_userop' intents can no longer be signed. Re-onboard the account on the delegation rail."
|
|
3750
3825
|
);
|
|
3751
3826
|
}
|
|
3752
3827
|
if (scheme === "eip712_userop") {
|
|
3753
3828
|
if (!signData.typed_data) {
|
|
3754
|
-
throw new
|
|
3829
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3755
3830
|
"sign_data.signature_scheme is eip712_userop but typed_data is missing \u2014 refusing to sign the bare hash (the account would reject it)."
|
|
3756
3831
|
);
|
|
3757
3832
|
}
|
|
3758
|
-
|
|
3759
|
-
|
|
3833
|
+
chunkLZHCIK7L_cjs.assertUserOpTypedDataBinding(signData.typed_data, signData.hash);
|
|
3834
|
+
chunk4Z7PKLFD_cjs.assertBoundDirectPaymentUserOp(
|
|
3760
3835
|
signData.typed_data,
|
|
3761
3836
|
this.delegateAddress
|
|
3762
3837
|
);
|
|
3763
3838
|
if (fundingExpectation) {
|
|
3764
|
-
|
|
3839
|
+
chunk4Z7PKLFD_cjs.assertFundingLegPaysDelegate(signData.typed_data, {
|
|
3765
3840
|
delegateAddress: this.delegateAddress,
|
|
3766
3841
|
asset: fundingExpectation.asset,
|
|
3767
3842
|
amount: fundingExpectation.amount
|
|
@@ -3771,24 +3846,24 @@ var HavenClient = class {
|
|
|
3771
3846
|
}
|
|
3772
3847
|
if (scheme === "eip712_delegation") {
|
|
3773
3848
|
if (!signData.typed_data) {
|
|
3774
|
-
throw new
|
|
3849
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3775
3850
|
"sign_data.signature_scheme is eip712_delegation but typed_data is missing \u2014 refusing to sign the bare hash (the settlement would be rejected on redemption)."
|
|
3776
3851
|
);
|
|
3777
3852
|
}
|
|
3778
3853
|
if (!settlementExpectation) {
|
|
3779
|
-
throw new
|
|
3854
|
+
throw new chunk4Z7PKLFD_cjs.HavenTypedDataRefusedError(
|
|
3780
3855
|
"Refusing to sign an x402 settlement child without an independent expectation of what it must pay (the merchant's 402). Pay erc7710 merchants through settleX402Erc7710(), which supplies it."
|
|
3781
3856
|
);
|
|
3782
3857
|
}
|
|
3783
|
-
|
|
3858
|
+
chunk4Z7PKLFD_cjs.assertOwnSettlementChild(signData.typed_data, settlementExpectation, this.delegateAddress);
|
|
3784
3859
|
return signSettlementDelegationTypedData(this.delegateKey, signData.typed_data);
|
|
3785
3860
|
}
|
|
3786
3861
|
if (scheme === void 0) {
|
|
3787
|
-
throw new
|
|
3862
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3788
3863
|
"sign_data.signature_scheme is required \u2014 the legacy AllowanceModule rail that signed the bare hash is retired (#2850). Refusing to guess a signing scheme."
|
|
3789
3864
|
);
|
|
3790
3865
|
}
|
|
3791
|
-
throw new
|
|
3866
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
3792
3867
|
`Unknown sign_data.signature_scheme '${scheme}' \u2014 refusing to guess a signing scheme. Update @haven_ai/sdk.`
|
|
3793
3868
|
);
|
|
3794
3869
|
}
|
|
@@ -3909,6 +3984,12 @@ var HavenClient = class {
|
|
|
3909
3984
|
* degrade-to-warning path and the ledger row would still land while the
|
|
3910
3985
|
* purchase proceeded.
|
|
3911
3986
|
*
|
|
3987
|
+
* #4458: an agent whose only budget for the token has ENDED is refused the
|
|
3988
|
+
* same way with `error_code: 'delegation_expired'` and `budget_ended_at`
|
|
3989
|
+
* (ISO 8601) — also thrown, also recorded (`source: 'hosted_prepare'`).
|
|
3990
|
+
* The remedy differs: the owner sets a NEW budget, waiting for a period to
|
|
3991
|
+
* reset cannot help.
|
|
3992
|
+
*
|
|
3912
3993
|
* #3518: without `merchantTo`, an agent whose budgets for the token are all
|
|
3913
3994
|
* merchant-locked gets 409 `budget_requires_recipient` (thrown, nothing
|
|
3914
3995
|
* recorded) naming the pins in `budget_recipient_addresses` — repeat the
|
|
@@ -3933,12 +4014,13 @@ var HavenClient = class {
|
|
|
3933
4014
|
/**
|
|
3934
4015
|
* Post-purchase allowance/budget summary for a settled payment (#1310).
|
|
3935
4016
|
*
|
|
3936
|
-
* Reuses the EXACT rail-aware read path {@link getAllowances}
|
|
3937
|
-
*
|
|
3938
|
-
*
|
|
3939
|
-
* the #1090 `deriveDelegationBudgets`-backed enforcer read, never
|
|
4017
|
+
* Reuses the EXACT rail-aware read path {@link getAllowances} uses —
|
|
4018
|
+
* `GET /machine-payments/allowances`, with delegation-rail values coming
|
|
4019
|
+
* from the #1090 `deriveDelegationBudgets`-backed enforcer read, never
|
|
3940
4020
|
* `agent_allowances` — so this can never disagree with
|
|
3941
|
-
* {@link getAllowances} for the same fixture.
|
|
4021
|
+
* {@link getAllowances} for the same fixture. (#1306's catalog-purchase
|
|
4022
|
+
* preflight read the same path until #3054; it now calls
|
|
4023
|
+
* `POST /machine-payments/budget-precheck` instead.) The settled token is
|
|
3942
4024
|
* resolved from {@link getPaymentStatus} so callers pass only
|
|
3943
4025
|
* `paymentId`, never a second haven_get_agent-style round trip.
|
|
3944
4026
|
*
|
|
@@ -3979,7 +4061,7 @@ var HavenClient = class {
|
|
|
3979
4061
|
*/
|
|
3980
4062
|
async getPaymentStatusWithPostPurchaseAllowance(paymentId) {
|
|
3981
4063
|
const status = await this.getPaymentStatus(paymentId);
|
|
3982
|
-
if (status.rail ===
|
|
4064
|
+
if (status.rail === chunkLZHCIK7L_cjs.AgentPaymentRail.X402 && status.phase === chunkLZHCIK7L_cjs.AgentPaymentPhase.PaymentConfirmed) {
|
|
3983
4065
|
const { allowance, warnings } = await this.getPostPurchaseAllowanceSummary(paymentId);
|
|
3984
4066
|
return { ...status, allowance, ...warnings.length > 0 ? { warnings } : {} };
|
|
3985
4067
|
}
|
|
@@ -4230,7 +4312,7 @@ var HavenClient = class {
|
|
|
4230
4312
|
}
|
|
4231
4313
|
await sleep(this.pollingInterval);
|
|
4232
4314
|
}
|
|
4233
|
-
throw new
|
|
4315
|
+
throw new chunkLZHCIK7L_cjs.HavenTimeoutError(paymentId);
|
|
4234
4316
|
}
|
|
4235
4317
|
// ── x402 Protocol Support ────────────────────────────────────────
|
|
4236
4318
|
/**
|
|
@@ -4244,24 +4326,24 @@ var HavenClient = class {
|
|
|
4244
4326
|
*/
|
|
4245
4327
|
async authorizeX402(paymentRequired, options = {}) {
|
|
4246
4328
|
if (!this.delegateKey) {
|
|
4247
|
-
throw new
|
|
4329
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
4248
4330
|
"delegateKey is required for x402 payments. Pass it in the HavenClient config."
|
|
4249
4331
|
);
|
|
4250
4332
|
}
|
|
4251
4333
|
if (!this.delegateAddress) {
|
|
4252
|
-
throw new
|
|
4334
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
|
|
4253
4335
|
}
|
|
4254
|
-
const option =
|
|
4336
|
+
const option = chunk4Z7PKLFD_cjs.selectStandardPaymentOption(paymentRequired.accepts);
|
|
4255
4337
|
if (!option) {
|
|
4256
4338
|
throw noCompatiblePaymentOptionError(paymentRequired.accepts);
|
|
4257
4339
|
}
|
|
4258
|
-
const idempotencyKey = options.idempotencyKey ??
|
|
4340
|
+
const idempotencyKey = options.idempotencyKey ?? chunk4Z7PKLFD_cjs.buildX402IdempotencyKey(paymentRequired, option);
|
|
4259
4341
|
const cached = this.fundingLeg.cachedReceipt(idempotencyKey, options.taskBudgetId, options.subBudgetId);
|
|
4260
4342
|
if (cached) return cached;
|
|
4261
4343
|
const inFlight = this.inFlightX402.get(idempotencyKey);
|
|
4262
4344
|
if (inFlight) {
|
|
4263
4345
|
if (!sameX402TaskBudget(this.inFlightX402TaskBudget.get(idempotencyKey), options.taskBudgetId) || !sameX402TaskBudget(this.inFlightX402SubBudget.get(idempotencyKey), options.subBudgetId)) {
|
|
4264
|
-
throw new
|
|
4346
|
+
throw new chunkLZHCIK7L_cjs.X402TaskBudgetMismatchError(
|
|
4265
4347
|
`The x402 idempotency key '${idempotencyKey}' has an in-flight payment created under a different authorizing budget (task '${this.inFlightX402TaskBudget.get(idempotencyKey) ?? "none"}' vs '${options.taskBudgetId ?? "none"}', sub '${this.inFlightX402SubBudget.get(idempotencyKey) ?? "none"}' vs '${options.subBudgetId ?? "none"}'). Pass a new idempotencyKey to pay under this budget.`,
|
|
4266
4348
|
idempotencyKey,
|
|
4267
4349
|
this.inFlightX402TaskBudget.get(idempotencyKey),
|
|
@@ -4316,16 +4398,16 @@ var HavenClient = class {
|
|
|
4316
4398
|
if (err instanceof MerchantEgressResponseCapError) throw err;
|
|
4317
4399
|
body = void 0;
|
|
4318
4400
|
}
|
|
4319
|
-
throw new
|
|
4401
|
+
throw new chunkLZHCIK7L_cjs.X402UnexpectedStatusError(
|
|
4320
4402
|
`Expected an x402 quote response with HTTP 402, got HTTP ${response.status}.`,
|
|
4321
4403
|
response.status || 400,
|
|
4322
4404
|
body
|
|
4323
4405
|
);
|
|
4324
4406
|
}
|
|
4325
4407
|
if (response.headers.get("MACHINE-PAYMENT-CHALLENGE")) {
|
|
4326
|
-
throw new
|
|
4408
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError("quoteX402 only supports standard x402 Payment Required responses.", 400);
|
|
4327
4409
|
}
|
|
4328
|
-
const paymentRequired = await
|
|
4410
|
+
const paymentRequired = await chunk4Z7PKLFD_cjs.parsePaymentRequiredResponse(response);
|
|
4329
4411
|
const mcpTransport = await this.merchantTransport.detect(url, paymentRequired, response);
|
|
4330
4412
|
return buildX402Quote(paymentRequired, request, options.idempotencyKey, mcpTransport);
|
|
4331
4413
|
}
|
|
@@ -4343,7 +4425,7 @@ var HavenClient = class {
|
|
|
4343
4425
|
const wallet = await this.merchantCompletion.resolveWalletForMerchantCall();
|
|
4344
4426
|
const sessionId = await this.merchantTransport.initialize(url, init, wallet);
|
|
4345
4427
|
if (!sessionId) {
|
|
4346
|
-
throw new
|
|
4428
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError(
|
|
4347
4429
|
"The merchant did not establish an MCP session before the x402 quote. No payment was created.",
|
|
4348
4430
|
502,
|
|
4349
4431
|
{ mcpSessionNotEstablished: true }
|
|
@@ -4417,18 +4499,18 @@ var HavenClient = class {
|
|
|
4417
4499
|
}
|
|
4418
4500
|
async resumeAuthorizedX402(input) {
|
|
4419
4501
|
if (!this.delegateKey) {
|
|
4420
|
-
throw new
|
|
4502
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError(
|
|
4421
4503
|
"delegateKey is required for x402 payments. Pass it in the HavenClient config."
|
|
4422
4504
|
);
|
|
4423
4505
|
}
|
|
4424
4506
|
if (!this.delegateAddress) {
|
|
4425
|
-
throw new
|
|
4507
|
+
throw new chunkLZHCIK7L_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
|
|
4426
4508
|
}
|
|
4427
|
-
const option =
|
|
4509
|
+
const option = chunk4Z7PKLFD_cjs.selectStandardPaymentOption(input.paymentRequired.accepts);
|
|
4428
4510
|
if (!option) {
|
|
4429
4511
|
throw noCompatiblePaymentOptionError(input.paymentRequired.accepts);
|
|
4430
4512
|
}
|
|
4431
|
-
const idempotencyKey = input.idempotencyKey ??
|
|
4513
|
+
const idempotencyKey = input.idempotencyKey ?? chunk4Z7PKLFD_cjs.buildX402IdempotencyKey(input.paymentRequired, option);
|
|
4432
4514
|
const cached = this.fundingLeg.cachedReceipt(idempotencyKey, input.taskBudgetId);
|
|
4433
4515
|
if (cached) return cached;
|
|
4434
4516
|
const status = await this.getPaymentStatus(input.paymentId);
|
|
@@ -4436,10 +4518,10 @@ var HavenClient = class {
|
|
|
4436
4518
|
const canFund = await this.fundingLeg.delegateCanFund(
|
|
4437
4519
|
status.chainId ?? chainIdFromNetwork(option.network),
|
|
4438
4520
|
option.asset,
|
|
4439
|
-
|
|
4521
|
+
chunk4Z7PKLFD_cjs.x402AuthorizationAmount(option)
|
|
4440
4522
|
);
|
|
4441
4523
|
if (canFund === false) {
|
|
4442
|
-
throw new
|
|
4524
|
+
throw new chunkLZHCIK7L_cjs.X402AlreadySettledError(
|
|
4443
4525
|
`x402 payment ${status.paymentId} has already settled \u2014 the delegate no longer holds the funds to authorize it again, so there is nothing left to resume.`,
|
|
4444
4526
|
this.fundingLeg.receiptFromStatus(input.paymentRequired, option, void 0, status),
|
|
4445
4527
|
"settled"
|
|
@@ -4460,13 +4542,13 @@ var HavenClient = class {
|
|
|
4460
4542
|
const url = input.url ?? input.request?.url;
|
|
4461
4543
|
if (!paymentRequired) {
|
|
4462
4544
|
if (!url) {
|
|
4463
|
-
throw new
|
|
4545
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError("x402 resume requires the original URL or a captured request snapshot.", 400);
|
|
4464
4546
|
}
|
|
4465
4547
|
const response = await this.merchantTransport.fetch(url, initialInit, this.merchantTransport.budgetFor("quote"), this.merchantTransport.capFor("quote"));
|
|
4466
4548
|
if (response.status !== 402) {
|
|
4467
|
-
throw new
|
|
4549
|
+
throw new chunkLZHCIK7L_cjs.HavenApiError("Expected the original x402 request to return HTTP 402 before resuming.", 400);
|
|
4468
4550
|
}
|
|
4469
|
-
paymentRequired = await
|
|
4551
|
+
paymentRequired = await chunk4Z7PKLFD_cjs.parsePaymentRequiredResponse(response);
|
|
4470
4552
|
}
|
|
4471
4553
|
const receipt = await this.resumeAuthorizedX402({
|
|
4472
4554
|
paymentId: input.paymentId,
|
|
@@ -4519,7 +4601,7 @@ var HavenClient = class {
|
|
|
4519
4601
|
nativeChallenge = true;
|
|
4520
4602
|
} else {
|
|
4521
4603
|
try {
|
|
4522
|
-
paymentRequired = await
|
|
4604
|
+
paymentRequired = await chunk4Z7PKLFD_cjs.parsePaymentRequiredResponse(response);
|
|
4523
4605
|
} catch (err) {
|
|
4524
4606
|
if (err instanceof MerchantEgressResponseCapError) throw err;
|
|
4525
4607
|
return response;
|
|
@@ -4530,8 +4612,8 @@ var HavenClient = class {
|
|
|
4530
4612
|
if (mcpSessionId) requestInit = this.merchantTransport.withSessionHeaders(requestInit, mcpSessionId);
|
|
4531
4613
|
}
|
|
4532
4614
|
const request = snapshotX402Request(url, requestInit);
|
|
4533
|
-
const option =
|
|
4534
|
-
const idempotencyKey = options.idempotencyKey ?? (option ?
|
|
4615
|
+
const option = chunk4Z7PKLFD_cjs.selectStandardPaymentOption(paymentRequired.accepts);
|
|
4616
|
+
const idempotencyKey = options.idempotencyKey ?? (option ? chunk4Z7PKLFD_cjs.buildX402IdempotencyKey(paymentRequired, option) : void 0);
|
|
4535
4617
|
let receipt;
|
|
4536
4618
|
try {
|
|
4537
4619
|
receipt = await this.authorizeX402(paymentRequired, options);
|
|
@@ -4661,7 +4743,7 @@ var HavenClient = class {
|
|
|
4661
4743
|
txHash: evidenceTxHash,
|
|
4662
4744
|
resourceUrl: evidenceContext.resourceUrl,
|
|
4663
4745
|
merchantStatus: surfaced.status,
|
|
4664
|
-
paymentProofHeaderName:
|
|
4746
|
+
paymentProofHeaderName: chunk4Z7PKLFD_cjs.x402PaymentHeaderNamesSent(input.paymentHeader),
|
|
4665
4747
|
paymentProofHeader: input.paymentHeader,
|
|
4666
4748
|
protocolReceiptHeaderName: answer.protocolReceiptHeaderName,
|
|
4667
4749
|
protocolReceiptHeader: answer.protocolReceiptHeader,
|
|
@@ -4787,7 +4869,7 @@ var HavenClient = class {
|
|
|
4787
4869
|
try {
|
|
4788
4870
|
raw = await this.get(`/x402/by-idempotency-key/${encodeURIComponent(key)}`);
|
|
4789
4871
|
} catch (err) {
|
|
4790
|
-
if (err instanceof
|
|
4872
|
+
if (err instanceof chunkLZHCIK7L_cjs.HavenApiError && err.statusCode === 404) return null;
|
|
4791
4873
|
throw err;
|
|
4792
4874
|
}
|
|
4793
4875
|
return {
|
|
@@ -4963,7 +5045,7 @@ var toolDescriptions = {
|
|
|
4963
5045
|
getAgent: {
|
|
4964
5046
|
summary: "Return the authenticated agent identity AND its live spend authority in one call: Haven wallet, delegate, chain, raw status, spend_authority_readiness, per-token remaining allowance (atomic + human-readable). The recommended first call in a new session.",
|
|
4965
5047
|
selectionGuidance: "Use this as the session bootstrap, or to confirm identity together with whether the agent has spend authority right now. For per-token detail (configured vs spent vs reset window) use haven_get_allowances.",
|
|
4966
|
-
behavior: `Reads identity plus the live spend-authority snapshot \u2014 the active on-chain budget delegation. spend_authority_readiness (readiness is a deprecated alias, same value) is "ready" when at least one token has remaining spend authority, "needs_approval" when the agent is active but has none, and "revoked" when the credential is not active. Readiness is AUTHORITY
|
|
5048
|
+
behavior: `Reads identity plus the live spend-authority snapshot \u2014 the active on-chain budget delegation. spend_authority_readiness (readiness is a deprecated alias, same value) is "ready" when at least one token has remaining spend authority, "needs_approval" when the agent is active but has none, and "revoked" when the credential is not active. needs_approval with no allowances[] rows and budgetEndedAt set: the budget ENDED on that date \u2014 ask the owner to set a new one, waiting will not help; with no rows and no budgetEndedAt: nothing approved yet; with rows: spent for this period, refilling at budgetRefillsAt (null: it ends first). Readiness is AUTHORITY \u2014 a budget is live, not that funds are held. Each allowances[] row carries fundsCoverRemaining: false when the account's balance cannot back that row's whole remaining budget \u2014 a heads-up to mention, not a refusal (budgets above the balance are normal; an owner may top up weekly) \u2014 and null when the coverage read failed or the remaining was not read live; the key is absent at remaining 0, and rows for one token are compared alone. Covers hosted identity + on-chain spend authority ONLY \u2014 the hosted server cannot see the LOCAL signer, so "ready" does not mean the signer can start; verify it with a signer tool call or connect --doctor. An over-budget payment is declined before any money moves; there is no approval queue \u2014 ask the owner to grant or raise the budget. allowances[] carries id, tokenAddress, remainingAtomic, remainingDisplay, nextRefillAt per token. taskBudgets[] rows carry maxAtomic/maxDisplay plus spentAtomic/remainingAtomic/remainingDisplay \u2014 what the chain still allows that budget \u2014 and remainingIsFromChain: false marks a failed read (figures null, never the cap); only live rows are listed, each with its status (pending | open | closing) and isExpired. pendingSubBudgetSignatures[] lists sub-budget rows awaiting YOUR signature, with the haven_sign step. Identity fields: id, name, status, accountAddress, delegateAddress, chainId.`,
|
|
4967
5049
|
nextActionGuidance: ""
|
|
4968
5050
|
},
|
|
4969
5051
|
getAllowances: {
|
|
@@ -5285,7 +5367,7 @@ You are an AI agent whose user has no Haven account yet, or has one but has not
|
|
|
5285
5367
|
|
|
5286
5368
|
## What Haven is, in three sentences
|
|
5287
5369
|
|
|
5288
|
-
Your user gives you a **budget on their own account** \u2014 not their wallet, and not a key to their funds. The budget is a delegation they sign, enforced on-chain: a payment over it, to the wrong recipient, or past its expiry is refused at execution time, not by a dashboard promise. Haven constructs and relays the payments; you get an agent credential and a signing key made on your machine, and your user can revoke the budget without you and without Haven.
|
|
5370
|
+
Your user gives you a **budget on their own account** \u2014 not their wallet, and not a key to their funds. The budget is a delegation they sign, enforced on-chain: a payment over it, to the wrong recipient, or past its expiry is refused at execution time, not by a dashboard promise. The budget also ENDS on a date your user chooses \u2014 30, 90 (default), 180 or 365 days out \u2014 and that day is enforced on-chain too. When the budget ends, your authority to pay ends with it; ask your user to renew it (a new approval on the agent's page, or a new \`budget grant\`). Haven constructs and relays the payments; you get an agent credential and a signing key made on your machine, and your user can revoke the budget without you and without Haven.
|
|
5289
5371
|
|
|
5290
5372
|
## The sequence
|
|
5291
5373
|
|
|
@@ -5358,7 +5440,7 @@ If the approval wait times out, nothing is lost \u2014 your agent is registered
|
|
|
5358
5440
|
Call \`haven_get_agent\`, one of the Haven MCP tools the connector wires into your runtime in step 4. It returns identity plus \`spend_authority_readiness\`:
|
|
5359
5441
|
|
|
5360
5442
|
- \`ready\` \u2014 a budget is live: you have the authority to pay. It does not say the account holds funds \u2014 the \`allowances[]\` rows carry \`funds_cover_remaining\`, and \`false\` there is a heads-up to mention to your user, not a refusal.
|
|
5361
|
-
- \`needs_approval\` \u2014
|
|
5443
|
+
- \`needs_approval\` \u2014 no budget can pay. \`allowances[]\` empty with \`budgetEndedAt\` set: your budget ENDED on that date; waiting will not help \u2014 ask your user to set a new one in their Haven tab. \`allowances[]\` empty with \`budgetEndedAt\` null: nobody approved one yet; ask your user again \u2014 there is no queue. Rows, all spent: it refills at \`budgetRefillsAt\`; tell your user, then wait or ask them to raise it (\`null\`: it ends first; ask them to renew it).
|
|
5362
5444
|
- \`revoked\` \u2014 the credential is not active; ask your user to create a new agent.
|
|
5363
5445
|
|
|
5364
5446
|
\`ready\` covers hosted identity and the budget only, not your local signer. Check that with \`npx -y @haven_ai/connect@<channel> --doctor\`, the same tag your prompt named \u2014 a separate command, so the command-modification rule does not bind it.
|
|
@@ -5394,7 +5476,7 @@ Then:
|
|
|
5394
5476
|
1. Run \`<packages.cli.one_liner> login\`. That command is the manifest's \`packages.cli.one_liner\` (\`/.well-known/haven.json\`) \u2014 run it as given: \`packages.cli.channel\` serves the full spec. It prints a link and a code and does not need my password \u2014 it must never ask for it. Give me the link straight away and wait for me to approve it in my browser.
|
|
5395
5477
|
2. Once I have approved, run \`haven agents connect --name <a name you choose> --budget <amount> --token USDC --period <minutes>\` with the budget I tell you. If I have not given you one, ask me before running it. Add \`--run\` to complete the connection in the same step.
|
|
5396
5478
|
3. ${AGENT_APPROVAL_RELAY_JSON_SENTENCE}
|
|
5397
|
-
4. Once I have approved the budget, verify with the \`haven_get_agent\` tool: \`ready\` means I have given you the authority to pay \u2014 it does not confirm the account holds funds, so if its allowances rows carry \`funds_cover_remaining: false\`, tell me and still try the payment; \`needs_approval\` means my approval has not landed yet.
|
|
5479
|
+
4. Once I have approved the budget, verify with the \`haven_get_agent\` tool: \`ready\` means I have given you the authority to pay \u2014 it does not confirm the account holds funds, so if its allowances rows carry \`funds_cover_remaining: false\`, tell me and still try the payment; \`needs_approval\` with no allowances rows and \`budgetEndedAt\` set means my budget ended on that date \u2014 tell me, and I will set a new one; with no rows and no \`budgetEndedAt\`, my approval has not landed yet; with rows, the budget is spent \u2014 it refills at \`budgetRefillsAt\` (\`null\`: it ends first), so tell me, and I can raise or renew it.
|
|
5398
5480
|
|
|
5399
5481
|
Two things only I can do: approving that budget with my passkey, and funding the account with USDC \u2014 no ETH, Haven sponsors the gas. Tell me if either is missing rather than working around it.
|
|
5400
5482
|
|
|
@@ -5514,8 +5596,10 @@ Do not guess the wallet address, network, or budget.
|
|
|
5514
5596
|
|
|
5515
5597
|
For instant orientation at the start of a session, read the non-secret
|
|
5516
5598
|
\`agent.json\` the connector wrote to your Haven credential directory (typically
|
|
5517
|
-
\`~/.haven/agents/<
|
|
5518
|
-
|
|
5599
|
+
\`~/.haven/agents/<slug>/agent.json\`, where \`<slug>\` is the wiring name of the
|
|
5600
|
+
\`haven-<slug>\` pair \u2014 only a \`--bare\` run, or a \`--replace\` without \`--name\`,
|
|
5601
|
+
names the directory by the agent id instead; if you don't know the folder, list
|
|
5602
|
+
\`~/.haven/agents/\` to find it). It
|
|
5519
5603
|
holds your agent id, Haven wallet address, network, and *configured* per-token
|
|
5520
5604
|
budget, and contains no keys \u2014 the fastest way to answer "who am I and what may
|
|
5521
5605
|
I spend" with no round trip. If that file is absent (some setups don't write
|
|
@@ -5536,7 +5620,13 @@ spending:
|
|
|
5536
5620
|
the user, not a refusal \u2014 a budget above the balance is a normal setup, so
|
|
5537
5621
|
still try the payment; \`null\` means the coverage read failed or the remaining
|
|
5538
5622
|
figure was not read live; the key is absent when the remaining is 0. Rows for
|
|
5539
|
-
one token are compared alone.
|
|
5623
|
+
one token are compared alone. \`needs_approval\` with no \`allowances[]\`
|
|
5624
|
+
rows and \`budgetEndedAt\` set means the budget ENDED on that date \u2014 waiting
|
|
5625
|
+
will not help, ask the owner to set a new one; with no rows and no
|
|
5626
|
+
\`budgetEndedAt\`, nobody approved a budget yet; with rows (all at remaining 0) the
|
|
5627
|
+
budget is spent for this period, and \`budgetRefillsAt\` says when it refills
|
|
5628
|
+
(\`null\`: it ends before it refills) \u2014 tell the user, then wait or ask them
|
|
5629
|
+
to raise it.
|
|
5540
5630
|
- \`mcp__haven__haven_get_allowances\` \u2014 detailed per-token breakdown
|
|
5541
5631
|
(configured, spent, reset window) when you need more than the summary.
|
|
5542
5632
|
- \`mcp__haven__haven_check_funds\` \u2014 whether the account actually HOLDS at
|
|
@@ -5750,8 +5840,10 @@ for example, an invoice carrying an \`x402_payment_url\` to POST with its
|
|
|
5750
5840
|
report it, the merchant's settlement evidence. (A deposit transfer is bound
|
|
5751
5841
|
to its payee and amount on-chain too; the difference is the record, not
|
|
5752
5842
|
the binding.)
|
|
5753
|
-
- **If the quote says stop, stop.** The quote checks the agent's
|
|
5754
|
-
budget at quote time, and it can check a price you state
|
|
5843
|
+
- **If the quote says stop, stop.** The hosted quote checks the agent's
|
|
5844
|
+
remaining budget at quote time, and it can check a price you state
|
|
5845
|
+
(\`expected_amount\`). On the local runtime (\`@haven_ai/mcp\`) the quote
|
|
5846
|
+
checks only a price you state; the budget is checked when you pay.
|
|
5755
5847
|
When it returns \`safe_to_continue: false\` \u2014 the amount exceeds the budget, or
|
|
5756
5848
|
the price does not match what you expected \u2014 it prefills no cap and names no
|
|
5757
5849
|
next tool: stop and tell the user. If the x402 challenge itself is wrong (a
|
|
@@ -5896,8 +5988,8 @@ only part of it was usable), and an optional \`note\` (max 2000 characters)
|
|
|
5896
5988
|
saying what was wrong. It is evidence only: it moves no money, never changes
|
|
5897
5989
|
\`settled\` or any money field, and works only on your own settled
|
|
5898
5990
|
payments \u2014 another agent's payment is refused. A re-report replaces your
|
|
5899
|
-
earlier verdict; the receipt then carries it beside the payment, so
|
|
5900
|
-
|
|
5991
|
+
earlier verdict; the receipt then carries it beside the payment, so a junk
|
|
5992
|
+
delivery does not read as a success.
|
|
5901
5993
|
### Relay a delivered code or credential to the owner \u2014 immediately, verbatim
|
|
5902
5994
|
|
|
5903
5995
|
If a merchant response carries what the user PAID FOR \u2014 a redemption code, gift
|
|
@@ -5969,7 +6061,7 @@ async function discoverMerchantMcpUrl(inputUrl, egress) {
|
|
|
5969
6061
|
} catch (err) {
|
|
5970
6062
|
if (err instanceof MerchantEgressRefusedError || err instanceof MerchantEgressResponseCapError) throw err;
|
|
5971
6063
|
if (isBodyPhaseTimeout(err)) {
|
|
5972
|
-
throw new
|
|
6064
|
+
throw new chunkLZHCIK7L_cjs.MerchantTimeoutError(`Merchant discovery document read timed out after ${timeoutMs}ms.`);
|
|
5973
6065
|
}
|
|
5974
6066
|
continue;
|
|
5975
6067
|
}
|
|
@@ -5988,499 +6080,507 @@ function sameUrl(a, b) {
|
|
|
5988
6080
|
|
|
5989
6081
|
Object.defineProperty(exports, "DEFAULT_NEXT_TOOL_BY_ACTION", {
|
|
5990
6082
|
enumerable: true,
|
|
5991
|
-
get: function () { return
|
|
6083
|
+
get: function () { return chunk4Z7PKLFD_cjs.DEFAULT_NEXT_TOOL_BY_ACTION; }
|
|
5992
6084
|
});
|
|
5993
6085
|
Object.defineProperty(exports, "ERC7710_ASSET_TRANSFER_METHOD", {
|
|
5994
6086
|
enumerable: true,
|
|
5995
|
-
get: function () { return
|
|
6087
|
+
get: function () { return chunk4Z7PKLFD_cjs.ERC7710_ASSET_TRANSFER_METHOD; }
|
|
5996
6088
|
});
|
|
5997
6089
|
Object.defineProperty(exports, "HAVEN_CLIENT_HEADER", {
|
|
5998
6090
|
enumerable: true,
|
|
5999
|
-
get: function () { return
|
|
6091
|
+
get: function () { return chunk4Z7PKLFD_cjs.HAVEN_CLIENT_HEADER; }
|
|
6000
6092
|
});
|
|
6001
6093
|
Object.defineProperty(exports, "HAVEN_MINIMUM_NODE_VERSION", {
|
|
6002
6094
|
enumerable: true,
|
|
6003
|
-
get: function () { return
|
|
6095
|
+
get: function () { return chunk4Z7PKLFD_cjs.HAVEN_MINIMUM_NODE_VERSION; }
|
|
6004
6096
|
});
|
|
6005
6097
|
Object.defineProperty(exports, "HavenTypedDataRefusedError", {
|
|
6006
6098
|
enumerable: true,
|
|
6007
|
-
get: function () { return
|
|
6099
|
+
get: function () { return chunk4Z7PKLFD_cjs.HavenTypedDataRefusedError; }
|
|
6008
6100
|
});
|
|
6009
6101
|
Object.defineProperty(exports, "MAX_TASK_BUDGET_TTL_SECONDS", {
|
|
6010
6102
|
enumerable: true,
|
|
6011
|
-
get: function () { return
|
|
6103
|
+
get: function () { return chunk4Z7PKLFD_cjs.MAX_TASK_BUDGET_TTL_SECONDS; }
|
|
6012
6104
|
});
|
|
6013
6105
|
Object.defineProperty(exports, "NEXT_TOOL_SERVER_NAMES", {
|
|
6014
6106
|
enumerable: true,
|
|
6015
|
-
get: function () { return
|
|
6107
|
+
get: function () { return chunk4Z7PKLFD_cjs.NEXT_TOOL_SERVER_NAMES; }
|
|
6016
6108
|
});
|
|
6017
6109
|
Object.defineProperty(exports, "NEXT_TOOL_SERVER_ROLES", {
|
|
6018
6110
|
enumerable: true,
|
|
6019
|
-
get: function () { return
|
|
6111
|
+
get: function () { return chunk4Z7PKLFD_cjs.NEXT_TOOL_SERVER_ROLES; }
|
|
6020
6112
|
});
|
|
6021
6113
|
Object.defineProperty(exports, "SDK_CLIENT_IDENTITY", {
|
|
6022
6114
|
enumerable: true,
|
|
6023
|
-
get: function () { return
|
|
6115
|
+
get: function () { return chunk4Z7PKLFD_cjs.SDK_CLIENT_IDENTITY; }
|
|
6024
6116
|
});
|
|
6025
6117
|
Object.defineProperty(exports, "SDK_VERSION", {
|
|
6026
6118
|
enumerable: true,
|
|
6027
|
-
get: function () { return
|
|
6119
|
+
get: function () { return chunk4Z7PKLFD_cjs.SDK_VERSION; }
|
|
6028
6120
|
});
|
|
6029
6121
|
Object.defineProperty(exports, "SWEEP_BASE_CHAIN_ID", {
|
|
6030
6122
|
enumerable: true,
|
|
6031
|
-
get: function () { return
|
|
6123
|
+
get: function () { return chunk4Z7PKLFD_cjs.SWEEP_BASE_CHAIN_ID; }
|
|
6032
6124
|
});
|
|
6033
6125
|
Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_CHAIN_ID", {
|
|
6034
6126
|
enumerable: true,
|
|
6035
|
-
get: function () { return
|
|
6127
|
+
get: function () { return chunk4Z7PKLFD_cjs.SWEEP_BASE_SEPOLIA_CHAIN_ID; }
|
|
6036
6128
|
});
|
|
6037
6129
|
Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_USDC_ADDRESS", {
|
|
6038
6130
|
enumerable: true,
|
|
6039
|
-
get: function () { return
|
|
6131
|
+
get: function () { return chunk4Z7PKLFD_cjs.SWEEP_BASE_SEPOLIA_USDC_ADDRESS; }
|
|
6040
6132
|
});
|
|
6041
6133
|
Object.defineProperty(exports, "SWEEP_BASE_USDC_ADDRESS", {
|
|
6042
6134
|
enumerable: true,
|
|
6043
|
-
get: function () { return
|
|
6135
|
+
get: function () { return chunk4Z7PKLFD_cjs.SWEEP_BASE_USDC_ADDRESS; }
|
|
6044
6136
|
});
|
|
6045
6137
|
Object.defineProperty(exports, "TRANSFER_WITH_AUTHORIZATION_TYPES", {
|
|
6046
6138
|
enumerable: true,
|
|
6047
|
-
get: function () { return
|
|
6139
|
+
get: function () { return chunk4Z7PKLFD_cjs.TRANSFER_WITH_AUTHORIZATION_TYPES; }
|
|
6048
6140
|
});
|
|
6049
6141
|
Object.defineProperty(exports, "TYPED_DATA_NOT_ALLOWED", {
|
|
6050
6142
|
enumerable: true,
|
|
6051
|
-
get: function () { return
|
|
6143
|
+
get: function () { return chunk4Z7PKLFD_cjs.TYPED_DATA_NOT_ALLOWED; }
|
|
6052
6144
|
});
|
|
6053
6145
|
Object.defineProperty(exports, "X402PaymentHeaderValidationError", {
|
|
6054
6146
|
enumerable: true,
|
|
6055
|
-
get: function () { return
|
|
6147
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402PaymentHeaderValidationError; }
|
|
6056
6148
|
});
|
|
6057
6149
|
Object.defineProperty(exports, "X402_LEGACY_PAYMENT_HEADER_NAME", {
|
|
6058
6150
|
enumerable: true,
|
|
6059
|
-
get: function () { return
|
|
6151
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402_LEGACY_PAYMENT_HEADER_NAME; }
|
|
6060
6152
|
});
|
|
6061
6153
|
Object.defineProperty(exports, "X402_MAX_AUTHORIZATION_WINDOW_SECONDS", {
|
|
6062
6154
|
enumerable: true,
|
|
6063
|
-
get: function () { return
|
|
6155
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402_MAX_AUTHORIZATION_WINDOW_SECONDS; }
|
|
6064
6156
|
});
|
|
6065
6157
|
Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAME", {
|
|
6066
6158
|
enumerable: true,
|
|
6067
|
-
get: function () { return
|
|
6159
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402_PAYMENT_HEADER_NAME; }
|
|
6068
6160
|
});
|
|
6069
6161
|
Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAMES_SENT", {
|
|
6070
6162
|
enumerable: true,
|
|
6071
|
-
get: function () { return
|
|
6163
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402_PAYMENT_HEADER_NAMES_SENT; }
|
|
6072
6164
|
});
|
|
6073
6165
|
Object.defineProperty(exports, "X402_PAYMENT_NONCE_TAG", {
|
|
6074
6166
|
enumerable: true,
|
|
6075
|
-
get: function () { return
|
|
6167
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402_PAYMENT_NONCE_TAG; }
|
|
6076
6168
|
});
|
|
6077
6169
|
Object.defineProperty(exports, "X402_PAYMENT_REQUIRED_HEADER_NAME", {
|
|
6078
6170
|
enumerable: true,
|
|
6079
|
-
get: function () { return
|
|
6171
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402_PAYMENT_REQUIRED_HEADER_NAME; }
|
|
6080
6172
|
});
|
|
6081
6173
|
Object.defineProperty(exports, "X402_PAYMENT_RESPONSE_HEADER_NAME", {
|
|
6082
6174
|
enumerable: true,
|
|
6083
|
-
get: function () { return
|
|
6175
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402_PAYMENT_RESPONSE_HEADER_NAME; }
|
|
6084
6176
|
});
|
|
6085
6177
|
Object.defineProperty(exports, "X402_SETTLEMENT_FORWARD_MARGIN_SECONDS", {
|
|
6086
6178
|
enumerable: true,
|
|
6087
|
-
get: function () { return
|
|
6179
|
+
get: function () { return chunk4Z7PKLFD_cjs.X402_SETTLEMENT_FORWARD_MARGIN_SECONDS; }
|
|
6088
6180
|
});
|
|
6089
6181
|
Object.defineProperty(exports, "assertBoundDirectPaymentUserOp", {
|
|
6090
6182
|
enumerable: true,
|
|
6091
|
-
get: function () { return
|
|
6183
|
+
get: function () { return chunk4Z7PKLFD_cjs.assertBoundDirectPaymentUserOp; }
|
|
6092
6184
|
});
|
|
6093
6185
|
Object.defineProperty(exports, "assertOwnTaskBudgetCloseUserOp", {
|
|
6094
6186
|
enumerable: true,
|
|
6095
|
-
get: function () { return
|
|
6187
|
+
get: function () { return chunk4Z7PKLFD_cjs.assertOwnTaskBudgetCloseUserOp; }
|
|
6096
6188
|
});
|
|
6097
6189
|
Object.defineProperty(exports, "assertOwnTaskChild", {
|
|
6098
6190
|
enumerable: true,
|
|
6099
|
-
get: function () { return
|
|
6191
|
+
get: function () { return chunk4Z7PKLFD_cjs.assertOwnTaskChild; }
|
|
6100
6192
|
});
|
|
6101
6193
|
Object.defineProperty(exports, "buildSweepAuthorizationMessage", {
|
|
6102
6194
|
enumerable: true,
|
|
6103
|
-
get: function () { return
|
|
6195
|
+
get: function () { return chunk4Z7PKLFD_cjs.buildSweepAuthorizationMessage; }
|
|
6104
6196
|
});
|
|
6105
6197
|
Object.defineProperty(exports, "buildSweepTypedData", {
|
|
6106
6198
|
enumerable: true,
|
|
6107
|
-
get: function () { return
|
|
6199
|
+
get: function () { return chunk4Z7PKLFD_cjs.buildSweepTypedData; }
|
|
6108
6200
|
});
|
|
6109
6201
|
Object.defineProperty(exports, "buildX402ExpectedMessage", {
|
|
6110
6202
|
enumerable: true,
|
|
6111
|
-
get: function () { return
|
|
6203
|
+
get: function () { return chunk4Z7PKLFD_cjs.buildX402ExpectedMessage; }
|
|
6112
6204
|
});
|
|
6113
6205
|
Object.defineProperty(exports, "compareNodeVersions", {
|
|
6114
6206
|
enumerable: true,
|
|
6115
|
-
get: function () { return
|
|
6207
|
+
get: function () { return chunk4Z7PKLFD_cjs.compareNodeVersions; }
|
|
6116
6208
|
});
|
|
6117
6209
|
Object.defineProperty(exports, "createNextStepBuilder", {
|
|
6118
6210
|
enumerable: true,
|
|
6119
|
-
get: function () { return
|
|
6211
|
+
get: function () { return chunk4Z7PKLFD_cjs.createNextStepBuilder; }
|
|
6120
6212
|
});
|
|
6121
6213
|
Object.defineProperty(exports, "decodeBase64Json", {
|
|
6122
6214
|
enumerable: true,
|
|
6123
|
-
get: function () { return
|
|
6215
|
+
get: function () { return chunk4Z7PKLFD_cjs.decodeBase64Json; }
|
|
6124
6216
|
});
|
|
6125
6217
|
Object.defineProperty(exports, "decodeBase64Utf8", {
|
|
6126
6218
|
enumerable: true,
|
|
6127
|
-
get: function () { return
|
|
6219
|
+
get: function () { return chunk4Z7PKLFD_cjs.decodeBase64Utf8; }
|
|
6128
6220
|
});
|
|
6129
6221
|
Object.defineProperty(exports, "defaultNextToolFor", {
|
|
6130
6222
|
enumerable: true,
|
|
6131
|
-
get: function () { return
|
|
6223
|
+
get: function () { return chunk4Z7PKLFD_cjs.defaultNextToolFor; }
|
|
6132
6224
|
});
|
|
6133
6225
|
Object.defineProperty(exports, "deriveX402PaymentNonce", {
|
|
6134
6226
|
enumerable: true,
|
|
6135
|
-
get: function () { return
|
|
6227
|
+
get: function () { return chunk4Z7PKLFD_cjs.deriveX402PaymentNonce; }
|
|
6136
6228
|
});
|
|
6137
6229
|
Object.defineProperty(exports, "encodeBase64Json", {
|
|
6138
6230
|
enumerable: true,
|
|
6139
|
-
get: function () { return
|
|
6231
|
+
get: function () { return chunk4Z7PKLFD_cjs.encodeBase64Json; }
|
|
6140
6232
|
});
|
|
6141
6233
|
Object.defineProperty(exports, "encodeBase64Utf8", {
|
|
6142
6234
|
enumerable: true,
|
|
6143
|
-
get: function () { return
|
|
6235
|
+
get: function () { return chunk4Z7PKLFD_cjs.encodeBase64Utf8; }
|
|
6144
6236
|
});
|
|
6145
6237
|
Object.defineProperty(exports, "encodePaymentProof", {
|
|
6146
6238
|
enumerable: true,
|
|
6147
|
-
get: function () { return
|
|
6239
|
+
get: function () { return chunk4Z7PKLFD_cjs.encodePaymentProof; }
|
|
6148
6240
|
});
|
|
6149
6241
|
Object.defineProperty(exports, "hashDelegation", {
|
|
6150
6242
|
enumerable: true,
|
|
6151
|
-
get: function () { return
|
|
6243
|
+
get: function () { return chunk4Z7PKLFD_cjs.hashDelegation; }
|
|
6152
6244
|
});
|
|
6153
6245
|
Object.defineProperty(exports, "havenClientIdentity", {
|
|
6154
6246
|
enumerable: true,
|
|
6155
|
-
get: function () { return
|
|
6247
|
+
get: function () { return chunk4Z7PKLFD_cjs.havenClientIdentity; }
|
|
6156
6248
|
});
|
|
6157
6249
|
Object.defineProperty(exports, "isErc7710Option", {
|
|
6158
6250
|
enumerable: true,
|
|
6159
|
-
get: function () { return
|
|
6251
|
+
get: function () { return chunk4Z7PKLFD_cjs.isErc7710Option; }
|
|
6160
6252
|
});
|
|
6161
6253
|
Object.defineProperty(exports, "isSupportedNodeVersion", {
|
|
6162
6254
|
enumerable: true,
|
|
6163
|
-
get: function () { return
|
|
6255
|
+
get: function () { return chunk4Z7PKLFD_cjs.isSupportedNodeVersion; }
|
|
6164
6256
|
});
|
|
6165
6257
|
Object.defineProperty(exports, "isSweepableChain", {
|
|
6166
6258
|
enumerable: true,
|
|
6167
|
-
get: function () { return
|
|
6259
|
+
get: function () { return chunk4Z7PKLFD_cjs.isSweepableChain; }
|
|
6168
6260
|
});
|
|
6169
6261
|
Object.defineProperty(exports, "isTaskChildTypedData", {
|
|
6170
6262
|
enumerable: true,
|
|
6171
|
-
get: function () { return
|
|
6263
|
+
get: function () { return chunk4Z7PKLFD_cjs.isTaskChildTypedData; }
|
|
6172
6264
|
});
|
|
6173
6265
|
Object.defineProperty(exports, "normalizePaymentRequired", {
|
|
6174
6266
|
enumerable: true,
|
|
6175
|
-
get: function () { return
|
|
6267
|
+
get: function () { return chunk4Z7PKLFD_cjs.normalizePaymentRequired; }
|
|
6176
6268
|
});
|
|
6177
6269
|
Object.defineProperty(exports, "parseNextTool", {
|
|
6178
6270
|
enumerable: true,
|
|
6179
|
-
get: function () { return
|
|
6271
|
+
get: function () { return chunk4Z7PKLFD_cjs.parseNextTool; }
|
|
6180
6272
|
});
|
|
6181
6273
|
Object.defineProperty(exports, "parsePaymentRequired", {
|
|
6182
6274
|
enumerable: true,
|
|
6183
|
-
get: function () { return
|
|
6275
|
+
get: function () { return chunk4Z7PKLFD_cjs.parsePaymentRequired; }
|
|
6184
6276
|
});
|
|
6185
6277
|
Object.defineProperty(exports, "parsePaymentRequiredResponse", {
|
|
6186
6278
|
enumerable: true,
|
|
6187
|
-
get: function () { return
|
|
6279
|
+
get: function () { return chunk4Z7PKLFD_cjs.parsePaymentRequiredResponse; }
|
|
6188
6280
|
});
|
|
6189
6281
|
Object.defineProperty(exports, "readClientUpdate", {
|
|
6190
6282
|
enumerable: true,
|
|
6191
|
-
get: function () { return
|
|
6283
|
+
get: function () { return chunk4Z7PKLFD_cjs.readClientUpdate; }
|
|
6192
6284
|
});
|
|
6193
6285
|
Object.defineProperty(exports, "renderNextTool", {
|
|
6194
6286
|
enumerable: true,
|
|
6195
|
-
get: function () { return
|
|
6287
|
+
get: function () { return chunk4Z7PKLFD_cjs.renderNextTool; }
|
|
6196
6288
|
});
|
|
6197
6289
|
Object.defineProperty(exports, "resolveTokenBySymbol", {
|
|
6198
6290
|
enumerable: true,
|
|
6199
|
-
get: function () { return
|
|
6291
|
+
get: function () { return chunk4Z7PKLFD_cjs.resolveTokenBySymbol; }
|
|
6200
6292
|
});
|
|
6201
6293
|
Object.defineProperty(exports, "resolveTokenFromAddress", {
|
|
6202
6294
|
enumerable: true,
|
|
6203
|
-
get: function () { return
|
|
6295
|
+
get: function () { return chunk4Z7PKLFD_cjs.resolveTokenFromAddress; }
|
|
6204
6296
|
});
|
|
6205
6297
|
Object.defineProperty(exports, "selectErc7710PaymentOption", {
|
|
6206
6298
|
enumerable: true,
|
|
6207
|
-
get: function () { return
|
|
6299
|
+
get: function () { return chunk4Z7PKLFD_cjs.selectErc7710PaymentOption; }
|
|
6208
6300
|
});
|
|
6209
6301
|
Object.defineProperty(exports, "selectPaymentOption", {
|
|
6210
6302
|
enumerable: true,
|
|
6211
|
-
get: function () { return
|
|
6303
|
+
get: function () { return chunk4Z7PKLFD_cjs.selectPaymentOption; }
|
|
6212
6304
|
});
|
|
6213
6305
|
Object.defineProperty(exports, "selectStandardPaymentOption", {
|
|
6214
6306
|
enumerable: true,
|
|
6215
|
-
get: function () { return
|
|
6307
|
+
get: function () { return chunk4Z7PKLFD_cjs.selectStandardPaymentOption; }
|
|
6216
6308
|
});
|
|
6217
6309
|
Object.defineProperty(exports, "selectX402SettlementScheme", {
|
|
6218
6310
|
enumerable: true,
|
|
6219
|
-
get: function () { return
|
|
6311
|
+
get: function () { return chunk4Z7PKLFD_cjs.selectX402SettlementScheme; }
|
|
6220
6312
|
});
|
|
6221
6313
|
Object.defineProperty(exports, "sweepUsdcAddress", {
|
|
6222
6314
|
enumerable: true,
|
|
6223
|
-
get: function () { return
|
|
6315
|
+
get: function () { return chunk4Z7PKLFD_cjs.sweepUsdcAddress; }
|
|
6224
6316
|
});
|
|
6225
6317
|
Object.defineProperty(exports, "sweepUsdcDomain", {
|
|
6226
6318
|
enumerable: true,
|
|
6227
|
-
get: function () { return
|
|
6319
|
+
get: function () { return chunk4Z7PKLFD_cjs.sweepUsdcDomain; }
|
|
6228
6320
|
});
|
|
6229
6321
|
Object.defineProperty(exports, "toStandardPaymentRequirements", {
|
|
6230
6322
|
enumerable: true,
|
|
6231
|
-
get: function () { return
|
|
6323
|
+
get: function () { return chunk4Z7PKLFD_cjs.toStandardPaymentRequirements; }
|
|
6232
6324
|
});
|
|
6233
6325
|
Object.defineProperty(exports, "unsupportedNodeVersionMessage", {
|
|
6234
6326
|
enumerable: true,
|
|
6235
|
-
get: function () { return
|
|
6327
|
+
get: function () { return chunk4Z7PKLFD_cjs.unsupportedNodeVersionMessage; }
|
|
6236
6328
|
});
|
|
6237
6329
|
Object.defineProperty(exports, "validateStandardX402PaymentHeader", {
|
|
6238
6330
|
enumerable: true,
|
|
6239
|
-
get: function () { return
|
|
6331
|
+
get: function () { return chunk4Z7PKLFD_cjs.validateStandardX402PaymentHeader; }
|
|
6240
6332
|
});
|
|
6241
6333
|
Object.defineProperty(exports, "x402AssetTransferMethod", {
|
|
6242
6334
|
enumerable: true,
|
|
6243
|
-
get: function () { return
|
|
6335
|
+
get: function () { return chunk4Z7PKLFD_cjs.x402AssetTransferMethod; }
|
|
6244
6336
|
});
|
|
6245
6337
|
Object.defineProperty(exports, "x402AuthorizationAmount", {
|
|
6246
6338
|
enumerable: true,
|
|
6247
|
-
get: function () { return
|
|
6339
|
+
get: function () { return chunk4Z7PKLFD_cjs.x402AuthorizationAmount; }
|
|
6248
6340
|
});
|
|
6249
6341
|
Object.defineProperty(exports, "x402FacilitatorAddresses", {
|
|
6250
6342
|
enumerable: true,
|
|
6251
|
-
get: function () { return
|
|
6343
|
+
get: function () { return chunk4Z7PKLFD_cjs.x402FacilitatorAddresses; }
|
|
6252
6344
|
});
|
|
6253
6345
|
Object.defineProperty(exports, "x402PaymentHeaderNamesFor", {
|
|
6254
6346
|
enumerable: true,
|
|
6255
|
-
get: function () { return
|
|
6347
|
+
get: function () { return chunk4Z7PKLFD_cjs.x402PaymentHeaderNamesFor; }
|
|
6256
6348
|
});
|
|
6257
6349
|
Object.defineProperty(exports, "x402RetryHeadersFor", {
|
|
6258
6350
|
enumerable: true,
|
|
6259
|
-
get: function () { return
|
|
6351
|
+
get: function () { return chunk4Z7PKLFD_cjs.x402RetryHeadersFor; }
|
|
6260
6352
|
});
|
|
6261
6353
|
Object.defineProperty(exports, "x402V2PaymentEnvelope", {
|
|
6262
6354
|
enumerable: true,
|
|
6263
|
-
get: function () { return
|
|
6355
|
+
get: function () { return chunk4Z7PKLFD_cjs.x402V2PaymentEnvelope; }
|
|
6264
6356
|
});
|
|
6265
6357
|
Object.defineProperty(exports, "RECEIPT_VERSION", {
|
|
6266
6358
|
enumerable: true,
|
|
6267
|
-
get: function () { return
|
|
6359
|
+
get: function () { return chunkZ5MTKU6O_cjs.RECEIPT_VERSION; }
|
|
6268
6360
|
});
|
|
6269
6361
|
Object.defineProperty(exports, "verifyPaymentReceipt", {
|
|
6270
6362
|
enumerable: true,
|
|
6271
|
-
get: function () { return
|
|
6363
|
+
get: function () { return chunkZ5MTKU6O_cjs.verifyPaymentReceipt; }
|
|
6272
6364
|
});
|
|
6273
6365
|
Object.defineProperty(exports, "AGENT_PAYMENT_FAILURE_CODE_VALUES", {
|
|
6274
6366
|
enumerable: true,
|
|
6275
|
-
get: function () { return
|
|
6367
|
+
get: function () { return chunkLZHCIK7L_cjs.AGENT_PAYMENT_FAILURE_CODE_VALUES; }
|
|
6276
6368
|
});
|
|
6277
6369
|
Object.defineProperty(exports, "AGENT_PAYMENT_NEXT_ACTION_VALUES", {
|
|
6278
6370
|
enumerable: true,
|
|
6279
|
-
get: function () { return
|
|
6371
|
+
get: function () { return chunkLZHCIK7L_cjs.AGENT_PAYMENT_NEXT_ACTION_VALUES; }
|
|
6280
6372
|
});
|
|
6281
6373
|
Object.defineProperty(exports, "AGENT_PAYMENT_PHASE_VALUES", {
|
|
6282
6374
|
enumerable: true,
|
|
6283
|
-
get: function () { return
|
|
6375
|
+
get: function () { return chunkLZHCIK7L_cjs.AGENT_PAYMENT_PHASE_VALUES; }
|
|
6284
6376
|
});
|
|
6285
6377
|
Object.defineProperty(exports, "AGENT_PAYMENT_RAIL_VALUES", {
|
|
6286
6378
|
enumerable: true,
|
|
6287
|
-
get: function () { return
|
|
6379
|
+
get: function () { return chunkLZHCIK7L_cjs.AGENT_PAYMENT_RAIL_VALUES; }
|
|
6288
6380
|
});
|
|
6289
6381
|
Object.defineProperty(exports, "AgentPaymentFailureCode", {
|
|
6290
6382
|
enumerable: true,
|
|
6291
|
-
get: function () { return
|
|
6383
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentFailureCode; }
|
|
6292
6384
|
});
|
|
6293
6385
|
Object.defineProperty(exports, "AgentPaymentFailureCodeDescriptions", {
|
|
6294
6386
|
enumerable: true,
|
|
6295
|
-
get: function () { return
|
|
6387
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentFailureCodeDescriptions; }
|
|
6296
6388
|
});
|
|
6297
6389
|
Object.defineProperty(exports, "AgentPaymentFailureCodeSchema", {
|
|
6298
6390
|
enumerable: true,
|
|
6299
|
-
get: function () { return
|
|
6391
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentFailureCodeSchema; }
|
|
6300
6392
|
});
|
|
6301
6393
|
Object.defineProperty(exports, "AgentPaymentNextAction", {
|
|
6302
6394
|
enumerable: true,
|
|
6303
|
-
get: function () { return
|
|
6395
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentNextAction; }
|
|
6304
6396
|
});
|
|
6305
6397
|
Object.defineProperty(exports, "AgentPaymentNextActionDescriptions", {
|
|
6306
6398
|
enumerable: true,
|
|
6307
|
-
get: function () { return
|
|
6399
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentNextActionDescriptions; }
|
|
6308
6400
|
});
|
|
6309
6401
|
Object.defineProperty(exports, "AgentPaymentNextActionSchema", {
|
|
6310
6402
|
enumerable: true,
|
|
6311
|
-
get: function () { return
|
|
6403
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentNextActionSchema; }
|
|
6312
6404
|
});
|
|
6313
6405
|
Object.defineProperty(exports, "AgentPaymentPhase", {
|
|
6314
6406
|
enumerable: true,
|
|
6315
|
-
get: function () { return
|
|
6407
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentPhase; }
|
|
6316
6408
|
});
|
|
6317
6409
|
Object.defineProperty(exports, "AgentPaymentPhaseDescriptions", {
|
|
6318
6410
|
enumerable: true,
|
|
6319
|
-
get: function () { return
|
|
6411
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentPhaseDescriptions; }
|
|
6320
6412
|
});
|
|
6321
6413
|
Object.defineProperty(exports, "AgentPaymentPhaseSchema", {
|
|
6322
6414
|
enumerable: true,
|
|
6323
|
-
get: function () { return
|
|
6415
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentPhaseSchema; }
|
|
6324
6416
|
});
|
|
6325
6417
|
Object.defineProperty(exports, "AgentPaymentRail", {
|
|
6326
6418
|
enumerable: true,
|
|
6327
|
-
get: function () { return
|
|
6419
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentRail; }
|
|
6328
6420
|
});
|
|
6329
6421
|
Object.defineProperty(exports, "AgentPaymentRailDescriptions", {
|
|
6330
6422
|
enumerable: true,
|
|
6331
|
-
get: function () { return
|
|
6423
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentRailDescriptions; }
|
|
6332
6424
|
});
|
|
6333
6425
|
Object.defineProperty(exports, "AgentPaymentRailSchema", {
|
|
6334
6426
|
enumerable: true,
|
|
6335
|
-
get: function () { return
|
|
6427
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentRailSchema; }
|
|
6336
6428
|
});
|
|
6337
6429
|
Object.defineProperty(exports, "AgentPaymentWarningCode", {
|
|
6338
6430
|
enumerable: true,
|
|
6339
|
-
get: function () { return
|
|
6431
|
+
get: function () { return chunkLZHCIK7L_cjs.AgentPaymentWarningCode; }
|
|
6340
6432
|
});
|
|
6341
6433
|
Object.defineProperty(exports, "CONNECTOR_PACKAGE_NAME", {
|
|
6342
6434
|
enumerable: true,
|
|
6343
|
-
get: function () { return
|
|
6435
|
+
get: function () { return chunkLZHCIK7L_cjs.CONNECTOR_PACKAGE_NAME; }
|
|
6344
6436
|
});
|
|
6345
6437
|
Object.defineProperty(exports, "DEFAULT_CONFIRMATION_TIMEOUT_MS", {
|
|
6346
6438
|
enumerable: true,
|
|
6347
|
-
get: function () { return
|
|
6439
|
+
get: function () { return chunkLZHCIK7L_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS; }
|
|
6348
6440
|
});
|
|
6349
6441
|
Object.defineProperty(exports, "DIRECT_SIGN_CONTEXT_VERSION", {
|
|
6350
6442
|
enumerable: true,
|
|
6351
|
-
get: function () { return
|
|
6443
|
+
get: function () { return chunkLZHCIK7L_cjs.DIRECT_SIGN_CONTEXT_VERSION; }
|
|
6352
6444
|
});
|
|
6353
6445
|
Object.defineProperty(exports, "ENTRY_POINT_V07", {
|
|
6354
6446
|
enumerable: true,
|
|
6355
|
-
get: function () { return
|
|
6447
|
+
get: function () { return chunkLZHCIK7L_cjs.ENTRY_POINT_V07; }
|
|
6448
|
+
});
|
|
6449
|
+
Object.defineProperty(exports, "FundingConfirmationUnknownError", {
|
|
6450
|
+
enumerable: true,
|
|
6451
|
+
get: function () { return chunkLZHCIK7L_cjs.FundingConfirmationUnknownError; }
|
|
6452
|
+
});
|
|
6453
|
+
Object.defineProperty(exports, "FundingRevertedError", {
|
|
6454
|
+
enumerable: true,
|
|
6455
|
+
get: function () { return chunkLZHCIK7L_cjs.FundingRevertedError; }
|
|
6356
6456
|
});
|
|
6357
6457
|
Object.defineProperty(exports, "HAVEN_CONNECTOR_CHANNEL", {
|
|
6358
6458
|
enumerable: true,
|
|
6359
|
-
get: function () { return
|
|
6459
|
+
get: function () { return chunkLZHCIK7L_cjs.HAVEN_CONNECTOR_CHANNEL; }
|
|
6360
6460
|
});
|
|
6361
6461
|
Object.defineProperty(exports, "HYBRID_DELEGATOR_DOMAIN_NAME", {
|
|
6362
6462
|
enumerable: true,
|
|
6363
|
-
get: function () { return
|
|
6463
|
+
get: function () { return chunkLZHCIK7L_cjs.HYBRID_DELEGATOR_DOMAIN_NAME; }
|
|
6364
6464
|
});
|
|
6365
6465
|
Object.defineProperty(exports, "HYBRID_DELEGATOR_DOMAIN_VERSION", {
|
|
6366
6466
|
enumerable: true,
|
|
6367
|
-
get: function () { return
|
|
6467
|
+
get: function () { return chunkLZHCIK7L_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION; }
|
|
6368
6468
|
});
|
|
6369
6469
|
Object.defineProperty(exports, "HavenApiError", {
|
|
6370
6470
|
enumerable: true,
|
|
6371
|
-
get: function () { return
|
|
6471
|
+
get: function () { return chunkLZHCIK7L_cjs.HavenApiError; }
|
|
6372
6472
|
});
|
|
6373
6473
|
Object.defineProperty(exports, "HavenError", {
|
|
6374
6474
|
enumerable: true,
|
|
6375
|
-
get: function () { return
|
|
6475
|
+
get: function () { return chunkLZHCIK7L_cjs.HavenError; }
|
|
6376
6476
|
});
|
|
6377
6477
|
Object.defineProperty(exports, "HavenPaymentStateError", {
|
|
6378
6478
|
enumerable: true,
|
|
6379
|
-
get: function () { return
|
|
6479
|
+
get: function () { return chunkLZHCIK7L_cjs.HavenPaymentStateError; }
|
|
6380
6480
|
});
|
|
6381
6481
|
Object.defineProperty(exports, "HavenSigningError", {
|
|
6382
6482
|
enumerable: true,
|
|
6383
|
-
get: function () { return
|
|
6483
|
+
get: function () { return chunkLZHCIK7L_cjs.HavenSigningError; }
|
|
6384
6484
|
});
|
|
6385
6485
|
Object.defineProperty(exports, "HavenTimeoutError", {
|
|
6386
6486
|
enumerable: true,
|
|
6387
|
-
get: function () { return
|
|
6487
|
+
get: function () { return chunkLZHCIK7L_cjs.HavenTimeoutError; }
|
|
6388
6488
|
});
|
|
6389
6489
|
Object.defineProperty(exports, "HavenUnsupportedSignerVersionError", {
|
|
6390
6490
|
enumerable: true,
|
|
6391
|
-
get: function () { return
|
|
6491
|
+
get: function () { return chunkLZHCIK7L_cjs.HavenUnsupportedSignerVersionError; }
|
|
6392
6492
|
});
|
|
6393
6493
|
Object.defineProperty(exports, "HavenUserOpBindingError", {
|
|
6394
6494
|
enumerable: true,
|
|
6395
|
-
get: function () { return
|
|
6495
|
+
get: function () { return chunkLZHCIK7L_cjs.HavenUserOpBindingError; }
|
|
6396
6496
|
});
|
|
6397
6497
|
Object.defineProperty(exports, "HavenZeroSettlementHashError", {
|
|
6398
6498
|
enumerable: true,
|
|
6399
|
-
get: function () { return
|
|
6499
|
+
get: function () { return chunkLZHCIK7L_cjs.HavenZeroSettlementHashError; }
|
|
6400
6500
|
});
|
|
6401
6501
|
Object.defineProperty(exports, "MerchantTimeoutError", {
|
|
6402
6502
|
enumerable: true,
|
|
6403
|
-
get: function () { return
|
|
6503
|
+
get: function () { return chunkLZHCIK7L_cjs.MerchantTimeoutError; }
|
|
6404
6504
|
});
|
|
6405
6505
|
Object.defineProperty(exports, "PACKED_USER_OPERATION_FIELDS", {
|
|
6406
6506
|
enumerable: true,
|
|
6407
|
-
get: function () { return
|
|
6507
|
+
get: function () { return chunkLZHCIK7L_cjs.PACKED_USER_OPERATION_FIELDS; }
|
|
6408
6508
|
});
|
|
6409
6509
|
Object.defineProperty(exports, "ROOT_AUTHORITY", {
|
|
6410
6510
|
enumerable: true,
|
|
6411
|
-
get: function () { return
|
|
6511
|
+
get: function () { return chunkLZHCIK7L_cjs.ROOT_AUTHORITY; }
|
|
6412
6512
|
});
|
|
6413
6513
|
Object.defineProperty(exports, "SIGNER_UPDATE_FALLBACK", {
|
|
6414
6514
|
enumerable: true,
|
|
6415
|
-
get: function () { return
|
|
6515
|
+
get: function () { return chunkLZHCIK7L_cjs.SIGNER_UPDATE_FALLBACK; }
|
|
6416
6516
|
});
|
|
6417
6517
|
Object.defineProperty(exports, "SignerRefusalCode", {
|
|
6418
6518
|
enumerable: true,
|
|
6419
|
-
get: function () { return
|
|
6519
|
+
get: function () { return chunkLZHCIK7L_cjs.SignerRefusalCode; }
|
|
6420
6520
|
});
|
|
6421
6521
|
Object.defineProperty(exports, "TASK_SIGN_CONTEXT_VERSION", {
|
|
6422
6522
|
enumerable: true,
|
|
6423
|
-
get: function () { return
|
|
6523
|
+
get: function () { return chunkLZHCIK7L_cjs.TASK_SIGN_CONTEXT_VERSION; }
|
|
6424
6524
|
});
|
|
6425
6525
|
Object.defineProperty(exports, "X402AlreadySettledError", {
|
|
6426
6526
|
enumerable: true,
|
|
6427
|
-
get: function () { return
|
|
6527
|
+
get: function () { return chunkLZHCIK7L_cjs.X402AlreadySettledError; }
|
|
6428
6528
|
});
|
|
6429
6529
|
Object.defineProperty(exports, "X402Erc7710AlreadySettledError", {
|
|
6430
6530
|
enumerable: true,
|
|
6431
|
-
get: function () { return
|
|
6531
|
+
get: function () { return chunkLZHCIK7L_cjs.X402Erc7710AlreadySettledError; }
|
|
6432
6532
|
});
|
|
6433
6533
|
Object.defineProperty(exports, "X402TaskBudgetMismatchError", {
|
|
6434
6534
|
enumerable: true,
|
|
6435
|
-
get: function () { return
|
|
6535
|
+
get: function () { return chunkLZHCIK7L_cjs.X402TaskBudgetMismatchError; }
|
|
6436
6536
|
});
|
|
6437
6537
|
Object.defineProperty(exports, "X402UnexpectedStatusError", {
|
|
6438
6538
|
enumerable: true,
|
|
6439
|
-
get: function () { return
|
|
6539
|
+
get: function () { return chunkLZHCIK7L_cjs.X402UnexpectedStatusError; }
|
|
6440
6540
|
});
|
|
6441
6541
|
Object.defineProperty(exports, "assertUserOpTypedDataBinding", {
|
|
6442
6542
|
enumerable: true,
|
|
6443
|
-
get: function () { return
|
|
6543
|
+
get: function () { return chunkLZHCIK7L_cjs.assertUserOpTypedDataBinding; }
|
|
6444
6544
|
});
|
|
6445
6545
|
Object.defineProperty(exports, "connectorRerunCommand", {
|
|
6446
6546
|
enumerable: true,
|
|
6447
|
-
get: function () { return
|
|
6547
|
+
get: function () { return chunkLZHCIK7L_cjs.connectorRerunCommand; }
|
|
6448
6548
|
});
|
|
6449
6549
|
Object.defineProperty(exports, "connectorSpec", {
|
|
6450
6550
|
enumerable: true,
|
|
6451
|
-
get: function () { return
|
|
6551
|
+
get: function () { return chunkLZHCIK7L_cjs.connectorSpec; }
|
|
6452
6552
|
});
|
|
6453
6553
|
Object.defineProperty(exports, "connectorUpgradeCommand", {
|
|
6454
6554
|
enumerable: true,
|
|
6455
|
-
get: function () { return
|
|
6555
|
+
get: function () { return chunkLZHCIK7L_cjs.connectorUpgradeCommand; }
|
|
6456
6556
|
});
|
|
6457
6557
|
Object.defineProperty(exports, "deriveDelegateAccountAddress", {
|
|
6458
6558
|
enumerable: true,
|
|
6459
|
-
get: function () { return
|
|
6559
|
+
get: function () { return chunkLZHCIK7L_cjs.deriveDelegateAccountAddress; }
|
|
6460
6560
|
});
|
|
6461
6561
|
Object.defineProperty(exports, "isConnectorChannel", {
|
|
6462
6562
|
enumerable: true,
|
|
6463
|
-
get: function () { return
|
|
6563
|
+
get: function () { return chunkLZHCIK7L_cjs.isConnectorChannel; }
|
|
6464
6564
|
});
|
|
6465
6565
|
Object.defineProperty(exports, "isPackedUserOperationTypedData", {
|
|
6466
6566
|
enumerable: true,
|
|
6467
|
-
get: function () { return
|
|
6567
|
+
get: function () { return chunkLZHCIK7L_cjs.isPackedUserOperationTypedData; }
|
|
6468
6568
|
});
|
|
6469
6569
|
Object.defineProperty(exports, "packedUserOperationHash", {
|
|
6470
6570
|
enumerable: true,
|
|
6471
|
-
get: function () { return
|
|
6571
|
+
get: function () { return chunkLZHCIK7L_cjs.packedUserOperationHash; }
|
|
6472
6572
|
});
|
|
6473
6573
|
Object.defineProperty(exports, "resolveConnectorChannel", {
|
|
6474
6574
|
enumerable: true,
|
|
6475
|
-
get: function () { return
|
|
6575
|
+
get: function () { return chunkLZHCIK7L_cjs.resolveConnectorChannel; }
|
|
6476
6576
|
});
|
|
6477
6577
|
Object.defineProperty(exports, "signerUpdateFallback", {
|
|
6478
6578
|
enumerable: true,
|
|
6479
|
-
get: function () { return
|
|
6579
|
+
get: function () { return chunkLZHCIK7L_cjs.signerUpdateFallback; }
|
|
6480
6580
|
});
|
|
6481
6581
|
Object.defineProperty(exports, "verifySettlementChild", {
|
|
6482
6582
|
enumerable: true,
|
|
6483
|
-
get: function () { return
|
|
6583
|
+
get: function () { return chunkLZHCIK7L_cjs.verifySettlementChild; }
|
|
6484
6584
|
});
|
|
6485
6585
|
exports.AGENT_APPROVAL_RELAY_JSON_SENTENCE = AGENT_APPROVAL_RELAY_JSON_SENTENCE;
|
|
6486
6586
|
exports.AGENT_APPROVAL_RELAY_PROSE_SENTENCE = AGENT_APPROVAL_RELAY_PROSE_SENTENCE;
|