@haven_ai/sdk 0.0.0-dev.202609291912.efd0772 → 0.0.0-dev.202609291949.4e52d4b

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/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkMJ2IMB5H_cjs = require('./chunk-MJ2IMB5H.cjs');
3
+ var chunkJ6SS36ZD_cjs = require('./chunk-J6SS36ZD.cjs');
4
4
  var chunkSZHKBOCZ_cjs = require('./chunk-SZHKBOCZ.cjs');
5
5
  var viem = require('viem');
6
6
  var ethers = require('ethers');
@@ -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 = chunkMJ2IMB5H_cjs.HAVEN_CLIENT_HEADER.toLowerCase();
64
+ const target = chunkJ6SS36ZD_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 ?? chunkMJ2IMB5H_cjs.SDK_CLIENT_IDENTITY;
80
+ this.clientIdentity = config.clientIdentity ?? chunkJ6SS36ZD_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 = chunkMJ2IMB5H_cjs.readClientUpdate(data.client_update);
93
+ const hint = chunkJ6SS36ZD_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
- [chunkMJ2IMB5H_cjs.HAVEN_CLIENT_HEADER]: this.clientIdentity
126
+ [chunkJ6SS36ZD_cjs.HAVEN_CLIENT_HEADER]: this.clientIdentity
127
127
  },
128
128
  body: body ? JSON.stringify(body) : void 0,
129
129
  signal: controller.signal
@@ -154,6 +154,62 @@ var HavenApiTransport = class {
154
154
  }
155
155
  };
156
156
 
157
+ // src/client-tax-declaration.ts
158
+ async function fetchUnsignedTaxDeclaration(client) {
159
+ const agent = await client.getAgent();
160
+ const body = await client.get(
161
+ `/agents/${agent.id}/tax-declaration`
162
+ );
163
+ if (body && body.available === true && body.declaration && typeof body.declaration === "object") {
164
+ return { available: true, declaration: body.declaration };
165
+ }
166
+ const reason = body && typeof body.reason === "string" ? body.reason : void 0;
167
+ if (reason === "feature_disabled" || reason === "disabled" || reason === "no_company_details" || reason === "vies_not_valid") {
168
+ return { available: false, reason };
169
+ }
170
+ throw new chunkSZHKBOCZ_cjs.HavenApiError(
171
+ "The tax-declaration endpoint answered a body that is neither the \xA72.1 content nor a named unavailability reason.",
172
+ 502
173
+ );
174
+ }
175
+ async function resolveTaxDeclarationHeader(client, input) {
176
+ if (chunkJ6SS36ZD_cjs.isErc7710Option(input.accepted)) {
177
+ return { header: void 0 };
178
+ }
179
+ let content;
180
+ try {
181
+ content = await fetchUnsignedTaxDeclaration(client);
182
+ } catch {
183
+ return { header: void 0 };
184
+ }
185
+ if (!content.available) {
186
+ return { header: void 0 };
187
+ }
188
+ const signed = chunkJ6SS36ZD_cjs.buildSignedTaxDeclaration({
189
+ content: content.declaration,
190
+ network: input.accepted.network,
191
+ delegateKey: input.delegateKey
192
+ });
193
+ process.stderr.write(
194
+ `[haven-sdk] signing x402 tax declaration taxId=${JSON.stringify(content.declaration.taxId)} jurisdiction=${JSON.stringify(content.declaration.jurisdiction)} principalId=${signed.declaration.principalId}
195
+ `
196
+ );
197
+ return { header: chunkJ6SS36ZD_cjs.encodeTaxDeclarationHeader(signed) };
198
+ }
199
+ function withTaxDeclarationHeader(init, header) {
200
+ if (!header) {
201
+ if (init?.headers && new Headers(init.headers).has(chunkJ6SS36ZD_cjs.X_TAX_DECLARATION_HEADER)) {
202
+ const headers2 = new Headers(init.headers);
203
+ headers2.delete(chunkJ6SS36ZD_cjs.X_TAX_DECLARATION_HEADER);
204
+ return { ...init, headers: headers2 };
205
+ }
206
+ return init ?? {};
207
+ }
208
+ const headers = new Headers(init?.headers);
209
+ headers.set(chunkJ6SS36ZD_cjs.X_TAX_DECLARATION_HEADER, header);
210
+ return { ...init, headers };
211
+ }
212
+
157
213
  // src/payment-mappers.ts
