@spectratools/assembly-cli 0.11.3 → 0.11.6

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 +95 -84
  2. package/dist/index.js +8098 -0
  3. package/package.json +9 -3
package/dist/cli.js CHANGED
@@ -4,6 +4,11 @@
4
4
  import { readFileSync, realpathSync } from "fs";
5
5
  import { dirname, resolve } from "path";
6
6
  import { fileURLToPath } from "url";
7
+ import {
8
+ initTelemetry,
9
+ shutdownTelemetry,
10
+ withCommandSpan
11
+ } from "@spectratools/cli-shared/telemetry";
7
12
  import { Cli as Cli6, z as z7 } from "incur";
8
13
 
9
14
  // src/commands/_common.ts
@@ -7955,49 +7960,51 @@ cli.command("status", {
7955
7960
  }),
7956
7961
  examples: [{ description: "Fetch the current Assembly system status" }],
7957
7962
  async run(c) {
7958
- const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
7959
- const [
7960
- activeMemberCount,
7961
- seatCount,
7962
- proposalCount,
7963
- currentAuctionDay,
7964
- currentAuctionSlot,
7965
- treasuryBalance
7966
- ] = await Promise.all([
7967
- client.readContract({
7968
- abi: registryAbi,
7969
- address: ABSTRACT_MAINNET_ADDRESSES.registry,
7970
- functionName: "activeMemberCount"
7971
- }),
7972
- client.readContract({
7973
- abi: councilSeatsAbi,
7974
- address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
7975
- functionName: "seatCount"
7976
- }),
7977
- client.readContract({
7978
- abi: governanceAbi,
7979
- address: ABSTRACT_MAINNET_ADDRESSES.governance,
7980
- functionName: "proposalCount"
7981
- }),
7982
- client.readContract({
7983
- abi: councilSeatsAbi,
7984
- address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
7985
- functionName: "currentAuctionDay"
7986
- }),
7987
- client.readContract({
7988
- abi: councilSeatsAbi,
7989
- address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
7990
- functionName: "currentAuctionSlot"
7991
- }),
7992
- client.getBalance({ address: ABSTRACT_MAINNET_ADDRESSES.treasury })
7993
- ]);
7994
- return c.ok({
7995
- activeMemberCount: Number(activeMemberCount),
7996
- seatCount: Number(seatCount),
7997
- proposalCount: Number(proposalCount),
7998
- currentAuctionDay: Number(currentAuctionDay),
7999
- currentAuctionSlot: Number(currentAuctionSlot),
8000
- treasuryBalance: eth(treasuryBalance)
7963
+ return withCommandSpan("assembly status", {}, async () => {
7964
+ const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
7965
+ const [
7966
+ activeMemberCount,
7967
+ seatCount,
7968
+ proposalCount,
7969
+ currentAuctionDay,
7970
+ currentAuctionSlot,
7971
+ treasuryBalance
7972
+ ] = await Promise.all([
7973
+ client.readContract({
7974
+ abi: registryAbi,
7975
+ address: ABSTRACT_MAINNET_ADDRESSES.registry,
7976
+ functionName: "activeMemberCount"
7977
+ }),
7978
+ client.readContract({
7979
+ abi: councilSeatsAbi,
7980
+ address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
7981
+ functionName: "seatCount"
7982
+ }),
7983
+ client.readContract({
7984
+ abi: governanceAbi,
7985
+ address: ABSTRACT_MAINNET_ADDRESSES.governance,
7986
+ functionName: "proposalCount"
7987
+ }),
7988
+ client.readContract({
7989
+ abi: councilSeatsAbi,
7990
+ address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
7991
+ functionName: "currentAuctionDay"
7992
+ }),
7993
+ client.readContract({
7994
+ abi: councilSeatsAbi,
7995
+ address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
7996
+ functionName: "currentAuctionSlot"
7997
+ }),
7998
+ client.getBalance({ address: ABSTRACT_MAINNET_ADDRESSES.treasury })
7999
+ ]);
8000
+ return c.ok({
8001
+ activeMemberCount: Number(activeMemberCount),
8002
+ seatCount: Number(seatCount),
8003
+ proposalCount: Number(proposalCount),
8004
+ currentAuctionDay: Number(currentAuctionDay),
8005
+ currentAuctionSlot: Number(currentAuctionSlot),
8006
+ treasuryBalance: eth(treasuryBalance)
8007
+ });
8001
8008
  });
8002
8009
  }
8003
8010
  });
