@haven_ai/sdk 0.0.0-dev.202609272032.679e797 → 0.0.0-dev.202609281736.4aa027b
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/{base64-uq8A2tP_.d.cts → base64-DDWvAiAE.d.cts} +38 -3
- package/dist/{base64-uq8A2tP_.d.ts → base64-DDWvAiAE.d.ts} +38 -3
- package/dist/{chunk-U4DQ3APD.cjs → chunk-6ZVB7XDK.cjs} +36 -29
- package/dist/chunk-6ZVB7XDK.cjs.map +1 -0
- package/dist/{chunk-VJA3OQWY.cjs → chunk-M7BXKTBK.cjs} +7 -3
- package/dist/chunk-M7BXKTBK.cjs.map +1 -0
- package/dist/{chunk-BVNBYB7Q.js → chunk-PIE7TV5C.js} +11 -5
- package/dist/chunk-PIE7TV5C.js.map +1 -0
- package/dist/{chunk-USEZLMWK.js → chunk-XH4WMOAM.js} +7 -4
- package/dist/chunk-XH4WMOAM.js.map +1 -0
- package/dist/edge.cjs +68 -64
- package/dist/edge.d.cts +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/edge.js +3 -3
- package/dist/index.cjs +306 -289
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/test-support.cjs +18 -18
- package/dist/test-support.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BVNBYB7Q.js.map +0 -1
- package/dist/chunk-U4DQ3APD.cjs.map +0 -1
- package/dist/chunk-USEZLMWK.js.map +0 -1
- package/dist/chunk-VJA3OQWY.cjs.map +0 -1
|
@@ -697,7 +697,7 @@ interface HavenAgentAllowanceSummary {
|
|
|
697
697
|
remainingAtomic: string;
|
|
698
698
|
/** Human-readable remaining, e.g. "4.96 USDC". */
|
|
699
699
|
remainingDisplay: string;
|
|
700
|
-
/** Configured allowance amount (atomic
|
|
700
|
+
/** Configured allowance amount in whole token units (human decimal, e.g. "1.00" — NOT atomic; on-chain.amount is the atomic figure). */
|
|
701
701
|
configuredAmount: string;
|
|
702
702
|
resetPeriodMin: number;
|
|
703
703
|
isResetPending: boolean;
|
|
@@ -1969,7 +1969,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
|
|
|
1969
1969
|
* This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
|
|
1970
1970
|
* it with the package version on every release — never hand-edit it.
|
|
1971
1971
|
*/
|
|
1972
|
-
declare const SDK_VERSION = "0.0.0-dev.
|
|
1972
|
+
declare const SDK_VERSION = "0.0.0-dev.202609281736.4aa027b";
|
|
1973
1973
|
/** The request header every published Haven client sends. */
|
|
1974
1974
|
declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
|
|
1975
1975
|
/** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
|
|
@@ -2188,6 +2188,28 @@ declare function connectorRerunCommand(args?: string, options?: {
|
|
|
2188
2188
|
channel?: string;
|
|
2189
2189
|
npxFlags?: string;
|
|
2190
2190
|
}): string;
|
|
2191
|
+
/**
|
|
2192
|
+
* The command every UPGRADE hint names (#3412): `npx -y @haven_ai/connect@<channel> --doctor`.
|
|
2193
|
+
*
|
|
2194
|
+
* A bare connector re-run is a SETUP command — on a machine that is already
|
|
2195
|
+
* set up it stops at "Missing --setup <hv_setup_...> setup token", so an
|
|
2196
|
+
* outdated signer, local MCP or connector told to "re-run the connector" was
|
|
2197
|
+
* handed a dead end. The flagless doctor works as pasted on an existing
|
|
2198
|
+
* install (#3210: it resolves the runtime from the setup record), diagnoses an
|
|
2199
|
+
* outdated signer, and prints the exact `--doctor --repair` line for the agent
|
|
2200
|
+
* it describes — with `--credentials-dir` whenever more than one agent lives on
|
|
2201
|
+
* the machine, so the repair cannot land on a different agent.
|
|
2202
|
+
*
|
|
2203
|
+
* `-y` because an upgrade hint is often run by an agent in a non-interactive
|
|
2204
|
+
* shell. `@haven_ai/core`'s `upgradeCommandFor` (the backend's
|
|
2205
|
+
* `client_update.upgrade_command`) cannot import this package, so it carries a
|
|
2206
|
+
* copy; `packages/backend/src/__tests__/connector-upgrade-command-parity.test.ts`
|
|
2207
|
+
* fails if the two ever disagree. Setup-time hints (identity restore,
|
|
2208
|
+
* mid-setup retry) legitimately stay on {@link connectorRerunCommand}.
|
|
2209
|
+
*/
|
|
2210
|
+
declare function connectorUpgradeCommand(options?: {
|
|
2211
|
+
channel?: string;
|
|
2212
|
+
}): string;
|
|
2191
2213
|
|
|
2192
2214
|
/**
|
|
2193
2215
|
* The Node.js floor Haven's published packages support (#1161).
|
|
@@ -2540,6 +2562,19 @@ declare function resolveTokenFromAddress(address: string, network?: string): {
|
|
|
2540
2562
|
symbol: string;
|
|
2541
2563
|
decimals: number;
|
|
2542
2564
|
} | null;
|
|
2565
|
+
/**
|
|
2566
|
+
* #3410: token decimals from a SYMBOL + CHAIN — the same registry
|
|
2567
|
+
* `resolveTokenFromAddress` reads, keyed the other way. The address-based
|
|
2568
|
+
* resolver needs the token's contract address, which the consent seed path
|
|
2569
|
+
* (setup-time credential files) does not carry; the symbol and chain it does
|
|
2570
|
+
* carry. Null when the symbol is not registered on that chain (unknown or
|
|
2571
|
+
* custom tokens) — callers must fall back to an explicit atomic label rather
|
|
2572
|
+
* than reading an atomic amount as whole tokens.
|
|
2573
|
+
*/
|
|
2574
|
+
declare function resolveTokenBySymbol(chainId: number, symbol: string): {
|
|
2575
|
+
symbol: string;
|
|
2576
|
+
decimals: number;
|
|
2577
|
+
} | null;
|
|
2543
2578
|
|
|
2544
2579
|
/**
|
|
2545
2580
|
* #3271: the integrity check every client runs before signing a direct
|
|
@@ -3023,4 +3058,4 @@ declare function encodeBase64Json(value: unknown): string;
|
|
|
3023
3058
|
*/
|
|
3024
3059
|
declare function decodeBase64Json<T>(value: string, label?: string): T;
|
|
3025
3060
|
|
|
3026
|
-
export { AgentPaymentPhase as $, type AgentPaymentWarning as A, type ResumeAuthorizedX402Input as B, type CloseTaskBudgetResult as C, type ResumeX402PaymentInput as D, type X402ResumeState as E, type X402McpTransport as F, type X402MerchantCallContext as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, AGENT_PAYMENT_RAIL_VALUES as M, type AgentNextStep as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentPaymentEnumSchema as Q, type RawPaymentParties as R, type SweepResult as S, type TaskBudgetSignContext as T, AgentPaymentFailureCode as U, AgentPaymentFailureCodeDescriptions as V, AgentPaymentFailureCodeSchema as W, type X402PaymentRequired as X, AgentPaymentNextAction as Y, AgentPaymentNextActionDescriptions as Z, AgentPaymentNextActionSchema as _, type HavenClientUpdate as a, type SweepExpectedAuth as a$, AgentPaymentPhaseDescriptions as a0, AgentPaymentPhaseSchema as a1, AgentPaymentRail as a2, AgentPaymentRailDescriptions as a3, AgentPaymentRailSchema as a4, type AgentPaymentSummary as a5, AgentPaymentWarningCode as a6, type AgentPurchaseSummary as a7, CONNECTOR_PACKAGE_NAME as a8, type CatalogSubmissionAccepted as a9, NEXT_TOOL_SERVER_NAMES as aA, NEXT_TOOL_SERVER_ROLES as aB, type NextStep as aC, type NextStepArguments as aD, type NextStepHandoff as aE, type NextStepInput as aF, type NextStepTarget as aG, type NextStepTargets as aH, type NextToolServerRole as aI, PACKED_USER_OPERATION_FIELDS as aJ, type PaymentFee as aK, type PaymentNextAction as aL, type PaymentPhase as aM, type PaymentStatus as aN, ROOT_AUTHORITY as aO, SDK_CLIENT_IDENTITY as aP, SDK_VERSION as aQ, SIGNER_UPDATE_FALLBACK as aR, SWEEP_BASE_CHAIN_ID as aS, SWEEP_BASE_SEPOLIA_CHAIN_ID as aT, SWEEP_BASE_SEPOLIA_USDC_ADDRESS as aU, SWEEP_BASE_USDC_ADDRESS as aV, type SettlementChildExpectation as aW, SignerRefusalCode as aX, type SweepConfirmation as aY, type SweepEip712Domain as aZ, type SweepEntry as a_, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, DEFAULT_NEXT_TOOL_BY_ACTION as ab, DIRECT_SIGN_CONTEXT_VERSION as ac, ENTRY_POINT_V07 as ad, ERC7710_ASSET_TRANSFER_METHOD as ae, HAVEN_CLIENT_HEADER as af, HAVEN_CONNECTOR_CHANNEL as ag, HAVEN_MINIMUM_NODE_VERSION as ah, HYBRID_DELEGATOR_DOMAIN_NAME as ai, HYBRID_DELEGATOR_DOMAIN_VERSION as aj, type HavenAgentAllowanceSummary as ak, type HavenAgentReadiness as al, type HavenAllowance as am, HavenApiError as an, type HavenCatalogMerchant as ao, type HavenListScope as ap, HavenPaymentStateError as aq, HavenSigningError as ar, HavenTimeoutError as as, HavenTypedDataRefusedError as at, HavenUnsupportedSignerVersionError as au, HavenUserOpBindingError as av, HavenZeroSettlementHashError as aw, MAX_TASK_BUDGET_TTL_SECONDS as ax, type MachinePaymentRail as ay, MerchantTimeoutError as az, type PaymentResult as b,
|
|
3061
|
+
export { AgentPaymentPhase as $, type AgentPaymentWarning as A, type ResumeAuthorizedX402Input as B, type CloseTaskBudgetResult as C, type ResumeX402PaymentInput as D, type X402ResumeState as E, type X402McpTransport as F, type X402MerchantCallContext as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, AGENT_PAYMENT_RAIL_VALUES as M, type AgentNextStep as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentPaymentEnumSchema as Q, type RawPaymentParties as R, type SweepResult as S, type TaskBudgetSignContext as T, AgentPaymentFailureCode as U, AgentPaymentFailureCodeDescriptions as V, AgentPaymentFailureCodeSchema as W, type X402PaymentRequired as X, AgentPaymentNextAction as Y, AgentPaymentNextActionDescriptions as Z, AgentPaymentNextActionSchema as _, type HavenClientUpdate as a, type SweepExpectedAuth as a$, AgentPaymentPhaseDescriptions as a0, AgentPaymentPhaseSchema as a1, AgentPaymentRail as a2, AgentPaymentRailDescriptions as a3, AgentPaymentRailSchema as a4, type AgentPaymentSummary as a5, AgentPaymentWarningCode as a6, type AgentPurchaseSummary as a7, CONNECTOR_PACKAGE_NAME as a8, type CatalogSubmissionAccepted as a9, NEXT_TOOL_SERVER_NAMES as aA, NEXT_TOOL_SERVER_ROLES as aB, type NextStep as aC, type NextStepArguments as aD, type NextStepHandoff as aE, type NextStepInput as aF, type NextStepTarget as aG, type NextStepTargets as aH, type NextToolServerRole as aI, PACKED_USER_OPERATION_FIELDS as aJ, type PaymentFee as aK, type PaymentNextAction as aL, type PaymentPhase as aM, type PaymentStatus as aN, ROOT_AUTHORITY as aO, SDK_CLIENT_IDENTITY as aP, SDK_VERSION as aQ, SIGNER_UPDATE_FALLBACK as aR, SWEEP_BASE_CHAIN_ID as aS, SWEEP_BASE_SEPOLIA_CHAIN_ID as aT, SWEEP_BASE_SEPOLIA_USDC_ADDRESS as aU, SWEEP_BASE_USDC_ADDRESS as aV, type SettlementChildExpectation as aW, SignerRefusalCode as aX, type SweepConfirmation as aY, type SweepEip712Domain as aZ, type SweepEntry as a_, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, DEFAULT_NEXT_TOOL_BY_ACTION as ab, DIRECT_SIGN_CONTEXT_VERSION as ac, ENTRY_POINT_V07 as ad, ERC7710_ASSET_TRANSFER_METHOD as ae, HAVEN_CLIENT_HEADER as af, HAVEN_CONNECTOR_CHANNEL as ag, HAVEN_MINIMUM_NODE_VERSION as ah, HYBRID_DELEGATOR_DOMAIN_NAME as ai, HYBRID_DELEGATOR_DOMAIN_VERSION as aj, type HavenAgentAllowanceSummary as ak, type HavenAgentReadiness as al, type HavenAllowance as am, HavenApiError as an, type HavenCatalogMerchant as ao, type HavenListScope as ap, HavenPaymentStateError as aq, HavenSigningError as ar, HavenTimeoutError as as, HavenTypedDataRefusedError as at, HavenUnsupportedSignerVersionError as au, HavenUserOpBindingError as av, HavenZeroSettlementHashError as aw, MAX_TASK_BUDGET_TTL_SECONDS as ax, type MachinePaymentRail as ay, MerchantTimeoutError as az, type PaymentResult as b, selectErc7710PaymentOption as b$, type SweepPreparation as b0, type SweepSubmitResult as b1, type SweepTypedData as b2, TRANSFER_WITH_AUTHORIZATION_TYPES as b3, TYPED_DATA_NOT_ALLOWED as b4, type TaskBudgetCloseExpectation as b5, type TaskChildExpectation as b6, type TaskChildTypedData as b7, type UnsupportedNodeVersionMessageOptions as b8, X402AlreadySettledError as b9, connectorUpgradeCommand as bA, createNextStepBuilder as bB, decodeBase64Json as bC, decodeBase64Utf8 as bD, defaultNextToolFor as bE, deriveDelegateAccountAddress as bF, encodeBase64Json as bG, encodeBase64Utf8 as bH, encodePaymentProof as bI, hashDelegation as bJ, havenClientIdentity as bK, isConnectorChannel as bL, isErc7710Option as bM, isPackedUserOperationTypedData as bN, isSupportedNodeVersion as bO, isSweepableChain as bP, isTaskChildTypedData as bQ, normalizePaymentRequired as bR, packedUserOperationHash as bS, parseNextTool as bT, parsePaymentRequired as bU, parsePaymentRequiredResponse as bV, readClientUpdate as bW, renderNextTool as bX, resolveConnectorChannel as bY, resolveTokenBySymbol as bZ, resolveTokenFromAddress as b_, type X402ExpectedAuth as ba, type X402ExpectedContext as bb, type X402PaymentHeaderContext as bc, X402PaymentHeaderValidationError as bd, type X402PaymentOption as be, type X402RequestSnapshot as bf, type X402SchemeSelection as bg, X402TaskBudgetMismatchError as bh, X402UnexpectedStatusError as bi, X402_LEGACY_PAYMENT_HEADER_NAME as bj, X402_MAX_AUTHORIZATION_WINDOW_SECONDS as bk, X402_PAYMENT_HEADER_NAME as bl, X402_PAYMENT_HEADER_NAMES_SENT as bm, X402_PAYMENT_REQUIRED_HEADER_NAME as bn, X402_PAYMENT_RESPONSE_HEADER_NAME as bo, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS as bp, assertBoundDirectPaymentUserOp as bq, assertOwnTaskBudgetCloseUserOp as br, assertOwnTaskChild as bs, assertUserOpTypedDataBinding as bt, buildSweepAuthorizationMessage as bu, buildSweepTypedData as bv, buildX402ExpectedMessage as bw, compareNodeVersions as bx, connectorRerunCommand as by, connectorSpec as bz, type PaymentIntent as c, selectPaymentOption as c0, selectStandardPaymentOption as c1, selectX402SettlementScheme as c2, signerUpdateFallback as c3, sweepUsdcAddress as c4, sweepUsdcDomain as c5, toStandardPaymentRequirements as c6, unsupportedNodeVersionMessage as c7, validateStandardX402PaymentHeader as c8, verifySettlementChild as c9, x402AssetTransferMethod as ca, x402AuthorizationAmount as cb, x402FacilitatorAddresses as cc, x402V2PaymentEnvelope as cd, CAVEAT_ENFORCERS as ce, CAVEAT_TYPEHASH as cf, DELEGATION_MANAGER as cg, DELEGATION_TYPEHASH as ch, DIRECT_PAYMENT_CHAIN_IDS as ci, type DelegationForHashing as cj, EXECUTE_ABI as ck, HYBRID_DELEGATOR_IMPLEMENTATION as cl, MAX_SETTLEMENT_WINDOW_SECONDS as cm, SIMPLE_FACTORY_ADDRESS as cn, type SettlementChildTypedData as co, assertFundingLegPaysDelegate as cp, assertOwnSettlementChild as cq, chainIdForNetwork as cr, isSettlementChildTypedData as cs, type X402AuthorizationOptions as d, type X402Intent as e, type PaymentStatusResult as f, type HavenAgent as g, type HavenAgentSummary as h, type SweepPrepareResponse as i, type SweepAuthorization as j, type SweepSubmitResponse as k, type HavenAllowanceSummary as l, type HavenBalanceCoverage as m, type PostPurchaseAllowanceSummary as n, type HavenCatalogEntry as o, type HavenCatalogSubmission as p, type HavenPaymentReceipt as q, type HavenPaymentReceiptsPage as r, type HavenTaskBudget as s, type SubmitTaskBudgetResult as t, type PaymentResumeState as u, type X402Receipt as v, type X402Quote as w, type X402Erc7710Settlement as x, type X402McpCallContext as y, type SignData as z };
|
|
@@ -697,7 +697,7 @@ interface HavenAgentAllowanceSummary {
|
|
|
697
697
|
remainingAtomic: string;
|
|
698
698
|
/** Human-readable remaining, e.g. "4.96 USDC". */
|
|
699
699
|
remainingDisplay: string;
|
|
700
|
-
/** Configured allowance amount (atomic
|
|
700
|
+
/** Configured allowance amount in whole token units (human decimal, e.g. "1.00" — NOT atomic; on-chain.amount is the atomic figure). */
|
|
701
701
|
configuredAmount: string;
|
|
702
702
|
resetPeriodMin: number;
|
|
703
703
|
isResetPending: boolean;
|
|
@@ -1969,7 +1969,7 @@ declare function buildSweepAuthorizationMessage(auth: SweepAuthorization): strin
|
|
|
1969
1969
|
* This SDK's own version. Owned by `scripts/release-bump.mjs`, which rewrites
|
|
1970
1970
|
* it with the package version on every release — never hand-edit it.
|
|
1971
1971
|
*/
|
|
1972
|
-
declare const SDK_VERSION = "0.0.0-dev.
|
|
1972
|
+
declare const SDK_VERSION = "0.0.0-dev.202609281736.4aa027b";
|
|
1973
1973
|
/** The request header every published Haven client sends. */
|
|
1974
1974
|
declare const HAVEN_CLIENT_HEADER = "X-Haven-Client";
|
|
1975
1975
|
/** `<package>/<version>` — the value of {@link HAVEN_CLIENT_HEADER}. */
|
|
@@ -2188,6 +2188,28 @@ declare function connectorRerunCommand(args?: string, options?: {
|
|
|
2188
2188
|
channel?: string;
|
|
2189
2189
|
npxFlags?: string;
|
|
2190
2190
|
}): string;
|
|
2191
|
+
/**
|
|
2192
|
+
* The command every UPGRADE hint names (#3412): `npx -y @haven_ai/connect@<channel> --doctor`.
|
|
2193
|
+
*
|
|
2194
|
+
* A bare connector re-run is a SETUP command — on a machine that is already
|
|
2195
|
+
* set up it stops at "Missing --setup <hv_setup_...> setup token", so an
|
|
2196
|
+
* outdated signer, local MCP or connector told to "re-run the connector" was
|
|
2197
|
+
* handed a dead end. The flagless doctor works as pasted on an existing
|
|
2198
|
+
* install (#3210: it resolves the runtime from the setup record), diagnoses an
|
|
2199
|
+
* outdated signer, and prints the exact `--doctor --repair` line for the agent
|
|
2200
|
+
* it describes — with `--credentials-dir` whenever more than one agent lives on
|
|
2201
|
+
* the machine, so the repair cannot land on a different agent.
|
|
2202
|
+
*
|
|
2203
|
+
* `-y` because an upgrade hint is often run by an agent in a non-interactive
|
|
2204
|
+
* shell. `@haven_ai/core`'s `upgradeCommandFor` (the backend's
|
|
2205
|
+
* `client_update.upgrade_command`) cannot import this package, so it carries a
|
|
2206
|
+
* copy; `packages/backend/src/__tests__/connector-upgrade-command-parity.test.ts`
|
|
2207
|
+
* fails if the two ever disagree. Setup-time hints (identity restore,
|
|
2208
|
+
* mid-setup retry) legitimately stay on {@link connectorRerunCommand}.
|
|
2209
|
+
*/
|
|
2210
|
+
declare function connectorUpgradeCommand(options?: {
|
|
2211
|
+
channel?: string;
|
|
2212
|
+
}): string;
|
|
2191
2213
|
|
|
2192
2214
|
/**
|
|
2193
2215
|
* The Node.js floor Haven's published packages support (#1161).
|
|
@@ -2540,6 +2562,19 @@ declare function resolveTokenFromAddress(address: string, network?: string): {
|
|
|
2540
2562
|
symbol: string;
|
|
2541
2563
|
decimals: number;
|
|
2542
2564
|
} | null;
|
|
2565
|
+
/**
|
|
2566
|
+
* #3410: token decimals from a SYMBOL + CHAIN — the same registry
|
|
2567
|
+
* `resolveTokenFromAddress` reads, keyed the other way. The address-based
|
|
2568
|
+
* resolver needs the token's contract address, which the consent seed path
|
|
2569
|
+
* (setup-time credential files) does not carry; the symbol and chain it does
|
|
2570
|
+
* carry. Null when the symbol is not registered on that chain (unknown or
|
|
2571
|
+
* custom tokens) — callers must fall back to an explicit atomic label rather
|
|
2572
|
+
* than reading an atomic amount as whole tokens.
|
|
2573
|
+
*/
|
|
2574
|
+
declare function resolveTokenBySymbol(chainId: number, symbol: string): {
|
|
2575
|
+
symbol: string;
|
|
2576
|
+
decimals: number;
|
|
2577
|
+
} | null;
|
|
2543
2578
|
|
|
2544
2579
|
/**
|
|
2545
2580
|
* #3271: the integrity check every client runs before signing a direct
|
|
@@ -3023,4 +3058,4 @@ declare function encodeBase64Json(value: unknown): string;
|
|
|
3023
3058
|
*/
|
|
3024
3059
|
declare function decodeBase64Json<T>(value: string, label?: string): T;
|
|
3025
3060
|
|
|
3026
|
-
export { AgentPaymentPhase as $, type AgentPaymentWarning as A, type ResumeAuthorizedX402Input as B, type CloseTaskBudgetResult as C, type ResumeX402PaymentInput as D, type X402ResumeState as E, type X402McpTransport as F, type X402MerchantCallContext as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, AGENT_PAYMENT_RAIL_VALUES as M, type AgentNextStep as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentPaymentEnumSchema as Q, type RawPaymentParties as R, type SweepResult as S, type TaskBudgetSignContext as T, AgentPaymentFailureCode as U, AgentPaymentFailureCodeDescriptions as V, AgentPaymentFailureCodeSchema as W, type X402PaymentRequired as X, AgentPaymentNextAction as Y, AgentPaymentNextActionDescriptions as Z, AgentPaymentNextActionSchema as _, type HavenClientUpdate as a, type SweepExpectedAuth as a$, AgentPaymentPhaseDescriptions as a0, AgentPaymentPhaseSchema as a1, AgentPaymentRail as a2, AgentPaymentRailDescriptions as a3, AgentPaymentRailSchema as a4, type AgentPaymentSummary as a5, AgentPaymentWarningCode as a6, type AgentPurchaseSummary as a7, CONNECTOR_PACKAGE_NAME as a8, type CatalogSubmissionAccepted as a9, NEXT_TOOL_SERVER_NAMES as aA, NEXT_TOOL_SERVER_ROLES as aB, type NextStep as aC, type NextStepArguments as aD, type NextStepHandoff as aE, type NextStepInput as aF, type NextStepTarget as aG, type NextStepTargets as aH, type NextToolServerRole as aI, PACKED_USER_OPERATION_FIELDS as aJ, type PaymentFee as aK, type PaymentNextAction as aL, type PaymentPhase as aM, type PaymentStatus as aN, ROOT_AUTHORITY as aO, SDK_CLIENT_IDENTITY as aP, SDK_VERSION as aQ, SIGNER_UPDATE_FALLBACK as aR, SWEEP_BASE_CHAIN_ID as aS, SWEEP_BASE_SEPOLIA_CHAIN_ID as aT, SWEEP_BASE_SEPOLIA_USDC_ADDRESS as aU, SWEEP_BASE_USDC_ADDRESS as aV, type SettlementChildExpectation as aW, SignerRefusalCode as aX, type SweepConfirmation as aY, type SweepEip712Domain as aZ, type SweepEntry as a_, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, DEFAULT_NEXT_TOOL_BY_ACTION as ab, DIRECT_SIGN_CONTEXT_VERSION as ac, ENTRY_POINT_V07 as ad, ERC7710_ASSET_TRANSFER_METHOD as ae, HAVEN_CLIENT_HEADER as af, HAVEN_CONNECTOR_CHANNEL as ag, HAVEN_MINIMUM_NODE_VERSION as ah, HYBRID_DELEGATOR_DOMAIN_NAME as ai, HYBRID_DELEGATOR_DOMAIN_VERSION as aj, type HavenAgentAllowanceSummary as ak, type HavenAgentReadiness as al, type HavenAllowance as am, HavenApiError as an, type HavenCatalogMerchant as ao, type HavenListScope as ap, HavenPaymentStateError as aq, HavenSigningError as ar, HavenTimeoutError as as, HavenTypedDataRefusedError as at, HavenUnsupportedSignerVersionError as au, HavenUserOpBindingError as av, HavenZeroSettlementHashError as aw, MAX_TASK_BUDGET_TTL_SECONDS as ax, type MachinePaymentRail as ay, MerchantTimeoutError as az, type PaymentResult as b,
|
|
3061
|
+
export { AgentPaymentPhase as $, type AgentPaymentWarning as A, type ResumeAuthorizedX402Input as B, type CloseTaskBudgetResult as C, type ResumeX402PaymentInput as D, type X402ResumeState as E, type X402McpTransport as F, type X402MerchantCallContext as G, type HavenClientConfig as H, HavenError as I, AGENT_PAYMENT_FAILURE_CODE_VALUES as J, AGENT_PAYMENT_NEXT_ACTION_VALUES as K, AGENT_PAYMENT_PHASE_VALUES as L, AGENT_PAYMENT_RAIL_VALUES as M, type AgentNextStep as N, type OpenTaskBudgetResult as O, type PaymentRequest as P, type AgentPaymentEnumSchema as Q, type RawPaymentParties as R, type SweepResult as S, type TaskBudgetSignContext as T, AgentPaymentFailureCode as U, AgentPaymentFailureCodeDescriptions as V, AgentPaymentFailureCodeSchema as W, type X402PaymentRequired as X, AgentPaymentNextAction as Y, AgentPaymentNextActionDescriptions as Z, AgentPaymentNextActionSchema as _, type HavenClientUpdate as a, type SweepExpectedAuth as a$, AgentPaymentPhaseDescriptions as a0, AgentPaymentPhaseSchema as a1, AgentPaymentRail as a2, AgentPaymentRailDescriptions as a3, AgentPaymentRailSchema as a4, type AgentPaymentSummary as a5, AgentPaymentWarningCode as a6, type AgentPurchaseSummary as a7, CONNECTOR_PACKAGE_NAME as a8, type CatalogSubmissionAccepted as a9, NEXT_TOOL_SERVER_NAMES as aA, NEXT_TOOL_SERVER_ROLES as aB, type NextStep as aC, type NextStepArguments as aD, type NextStepHandoff as aE, type NextStepInput as aF, type NextStepTarget as aG, type NextStepTargets as aH, type NextToolServerRole as aI, PACKED_USER_OPERATION_FIELDS as aJ, type PaymentFee as aK, type PaymentNextAction as aL, type PaymentPhase as aM, type PaymentStatus as aN, ROOT_AUTHORITY as aO, SDK_CLIENT_IDENTITY as aP, SDK_VERSION as aQ, SIGNER_UPDATE_FALLBACK as aR, SWEEP_BASE_CHAIN_ID as aS, SWEEP_BASE_SEPOLIA_CHAIN_ID as aT, SWEEP_BASE_SEPOLIA_USDC_ADDRESS as aU, SWEEP_BASE_USDC_ADDRESS as aV, type SettlementChildExpectation as aW, SignerRefusalCode as aX, type SweepConfirmation as aY, type SweepEip712Domain as aZ, type SweepEntry as a_, DEFAULT_CONFIRMATION_TIMEOUT_MS as aa, DEFAULT_NEXT_TOOL_BY_ACTION as ab, DIRECT_SIGN_CONTEXT_VERSION as ac, ENTRY_POINT_V07 as ad, ERC7710_ASSET_TRANSFER_METHOD as ae, HAVEN_CLIENT_HEADER as af, HAVEN_CONNECTOR_CHANNEL as ag, HAVEN_MINIMUM_NODE_VERSION as ah, HYBRID_DELEGATOR_DOMAIN_NAME as ai, HYBRID_DELEGATOR_DOMAIN_VERSION as aj, type HavenAgentAllowanceSummary as ak, type HavenAgentReadiness as al, type HavenAllowance as am, HavenApiError as an, type HavenCatalogMerchant as ao, type HavenListScope as ap, HavenPaymentStateError as aq, HavenSigningError as ar, HavenTimeoutError as as, HavenTypedDataRefusedError as at, HavenUnsupportedSignerVersionError as au, HavenUserOpBindingError as av, HavenZeroSettlementHashError as aw, MAX_TASK_BUDGET_TTL_SECONDS as ax, type MachinePaymentRail as ay, MerchantTimeoutError as az, type PaymentResult as b, selectErc7710PaymentOption as b$, type SweepPreparation as b0, type SweepSubmitResult as b1, type SweepTypedData as b2, TRANSFER_WITH_AUTHORIZATION_TYPES as b3, TYPED_DATA_NOT_ALLOWED as b4, type TaskBudgetCloseExpectation as b5, type TaskChildExpectation as b6, type TaskChildTypedData as b7, type UnsupportedNodeVersionMessageOptions as b8, X402AlreadySettledError as b9, connectorUpgradeCommand as bA, createNextStepBuilder as bB, decodeBase64Json as bC, decodeBase64Utf8 as bD, defaultNextToolFor as bE, deriveDelegateAccountAddress as bF, encodeBase64Json as bG, encodeBase64Utf8 as bH, encodePaymentProof as bI, hashDelegation as bJ, havenClientIdentity as bK, isConnectorChannel as bL, isErc7710Option as bM, isPackedUserOperationTypedData as bN, isSupportedNodeVersion as bO, isSweepableChain as bP, isTaskChildTypedData as bQ, normalizePaymentRequired as bR, packedUserOperationHash as bS, parseNextTool as bT, parsePaymentRequired as bU, parsePaymentRequiredResponse as bV, readClientUpdate as bW, renderNextTool as bX, resolveConnectorChannel as bY, resolveTokenBySymbol as bZ, resolveTokenFromAddress as b_, type X402ExpectedAuth as ba, type X402ExpectedContext as bb, type X402PaymentHeaderContext as bc, X402PaymentHeaderValidationError as bd, type X402PaymentOption as be, type X402RequestSnapshot as bf, type X402SchemeSelection as bg, X402TaskBudgetMismatchError as bh, X402UnexpectedStatusError as bi, X402_LEGACY_PAYMENT_HEADER_NAME as bj, X402_MAX_AUTHORIZATION_WINDOW_SECONDS as bk, X402_PAYMENT_HEADER_NAME as bl, X402_PAYMENT_HEADER_NAMES_SENT as bm, X402_PAYMENT_REQUIRED_HEADER_NAME as bn, X402_PAYMENT_RESPONSE_HEADER_NAME as bo, X402_SETTLEMENT_FORWARD_MARGIN_SECONDS as bp, assertBoundDirectPaymentUserOp as bq, assertOwnTaskBudgetCloseUserOp as br, assertOwnTaskChild as bs, assertUserOpTypedDataBinding as bt, buildSweepAuthorizationMessage as bu, buildSweepTypedData as bv, buildX402ExpectedMessage as bw, compareNodeVersions as bx, connectorRerunCommand as by, connectorSpec as bz, type PaymentIntent as c, selectPaymentOption as c0, selectStandardPaymentOption as c1, selectX402SettlementScheme as c2, signerUpdateFallback as c3, sweepUsdcAddress as c4, sweepUsdcDomain as c5, toStandardPaymentRequirements as c6, unsupportedNodeVersionMessage as c7, validateStandardX402PaymentHeader as c8, verifySettlementChild as c9, x402AssetTransferMethod as ca, x402AuthorizationAmount as cb, x402FacilitatorAddresses as cc, x402V2PaymentEnvelope as cd, CAVEAT_ENFORCERS as ce, CAVEAT_TYPEHASH as cf, DELEGATION_MANAGER as cg, DELEGATION_TYPEHASH as ch, DIRECT_PAYMENT_CHAIN_IDS as ci, type DelegationForHashing as cj, EXECUTE_ABI as ck, HYBRID_DELEGATOR_IMPLEMENTATION as cl, MAX_SETTLEMENT_WINDOW_SECONDS as cm, SIMPLE_FACTORY_ADDRESS as cn, type SettlementChildTypedData as co, assertFundingLegPaysDelegate as cp, assertOwnSettlementChild as cq, chainIdForNetwork as cr, isSettlementChildTypedData as cs, type X402AuthorizationOptions as d, type X402Intent as e, type PaymentStatusResult as f, type HavenAgent as g, type HavenAgentSummary as h, type SweepPrepareResponse as i, type SweepAuthorization as j, type SweepSubmitResponse as k, type HavenAllowanceSummary as l, type HavenBalanceCoverage as m, type PostPurchaseAllowanceSummary as n, type HavenCatalogEntry as o, type HavenCatalogSubmission as p, type HavenPaymentReceipt as q, type HavenPaymentReceiptsPage as r, type HavenTaskBudget as s, type SubmitTaskBudgetResult as t, type PaymentResumeState as u, type X402Receipt as v, type X402Quote as w, type X402Erc7710Settlement as x, type X402McpCallContext as y, type SignData as z };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkM7BXKTBK_cjs = require('./chunk-M7BXKTBK.cjs');
|
|
4
4
|
var viem = require('viem');
|
|
5
5
|
var crypto = require('crypto');
|
|
6
6
|
|
|
7
7
|
var TYPED_DATA_NOT_ALLOWED = "TYPED_DATA_NOT_ALLOWED";
|
|
8
|
-
var HavenTypedDataRefusedError = class extends
|
|
8
|
+
var HavenTypedDataRefusedError = class extends chunkM7BXKTBK_cjs.HavenSigningError {
|
|
9
9
|
constructor(message) {
|
|
10
10
|
super(message);
|
|
11
11
|
this.code = TYPED_DATA_NOT_ALLOWED;
|
|
@@ -46,7 +46,7 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
|
|
|
46
46
|
`This signer only signs direct payments on chains the delegation rail has pinned contracts for (${[...DIRECT_PAYMENT_CHAIN_IDS].join(", ")}); this typed data names chain ${String(domain.chainId)}. Refusing.`
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
const ownAccount =
|
|
49
|
+
const ownAccount = chunkM7BXKTBK_cjs.deriveDelegateAccountAddress(delegateAddress);
|
|
50
50
|
const sender = typeof message.sender === "string" ? message.sender : "";
|
|
51
51
|
if (sender.toLowerCase() !== ownAccount.toLowerCase()) {
|
|
52
52
|
throw new HavenTypedDataRefusedError(
|
|
@@ -76,9 +76,9 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
|
|
|
76
76
|
"This UserOperation's execute() call does not re-encode to the exact callData bytes (trailing or non-canonical bytes). Refusing."
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
if (decoded.target.toLowerCase() !==
|
|
79
|
+
if (decoded.target.toLowerCase() !== chunkM7BXKTBK_cjs.DELEGATION_MANAGER.toLowerCase()) {
|
|
80
80
|
throw new HavenTypedDataRefusedError(
|
|
81
|
-
`This UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${
|
|
81
|
+
`This UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${chunkM7BXKTBK_cjs.DELEGATION_MANAGER}). A direct payment only ever redeems the agent's own budget delegation \u2014 refusing what looks like a self-call (e.g. transferOwnership, updateSigners, upgradeToAndCall) or a call to an unrelated contract.`
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
if (decoded.value !== 0n) {
|
|
@@ -87,20 +87,20 @@ function assertBoundDirectPaymentUserOp(typedData, delegateAddress) {
|
|
|
87
87
|
);
|
|
88
88
|
}
|
|
89
89
|
try {
|
|
90
|
-
|
|
90
|
+
chunkM7BXKTBK_cjs.assertRedeemsOwnBudgetDelegation(decoded.callData, ownAccount);
|
|
91
91
|
} catch (err) {
|
|
92
92
|
throw new HavenTypedDataRefusedError(err instanceof Error ? err.message : String(err));
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
function assertOwnSettlementChild(typedData, expectation, delegateAddress) {
|
|
96
96
|
try {
|
|
97
|
-
|
|
97
|
+
chunkM7BXKTBK_cjs.verifySettlementChild(typedData, {
|
|
98
98
|
...expectation,
|
|
99
|
-
delegatorAccount:
|
|
99
|
+
delegatorAccount: chunkM7BXKTBK_cjs.deriveDelegateAccountAddress(delegateAddress)
|
|
100
100
|
});
|
|
101
101
|
} catch (err) {
|
|
102
102
|
if (err instanceof HavenTypedDataRefusedError) throw err;
|
|
103
|
-
if (err instanceof
|
|
103
|
+
if (err instanceof chunkM7BXKTBK_cjs.HavenSigningError) throw new HavenTypedDataRefusedError(err.message);
|
|
104
104
|
throw new HavenTypedDataRefusedError(
|
|
105
105
|
`Refusing to sign the x402 settlement child: it is malformed (${err instanceof Error ? err.message : String(err)}).`
|
|
106
106
|
);
|
|
@@ -129,7 +129,7 @@ function assertFundingLegPaysDelegate(typedData, expected) {
|
|
|
129
129
|
try {
|
|
130
130
|
const { args: executeArgs } = viem.decodeFunctionData({ abi: EXECUTE_ABI, data: message.callData });
|
|
131
131
|
const inner = executeArgs[0].callData;
|
|
132
|
-
const { args } = viem.decodeFunctionData({ abi:
|
|
132
|
+
const { args } = viem.decodeFunctionData({ abi: chunkM7BXKTBK_cjs.REDEEM_DELEGATIONS_ABI, data: inner });
|
|
133
133
|
const executions = args[2];
|
|
134
134
|
executionCallData = executions[0];
|
|
135
135
|
} catch {
|
|
@@ -248,7 +248,7 @@ var TRANSFER_WITH_AUTHORIZATION_TYPES = {
|
|
|
248
248
|
function sweepUsdcAddress(chainId) {
|
|
249
249
|
const address = USDC_ADDRESS_BY_CHAIN[chainId];
|
|
250
250
|
if (!address) {
|
|
251
|
-
throw new
|
|
251
|
+
throw new chunkM7BXKTBK_cjs.HavenSigningError(
|
|
252
252
|
`Sweep is not supported on chain ${chainId}. Supported: ${SWEEPABLE_CHAIN_IDS.join(", ")}.`
|
|
253
253
|
);
|
|
254
254
|
}
|
|
@@ -257,7 +257,7 @@ function sweepUsdcAddress(chainId) {
|
|
|
257
257
|
function sweepUsdcDomain(chainId) {
|
|
258
258
|
const domain = USDC_EIP712_DOMAIN_BY_CHAIN[chainId];
|
|
259
259
|
if (!domain) {
|
|
260
|
-
throw new
|
|
260
|
+
throw new chunkM7BXKTBK_cjs.HavenSigningError(
|
|
261
261
|
`Sweep is not supported on chain ${chainId}. Supported: ${SWEEPABLE_CHAIN_IDS.join(", ")}.`
|
|
262
262
|
);
|
|
263
263
|
}
|
|
@@ -270,12 +270,12 @@ function buildSweepTypedData(auth) {
|
|
|
270
270
|
const domain = sweepUsdcDomain(auth.chainId);
|
|
271
271
|
const expectedToken = sweepUsdcAddress(auth.chainId);
|
|
272
272
|
if (!sameAddress(auth.token, expectedToken)) {
|
|
273
|
-
throw new
|
|
273
|
+
throw new chunkM7BXKTBK_cjs.HavenSigningError(
|
|
274
274
|
`Sweep token ${auth.token} is not the canonical USDC contract for chain ${auth.chainId}.`
|
|
275
275
|
);
|
|
276
276
|
}
|
|
277
277
|
if (!/^0x[0-9a-fA-F]{64}$/.test(auth.nonce)) {
|
|
278
|
-
throw new
|
|
278
|
+
throw new chunkM7BXKTBK_cjs.HavenSigningError("Sweep nonce must be a 0x-prefixed 32-byte hex string.");
|
|
279
279
|
}
|
|
280
280
|
return {
|
|
281
281
|
domain,
|
|
@@ -767,6 +767,12 @@ function resolveTokenFromAddress(address, network) {
|
|
|
767
767
|
}
|
|
768
768
|
return ALL_TOKENS[lower] ?? null;
|
|
769
769
|
}
|
|
770
|
+
function resolveTokenBySymbol(chainId, symbol) {
|
|
771
|
+
const table = NETWORK_TOKENS[`eip155:${chainId}`];
|
|
772
|
+
if (!table) return null;
|
|
773
|
+
const hit = Object.entries(table).find(([, token]) => token.symbol === symbol);
|
|
774
|
+
return hit ? { ...hit[1] } : null;
|
|
775
|
+
}
|
|
770
776
|
function stableStringify2(value) {
|
|
771
777
|
if (value === null || typeof value !== "object") {
|
|
772
778
|
const primitive = JSON.stringify(value);
|
|
@@ -779,7 +785,7 @@ function stableStringify2(value) {
|
|
|
779
785
|
}
|
|
780
786
|
|
|
781
787
|
// src/client-identity.ts
|
|
782
|
-
var SDK_VERSION = "0.0.0-dev.
|
|
788
|
+
var SDK_VERSION = "0.0.0-dev.202609281736.4aa027b";
|
|
783
789
|
var HAVEN_CLIENT_HEADER = "X-Haven-Client";
|
|
784
790
|
function havenClientIdentity(pkg, version) {
|
|
785
791
|
return `${pkg}/${version}`;
|
|
@@ -946,10 +952,10 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
|
|
|
946
952
|
if (td?.primaryType !== "Delegation") {
|
|
947
953
|
refuseTaskChild("it is not a Delegation payload", `primaryType was '${String(td?.primaryType)}'.`);
|
|
948
954
|
}
|
|
949
|
-
if (!same(td.domain?.verifyingContract,
|
|
955
|
+
if (!same(td.domain?.verifyingContract, chunkM7BXKTBK_cjs.DELEGATION_MANAGER)) {
|
|
950
956
|
refuseTaskChild(
|
|
951
957
|
"the EIP-712 domain names an unknown DelegationManager",
|
|
952
|
-
`Expected ${
|
|
958
|
+
`Expected ${chunkM7BXKTBK_cjs.DELEGATION_MANAGER}, got ${td.domain?.verifyingContract}.`
|
|
953
959
|
);
|
|
954
960
|
}
|
|
955
961
|
if (td.domain?.name !== DELEGATION_DOMAIN_NAME || td.domain?.version !== DELEGATION_DOMAIN_VERSION) {
|
|
@@ -977,7 +983,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
|
|
|
977
983
|
`Expected chain ${expected.chainId}; the child says ${td.domain?.chainId}.`
|
|
978
984
|
);
|
|
979
985
|
}
|
|
980
|
-
const ownAccount =
|
|
986
|
+
const ownAccount = chunkM7BXKTBK_cjs.deriveDelegateAccountAddress(delegateAddress);
|
|
981
987
|
const delegator = td.message?.delegator;
|
|
982
988
|
if (typeof delegator !== "string" || !same(delegator, ownAccount)) {
|
|
983
989
|
refuseTaskChild(
|
|
@@ -996,7 +1002,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
|
|
|
996
1002
|
if (typeof authority !== "string" || !/^0x[0-9a-fA-F]{64}$/.test(authority)) {
|
|
997
1003
|
refuseTaskChild("its authority is not a 32-byte delegation hash", `Got ${String(authority)}.`);
|
|
998
1004
|
}
|
|
999
|
-
if (authority.toLowerCase() ===
|
|
1005
|
+
if (authority.toLowerCase() === chunkM7BXKTBK_cjs.ROOT_AUTHORITY) {
|
|
1000
1006
|
refuseTaskChild(
|
|
1001
1007
|
"it is a ROOT delegation, not a re-delegation of the agent budget",
|
|
1002
1008
|
"A task budget always chains under the agent budget delegation."
|
|
@@ -1009,7 +1015,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
|
|
|
1009
1015
|
);
|
|
1010
1016
|
}
|
|
1011
1017
|
const caveats = td.message?.caveats ?? [];
|
|
1012
|
-
const transfer = findCaveat(caveats,
|
|
1018
|
+
const transfer = findCaveat(caveats, chunkM7BXKTBK_cjs.CAVEAT_ENFORCERS.erc20TransferAmount);
|
|
1013
1019
|
if (!transfer) {
|
|
1014
1020
|
refuseTaskChild(
|
|
1015
1021
|
"it has no ERC-20 transfer-amount caveat",
|
|
@@ -1027,7 +1033,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
|
|
|
1027
1033
|
`Expected ${expected.maxAmountAtomic}; the child allows ${amount.toString()}.`
|
|
1028
1034
|
);
|
|
1029
1035
|
}
|
|
1030
|
-
const timestamp = findCaveat(caveats,
|
|
1036
|
+
const timestamp = findCaveat(caveats, chunkM7BXKTBK_cjs.CAVEAT_ENFORCERS.timestamp);
|
|
1031
1037
|
if (!timestamp) {
|
|
1032
1038
|
refuseTaskChild("it never expires", "A task-budget child without a timestamp caveat is open-ended.");
|
|
1033
1039
|
}
|
|
@@ -1048,7 +1054,7 @@ function assertOwnTaskChild(typedData, expected, delegateAddress, now = Date.now
|
|
|
1048
1054
|
`Expected ${expected.expiresAt}; the child says ${beforeThreshold}.`
|
|
1049
1055
|
);
|
|
1050
1056
|
}
|
|
1051
|
-
const calldata = findCaveat(caveats,
|
|
1057
|
+
const calldata = findCaveat(caveats, chunkM7BXKTBK_cjs.CAVEAT_ENFORCERS.allowedCalldata);
|
|
1052
1058
|
if (expected.recipientAddress) {
|
|
1053
1059
|
if (!calldata) {
|
|
1054
1060
|
refuseTaskChild(
|
|
@@ -1085,7 +1091,7 @@ var DISABLE_DELEGATION_ABI = [
|
|
|
1085
1091
|
{
|
|
1086
1092
|
type: "function",
|
|
1087
1093
|
name: "disableDelegation",
|
|
1088
|
-
inputs: [{ name: "delegation", type: "tuple", components:
|
|
1094
|
+
inputs: [{ name: "delegation", type: "tuple", components: chunkM7BXKTBK_cjs.DELEGATION_TUPLE_COMPONENTS }],
|
|
1089
1095
|
outputs: [],
|
|
1090
1096
|
stateMutability: "nonpayable"
|
|
1091
1097
|
}
|
|
@@ -1104,7 +1110,7 @@ function assertOwnTaskBudgetCloseUserOp(typedData, expected, delegateAddress) {
|
|
|
1104
1110
|
`This signer only signs a task-budget close on chains the delegation rail has pinned contracts for (${[...DIRECT_PAYMENT_CHAIN_IDS].join(", ")}); this typed data names chain ${String(domain.chainId)}. Refusing.`
|
|
1105
1111
|
);
|
|
1106
1112
|
}
|
|
1107
|
-
const ownAccount =
|
|
1113
|
+
const ownAccount = chunkM7BXKTBK_cjs.deriveDelegateAccountAddress(delegateAddress);
|
|
1108
1114
|
const sender = typeof message.sender === "string" ? message.sender : "";
|
|
1109
1115
|
if (sender.toLowerCase() !== ownAccount.toLowerCase()) {
|
|
1110
1116
|
throw new HavenTypedDataRefusedError(
|
|
@@ -1127,9 +1133,9 @@ function assertOwnTaskBudgetCloseUserOp(typedData, expected, delegateAddress) {
|
|
|
1127
1133
|
"This close UserOperation's execute() call does not re-encode to the exact callData bytes (trailing or non-canonical bytes). Refusing."
|
|
1128
1134
|
);
|
|
1129
1135
|
}
|
|
1130
|
-
if (decoded.target.toLowerCase() !==
|
|
1136
|
+
if (decoded.target.toLowerCase() !== chunkM7BXKTBK_cjs.DELEGATION_MANAGER.toLowerCase()) {
|
|
1131
1137
|
throw new HavenTypedDataRefusedError(
|
|
1132
|
-
`This close UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${
|
|
1138
|
+
`This close UserOperation's execute() calls ${decoded.target}, not the DelegationManager (${chunkM7BXKTBK_cjs.DELEGATION_MANAGER}). Refusing what looks like a self-call or a call to an unrelated contract.`
|
|
1133
1139
|
);
|
|
1134
1140
|
}
|
|
1135
1141
|
if (decoded.value !== 0n) {
|
|
@@ -1166,7 +1172,7 @@ function assertOwnTaskBudgetCloseUserOp(typedData, expected, delegateAddress) {
|
|
|
1166
1172
|
`This close UserOperation disables a delegation granted to ${delegation.delegate}, not this signer's own account (${ownAccount}) \u2014 a task-budget child is always self-delegated. Refusing.`
|
|
1167
1173
|
);
|
|
1168
1174
|
}
|
|
1169
|
-
if (delegation.authority.toLowerCase() ===
|
|
1175
|
+
if (delegation.authority.toLowerCase() === chunkM7BXKTBK_cjs.ROOT_AUTHORITY) {
|
|
1170
1176
|
throw new HavenTypedDataRefusedError(
|
|
1171
1177
|
"This close UserOperation disables a ROOT delegation, not a re-delegation of the agent budget. A task-budget child always chains under the agent budget delegation. Refusing."
|
|
1172
1178
|
);
|
|
@@ -1266,6 +1272,7 @@ exports.parsePaymentRequired = parsePaymentRequired;
|
|
|
1266
1272
|
exports.parsePaymentRequiredResponse = parsePaymentRequiredResponse;
|
|
1267
1273
|
exports.readClientUpdate = readClientUpdate;
|
|
1268
1274
|
exports.renderNextTool = renderNextTool;
|
|
1275
|
+
exports.resolveTokenBySymbol = resolveTokenBySymbol;
|
|
1269
1276
|
exports.resolveTokenFromAddress = resolveTokenFromAddress;
|
|
1270
1277
|
exports.selectErc7710PaymentOption = selectErc7710PaymentOption;
|
|
1271
1278
|
exports.selectPaymentOption = selectPaymentOption;
|
|
@@ -1282,5 +1289,5 @@ exports.x402FacilitatorAddresses = x402FacilitatorAddresses;
|
|
|
1282
1289
|
exports.x402PaymentHeaderNamesFor = x402PaymentHeaderNamesFor;
|
|
1283
1290
|
exports.x402PaymentHeaderNamesSent = x402PaymentHeaderNamesSent;
|
|
1284
1291
|
exports.x402V2PaymentEnvelope = x402V2PaymentEnvelope;
|
|
1285
|
-
//# sourceMappingURL=chunk-
|
|
1286
|
-
//# sourceMappingURL=chunk-
|
|
1292
|
+
//# sourceMappingURL=chunk-6ZVB7XDK.cjs.map
|
|
1293
|
+
//# sourceMappingURL=chunk-6ZVB7XDK.cjs.map
|