@sherwoodagent/cli 0.18.4 → 0.19.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.
- package/dist/{chat-7CB4YGGP.js → chat-WKOSUZXO.js} +7 -7
- package/dist/{chunk-FR4LYDPJ.js → chunk-CTLEZZO7.js} +115 -4
- package/dist/chunk-CTLEZZO7.js.map +1 -0
- package/dist/{chunk-L24NGLKY.js → chunk-I7CKBBOG.js} +8 -3
- package/dist/{chunk-L24NGLKY.js.map → chunk-I7CKBBOG.js.map} +1 -1
- package/dist/{chunk-TPE6ZTUI.js → chunk-LHDWONBI.js} +59 -5
- package/dist/chunk-LHDWONBI.js.map +1 -0
- package/dist/{chunk-5ZC2A7UP.js → chunk-P4J6FKAP.js} +4 -4
- package/dist/{chunk-ARD44YTT.js → chunk-QT7BUKWR.js} +5 -5
- package/dist/{chunk-TWX6FSCM.js → chunk-SZ5QQJGA.js} +12 -2
- package/dist/chunk-SZ5QQJGA.js.map +1 -0
- package/dist/{chunk-MJMWA4LY.js → chunk-TAAEMX3L.js} +2 -2
- package/dist/{chunk-Z2PNK3CC.js → chunk-XR2ZUO4R.js} +2 -2
- package/dist/chunk-YJAMY25R.js +465 -0
- package/dist/chunk-YJAMY25R.js.map +1 -0
- package/dist/client-3AAXAX4C.js +21 -0
- package/dist/{config-LW4Q6NK5.js → config-IDAHD7S3.js} +6 -2
- package/dist/eas-JE3NQCXE.js +29 -0
- package/dist/{governor-E6AU3UWV.js → governor-J3W67NXA.js} +6 -6
- package/dist/index.js +76 -295
- package/dist/index.js.map +1 -1
- package/dist/{network-C32G5D3J.js → network-DBUZ7GRF.js} +3 -3
- package/dist/{research-MKI4RS2F.js → research-47YMVW3N.js} +7 -7
- package/dist/research-DZINC4N4.js +14 -0
- package/dist/research-DZINC4N4.js.map +1 -0
- package/dist/{session-RAFLL5BD.js → session-Q2WRYXYF.js} +10 -10
- package/dist/trade-D6VT5MLQ.js +874 -0
- package/dist/trade-D6VT5MLQ.js.map +1 -0
- package/dist/{xmtp-ATRMY76G.js → xmtp-7DF7UG66.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-FR4LYDPJ.js.map +0 -1
- package/dist/chunk-TPE6ZTUI.js.map +0 -1
- package/dist/chunk-TWX6FSCM.js.map +0 -1
- package/dist/eas-DOC4QKDF.js +0 -23
- package/dist/research-V63URK4C.js +0 -14
- /package/dist/{chat-7CB4YGGP.js.map → chat-WKOSUZXO.js.map} +0 -0
- /package/dist/{chunk-5ZC2A7UP.js.map → chunk-P4J6FKAP.js.map} +0 -0
- /package/dist/{chunk-ARD44YTT.js.map → chunk-QT7BUKWR.js.map} +0 -0
- /package/dist/{chunk-MJMWA4LY.js.map → chunk-TAAEMX3L.js.map} +0 -0
- /package/dist/{chunk-Z2PNK3CC.js.map → chunk-XR2ZUO4R.js.map} +0 -0
- /package/dist/{config-LW4Q6NK5.js.map → client-3AAXAX4C.js.map} +0 -0
- /package/dist/{eas-DOC4QKDF.js.map → config-IDAHD7S3.js.map} +0 -0
- /package/dist/{governor-E6AU3UWV.js.map → eas-JE3NQCXE.js.map} +0 -0
- /package/dist/{network-C32G5D3J.js.map → governor-J3W67NXA.js.map} +0 -0
- /package/dist/{research-V63URK4C.js.map → network-DBUZ7GRF.js.map} +0 -0
- /package/dist/{research-MKI4RS2F.js.map → research-47YMVW3N.js.map} +0 -0
- /package/dist/{session-RAFLL5BD.js.map → session-Q2WRYXYF.js.map} +0 -0
- /package/dist/{xmtp-ATRMY76G.js.map → xmtp-7DF7UG66.js.map} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
estimateFeesWithBuffer,
|
|
3
|
+
getAccount,
|
|
4
|
+
getPublicClient,
|
|
5
|
+
getWalletClient,
|
|
6
|
+
resetClients,
|
|
7
|
+
sendTxWithRetry,
|
|
8
|
+
writeContractWithRetry
|
|
9
|
+
} from "./chunk-I7CKBBOG.js";
|
|
10
|
+
import "./chunk-TAAEMX3L.js";
|
|
11
|
+
import "./chunk-SZ5QQJGA.js";
|
|
12
|
+
export {
|
|
13
|
+
estimateFeesWithBuffer,
|
|
14
|
+
getAccount,
|
|
15
|
+
getPublicClient,
|
|
16
|
+
getWalletClient,
|
|
17
|
+
resetClients,
|
|
18
|
+
sendTxWithRetry,
|
|
19
|
+
writeContractWithRetry
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=client-3AAXAX4C.js.map
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
getConfigRpcUrl,
|
|
7
7
|
getNotifyTo,
|
|
8
8
|
getPrivateKey,
|
|
9
|
+
getUniswapApiKey,
|
|
9
10
|
getVeniceApiKey,
|
|
10
11
|
loadConfig,
|
|
11
12
|
saveConfig,
|
|
@@ -14,8 +15,9 @@ import {
|
|
|
14
15
|
setConfigRpcUrl,
|
|
15
16
|
setNotifyTo,
|
|
16
17
|
setPrivateKey,
|
|
18
|
+
setUniswapApiKey,
|
|
17
19
|
setVeniceApiKey
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-SZ5QQJGA.js";
|
|
19
21
|
export {
|
|
20
22
|
cacheGroupId,
|
|
21
23
|
getAgentId,
|
|
@@ -24,6 +26,7 @@ export {
|
|
|
24
26
|
getConfigRpcUrl,
|
|
25
27
|
getNotifyTo,
|
|
26
28
|
getPrivateKey,
|
|
29
|
+
getUniswapApiKey,
|
|
27
30
|
getVeniceApiKey,
|
|
28
31
|
loadConfig,
|
|
29
32
|
saveConfig,
|
|
@@ -32,6 +35,7 @@ export {
|
|
|
32
35
|
setConfigRpcUrl,
|
|
33
36
|
setNotifyTo,
|
|
34
37
|
setPrivateKey,
|
|
38
|
+
setUniswapApiKey,
|
|
35
39
|
setVeniceApiKey
|
|
36
40
|
};
|
|
37
|
-
//# sourceMappingURL=config-
|
|
41
|
+
//# sourceMappingURL=config-IDAHD7S3.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApproval,
|
|
3
|
+
createJoinRequest,
|
|
4
|
+
createResearchAttestation,
|
|
5
|
+
createTradeAttestation,
|
|
6
|
+
createVeniceInferenceAttestation,
|
|
7
|
+
createVeniceProvisionAttestation,
|
|
8
|
+
getEasScanUrl,
|
|
9
|
+
queryApprovals,
|
|
10
|
+
queryJoinRequests,
|
|
11
|
+
revokeAttestation
|
|
12
|
+
} from "./chunk-CTLEZZO7.js";
|
|
13
|
+
import "./chunk-LHDWONBI.js";
|
|
14
|
+
import "./chunk-I7CKBBOG.js";
|
|
15
|
+
import "./chunk-TAAEMX3L.js";
|
|
16
|
+
import "./chunk-SZ5QQJGA.js";
|
|
17
|
+
export {
|
|
18
|
+
createApproval,
|
|
19
|
+
createJoinRequest,
|
|
20
|
+
createResearchAttestation,
|
|
21
|
+
createTradeAttestation,
|
|
22
|
+
createVeniceInferenceAttestation,
|
|
23
|
+
createVeniceProvisionAttestation,
|
|
24
|
+
getEasScanUrl,
|
|
25
|
+
queryApprovals,
|
|
26
|
+
queryJoinRequests,
|
|
27
|
+
revokeAttestation
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=eas-JE3NQCXE.js.map
|
|
@@ -34,11 +34,11 @@ import {
|
|
|
34
34
|
settleProposal,
|
|
35
35
|
vetoProposal,
|
|
36
36
|
vote
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-P4J6FKAP.js";
|
|
38
|
+
import "./chunk-LHDWONBI.js";
|
|
39
|
+
import "./chunk-I7CKBBOG.js";
|
|
40
|
+
import "./chunk-TAAEMX3L.js";
|
|
41
|
+
import "./chunk-SZ5QQJGA.js";
|
|
42
42
|
export {
|
|
43
43
|
PROPOSAL_STATE,
|
|
44
44
|
PROPOSAL_STATES,
|
|
@@ -76,4 +76,4 @@ export {
|
|
|
76
76
|
vetoProposal,
|
|
77
77
|
vote
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=governor-
|
|
79
|
+
//# sourceMappingURL=governor-J3W67NXA.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
UniswapProvider,
|
|
4
|
+
applySlippage,
|
|
5
|
+
chatCompletion,
|
|
6
|
+
checkApiKeyValid,
|
|
7
|
+
encodeSwapPath,
|
|
8
|
+
getMultiHopQuote,
|
|
9
|
+
getQuote,
|
|
10
|
+
listModels,
|
|
11
|
+
provisionApiKey
|
|
12
|
+
} from "./chunk-YJAMY25R.js";
|
|
2
13
|
import {
|
|
3
14
|
PROPOSAL_STATE,
|
|
4
15
|
PROPOSAL_STATES,
|
|
@@ -29,7 +40,7 @@ import {
|
|
|
29
40
|
setVotingPeriod,
|
|
30
41
|
settleProposal,
|
|
31
42
|
vote
|
|
32
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-P4J6FKAP.js";
|
|
33
44
|
import {
|
|
34
45
|
fetchMetadata,
|
|
35
46
|
uploadMetadata
|
|
@@ -41,7 +52,7 @@ import {
|
|
|
41
52
|
queryApprovals,
|
|
42
53
|
queryJoinRequests,
|
|
43
54
|
revokeAttestation
|
|
44
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-CTLEZZO7.js";
|
|
45
56
|
import {
|
|
46
57
|
approveDepositor,
|
|
47
58
|
deposit,
|
|
@@ -57,7 +68,7 @@ import {
|
|
|
57
68
|
resolveVaultSyndicate,
|
|
58
69
|
setTextRecord,
|
|
59
70
|
setVaultAddress
|
|
60
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-QT7BUKWR.js";
|
|
61
72
|
import {
|
|
62
73
|
AERODROME,
|
|
63
74
|
AGENT_REGISTRY,
|
|
@@ -67,21 +78,22 @@ import {
|
|
|
67
78
|
MOONWELL,
|
|
68
79
|
SHERWOOD,
|
|
69
80
|
STRATEGY_TEMPLATES,
|
|
81
|
+
SWAP_ROUTER_ABI,
|
|
82
|
+
SWAP_ROUTER_EXACT_INPUT_SINGLE_ABI,
|
|
70
83
|
SYNDICATE_FACTORY_ABI,
|
|
71
84
|
SYNDICATE_VAULT_ABI,
|
|
72
85
|
TOKENS,
|
|
73
86
|
UNISWAP,
|
|
74
|
-
UNISWAP_QUOTER_V2_ABI,
|
|
75
87
|
VENICE,
|
|
76
88
|
VENICE_STAKING_ABI
|
|
77
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-LHDWONBI.js";
|
|
78
90
|
import {
|
|
79
91
|
getAccount,
|
|
80
92
|
getPublicClient,
|
|
81
93
|
getWalletClient,
|
|
82
94
|
sendTxWithRetry,
|
|
83
95
|
writeContractWithRetry
|
|
84
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-I7CKBBOG.js";
|
|
85
97
|
import {
|
|
86
98
|
VALID_NETWORKS,
|
|
87
99
|
getChain,
|
|
@@ -90,12 +102,13 @@ import {
|
|
|
90
102
|
getRpcUrl,
|
|
91
103
|
isTestnet,
|
|
92
104
|
setNetwork
|
|
93
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-TAAEMX3L.js";
|
|
94
106
|
import {
|
|
95
107
|
cacheGroupId,
|
|
96
108
|
getAgentId,
|
|
97
109
|
getChainContracts,
|
|
98
110
|
getNotifyTo,
|
|
111
|
+
getUniswapApiKey,
|
|
99
112
|
getVeniceApiKey,
|
|
100
113
|
loadConfig,
|
|
101
114
|
setAgentId,
|
|
@@ -103,8 +116,9 @@ import {
|
|
|
103
116
|
setConfigRpcUrl,
|
|
104
117
|
setNotifyTo,
|
|
105
118
|
setPrivateKey,
|
|
119
|
+
setUniswapApiKey,
|
|
106
120
|
setVeniceApiKey
|
|
107
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-SZ5QQJGA.js";
|
|
108
122
|
|
|
109
123
|
// src/index.ts
|
|
110
124
|
import { config as loadDotenv } from "dotenv";
|
|
@@ -149,28 +163,6 @@ var MoonwellProvider = class {
|
|
|
149
163
|
}
|
|
150
164
|
};
|
|
151
165
|
|
|
152
|
-
// src/providers/uniswap.ts
|
|
153
|
-
import { base as base2, baseSepolia as baseSepolia2 } from "viem/chains";
|
|
154
|
-
var UniswapProvider = class {
|
|
155
|
-
info() {
|
|
156
|
-
return {
|
|
157
|
-
name: "uniswap",
|
|
158
|
-
type: "trading",
|
|
159
|
-
capabilities: [
|
|
160
|
-
"swap.exact-input",
|
|
161
|
-
"swap.quote"
|
|
162
|
-
],
|
|
163
|
-
supportedChains: [base2, baseSepolia2]
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
async swap(params) {
|
|
167
|
-
throw new Error("Not implemented \u2014 wire up viem client");
|
|
168
|
-
}
|
|
169
|
-
async quote(params) {
|
|
170
|
-
throw new Error("Not implemented");
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
|
|
174
166
|
// src/commands/strategy-template.ts
|
|
175
167
|
import { parseUnits, isAddress, erc20Abi } from "viem";
|
|
176
168
|
import chalk from "chalk";
|
|
@@ -882,9 +874,9 @@ function registerStrategyTemplateCommands(strategy2) {
|
|
|
882
874
|
console.error(chalk.red("Missing --name, --performance-fee, or --duration. Use --write-calls to skip proposal submission."));
|
|
883
875
|
process.exit(1);
|
|
884
876
|
}
|
|
885
|
-
const { propose: propose2 } = await import("./governor-
|
|
877
|
+
const { propose: propose2 } = await import("./governor-J3W67NXA.js");
|
|
886
878
|
const { pinJSON } = await import("./ipfs-22YLNQ2C.js");
|
|
887
|
-
const { parseDuration: parseDuration2 } = await import("./governor-
|
|
879
|
+
const { parseDuration: parseDuration2 } = await import("./governor-J3W67NXA.js");
|
|
888
880
|
const performanceFeeBps = BigInt(opts.performanceFee);
|
|
889
881
|
if (performanceFeeBps < 0n || performanceFeeBps > 10000n) {
|
|
890
882
|
console.error(chalk.red("--performance-fee must be 0-10000 (basis points)"));
|
|
@@ -1124,124 +1116,6 @@ async function getActiveSyndicates2(creator) {
|
|
|
1124
1116
|
import { formatUnits as formatUnits2, isAddress as isAddress2 } from "viem";
|
|
1125
1117
|
import chalk2 from "chalk";
|
|
1126
1118
|
import ora2 from "ora";
|
|
1127
|
-
|
|
1128
|
-
// src/lib/venice.ts
|
|
1129
|
-
var VENICE_API_BASE = "https://api.venice.ai/api/v1";
|
|
1130
|
-
async function provisionApiKey() {
|
|
1131
|
-
const account = getAccount();
|
|
1132
|
-
const tokenRes = await fetch(`${VENICE_API_BASE}/api_keys/generate_web3_key`, {
|
|
1133
|
-
signal: AbortSignal.timeout(15e3)
|
|
1134
|
-
});
|
|
1135
|
-
if (!tokenRes.ok) {
|
|
1136
|
-
throw new Error(`Failed to get validation token: ${tokenRes.status} ${tokenRes.statusText}`);
|
|
1137
|
-
}
|
|
1138
|
-
const tokenData = await tokenRes.json();
|
|
1139
|
-
const token = tokenData?.data?.token;
|
|
1140
|
-
if (!token) {
|
|
1141
|
-
throw new Error("Venice API returned no validation token");
|
|
1142
|
-
}
|
|
1143
|
-
const signature = await account.signMessage({ message: token });
|
|
1144
|
-
const keyRes = await fetch(`${VENICE_API_BASE}/api_keys/generate_web3_key`, {
|
|
1145
|
-
method: "POST",
|
|
1146
|
-
headers: {
|
|
1147
|
-
"Content-Type": "application/json",
|
|
1148
|
-
Authorization: `Bearer ${token}`
|
|
1149
|
-
},
|
|
1150
|
-
signal: AbortSignal.timeout(15e3),
|
|
1151
|
-
body: JSON.stringify({
|
|
1152
|
-
address: account.address,
|
|
1153
|
-
signature,
|
|
1154
|
-
token,
|
|
1155
|
-
apiKeyType: "INFERENCE",
|
|
1156
|
-
description: "Sherwood syndicate agent"
|
|
1157
|
-
})
|
|
1158
|
-
});
|
|
1159
|
-
if (!keyRes.ok) {
|
|
1160
|
-
const body = await keyRes.text();
|
|
1161
|
-
throw new Error(`Failed to generate API key: ${keyRes.status} ${body}`);
|
|
1162
|
-
}
|
|
1163
|
-
const keyData = await keyRes.json();
|
|
1164
|
-
const apiKey = keyData?.data?.apiKey;
|
|
1165
|
-
if (!apiKey) {
|
|
1166
|
-
throw new Error("Venice API returned no API key");
|
|
1167
|
-
}
|
|
1168
|
-
setVeniceApiKey(apiKey);
|
|
1169
|
-
return apiKey;
|
|
1170
|
-
}
|
|
1171
|
-
async function checkApiKeyValid() {
|
|
1172
|
-
const apiKey = getVeniceApiKey();
|
|
1173
|
-
if (!apiKey) return false;
|
|
1174
|
-
try {
|
|
1175
|
-
const res = await fetch(`${VENICE_API_BASE}/models`, {
|
|
1176
|
-
headers: { Authorization: `Bearer ${apiKey}` },
|
|
1177
|
-
signal: AbortSignal.timeout(15e3)
|
|
1178
|
-
});
|
|
1179
|
-
return res.ok;
|
|
1180
|
-
} catch {
|
|
1181
|
-
return false;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
async function chatCompletion(opts) {
|
|
1185
|
-
const apiKey = getVeniceApiKey();
|
|
1186
|
-
if (!apiKey) {
|
|
1187
|
-
throw new Error("No Venice API key configured. Run 'sherwood venice provision' first.");
|
|
1188
|
-
}
|
|
1189
|
-
const body = {
|
|
1190
|
-
model: opts.model,
|
|
1191
|
-
messages: opts.messages
|
|
1192
|
-
};
|
|
1193
|
-
if (opts.temperature !== void 0) body.temperature = opts.temperature;
|
|
1194
|
-
if (opts.maxTokens !== void 0) body.max_tokens = opts.maxTokens;
|
|
1195
|
-
const veniceParams = {};
|
|
1196
|
-
if (opts.enableWebSearch) veniceParams.enable_web_search = "on";
|
|
1197
|
-
if (opts.disableThinking) veniceParams.disable_thinking = true;
|
|
1198
|
-
if (Object.keys(veniceParams).length > 0) body.venice_parameters = veniceParams;
|
|
1199
|
-
const res = await fetch(`${VENICE_API_BASE}/chat/completions`, {
|
|
1200
|
-
method: "POST",
|
|
1201
|
-
headers: {
|
|
1202
|
-
"Content-Type": "application/json",
|
|
1203
|
-
Authorization: `Bearer ${apiKey}`
|
|
1204
|
-
},
|
|
1205
|
-
signal: AbortSignal.timeout(12e4),
|
|
1206
|
-
// inference can be slow
|
|
1207
|
-
body: JSON.stringify(body)
|
|
1208
|
-
});
|
|
1209
|
-
if (!res.ok) {
|
|
1210
|
-
const errBody = await res.text();
|
|
1211
|
-
throw new Error(`Venice inference failed: ${res.status} ${errBody}`);
|
|
1212
|
-
}
|
|
1213
|
-
const data = await res.json();
|
|
1214
|
-
const choice = data.choices?.[0];
|
|
1215
|
-
if (!choice) {
|
|
1216
|
-
throw new Error("Venice returned no choices");
|
|
1217
|
-
}
|
|
1218
|
-
return {
|
|
1219
|
-
content: choice.message?.content ?? "",
|
|
1220
|
-
model: data.model ?? opts.model,
|
|
1221
|
-
usage: {
|
|
1222
|
-
promptTokens: data.usage?.prompt_tokens ?? 0,
|
|
1223
|
-
completionTokens: data.usage?.completion_tokens ?? 0,
|
|
1224
|
-
totalTokens: data.usage?.total_tokens ?? 0
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
}
|
|
1228
|
-
async function listModels() {
|
|
1229
|
-
const apiKey = getVeniceApiKey();
|
|
1230
|
-
if (!apiKey) {
|
|
1231
|
-
throw new Error("No Venice API key configured. Run 'sherwood venice provision' first.");
|
|
1232
|
-
}
|
|
1233
|
-
const res = await fetch(`${VENICE_API_BASE}/models`, {
|
|
1234
|
-
headers: { Authorization: `Bearer ${apiKey}` },
|
|
1235
|
-
signal: AbortSignal.timeout(15e3)
|
|
1236
|
-
});
|
|
1237
|
-
if (!res.ok) {
|
|
1238
|
-
throw new Error(`Failed to list Venice models: ${res.status} ${res.statusText}`);
|
|
1239
|
-
}
|
|
1240
|
-
const data = await res.json();
|
|
1241
|
-
return (data.data ?? []).map((m) => m.id);
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
// src/commands/venice.ts
|
|
1245
1119
|
import { readFileSync } from "fs";
|
|
1246
1120
|
function registerVeniceCommands(program2) {
|
|
1247
1121
|
const venice = program2.command("venice").description("Venice private inference \u2014 provision API keys, run inference");
|
|
@@ -1274,6 +1148,14 @@ function registerVeniceCommands(program2) {
|
|
|
1274
1148
|
keySpinner.succeed("Venice API key provisioned");
|
|
1275
1149
|
console.log(chalk2.dim(` Key: ${apiKey.slice(0, 8)}...${apiKey.slice(-4)}`));
|
|
1276
1150
|
console.log(chalk2.dim(" Saved to ~/.sherwood/config.json"));
|
|
1151
|
+
try {
|
|
1152
|
+
const { createVeniceProvisionAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-JE3NQCXE.js");
|
|
1153
|
+
const { uid } = await createVeniceProvisionAttestation(account.address);
|
|
1154
|
+
if (uid !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
1155
|
+
console.log(chalk2.dim(` Attested: ${getEasScanUrl2(uid)}`));
|
|
1156
|
+
}
|
|
1157
|
+
} catch {
|
|
1158
|
+
}
|
|
1277
1159
|
} catch (err) {
|
|
1278
1160
|
keySpinner.fail("Failed to provision API key");
|
|
1279
1161
|
console.error(chalk2.red(err instanceof Error ? err.message : String(err)));
|
|
@@ -1417,6 +1299,21 @@ ${opts.prompt}`;
|
|
|
1417
1299
|
console.log();
|
|
1418
1300
|
console.log(chalk2.dim(`Model: ${result.model} | Tokens: ${result.usage.promptTokens} in, ${result.usage.completionTokens} out, ${result.usage.totalTokens} total`));
|
|
1419
1301
|
}
|
|
1302
|
+
try {
|
|
1303
|
+
const { createVeniceInferenceAttestation, getEasScanUrl: getEasScanUrl2 } = await import("./eas-JE3NQCXE.js");
|
|
1304
|
+
const { keccak256, toHex } = await import("viem");
|
|
1305
|
+
const promptHash = keccak256(toHex(userContent)).slice(0, 18);
|
|
1306
|
+
const { uid } = await createVeniceInferenceAttestation(
|
|
1307
|
+
result.model,
|
|
1308
|
+
result.usage.promptTokens,
|
|
1309
|
+
result.usage.completionTokens,
|
|
1310
|
+
promptHash
|
|
1311
|
+
);
|
|
1312
|
+
if (uid !== "0x0000000000000000000000000000000000000000000000000000000000000000") {
|
|
1313
|
+
console.log(chalk2.dim(`Attested: ${getEasScanUrl2(uid)}`));
|
|
1314
|
+
}
|
|
1315
|
+
} catch {
|
|
1316
|
+
}
|
|
1420
1317
|
} catch (err) {
|
|
1421
1318
|
spinner.fail("Inference failed");
|
|
1422
1319
|
console.error(chalk2.red(err instanceof Error ? err.message : String(err)));
|
|
@@ -1430,138 +1327,8 @@ import { parseUnits as parseUnits4, formatUnits as formatUnits3, isAddress as is
|
|
|
1430
1327
|
import chalk3 from "chalk";
|
|
1431
1328
|
import ora3 from "ora";
|
|
1432
1329
|
|
|
1433
|
-
// src/lib/quote.ts
|
|
1434
|
-
import { encodeFunctionData as encodeFunctionData5, decodeFunctionResult, concat as concat2, pad, numberToHex } from "viem";
|
|
1435
|
-
async function getQuote(params) {
|
|
1436
|
-
const client = getPublicClient();
|
|
1437
|
-
const calldata = encodeFunctionData5({
|
|
1438
|
-
abi: UNISWAP_QUOTER_V2_ABI,
|
|
1439
|
-
functionName: "quoteExactInputSingle",
|
|
1440
|
-
args: [
|
|
1441
|
-
{
|
|
1442
|
-
tokenIn: params.tokenIn,
|
|
1443
|
-
tokenOut: params.tokenOut,
|
|
1444
|
-
amountIn: params.amountIn,
|
|
1445
|
-
fee: params.fee,
|
|
1446
|
-
sqrtPriceLimitX96: 0n
|
|
1447
|
-
}
|
|
1448
|
-
]
|
|
1449
|
-
});
|
|
1450
|
-
const { data } = await client.call({
|
|
1451
|
-
to: UNISWAP().QUOTER_V2,
|
|
1452
|
-
data: calldata
|
|
1453
|
-
});
|
|
1454
|
-
if (!data) {
|
|
1455
|
-
throw new Error("Quoter returned no data \u2014 pool may not exist for this pair/fee");
|
|
1456
|
-
}
|
|
1457
|
-
const [amountOut, sqrtPriceX96After, , gasEstimate] = decodeFunctionResult({
|
|
1458
|
-
abi: UNISWAP_QUOTER_V2_ABI,
|
|
1459
|
-
functionName: "quoteExactInputSingle",
|
|
1460
|
-
data
|
|
1461
|
-
});
|
|
1462
|
-
return { amountOut, sqrtPriceX96After, gasEstimate };
|
|
1463
|
-
}
|
|
1464
|
-
function applySlippage(amountOut, slippageBps) {
|
|
1465
|
-
return amountOut * BigInt(1e4 - slippageBps) / 10000n;
|
|
1466
|
-
}
|
|
1467
|
-
function encodeSwapPath(tokens, fees) {
|
|
1468
|
-
if (tokens.length < 2 || fees.length !== tokens.length - 1) {
|
|
1469
|
-
throw new Error("Invalid path: need at least 2 tokens and (tokens-1) fees");
|
|
1470
|
-
}
|
|
1471
|
-
const parts = [];
|
|
1472
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
1473
|
-
parts.push(tokens[i].toLowerCase());
|
|
1474
|
-
if (i < fees.length) {
|
|
1475
|
-
parts.push(pad(numberToHex(fees[i]), { size: 3 }));
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
return concat2(parts);
|
|
1479
|
-
}
|
|
1480
|
-
async function getMultiHopQuote(params) {
|
|
1481
|
-
const client = getPublicClient();
|
|
1482
|
-
const calldata = encodeFunctionData5({
|
|
1483
|
-
abi: UNISWAP_QUOTER_V2_ABI,
|
|
1484
|
-
functionName: "quoteExactInput",
|
|
1485
|
-
args: [params.path, params.amountIn]
|
|
1486
|
-
});
|
|
1487
|
-
const { data } = await client.call({
|
|
1488
|
-
to: UNISWAP().QUOTER_V2,
|
|
1489
|
-
data: calldata
|
|
1490
|
-
});
|
|
1491
|
-
if (!data) {
|
|
1492
|
-
throw new Error("Quoter returned no data \u2014 pool may not exist for this path");
|
|
1493
|
-
}
|
|
1494
|
-
const [amountOut, , , gasEstimate] = decodeFunctionResult({
|
|
1495
|
-
abi: UNISWAP_QUOTER_V2_ABI,
|
|
1496
|
-
functionName: "quoteExactInput",
|
|
1497
|
-
data
|
|
1498
|
-
});
|
|
1499
|
-
return { amountOut, sqrtPriceX96After: 0n, gasEstimate };
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
1330
|
// src/strategies/allowance-disburse.ts
|
|
1503
|
-
import { encodeFunctionData as
|
|
1504
|
-
var ERC20_ABI2 = [
|
|
1505
|
-
{
|
|
1506
|
-
name: "approve",
|
|
1507
|
-
type: "function",
|
|
1508
|
-
inputs: [
|
|
1509
|
-
{ name: "spender", type: "address" },
|
|
1510
|
-
{ name: "amount", type: "uint256" }
|
|
1511
|
-
],
|
|
1512
|
-
outputs: [{ name: "", type: "bool" }]
|
|
1513
|
-
},
|
|
1514
|
-
{
|
|
1515
|
-
name: "transfer",
|
|
1516
|
-
type: "function",
|
|
1517
|
-
inputs: [
|
|
1518
|
-
{ name: "to", type: "address" },
|
|
1519
|
-
{ name: "amount", type: "uint256" }
|
|
1520
|
-
],
|
|
1521
|
-
outputs: [{ name: "", type: "bool" }]
|
|
1522
|
-
}
|
|
1523
|
-
];
|
|
1524
|
-
var SWAP_ROUTER_EXACT_INPUT_SINGLE_ABI = [
|
|
1525
|
-
{
|
|
1526
|
-
name: "exactInputSingle",
|
|
1527
|
-
type: "function",
|
|
1528
|
-
inputs: [
|
|
1529
|
-
{
|
|
1530
|
-
name: "params",
|
|
1531
|
-
type: "tuple",
|
|
1532
|
-
components: [
|
|
1533
|
-
{ name: "tokenIn", type: "address" },
|
|
1534
|
-
{ name: "tokenOut", type: "address" },
|
|
1535
|
-
{ name: "fee", type: "uint24" },
|
|
1536
|
-
{ name: "recipient", type: "address" },
|
|
1537
|
-
{ name: "amountIn", type: "uint256" },
|
|
1538
|
-
{ name: "amountOutMinimum", type: "uint256" },
|
|
1539
|
-
{ name: "sqrtPriceLimitX96", type: "uint160" }
|
|
1540
|
-
]
|
|
1541
|
-
}
|
|
1542
|
-
],
|
|
1543
|
-
outputs: [{ name: "amountOut", type: "uint256" }]
|
|
1544
|
-
}
|
|
1545
|
-
];
|
|
1546
|
-
var SWAP_ROUTER_EXACT_INPUT_ABI = [
|
|
1547
|
-
{
|
|
1548
|
-
name: "exactInput",
|
|
1549
|
-
type: "function",
|
|
1550
|
-
inputs: [
|
|
1551
|
-
{
|
|
1552
|
-
name: "params",
|
|
1553
|
-
type: "tuple",
|
|
1554
|
-
components: [
|
|
1555
|
-
{ name: "path", type: "bytes" },
|
|
1556
|
-
{ name: "recipient", type: "address" },
|
|
1557
|
-
{ name: "amountIn", type: "uint256" },
|
|
1558
|
-
{ name: "amountOutMinimum", type: "uint256" }
|
|
1559
|
-
]
|
|
1560
|
-
}
|
|
1561
|
-
],
|
|
1562
|
-
outputs: [{ name: "amountOut", type: "uint256" }]
|
|
1563
|
-
}
|
|
1564
|
-
];
|
|
1331
|
+
import { encodeFunctionData as encodeFunctionData5, parseUnits as parseUnits3 } from "viem";
|
|
1565
1332
|
function buildDisburseBatch(config, vaultAddress, agents, assetAddress, assetDecimals, minUsdc, swapPath) {
|
|
1566
1333
|
const assetAmount = parseUnits3(config.amount, assetDecimals);
|
|
1567
1334
|
const isUsdc = assetAddress.toLowerCase() === TOKENS().USDC.toLowerCase();
|
|
@@ -1570,8 +1337,8 @@ function buildDisburseBatch(config, vaultAddress, agents, assetAddress, assetDec
|
|
|
1570
1337
|
if (!isUsdc) {
|
|
1571
1338
|
calls.push({
|
|
1572
1339
|
target: assetAddress,
|
|
1573
|
-
data:
|
|
1574
|
-
abi:
|
|
1340
|
+
data: encodeFunctionData5({
|
|
1341
|
+
abi: ERC20_ABI,
|
|
1575
1342
|
functionName: "approve",
|
|
1576
1343
|
args: [UNISWAP().SWAP_ROUTER, assetAmount]
|
|
1577
1344
|
}),
|
|
@@ -1580,7 +1347,7 @@ function buildDisburseBatch(config, vaultAddress, agents, assetAddress, assetDec
|
|
|
1580
1347
|
if (isWeth) {
|
|
1581
1348
|
calls.push({
|
|
1582
1349
|
target: UNISWAP().SWAP_ROUTER,
|
|
1583
|
-
data:
|
|
1350
|
+
data: encodeFunctionData5({
|
|
1584
1351
|
abi: SWAP_ROUTER_EXACT_INPUT_SINGLE_ABI,
|
|
1585
1352
|
functionName: "exactInputSingle",
|
|
1586
1353
|
args: [
|
|
@@ -1600,8 +1367,8 @@ function buildDisburseBatch(config, vaultAddress, agents, assetAddress, assetDec
|
|
|
1600
1367
|
} else {
|
|
1601
1368
|
calls.push({
|
|
1602
1369
|
target: UNISWAP().SWAP_ROUTER,
|
|
1603
|
-
data:
|
|
1604
|
-
abi:
|
|
1370
|
+
data: encodeFunctionData5({
|
|
1371
|
+
abi: SWAP_ROUTER_ABI,
|
|
1605
1372
|
functionName: "exactInput",
|
|
1606
1373
|
args: [
|
|
1607
1374
|
{
|
|
@@ -1620,8 +1387,8 @@ function buildDisburseBatch(config, vaultAddress, agents, assetAddress, assetDec
|
|
|
1620
1387
|
for (const agent of agents) {
|
|
1621
1388
|
calls.push({
|
|
1622
1389
|
target: TOKENS().USDC,
|
|
1623
|
-
data:
|
|
1624
|
-
abi:
|
|
1390
|
+
data: encodeFunctionData5({
|
|
1391
|
+
abi: ERC20_ABI,
|
|
1625
1392
|
functionName: "transfer",
|
|
1626
1393
|
args: [agent, perAgent]
|
|
1627
1394
|
}),
|
|
@@ -2516,7 +2283,7 @@ try {
|
|
|
2516
2283
|
var require2 = createRequire(import.meta.url);
|
|
2517
2284
|
var { version: CLI_VERSION } = require2("../package.json");
|
|
2518
2285
|
async function loadXmtp() {
|
|
2519
|
-
return import("./xmtp-
|
|
2286
|
+
return import("./xmtp-7DF7UG66.js");
|
|
2520
2287
|
}
|
|
2521
2288
|
async function loadCron() {
|
|
2522
2289
|
return import("./cron-SKYKVZ6K.js");
|
|
@@ -3248,7 +3015,7 @@ vaultCmd.command("balance").description("Show LP share balance and asset value")
|
|
|
3248
3015
|
var strategy = program.command("strategy").description("Strategy templates \u2014 list, clone, propose");
|
|
3249
3016
|
registerStrategyTemplateCommands(strategy);
|
|
3250
3017
|
program.command("providers").description("List available DeFi providers").action(async () => {
|
|
3251
|
-
const { MessariProvider, NansenProvider } = await import("./research-
|
|
3018
|
+
const { MessariProvider, NansenProvider } = await import("./research-DZINC4N4.js");
|
|
3252
3019
|
const providers = [new MoonwellProvider(), new UniswapProvider(), new MessariProvider(), new NansenProvider()];
|
|
3253
3020
|
for (const p of providers) {
|
|
3254
3021
|
const info = p.info();
|
|
@@ -3259,7 +3026,7 @@ ${info.name} (${info.type})`);
|
|
|
3259
3026
|
}
|
|
3260
3027
|
});
|
|
3261
3028
|
try {
|
|
3262
|
-
const { registerChatCommands } = await import("./chat-
|
|
3029
|
+
const { registerChatCommands } = await import("./chat-WKOSUZXO.js");
|
|
3263
3030
|
registerChatCommands(program);
|
|
3264
3031
|
} catch {
|
|
3265
3032
|
program.command("chat <name> [action] [actionArgs...]").description("Syndicate chat (XMTP) \u2014 requires @xmtp/cli").action(() => {
|
|
@@ -3269,17 +3036,19 @@ try {
|
|
|
3269
3036
|
process.exit(1);
|
|
3270
3037
|
});
|
|
3271
3038
|
}
|
|
3272
|
-
var { registerSessionCommands } = await import("./session-
|
|
3039
|
+
var { registerSessionCommands } = await import("./session-Q2WRYXYF.js");
|
|
3273
3040
|
registerSessionCommands(program);
|
|
3274
3041
|
registerVeniceCommands(program);
|
|
3275
3042
|
registerAllowanceCommands(program);
|
|
3276
3043
|
registerIdentityCommands(program);
|
|
3277
3044
|
registerProposalCommands(program);
|
|
3278
3045
|
registerGovernorCommands(program);
|
|
3279
|
-
var { registerResearchCommands } = await import("./research-
|
|
3046
|
+
var { registerResearchCommands } = await import("./research-47YMVW3N.js");
|
|
3280
3047
|
registerResearchCommands(program);
|
|
3048
|
+
var { registerTradeCommands } = await import("./trade-D6VT5MLQ.js");
|
|
3049
|
+
registerTradeCommands(program);
|
|
3281
3050
|
var configCmd = program.command("config");
|
|
3282
|
-
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.)").action((opts) => {
|
|
3051
|
+
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").action((opts) => {
|
|
3283
3052
|
let saved = false;
|
|
3284
3053
|
if (opts.privateKey) {
|
|
3285
3054
|
setPrivateKey(opts.privateKey);
|
|
@@ -3308,8 +3077,18 @@ configCmd.command("set").description("Save settings to ~/.sherwood/config.json (
|
|
|
3308
3077
|
console.log(chalk7.dim(` Notify to: ${opts.notifyTo}`));
|
|
3309
3078
|
saved = true;
|
|
3310
3079
|
}
|
|
3080
|
+
if (opts.uniswapApiKey) {
|
|
3081
|
+
setUniswapApiKey(opts.uniswapApiKey);
|
|
3082
|
+
console.log(chalk7.green("Uniswap API key saved to ~/.sherwood/config.json"));
|
|
3083
|
+
saved = true;
|
|
3084
|
+
}
|
|
3085
|
+
if (opts.veniceApiKey) {
|
|
3086
|
+
setVeniceApiKey(opts.veniceApiKey);
|
|
3087
|
+
console.log(chalk7.green("Venice API key saved to ~/.sherwood/config.json"));
|
|
3088
|
+
saved = true;
|
|
3089
|
+
}
|
|
3311
3090
|
if (!saved) {
|
|
3312
|
-
console.log(chalk7.red("Provide at least one of: --private-key, --vault, --rpc, --notify-to"));
|
|
3091
|
+
console.log(chalk7.red("Provide at least one of: --private-key, --vault, --rpc, --notify-to, --uniswap-api-key, --venice-api-key"));
|
|
3313
3092
|
process.exit(1);
|
|
3314
3093
|
}
|
|
3315
3094
|
});
|
|
@@ -3327,6 +3106,8 @@ configCmd.command("show").description("Display current config for the active net
|
|
|
3327
3106
|
console.log(` Wallet: ${config.privateKey ? chalk7.green("configured") : chalk7.dim("not set")}`);
|
|
3328
3107
|
console.log(` Agent ID: ${config.agentId ?? chalk7.dim("not set")}`);
|
|
3329
3108
|
console.log(` Vault: ${contracts.vault ?? chalk7.dim("not set")}`);
|
|
3109
|
+
console.log(` Uniswap: ${getUniswapApiKey() ? chalk7.green("API key configured") : chalk7.dim("not set")}`);
|
|
3110
|
+
console.log(` Venice: ${getVeniceApiKey() ? chalk7.green("API key configured") : chalk7.dim("not set")}`);
|
|
3330
3111
|
console.log();
|
|
3331
3112
|
console.log(chalk7.dim(" Config file: ~/.sherwood/config.json"));
|
|
3332
3113
|
console.log();
|