@haven_ai/sdk 0.0.0-dev.202609282003.b645eff → 0.0.0-dev.202609282315.dd06d7c
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 +3 -1
- package/dist/{base64-Br8mJPgm.d.cts → base64-YC49ypsN.d.cts} +21 -2
- package/dist/{base64-Br8mJPgm.d.ts → base64-YC49ypsN.d.ts} +21 -2
- package/dist/{chunk-Y2Q4DZVU.js → chunk-FVLF2A66.js} +19 -4
- package/dist/chunk-FVLF2A66.js.map +1 -0
- package/dist/{chunk-PZLGXWSP.cjs → chunk-TKJDIRAY.cjs} +29 -29
- package/dist/{chunk-PZLGXWSP.cjs.map → chunk-TKJDIRAY.cjs.map} +1 -1
- package/dist/{chunk-FXPB3NEJ.cjs → chunk-WQ4UYTPE.cjs} +19 -4
- package/dist/chunk-WQ4UYTPE.cjs.map +1 -0
- package/dist/{chunk-AFJ7XDDI.js → chunk-XDJAPMS2.js} +4 -4
- package/dist/{chunk-AFJ7XDDI.js.map → chunk-XDJAPMS2.js.map} +1 -1
- package/dist/edge.cjs +65 -65
- package/dist/edge.d.cts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +3 -3
- package/dist/index.cjs +385 -311
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -19
- package/dist/index.d.ts +61 -19
- package/dist/index.js +98 -24
- package/dist/index.js.map +1 -1
- package/dist/test-support.cjs +18 -18
- package/dist/test-support.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-FXPB3NEJ.cjs.map +0 -1
- package/dist/chunk-Y2Q4DZVU.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkTKJDIRAY_cjs = require('./chunk-TKJDIRAY.cjs');
|
|
4
|
+
var chunkWQ4UYTPE_cjs = require('./chunk-WQ4UYTPE.cjs');
|
|
5
5
|
var viem = require('viem');
|
|
6
6
|
var ethers = require('ethers');
|
|
7
7
|
var async_hooks = require('async_hooks');
|
|
@@ -14,7 +14,7 @@ function signHash(privateKey, hash) {
|
|
|
14
14
|
const sig = signingKey.sign(hash);
|
|
15
15
|
return sig.serialized;
|
|
16
16
|
} catch (err) {
|
|
17
|
-
throw new
|
|
17
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
18
18
|
`Failed to sign hash: ${err instanceof Error ? err.message : String(err)}`
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -30,7 +30,7 @@ async function signTypedDataVerbatim(privateKey, typedData, label) {
|
|
|
30
30
|
typedData.message
|
|
31
31
|
);
|
|
32
32
|
} catch (err) {
|
|
33
|
-
throw new
|
|
33
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
34
34
|
`Failed to sign ${label}: ${err instanceof Error ? err.message : String(err)}`
|
|
35
35
|
);
|
|
36
36
|
}
|
|
@@ -45,7 +45,7 @@ function addressFromKey(privateKey) {
|
|
|
45
45
|
try {
|
|
46
46
|
return new ethers.ethers.Wallet(privateKey).address;
|
|
47
47
|
} catch (err) {
|
|
48
|
-
throw new
|
|
48
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
49
49
|
`Invalid private key: ${err instanceof Error ? err.message : String(err)}`
|
|
50
50
|
);
|
|
51
51
|
}
|
|
@@ -61,7 +61,7 @@ function verifySignature(hash, signature, expectedAddress) {
|
|
|
61
61
|
var DEFAULT_BASE_URL = "http://localhost:3001";
|
|
62
62
|
var DEFAULT_REQUEST_TIMEOUT = 3e4;
|
|
63
63
|
function withoutClientHeader(headers) {
|
|
64
|
-
const target =
|
|
64
|
+
const target = chunkTKJDIRAY_cjs.HAVEN_CLIENT_HEADER.toLowerCase();
|
|
65
65
|
return Object.fromEntries(Object.entries(headers).filter(([name]) => name.toLowerCase() !== target));
|
|
66
66
|
}
|
|
67
67
|
var HavenApiTransport = class {
|
|
@@ -77,7 +77,7 @@ var HavenApiTransport = class {
|
|
|
77
77
|
this.baseUrl = (config.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
78
78
|
this.requestTimeout = config.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;
|
|
79
79
|
this.defaultHeaders = { ...config.defaultHeaders ?? {} };
|
|
80
|
-
this.clientIdentity = config.clientIdentity ??
|
|
80
|
+
this.clientIdentity = config.clientIdentity ?? chunkTKJDIRAY_cjs.SDK_CLIENT_IDENTITY;
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* The newest `client_update` the backend sent (#3303): inside a
|
|
@@ -90,7 +90,7 @@ var HavenApiTransport = class {
|
|
|
90
90
|
}
|
|
91
91
|
recordClientUpdate(data) {
|
|
92
92
|
if (data === null || typeof data !== "object" || Array.isArray(data)) return;
|
|
93
|
-
const hint =
|
|
93
|
+
const hint = chunkTKJDIRAY_cjs.readClientUpdate(data.client_update);
|
|
94
94
|
if (!hint) return;
|
|
95
95
|
this.lastClientUpdate = hint;
|
|
96
96
|
const store = this.requestContext.getStore();
|
|
@@ -123,7 +123,7 @@ var HavenApiTransport = class {
|
|
|
123
123
|
// JOIN `x-haven-client` and `X-Haven-Client` into one unparseable
|
|
124
124
|
// value), so neither `defaultHeaders` nor a dispatch context can
|
|
125
125
|
// misname the client; `clientIdentity` is the one way to set it.
|
|
126
|
-
[
|
|
126
|
+
[chunkTKJDIRAY_cjs.HAVEN_CLIENT_HEADER]: this.clientIdentity
|
|
127
127
|
},
|
|
128
128
|
body: body ? JSON.stringify(body) : void 0,
|
|
129
129
|
signal: controller.signal
|
|
@@ -136,15 +136,15 @@ var HavenApiTransport = class {
|
|
|
136
136
|
const rawDetails = record.details ?? record.detail;
|
|
137
137
|
const detailsText = typeof rawDetails === "string" ? rawDetails : rawDetails != null ? JSON.stringify(rawDetails) : void 0;
|
|
138
138
|
const message = errorText && detailsText ? `${errorText}: ${detailsText}` : errorText ?? detailsText ?? "API request failed";
|
|
139
|
-
throw new
|
|
139
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(message, res.status, data);
|
|
140
140
|
}
|
|
141
141
|
return data;
|
|
142
142
|
} catch (err) {
|
|
143
|
-
if (err instanceof
|
|
143
|
+
if (err instanceof chunkWQ4UYTPE_cjs.HavenApiError) throw err;
|
|
144
144
|
if (err instanceof Error && err.name === "AbortError") {
|
|
145
|
-
throw new
|
|
145
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(`Request to ${path} timed out`, 408);
|
|
146
146
|
}
|
|
147
|
-
throw new
|
|
147
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
148
148
|
`Request to ${path} failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
149
149
|
0
|
|
150
150
|
);
|
|
@@ -216,6 +216,9 @@ function mapPaymentStatusResult(raw) {
|
|
|
216
216
|
expiresAt: raw.expires_at,
|
|
217
217
|
chainId: raw.chain_id,
|
|
218
218
|
message: raw.message,
|
|
219
|
+
// #3420: the delivered half of the settle vocabulary, additive — absent
|
|
220
|
+
// from the raw payload (older backend) stays absent here.
|
|
221
|
+
...raw.delivered === true ? { delivered: true } : {},
|
|
219
222
|
fee: raw.fee ? {
|
|
220
223
|
amount: raw.fee.amount,
|
|
221
224
|
token: raw.fee.token,
|
|
@@ -298,29 +301,29 @@ function paymentStateStatusCode(status, fallback = 502) {
|
|
|
298
301
|
return PAYMENT_STATE_STATUS_CODES[status] ?? fallback;
|
|
299
302
|
}
|
|
300
303
|
function phaseForStatus(status) {
|
|
301
|
-
if (status === "pending_signature") return
|
|
302
|
-
if (status === "submitted") return
|
|
303
|
-
if (status === "confirmed") return
|
|
304
|
-
if (status === "pending" || status === "pending_approval") return
|
|
305
|
-
if (status === "approved") return
|
|
306
|
-
if (status === "proposed") return
|
|
307
|
-
if (status === "executed") return
|
|
308
|
-
if (status === "rejected") return
|
|
309
|
-
if (status === "expired") return
|
|
310
|
-
if (status === "failed") return
|
|
304
|
+
if (status === "pending_signature") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.AgentSignatureRequired;
|
|
305
|
+
if (status === "submitted") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.PaymentSubmitted;
|
|
306
|
+
if (status === "confirmed") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.PaymentConfirmed;
|
|
307
|
+
if (status === "pending" || status === "pending_approval") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.UserApprovalRequired;
|
|
308
|
+
if (status === "approved") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.UserExecutionRequired;
|
|
309
|
+
if (status === "proposed") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.WaitingForAdditionalApprovals;
|
|
310
|
+
if (status === "executed") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.FundingSent;
|
|
311
|
+
if (status === "rejected") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.Rejected;
|
|
312
|
+
if (status === "expired") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.Expired;
|
|
313
|
+
if (status === "failed") return chunkWQ4UYTPE_cjs.AgentPaymentPhase.Failed;
|
|
311
314
|
return null;
|
|
312
315
|
}
|
|
313
316
|
function nextActionForStatus(status) {
|
|
314
|
-
if (status === "pending_signature") return
|
|
315
|
-
if (status === "submitted") return
|
|
316
|
-
if (status === "confirmed") return
|
|
317
|
-
if (status === "pending" || status === "pending_approval") return
|
|
318
|
-
if (status === "approved") return
|
|
319
|
-
if (status === "proposed") return
|
|
320
|
-
if (status === "executed") return
|
|
321
|
-
if (status === "rejected") return
|
|
322
|
-
if (status === "expired") return
|
|
323
|
-
if (status === "failed") return
|
|
317
|
+
if (status === "pending_signature") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.SignAndSubmitPayment;
|
|
318
|
+
if (status === "submitted") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.CheckStatusLater;
|
|
319
|
+
if (status === "confirmed") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.None;
|
|
320
|
+
if (status === "pending" || status === "pending_approval") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
321
|
+
if (status === "approved") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
322
|
+
if (status === "proposed") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
323
|
+
if (status === "executed") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
324
|
+
if (status === "rejected") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
325
|
+
if (status === "expired") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.RequestAgainIfUserStillWantsIt;
|
|
326
|
+
if (status === "failed") return chunkWQ4UYTPE_cjs.AgentPaymentNextAction.StopAndTellUser;
|
|
324
327
|
return null;
|
|
325
328
|
}
|
|
326
329
|
function messageForState(label, status, paymentId, nextAction) {
|
|
@@ -394,17 +397,17 @@ function throwPaymentStateError(label, raw) {
|
|
|
394
397
|
const statusCode = paymentStateStatusCode(raw.status);
|
|
395
398
|
const state = paymentStateFromRaw(label, raw);
|
|
396
399
|
if (state) {
|
|
397
|
-
throw new
|
|
400
|
+
throw new chunkWQ4UYTPE_cjs.HavenPaymentStateError(state.message, statusCode, state, raw);
|
|
398
401
|
}
|
|
399
402
|
if (raw.status === "pending_approval") {
|
|
400
|
-
throw new
|
|
403
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
401
404
|
`${label} exceeds the agent's on-chain budget and was declined; no approval is pending and none will arrive (payment_id: ${raw.payment_id}).`,
|
|
402
405
|
statusCode,
|
|
403
406
|
raw
|
|
404
407
|
);
|
|
405
408
|
}
|
|
406
409
|
if (raw.status === "expired") {
|
|
407
|
-
throw new
|
|
410
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
408
411
|
`${label} expired before it could be completed (payment_id: ${raw.payment_id}).`,
|
|
409
412
|
statusCode,
|
|
410
413
|
raw
|
|
@@ -412,7 +415,7 @@ function throwPaymentStateError(label, raw) {
|
|
|
412
415
|
}
|
|
413
416
|
const paymentId = raw.payment_id ? ` (payment_id: ${raw.payment_id})` : "";
|
|
414
417
|
const message = raw.error ?? `${label} ${raw.status}${paymentId}`;
|
|
415
|
-
throw new
|
|
418
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(message, statusCode, raw);
|
|
416
419
|
}
|
|
417
420
|
|
|
418
421
|
// src/x402-retry-target.ts
|
|
@@ -444,7 +447,7 @@ function isSecureX402RetryTarget(url) {
|
|
|
444
447
|
return RESERVED_SUFFIXES.some((suffix) => host.endsWith(suffix));
|
|
445
448
|
}
|
|
446
449
|
var INSECURE_RETRY_TARGET_CODE = "INSECURE_RETRY_TARGET";
|
|
447
|
-
var HavenInsecureRetryTargetError = class extends
|
|
450
|
+
var HavenInsecureRetryTargetError = class extends chunkWQ4UYTPE_cjs.HavenError {
|
|
448
451
|
constructor(url) {
|
|
449
452
|
super(
|
|
450
453
|
`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.`,
|
|
@@ -486,7 +489,7 @@ var McpMerchantTransport = class {
|
|
|
486
489
|
return await this.fetchImpl(url, { ...init, signal });
|
|
487
490
|
} catch (err) {
|
|
488
491
|
if (timeoutSignal.aborted) {
|
|
489
|
-
throw new
|
|
492
|
+
throw new chunkWQ4UYTPE_cjs.MerchantTimeoutError(`Merchant request timed out after ${timeoutMs}ms: ${url}`);
|
|
490
493
|
}
|
|
491
494
|
throw err;
|
|
492
495
|
}
|
|
@@ -623,8 +626,8 @@ var McpMerchantTransport = class {
|
|
|
623
626
|
async deliverPayment(url, init, paymentHeader) {
|
|
624
627
|
assertSecureX402RetryTarget(url);
|
|
625
628
|
const headers = new Headers(init?.headers);
|
|
626
|
-
const send =
|
|
627
|
-
for (const name of
|
|
629
|
+
const send = chunkTKJDIRAY_cjs.x402PaymentHeaderNamesFor(paymentHeader);
|
|
630
|
+
for (const name of chunkTKJDIRAY_cjs.X402_PAYMENT_HEADER_NAMES) {
|
|
628
631
|
if (send.includes(name)) headers.set(name, paymentHeader);
|
|
629
632
|
else headers.delete(name);
|
|
630
633
|
}
|
|
@@ -711,7 +714,7 @@ function mcpToolResultOf(value) {
|
|
|
711
714
|
function extractMcpPaymentRequired(toolResult) {
|
|
712
715
|
if (toolResult.isError !== true) return void 0;
|
|
713
716
|
if (isRecord(toolResult.structuredContent)) {
|
|
714
|
-
const parsed =
|
|
717
|
+
const parsed = chunkTKJDIRAY_cjs.normalizePaymentRequired(toolResult.structuredContent);
|
|
715
718
|
if (parsed) return parsed;
|
|
716
719
|
}
|
|
717
720
|
if (Array.isArray(toolResult.content)) {
|
|
@@ -723,7 +726,7 @@ function extractMcpPaymentRequired(toolResult) {
|
|
|
723
726
|
} catch {
|
|
724
727
|
continue;
|
|
725
728
|
}
|
|
726
|
-
const parsed =
|
|
729
|
+
const parsed = chunkTKJDIRAY_cjs.normalizePaymentRequired(candidate);
|
|
727
730
|
if (parsed) return parsed;
|
|
728
731
|
}
|
|
729
732
|
}
|
|
@@ -747,7 +750,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
|
|
|
747
750
|
if (!request) return init;
|
|
748
751
|
let envelope;
|
|
749
752
|
try {
|
|
750
|
-
envelope =
|
|
753
|
+
envelope = chunkTKJDIRAY_cjs.decodeBase64Json(paymentHeader);
|
|
751
754
|
} catch {
|
|
752
755
|
return init;
|
|
753
756
|
}
|
|
@@ -763,7 +766,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
|
|
|
763
766
|
};
|
|
764
767
|
}
|
|
765
768
|
function encodeMcpSettlementReceipt(settlement) {
|
|
766
|
-
return
|
|
769
|
+
return chunkTKJDIRAY_cjs.encodeBase64Json(settlement);
|
|
767
770
|
}
|
|
768
771
|
function parseJsonRpcToolsCall(body) {
|
|
769
772
|
if (typeof body !== "string") return void 0;
|
|
@@ -849,22 +852,93 @@ function selectJsonRpcResult(messages) {
|
|
|
849
852
|
return messages.find((message) => "result" in message || "error" in message) ?? messages.at(-1);
|
|
850
853
|
}
|
|
851
854
|
var RECEIPT_VERSION = "haven-receipt-1";
|
|
855
|
+
var DELEGATION_MANAGER_CHAIN_IDS = /* @__PURE__ */ new Set([8453, 84532]);
|
|
856
|
+
var EIP712_DOMAIN_TYPEHASH = viem.keccak256(
|
|
857
|
+
viem.toBytes("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
|
|
858
|
+
);
|
|
859
|
+
function delegationDomainSeparator(chainId) {
|
|
860
|
+
return viem.keccak256(
|
|
861
|
+
viem.encodeAbiParameters(
|
|
862
|
+
[{ type: "bytes32" }, { type: "bytes32" }, { type: "bytes32" }, { type: "uint256" }, { type: "address" }],
|
|
863
|
+
[
|
|
864
|
+
EIP712_DOMAIN_TYPEHASH,
|
|
865
|
+
viem.keccak256(viem.toBytes("DelegationManager")),
|
|
866
|
+
viem.keccak256(viem.toBytes("1")),
|
|
867
|
+
BigInt(chainId),
|
|
868
|
+
chunkWQ4UYTPE_cjs.DELEGATION_MANAGER
|
|
869
|
+
]
|
|
870
|
+
)
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
function delegationDigest(structHash, chainId) {
|
|
874
|
+
return viem.keccak256(viem.concatHex(["0x1901", delegationDomainSeparator(chainId), structHash]));
|
|
875
|
+
}
|
|
852
876
|
function defaultRecover(hash, signature) {
|
|
853
877
|
return ethers.ethers.recoverAddress(hash, signature);
|
|
854
878
|
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
if (!signature) return { verified: false, reason: "missing_signature" };
|
|
879
|
+
var NOT_A_SIGNED_RECEIPT = { verified: false, reason: "not_a_signed_receipt" };
|
|
880
|
+
function match(delegate, hash, signature, recover) {
|
|
858
881
|
let recovered;
|
|
859
882
|
try {
|
|
860
|
-
recovered = recover(
|
|
883
|
+
recovered = recover(hash, signature);
|
|
861
884
|
} catch {
|
|
862
|
-
return {
|
|
885
|
+
return { ok: false, reason: "bad_signature" };
|
|
863
886
|
}
|
|
864
887
|
if (recovered.toLowerCase() !== delegate.toLowerCase()) {
|
|
865
|
-
return {
|
|
888
|
+
return { ok: false, reason: "signer_mismatch", recoveredSigner: recovered };
|
|
889
|
+
}
|
|
890
|
+
return { ok: true, recoveredSigner: recovered };
|
|
891
|
+
}
|
|
892
|
+
function finish(result, verifiedOver) {
|
|
893
|
+
if (result.ok) {
|
|
894
|
+
return { verified: true, recoveredSigner: result.recoveredSigner, verifiedOver };
|
|
895
|
+
}
|
|
896
|
+
return result.recoveredSigner !== void 0 ? { verified: false, reason: result.reason, recoveredSigner: result.recoveredSigner } : { verified: false, reason: result.reason };
|
|
897
|
+
}
|
|
898
|
+
function verifyPaymentReceipt(receipt, recover = defaultRecover) {
|
|
899
|
+
if (typeof receipt !== "object" || receipt === null) return NOT_A_SIGNED_RECEIPT;
|
|
900
|
+
const source = receipt;
|
|
901
|
+
if (typeof source.authorization !== "object" || source.authorization === null) {
|
|
902
|
+
return NOT_A_SIGNED_RECEIPT;
|
|
903
|
+
}
|
|
904
|
+
const auth = source.authorization;
|
|
905
|
+
const { delegate, signHash: signHash2, signature, signatureScheme } = auth;
|
|
906
|
+
if (typeof delegate !== "string" || delegate === "" || typeof signHash2 !== "string" || signHash2 === "") {
|
|
907
|
+
return NOT_A_SIGNED_RECEIPT;
|
|
908
|
+
}
|
|
909
|
+
if (typeof signature !== "string" || signature === "") {
|
|
910
|
+
return { verified: false, reason: "missing_signature" };
|
|
911
|
+
}
|
|
912
|
+
const chainId = typeof source.onChain?.chainId === "number" ? source.onChain.chainId : void 0;
|
|
913
|
+
const digestVerifiable = chainId !== void 0 && DELEGATION_MANAGER_CHAIN_IDS.has(chainId);
|
|
914
|
+
if (signatureScheme === "eip712_userop") {
|
|
915
|
+
return { verified: false, reason: "not_verifiable_offline" };
|
|
916
|
+
}
|
|
917
|
+
if (signatureScheme === "eip712_delegation") {
|
|
918
|
+
if (!digestVerifiable) {
|
|
919
|
+
return { verified: false, reason: "not_verifiable_offline" };
|
|
920
|
+
}
|
|
921
|
+
let digest;
|
|
922
|
+
try {
|
|
923
|
+
digest = delegationDigest(signHash2, chainId);
|
|
924
|
+
} catch {
|
|
925
|
+
return { verified: false, reason: "bad_signature" };
|
|
926
|
+
}
|
|
927
|
+
return finish(match(delegate, digest, signature, recover), "delegation_digest");
|
|
928
|
+
}
|
|
929
|
+
const raw = match(delegate, signHash2, signature, recover);
|
|
930
|
+
if (raw.ok) return finish(raw, "sign_hash");
|
|
931
|
+
if (digestVerifiable) {
|
|
932
|
+
let digest;
|
|
933
|
+
try {
|
|
934
|
+
digest = delegationDigest(signHash2, chainId);
|
|
935
|
+
} catch {
|
|
936
|
+
return finish(raw, "sign_hash");
|
|
937
|
+
}
|
|
938
|
+
const delegated = match(delegate, digest, signature, recover);
|
|
939
|
+
if (delegated.ok) return finish(delegated, "delegation_digest");
|
|
866
940
|
}
|
|
867
|
-
return
|
|
941
|
+
return finish(raw, "sign_hash");
|
|
868
942
|
}
|
|
869
943
|
|
|
870
944
|
// src/account-reads.ts
|
|
@@ -887,7 +961,7 @@ function deriveReadiness(status, allowances) {
|
|
|
887
961
|
return allowances.some((allowance) => safeBigInt(allowance.remainingAtomic) > 0n) ? "ready" : "needs_approval";
|
|
888
962
|
}
|
|
889
963
|
function formatRemainingDisplay(tokenAddress, tokenSymbol, remainingAtomic) {
|
|
890
|
-
const token =
|
|
964
|
+
const token = chunkTKJDIRAY_cjs.resolveTokenFromAddress(tokenAddress);
|
|
891
965
|
return token ? `${formatAtomicAmount(safeBigInt(remainingAtomic), token.decimals)} ${tokenSymbol}` : `${remainingAtomic} ${tokenSymbol} (atomic; unknown decimals)`;
|
|
892
966
|
}
|
|
893
967
|
function formatTokenAmount(atomic, decimals) {
|
|
@@ -919,7 +993,7 @@ function mapTaskBudget(raw) {
|
|
|
919
993
|
};
|
|
920
994
|
}
|
|
921
995
|
function summarizeTaskBudget(taskBudget) {
|
|
922
|
-
const token =
|
|
996
|
+
const token = chunkTKJDIRAY_cjs.resolveTokenFromAddress(taskBudget.tokenAddress);
|
|
923
997
|
const maxDisplay = token ? `${formatAtomicAmount(safeBigInt(taskBudget.maxAtomic), token.decimals)} ${token.symbol}` : `${taskBudget.maxAtomic} (atomic; unknown decimals)`;
|
|
924
998
|
return {
|
|
925
999
|
id: taskBudget.id,
|
|
@@ -1059,7 +1133,7 @@ var AccountReads = class {
|
|
|
1059
1133
|
payment: payment2,
|
|
1060
1134
|
allowance: null,
|
|
1061
1135
|
warnings: [{
|
|
1062
|
-
code:
|
|
1136
|
+
code: chunkWQ4UYTPE_cjs.AgentPaymentWarningCode.AllowanceCheckUnavailable,
|
|
1063
1137
|
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.`
|
|
1064
1138
|
}]
|
|
1065
1139
|
});
|
|
@@ -1081,22 +1155,22 @@ var AccountReads = class {
|
|
|
1081
1155
|
try {
|
|
1082
1156
|
const tokenAddress = payment.asset ?? payment.x402?.asset ?? null;
|
|
1083
1157
|
if (!tokenAddress) return unavailable("the settled payment does not carry a resolvable token address", payment);
|
|
1084
|
-
const
|
|
1158
|
+
const match2 = allowanceResult.value.allowances.find(
|
|
1085
1159
|
(allowance) => allowance.tokenAddress.toLowerCase() === tokenAddress.toLowerCase()
|
|
1086
1160
|
);
|
|
1087
|
-
if (!
|
|
1088
|
-
const token =
|
|
1089
|
-
const remainingDisplay = token ? `${formatAtomicAmount(safeBigInt(
|
|
1161
|
+
if (!match2) return unavailable("no allowance/budget row matches the settled token", payment);
|
|
1162
|
+
const token = chunkTKJDIRAY_cjs.resolveTokenFromAddress(match2.tokenAddress);
|
|
1163
|
+
const remainingDisplay = token ? `${formatAtomicAmount(safeBigInt(match2.onchain.remaining), token.decimals)} ${match2.tokenSymbol}` : void 0;
|
|
1090
1164
|
const rail = agentResult.value.executionRail;
|
|
1091
1165
|
return {
|
|
1092
1166
|
payment,
|
|
1093
1167
|
allowance: {
|
|
1094
1168
|
rail,
|
|
1095
|
-
remaining_atomic:
|
|
1169
|
+
remaining_atomic: match2.onchain.remaining,
|
|
1096
1170
|
...remainingDisplay ? { remaining_display: remainingDisplay } : {},
|
|
1097
|
-
token_symbol:
|
|
1098
|
-
token_address:
|
|
1099
|
-
reset_period:
|
|
1171
|
+
token_symbol: match2.tokenSymbol,
|
|
1172
|
+
token_address: match2.tokenAddress,
|
|
1173
|
+
reset_period: match2.resetPeriodMin,
|
|
1100
1174
|
source: rail === "delegation" ? "active_delegations" : "allowance_module"
|
|
1101
1175
|
},
|
|
1102
1176
|
warnings: []
|
|
@@ -1160,7 +1234,7 @@ function isWaitTimeout(err) {
|
|
|
1160
1234
|
async function waitForSweepTx(tx) {
|
|
1161
1235
|
let receipt;
|
|
1162
1236
|
try {
|
|
1163
|
-
receipt = await tx.wait(1,
|
|
1237
|
+
receipt = await tx.wait(1, chunkWQ4UYTPE_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS);
|
|
1164
1238
|
} catch (err) {
|
|
1165
1239
|
if (!isWaitTimeout(err)) throw err;
|
|
1166
1240
|
return { txHash: tx.hash, confirmation: "unconfirmed" };
|
|
@@ -1174,16 +1248,16 @@ var DelegateSweepApi = class {
|
|
|
1174
1248
|
}
|
|
1175
1249
|
options;
|
|
1176
1250
|
async sweepDelegate() {
|
|
1177
|
-
if (!this.options.delegateKey) throw new
|
|
1251
|
+
if (!this.options.delegateKey) throw new chunkWQ4UYTPE_cjs.HavenSigningError("delegateKey is required for sweepDelegate.");
|
|
1178
1252
|
const agent = await this.options.getAgent();
|
|
1179
|
-
if (!agent.delegateAddress) throw new
|
|
1253
|
+
if (!agent.delegateAddress) throw new chunkWQ4UYTPE_cjs.HavenApiError("Agent has no delegate address.", 422);
|
|
1180
1254
|
const rpcUrl = this.options.chainRpcs[agent.chainId];
|
|
1181
|
-
if (!rpcUrl) throw new
|
|
1255
|
+
if (!rpcUrl) throw new chunkWQ4UYTPE_cjs.HavenApiError(`chainRpcs[${agent.chainId}] must be configured to sweep the delegate wallet.`, 422);
|
|
1182
1256
|
const provider = createJsonRpcProvider(rpcUrl);
|
|
1183
1257
|
const wallet = createWallet(this.options.delegateKey, provider);
|
|
1184
1258
|
const transfers = [];
|
|
1185
|
-
if (
|
|
1186
|
-
const contract = createErc20Contract(
|
|
1259
|
+
if (chunkTKJDIRAY_cjs.isSweepableChain(agent.chainId)) {
|
|
1260
|
+
const contract = createErc20Contract(chunkTKJDIRAY_cjs.sweepUsdcAddress(agent.chainId), ["function balanceOf(address) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)"], wallet);
|
|
1187
1261
|
const balance2 = await contract.balanceOf(agent.delegateAddress);
|
|
1188
1262
|
if (balance2 > 0n) {
|
|
1189
1263
|
const tx = await contract.transfer(agent.accountAddress, balance2);
|
|
@@ -1271,7 +1345,7 @@ function snapshotRequestBody(body) {
|
|
|
1271
1345
|
if (body == null) return void 0;
|
|
1272
1346
|
if (typeof body === "string") return body;
|
|
1273
1347
|
if (body instanceof URLSearchParams) return body.toString();
|
|
1274
|
-
throw new
|
|
1348
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1275
1349
|
"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.",
|
|
1276
1350
|
400
|
|
1277
1351
|
);
|
|
@@ -1292,25 +1366,25 @@ function requestInitFromSnapshot(request) {
|
|
|
1292
1366
|
};
|
|
1293
1367
|
}
|
|
1294
1368
|
function noCompatiblePaymentOptionError(accepts) {
|
|
1295
|
-
const erc7710Only =
|
|
1369
|
+
const erc7710Only = chunkTKJDIRAY_cjs.selectErc7710PaymentOption(accepts) !== null;
|
|
1296
1370
|
const unsupportedOnly = !erc7710Only && accepts.some(
|
|
1297
|
-
(opt) => opt !== null && typeof opt === "object" && !
|
|
1371
|
+
(opt) => opt !== null && typeof opt === "object" && !chunkTKJDIRAY_cjs.isErc7710Option(opt) && (chunkTKJDIRAY_cjs.x402AssetTransferMethod(opt) !== null || opt.extra?.paymentFlow !== void 0)
|
|
1298
1372
|
);
|
|
1299
|
-
return new
|
|
1373
|
+
return new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1300
1374
|
"No compatible payment option found in x402 requirements. Haven supports standard x402 exact payments on Base USDC." + (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." : ""),
|
|
1301
1375
|
400
|
|
1302
1376
|
);
|
|
1303
1377
|
}
|
|
1304
1378
|
function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport) {
|
|
1305
|
-
const standard =
|
|
1306
|
-
const option = standard ??
|
|
1379
|
+
const standard = chunkTKJDIRAY_cjs.selectStandardPaymentOption(paymentRequired.accepts);
|
|
1380
|
+
const option = standard ?? chunkTKJDIRAY_cjs.selectErc7710PaymentOption(paymentRequired.accepts);
|
|
1307
1381
|
if (!option) {
|
|
1308
1382
|
throw noCompatiblePaymentOptionError(paymentRequired.accepts);
|
|
1309
1383
|
}
|
|
1310
|
-
const token =
|
|
1384
|
+
const token = chunkTKJDIRAY_cjs.resolveTokenFromAddress(option.asset, option.network);
|
|
1311
1385
|
return {
|
|
1312
1386
|
rail: "x402",
|
|
1313
|
-
idempotencyKey: idempotencyKey ??
|
|
1387
|
+
idempotencyKey: idempotencyKey ?? chunkTKJDIRAY_cjs.buildX402IdempotencyKey(paymentRequired, option),
|
|
1314
1388
|
paymentRequired,
|
|
1315
1389
|
accepted: option,
|
|
1316
1390
|
acceptedScheme: standard ? "standard" : "erc7710",
|
|
@@ -1324,8 +1398,8 @@ function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport)
|
|
|
1324
1398
|
resourceUrlDiffersFromRequest: paymentRequired.resource.url !== request.url,
|
|
1325
1399
|
description: paymentRequired.resource.description ?? option.description ?? null,
|
|
1326
1400
|
mimeType: paymentRequired.resource.mimeType ?? option.mimeType ?? null,
|
|
1327
|
-
amountAtomic:
|
|
1328
|
-
amount: decimalFromUsdcAtomic(
|
|
1401
|
+
amountAtomic: chunkTKJDIRAY_cjs.x402AuthorizationAmount(option),
|
|
1402
|
+
amount: decimalFromUsdcAtomic(chunkTKJDIRAY_cjs.x402AuthorizationAmount(option)),
|
|
1329
1403
|
token: token?.symbol ?? "USDC",
|
|
1330
1404
|
// #1351: null when the asset is unrecognised on this network — the
|
|
1331
1405
|
// `token` fallback above is a LABEL, not evidence of 6 decimals, and a
|
|
@@ -1364,7 +1438,7 @@ function buildX402Receipt(input) {
|
|
|
1364
1438
|
payTo: input.merchantTo ?? input.accepted.payTo
|
|
1365
1439
|
},
|
|
1366
1440
|
x402: {
|
|
1367
|
-
amount:
|
|
1441
|
+
amount: chunkTKJDIRAY_cjs.x402AuthorizationAmount(input.accepted),
|
|
1368
1442
|
token: input.token,
|
|
1369
1443
|
network: input.accepted.network,
|
|
1370
1444
|
asset: input.accepted.asset,
|
|
@@ -1373,7 +1447,7 @@ function buildX402Receipt(input) {
|
|
|
1373
1447
|
};
|
|
1374
1448
|
}
|
|
1375
1449
|
function buildX402ResumeState(input) {
|
|
1376
|
-
const token =
|
|
1450
|
+
const token = chunkTKJDIRAY_cjs.resolveTokenFromAddress(input.accepted.asset, input.accepted.network);
|
|
1377
1451
|
return {
|
|
1378
1452
|
rail: "x402",
|
|
1379
1453
|
paymentId: input.paymentId,
|
|
@@ -1384,8 +1458,8 @@ function buildX402ResumeState(input) {
|
|
|
1384
1458
|
request: input.request,
|
|
1385
1459
|
resourceUrl: input.paymentRequired.resource.url,
|
|
1386
1460
|
description: input.paymentRequired.resource.description ?? input.accepted.description ?? null,
|
|
1387
|
-
amountAtomic:
|
|
1388
|
-
amount: decimalFromUsdcAtomic(
|
|
1461
|
+
amountAtomic: chunkTKJDIRAY_cjs.x402AuthorizationAmount(input.accepted),
|
|
1462
|
+
amount: decimalFromUsdcAtomic(chunkTKJDIRAY_cjs.x402AuthorizationAmount(input.accepted)),
|
|
1389
1463
|
token: token?.symbol ?? "USDC",
|
|
1390
1464
|
asset: input.accepted.asset,
|
|
1391
1465
|
network: input.accepted.network,
|
|
@@ -1394,7 +1468,7 @@ function buildX402ResumeState(input) {
|
|
|
1394
1468
|
};
|
|
1395
1469
|
}
|
|
1396
1470
|
function attachX402ResumeState(err, paymentRequired, accepted, idempotencyKey, request) {
|
|
1397
|
-
if (!(err instanceof
|
|
1471
|
+
if (!(err instanceof chunkWQ4UYTPE_cjs.HavenPaymentStateError)) return;
|
|
1398
1472
|
if (err.state.rail !== "x402") return;
|
|
1399
1473
|
err.resumeState = buildX402ResumeState({
|
|
1400
1474
|
paymentId: err.state.paymentId,
|
|
@@ -1415,17 +1489,17 @@ function attachResumeState(err, input) {
|
|
|
1415
1489
|
}
|
|
1416
1490
|
function assertCanResumeX402(status, paymentRequired, option) {
|
|
1417
1491
|
if (status.rail !== "x402") {
|
|
1418
|
-
throw new
|
|
1492
|
+
throw new chunkWQ4UYTPE_cjs.HavenPaymentStateError(
|
|
1419
1493
|
`Payment ${status.paymentId} is ${status.rail}, not x402.`,
|
|
1420
1494
|
409,
|
|
1421
1495
|
status
|
|
1422
1496
|
);
|
|
1423
1497
|
}
|
|
1424
|
-
if (status.nextAction !==
|
|
1425
|
-
throw new
|
|
1498
|
+
if (status.nextAction !== chunkWQ4UYTPE_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
|
|
1499
|
+
throw new chunkWQ4UYTPE_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
|
|
1426
1500
|
}
|
|
1427
1501
|
if (!status.txHash) {
|
|
1428
|
-
throw new
|
|
1502
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1429
1503
|
`x402 payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
|
|
1430
1504
|
502,
|
|
1431
1505
|
status,
|
|
@@ -1433,7 +1507,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
1433
1507
|
);
|
|
1434
1508
|
}
|
|
1435
1509
|
if (status.resourceUrl && status.resourceUrl !== paymentRequired.resource.url) {
|
|
1436
|
-
throw new
|
|
1510
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1437
1511
|
"x402 resume request does not match the approved resource URL.",
|
|
1438
1512
|
409,
|
|
1439
1513
|
{ status, paymentRequired },
|
|
@@ -1441,7 +1515,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
1441
1515
|
);
|
|
1442
1516
|
}
|
|
1443
1517
|
if (status.merchantAddress && !sameAddress(status.merchantAddress, option.payTo)) {
|
|
1444
|
-
throw new
|
|
1518
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1445
1519
|
"x402 resume request does not match the approved merchant.",
|
|
1446
1520
|
409,
|
|
1447
1521
|
{ status, selectedPayment: option },
|
|
@@ -1450,7 +1524,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
1450
1524
|
}
|
|
1451
1525
|
const optionChainId = chainIdFromNetwork(option.network);
|
|
1452
1526
|
if (status.chainId && optionChainId && status.chainId !== optionChainId) {
|
|
1453
|
-
throw new
|
|
1527
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1454
1528
|
"x402 resume request does not match the approved network.",
|
|
1455
1529
|
409,
|
|
1456
1530
|
{ status, selectedPayment: option },
|
|
@@ -1458,7 +1532,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
1458
1532
|
);
|
|
1459
1533
|
}
|
|
1460
1534
|
if (status.token && status.token !== "USDC") {
|
|
1461
|
-
throw new
|
|
1535
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1462
1536
|
"x402 resume request does not match the approved token.",
|
|
1463
1537
|
409,
|
|
1464
1538
|
{ status, selectedPayment: option },
|
|
@@ -1466,9 +1540,9 @@ function assertCanResumeX402(status, paymentRequired, option) {
|
|
|
1466
1540
|
);
|
|
1467
1541
|
}
|
|
1468
1542
|
const approvedAmount = status.amount ? normalizeDecimal(status.amount) : "";
|
|
1469
|
-
const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(
|
|
1543
|
+
const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(chunkTKJDIRAY_cjs.x402AuthorizationAmount(option)));
|
|
1470
1544
|
if (approvedAmount && approvedAmount !== requestedAmount) {
|
|
1471
|
-
throw new
|
|
1545
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1472
1546
|
"x402 resume request does not match the approved amount.",
|
|
1473
1547
|
409,
|
|
1474
1548
|
{ status, selectedPayment: option },
|
|
@@ -1523,7 +1597,7 @@ var X402FundingLeg = class {
|
|
|
1523
1597
|
const cached = this.receiptCache.get(idempotencyKey);
|
|
1524
1598
|
if (!cached || cached.expiresAt <= Date.now()) return void 0;
|
|
1525
1599
|
if (!sameX402TaskBudget(cached.taskBudgetId, taskBudgetId)) {
|
|
1526
|
-
throw new
|
|
1600
|
+
throw new chunkWQ4UYTPE_cjs.X402TaskBudgetMismatchError(
|
|
1527
1601
|
`The x402 idempotency key '${idempotencyKey}' was already used under a different task budget ('${cached.taskBudgetId ?? "none"}' vs '${taskBudgetId ?? "none"}'). Pass a new idempotencyKey to pay under this budget.`,
|
|
1528
1602
|
idempotencyKey,
|
|
1529
1603
|
cached.taskBudgetId,
|
|
@@ -1544,7 +1618,7 @@ var X402FundingLeg = class {
|
|
|
1544
1618
|
url: paymentRequired.resource.url,
|
|
1545
1619
|
payTo: this.delegateAddress,
|
|
1546
1620
|
merchantPayTo: option.payTo,
|
|
1547
|
-
amount:
|
|
1621
|
+
amount: chunkTKJDIRAY_cjs.x402AuthorizationAmount(option),
|
|
1548
1622
|
asset: option.asset,
|
|
1549
1623
|
network: option.network,
|
|
1550
1624
|
description: paymentRequired.resource.description,
|
|
@@ -1558,17 +1632,17 @@ var X402FundingLeg = class {
|
|
|
1558
1632
|
...taskBudgetId ? { taskBudgetId } : {}
|
|
1559
1633
|
});
|
|
1560
1634
|
const state = paymentStateFromRaw("x402 payment", raw);
|
|
1561
|
-
const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction ===
|
|
1635
|
+
const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction === chunkWQ4UYTPE_cjs.AgentPaymentNextAction.RetryOriginalX402Request ? "approval-resume" : null;
|
|
1562
1636
|
if (executedReplay) {
|
|
1563
1637
|
const canFund = await this.delegateCanFund(
|
|
1564
1638
|
raw.chain_id ?? state?.chainId ?? chainIdFromNetwork(option.network),
|
|
1565
1639
|
option.asset,
|
|
1566
|
-
|
|
1640
|
+
chunkTKJDIRAY_cjs.x402AuthorizationAmount(option)
|
|
1567
1641
|
);
|
|
1568
1642
|
const refuse = executedReplay === "idempotency-collision" ? canFund !== true : canFund === false;
|
|
1569
1643
|
if (refuse) {
|
|
1570
1644
|
const settledReceipt = state && executedReplay === "approval-resume" ? this.receiptFromStatus(paymentRequired, option, void 0, state) : this.receiptFromAuthorization(paymentRequired, option, void 0, raw);
|
|
1571
|
-
throw new
|
|
1645
|
+
throw new chunkWQ4UYTPE_cjs.X402AlreadySettledError(
|
|
1572
1646
|
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`.",
|
|
1573
1647
|
settledReceipt,
|
|
1574
1648
|
canFund === false ? "settled" : "unverifiable"
|
|
@@ -1581,18 +1655,18 @@ var X402FundingLeg = class {
|
|
|
1581
1655
|
this.cacheReceipt(idempotencyKey, paymentHeader, receipt2, taskBudgetId);
|
|
1582
1656
|
return receipt2;
|
|
1583
1657
|
}
|
|
1584
|
-
if (state?.nextAction ===
|
|
1658
|
+
if (state?.nextAction === chunkWQ4UYTPE_cjs.AgentPaymentNextAction.RetryOriginalX402Request) {
|
|
1585
1659
|
const receipt2 = this.receiptFromStatus(paymentRequired, option, paymentHeader, state);
|
|
1586
1660
|
this.cacheReceipt(idempotencyKey, paymentHeader, receipt2, taskBudgetId);
|
|
1587
1661
|
return receipt2;
|
|
1588
1662
|
}
|
|
1589
1663
|
this.assertSignableAuthorizationState("x402 payment", raw);
|
|
1590
1664
|
if (!raw.sign_data?.hash) {
|
|
1591
|
-
throw new
|
|
1665
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
|
|
1592
1666
|
}
|
|
1593
1667
|
const sig = await this.signForData(raw.sign_data, {
|
|
1594
1668
|
asset: option.asset,
|
|
1595
|
-
amount:
|
|
1669
|
+
amount: chunkTKJDIRAY_cjs.x402AuthorizationAmount(option)
|
|
1596
1670
|
});
|
|
1597
1671
|
const execResult = await this.post(
|
|
1598
1672
|
`/payments/${raw.payment_id}/sign`,
|
|
@@ -1612,25 +1686,25 @@ var X402FundingLeg = class {
|
|
|
1612
1686
|
// ── Header minting ───────────────────────────────────────────────
|
|
1613
1687
|
async createPaymentHeader(paymentRequired, option) {
|
|
1614
1688
|
if (!this.delegateKey) {
|
|
1615
|
-
throw new
|
|
1689
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError("delegateKey is required to sign x402 payment headers.");
|
|
1616
1690
|
}
|
|
1617
1691
|
const account = accounts.privateKeyToAccount(this.delegateKey);
|
|
1618
|
-
const requirements =
|
|
1692
|
+
const requirements = chunkTKJDIRAY_cjs.toStandardPaymentRequirements(paymentRequired, option);
|
|
1619
1693
|
const header = await schemes.exact.evm.createPaymentHeader(
|
|
1620
1694
|
account,
|
|
1621
1695
|
paymentRequired.x402Version,
|
|
1622
1696
|
requirements
|
|
1623
1697
|
);
|
|
1624
1698
|
if (paymentRequired.x402Version < 2) return header;
|
|
1625
|
-
const payment =
|
|
1626
|
-
return
|
|
1699
|
+
const payment = chunkTKJDIRAY_cjs.decodeBase64Json(header);
|
|
1700
|
+
return chunkTKJDIRAY_cjs.encodeBase64Json(chunkTKJDIRAY_cjs.x402V2PaymentEnvelope(paymentRequired, option, payment.payload));
|
|
1627
1701
|
}
|
|
1628
1702
|
// ── Receipt mapping ──────────────────────────────────────────────
|
|
1629
1703
|
receiptFromAuthorization(paymentRequired, option, paymentHeader, raw, execResult) {
|
|
1630
1704
|
const txHash = execResult?.tx_hash ?? raw.tx_hash ?? "";
|
|
1631
1705
|
const chainId = execResult?.chain_id ?? raw.chain_id ?? chainIdFromNetwork(option.network);
|
|
1632
1706
|
const token = execResult?.token ?? raw.token ?? "USDC";
|
|
1633
|
-
const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(
|
|
1707
|
+
const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(chunkTKJDIRAY_cjs.x402AuthorizationAmount(option));
|
|
1634
1708
|
const to = execResult?.to ?? raw.to ?? this.delegateAddress ?? "";
|
|
1635
1709
|
const explorerUrl = execResult?.explorer_url ?? raw.explorer_url ?? explorerUrlOrEmpty(chainId, txHash);
|
|
1636
1710
|
const merchantTo = execResult?.merchant_to ?? raw.merchant_to ?? option.payTo;
|
|
@@ -1652,7 +1726,7 @@ var X402FundingLeg = class {
|
|
|
1652
1726
|
}
|
|
1653
1727
|
receiptFromStatus(paymentRequired, option, paymentHeader, status) {
|
|
1654
1728
|
if (!status.txHash) {
|
|
1655
|
-
throw new
|
|
1729
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1656
1730
|
`x402 payment ${status.paymentId} is ready to retry but has no Haven transaction hash.`,
|
|
1657
1731
|
502,
|
|
1658
1732
|
status,
|
|
@@ -1663,7 +1737,7 @@ var X402FundingLeg = class {
|
|
|
1663
1737
|
paymentId: status.paymentId,
|
|
1664
1738
|
txHash: status.txHash,
|
|
1665
1739
|
token: status.token || "USDC",
|
|
1666
|
-
amount: status.amount || decimalFromUsdcAtomic(
|
|
1740
|
+
amount: status.amount || decimalFromUsdcAtomic(chunkTKJDIRAY_cjs.x402AuthorizationAmount(option)),
|
|
1667
1741
|
to: this.delegateAddress ?? "",
|
|
1668
1742
|
resourceUrl: paymentRequired.resource.url,
|
|
1669
1743
|
explorerUrl: explorerUrlOrEmpty(status.chainId, status.txHash),
|
|
@@ -1691,7 +1765,7 @@ var X402FundingLeg = class {
|
|
|
1691
1765
|
const provider = createJsonRpcProvider(rpcUrl);
|
|
1692
1766
|
const onChainReceipt = await provider.waitForTransaction(txHash, 1, timeoutMs);
|
|
1693
1767
|
if (!onChainReceipt || onChainReceipt.status !== 1) {
|
|
1694
|
-
throw new
|
|
1768
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1695
1769
|
"Funding tx did not confirm on-chain within the timeout window.",
|
|
1696
1770
|
500,
|
|
1697
1771
|
{ txHash, chainId }
|
|
@@ -1740,7 +1814,7 @@ var X402FundingLeg = class {
|
|
|
1740
1814
|
};
|
|
1741
1815
|
function getPaymentHeaderValidBefore(paymentHeader) {
|
|
1742
1816
|
try {
|
|
1743
|
-
const payment =
|
|
1817
|
+
const payment = chunkTKJDIRAY_cjs.decodeBase64Json(
|
|
1744
1818
|
paymentHeader
|
|
1745
1819
|
);
|
|
1746
1820
|
const payload = payment.payload;
|
|
@@ -1795,7 +1869,7 @@ var X402Erc7710 = class {
|
|
|
1795
1869
|
*/
|
|
1796
1870
|
async settle(paymentRequired, options = {}) {
|
|
1797
1871
|
if (!this.delegateKey) {
|
|
1798
|
-
throw new
|
|
1872
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
1799
1873
|
"delegateKey is required for x402 payments. Pass it in the HavenClient config."
|
|
1800
1874
|
);
|
|
1801
1875
|
}
|
|
@@ -1820,21 +1894,21 @@ var X402Erc7710 = class {
|
|
|
1820
1894
|
async prepare(paymentRequired, options = {}) {
|
|
1821
1895
|
const delegationRail = options.delegationRail ?? (await this.getAgent()).executionRail === "delegation";
|
|
1822
1896
|
if (!delegationRail) {
|
|
1823
|
-
throw new
|
|
1897
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1824
1898
|
"erc7710 settlement requires a delegation-rail account; this one is not on it. Use authorizeX402() for the standard EIP-3009 path.",
|
|
1825
1899
|
400
|
|
1826
1900
|
);
|
|
1827
1901
|
}
|
|
1828
|
-
const selection =
|
|
1902
|
+
const selection = chunkTKJDIRAY_cjs.selectX402SettlementScheme(paymentRequired.accepts, { delegationRail });
|
|
1829
1903
|
if (!selection || selection.scheme !== "erc7710") {
|
|
1830
|
-
throw new
|
|
1904
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1831
1905
|
"This merchant does not advertise an erc7710 settlement option (no accepts[] entry carries extra.assetTransferMethod: 'erc7710'). Use authorizeX402() for the standard EIP-3009 path.",
|
|
1832
1906
|
400
|
|
1833
1907
|
);
|
|
1834
1908
|
}
|
|
1835
1909
|
const option = selection.option;
|
|
1836
1910
|
const merchantPayTo = option.payTo;
|
|
1837
|
-
const amountAtomic =
|
|
1911
|
+
const amountAtomic = chunkTKJDIRAY_cjs.x402AuthorizationAmount(option);
|
|
1838
1912
|
const raw = await this.post("/x402", {
|
|
1839
1913
|
url: options.resourceUrl ?? paymentRequired.resource?.url,
|
|
1840
1914
|
// #2373: the full 402 challenge, persisted verbatim by the backend
|
|
@@ -1875,24 +1949,24 @@ var X402Erc7710 = class {
|
|
|
1875
1949
|
...options.taskBudgetId ? { taskBudgetId: options.taskBudgetId } : {}
|
|
1876
1950
|
});
|
|
1877
1951
|
if (!raw.payment_id) {
|
|
1878
|
-
throw new
|
|
1952
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("No payment_id returned from x402/authorize", 500, raw);
|
|
1879
1953
|
}
|
|
1880
1954
|
if (raw.status === "confirmed" && raw.tx_hash) {
|
|
1881
1955
|
const requestedUrl = options.resourceUrl ?? paymentRequired.resource?.url;
|
|
1882
1956
|
const samePurchase = typeof raw.to === "string" && raw.to.toLowerCase() === merchantPayTo.toLowerCase() && raw.resource_url === requestedUrl;
|
|
1883
1957
|
if (!samePurchase) {
|
|
1884
|
-
throw new
|
|
1958
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1885
1959
|
`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.`,
|
|
1886
1960
|
409,
|
|
1887
1961
|
raw,
|
|
1888
1962
|
raw.payment_id
|
|
1889
1963
|
);
|
|
1890
1964
|
}
|
|
1891
|
-
throw new
|
|
1965
|
+
throw new chunkWQ4UYTPE_cjs.X402Erc7710AlreadySettledError(raw.payment_id, raw.tx_hash, raw);
|
|
1892
1966
|
}
|
|
1893
1967
|
const signData = raw.sign_data;
|
|
1894
1968
|
if (signData?.signature_scheme !== "eip712_delegation" || !signData.typed_data) {
|
|
1895
|
-
throw new
|
|
1969
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1896
1970
|
`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.`,
|
|
1897
1971
|
500,
|
|
1898
1972
|
raw
|
|
@@ -1925,7 +1999,7 @@ var X402Erc7710 = class {
|
|
|
1925
1999
|
{ signature }
|
|
1926
2000
|
);
|
|
1927
2001
|
if (!settled.payment_header) {
|
|
1928
|
-
throw new
|
|
2002
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
1929
2003
|
"x402 settle returned no payment_header \u2014 the merchant cannot be retried.",
|
|
1930
2004
|
500,
|
|
1931
2005
|
settled
|
|
@@ -1935,9 +2009,9 @@ var X402Erc7710 = class {
|
|
|
1935
2009
|
}
|
|
1936
2010
|
};
|
|
1937
2011
|
function settlementExpectationFromQuote(settlement) {
|
|
1938
|
-
const chainId =
|
|
2012
|
+
const chainId = chunkWQ4UYTPE_cjs.chainIdForNetwork(settlement.network);
|
|
1939
2013
|
if (chainId === void 0) {
|
|
1940
|
-
throw new
|
|
2014
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
1941
2015
|
`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.`
|
|
1942
2016
|
);
|
|
1943
2017
|
}
|
|
@@ -1987,7 +2061,7 @@ function x402ToolReceipt(receipt) {
|
|
|
1987
2061
|
};
|
|
1988
2062
|
}
|
|
1989
2063
|
function toolError(err) {
|
|
1990
|
-
if (err instanceof
|
|
2064
|
+
if (err instanceof chunkWQ4UYTPE_cjs.HavenPaymentStateError) {
|
|
1991
2065
|
return {
|
|
1992
2066
|
success: false,
|
|
1993
2067
|
payment_id: err.state.paymentId,
|
|
@@ -2032,7 +2106,7 @@ function toolError(err) {
|
|
|
2032
2106
|
error: err.message
|
|
2033
2107
|
};
|
|
2034
2108
|
}
|
|
2035
|
-
if (err instanceof
|
|
2109
|
+
if (err instanceof chunkWQ4UYTPE_cjs.HavenApiError) {
|
|
2036
2110
|
return {
|
|
2037
2111
|
success: false,
|
|
2038
2112
|
status_code: err.statusCode,
|
|
@@ -2069,10 +2143,10 @@ var MerchantCompletion = class {
|
|
|
2069
2143
|
}
|
|
2070
2144
|
async retryRequest(url, initialInit, paymentRequired, receipt) {
|
|
2071
2145
|
if (!receipt.accepted) {
|
|
2072
|
-
throw new
|
|
2146
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("No accepted x402 option was recorded for payment retry", 500);
|
|
2073
2147
|
}
|
|
2074
2148
|
if (!receipt.paymentHeader) {
|
|
2075
|
-
throw new
|
|
2149
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("No x402 payment header was returned for payment retry", 500);
|
|
2076
2150
|
}
|
|
2077
2151
|
const retryResponse = await this.merchantTransport.deliverPaymentRecoveringSession(
|
|
2078
2152
|
url,
|
|
@@ -2097,7 +2171,7 @@ var MerchantCompletion = class {
|
|
|
2097
2171
|
delegate_to: receipt.to
|
|
2098
2172
|
}
|
|
2099
2173
|
});
|
|
2100
|
-
throw new
|
|
2174
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
2101
2175
|
"x402 retry failed after Haven funded the delegate wallet; reconciliation may be required.",
|
|
2102
2176
|
inBandRejection ? X402_RETRY_REJECTED_STATUS : merchant.merchant_status,
|
|
2103
2177
|
{
|
|
@@ -2130,7 +2204,7 @@ var MerchantCompletion = class {
|
|
|
2130
2204
|
merchantStatus: retryResponse.status,
|
|
2131
2205
|
challengePayload: paymentRequired,
|
|
2132
2206
|
selectedPayment: receipt.accepted,
|
|
2133
|
-
paymentProofHeaderName:
|
|
2207
|
+
paymentProofHeaderName: chunkTKJDIRAY_cjs.x402PaymentHeaderNamesSent(receipt.paymentHeader),
|
|
2134
2208
|
paymentProofHeader: receipt.paymentHeader,
|
|
2135
2209
|
protocolReceiptHeaderName,
|
|
2136
2210
|
protocolReceiptHeader
|
|
@@ -2171,18 +2245,18 @@ var MerchantCompletion = class {
|
|
|
2171
2245
|
async resolveCompletionContext(input) {
|
|
2172
2246
|
const status = await this.getPaymentStatus(input.paymentId);
|
|
2173
2247
|
if (status.rail !== "x402") {
|
|
2174
|
-
throw new
|
|
2248
|
+
throw new chunkWQ4UYTPE_cjs.HavenPaymentStateError(
|
|
2175
2249
|
`Payment ${status.paymentId} is ${status.rail}, not x402.`,
|
|
2176
2250
|
409,
|
|
2177
2251
|
status
|
|
2178
2252
|
);
|
|
2179
2253
|
}
|
|
2180
|
-
const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction ===
|
|
2254
|
+
const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction === chunkWQ4UYTPE_cjs.AgentPaymentNextAction.RetryOriginalX402Request || status.kind === "payment_intent" && status.status === "confirmed" && status.phase === chunkWQ4UYTPE_cjs.AgentPaymentPhase.PaymentConfirmed && status.nextAction === chunkWQ4UYTPE_cjs.AgentPaymentNextAction.None;
|
|
2181
2255
|
if (!readyForMerchantCompletion) {
|
|
2182
|
-
throw new
|
|
2256
|
+
throw new chunkWQ4UYTPE_cjs.HavenPaymentStateError(status.message, paymentStateStatusCode(status.status, 409), status);
|
|
2183
2257
|
}
|
|
2184
2258
|
if (!input.noFundingLeg && !status.txHash) {
|
|
2185
|
-
throw new
|
|
2259
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
2186
2260
|
`x402 payment ${status.paymentId} is ready for merchant completion but has no Haven transaction hash.`,
|
|
2187
2261
|
502,
|
|
2188
2262
|
status,
|
|
@@ -2191,7 +2265,7 @@ var MerchantCompletion = class {
|
|
|
2191
2265
|
}
|
|
2192
2266
|
const approvedResourceUrl = status.resourceUrl ?? status.x402?.resourceUrl ?? null;
|
|
2193
2267
|
if (approvedResourceUrl && approvedResourceUrl !== input.url) {
|
|
2194
|
-
throw new
|
|
2268
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
2195
2269
|
"x402 merchant completion does not match the approved resource URL.",
|
|
2196
2270
|
409,
|
|
2197
2271
|
{ status, url: input.url },
|
|
@@ -2277,7 +2351,7 @@ var MerchantCompletion = class {
|
|
|
2277
2351
|
*/
|
|
2278
2352
|
async reportMerchantOutcome(input) {
|
|
2279
2353
|
if (!Number.isInteger(input.merchantStatus) || input.merchantStatus < 100 || input.merchantStatus > 599) {
|
|
2280
|
-
throw new
|
|
2354
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
2281
2355
|
`merchant_status must be an integer HTTP status from 100 to 599 (received ${input.merchantStatus}).`,
|
|
2282
2356
|
400,
|
|
2283
2357
|
void 0,
|
|
@@ -2286,7 +2360,7 @@ var MerchantCompletion = class {
|
|
|
2286
2360
|
}
|
|
2287
2361
|
const looksAccepted = input.merchantStatus >= 200 && input.merchantStatus < 300;
|
|
2288
2362
|
if (looksAccepted !== (input.outcome === "accepted")) {
|
|
2289
|
-
throw new
|
|
2363
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
2290
2364
|
`outcome "${input.outcome}" contradicts merchant_status ${input.merchantStatus}: report "accepted" only for a 2xx and "rejected" only for a non-2xx.`,
|
|
2291
2365
|
400,
|
|
2292
2366
|
void 0,
|
|
@@ -2295,14 +2369,14 @@ var MerchantCompletion = class {
|
|
|
2295
2369
|
}
|
|
2296
2370
|
const status = await this.getPaymentStatus(input.paymentId);
|
|
2297
2371
|
if (status.rail !== "x402") {
|
|
2298
|
-
throw new
|
|
2372
|
+
throw new chunkWQ4UYTPE_cjs.HavenPaymentStateError(
|
|
2299
2373
|
`Payment ${status.paymentId} is ${status.rail}, not x402 \u2014 there is no merchant retry to report.`,
|
|
2300
2374
|
409,
|
|
2301
2375
|
status
|
|
2302
2376
|
);
|
|
2303
2377
|
}
|
|
2304
2378
|
if (status.status !== "confirmed" || !status.txHash) {
|
|
2305
|
-
throw new
|
|
2379
|
+
throw new chunkWQ4UYTPE_cjs.HavenPaymentStateError(
|
|
2306
2380
|
`Payment ${status.paymentId} has no confirmed Haven funding transaction to anchor a merchant report to (status ${status.status}). ${status.message}`,
|
|
2307
2381
|
paymentStateStatusCode(status.status, 409),
|
|
2308
2382
|
status
|
|
@@ -2310,7 +2384,7 @@ var MerchantCompletion = class {
|
|
|
2310
2384
|
}
|
|
2311
2385
|
const resourceUrl = status.resourceUrl ?? status.x402?.resourceUrl ?? null;
|
|
2312
2386
|
if (!resourceUrl) {
|
|
2313
|
-
throw new
|
|
2387
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
2314
2388
|
`Payment ${status.paymentId} has no recorded resource URL, so a merchant report cannot be stored.`,
|
|
2315
2389
|
409,
|
|
2316
2390
|
status,
|
|
@@ -2363,7 +2437,7 @@ var MerchantCompletion = class {
|
|
|
2363
2437
|
await this.post("/machine-payments/evidence", body);
|
|
2364
2438
|
return { outcome: "confirmed" };
|
|
2365
2439
|
} catch (err) {
|
|
2366
|
-
const statusCode = err instanceof
|
|
2440
|
+
const statusCode = err instanceof chunkWQ4UYTPE_cjs.HavenApiError ? err.statusCode : void 0;
|
|
2367
2441
|
const retryable = statusCode === EVIDENCE_RETRYABLE_STATUS;
|
|
2368
2442
|
if (!retryable) {
|
|
2369
2443
|
return { outcome: "refused", statusCode: statusCode ?? 0 };
|
|
@@ -2400,7 +2474,7 @@ var MerchantCompletion = class {
|
|
|
2400
2474
|
*/
|
|
2401
2475
|
async reportSettlementEvidence(paymentId, settlementTxHash) {
|
|
2402
2476
|
if (isZeroSettlementTxHash(settlementTxHash)) {
|
|
2403
|
-
throw new
|
|
2477
|
+
throw new chunkWQ4UYTPE_cjs.HavenZeroSettlementHashError(paymentId);
|
|
2404
2478
|
}
|
|
2405
2479
|
return this.reportEvidence({
|
|
2406
2480
|
paymentId,
|
|
@@ -2420,7 +2494,7 @@ function parseMerchantSettlement(header) {
|
|
|
2420
2494
|
}
|
|
2421
2495
|
function parseProtocolReceiptHeader(value) {
|
|
2422
2496
|
try {
|
|
2423
|
-
return
|
|
2497
|
+
return chunkTKJDIRAY_cjs.decodeBase64Json(value);
|
|
2424
2498
|
} catch {
|
|
2425
2499
|
try {
|
|
2426
2500
|
return JSON.parse(value);
|
|
@@ -2437,7 +2511,7 @@ function x402TypedDataDigest(typedData) {
|
|
|
2437
2511
|
try {
|
|
2438
2512
|
return viem.hashTypedData(typedData);
|
|
2439
2513
|
} catch (err) {
|
|
2440
|
-
throw new
|
|
2514
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2441
2515
|
`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)}`
|
|
2442
2516
|
);
|
|
2443
2517
|
}
|
|
@@ -2526,7 +2600,7 @@ var HavenClient = class {
|
|
|
2526
2600
|
});
|
|
2527
2601
|
this.x402Wallet = config.x402Wallet;
|
|
2528
2602
|
this.merchantTransport = new McpMerchantTransport({ merchantTimeout: config.merchantTimeout });
|
|
2529
|
-
this.confirmationTimeout = config.confirmationTimeout ??
|
|
2603
|
+
this.confirmationTimeout = config.confirmationTimeout ?? chunkWQ4UYTPE_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS;
|
|
2530
2604
|
this.pollingInterval = config.pollingInterval ?? DEFAULT_POLLING_INTERVAL;
|
|
2531
2605
|
this.chainRpcs = config.chainRpcs ?? {};
|
|
2532
2606
|
if (this.delegateKey) {
|
|
@@ -2595,7 +2669,7 @@ var HavenClient = class {
|
|
|
2595
2669
|
*/
|
|
2596
2670
|
async pay(request) {
|
|
2597
2671
|
if (!this.delegateKey) {
|
|
2598
|
-
throw new
|
|
2672
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2599
2673
|
"Cannot use pay() without a delegateKey. Use createIntent() + submitSignature() for manual signing."
|
|
2600
2674
|
);
|
|
2601
2675
|
}
|
|
@@ -2645,15 +2719,15 @@ var HavenClient = class {
|
|
|
2645
2719
|
* on-chain allowance — there is nothing to sign until the user approves.
|
|
2646
2720
|
*/
|
|
2647
2721
|
async createX402Intent(paymentRequired, options = {}) {
|
|
2648
|
-
const option =
|
|
2722
|
+
const option = chunkTKJDIRAY_cjs.selectStandardPaymentOption(paymentRequired.accepts);
|
|
2649
2723
|
if (!option) {
|
|
2650
2724
|
throw noCompatiblePaymentOptionError(paymentRequired.accepts);
|
|
2651
2725
|
}
|
|
2652
2726
|
const fundingTo = options.delegateAddress ?? (await this.getAgent()).delegateAddress;
|
|
2653
2727
|
if (!fundingTo) {
|
|
2654
|
-
throw new
|
|
2728
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("Authenticated agent has no delegate address registered.", 502);
|
|
2655
2729
|
}
|
|
2656
|
-
const idempotencyKey = options.idempotencyKey ??
|
|
2730
|
+
const idempotencyKey = options.idempotencyKey ?? chunkTKJDIRAY_cjs.buildX402IdempotencyKey(paymentRequired, option);
|
|
2657
2731
|
const raw = await this.post("/x402", {
|
|
2658
2732
|
url: paymentRequired.resource.url,
|
|
2659
2733
|
payTo: fundingTo,
|
|
@@ -2664,7 +2738,7 @@ var HavenClient = class {
|
|
|
2664
2738
|
// of a silent reroute to the erc7710 settlement branch (the #1358
|
|
2665
2739
|
// review's open-budget misroute). Legacy-rail backends ignore the field.
|
|
2666
2740
|
settlementScheme: "eip3009",
|
|
2667
|
-
amount:
|
|
2741
|
+
amount: chunkTKJDIRAY_cjs.x402AuthorizationAmount(option),
|
|
2668
2742
|
asset: option.asset,
|
|
2669
2743
|
network: option.network,
|
|
2670
2744
|
description: paymentRequired.resource.description,
|
|
@@ -2686,15 +2760,15 @@ var HavenClient = class {
|
|
|
2686
2760
|
throwPaymentStateError("x402 payment", raw);
|
|
2687
2761
|
}
|
|
2688
2762
|
if (!raw.sign_data?.hash) {
|
|
2689
|
-
throw new
|
|
2763
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("No sign_hash returned from x402/authorize", 500, raw);
|
|
2690
2764
|
}
|
|
2691
2765
|
if (raw.sign_data.signature_scheme !== void 0 && !raw.sign_data.typed_data) {
|
|
2692
|
-
throw new
|
|
2766
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2693
2767
|
`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.`
|
|
2694
2768
|
);
|
|
2695
2769
|
}
|
|
2696
2770
|
if (!raw.x402_expected_auth) {
|
|
2697
|
-
throw new
|
|
2771
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("No x402 expected-context binding returned from x402/authorize", 500, raw);
|
|
2698
2772
|
}
|
|
2699
2773
|
return {
|
|
2700
2774
|
paymentId: raw.payment_id,
|
|
@@ -2705,7 +2779,7 @@ var HavenClient = class {
|
|
|
2705
2779
|
accepted: option,
|
|
2706
2780
|
resourceUrl: paymentRequired.resource.url,
|
|
2707
2781
|
merchantTo: raw.merchant_to ?? option.payTo,
|
|
2708
|
-
amountAtomic:
|
|
2782
|
+
amountAtomic: chunkTKJDIRAY_cjs.x402AuthorizationAmount(option),
|
|
2709
2783
|
asset: option.asset,
|
|
2710
2784
|
network: option.network,
|
|
2711
2785
|
expectedAuth: raw.x402_expected_auth,
|
|
@@ -2730,13 +2804,13 @@ var HavenClient = class {
|
|
|
2730
2804
|
*/
|
|
2731
2805
|
sign(hash) {
|
|
2732
2806
|
if (!this.delegateKey) {
|
|
2733
|
-
throw new
|
|
2807
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2734
2808
|
"Cannot sign without a delegateKey. Pass the private key in HavenClient config, or sign externally."
|
|
2735
2809
|
);
|
|
2736
2810
|
}
|
|
2737
2811
|
const signature = signHash(this.delegateKey, hash);
|
|
2738
2812
|
if (!verifySignature(hash, signature, this.delegateAddress)) {
|
|
2739
|
-
throw new
|
|
2813
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2740
2814
|
"Local signature verification failed \u2014 recovered address does not match delegate key."
|
|
2741
2815
|
);
|
|
2742
2816
|
}
|
|
@@ -2754,29 +2828,29 @@ var HavenClient = class {
|
|
|
2754
2828
|
*/
|
|
2755
2829
|
async signForData(signData, settlementExpectation, fundingExpectation) {
|
|
2756
2830
|
if (!this.delegateKey) {
|
|
2757
|
-
throw new
|
|
2831
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2758
2832
|
"Cannot sign without a delegateKey. Pass the private key in HavenClient config, or sign externally."
|
|
2759
2833
|
);
|
|
2760
2834
|
}
|
|
2761
2835
|
const scheme = signData.signature_scheme;
|
|
2762
2836
|
if (scheme === "eip191_userop") {
|
|
2763
|
-
throw new
|
|
2837
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2764
2838
|
"The session rail is retired \u2014 'eip191_userop' intents can no longer be signed. Re-onboard the account on the delegation rail."
|
|
2765
2839
|
);
|
|
2766
2840
|
}
|
|
2767
2841
|
if (scheme === "eip712_userop") {
|
|
2768
2842
|
if (!signData.typed_data) {
|
|
2769
|
-
throw new
|
|
2843
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2770
2844
|
"sign_data.signature_scheme is eip712_userop but typed_data is missing \u2014 refusing to sign the bare hash (the account would reject it)."
|
|
2771
2845
|
);
|
|
2772
2846
|
}
|
|
2773
|
-
|
|
2774
|
-
|
|
2847
|
+
chunkWQ4UYTPE_cjs.assertUserOpTypedDataBinding(signData.typed_data, signData.hash);
|
|
2848
|
+
chunkTKJDIRAY_cjs.assertBoundDirectPaymentUserOp(
|
|
2775
2849
|
signData.typed_data,
|
|
2776
2850
|
this.delegateAddress
|
|
2777
2851
|
);
|
|
2778
2852
|
if (fundingExpectation) {
|
|
2779
|
-
|
|
2853
|
+
chunkTKJDIRAY_cjs.assertFundingLegPaysDelegate(signData.typed_data, {
|
|
2780
2854
|
delegateAddress: this.delegateAddress,
|
|
2781
2855
|
asset: fundingExpectation.asset,
|
|
2782
2856
|
amount: fundingExpectation.amount
|
|
@@ -2786,24 +2860,24 @@ var HavenClient = class {
|
|
|
2786
2860
|
}
|
|
2787
2861
|
if (scheme === "eip712_delegation") {
|
|
2788
2862
|
if (!signData.typed_data) {
|
|
2789
|
-
throw new
|
|
2863
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2790
2864
|
"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)."
|
|
2791
2865
|
);
|
|
2792
2866
|
}
|
|
2793
2867
|
if (!settlementExpectation) {
|
|
2794
|
-
throw new
|
|
2868
|
+
throw new chunkTKJDIRAY_cjs.HavenTypedDataRefusedError(
|
|
2795
2869
|
"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."
|
|
2796
2870
|
);
|
|
2797
2871
|
}
|
|
2798
|
-
|
|
2872
|
+
chunkTKJDIRAY_cjs.assertOwnSettlementChild(signData.typed_data, settlementExpectation, this.delegateAddress);
|
|
2799
2873
|
return signSettlementDelegationTypedData(this.delegateKey, signData.typed_data);
|
|
2800
2874
|
}
|
|
2801
2875
|
if (scheme === void 0) {
|
|
2802
|
-
throw new
|
|
2876
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2803
2877
|
"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."
|
|
2804
2878
|
);
|
|
2805
2879
|
}
|
|
2806
|
-
throw new
|
|
2880
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
2807
2881
|
`Unknown sign_data.signature_scheme '${scheme}' \u2014 refusing to guess a signing scheme. Update @haven_ai/sdk.`
|
|
2808
2882
|
);
|
|
2809
2883
|
}
|
|
@@ -2987,7 +3061,7 @@ var HavenClient = class {
|
|
|
2987
3061
|
*/
|
|
2988
3062
|
async getPaymentStatusWithPostPurchaseAllowance(paymentId) {
|
|
2989
3063
|
const status = await this.getPaymentStatus(paymentId);
|
|
2990
|
-
if (status.rail ===
|
|
3064
|
+
if (status.rail === chunkWQ4UYTPE_cjs.AgentPaymentRail.X402 && status.phase === chunkWQ4UYTPE_cjs.AgentPaymentPhase.PaymentConfirmed) {
|
|
2991
3065
|
const { allowance, warnings } = await this.getPostPurchaseAllowanceSummary(paymentId);
|
|
2992
3066
|
return { ...status, allowance, ...warnings.length > 0 ? { warnings } : {} };
|
|
2993
3067
|
}
|
|
@@ -3185,7 +3259,7 @@ var HavenClient = class {
|
|
|
3185
3259
|
}
|
|
3186
3260
|
await sleep(this.pollingInterval);
|
|
3187
3261
|
}
|
|
3188
|
-
throw new
|
|
3262
|
+
throw new chunkWQ4UYTPE_cjs.HavenTimeoutError(paymentId);
|
|
3189
3263
|
}
|
|
3190
3264
|
// ── x402 Protocol Support ────────────────────────────────────────
|
|
3191
3265
|
/**
|
|
@@ -3199,24 +3273,24 @@ var HavenClient = class {
|
|
|
3199
3273
|
*/
|
|
3200
3274
|
async authorizeX402(paymentRequired, options = {}) {
|
|
3201
3275
|
if (!this.delegateKey) {
|
|
3202
|
-
throw new
|
|
3276
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
3203
3277
|
"delegateKey is required for x402 payments. Pass it in the HavenClient config."
|
|
3204
3278
|
);
|
|
3205
3279
|
}
|
|
3206
3280
|
if (!this.delegateAddress) {
|
|
3207
|
-
throw new
|
|
3281
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
|
|
3208
3282
|
}
|
|
3209
|
-
const option =
|
|
3283
|
+
const option = chunkTKJDIRAY_cjs.selectStandardPaymentOption(paymentRequired.accepts);
|
|
3210
3284
|
if (!option) {
|
|
3211
3285
|
throw noCompatiblePaymentOptionError(paymentRequired.accepts);
|
|
3212
3286
|
}
|
|
3213
|
-
const idempotencyKey = options.idempotencyKey ??
|
|
3287
|
+
const idempotencyKey = options.idempotencyKey ?? chunkTKJDIRAY_cjs.buildX402IdempotencyKey(paymentRequired, option);
|
|
3214
3288
|
const cached = this.fundingLeg.cachedReceipt(idempotencyKey, options.taskBudgetId);
|
|
3215
3289
|
if (cached) return cached;
|
|
3216
3290
|
const inFlight = this.inFlightX402.get(idempotencyKey);
|
|
3217
3291
|
if (inFlight) {
|
|
3218
3292
|
if (!sameX402TaskBudget(this.inFlightX402TaskBudget.get(idempotencyKey), options.taskBudgetId)) {
|
|
3219
|
-
throw new
|
|
3293
|
+
throw new chunkWQ4UYTPE_cjs.X402TaskBudgetMismatchError(
|
|
3220
3294
|
`The x402 idempotency key '${idempotencyKey}' has an in-flight payment created under a different task budget ('${this.inFlightX402TaskBudget.get(idempotencyKey) ?? "none"}' vs '${options.taskBudgetId ?? "none"}'). Pass a new idempotencyKey to pay under this budget.`,
|
|
3221
3295
|
idempotencyKey,
|
|
3222
3296
|
this.inFlightX402TaskBudget.get(idempotencyKey),
|
|
@@ -3262,16 +3336,16 @@ var HavenClient = class {
|
|
|
3262
3336
|
} catch {
|
|
3263
3337
|
body = void 0;
|
|
3264
3338
|
}
|
|
3265
|
-
throw new
|
|
3339
|
+
throw new chunkWQ4UYTPE_cjs.X402UnexpectedStatusError(
|
|
3266
3340
|
`Expected an x402 quote response with HTTP 402, got HTTP ${response.status}.`,
|
|
3267
3341
|
response.status || 400,
|
|
3268
3342
|
body
|
|
3269
3343
|
);
|
|
3270
3344
|
}
|
|
3271
3345
|
if (response.headers.get("MACHINE-PAYMENT-CHALLENGE")) {
|
|
3272
|
-
throw new
|
|
3346
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("quoteX402 only supports standard x402 Payment Required responses.", 400);
|
|
3273
3347
|
}
|
|
3274
|
-
const paymentRequired = await
|
|
3348
|
+
const paymentRequired = await chunkTKJDIRAY_cjs.parsePaymentRequiredResponse(response);
|
|
3275
3349
|
const mcpTransport = await this.merchantTransport.detect(url, paymentRequired, response);
|
|
3276
3350
|
return buildX402Quote(paymentRequired, request, options.idempotencyKey, mcpTransport);
|
|
3277
3351
|
}
|
|
@@ -3289,7 +3363,7 @@ var HavenClient = class {
|
|
|
3289
3363
|
const wallet = await this.merchantCompletion.resolveWalletForMerchantCall();
|
|
3290
3364
|
const sessionId = await this.merchantTransport.initialize(url, init, wallet);
|
|
3291
3365
|
if (!sessionId) {
|
|
3292
|
-
throw new
|
|
3366
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError(
|
|
3293
3367
|
"The merchant did not establish an MCP session before the x402 quote. No payment was created.",
|
|
3294
3368
|
502,
|
|
3295
3369
|
{ mcpSessionNotEstablished: true }
|
|
@@ -3363,18 +3437,18 @@ var HavenClient = class {
|
|
|
3363
3437
|
}
|
|
3364
3438
|
async resumeAuthorizedX402(input) {
|
|
3365
3439
|
if (!this.delegateKey) {
|
|
3366
|
-
throw new
|
|
3440
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError(
|
|
3367
3441
|
"delegateKey is required for x402 payments. Pass it in the HavenClient config."
|
|
3368
3442
|
);
|
|
3369
3443
|
}
|
|
3370
3444
|
if (!this.delegateAddress) {
|
|
3371
|
-
throw new
|
|
3445
|
+
throw new chunkWQ4UYTPE_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
|
|
3372
3446
|
}
|
|
3373
|
-
const option =
|
|
3447
|
+
const option = chunkTKJDIRAY_cjs.selectStandardPaymentOption(input.paymentRequired.accepts);
|
|
3374
3448
|
if (!option) {
|
|
3375
3449
|
throw noCompatiblePaymentOptionError(input.paymentRequired.accepts);
|
|
3376
3450
|
}
|
|
3377
|
-
const idempotencyKey = input.idempotencyKey ??
|
|
3451
|
+
const idempotencyKey = input.idempotencyKey ?? chunkTKJDIRAY_cjs.buildX402IdempotencyKey(input.paymentRequired, option);
|
|
3378
3452
|
const cached = this.fundingLeg.cachedReceipt(idempotencyKey, input.taskBudgetId);
|
|
3379
3453
|
if (cached) return cached;
|
|
3380
3454
|
const status = await this.getPaymentStatus(input.paymentId);
|
|
@@ -3382,10 +3456,10 @@ var HavenClient = class {
|
|
|
3382
3456
|
const canFund = await this.fundingLeg.delegateCanFund(
|
|
3383
3457
|
status.chainId ?? chainIdFromNetwork(option.network),
|
|
3384
3458
|
option.asset,
|
|
3385
|
-
|
|
3459
|
+
chunkTKJDIRAY_cjs.x402AuthorizationAmount(option)
|
|
3386
3460
|
);
|
|
3387
3461
|
if (canFund === false) {
|
|
3388
|
-
throw new
|
|
3462
|
+
throw new chunkWQ4UYTPE_cjs.X402AlreadySettledError(
|
|
3389
3463
|
`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.`,
|
|
3390
3464
|
this.fundingLeg.receiptFromStatus(input.paymentRequired, option, void 0, status),
|
|
3391
3465
|
"settled"
|
|
@@ -3406,13 +3480,13 @@ var HavenClient = class {
|
|
|
3406
3480
|
const url = input.url ?? input.request?.url;
|
|
3407
3481
|
if (!paymentRequired) {
|
|
3408
3482
|
if (!url) {
|
|
3409
|
-
throw new
|
|
3483
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("x402 resume requires the original URL or a captured request snapshot.", 400);
|
|
3410
3484
|
}
|
|
3411
3485
|
const response = await this.merchantTransport.fetch(url, initialInit);
|
|
3412
3486
|
if (response.status !== 402) {
|
|
3413
|
-
throw new
|
|
3487
|
+
throw new chunkWQ4UYTPE_cjs.HavenApiError("Expected the original x402 request to return HTTP 402 before resuming.", 400);
|
|
3414
3488
|
}
|
|
3415
|
-
paymentRequired = await
|
|
3489
|
+
paymentRequired = await chunkTKJDIRAY_cjs.parsePaymentRequiredResponse(response);
|
|
3416
3490
|
}
|
|
3417
3491
|
const receipt = await this.resumeAuthorizedX402({
|
|
3418
3492
|
paymentId: input.paymentId,
|
|
@@ -3465,7 +3539,7 @@ var HavenClient = class {
|
|
|
3465
3539
|
nativeChallenge = true;
|
|
3466
3540
|
} else {
|
|
3467
3541
|
try {
|
|
3468
|
-
paymentRequired = await
|
|
3542
|
+
paymentRequired = await chunkTKJDIRAY_cjs.parsePaymentRequiredResponse(response);
|
|
3469
3543
|
} catch {
|
|
3470
3544
|
return response;
|
|
3471
3545
|
}
|
|
@@ -3475,8 +3549,8 @@ var HavenClient = class {
|
|
|
3475
3549
|
if (mcpSessionId) requestInit = this.merchantTransport.withSessionHeaders(requestInit, mcpSessionId);
|
|
3476
3550
|
}
|
|
3477
3551
|
const request = snapshotX402Request(url, requestInit);
|
|
3478
|
-
const option =
|
|
3479
|
-
const idempotencyKey = options.idempotencyKey ?? (option ?
|
|
3552
|
+
const option = chunkTKJDIRAY_cjs.selectStandardPaymentOption(paymentRequired.accepts);
|
|
3553
|
+
const idempotencyKey = options.idempotencyKey ?? (option ? chunkTKJDIRAY_cjs.buildX402IdempotencyKey(paymentRequired, option) : void 0);
|
|
3480
3554
|
let receipt;
|
|
3481
3555
|
try {
|
|
3482
3556
|
receipt = await this.authorizeX402(paymentRequired, options);
|
|
@@ -3603,7 +3677,7 @@ var HavenClient = class {
|
|
|
3603
3677
|
txHash: evidenceTxHash,
|
|
3604
3678
|
resourceUrl: evidenceContext.resourceUrl,
|
|
3605
3679
|
merchantStatus: surfaced.status,
|
|
3606
|
-
paymentProofHeaderName:
|
|
3680
|
+
paymentProofHeaderName: chunkTKJDIRAY_cjs.x402PaymentHeaderNamesSent(input.paymentHeader),
|
|
3607
3681
|
paymentProofHeader: input.paymentHeader,
|
|
3608
3682
|
protocolReceiptHeaderName,
|
|
3609
3683
|
protocolReceiptHeader
|
|
@@ -3820,7 +3894,7 @@ var toolDescriptions = {
|
|
|
3820
3894
|
// deleted `/demo/mpp/*` route. Use the x402 fragments above instead.
|
|
3821
3895
|
getPaymentStatus: {
|
|
3822
3896
|
summary: "Fetch structured Haven payment status for agent recovery.",
|
|
3823
|
-
behavior: "State: phase, nextAction, rail, amount, merchant, resource, idempotency, message; parties: treasury/delegate/delegateAccount/merchant. awaiting_settlement_evidence: poll once, else unverified.",
|
|
3897
|
+
behavior: "State: phase, nextAction, rail, amount, merchant, resource, idempotency, message; delivered when the merchant answered; parties: treasury/delegate/delegateAccount/merchant. awaiting_settlement_evidence: poll once, else unverified. delivered_unverified: terminal, stop.",
|
|
3824
3898
|
nextActionGuidance: ""
|
|
3825
3899
|
},
|
|
3826
3900
|
getResumeState: {
|
|
@@ -3855,9 +3929,9 @@ var toolDescriptions = {
|
|
|
3855
3929
|
nextActionGuidance: ""
|
|
3856
3930
|
},
|
|
3857
3931
|
verifyReceipt: {
|
|
3858
|
-
summary: "Verify a payment receipt offline \u2014 confirm the agent
|
|
3859
|
-
selectionGuidance: "
|
|
3860
|
-
behavior: "
|
|
3932
|
+
summary: "Verify a signed payment receipt offline \u2014 confirm the agent delegate signed its authorisation.",
|
|
3933
|
+
selectionGuidance: "Takes the signed bundle from GET /payments/{id}/receipt, not a haven_list_receipts row \u2014 a row carries no signature and returns not_a_signed_receipt. No network.",
|
|
3934
|
+
behavior: "Never throws. An erc7710 bundle verifies over the delegation digest the delegate signed; a direct or eip3009 bundle returns not_verifiable_offline. verified true means only that the delegate signed the hash named by verifiedOver \u2014 payment facts are Haven-asserted and settlement is not proven; check settlementTxHash on an explorer.",
|
|
3861
3935
|
nextActionGuidance: ""
|
|
3862
3936
|
},
|
|
3863
3937
|
payMcpTool: {
|
|
@@ -4604,471 +4678,471 @@ function sameUrl(a, b) {
|
|
|
4604
4678
|
|
|
4605
4679
|
Object.defineProperty(exports, "DEFAULT_NEXT_TOOL_BY_ACTION", {
|
|
4606
4680
|
enumerable: true,
|
|
4607
|
-
get: function () { return
|
|
4681
|
+
get: function () { return chunkTKJDIRAY_cjs.DEFAULT_NEXT_TOOL_BY_ACTION; }
|
|
4608
4682
|
});
|
|
4609
4683
|
Object.defineProperty(exports, "ERC7710_ASSET_TRANSFER_METHOD", {
|
|
4610
4684
|
enumerable: true,
|
|
4611
|
-
get: function () { return
|
|
4685
|
+
get: function () { return chunkTKJDIRAY_cjs.ERC7710_ASSET_TRANSFER_METHOD; }
|
|
4612
4686
|
});
|
|
4613
4687
|
Object.defineProperty(exports, "HAVEN_CLIENT_HEADER", {
|
|
4614
4688
|
enumerable: true,
|
|
4615
|
-
get: function () { return
|
|
4689
|
+
get: function () { return chunkTKJDIRAY_cjs.HAVEN_CLIENT_HEADER; }
|
|
4616
4690
|
});
|
|
4617
4691
|
Object.defineProperty(exports, "HAVEN_MINIMUM_NODE_VERSION", {
|
|
4618
4692
|
enumerable: true,
|
|
4619
|
-
get: function () { return
|
|
4693
|
+
get: function () { return chunkTKJDIRAY_cjs.HAVEN_MINIMUM_NODE_VERSION; }
|
|
4620
4694
|
});
|
|
4621
4695
|
Object.defineProperty(exports, "HavenTypedDataRefusedError", {
|
|
4622
4696
|
enumerable: true,
|
|
4623
|
-
get: function () { return
|
|
4697
|
+
get: function () { return chunkTKJDIRAY_cjs.HavenTypedDataRefusedError; }
|
|
4624
4698
|
});
|
|
4625
4699
|
Object.defineProperty(exports, "MAX_TASK_BUDGET_TTL_SECONDS", {
|
|
4626
4700
|
enumerable: true,
|
|
4627
|
-
get: function () { return
|
|
4701
|
+
get: function () { return chunkTKJDIRAY_cjs.MAX_TASK_BUDGET_TTL_SECONDS; }
|
|
4628
4702
|
});
|
|
4629
4703
|
Object.defineProperty(exports, "NEXT_TOOL_SERVER_NAMES", {
|
|
4630
4704
|
enumerable: true,
|
|
4631
|
-
get: function () { return
|
|
4705
|
+
get: function () { return chunkTKJDIRAY_cjs.NEXT_TOOL_SERVER_NAMES; }
|
|
4632
4706
|
});
|
|
4633
4707
|
Object.defineProperty(exports, "NEXT_TOOL_SERVER_ROLES", {
|
|
4634
4708
|
enumerable: true,
|
|
4635
|
-
get: function () { return
|
|
4709
|
+
get: function () { return chunkTKJDIRAY_cjs.NEXT_TOOL_SERVER_ROLES; }
|
|
4636
4710
|
});
|
|
4637
4711
|
Object.defineProperty(exports, "SDK_CLIENT_IDENTITY", {
|
|
4638
4712
|
enumerable: true,
|
|
4639
|
-
get: function () { return
|
|
4713
|
+
get: function () { return chunkTKJDIRAY_cjs.SDK_CLIENT_IDENTITY; }
|
|
4640
4714
|
});
|
|
4641
4715
|
Object.defineProperty(exports, "SDK_VERSION", {
|
|
4642
4716
|
enumerable: true,
|
|
4643
|
-
get: function () { return
|
|
4717
|
+
get: function () { return chunkTKJDIRAY_cjs.SDK_VERSION; }
|
|
4644
4718
|
});
|
|
4645
4719
|
Object.defineProperty(exports, "SWEEP_BASE_CHAIN_ID", {
|
|
4646
4720
|
enumerable: true,
|
|
4647
|
-
get: function () { return
|
|
4721
|
+
get: function () { return chunkTKJDIRAY_cjs.SWEEP_BASE_CHAIN_ID; }
|
|
4648
4722
|
});
|
|
4649
4723
|
Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_CHAIN_ID", {
|
|
4650
4724
|
enumerable: true,
|
|
4651
|
-
get: function () { return
|
|
4725
|
+
get: function () { return chunkTKJDIRAY_cjs.SWEEP_BASE_SEPOLIA_CHAIN_ID; }
|
|
4652
4726
|
});
|
|
4653
4727
|
Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_USDC_ADDRESS", {
|
|
4654
4728
|
enumerable: true,
|
|
4655
|
-
get: function () { return
|
|
4729
|
+
get: function () { return chunkTKJDIRAY_cjs.SWEEP_BASE_SEPOLIA_USDC_ADDRESS; }
|
|
4656
4730
|
});
|
|
4657
4731
|
Object.defineProperty(exports, "SWEEP_BASE_USDC_ADDRESS", {
|
|
4658
4732
|
enumerable: true,
|
|
4659
|
-
get: function () { return
|
|
4733
|
+
get: function () { return chunkTKJDIRAY_cjs.SWEEP_BASE_USDC_ADDRESS; }
|
|
4660
4734
|
});
|
|
4661
4735
|
Object.defineProperty(exports, "TRANSFER_WITH_AUTHORIZATION_TYPES", {
|
|
4662
4736
|
enumerable: true,
|
|
4663
|
-
get: function () { return
|
|
4737
|
+
get: function () { return chunkTKJDIRAY_cjs.TRANSFER_WITH_AUTHORIZATION_TYPES; }
|
|
4664
4738
|
});
|
|
4665
4739
|
Object.defineProperty(exports, "TYPED_DATA_NOT_ALLOWED", {
|
|
4666
4740
|
enumerable: true,
|
|
4667
|
-
get: function () { return
|
|
4741
|
+
get: function () { return chunkTKJDIRAY_cjs.TYPED_DATA_NOT_ALLOWED; }
|
|
4668
4742
|
});
|
|
4669
4743
|
Object.defineProperty(exports, "X402PaymentHeaderValidationError", {
|
|
4670
4744
|
enumerable: true,
|
|
4671
|
-
get: function () { return
|
|
4745
|
+
get: function () { return chunkTKJDIRAY_cjs.X402PaymentHeaderValidationError; }
|
|
4672
4746
|
});
|
|
4673
4747
|
Object.defineProperty(exports, "X402_LEGACY_PAYMENT_HEADER_NAME", {
|
|
4674
4748
|
enumerable: true,
|
|
4675
|
-
get: function () { return
|
|
4749
|
+
get: function () { return chunkTKJDIRAY_cjs.X402_LEGACY_PAYMENT_HEADER_NAME; }
|
|
4676
4750
|
});
|
|
4677
4751
|
Object.defineProperty(exports, "X402_MAX_AUTHORIZATION_WINDOW_SECONDS", {
|
|
4678
4752
|
enumerable: true,
|
|
4679
|
-
get: function () { return
|
|
4753
|
+
get: function () { return chunkTKJDIRAY_cjs.X402_MAX_AUTHORIZATION_WINDOW_SECONDS; }
|
|
4680
4754
|
});
|
|
4681
4755
|
Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAME", {
|
|
4682
4756
|
enumerable: true,
|
|
4683
|
-
get: function () { return
|
|
4757
|
+
get: function () { return chunkTKJDIRAY_cjs.X402_PAYMENT_HEADER_NAME; }
|
|
4684
4758
|
});
|
|
4685
4759
|
Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAMES_SENT", {
|
|
4686
4760
|
enumerable: true,
|
|
4687
|
-
get: function () { return
|
|
4761
|
+
get: function () { return chunkTKJDIRAY_cjs.X402_PAYMENT_HEADER_NAMES_SENT; }
|
|
4688
4762
|
});
|
|
4689
4763
|
Object.defineProperty(exports, "X402_PAYMENT_REQUIRED_HEADER_NAME", {
|
|
4690
4764
|
enumerable: true,
|
|
4691
|
-
get: function () { return
|
|
4765
|
+
get: function () { return chunkTKJDIRAY_cjs.X402_PAYMENT_REQUIRED_HEADER_NAME; }
|
|
4692
4766
|
});
|
|
4693
4767
|
Object.defineProperty(exports, "X402_PAYMENT_RESPONSE_HEADER_NAME", {
|
|
4694
4768
|
enumerable: true,
|
|
4695
|
-
get: function () { return
|
|
4769
|
+
get: function () { return chunkTKJDIRAY_cjs.X402_PAYMENT_RESPONSE_HEADER_NAME; }
|
|
4696
4770
|
});
|
|
4697
4771
|
Object.defineProperty(exports, "X402_SETTLEMENT_FORWARD_MARGIN_SECONDS", {
|
|
4698
4772
|
enumerable: true,
|
|
4699
|
-
get: function () { return
|
|
4773
|
+
get: function () { return chunkTKJDIRAY_cjs.X402_SETTLEMENT_FORWARD_MARGIN_SECONDS; }
|
|
4700
4774
|
});
|
|
4701
4775
|
Object.defineProperty(exports, "assertBoundDirectPaymentUserOp", {
|
|
4702
4776
|
enumerable: true,
|
|
4703
|
-
get: function () { return
|
|
4777
|
+
get: function () { return chunkTKJDIRAY_cjs.assertBoundDirectPaymentUserOp; }
|
|
4704
4778
|
});
|
|
4705
4779
|
Object.defineProperty(exports, "assertOwnTaskBudgetCloseUserOp", {
|
|
4706
4780
|
enumerable: true,
|
|
4707
|
-
get: function () { return
|
|
4781
|
+
get: function () { return chunkTKJDIRAY_cjs.assertOwnTaskBudgetCloseUserOp; }
|
|
4708
4782
|
});
|
|
4709
4783
|
Object.defineProperty(exports, "assertOwnTaskChild", {
|
|
4710
4784
|
enumerable: true,
|
|
4711
|
-
get: function () { return
|
|
4785
|
+
get: function () { return chunkTKJDIRAY_cjs.assertOwnTaskChild; }
|
|
4712
4786
|
});
|
|
4713
4787
|
Object.defineProperty(exports, "buildSweepAuthorizationMessage", {
|
|
4714
4788
|
enumerable: true,
|
|
4715
|
-
get: function () { return
|
|
4789
|
+
get: function () { return chunkTKJDIRAY_cjs.buildSweepAuthorizationMessage; }
|
|
4716
4790
|
});
|
|
4717
4791
|
Object.defineProperty(exports, "buildSweepTypedData", {
|
|
4718
4792
|
enumerable: true,
|
|
4719
|
-
get: function () { return
|
|
4793
|
+
get: function () { return chunkTKJDIRAY_cjs.buildSweepTypedData; }
|
|
4720
4794
|
});
|
|
4721
4795
|
Object.defineProperty(exports, "buildX402ExpectedMessage", {
|
|
4722
4796
|
enumerable: true,
|
|
4723
|
-
get: function () { return
|
|
4797
|
+
get: function () { return chunkTKJDIRAY_cjs.buildX402ExpectedMessage; }
|
|
4724
4798
|
});
|
|
4725
4799
|
Object.defineProperty(exports, "compareNodeVersions", {
|
|
4726
4800
|
enumerable: true,
|
|
4727
|
-
get: function () { return
|
|
4801
|
+
get: function () { return chunkTKJDIRAY_cjs.compareNodeVersions; }
|
|
4728
4802
|
});
|
|
4729
4803
|
Object.defineProperty(exports, "createNextStepBuilder", {
|
|
4730
4804
|
enumerable: true,
|
|
4731
|
-
get: function () { return
|
|
4805
|
+
get: function () { return chunkTKJDIRAY_cjs.createNextStepBuilder; }
|
|
4732
4806
|
});
|
|
4733
4807
|
Object.defineProperty(exports, "decodeBase64Json", {
|
|
4734
4808
|
enumerable: true,
|
|
4735
|
-
get: function () { return
|
|
4809
|
+
get: function () { return chunkTKJDIRAY_cjs.decodeBase64Json; }
|
|
4736
4810
|
});
|
|
4737
4811
|
Object.defineProperty(exports, "decodeBase64Utf8", {
|
|
4738
4812
|
enumerable: true,
|
|
4739
|
-
get: function () { return
|
|
4813
|
+
get: function () { return chunkTKJDIRAY_cjs.decodeBase64Utf8; }
|
|
4740
4814
|
});
|
|
4741
4815
|
Object.defineProperty(exports, "defaultNextToolFor", {
|
|
4742
4816
|
enumerable: true,
|
|
4743
|
-
get: function () { return
|
|
4817
|
+
get: function () { return chunkTKJDIRAY_cjs.defaultNextToolFor; }
|
|
4744
4818
|
});
|
|
4745
4819
|
Object.defineProperty(exports, "encodeBase64Json", {
|
|
4746
4820
|
enumerable: true,
|
|
4747
|
-
get: function () { return
|
|
4821
|
+
get: function () { return chunkTKJDIRAY_cjs.encodeBase64Json; }
|
|
4748
4822
|
});
|
|
4749
4823
|
Object.defineProperty(exports, "encodeBase64Utf8", {
|
|
4750
4824
|
enumerable: true,
|
|
4751
|
-
get: function () { return
|
|
4825
|
+
get: function () { return chunkTKJDIRAY_cjs.encodeBase64Utf8; }
|
|
4752
4826
|
});
|
|
4753
4827
|
Object.defineProperty(exports, "encodePaymentProof", {
|
|
4754
4828
|
enumerable: true,
|
|
4755
|
-
get: function () { return
|
|
4829
|
+
get: function () { return chunkTKJDIRAY_cjs.encodePaymentProof; }
|
|
4756
4830
|
});
|
|
4757
4831
|
Object.defineProperty(exports, "hashDelegation", {
|
|
4758
4832
|
enumerable: true,
|
|
4759
|
-
get: function () { return
|
|
4833
|
+
get: function () { return chunkTKJDIRAY_cjs.hashDelegation; }
|
|
4760
4834
|
});
|
|
4761
4835
|
Object.defineProperty(exports, "havenClientIdentity", {
|
|
4762
4836
|
enumerable: true,
|
|
4763
|
-
get: function () { return
|
|
4837
|
+
get: function () { return chunkTKJDIRAY_cjs.havenClientIdentity; }
|
|
4764
4838
|
});
|
|
4765
4839
|
Object.defineProperty(exports, "isErc7710Option", {
|
|
4766
4840
|
enumerable: true,
|
|
4767
|
-
get: function () { return
|
|
4841
|
+
get: function () { return chunkTKJDIRAY_cjs.isErc7710Option; }
|
|
4768
4842
|
});
|
|
4769
4843
|
Object.defineProperty(exports, "isSupportedNodeVersion", {
|
|
4770
4844
|
enumerable: true,
|
|
4771
|
-
get: function () { return
|
|
4845
|
+
get: function () { return chunkTKJDIRAY_cjs.isSupportedNodeVersion; }
|
|
4772
4846
|
});
|
|
4773
4847
|
Object.defineProperty(exports, "isSweepableChain", {
|
|
4774
4848
|
enumerable: true,
|
|
4775
|
-
get: function () { return
|
|
4849
|
+
get: function () { return chunkTKJDIRAY_cjs.isSweepableChain; }
|
|
4776
4850
|
});
|
|
4777
4851
|
Object.defineProperty(exports, "isTaskChildTypedData", {
|
|
4778
4852
|
enumerable: true,
|
|
4779
|
-
get: function () { return
|
|
4853
|
+
get: function () { return chunkTKJDIRAY_cjs.isTaskChildTypedData; }
|
|
4780
4854
|
});
|
|
4781
4855
|
Object.defineProperty(exports, "normalizePaymentRequired", {
|
|
4782
4856
|
enumerable: true,
|
|
4783
|
-
get: function () { return
|
|
4857
|
+
get: function () { return chunkTKJDIRAY_cjs.normalizePaymentRequired; }
|
|
4784
4858
|
});
|
|
4785
4859
|
Object.defineProperty(exports, "parseNextTool", {
|
|
4786
4860
|
enumerable: true,
|
|
4787
|
-
get: function () { return
|
|
4861
|
+
get: function () { return chunkTKJDIRAY_cjs.parseNextTool; }
|
|
4788
4862
|
});
|
|
4789
4863
|
Object.defineProperty(exports, "parsePaymentRequired", {
|
|
4790
4864
|
enumerable: true,
|
|
4791
|
-
get: function () { return
|
|
4865
|
+
get: function () { return chunkTKJDIRAY_cjs.parsePaymentRequired; }
|
|
4792
4866
|
});
|
|
4793
4867
|
Object.defineProperty(exports, "parsePaymentRequiredResponse", {
|
|
4794
4868
|
enumerable: true,
|
|
4795
|
-
get: function () { return
|
|
4869
|
+
get: function () { return chunkTKJDIRAY_cjs.parsePaymentRequiredResponse; }
|
|
4796
4870
|
});
|
|
4797
4871
|
Object.defineProperty(exports, "readClientUpdate", {
|
|
4798
4872
|
enumerable: true,
|
|
4799
|
-
get: function () { return
|
|
4873
|
+
get: function () { return chunkTKJDIRAY_cjs.readClientUpdate; }
|
|
4800
4874
|
});
|
|
4801
4875
|
Object.defineProperty(exports, "renderNextTool", {
|
|
4802
4876
|
enumerable: true,
|
|
4803
|
-
get: function () { return
|
|
4877
|
+
get: function () { return chunkTKJDIRAY_cjs.renderNextTool; }
|
|
4804
4878
|
});
|
|
4805
4879
|
Object.defineProperty(exports, "resolveTokenBySymbol", {
|
|
4806
4880
|
enumerable: true,
|
|
4807
|
-
get: function () { return
|
|
4881
|
+
get: function () { return chunkTKJDIRAY_cjs.resolveTokenBySymbol; }
|
|
4808
4882
|
});
|
|
4809
4883
|
Object.defineProperty(exports, "resolveTokenFromAddress", {
|
|
4810
4884
|
enumerable: true,
|
|
4811
|
-
get: function () { return
|
|
4885
|
+
get: function () { return chunkTKJDIRAY_cjs.resolveTokenFromAddress; }
|
|
4812
4886
|
});
|
|
4813
4887
|
Object.defineProperty(exports, "selectErc7710PaymentOption", {
|
|
4814
4888
|
enumerable: true,
|
|
4815
|
-
get: function () { return
|
|
4889
|
+
get: function () { return chunkTKJDIRAY_cjs.selectErc7710PaymentOption; }
|
|
4816
4890
|
});
|
|
4817
4891
|
Object.defineProperty(exports, "selectPaymentOption", {
|
|
4818
4892
|
enumerable: true,
|
|
4819
|
-
get: function () { return
|
|
4893
|
+
get: function () { return chunkTKJDIRAY_cjs.selectPaymentOption; }
|
|
4820
4894
|
});
|
|
4821
4895
|
Object.defineProperty(exports, "selectStandardPaymentOption", {
|
|
4822
4896
|
enumerable: true,
|
|
4823
|
-
get: function () { return
|
|
4897
|
+
get: function () { return chunkTKJDIRAY_cjs.selectStandardPaymentOption; }
|
|
4824
4898
|
});
|
|
4825
4899
|
Object.defineProperty(exports, "selectX402SettlementScheme", {
|
|
4826
4900
|
enumerable: true,
|
|
4827
|
-
get: function () { return
|
|
4901
|
+
get: function () { return chunkTKJDIRAY_cjs.selectX402SettlementScheme; }
|
|
4828
4902
|
});
|
|
4829
4903
|
Object.defineProperty(exports, "sweepUsdcAddress", {
|
|
4830
4904
|
enumerable: true,
|
|
4831
|
-
get: function () { return
|
|
4905
|
+
get: function () { return chunkTKJDIRAY_cjs.sweepUsdcAddress; }
|
|
4832
4906
|
});
|
|
4833
4907
|
Object.defineProperty(exports, "sweepUsdcDomain", {
|
|
4834
4908
|
enumerable: true,
|
|
4835
|
-
get: function () { return
|
|
4909
|
+
get: function () { return chunkTKJDIRAY_cjs.sweepUsdcDomain; }
|
|
4836
4910
|
});
|
|
4837
4911
|
Object.defineProperty(exports, "toStandardPaymentRequirements", {
|
|
4838
4912
|
enumerable: true,
|
|
4839
|
-
get: function () { return
|
|
4913
|
+
get: function () { return chunkTKJDIRAY_cjs.toStandardPaymentRequirements; }
|
|
4840
4914
|
});
|
|
4841
4915
|
Object.defineProperty(exports, "unsupportedNodeVersionMessage", {
|
|
4842
4916
|
enumerable: true,
|
|
4843
|
-
get: function () { return
|
|
4917
|
+
get: function () { return chunkTKJDIRAY_cjs.unsupportedNodeVersionMessage; }
|
|
4844
4918
|
});
|
|
4845
4919
|
Object.defineProperty(exports, "validateStandardX402PaymentHeader", {
|
|
4846
4920
|
enumerable: true,
|
|
4847
|
-
get: function () { return
|
|
4921
|
+
get: function () { return chunkTKJDIRAY_cjs.validateStandardX402PaymentHeader; }
|
|
4848
4922
|
});
|
|
4849
4923
|
Object.defineProperty(exports, "x402AssetTransferMethod", {
|
|
4850
4924
|
enumerable: true,
|
|
4851
|
-
get: function () { return
|
|
4925
|
+
get: function () { return chunkTKJDIRAY_cjs.x402AssetTransferMethod; }
|
|
4852
4926
|
});
|
|
4853
4927
|
Object.defineProperty(exports, "x402AuthorizationAmount", {
|
|
4854
4928
|
enumerable: true,
|
|
4855
|
-
get: function () { return
|
|
4929
|
+
get: function () { return chunkTKJDIRAY_cjs.x402AuthorizationAmount; }
|
|
4856
4930
|
});
|
|
4857
4931
|
Object.defineProperty(exports, "x402FacilitatorAddresses", {
|
|
4858
4932
|
enumerable: true,
|
|
4859
|
-
get: function () { return
|
|
4933
|
+
get: function () { return chunkTKJDIRAY_cjs.x402FacilitatorAddresses; }
|
|
4860
4934
|
});
|
|
4861
4935
|
Object.defineProperty(exports, "x402V2PaymentEnvelope", {
|
|
4862
4936
|
enumerable: true,
|
|
4863
|
-
get: function () { return
|
|
4937
|
+
get: function () { return chunkTKJDIRAY_cjs.x402V2PaymentEnvelope; }
|
|
4864
4938
|
});
|
|
4865
4939
|
Object.defineProperty(exports, "AGENT_PAYMENT_FAILURE_CODE_VALUES", {
|
|
4866
4940
|
enumerable: true,
|
|
4867
|
-
get: function () { return
|
|
4941
|
+
get: function () { return chunkWQ4UYTPE_cjs.AGENT_PAYMENT_FAILURE_CODE_VALUES; }
|
|
4868
4942
|
});
|
|
4869
4943
|
Object.defineProperty(exports, "AGENT_PAYMENT_NEXT_ACTION_VALUES", {
|
|
4870
4944
|
enumerable: true,
|
|
4871
|
-
get: function () { return
|
|
4945
|
+
get: function () { return chunkWQ4UYTPE_cjs.AGENT_PAYMENT_NEXT_ACTION_VALUES; }
|
|
4872
4946
|
});
|
|
4873
4947
|
Object.defineProperty(exports, "AGENT_PAYMENT_PHASE_VALUES", {
|
|
4874
4948
|
enumerable: true,
|
|
4875
|
-
get: function () { return
|
|
4949
|
+
get: function () { return chunkWQ4UYTPE_cjs.AGENT_PAYMENT_PHASE_VALUES; }
|
|
4876
4950
|
});
|
|
4877
4951
|
Object.defineProperty(exports, "AGENT_PAYMENT_RAIL_VALUES", {
|
|
4878
4952
|
enumerable: true,
|
|
4879
|
-
get: function () { return
|
|
4953
|
+
get: function () { return chunkWQ4UYTPE_cjs.AGENT_PAYMENT_RAIL_VALUES; }
|
|
4880
4954
|
});
|
|
4881
4955
|
Object.defineProperty(exports, "AgentPaymentFailureCode", {
|
|
4882
4956
|
enumerable: true,
|
|
4883
|
-
get: function () { return
|
|
4957
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentFailureCode; }
|
|
4884
4958
|
});
|
|
4885
4959
|
Object.defineProperty(exports, "AgentPaymentFailureCodeDescriptions", {
|
|
4886
4960
|
enumerable: true,
|
|
4887
|
-
get: function () { return
|
|
4961
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentFailureCodeDescriptions; }
|
|
4888
4962
|
});
|
|
4889
4963
|
Object.defineProperty(exports, "AgentPaymentFailureCodeSchema", {
|
|
4890
4964
|
enumerable: true,
|
|
4891
|
-
get: function () { return
|
|
4965
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentFailureCodeSchema; }
|
|
4892
4966
|
});
|
|
4893
4967
|
Object.defineProperty(exports, "AgentPaymentNextAction", {
|
|
4894
4968
|
enumerable: true,
|
|
4895
|
-
get: function () { return
|
|
4969
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentNextAction; }
|
|
4896
4970
|
});
|
|
4897
4971
|
Object.defineProperty(exports, "AgentPaymentNextActionDescriptions", {
|
|
4898
4972
|
enumerable: true,
|
|
4899
|
-
get: function () { return
|
|
4973
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentNextActionDescriptions; }
|
|
4900
4974
|
});
|
|
4901
4975
|
Object.defineProperty(exports, "AgentPaymentNextActionSchema", {
|
|
4902
4976
|
enumerable: true,
|
|
4903
|
-
get: function () { return
|
|
4977
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentNextActionSchema; }
|
|
4904
4978
|
});
|
|
4905
4979
|
Object.defineProperty(exports, "AgentPaymentPhase", {
|
|
4906
4980
|
enumerable: true,
|
|
4907
|
-
get: function () { return
|
|
4981
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentPhase; }
|
|
4908
4982
|
});
|
|
4909
4983
|
Object.defineProperty(exports, "AgentPaymentPhaseDescriptions", {
|
|
4910
4984
|
enumerable: true,
|
|
4911
|
-
get: function () { return
|
|
4985
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentPhaseDescriptions; }
|
|
4912
4986
|
});
|
|
4913
4987
|
Object.defineProperty(exports, "AgentPaymentPhaseSchema", {
|
|
4914
4988
|
enumerable: true,
|
|
4915
|
-
get: function () { return
|
|
4989
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentPhaseSchema; }
|
|
4916
4990
|
});
|
|
4917
4991
|
Object.defineProperty(exports, "AgentPaymentRail", {
|
|
4918
4992
|
enumerable: true,
|
|
4919
|
-
get: function () { return
|
|
4993
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentRail; }
|
|
4920
4994
|
});
|
|
4921
4995
|
Object.defineProperty(exports, "AgentPaymentRailDescriptions", {
|
|
4922
4996
|
enumerable: true,
|
|
4923
|
-
get: function () { return
|
|
4997
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentRailDescriptions; }
|
|
4924
4998
|
});
|
|
4925
4999
|
Object.defineProperty(exports, "AgentPaymentRailSchema", {
|
|
4926
5000
|
enumerable: true,
|
|
4927
|
-
get: function () { return
|
|
5001
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentRailSchema; }
|
|
4928
5002
|
});
|
|
4929
5003
|
Object.defineProperty(exports, "AgentPaymentWarningCode", {
|
|
4930
5004
|
enumerable: true,
|
|
4931
|
-
get: function () { return
|
|
5005
|
+
get: function () { return chunkWQ4UYTPE_cjs.AgentPaymentWarningCode; }
|
|
4932
5006
|
});
|
|
4933
5007
|
Object.defineProperty(exports, "CONNECTOR_PACKAGE_NAME", {
|
|
4934
5008
|
enumerable: true,
|
|
4935
|
-
get: function () { return
|
|
5009
|
+
get: function () { return chunkWQ4UYTPE_cjs.CONNECTOR_PACKAGE_NAME; }
|
|
4936
5010
|
});
|
|
4937
5011
|
Object.defineProperty(exports, "DEFAULT_CONFIRMATION_TIMEOUT_MS", {
|
|
4938
5012
|
enumerable: true,
|
|
4939
|
-
get: function () { return
|
|
5013
|
+
get: function () { return chunkWQ4UYTPE_cjs.DEFAULT_CONFIRMATION_TIMEOUT_MS; }
|
|
4940
5014
|
});
|
|
4941
5015
|
Object.defineProperty(exports, "DIRECT_SIGN_CONTEXT_VERSION", {
|
|
4942
5016
|
enumerable: true,
|
|
4943
|
-
get: function () { return
|
|
5017
|
+
get: function () { return chunkWQ4UYTPE_cjs.DIRECT_SIGN_CONTEXT_VERSION; }
|
|
4944
5018
|
});
|
|
4945
5019
|
Object.defineProperty(exports, "ENTRY_POINT_V07", {
|
|
4946
5020
|
enumerable: true,
|
|
4947
|
-
get: function () { return
|
|
5021
|
+
get: function () { return chunkWQ4UYTPE_cjs.ENTRY_POINT_V07; }
|
|
4948
5022
|
});
|
|
4949
5023
|
Object.defineProperty(exports, "HAVEN_CONNECTOR_CHANNEL", {
|
|
4950
5024
|
enumerable: true,
|
|
4951
|
-
get: function () { return
|
|
5025
|
+
get: function () { return chunkWQ4UYTPE_cjs.HAVEN_CONNECTOR_CHANNEL; }
|
|
4952
5026
|
});
|
|
4953
5027
|
Object.defineProperty(exports, "HYBRID_DELEGATOR_DOMAIN_NAME", {
|
|
4954
5028
|
enumerable: true,
|
|
4955
|
-
get: function () { return
|
|
5029
|
+
get: function () { return chunkWQ4UYTPE_cjs.HYBRID_DELEGATOR_DOMAIN_NAME; }
|
|
4956
5030
|
});
|
|
4957
5031
|
Object.defineProperty(exports, "HYBRID_DELEGATOR_DOMAIN_VERSION", {
|
|
4958
5032
|
enumerable: true,
|
|
4959
|
-
get: function () { return
|
|
5033
|
+
get: function () { return chunkWQ4UYTPE_cjs.HYBRID_DELEGATOR_DOMAIN_VERSION; }
|
|
4960
5034
|
});
|
|
4961
5035
|
Object.defineProperty(exports, "HavenApiError", {
|
|
4962
5036
|
enumerable: true,
|
|
4963
|
-
get: function () { return
|
|
5037
|
+
get: function () { return chunkWQ4UYTPE_cjs.HavenApiError; }
|
|
4964
5038
|
});
|
|
4965
5039
|
Object.defineProperty(exports, "HavenError", {
|
|
4966
5040
|
enumerable: true,
|
|
4967
|
-
get: function () { return
|
|
5041
|
+
get: function () { return chunkWQ4UYTPE_cjs.HavenError; }
|
|
4968
5042
|
});
|
|
4969
5043
|
Object.defineProperty(exports, "HavenPaymentStateError", {
|
|
4970
5044
|
enumerable: true,
|
|
4971
|
-
get: function () { return
|
|
5045
|
+
get: function () { return chunkWQ4UYTPE_cjs.HavenPaymentStateError; }
|
|
4972
5046
|
});
|
|
4973
5047
|
Object.defineProperty(exports, "HavenSigningError", {
|
|
4974
5048
|
enumerable: true,
|
|
4975
|
-
get: function () { return
|
|
5049
|
+
get: function () { return chunkWQ4UYTPE_cjs.HavenSigningError; }
|
|
4976
5050
|
});
|
|
4977
5051
|
Object.defineProperty(exports, "HavenTimeoutError", {
|
|
4978
5052
|
enumerable: true,
|
|
4979
|
-
get: function () { return
|
|
5053
|
+
get: function () { return chunkWQ4UYTPE_cjs.HavenTimeoutError; }
|
|
4980
5054
|
});
|
|
4981
5055
|
Object.defineProperty(exports, "HavenUnsupportedSignerVersionError", {
|
|
4982
5056
|
enumerable: true,
|
|
4983
|
-
get: function () { return
|
|
5057
|
+
get: function () { return chunkWQ4UYTPE_cjs.HavenUnsupportedSignerVersionError; }
|
|
4984
5058
|
});
|
|
4985
5059
|
Object.defineProperty(exports, "HavenUserOpBindingError", {
|
|
4986
5060
|
enumerable: true,
|
|
4987
|
-
get: function () { return
|
|
5061
|
+
get: function () { return chunkWQ4UYTPE_cjs.HavenUserOpBindingError; }
|
|
4988
5062
|
});
|
|
4989
5063
|
Object.defineProperty(exports, "HavenZeroSettlementHashError", {
|
|
4990
5064
|
enumerable: true,
|
|
4991
|
-
get: function () { return
|
|
5065
|
+
get: function () { return chunkWQ4UYTPE_cjs.HavenZeroSettlementHashError; }
|
|
4992
5066
|
});
|
|
4993
5067
|
Object.defineProperty(exports, "MerchantTimeoutError", {
|
|
4994
5068
|
enumerable: true,
|
|
4995
|
-
get: function () { return
|
|
5069
|
+
get: function () { return chunkWQ4UYTPE_cjs.MerchantTimeoutError; }
|
|
4996
5070
|
});
|
|
4997
5071
|
Object.defineProperty(exports, "PACKED_USER_OPERATION_FIELDS", {
|
|
4998
5072
|
enumerable: true,
|
|
4999
|
-
get: function () { return
|
|
5073
|
+
get: function () { return chunkWQ4UYTPE_cjs.PACKED_USER_OPERATION_FIELDS; }
|
|
5000
5074
|
});
|
|
5001
5075
|
Object.defineProperty(exports, "ROOT_AUTHORITY", {
|
|
5002
5076
|
enumerable: true,
|
|
5003
|
-
get: function () { return
|
|
5077
|
+
get: function () { return chunkWQ4UYTPE_cjs.ROOT_AUTHORITY; }
|
|
5004
5078
|
});
|
|
5005
5079
|
Object.defineProperty(exports, "SIGNER_UPDATE_FALLBACK", {
|
|
5006
5080
|
enumerable: true,
|
|
5007
|
-
get: function () { return
|
|
5081
|
+
get: function () { return chunkWQ4UYTPE_cjs.SIGNER_UPDATE_FALLBACK; }
|
|
5008
5082
|
});
|
|
5009
5083
|
Object.defineProperty(exports, "SignerRefusalCode", {
|
|
5010
5084
|
enumerable: true,
|
|
5011
|
-
get: function () { return
|
|
5085
|
+
get: function () { return chunkWQ4UYTPE_cjs.SignerRefusalCode; }
|
|
5012
5086
|
});
|
|
5013
5087
|
Object.defineProperty(exports, "X402AlreadySettledError", {
|
|
5014
5088
|
enumerable: true,
|
|
5015
|
-
get: function () { return
|
|
5089
|
+
get: function () { return chunkWQ4UYTPE_cjs.X402AlreadySettledError; }
|
|
5016
5090
|
});
|
|
5017
5091
|
Object.defineProperty(exports, "X402Erc7710AlreadySettledError", {
|
|
5018
5092
|
enumerable: true,
|
|
5019
|
-
get: function () { return
|
|
5093
|
+
get: function () { return chunkWQ4UYTPE_cjs.X402Erc7710AlreadySettledError; }
|
|
5020
5094
|
});
|
|
5021
5095
|
Object.defineProperty(exports, "X402TaskBudgetMismatchError", {
|
|
5022
5096
|
enumerable: true,
|
|
5023
|
-
get: function () { return
|
|
5097
|
+
get: function () { return chunkWQ4UYTPE_cjs.X402TaskBudgetMismatchError; }
|
|
5024
5098
|
});
|
|
5025
5099
|
Object.defineProperty(exports, "X402UnexpectedStatusError", {
|
|
5026
5100
|
enumerable: true,
|
|
5027
|
-
get: function () { return
|
|
5101
|
+
get: function () { return chunkWQ4UYTPE_cjs.X402UnexpectedStatusError; }
|
|
5028
5102
|
});
|
|
5029
5103
|
Object.defineProperty(exports, "assertUserOpTypedDataBinding", {
|
|
5030
5104
|
enumerable: true,
|
|
5031
|
-
get: function () { return
|
|
5105
|
+
get: function () { return chunkWQ4UYTPE_cjs.assertUserOpTypedDataBinding; }
|
|
5032
5106
|
});
|
|
5033
5107
|
Object.defineProperty(exports, "connectorRerunCommand", {
|
|
5034
5108
|
enumerable: true,
|
|
5035
|
-
get: function () { return
|
|
5109
|
+
get: function () { return chunkWQ4UYTPE_cjs.connectorRerunCommand; }
|
|
5036
5110
|
});
|
|
5037
5111
|
Object.defineProperty(exports, "connectorSpec", {
|
|
5038
5112
|
enumerable: true,
|
|
5039
|
-
get: function () { return
|
|
5113
|
+
get: function () { return chunkWQ4UYTPE_cjs.connectorSpec; }
|
|
5040
5114
|
});
|
|
5041
5115
|
Object.defineProperty(exports, "connectorUpgradeCommand", {
|
|
5042
5116
|
enumerable: true,
|
|
5043
|
-
get: function () { return
|
|
5117
|
+
get: function () { return chunkWQ4UYTPE_cjs.connectorUpgradeCommand; }
|
|
5044
5118
|
});
|
|
5045
5119
|
Object.defineProperty(exports, "deriveDelegateAccountAddress", {
|
|
5046
5120
|
enumerable: true,
|
|
5047
|
-
get: function () { return
|
|
5121
|
+
get: function () { return chunkWQ4UYTPE_cjs.deriveDelegateAccountAddress; }
|
|
5048
5122
|
});
|
|
5049
5123
|
Object.defineProperty(exports, "isConnectorChannel", {
|
|
5050
5124
|
enumerable: true,
|
|
5051
|
-
get: function () { return
|
|
5125
|
+
get: function () { return chunkWQ4UYTPE_cjs.isConnectorChannel; }
|
|
5052
5126
|
});
|
|
5053
5127
|
Object.defineProperty(exports, "isPackedUserOperationTypedData", {
|
|
5054
5128
|
enumerable: true,
|
|
5055
|
-
get: function () { return
|
|
5129
|
+
get: function () { return chunkWQ4UYTPE_cjs.isPackedUserOperationTypedData; }
|
|
5056
5130
|
});
|
|
5057
5131
|
Object.defineProperty(exports, "packedUserOperationHash", {
|
|
5058
5132
|
enumerable: true,
|
|
5059
|
-
get: function () { return
|
|
5133
|
+
get: function () { return chunkWQ4UYTPE_cjs.packedUserOperationHash; }
|
|
5060
5134
|
});
|
|
5061
5135
|
Object.defineProperty(exports, "resolveConnectorChannel", {
|
|
5062
5136
|
enumerable: true,
|
|
5063
|
-
get: function () { return
|
|
5137
|
+
get: function () { return chunkWQ4UYTPE_cjs.resolveConnectorChannel; }
|
|
5064
5138
|
});
|
|
5065
5139
|
Object.defineProperty(exports, "signerUpdateFallback", {
|
|
5066
5140
|
enumerable: true,
|
|
5067
|
-
get: function () { return
|
|
5141
|
+
get: function () { return chunkWQ4UYTPE_cjs.signerUpdateFallback; }
|
|
5068
5142
|
});
|
|
5069
5143
|
Object.defineProperty(exports, "verifySettlementChild", {
|
|
5070
5144
|
enumerable: true,
|
|
5071
|
-
get: function () { return
|
|
5145
|
+
get: function () { return chunkWQ4UYTPE_cjs.verifySettlementChild; }
|
|
5072
5146
|
});
|
|
5073
5147
|
exports.AGENT_APPROVAL_RELAY_JSON_SENTENCE = AGENT_APPROVAL_RELAY_JSON_SENTENCE;
|
|
5074
5148
|
exports.AGENT_APPROVAL_RELAY_PROSE_SENTENCE = AGENT_APPROVAL_RELAY_PROSE_SENTENCE;
|