@spectratools/assembly-cli 0.3.0 → 0.4.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 +141 -54
- package/package.json +1 -7
package/dist/cli.js
CHANGED
|
@@ -4392,6 +4392,18 @@ council.command("seat", {
|
|
|
4392
4392
|
examples: [{ args: { id: 0 }, description: "Inspect seat #0" }],
|
|
4393
4393
|
async run(c) {
|
|
4394
4394
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
4395
|
+
const seatCount = await client.readContract({
|
|
4396
|
+
abi: councilSeatsAbi,
|
|
4397
|
+
address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
|
|
4398
|
+
functionName: "seatCount"
|
|
4399
|
+
});
|
|
4400
|
+
if (c.args.id >= Number(seatCount)) {
|
|
4401
|
+
return c.error({
|
|
4402
|
+
code: "OUT_OF_RANGE",
|
|
4403
|
+
message: `Seat id ${c.args.id} does not exist (seatCount: ${seatCount})`,
|
|
4404
|
+
retryable: false
|
|
4405
|
+
});
|
|
4406
|
+
}
|
|
4395
4407
|
const seatTuple = await client.readContract({
|
|
4396
4408
|
abi: councilSeatsAbi,
|
|
4397
4409
|
address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
|
|
@@ -4823,17 +4835,20 @@ var forum = Cli2.create("forum", {
|
|
|
4823
4835
|
forum.command("threads", {
|
|
4824
4836
|
description: "List forum threads with author and creation metadata.",
|
|
4825
4837
|
env: env2,
|
|
4826
|
-
output: z2.
|
|
4827
|
-
z2.
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4838
|
+
output: z2.object({
|
|
4839
|
+
threads: z2.array(
|
|
4840
|
+
z2.object({
|
|
4841
|
+
id: z2.number(),
|
|
4842
|
+
kind: z2.number(),
|
|
4843
|
+
author: z2.string(),
|
|
4844
|
+
createdAt: z2.number(),
|
|
4845
|
+
createdAtRelative: z2.string(),
|
|
4846
|
+
category: z2.string().nullable().optional(),
|
|
4847
|
+
title: z2.string().nullable().optional()
|
|
4848
|
+
})
|
|
4849
|
+
),
|
|
4850
|
+
count: z2.number()
|
|
4851
|
+
}),
|
|
4837
4852
|
examples: [{ description: "List all forum threads" }],
|
|
4838
4853
|
async run(c) {
|
|
4839
4854
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
@@ -4853,16 +4868,20 @@ forum.command("threads", {
|
|
|
4853
4868
|
}))
|
|
4854
4869
|
}) : [];
|
|
4855
4870
|
const items = threadTuples.map(decodeThread);
|
|
4871
|
+
const threads = items.map((x) => ({
|
|
4872
|
+
id: x.id,
|
|
4873
|
+
kind: x.kind,
|
|
4874
|
+
author: x.author,
|
|
4875
|
+
createdAt: x.createdAt,
|
|
4876
|
+
createdAtRelative: relTime(x.createdAt),
|
|
4877
|
+
category: x.category ?? null,
|
|
4878
|
+
title: x.title ?? null
|
|
4879
|
+
}));
|
|
4856
4880
|
return c.ok(
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
createdAt: x.createdAt,
|
|
4862
|
-
createdAtRelative: relTime(x.createdAt),
|
|
4863
|
-
category: x.category ?? null,
|
|
4864
|
-
title: x.title ?? null
|
|
4865
|
-
})),
|
|
4881
|
+
{
|
|
4882
|
+
threads,
|
|
4883
|
+
count: threads.length
|
|
4884
|
+
},
|
|
4866
4885
|
{
|
|
4867
4886
|
cta: {
|
|
4868
4887
|
description: "Inspect or comment:",
|
|
@@ -4888,6 +4907,18 @@ forum.command("thread", {
|
|
|
4888
4907
|
examples: [{ args: { id: 1 }, description: "Fetch thread #1 and its comments" }],
|
|
4889
4908
|
async run(c) {
|
|
4890
4909
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
4910
|
+
const threadCount = await client.readContract({
|
|
4911
|
+
abi: forumAbi,
|
|
4912
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
4913
|
+
functionName: "threadCount"
|
|
4914
|
+
});
|
|
4915
|
+
if (c.args.id > Number(threadCount)) {
|
|
4916
|
+
return c.error({
|
|
4917
|
+
code: "OUT_OF_RANGE",
|
|
4918
|
+
message: `Thread id ${c.args.id} does not exist (threadCount: ${threadCount})`,
|
|
4919
|
+
retryable: false
|
|
4920
|
+
});
|
|
4921
|
+
}
|
|
4891
4922
|
const [threadTuple, commentCount] = await Promise.all([
|
|
4892
4923
|
client.readContract({
|
|
4893
4924
|
abi: forumAbi,
|
|
@@ -4960,6 +4991,18 @@ forum.command("comment", {
|
|
|
4960
4991
|
examples: [{ args: { id: 1 }, description: "Fetch comment #1" }],
|
|
4961
4992
|
async run(c) {
|
|
4962
4993
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
4994
|
+
const commentCount = await client.readContract({
|
|
4995
|
+
abi: forumAbi,
|
|
4996
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
4997
|
+
functionName: "commentCount"
|
|
4998
|
+
});
|
|
4999
|
+
if (c.args.id > Number(commentCount)) {
|
|
5000
|
+
return c.error({
|
|
5001
|
+
code: "OUT_OF_RANGE",
|
|
5002
|
+
message: `Comment id ${c.args.id} does not exist (commentCount: ${commentCount})`,
|
|
5003
|
+
retryable: false
|
|
5004
|
+
});
|
|
5005
|
+
}
|
|
4963
5006
|
const commentTuple = await client.readContract({
|
|
4964
5007
|
abi: forumAbi,
|
|
4965
5008
|
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
@@ -5005,6 +5048,18 @@ forum.command("petition", {
|
|
|
5005
5048
|
examples: [{ args: { id: 1 }, description: "Fetch petition #1" }],
|
|
5006
5049
|
async run(c) {
|
|
5007
5050
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
5051
|
+
const petitionCount = await client.readContract({
|
|
5052
|
+
abi: forumAbi,
|
|
5053
|
+
address: ABSTRACT_MAINNET_ADDRESSES.forum,
|
|
5054
|
+
functionName: "petitionCount"
|
|
5055
|
+
});
|
|
5056
|
+
if (c.args.id > Number(petitionCount)) {
|
|
5057
|
+
return c.error({
|
|
5058
|
+
code: "OUT_OF_RANGE",
|
|
5059
|
+
message: `Petition id ${c.args.id} does not exist (petitionCount: ${petitionCount})`,
|
|
5060
|
+
retryable: false
|
|
5061
|
+
});
|
|
5062
|
+
}
|
|
5008
5063
|
const petition = decodePetition(
|
|
5009
5064
|
await client.readContract({
|
|
5010
5065
|
abi: forumAbi,
|
|
@@ -5187,16 +5242,19 @@ var governance = Cli3.create("governance", {
|
|
|
5187
5242
|
governance.command("proposals", {
|
|
5188
5243
|
description: "List governance proposals with status and vote end time.",
|
|
5189
5244
|
env: env3,
|
|
5190
|
-
output: z3.
|
|
5191
|
-
z3.
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5245
|
+
output: z3.object({
|
|
5246
|
+
proposals: z3.array(
|
|
5247
|
+
z3.object({
|
|
5248
|
+
id: z3.number(),
|
|
5249
|
+
kind: z3.number(),
|
|
5250
|
+
status: z3.number(),
|
|
5251
|
+
title: z3.string().nullable().optional(),
|
|
5252
|
+
voteEndAt: z3.number(),
|
|
5253
|
+
voteEndRelative: z3.string()
|
|
5254
|
+
})
|
|
5255
|
+
),
|
|
5256
|
+
count: z3.number()
|
|
5257
|
+
}),
|
|
5200
5258
|
examples: [{ description: "List all proposals" }],
|
|
5201
5259
|
async run(c) {
|
|
5202
5260
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
@@ -5216,15 +5274,19 @@ governance.command("proposals", {
|
|
|
5216
5274
|
}))
|
|
5217
5275
|
}) : [];
|
|
5218
5276
|
const proposals = proposalTuples.map(decodeProposal);
|
|
5277
|
+
const items = proposals.map((p, i) => ({
|
|
5278
|
+
id: i + 1,
|
|
5279
|
+
kind: asNum(p.kind),
|
|
5280
|
+
status: asNum(p.status),
|
|
5281
|
+
title: p.title ?? null,
|
|
5282
|
+
voteEndAt: asNum(p.voteEndAt),
|
|
5283
|
+
voteEndRelative: relTime(p.voteEndAt)
|
|
5284
|
+
}));
|
|
5219
5285
|
return c.ok(
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
title: p.title ?? null,
|
|
5225
|
-
voteEndAt: asNum(p.voteEndAt),
|
|
5226
|
-
voteEndRelative: relTime(p.voteEndAt)
|
|
5227
|
-
})),
|
|
5286
|
+
{
|
|
5287
|
+
proposals: items,
|
|
5288
|
+
count: items.length
|
|
5289
|
+
},
|
|
5228
5290
|
{
|
|
5229
5291
|
cta: {
|
|
5230
5292
|
description: "Inspect or vote:",
|
|
@@ -5247,6 +5309,18 @@ governance.command("proposal", {
|
|
|
5247
5309
|
examples: [{ args: { id: 1 }, description: "Fetch proposal #1" }],
|
|
5248
5310
|
async run(c) {
|
|
5249
5311
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
5312
|
+
const proposalCount = await client.readContract({
|
|
5313
|
+
abi: governanceAbi,
|
|
5314
|
+
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
5315
|
+
functionName: "proposalCount"
|
|
5316
|
+
});
|
|
5317
|
+
if (c.args.id > Number(proposalCount)) {
|
|
5318
|
+
return c.error({
|
|
5319
|
+
code: "OUT_OF_RANGE",
|
|
5320
|
+
message: `Proposal id ${c.args.id} does not exist (proposalCount: ${proposalCount})`,
|
|
5321
|
+
retryable: false
|
|
5322
|
+
});
|
|
5323
|
+
}
|
|
5250
5324
|
const proposal = decodeProposal(
|
|
5251
5325
|
await client.readContract({
|
|
5252
5326
|
abi: governanceAbi,
|
|
@@ -5470,17 +5544,20 @@ var members = Cli4.create("members", {
|
|
|
5470
5544
|
members.command("list", {
|
|
5471
5545
|
description: "List members from an indexer snapshot (or Registered event fallback) plus on-chain active state.",
|
|
5472
5546
|
env: env4,
|
|
5473
|
-
output: z4.
|
|
5474
|
-
z4.
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5547
|
+
output: z4.object({
|
|
5548
|
+
members: z4.array(
|
|
5549
|
+
z4.object({
|
|
5550
|
+
address: z4.string(),
|
|
5551
|
+
active: z4.boolean(),
|
|
5552
|
+
registered: z4.boolean(),
|
|
5553
|
+
activeUntil: z4.number(),
|
|
5554
|
+
activeUntilRelative: z4.string(),
|
|
5555
|
+
lastHeartbeatAt: z4.number(),
|
|
5556
|
+
lastHeartbeatRelative: z4.string()
|
|
5557
|
+
})
|
|
5558
|
+
),
|
|
5559
|
+
count: z4.number()
|
|
5560
|
+
}),
|
|
5484
5561
|
examples: [
|
|
5485
5562
|
{ description: "List members using default indexer snapshot" },
|
|
5486
5563
|
{ description: "Override ASSEMBLY_INDEXER_URL to use a custom snapshot source" }
|
|
@@ -5549,11 +5626,9 @@ members.command("list", {
|
|
|
5549
5626
|
lastHeartbeatRelative: relTime(info.lastHeartbeatAt)
|
|
5550
5627
|
};
|
|
5551
5628
|
});
|
|
5552
|
-
return c.ok(
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
commands: [{ command: "members info", args: { address: "<addr>" } }]
|
|
5556
|
-
}
|
|
5629
|
+
return c.ok({
|
|
5630
|
+
members: rows,
|
|
5631
|
+
count: rows.length
|
|
5557
5632
|
});
|
|
5558
5633
|
}
|
|
5559
5634
|
});
|
|
@@ -5774,6 +5849,18 @@ treasury.command("executed", {
|
|
|
5774
5849
|
examples: [{ args: { proposalId: 1 }, description: "Check execution status for proposal #1" }],
|
|
5775
5850
|
async run(c) {
|
|
5776
5851
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
5852
|
+
const proposalCount = await client.readContract({
|
|
5853
|
+
abi: governanceAbi,
|
|
5854
|
+
address: ABSTRACT_MAINNET_ADDRESSES.governance,
|
|
5855
|
+
functionName: "proposalCount"
|
|
5856
|
+
});
|
|
5857
|
+
if (c.args.proposalId > Number(proposalCount)) {
|
|
5858
|
+
return c.error({
|
|
5859
|
+
code: "OUT_OF_RANGE",
|
|
5860
|
+
message: `Proposal id ${c.args.proposalId} does not exist (proposalCount: ${proposalCount})`,
|
|
5861
|
+
retryable: false
|
|
5862
|
+
});
|
|
5863
|
+
}
|
|
5777
5864
|
const executed = await client.readContract({
|
|
5778
5865
|
abi: treasuryAbi,
|
|
5779
5866
|
address: ABSTRACT_MAINNET_ADDRESSES.treasury,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectratools/assembly-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "CLI for Assembly governance on Abstract (members, council, forum, proposals, and treasury).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,12 +28,6 @@
|
|
|
28
28
|
"bin": {
|
|
29
29
|
"assembly-cli": "./dist/cli.js"
|
|
30
30
|
},
|
|
31
|
-
"exports": {
|
|
32
|
-
".": {
|
|
33
|
-
"types": "./dist/index.d.ts",
|
|
34
|
-
"default": "./dist/index.js"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
31
|
"dependencies": {
|
|
38
32
|
"incur": "^0.2.2",
|
|
39
33
|
"ox": "^0.14.0",
|