@sherwoodagent/cli 0.59.13 → 0.59.16
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/{abis-4HWN2E3H.js → abis-ITHGPHGM.js} +2 -2
- package/dist/{addresses-PYRHQSVZ.js → addresses-FXTJXDI7.js} +2 -2
- package/dist/{agent-QI7GVRJV.js → agent-ASULMU7P.js} +5 -5
- package/dist/{chat-J5G63PFI.js → chat-325YZ7PA.js} +7 -7
- package/dist/{chunk-GAT77CJE.js → chunk-6TJVN5JR.js} +4 -4
- package/dist/{chunk-IKQD5ERV.js → chunk-G6MBVVH7.js} +4 -4
- package/dist/{chunk-OHQOTSFG.js → chunk-J42NNFUV.js} +2 -2
- package/dist/{chunk-7TSAKVAO.js → chunk-KTWP2UTY.js} +4 -4
- package/dist/{chunk-4ZM3QQO7.js → chunk-M3KSKVOT.js} +4 -4
- package/dist/{chunk-YZHZSBES.js → chunk-SKOVJ7XM.js} +15 -1
- package/dist/chunk-SKOVJ7XM.js.map +1 -0
- package/dist/{chunk-7HJXZ4NM.js → chunk-UBAX22KA.js} +2 -2
- package/dist/{chunk-JH5YGXZC.js → chunk-VAOCUQMY.js} +11 -2
- package/dist/chunk-VAOCUQMY.js.map +1 -0
- package/dist/{chunk-XDBRKW7I.js → chunk-YJSCIQUZ.js} +21 -1
- package/dist/chunk-YJSCIQUZ.js.map +1 -0
- package/dist/{chunk-JE3FON2M.js → chunk-ZOFZWUMC.js} +4 -4
- package/dist/{client-UHHCB6EZ.js → client-KBBFAMEI.js} +2 -2
- package/dist/{eas-YJF7L25R.js → eas-M6XC7MRC.js} +5 -5
- package/dist/{governor-4JUK6HDR.js → governor-CRV74AJ7.js} +5 -5
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/dist/{price-NJBSPQ3M.js → price-PSBQZKNM.js} +4 -4
- package/dist/{research-PZRG36KL.js → research-7BGMM554.js} +5 -5
- package/dist/{research-YJWSQS2A.js → research-N3R5MU6Q.js} +3 -3
- package/dist/{session-U3NEZJ7X.js → session-G5OEV4OY.js} +7 -7
- package/dist/{trade-HSNABOTJ.js → trade-B3A6HMDJ.js} +11 -11
- package/dist/{xmtp-54DNJCS5.js → xmtp-F4RRSWVL.js} +5 -5
- package/package.json +1 -1
- package/dist/chunk-JH5YGXZC.js.map +0 -1
- package/dist/chunk-XDBRKW7I.js.map +0 -1
- package/dist/chunk-YZHZSBES.js.map +0 -1
- /package/dist/{abis-4HWN2E3H.js.map → abis-ITHGPHGM.js.map} +0 -0
- /package/dist/{addresses-PYRHQSVZ.js.map → addresses-FXTJXDI7.js.map} +0 -0
- /package/dist/{agent-QI7GVRJV.js.map → agent-ASULMU7P.js.map} +0 -0
- /package/dist/{chat-J5G63PFI.js.map → chat-325YZ7PA.js.map} +0 -0
- /package/dist/{chunk-GAT77CJE.js.map → chunk-6TJVN5JR.js.map} +0 -0
- /package/dist/{chunk-IKQD5ERV.js.map → chunk-G6MBVVH7.js.map} +0 -0
- /package/dist/{chunk-OHQOTSFG.js.map → chunk-J42NNFUV.js.map} +0 -0
- /package/dist/{chunk-7TSAKVAO.js.map → chunk-KTWP2UTY.js.map} +0 -0
- /package/dist/{chunk-4ZM3QQO7.js.map → chunk-M3KSKVOT.js.map} +0 -0
- /package/dist/{chunk-7HJXZ4NM.js.map → chunk-UBAX22KA.js.map} +0 -0
- /package/dist/{chunk-JE3FON2M.js.map → chunk-ZOFZWUMC.js.map} +0 -0
- /package/dist/{client-UHHCB6EZ.js.map → client-KBBFAMEI.js.map} +0 -0
- /package/dist/{eas-YJF7L25R.js.map → eas-M6XC7MRC.js.map} +0 -0
- /package/dist/{governor-4JUK6HDR.js.map → governor-CRV74AJ7.js.map} +0 -0
- /package/dist/{price-NJBSPQ3M.js.map → price-PSBQZKNM.js.map} +0 -0
- /package/dist/{research-PZRG36KL.js.map → research-7BGMM554.js.map} +0 -0
- /package/dist/{research-YJWSQS2A.js.map → research-N3R5MU6Q.js.map} +0 -0
- /package/dist/{session-U3NEZJ7X.js.map → session-G5OEV4OY.js.map} +0 -0
- /package/dist/{trade-HSNABOTJ.js.map → trade-B3A6HMDJ.js.map} +0 -0
- /package/dist/{xmtp-54DNJCS5.js.map → xmtp-F4RRSWVL.js.map} +0 -0
|
@@ -112,6 +112,16 @@ var CONTRACT_ERRORS_ABI = [
|
|
|
112
112
|
// ── WstETHMoonwellStrategy / VeniceInferenceStrategy ──
|
|
113
113
|
{ type: "error", name: "SwapFailed", inputs: [] },
|
|
114
114
|
{ type: "error", name: "AlreadySettledParams", inputs: [] },
|
|
115
|
+
// ── PortfolioStrategy / UniswapSwapAdapter ──
|
|
116
|
+
{ type: "error", name: "QuoteUnavailable", inputs: [] },
|
|
117
|
+
{ type: "error", name: "UnsupportedMode", inputs: [] },
|
|
118
|
+
{ type: "error", name: "InvalidWeights", inputs: [] },
|
|
119
|
+
{ type: "error", name: "LengthMismatch", inputs: [] },
|
|
120
|
+
{ type: "error", name: "TooManyTokens", inputs: [] },
|
|
121
|
+
{ type: "error", name: "RebalancingInProgress", inputs: [] },
|
|
122
|
+
{ type: "error", name: "StalePrice", inputs: [] },
|
|
123
|
+
{ type: "error", name: "InvalidSlippage", inputs: [] },
|
|
124
|
+
{ type: "error", name: "InvalidPriceDecimals", inputs: [] },
|
|
115
125
|
// ── VeniceInferenceStrategy ──
|
|
116
126
|
{ type: "error", name: "NoAgent", inputs: [] }
|
|
117
127
|
];
|
|
@@ -217,6 +227,16 @@ var ERROR_MESSAGES = {
|
|
|
217
227
|
// Strategy — WstETH / Venice
|
|
218
228
|
SwapFailed: "Token swap failed. Check slippage tolerance and pool liquidity.",
|
|
219
229
|
AlreadySettledParams: "Settlement parameters have already been set.",
|
|
230
|
+
// Strategy — Portfolio / UniswapSwapAdapter
|
|
231
|
+
QuoteUnavailable: "Uniswap quoter returned 0 or reverted for a portfolio allocation. Usually means: (a) no V3 pool exists at the requested fee tier for one of the tokens, (b) the strategy clone was initialized against an old/broken UniswapSwapAdapter (check the clone's swapAdapter() vs the current chains JSON), or (c) the adapter is calling Quoter with the wrong ABI (pre-PR #317 bug).",
|
|
232
|
+
UnsupportedMode: "UniswapSwapAdapter doesn't support that swap mode. Only V3 single-hop (mode 0) and multi-hop (mode 1) are supported.",
|
|
233
|
+
InvalidWeights: "Portfolio weights must sum to 10000 bps (100%).",
|
|
234
|
+
LengthMismatch: "Portfolio input arrays (tokens / weights / swapExtraData / priceDecimals) must have the same length.",
|
|
235
|
+
TooManyTokens: "Portfolio basket exceeds the maximum allocation count (20).",
|
|
236
|
+
RebalancingInProgress: "A rebalance is already in flight on this clone. Wait for it to finish.",
|
|
237
|
+
StalePrice: "Chainlink Data Streams report has expired. Refresh prices and retry.",
|
|
238
|
+
InvalidSlippage: "maxSlippageBps must be > 0 and < 10000.",
|
|
239
|
+
InvalidPriceDecimals: "priceDecimals entry exceeds 36. Use 8 for tokenized-stock feeds, 18 for crypto pairs.",
|
|
220
240
|
// Strategy — Venice
|
|
221
241
|
NoAgent: "No agent is registered on the vault. Register an agent first."
|
|
222
242
|
};
|
|
@@ -489,4 +509,4 @@ export {
|
|
|
489
509
|
writeContractWithRetry,
|
|
490
510
|
waitForReceipt
|
|
491
511
|
};
|
|
492
|
-
//# sourceMappingURL=chunk-
|
|
512
|
+
//# sourceMappingURL=chunk-YJSCIQUZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/client.ts","../src/lib/errors.ts"],"sourcesContent":["/**\n * viem client factory — resolves chain and RPC from the network module.\n * Private key is read from ~/.sherwood/config.json (set via `sherwood config set --private-key`),\n * with PRIVATE_KEY env var as fallback.\n */\n\n// dotenv loaded at entrypoint\nimport type { Hex, TransactionReceipt } from \"viem\";\nimport { createPublicClient, createWalletClient, fallback, http } from \"viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\nimport { getChain, getRpcUrls } from \"./network.js\";\nimport { loadConfig } from \"./config.js\";\nimport { formatContractError } from \"./errors.js\";\nexport { formatContractError } from \"./errors.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet _publicClient: any = null;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet _walletClient: any = null;\n\n/**\n * Resolve the private key: config → env → error.\n */\nfunction getPrivateKey(): `0x${string}` {\n // 1. Config (~/.sherwood/config.json)\n const config = loadConfig();\n if (config.privateKey) {\n const k = config.privateKey;\n return (k.startsWith(\"0x\") ? k : `0x${k}`) as `0x${string}`;\n }\n\n // 2. Env var fallback\n const env = process.env.PRIVATE_KEY;\n if (env) {\n return (env.startsWith(\"0x\") ? env : `0x${env}`) as `0x${string}`;\n }\n\n throw new Error(\n \"Private key not found. Run 'sherwood config set --private-key <key>' or set PRIVATE_KEY env var.\",\n );\n}\n\n/**\n * Build a viem fallback transport over the chain's RPC URL list.\n * Transparently advances to the next URL on rate-limit / network errors\n * (issue #182). `retryCount: 0` on the inner `http` avoids wasting 10+s\n * spinning on a dead RPC before the fallback layer advances.\n */\nfunction buildTransport() {\n const urls = getRpcUrls();\n return fallback(\n urls.map((url) => http(url, { retryCount: 0, timeout: 8_000 })),\n { rank: false, retryCount: 0 },\n );\n}\n\nexport function getPublicClient() {\n const chain = getChain();\n // Auto-invalidate if network changed since last creation\n if (_publicClient && _publicClient.chain?.id !== chain.id) {\n _publicClient = null;\n }\n if (!_publicClient) {\n _publicClient = createPublicClient({\n chain,\n transport: buildTransport(),\n });\n }\n return _publicClient as ReturnType<typeof createPublicClient>;\n}\n\nexport function getWalletClient() {\n const chain = getChain();\n // Auto-invalidate if network changed since last creation\n if (_walletClient && _walletClient.chain?.id !== chain.id) {\n _walletClient = null;\n }\n if (!_walletClient) {\n const account = privateKeyToAccount(getPrivateKey());\n _walletClient = createWalletClient({\n account,\n chain,\n transport: buildTransport(),\n });\n }\n return _walletClient as ReturnType<typeof createWalletClient>;\n}\n\n/**\n * Reset cached clients. Required for tests that call setNetwork()\n * after a client was already created.\n */\nexport function resetClients() {\n _publicClient = null;\n _walletClient = null;\n}\n\nexport function getAccount() {\n return privateKeyToAccount(getPrivateKey());\n}\n\n/**\n * Estimate EIP-1559 fees with a 20% buffer to avoid stuck txs on Base gas spikes.\n */\nexport async function estimateFeesWithBuffer() {\n const client = getPublicClient();\n const { maxFeePerGas, maxPriorityFeePerGas } =\n await client.estimateFeesPerGas();\n return {\n maxFeePerGas: (maxFeePerGas * 120n) / 100n,\n maxPriorityFeePerGas: (maxPriorityFeePerGas * 120n) / 100n,\n };\n}\n\n// ── Nonce management + retry helpers ──\n//\n// Handles: nonce collisions, underpriced replacements, stuck pending txs.\n// Gas bump ceiling: base * 1.2 (buffer) * 1.1^3 (max retries) ≈ 1.6x base fee.\n\nconst MAX_RETRIES = 3;\nconst RETRY_DELAY_MS = 1500; // backoff between retries\nconst STUCK_NONCE_CONFIRM_DELAY_MS = 2500; // staleness check delay\nconst GAS_BUMP_NUMERATOR = 110n;\nconst GAS_BUMP_DENOMINATOR = 100n;\n\nfunction isUnderpricedError(msg: string): boolean {\n return msg.includes(\"replacement transaction underpriced\");\n}\n\nfunction isNonceStaleError(msg: string): boolean {\n return msg.includes(\"nonce too low\") || msg.includes(\"NONCE_EXPIRED\");\n}\n\nfunction isRetryableError(err: unknown): boolean {\n const msg = err instanceof Error ? err.message : String(err);\n return isUnderpricedError(msg) || isNonceStaleError(msg);\n}\n\nfunction bumpFees(fees: { maxFeePerGas: bigint; maxPriorityFeePerGas: bigint }) {\n return {\n maxFeePerGas: (fees.maxFeePerGas * GAS_BUMP_NUMERATOR) / GAS_BUMP_DENOMINATOR,\n maxPriorityFeePerGas: (fees.maxPriorityFeePerGas * GAS_BUMP_NUMERATOR) / GAS_BUMP_DENOMINATOR,\n };\n}\n\n// ── Stuck nonce detection ──\n\n/**\n * Check if the wallet has a stuck nonce (pending tx count > confirmed tx count).\n * Returns the stuck nonce number, or null if the wallet is clean.\n *\n * Includes a staleness guard: if pending > confirmed, waits ~2.5s and re-checks\n * to avoid false positives from propagation delays.\n */\nexport async function detectStuckNonce(): Promise<number | null> {\n const client = getPublicClient();\n const address = getAccount().address;\n const [confirmed, pending] = await Promise.all([\n client.getTransactionCount({ address, blockTag: \"latest\" }),\n client.getTransactionCount({ address, blockTag: \"pending\" }),\n ]);\n if (pending <= confirmed) return null;\n\n // Staleness guard: re-check after a short delay to avoid false positives\n await new Promise((r) => setTimeout(r, STUCK_NONCE_CONFIRM_DELAY_MS));\n const [confirmed2, pending2] = await Promise.all([\n client.getTransactionCount({ address, blockTag: \"latest\" }),\n client.getTransactionCount({ address, blockTag: \"pending\" }),\n ]);\n return pending2 > confirmed2 ? confirmed2 : null;\n}\n\n/**\n * Clear a single stuck nonce by sending a 0-value self-transfer with aggressively bumped gas.\n * Uses 5x the buffered fee estimate to guarantee replacement even if the original tx\n * was sent during a gas spike (EIP-1559 requires >= 110% of original maxPriorityFeePerGas).\n */\nasync function unstickWalletSingle(): Promise<Hex> {\n const stuckNonce = await detectStuckNonce();\n if (stuckNonce === null) {\n throw new Error(\"No stuck nonce detected — wallet is clean.\");\n }\n\n console.warn(` Unsticking wallet: replacing stuck tx at nonce ${stuckNonce}...`);\n const wallet = getWalletClient();\n const account = getAccount();\n\n // Use 5x gas buffer to guarantee replacement even for txs sent during gas spikes\n const { maxFeePerGas, maxPriorityFeePerGas } = await estimateFeesWithBuffer();\n const hash = await wallet.sendTransaction({\n account,\n chain: wallet.chain,\n to: account.address,\n value: 0n,\n nonce: stuckNonce,\n maxFeePerGas: maxFeePerGas * 5n,\n maxPriorityFeePerGas: maxPriorityFeePerGas * 5n,\n });\n\n const client = getPublicClient();\n await client.waitForTransactionReceipt({ hash });\n console.warn(` Wallet unstuck (nonce ${stuckNonce} replaced).`);\n return hash;\n}\n\n/**\n * Unstick a wallet by clearing ALL stuck nonces, not just the first one.\n * Loops until pending == confirmed nonce count.\n */\nexport async function unstickWallet(): Promise<Hex[]> {\n const hashes: Hex[] = [];\n while ((await detectStuckNonce()) !== null) {\n hashes.push(await unstickWalletSingle());\n }\n if (hashes.length === 0) {\n throw new Error(\"No stuck nonce detected — wallet is clean.\");\n }\n return hashes;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TxSender = (params: any) => Promise<Hex>;\n\n/**\n * Shared retry loop: explicit nonce + EIP-1559 fee buffer + gas-bump on underpriced errors.\n * On \"nonce too low\" / \"NONCE_EXPIRED\", re-fetches nonce from pending state before retrying.\n * Also detects stuck nonces before sending and auto-unsticks the wallet.\n */\nasync function withRetry(send: TxSender, txParams: Record<string, unknown>): Promise<Hex> {\n const client = getPublicClient();\n const account = getAccount();\n let fees = await estimateFeesWithBuffer();\n\n // Auto-detect and clear ALL stuck nonces before attempting the tx\n while ((await detectStuckNonce()) !== null) {\n await unstickWalletSingle();\n }\n\n let nonce = await client.getTransactionCount({ address: account.address, blockTag: \"pending\" });\n\n for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {\n try {\n return await send({ ...txParams, ...fees, nonce });\n } catch (err) {\n if (attempt >= MAX_RETRIES || !isRetryableError(err)) {\n // Decode contract revert into a human-readable message before throwing\n throw new Error(formatContractError(err));\n }\n\n const msg = err instanceof Error ? err.message : String(err);\n console.warn(` Retry ${attempt + 1}/${MAX_RETRIES}: ${isNonceStaleError(msg) ? \"refreshing nonce\" : \"bumping gas\"}...`);\n\n // Backoff between retries to let mempool settle\n await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));\n\n if (isNonceStaleError(msg)) {\n // Fresh nonce = fresh tx, no replacement needed — only bump fees for underpriced errors\n nonce = await client.getTransactionCount({ address: account.address, blockTag: \"pending\" });\n } else {\n fees = bumpFees(fees);\n }\n }\n }\n throw new Error(\"withRetry: exhausted retries\");\n}\n\n/**\n * Send a raw transaction with automatic gas-bump retry on nonce/underpriced errors.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function sendTxWithRetry(txParams: Record<string, any>): Promise<Hex> {\n const wallet = getWalletClient();\n return withRetry((p) => wallet.sendTransaction(p), txParams);\n}\n\n/**\n * Call writeContract with automatic gas-bump retry on nonce/underpriced errors.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport async function writeContractWithRetry(txParams: Record<string, any>): Promise<Hex> {\n const wallet = getWalletClient();\n return withRetry((p) => wallet.writeContract(p), txParams);\n}\n\n/**\n * Wait for a tx receipt. On timeout, checks for stuck nonce and auto-unsticks.\n *\n * **Important**: After unsticking, the error is still re-thrown because the original\n * tx is lost. Callers should use `writeContractWithRetry` / `sendTxWithRetry` which\n * re-fetch nonces automatically. Do NOT manually retry after this throws — use the\n * retry-aware wrappers instead.\n */\nexport async function waitForReceipt(hash: Hex): Promise<TransactionReceipt> {\n const client = getPublicClient();\n try {\n return await client.waitForTransactionReceipt({ hash });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n // If receipt wait times out, check for stuck nonce\n const msg = err instanceof Error ? err.message : String(err);\n if (msg.includes(\"timeout\") || msg.includes(\"Timed out\")) {\n if ((await detectStuckNonce()) !== null) {\n console.warn(` Tx ${hash} appears stuck — attempting to unstick wallet...`);\n while ((await detectStuckNonce()) !== null) {\n await unstickWalletSingle();\n }\n }\n }\n throw err;\n }\n}\n","/**\n * Contract error decoding — turns raw reverts into human-readable messages.\n *\n * Uses viem's decodeErrorResult() against a combined ABI of all custom errors\n * from SyndicateVault, SyndicateGovernor, GovernorParameters, SyndicateFactory,\n * and strategy contracts.\n */\n\nimport { type Hex, decodeErrorResult, BaseError } from \"viem\";\n\n// ── Combined error-only ABI for decoding ──\n\nexport const CONTRACT_ERRORS_ABI = [\n // ── SyndicateVault ──\n { type: \"error\", name: \"InvalidOwner\", inputs: [] },\n { type: \"error\", name: \"InvalidExecutorImpl\", inputs: [] },\n { type: \"error\", name: \"NotActiveAgent\", inputs: [] },\n { type: \"error\", name: \"SimulationFailed\", inputs: [] },\n { type: \"error\", name: \"InvalidDepositor\", inputs: [] },\n { type: \"error\", name: \"DepositorAlreadyApproved\", inputs: [] },\n { type: \"error\", name: \"DepositorNotApproved\", inputs: [] },\n { type: \"error\", name: \"NotApprovedDepositor\", inputs: [] },\n { type: \"error\", name: \"AgentAlreadyRegistered\", inputs: [] },\n { type: \"error\", name: \"AgentNotActive\", inputs: [] },\n { type: \"error\", name: \"InvalidAgentRegistry\", inputs: [] },\n { type: \"error\", name: \"NotAgentOwner\", inputs: [] },\n { type: \"error\", name: \"NotGovernor\", inputs: [] },\n { type: \"error\", name: \"RedemptionsLocked\", inputs: [] },\n { type: \"error\", name: \"DepositsLocked\", inputs: [] },\n { type: \"error\", name: \"InvalidAgentAddress\", inputs: [] },\n { type: \"error\", name: \"TransferFailed\", inputs: [] },\n { type: \"error\", name: \"ZeroAddress\", inputs: [] },\n { type: \"error\", name: \"CannotRescueAsset\", inputs: [] },\n { type: \"error\", name: \"NotFactory\", inputs: [] },\n\n // ── SyndicateGovernor ──\n { type: \"error\", name: \"VaultNotRegistered\", inputs: [] },\n { type: \"error\", name: \"VaultAlreadyRegistered\", inputs: [] },\n { type: \"error\", name: \"NotRegisteredAgent\", inputs: [] },\n { type: \"error\", name: \"PerformanceFeeTooHigh\", inputs: [] },\n { type: \"error\", name: \"StrategyDurationTooLong\", inputs: [] },\n { type: \"error\", name: \"StrategyDurationTooShort\", inputs: [] },\n { type: \"error\", name: \"EmptyExecuteCalls\", inputs: [] },\n { type: \"error\", name: \"EmptySettlementCalls\", inputs: [] },\n { type: \"error\", name: \"NotWithinVotingPeriod\", inputs: [] },\n { type: \"error\", name: \"NoVotingPower\", inputs: [] },\n { type: \"error\", name: \"AlreadyVoted\", inputs: [] },\n { type: \"error\", name: \"ProposalNotFound\", inputs: [] },\n { type: \"error\", name: \"ProposalNotApproved\", inputs: [] },\n { type: \"error\", name: \"ExecutionWindowExpired\", inputs: [] },\n { type: \"error\", name: \"StrategyAlreadyActive\", inputs: [] },\n { type: \"error\", name: \"CooldownNotElapsed\", inputs: [] },\n { type: \"error\", name: \"ProposalNotExecuted\", inputs: [] },\n { type: \"error\", name: \"ProposalNotCancellable\", inputs: [] },\n { type: \"error\", name: \"NotProposer\", inputs: [] },\n { type: \"error\", name: \"InvalidVotingPeriod\", inputs: [] },\n { type: \"error\", name: \"InvalidExecutionWindow\", inputs: [] },\n { type: \"error\", name: \"InvalidVetoThresholdBps\", inputs: [] },\n { type: \"error\", name: \"InvalidMaxPerformanceFeeBps\", inputs: [] },\n { type: \"error\", name: \"InvalidStrategyDurationBounds\", inputs: [] },\n { type: \"error\", name: \"InvalidCooldownPeriod\", inputs: [] },\n { type: \"error\", name: \"InvalidVault\", inputs: [] },\n { type: \"error\", name: \"NotVaultOwner\", inputs: [] },\n { type: \"error\", name: \"StrategyDurationNotElapsed\", inputs: [] },\n { type: \"error\", name: \"InvalidProtocolFeeBps\", inputs: [] },\n { type: \"error\", name: \"InvalidProtocolFeeRecipient\", inputs: [] },\n { type: \"error\", name: \"NotCoProposer\", inputs: [] },\n { type: \"error\", name: \"CollaborationExpired\", inputs: [] },\n { type: \"error\", name: \"AlreadyApproved\", inputs: [] },\n { type: \"error\", name: \"InvalidSplits\", inputs: [] },\n { type: \"error\", name: \"TooManyCoProposers\", inputs: [] },\n { type: \"error\", name: \"SplitTooLow\", inputs: [] },\n { type: \"error\", name: \"LeadSplitTooLow\", inputs: [] },\n { type: \"error\", name: \"DuplicateCoProposer\", inputs: [] },\n { type: \"error\", name: \"NotDraftState\", inputs: [] },\n { type: \"error\", name: \"InvalidCollaborationWindow\", inputs: [] },\n { type: \"error\", name: \"NotAuthorized\", inputs: [] },\n { type: \"error\", name: \"InvalidMaxCoProposers\", inputs: [] },\n { type: \"error\", name: \"Reentrancy\", inputs: [] },\n\n // ── GovernorParameters (timelock) ──\n { type: \"error\", name: \"ChangeAlreadyPending\", inputs: [] },\n { type: \"error\", name: \"NoChangePending\", inputs: [] },\n { type: \"error\", name: \"ChangeNotReady\", inputs: [] },\n { type: \"error\", name: \"InvalidParameterChangeDelay\", inputs: [] },\n { type: \"error\", name: \"InvalidParameterKey\", inputs: [] },\n\n // ── SyndicateFactory ──\n { type: \"error\", name: \"InvalidVaultImpl\", inputs: [] },\n { type: \"error\", name: \"InvalidENSRegistrar\", inputs: [] },\n { type: \"error\", name: \"SubdomainTooShort\", inputs: [] },\n { type: \"error\", name: \"SubdomainTaken\", inputs: [] },\n { type: \"error\", name: \"NotCreator\", inputs: [] },\n { type: \"error\", name: \"InvalidGovernor\", inputs: [] },\n { type: \"error\", name: \"InsufficientCreationFee\", inputs: [] },\n { type: \"error\", name: \"InvalidFeeToken\", inputs: [] },\n { type: \"error\", name: \"ManagementFeeTooHigh\", inputs: [] },\n { type: \"error\", name: \"UpgradesDisabled\", inputs: [] },\n { type: \"error\", name: \"VaultNotDeployed\", inputs: [] },\n { type: \"error\", name: \"StrategyActive\", inputs: [] },\n\n // ── BaseStrategy ──\n { type: \"error\", name: \"AlreadyInitialized\", inputs: [] },\n { type: \"error\", name: \"NotVault\", inputs: [] },\n { type: \"error\", name: \"NotExecuted\", inputs: [] },\n { type: \"error\", name: \"AlreadyExecuted\", inputs: [] },\n { type: \"error\", name: \"AlreadySettled\", inputs: [] },\n\n // ── MoonwellSupplyStrategy / WstETHMoonwellStrategy ──\n { type: \"error\", name: \"InvalidAmount\", inputs: [] },\n { type: \"error\", name: \"MintFailed\", inputs: [] },\n { type: \"error\", name: \"RedeemFailed\", inputs: [] },\n\n // ── AerodromeLPStrategy ──\n { type: \"error\", name: \"GaugeMismatch\", inputs: [] },\n\n // ── WstETHMoonwellStrategy / VeniceInferenceStrategy ──\n { type: \"error\", name: \"SwapFailed\", inputs: [] },\n { type: \"error\", name: \"AlreadySettledParams\", inputs: [] },\n\n // ── PortfolioStrategy / UniswapSwapAdapter ──\n { type: \"error\", name: \"QuoteUnavailable\", inputs: [] },\n { type: \"error\", name: \"UnsupportedMode\", inputs: [] },\n { type: \"error\", name: \"InvalidWeights\", inputs: [] },\n { type: \"error\", name: \"LengthMismatch\", inputs: [] },\n { type: \"error\", name: \"TooManyTokens\", inputs: [] },\n { type: \"error\", name: \"RebalancingInProgress\", inputs: [] },\n { type: \"error\", name: \"StalePrice\", inputs: [] },\n { type: \"error\", name: \"InvalidSlippage\", inputs: [] },\n { type: \"error\", name: \"InvalidPriceDecimals\", inputs: [] },\n\n // ── VeniceInferenceStrategy ──\n { type: \"error\", name: \"NoAgent\", inputs: [] },\n] as const;\n\n// ── Human-readable error messages ──\n\nconst ERROR_MESSAGES: Record<string, string> = {\n // Vault — permissions / state\n InvalidOwner: \"The caller is not the vault owner.\",\n NotActiveAgent: \"Your wallet is not registered as an active agent on this vault. Ask the creator to run: sherwood syndicate approve --agent-id <id> --wallet <your-address>\",\n NotApprovedDepositor: \"Your address is not on the depositor whitelist. Ask the vault creator to approve you.\",\n NotGovernor: \"This operation can only be called by the governor contract.\",\n NotFactory: \"This operation can only be called by the factory contract.\",\n RedemptionsLocked: \"Redemptions are locked while a strategy is executing. Wait for the proposal to be settled.\",\n DepositsLocked: \"Deposits are locked while an active proposal exists. Wait for settlement.\",\n InvalidDepositor: \"Invalid depositor address.\",\n DepositorAlreadyApproved: \"This depositor is already on the whitelist.\",\n DepositorNotApproved: \"This depositor is not on the whitelist.\",\n AgentAlreadyRegistered: \"This agent wallet is already registered on the vault.\",\n AgentNotActive: \"This agent is registered but not active.\",\n InvalidAgentRegistry: \"Agent registry address is invalid.\",\n NotAgentOwner: \"You do not own this ERC-8004 agent identity NFT.\",\n InvalidAgentAddress: \"Invalid agent wallet address (cannot be zero).\",\n InvalidExecutorImpl: \"Executor implementation address is invalid.\",\n SimulationFailed: \"Transaction simulation failed — the batch calls would revert onchain.\",\n TransferFailed: \"ERC-20 token transfer failed. Check token balance and approvals.\",\n ZeroAddress: \"A required address parameter is the zero address.\",\n CannotRescueAsset: \"Cannot rescue the vault's underlying asset — use redeem() instead.\",\n\n // Governor — proposal lifecycle\n VaultNotRegistered: \"This vault is not registered with the governor. The factory registers vaults automatically on creation.\",\n VaultAlreadyRegistered: \"This vault is already registered with the governor.\",\n NotRegisteredAgent: \"Your wallet is not a registered agent on this vault. Register first via: sherwood syndicate approve\",\n PerformanceFeeTooHigh: \"Performance fee exceeds the governor's maxPerformanceFeeBps. Check: sherwood governor info\",\n StrategyDurationTooLong: \"Strategy duration exceeds the governor's maxStrategyDuration. Check: sherwood governor info\",\n StrategyDurationTooShort: \"Strategy duration is below the governor's minStrategyDuration. Check: sherwood governor info\",\n EmptyExecuteCalls: \"Proposal must include at least one execute call.\",\n EmptySettlementCalls: \"Proposal must include at least one settlement call.\",\n NotWithinVotingPeriod: \"Voting period has not started or has already ended. Check: sherwood proposal show <id>\",\n NoVotingPower: \"You have no voting power (zero vault shares at the snapshot time).\",\n AlreadyVoted: \"You have already voted on this proposal.\",\n ProposalNotFound: \"Proposal does not exist. Check the proposal ID.\",\n ProposalNotApproved: \"Proposal is not in Approved state. It may still be in voting or was rejected.\",\n ExecutionWindowExpired: \"The execution window has closed. The proposal is now Expired.\",\n StrategyAlreadyActive: \"Another strategy is currently executing on this vault. Settle it first before executing a new proposal.\",\n CooldownNotElapsed: \"A proposal was recently settled. Wait for the cooldown period to elapse. Check: sherwood governor info\",\n ProposalNotExecuted: \"Proposal has not been executed yet. Execute it first.\",\n ProposalNotCancellable: \"This proposal cannot be cancelled in its current state.\",\n NotProposer: \"Only the original proposer can perform this action.\",\n StrategyDurationNotElapsed: \"Strategy duration has not elapsed yet. Only the proposer can settle early.\",\n\n // Governor — parameter validation\n InvalidVotingPeriod: \"Voting period is outside allowed bounds (check governor constants).\",\n InvalidExecutionWindow: \"Execution window is outside allowed bounds.\",\n InvalidVetoThresholdBps: \"Veto threshold must be between the allowed bounds (in bps).\",\n InvalidMaxPerformanceFeeBps: \"Max performance fee is outside allowed bounds.\",\n InvalidStrategyDurationBounds: \"Strategy duration bounds are invalid (min must be < max).\",\n InvalidCooldownPeriod: \"Cooldown period is outside allowed bounds.\",\n InvalidVault: \"Invalid vault address.\",\n NotVaultOwner: \"Only the vault owner can perform this action.\",\n InvalidProtocolFeeBps: \"Protocol fee exceeds the 10% maximum (1000 bps).\",\n InvalidProtocolFeeRecipient: \"Protocol fee recipient must be set before enabling protocol fees.\",\n\n // Governor — collaborative proposals\n NotCoProposer: \"You are not listed as a co-proposer on this proposal.\",\n CollaborationExpired: \"The collaboration window has expired.\",\n AlreadyApproved: \"This co-proposer has already approved.\",\n InvalidSplits: \"Co-proposer fee splits must sum correctly with the lead proposer split.\",\n TooManyCoProposers: \"Exceeds the maximum number of co-proposers. Check: sherwood governor info\",\n SplitTooLow: \"A co-proposer's fee split is below the minimum.\",\n LeadSplitTooLow: \"The lead proposer's fee split is below the minimum.\",\n DuplicateCoProposer: \"Duplicate co-proposer address in the list.\",\n NotDraftState: \"Proposal must be in Draft state for this operation.\",\n InvalidCollaborationWindow: \"Collaboration window is outside allowed bounds.\",\n NotAuthorized: \"You are not authorized to perform this action.\",\n InvalidMaxCoProposers: \"Max co-proposers value is outside allowed bounds.\",\n Reentrancy: \"Reentrancy detected — this call cannot be made during another call.\",\n\n // Governor — parameter timelock\n ChangeAlreadyPending: \"A parameter change is already pending for this parameter. Finalize or cancel it first.\",\n NoChangePending: \"No parameter change is pending for this key.\",\n ChangeNotReady: \"Parameter change timelock has not elapsed yet. Wait for the delay to pass, then finalize.\",\n InvalidParameterChangeDelay: \"Parameter change delay is outside allowed bounds.\",\n InvalidParameterKey: \"Unknown parameter key.\",\n\n // Factory\n InvalidVaultImpl: \"Vault implementation address is invalid.\",\n InvalidENSRegistrar: \"ENS registrar address is invalid.\",\n SubdomainTooShort: \"Subdomain must be at least 3 characters.\",\n SubdomainTaken: \"This subdomain is already taken. Choose a different name.\",\n NotCreator: \"Only the syndicate creator can perform this action.\",\n InvalidGovernor: \"Governor address is invalid.\",\n InsufficientCreationFee: \"Insufficient creation fee. Check the required fee amount.\",\n InvalidFeeToken: \"Invalid fee token address.\",\n ManagementFeeTooHigh: \"Management fee exceeds the maximum allowed.\",\n UpgradesDisabled: \"Vault upgrades are currently disabled by the factory owner.\",\n VaultNotDeployed: \"Vault has not been deployed yet.\",\n StrategyActive: \"Cannot perform this action while a strategy is actively executing.\",\n\n // Strategy — base\n AlreadyInitialized: \"This strategy clone was already initialized. Deploy a fresh clone.\",\n NotVault: \"Only the vault can call this strategy function.\",\n NotExecuted: \"Strategy has not been executed yet.\",\n AlreadyExecuted: \"Strategy has already been executed.\",\n AlreadySettled: \"Strategy has already been settled.\",\n\n // Strategy — Moonwell / WstETH\n InvalidAmount: \"Invalid amount — must be greater than zero.\",\n MintFailed: \"Moonwell cToken mint failed. The underlying supply may have hit the market cap.\",\n RedeemFailed: \"Moonwell cToken redeem failed. Check that sufficient liquidity is available.\",\n\n // Strategy — Aerodrome\n GaugeMismatch: \"Aerodrome gauge does not match the expected pool.\",\n\n // Strategy — WstETH / Venice\n SwapFailed: \"Token swap failed. Check slippage tolerance and pool liquidity.\",\n AlreadySettledParams: \"Settlement parameters have already been set.\",\n\n // Strategy — Portfolio / UniswapSwapAdapter\n QuoteUnavailable:\n \"Uniswap quoter returned 0 or reverted for a portfolio allocation. \" +\n \"Usually means: (a) no V3 pool exists at the requested fee tier for one of the tokens, \" +\n \"(b) the strategy clone was initialized against an old/broken UniswapSwapAdapter \" +\n \"(check the clone's swapAdapter() vs the current chains JSON), or \" +\n \"(c) the adapter is calling Quoter with the wrong ABI (pre-PR #317 bug).\",\n UnsupportedMode: \"UniswapSwapAdapter doesn't support that swap mode. Only V3 single-hop (mode 0) and multi-hop (mode 1) are supported.\",\n InvalidWeights: \"Portfolio weights must sum to 10000 bps (100%).\",\n LengthMismatch: \"Portfolio input arrays (tokens / weights / swapExtraData / priceDecimals) must have the same length.\",\n TooManyTokens: \"Portfolio basket exceeds the maximum allocation count (20).\",\n RebalancingInProgress: \"A rebalance is already in flight on this clone. Wait for it to finish.\",\n StalePrice: \"Chainlink Data Streams report has expired. Refresh prices and retry.\",\n InvalidSlippage: \"maxSlippageBps must be > 0 and < 10000.\",\n InvalidPriceDecimals: \"priceDecimals entry exceeds 36. Use 8 for tokenized-stock feeds, 18 for crypto pairs.\",\n\n // Strategy — Venice\n NoAgent: \"No agent is registered on the vault. Register an agent first.\",\n};\n\n// ── Decoding ──\n\n/**\n * Attempt to decode a hex revert selector into a human-readable error message.\n * Returns null if the selector doesn't match any known contract error.\n */\nexport function decodeContractError(data: Hex): { name: string; message: string } | null {\n try {\n const decoded = decodeErrorResult({\n abi: CONTRACT_ERRORS_ABI,\n data,\n });\n const message = ERROR_MESSAGES[decoded.errorName] || `Contract error: ${decoded.errorName}`;\n return { name: decoded.errorName, message };\n } catch {\n return null;\n }\n}\n\n/**\n * Extract a hex error selector from a viem error's walk chain.\n * viem wraps contract call reverts in ContractFunctionRevertedError which\n * contains a `data` field with the raw 4-byte (or longer) revert payload.\n */\nfunction extractRevertData(err: unknown): Hex | null {\n if (!(err instanceof BaseError)) return null;\n\n // Walk the viem error chain to find revert data\n const revertError = err.walk((e) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (e as any).data !== undefined;\n });\n\n if (revertError) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const data = (revertError as any).data;\n // data can be the hex string directly, or an object with a data field\n if (typeof data === \"string\" && data.startsWith(\"0x\")) {\n return data as Hex;\n }\n if (typeof data === \"object\" && data?.data && typeof data.data === \"string\") {\n return data.data as Hex;\n }\n }\n\n // Fallback: extract 0x + hex from the error message (e.g. \"reverted with 0x62df0545\")\n const msg = err.message || \"\";\n const match = msg.match(/(?:signature|data)\\s*\"?(0x[0-9a-fA-F]+)\"?/);\n if (match) return match[1] as Hex;\n\n return null;\n}\n\n// ── Known common EVM / ERC-20 revert strings ──\n\nconst KNOWN_REVERT_STRINGS: Record<string, string> = {\n \"ERC20: transfer amount exceeds balance\": \"Insufficient token balance for this transfer.\",\n \"ERC20: transfer amount exceeds allowance\": \"Token allowance insufficient. An approval step may have been skipped.\",\n \"ERC20: insufficient allowance\": \"Token allowance insufficient. An approval step may have been skipped.\",\n \"Ownable: caller is not the owner\": \"Only the contract owner can call this function.\",\n \"Pausable: paused\": \"The contract is currently paused.\",\n};\n\n/**\n * Format any caught error into a user-friendly message.\n *\n * Tries (in order):\n * 1. Decode custom error selector from our contract ABIs\n * 2. Match known EVM/ERC-20 revert reason strings\n * 3. Identify nonce / gas issues with actionable advice\n * 4. Fall back to the raw error message\n */\nexport function formatContractError(err: unknown): string {\n // 1. Try to decode custom contract error\n const revertData = extractRevertData(err);\n if (revertData && revertData.length >= 10) {\n const decoded = decodeContractError(revertData);\n if (decoded) return decoded.message;\n }\n\n const rawMsg = err instanceof Error ? err.message : String(err);\n\n // 2. Check for known revert reason strings\n for (const [pattern, message] of Object.entries(KNOWN_REVERT_STRINGS)) {\n if (rawMsg.includes(pattern)) return message;\n }\n\n // 3. Nonce / gas issues — already handled by retry, but surface clearly if they bubble up\n if (rawMsg.includes(\"replacement transaction underpriced\")) {\n return \"A previous transaction is stuck. The CLI retried with higher gas but the error persists. Try again in a moment.\";\n }\n if (rawMsg.includes(\"nonce too low\") || rawMsg.includes(\"NONCE_EXPIRED\")) {\n return \"Transaction nonce conflict — a previous transaction is still pending. Wait a moment and retry.\";\n }\n if (rawMsg.includes(\"insufficient funds for gas\")) {\n return \"Insufficient ETH for gas fees. Top up your wallet with ETH on Base.\";\n }\n\n // 4. Clean up common viem wrapper noise\n // Strip \"ContractFunctionRevertedError:\" prefix and \"Docs:\" links\n let cleaned = rawMsg\n .replace(/ContractFunctionRevertedError:\\s*/g, \"\")\n .replace(/Docs:\\s*https:\\/\\/\\S+/g, \"\")\n .replace(/Version:\\s*viem@\\S+/g, \"\")\n .replace(/Request Arguments:[\\s\\S]*$/m, \"\")\n .replace(/Contract Call:[\\s\\S]*?(?=\\n\\n|\\n[A-Z]|$)/m, \"\")\n .trim();\n\n // If we still have \"reverted with the following signature: 0x...\" try one more decode\n const sigMatch = cleaned.match(/signature[:\\s]+\"?(0x[0-9a-fA-F]{8,})\"?/);\n if (sigMatch) {\n const decoded = decodeContractError(sigMatch[1] as Hex);\n if (decoded) return decoded.message;\n // If we can't decode it, at least explain what it is\n cleaned = `Contract reverted with unknown error selector ${sigMatch[1]}. Check the transaction on Basescan for details.`;\n }\n\n return cleaned;\n}\n"],"mappings":";;;;;;;;;AAQA,SAAS,oBAAoB,oBAAoB,UAAU,YAAY;AACvE,SAAS,2BAA2B;;;ACDpC,SAAmB,mBAAmB,iBAAiB;AAIhD,IAAM,sBAAsB;AAAA;AAAA,EAEjC,EAAE,MAAM,SAAS,MAAM,gBAAgB,QAAQ,CAAC,EAAE;AAAA,EAClD,EAAE,MAAM,SAAS,MAAM,uBAAuB,QAAQ,CAAC,EAAE;AAAA,EACzD,EAAE,MAAM,SAAS,MAAM,kBAAkB,QAAQ,CAAC,EAAE;AAAA,EACpD,EAAE,MAAM,SAAS,MAAM,oBAAoB,QAAQ,CAAC,EAAE;AAAA,EACtD,EAAE,MAAM,SAAS,MAAM,oBAAoB,QAAQ,CAAC,EAAE;AAAA,EACtD,EAAE,MAAM,SAAS,MAAM,4BAA4B,QAAQ,CAAC,EAAE;AAAA,EAC9D,EAAE,MAAM,SAAS,MAAM,wBAAwB,QAAQ,CAAC,EAAE;AAAA,EAC1D,EAAE,MAAM,SAAS,MAAM,wBAAwB,QAAQ,CAAC,EAAE;AAAA,EAC1D,EAAE,MAAM,SAAS,MAAM,0BAA0B,QAAQ,CAAC,EAAE;AAAA,EAC5D,EAAE,MAAM,SAAS,MAAM,kBAAkB,QAAQ,CAAC,EAAE;AAAA,EACpD,EAAE,MAAM,SAAS,MAAM,wBAAwB,QAAQ,CAAC,EAAE;AAAA,EAC1D,EAAE,MAAM,SAAS,MAAM,iBAAiB,QAAQ,CAAC,EAAE;AAAA,EACnD,EAAE,MAAM,SAAS,MAAM,eAAe,QAAQ,CAAC,EAAE;AAAA,EACjD,EAAE,MAAM,SAAS,MAAM,qBAAqB,QAAQ,CAAC,EAAE;AAAA,EACvD,EAAE,MAAM,SAAS,MAAM,kBAAkB,QAAQ,CAAC,EAAE;AAAA,EACpD,EAAE,MAAM,SAAS,MAAM,uBAA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ractWithRetry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YJSCIQUZ.js";
|
|
11
11
|
import {
|
|
12
12
|
CHAIN_REGISTRY,
|
|
13
13
|
getChain,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "./chunk-2LRC7I33.js";
|
|
19
19
|
import {
|
|
20
20
|
EAS_ABI
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-SKOVJ7XM.js";
|
|
22
22
|
|
|
23
23
|
// src/lib/eas.ts
|
|
24
24
|
import { encodeAbiParameters, parseAbiParameters, decodeAbiParameters } from "viem";
|
|
@@ -453,4 +453,4 @@ export {
|
|
|
453
453
|
queryApprovals,
|
|
454
454
|
queryJoinRequests
|
|
455
455
|
};
|
|
456
|
-
//# sourceMappingURL=chunk-
|
|
456
|
+
//# sourceMappingURL=chunk-ZOFZWUMC.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
unstickWallet,
|
|
11
11
|
waitForReceipt,
|
|
12
12
|
writeContractWithRetry
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YJSCIQUZ.js";
|
|
14
14
|
import "./chunk-2LRC7I33.js";
|
|
15
15
|
import "./chunk-2W4KGGPU.js";
|
|
16
16
|
export {
|
|
@@ -26,4 +26,4 @@ export {
|
|
|
26
26
|
waitForReceipt,
|
|
27
27
|
writeContractWithRetry
|
|
28
28
|
};
|
|
29
|
-
//# sourceMappingURL=client-
|
|
29
|
+
//# sourceMappingURL=client-KBBFAMEI.js.map
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
revokeAttestation,
|
|
18
18
|
revokeJoinRequest,
|
|
19
19
|
stripReferrerPrefix
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-ZOFZWUMC.js";
|
|
21
|
+
import "./chunk-VAOCUQMY.js";
|
|
22
|
+
import "./chunk-YJSCIQUZ.js";
|
|
23
23
|
import "./chunk-2LRC7I33.js";
|
|
24
24
|
import "./chunk-2W4KGGPU.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-SKOVJ7XM.js";
|
|
26
26
|
export {
|
|
27
27
|
createApproval,
|
|
28
28
|
createJoinRequest,
|
|
@@ -43,4 +43,4 @@ export {
|
|
|
43
43
|
revokeJoinRequest,
|
|
44
44
|
stripReferrerPrefix
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=eas-
|
|
46
|
+
//# sourceMappingURL=eas-M6XC7MRC.js.map
|
|
@@ -34,12 +34,12 @@ import {
|
|
|
34
34
|
settleProposal,
|
|
35
35
|
vetoProposal,
|
|
36
36
|
vote
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-G6MBVVH7.js";
|
|
38
|
+
import "./chunk-VAOCUQMY.js";
|
|
39
|
+
import "./chunk-YJSCIQUZ.js";
|
|
40
40
|
import "./chunk-2LRC7I33.js";
|
|
41
41
|
import "./chunk-2W4KGGPU.js";
|
|
42
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-SKOVJ7XM.js";
|
|
43
43
|
export {
|
|
44
44
|
PROPOSAL_STATE,
|
|
45
45
|
PROPOSAL_STATES,
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
vetoProposal,
|
|
78
78
|
vote
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=governor-
|
|
80
|
+
//# sourceMappingURL=governor-CRV74AJ7.js.map
|
package/dist/index.js
CHANGED
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
encodeSwapPath,
|
|
16
16
|
getMultiHopQuote,
|
|
17
17
|
getQuote
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-KTWP2UTY.js";
|
|
19
19
|
import {
|
|
20
20
|
chatCompletion,
|
|
21
21
|
checkApiKeyValid,
|
|
22
22
|
listModels,
|
|
23
23
|
provisionApiKey
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-UBAX22KA.js";
|
|
25
25
|
import {
|
|
26
26
|
createApproval,
|
|
27
27
|
createJoinRequest,
|
|
@@ -32,14 +32,14 @@ import {
|
|
|
32
32
|
queryJoinRequests,
|
|
33
33
|
revokeJoinRequest,
|
|
34
34
|
stripReferrerPrefix
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-ZOFZWUMC.js";
|
|
36
36
|
import {
|
|
37
37
|
createSyndicate,
|
|
38
38
|
getActiveSyndicates,
|
|
39
39
|
getSyndicate,
|
|
40
40
|
subdomainExists,
|
|
41
41
|
updateMetadata
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-6TJVN5JR.js";
|
|
43
43
|
import {
|
|
44
44
|
approveDepositor,
|
|
45
45
|
deposit,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
searchSyndicateAcrossChains,
|
|
64
64
|
setTextRecord,
|
|
65
65
|
setVaultAddress
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-M3KSKVOT.js";
|
|
67
67
|
import {
|
|
68
68
|
PROPOSAL_STATE,
|
|
69
69
|
PROPOSAL_STATES,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
setVotingPeriod,
|
|
96
96
|
settleProposal,
|
|
97
97
|
vote
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-G6MBVVH7.js";
|
|
99
99
|
import {
|
|
100
100
|
AERODROME,
|
|
101
101
|
AGENT_REGISTRY,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
TOKENS,
|
|
108
108
|
UNISWAP,
|
|
109
109
|
VENICE
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-VAOCUQMY.js";
|
|
111
111
|
import {
|
|
112
112
|
formatContractError,
|
|
113
113
|
getAccount,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
sendTxWithRetry,
|
|
117
117
|
waitForReceipt,
|
|
118
118
|
writeContractWithRetry
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-YJSCIQUZ.js";
|
|
120
120
|
import {
|
|
121
121
|
CHAIN_REGISTRY,
|
|
122
122
|
VALID_NETWORKS,
|
|
@@ -161,7 +161,7 @@ import {
|
|
|
161
161
|
SWAP_ROUTER_EXACT_INPUT_SINGLE_ABI,
|
|
162
162
|
SYNDICATE_VAULT_ABI,
|
|
163
163
|
VENICE_STAKING_ABI
|
|
164
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-SKOVJ7XM.js";
|
|
165
165
|
import {
|
|
166
166
|
fetchMetadata,
|
|
167
167
|
uploadMetadata
|
|
@@ -1702,9 +1702,9 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
1702
1702
|
console.error(chalk.red("Missing --name, --performance-fee, or --duration. Use --write-calls to skip proposal submission."));
|
|
1703
1703
|
process.exit(1);
|
|
1704
1704
|
}
|
|
1705
|
-
const { propose: propose2 } = await import("./governor-
|
|
1705
|
+
const { propose: propose2 } = await import("./governor-CRV74AJ7.js");
|
|
1706
1706
|
const { pinJSON } = await import("./ipfs-IGXLLJCF.js");
|
|
1707
|
-
const { parseDuration: parseDuration2 } = await import("./governor-
|
|
1707
|
+
const { parseDuration: parseDuration2 } = await import("./governor-CRV74AJ7.js");
|
|
1708
1708
|
const performanceFeeBps = BigInt(opts.performanceFee);
|
|
1709
1709
|
if (performanceFeeBps < 0n || performanceFeeBps > 10000n) {
|
|
1710
1710
|
console.error(chalk.red("--performance-fee must be 0-10000 (basis points)"));
|
|
@@ -1812,7 +1812,7 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
1812
1812
|
let prices = [];
|
|
1813
1813
|
let priceSource = null;
|
|
1814
1814
|
try {
|
|
1815
|
-
const { getTokenPricesInAsset } = await import("./price-
|
|
1815
|
+
const { getTokenPricesInAsset } = await import("./price-PSBQZKNM.js");
|
|
1816
1816
|
prices = await getTokenPricesInAsset({
|
|
1817
1817
|
tokens: allocations.map((a, i) => ({
|
|
1818
1818
|
token: a.token,
|
|
@@ -2242,7 +2242,7 @@ function registerVeniceCommands(program2) {
|
|
|
2242
2242
|
console.log(chalk2.dim(` Key: ${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`));
|
|
2243
2243
|
console.log(chalk2.dim(" Saved to ~/.sherwood/config.json"));
|
|
2244
2244
|
try {
|
|
2245
|
-
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-
|
|
2245
|
+
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-M6XC7MRC.js");
|
|
2246
2246
|
const { uid } = await createVeniceProvisionAttestation(account.address);
|
|
2247
2247
|
if (uid !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
2248
2248
|
console.log(chalk2.dim(` Attested: ${getEasScanUrl2(uid)}`));
|
|
@@ -2598,7 +2598,7 @@ ${opts.prompt}`;
|
|
|
2598
2598
|
console.log(chalk2.dim(`Model: ${result.model} | Tokens: ${result.usage.promptTokens} in, ${result.usage.completionTokens} out, ${result.usage.totalTokens} total`));
|
|
2599
2599
|
}
|
|
2600
2600
|
try {
|
|
2601
|
-
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-
|
|
2601
|
+
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-M6XC7MRC.js");
|
|
2602
2602
|
const { keccak256: keccak2562, toHex, isAddress: isAddr } = await import("viem");
|
|
2603
2603
|
const { getChainContracts: getChainContracts2 } = await import("./config-REASKDIK.js");
|
|
2604
2604
|
const { getChain: getActiveChain } = await import("./network-3ZU7UBDU.js");
|
|
@@ -3813,8 +3813,8 @@ function printSimulationResult(result, callType) {
|
|
|
3813
3813
|
}
|
|
3814
3814
|
async function sendSimulationAlert(subdomain, proposalId, vault, execResult, settleResult) {
|
|
3815
3815
|
try {
|
|
3816
|
-
const xmtp = await import("./xmtp-
|
|
3817
|
-
const { getAccount: getAccount2 } = await import("./client-
|
|
3816
|
+
const xmtp = await import("./xmtp-F4RRSWVL.js");
|
|
3817
|
+
const { getAccount: getAccount2 } = await import("./client-KBBFAMEI.js");
|
|
3818
3818
|
const group = await xmtp.getGroup("", subdomain);
|
|
3819
3819
|
const allRisks = [...execResult.risks, ...settleResult?.risks ?? []];
|
|
3820
3820
|
const criticals = allRisks.filter((r) => r.level === "critical");
|
|
@@ -7046,7 +7046,7 @@ function parseTokenSplit(raw, tokens) {
|
|
|
7046
7046
|
}
|
|
7047
7047
|
function registerGridCommand(program2) {
|
|
7048
7048
|
const grid = program2.command("grid").description("Grid trading strategy \u2014 ATR-based grid on BTC/ETH/SOL");
|
|
7049
|
-
grid.command("start").description("Start the grid trading loop").option("--capital <usd>", "Starting capital in USD", "5000").option("--cycle <seconds>", "Cycle interval in seconds", "60").option("--tokens <list>", "Comma-separated token list", "bitcoin,ethereum,solana").option("--leverage <n>", "Leverage multiplier", String(DEFAULT_GRID_CONFIG.leverage)).option("--levels <n>", "Grid levels per side", String(DEFAULT_GRID_CONFIG.levelsPerSide)).option("--live", "enable live execution (places real orders on Hyperliquid)").option("--asset-indices <pairs>", "comma-separated token=index pairs (
|
|
7049
|
+
grid.command("start").description("Start the grid trading loop").option("--capital <usd>", "Starting capital in USD", "5000").option("--cycle <seconds>", "Cycle interval in seconds", "60").option("--tokens <list>", "Comma-separated token list", "bitcoin,ethereum,solana").option("--leverage <n>", "Leverage multiplier", String(DEFAULT_GRID_CONFIG.leverage)).option("--levels <n>", "Grid levels per side", String(DEFAULT_GRID_CONFIG.levelsPerSide)).option("--live", "enable live execution (places real orders on Hyperliquid)").option("--asset-indices <pairs>", "comma-separated token=index pairs (e.g. bitcoin=3,ethereum=4,solana=5)").option("--strategy <address>", "on-chain strategy contract address (enables on-chain executor)").option("--token-split <pairs>", "Comma-separated token=weight pairs (must sum to 1.0). Default: equal-weight.").option("--state-dir <path>", "Override directory for portfolio.json / hedge.json / cycles.jsonl / onchain-state.json. Defaults to ~/.sherwood/grid. Use a separate dir to run paper and live grids in parallel.").action(async (opts) => {
|
|
7050
7050
|
const capital = parseFloat(opts.capital);
|
|
7051
7051
|
const cycleMs = parseInt(opts.cycle, 10) * 1e3;
|
|
7052
7052
|
const tokens = opts.tokens.split(",").map((t) => t.trim());
|
|
@@ -7057,7 +7057,7 @@ function registerGridCommand(program2) {
|
|
|
7057
7057
|
let assetIndices;
|
|
7058
7058
|
if (live) {
|
|
7059
7059
|
if (!opts.assetIndices) {
|
|
7060
|
-
throw new Error("--asset-indices required when --live (
|
|
7060
|
+
throw new Error("--asset-indices required when --live (e.g. --asset-indices bitcoin=3,ethereum=4,solana=5)");
|
|
7061
7061
|
}
|
|
7062
7062
|
assetIndices = {};
|
|
7063
7063
|
for (const pair of opts.assetIndices.split(",")) {
|
|
@@ -7283,7 +7283,7 @@ try {
|
|
|
7283
7283
|
var require2 = createRequire(import.meta.url);
|
|
7284
7284
|
var { version: CLI_VERSION } = require2("../package.json");
|
|
7285
7285
|
async function loadXmtp() {
|
|
7286
|
-
return import("./xmtp-
|
|
7286
|
+
return import("./xmtp-F4RRSWVL.js");
|
|
7287
7287
|
}
|
|
7288
7288
|
async function loadCron() {
|
|
7289
7289
|
return import("./cron-EOULYO3R.js");
|
|
@@ -7808,7 +7808,7 @@ syndicate.command("add").description("Register an agent on a syndicate vault (cr
|
|
|
7808
7808
|
if (opts.agentId) {
|
|
7809
7809
|
agentId = BigInt(opts.agentId);
|
|
7810
7810
|
} else {
|
|
7811
|
-
const { AGENT_REGISTRY: AGENT_REGISTRY2 } = await import("./addresses-
|
|
7811
|
+
const { AGENT_REGISTRY: AGENT_REGISTRY2 } = await import("./addresses-FXTJXDI7.js");
|
|
7812
7812
|
const registry2 = AGENT_REGISTRY2().IDENTITY_REGISTRY;
|
|
7813
7813
|
if (registry2 === "0x0000000000000000000000000000000000000000") {
|
|
7814
7814
|
agentId = 0n;
|
|
@@ -8422,7 +8422,7 @@ vaultCmd.command("redeem").description("Redeem vault shares for the underlying a
|
|
|
8422
8422
|
var strategy = program.command("strategy").description("Strategy templates \u2014 list, clone, propose");
|
|
8423
8423
|
registerStrategyTemplateCommands(strategy);
|
|
8424
8424
|
program.command("providers").description("List available DeFi providers").action(async () => {
|
|
8425
|
-
const { MessariProvider, NansenProvider } = await import("./research-
|
|
8425
|
+
const { MessariProvider, NansenProvider } = await import("./research-N3R5MU6Q.js");
|
|
8426
8426
|
const providers = [new MoonwellProvider(), new UniswapProvider(), new MessariProvider(), new NansenProvider()];
|
|
8427
8427
|
for (const p of providers) {
|
|
8428
8428
|
const info = p.info();
|
|
@@ -8433,7 +8433,7 @@ ${info.name} (${info.type})`);
|
|
|
8433
8433
|
}
|
|
8434
8434
|
});
|
|
8435
8435
|
try {
|
|
8436
|
-
const { registerChatCommands } = await import("./chat-
|
|
8436
|
+
const { registerChatCommands } = await import("./chat-325YZ7PA.js");
|
|
8437
8437
|
registerChatCommands(program);
|
|
8438
8438
|
} catch {
|
|
8439
8439
|
program.command("chat <name> [action] [actionArgs...]").description("Syndicate chat (XMTP) \u2014 requires @xmtp/cli").action(() => {
|
|
@@ -8443,7 +8443,7 @@ try {
|
|
|
8443
8443
|
process.exit(1);
|
|
8444
8444
|
});
|
|
8445
8445
|
}
|
|
8446
|
-
var { registerSessionCommands } = await import("./session-
|
|
8446
|
+
var { registerSessionCommands } = await import("./session-G5OEV4OY.js");
|
|
8447
8447
|
registerSessionCommands(program);
|
|
8448
8448
|
registerVeniceCommands(program);
|
|
8449
8449
|
registerAllowanceCommands(program);
|
|
@@ -8451,11 +8451,11 @@ registerIdentityCommands(program);
|
|
|
8451
8451
|
registerProposalCommands(program);
|
|
8452
8452
|
registerGovernorCommands(program);
|
|
8453
8453
|
registerGuardianCommands(program);
|
|
8454
|
-
var { registerResearchCommands } = await import("./research-
|
|
8454
|
+
var { registerResearchCommands } = await import("./research-7BGMM554.js");
|
|
8455
8455
|
registerResearchCommands(program);
|
|
8456
|
-
var { registerAgentCommands } = await import("./agent-
|
|
8456
|
+
var { registerAgentCommands } = await import("./agent-ASULMU7P.js");
|
|
8457
8457
|
registerAgentCommands(program);
|
|
8458
|
-
var { registerTradeCommands } = await import("./trade-
|
|
8458
|
+
var { registerTradeCommands } = await import("./trade-B3A6HMDJ.js");
|
|
8459
8459
|
registerTradeCommands(program);
|
|
8460
8460
|
registerGridCommand(program);
|
|
8461
8461
|
var configCmd = program.command("config");
|