158
214
  function mapParties(raw) {
159
215
  if (!raw) return void 0;
@@ -626,8 +682,8 @@ var McpMerchantTransport = class {
626
682
  async deliverPayment(url, init, paymentHeader) {
627
683
  assertSecureX402RetryTarget(url);
628
684
  const headers = new Headers(init?.headers);
629
- const send = chunkMJ2IMB5H_cjs.x402PaymentHeaderNamesFor(paymentHeader);
630
- for (const name of chunkMJ2IMB5H_cjs.X402_PAYMENT_HEADER_NAMES) {
685
+ const send = chunkJ6SS36ZD_cjs.x402PaymentHeaderNamesFor(paymentHeader);
686
+ for (const name of chunkJ6SS36ZD_cjs.X402_PAYMENT_HEADER_NAMES) {
631
687
  if (send.includes(name)) headers.set(name, paymentHeader);
632
688
  else headers.delete(name);
633
689
  }
@@ -714,7 +770,7 @@ function mcpToolResultOf(value) {
714
770
  function extractMcpPaymentRequired(toolResult) {
715
771
  if (toolResult.isError !== true) return void 0;
716
772
  if (isRecord(toolResult.structuredContent)) {
717
- const parsed = chunkMJ2IMB5H_cjs.normalizePaymentRequired(toolResult.structuredContent);
773
+ const parsed = chunkJ6SS36ZD_cjs.normalizePaymentRequired(toolResult.structuredContent);
718
774
  if (parsed) return parsed;
719
775
  }
720
776
  if (Array.isArray(toolResult.content)) {
@@ -726,7 +782,7 @@ function extractMcpPaymentRequired(toolResult) {
726
782
  } catch {
727
783
  continue;
728
784
  }
729
- const parsed = chunkMJ2IMB5H_cjs.normalizePaymentRequired(candidate);
785
+ const parsed = chunkJ6SS36ZD_cjs.normalizePaymentRequired(candidate);
730
786
  if (parsed) return parsed;
731
787
  }
732
788
  }
@@ -750,7 +806,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
750
806
  if (!request) return init;
751
807
  let envelope;
752
808
  try {
753
- envelope = chunkMJ2IMB5H_cjs.decodeBase64Json(paymentHeader);
809
+ envelope = chunkJ6SS36ZD_cjs.decodeBase64Json(paymentHeader);
754
810
  } catch {
755
811
  return init;
756
812
  }
@@ -766,7 +822,7 @@ function withMcpPaymentMeta(init, paymentHeader) {
766
822
  };
767
823
  }
768
824
  function encodeMcpSettlementReceipt(settlement) {
769
- return chunkMJ2IMB5H_cjs.encodeBase64Json(settlement);
825
+ return chunkJ6SS36ZD_cjs.encodeBase64Json(settlement);
770
826
  }
771
827
  function parseJsonRpcToolsCall(body) {
772
828
  if (typeof body !== "string") return void 0;
@@ -961,7 +1017,7 @@ function deriveReadiness(status, allowances) {
961
1017
  return allowances.some((allowance) => safeBigInt(allowance.remainingAtomic) > 0n) ? "ready" : "needs_approval";
962
1018
  }
963
1019
  function formatRemainingDisplay(tokenAddress, tokenSymbol, remainingAtomic) {
964
- const token = chunkMJ2IMB5H_cjs.resolveTokenFromAddress(tokenAddress);
1020
+ const token = chunkJ6SS36ZD_cjs.resolveTokenFromAddress(tokenAddress);
965
1021
  return token ? `${formatAtomicAmount(safeBigInt(remainingAtomic), token.decimals)} ${tokenSymbol}` : `${remainingAtomic} ${tokenSymbol} (atomic; unknown decimals)`;
966
1022
  }
967
1023
  function formatTokenAmount(atomic, decimals) {
@@ -993,7 +1049,7 @@ function mapTaskBudget(raw) {
993
1049
  };
994
1050
  }
995
1051
  function summarizeTaskBudget(taskBudget) {
996
- const token = chunkMJ2IMB5H_cjs.resolveTokenFromAddress(taskBudget.tokenAddress);
1052
+ const token = chunkJ6SS36ZD_cjs.resolveTokenFromAddress(taskBudget.tokenAddress);
997
1053
  const maxDisplay = token ? `${formatAtomicAmount(safeBigInt(taskBudget.maxAtomic), token.decimals)} ${token.symbol}` : `${taskBudget.maxAtomic} (atomic; unknown decimals)`;
998
1054
  return {
999
1055
  id: taskBudget.id,
@@ -1279,8 +1335,8 @@ var DelegateSweepApi = class {
1279
1335
  const provider = createJsonRpcProvider(rpcUrl);
1280
1336
  const wallet = createWallet(this.options.delegateKey, provider);
1281
1337
  const transfers = [];
1282
- if (chunkMJ2IMB5H_cjs.isSweepableChain(agent.chainId)) {
1283
- const contract = createErc20Contract(chunkMJ2IMB5H_cjs.sweepUsdcAddress(agent.chainId), ["function balanceOf(address) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)"], wallet);
1338
+ if (chunkJ6SS36ZD_cjs.isSweepableChain(agent.chainId)) {
1339
+ const contract = createErc20Contract(chunkJ6SS36ZD_cjs.sweepUsdcAddress(agent.chainId), ["function balanceOf(address) view returns (uint256)", "function transfer(address to, uint256 amount) returns (bool)"], wallet);
1284
1340
  const balance2 = await contract.balanceOf(agent.delegateAddress);
1285
1341
  if (balance2 > 0n) {
1286
1342
  const tx = await contract.transfer(agent.accountAddress, balance2);
@@ -1389,9 +1445,9 @@ function requestInitFromSnapshot(request) {
1389
1445
  };
1390
1446
  }
1391
1447
  function noCompatiblePaymentOptionError(accepts) {
1392
- const erc7710Only = chunkMJ2IMB5H_cjs.selectErc7710PaymentOption(accepts) !== null;
1448
+ const erc7710Only = chunkJ6SS36ZD_cjs.selectErc7710PaymentOption(accepts) !== null;
1393
1449
  const unsupportedOnly = !erc7710Only && accepts.some(
1394
- (opt) => opt !== null && typeof opt === "object" && !chunkMJ2IMB5H_cjs.isErc7710Option(opt) && (chunkMJ2IMB5H_cjs.x402AssetTransferMethod(opt) !== null || opt.extra?.paymentFlow !== void 0)
1450
+ (opt) => opt !== null && typeof opt === "object" && !chunkJ6SS36ZD_cjs.isErc7710Option(opt) && (chunkJ6SS36ZD_cjs.x402AssetTransferMethod(opt) !== null || opt.extra?.paymentFlow !== void 0)
1395
1451
  );
1396
1452
  return new chunkSZHKBOCZ_cjs.HavenApiError(
1397
1453
  "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." : ""),
@@ -1399,15 +1455,15 @@ function noCompatiblePaymentOptionError(accepts) {
1399
1455
  );
1400
1456
  }
1401
1457
  function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport) {
1402
- const standard = chunkMJ2IMB5H_cjs.selectStandardPaymentOption(paymentRequired.accepts);
1403
- const option = standard ?? chunkMJ2IMB5H_cjs.selectErc7710PaymentOption(paymentRequired.accepts);
1458
+ const standard = chunkJ6SS36ZD_cjs.selectStandardPaymentOption(paymentRequired.accepts);
1459
+ const option = standard ?? chunkJ6SS36ZD_cjs.selectErc7710PaymentOption(paymentRequired.accepts);
1404
1460
  if (!option) {
1405
1461
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
1406
1462
  }
1407
- const token = chunkMJ2IMB5H_cjs.resolveTokenFromAddress(option.asset, option.network);
1463
+ const token = chunkJ6SS36ZD_cjs.resolveTokenFromAddress(option.asset, option.network);
1408
1464
  return {
1409
1465
  rail: "x402",
1410
- idempotencyKey: idempotencyKey ?? chunkMJ2IMB5H_cjs.buildX402IdempotencyKey(paymentRequired, option),
1466
+ idempotencyKey: idempotencyKey ?? chunkJ6SS36ZD_cjs.buildX402IdempotencyKey(paymentRequired, option),
1411
1467
  paymentRequired,
1412
1468
  accepted: option,
1413
1469
  acceptedScheme: standard ? "standard" : "erc7710",
@@ -1421,8 +1477,8 @@ function buildX402Quote(paymentRequired, request, idempotencyKey, mcpTransport)
1421
1477
  resourceUrlDiffersFromRequest: paymentRequired.resource.url !== request.url,
1422
1478
  description: paymentRequired.resource.description ?? option.description ?? null,
1423
1479
  mimeType: paymentRequired.resource.mimeType ?? option.mimeType ?? null,
1424
- amountAtomic: chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option),
1425
- amount: decimalFromUsdcAtomic(chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option)),
1480
+ amountAtomic: chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option),
1481
+ amount: decimalFromUsdcAtomic(chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option)),
1426
1482
  token: token?.symbol ?? "USDC",
1427
1483
  // #1351: null when the asset is unrecognised on this network — the
1428
1484
  // `token` fallback above is a LABEL, not evidence of 6 decimals, and a
@@ -1461,7 +1517,7 @@ function buildX402Receipt(input) {
1461
1517
  payTo: input.merchantTo ?? input.accepted.payTo
1462
1518
  },
1463
1519
  x402: {
1464
- amount: chunkMJ2IMB5H_cjs.x402AuthorizationAmount(input.accepted),
1520
+ amount: chunkJ6SS36ZD_cjs.x402AuthorizationAmount(input.accepted),
1465
1521
  token: input.token,
1466
1522
  network: input.accepted.network,
1467
1523
  asset: input.accepted.asset,
@@ -1470,7 +1526,7 @@ function buildX402Receipt(input) {
1470
1526
  };
1471
1527
  }
1472
1528
  function buildX402ResumeState(input) {
1473
- const token = chunkMJ2IMB5H_cjs.resolveTokenFromAddress(input.accepted.asset, input.accepted.network);
1529
+ const token = chunkJ6SS36ZD_cjs.resolveTokenFromAddress(input.accepted.asset, input.accepted.network);
1474
1530
  return {
1475
1531
  rail: "x402",
1476
1532
  paymentId: input.paymentId,
@@ -1481,8 +1537,8 @@ function buildX402ResumeState(input) {
1481
1537
  request: input.request,
1482
1538
  resourceUrl: input.paymentRequired.resource.url,
1483
1539
  description: input.paymentRequired.resource.description ?? input.accepted.description ?? null,
1484
- amountAtomic: chunkMJ2IMB5H_cjs.x402AuthorizationAmount(input.accepted),
1485
- amount: decimalFromUsdcAtomic(chunkMJ2IMB5H_cjs.x402AuthorizationAmount(input.accepted)),
1540
+ amountAtomic: chunkJ6SS36ZD_cjs.x402AuthorizationAmount(input.accepted),
1541
+ amount: decimalFromUsdcAtomic(chunkJ6SS36ZD_cjs.x402AuthorizationAmount(input.accepted)),
1486
1542
  token: token?.symbol ?? "USDC",
1487
1543
  asset: input.accepted.asset,
1488
1544
  network: input.accepted.network,
@@ -1563,7 +1619,7 @@ function assertCanResumeX402(status, paymentRequired, option) {
1563
1619
  );
1564
1620
  }
1565
1621
  const approvedAmount = status.amount ? normalizeDecimal(status.amount) : "";
1566
- const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option)));
1622
+ const requestedAmount = normalizeDecimal(decimalFromUsdcAtomic(chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option)));
1567
1623
  if (approvedAmount && approvedAmount !== requestedAmount) {
1568
1624
  throw new chunkSZHKBOCZ_cjs.HavenApiError(
1569
1625
  "x402 resume request does not match the approved amount.",
@@ -1642,7 +1698,7 @@ var X402FundingLeg = class {
1642
1698
  url: paymentRequired.resource.url,
1643
1699
  payTo: this.delegateAddress,
1644
1700
  merchantPayTo: option.payTo,
1645
- amount: chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option),
1701
+ amount: chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option),
1646
1702
  asset: option.asset,
1647
1703
  network: option.network,
1648
1704
  description: paymentRequired.resource.description,
@@ -1666,7 +1722,7 @@ var X402FundingLeg = class {
1666
1722
  const canFund = await this.delegateCanFund(
1667
1723
  raw.chain_id ?? state?.chainId ?? chainIdFromNetwork(option.network),
1668
1724
  option.asset,
1669
- chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option)
1725
+ chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option)
1670
1726
  );
1671
1727
  const refuse = executedReplay === "idempotency-collision" ? canFund !== true : canFund === false;
1672
1728
  if (refuse) {
@@ -1695,7 +1751,7 @@ var X402FundingLeg = class {
1695
1751
  }
1696
1752
  const sig = await this.signForData(raw.sign_data, {
1697
1753
  asset: option.asset,
1698
- amount: chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option)
1754
+ amount: chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option)
1699
1755
  });
1700
1756
  const execResult = await this.post(
1701
1757
  `/payments/${raw.payment_id}/sign`,
@@ -1718,22 +1774,22 @@ var X402FundingLeg = class {
1718
1774
  throw new chunkSZHKBOCZ_cjs.HavenSigningError("delegateKey is required to sign x402 payment headers.");
1719
1775
  }
1720
1776
  const account = accounts.privateKeyToAccount(this.delegateKey);
1721
- const requirements = chunkMJ2IMB5H_cjs.toStandardPaymentRequirements(paymentRequired, option);
1777
+ const requirements = chunkJ6SS36ZD_cjs.toStandardPaymentRequirements(paymentRequired, option);
1722
1778
  const header = await schemes.exact.evm.createPaymentHeader(
1723
1779
  account,
1724
1780
  paymentRequired.x402Version,
1725
1781
  requirements
1726
1782
  );
1727
1783
  if (paymentRequired.x402Version < 2) return header;
1728
- const payment = chunkMJ2IMB5H_cjs.decodeBase64Json(header);
1729
- return chunkMJ2IMB5H_cjs.encodeBase64Json(chunkMJ2IMB5H_cjs.x402V2PaymentEnvelope(paymentRequired, option, payment.payload));
1784
+ const payment = chunkJ6SS36ZD_cjs.decodeBase64Json(header);
1785
+ return chunkJ6SS36ZD_cjs.encodeBase64Json(chunkJ6SS36ZD_cjs.x402V2PaymentEnvelope(paymentRequired, option, payment.payload));
1730
1786
  }
1731
1787
  // ── Receipt mapping ──────────────────────────────────────────────
1732
1788
  receiptFromAuthorization(paymentRequired, option, paymentHeader, raw, execResult) {
1733
1789
  const txHash = execResult?.tx_hash ?? raw.tx_hash ?? "";
1734
1790
  const chainId = execResult?.chain_id ?? raw.chain_id ?? chainIdFromNetwork(option.network);
1735
1791
  const token = execResult?.token ?? raw.token ?? "USDC";
1736
- const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option));
1792
+ const amount = execResult?.amount ?? raw.amount ?? decimalFromUsdcAtomic(chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option));
1737
1793
  const to = execResult?.to ?? raw.to ?? this.delegateAddress ?? "";
1738
1794
  const explorerUrl = execResult?.explorer_url ?? raw.explorer_url ?? explorerUrlOrEmpty(chainId, txHash);
1739
1795
  const merchantTo = execResult?.merchant_to ?? raw.merchant_to ?? option.payTo;
@@ -1766,7 +1822,7 @@ var X402FundingLeg = class {
1766
1822
  paymentId: status.paymentId,
1767
1823
  txHash: status.txHash,
1768
1824
  token: status.token || "USDC",
1769
- amount: status.amount || decimalFromUsdcAtomic(chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option)),
1825
+ amount: status.amount || decimalFromUsdcAtomic(chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option)),
1770
1826
  to: this.delegateAddress ?? "",
1771
1827
  resourceUrl: paymentRequired.resource.url,
1772
1828
  explorerUrl: explorerUrlOrEmpty(status.chainId, status.txHash),
@@ -1843,7 +1899,7 @@ var X402FundingLeg = class {
1843
1899
  };
1844
1900
  function getPaymentHeaderValidBefore(paymentHeader) {
1845
1901
  try {
1846
- const payment = chunkMJ2IMB5H_cjs.decodeBase64Json(
1902
+ const payment = chunkJ6SS36ZD_cjs.decodeBase64Json(
1847
1903
  paymentHeader
1848
1904
  );
1849
1905
  const payload = payment.payload;
@@ -1928,7 +1984,7 @@ var X402Erc7710 = class {
1928
1984
  400
1929
1985
  );
1930
1986
  }
1931
- const selection = chunkMJ2IMB5H_cjs.selectX402SettlementScheme(paymentRequired.accepts, { delegationRail });
1987
+ const selection = chunkJ6SS36ZD_cjs.selectX402SettlementScheme(paymentRequired.accepts, { delegationRail });
1932
1988
  if (!selection || selection.scheme !== "erc7710") {
1933
1989
  throw new chunkSZHKBOCZ_cjs.HavenApiError(
1934
1990
  "This merchant does not advertise an erc7710 settlement option (no accepts[] entry carries extra.assetTransferMethod: 'erc7710'). Use authorizeX402() for the standard EIP-3009 path.",
@@ -1937,7 +1993,7 @@ var X402Erc7710 = class {
1937
1993
  }
1938
1994
  const option = selection.option;
1939
1995
  const merchantPayTo = option.payTo;
1940
- const amountAtomic = chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option);
1996
+ const amountAtomic = chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option);
1941
1997
  const raw = await this.post("/x402", {
1942
1998
  url: options.resourceUrl ?? paymentRequired.resource?.url,
1943
1999
  // #2373: the full 402 challenge, persisted verbatim by the backend
@@ -2173,6 +2229,8 @@ var MerchantCompletion = class {
2173
2229
  getAgent;
2174
2230
  delegateAddress;
2175
2231
  x402Wallet;
2232
+ getTaxDeclarationHeader;
2233
+ delegateKey;
2176
2234
  sleep;
2177
2235
  constructor(options) {
2178
2236
  this.sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
@@ -2182,6 +2240,8 @@ var MerchantCompletion = class {
2182
2240
  this.getAgent = options.getAgent;
2183
2241
  this.delegateAddress = options.delegateAddress;
2184
2242
  this.x402Wallet = options.x402Wallet;
2243
+ this.getTaxDeclarationHeader = options.getTaxDeclarationHeader;
2244
+ this.delegateKey = options.delegateKey;
2185
2245
  }
2186
2246
  async retryRequest(url, initialInit, paymentRequired, receipt) {
2187
2247
  if (!receipt.accepted) {
@@ -2190,9 +2250,23 @@ var MerchantCompletion = class {
2190
2250
  if (!receipt.paymentHeader) {
2191
2251
  throw new chunkSZHKBOCZ_cjs.HavenApiError("No x402 payment header was returned for payment retry", 500);
2192
2252
  }
2253
+ let retryInit = initialInit;
2254
+ if (this.getTaxDeclarationHeader && this.delegateKey) {
2255
+ const scheme = chunkJ6SS36ZD_cjs.x402PaymentHeaderNamesFor(receipt.paymentHeader);
2256
+ const isEip3009 = scheme.length > 1;
2257
+ if (isEip3009) {
2258
+ const resolved = await this.getTaxDeclarationHeader({
2259
+ accepted: receipt.accepted,
2260
+ delegateKey: this.delegateKey
2261
+ });
2262
+ retryInit = withTaxDeclarationHeader(initialInit, resolved.header);
2263
+ } else {
2264
+ retryInit = withTaxDeclarationHeader(initialInit, void 0);
2265
+ }
2266
+ }
2193
2267
  const retryResponse = await this.merchantTransport.deliverPaymentRecoveringSession(
2194
2268
  url,
2195
- initialInit,
2269
+ retryInit,
2196
2270
  receipt.paymentHeader,
2197
2271
  () => this.merchantTransport.initialize(url, initialInit)
2198
2272
  );
@@ -2246,7 +2320,7 @@ var MerchantCompletion = class {
2246
2320
  merchantStatus: retryResponse.status,
2247
2321
  challengePayload: paymentRequired,
2248
2322
  selectedPayment: receipt.accepted,
2249
- paymentProofHeaderName: chunkMJ2IMB5H_cjs.x402PaymentHeaderNamesSent(receipt.paymentHeader),
2323
+ paymentProofHeaderName: chunkJ6SS36ZD_cjs.x402PaymentHeaderNamesSent(receipt.paymentHeader),
2250
2324
  paymentProofHeader: receipt.paymentHeader,
2251
2325
  protocolReceiptHeaderName,
2252
2326
  protocolReceiptHeader
@@ -2545,7 +2619,7 @@ function parseMerchantSettlement(header) {
2545
2619
  }
2546
2620
  function parseProtocolReceiptHeader(value) {
2547
2621
  try {
2548
- return chunkMJ2IMB5H_cjs.decodeBase64Json(value);
2622
+ return chunkJ6SS36ZD_cjs.decodeBase64Json(value);
2549
2623
  } catch {
2550
2624
  try {
2551
2625
  return JSON.parse(value);
@@ -2674,7 +2748,19 @@ var HavenClient = class {
2674
2748
  getPaymentStatus: (paymentId) => this.getPaymentStatus(paymentId),
2675
2749
  getAgent: () => this.getAgent(),
2676
2750
  delegateAddress: this.delegateAddress,
2677
- x402Wallet: this.x402Wallet
2751
+ x402Wallet: this.x402Wallet,
2752
+ // #3427: the buyer-side tax declaration is resolved (and signed) only
2753
+ // by the local, key-holding client. The resolver is bound ONLY when a
2754
+ // delegate key exists, so the hosted, keyless construction of this
2755
+ // class — `completeX402MerchantCall`'s `MerchantCompletion` — cannot
2756
+ // resolve a declaration at all, let alone sign one.
2757
+ ...config.delegateKey ? {
2758
+ getTaxDeclarationHeader: (input) => resolveTaxDeclarationHeader(
2759
+ { getAgent: () => this.getAgent(), get: (path) => this.get(path) },
2760
+ input
2761
+ ),
2762
+ delegateKey: config.delegateKey
2763
+ } : {}
2678
2764
  });
2679
2765
  this.erc7710 = new X402Erc7710({
2680
2766
  delegateKey: this.delegateKey,
@@ -2775,7 +2861,7 @@ var HavenClient = class {
2775
2861
  * on-chain allowance — there is nothing to sign until the user approves.
2776
2862
  */
2777
2863
  async createX402Intent(paymentRequired, options = {}) {
2778
- const option = chunkMJ2IMB5H_cjs.selectStandardPaymentOption(paymentRequired.accepts);
2864
+ const option = chunkJ6SS36ZD_cjs.selectStandardPaymentOption(paymentRequired.accepts);
2779
2865
  if (!option) {
2780
2866
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
2781
2867
  }
@@ -2783,7 +2869,7 @@ var HavenClient = class {
2783
2869
  if (!fundingTo) {
2784
2870
  throw new chunkSZHKBOCZ_cjs.HavenApiError("Authenticated agent has no delegate address registered.", 502);
2785
2871
  }
2786
- const idempotencyKey = options.idempotencyKey ?? chunkMJ2IMB5H_cjs.buildX402IdempotencyKey(paymentRequired, option);
2872
+ const idempotencyKey = options.idempotencyKey ?? chunkJ6SS36ZD_cjs.buildX402IdempotencyKey(paymentRequired, option);
2787
2873
  const raw = await this.post("/x402", {
2788
2874
  url: paymentRequired.resource.url,
2789
2875
  payTo: fundingTo,
@@ -2794,7 +2880,7 @@ var HavenClient = class {
2794
2880
  // of a silent reroute to the erc7710 settlement branch (the #1358
2795
2881
  // review's open-budget misroute). Legacy-rail backends ignore the field.
2796
2882
  settlementScheme: "eip3009",
2797
- amount: chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option),
2883
+ amount: chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option),
2798
2884
  asset: option.asset,
2799
2885
  network: option.network,
2800
2886
  description: paymentRequired.resource.description,
@@ -2838,7 +2924,7 @@ var HavenClient = class {
2838
2924
  accepted: option,
2839
2925
  resourceUrl: paymentRequired.resource.url,
2840
2926
  merchantTo: raw.merchant_to ?? option.payTo,
2841
- amountAtomic: chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option),
2927
+ amountAtomic: chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option),
2842
2928
  asset: option.asset,
2843
2929
  network: option.network,
2844
2930
  expectedAuth: raw.x402_expected_auth,
@@ -2904,12 +2990,12 @@ var HavenClient = class {
2904
2990
  );
2905
2991
  }
2906
2992
  chunkSZHKBOCZ_cjs.assertUserOpTypedDataBinding(signData.typed_data, signData.hash);
2907
- chunkMJ2IMB5H_cjs.assertBoundDirectPaymentUserOp(
2993
+ chunkJ6SS36ZD_cjs.assertBoundDirectPaymentUserOp(
2908
2994
  signData.typed_data,
2909
2995
  this.delegateAddress
2910
2996
  );
2911
2997
  if (fundingExpectation) {
2912
- chunkMJ2IMB5H_cjs.assertFundingLegPaysDelegate(signData.typed_data, {
2998
+ chunkJ6SS36ZD_cjs.assertFundingLegPaysDelegate(signData.typed_data, {
2913
2999
  delegateAddress: this.delegateAddress,
2914
3000
  asset: fundingExpectation.asset,
2915
3001
  amount: fundingExpectation.amount
@@ -2924,11 +3010,11 @@ var HavenClient = class {
2924
3010
  );
2925
3011
  }
2926
3012
  if (!settlementExpectation) {
2927
- throw new chunkMJ2IMB5H_cjs.HavenTypedDataRefusedError(
3013
+ throw new chunkJ6SS36ZD_cjs.HavenTypedDataRefusedError(
2928
3014
  "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."
2929
3015
  );
2930
3016
  }
2931
- chunkMJ2IMB5H_cjs.assertOwnSettlementChild(signData.typed_data, settlementExpectation, this.delegateAddress);
3017
+ chunkJ6SS36ZD_cjs.assertOwnSettlementChild(signData.typed_data, settlementExpectation, this.delegateAddress);
2932
3018
  return signSettlementDelegationTypedData(this.delegateKey, signData.typed_data);
2933
3019
  }
2934
3020
  if (scheme === void 0) {
@@ -3344,11 +3430,11 @@ var HavenClient = class {
3344
3430
  if (!this.delegateAddress) {
3345
3431
  throw new chunkSZHKBOCZ_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
3346
3432
  }
3347
- const option = chunkMJ2IMB5H_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3433
+ const option = chunkJ6SS36ZD_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3348
3434
  if (!option) {
3349
3435
  throw noCompatiblePaymentOptionError(paymentRequired.accepts);
3350
3436
  }
3351
- const idempotencyKey = options.idempotencyKey ?? chunkMJ2IMB5H_cjs.buildX402IdempotencyKey(paymentRequired, option);
3437
+ const idempotencyKey = options.idempotencyKey ?? chunkJ6SS36ZD_cjs.buildX402IdempotencyKey(paymentRequired, option);
3352
3438
  const cached = this.fundingLeg.cachedReceipt(idempotencyKey, options.taskBudgetId, options.subBudgetId);
3353
3439
  if (cached) return cached;
3354
3440
  const inFlight = this.inFlightX402.get(idempotencyKey);
@@ -3417,7 +3503,7 @@ var HavenClient = class {
3417
3503
  if (response.headers.get("MACHINE-PAYMENT-CHALLENGE")) {
3418
3504
  throw new chunkSZHKBOCZ_cjs.HavenApiError("quoteX402 only supports standard x402 Payment Required responses.", 400);
3419
3505
  }
3420
- const paymentRequired = await chunkMJ2IMB5H_cjs.parsePaymentRequiredResponse(response);
3506
+ const paymentRequired = await chunkJ6SS36ZD_cjs.parsePaymentRequiredResponse(response);
3421
3507
  const mcpTransport = await this.merchantTransport.detect(url, paymentRequired, response);
3422
3508
  return buildX402Quote(paymentRequired, request, options.idempotencyKey, mcpTransport);
3423
3509
  }
@@ -3516,11 +3602,11 @@ var HavenClient = class {
3516
3602
  if (!this.delegateAddress) {
3517
3603
  throw new chunkSZHKBOCZ_cjs.HavenSigningError("delegateAddress could not be derived from delegateKey.");
3518
3604
  }
3519
- const option = chunkMJ2IMB5H_cjs.selectStandardPaymentOption(input.paymentRequired.accepts);
3605
+ const option = chunkJ6SS36ZD_cjs.selectStandardPaymentOption(input.paymentRequired.accepts);
3520
3606
  if (!option) {
3521
3607
  throw noCompatiblePaymentOptionError(input.paymentRequired.accepts);
3522
3608
  }
3523
- const idempotencyKey = input.idempotencyKey ?? chunkMJ2IMB5H_cjs.buildX402IdempotencyKey(input.paymentRequired, option);
3609
+ const idempotencyKey = input.idempotencyKey ?? chunkJ6SS36ZD_cjs.buildX402IdempotencyKey(input.paymentRequired, option);
3524
3610
  const cached = this.fundingLeg.cachedReceipt(idempotencyKey, input.taskBudgetId);
3525
3611
  if (cached) return cached;
3526
3612
  const status = await this.getPaymentStatus(input.paymentId);
@@ -3528,7 +3614,7 @@ var HavenClient = class {
3528
3614
  const canFund = await this.fundingLeg.delegateCanFund(
3529
3615
  status.chainId ?? chainIdFromNetwork(option.network),
3530
3616
  option.asset,
3531
- chunkMJ2IMB5H_cjs.x402AuthorizationAmount(option)
3617
+ chunkJ6SS36ZD_cjs.x402AuthorizationAmount(option)
3532
3618
  );
3533
3619
  if (canFund === false) {
3534
3620
  throw new chunkSZHKBOCZ_cjs.X402AlreadySettledError(
@@ -3558,7 +3644,7 @@ var HavenClient = class {
3558
3644
  if (response.status !== 402) {
3559
3645
  throw new chunkSZHKBOCZ_cjs.HavenApiError("Expected the original x402 request to return HTTP 402 before resuming.", 400);
3560
3646
  }
3561
- paymentRequired = await chunkMJ2IMB5H_cjs.parsePaymentRequiredResponse(response);
3647
+ paymentRequired = await chunkJ6SS36ZD_cjs.parsePaymentRequiredResponse(response);
3562
3648
  }
3563
3649
  const receipt = await this.resumeAuthorizedX402({
3564
3650
  paymentId: input.paymentId,
@@ -3611,7 +3697,7 @@ var HavenClient = class {
3611
3697
  nativeChallenge = true;
3612
3698
  } else {
3613
3699
  try {
3614
- paymentRequired = await chunkMJ2IMB5H_cjs.parsePaymentRequiredResponse(response);
3700
+ paymentRequired = await chunkJ6SS36ZD_cjs.parsePaymentRequiredResponse(response);
3615
3701
  } catch {
3616
3702
  return response;
3617
3703
  }
@@ -3621,8 +3707,8 @@ var HavenClient = class {
3621
3707
  if (mcpSessionId) requestInit = this.merchantTransport.withSessionHeaders(requestInit, mcpSessionId);
3622
3708
  }
3623
3709
  const request = snapshotX402Request(url, requestInit);
3624
- const option = chunkMJ2IMB5H_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3625
- const idempotencyKey = options.idempotencyKey ?? (option ? chunkMJ2IMB5H_cjs.buildX402IdempotencyKey(paymentRequired, option) : void 0);
3710
+ const option = chunkJ6SS36ZD_cjs.selectStandardPaymentOption(paymentRequired.accepts);
3711
+ const idempotencyKey = options.idempotencyKey ?? (option ? chunkJ6SS36ZD_cjs.buildX402IdempotencyKey(paymentRequired, option) : void 0);
3626
3712
  let receipt;
3627
3713
  try {
3628
3714
  receipt = await this.authorizeX402(paymentRequired, options);
@@ -3749,7 +3835,7 @@ var HavenClient = class {
3749
3835
  txHash: evidenceTxHash,
3750
3836
  resourceUrl: evidenceContext.resourceUrl,
3751
3837
  merchantStatus: surfaced.status,
3752
- paymentProofHeaderName: chunkMJ2IMB5H_cjs.x402PaymentHeaderNamesSent(input.paymentHeader),
3838
+ paymentProofHeaderName: chunkJ6SS36ZD_cjs.x402PaymentHeaderNamesSent(input.paymentHeader),
3753
3839
  paymentProofHeader: input.paymentHeader,
3754
3840
  protocolReceiptHeaderName,
3755
3841
  protocolReceiptHeader
@@ -3959,12 +4045,12 @@ var toolDescriptions = {
3959
4045
  payX402OneShot: {
3960
4046
  summary: "Fetch an x402 paid HTTP resource in a single call. Handles the full probe -> pay -> retry round trip and returns the merchant response.",
3961
4047
  selectionGuidance: "Prefer this over the quote+pay split when the agent just wants the paid resource and does not need to inspect the price first. If you already have a quote from haven_quote_x402, use haven_pay_x402_quote instead. Do not use for read-only allowance, budget, spend-limit, remaining-amount, reset-period, or what-can-I-spend questions; use the allowance lookup tool instead.",
3962
- behavior: "Calls the URL, parses any HTTP 402 x402 challenge (or, since #3118, a native-MCP payment-required tool result under HTTP 200), signs the payment locally, then retries the original request with the signed payment header (sent under PAYMENT-SIGNATURE, plus the legacy X-PAYMENT on the EIP-3009 path only) and returns the merchant response. Settlement is either direct account-to-merchant with no funding leg, or a bridge that first redeems the agent's budget delegation to fund the delegate wallet for an EIP-3009 authorization. A payment outside the on-chain budget is declined before any money moves; nothing is queued for a human to approve later. If the resource returns a non-402 status with no payment-required tool result, returns it unchanged without contacting Haven.",
4048
+ behavior: "Calls the URL, parses any HTTP 402 x402 challenge (or, since #3118, a native-MCP payment-required tool result under HTTP 200), signs the payment locally, then retries the original request with the signed payment header (sent under PAYMENT-SIGNATURE, plus the legacy X-PAYMENT on the EIP-3009 path only) and returns the merchant response. On the EIP-3009 path, when the owner opted this agent in, the same retry also carries the agent-signed buyer tax declaration in X-Tax-Declaration \u2014 signed by the same local delegate key, sent to the seller only, and omitted when the declaration is not available or on the direct-settlement (erc7710) scheme. Settlement is either direct account-to-merchant with no funding leg, or a bridge that first redeems the agent's budget delegation to fund the delegate wallet for an EIP-3009 authorization. A payment outside the on-chain budget is declined before any money moves; nothing is queued for a human to approve later. If the resource returns a non-402 status with no payment-required tool result, returns it unchanged without contacting Haven.",
3963
4049
  nextActionGuidance: "Preserve the returned resume_state or paymentId \u2014 either identifies this payment if you need to ask about it later. This tool performs the merchant retry itself, so do not wait on a signal while the call is in flight. If the process crashes after this call and a later haven_get_payment_status reports nextAction=retry_original_x402_request, Haven's funding leg confirmed but no merchant response was ever recorded \u2014 call the resume tool with the preserved resume_state or payment_id instead of paying again. If the response carries phase=insufficient_funds and nextAction=fund_account_or_raise_allowance, the payment cannot be retried until the account is funded or the agent budget raised \u2014 stop and tell the user the shortfall reported on the response."
3964
4050
  },
3965
4051
  resumeX402: {
3966
4052
  summary: "Resume an x402 payment whose Haven-side authorization already succeeded but whose merchant retry did not complete.",
3967
- behavior: "Accepts either resume_state or payment_id, validates the x402 details against the authorized funding, and retries the merchant request with the signed payment header (PAYMENT-SIGNATURE, plus legacy X-PAYMENT on EIP-3009 only; also params._meta on an MCP tools/call body). No new Haven payment is created.",
4053
+ behavior: "Accepts either resume_state or payment_id, validates the x402 details against the authorized funding, and retries the merchant request with the signed payment header (PAYMENT-SIGNATURE, plus legacy X-PAYMENT on EIP-3009 only; also params._meta on an MCP tools/call body). On the EIP-3009 scheme the retry also carries the agent-signed buyer tax declaration in X-Tax-Declaration when the owner opted this agent in and the declaration is available \u2014 signed locally by the same delegate key, sent to the seller only. No new Haven payment is created.",
3968
4054
  nextActionGuidance: "Only call this after haven_get_payment_status reports nextAction=retry_original_x402_request \u2014 that means Haven's funding leg confirmed but no merchant response was ever recorded, most often because the process crashed between funding and the merchant retry. Any other nextAction reports a conflict instead of retrying, so do not call this speculatively. Do not start a new merchant session and do not pay again \u2014 that would pay twice for one resource."
3969
4055
  },
3970
4056
  // #1328: quoteMpp / payMpp / resumeMpp (the mpp_demo challenge/quote/resume
@@ -4626,7 +4712,11 @@ failed purchase reads as complete for fifteen minutes. If the merchant's
4626
4712
  \`settlement_tx_hash\`): Haven verifies it on-chain, and the receipt then shows
4627
4713
  the merchant's settlement, not only the funding transaction. (The SDK's own
4628
4714
  \`haven_pay_x402\` tool does perform the merchant retry itself; that tool is
4629
- not part of the hosted MCP surface.) If the process
4715
+ not part of the hosted MCP surface.) On this SDK path, when the owner opted the
4716
+ agent in, the paid EIP-3009 retry also carries the agent-signed buyer tax
4717
+ declaration to the seller (\`X-Tax-Declaration\`, #3427) \u2014 signed locally by the
4718
+ same delegate key, omitted when unavailable or on the erc7710 scheme; nothing
4719
+ for you to sign or send. If the process
4630
4720
  crashes after payment, a later \`mcp__haven__haven_get_payment_status\` call
4631
4721
  may report \`nextAction: 'retry_original_x402_request'\` \u2014 only then call
4632
4722
  \`mcp__haven__haven_resume_x402_payment\` with the preserved resume state or
@@ -4776,263 +4866,263 @@ function sameUrl(a, b) {
4776
4866
 
4777
4867
  Object.defineProperty(exports, "DEFAULT_NEXT_TOOL_BY_ACTION", {
4778
4868
  enumerable: true,
4779
- get: function () { return chunkMJ2IMB5H_cjs.DEFAULT_NEXT_TOOL_BY_ACTION; }
4869
+ get: function () { return chunkJ6SS36ZD_cjs.DEFAULT_NEXT_TOOL_BY_ACTION; }
4780
4870
  });
4781
4871
  Object.defineProperty(exports, "ERC7710_ASSET_TRANSFER_METHOD", {
4782
4872
  enumerable: true,
4783
- get: function () { return chunkMJ2IMB5H_cjs.ERC7710_ASSET_TRANSFER_METHOD; }
4873
+ get: function () { return chunkJ6SS36ZD_cjs.ERC7710_ASSET_TRANSFER_METHOD; }
4784
4874
  });
4785
4875
  Object.defineProperty(exports, "HAVEN_CLIENT_HEADER", {
4786
4876
  enumerable: true,
4787
- get: function () { return chunkMJ2IMB5H_cjs.HAVEN_CLIENT_HEADER; }
4877
+ get: function () { return chunkJ6SS36ZD_cjs.HAVEN_CLIENT_HEADER; }
4788
4878
  });
4789
4879
  Object.defineProperty(exports, "HAVEN_MINIMUM_NODE_VERSION", {
4790
4880
  enumerable: true,
4791
- get: function () { return chunkMJ2IMB5H_cjs.HAVEN_MINIMUM_NODE_VERSION; }
4881
+ get: function () { return chunkJ6SS36ZD_cjs.HAVEN_MINIMUM_NODE_VERSION; }
4792
4882
  });
4793
4883
  Object.defineProperty(exports, "HavenTypedDataRefusedError", {
4794
4884
  enumerable: true,
4795
- get: function () { return chunkMJ2IMB5H_cjs.HavenTypedDataRefusedError; }
4885
+ get: function () { return chunkJ6SS36ZD_cjs.HavenTypedDataRefusedError; }
4796
4886
  });
4797
4887
  Object.defineProperty(exports, "MAX_TASK_BUDGET_TTL_SECONDS", {
4798
4888
  enumerable: true,
4799
- get: function () { return chunkMJ2IMB5H_cjs.MAX_TASK_BUDGET_TTL_SECONDS; }
4889
+ get: function () { return chunkJ6SS36ZD_cjs.MAX_TASK_BUDGET_TTL_SECONDS; }
4800
4890
  });
4801
4891
  Object.defineProperty(exports, "NEXT_TOOL_SERVER_NAMES", {
4802
4892
  enumerable: true,
4803
- get: function () { return chunkMJ2IMB5H_cjs.NEXT_TOOL_SERVER_NAMES; }
4893
+ get: function () { return chunkJ6SS36ZD_cjs.NEXT_TOOL_SERVER_NAMES; }
4804
4894
  });
4805
4895
  Object.defineProperty(exports, "NEXT_TOOL_SERVER_ROLES", {
4806
4896
  enumerable: true,
4807
- get: function () { return chunkMJ2IMB5H_cjs.NEXT_TOOL_SERVER_ROLES; }
4897
+ get: function () { return chunkJ6SS36ZD_cjs.NEXT_TOOL_SERVER_ROLES; }
4808
4898
  });
4809
4899
  Object.defineProperty(exports, "SDK_CLIENT_IDENTITY", {
4810
4900
  enumerable: true,
4811
- get: function () { return chunkMJ2IMB5H_cjs.SDK_CLIENT_IDENTITY; }
4901
+ get: function () { return chunkJ6SS36ZD_cjs.SDK_CLIENT_IDENTITY; }
4812
4902
  });
4813
4903
  Object.defineProperty(exports, "SDK_VERSION", {
4814
4904
  enumerable: true,
4815
- get: function () { return chunkMJ2IMB5H_cjs.SDK_VERSION; }
4905
+ get: function () { return chunkJ6SS36ZD_cjs.SDK_VERSION; }
4816
4906
  });
4817
4907
  Object.defineProperty(exports, "SWEEP_BASE_CHAIN_ID", {
4818
4908
  enumerable: true,
4819
- get: function () { return chunkMJ2IMB5H_cjs.SWEEP_BASE_CHAIN_ID; }
4909
+ get: function () { return chunkJ6SS36ZD_cjs.SWEEP_BASE_CHAIN_ID; }
4820
4910
  });
4821
4911
  Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_CHAIN_ID", {
4822
4912
  enumerable: true,
4823
- get: function () { return chunkMJ2IMB5H_cjs.SWEEP_BASE_SEPOLIA_CHAIN_ID; }
4913
+ get: function () { return chunkJ6SS36ZD_cjs.SWEEP_BASE_SEPOLIA_CHAIN_ID; }
4824
4914
  });
4825
4915
  Object.defineProperty(exports, "SWEEP_BASE_SEPOLIA_USDC_ADDRESS", {
4826
4916
  enumerable: true,
4827
- get: function () { return chunkMJ2IMB5H_cjs.SWEEP_BASE_SEPOLIA_USDC_ADDRESS; }
4917
+ get: function () { return chunkJ6SS36ZD_cjs.SWEEP_BASE_SEPOLIA_USDC_ADDRESS; }
4828
4918
  });
4829
4919
  Object.defineProperty(exports, "SWEEP_BASE_USDC_ADDRESS", {
4830
4920
  enumerable: true,
4831
- get: function () { return chunkMJ2IMB5H_cjs.SWEEP_BASE_USDC_ADDRESS; }
4921
+ get: function () { return chunkJ6SS36ZD_cjs.SWEEP_BASE_USDC_ADDRESS; }
4832
4922
  });
4833
4923
  Object.defineProperty(exports, "TRANSFER_WITH_AUTHORIZATION_TYPES", {
4834
4924
  enumerable: true,
4835
- get: function () { return chunkMJ2IMB5H_cjs.TRANSFER_WITH_AUTHORIZATION_TYPES; }
4925
+ get: function () { return chunkJ6SS36ZD_cjs.TRANSFER_WITH_AUTHORIZATION_TYPES; }
4836
4926
  });
4837
4927
  Object.defineProperty(exports, "TYPED_DATA_NOT_ALLOWED", {
4838
4928
  enumerable: true,
4839
- get: function () { return chunkMJ2IMB5H_cjs.TYPED_DATA_NOT_ALLOWED; }
4929
+ get: function () { return chunkJ6SS36ZD_cjs.TYPED_DATA_NOT_ALLOWED; }
4840
4930
  });
4841
4931
  Object.defineProperty(exports, "X402PaymentHeaderValidationError", {
4842
4932
  enumerable: true,
4843
- get: function () { return chunkMJ2IMB5H_cjs.X402PaymentHeaderValidationError; }
4933
+ get: function () { return chunkJ6SS36ZD_cjs.X402PaymentHeaderValidationError; }
4844
4934
  });
4845
4935
  Object.defineProperty(exports, "X402_LEGACY_PAYMENT_HEADER_NAME", {
4846
4936
  enumerable: true,
4847
- get: function () { return chunkMJ2IMB5H_cjs.X402_LEGACY_PAYMENT_HEADER_NAME; }
4937
+ get: function () { return chunkJ6SS36ZD_cjs.X402_LEGACY_PAYMENT_HEADER_NAME; }
4848
4938
  });
4849
4939
  Object.defineProperty(exports, "X402_MAX_AUTHORIZATION_WINDOW_SECONDS", {
4850
4940
  enumerable: true,
4851
- get: function () { return chunkMJ2IMB5H_cjs.X402_MAX_AUTHORIZATION_WINDOW_SECONDS; }
4941
+ get: function () { return chunkJ6SS36ZD_cjs.X402_MAX_AUTHORIZATION_WINDOW_SECONDS; }
4852
4942
  });
4853
4943
  Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAME", {
4854
4944
  enumerable: true,
4855
- get: function () { return chunkMJ2IMB5H_cjs.X402_PAYMENT_HEADER_NAME; }
4945
+ get: function () { return chunkJ6SS36ZD_cjs.X402_PAYMENT_HEADER_NAME; }
4856
4946
  });
4857
4947
  Object.defineProperty(exports, "X402_PAYMENT_HEADER_NAMES_SENT", {
4858
4948
  enumerable: true,
4859
- get: function () { return chunkMJ2IMB5H_cjs.X402_PAYMENT_HEADER_NAMES_SENT; }
4949
+ get: function () { return chunkJ6SS36ZD_cjs.X402_PAYMENT_HEADER_NAMES_SENT; }
4860
4950
  });
4861
4951
  Object.defineProperty(exports, "X402_PAYMENT_REQUIRED_HEADER_NAME", {
4862
4952
  enumerable: true,
4863
- get: function () { return chunkMJ2IMB5H_cjs.X402_PAYMENT_REQUIRED_HEADER_NAME; }
4953
+ get: function () { return chunkJ6SS36ZD_cjs.X402_PAYMENT_REQUIRED_HEADER_NAME; }
4864
4954
  });
4865
4955
  Object.defineProperty(exports, "X402_PAYMENT_RESPONSE_HEADER_NAME", {
4866
4956
  enumerable: true,
4867
- get: function () { return chunkMJ2IMB5H_cjs.X402_PAYMENT_RESPONSE_HEADER_NAME; }
4957
+ get: function () { return chunkJ6SS36ZD_cjs.X402_PAYMENT_RESPONSE_HEADER_NAME; }
4868
4958
  });
4869
4959
  Object.defineProperty(exports, "X402_SETTLEMENT_FORWARD_MARGIN_SECONDS", {
4870
4960
  enumerable: true,
4871
- get: function () { return chunkMJ2IMB5H_cjs.X402_SETTLEMENT_FORWARD_MARGIN_SECONDS; }
4961
+ get: function () { return chunkJ6SS36ZD_cjs.X402_SETTLEMENT_FORWARD_MARGIN_SECONDS; }
4872
4962
  });
4873
4963
  Object.defineProperty(exports, "assertBoundDirectPaymentUserOp", {
4874
4964
  enumerable: true,
4875
- get: function () { return chunkMJ2IMB5H_cjs.assertBoundDirectPaymentUserOp; }
4965
+ get: function () { return chunkJ6SS36ZD_cjs.assertBoundDirectPaymentUserOp; }
4876
4966
  });
4877
4967
  Object.defineProperty(exports, "assertOwnTaskBudgetCloseUserOp", {
4878
4968
  enumerable: true,
4879
- get: function () { return chunkMJ2IMB5H_cjs.assertOwnTaskBudgetCloseUserOp; }
4969
+ get: function () { return chunkJ6SS36ZD_cjs.assertOwnTaskBudgetCloseUserOp; }
4880
4970
  });
4881
4971
  Object.defineProperty(exports, "assertOwnTaskChild", {
4882
4972
  enumerable: true,
4883
- get: function () { return chunkMJ2IMB5H_cjs.assertOwnTaskChild; }
4973
+ get: function () { return chunkJ6SS36ZD_cjs.assertOwnTaskChild; }
4884
4974
  });
4885
4975
  Object.defineProperty(exports, "buildSweepAuthorizationMessage", {
4886
4976
  enumerable: true,
4887
- get: function () { return chunkMJ2IMB5H_cjs.buildSweepAuthorizationMessage; }
4977
+ get: function () { return chunkJ6SS36ZD_cjs.buildSweepAuthorizationMessage; }
4888
4978
  });
4889
4979
  Object.defineProperty(exports, "buildSweepTypedData", {
4890
4980
  enumerable: true,
4891
- get: function () { return chunkMJ2IMB5H_cjs.buildSweepTypedData; }
4981
+ get: function () { return chunkJ6SS36ZD_cjs.buildSweepTypedData; }
4892
4982
  });
4893
4983
  Object.defineProperty(exports, "buildX402ExpectedMessage", {
4894
4984
  enumerable: true,
4895
- get: function () { return chunkMJ2IMB5H_cjs.buildX402ExpectedMessage; }
4985
+ get: function () { return chunkJ6SS36ZD_cjs.buildX402ExpectedMessage; }
4896
4986
  });
4897
4987
  Object.defineProperty(exports, "compareNodeVersions", {
4898
4988
  enumerable: true,
4899
- get: function () { return chunkMJ2IMB5H_cjs.compareNodeVersions; }
4989
+ get: function () { return chunkJ6SS36ZD_cjs.compareNodeVersions; }
4900
4990
  });
4901
4991
  Object.defineProperty(exports, "createNextStepBuilder", {
4902
4992
  enumerable: true,
4903
- get: function () { return chunkMJ2IMB5H_cjs.createNextStepBuilder; }
4993
+ get: function () { return chunkJ6SS36ZD_cjs.createNextStepBuilder; }
4904
4994
  });
4905
4995
  Object.defineProperty(exports, "decodeBase64Json", {
4906
4996
  enumerable: true,
4907
- get: function () { return chunkMJ2IMB5H_cjs.decodeBase64Json; }
4997
+ get: function () { return chunkJ6SS36ZD_cjs.decodeBase64Json; }
4908
4998
  });
4909
4999
  Object.defineProperty(exports, "decodeBase64Utf8", {
4910
5000
  enumerable: true,
4911
- get: function () { return chunkMJ2IMB5H_cjs.decodeBase64Utf8; }
5001
+ get: function () { return chunkJ6SS36ZD_cjs.decodeBase64Utf8; }
4912
5002
  });
4913
5003
  Object.defineProperty(exports, "defaultNextToolFor", {
4914
5004
  enumerable: true,
4915
- get: function () { return chunkMJ2IMB5H_cjs.defaultNextToolFor; }
5005
+ get: function () { return chunkJ6SS36ZD_cjs.defaultNextToolFor; }
4916
5006
  });
4917
5007
  Object.defineProperty(exports, "encodeBase64Json", {
4918
5008
  enumerable: true,
4919
- get: function () { return chunkMJ2IMB5H_cjs.encodeBase64Json; }
5009
+ get: function () { return chunkJ6SS36ZD_cjs.encodeBase64Json; }
4920
5010
  });
4921
5011
  Object.defineProperty(exports, "encodeBase64Utf8", {
4922
5012
  enumerable: true,
4923
- get: function () { return chunkMJ2IMB5H_cjs.encodeBase64Utf8; }
5013
+ get: function () { return chunkJ6SS36ZD_cjs.encodeBase64Utf8; }
4924
5014
  });
4925
5015
  Object.defineProperty(exports, "encodePaymentProof", {
4926
5016
  enumerable: true,
4927
- get: function () { return chunkMJ2IMB5H_cjs.encodePaymentProof; }
5017
+ get: function () { return chunkJ6SS36ZD_cjs.encodePaymentProof; }
4928
5018
  });
4929
5019
  Object.defineProperty(exports, "hashDelegation", {
4930
5020
  enumerable: true,
4931
- get: function () { return chunkMJ2IMB5H_cjs.hashDelegation; }
5021
+ get: function () { return chunkJ6SS36ZD_cjs.hashDelegation; }
4932
5022
  });
4933
5023
  Object.defineProperty(exports, "havenClientIdentity", {
4934
5024
  enumerable: true,
4935
- get: function () { return chunkMJ2IMB5H_cjs.havenClientIdentity; }
5025
+ get: function () { return chunkJ6SS36ZD_cjs.havenClientIdentity; }
4936
5026
  });
4937
5027
  Object.defineProperty(exports, "isErc7710Option", {
4938
5028
  enumerable: true,
4939
- get: function () { return chunkMJ2IMB5H_cjs.isErc7710Option; }
5029
+ get: function () { return chunkJ6SS36ZD_cjs.isErc7710Option; }
4940
5030
  });
4941
5031
  Object.defineProperty(exports, "isSupportedNodeVersion", {
4942
5032
  enumerable: true,
4943
- get: function () { return chunkMJ2IMB5H_cjs.isSupportedNodeVersion; }
5033
+ get: function () { return chunkJ6SS36ZD_cjs.isSupportedNodeVersion; }
4944
5034
  });
4945
5035
  Object.defineProperty(exports, "isSweepableChain", {
4946
5036
  enumerable: true,
4947
- get: function () { return chunkMJ2IMB5H_cjs.isSweepableChain; }
5037
+ get: function () { return chunkJ6SS36ZD_cjs.isSweepableChain; }
4948
5038
  });
4949
5039
  Object.defineProperty(exports, "isTaskChildTypedData", {
4950
5040
  enumerable: true,
4951
- get: function () { return chunkMJ2IMB5H_cjs.isTaskChildTypedData; }
5041
+ get: function () { return chunkJ6SS36ZD_cjs.isTaskChildTypedData; }
4952
5042
  });
4953
5043
  Object.defineProperty(exports, "normalizePaymentRequired", {
4954
5044
  enumerable: true,
4955
- get: function () { return chunkMJ2IMB5H_cjs.normalizePaymentRequired; }
5045
+ get: function () { return chunkJ6SS36ZD_cjs.normalizePaymentRequired; }
4956
5046
  });
4957
5047
  Object.defineProperty(exports, "parseNextTool", {
4958
5048
  enumerable: true,
4959
- get: function () { return chunkMJ2IMB5H_cjs.parseNextTool; }
5049
+ get: function () { return chunkJ6SS36ZD_cjs.parseNextTool; }
4960
5050
  });
4961
5051
  Object.defineProperty(exports, "parsePaymentRequired", {
4962
5052
  enumerable: true,
4963
- get: function () { return chunkMJ2IMB5H_cjs.parsePaymentRequired; }
5053
+ get: function () { return chunkJ6SS36ZD_cjs.parsePaymentRequired; }
4964
5054
  });
4965
5055
  Object.defineProperty(exports, "parsePaymentRequiredResponse", {
4966
5056
  enumerable: true,
4967
- get: function () { return chunkMJ2IMB5H_cjs.parsePaymentRequiredResponse; }
5057
+ get: function () { return chunkJ6SS36ZD_cjs.parsePaymentRequiredResponse; }
4968
5058
  });
4969
5059
  Object.defineProperty(exports, "readClientUpdate", {
4970
5060
  enumerable: true,
4971
- get: function () { return chunkMJ2IMB5H_cjs.readClientUpdate; }
5061
+ get: function () { return chunkJ6SS36ZD_cjs.readClientUpdate; }
4972
5062
  });
4973
5063
  Object.defineProperty(exports, "renderNextTool", {
4974
5064
  enumerable: true,
4975
- get: function () { return chunkMJ2IMB5H_cjs.renderNextTool; }
5065
+ get: function () { return chunkJ6SS36ZD_cjs.renderNextTool; }
4976
5066
  });
4977
5067
  Object.defineProperty(exports, "resolveTokenBySymbol", {
4978
5068
  enumerable: true,
4979
- get: function () { return chunkMJ2IMB5H_cjs.resolveTokenBySymbol; }
5069
+ get: function () { return chunkJ6SS36ZD_cjs.resolveTokenBySymbol; }
4980
5070
  });
4981
5071
  Object.defineProperty(exports, "resolveTokenFromAddress", {
4982
5072
  enumerable: true,
4983
- get: function () { return chunkMJ2IMB5H_cjs.resolveTokenFromAddress; }
5073
+ get: function () { return chunkJ6SS36ZD_cjs.resolveTokenFromAddress; }
4984
5074
  });
4985
5075
  Object.defineProperty(exports, "selectErc7710PaymentOption", {
4986
5076
  enumerable: true,
4987
- get: function () { return chunkMJ2IMB5H_cjs.selectErc7710PaymentOption; }
5077
+ get: function () { return chunkJ6SS36ZD_cjs.selectErc7710PaymentOption; }
4988
5078
  });
4989
5079
  Object.defineProperty(exports, "selectPaymentOption", {
4990
5080
  enumerable: true,
4991
- get: function () { return chunkMJ2IMB5H_cjs.selectPaymentOption; }
5081
+ get: function () { return chunkJ6SS36ZD_cjs.selectPaymentOption; }
4992
5082
  });
4993
5083
  Object.defineProperty(exports, "selectStandardPaymentOption", {
4994
5084
  enumerable: true,
4995
- get: function () { return chunkMJ2IMB5H_cjs.selectStandardPaymentOption; }
5085
+ get: function () { return chunkJ6SS36ZD_cjs.selectStandardPaymentOption; }
4996
5086
  });
4997
5087
  Object.defineProperty(exports, "selectX402SettlementScheme", {
4998
5088
  enumerable: true,
4999
- get: function () { return chunkMJ2IMB5H_cjs.selectX402SettlementScheme; }
5089
+ get: function () { return chunkJ6SS36ZD_cjs.selectX402SettlementScheme; }
5000
5090
  });
5001
5091
  Object.defineProperty(exports, "sweepUsdcAddress", {
5002
5092
  enumerable: true,
5003
- get: function () { return chunkMJ2IMB5H_cjs.sweepUsdcAddress; }
5093
+ get: function () { return chunkJ6SS36ZD_cjs.sweepUsdcAddress; }
5004
5094
  });
5005
5095
  Object.defineProperty(exports, "sweepUsdcDomain", {
5006
5096
  enumerable: true,
5007
- get: function () { return chunkMJ2IMB5H_cjs.sweepUsdcDomain; }
5097
+ get: function () { return chunkJ6SS36ZD_cjs.sweepUsdcDomain; }
5008
5098
  });
5009
5099
  Object.defineProperty(exports, "toStandardPaymentRequirements", {
5010
5100
  enumerable: true,
5011
- get: function () { return chunkMJ2IMB5H_cjs.toStandardPaymentRequirements; }
5101
+ get: function () { return chunkJ6SS36ZD_cjs.toStandardPaymentRequirements; }
5012
5102
  });
5013
5103
  Object.defineProperty(exports, "unsupportedNodeVersionMessage", {
5014
5104
  enumerable: true,
5015
- get: function () { return chunkMJ2IMB5H_cjs.unsupportedNodeVersionMessage; }
5105
+ get: function () { return chunkJ6SS36ZD_cjs.unsupportedNodeVersionMessage; }
5016
5106
  });
5017
5107
  Object.defineProperty(exports, "validateStandardX402PaymentHeader", {
5018
5108
  enumerable: true,
5019
- get: function () { return chunkMJ2IMB5H_cjs.validateStandardX402PaymentHeader; }
5109
+ get: function () { return chunkJ6SS36ZD_cjs.validateStandardX402PaymentHeader; }
5020
5110
  });
5021
5111
  Object.defineProperty(exports, "x402AssetTransferMethod", {
5022
5112
  enumerable: true,
5023
- get: function () { return chunkMJ2IMB5H_cjs.x402AssetTransferMethod; }
5113
+ get: function () { return chunkJ6SS36ZD_cjs.x402AssetTransferMethod; }
5024
5114
  });
5025
5115
  Object.defineProperty(exports, "x402AuthorizationAmount", {
5026
5116
  enumerable: true,
5027
- get: function () { return chunkMJ2IMB5H_cjs.x402AuthorizationAmount; }
5117
+ get: function () { return chunkJ6SS36ZD_cjs.x402AuthorizationAmount; }
5028
5118
  });
5029
5119
  Object.defineProperty(exports, "x402FacilitatorAddresses", {
5030
5120
  enumerable: true,
5031
- get: function () { return chunkMJ2IMB5H_cjs.x402FacilitatorAddresses; }
5121
+ get: function () { return chunkJ6SS36ZD_cjs.x402FacilitatorAddresses; }
5032
5122
  });
5033
5123
  Object.defineProperty(exports, "x402V2PaymentEnvelope", {
5034
5124
  enumerable: true,
5035
- get: function () { return chunkMJ2IMB5H_cjs.x402V2PaymentEnvelope; }
5125
+ get: function () { return chunkJ6SS36ZD_cjs.x402V2PaymentEnvelope; }
5036
5126
  });
5037
5127
  Object.defineProperty(exports, "AGENT_PAYMENT_FAILURE_CODE_VALUES", {
5038
5128
  enumerable: true,