@haven_ai/sdk 0.1.24-alpha.0 → 0.1.26-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1063,6 +1063,42 @@ declare class X402UnexpectedStatusError extends HavenApiError {
1063
1063
  readonly x402ErrorCode: "unexpected_non_402_status";
1064
1064
  constructor(message: string, statusCode: number);
1065
1065
  }
1066
+ /**
1067
+ * #1521: the idempotency key resolved to a payment that has already settled,
1068
+ * and the delegate can no longer fund a fresh authorization for it.
1069
+ *
1070
+ * This is the typed form of "you already bought this". It exists because the
1071
+ * alternative was indefensible: the SDK used to mint a new EIP-3009
1072
+ * authorization against the spent delegate and hand it back paired with the
1073
+ * ORIGINAL payment's `txHash`, so the caller learned what had happened only
1074
+ * from a merchant-side balance error that reads identically to a broken
1075
+ * payment rail.
1076
+ *
1077
+ * `receipt` is the ORIGINAL payment — a real receipt for real settled funds,
1078
+ * deliberately carrying no `paymentHeader`, because any header minted here
1079
+ * would be exactly the unfundable artifact this error replaces.
1080
+ */
1081
+ declare class X402AlreadySettledError extends HavenApiError {
1082
+ readonly receipt: X402Receipt;
1083
+ /**
1084
+ * `settled` — the delegate was checked on-chain and cannot fund a fresh
1085
+ * authorization, so this payment demonstrably completed.
1086
+ * `unverifiable` — no `chainRpcs` entry for the chain, so fundability
1087
+ * could not be established either way. Same refusal, weaker claim; say
1088
+ * which, rather than assert what was not checked.
1089
+ */
1090
+ readonly basis: 'settled' | 'unverifiable';
1091
+ readonly x402ErrorCode: "already_settled";
1092
+ constructor(message: string, receipt: X402Receipt,
1093
+ /**
1094
+ * `settled` — the delegate was checked on-chain and cannot fund a fresh
1095
+ * authorization, so this payment demonstrably completed.
1096
+ * `unverifiable` — no `chainRpcs` entry for the chain, so fundability
1097
+ * could not be established either way. Same refusal, weaker claim; say
1098
+ * which, rather than assert what was not checked.
1099
+ */
1100
+ basis: 'settled' | 'unverifiable');
1101
+ }
1066
1102
  declare class HavenPaymentStateError extends HavenApiError {
1067
1103
  readonly state: PaymentStatusResult;
1068
1104
  resumeState?: X402ResumeState;
@@ -1758,8 +1794,18 @@ declare class HavenClient {
1758
1794
  * balance — otherwise it rejects with "Payment verification failed". The
1759
1795
  * SDK's local path already does this (see authorizeStandardX402); the hosted
1760
1796
  * split flow regressed when the 5→3 collapse removed the incidental
1761
- * inter-call latency that used to mask it. No-op when the funding tx hash or
1762
- * a chain RPC (chainRpcs[chainId]) is unavailable.
1797
+ * inter-call latency that used to mask it.
1798
+ *
1799
+ * **NOT a no-op when the funding tx hash is absent** (#1508). The WAIT is
1800
+ * skipped without a hash or a chain RPC, but the `GET /payments/:id` read
1801
+ * below runs UNCONDITIONALLY — it is how the fallback hash and the chainId
1802
+ * are obtained. That distinction is load-bearing: this method must never be
1803
+ * called on a scheme with no funding leg, because the read itself fails once
1804
+ * the intent reaches a status the backend maps to a non-2xx (`submitted` is a
1805
+ * 409), turning a settled payment into a reported error. The previous wording
1806
+ * here said "No-op when the funding tx hash ... is unavailable", and the
1807
+ * hosted erc7710 path was written against that promise — see
1808
+ * `deliverMerchantPayment`'s `noFundingLeg` option.
1763
1809
  */
1764
1810
  ensureFundingConfirmed(paymentId: string, fundingTxHash?: string): Promise<void>;
1765
1811
  completeX402MerchantCall(input: {
@@ -1768,6 +1814,16 @@ declare class HavenClient {
1768
1814
  paymentId: string;
1769
1815
  paymentHeader: string;
1770
1816
  mcpTransport?: X402McpTransport;
1817
+ /**
1818
+ * #1508: the payment settles with NO funding leg (erc7710). This method was
1819
+ * written for EIP-3009 and encodes that lifecycle in two places — the
1820
+ * readiness gate wants `confirmed`, and a Haven funding tx hash is
1821
+ * mandatory. Neither is reachable on a scheme where the MERCHANT redeems
1822
+ * the delegation chain: the intent sits at `submitted` by design, and there
1823
+ * is no Haven-submitted transaction at all. Set this to take the
1824
+ * no-funding-leg path through both.
1825
+ */
1826
+ noFundingLeg?: boolean;
1771
1827
  }): Promise<{
1772
1828
  status: number;
1773
1829
  ok: boolean;
@@ -1805,6 +1861,25 @@ declare class HavenClient {
1805
1861
  * small propagation window as a trade-off for not configuring an RPC URL.
1806
1862
  */
1807
1863
  private waitForFundingTx;
1864
+ /**
1865
+ * Can the delegate EOA still fund an authorization for `amountAtomic`?
1866
+ *
1867
+ * #1521: the only question that separates a legitimate resume (funding
1868
+ * confirmed, merchant never paid — the delegate still holds the money) from
1869
+ * a replayed settled payment (funding confirmed, merchant paid, delegate
1870
+ * spent). The intent's own `status: 'confirmed'` is identical in both.
1871
+ *
1872
+ * The balance is asked of the CHAIN rather than of Haven's bookkeeping on
1873
+ * purpose: the merchant-settlement evidence record is written by this SDK
1874
+ * *after* the merchant call, so a client that dies between the two leaves
1875
+ * the backend believing the merchant was never paid — the exact case the
1876
+ * discriminator has to get right. The chain cannot be behind in that way.
1877
+ *
1878
+ * Returns `null` — never a guess — when `chainRpcs` has no entry for the
1879
+ * chain or the read fails. Callers must treat that as "unverifiable", not
1880
+ * as "funded".
1881
+ */
1882
+ private delegateCanFund;
1808
1883
  private throwIfNonSignableAuthorizationState;
1809
1884
  private throwPaymentStateError;
1810
1885
  private paymentStateFromRaw;
@@ -2449,4 +2524,4 @@ declare function discoverMerchantMcpUrl(inputUrl: string): Promise<string | null
2449
2524
  /** Trailing-slash/percent-case echoes compare equal; unparseable never does. */
2450
2525
  declare function sameUrl(a: string, b: string): boolean;
2451
2526
 
2452
- export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, type AgentNextStep, type AgentPaymentEnumSchema, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, type AgentPaymentSummary, type AgentPaymentWarning, AgentPaymentWarningCode, type AgentPurchaseSummary, type ClaudeTool, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, type HavenAgent, type HavenAgentAllowanceSummary, type HavenAgentReadiness, type HavenAgentSummary, type HavenAllowance, type HavenAllowanceSummary, HavenApiError, type HavenCatalogEntry, HavenClient, type HavenClientConfig, HavenError, type HavenPaymentReceipt, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, type MachinePaymentRail, MerchantTimeoutError, type OpenAITool, type PaymentFee, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentReceipt, type PaymentRequest, type PaymentResult, type PaymentResumeState, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, type ResumeAuthorizedX402Input, type ResumeX402PaymentInput, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, type SharedToolKey, type SignData, SignerRefusalCode, type SweepAuthorization, type SweepEip712Domain, type SweepEntry, type SweepExpectedAuth, type SweepPreparation, type SweepPrepareResponse, type SweepResult, type SweepSubmitResponse, type SweepSubmitResult, type SweepTypedData, TRANSFER_WITH_AUTHORIZATION_TYPES, type ToolDescription, type UnsupportedNodeVersionMessageOptions, type X402AuthorizationOptions, type X402Erc7710Settlement, type X402ExpectedAuth, type X402ExpectedContext, type X402Intent, type X402McpCallContext, type X402McpTransport, type X402MerchantCallContext, type X402PaymentHeaderContext, X402PaymentHeaderValidationError, type X402PaymentOption, type X402PaymentRequired, type X402Quote, type X402Receipt, type X402RequestSnapshot, type X402ResumeState, type X402SchemeSelection, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses };
2527
+ export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, type AgentNextStep, type AgentPaymentEnumSchema, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, type AgentPaymentSummary, type AgentPaymentWarning, AgentPaymentWarningCode, type AgentPurchaseSummary, type ClaudeTool, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, type HavenAgent, type HavenAgentAllowanceSummary, type HavenAgentReadiness, type HavenAgentSummary, type HavenAllowance, type HavenAllowanceSummary, HavenApiError, type HavenCatalogEntry, HavenClient, type HavenClientConfig, HavenError, type HavenPaymentReceipt, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, type MachinePaymentRail, MerchantTimeoutError, type OpenAITool, type PaymentFee, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentReceipt, type PaymentRequest, type PaymentResult, type PaymentResumeState, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, type ResumeAuthorizedX402Input, type ResumeX402PaymentInput, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, type SharedToolKey, type SignData, SignerRefusalCode, type SweepAuthorization, type SweepEip712Domain, type SweepEntry, type SweepExpectedAuth, type SweepPreparation, type SweepPrepareResponse, type SweepResult, type SweepSubmitResponse, type SweepSubmitResult, type SweepTypedData, TRANSFER_WITH_AUTHORIZATION_TYPES, type ToolDescription, type UnsupportedNodeVersionMessageOptions, X402AlreadySettledError, type X402AuthorizationOptions, type X402Erc7710Settlement, type X402ExpectedAuth, type X402ExpectedContext, type X402Intent, type X402McpCallContext, type X402McpTransport, type X402MerchantCallContext, type X402PaymentHeaderContext, X402PaymentHeaderValidationError, type X402PaymentOption, type X402PaymentRequired, type X402Quote, type X402Receipt, type X402RequestSnapshot, type X402ResumeState, type X402SchemeSelection, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses };
package/dist/index.d.ts CHANGED
@@ -1063,6 +1063,42 @@ declare class X402UnexpectedStatusError extends HavenApiError {
1063
1063
  readonly x402ErrorCode: "unexpected_non_402_status";
1064
1064
  constructor(message: string, statusCode: number);
1065
1065
  }
1066
+ /**
1067
+ * #1521: the idempotency key resolved to a payment that has already settled,
1068
+ * and the delegate can no longer fund a fresh authorization for it.
1069
+ *
1070
+ * This is the typed form of "you already bought this". It exists because the
1071
+ * alternative was indefensible: the SDK used to mint a new EIP-3009
1072
+ * authorization against the spent delegate and hand it back paired with the
1073
+ * ORIGINAL payment's `txHash`, so the caller learned what had happened only
1074
+ * from a merchant-side balance error that reads identically to a broken
1075
+ * payment rail.
1076
+ *
1077
+ * `receipt` is the ORIGINAL payment — a real receipt for real settled funds,
1078
+ * deliberately carrying no `paymentHeader`, because any header minted here
1079
+ * would be exactly the unfundable artifact this error replaces.
1080
+ */
1081
+ declare class X402AlreadySettledError extends HavenApiError {
1082
+ readonly receipt: X402Receipt;
1083
+ /**
1084
+ * `settled` — the delegate was checked on-chain and cannot fund a fresh
1085
+ * authorization, so this payment demonstrably completed.
1086
+ * `unverifiable` — no `chainRpcs` entry for the chain, so fundability
1087
+ * could not be established either way. Same refusal, weaker claim; say
1088
+ * which, rather than assert what was not checked.
1089
+ */
1090
+ readonly basis: 'settled' | 'unverifiable';
1091
+ readonly x402ErrorCode: "already_settled";
1092
+ constructor(message: string, receipt: X402Receipt,
1093
+ /**
1094
+ * `settled` — the delegate was checked on-chain and cannot fund a fresh
1095
+ * authorization, so this payment demonstrably completed.
1096
+ * `unverifiable` — no `chainRpcs` entry for the chain, so fundability
1097
+ * could not be established either way. Same refusal, weaker claim; say
1098
+ * which, rather than assert what was not checked.
1099
+ */
1100
+ basis: 'settled' | 'unverifiable');
1101
+ }
1066
1102
  declare class HavenPaymentStateError extends HavenApiError {
1067
1103
  readonly state: PaymentStatusResult;
1068
1104
  resumeState?: X402ResumeState;
@@ -1758,8 +1794,18 @@ declare class HavenClient {
1758
1794
  * balance — otherwise it rejects with "Payment verification failed". The
1759
1795
  * SDK's local path already does this (see authorizeStandardX402); the hosted
1760
1796
  * split flow regressed when the 5→3 collapse removed the incidental
1761
- * inter-call latency that used to mask it. No-op when the funding tx hash or
1762
- * a chain RPC (chainRpcs[chainId]) is unavailable.
1797
+ * inter-call latency that used to mask it.
1798
+ *
1799
+ * **NOT a no-op when the funding tx hash is absent** (#1508). The WAIT is
1800
+ * skipped without a hash or a chain RPC, but the `GET /payments/:id` read
1801
+ * below runs UNCONDITIONALLY — it is how the fallback hash and the chainId
1802
+ * are obtained. That distinction is load-bearing: this method must never be
1803
+ * called on a scheme with no funding leg, because the read itself fails once
1804
+ * the intent reaches a status the backend maps to a non-2xx (`submitted` is a
1805
+ * 409), turning a settled payment into a reported error. The previous wording
1806
+ * here said "No-op when the funding tx hash ... is unavailable", and the
1807
+ * hosted erc7710 path was written against that promise — see
1808
+ * `deliverMerchantPayment`'s `noFundingLeg` option.
1763
1809
  */
1764
1810
  ensureFundingConfirmed(paymentId: string, fundingTxHash?: string): Promise<void>;
1765
1811
  completeX402MerchantCall(input: {
@@ -1768,6 +1814,16 @@ declare class HavenClient {
1768
1814
  paymentId: string;
1769
1815
  paymentHeader: string;
1770
1816
  mcpTransport?: X402McpTransport;
1817
+ /**
1818
+ * #1508: the payment settles with NO funding leg (erc7710). This method was
1819
+ * written for EIP-3009 and encodes that lifecycle in two places — the
1820
+ * readiness gate wants `confirmed`, and a Haven funding tx hash is
1821
+ * mandatory. Neither is reachable on a scheme where the MERCHANT redeems
1822
+ * the delegation chain: the intent sits at `submitted` by design, and there
1823
+ * is no Haven-submitted transaction at all. Set this to take the
1824
+ * no-funding-leg path through both.
1825
+ */
1826
+ noFundingLeg?: boolean;
1771
1827
  }): Promise<{
1772
1828
  status: number;
1773
1829
  ok: boolean;
@@ -1805,6 +1861,25 @@ declare class HavenClient {
1805
1861
  * small propagation window as a trade-off for not configuring an RPC URL.
1806
1862
  */
1807
1863
  private waitForFundingTx;
1864
+ /**
1865
+ * Can the delegate EOA still fund an authorization for `amountAtomic`?
1866
+ *
1867
+ * #1521: the only question that separates a legitimate resume (funding
1868
+ * confirmed, merchant never paid — the delegate still holds the money) from
1869
+ * a replayed settled payment (funding confirmed, merchant paid, delegate
1870
+ * spent). The intent's own `status: 'confirmed'` is identical in both.
1871
+ *
1872
+ * The balance is asked of the CHAIN rather than of Haven's bookkeeping on
1873
+ * purpose: the merchant-settlement evidence record is written by this SDK
1874
+ * *after* the merchant call, so a client that dies between the two leaves
1875
+ * the backend believing the merchant was never paid — the exact case the
1876
+ * discriminator has to get right. The chain cannot be behind in that way.
1877
+ *
1878
+ * Returns `null` — never a guess — when `chainRpcs` has no entry for the
1879
+ * chain or the read fails. Callers must treat that as "unverifiable", not
1880
+ * as "funded".
1881
+ */
1882
+ private delegateCanFund;
1808
1883
  private throwIfNonSignableAuthorizationState;
1809
1884
  private throwPaymentStateError;
1810
1885
  private paymentStateFromRaw;
@@ -2449,4 +2524,4 @@ declare function discoverMerchantMcpUrl(inputUrl: string): Promise<string | null
2449
2524
  /** Trailing-slash/percent-case echoes compare equal; unparseable never does. */
2450
2525
  declare function sameUrl(a: string, b: string): boolean;
2451
2526
 
2452
- export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, type AgentNextStep, type AgentPaymentEnumSchema, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, type AgentPaymentSummary, type AgentPaymentWarning, AgentPaymentWarningCode, type AgentPurchaseSummary, type ClaudeTool, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, type HavenAgent, type HavenAgentAllowanceSummary, type HavenAgentReadiness, type HavenAgentSummary, type HavenAllowance, type HavenAllowanceSummary, HavenApiError, type HavenCatalogEntry, HavenClient, type HavenClientConfig, HavenError, type HavenPaymentReceipt, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, type MachinePaymentRail, MerchantTimeoutError, type OpenAITool, type PaymentFee, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentReceipt, type PaymentRequest, type PaymentResult, type PaymentResumeState, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, type ResumeAuthorizedX402Input, type ResumeX402PaymentInput, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, type SharedToolKey, type SignData, SignerRefusalCode, type SweepAuthorization, type SweepEip712Domain, type SweepEntry, type SweepExpectedAuth, type SweepPreparation, type SweepPrepareResponse, type SweepResult, type SweepSubmitResponse, type SweepSubmitResult, type SweepTypedData, TRANSFER_WITH_AUTHORIZATION_TYPES, type ToolDescription, type UnsupportedNodeVersionMessageOptions, type X402AuthorizationOptions, type X402Erc7710Settlement, type X402ExpectedAuth, type X402ExpectedContext, type X402Intent, type X402McpCallContext, type X402McpTransport, type X402MerchantCallContext, type X402PaymentHeaderContext, X402PaymentHeaderValidationError, type X402PaymentOption, type X402PaymentRequired, type X402Quote, type X402Receipt, type X402RequestSnapshot, type X402ResumeState, type X402SchemeSelection, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses };
2527
+ export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, type AgentNextStep, type AgentPaymentEnumSchema, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, type AgentPaymentSummary, type AgentPaymentWarning, AgentPaymentWarningCode, type AgentPurchaseSummary, type ClaudeTool, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, type HavenAgent, type HavenAgentAllowanceSummary, type HavenAgentReadiness, type HavenAgentSummary, type HavenAllowance, type HavenAllowanceSummary, HavenApiError, type HavenCatalogEntry, HavenClient, type HavenClientConfig, HavenError, type HavenPaymentReceipt, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, type MachinePaymentRail, MerchantTimeoutError, type OpenAITool, type PaymentFee, type PaymentIntent, type PaymentNextAction, type PaymentPhase, type PaymentReceipt, type PaymentRequest, type PaymentResult, type PaymentResumeState, type PaymentStatus, type PaymentStatusResult, type PendingApproval, type PostPurchaseAllowanceSummary, RECEIPT_VERSION, type ReceiptVerification, type ResumeAuthorizedX402Input, type ResumeX402PaymentInput, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, type SharedToolKey, type SignData, SignerRefusalCode, type SweepAuthorization, type SweepEip712Domain, type SweepEntry, type SweepExpectedAuth, type SweepPreparation, type SweepPrepareResponse, type SweepResult, type SweepSubmitResponse, type SweepSubmitResult, type SweepTypedData, TRANSFER_WITH_AUTHORIZATION_TYPES, type ToolDescription, type UnsupportedNodeVersionMessageOptions, X402AlreadySettledError, type X402AuthorizationOptions, type X402Erc7710Settlement, type X402ExpectedAuth, type X402ExpectedContext, type X402Intent, type X402McpCallContext, type X402McpTransport, type X402MerchantCallContext, type X402PaymentHeaderContext, X402PaymentHeaderValidationError, type X402PaymentOption, type X402PaymentRequired, type X402Quote, type X402Receipt, type X402RequestSnapshot, type X402ResumeState, type X402SchemeSelection, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses };
package/dist/index.js CHANGED
@@ -275,6 +275,17 @@ var X402UnexpectedStatusError = class extends HavenApiError {
275
275
  this.name = "X402UnexpectedStatusError";
276
276
  }
277
277
  };
278
+ var X402AlreadySettledError = class extends HavenApiError {
279
+ constructor(message, receipt, basis) {
280
+ super(message, 409, void 0, receipt.paymentId);
281
+ this.receipt = receipt;
282
+ this.basis = basis;
283
+ this.name = "X402AlreadySettledError";
284
+ }
285
+ receipt;
286
+ basis;
287
+ x402ErrorCode = "already_settled";
288
+ };
278
289
  var HavenPaymentStateError = class extends HavenApiError {
279
290
  constructor(message, statusCode, state, body) {
280
291
  super(message, statusCode, body, state.paymentId);
@@ -951,8 +962,8 @@ function createJsonRpcProvider(url) {
951
962
  function createWallet(privateKey, provider) {
952
963
  return new ethers.Wallet(privateKey, provider);
953
964
  }
954
- function createErc20Contract(address, abi, signer) {
955
- return new ethers.Contract(address, abi, signer);
965
+ function createErc20Contract(address, abi, runner) {
966
+ return new ethers.Contract(address, abi, runner);
956
967
  }
957
968
 
958
969
  // src/client.ts
@@ -1932,7 +1943,6 @@ var HavenClient = class {
1932
1943
  }
1933
1944
  }
1934
1945
  async authorizeStandardX402(paymentRequired, option, idempotencyKey) {
1935
- const paymentHeader = await this.createStandardX402Header(paymentRequired, option);
1936
1946
  const raw = await this.post("/x402", {
1937
1947
  url: paymentRequired.resource.url,
1938
1948
  payTo: this.delegateAddress,
@@ -1947,12 +1957,30 @@ var HavenClient = class {
1947
1957
  // declaration keeps both writers of the 3009 shape loud-by-default.
1948
1958
  settlementScheme: "eip3009"
1949
1959
  });
1960
+ const state = this.paymentStateFromRaw("x402 payment", raw);
1961
+ const executedReplay = raw.success && raw.tx_hash ? "idempotency-collision" : state?.nextAction === AgentPaymentNextAction.RetryOriginalX402Request ? "approval-resume" : null;
1962
+ if (executedReplay) {
1963
+ const canFund = await this.delegateCanFund(
1964
+ raw.chain_id ?? state?.chainId ?? chainIdFromNetwork(option.network),
1965
+ option.asset,
1966
+ x402AuthorizationAmount(option)
1967
+ );
1968
+ const refuse = executedReplay === "idempotency-collision" ? canFund !== true : canFund === false;
1969
+ if (refuse) {
1970
+ const settledReceipt = state && executedReplay === "approval-resume" ? this.mapX402ReceiptFromStatus(paymentRequired, option, void 0, state) : this.mapX402ReceiptFromAuthorization(paymentRequired, option, void 0, raw);
1971
+ throw new X402AlreadySettledError(
1972
+ 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`.",
1973
+ settledReceipt,
1974
+ canFund === false ? "settled" : "unverifiable"
1975
+ );
1976
+ }
1977
+ }
1978
+ const paymentHeader = await this.createStandardX402Header(paymentRequired, option);
1950
1979
  if (raw.success && raw.tx_hash) {
1951
1980
  const receipt2 = this.mapX402ReceiptFromAuthorization(paymentRequired, option, paymentHeader, raw);
1952
1981
  this.cacheX402Receipt(idempotencyKey, paymentHeader, receipt2);
1953
1982
  return receipt2;
1954
1983
  }
1955
- const state = this.paymentStateFromRaw("x402 payment", raw);
1956
1984
  if (state?.nextAction === AgentPaymentNextAction.RetryOriginalX402Request) {
1957
1985
  const receipt2 = this.mapX402ReceiptFromStatus(paymentRequired, option, paymentHeader, state);
1958
1986
  this.cacheX402Receipt(idempotencyKey, paymentHeader, receipt2);
@@ -2133,6 +2161,18 @@ var HavenClient = class {
2133
2161
  if (cached && cached.expiresAt > Date.now()) return cached.receipt;
2134
2162
  const status = await this.getPaymentStatus(input.paymentId);
2135
2163
  this.assertCanResumeX402(status, input.paymentRequired, option);
2164
+ const canFund = await this.delegateCanFund(
2165
+ status.chainId ?? chainIdFromNetwork(option.network),
2166
+ option.asset,
2167
+ x402AuthorizationAmount(option)
2168
+ );
2169
+ if (canFund === false) {
2170
+ throw new X402AlreadySettledError(
2171
+ `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.`,
2172
+ this.mapX402ReceiptFromStatus(input.paymentRequired, option, void 0, status),
2173
+ "settled"
2174
+ );
2175
+ }
2136
2176
  const paymentHeader = await this.createStandardX402Header(input.paymentRequired, option);
2137
2177
  const receipt = this.mapX402ReceiptFromStatus(input.paymentRequired, option, paymentHeader, status);
2138
2178
  this.cacheX402Receipt(idempotencyKey, paymentHeader, receipt);
@@ -2463,8 +2503,18 @@ var HavenClient = class {
2463
2503
  * balance — otherwise it rejects with "Payment verification failed". The
2464
2504
  * SDK's local path already does this (see authorizeStandardX402); the hosted
2465
2505
  * split flow regressed when the 5→3 collapse removed the incidental
2466
- * inter-call latency that used to mask it. No-op when the funding tx hash or
2467
- * a chain RPC (chainRpcs[chainId]) is unavailable.
2506
+ * inter-call latency that used to mask it.
2507
+ *
2508
+ * **NOT a no-op when the funding tx hash is absent** (#1508). The WAIT is
2509
+ * skipped without a hash or a chain RPC, but the `GET /payments/:id` read
2510
+ * below runs UNCONDITIONALLY — it is how the fallback hash and the chainId
2511
+ * are obtained. That distinction is load-bearing: this method must never be
2512
+ * called on a scheme with no funding leg, because the read itself fails once
2513
+ * the intent reaches a status the backend maps to a non-2xx (`submitted` is a
2514
+ * 409), turning a settled payment into a reported error. The previous wording
2515
+ * here said "No-op when the funding tx hash ... is unavailable", and the
2516
+ * hosted erc7710 path was written against that promise — see
2517
+ * `deliverMerchantPayment`'s `noFundingLeg` option.
2468
2518
  */
2469
2519
  async ensureFundingConfirmed(paymentId, fundingTxHash) {
2470
2520
  const status = await this.getPaymentStatus(paymentId);
@@ -2473,8 +2523,10 @@ var HavenClient = class {
2473
2523
  async completeX402MerchantCall(input) {
2474
2524
  const evidenceContext = await this.resolveX402MerchantCompletionContext({
2475
2525
  paymentId: input.paymentId,
2476
- url: input.url
2526
+ url: input.url,
2527
+ noFundingLeg: input.noFundingLeg === true
2477
2528
  });
2529
+ const fundingTxHash = evidenceContext.txHash;
2478
2530
  const shouldHandshakeMcp = isMcpUrl(input.url) || input.mcpTransport?.handshakeRequired === true;
2479
2531
  const x402Wallet = shouldHandshakeMcp ? await this.resolveX402WalletForMerchantCall() : this.x402PayerAddress();
2480
2532
  let mcpSessionId;
@@ -2498,33 +2550,37 @@ var HavenClient = class {
2498
2550
  body = text;
2499
2551
  }
2500
2552
  if (!surfaced.ok) {
2501
- await this.recordMerchantRetryRejected({
2502
- rail: "x402",
2503
- paymentId: evidenceContext.paymentId,
2504
- txHash: evidenceContext.txHash,
2505
- resourceUrl: evidenceContext.resourceUrl,
2506
- merchant: {
2507
- merchant_status: surfaced.status,
2508
- merchant_status_text: surfaced.statusText,
2509
- merchant_headers: Object.fromEntries(surfaced.headers.entries()),
2510
- merchant_body: text
2511
- },
2512
- details: {
2513
- merchant_to: evidenceContext.merchantAddress
2514
- }
2515
- });
2553
+ if (!input.noFundingLeg && fundingTxHash) {
2554
+ await this.recordMerchantRetryRejected({
2555
+ rail: "x402",
2556
+ paymentId: evidenceContext.paymentId,
2557
+ txHash: fundingTxHash,
2558
+ resourceUrl: evidenceContext.resourceUrl,
2559
+ merchant: {
2560
+ merchant_status: surfaced.status,
2561
+ merchant_status_text: surfaced.statusText,
2562
+ merchant_headers: Object.fromEntries(surfaced.headers.entries()),
2563
+ merchant_body: text
2564
+ },
2565
+ details: {
2566
+ merchant_to: evidenceContext.merchantAddress
2567
+ }
2568
+ });
2569
+ }
2516
2570
  } else {
2517
- await this.reportMachinePaymentEvidence({
2518
- paymentId: evidenceContext.paymentId,
2519
- rail: "x402",
2520
- txHash: evidenceContext.txHash,
2521
- resourceUrl: evidenceContext.resourceUrl,
2522
- merchantStatus: surfaced.status,
2523
- paymentProofHeaderName: "X-PAYMENT",
2524
- paymentProofHeader: input.paymentHeader,
2525
- protocolReceiptHeaderName: protocolReceiptHeader ? "PAYMENT-RESPONSE" : void 0,
2526
- protocolReceiptHeader
2527
- });
2571
+ if (!input.noFundingLeg && fundingTxHash) {
2572
+ await this.reportMachinePaymentEvidence({
2573
+ paymentId: evidenceContext.paymentId,
2574
+ rail: "x402",
2575
+ txHash: fundingTxHash,
2576
+ resourceUrl: evidenceContext.resourceUrl,
2577
+ merchantStatus: surfaced.status,
2578
+ paymentProofHeaderName: "X-PAYMENT",
2579
+ paymentProofHeader: input.paymentHeader,
2580
+ protocolReceiptHeaderName: protocolReceiptHeader ? "PAYMENT-RESPONSE" : void 0,
2581
+ protocolReceiptHeader
2582
+ });
2583
+ }
2528
2584
  await this.reportMerchantReceipt(evidenceContext.paymentId, surfaced);
2529
2585
  }
2530
2586
  return {
@@ -2570,11 +2626,11 @@ var HavenClient = class {
2570
2626
  status
2571
2627
  );
2572
2628
  }
2573
- const readyForMerchantCompletion = status.nextAction === AgentPaymentNextAction.RetryOriginalX402Request || status.kind === "payment_intent" && status.status === "confirmed" && status.phase === AgentPaymentPhase.PaymentConfirmed && status.nextAction === AgentPaymentNextAction.None;
2629
+ const readyForMerchantCompletion = input.noFundingLeg ? status.kind === "payment_intent" && status.status === "submitted" : status.nextAction === AgentPaymentNextAction.RetryOriginalX402Request || status.kind === "payment_intent" && status.status === "confirmed" && status.phase === AgentPaymentPhase.PaymentConfirmed && status.nextAction === AgentPaymentNextAction.None;
2574
2630
  if (!readyForMerchantCompletion) {
2575
2631
  throw new HavenPaymentStateError(status.message, PAYMENT_STATE_STATUS_CODES[status.status] ?? 409, status);
2576
2632
  }
2577
- if (!status.txHash) {
2633
+ if (!input.noFundingLeg && !status.txHash) {
2578
2634
  throw new HavenApiError(
2579
2635
  `x402 payment ${status.paymentId} is ready for merchant completion but has no Haven transaction hash.`,
2580
2636
  502,
@@ -2844,6 +2900,45 @@ var HavenClient = class {
2844
2900
  );
2845
2901
  }
2846
2902
  }
2903
+ /**
2904
+ * Can the delegate EOA still fund an authorization for `amountAtomic`?
2905
+ *
2906
+ * #1521: the only question that separates a legitimate resume (funding
2907
+ * confirmed, merchant never paid — the delegate still holds the money) from
2908
+ * a replayed settled payment (funding confirmed, merchant paid, delegate
2909
+ * spent). The intent's own `status: 'confirmed'` is identical in both.
2910
+ *
2911
+ * The balance is asked of the CHAIN rather than of Haven's bookkeeping on
2912
+ * purpose: the merchant-settlement evidence record is written by this SDK
2913
+ * *after* the merchant call, so a client that dies between the two leaves
2914
+ * the backend believing the merchant was never paid — the exact case the
2915
+ * discriminator has to get right. The chain cannot be behind in that way.
2916
+ *
2917
+ * Returns `null` — never a guess — when `chainRpcs` has no entry for the
2918
+ * chain or the read fails. Callers must treat that as "unverifiable", not
2919
+ * as "funded".
2920
+ */
2921
+ async delegateCanFund(chainId, tokenAddress, amountAtomic, timeoutMs = 1e4) {
2922
+ if (!chainId || !this.delegateAddress) return null;
2923
+ const rpcUrl = this.chainRpcs[chainId];
2924
+ if (!rpcUrl) return null;
2925
+ try {
2926
+ const provider = createJsonRpcProvider(rpcUrl);
2927
+ const token = createErc20Contract(
2928
+ tokenAddress,
2929
+ ["function balanceOf(address) view returns (uint256)"],
2930
+ provider
2931
+ );
2932
+ const balance = await Promise.race([
2933
+ token.balanceOf(this.delegateAddress),
2934
+ new Promise((resolve) => setTimeout(() => resolve(null), timeoutMs).unref?.())
2935
+ ]);
2936
+ if (balance === null) return null;
2937
+ return balance >= BigInt(amountAtomic);
2938
+ } catch {
2939
+ return null;
2940
+ }
2941
+ }
2847
2942
  throwIfNonSignableAuthorizationState(label, raw) {
2848
2943
  if (raw.status === "pending_signature") return;
2849
2944
  this.throwPaymentStateError(label, raw);
@@ -4024,6 +4119,6 @@ function sameUrl(a, b) {
4024
4119
  }
4025
4120
  }
4026
4121
 
4027
- export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, HavenApiError, HavenClient, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, MerchantTimeoutError, RECEIPT_VERSION, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, SignerRefusalCode, TRANSFER_WITH_AUTHORIZATION_TYPES, X402PaymentHeaderValidationError, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses };
4122
+ export { AGENT_PAYMENT_FAILURE_CODE_VALUES, AGENT_PAYMENT_NEXT_ACTION_VALUES, AGENT_PAYMENT_PHASE_VALUES, AGENT_PAYMENT_RAIL_VALUES, AgentPaymentFailureCode, AgentPaymentFailureCodeDescriptions, AgentPaymentFailureCodeSchema, AgentPaymentNextAction, AgentPaymentNextActionDescriptions, AgentPaymentNextActionSchema, AgentPaymentPhase, AgentPaymentPhaseDescriptions, AgentPaymentPhaseSchema, AgentPaymentRail, AgentPaymentRailDescriptions, AgentPaymentRailSchema, AgentPaymentWarningCode, DISCOVERY_MAX_BYTES, ERC7710_ASSET_TRANSFER_METHOD, HAVEN_MINIMUM_NODE_VERSION, HAVEN_SKILL_BODY_MD, HAVEN_SKILL_MD, HavenApiError, HavenClient, HavenError, HavenPaymentStateError, HavenSigningError, HavenTimeoutError, HavenUnsupportedSignerVersionError, MERCHANT_DISCOVERY_PATHS, MerchantTimeoutError, RECEIPT_VERSION, SIGNER_UPDATE_FALLBACK, SKILL_FOLDER_NAME, SWEEP_BASE_CHAIN_ID, SWEEP_BASE_SEPOLIA_CHAIN_ID, SWEEP_BASE_SEPOLIA_USDC_ADDRESS, SWEEP_BASE_USDC_ADDRESS, SignerRefusalCode, TRANSFER_WITH_AUTHORIZATION_TYPES, X402AlreadySettledError, X402PaymentHeaderValidationError, X402UnexpectedStatusError, X402_MAX_AUTHORIZATION_WINDOW_SECONDS, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS, addressFromKey, buildSweepAuthorizationMessage, buildSweepTypedData, buildX402ExpectedMessage, compareNodeVersions, composeDescription, decodeBase64Json, decodeBase64Utf8, discoverMerchantMcpUrl, encodeBase64Json, encodeBase64Utf8, encodePaymentProof, havenTools, isErc7710Option, isSupportedNodeVersion, isSweepableChain, normalizePaymentRequired, parsePaymentRequired, parsePaymentRequiredResponse, resolveTokenFromAddress, sameUrl, selectErc7710PaymentOption, selectPaymentOption, selectStandardPaymentOption, selectX402SettlementScheme, signHash, signUserOpTypedDataForDelegation, sweepUsdcAddress, sweepUsdcDomain, toStandardPaymentRequirements, toolDescriptions, unsupportedNodeVersionMessage, validateStandardX402PaymentHeader, verifyPaymentReceipt, verifySignature, x402AssetTransferMethod, x402AuthorizationAmount, x402FacilitatorAddresses };
4028
4123
  //# sourceMappingURL=index.js.map
4029
4124
  //# sourceMappingURL=index.js.map