@spectratools/assembly-cli 0.4.1 → 0.5.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 +100 -35
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -27,6 +27,19 @@ function relTime(unixSeconds) {
|
|
|
27
27
|
const label = h > 0 ? `${h}h ${m}m` : `${m}m`;
|
|
28
28
|
return delta >= 0 ? `in ${label}` : `${label} ago`;
|
|
29
29
|
}
|
|
30
|
+
function isoTime(unixSeconds) {
|
|
31
|
+
const ts = typeof unixSeconds === "bigint" ? Number(unixSeconds) : unixSeconds;
|
|
32
|
+
if (!Number.isFinite(ts) || ts <= 0) return "n/a";
|
|
33
|
+
try {
|
|
34
|
+
return new Date(ts * 1e3).toISOString().replace(".000Z", "Z");
|
|
35
|
+
} catch {
|
|
36
|
+
return "n/a";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function timeValue(unixSeconds, format) {
|
|
40
|
+
if (format === "json" || format === "jsonl") return isoTime(unixSeconds);
|
|
41
|
+
return typeof unixSeconds === "bigint" ? Number(unixSeconds) : unixSeconds;
|
|
42
|
+
}
|
|
30
43
|
function asNum(value) {
|
|
31
44
|
return Number(value);
|
|
32
45
|
}
|
|
@@ -4314,6 +4327,7 @@ function createAssemblyPublicClient(rpcUrl) {
|
|
|
4314
4327
|
var env = z.object({
|
|
4315
4328
|
ABSTRACT_RPC_URL: z.string().optional().describe("Abstract RPC URL override")
|
|
4316
4329
|
});
|
|
4330
|
+
var timestampOutput = z.union([z.number(), z.string()]);
|
|
4317
4331
|
function decodeSeat(value) {
|
|
4318
4332
|
const [owner, startAt, endAt, forfeited] = value;
|
|
4319
4333
|
return { owner, startAt, endAt, forfeited };
|
|
@@ -4337,9 +4351,9 @@ council.command("seats", {
|
|
|
4337
4351
|
z.object({
|
|
4338
4352
|
id: z.number(),
|
|
4339
4353
|
owner: z.string(),
|
|
4340
|
-
startAt:
|
|
4354
|
+
startAt: timestampOutput,
|
|
4341
4355
|
startAtRelative: z.string(),
|
|
4342
|
-
endAt:
|
|
4356
|
+
endAt: timestampOutput,
|
|
4343
4357
|
endAtRelative: z.string(),
|
|
4344
4358
|
forfeited: z.boolean()
|
|
4345
4359
|
})
|
|
@@ -4367,9 +4381,9 @@ council.command("seats", {
|
|
|
4367
4381
|
seats.map((seat, idx) => ({
|
|
4368
4382
|
id: idx,
|
|
4369
4383
|
owner: toChecksum(seat.owner),
|
|
4370
|
-
startAt:
|
|
4384
|
+
startAt: timeValue(seat.startAt, c.format),
|
|
4371
4385
|
startAtRelative: relTime(seat.startAt),
|
|
4372
|
-
endAt:
|
|
4386
|
+
endAt: timeValue(seat.endAt, c.format),
|
|
4373
4387
|
endAtRelative: relTime(seat.endAt),
|
|
4374
4388
|
forfeited: seat.forfeited
|
|
4375
4389
|
}))
|
|
@@ -4385,8 +4399,8 @@ council.command("seat", {
|
|
|
4385
4399
|
output: z.object({
|
|
4386
4400
|
id: z.number(),
|
|
4387
4401
|
owner: z.string(),
|
|
4388
|
-
startAt:
|
|
4389
|
-
endAt:
|
|
4402
|
+
startAt: timestampOutput,
|
|
4403
|
+
endAt: timestampOutput,
|
|
4390
4404
|
forfeited: z.boolean(),
|
|
4391
4405
|
endAtRelative: z.string()
|
|
4392
4406
|
}),
|
|
@@ -4415,8 +4429,8 @@ council.command("seat", {
|
|
|
4415
4429
|
return c.ok({
|
|
4416
4430
|
id: c.args.id,
|
|
4417
4431
|
owner: toChecksum(seat.owner),
|
|
4418
|
-
startAt:
|
|
4419
|
-
endAt:
|
|
4432
|
+
startAt: timeValue(seat.startAt, c.format),
|
|
4433
|
+
endAt: timeValue(seat.endAt, c.format),
|
|
4420
4434
|
forfeited: seat.forfeited,
|
|
4421
4435
|
endAtRelative: relTime(seat.endAt)
|
|
4422
4436
|
});
|
|
@@ -4539,7 +4553,7 @@ council.command("auctions", {
|
|
|
4539
4553
|
highestBidder: z.string(),
|
|
4540
4554
|
highestBid: z.string(),
|
|
4541
4555
|
settled: z.boolean(),
|
|
4542
|
-
windowEnd:
|
|
4556
|
+
windowEnd: timestampOutput,
|
|
4543
4557
|
windowEndRelative: z.string(),
|
|
4544
4558
|
status: z.enum(["bidding", "closed", "settled"])
|
|
4545
4559
|
})
|
|
@@ -4605,7 +4619,7 @@ council.command("auctions", {
|
|
|
4605
4619
|
highestBidder: toChecksum(auctions[i].highestBidder),
|
|
4606
4620
|
highestBid: eth(auctions[i].highestBid),
|
|
4607
4621
|
settled: auctions[i].settled,
|
|
4608
|
-
windowEnd:
|
|
4622
|
+
windowEnd: timeValue(windowEnd, c.format),
|
|
4609
4623
|
windowEndRelative: relTime(windowEnd),
|
|
4610
4624
|
status: deriveAuctionStatus({
|
|
4611
4625
|
settled: auctions[i].settled,
|
|
@@ -4615,7 +4629,7 @@ council.command("auctions", {
|
|
|
4615
4629
|
};
|
|
4616
4630
|
})
|
|
4617
4631
|
},
|
|
4618
|
-
{
|
|
4632
|
+
c.format === "json" || c.format === "jsonl" ? void 0 : {
|
|
4619
4633
|
cta: {
|
|
4620
4634
|
description: "Inspect and bid:",
|
|
4621
4635
|
commands: [
|
|
@@ -4640,7 +4654,7 @@ council.command("auction", {
|
|
|
4640
4654
|
highestBidder: z.string(),
|
|
4641
4655
|
highestBid: z.string(),
|
|
4642
4656
|
settled: z.boolean(),
|
|
4643
|
-
windowEnd:
|
|
4657
|
+
windowEnd: timestampOutput,
|
|
4644
4658
|
windowEndRelative: z.string(),
|
|
4645
4659
|
status: z.enum(["bidding", "closed", "settled"])
|
|
4646
4660
|
}),
|
|
@@ -4671,7 +4685,7 @@ council.command("auction", {
|
|
|
4671
4685
|
highestBidder: toChecksum(auction.highestBidder),
|
|
4672
4686
|
highestBid: eth(auction.highestBid),
|
|
4673
4687
|
settled: auction.settled,
|
|
4674
|
-
windowEnd:
|
|
4688
|
+
windowEnd: timeValue(windowEndTimestamp, c.format),
|
|
4675
4689
|
windowEndRelative: relTime(windowEndTimestamp),
|
|
4676
4690
|
status: deriveAuctionStatus({
|
|
4677
4691
|
settled: auction.settled,
|
|
@@ -4779,6 +4793,7 @@ import { Cli as Cli2, z as z2 } from "incur";
|
|
|
4779
4793
|
var env2 = z2.object({
|
|
4780
4794
|
ABSTRACT_RPC_URL: z2.string().optional().describe("Abstract RPC URL override")
|
|
4781
4795
|
});
|
|
4796
|
+
var timestampOutput2 = z2.union([z2.number(), z2.string()]);
|
|
4782
4797
|
function decodeThread(value) {
|
|
4783
4798
|
const [id, kind, author, createdAt, category, title, body, proposalId, petitionId] = value;
|
|
4784
4799
|
return {
|
|
@@ -4842,7 +4857,7 @@ forum.command("threads", {
|
|
|
4842
4857
|
id: z2.number(),
|
|
4843
4858
|
kind: z2.number(),
|
|
4844
4859
|
author: z2.string(),
|
|
4845
|
-
createdAt:
|
|
4860
|
+
createdAt: timestampOutput2,
|
|
4846
4861
|
createdAtRelative: z2.string(),
|
|
4847
4862
|
category: z2.string().nullable().optional(),
|
|
4848
4863
|
title: z2.string().nullable().optional()
|
|
@@ -4873,7 +4888,7 @@ forum.command("threads", {
|
|
|
4873
4888
|
id: x.id,
|
|
4874
4889
|
kind: x.kind,
|
|
4875
4890
|
author: x.author,
|
|
4876
|
-
createdAt: x.createdAt,
|
|
4891
|
+
createdAt: timeValue(x.createdAt, c.format),
|
|
4877
4892
|
createdAtRelative: relTime(x.createdAt),
|
|
4878
4893
|
category: x.category ?? null,
|
|
4879
4894
|
title: x.title ?? null
|
|
@@ -4883,7 +4898,7 @@ forum.command("threads", {
|
|
|
4883
4898
|
threads,
|
|
4884
4899
|
count: threads.length
|
|
4885
4900
|
},
|
|
4886
|
-
{
|
|
4901
|
+
c.format === "json" || c.format === "jsonl" ? void 0 : {
|
|
4887
4902
|
cta: {
|
|
4888
4903
|
description: "Inspect or comment:",
|
|
4889
4904
|
commands: [
|
|
@@ -5158,6 +5173,48 @@ import { Cli as Cli3, z as z3 } from "incur";
|
|
|
5158
5173
|
var env3 = z3.object({
|
|
5159
5174
|
ABSTRACT_RPC_URL: z3.string().optional().describe("Abstract RPC URL override")
|
|
5160
5175
|
});
|
|
5176
|
+
var timestampOutput3 = z3.union([z3.number(), z3.string()]);
|
|
5177
|
+
var proposalStatusLabels = {
|
|
5178
|
+
0: "pending",
|
|
5179
|
+
1: "active",
|
|
5180
|
+
2: "passed",
|
|
5181
|
+
3: "executed",
|
|
5182
|
+
4: "defeated",
|
|
5183
|
+
5: "cancelled"
|
|
5184
|
+
};
|
|
5185
|
+
function proposalStatus(status) {
|
|
5186
|
+
const statusCode = asNum(status);
|
|
5187
|
+
return {
|
|
5188
|
+
status: proposalStatusLabels[statusCode] ?? `unknown-${statusCode}`,
|
|
5189
|
+
statusCode
|
|
5190
|
+
};
|
|
5191
|
+
}
|
|
5192
|
+
var proposalOutputSchema = z3.object({
|
|
5193
|
+
kind: z3.number(),
|
|
5194
|
+
configRiskTier: z3.number(),
|
|
5195
|
+
origin: z3.number(),
|
|
5196
|
+
status: z3.string(),
|
|
5197
|
+
statusCode: z3.number(),
|
|
5198
|
+
proposer: z3.string(),
|
|
5199
|
+
threadId: z3.number(),
|
|
5200
|
+
petitionId: z3.number(),
|
|
5201
|
+
createdAt: z3.number(),
|
|
5202
|
+
deliberationEndsAt: z3.number(),
|
|
5203
|
+
voteStartAt: z3.number(),
|
|
5204
|
+
voteEndAt: z3.number(),
|
|
5205
|
+
timelockEndsAt: z3.number(),
|
|
5206
|
+
activeSeatsSnapshot: z3.number(),
|
|
5207
|
+
forVotes: z3.string(),
|
|
5208
|
+
againstVotes: z3.string(),
|
|
5209
|
+
abstainVotes: z3.string(),
|
|
5210
|
+
amount: z3.string(),
|
|
5211
|
+
snapshotAssetBalance: z3.string(),
|
|
5212
|
+
transferIntent: z3.boolean(),
|
|
5213
|
+
intentDeadline: z3.number(),
|
|
5214
|
+
intentMaxRiskTier: z3.number(),
|
|
5215
|
+
title: z3.string(),
|
|
5216
|
+
description: z3.string()
|
|
5217
|
+
});
|
|
5161
5218
|
function decodeProposal(value) {
|
|
5162
5219
|
const [
|
|
5163
5220
|
kind,
|
|
@@ -5211,11 +5268,13 @@ function decodeProposal(value) {
|
|
|
5211
5268
|
};
|
|
5212
5269
|
}
|
|
5213
5270
|
function serializeProposal(proposal) {
|
|
5271
|
+
const status = proposalStatus(proposal.status);
|
|
5214
5272
|
return {
|
|
5215
5273
|
kind: asNum(proposal.kind),
|
|
5216
5274
|
configRiskTier: asNum(proposal.configRiskTier),
|
|
5217
5275
|
origin: asNum(proposal.origin),
|
|
5218
|
-
status:
|
|
5276
|
+
status: status.status,
|
|
5277
|
+
statusCode: status.statusCode,
|
|
5219
5278
|
proposer: proposal.proposer,
|
|
5220
5279
|
threadId: asNum(proposal.threadId),
|
|
5221
5280
|
petitionId: asNum(proposal.petitionId),
|
|
@@ -5248,9 +5307,10 @@ governance.command("proposals", {
|
|
|
5248
5307
|
z3.object({
|
|
5249
5308
|
id: z3.number(),
|
|
5250
5309
|
kind: z3.number(),
|
|
5251
|
-
status: z3.
|
|
5310
|
+
status: z3.string(),
|
|
5311
|
+
statusCode: z3.number(),
|
|
5252
5312
|
title: z3.string().nullable().optional(),
|
|
5253
|
-
voteEndAt:
|
|
5313
|
+
voteEndAt: timestampOutput3,
|
|
5254
5314
|
voteEndRelative: z3.string()
|
|
5255
5315
|
})
|
|
5256
5316
|
),
|
|
@@ -5276,11 +5336,11 @@ governance.command("proposals", {
|
|
|
5276
5336
|
}) : [];
|
|
5277
5337
|
const proposals = proposalTuples.map(decodeProposal);
|
|
5278
5338
|
const items = proposals.map((p, i) => ({
|
|
5339
|
+
...proposalStatus(p.status),
|
|
5279
5340
|
id: i + 1,
|
|
5280
5341
|
kind: asNum(p.kind),
|
|
5281
|
-
status: asNum(p.status),
|
|
5282
5342
|
title: p.title ?? null,
|
|
5283
|
-
voteEndAt:
|
|
5343
|
+
voteEndAt: timeValue(p.voteEndAt, c.format),
|
|
5284
5344
|
voteEndRelative: relTime(p.voteEndAt)
|
|
5285
5345
|
}));
|
|
5286
5346
|
return c.ok(
|
|
@@ -5288,7 +5348,7 @@ governance.command("proposals", {
|
|
|
5288
5348
|
proposals: items,
|
|
5289
5349
|
count: items.length
|
|
5290
5350
|
},
|
|
5291
|
-
{
|
|
5351
|
+
c.format === "json" || c.format === "jsonl" ? void 0 : {
|
|
5292
5352
|
cta: {
|
|
5293
5353
|
description: "Inspect or vote:",
|
|
5294
5354
|
commands: [
|
|
@@ -5306,7 +5366,7 @@ governance.command("proposal", {
|
|
|
5306
5366
|
id: z3.coerce.number().int().positive().describe("Proposal id (1-indexed)")
|
|
5307
5367
|
}),
|
|
5308
5368
|
env: env3,
|
|
5309
|
-
output:
|
|
5369
|
+
output: proposalOutputSchema,
|
|
5310
5370
|
examples: [{ args: { id: 1 }, description: "Fetch proposal #1" }],
|
|
5311
5371
|
async run(c) {
|
|
5312
5372
|
const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
|
|
@@ -5437,6 +5497,7 @@ var env4 = z4.object({
|
|
|
5437
5497
|
ABSTRACT_RPC_URL: z4.string().optional().describe("Abstract RPC URL override"),
|
|
5438
5498
|
ASSEMBLY_INDEXER_URL: z4.string().optional().describe("Optional members snapshot endpoint (default: theaiassembly.org indexer)")
|
|
5439
5499
|
});
|
|
5500
|
+
var timestampOutput4 = z4.union([z4.number(), z4.string()]);
|
|
5440
5501
|
var memberSnapshotSchema = z4.array(z4.string());
|
|
5441
5502
|
var AssemblyApiValidationError = class extends Error {
|
|
5442
5503
|
constructor(details) {
|
|
@@ -5551,9 +5612,9 @@ members.command("list", {
|
|
|
5551
5612
|
address: z4.string(),
|
|
5552
5613
|
active: z4.boolean(),
|
|
5553
5614
|
registered: z4.boolean(),
|
|
5554
|
-
activeUntil:
|
|
5615
|
+
activeUntil: timestampOutput4,
|
|
5555
5616
|
activeUntilRelative: z4.string(),
|
|
5556
|
-
lastHeartbeatAt:
|
|
5617
|
+
lastHeartbeatAt: timestampOutput4,
|
|
5557
5618
|
lastHeartbeatRelative: z4.string()
|
|
5558
5619
|
})
|
|
5559
5620
|
),
|
|
@@ -5621,9 +5682,9 @@ members.command("list", {
|
|
|
5621
5682
|
address: toChecksum(address),
|
|
5622
5683
|
active,
|
|
5623
5684
|
registered: info.registered,
|
|
5624
|
-
activeUntil:
|
|
5685
|
+
activeUntil: timeValue(info.activeUntil, c.format),
|
|
5625
5686
|
activeUntilRelative: relTime(info.activeUntil),
|
|
5626
|
-
lastHeartbeatAt:
|
|
5687
|
+
lastHeartbeatAt: timeValue(info.lastHeartbeatAt, c.format),
|
|
5627
5688
|
lastHeartbeatRelative: relTime(info.lastHeartbeatAt)
|
|
5628
5689
|
};
|
|
5629
5690
|
});
|
|
@@ -5642,8 +5703,8 @@ members.command("info", {
|
|
|
5642
5703
|
output: z4.object({
|
|
5643
5704
|
address: z4.string(),
|
|
5644
5705
|
active: z4.boolean(),
|
|
5645
|
-
activeUntil:
|
|
5646
|
-
lastHeartbeatAt:
|
|
5706
|
+
activeUntil: timestampOutput4,
|
|
5707
|
+
lastHeartbeatAt: timestampOutput4,
|
|
5647
5708
|
activeUntilRelative: z4.string(),
|
|
5648
5709
|
lastHeartbeatRelative: z4.string()
|
|
5649
5710
|
}),
|
|
@@ -5672,8 +5733,8 @@ members.command("info", {
|
|
|
5672
5733
|
return c.ok({
|
|
5673
5734
|
address: toChecksum(c.args.address),
|
|
5674
5735
|
active,
|
|
5675
|
-
activeUntil:
|
|
5676
|
-
lastHeartbeatAt:
|
|
5736
|
+
activeUntil: timeValue(member.activeUntil, c.format),
|
|
5737
|
+
lastHeartbeatAt: timeValue(member.lastHeartbeatAt, c.format),
|
|
5677
5738
|
activeUntilRelative: relTime(member.activeUntil),
|
|
5678
5739
|
lastHeartbeatRelative: relTime(member.lastHeartbeatAt)
|
|
5679
5740
|
});
|
|
@@ -5749,6 +5810,7 @@ import { Cli as Cli5, z as z5 } from "incur";
|
|
|
5749
5810
|
var env5 = z5.object({
|
|
5750
5811
|
ABSTRACT_RPC_URL: z5.string().optional().describe("Abstract RPC URL override")
|
|
5751
5812
|
});
|
|
5813
|
+
var timestampOutput5 = z5.union([z5.number(), z5.string()]);
|
|
5752
5814
|
var treasury = Cli5.create("treasury", {
|
|
5753
5815
|
description: "Inspect treasury balances, execution status, and spend controls."
|
|
5754
5816
|
});
|
|
@@ -5803,7 +5865,7 @@ treasury.command("major-spend-status", {
|
|
|
5803
5865
|
env: env5,
|
|
5804
5866
|
output: z5.object({
|
|
5805
5867
|
majorSpendCooldownSeconds: z5.number(),
|
|
5806
|
-
lastMajorSpendAt:
|
|
5868
|
+
lastMajorSpendAt: timestampOutput5,
|
|
5807
5869
|
lastMajorSpendRelative: z5.string(),
|
|
5808
5870
|
isMajorSpendAllowed: z5.boolean()
|
|
5809
5871
|
}),
|
|
@@ -5831,7 +5893,7 @@ treasury.command("major-spend-status", {
|
|
|
5831
5893
|
]);
|
|
5832
5894
|
return c.ok({
|
|
5833
5895
|
majorSpendCooldownSeconds: asNum(cooldown),
|
|
5834
|
-
lastMajorSpendAt:
|
|
5896
|
+
lastMajorSpendAt: timeValue(lastMajorSpendAt, c.format),
|
|
5835
5897
|
lastMajorSpendRelative: relTime(lastMajorSpendAt),
|
|
5836
5898
|
isMajorSpendAllowed: allowed
|
|
5837
5899
|
});
|
|
@@ -6011,6 +6073,7 @@ cli.command(treasury);
|
|
|
6011
6073
|
var rootEnv = z6.object({
|
|
6012
6074
|
ABSTRACT_RPC_URL: z6.string().optional().describe("Abstract RPC URL override")
|
|
6013
6075
|
});
|
|
6076
|
+
var timestampOutput6 = z6.union([z6.number(), z6.string()]);
|
|
6014
6077
|
cli.command("status", {
|
|
6015
6078
|
description: "Get a cross-contract Assembly snapshot (members, council, governance, treasury).",
|
|
6016
6079
|
env: rootEnv,
|
|
@@ -6079,7 +6142,8 @@ cli.command("health", {
|
|
|
6079
6142
|
output: z6.object({
|
|
6080
6143
|
address: z6.string(),
|
|
6081
6144
|
isActive: z6.boolean(),
|
|
6082
|
-
activeUntil:
|
|
6145
|
+
activeUntil: timestampOutput6,
|
|
6146
|
+
activeUntilRelative: z6.string(),
|
|
6083
6147
|
isCouncilMember: z6.boolean(),
|
|
6084
6148
|
pendingReturnsWei: z6.string(),
|
|
6085
6149
|
votingPower: z6.number()
|
|
@@ -6127,7 +6191,8 @@ cli.command("health", {
|
|
|
6127
6191
|
return c.ok({
|
|
6128
6192
|
address: toChecksum(c.args.address),
|
|
6129
6193
|
isActive,
|
|
6130
|
-
activeUntil:
|
|
6194
|
+
activeUntil: timeValue(member.activeUntil, c.format),
|
|
6195
|
+
activeUntilRelative: relTime(member.activeUntil),
|
|
6131
6196
|
isCouncilMember,
|
|
6132
6197
|
pendingReturnsWei: pendingReturns.toString(),
|
|
6133
6198
|
votingPower: Number(votingPower)
|