@sherwoodagent/cli 0.73.2 → 0.73.3
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/{addresses-YDPUPGWQ.js → addresses-DGB3D457.js} +3 -3
- package/dist/{agent-AML5SIMT.js → agent-UNSW5IPO.js} +6 -6
- package/dist/{chat-6RO4RS3L.js → chat-KT2WVDT2.js} +8 -8
- package/dist/{chunk-AGZQWXAR.js → chunk-2U4TWPWQ.js} +4 -4
- package/dist/{chunk-RQZ53CV4.js → chunk-BKJ7HYX7.js} +2 -2
- package/dist/{chunk-XJJEZFOA.js → chunk-CHWBQJLT.js} +5 -5
- package/dist/{chunk-FNJHLDRL.js → chunk-CZRJ5GWE.js} +15 -11
- package/dist/chunk-CZRJ5GWE.js.map +1 -0
- package/dist/{chunk-5ECJMM3K.js → chunk-DIZEB2VV.js} +4 -4
- package/dist/{chunk-HYUUR6SC.js → chunk-DXJJMRBM.js} +13 -3
- package/dist/chunk-DXJJMRBM.js.map +1 -0
- package/dist/{chunk-XMYD5SES.js → chunk-GU5VZGXB.js} +4 -4
- package/dist/{chunk-RAITRCM7.js → chunk-IFL5SREW.js} +2 -2
- package/dist/{chunk-WO4YDEDH.js → chunk-NPWYX6NU.js} +2 -2
- package/dist/{chunk-LZH4PJI4.js → chunk-ROKE6ZAW.js} +24 -4
- package/dist/chunk-ROKE6ZAW.js.map +1 -0
- package/dist/{chunk-TSNHEU2C.js → chunk-ZURDCYGU.js} +4 -4
- package/dist/{client-HMUVPZEG.js → client-NAL3HVLK.js} +7 -3
- package/dist/{eas-GDQYAUXR.js → eas-QAH7XVLK.js} +5 -5
- package/dist/{governor-PX6AMIAU.js → governor-S56M6BV6.js} +5 -5
- package/dist/index.js +36 -32
- package/dist/index.js.map +1 -1
- package/dist/{network-L6JKNYOJ.js → network-MKMX2NG6.js} +6 -2
- package/dist/{price-SGQZC4DT.js → price-HHDBMKIE.js} +4 -4
- package/dist/{research-S5PLKE5V.js → research-4TBGYEVI.js} +4 -4
- package/dist/{research-DDEAW7NP.js → research-IJBOMYL3.js} +7 -7
- package/dist/{session-2QRTQ6ID.js → session-L67AVWBY.js} +9 -9
- package/dist/{trade-GNOISJNX.js → trade-LGFQEK3I.js} +14 -14
- package/dist/{vault-32RDL5HM.js → vault-XWFPGHRA.js} +5 -5
- package/dist/{xmtp-AL5W36H6.js → xmtp-6US7GH3Z.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-FNJHLDRL.js.map +0 -1
- package/dist/chunk-HYUUR6SC.js.map +0 -1
- package/dist/chunk-LZH4PJI4.js.map +0 -1
- /package/dist/{addresses-YDPUPGWQ.js.map → addresses-DGB3D457.js.map} +0 -0
- /package/dist/{agent-AML5SIMT.js.map → agent-UNSW5IPO.js.map} +0 -0
- /package/dist/{chat-6RO4RS3L.js.map → chat-KT2WVDT2.js.map} +0 -0
- /package/dist/{chunk-AGZQWXAR.js.map → chunk-2U4TWPWQ.js.map} +0 -0
- /package/dist/{chunk-RQZ53CV4.js.map → chunk-BKJ7HYX7.js.map} +0 -0
- /package/dist/{chunk-XJJEZFOA.js.map → chunk-CHWBQJLT.js.map} +0 -0
- /package/dist/{chunk-5ECJMM3K.js.map → chunk-DIZEB2VV.js.map} +0 -0
- /package/dist/{chunk-XMYD5SES.js.map → chunk-GU5VZGXB.js.map} +0 -0
- /package/dist/{chunk-RAITRCM7.js.map → chunk-IFL5SREW.js.map} +0 -0
- /package/dist/{chunk-WO4YDEDH.js.map → chunk-NPWYX6NU.js.map} +0 -0
- /package/dist/{chunk-TSNHEU2C.js.map → chunk-ZURDCYGU.js.map} +0 -0
- /package/dist/{client-HMUVPZEG.js.map → client-NAL3HVLK.js.map} +0 -0
- /package/dist/{eas-GDQYAUXR.js.map → eas-QAH7XVLK.js.map} +0 -0
- /package/dist/{governor-PX6AMIAU.js.map → governor-S56M6BV6.js.map} +0 -0
- /package/dist/{network-L6JKNYOJ.js.map → network-MKMX2NG6.js.map} +0 -0
- /package/dist/{price-SGQZC4DT.js.map → price-HHDBMKIE.js.map} +0 -0
- /package/dist/{research-S5PLKE5V.js.map → research-4TBGYEVI.js.map} +0 -0
- /package/dist/{research-DDEAW7NP.js.map → research-IJBOMYL3.js.map} +0 -0
- /package/dist/{session-2QRTQ6ID.js.map → session-L67AVWBY.js.map} +0 -0
- /package/dist/{trade-GNOISJNX.js.map → trade-LGFQEK3I.js.map} +0 -0
- /package/dist/{vault-32RDL5HM.js.map → vault-XWFPGHRA.js.map} +0 -0
- /package/dist/{xmtp-AL5W36H6.js.map → xmtp-6US7GH3Z.js.map} +0 -0
|
@@ -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, getMinGasReserve } 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 let fee = (maxFeePerGas * 120n) / 100n;\n let tip = (maxPriorityFeePerGas * 120n) / 100n;\n // #462: some RPCs (Robinhood testnet after activity bursts) suggest fees\n // orders of magnitude above the live base fee; viem's worst-case prefund\n // check (gas × maxFeePerGas) then rejects large txs from small wallets even\n // though real cost is negligible. Clamp to 10× live base, but ONLY when the\n // suggestion exceeds 1000× base (never true on healthy chains — Base gas\n // spikes stay untouched). Best-effort: a failed getBlock skips the clamp.\n let base: bigint | null | undefined;\n try {\n base = (await client.getBlock()).baseFeePerGas;\n } catch {\n base = undefined;\n }\n if (base !== null && base !== undefined && base > 0n && fee > base * 1000n) {\n fee = base * 10n;\n if (tip > fee) tip = fee;\n }\n return { maxFeePerGas: fee, maxPriorityFeePerGas: tip };\n}\n\n/**\n * Conservative per-op gas-unit budgets for the native-ETH-wrap deposit/redeem\n * sequences. Multiplied by the live buffered `maxFeePerGas` (× a safety factor)\n * to derive the ETH gas cushion — replacing the old hardcoded 0.0005-ETH,\n * Base-calibrated constant that rejected valid deposits on low-fee chains\n * (Robinhood testnet, ~14-wei base fee). Deliberately generous; the realized\n * cost is a fraction of these on any chain.\n */\nexport const GAS_UNITS = {\n wrap: 55_000n,\n approve: 60_000n,\n deposit: 250_000n,\n redeem: 250_000n,\n} as const;\n\n/**\n * Derive the ETH gas cushion from live chain gas instead of a fixed constant:\n *\n * cushion = gasUnits × bufferedMaxFeePerGas × safetyFactor, floored at the\n * active chain's `minGasReserve`.\n *\n * `gasUnits` is the summed budget for the tx sequence (e.g. wrap+approve+deposit\n * via `GAS_UNITS`). Falls back to the per-chain floor when the live fee estimate\n * is unavailable (RPC error). On a ~14-wei-base-fee chain the derived term is\n * negligible, so the tiny per-chain floor dominates; on Base the live term\n * scales with the gas market and the Base-scale floor is the lower bound.\n */\nexport async function estimateGasCushion(\n gasUnits: bigint,\n safetyFactor = 2n,\n): Promise<bigint> {\n const floor = getMinGasReserve();\n try {\n const { maxFeePerGas } = await estimateFeesWithBuffer();\n const derived = gasUnits * maxFeePerGas * safetyFactor;\n return derived > floor ? derived : floor;\n } catch {\n return floor;\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\";\nimport { getChain } from \"./network.js\";\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 fund 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 fund 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 fund 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 ${getChain().name}.`;\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 const explorer = getChain().blockExplorers?.default?.name ?? \"the block explorer\";\n cleaned = `Contract reverted with unknown error selector ${sigMatch[1]}. Check the transaction on ${explorer} for details.`;\n }\n\n return cleaned;\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAS,oBAAoB,oBAAoB,UAAU,YAAY;AACvE,SAAS,2BAA2B;;;ACDpC,SAAmB,mBAAmB,iBAAiB;AAKhD,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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","names":[]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SHERWOOD
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IFL5SREW.js";
|
|
4
4
|
import {
|
|
5
5
|
getAccount,
|
|
6
6
|
getPublicClient,
|
|
7
7
|
waitForReceipt,
|
|
8
8
|
writeContractWithRetry
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ROKE6ZAW.js";
|
|
10
10
|
import {
|
|
11
11
|
getChain
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DXJJMRBM.js";
|
|
13
13
|
import {
|
|
14
14
|
PROTOCOL_CONFIG_ABI,
|
|
15
15
|
SYNDICATE_FACTORY_ABI,
|
|
@@ -425,4 +425,4 @@ export {
|
|
|
425
425
|
vetoProposal,
|
|
426
426
|
setProtocolFeeBps
|
|
427
427
|
};
|
|
428
|
-
//# sourceMappingURL=chunk-
|
|
428
|
+
//# sourceMappingURL=chunk-ZURDCYGU.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
GAS_UNITS,
|
|
2
3
|
detectStuckNonce,
|
|
3
4
|
estimateFeesWithBuffer,
|
|
5
|
+
estimateGasCushion,
|
|
4
6
|
formatContractError,
|
|
5
7
|
getAccount,
|
|
6
8
|
getPublicClient,
|
|
@@ -10,12 +12,14 @@ import {
|
|
|
10
12
|
unstickWallet,
|
|
11
13
|
waitForReceipt,
|
|
12
14
|
writeContractWithRetry
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-ROKE6ZAW.js";
|
|
16
|
+
import "./chunk-DXJJMRBM.js";
|
|
15
17
|
import "./chunk-GSC7PVEO.js";
|
|
16
18
|
export {
|
|
19
|
+
GAS_UNITS,
|
|
17
20
|
detectStuckNonce,
|
|
18
21
|
estimateFeesWithBuffer,
|
|
22
|
+
estimateGasCushion,
|
|
19
23
|
formatContractError,
|
|
20
24
|
getAccount,
|
|
21
25
|
getPublicClient,
|
|
@@ -26,4 +30,4 @@ export {
|
|
|
26
30
|
waitForReceipt,
|
|
27
31
|
writeContractWithRetry
|
|
28
32
|
};
|
|
29
|
-
//# sourceMappingURL=client-
|
|
33
|
+
//# sourceMappingURL=client-NAL3HVLK.js.map
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
revokeAttestation,
|
|
18
18
|
revokeJoinRequest,
|
|
19
19
|
stripReferrerPrefix
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-GU5VZGXB.js";
|
|
21
|
+
import "./chunk-IFL5SREW.js";
|
|
22
|
+
import "./chunk-ROKE6ZAW.js";
|
|
23
|
+
import "./chunk-DXJJMRBM.js";
|
|
24
24
|
import "./chunk-GSC7PVEO.js";
|
|
25
25
|
import "./chunk-BQMOE4FJ.js";
|
|
26
26
|
export {
|
|
@@ -43,4 +43,4 @@ export {
|
|
|
43
43
|
revokeJoinRequest,
|
|
44
44
|
stripReferrerPrefix
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=eas-
|
|
46
|
+
//# sourceMappingURL=eas-QAH7XVLK.js.map
|
|
@@ -36,10 +36,10 @@ import {
|
|
|
36
36
|
settleProposal,
|
|
37
37
|
vetoProposal,
|
|
38
38
|
vote
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
39
|
+
} from "./chunk-ZURDCYGU.js";
|
|
40
|
+
import "./chunk-IFL5SREW.js";
|
|
41
|
+
import "./chunk-ROKE6ZAW.js";
|
|
42
|
+
import "./chunk-DXJJMRBM.js";
|
|
43
43
|
import "./chunk-GSC7PVEO.js";
|
|
44
44
|
import "./chunk-BQMOE4FJ.js";
|
|
45
45
|
export {
|
|
@@ -81,4 +81,4 @@ export {
|
|
|
81
81
|
vetoProposal,
|
|
82
82
|
vote
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=governor-
|
|
84
|
+
//# sourceMappingURL=governor-S56M6BV6.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-DIZEB2VV.js";
|
|
19
19
|
import {
|
|
20
20
|
chatCompletion,
|
|
21
21
|
checkApiKeyValid,
|
|
22
22
|
listModels,
|
|
23
23
|
provisionApiKey
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-NPWYX6NU.js";
|
|
25
25
|
import {
|
|
26
26
|
createApproval,
|
|
27
27
|
createJoinRequest,
|
|
@@ -32,20 +32,20 @@ import {
|
|
|
32
32
|
queryJoinRequests,
|
|
33
33
|
revokeJoinRequest,
|
|
34
34
|
stripReferrerPrefix
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-GU5VZGXB.js";
|
|
36
36
|
import {
|
|
37
37
|
createFund,
|
|
38
38
|
getActiveFunds,
|
|
39
39
|
getFund,
|
|
40
40
|
subdomainExists,
|
|
41
41
|
updateMetadata
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-2U4TWPWQ.js";
|
|
43
43
|
import {
|
|
44
44
|
resolveFund,
|
|
45
45
|
resolveVaultFund,
|
|
46
46
|
searchFundAcrossChains,
|
|
47
47
|
setTextRecord
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-CHWBQJLT.js";
|
|
49
49
|
import {
|
|
50
50
|
approveDepositor,
|
|
51
51
|
deposit,
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
removeDepositor,
|
|
68
68
|
setAgentFeeBps,
|
|
69
69
|
setVaultAddress
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-CZRJ5GWE.js";
|
|
71
71
|
import {
|
|
72
72
|
PROPOSAL_STATE,
|
|
73
73
|
PROPOSAL_STATES,
|
|
@@ -101,7 +101,7 @@ import {
|
|
|
101
101
|
setVotingPeriod,
|
|
102
102
|
settleProposal,
|
|
103
103
|
vote
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-ZURDCYGU.js";
|
|
105
105
|
import {
|
|
106
106
|
AERODROME,
|
|
107
107
|
AGENT_REGISTRY,
|
|
@@ -115,8 +115,10 @@ import {
|
|
|
115
115
|
UNISWAP,
|
|
116
116
|
VENICE,
|
|
117
117
|
robinhoodEquityMaxAge
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-IFL5SREW.js";
|
|
119
119
|
import {
|
|
120
|
+
GAS_UNITS,
|
|
121
|
+
estimateGasCushion,
|
|
120
122
|
formatContractError,
|
|
121
123
|
getAccount,
|
|
122
124
|
getPublicClient,
|
|
@@ -124,7 +126,7 @@ import {
|
|
|
124
126
|
sendTxWithRetry,
|
|
125
127
|
waitForReceipt,
|
|
126
128
|
writeContractWithRetry
|
|
127
|
-
} from "./chunk-
|
|
129
|
+
} from "./chunk-ROKE6ZAW.js";
|
|
128
130
|
import {
|
|
129
131
|
DEFAULT_NETWORK,
|
|
130
132
|
VALID_NETWORKS,
|
|
@@ -136,7 +138,7 @@ import {
|
|
|
136
138
|
isTestnet,
|
|
137
139
|
setNetwork,
|
|
138
140
|
withNetwork
|
|
139
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-DXJJMRBM.js";
|
|
140
142
|
import {
|
|
141
143
|
addFund,
|
|
142
144
|
cacheGroupId,
|
|
@@ -3517,7 +3519,7 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
3517
3519
|
process.exit(1);
|
|
3518
3520
|
}
|
|
3519
3521
|
if (!opts.agent) opts.agent = proposer;
|
|
3520
|
-
const { parseDuration: parseDuration3, getGovernorOf: getGovernorOf2 } = await import("./governor-
|
|
3522
|
+
const { parseDuration: parseDuration3, getGovernorOf: getGovernorOf2 } = await import("./governor-S56M6BV6.js");
|
|
3521
3523
|
const strategyDuration2 = parseDuration3(opts.duration);
|
|
3522
3524
|
const chainId = getChain().id;
|
|
3523
3525
|
try {
|
|
@@ -3743,9 +3745,9 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
3743
3745
|
console.error(chalk.red("Missing --name or --duration. Use --write-calls to skip proposal submission."));
|
|
3744
3746
|
process.exit(1);
|
|
3745
3747
|
}
|
|
3746
|
-
const { propose: propose2 } = await import("./governor-
|
|
3748
|
+
const { propose: propose2 } = await import("./governor-S56M6BV6.js");
|
|
3747
3749
|
const { pinJSON } = await import("./ipfs-RWSTXTZM.js");
|
|
3748
|
-
const { parseDuration: parseDuration2 } = await import("./governor-
|
|
3750
|
+
const { parseDuration: parseDuration2 } = await import("./governor-S56M6BV6.js");
|
|
3749
3751
|
const strategyDuration = parseDuration2(opts.duration);
|
|
3750
3752
|
const metaSpinner = ora("Pinning metadata to IPFS...").start();
|
|
3751
3753
|
let metadataURI;
|
|
@@ -3768,7 +3770,7 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
3768
3770
|
process.exit(1);
|
|
3769
3771
|
}
|
|
3770
3772
|
try {
|
|
3771
|
-
const { getAgentFeeBps: getAgentFeeBps2 } = await import("./vault-
|
|
3773
|
+
const { getAgentFeeBps: getAgentFeeBps2 } = await import("./vault-XWFPGHRA.js");
|
|
3772
3774
|
const feeBps = await getAgentFeeBps2(vault);
|
|
3773
3775
|
console.log(
|
|
3774
3776
|
chalk.yellow(
|
|
@@ -3856,7 +3858,7 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
3856
3858
|
let prices = [];
|
|
3857
3859
|
let priceSource = null;
|
|
3858
3860
|
try {
|
|
3859
|
-
const { getTokenPricesInAsset } = await import("./price-
|
|
3861
|
+
const { getTokenPricesInAsset } = await import("./price-HHDBMKIE.js");
|
|
3860
3862
|
prices = await getTokenPricesInAsset({
|
|
3861
3863
|
tokens: allocations.map((a, i) => ({
|
|
3862
3864
|
token: a.token,
|
|
@@ -4286,7 +4288,7 @@ function registerVeniceCommands(program2) {
|
|
|
4286
4288
|
console.log(chalk2.dim(` Key: ${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`));
|
|
4287
4289
|
console.log(chalk2.dim(" Saved to ~/.sherwood/config.json"));
|
|
4288
4290
|
try {
|
|
4289
|
-
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-
|
|
4291
|
+
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-QAH7XVLK.js");
|
|
4290
4292
|
const { uid } = await createVeniceProvisionAttestation(account.address);
|
|
4291
4293
|
if (uid !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
4292
4294
|
console.log(chalk2.dim(` Attested: ${getEasScanUrl2(uid)}`));
|
|
@@ -4642,10 +4644,10 @@ ${opts.prompt}`;
|
|
|
4642
4644
|
console.log(chalk2.dim(`Model: ${result.model} | Tokens: ${result.usage.promptTokens} in, ${result.usage.completionTokens} out, ${result.usage.totalTokens} total`));
|
|
4643
4645
|
}
|
|
4644
4646
|
try {
|
|
4645
|
-
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-
|
|
4647
|
+
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-QAH7XVLK.js");
|
|
4646
4648
|
const { keccak256: keccak2563, toHex, isAddress: isAddr } = await import("viem");
|
|
4647
4649
|
const { getChainContracts: getChainContracts2 } = await import("./config-FAQO37S7.js");
|
|
4648
|
-
const { getChain: getActiveChain } = await import("./network-
|
|
4650
|
+
const { getChain: getActiveChain } = await import("./network-MKMX2NG6.js");
|
|
4649
4651
|
const vaultRecipient = opts.vault && isAddr(opts.vault) ? opts.vault : getChainContracts2(getActiveChain().id).vault;
|
|
4650
4652
|
const promptHash = keccak2563(toHex(userContent)).slice(0, 18);
|
|
4651
4653
|
const { uid } = await createVeniceInferenceAttestation(
|
|
@@ -5900,8 +5902,8 @@ function printSimulationResult(result, callType) {
|
|
|
5900
5902
|
}
|
|
5901
5903
|
async function sendSimulationAlert(subdomain, proposalId, vault, execResult, settleResult) {
|
|
5902
5904
|
try {
|
|
5903
|
-
const xmtp = await import("./xmtp-
|
|
5904
|
-
const { getAccount: getAccount2 } = await import("./client-
|
|
5905
|
+
const xmtp = await import("./xmtp-6US7GH3Z.js");
|
|
5906
|
+
const { getAccount: getAccount2 } = await import("./client-NAL3HVLK.js");
|
|
5905
5907
|
const group = await xmtp.getGroup("", subdomain);
|
|
5906
5908
|
const allRisks = [...execResult.risks, ...settleResult?.risks ?? []];
|
|
5907
5909
|
const criticals = allRisks.filter((r) => r.level === "critical");
|
|
@@ -6907,7 +6909,7 @@ function registerProposalCommands(program2) {
|
|
|
6907
6909
|
}
|
|
6908
6910
|
|
|
6909
6911
|
// src/commands/queue.ts
|
|
6910
|
-
import { parseUnits as parseUnits5, formatUnits as formatUnits5,
|
|
6912
|
+
import { parseUnits as parseUnits5, formatUnits as formatUnits5, isAddress as isAddress6, parseEventLogs } from "viem";
|
|
6911
6913
|
import chalk7 from "chalk";
|
|
6912
6914
|
import ora6 from "ora";
|
|
6913
6915
|
var WETH_ABI2 = [
|
|
@@ -7091,10 +7093,12 @@ function registerQueueCommands(program2) {
|
|
|
7091
7093
|
if (wethBalance < assets) {
|
|
7092
7094
|
const shortfall = assets - wethBalance;
|
|
7093
7095
|
const ethBalance = await client.getBalance({ address: account.address });
|
|
7094
|
-
const minGas =
|
|
7096
|
+
const minGas = await estimateGasCushion(
|
|
7097
|
+
GAS_UNITS.wrap + GAS_UNITS.approve + GAS_UNITS.deposit
|
|
7098
|
+
);
|
|
7095
7099
|
if (ethBalance < shortfall + minGas) {
|
|
7096
7100
|
throw new Error(
|
|
7097
|
-
`Insufficient ETH. Have ${formatUnits5(ethBalance, 18)} ETH, need ${formatUnits5(shortfall, 18)} to wrap + gas.`
|
|
7101
|
+
`Insufficient ETH on ${getChain().name}. Have ${formatUnits5(ethBalance, 18)} ETH, need ${formatUnits5(shortfall, 18)} to wrap + ~${formatUnits5(minGas, 18)} for gas.`
|
|
7098
7102
|
);
|
|
7099
7103
|
}
|
|
7100
7104
|
spinner.text = "Wrapping ETH \u2192 WETH...";
|
|
@@ -10336,9 +10340,9 @@ try {
|
|
|
10336
10340
|
} catch {
|
|
10337
10341
|
}
|
|
10338
10342
|
var require2 = createRequire(import.meta.url);
|
|
10339
|
-
var CLI_VERSION = "0.73.
|
|
10343
|
+
var CLI_VERSION = "0.73.3";
|
|
10340
10344
|
async function loadXmtp() {
|
|
10341
|
-
return import("./xmtp-
|
|
10345
|
+
return import("./xmtp-6US7GH3Z.js");
|
|
10342
10346
|
}
|
|
10343
10347
|
async function loadCron() {
|
|
10344
10348
|
return import("./cron-QMLRWDJG.js");
|
|
@@ -10930,7 +10934,7 @@ fund.command("add").description("Register an agent on a fund vault (creator only
|
|
|
10930
10934
|
if (opts.agentId) {
|
|
10931
10935
|
agentId = BigInt(opts.agentId);
|
|
10932
10936
|
} else {
|
|
10933
|
-
const { AGENT_REGISTRY: AGENT_REGISTRY2 } = await import("./addresses-
|
|
10937
|
+
const { AGENT_REGISTRY: AGENT_REGISTRY2 } = await import("./addresses-DGB3D457.js");
|
|
10934
10938
|
const registry = AGENT_REGISTRY2().IDENTITY_REGISTRY;
|
|
10935
10939
|
if (registry === "0x0000000000000000000000000000000000000000") {
|
|
10936
10940
|
agentId = 0n;
|
|
@@ -11656,7 +11660,7 @@ vaultCmd.command("redeem").description("Redeem vault shares for the underlying a
|
|
|
11656
11660
|
var strategy = program.command("strategy").description("Strategy templates \u2014 list, clone, propose");
|
|
11657
11661
|
registerStrategyTemplateCommands(strategy);
|
|
11658
11662
|
program.command("providers").description("List available DeFi providers").action(async () => {
|
|
11659
|
-
const { MessariProvider, NansenProvider } = await import("./research-
|
|
11663
|
+
const { MessariProvider, NansenProvider } = await import("./research-4TBGYEVI.js");
|
|
11660
11664
|
const providers = [new MoonwellProvider(), new UniswapProvider(), new MessariProvider(), new NansenProvider()];
|
|
11661
11665
|
for (const p of providers) {
|
|
11662
11666
|
const info = p.info();
|
|
@@ -11667,7 +11671,7 @@ ${info.name} (${info.type})`);
|
|
|
11667
11671
|
}
|
|
11668
11672
|
});
|
|
11669
11673
|
try {
|
|
11670
|
-
const { registerChatCommands } = await import("./chat-
|
|
11674
|
+
const { registerChatCommands } = await import("./chat-KT2WVDT2.js");
|
|
11671
11675
|
registerChatCommands(program);
|
|
11672
11676
|
} catch {
|
|
11673
11677
|
program.command("chat <name> [action] [actionArgs...]").description("Fund chat (XMTP) \u2014 requires @xmtp/cli").action(() => {
|
|
@@ -11677,7 +11681,7 @@ try {
|
|
|
11677
11681
|
process.exit(1);
|
|
11678
11682
|
});
|
|
11679
11683
|
}
|
|
11680
|
-
var { registerSessionCommands } = await import("./session-
|
|
11684
|
+
var { registerSessionCommands } = await import("./session-L67AVWBY.js");
|
|
11681
11685
|
registerSessionCommands(program);
|
|
11682
11686
|
registerVeniceCommands(program);
|
|
11683
11687
|
registerAllowanceCommands(program);
|
|
@@ -11686,11 +11690,11 @@ registerProposalCommands(program);
|
|
|
11686
11690
|
registerQueueCommands(program);
|
|
11687
11691
|
registerGovernorCommands(program);
|
|
11688
11692
|
registerGuardianCommands(program);
|
|
11689
|
-
var { registerResearchCommands } = await import("./research-
|
|
11693
|
+
var { registerResearchCommands } = await import("./research-IJBOMYL3.js");
|
|
11690
11694
|
registerResearchCommands(program);
|
|
11691
|
-
var { registerAgentCommands } = await import("./agent-
|
|
11695
|
+
var { registerAgentCommands } = await import("./agent-UNSW5IPO.js");
|
|
11692
11696
|
registerAgentCommands(program);
|
|
11693
|
-
var { registerTradeCommands } = await import("./trade-
|
|
11697
|
+
var { registerTradeCommands } = await import("./trade-LGFQEK3I.js");
|
|
11694
11698
|
registerTradeCommands(program);
|
|
11695
11699
|
registerGridCommand(program);
|
|
11696
11700
|
var configCmd = program.command("config");
|