@spectratools/aborean-cli 0.10.3 → 0.10.5

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.
Files changed (3) hide show
  1. package/dist/cli.js +157 -148
  2. package/dist/index.js +6646 -0
  3. package/package.json +9 -3
package/dist/cli.js CHANGED
@@ -5,6 +5,11 @@ import { readFileSync } from "fs";
5
5
  import { dirname, resolve } from "path";
6
6
  import { fileURLToPath } from "url";
7
7
  import { checksumAddress as checksumAddress6 } from "@spectratools/cli-shared";
8
+ import {
9
+ initTelemetry,
10
+ shutdownTelemetry,
11
+ withCommandSpan
12
+ } from "@spectratools/cli-shared/telemetry";
8
13
  import { Cli as Cli8, z as z9 } from "incur";
9
14
  import { formatUnits as formatUnits4 } from "viem";
10
15
 
@@ -6478,159 +6483,163 @@ cli.command("status", {
6478
6483
  }),
6479
6484
  examples: [{ description: "Fetch the current Aborean protocol status" }],
6480
6485
  async run(c) {
6481
- const client = createAboreanPublicClient(c.env.ABSTRACT_RPC_URL);
6482
- const [
6483
- v2PoolCount,
6484
- clPoolCount,
6485
- gaugeCount,
6486
- totalVotingWeight,
6487
- veABXTotalSupply,
6488
- veABXLockedSupply,
6489
- activePeriod,
6490
- weekSeconds,
6491
- epochCount,
6492
- weeklyEmission,
6493
- v2PoolSnapshot
6494
- ] = await Promise.all([
6495
- client.readContract({
6496
- abi: poolFactoryAbi,
6497
- address: ABOREAN_V2_ADDRESSES.poolFactory,
6498
- functionName: "allPoolsLength"
6499
- }),
6500
- client.readContract({
6501
- abi: clFactoryAbi,
6502
- address: ABOREAN_CL_ADDRESSES.clFactory,
6503
- functionName: "allPoolsLength"
6504
- }),
6505
- client.readContract({
6506
- abi: voterAbi,
6507
- address: ABOREAN_V2_ADDRESSES.voter,
6508
- functionName: "length"
6509
- }),
6510
- client.readContract({
6511
- abi: voterAbi,
6512
- address: ABOREAN_V2_ADDRESSES.voter,
6513
- functionName: "totalWeight"
6514
- }),
6515
- client.readContract({
6516
- abi: votingEscrowAbi,
6517
- address: ABOREAN_V2_ADDRESSES.votingEscrow,
6518
- functionName: "totalSupply"
6519
- }),
6520
- client.readContract({
6521
- abi: votingEscrowAbi,
6522
- address: ABOREAN_V2_ADDRESSES.votingEscrow,
6523
- functionName: "supply"
6524
- }),
6525
- client.readContract({
6526
- abi: minterAbi,
6527
- address: ABOREAN_V2_ADDRESSES.minter,
6528
- functionName: "activePeriod"
6529
- }),
6530
- client.readContract({
6531
- abi: minterAbi,
6532
- address: ABOREAN_V2_ADDRESSES.minter,
6533
- functionName: "WEEK"
6534
- }),
6535
- client.readContract({
6536
- abi: minterAbi,
6537
- address: ABOREAN_V2_ADDRESSES.minter,
6538
- functionName: "epochCount"
6539
- }),
6540
- client.readContract({
6541
- abi: minterAbi,
6542
- address: ABOREAN_V2_ADDRESSES.minter,
6543
- functionName: "weekly"
6544
- }),
6545
- readTopV2PoolsSnapshot(client, 5)
6546
- ]);
6547
- let vaultRelayCount = 0;
6548
- let vaultManagedVotingPower = "0";
6549
- let vaultNote = null;
6550
- try {
6551
- const vaultSnapshot = await readVaultSummary(client);
6552
- vaultRelayCount = vaultSnapshot.relayCount;
6553
- vaultManagedVotingPower = vaultSnapshot.totals.managedVotingPower;
6554
- } catch (error) {
6555
- vaultNote = error instanceof Error ? error.message : "vault snapshot unavailable";
6556
- }
6557
- let lendingAvailable = false;
6558
- let lendingMarketCount = 0;
6559
- let lendingMorpho = "";
6560
- let lendingSupplyByLoanToken = [];
6561
- let lendingNote = null;
6562
- try {
6563
- const lendingSnapshot = await readLendingSummary(client);
6564
- lendingAvailable = lendingSnapshot.available;
6565
- lendingMarketCount = lendingSnapshot.marketCount;
6566
- lendingMorpho = lendingSnapshot.morpho;
6567
- lendingSupplyByLoanToken = lendingSnapshot.supplyByLoanToken;
6568
- } catch (error) {
6569
- lendingMorpho = "";
6570
- lendingNote = error instanceof Error ? error.message : "lending snapshot unavailable";
6571
- }
6572
- const now = Math.floor(Date.now() / 1e3);
6573
- const epochEnd = Number(activePeriod) + Number(weekSeconds);
6574
- return c.ok(
6575
- {
6576
- v2PoolCount: Number(v2PoolCount),
6577
- clPoolCount: Number(clPoolCount),
6578
- gaugeCount: Number(gaugeCount),
6579
- totalVotingWeight: String(totalVotingWeight),
6580
- veABXTotalSupply: String(veABXTotalSupply),
6581
- veABXLockedSupply: String(veABXLockedSupply),
6582
- epoch: {
6583
- activePeriod: Number(activePeriod),
6584
- epochEnd,
6585
- secondsRemaining: Math.max(0, epochEnd - now),
6586
- epochCount: Number(epochCount),
6587
- weeklyEmission: String(weeklyEmission)
6588
- },
6589
- topPools: v2PoolSnapshot.topPools,
6590
- tvl: {
6591
- v2ReserveUnitEstimate: v2PoolSnapshot.reserveUnitTvl,
6592
- vaultManagedVotingPower
6593
- },
6594
- vaults: {
6595
- relayCount: vaultRelayCount,
6596
- managedVotingPower: vaultManagedVotingPower,
6597
- note: vaultNote
6486
+ return withCommandSpan("aborean status", {}, async () => {
6487
+ const client = createAboreanPublicClient(c.env.ABSTRACT_RPC_URL);
6488
+ const [
6489
+ v2PoolCount,
6490
+ clPoolCount,
6491
+ gaugeCount,
6492
+ totalVotingWeight,
6493
+ veABXTotalSupply,
6494
+ veABXLockedSupply,
6495
+ activePeriod,
6496
+ weekSeconds,
6497
+ epochCount,
6498
+ weeklyEmission,
6499
+ v2PoolSnapshot
6500
+ ] = await Promise.all([
6501
+ client.readContract({
6502
+ abi: poolFactoryAbi,
6503
+ address: ABOREAN_V2_ADDRESSES.poolFactory,
6504
+ functionName: "allPoolsLength"
6505
+ }),
6506
+ client.readContract({
6507
+ abi: clFactoryAbi,
6508
+ address: ABOREAN_CL_ADDRESSES.clFactory,
6509
+ functionName: "allPoolsLength"
6510
+ }),
6511
+ client.readContract({
6512
+ abi: voterAbi,
6513
+ address: ABOREAN_V2_ADDRESSES.voter,
6514
+ functionName: "length"
6515
+ }),
6516
+ client.readContract({
6517
+ abi: voterAbi,
6518
+ address: ABOREAN_V2_ADDRESSES.voter,
6519
+ functionName: "totalWeight"
6520
+ }),
6521
+ client.readContract({
6522
+ abi: votingEscrowAbi,
6523
+ address: ABOREAN_V2_ADDRESSES.votingEscrow,
6524
+ functionName: "totalSupply"
6525
+ }),
6526
+ client.readContract({
6527
+ abi: votingEscrowAbi,
6528
+ address: ABOREAN_V2_ADDRESSES.votingEscrow,
6529
+ functionName: "supply"
6530
+ }),
6531
+ client.readContract({
6532
+ abi: minterAbi,
6533
+ address: ABOREAN_V2_ADDRESSES.minter,
6534
+ functionName: "activePeriod"
6535
+ }),
6536
+ client.readContract({
6537
+ abi: minterAbi,
6538
+ address: ABOREAN_V2_ADDRESSES.minter,
6539
+ functionName: "WEEK"
6540
+ }),
6541
+ client.readContract({
6542
+ abi: minterAbi,
6543
+ address: ABOREAN_V2_ADDRESSES.minter,
6544
+ functionName: "epochCount"
6545
+ }),
6546
+ client.readContract({
6547
+ abi: minterAbi,
6548
+ address: ABOREAN_V2_ADDRESSES.minter,
6549
+ functionName: "weekly"
6550
+ }),
6551
+ readTopV2PoolsSnapshot(client, 5)
6552
+ ]);
6553
+ let vaultRelayCount = 0;
6554
+ let vaultManagedVotingPower = "0";
6555
+ let vaultNote = null;
6556
+ try {
6557
+ const vaultSnapshot = await readVaultSummary(client);
6558
+ vaultRelayCount = vaultSnapshot.relayCount;
6559
+ vaultManagedVotingPower = vaultSnapshot.totals.managedVotingPower;
6560
+ } catch (error) {
6561
+ vaultNote = error instanceof Error ? error.message : "vault snapshot unavailable";
6562
+ }
6563
+ let lendingAvailable = false;
6564
+ let lendingMarketCount = 0;
6565
+ let lendingMorpho = "";
6566
+ let lendingSupplyByLoanToken = [];
6567
+ let lendingNote = null;
6568
+ try {
6569
+ const lendingSnapshot = await readLendingSummary(client);
6570
+ lendingAvailable = lendingSnapshot.available;
6571
+ lendingMarketCount = lendingSnapshot.marketCount;
6572
+ lendingMorpho = lendingSnapshot.morpho;
6573
+ lendingSupplyByLoanToken = lendingSnapshot.supplyByLoanToken;
6574
+ } catch (error) {
6575
+ lendingMorpho = "";
6576
+ lendingNote = error instanceof Error ? error.message : "lending snapshot unavailable";
6577
+ }
6578
+ const now = Math.floor(Date.now() / 1e3);
6579
+ const epochEnd = Number(activePeriod) + Number(weekSeconds);
6580
+ return c.ok(
6581
+ {
6582
+ v2PoolCount: Number(v2PoolCount),
6583
+ clPoolCount: Number(clPoolCount),
6584
+ gaugeCount: Number(gaugeCount),
6585
+ totalVotingWeight: String(totalVotingWeight),
6586
+ veABXTotalSupply: String(veABXTotalSupply),
6587
+ veABXLockedSupply: String(veABXLockedSupply),
6588
+ epoch: {
6589
+ activePeriod: Number(activePeriod),
6590
+ epochEnd,
6591
+ secondsRemaining: Math.max(0, epochEnd - now),
6592
+ epochCount: Number(epochCount),
6593
+ weeklyEmission: String(weeklyEmission)
6594
+ },
6595
+ topPools: v2PoolSnapshot.topPools,
6596
+ tvl: {
6597
+ v2ReserveUnitEstimate: v2PoolSnapshot.reserveUnitTvl,
6598
+ vaultManagedVotingPower
6599
+ },
6600
+ vaults: {
6601
+ relayCount: vaultRelayCount,
6602
+ managedVotingPower: vaultManagedVotingPower,
6603
+ note: vaultNote
6604
+ },
6605
+ lending: {
6606
+ available: lendingAvailable,
6607
+ morpho: lendingMorpho,
6608
+ marketCount: lendingMarketCount,
6609
+ supplyByLoanToken: lendingSupplyByLoanToken,
6610
+ note: lendingNote
6611
+ }
6598
6612
  },
6599
- lending: {
6600
- available: lendingAvailable,
6601
- morpho: lendingMorpho,
6602
- marketCount: lendingMarketCount,
6603
- supplyByLoanToken: lendingSupplyByLoanToken,
6604
- note: lendingNote
6605
- }
6606
- },
6607
- c.format === "json" || c.format === "jsonl" ? void 0 : {
6608
- cta: {
6609
- description: "Drill down:",
6610
- commands: [
6611
- {
6612
- command: "pools list",
6613
- description: "List V2 AMM pools"
6614
- },
6615
- {
6616
- command: "cl pools",
6617
- description: "List Slipstream CL pools"
6618
- },
6619
- {
6620
- command: "gauges list",
6621
- description: "List active gauges"
6622
- },
6623
- {
6624
- command: "ve stats",
6625
- description: "View veABX global stats"
6626
- }
6627
- ]
6613
+ c.format === "json" || c.format === "jsonl" ? void 0 : {
6614
+ cta: {
6615
+ description: "Drill down:",
6616
+ commands: [
6617
+ {
6618
+ command: "pools list",
6619
+ description: "List V2 AMM pools"
6620
+ },
6621
+ {
6622
+ command: "cl pools",
6623
+ description: "List Slipstream CL pools"
6624
+ },
6625
+ {
6626
+ command: "gauges list",
6627
+ description: "List active gauges"
6628
+ },
6629
+ {
6630
+ command: "ve stats",
6631
+ description: "View veABX global stats"
6632
+ }
6633
+ ]
6634
+ }
6628
6635
  }
6629
- }
6630
- );
6636
+ );
6637
+ });
6631
6638
  }
6632
6639
  });
6633
6640
  applyFriendlyErrorHandling(cli);
6641
+ initTelemetry("aborean");
6642
+ process.on("beforeExit", () => shutdownTelemetry());
6634
6643
  cli.serve();
6635
6644
  export {
6636
6645
  cli