@@ -8023,47 +8030,49 @@ cli.command("health", {
8023
8030
  }
8024
8031
  ],
8025
8032
  async run(c) {
8026
- const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
8027
- const [isActive, member, isCouncilMember, pendingReturns, votingPower] = await Promise.all([
8028
- client.readContract({
8029
- abi: registryAbi,
8030
- address: ABSTRACT_MAINNET_ADDRESSES.registry,
8031
- functionName: "isActive",
8032
- args: [c.args.address]
8033
- }),
8034
- client.readContract({
8035
- abi: registryAbi,
8036
- address: ABSTRACT_MAINNET_ADDRESSES.registry,
8037
- functionName: "members",
8038
- args: [c.args.address]
8039
- }),
8040
- client.readContract({
8041
- abi: councilSeatsAbi,
8042
- address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
8043
- functionName: "isCouncilMember",
8044
- args: [c.args.address]
8045
- }),
8046
- client.readContract({
8047
- abi: councilSeatsAbi,
8048
- address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
8049
- functionName: "pendingReturns",
8050
- args: [c.args.address]
8051
- }),
8052
- client.readContract({
8053
- abi: councilSeatsAbi,
8054
- address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
8055
- functionName: "getVotingPower",
8056
- args: [c.args.address]
8057
- })
8058
- ]);
8059
- return c.ok({
8060
- address: toChecksum(c.args.address),
8061
- isActive,
8062
- activeUntil: timeValue(member.activeUntil, c.format),
8063
- activeUntilRelative: relTime(member.activeUntil),
8064
- isCouncilMember,
8065
- pendingReturnsWei: pendingReturns.toString(),
8066
- votingPower: Number(votingPower)
8033
+ return withCommandSpan("assembly health", { address: c.args.address }, async () => {
8034
+ const client = createAssemblyPublicClient(c.env.ABSTRACT_RPC_URL);
8035
+ const [isActive, member, isCouncilMember, pendingReturns, votingPower] = await Promise.all([
8036
+ client.readContract({
8037
+ abi: registryAbi,
8038
+ address: ABSTRACT_MAINNET_ADDRESSES.registry,
8039
+ functionName: "isActive",
8040
+ args: [c.args.address]
8041
+ }),
8042
+ client.readContract({
8043
+ abi: registryAbi,
8044
+ address: ABSTRACT_MAINNET_ADDRESSES.registry,
8045
+ functionName: "members",
8046
+ args: [c.args.address]
8047
+ }),
8048
+ client.readContract({
8049
+ abi: councilSeatsAbi,
8050
+ address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
8051
+ functionName: "isCouncilMember",
8052
+ args: [c.args.address]
8053
+ }),
8054
+ client.readContract({
8055
+ abi: councilSeatsAbi,
8056
+ address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
8057
+ functionName: "pendingReturns",
8058
+ args: [c.args.address]
8059
+ }),
8060
+ client.readContract({
8061
+ abi: councilSeatsAbi,
8062
+ address: ABSTRACT_MAINNET_ADDRESSES.councilSeats,
8063
+ functionName: "getVotingPower",
8064
+ args: [c.args.address]
8065
+ })
8066
+ ]);
8067
+ return c.ok({
8068
+ address: toChecksum(c.args.address),
8069
+ isActive,
8070
+ activeUntil: timeValue(member.activeUntil, c.format),
8071
+ activeUntilRelative: relTime(member.activeUntil),
8072
+ isCouncilMember,
8073
+ pendingReturnsWei: pendingReturns.toString(),
8074
+ votingPower: Number(votingPower)
8075
+ });
8067
8076
  });
8068
8077
  }
8069
8078
  });
@@ -8080,6 +8089,8 @@ var isMain = (() => {
8080
8089
  }
8081
8090
  })();
8082
8091
  if (isMain) {
8092
+ initTelemetry("assembly");
8093
+ process.on("beforeExit", () => shutdownTelemetry());
8083
8094
  cli.serve();
8084
8095
  }
8085
8096
  export {