@sherwoodagent/cli 0.29.0 → 0.29.1

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.
Files changed (48) hide show
  1. package/dist/{addresses-CQLJSZGN.js → addresses-NOWMJT4H.js} +3 -3
  2. package/dist/{agent-QIQABFLV.js → agent-U6OFXITU.js} +4 -4
  3. package/dist/{chat-N6LSZUSC.js → chat-SIB6GCJF.js} +7 -7
  4. package/dist/{chunk-WQOTLKVP.js → chunk-7PDRYBHD.js} +2 -2
  5. package/dist/{chunk-YRYPGJ66.js → chunk-7W6U6ZC6.js} +4 -4
  6. package/dist/{chunk-T5BRUFWV.js → chunk-BVL3O7UH.js} +4 -4
  7. package/dist/{chunk-3EMDYEAD.js → chunk-C4SYHSY2.js} +4 -4
  8. package/dist/{chunk-QGEIK4H5.js → chunk-EYI6JORK.js} +2 -2
  9. package/dist/{chunk-ZPYN5ZAI.js → chunk-H32QA3NV.js} +28 -11
  10. package/dist/chunk-H32QA3NV.js.map +1 -0
  11. package/dist/{chunk-WRG7GAIA.js → chunk-N2547R2L.js} +13 -6
  12. package/dist/chunk-N2547R2L.js.map +1 -0
  13. package/dist/{chunk-I3UVF2GD.js → chunk-OD5JECOR.js} +4 -4
  14. package/dist/{chunk-IIBOFECO.js → chunk-UW6P2PMP.js} +4 -4
  15. package/dist/{client-HBMSTSKK.js → client-66VTYDRS.js} +3 -3
  16. package/dist/{eas-D3KSAGWT.js → eas-YTMCD3UN.js} +5 -5
  17. package/dist/{governor-3MYMDBRF.js → governor-2N3CPFOP.js} +5 -5
  18. package/dist/index.js +24 -24
  19. package/dist/{network-X6GM7ROG.js → network-GJA2ZN3O.js} +4 -2
  20. package/dist/{price-DXNFNTV6.js → price-HGBIMFYN.js} +4 -4
  21. package/dist/{research-NCESMYXK.js → research-3GNTDKY4.js} +4 -4
  22. package/dist/{research-H3I4LALI.js → research-ECOWBTFP.js} +7 -7
  23. package/dist/{session-5JUUZYIL.js → session-RTCMOPAQ.js} +8 -8
  24. package/dist/{trade-XDE6YCNY.js → trade-3HVCELTB.js} +13 -13
  25. package/dist/{xmtp-XTJ7HDVG.js → xmtp-5FPJN5WE.js} +5 -5
  26. package/package.json +1 -1
  27. package/dist/chunk-WRG7GAIA.js.map +0 -1
  28. package/dist/chunk-ZPYN5ZAI.js.map +0 -1
  29. /package/dist/{addresses-CQLJSZGN.js.map → addresses-NOWMJT4H.js.map} +0 -0
  30. /package/dist/{agent-QIQABFLV.js.map → agent-U6OFXITU.js.map} +0 -0
  31. /package/dist/{chat-N6LSZUSC.js.map → chat-SIB6GCJF.js.map} +0 -0
  32. /package/dist/{chunk-WQOTLKVP.js.map → chunk-7PDRYBHD.js.map} +0 -0
  33. /package/dist/{chunk-YRYPGJ66.js.map → chunk-7W6U6ZC6.js.map} +0 -0
  34. /package/dist/{chunk-T5BRUFWV.js.map → chunk-BVL3O7UH.js.map} +0 -0
  35. /package/dist/{chunk-3EMDYEAD.js.map → chunk-C4SYHSY2.js.map} +0 -0
  36. /package/dist/{chunk-QGEIK4H5.js.map → chunk-EYI6JORK.js.map} +0 -0
  37. /package/dist/{chunk-I3UVF2GD.js.map → chunk-OD5JECOR.js.map} +0 -0
  38. /package/dist/{chunk-IIBOFECO.js.map → chunk-UW6P2PMP.js.map} +0 -0
  39. /package/dist/{client-HBMSTSKK.js.map → client-66VTYDRS.js.map} +0 -0
  40. /package/dist/{eas-D3KSAGWT.js.map → eas-YTMCD3UN.js.map} +0 -0
  41. /package/dist/{governor-3MYMDBRF.js.map → governor-2N3CPFOP.js.map} +0 -0
  42. /package/dist/{network-X6GM7ROG.js.map → network-GJA2ZN3O.js.map} +0 -0
  43. /package/dist/{price-DXNFNTV6.js.map → price-HGBIMFYN.js.map} +0 -0
  44. /package/dist/{research-NCESMYXK.js.map → research-3GNTDKY4.js.map} +0 -0
  45. /package/dist/{research-H3I4LALI.js.map → research-ECOWBTFP.js.map} +0 -0
  46. /package/dist/{session-5JUUZYIL.js.map → session-RTCMOPAQ.js.map} +0 -0
  47. /package/dist/{trade-XDE6YCNY.js.map → trade-3HVCELTB.js.map} +0 -0
  48. /package/dist/{xmtp-XTJ7HDVG.js.map → xmtp-5FPJN5WE.js.map} +0 -0
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  getQuote,
10
10
  listModels,
