@sm-lab/recipes 0.2.0 → 0.3.0

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/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { a as deposit, d as addKeys, g as connect, i as getPubkey, n as topUpActiveKeys, r as getKeyBalance, t as increaseAllocatedBalance, v as resolveGate } from "./topup-B2NzJV7_.mjs";
3
- import { C as snapshot, E as operatorInfo, S as revert, a as setGateAddrs, b as proposeManager, c as cancelPenalty, d as settlePenalty, f as slash, h as unvet, i as submitRewards, l as compensatePenalty, m as exit, o as addBond, p as withdraw, r as makeRewards, s as createBondDebt, t as clActivate, u as reportPenalty, v as confirmManager, w as warpBy, x as proposeReward, y as confirmReward } from "./cl-activate-CPqr6v_D.mjs";
2
+ import { E as resolveGate, a as getGateTree, c as getPubkey, d as operatorsCount, f as deposit, i as getCurveInfo, l as keyBalances, n as topUpActiveKeys, o as getKeyBalance, r as bondInfo, s as getLastOperator, t as increaseAllocatedBalance, u as operatorKeys, w as connect, y as addKeys } from "./topup-CuqmB14u.mjs";
3
+ import { A as snapshot, D as proposeReward, E as proposeManager, M as warpBy, O as setTargetLimit, P as operatorInfo, T as confirmReward, _ as slash, b as removeKey, c as setGateAddrs, d as cancelPenalty, f as compensatePenalty, g as reportBalance, h as activateKeys, i as clActivate, j as topUpAccount, k as revert, l as addBond, m as settlePenalty, n as pause, o as makeRewards, p as reportPenalty, r as resume, s as submitRewards, t as exitRequest, u as createBondDebt, v as withdraw, w as confirmManager, x as unvet, y as exit } from "./exit-request-c0CS5wKu.mjs";
4
4
  import { createCuratedOperator, createOperatorGroup, resetOperatorGroup, seedCm, setBondCurveWeight } from "./cm.mjs";
5
5
  import { formatEther, isAddress, isHex, parseEther } from "viem";
6
6
  import "dotenv/config";
@@ -866,6 +866,26 @@ const sharedCommands = [
866
866
  run: (ctx, o) => exit(ctx, o),
867
867
  report: (_r, o) => [`operator ${o.noId}: exited=${o.exitedKeys}`]
868
868
  },
869
+ {
870
+ name: "exit-request",
871
+ summary: "request a validator exit via VEBO (impersonates the consensus contract + a submitter)",
872
+ options: [
873
+ operatorId$1,
874
+ keyIndex,
875
+ {
876
+ flag: "--validator-index <n>",
877
+ key: "validatorIndex",
878
+ coerce: toBigInt,
879
+ description: "CL validator index to pack into the report (default 900000)"
880
+ }
881
+ ],
882
+ run: (ctx, o) => exitRequest(ctx, o),
883
+ report: (r, o) => [
884
+ `operator ${o.noId} key ${o.keyIndex}: exit requested (module ${r.moduleId}, refSlot ${r.refSlot})`,
885
+ `reportHash ${r.reportHash}`,
886
+ ...r.clStatus ? [`cl-mock: validator marked ${r.clStatus}`] : []
887
+ ]
888
+ },
869
889
  {
870
890
  name: "increase-allocated-balance",
871
891
  summary: "top up one deposited key's allocated balance (ETH)",
@@ -1129,6 +1149,184 @@ const sharedCommands = [
1129
1149
  }],
1130
1150
  run: (ctx, o) => revert(ctx, o.id),
1131
1151
  report: (_r, o) => [`reverted to ${o.id}`]
