@reppo/cli 0.6.0 → 0.8.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/README.md +3 -2
- package/dist/api/subnets.d.ts +45 -0
- package/dist/api/subnets.d.ts.map +1 -0
- package/dist/api/subnets.js +49 -0
- package/dist/api/subnets.js.map +1 -0
- package/dist/bin.js +3 -1
- package/dist/bin.js.map +1 -1
- package/dist/chain/abis.d.ts +27 -0
- package/dist/chain/abis.d.ts.map +1 -1
- package/dist/chain/abis.js +8 -0
- package/dist/chain/abis.js.map +1 -1
- package/dist/commands/list/datanets.d.ts.map +1 -1
- package/dist/commands/list/datanets.js +3 -20
- package/dist/commands/list/datanets.js.map +1 -1
- package/dist/commands/query/datanet.d.ts +10 -0
- package/dist/commands/query/datanet.d.ts.map +1 -1
- package/dist/commands/query/datanet.js +93 -2
- package/dist/commands/query/datanet.js.map +1 -1
- package/dist/commands/query/epoch.d.ts +29 -0
- package/dist/commands/query/epoch.d.ts.map +1 -0
- package/dist/commands/query/epoch.js +108 -0
- package/dist/commands/query/epoch.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Command-line interface for [Reppo](https://reppo.ai) — mint pods, vote, lock REPPO, manage datanets. Built for **AI agents** as the primary user, but humans can use it too.
|
|
4
4
|
|
|
5
|
-
> **Status:** v0.4.0 — fully wired against PodManager V2 on mainnet. Shipped: `approve`, `auth`, `query balance`, `query datanet`, `query emissions-due`, `query pod`, `query voting-power`, `list datanets`, `list pods` (incl. `--all`), `claim-emissions`, `extend-lock`, `grant-access`, `lock`, `mint-pod`, `register-agent`, `unlock`, `vote`. Remaining 2 commands (`create-datanet`, `swap`) are scaffolded but not yet wired.
|
|
5
|
+
> **Status:** v0.4.0 — fully wired against PodManager V2 on mainnet. Shipped: `approve`, `auth`, `query balance`, `query datanet`, `query epoch`, `query emissions-due`, `query pod`, `query voting-power`, `list datanets`, `list pods` (incl. `--all`), `claim-emissions`, `extend-lock`, `grant-access`, `lock`, `mint-pod`, `register-agent`, `unlock`, `vote`. Remaining 2 commands (`create-datanet`, `swap`) are scaffolded but not yet wired.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -47,7 +47,8 @@ Errors **always** emit JSON on stderr regardless of mode, with a stable `code` f
|
|
|
47
47
|
- `reppo query balance [address]` — ETH + REPPO + veREPPO + USDC
|
|
48
48
|
- `reppo query voting-power [address]` — veREPPO voting power + lockup count
|
|
49
49
|
- `reppo query pod <podId>` — pod existence + owner address
|
|
50
|
-
- `reppo query datanet <datanetId> [--for <addr>]` — validity + REPPO access fee
|
|
50
|
+
- `reppo query datanet <datanetId> [--for <addr>]` — on-chain validity + REPPO access fee (optionally check access for an address) + the current on-chain epoch, plus off-chain catalog metadata: name, description, native token (symbol/address/decimals), per-epoch emissions, vote volumes, publisher/voter onboarding guidance, and the platform `subnetUuid` (the `--subnet-uuid` for `mint-pod` publishing). Catalog enrichment is best-effort — a platform outage degrades `metadata` to `{ unavailable }` without affecting the on-chain answer.
|
|
51
|
+
- `reppo query epoch` — current on-chain epoch, read directly from `veReppo.currentEpoch()` (the protocol's epoch time-base). JSON: `{ network, epoch, epochStart, epochDurationSeconds, secondsRemaining }`. Epochs are fixed ~48h windows; the timing fields are derived from `epochEnd`/`epochLength` and degrade to `null` if those getters are unavailable. Pure read — no signer, no gas. Honor `--rpc-url` against a private RPC (the public Base RPC rate-limits).
|
|
51
52
|
- `reppo query emissions-due` — list unclaimed REPPO emissions across all pods owned by the configured wallet (uses platform API)
|
|
52
53
|
|
|
53
54
|
### List
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const PUBLIC_SUBNETS_PATH = "/api/v1/public/subnets";
|
|
2
|
+
/** Raw subnet row as returned by /api/v1/public/subnets. */
|
|
3
|
+
export interface RawSubnet {
|
|
4
|
+
id?: string;
|
|
5
|
+
subnetName?: string;
|
|
6
|
+
subnetDescription?: string;
|
|
7
|
+
thumbnailUrl?: string;
|
|
8
|
+
nativeTokenAddress?: string;
|
|
9
|
+
nativeTokenSymbol?: string;
|
|
10
|
+
nativeTokenDecimals?: number;
|
|
11
|
+
tokenId?: string;
|
|
12
|
+
accessFeeREPPO?: number | string;
|
|
13
|
+
emissionsPerEpochREPPO?: number | string;
|
|
14
|
+
emissionsPerEpochPrimaryToken?: number | string;
|
|
15
|
+
status?: string;
|
|
16
|
+
upVoteVolume?: number | string;
|
|
17
|
+
downVoteVolume?: number | string;
|
|
18
|
+
onboardingPublishers?: string;
|
|
19
|
+
onboardingVoters?: string;
|
|
20
|
+
createdByUserId?: string;
|
|
21
|
+
deleteScheduledAt?: string | null;
|
|
22
|
+
isABTestingSubnet?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface PublicSubnetsResponse {
|
|
25
|
+
data?: {
|
|
26
|
+
subnets?: RawSubnet[];
|
|
27
|
+
};
|
|
28
|
+
subnets?: RawSubnet[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Convert a JSON number/string from the platform into a string suitable for
|
|
32
|
+
* downstream BigInt parsing. Non-numeric or missing values render as "0"
|
|
33
|
+
* rather than "NaN"/"undefined" so the output shape stays consistent.
|
|
34
|
+
*/
|
|
35
|
+
export declare function numericToString(v: number | string | undefined): string;
|
|
36
|
+
/** Fetch the full public catalog. Throws `PUBLIC_API_*` on transport/parse failure. */
|
|
37
|
+
export declare function fetchSubnets(baseUrl: string | undefined): Promise<RawSubnet[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Find a single catalog row by its on-chain datanet id (`tokenId`). Returns
|
|
40
|
+
* `null` when no row matches (e.g. a testnet datanet absent from the mainnet
|
|
41
|
+
* catalog). Throws `PUBLIC_API_*` only on transport/parse failure — the
|
|
42
|
+
* caller decides whether that's fatal.
|
|
43
|
+
*/
|
|
44
|
+
export declare function fetchSubnetByTokenId(baseUrl: string | undefined, tokenId: string): Promise<RawSubnet | null>;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M,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAQtE;AAED,uFAAuF;AACvF,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAGpF;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAG3B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reppo public catalog of datanets ("subnets").
|
|
3
|
+
*
|
|
4
|
+
* The unauthenticated endpoint `GET reppo.ai/api/v1/public/subnets` returns
|
|
5
|
+
* the rich, off-chain metadata for every datanet — name, description,
|
|
6
|
+
* onboarding guidance, native token, emissions, vote volumes. This is the
|
|
7
|
+
* source `list datanets` summarizes and `query datanet` surfaces in full.
|
|
8
|
+
*
|
|
9
|
+
* "Datanet" is the user-facing name; the platform still uses the legacy
|
|
10
|
+
* "subnet" terminology in field names. A row carries BOTH ids:
|
|
11
|
+
* - `id` — platform cuid (e.g. cmnhuowns000bic04e16t6735), the
|
|
12
|
+
* `--subnet-uuid` used by mint-pod Phase-2 publishing.
|
|
13
|
+
* - `tokenId` — the on-chain datanet id (e.g. "9") the CLI takes as the
|
|
14
|
+
* `query datanet <id>` / `mint-pod --datanet` argument.
|
|
15
|
+
*/
|
|
16
|
+
import { publicGet } from './public.js';
|
|
17
|
+
export const PUBLIC_SUBNETS_PATH = '/api/v1/public/subnets';
|
|
18
|
+
/**
|
|
19
|
+
* Convert a JSON number/string from the platform into a string suitable for
|
|
20
|
+
* downstream BigInt parsing. Non-numeric or missing values render as "0"
|
|
21
|
+
* rather than "NaN"/"undefined" so the output shape stays consistent.
|
|
22
|
+
*/
|
|
23
|
+
export function numericToString(v) {
|
|
24
|
+
if (v === undefined || v === null)
|
|
25
|
+
return '0';
|
|
26
|
+
if (typeof v === 'number') {
|
|
27
|
+
if (!Number.isFinite(v))
|
|
28
|
+
return '0';
|
|
29
|
+
return Math.trunc(v).toString();
|
|
30
|
+
}
|
|
31
|
+
const s = v.trim();
|
|
32
|
+
return s === '' ? '0' : s;
|
|
33
|
+
}
|
|
34
|
+
/** Fetch the full public catalog. Throws `PUBLIC_API_*` on transport/parse failure. */
|
|
35
|
+
export async function fetchSubnets(baseUrl) {
|
|
36
|
+
const resp = await publicGet(baseUrl, PUBLIC_SUBNETS_PATH);
|
|
37
|
+
return resp.data?.subnets ?? resp.subnets ?? [];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Find a single catalog row by its on-chain datanet id (`tokenId`). Returns
|
|
41
|
+
* `null` when no row matches (e.g. a testnet datanet absent from the mainnet
|
|
42
|
+
* catalog). Throws `PUBLIC_API_*` only on transport/parse failure — the
|
|
43
|
+
* caller decides whether that's fatal.
|
|
44
|
+
*/
|
|
45
|
+
export async function fetchSubnetByTokenId(baseUrl, tokenId) {
|
|
46
|
+
const subnets = await fetchSubnets(baseUrl);
|
|
47
|
+
return subnets.find((s) => (s.tokenId ?? '') === tokenId) ?? null;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=subnets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subnets.js","sourceRoot":"","sources":["../../src/api/subnets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,mBAAmB,GAAG,wBAAwB,CAAC;AA8B5D;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,CAA8B;IAC5D,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,GAAG,CAAC;IAC9C,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAClC,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACnB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAA2B;IAC5D,MAAM,IAAI,GAAG,MAAM,SAAS,CAAwB,OAAO,EAAE,mBAAmB,CAAC,CAAC;IAClF,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAA2B,EAC3B,OAAe;IAEf,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;IAC5C,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,IAAI,CAAC;AACpE,CAAC"}
|
package/dist/bin.js
CHANGED
|
@@ -16,6 +16,7 @@ import { MintPodCommand } from './commands/mint-pod.js';
|
|
|
16
16
|
import { QueryBalanceCommand } from './commands/query/balance.js';
|
|
17
17
|
import { QueryDatanetCommand } from './commands/query/datanet.js';
|
|
18
18
|
import { QueryEmissionsDueCommand } from './commands/query/emissions-due.js';
|
|
19
|
+
import { QueryEpochCommand } from './commands/query/epoch.js';
|
|
19
20
|
import { QueryPodCommand } from './commands/query/pod.js';
|
|
20
21
|
import { QueryVotingPowerCommand } from './commands/query/voting-power.js';
|
|
21
22
|
import { RegisterAgentCommand } from './commands/register-agent.js';
|
|
@@ -24,7 +25,7 @@ import { VoteCommand } from './commands/vote.js';
|
|
|
24
25
|
const cli = new Cli({
|
|
25
26
|
binaryLabel: 'Reppo CLI',
|
|
26
27
|
binaryName: 'reppo',
|
|
27
|
-
binaryVersion: '0.
|
|
28
|
+
binaryVersion: '0.8.0',
|
|
28
29
|
enableCapture: false,
|
|
29
30
|
});
|
|
30
31
|
cli.register(Builtins.HelpCommand);
|
|
@@ -41,6 +42,7 @@ cli.register(MintPodCommand);
|
|
|
41
42
|
cli.register(QueryBalanceCommand);
|
|
42
43
|
cli.register(QueryDatanetCommand);
|
|
43
44
|
cli.register(QueryEmissionsDueCommand);
|
|
45
|
+
cli.register(QueryEpochCommand);
|
|
44
46
|
cli.register(QueryPodCommand);
|
|
45
47
|
cli.register(QueryVotingPowerCommand);
|
|
46
48
|
cli.register(RegisterAgentCommand);
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM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{
|
|
232
|
+
readonly name: "currentEpoch";
|
|
233
|
+
readonly type: "function";
|
|
234
|
+
readonly stateMutability: "view";
|
|
235
|
+
readonly inputs: readonly [];
|
|
236
|
+
readonly outputs: readonly [{
|
|
237
|
+
readonly type: "uint256";
|
|
238
|
+
}];
|
|
239
|
+
}, {
|
|
240
|
+
readonly name: "epochLength";
|
|
241
|
+
readonly type: "function";
|
|
242
|
+
readonly stateMutability: "view";
|
|
243
|
+
readonly inputs: readonly [];
|
|
244
|
+
readonly outputs: readonly [{
|
|
245
|
+
readonly type: "uint256";
|
|
246
|
+
}];
|
|
247
|
+
}, {
|
|
248
|
+
readonly name: "epochEnd";
|
|
249
|
+
readonly type: "function";
|
|
250
|
+
readonly stateMutability: "view";
|
|
251
|
+
readonly inputs: readonly [{
|
|
252
|
+
readonly type: "uint256";
|
|
253
|
+
readonly name: "epoch";
|
|
254
|
+
}];
|
|
255
|
+
readonly outputs: readonly [{
|
|
256
|
+
readonly type: "uint256";
|
|
257
|
+
}];
|
|
258
|
+
}, {
|
|
232
259
|
readonly name: "votingPowerOf";
|
|
233
260
|
readonly type: "function";
|
|
234
261
|
readonly stateMutability: "view";
|
package/dist/chain/abis.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../../src/chain/abis.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../../src/chain/abis.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBvB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG7B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAErB,CAAC"}
|
package/dist/chain/abis.js
CHANGED
|
@@ -37,6 +37,14 @@ export const SUBNET_MANAGER_ABI = parseAbi([
|
|
|
37
37
|
'function getAccessFeeREPPO(uint256 subnetId) view returns (uint256)',
|
|
38
38
|
]);
|
|
39
39
|
export const VE_REPPO_ABI = parseAbi([
|
|
40
|
+
// veReppo is the protocol's epoch time-base: PodManagerV2 and SubnetManager
|
|
41
|
+
// both read `veReppo.currentEpoch()`. Epochs are fixed-length windows
|
|
42
|
+
// (`epochLength()` = 172800s ≈ 48h); `epochEnd(epoch)` returns the unix
|
|
43
|
+
// second that epoch ends (== next epoch's start), so the current epoch's
|
|
44
|
+
// start is `epochEnd(currentEpoch) - epochLength`.
|
|
45
|
+
'function currentEpoch() view returns (uint256)',
|
|
46
|
+
'function epochLength() view returns (uint256)',
|
|
47
|
+
'function epochEnd(uint256 epoch) view returns (uint256)',
|
|
40
48
|
'function votingPowerOf(address) view returns (uint256)',
|
|
41
49
|
'function stake(uint256 amount, uint256 duration) returns (uint256 lockupId)',
|
|
42
50
|
'function stakeMore(uint256 lockupId, uint256 amount)',
|
package/dist/chain/abis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abis.js","sourceRoot":"","sources":["../../src/chain/abis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;IACtC,iFAAiF;IACjF,wFAAwF;IACxF,0DAA0D;IAC1D,+DAA+D;IAC/D,2EAA2E;IAC3E,0DAA0D;IAC1D,sDAAsD;IACtD,oEAAoE;IACpE,oFAAoF;IACpF,sFAAsF;IACtF,wFAAwF;IACxF,kGAAkG;IAClG,mFAAmF;CACpF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACzC,iEAAiE;IACjE,kFAAkF;IAClF,4DAA4D;IAC5D,qEAAqE;CACtE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;IACnC,wDAAwD;IACxD,6EAA6E;IAC7E,sDAAsD;IACtD,yDAAyD;IACzD,gDAAgD;IAChD,qGAAqG;IACrG,oDAAoD;IACpD,oDAAoD;IACpD,6HAA6H;IAC7H,oDAAoD;IACpD,0DAA0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oD;IACpD,6HAA6H;IAC7H,oDAAoD;IACpD,0DAA0D;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;IAChC,uCAAuC;IACvC,yCAAyC;IACzC,0CAA0C;IAC1C,+CAA+C;IAC/C,oDAAoD;IACpD,2EAA2E;IAC3E,kEAAkE;IAClE,8DAA8D;IAC9D,yEAAyE;CAC1E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACzC,0MAA0M;IAC1M,sGAAsG;CACvG,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC;IACjC,wOAAwO;CACzO,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datanets.d.ts","sourceRoot":"","sources":["../../../src/commands/list/datanets.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"datanets.d.ts","sourceRoot":"","sources":["../../../src/commands/list/datanets.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAuB1C,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,OAAgB,KAAK,aAA0B;IAE/C,OAAgB,KAAK,4BAclB;IAEH,MAAM,SAEH;IAEH,WAAW,qBAER;IAEH,KAAK,qBAEF;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAmEjC"}
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
import { Option } from 'clipanion';
|
|
21
21
|
import { BaseCommand } from '../_base.js';
|
|
22
22
|
import { cliError, emit } from '../../output/format.js';
|
|
23
|
-
import {
|
|
23
|
+
import { DEFAULT_PUBLIC_API_URL } from '../../api/public.js';
|
|
24
|
+
import { fetchSubnets, numericToString } from '../../api/subnets.js';
|
|
24
25
|
const VALID_STATUSES = ['ACTIVE', 'ALL'];
|
|
25
26
|
export class ListDatanetsCommand extends BaseCommand {
|
|
26
27
|
static paths = [['list', 'datanets']];
|
|
@@ -66,8 +67,7 @@ export class ListDatanetsCommand extends BaseCommand {
|
|
|
66
67
|
}
|
|
67
68
|
// Resolve env override at call site (per spec — not in loadConfig).
|
|
68
69
|
const baseUrl = process.env.REPPO_PUBLIC_API_URL ?? DEFAULT_PUBLIC_API_URL;
|
|
69
|
-
const
|
|
70
|
-
const raw = resp.data?.subnets ?? resp.subnets ?? [];
|
|
70
|
+
const raw = await fetchSubnets(baseUrl);
|
|
71
71
|
// Filter: status, token-symbol.
|
|
72
72
|
const symbolNeedle = this.tokenSymbol?.toLowerCase();
|
|
73
73
|
const filtered = raw.filter((s) => {
|
|
@@ -108,23 +108,6 @@ export class ListDatanetsCommand extends BaseCommand {
|
|
|
108
108
|
function isStatusFilter(v) {
|
|
109
109
|
return VALID_STATUSES.includes(v);
|
|
110
110
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Convert a JSON number/string from the platform into a string suitable
|
|
113
|
-
* for downstream BigInt parsing. Non-numeric or missing values render
|
|
114
|
-
* as "0" rather than "NaN" or "undefined" so the output shape stays
|
|
115
|
-
* consistent.
|
|
116
|
-
*/
|
|
117
|
-
function numericToString(v) {
|
|
118
|
-
if (v === undefined || v === null)
|
|
119
|
-
return '0';
|
|
120
|
-
if (typeof v === 'number') {
|
|
121
|
-
if (!Number.isFinite(v))
|
|
122
|
-
return '0';
|
|
123
|
-
return Math.trunc(v).toString();
|
|
124
|
-
}
|
|
125
|
-
const s = v.trim();
|
|
126
|
-
return s === '' ? '0' : s;
|
|
127
|
-
}
|
|
128
111
|
function toRow(s) {
|
|
129
112
|
return {
|
|
130
113
|
id: s.tokenId ?? '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datanets.js","sourceRoot":"","sources":["../../../src/commands/list/datanets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,MAA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AAC,MAAM,UAAU,CAAC,CAAC,cAAc,iBAAiB,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC5H,CAAC;YACH,CAAC;YAED,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,CAAC;QACX,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;;AAGH,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAQ,cAAoC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,KAAK,CAAC,CAAY;IACzB,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE;QACnB,IAAI,EAAE,CAAC,CAAC,UAAU,IAAI,EAAE;QACxB,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,SAAS;QAC7B,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC;QACjD,sBAAsB,EAAE,eAAe,CAAC,CAAC,CAAC,sBAAsB,CAAC;QACjE,WAAW,EAAE;YACX,OAAO,EAAE,CAAC,CAAC,kBAAkB,IAAI,EAAE;YACnC,MAAM,EAAE,CAAC,CAAC,iBAAiB,IAAI,EAAE;YACjC,QAAQ,EAAE,OAAO,CAAC,CAAC,mBAAmB,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;SAChF;QACD,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC;QAC7C,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -6,5 +6,15 @@ export declare class QueryDatanetCommand extends BaseCommand {
|
|
|
6
6
|
for_: string | undefined;
|
|
7
7
|
execute(): Promise<number>;
|
|
8
8
|
private resolveCallerAddress;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the off-chain catalog row for this datanet by its on-chain id
|
|
11
|
+
* (`tokenId`). Best-effort: returns `{ unavailable }` on a catalog outage
|
|
12
|
+
* or a no-match, never throwing — the on-chain answer is authoritative and
|
|
13
|
+
* must survive a flaky platform API.
|
|
14
|
+
*/
|
|
15
|
+
private fetchMetadata;
|
|
16
|
+
private toMetadata;
|
|
17
|
+
/** Human-mode lines for the catalog metadata block. */
|
|
18
|
+
private metadataLines;
|
|
9
19
|
}
|
|
10
20
|
//# sourceMappingURL=datanet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datanet.d.ts","sourceRoot":"","sources":["../../../src/commands/query/datanet.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"datanet.d.ts","sourceRoot":"","sources":["../../../src/commands/query/datanet.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgC1C,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,OAAgB,KAAK,aAA0B;IAE/C,OAAgB,KAAK,4BAUlB;IAEH,OAAO,SAAqC;IAC5C,IAAI,qBAA+H;IAE7H,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IA6GhC,OAAO,CAAC,oBAAoB;IAW5B;;;;;OAKG;YACW,aAAa;IAW3B,OAAO,CAAC,UAAU;IAsBlB,uDAAuD;IACvD,OAAO,CAAC,aAAa;CAyBtB"}
|
|
@@ -22,7 +22,9 @@ import { privateKeyToAddress } from 'viem/accounts';
|
|
|
22
22
|
import { BaseCommand } from '../_base.js';
|
|
23
23
|
import { cliError, emit } from '../../output/format.js';
|
|
24
24
|
import { createReadClient } from '../../chain/clients.js';
|
|
25
|
-
import { trySubnetManager } from '../../chain/contracts.js';
|
|
25
|
+
import { trySubnetManager, tryVeReppo } from '../../chain/contracts.js';
|
|
26
|
+
import { DEFAULT_PUBLIC_API_URL } from '../../api/public.js';
|
|
27
|
+
import { fetchSubnetByTokenId, numericToString } from '../../api/subnets.js';
|
|
26
28
|
function unavailable(reason) {
|
|
27
29
|
return { unavailable: reason };
|
|
28
30
|
}
|
|
@@ -51,6 +53,10 @@ export class QueryDatanetCommand extends BaseCommand {
|
|
|
51
53
|
catch {
|
|
52
54
|
throw cliError('INVALID_DATANET_ID', `Datanet id must be a non-negative integer; got "${this.datanet}".`);
|
|
53
55
|
}
|
|
56
|
+
// Off-chain catalog metadata (name, description, token, emissions,
|
|
57
|
+
// onboarding). Best-effort: a catalog outage or a datanet absent from
|
|
58
|
+
// the public catalog must NOT break the authoritative on-chain answer.
|
|
59
|
+
const metadata = await this.fetchMetadata(datanetId.toString());
|
|
54
60
|
const client = createReadClient({ network: cfg.network, ...(cfg.rpcUrl ? { rpcUrl: cfg.rpcUrl } : {}) });
|
|
55
61
|
const sm = trySubnetManager(cfg.network);
|
|
56
62
|
if (!sm) {
|
|
@@ -60,15 +66,31 @@ export class QueryDatanetCommand extends BaseCommand {
|
|
|
60
66
|
network: cfg.network,
|
|
61
67
|
valid: unavailable(reason),
|
|
62
68
|
accessFeeREPPO: unavailable(reason),
|
|
69
|
+
metadata,
|
|
63
70
|
}, [
|
|
64
71
|
`Datanet: ${datanetId}`,
|
|
65
72
|
`Network: ${cfg.network}`,
|
|
66
|
-
`(unavailable: ${reason})`,
|
|
73
|
+
`(on-chain unavailable: ${reason})`,
|
|
74
|
+
...this.metadataLines(metadata),
|
|
67
75
|
]);
|
|
68
76
|
return 0;
|
|
69
77
|
}
|
|
70
78
|
// On-chain function names use the legacy "subnet" naming; CLI surface uses datanet.
|
|
71
79
|
const valid = await client.readContract({ ...sm, functionName: 'validSubnet', args: [datanetId] });
|
|
80
|
+
// Best-effort current epoch (veReppo is the protocol's epoch time-base).
|
|
81
|
+
// Surfaced so callers don't need a second `query epoch` round-trip; a
|
|
82
|
+
// null here never affects the authoritative validity/fee answer.
|
|
83
|
+
const ve = tryVeReppo(cfg.network);
|
|
84
|
+
let currentEpoch = null;
|
|
85
|
+
if (ve) {
|
|
86
|
+
try {
|
|
87
|
+
const e = await client.readContract({ ...ve, functionName: 'currentEpoch' });
|
|
88
|
+
currentEpoch = typeof e === 'bigint' ? Number(e) : null;
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// leave null — on-chain validity/fee are the authoritative fields
|
|
92
|
+
}
|
|
93
|
+
}
|
|
72
94
|
// Skip the fee read on invalid datanets — getAccessFeeREPPO is likely
|
|
73
95
|
// to revert (or return 0) for non-existent datanets, and either way
|
|
74
96
|
// the answer is "no fee because there is no datanet", not "fee is 0".
|
|
@@ -90,8 +112,10 @@ export class QueryDatanetCommand extends BaseCommand {
|
|
|
90
112
|
datanetId: datanetId.toString(),
|
|
91
113
|
network: cfg.network,
|
|
92
114
|
valid,
|
|
115
|
+
currentEpoch,
|
|
93
116
|
accessFeeREPPO,
|
|
94
117
|
...(callerAccess ? { callerAccess } : {}),
|
|
118
|
+
metadata,
|
|
95
119
|
};
|
|
96
120
|
const feeFmt = 'unavailable' in accessFeeREPPO
|
|
97
121
|
? `(unavailable: ${accessFeeREPPO.unavailable})`
|
|
@@ -100,12 +124,14 @@ export class QueryDatanetCommand extends BaseCommand {
|
|
|
100
124
|
`Datanet: ${datanetId}`,
|
|
101
125
|
`Network: ${cfg.network}`,
|
|
102
126
|
`Valid: ${valid}`,
|
|
127
|
+
`Current epoch: ${currentEpoch ?? '(unavailable)'}`,
|
|
103
128
|
`Access fee: ${feeFmt}`,
|
|
104
129
|
];
|
|
105
130
|
if (callerAccess) {
|
|
106
131
|
lines.push(`Caller: ${callerAccess.address}`);
|
|
107
132
|
lines.push(`Caller access: ${callerAccess.hasAccess}`);
|
|
108
133
|
}
|
|
134
|
+
lines.push(...this.metadataLines(metadata));
|
|
109
135
|
emit(result, lines);
|
|
110
136
|
return 0;
|
|
111
137
|
}
|
|
@@ -124,5 +150,70 @@ export class QueryDatanetCommand extends BaseCommand {
|
|
|
124
150
|
return privateKeyToAddress(pk);
|
|
125
151
|
return undefined;
|
|
126
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Resolve the off-chain catalog row for this datanet by its on-chain id
|
|
155
|
+
* (`tokenId`). Best-effort: returns `{ unavailable }` on a catalog outage
|
|
156
|
+
* or a no-match, never throwing — the on-chain answer is authoritative and
|
|
157
|
+
* must survive a flaky platform API.
|
|
158
|
+
*/
|
|
159
|
+
async fetchMetadata(tokenId) {
|
|
160
|
+
const baseUrl = process.env.REPPO_PUBLIC_API_URL ?? DEFAULT_PUBLIC_API_URL;
|
|
161
|
+
try {
|
|
162
|
+
const row = await fetchSubnetByTokenId(baseUrl, tokenId);
|
|
163
|
+
if (!row)
|
|
164
|
+
return unavailable('datanet not found in the public catalog');
|
|
165
|
+
return this.toMetadata(row);
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
return unavailable(`catalog fetch failed: ${e.message}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
toMetadata(s) {
|
|
172
|
+
return {
|
|
173
|
+
subnetUuid: s.id ?? '',
|
|
174
|
+
name: s.subnetName ?? '',
|
|
175
|
+
description: s.subnetDescription ?? '',
|
|
176
|
+
status: s.status ?? 'UNKNOWN',
|
|
177
|
+
nativeToken: {
|
|
178
|
+
address: s.nativeTokenAddress ?? '',
|
|
179
|
+
symbol: s.nativeTokenSymbol ?? '',
|
|
180
|
+
decimals: typeof s.nativeTokenDecimals === 'number' ? s.nativeTokenDecimals : 0,
|
|
181
|
+
},
|
|
182
|
+
emissionsPerEpochREPPO: numericToString(s.emissionsPerEpochREPPO),
|
|
183
|
+
emissionsPerEpochPrimaryToken: numericToString(s.emissionsPerEpochPrimaryToken),
|
|
184
|
+
upVoteVolume: numericToString(s.upVoteVolume),
|
|
185
|
+
downVoteVolume: numericToString(s.downVoteVolume),
|
|
186
|
+
onboardingPublishers: s.onboardingPublishers ?? '',
|
|
187
|
+
onboardingVoters: s.onboardingVoters ?? '',
|
|
188
|
+
thumbnailUrl: s.thumbnailUrl ?? '',
|
|
189
|
+
isABTestingSubnet: s.isABTestingSubnet ?? false,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/** Human-mode lines for the catalog metadata block. */
|
|
193
|
+
metadataLines(m) {
|
|
194
|
+
if ('unavailable' in m) {
|
|
195
|
+
return [`Metadata: (unavailable: ${m.unavailable})`];
|
|
196
|
+
}
|
|
197
|
+
const lines = [
|
|
198
|
+
``,
|
|
199
|
+
`Name: ${m.name}`,
|
|
200
|
+
`Status: ${m.status}`,
|
|
201
|
+
`Token: ${m.nativeToken.symbol} (${m.nativeToken.decimals} decimals) ${m.nativeToken.address}`,
|
|
202
|
+
`Emissions: ${m.emissionsPerEpochREPPO} REPPO/epoch` +
|
|
203
|
+
(m.emissionsPerEpochPrimaryToken !== '0' ? ` + ${m.emissionsPerEpochPrimaryToken} primary/epoch` : ''),
|
|
204
|
+
`Votes: ↑${m.upVoteVolume} / ↓${m.downVoteVolume}`,
|
|
205
|
+
`Subnet UUID: ${m.subnetUuid} (use as --subnet-uuid for mint-pod publishing)`,
|
|
206
|
+
];
|
|
207
|
+
if (m.description.trim()) {
|
|
208
|
+
lines.push(``, `Description:`, m.description.trim());
|
|
209
|
+
}
|
|
210
|
+
if (m.onboardingPublishers.trim()) {
|
|
211
|
+
lines.push(``, `Onboarding — publishers:`, m.onboardingPublishers.trim());
|
|
212
|
+
}
|
|
213
|
+
if (m.onboardingVoters.trim()) {
|
|
214
|
+
lines.push(``, `Onboarding — voters:`, m.onboardingVoters.trim());
|
|
215
|
+
}
|
|
216
|
+
return lines;
|
|
217
|
+
}
|
|
127
218
|
}
|
|
128
219
|
//# sourceMappingURL=datanet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datanet.js","sourceRoot":"","sources":["../../../src/commands/query/datanet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,MA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*
|
|
5
|
+
* Source of truth: veReppo is the protocol's epoch time-base. Both
|
|
6
|
+
* PodManagerV2 and SubnetManager compute epoch as `veReppo.currentEpoch()`,
|
|
7
|
+
* so this command reads that getter directly rather than inferring epoch
|
|
8
|
+
* from pod `validityEpoch`s (which lag when no pod has published this epoch).
|
|
9
|
+
*
|
|
10
|
+
* Epochs are fixed-length windows (`epochLength()` ≈ 48h). `epochEnd(epoch)`
|
|
11
|
+
* returns the unix second the epoch ends (== the next epoch's start), so:
|
|
12
|
+
* epochStart = epochEnd(currentEpoch) - epochLength
|
|
13
|
+
* secondsRemaining = epochEnd(currentEpoch) - <latest block timestamp>
|
|
14
|
+
*
|
|
15
|
+
* The epoch number is read first and is authoritative. The timing fields are
|
|
16
|
+
* best-effort: if `epochLength`/`epochEnd` are absent on a given deployment
|
|
17
|
+
* they degrade to `null` without breaking the epoch read. `secondsRemaining`
|
|
18
|
+
* uses the chain's latest block timestamp, not the local clock, to keep the
|
|
19
|
+
* answer purely on-chain.
|
|
20
|
+
*
|
|
21
|
+
* Pure read: `eth_call` only — no transaction, no signing key, no gas.
|
|
22
|
+
*/
|
|
23
|
+
import { BaseCommand } from '../_base.js';
|
|
24
|
+
export declare class QueryEpochCommand extends BaseCommand {
|
|
25
|
+
static paths: string[][];
|
|
26
|
+
static usage: import("clipanion").Usage;
|
|
27
|
+
execute(): Promise<number>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=epoch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch.d.ts","sourceRoot":"","sources":["../../../src/commands/query/epoch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,OAAgB,KAAK,aAAwB;IAE7C,OAAgB,KAAK,4BAOlB;IAEG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CA2EjC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `reppo query epoch` — report the current on-chain epoch, read directly
|
|
3
|
+
* from the Reppo contracts (no off-chain inference).
|
|
4
|
+
*
|
|
5
|
+
* Source of truth: veReppo is the protocol's epoch time-base. Both
|
|
6
|
+
* PodManagerV2 and SubnetManager compute epoch as `veReppo.currentEpoch()`,
|
|
7
|
+
* so this command reads that getter directly rather than inferring epoch
|
|
8
|
+
* from pod `validityEpoch`s (which lag when no pod has published this epoch).
|
|
9
|
+
*
|
|
10
|
+
* Epochs are fixed-length windows (`epochLength()` ≈ 48h). `epochEnd(epoch)`
|
|
11
|
+
* returns the unix second the epoch ends (== the next epoch's start), so:
|
|
12
|
+
* epochStart = epochEnd(currentEpoch) - epochLength
|
|
13
|
+
* secondsRemaining = epochEnd(currentEpoch) - <latest block timestamp>
|
|
14
|
+
*
|
|
15
|
+
* The epoch number is read first and is authoritative. The timing fields are
|
|
16
|
+
* best-effort: if `epochLength`/`epochEnd` are absent on a given deployment
|
|
17
|
+
* they degrade to `null` without breaking the epoch read. `secondsRemaining`
|
|
18
|
+
* uses the chain's latest block timestamp, not the local clock, to keep the
|
|
19
|
+
* answer purely on-chain.
|
|
20
|
+
*
|
|
21
|
+
* Pure read: `eth_call` only — no transaction, no signing key, no gas.
|
|
22
|
+
*/
|
|
23
|
+
import { BaseCommand } from '../_base.js';
|
|
24
|
+
import { emit } from '../../output/format.js';
|
|
25
|
+
import { createReadClient } from '../../chain/clients.js';
|
|
26
|
+
import { tryVeReppo } from '../../chain/contracts.js';
|
|
27
|
+
export class QueryEpochCommand extends BaseCommand {
|
|
28
|
+
static paths = [['query', 'epoch']];
|
|
29
|
+
static usage = BaseCommand.Usage({
|
|
30
|
+
description: 'Show the current on-chain epoch (read from the Reppo contracts).',
|
|
31
|
+
examples: [
|
|
32
|
+
['Current epoch on mainnet', 'reppo query epoch'],
|
|
33
|
+
['JSON output for an agent', 'reppo query epoch --json'],
|
|
34
|
+
['Against a private RPC', 'reppo query epoch --rpc-url https://my-base-rpc'],
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
async execute() {
|
|
38
|
+
try {
|
|
39
|
+
const cfg = this.loadConfig();
|
|
40
|
+
const ve = tryVeReppo(cfg.network);
|
|
41
|
+
if (!ve) {
|
|
42
|
+
const reason = `veReppo address not configured for ${cfg.network}.`;
|
|
43
|
+
const result = {
|
|
44
|
+
network: cfg.network,
|
|
45
|
+
epoch: null,
|
|
46
|
+
epochStart: null,
|
|
47
|
+
epochDurationSeconds: null,
|
|
48
|
+
secondsRemaining: null,
|
|
49
|
+
};
|
|
50
|
+
emit(result, [
|
|
51
|
+
`Network: ${cfg.network}`,
|
|
52
|
+
`(on-chain unavailable: ${reason})`,
|
|
53
|
+
]);
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
const client = createReadClient({ network: cfg.network, ...(cfg.rpcUrl ? { rpcUrl: cfg.rpcUrl } : {}) });
|
|
57
|
+
// Authoritative: the epoch number itself.
|
|
58
|
+
const epoch = await client.readContract({ ...ve, functionName: 'currentEpoch' });
|
|
59
|
+
// Best-effort timing. epochLength + epochEnd let us derive start and
|
|
60
|
+
// seconds-remaining; either being absent degrades only the timing
|
|
61
|
+
// fields, never the epoch number.
|
|
62
|
+
let epochStart = null;
|
|
63
|
+
let epochDurationSeconds = null;
|
|
64
|
+
let secondsRemaining = null;
|
|
65
|
+
try {
|
|
66
|
+
const [epochLength, epochEnd, block] = await Promise.all([
|
|
67
|
+
client.readContract({ ...ve, functionName: 'epochLength' }),
|
|
68
|
+
client.readContract({ ...ve, functionName: 'epochEnd', args: [epoch] }),
|
|
69
|
+
client.getBlock({ blockTag: 'latest' }),
|
|
70
|
+
]);
|
|
71
|
+
epochDurationSeconds = Number(epochLength);
|
|
72
|
+
epochStart = Number(epochEnd - epochLength);
|
|
73
|
+
// Clamp: epochEnd(currentEpoch) is always > the timestamp that
|
|
74
|
+
// produced currentEpoch, but guard against a stale block read.
|
|
75
|
+
const remaining = epochEnd - block.timestamp;
|
|
76
|
+
secondsRemaining = remaining > 0n ? Number(remaining) : 0;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Timing getters unavailable on this deployment — leave nulls.
|
|
80
|
+
}
|
|
81
|
+
const result = {
|
|
82
|
+
network: cfg.network,
|
|
83
|
+
epoch: Number(epoch),
|
|
84
|
+
epochStart,
|
|
85
|
+
epochDurationSeconds,
|
|
86
|
+
secondsRemaining,
|
|
87
|
+
};
|
|
88
|
+
const lines = [
|
|
89
|
+
`Network: ${cfg.network}`,
|
|
90
|
+
`Current epoch: ${result.epoch}`,
|
|
91
|
+
];
|
|
92
|
+
if (epochStart !== null) {
|
|
93
|
+
lines.push(`Epoch start: ${new Date(epochStart * 1000).toISOString()} (${epochStart})`);
|
|
94
|
+
}
|
|
95
|
+
if (secondsRemaining !== null) {
|
|
96
|
+
const h = Math.floor(secondsRemaining / 3600);
|
|
97
|
+
const m = Math.floor((secondsRemaining % 3600) / 60);
|
|
98
|
+
lines.push(`Next epoch in: ${h}h ${m}m (${secondsRemaining}s)`);
|
|
99
|
+
}
|
|
100
|
+
emit(result, lines);
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
this.handleError(err);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=epoch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"epoch.js","sourceRoot":"","sources":["../../../src/commands/query/epoch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0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