@spectratools/assembly-cli 0.11.6 → 0.12.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.js +406 -393
- package/dist/index.js +406 -393
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
shutdownTelemetry,
|
|
10
10
|
withCommandSpan
|
|
11
11
|
} from "@spectratools/cli-shared/telemetry";
|
|
12
|
-
import { Cli as Cli6, z as
|
|
12
|
+
import { Cli as Cli6, z as z8 } from "incur";
|
|
13
13
|
|
|
14
14
|
// src/commands/_common.ts
|
|
15
15
|
import { checksumAddress, weiToEth } from "@spectratools/cli-shared";
|
|
@@ -5249,38 +5249,8 @@ council.command("withdraw-refund", {
|
|
|
5249
5249
|
// src/commands/forum.ts
|
|
5250
5250
|
import { TxError } from "@spectratools/tx-shared";
|
|
5251
5251
|
import { Cli as Cli2, z as z3 } from "incur";
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
});
|
|
5255
|
-
var commentEnv = env2.extend({
|
|
5256
|
-
PRIVATE_KEY: z3.string().optional().describe("Private key (required only when posting a comment via --body)")
|
|
5257
|
-
});
|
|
5258
|
-
var timestampOutput2 = z3.union([z3.number(), z3.string()]);
|
|
5259
|
-
var txResultOutput2 = z3.union([
|
|
5260
|
-
z3.object({
|
|
5261
|
-
status: z3.literal("success"),
|
|
5262
|
-
hash: z3.string(),
|
|
5263
|
-
blockNumber: z3.number(),
|
|
5264
|
-
gasUsed: z3.string(),
|
|
5265
|
-
from: z3.string(),
|
|
5266
|
-
to: z3.string().nullable(),
|
|
5267
|
-
effectiveGasPrice: z3.string().optional()
|
|
5268
|
-
}),
|
|
5269
|
-
z3.object({
|
|
5270
|
-
status: z3.literal("reverted"),
|
|
5271
|
-
hash: z3.string(),
|
|
5272
|
-
blockNumber: z3.number(),
|
|
5273
|
-
gasUsed: z3.string(),
|
|
5274
|
-
from: z3.string(),
|
|
5275
|
-
to: z3.string().nullable(),
|
|
5276
|
-
effectiveGasPrice: z3.string().optional()
|
|
5277
|
-
}),
|
|
5278
|
-
z3.object({
|
|
5279
|
-
status: z3.literal("dry-run"),
|
|
5280
|
-
estimatedGas: z3.string(),
|
|
5281
|
-
simulationResult: z3.unknown()
|
|
5282
|
-
})
|
|
5283
|
-
]);
|
|
5252
|
+
|
|
5253
|
+
// src/services/forum.ts
|
|
5284
5254
|
function decodeThread(value) {
|
|
5285
5255
|
const [id, kind, author, createdAt, category, title, body, proposalId, petitionId] = value;
|
|
5286
5256
|
return {
|
|
@@ -5332,6 +5302,127 @@ function decodePetition(value) {
|
|
|
5332
5302
|
proposalInput: jsonSafe(proposalInput)
|
|
5333
5303
|
};
|
|
5334
5304
|
}
|
|
5305
|
+
async function fetchAllThreads(client) {
|
|
5306
|
+
const count = await client.readContract({
|
|
5307
|
+
abi: forumAbi,
|
|
5308
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5309
|
+
functionName: "threadCount"
|
|
5310
|
+
});
|
|
5311
|
+
const ids = Array.from({ length: Number(count) }, (_, i) => BigInt(i + 1));
|
|
5312
|
+
if (ids.length === 0) return [];
|
|
5313
|
+
const threadTuples = await client.multicall({
|
|
5314
|
+
allowFailure: false,
|
|
5315
|
+
contracts: ids.map((id) => ({
|
|
5316
|
+
abi: forumAbi,
|
|
5317
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5318
|
+
functionName: "threads",
|
|
5319
|
+
args: [id]
|
|
5320
|
+
}))
|
|
5321
|
+
});
|
|
5322
|
+
return threadTuples.map(decodeThread);
|
|
5323
|
+
}
|
|
5324
|
+
async function fetchAllComments(client) {
|
|
5325
|
+
const count = await client.readContract({
|
|
5326
|
+
abi: forumAbi,
|
|
5327
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5328
|
+
functionName: "commentCount"
|
|
5329
|
+
});
|
|
5330
|
+
const ids = Array.from({ length: Number(count) }, (_, i) => BigInt(i + 1));
|
|
5331
|
+
if (ids.length === 0) return [];
|
|
5332
|
+
const commentTuples = await client.multicall({
|
|
5333
|
+
allowFailure: false,
|
|
5334
|
+
contracts: ids.map((id) => ({
|
|
5335
|
+
abi: forumAbi,
|
|
5336
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5337
|
+
functionName: "comments",
|
|
5338
|
+
args: [id]
|
|
5339
|
+
}))
|
|
5340
|
+
});
|
|
5341
|
+
return commentTuples.map(decodeComment);
|
|
5342
|
+
}
|
|
5343
|
+
async function fetchAllPetitions(client) {
|
|
5344
|
+
const count = await client.readContract({
|
|
5345
|
+
abi: forumAbi,
|
|
5346
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5347
|
+
functionName: "petitionCount"
|
|
5348
|
+
});
|
|
5349
|
+
const ids = Array.from({ length: Number(count) }, (_, i) => BigInt(i + 1));
|
|
5350
|
+
if (ids.length === 0) return [];
|
|
5351
|
+
const petitionTuples = await client.multicall({
|
|
5352
|
+
allowFailure: false,
|
|
5353
|
+
contracts: ids.map((id) => ({
|
|
5354
|
+
abi: forumAbi,
|
|
5355
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5356
|
+
functionName: "petitions",
|
|
5357
|
+
args: [id]
|
|
5358
|
+
}))
|
|
5359
|
+
});
|
|
5360
|
+
return petitionTuples.map(decodePetition);
|
|
5361
|
+
}
|
|
5362
|
+
async function fetchForumStats(client) {
|
|
5363
|
+
const [threadCount, commentCount, petitionCount, petitionThresholdBps] = await Promise.all([
|
|
5364
|
+
client.readContract({
|
|
5365
|
+
abi: forumAbi,
|
|
5366
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5367
|
+
functionName: "threadCount"
|
|
5368
|
+
}),
|
|
5369
|
+
client.readContract({
|
|
5370
|
+
abi: forumAbi,
|
|
5371
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5372
|
+
functionName: "commentCount"
|
|
5373
|
+
}),
|
|
5374
|
+
client.readContract({
|
|
5375
|
+
abi: forumAbi,
|
|
5376
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5377
|
+
functionName: "petitionCount"
|
|
5378
|
+
}),
|
|
5379
|
+
client.readContract({
|
|
5380
|
+
abi: forumAbi,
|
|
5381
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5382
|
+
functionName: "petitionThresholdBps"
|
|
5383
|
+
})
|
|
5384
|
+
]);
|
|
5385
|
+
return {
|
|
5386
|
+
threadCount: asNum(threadCount),
|
|
5387
|
+
commentCount: asNum(commentCount),
|
|
5388
|
+
petitionCount: asNum(petitionCount),
|
|
5389
|
+
petitionThresholdBps: asNum(petitionThresholdBps)
|
|
5390
|
+
};
|
|
5391
|
+
}
|
|
5392
|
+
|
|
5393
|
+
// src/commands/forum.ts
|
|
5394
|
+
var env2 = z3.object({
|
|
5395
|
+
ABSTRACT_RPC_URL: z3.string().optional().describe("Abstract RPC URL override")
|
|
5396
|
+
});
|
|
5397
|
+
var commentEnv = env2.extend({
|
|
5398
|
+
PRIVATE_KEY: z3.string().optional().describe("Private key (required only when posting a comment via --body)")
|
|
5399
|
+
});
|
|
5400
|
+
var timestampOutput2 = z3.union([z3.number(), z3.string()]);
|
|
5401
|
+
var txResultOutput2 = z3.union([
|
|
5402
|
+
z3.object({
|
|
5403
|
+
status: z3.literal("success"),
|
|
5404
|
+
hash: z3.string(),
|
|
5405
|
+
blockNumber: z3.number(),
|
|
5406
|
+
gasUsed: z3.string(),
|
|
5407
|
+
from: z3.string(),
|
|
5408
|
+
to: z3.string().nullable(),
|
|
5409
|
+
effectiveGasPrice: z3.string().optional()
|
|
5410
|
+
}),
|
|
5411
|
+
z3.object({
|
|
5412
|
+
status: z3.literal("reverted"),
|
|
5413
|
+
hash: z3.string(),
|
|
5414
|
+
blockNumber: z3.number(),
|
|
5415
|
+
gasUsed: z3.string(),
|
|
5416
|
+
from: z3.string(),
|
|
5417
|
+
to: z3.string().nullable(),
|
|
5418
|
+
effectiveGasPrice: z3.string().optional()
|
|
5419
|
+
}),
|
|
5420
|
+
z3.object({
|
|
5421
|
+
status: z3.literal("dry-run"),
|
|
5422
|
+
estimatedGas: z3.string(),
|
|
5423
|
+
simulationResult: z3.unknown()
|
|
5424
|
+
})
|
|
5425
|
+
]);
|
|
5335
5426
|
var forum = Cli2.create("forum", {
|
|
5336
5427
|
description: "Browse Assembly forum threads, comments, and petitions."
|
|
5337
5428
|
});
|
|
@@ -5355,22 +5446,7 @@ forum.command("threads", {
|
|
|
5355
5446
|
examples: [{ description: "List all forum threads" }],
|
|
5356
5447
|
async run(c) {
|
|
5357
5448
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
5358
|
-
const
|
|
5359
|
-
abi: forumAbi,
|
|
5360
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5361
|
-
functionName: "threadCount"
|
|
5362
|
-
});
|
|
5363
|
-
const ids = Array.from({ length: Number(count) }, (_, i) => BigInt(i + 1));
|
|
5364
|
-
const threadTuples = ids.length ? await client.multicall({
|
|
5365
|
-
allowFailure: false,
|
|
5366
|
-
contracts: ids.map((id) => ({
|
|
5367
|
-
abi: forumAbi,
|
|
5368
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5369
|
-
functionName: "threads",
|
|
5370
|
-
args: [id]
|
|
5371
|
-
}))
|
|
5372
|
-
}) : [];
|
|
5373
|
-
const items = threadTuples.map(decodeThread);
|
|
5449
|
+
const items = await fetchAllThreads(client);
|
|
5374
5450
|
const threads = items.map((x) => ({
|
|
5375
5451
|
id: x.id,
|
|
5376
5452
|
kind: x.kind,
|
|
@@ -5422,31 +5498,14 @@ forum.command("thread", {
|
|
|
5422
5498
|
retryable: false
|
|
5423
5499
|
});
|
|
5424
5500
|
}
|
|
5425
|
-
const
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
}),
|
|
5432
|
-
client.readContract({
|
|
5433
|
-
abi: forumAbi,
|
|
5434
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5435
|
-
functionName: "commentCount"
|
|
5436
|
-
})
|
|
5437
|
-
]);
|
|
5501
|
+
const threadTuple = await client.readContract({
|
|
5502
|
+
abi: forumAbi,
|
|
5503
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5504
|
+
functionName: "threads",
|
|
5505
|
+
args: [BigInt(c.args.id)]
|
|
5506
|
+
});
|
|
5438
5507
|
const thread = decodeThread(threadTuple);
|
|
5439
|
-
const
|
|
5440
|
-
const commentTuples = ids.length ? await client.multicall({
|
|
5441
|
-
allowFailure: false,
|
|
5442
|
-
contracts: ids.map((id) => ({
|
|
5443
|
-
abi: forumAbi,
|
|
5444
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5445
|
-
functionName: "comments",
|
|
5446
|
-
args: [id]
|
|
5447
|
-
}))
|
|
5448
|
-
}) : [];
|
|
5449
|
-
const comments = commentTuples.map(decodeComment);
|
|
5508
|
+
const comments = await fetchAllComments(client);
|
|
5450
5509
|
return c.ok({
|
|
5451
5510
|
thread: jsonSafe(thread),
|
|
5452
5511
|
comments: comments.filter((x) => x.threadId === c.args.id).map((comment) => jsonSafe(comment))
|
|
@@ -5463,22 +5522,7 @@ forum.command("comments", {
|
|
|
5463
5522
|
examples: [{ args: { threadId: 1 }, description: "List comments for thread #1" }],
|
|
5464
5523
|
async run(c) {
|
|
5465
5524
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
5466
|
-
const
|
|
5467
|
-
abi: forumAbi,
|
|
5468
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5469
|
-
functionName: "commentCount"
|
|
5470
|
-
});
|
|
5471
|
-
const ids = Array.from({ length: Number(count) }, (_, i) => BigInt(i + 1));
|
|
5472
|
-
const commentTuples = ids.length ? await client.multicall({
|
|
5473
|
-
allowFailure: false,
|
|
5474
|
-
contracts: ids.map((id) => ({
|
|
5475
|
-
abi: forumAbi,
|
|
5476
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5477
|
-
functionName: "comments",
|
|
5478
|
-
args: [id]
|
|
5479
|
-
}))
|
|
5480
|
-
}) : [];
|
|
5481
|
-
const comments = commentTuples.map(decodeComment);
|
|
5525
|
+
const comments = await fetchAllComments(client);
|
|
5482
5526
|
return c.ok(
|
|
5483
5527
|
comments.filter((x) => x.threadId === c.args.threadId).map((comment) => jsonSafe(comment))
|
|
5484
5528
|
);
|
|
@@ -6000,22 +6044,7 @@ forum.command("petitions", {
|
|
|
6000
6044
|
examples: [{ description: "List all petitions" }],
|
|
6001
6045
|
async run(c) {
|
|
6002
6046
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
6003
|
-
const
|
|
6004
|
-
abi: forumAbi,
|
|
6005
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
6006
|
-
functionName: "petitionCount"
|
|
6007
|
-
});
|
|
6008
|
-
const ids = Array.from({ length: Number(count) }, (_, i) => BigInt(i + 1));
|
|
6009
|
-
const petitionTuples = ids.length ? await client.multicall({
|
|
6010
|
-
allowFailure: false,
|
|
6011
|
-
contracts: ids.map((id) => ({
|
|
6012
|
-
abi: forumAbi,
|
|
6013
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
6014
|
-
functionName: "petitions",
|
|
6015
|
-
args: [id]
|
|
6016
|
-
}))
|
|
6017
|
-
}) : [];
|
|
6018
|
-
const petitions = petitionTuples.map(decodePetition);
|
|
6047
|
+
const petitions = await fetchAllPetitions(client);
|
|
6019
6048
|
return c.ok(petitions.map((petition) => jsonSafe(petition)));
|
|
6020
6049
|
}
|
|
6021
6050
|
});
|
|
@@ -6102,44 +6131,15 @@ forum.command("stats", {
|
|
|
6102
6131
|
examples: [{ description: "Get forum counts and petition threshold" }],
|
|
6103
6132
|
async run(c) {
|
|
6104
6133
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
6105
|
-
|
|
6106
|
-
client.readContract({
|
|
6107
|
-
abi: forumAbi,
|
|
6108
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
6109
|
-
functionName: "threadCount"
|
|
6110
|
-
}),
|
|
6111
|
-
client.readContract({
|
|
6112
|
-
abi: forumAbi,
|
|
6113
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
6114
|
-
functionName: "commentCount"
|
|
6115
|
-
}),
|
|
6116
|
-
client.readContract({
|
|
6117
|
-
abi: forumAbi,
|
|
6118
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
6119
|
-
functionName: "petitionCount"
|
|
6120
|
-
}),
|
|
6121
|
-
client.readContract({
|
|
6122
|
-
abi: forumAbi,
|
|
6123
|
-
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
6124
|
-
functionName: "petitionThresholdBps"
|
|
6125
|
-
})
|
|
6126
|
-
]);
|
|
6127
|
-
return c.ok({
|
|
6128
|
-
threadCount: asNum(threadCount),
|
|
6129
|
-
commentCount: asNum(commentCount),
|
|
6130
|
-
petitionCount: asNum(petitionCount),
|
|
6131
|
-
petitionThresholdBps: asNum(petitionThresholdBps)
|
|
6132
|
-
});
|
|
6134
|
+
return c.ok(await fetchForumStats(client));
|
|
6133
6135
|
}
|
|
6134
6136
|
});
|
|
6135
6137
|
|
|
6136
6138
|
// src/commands/governance.ts
|
|
6137
6139
|
import { TxError as TxError2 } from "@spectratools/tx-shared";
|
|
6138
6140
|
import { Cli as Cli3, z as z4 } from "incur";
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
});
|
|
6142
|
-
var timestampOutput3 = z4.union([z4.number(), z4.string()]);
|
|
6141
|
+
|
|
6142
|
+
// src/services/governance.ts
|
|
6143
6143
|
var proposalStatusLabels = {
|
|
6144
6144
|
0: "pending",
|
|
6145
6145
|
1: "active",
|
|
@@ -6148,14 +6148,6 @@ var proposalStatusLabels = {
|
|
|
6148
6148
|
4: "defeated",
|
|
6149
6149
|
5: "cancelled"
|
|
6150
6150
|
};
|
|
6151
|
-
var PROPOSAL_STATUS_PENDING = 0;
|
|
6152
|
-
var PROPOSAL_STATUS_ACTIVE = 1;
|
|
6153
|
-
var PROPOSAL_STATUS_PASSED = 2;
|
|
6154
|
-
var supportChoiceToValue = {
|
|
6155
|
-
against: 0,
|
|
6156
|
-
for: 1,
|
|
6157
|
-
abstain: 2
|
|
6158
|
-
};
|
|
6159
6151
|
function proposalStatus(status) {
|
|
6160
6152
|
const statusCode = asNum(status);
|
|
6161
6153
|
return {
|
|
@@ -6163,32 +6155,6 @@ function proposalStatus(status) {
|
|
|
6163
6155
|
statusCode
|
|
6164
6156
|
};
|
|
6165
6157
|
}
|
|
6166
|
-
var proposalOutputSchema = z4.object({
|
|
6167
|
-
kind: z4.number(),
|
|
6168
|
-
configRiskTier: z4.number(),
|
|
6169
|
-
origin: z4.number(),
|
|
6170
|
-
status: z4.string(),
|
|
6171
|
-
statusCode: z4.number(),
|
|
6172
|
-
proposer: z4.string(),
|
|
6173
|
-
threadId: z4.number(),
|
|
6174
|
-
petitionId: z4.number(),
|
|
6175
|
-
createdAt: z4.number(),
|
|
6176
|
-
deliberationEndsAt: z4.number(),
|
|
6177
|
-
voteStartAt: z4.number(),
|
|
6178
|
-
voteEndAt: z4.number(),
|
|
6179
|
-
timelockEndsAt: z4.number(),
|
|
6180
|
-
activeSeatsSnapshot: z4.number(),
|
|
6181
|
-
forVotes: z4.string(),
|
|
6182
|
-
againstVotes: z4.string(),
|
|
6183
|
-
abstainVotes: z4.string(),
|
|
6184
|
-
amount: z4.string(),
|
|
6185
|
-
snapshotAssetBalance: z4.string(),
|
|
6186
|
-
transferIntent: z4.boolean(),
|
|
6187
|
-
intentDeadline: z4.number(),
|
|
6188
|
-
intentMaxRiskTier: z4.number(),
|
|
6189
|
-
title: z4.string(),
|
|
6190
|
-
description: z4.string()
|
|
6191
|
-
});
|
|
6192
6158
|
function decodeProposal(value) {
|
|
6193
6159
|
const [
|
|
6194
6160
|
kind,
|
|
@@ -6270,23 +6236,78 @@ function serializeProposal(proposal) {
|
|
|
6270
6236
|
description: proposal.description
|
|
6271
6237
|
};
|
|
6272
6238
|
}
|
|
6273
|
-
async function
|
|
6239
|
+
async function fetchProposalCount(client) {
|
|
6274
6240
|
return await client.readContract({
|
|
6275
6241
|
abi: governanceAbi,
|
|
6276
6242
|
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
6277
6243
|
functionName: "proposalCount"
|
|
6278
6244
|
});
|
|
6279
6245
|
}
|
|
6280
|
-
async function
|
|
6246
|
+
async function fetchProposalById(client, id) {
|
|
6281
6247
|
return decodeProposal(
|
|
6282
6248
|
await client.readContract({
|
|
6283
6249
|
abi: governanceAbi,
|
|
6284
6250
|
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
6285
6251
|
functionName: "proposals",
|
|
6286
|
-
args: [BigInt(
|
|
6252
|
+
args: [BigInt(id)]
|
|
6287
6253
|
})
|
|
6288
6254
|
);
|
|
6289
6255
|
}
|
|
6256
|
+
async function fetchAllProposals(client) {
|
|
6257
|
+
const count = await fetchProposalCount(client);
|
|
6258
|
+
const ids = Array.from({ length: Number(count) }, (_, i) => BigInt(i + 1));
|
|
6259
|
+
if (ids.length === 0) return [];
|
|
6260
|
+
const proposalTuples = await client.multicall({
|
|
6261
|
+
allowFailure: false,
|
|
6262
|
+
contracts: ids.map((id) => ({
|
|
6263
|
+
abi: governanceAbi,
|
|
6264
|
+
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
6265
|
+
functionName: "proposals",
|
|
6266
|
+
args: [id]
|
|
6267
|
+
}))
|
|
6268
|
+
});
|
|
6269
|
+
return proposalTuples.map(decodeProposal);
|
|
6270
|
+
}
|
|
6271
|
+
|
|
6272
|
+
// src/commands/governance.ts
|
|
6273
|
+
var env3 = z4.object({
|
|
6274
|
+
ABSTRACT_RPC_URL: z4.string().optional().describe("Abstract RPC URL override")
|
|
6275
|
+
});
|
|
6276
|
+
var timestampOutput3 = z4.union([z4.number(), z4.string()]);
|
|
6277
|
+
var PROPOSAL_STATUS_PENDING = 0;
|
|
6278
|
+
var PROPOSAL_STATUS_ACTIVE = 1;
|
|
6279
|
+
var PROPOSAL_STATUS_PASSED = 2;
|
|
6280
|
+
var supportChoiceToValue = {
|
|
6281
|
+
against: 0,
|
|
6282
|
+
for: 1,
|
|
6283
|
+
abstain: 2
|
|
6284
|
+
};
|
|
6285
|
+
var proposalOutputSchema = z4.object({
|
|
6286
|
+
kind: z4.number(),
|
|
6287
|
+
configRiskTier: z4.number(),
|
|
6288
|
+
origin: z4.number(),
|
|
6289
|
+
status: z4.string(),
|
|
6290
|
+
statusCode: z4.number(),
|
|
6291
|
+
proposer: z4.string(),
|
|
6292
|
+
threadId: z4.number(),
|
|
6293
|
+
petitionId: z4.number(),
|
|
6294
|
+
createdAt: z4.number(),
|
|
6295
|
+
deliberationEndsAt: z4.number(),
|
|
6296
|
+
voteStartAt: z4.number(),
|
|
6297
|
+
voteEndAt: z4.number(),
|
|
6298
|
+
timelockEndsAt: z4.number(),
|
|
6299
|
+
activeSeatsSnapshot: z4.number(),
|
|
6300
|
+
forVotes: z4.string(),
|
|
6301
|
+
againstVotes: z4.string(),
|
|
6302
|
+
abstainVotes: z4.string(),
|
|
6303
|
+
amount: z4.string(),
|
|
6304
|
+
snapshotAssetBalance: z4.string(),
|
|
6305
|
+
transferIntent: z4.boolean(),
|
|
6306
|
+
intentDeadline: z4.number(),
|
|
6307
|
+
intentMaxRiskTier: z4.number(),
|
|
6308
|
+
title: z4.string(),
|
|
6309
|
+
description: z4.string()
|
|
6310
|
+
});
|
|
6290
6311
|
var governance = Cli3.create("governance", {
|
|
6291
6312
|
description: "Inspect Assembly governance proposals, votes, and parameters."
|
|
6292
6313
|
});
|
|
@@ -6310,22 +6331,7 @@ governance.command("proposals", {
|
|
|
6310
6331
|
examples: [{ description: "List all proposals" }],
|
|
6311
6332
|
async run(c) {
|
|
6312
6333
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
6313
|
-
const
|
|
6314
|
-
abi: governanceAbi,
|
|
6315
|
-
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
6316
|
-
functionName: "proposalCount"
|
|
6317
|
-
});
|
|
6318
|
-
const ids = Array.from({ length: Number(count) }, (_, i) => BigInt(i + 1));
|
|
6319
|
-
const proposalTuples = ids.length ? await client.multicall({
|
|
6320
|
-
allowFailure: false,
|
|
6321
|
-
contracts: ids.map((id) => ({
|
|
6322
|
-
abi: governanceAbi,
|
|
6323
|
-
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
6324
|
-
functionName: "proposals",
|
|
6325
|
-
args: [id]
|
|
6326
|
-
}))
|
|
6327
|
-
}) : [];
|
|
6328
|
-
const proposals = proposalTuples.map(decodeProposal);
|
|
6334
|
+
const proposals = await fetchAllProposals(client);
|
|
6329
6335
|
const items = proposals.map((p, i) => ({
|
|
6330
6336
|
...proposalStatus(p.status),
|
|
6331
6337
|
id: i + 1,
|
|
@@ -6364,11 +6370,7 @@ governance.command("proposal", {
|
|
|
6364
6370
|
examples: [{ args: { id: 1 }, description: "Fetch proposal #1" }],
|
|
6365
6371
|
async run(c) {
|
|
6366
6372
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
6367
|
-
const proposalCount = await client
|
|
6368
|
-
abi: governanceAbi,
|
|
6369
|
-
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
6370
|
-
functionName: "proposalCount"
|
|
6371
|
-
});
|
|
6373
|
+
const proposalCount = await fetchProposalCount(client);
|
|
6372
6374
|
if (c.args.id > Number(proposalCount)) {
|
|
6373
6375
|
return c.error({
|
|
6374
6376
|
code: "OUT_OF_RANGE",
|
|
@@ -6376,14 +6378,7 @@ governance.command("proposal", {
|
|
|
6376
6378
|
retryable: false
|
|
6377
6379
|
});
|
|
6378
6380
|
}
|
|
6379
|
-
const proposal =
|
|
6380
|
-
await client.readContract({
|
|
6381
|
-
abi: governanceAbi,
|
|
6382
|
-
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
6383
|
-
functionName: "proposals",
|
|
6384
|
-
args: [BigInt(c.args.id)]
|
|
6385
|
-
})
|
|
6386
|
-
);
|
|
6381
|
+
const proposal = await fetchProposalById(client, c.args.id);
|
|
6387
6382
|
return c.ok(serializeProposal(proposal));
|
|
6388
6383
|
}
|
|
6389
6384
|
});
|
|
@@ -6527,7 +6522,7 @@ governance.command("vote", {
|
|
|
6527
6522
|
async run(c) {
|
|
6528
6523
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
6529
6524
|
const account = resolveAccount(c.env);
|
|
6530
|
-
const proposalCount = await
|
|
6525
|
+
const proposalCount = await fetchProposalCount(client);
|
|
6531
6526
|
if (c.args.proposalId > Number(proposalCount)) {
|
|
6532
6527
|
return c.error({
|
|
6533
6528
|
code: "OUT_OF_RANGE",
|
|
@@ -6535,7 +6530,7 @@ governance.command("vote", {
|
|
|
6535
6530
|
retryable: false
|
|
6536
6531
|
});
|
|
6537
6532
|
}
|
|
6538
|
-
const proposal = await
|
|
6533
|
+
const proposal = await fetchProposalById(client, c.args.proposalId);
|
|
6539
6534
|
const status = proposalStatus(proposal.status);
|
|
6540
6535
|
if (status.statusCode !== PROPOSAL_STATUS_ACTIVE) {
|
|
6541
6536
|
return c.error({
|
|
@@ -6648,7 +6643,7 @@ governance.command("propose", {
|
|
|
6648
6643
|
retryable: false
|
|
6649
6644
|
});
|
|
6650
6645
|
}
|
|
6651
|
-
const proposalCountBefore = await
|
|
6646
|
+
const proposalCountBefore = await fetchProposalCount(client);
|
|
6652
6647
|
const expectedProposalId = Number(proposalCountBefore) + 1;
|
|
6653
6648
|
const proposalInput = {
|
|
6654
6649
|
kind: c.options.kind,
|
|
@@ -6713,7 +6708,7 @@ governance.command("queue", {
|
|
|
6713
6708
|
],
|
|
6714
6709
|
async run(c) {
|
|
6715
6710
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
6716
|
-
const proposalCount = await
|
|
6711
|
+
const proposalCount = await fetchProposalCount(client);
|
|
6717
6712
|
if (c.args.proposalId > Number(proposalCount)) {
|
|
6718
6713
|
return c.error({
|
|
6719
6714
|
code: "OUT_OF_RANGE",
|
|
@@ -6721,7 +6716,7 @@ governance.command("queue", {
|
|
|
6721
6716
|
retryable: false
|
|
6722
6717
|
});
|
|
6723
6718
|
}
|
|
6724
|
-
const proposal = await
|
|
6719
|
+
const proposal = await fetchProposalById(client, c.args.proposalId);
|
|
6725
6720
|
const status = proposalStatus(proposal.status);
|
|
6726
6721
|
if (status.statusCode === PROPOSAL_STATUS_PASSED) {
|
|
6727
6722
|
return c.error({
|
|
@@ -6801,7 +6796,7 @@ governance.command("execute", {
|
|
|
6801
6796
|
],
|
|
6802
6797
|
async run(c) {
|
|
6803
6798
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
6804
|
-
const proposalCount = await
|
|
6799
|
+
const proposalCount = await fetchProposalCount(client);
|
|
6805
6800
|
if (c.args.proposalId > Number(proposalCount)) {
|
|
6806
6801
|
return c.error({
|
|
6807
6802
|
code: "OUT_OF_RANGE",
|
|
@@ -6809,7 +6804,7 @@ governance.command("execute", {
|
|
|
6809
6804
|
retryable: false
|
|
6810
6805
|
});
|
|
6811
6806
|
}
|
|
6812
|
-
const proposal = await
|
|
6807
|
+
const proposal = await fetchProposalById(client, c.args.proposalId);
|
|
6813
6808
|
const status = proposalStatus(proposal.status);
|
|
6814
6809
|
if (status.statusCode !== PROPOSAL_STATUS_PASSED) {
|
|
6815
6810
|
return c.error({
|
|
@@ -6856,16 +6851,13 @@ governance.command("execute", {
|
|
|
6856
6851
|
|
|
6857
6852
|
// src/commands/members.ts
|
|
6858
6853
|
import { TxError as TxError3 } from "@spectratools/tx-shared";
|
|
6859
|
-
import { Cli as Cli4, z as
|
|
6854
|
+
import { Cli as Cli4, z as z6 } from "incur";
|
|
6855
|
+
|
|
6856
|
+
// src/services/members.ts
|
|
6857
|
+
import { z as z5 } from "incur";
|
|
6860
6858
|
var DEFAULT_MEMBER_SNAPSHOT_URL = "https://www.theaiassembly.org/api/indexer/members";
|
|
6861
6859
|
var REGISTERED_EVENT_SCAN_STEP = 100000n;
|
|
6862
6860
|
var REGISTERED_EVENT_SCAN_TIMEOUT_MS = 2e4;
|
|
6863
|
-
var MAX_MEMBER_LOOKUP_SUGGESTIONS = 5;
|
|
6864
|
-
var env4 = z5.object({
|
|
6865
|
-
ABSTRACT_RPC_URL: z5.string().optional().describe("Abstract RPC URL override"),
|
|
6866
|
-
ASSEMBLY_INDEXER_URL: z5.string().optional().describe("Optional members snapshot endpoint (default: theaiassembly.org indexer)")
|
|
6867
|
-
});
|
|
6868
|
-
var timestampOutput4 = z5.union([z5.number(), z5.string()]);
|
|
6869
6861
|
var memberSnapshotEntrySchema = z5.union([
|
|
6870
6862
|
z5.string(),
|
|
6871
6863
|
z5.object({
|
|
@@ -6889,6 +6881,13 @@ var AssemblyIndexerUnavailableError = class extends Error {
|
|
|
6889
6881
|
this.name = "AssemblyIndexerUnavailableError";
|
|
6890
6882
|
}
|
|
6891
6883
|
};
|
|
6884
|
+
function memberSnapshotEntryToIdentity(entry) {
|
|
6885
|
+
if (typeof entry === "string") return { address: entry };
|
|
6886
|
+
const identity = { address: entry.address };
|
|
6887
|
+
if (entry.ens !== void 0) identity.ens = entry.ens;
|
|
6888
|
+
if (entry.name !== void 0) identity.name = entry.name;
|
|
6889
|
+
return identity;
|
|
6890
|
+
}
|
|
6892
6891
|
function mergeMemberIdentities(entries) {
|
|
6893
6892
|
const byAddress = /* @__PURE__ */ new Map();
|
|
6894
6893
|
for (const entry of entries) {
|
|
@@ -6907,27 +6906,6 @@ function mergeMemberIdentities(entries) {
|
|
|
6907
6906
|
}
|
|
6908
6907
|
return [...byAddress.values()];
|
|
6909
6908
|
}
|
|
6910
|
-
function memberSnapshotEntryToIdentity(entry) {
|
|
6911
|
-
if (typeof entry === "string") return { address: entry };
|
|
6912
|
-
const identity = { address: entry.address };
|
|
6913
|
-
if (entry.ens !== void 0) identity.ens = entry.ens;
|
|
6914
|
-
if (entry.name !== void 0) identity.name = entry.name;
|
|
6915
|
-
return identity;
|
|
6916
|
-
}
|
|
6917
|
-
function matchableAddressInput(query) {
|
|
6918
|
-
return query.startsWith("0x") && query.length === 42;
|
|
6919
|
-
}
|
|
6920
|
-
function searchMemberIdentities(query, members2) {
|
|
6921
|
-
const needle = query.trim().toLowerCase();
|
|
6922
|
-
if (needle.length === 0) return [];
|
|
6923
|
-
const exactMatches = members2.filter((member) => {
|
|
6924
|
-
return member.address.toLowerCase() === needle || member.ens?.toLowerCase() === needle || member.name?.toLowerCase() === needle;
|
|
6925
|
-
});
|
|
6926
|
-
if (exactMatches.length > 0) return exactMatches;
|
|
6927
|
-
return members2.filter((member) => {
|
|
6928
|
-
return member.address.toLowerCase().includes(needle) || member.ens?.toLowerCase().includes(needle) || member.name?.toLowerCase().includes(needle);
|
|
6929
|
-
});
|
|
6930
|
-
}
|
|
6931
6909
|
async function memberSnapshot(url) {
|
|
6932
6910
|
let res;
|
|
6933
6911
|
try {
|
|
@@ -6996,9 +6974,10 @@ async function membersFromRegisteredEvents(client) {
|
|
|
6996
6974
|
}
|
|
6997
6975
|
return [...addresses].map((address) => ({ address }));
|
|
6998
6976
|
}
|
|
6999
|
-
async function
|
|
6977
|
+
async function fetchMemberList(client, snapshotUrl) {
|
|
6978
|
+
const url = snapshotUrl ?? DEFAULT_MEMBER_SNAPSHOT_URL;
|
|
7000
6979
|
try {
|
|
7001
|
-
return { members: await memberSnapshot(
|
|
6980
|
+
return { members: await memberSnapshot(url) };
|
|
7002
6981
|
} catch (error) {
|
|
7003
6982
|
if (error instanceof AssemblyApiValidationError) {
|
|
7004
6983
|
throw error;
|
|
@@ -7017,6 +6996,58 @@ async function loadMemberIdentities(client, snapshotUrl) {
|
|
|
7017
6996
|
};
|
|
7018
6997
|
}
|
|
7019
6998
|
}
|
|
6999
|
+
async function fetchMemberOnchainState(client, addresses) {
|
|
7000
|
+
if (addresses.length === 0) return [];
|
|
7001
|
+
const calls = addresses.flatMap((address) => [
|
|
7002
|
+
{
|
|
7003
|
+
abi: registryAbi,
|
|
7004
|
+
address: ABSTRACT_MAINNET_ADDRESSES.registry,
|
|
7005
|
+
functionName: "isActive",
|
|
7006
|
+
args: [address]
|
|
7007
|
+
},
|
|
7008
|
+
{
|
|
7009
|
+
abi: registryAbi,
|
|
7010
|
+
address: ABSTRACT_MAINNET_ADDRESSES.registry,
|
|
7011
|
+
functionName: "members",
|
|
7012
|
+
args: [address]
|
|
7013
|
+
}
|
|
7014
|
+
]);
|
|
7015
|
+
const values = await client.multicall({ allowFailure: false, contracts: calls });
|
|
7016
|
+
return addresses.map((address, i) => {
|
|
7017
|
+
const active = values[i * 2];
|
|
7018
|
+
const info = values[i * 2 + 1];
|
|
7019
|
+
return {
|
|
7020
|
+
address: toChecksum(address),
|
|
7021
|
+
active,
|
|
7022
|
+
registered: info.registered,
|
|
7023
|
+
activeUntil: info.activeUntil,
|
|
7024
|
+
lastHeartbeatAt: info.lastHeartbeatAt
|
|
7025
|
+
};
|
|
7026
|
+
});
|
|
7027
|
+
}
|
|
7028
|
+
|
|
7029
|
+
// src/commands/members.ts
|
|
7030
|
+
var DEFAULT_MEMBER_SNAPSHOT_URL2 = "https://www.theaiassembly.org/api/indexer/members";
|
|
7031
|
+
var MAX_MEMBER_LOOKUP_SUGGESTIONS = 5;
|
|
7032
|
+
var env4 = z6.object({
|
|
7033
|
+
ABSTRACT_RPC_URL: z6.string().optional().describe("Abstract RPC URL override"),
|
|
7034
|
+
ASSEMBLY_INDEXER_URL: z6.string().optional().describe("Optional members snapshot endpoint (default: theaiassembly.org indexer)")
|
|
7035
|
+
});
|
|
7036
|
+
var timestampOutput4 = z6.union([z6.number(), z6.string()]);
|
|
7037
|
+
function matchableAddressInput(query) {
|
|
7038
|
+
return query.startsWith("0x") && query.length === 42;
|
|
7039
|
+
}
|
|
7040
|
+
function searchMemberIdentities(query, members2) {
|
|
7041
|
+
const needle = query.trim().toLowerCase();
|
|
7042
|
+
if (needle.length === 0) return [];
|
|
7043
|
+
const exactMatches = members2.filter((member) => {
|
|
7044
|
+
return member.address.toLowerCase() === needle || member.ens?.toLowerCase() === needle || member.name?.toLowerCase() === needle;
|
|
7045
|
+
});
|
|
7046
|
+
if (exactMatches.length > 0) return exactMatches;
|
|
7047
|
+
return members2.filter((member) => {
|
|
7048
|
+
return member.address.toLowerCase().includes(needle) || member.ens?.toLowerCase().includes(needle) || member.name?.toLowerCase().includes(needle);
|
|
7049
|
+
});
|
|
7050
|
+
}
|
|
7020
7051
|
function indexerIssue(details) {
|
|
7021
7052
|
if (typeof details.status === "number") {
|
|
7022
7053
|
return `${details.status}${details.statusText ? ` ${details.statusText}` : ""}`;
|
|
@@ -7048,19 +7079,19 @@ var members = Cli4.create("members", {
|
|
|
7048
7079
|
members.command("list", {
|
|
7049
7080
|
description: "List members from an indexer snapshot (or Registered event fallback) plus on-chain active state.",
|
|
7050
7081
|
env: env4,
|
|
7051
|
-
output:
|
|
7052
|
-
members:
|
|
7053
|
-
|
|
7054
|
-
address:
|
|
7055
|
-
active:
|
|
7056
|
-
registered:
|
|
7082
|
+
output: z6.object({
|
|
7083
|
+
members: z6.array(
|
|
7084
|
+
z6.object({
|
|
7085
|
+
address: z6.string(),
|
|
7086
|
+
active: z6.boolean(),
|
|
7087
|
+
registered: z6.boolean(),
|
|
7057
7088
|
activeUntil: timestampOutput4,
|
|
7058
|
-
activeUntilRelative:
|
|
7089
|
+
activeUntilRelative: z6.string(),
|
|
7059
7090
|
lastHeartbeatAt: timestampOutput4,
|
|
7060
|
-
lastHeartbeatRelative:
|
|
7091
|
+
lastHeartbeatRelative: z6.string()
|
|
7061
7092
|
})
|
|
7062
7093
|
),
|
|
7063
|
-
count:
|
|
7094
|
+
count: z6.number()
|
|
7064
7095
|
}),
|
|
7065
7096
|
examples: [
|
|
7066
7097
|
{ description: "List members using default indexer snapshot" },
|
|
@@ -7068,11 +7099,11 @@ members.command("list", {
|
|
|
7068
7099
|
],
|
|
7069
7100
|
async run(c) {
|
|
7070
7101
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
7071
|
-
const snapshotUrl = c.env.ASSEMBLY_INDEXER_URL ??
|
|
7102
|
+
const snapshotUrl = c.env.ASSEMBLY_INDEXER_URL ?? DEFAULT_MEMBER_SNAPSHOT_URL2;
|
|
7072
7103
|
let memberIdentities;
|
|
7073
7104
|
let fallbackReason;
|
|
7074
7105
|
try {
|
|
7075
|
-
const loaded = await
|
|
7106
|
+
const loaded = await fetchMemberList(client, snapshotUrl);
|
|
7076
7107
|
memberIdentities = loaded.members;
|
|
7077
7108
|
fallbackReason = loaded.fallbackReason;
|
|
7078
7109
|
} catch (error) {
|
|
@@ -7096,34 +7127,16 @@ members.command("list", {
|
|
|
7096
7127
|
emitIndexerFallbackWarning(fallbackReason);
|
|
7097
7128
|
}
|
|
7098
7129
|
const addresses = memberIdentities.map((member) => member.address);
|
|
7099
|
-
const
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
functionName: "members",
|
|
7110
|
-
args: [address]
|
|
7111
|
-
}
|
|
7112
|
-
]);
|
|
7113
|
-
const values = calls.length > 0 ? await client.multicall({ allowFailure: false, contracts: calls }) : [];
|
|
7114
|
-
const rows = addresses.map((address, i) => {
|
|
7115
|
-
const active = values[i * 2];
|
|
7116
|
-
const info = values[i * 2 + 1];
|
|
7117
|
-
return {
|
|
7118
|
-
address: toChecksum(address),
|
|
7119
|
-
active,
|
|
7120
|
-
registered: info.registered,
|
|
7121
|
-
activeUntil: timeValue(info.activeUntil, c.format),
|
|
7122
|
-
activeUntilRelative: relTime(info.activeUntil),
|
|
7123
|
-
lastHeartbeatAt: timeValue(info.lastHeartbeatAt, c.format),
|
|
7124
|
-
lastHeartbeatRelative: relTime(info.lastHeartbeatAt)
|
|
7125
|
-
};
|
|
7126
|
-
});
|
|
7130
|
+
const onchainStates = await fetchMemberOnchainState(client, addresses);
|
|
7131
|
+
const rows = onchainStates.map((state) => ({
|
|
7132
|
+
address: state.address,
|
|
7133
|
+
active: state.active,
|
|
7134
|
+
registered: state.registered,
|
|
7135
|
+
activeUntil: timeValue(state.activeUntil, c.format),
|
|
7136
|
+
activeUntilRelative: relTime(state.activeUntil),
|
|
7137
|
+
lastHeartbeatAt: timeValue(state.lastHeartbeatAt, c.format),
|
|
7138
|
+
lastHeartbeatRelative: relTime(state.lastHeartbeatAt)
|
|
7139
|
+
}));
|
|
7127
7140
|
return c.ok({
|
|
7128
7141
|
members: rows,
|
|
7129
7142
|
count: rows.length
|
|
@@ -7132,17 +7145,17 @@ members.command("list", {
|
|
|
7132
7145
|
});
|
|
7133
7146
|
members.command("info", {
|
|
7134
7147
|
description: "Get member registry record and active status by full address, partial address, ENS, or name.",
|
|
7135
|
-
args:
|
|
7136
|
-
address:
|
|
7148
|
+
args: z6.object({
|
|
7149
|
+
address: z6.string().describe("Member lookup query (full/partial address, ENS, or name metadata)")
|
|
7137
7150
|
}),
|
|
7138
7151
|
env: env4,
|
|
7139
|
-
output:
|
|
7140
|
-
address:
|
|
7141
|
-
active:
|
|
7152
|
+
output: z6.object({
|
|
7153
|
+
address: z6.string(),
|
|
7154
|
+
active: z6.boolean(),
|
|
7142
7155
|
activeUntil: timestampOutput4,
|
|
7143
7156
|
lastHeartbeatAt: timestampOutput4,
|
|
7144
|
-
activeUntilRelative:
|
|
7145
|
-
lastHeartbeatRelative:
|
|
7157
|
+
activeUntilRelative: z6.string(),
|
|
7158
|
+
lastHeartbeatRelative: z6.string()
|
|
7146
7159
|
}),
|
|
7147
7160
|
examples: [
|
|
7148
7161
|
{
|
|
@@ -7156,13 +7169,13 @@ members.command("info", {
|
|
|
7156
7169
|
],
|
|
7157
7170
|
async run(c) {
|
|
7158
7171
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
7159
|
-
const snapshotUrl = c.env.ASSEMBLY_INDEXER_URL ??
|
|
7172
|
+
const snapshotUrl = c.env.ASSEMBLY_INDEXER_URL ?? DEFAULT_MEMBER_SNAPSHOT_URL2;
|
|
7160
7173
|
let lookupAddress = c.args.address;
|
|
7161
7174
|
if (!matchableAddressInput(c.args.address)) {
|
|
7162
7175
|
let loadedMembers;
|
|
7163
7176
|
let fallbackReason;
|
|
7164
7177
|
try {
|
|
7165
|
-
const loaded = await
|
|
7178
|
+
const loaded = await fetchMemberList(client, snapshotUrl);
|
|
7166
7179
|
loadedMembers = loaded.members;
|
|
7167
7180
|
fallbackReason = loaded.fallbackReason;
|
|
7168
7181
|
} catch (error) {
|
|
@@ -7227,9 +7240,9 @@ members.command("info", {
|
|
|
7227
7240
|
members.command("count", {
|
|
7228
7241
|
description: "Get active and total-known member counts from Registry.",
|
|
7229
7242
|
env: env4,
|
|
7230
|
-
output:
|
|
7231
|
-
active:
|
|
7232
|
-
total:
|
|
7243
|
+
output: z6.object({
|
|
7244
|
+
active: z6.number(),
|
|
7245
|
+
total: z6.number()
|
|
7233
7246
|
}),
|
|
7234
7247
|
examples: [{ description: "Count active and known members" }],
|
|
7235
7248
|
async run(c) {
|
|
@@ -7252,12 +7265,12 @@ members.command("count", {
|
|
|
7252
7265
|
members.command("fees", {
|
|
7253
7266
|
description: "Get registration and heartbeat fee settings.",
|
|
7254
7267
|
env: env4,
|
|
7255
|
-
output:
|
|
7256
|
-
registrationFeeWei:
|
|
7257
|
-
registrationFee:
|
|
7258
|
-
heartbeatFeeWei:
|
|
7259
|
-
heartbeatFee:
|
|
7260
|
-
heartbeatGracePeriodSeconds:
|
|
7268
|
+
output: z6.object({
|
|
7269
|
+
registrationFeeWei: z6.string(),
|
|
7270
|
+
registrationFee: z6.string(),
|
|
7271
|
+
heartbeatFeeWei: z6.string(),
|
|
7272
|
+
heartbeatFee: z6.string(),
|
|
7273
|
+
heartbeatGracePeriodSeconds: z6.number()
|
|
7261
7274
|
}),
|
|
7262
7275
|
examples: [{ description: "Inspect current registry fee configuration" }],
|
|
7263
7276
|
async run(c) {
|
|
@@ -7288,24 +7301,24 @@ members.command("fees", {
|
|
|
7288
7301
|
});
|
|
7289
7302
|
}
|
|
7290
7303
|
});
|
|
7291
|
-
var txOutputSchema =
|
|
7292
|
-
|
|
7293
|
-
status:
|
|
7294
|
-
hash:
|
|
7295
|
-
blockNumber:
|
|
7296
|
-
gasUsed:
|
|
7297
|
-
from:
|
|
7298
|
-
to:
|
|
7299
|
-
effectiveGasPrice:
|
|
7300
|
-
fee:
|
|
7301
|
-
feeEth:
|
|
7304
|
+
var txOutputSchema = z6.union([
|
|
7305
|
+
z6.object({
|
|
7306
|
+
status: z6.enum(["success", "reverted"]),
|
|
7307
|
+
hash: z6.string(),
|
|
7308
|
+
blockNumber: z6.number(),
|
|
7309
|
+
gasUsed: z6.string(),
|
|
7310
|
+
from: z6.string(),
|
|
7311
|
+
to: z6.string().nullable(),
|
|
7312
|
+
effectiveGasPrice: z6.string().optional(),
|
|
7313
|
+
fee: z6.string(),
|
|
7314
|
+
feeEth: z6.string()
|
|
7302
7315
|
}),
|
|
7303
|
-
|
|
7304
|
-
status:
|
|
7305
|
-
estimatedGas:
|
|
7306
|
-
simulationResult:
|
|
7307
|
-
fee:
|
|
7308
|
-
feeEth:
|
|
7316
|
+
z6.object({
|
|
7317
|
+
status: z6.literal("dry-run"),
|
|
7318
|
+
estimatedGas: z6.string(),
|
|
7319
|
+
simulationResult: z6.unknown(),
|
|
7320
|
+
fee: z6.string(),
|
|
7321
|
+
feeEth: z6.string()
|
|
7309
7322
|
})
|
|
7310
7323
|
]);
|
|
7311
7324
|
members.command("register", {
|
|
@@ -7464,35 +7477,35 @@ members.command("renew", {
|
|
|
7464
7477
|
|
|
7465
7478
|
// src/commands/treasury.ts
|
|
7466
7479
|
import { TxError as TxError4 } from "@spectratools/tx-shared";
|
|
7467
|
-
import { Cli as Cli5, z as
|
|
7480
|
+
import { Cli as Cli5, z as z7 } from "incur";
|
|
7468
7481
|
import { encodeAbiParameters, parseUnits, zeroAddress } from "viem";
|
|
7469
|
-
var env5 =
|
|
7470
|
-
ABSTRACT_RPC_URL:
|
|
7482
|
+
var env5 = z7.object({
|
|
7483
|
+
ABSTRACT_RPC_URL: z7.string().optional().describe("Abstract RPC URL override")
|
|
7471
7484
|
});
|
|
7472
|
-
var timestampOutput5 =
|
|
7473
|
-
var txResultOutput4 =
|
|
7474
|
-
|
|
7475
|
-
status:
|
|
7476
|
-
hash:
|
|
7477
|
-
blockNumber:
|
|
7478
|
-
gasUsed:
|
|
7479
|
-
from:
|
|
7480
|
-
to:
|
|
7481
|
-
effectiveGasPrice:
|
|
7485
|
+
var timestampOutput5 = z7.union([z7.number(), z7.string()]);
|
|
7486
|
+
var txResultOutput4 = z7.union([
|
|
7487
|
+
z7.object({
|
|
7488
|
+
status: z7.literal("success"),
|
|
7489
|
+
hash: z7.string(),
|
|
7490
|
+
blockNumber: z7.number(),
|
|
7491
|
+
gasUsed: z7.string(),
|
|
7492
|
+
from: z7.string(),
|
|
7493
|
+
to: z7.string().nullable(),
|
|
7494
|
+
effectiveGasPrice: z7.string().optional()
|
|
7482
7495
|
}),
|
|
7483
|
-
|
|
7484
|
-
status:
|
|
7485
|
-
hash:
|
|
7486
|
-
blockNumber:
|
|
7487
|
-
gasUsed:
|
|
7488
|
-
from:
|
|
7489
|
-
to:
|
|
7490
|
-
effectiveGasPrice:
|
|
7496
|
+
z7.object({
|
|
7497
|
+
status: z7.literal("reverted"),
|
|
7498
|
+
hash: z7.string(),
|
|
7499
|
+
blockNumber: z7.number(),
|
|
7500
|
+
gasUsed: z7.string(),
|
|
7501
|
+
from: z7.string(),
|
|
7502
|
+
to: z7.string().nullable(),
|
|
7503
|
+
effectiveGasPrice: z7.string().optional()
|
|
7491
7504
|
}),
|
|
7492
|
-
|
|
7493
|
-
status:
|
|
7494
|
-
estimatedGas:
|
|
7495
|
-
simulationResult:
|
|
7505
|
+
z7.object({
|
|
7506
|
+
status: z7.literal("dry-run"),
|
|
7507
|
+
estimatedGas: z7.string(),
|
|
7508
|
+
simulationResult: z7.unknown()
|
|
7496
7509
|
})
|
|
7497
7510
|
]);
|
|
7498
7511
|
var treasury = Cli5.create("treasury", {
|
|
@@ -7501,10 +7514,10 @@ var treasury = Cli5.create("treasury", {
|
|
|
7501
7514
|
treasury.command("balance", {
|
|
7502
7515
|
description: "Get current native token balance for the treasury contract.",
|
|
7503
7516
|
env: env5,
|
|
7504
|
-
output:
|
|
7505
|
-
address:
|
|
7506
|
-
balanceWei:
|
|
7507
|
-
balance:
|
|
7517
|
+
output: z7.object({
|
|
7518
|
+
address: z7.string(),
|
|
7519
|
+
balanceWei: z7.string(),
|
|
7520
|
+
balance: z7.string()
|
|
7508
7521
|
}),
|
|
7509
7522
|
examples: [{ description: "Check treasury balance" }],
|
|
7510
7523
|
async run(c) {
|
|
@@ -7519,13 +7532,13 @@ treasury.command("balance", {
|
|
|
7519
7532
|
});
|
|
7520
7533
|
treasury.command("whitelist", {
|
|
7521
7534
|
description: "Check whether an asset address is treasury-whitelisted.",
|
|
7522
|
-
args:
|
|
7523
|
-
asset:
|
|
7535
|
+
args: z7.object({
|
|
7536
|
+
asset: z7.string().describe("Token/asset contract address")
|
|
7524
7537
|
}),
|
|
7525
7538
|
env: env5,
|
|
7526
|
-
output:
|
|
7527
|
-
asset:
|
|
7528
|
-
whitelisted:
|
|
7539
|
+
output: z7.object({
|
|
7540
|
+
asset: z7.string(),
|
|
7541
|
+
whitelisted: z7.boolean()
|
|
7529
7542
|
}),
|
|
7530
7543
|
examples: [
|
|
7531
7544
|
{
|
|
@@ -7547,11 +7560,11 @@ treasury.command("whitelist", {
|
|
|
7547
7560
|
treasury.command("major-spend-status", {
|
|
7548
7561
|
description: "Read major-spend cooldown status for the treasury contract.",
|
|
7549
7562
|
env: env5,
|
|
7550
|
-
output:
|
|
7551
|
-
majorSpendCooldownSeconds:
|
|
7563
|
+
output: z7.object({
|
|
7564
|
+
majorSpendCooldownSeconds: z7.number(),
|
|
7552
7565
|
lastMajorSpendAt: timestampOutput5,
|
|
7553
|
-
lastMajorSpendRelative:
|
|
7554
|
-
isMajorSpendAllowed:
|
|
7566
|
+
lastMajorSpendRelative: z7.string(),
|
|
7567
|
+
isMajorSpendAllowed: z7.boolean()
|
|
7555
7568
|
}),
|
|
7556
7569
|
examples: [{ description: "Inspect treasury major-spend guardrails" }],
|
|
7557
7570
|
async run(c) {
|
|
@@ -7585,13 +7598,13 @@ treasury.command("major-spend-status", {
|
|
|
7585
7598
|
});
|
|
7586
7599
|
treasury.command("executed", {
|
|
7587
7600
|
description: "Check whether a treasury action for a proposal has executed.",
|
|
7588
|
-
args:
|
|
7589
|
-
proposalId:
|
|
7601
|
+
args: z7.object({
|
|
7602
|
+
proposalId: z7.coerce.number().int().positive().describe("Governance proposal id")
|
|
7590
7603
|
}),
|
|
7591
7604
|
env: env5,
|
|
7592
|
-
output:
|
|
7593
|
-
proposalId:
|
|
7594
|
-
executed:
|
|
7605
|
+
output: z7.object({
|
|
7606
|
+
proposalId: z7.number(),
|
|
7607
|
+
executed: z7.boolean()
|
|
7595
7608
|
}),
|
|
7596
7609
|
examples: [{ args: { proposalId: 1 }, description: "Check execution status for proposal #1" }],
|
|
7597
7610
|
async run(c) {
|
|
@@ -7621,25 +7634,25 @@ treasury.command("propose-spend", {
|
|
|
7621
7634
|
description: "Create a council proposal that spends treasury funds via TreasuryTransferIntentModule.",
|
|
7622
7635
|
hint: "Requires PRIVATE_KEY environment variable for signing.",
|
|
7623
7636
|
options: writeOptions.extend({
|
|
7624
|
-
token:
|
|
7625
|
-
recipient:
|
|
7626
|
-
amount:
|
|
7627
|
-
decimals:
|
|
7628
|
-
title:
|
|
7629
|
-
description:
|
|
7630
|
-
category:
|
|
7631
|
-
"risk-tier":
|
|
7637
|
+
token: z7.string().describe("Token address to spend (use 0x0000000000000000000000000000000000000000 for ETH)"),
|
|
7638
|
+
recipient: z7.string().describe("Recipient address"),
|
|
7639
|
+
amount: z7.string().describe("Token amount as decimal string (human units)"),
|
|
7640
|
+
decimals: z7.coerce.number().int().min(0).max(36).default(18).describe("Token decimals used to parse --amount (default: 18)"),
|
|
7641
|
+
title: z7.string().min(1).describe("Proposal title"),
|
|
7642
|
+
description: z7.string().min(1).describe("Proposal description"),
|
|
7643
|
+
category: z7.string().default("treasury").describe("Forum category label for this proposal"),
|
|
7644
|
+
"risk-tier": z7.coerce.number().int().min(0).max(3).default(3).describe("Max allowed risk tier in intent constraints (0-3, default: 3)")
|
|
7632
7645
|
}),
|
|
7633
7646
|
env: writeEnv,
|
|
7634
|
-
output:
|
|
7635
|
-
proposer:
|
|
7636
|
-
category:
|
|
7637
|
-
token:
|
|
7638
|
-
recipient:
|
|
7639
|
-
amount:
|
|
7640
|
-
amountWei:
|
|
7641
|
-
expectedProposalId:
|
|
7642
|
-
expectedThreadId:
|
|
7647
|
+
output: z7.object({
|
|
7648
|
+
proposer: z7.string(),
|
|
7649
|
+
category: z7.string(),
|
|
7650
|
+
token: z7.string(),
|
|
7651
|
+
recipient: z7.string(),
|
|
7652
|
+
amount: z7.string(),
|
|
7653
|
+
amountWei: z7.string(),
|
|
7654
|
+
expectedProposalId: z7.number(),
|
|
7655
|
+
expectedThreadId: z7.number(),
|
|
7643
7656
|
tx: txResultOutput4
|
|
7644
7657
|
}),
|
|
7645
7658
|
examples: [
|
|
@@ -7943,20 +7956,20 @@ cli.command(council);
|
|
|
7943
7956
|
cli.command(forum);
|
|
7944
7957
|
cli.command(governance);
|
|
7945
7958
|
cli.command(treasury);
|
|
7946
|
-
var rootEnv =
|
|
7947
|
-
ABSTRACT_RPC_URL:
|
|
7959
|
+
var rootEnv = z8.object({
|
|
7960
|
+
ABSTRACT_RPC_URL: z8.string().optional().describe("Abstract RPC URL override")
|
|
7948
7961
|
});
|
|
7949
|
-
var timestampOutput6 =
|
|
7962
|
+
var timestampOutput6 = z8.union([z8.number(), z8.string()]);
|
|
7950
7963
|
cli.command("status", {
|
|
7951
7964
|
description: "Get a cross-contract Assembly snapshot (members, council, governance, treasury).",
|
|
7952
7965
|
env: rootEnv,
|
|
7953
|
-
output:
|
|
7954
|
-
activeMemberCount:
|
|
7955
|
-
seatCount:
|
|
7956
|
-
proposalCount:
|
|
7957
|
-
currentAuctionDay:
|
|
7958
|
-
currentAuctionSlot:
|
|
7959
|
-
treasuryBalance:
|
|
7966
|
+
output: z8.object({
|
|
7967
|
+
activeMemberCount: z8.number(),
|
|
7968
|
+
seatCount: z8.number(),
|
|
7969
|
+
proposalCount: z8.number(),
|
|
7970
|
+
currentAuctionDay: z8.number(),
|
|
7971
|
+
currentAuctionSlot: z8.number(),
|
|
7972
|
+
treasuryBalance: z8.string()
|
|
7960
7973
|
}),
|
|
7961
7974
|
examples: [{ description: "Fetch the current Assembly system status" }],
|
|
7962
7975
|
async run(c) {
|
|
@@ -8010,18 +8023,18 @@ cli.command("status", {
|
|
|
8010
8023
|
});
|
|
8011
8024
|
cli.command("health", {
|
|
8012
8025
|
description: "Check cross-contract health for one address (membership, council, refunds, power).",
|
|
8013
|
-
args:
|
|
8014
|
-
address:
|
|
8026
|
+
args: z8.object({
|
|
8027
|
+
address: z8.string().describe("Member or wallet address to inspect")
|
|
8015
8028
|
}),
|
|
8016
8029
|
env: rootEnv,
|
|
8017
|
-
output:
|
|
8018
|
-
address:
|
|
8019
|
-
isActive:
|
|
8030
|
+
output: z8.object({
|
|
8031
|
+
address: z8.string(),
|
|
8032
|
+
isActive: z8.boolean(),
|
|
8020
8033
|
activeUntil: timestampOutput6,
|
|
8021
|
-
activeUntilRelative:
|
|
8022
|
-
isCouncilMember:
|
|
8023
|
-
pendingReturnsWei:
|
|
8024
|
-
votingPower:
|
|
8034
|
+
activeUntilRelative: z8.string(),
|
|
8035
|
+
isCouncilMember: z8.boolean(),
|
|
8036
|
+
pendingReturnsWei: z8.string(),
|
|
8037
|
+
votingPower: z8.number()
|
|
8025
8038
|
}),
|
|
8026
8039
|
examples: [
|
|
8027
8040
|
{
|