11
11
  provisionApiKey
12
- } from "./chunk-IIBOFECO.js";
12
+ } from "./chunk-UW6P2PMP.js";
13
13
  import {
14
14
  createApproval,
15
15
  createJoinRequest,
@@ -19,14 +19,14 @@ import {
19
19
  queryJoinRequests,
20
20
  revokeAttestation,
21
21
  stripReferrerPrefix
22
- } from "./chunk-I3UVF2GD.js";
22
+ } from "./chunk-OD5JECOR.js";
23
23
  import {
24
24
  createSyndicate,
25
25
  getActiveSyndicates,
26
26
  getSyndicate,
27
27
  subdomainExists,
28
28
  updateMetadata
29
- } from "./chunk-T5BRUFWV.js";
29
+ } from "./chunk-BVL3O7UH.js";
30
30
  import {
31
31
  approveDepositor,
32
32
  deposit,
@@ -49,7 +49,7 @@ import {
49
49
  resolveVaultSyndicate,
50
50
  setTextRecord,
51
51
  setVaultAddress
52
- } from "./chunk-YRYPGJ66.js";
52
+ } from "./chunk-7W6U6ZC6.js";
53
53
  import {
54
54
  PROPOSAL_STATE,
55
55
  PROPOSAL_STATES,
@@ -81,7 +81,7 @@ import {
81
81
  setVotingPeriod,
82
82
  settleProposal,
83
83
  vote
84
- } from "./chunk-3EMDYEAD.js";
84
+ } from "./chunk-C4SYHSY2.js";
85
85
  import {
86
86
  fetchMetadata,
87
87
  uploadMetadata
@@ -107,7 +107,7 @@ import {
107
107
  TOKENS,
108
108
  UNISWAP,
109
109
  VENICE
110
- } from "./chunk-WQOTLKVP.js";
110
+ } from "./chunk-7PDRYBHD.js";
111
111
  import {
112
112
  formatContractError,
113
113
  getAccount,
@@ -115,7 +115,7 @@ import {
115
115
  sendTxWithRetry,
116
116
  waitForReceipt,
117
117
  writeContractWithRetry
118
- } from "./chunk-WRG7GAIA.js";
118
+ } from "./chunk-N2547R2L.js";
119
119
  import {
120
120
  CHAIN_REGISTRY,
121
121
  VALID_NETWORKS,
@@ -125,7 +125,7 @@ import {
125
125
  getRpcUrl,
126
126
  isTestnet,
127
127
  setNetwork
128
- } from "./chunk-ZPYN5ZAI.js";
128
+ } from "./chunk-H32QA3NV.js";
129
129
  import {
130
130
  addSyndicate,
131
131
  cacheGroupId,
@@ -1390,9 +1390,9 @@ function registerStrategyTemplateCommands(strategy2) {
1390
1390
  console.error(chalk.red("Missing --name, --performance-fee, or --duration. Use --write-calls to skip proposal submission."));
1391
1391
  process.exit(1);
1392
1392
  }
1393
- const { propose: propose2 } = await import("./governor-3MYMDBRF.js");
1393
+ const { propose: propose2 } = await import("./governor-2N3CPFOP.js");
1394
1394
  const { pinJSON } = await import("./ipfs-IGXLLJCF.js");
1395
- const { parseDuration: parseDuration2 } = await import("./governor-3MYMDBRF.js");
1395
+ const { parseDuration: parseDuration2 } = await import("./governor-2N3CPFOP.js");
1396
1396
  const performanceFeeBps = BigInt(opts.performanceFee);
1397
1397
  if (performanceFeeBps < 0n || performanceFeeBps > 10000n) {
1398
1398
  console.error(chalk.red("--performance-fee must be 0-10000 (basis points)"));
@@ -1500,7 +1500,7 @@ function registerStrategyTemplateCommands(strategy2) {
1500
1500
  let prices = [];
1501
1501
  let priceSource = null;
1502
1502
  try {
1503
- const { getTokenPricesInAsset } = await import("./price-DXNFNTV6.js");
1503
+ const { getTokenPricesInAsset } = await import("./price-HGBIMFYN.js");
1504
1504
  prices = await getTokenPricesInAsset({
1505
1505
  tokens: allocations.map((a, i) => ({
1506
1506
  token: a.token,
@@ -1929,7 +1929,7 @@ function registerVeniceCommands(program2) {
1929
1929
  console.log(chalk2.dim(` Key: ${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`));
1930
1930
  console.log(chalk2.dim(" Saved to ~/.sherwood/config.json"));
1931
1931
  try {
1932
- const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-D3KSAGWT.js");
1932
+ const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-YTMCD3UN.js");
1933
1933
  const { uid } = await createVeniceProvisionAttestation(account.address);
1934
1934
  if (uid !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
1935
1935
  console.log(chalk2.dim(` Attested: ${getEasScanUrl2(uid)}`));
@@ -2080,10 +2080,10 @@ ${opts.prompt}`;
2080
2080
  console.log(chalk2.dim(`Model: ${result.model} | Tokens: ${result.usage.promptTokens} in, ${result.usage.completionTokens} out, ${result.usage.totalTokens} total`));
2081
2081
  }
2082
2082
  try {
2083
- const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-D3KSAGWT.js");
2083
+ const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-YTMCD3UN.js");
2084
2084
  const { keccak256, toHex, isAddress: isAddr } = await import("viem");
2085
2085
  const { getChainContracts: getChainContracts2 } = await import("./config-YXZKPSZB.js");
2086
- const { getChain: getActiveChain } = await import("./network-X6GM7ROG.js");
2086
+ const { getChain: getActiveChain } = await import("./network-GJA2ZN3O.js");
2087
2087
  const vaultRecipient = opts.vault && isAddr(opts.vault) ? opts.vault : getChainContracts2(getActiveChain().id).vault;
2088
2088
  const promptHash = keccak256(toHex(userContent)).slice(0, 18);
2089
2089
  const { uid } = await createVeniceInferenceAttestation(
@@ -3212,8 +3212,8 @@ function printSimulationResult(result, callType) {
3212
3212
  }
3213
3213
  async function sendSimulationAlert(subdomain, proposalId, vault, execResult, settleResult) {
3214
3214
  try {
3215
- const xmtp = await import("./xmtp-XTJ7HDVG.js");
3216
- const { getAccount: getAccount2 } = await import("./client-HBMSTSKK.js");
3215
+ const xmtp = await import("./xmtp-5FPJN5WE.js");
3216
+ const { getAccount: getAccount2 } = await import("./client-66VTYDRS.js");
3217
3217
  const group = await xmtp.getGroup("", subdomain);
3218
3218
  const allRisks = [...execResult.risks, ...settleResult?.risks ?? []];
3219
3219
  const criticals = allRisks.filter((r) => r.level === "critical");
@@ -4029,7 +4029,7 @@ try {
4029
4029
  var require2 = createRequire(import.meta.url);
4030
4030
  var { version: CLI_VERSION } = require2("../package.json");
4031
4031
  async function loadXmtp() {
4032
- return import("./xmtp-XTJ7HDVG.js");
4032
+ return import("./xmtp-5FPJN5WE.js");
4033
4033
  }
4034
4034
  async function loadCron() {
4035
4035
  return import("./cron-EOULYO3R.js");
@@ -4497,7 +4497,7 @@ syndicate.command("add").description("Register an agent on a syndicate vault (cr
4497
4497
  if (opts.agentId) {
4498
4498
  agentId = BigInt(opts.agentId);
4499
4499
  } else {
4500
- const { AGENT_REGISTRY: AGENT_REGISTRY2 } = await import("./addresses-CQLJSZGN.js");
4500
+ const { AGENT_REGISTRY: AGENT_REGISTRY2 } = await import("./addresses-NOWMJT4H.js");
4501
4501
  const registry = AGENT_REGISTRY2().IDENTITY_REGISTRY;
4502
4502
  if (registry === "0x0000000000000000000000000000000000000000") {
4503
4503
  agentId = 0n;
@@ -5096,7 +5096,7 @@ vaultCmd.command("redeem").description("Redeem vault shares for the underlying a
5096
5096
  var strategy = program.command("strategy").description("Strategy templates \u2014 list, clone, propose");
5097
5097
  registerStrategyTemplateCommands(strategy);
5098
5098
  program.command("providers").description("List available DeFi providers").action(async () => {
5099
- const { MessariProvider, NansenProvider } = await import("./research-NCESMYXK.js");
5099
+ const { MessariProvider, NansenProvider } = await import("./research-3GNTDKY4.js");
5100
5100
  const providers = [new MoonwellProvider(), new UniswapProvider(), new MessariProvider(), new NansenProvider()];
5101
5101
  for (const p of providers) {
5102
5102
  const info = p.info();
@@ -5107,7 +5107,7 @@ ${info.name} (${info.type})`);
5107
5107
  }
5108
5108
  });
5109
5109
  try {
5110
- const { registerChatCommands } = await import("./chat-N6LSZUSC.js");
5110
+ const { registerChatCommands } = await import("./chat-SIB6GCJF.js");
5111
5111
  registerChatCommands(program);
5112
5112
  } catch {
5113
5113
  program.command("chat <name> [action] [actionArgs...]").description("Syndicate chat (XMTP) \u2014 requires @xmtp/cli").action(() => {
@@ -5117,18 +5117,18 @@ try {
5117
5117
  process.exit(1);
5118
5118
  });
5119
5119
  }
5120
- var { registerSessionCommands } = await import("./session-5JUUZYIL.js");
5120
+ var { registerSessionCommands } = await import("./session-RTCMOPAQ.js");
5121
5121
  registerSessionCommands(program);
5122
5122
  registerVeniceCommands(program);
5123
5123
  registerAllowanceCommands(program);
5124
5124
  registerIdentityCommands(program);
5125
5125
  registerProposalCommands(program);
5126
5126
  registerGovernorCommands(program);
5127
- var { registerResearchCommands } = await import("./research-H3I4LALI.js");
5127
+ var { registerResearchCommands } = await import("./research-ECOWBTFP.js");
5128
5128
  registerResearchCommands(program);
5129
- var { registerAgentCommands } = await import("./agent-QIQABFLV.js");
5129
+ var { registerAgentCommands } = await import("./agent-U6OFXITU.js");
5130
5130
  registerAgentCommands(program);
5131
- var { registerTradeCommands } = await import("./trade-XDE6YCNY.js");
5131
+ var { registerTradeCommands } = await import("./trade-3HVCELTB.js");
5132
5132
  registerTradeCommands(program);
5133
5133
  var configCmd = program.command("config");
5134
5134
  configCmd.command("set").description("Save settings to ~/.sherwood/config.json (persists across sessions)").option("--private-key <key>", "Wallet private key (0x-prefixed)").option("--vault <address>", "Default SyndicateVault address").option("--rpc <url>", "Custom RPC URL for the active --chain network").option("--notify-to <id>", "Destination for cron summaries (Telegram chat ID, phone, etc.)").option("--uniswap-api-key <key>", "Uniswap Trading API key (from developers.uniswap.org)").option("--venice-api-key <key>", "Venice AI inference API key").option("--xmtp-group <subdomain:groupId>", "Cache an XMTP group ID for a syndicate (e.g. my-fund:abc123)").action((opts) => {
@@ -6,12 +6,13 @@ import {
6
6
  getExplorerUrl,
7
7
  getNetwork,
8
8
  getRpcUrl,
9
+ getRpcUrls,
9
10
  hyperevm,
10
11
  hyperevmTestnet,
11
12
  isTestnet,
12
13
  robinhoodTestnet,
13
14
  setNetwork
14
- } from "./chunk-ZPYN5ZAI.js";
15
+ } from "./chunk-H32QA3NV.js";
15
16
  import "./chunk-RGOTBJIN.js";
16
17
  export {
17
18
  CHAIN_REGISTRY,
@@ -21,10 +22,11 @@ export {
21
22
  getExplorerUrl,
22
23
  getNetwork,
23
24
  getRpcUrl,
25
+ getRpcUrls,
24
26
  hyperevm,
25
27
  hyperevmTestnet,
26
28
  isTestnet,
27
29
  robinhoodTestnet,
28
30
  setNetwork
29
31
  };
30
- //# sourceMappingURL=network-X6GM7ROG.js.map
32
+ //# sourceMappingURL=network-GJA2ZN3O.js.map
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  SYNTHRA,
6
6
  UNISWAP
7
- } from "./chunk-WQOTLKVP.js";
7
+ } from "./chunk-7PDRYBHD.js";
8
8
  import {
9
9
  getPublicClient
10
- } from "./chunk-WRG7GAIA.js";
10
+ } from "./chunk-N2547R2L.js";
11
11
  import {
12
12
  getNetwork
13
- } from "./chunk-ZPYN5ZAI.js";
13
+ } from "./chunk-H32QA3NV.js";
14
14
  import "./chunk-RGOTBJIN.js";
15
15
 
16
16
  // src/lib/price.ts
@@ -155,4 +155,4 @@ export {
155
155
  getTokenPriceInAsset,
156
156
  getTokenPricesInAsset
157
157
  };
158
- //# sourceMappingURL=price-DXNFNTV6.js.map
158
+ //# sourceMappingURL=price-HGBIMFYN.js.map
@@ -2,13 +2,13 @@ import {
2
2
  MessariProvider,
3
3
  NansenProvider,
4
4
  getResearchProvider
5
- } from "./chunk-QGEIK4H5.js";
6
- import "./chunk-WRG7GAIA.js";
7
- import "./chunk-ZPYN5ZAI.js";
5
+ } from "./chunk-EYI6JORK.js";
6
+ import "./chunk-N2547R2L.js";
7
+ import "./chunk-H32QA3NV.js";
8
8
  import "./chunk-RGOTBJIN.js";
9
9
  export {
10
10
  MessariProvider,
11
11
  NansenProvider,
12
12
  getResearchProvider
13
13
  };
14
- //# sourceMappingURL=research-NCESMYXK.js.map
14
+ //# sourceMappingURL=research-3GNTDKY4.js.map
@@ -2,12 +2,12 @@ import {
2
2
  MESSARI_COST_ESTIMATE,
3
3
  NANSEN_COST_ESTIMATE,
4
4
  getResearchProvider
5
- } from "./chunk-QGEIK4H5.js";
5
+ } from "./chunk-EYI6JORK.js";
6
6
  import {
7
7
  formatContractError,
8
8
  getAccount
9
- } from "./chunk-WRG7GAIA.js";
10
- import "./chunk-ZPYN5ZAI.js";
9
+ } from "./chunk-N2547R2L.js";
10
+ import "./chunk-H32QA3NV.js";
11
11
  import "./chunk-RGOTBJIN.js";
12
12
 
13
13
  // src/commands/research.ts
@@ -16,7 +16,7 @@ import ora from "ora";
16
16
  import { confirm } from "@inquirer/prompts";
17
17
  import { isAddress } from "viem";
18
18
  async function loadXmtp() {
19
- return import("./xmtp-XTJ7HDVG.js");
19
+ return import("./xmtp-5FPJN5WE.js");
20
20
  }
21
21
  var COST_ESTIMATES = {
22
22
  messari: MESSARI_COST_ESTIMATE,
@@ -83,7 +83,7 @@ function formatValue(value) {
83
83
  }
84
84
  async function postResearch(syndicateName, result, prompt) {
85
85
  const { pinJSON } = await import("./ipfs-IGXLLJCF.js");
86
- const { createResearchAttestation, getEasScanUrl } = await import("./eas-D3KSAGWT.js");
86
+ const { createResearchAttestation, getEasScanUrl } = await import("./eas-YTMCD3UN.js");
87
87
  const xmtp = await loadXmtp();
88
88
  const pinSpinner = ora("Pinning research result to IPFS...").start();
89
89
  let resultUri;
@@ -113,7 +113,7 @@ async function postResearch(syndicateName, result, prompt) {
113
113
  let attestationUid;
114
114
  try {
115
115
  const { getChainContracts } = await import("./config-YXZKPSZB.js");
116
- const { getChain } = await import("./network-X6GM7ROG.js");
116
+ const { getChain } = await import("./network-GJA2ZN3O.js");
117
117
  const vaultRecipient = getChainContracts(getChain().id).vault;
118
118
  const { uid } = await createResearchAttestation(
119
119
  result.provider,
@@ -312,4 +312,4 @@ function registerResearchCommands(program) {
312
312
  export {
313
313
  registerResearchCommands
314
314
  };
315
- //# sourceMappingURL=research-H3I4LALI.js.map
315
+ //# sourceMappingURL=research-ECOWBTFP.js.map
@@ -6,11 +6,11 @@ import {
6
6
  } from "./chunk-W2ZUPR3W.js";
7
7
  import {
8
8
  resolveSyndicate
9
- } from "./chunk-YRYPGJ66.js";
9
+ } from "./chunk-7W6U6ZC6.js";
10
10
  import {
11
11
  PROPOSAL_STATES,
12
12
  getProposal
13
- } from "./chunk-3EMDYEAD.js";
13
+ } from "./chunk-C4SYHSY2.js";
14
14
  import {
15
15
  resolveMetadataSummary
16
16
  } from "./chunk-2H6IGGKN.js";
@@ -19,11 +19,11 @@ import {
19
19
  } from "./chunk-PQ5ZX6ZT.js";
20
20
  import {
21
21
  SHERWOOD
22
- } from "./chunk-WQOTLKVP.js";
22
+ } from "./chunk-7PDRYBHD.js";
23
23
  import {
24
24
  getPublicClient
25
- } from "./chunk-WRG7GAIA.js";
26
- import "./chunk-ZPYN5ZAI.js";
25
+ } from "./chunk-N2547R2L.js";
26
+ import "./chunk-H32QA3NV.js";
27
27
  import {
28
28
  loadConfig
29
29
  } from "./chunk-RGOTBJIN.js";
@@ -187,7 +187,7 @@ async function enrichProposalEvents(events, metadataCache) {
187
187
 
188
188
  // src/commands/session.ts
189
189
  async function loadXmtp() {
190
- return import("./xmtp-XTJ7HDVG.js");
190
+ return import("./xmtp-5FPJN5WE.js");
191
191
  }
192
192
  async function resolveGovernor(vaultAddress) {
193
193
  const client = getPublicClient();
@@ -424,7 +424,7 @@ function registerSessionCommands(program) {
424
424
  );
425
425
  session.command("cron <name>").description("Manage participation crons (OpenClaw agents)").option("--remove", "Remove participation crons", false).option("--status", "Show cron status", false).action(async (name, opts) => {
426
426
  const { isOpenClaw, registerSyndicateCrons, unregisterSyndicateCrons, getSyndicateCronStatus } = await import("./cron-EOULYO3R.js");
427
- const { isTestnet } = await import("./network-X6GM7ROG.js");
427
+ const { isTestnet } = await import("./network-GJA2ZN3O.js");
428
428
  const { getNotifyTo } = await import("./config-YXZKPSZB.js");
429
429
  if (!isOpenClaw()) {
430
430
  console.log(chalk.yellow("Not running on OpenClaw \u2014 cron commands unavailable"));
@@ -466,4 +466,4 @@ function registerSessionCommands(program) {
466
466
  export {
467
467
  registerSessionCommands
468
468
  };
469
- //# sourceMappingURL=session-5JUUZYIL.js.map
469
+ //# sourceMappingURL=session-RTCMOPAQ.js.map
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  getResearchProvider
3
- } from "./chunk-QGEIK4H5.js";
3
+ } from "./chunk-EYI6JORK.js";
4
4
  import {
5
5
  UniswapProvider,
6
6
  chatCompletion,
7
7
  getQuote
8
- } from "./chunk-IIBOFECO.js";
8
+ } from "./chunk-UW6P2PMP.js";
9
9
  import {
10
10
  ERC20_ABI
11
11
  } from "./chunk-PQ5ZX6ZT.js";
12
12
  import {
13
13
  TOKENS
14
- } from "./chunk-WQOTLKVP.js";
14
+ } from "./chunk-7PDRYBHD.js";
15
15
  import {
16
16
  formatContractError,
17
17
  getAccount,
18
18
  getPublicClient
19
- } from "./chunk-WRG7GAIA.js";
19
+ } from "./chunk-N2547R2L.js";
20
20
  import {
21
21
  getExplorerUrl
22
- } from "./chunk-ZPYN5ZAI.js";
22
+ } from "./chunk-H32QA3NV.js";
23
23
  import {
24
24
  loadConfig,
25
25
  saveConfig
@@ -332,7 +332,7 @@ async function getCurrentPrice(tokenAddress, tokenDecimals, feeTier) {
332
332
  // src/commands/trade.ts
333
333
  var uniswap = new UniswapProvider();
334
334
  async function loadXmtp() {
335
- return import("./xmtp-XTJ7HDVG.js");
335
+ return import("./xmtp-5FPJN5WE.js");
336
336
  }
337
337
  var ETH_ADDRESS = "0x0000000000000000000000000000000000000000";
338
338
  var KNOWN_MEMECOINS = {
@@ -516,7 +516,7 @@ function registerTradeCommands(program) {
516
516
  }
517
517
  const wrapSpinner = ora("Wrapping ETH \u2192 WETH...").start();
518
518
  try {
519
- const { writeContractWithRetry, waitForReceipt: waitForReceiptFn } = await import("./client-HBMSTSKK.js");
519
+ const { writeContractWithRetry, waitForReceipt: waitForReceiptFn } = await import("./client-66VTYDRS.js");
520
520
  const wethAddr = TOKENS().WETH;
521
521
  const wrapHash = await writeContractWithRetry({
522
522
  address: wethAddr,
@@ -525,7 +525,7 @@ function registerTradeCommands(program) {
525
525
  args: [],
526
526
  value: inputAmount,
527
527
  account,
528
- chain: (await import("./network-X6GM7ROG.js")).getChain()
528
+ chain: (await import("./network-GJA2ZN3O.js")).getChain()
529
529
  });
530
530
  await waitForReceiptFn(wrapHash);
531
531
  wrapSpinner.succeed(`Wrapped ${opts.amount} ETH \u2192 WETH`);
@@ -639,9 +639,9 @@ function registerTradeCommands(program) {
639
639
  }
640
640
  console.log(` Tx: ${chalk.dim(getExplorerUrl(txHash))}`);
641
641
  try {
642
- const { createTradeAttestation, getEasScanUrl } = await import("./eas-D3KSAGWT.js");
642
+ const { createTradeAttestation, getEasScanUrl } = await import("./eas-YTMCD3UN.js");
643
643
  const { getChainContracts } = await import("./config-YXZKPSZB.js");
644
- const { getChain: getActiveChain } = await import("./network-X6GM7ROG.js");
644
+ const { getChain: getActiveChain } = await import("./network-GJA2ZN3O.js");
645
645
  const vaultRecipient = getChainContracts(getActiveChain().id).vault;
646
646
  const { uid } = await createTradeAttestation(
647
647
  inputAddr,
@@ -767,9 +767,9 @@ function registerTradeCommands(program) {
767
767
  }
768
768
  console.log(` Tx: ${chalk.dim(getExplorerUrl(txHash))}`);
769
769
  try {
770
- const { createTradeAttestation, getEasScanUrl } = await import("./eas-D3KSAGWT.js");
770
+ const { createTradeAttestation, getEasScanUrl } = await import("./eas-YTMCD3UN.js");
771
771
  const { getChainContracts } = await import("./config-YXZKPSZB.js");
772
- const { getChain: getActiveChain } = await import("./network-X6GM7ROG.js");
772
+ const { getChain: getActiveChain } = await import("./network-GJA2ZN3O.js");
773
773
  const vaultRecipient = getChainContracts(getActiveChain().id).vault;
774
774
  const { uid } = await createTradeAttestation(
775
775
  tokenAddr,
@@ -944,4 +944,4 @@ function sleep(ms) {
944
944
  export {
945
945
  registerTradeCommands
946
946
  };
947
- //# sourceMappingURL=trade-XDE6YCNY.js.map
947
+ //# sourceMappingURL=trade-3HVCELTB.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  getTextRecord
3
- } from "./chunk-YRYPGJ66.js";
3
+ } from "./chunk-7W6U6ZC6.js";
4
4
  import "./chunk-PQ5ZX6ZT.js";
5
- import "./chunk-WQOTLKVP.js";
5
+ import "./chunk-7PDRYBHD.js";
6
6
  import {
7
7
  getAccount
8
- } from "./chunk-WRG7GAIA.js";
8
+ } from "./chunk-N2547R2L.js";
9
9
  import {
10
10
  getChainConfig
11
- } from "./chunk-ZPYN5ZAI.js";
11
+ } from "./chunk-H32QA3NV.js";
12
12
  import {
13
13
  cacheGroupId,
14
14
  getCachedGroupId,
@@ -276,4 +276,4 @@ export {
276
276
  sendReaction,
277
277
  streamMessages
278
278
  };
279
- //# sourceMappingURL=xmtp-XTJ7HDVG.js.map
279
+ //# sourceMappingURL=xmtp-5FPJN5WE.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sherwoodagent/cli",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "CLI for agent-managed investment syndicates — onchain DeFi syndicates with XMTP chat",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
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, http } from \"viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\nimport { getChain, getRpcUrl } 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\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: http(getRpcUrl()),\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: http(getRpcUrl()),\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 // ── 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 — 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,YAAY;AAC7D,SAAS,2BAA2B;;;ACDp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WAAW,UAAU,CAAC,IAAI,WAAW,KAAK,kBAAkB,GAAG,IAAI,qBAAqB,aAAa,KAAK;AAGvH,YAAM,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAEtD,UAAI,kBAAkB,GAAG,GAAG;AAE1B,gBAAQ,MAAM,OAAO,oBAAoB,EAAE,SAAS,QAAQ,SAAS,UAAU,UAAU,CAAC;AAAA,MAC5F,OAAO;AACL,eAAO,SAAS,IAAI;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AACA,QAAM,IAAI,MAAM,8BAA8B;AAChD;AAMA,eAAsB,gBAAgB,UAA6C;AACjF,QAAM,SAAS,gBAAgB;AAC/B,SAAO,UAAU,CAAC,MAAM,OAAO,gBAAgB,CAAC,GAAG,QAAQ;AAC7D;AAMA,eAAsB,uBAAuB,UAA6C;AACxF,QAAM,SAAS,gBAAgB;AAC/B,SAAO,UAAU,CAAC,MAAM,OAAO,cAAc,CAAC,GAAG,QAAQ;AAC3D;AAUA,eAAsB,eAAe,MAAwC;AAC3E,QAAM,SAAS,gBAAgB;AAC/B,MAAI;AACF,WAAO,MAAM,OAAO,0BAA0B,EAAE,KAAK,CAAC;AAAA,EAExD,SAAS,KAAU;AAEjB,UAAM,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG;AAC3D,QAAI,IAAI,SAAS,SAAS,KAAK,IAAI,SAAS,WAAW,GAAG;AACxD,UAAK,MAAM,iBAAiB,MAAO,MAAM;AACvC,gBAAQ,KAAK,QAAQ,IAAI,uDAAkD;AAC3E,eAAQ,MAAM,iBAAiB,MAAO,MAAM;AAC1C,gBAAM,oBAAoB;AAAA,QAC5B;AAAA,MACF;AAAA,IACF;AACA,UAAM;AAAA,EACR;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/network.ts"],"sourcesContent":["/**\n * Network state singleton.\n *\n * Called once at CLI startup via the --chain flag's preAction hook.\n * Every other module reads from here — never hardcodes a chain.\n */\n\nimport { type Chain, defineChain } from \"viem\";\nimport { base, baseSepolia } from \"viem/chains\";\nimport { getConfigRpcUrl } from \"./config.js\";\n\n// ── Robinhood L2 Testnet (Arbitrum Orbit, chain ID 46630) ──\n\nexport const robinhoodTestnet = defineChain({\n id: 46630,\n name: \"Robinhood Chain Testnet\",\n nativeCurrency: { name: \"Ethereum\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: { http: [\"https://rpc.testnet.chain.robinhood.com\"] },\n },\n blockExplorers: {\n default: {\n name: \"Blockscout\",\n url: \"https://explorer.testnet.chain.robinhood.com\",\n },\n },\n testnet: true,\n});\n\n// ── HyperEVM (Hyperliquid L1, chain ID 999) ──\n\nexport const hyperevm = defineChain({\n id: 999,\n name: \"HyperEVM\",\n nativeCurrency: { name: \"Ethereum\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: { http: [\"https://rpc.hyperliquid.xyz/evm\"] },\n },\n blockExplorers: {\n default: {\n name: \"Routescan\",\n url: \"https://hyperevmscan.io\",\n },\n },\n testnet: false,\n});\n\n// ── HyperEVM Testnet (chain ID 998) ──\n\nexport const hyperevmTestnet = defineChain({\n id: 998,\n name: \"HyperEVM Testnet\",\n nativeCurrency: { name: \"Ethereum\", symbol: \"ETH\", decimals: 18 },\n rpcUrls: {\n default: { http: [\"https://rpc.hyperliquid-testnet.xyz/evm\"] },\n },\n blockExplorers: {\n default: {\n name: \"Routescan\",\n url: \"https://explorer.hyperliquid-testnet.xyz\",\n },\n },\n testnet: true,\n});\n\n// ── Types ──\n\nexport type Network = \"base\" | \"base-sepolia\" | \"robinhood-testnet\" | \"hyperevm\" | \"hyperevm-testnet\";\n\nexport interface ChainConfig {\n chain: Chain;\n rpcFallback: string;\n /** Legacy env var for backwards compat (base / base-sepolia only) */\n rpcEnvVar?: string;\n explorerHost: string;\n /** EAS GraphQL endpoint — null if EAS is not available on this chain */\n easGraphqlUrl: string | null;\n /** EAS scan host — null if unavailable */\n easScanHost: string | null;\n xmtpEnv: \"production\" | \"dev\";\n isTestnet: boolean;\n}\n\n// ── Chain Registry ──\n\nexport const CHAIN_REGISTRY: Record<Network, ChainConfig> = {\n base: {\n chain: base,\n rpcFallback: \"https://mainnet.base.org\",\n rpcEnvVar: \"BASE_RPC_URL\",\n explorerHost: \"basescan.org\",\n easGraphqlUrl: \"https://base.easscan.org/graphql\",\n easScanHost: \"base.easscan.org\",\n xmtpEnv: \"production\",\n isTestnet: false,\n },\n \"base-sepolia\": {\n chain: baseSepolia,\n rpcFallback: \"https://sepolia.base.org\",\n rpcEnvVar: \"BASE_SEPOLIA_RPC_URL\",\n explorerHost: \"sepolia.basescan.org\",\n easGraphqlUrl: \"https://base-sepolia.easscan.org/graphql\",\n easScanHost: \"base-sepolia.easscan.org\",\n xmtpEnv: \"dev\",\n isTestnet: true,\n },\n \"robinhood-testnet\": {\n chain: robinhoodTestnet,\n rpcFallback: \"https://rpc.testnet.chain.robinhood.com\",\n explorerHost: \"explorer.testnet.chain.robinhood.com\",\n easGraphqlUrl: null,\n easScanHost: null,\n xmtpEnv: \"dev\",\n isTestnet: true,\n },\n hyperevm: {\n chain: hyperevm,\n rpcFallback: \"https://rpc.hyperliquid.xyz/evm\",\n rpcEnvVar: \"HYPEREVM_RPC_URL\",\n explorerHost: \"hyperevmscan.io\",\n easGraphqlUrl: null,\n easScanHost: null,\n xmtpEnv: \"production\",\n isTestnet: false,\n },\n \"hyperevm-testnet\": {\n chain: hyperevmTestnet,\n rpcFallback: \"https://rpc.hyperliquid-testnet.xyz/evm\",\n rpcEnvVar: \"HYPEREVM_TESTNET_RPC_URL\",\n explorerHost: \"explorer.hyperliquid-testnet.xyz\",\n easGraphqlUrl: null,\n easScanHost: null,\n xmtpEnv: \"dev\",\n isTestnet: true,\n },\n};\n\nexport const VALID_NETWORKS = Object.keys(CHAIN_REGISTRY) as Network[];\n\n// ── Singleton state ──\n\nlet _network: Network = \"base\";\n\nexport function setNetwork(n: Network) {\n const config = CHAIN_REGISTRY[n];\n if (!config) {\n throw new Error(\n `Unknown network: ${n}. Valid: ${VALID_NETWORKS.join(\", \")}`,\n );\n }\n if (config.isTestnet && process.env.ENABLE_TESTNET !== \"true\") {\n throw new Error(\n `Testnet \"${n}\" is disabled. Set ENABLE_TESTNET=true to enable.`,\n );\n }\n _network = n;\n}\n\nexport function getNetwork(): Network {\n return _network;\n}\n\nexport function getChainConfig(): ChainConfig {\n return CHAIN_REGISTRY[_network];\n}\n\nexport function getChain(): Chain {\n return CHAIN_REGISTRY[_network].chain;\n}\n\nexport function getRpcUrl(): string {\n // 1. User config (~/.sherwood/config.json)\n const fromConfig = getConfigRpcUrl(_network);\n if (fromConfig) return fromConfig;\n\n // 2. Legacy env var (backwards compat for base / base-sepolia)\n const cfg = CHAIN_REGISTRY[_network];\n if (cfg.rpcEnvVar && process.env[cfg.rpcEnvVar]) {\n return process.env[cfg.rpcEnvVar]!;\n }\n\n // 3. Public fallback\n return cfg.rpcFallback;\n}\n\nexport function getExplorerUrl(txHash: string): string {\n return `https://${CHAIN_REGISTRY[_network].explorerHost}/tx/${txHash}`;\n}\n\nexport function isTestnet(): boolean {\n return CHAIN_REGISTRY[_network].isTestnet;\n}\n"],"mappings":";;;;;AAOA,SAAqB,mBAAmB;AACxC,SAAS,MAAM,mBAAmB;AAK3B,IAAM,mBAAmB,YAAY;AAAA,EAC1C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB,EAAE,MAAM,YAAY,QAAQ,OAAO,UAAU,GAAG;AAAA,EAChE,SAAS;AAAA,IACP,SAAS,EAAE,MAAM,CAAC,yCAAyC,EAAE;AAAA,EAC/D;AAAA,EACA,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,MAAM;AAAA,MACN,KAAK;AAAA,IACP;AAAA,EACF;AAAA,EACA,SAAS;AACX,CAAC;AAIM,IAAM,WAAW,YAAY;AAAA,EAClC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,gBAAgB,EAAE,MAAM,YAAY,QAAQ,OAAO,U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