1152
+ },
1153
+ {
1154
+ name: "set-target-limit",
1155
+ summary: "set an operator's target validator limit (as the StakingRouter); mode 0=off, 1=soft, 2=forced",
1156
+ options: [
1157
+ operatorId$1,
1158
+ {
1159
+ flag: "--mode <0|1|2>",
1160
+ key: "mode",
1161
+ coerce: toNumber,
1162
+ required: true,
1163
+ description: "0=off, 1=soft, 2=forced"
1164
+ },
1165
+ {
1166
+ flag: "--limit <n>",
1167
+ key: "limit",
1168
+ coerce: toBigInt,
1169
+ description: "target limit (ignored for mode 0; default 0)"
1170
+ }
1171
+ ],
1172
+ run: (ctx, o) => setTargetLimit(ctx, o),
1173
+ report: (r) => [`operator ${r.noId}: targetLimitMode=${r.mode}, limit=${r.limit}`]
1174
+ },
1175
+ {
1176
+ name: "remove-key",
1177
+ summary: "remove key(s) from an operator starting at an index (as manager)",
1178
+ options: [
1179
+ operatorId$1,
1180
+ keyIndex,
1181
+ {
1182
+ flag: "--count <n>",
1183
+ key: "count",
1184
+ coerce: toBigInt,
1185
+ description: "number of keys to remove (default 1)"
1186
+ }
1187
+ ],
1188
+ run: (ctx, o) => removeKey(ctx, o),
1189
+ report: (_r, o) => [`operator ${o.noId}: removed ${o.count ?? 1n} key(s) from index ${o.keyIndex}`]
1190
+ },
1191
+ {
1192
+ name: "get-curve-info",
1193
+ summary: "read a bond curve by id (read-only)",
1194
+ options: [{
1195
+ flag: "--curve-id <n>",
1196
+ key: "curveId",
1197
+ coerce: toBigInt,
1198
+ required: true,
1199
+ description: "bond curve id (uint)"
1200
+ }],
1201
+ run: (ctx, o) => getCurveInfo(ctx, o),
1202
+ report: (r) => [JSON.stringify(r, bigintReplacer, 2)]
1203
+ },
1204
+ {
1205
+ name: "pause",
1206
+ summary: "pause a target: module | accounting | gate selector (grants PAUSE_ROLE + pauseFor max; idempotent)",
1207
+ options: [{
1208
+ flag: "--target <name>",
1209
+ key: "target",
1210
+ coerce: identity,
1211
+ required: true,
1212
+ positional: true,
1213
+ description: "module | accounting | gate selector (ics/idvtc/po…iodcp/index/0x…)"
1214
+ }],
1215
+ run: (ctx, o) => pause(ctx, o),
1216
+ report: (r) => [`${r.target} (${r.address}): paused=${r.paused}`]
1217
+ },
1218
+ {
1219
+ name: "resume",
1220
+ summary: "resume a target: module | accounting | gate selector (grants RESUME_ROLE + resume; idempotent)",
1221
+ options: [{
1222
+ flag: "--target <name>",
1223
+ key: "target",
1224
+ coerce: identity,
1225
+ required: true,
1226
+ positional: true,
1227
+ description: "module | accounting | gate selector (ics/idvtc/po…iodcp/index/0x…)"
1228
+ }],
1229
+ run: (ctx, o) => resume(ctx, o),
1230
+ report: (r) => [`${r.target} (${r.address}): paused=${r.paused}`]
1231
+ },
1232
+ {
1233
+ name: "activate-keys",
1234
+ summary: "activate N deposited keys on-chain (report 32 ETH + 1 gwei each, Verifier-gated)",
1235
+ options: [operatorId$1, {
1236
+ flag: "--count <n>",
1237
+ key: "count",
1238
+ coerce: toNumber,
1239
+ required: true
1240
+ }],
1241
+ run: (ctx, o) => activateKeys(ctx, o),
1242
+ report: (r) => [`activated ${r.activated} key(s)`]
1243
+ },
1244
+ {
1245
+ name: "report-balance",
1246
+ summary: "report a key's CL balance on-chain (ETH, Verifier-gated)",
1247
+ options: [
1248
+ operatorId$1,
1249
+ keyIndex,
1250
+ {
1251
+ flag: "--balance <eth>",
1252
+ key: "balanceWei",
1253
+ coerce: toEth,
1254
+ required: true
1255
+ }
1256
+ ],
1257
+ run: (ctx, o) => reportBalance(ctx, o),
1258
+ report: (r) => [`operator ${r.noId} key ${r.keyIndex}: reported ${formatEther(r.balanceWei)} ETH`]
1259
+ },
1260
+ {
1261
+ name: "topup",
1262
+ summary: "fund an account by setting its balance (anvil_setBalance; default 100 ETH)",
1263
+ options: [{
1264
+ flag: "--address <addr>",
1265
+ key: "address",
1266
+ coerce: toAddressValue,
1267
+ required: true,
1268
+ positional: true
1269
+ }, {
1270
+ flag: "--amount <eth>",
1271
+ key: "amountWei",
1272
+ coerce: toEth,
1273
+ description: "ETH to set (default 100)"
1274
+ }],
1275
+ run: (ctx, o) => topUpAccount(ctx, o),
1276
+ report: (r) => [`${r.address}: balance set to ${formatEther(r.amountWei)} ETH`]
1277
+ },
1278
+ {
1279
+ name: "bond-info",
1280
+ summary: "read an operator's bond summary (read-only); one field per line, --json for the object",
1281
+ options: [operatorId$1],
1282
+ run: (ctx, o) => bondInfo(ctx, o),
1283
+ report: (r, o) => [`operator ${o.noId}:`, ...Object.entries(r).map(([k, v]) => ` ${k}: ${v}`)]
1284
+ },
1285
+ {
1286
+ name: "operator-keys",
1287
+ summary: "read all of an operator's pubkeys (read-only)",
1288
+ options: [operatorId$1],
1289
+ run: (ctx, o) => operatorKeys(ctx, o),
1290
+ report: (r) => r.length ? r : ["(no keys)"]
1291
+ },
1292
+ {
1293
+ name: "key-balances",
1294
+ summary: "read all of an operator's deposited-key allocated balances (read-only)",
1295
+ options: [operatorId$1],
1296
+ run: (ctx, o) => keyBalances(ctx, o),
1297
+ report: (r) => r.length ? r.map((b, i) => ` key ${i}: ${formatEther(b)} ETH`) : ["(no deposited keys)"]
1298
+ },
1299
+ {
1300
+ name: "operators-count",
1301
+ summary: "read the module operator count (read-only)",
1302
+ options: [],
1303
+ run: (ctx) => operatorsCount(ctx),
1304
+ report: (r) => [`${r}`]
1305
+ },
1306
+ {
1307
+ name: "get-last-operator",
1308
+ summary: "read the highest operator id, count - 1 (read-only)",
1309
+ options: [],
1310
+ run: (ctx) => getLastOperator(ctx),
1311
+ report: (r) => [`${r}`]
1312
+ },
1313
+ {
1314
+ name: "get-gate-tree",
1315
+ summary: "read a gate's current merkle tree root + cid by selector (read-only)",
1316
+ options: [{
1317
+ flag: "--selector <name>",
1318
+ key: "selector",
1319
+ coerce: identity,
1320
+ required: true,
1321
+ positional: true,
1322
+ description: "gate selector (ics/idvtc for csm; po…iodcp for cm; 0x…)"
1323
+ }],
1324
+ run: (ctx, o) => getGateTree(ctx, o),
1325
+ report: (r) => [
1326
+ `${r.selector} → ${r.address}`,
1327
+ `root: ${r.treeRoot}`,
1328
+ `cid: ${r.treeCid}`
1329
+ ]
1132
1330
  }
1133
1331
  ];
1134
1332
  //#endregion
@@ -1270,7 +1468,7 @@ const cmCommands = [
1270
1468
  ];
1271
1469
  //#endregion
1272
1470
  //#region src/cli/commands/csm.ts
1273
- const csmSelectorHelp = "gate selector: ics (VettedGate) | idvtc (v3-only) | 0x… gate address";
1471
+ const csmSelectorHelp = "gate selector: ics (IcsGate) | idvtc (v3-only) | 0x… gate address";
1274
1472
  const csmCommands = [{
1275
1473
  name: "set-gate",
1276
1474
  summary: "build + install a gate address tree (pins to IPFS unless --cid)",