@reppo/cli 0.2.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/README.md +6 -5
- package/dist/bin.js +1 -1
- package/dist/chain/abis.d.ts +57 -78
- package/dist/chain/abis.d.ts.map +1 -1
- package/dist/chain/abis.js +24 -20
- package/dist/chain/abis.js.map +1 -1
- package/dist/chain/contracts.d.ts +9 -6
- package/dist/chain/contracts.d.ts.map +1 -1
- package/dist/chain/contracts.js +3 -3
- package/dist/chain/contracts.js.map +1 -1
- package/dist/chain/errors.d.ts.map +1 -1
- package/dist/chain/errors.js +30 -4
- package/dist/chain/errors.js.map +1 -1
- package/dist/commands/claim-emissions.d.ts.map +1 -1
- package/dist/commands/claim-emissions.js +17 -38
- package/dist/commands/claim-emissions.js.map +1 -1
- package/dist/commands/list/pods.d.ts +1 -0
- package/dist/commands/list/pods.d.ts.map +1 -1
- package/dist/commands/list/pods.js +143 -21
- package/dist/commands/list/pods.js.map +1 -1
- package/dist/commands/mint-pod.d.ts +0 -3
- package/dist/commands/mint-pod.d.ts.map +1 -1
- package/dist/commands/mint-pod.js +117 -228
- package/dist/commands/mint-pod.js.map +1 -1
- package/dist/commands/register-agent.d.ts.map +1 -1
- package/dist/commands/register-agent.js +26 -30
- package/dist/commands/register-agent.js.map +1 -1
- package/dist/commands/vote.d.ts +1 -1
- package/dist/commands/vote.d.ts.map +1 -1
- package/dist/commands/vote.js +48 -31
- package/dist/commands/vote.js.map +1 -1
- 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.
|
|
5
|
+
> **Status:** v0.4.0 — fully wired against PodManager V2 on mainnet. Shipped: `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.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -51,17 +51,18 @@ Errors **always** emit JSON on stderr regardless of mode, with a stable `code` f
|
|
|
51
51
|
|
|
52
52
|
- `reppo list datanets [--status ACTIVE|ALL] [--token-symbol <sym>] [--limit <n>]` — list all datanets on the platform (public endpoint, no auth required)
|
|
53
53
|
- `reppo list pods [--datanet <id>] [--include-emissions] [--limit <n>]` — list pods owned by the configured wallet, optionally scoped to a single datanet (uses platform API)
|
|
54
|
+
- `reppo list pods --all [--datanet <id>] [--limit <n>]` — list pods published by *any* wallet, so a voter can discover pods to vote on (public endpoint, no auth required); each row's `podId` feeds straight into `reppo vote --pod <podId>`
|
|
54
55
|
|
|
55
56
|
### Write
|
|
56
57
|
|
|
57
|
-
- `reppo vote --pod <id> --
|
|
58
|
-
- `reppo mint-pod
|
|
58
|
+
- `reppo vote --pod <id> --votes <n> --like|--dislike` — cast a vote on a pod, spending `<n>` voting power
|
|
59
|
+
- `reppo mint-pod --datanet <id> [--token reppo|primary] [--to <addr>]` — mint a pod into a datanet
|
|
59
60
|
- `reppo lock <amount> --duration <seconds>` — lock REPPO into veREPPO for voting power
|
|
60
61
|
- `reppo unlock <lockupId> [--to <addr>]` — withdraw an expired veREPPO lockup, returning the locked REPPO
|
|
61
62
|
- `reppo extend-lock <lockupId> --duration <seconds>` — extend an existing veREPPO lockup
|
|
62
63
|
- `reppo grant-access --datanet <id> [--to <addr>]` — pay the REPPO access fee and grant `--to` access to a datanet
|
|
63
64
|
- `reppo claim-emissions --pod <id> --epoch <n>` — claim a pod's emissions for an epoch
|
|
64
|
-
- `reppo register-agent --name <s> --description <s>` — register a new agent identity on the Reppo platform; returns id
|
|
65
|
+
- `reppo register-agent --name <s> --description <s>` — register a new agent identity on the Reppo platform; returns `{ id, apiKey }`. The apiKey is the Bearer token for subsequent agent-scoped calls (`/agents/[id]/subnets`, `/agents/[id]/pods`). On-chain mints use your `REPPO_PRIVATE_KEY` wallet; the platform no longer provisions one server-side.
|
|
65
66
|
- `reppo auth [--force]` — sign in to the platform API (api.reppo.xyz); caches a 24h Bearer token used by `query emissions-due` and other platform-API commands
|
|
66
67
|
- `reppo create-datanet ...` *(planned — currently dashboard-only; the REST endpoint requires a Privy session cookie which is browser auth)*
|
|
67
68
|
- `reppo swap <from> <to> --amount <n>` *(planned, mainnet only)*
|
|
@@ -82,7 +83,7 @@ Also available as a Claude Code skill that teaches agents how to invoke this CLI
|
|
|
82
83
|
claude plugin install reppo
|
|
83
84
|
```
|
|
84
85
|
|
|
85
|
-
The skill ships with the same v0.
|
|
86
|
+
The skill ships with the same v0.3.0 feature subset.
|
|
86
87
|
|
|
87
88
|
## License
|
|
88
89
|
|
package/dist/bin.js
CHANGED
package/dist/chain/abis.d.ts
CHANGED
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
readonly name: "
|
|
1
|
+
export declare const POD_MANAGER_ABI: readonly [{
|
|
2
|
+
readonly name: "mintPodWithREPPO";
|
|
3
3
|
readonly type: "function";
|
|
4
4
|
readonly stateMutability: "nonpayable";
|
|
5
5
|
readonly inputs: readonly [{
|
|
6
6
|
readonly type: "address";
|
|
7
7
|
readonly name: "to";
|
|
8
8
|
}, {
|
|
9
|
-
readonly type: "uint8";
|
|
10
|
-
readonly name: "emissionSharePercent";
|
|
11
|
-
}];
|
|
12
|
-
readonly outputs: readonly [{
|
|
13
9
|
readonly type: "uint256";
|
|
14
|
-
readonly name: "
|
|
10
|
+
readonly name: "subnetId";
|
|
15
11
|
}];
|
|
16
|
-
}, {
|
|
17
|
-
readonly name: "publishingFee";
|
|
18
|
-
readonly type: "function";
|
|
19
|
-
readonly stateMutability: "view";
|
|
20
|
-
readonly inputs: readonly [];
|
|
21
12
|
readonly outputs: readonly [{
|
|
22
13
|
readonly type: "uint256";
|
|
14
|
+
readonly name: "podId";
|
|
23
15
|
}];
|
|
24
16
|
}, {
|
|
25
|
-
readonly name: "
|
|
17
|
+
readonly name: "mintPodWithPrimaryToken";
|
|
26
18
|
readonly type: "function";
|
|
27
|
-
readonly stateMutability: "
|
|
19
|
+
readonly stateMutability: "nonpayable";
|
|
28
20
|
readonly inputs: readonly [{
|
|
21
|
+
readonly type: "address";
|
|
22
|
+
readonly name: "to";
|
|
23
|
+
}, {
|
|
29
24
|
readonly type: "uint256";
|
|
30
|
-
readonly name: "
|
|
25
|
+
readonly name: "subnetId";
|
|
31
26
|
}];
|
|
32
27
|
readonly outputs: readonly [{
|
|
33
|
-
readonly type: "
|
|
28
|
+
readonly type: "uint256";
|
|
29
|
+
readonly name: "podId";
|
|
34
30
|
}];
|
|
35
31
|
}, {
|
|
36
32
|
readonly name: "vote";
|
|
@@ -41,10 +37,10 @@ export declare const POD_MANAGER_MAINNET_ABI: readonly [{
|
|
|
41
37
|
readonly name: "podId";
|
|
42
38
|
}, {
|
|
43
39
|
readonly type: "uint256";
|
|
44
|
-
readonly name: "
|
|
40
|
+
readonly name: "votes";
|
|
45
41
|
}, {
|
|
46
42
|
readonly type: "bool";
|
|
47
|
-
readonly name: "
|
|
43
|
+
readonly name: "upVote";
|
|
48
44
|
}];
|
|
49
45
|
readonly outputs: readonly [];
|
|
50
46
|
}, {
|
|
@@ -60,129 +56,112 @@ export declare const POD_MANAGER_MAINNET_ABI: readonly [{
|
|
|
60
56
|
}];
|
|
61
57
|
readonly outputs: readonly [];
|
|
62
58
|
}, {
|
|
63
|
-
readonly name: "
|
|
59
|
+
readonly name: "claimVoterEmissions";
|
|
64
60
|
readonly type: "function";
|
|
65
|
-
readonly stateMutability: "
|
|
61
|
+
readonly stateMutability: "nonpayable";
|
|
66
62
|
readonly inputs: readonly [{
|
|
67
|
-
readonly type: "
|
|
68
|
-
readonly name: "
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
readonly name: "voter";
|
|
69
65
|
}, {
|
|
70
66
|
readonly type: "uint256";
|
|
71
67
|
readonly name: "podId";
|
|
72
|
-
}
|
|
73
|
-
readonly outputs: readonly [{
|
|
68
|
+
}, {
|
|
74
69
|
readonly type: "uint256";
|
|
70
|
+
readonly name: "epoch";
|
|
75
71
|
}];
|
|
72
|
+
readonly outputs: readonly [];
|
|
76
73
|
}, {
|
|
77
|
-
readonly name: "
|
|
74
|
+
readonly name: "ownerOf";
|
|
78
75
|
readonly type: "function";
|
|
79
76
|
readonly stateMutability: "view";
|
|
80
77
|
readonly inputs: readonly [{
|
|
81
78
|
readonly type: "uint256";
|
|
82
|
-
readonly name: "
|
|
83
|
-
}, {
|
|
84
|
-
readonly type: "uint256";
|
|
85
|
-
readonly name: "podId";
|
|
79
|
+
readonly name: "tokenId";
|
|
86
80
|
}];
|
|
87
81
|
readonly outputs: readonly [{
|
|
88
|
-
readonly type: "
|
|
82
|
+
readonly type: "address";
|
|
89
83
|
}];
|
|
90
84
|
}, {
|
|
91
|
-
readonly name: "
|
|
85
|
+
readonly name: "podValid";
|
|
92
86
|
readonly type: "function";
|
|
93
87
|
readonly stateMutability: "view";
|
|
94
88
|
readonly inputs: readonly [{
|
|
95
89
|
readonly type: "uint256";
|
|
96
|
-
readonly name: "
|
|
90
|
+
readonly name: "podId";
|
|
97
91
|
}];
|
|
98
92
|
readonly outputs: readonly [{
|
|
99
|
-
readonly type: "
|
|
93
|
+
readonly type: "bool";
|
|
100
94
|
}];
|
|
101
95
|
}, {
|
|
102
|
-
readonly name: "
|
|
103
|
-
readonly type: "event";
|
|
104
|
-
readonly inputs: readonly [{
|
|
105
|
-
readonly type: "address";
|
|
106
|
-
readonly name: "from";
|
|
107
|
-
readonly indexed: true;
|
|
108
|
-
}, {
|
|
109
|
-
readonly type: "address";
|
|
110
|
-
readonly name: "to";
|
|
111
|
-
readonly indexed: true;
|
|
112
|
-
}, {
|
|
113
|
-
readonly type: "uint256";
|
|
114
|
-
readonly name: "tokenId";
|
|
115
|
-
readonly indexed: true;
|
|
116
|
-
}];
|
|
117
|
-
}];
|
|
118
|
-
export declare const POD_MANAGER_TESTNET_ABI: readonly [{
|
|
119
|
-
readonly name: "mintPodWithREPPO";
|
|
96
|
+
readonly name: "getPodValidityEpoch";
|
|
120
97
|
readonly type: "function";
|
|
121
|
-
readonly stateMutability: "
|
|
98
|
+
readonly stateMutability: "view";
|
|
122
99
|
readonly inputs: readonly [{
|
|
123
|
-
readonly type: "address";
|
|
124
|
-
readonly name: "to";
|
|
125
|
-
}, {
|
|
126
100
|
readonly type: "uint256";
|
|
127
|
-
readonly name: "
|
|
101
|
+
readonly name: "podId";
|
|
128
102
|
}];
|
|
129
103
|
readonly outputs: readonly [{
|
|
130
104
|
readonly type: "uint256";
|
|
131
|
-
readonly name: "podId";
|
|
132
105
|
}];
|
|
133
106
|
}, {
|
|
134
|
-
readonly name: "
|
|
107
|
+
readonly name: "getPodUpVotesOfEpoch";
|
|
135
108
|
readonly type: "function";
|
|
136
|
-
readonly stateMutability: "
|
|
109
|
+
readonly stateMutability: "view";
|
|
137
110
|
readonly inputs: readonly [{
|
|
138
|
-
readonly type: "
|
|
139
|
-
readonly name: "
|
|
111
|
+
readonly type: "uint256";
|
|
112
|
+
readonly name: "epoch";
|
|
140
113
|
}, {
|
|
141
114
|
readonly type: "uint256";
|
|
142
|
-
readonly name: "
|
|
115
|
+
readonly name: "podId";
|
|
143
116
|
}];
|
|
144
117
|
readonly outputs: readonly [{
|
|
145
118
|
readonly type: "uint256";
|
|
146
|
-
readonly name: "podId";
|
|
147
119
|
}];
|
|
148
120
|
}, {
|
|
149
|
-
readonly name: "
|
|
121
|
+
readonly name: "getPodDownVotesOfEpoch";
|
|
150
122
|
readonly type: "function";
|
|
151
123
|
readonly stateMutability: "view";
|
|
152
124
|
readonly inputs: readonly [{
|
|
153
125
|
readonly type: "uint256";
|
|
154
|
-
readonly name: "
|
|
126
|
+
readonly name: "epoch";
|
|
127
|
+
}, {
|
|
128
|
+
readonly type: "uint256";
|
|
129
|
+
readonly name: "podId";
|
|
155
130
|
}];
|
|
156
131
|
readonly outputs: readonly [{
|
|
157
|
-
readonly type: "
|
|
132
|
+
readonly type: "uint256";
|
|
158
133
|
}];
|
|
159
134
|
}, {
|
|
160
|
-
readonly name: "
|
|
135
|
+
readonly name: "hasPodOwnerClaimedEmissions";
|
|
161
136
|
readonly type: "function";
|
|
162
|
-
readonly stateMutability: "
|
|
137
|
+
readonly stateMutability: "view";
|
|
163
138
|
readonly inputs: readonly [{
|
|
164
139
|
readonly type: "uint256";
|
|
165
|
-
readonly name: "
|
|
140
|
+
readonly name: "epoch";
|
|
166
141
|
}, {
|
|
167
142
|
readonly type: "uint256";
|
|
168
|
-
readonly name: "
|
|
169
|
-
}
|
|
143
|
+
readonly name: "podId";
|
|
144
|
+
}];
|
|
145
|
+
readonly outputs: readonly [{
|
|
170
146
|
readonly type: "bool";
|
|
171
|
-
readonly name: "like_";
|
|
172
147
|
}];
|
|
173
|
-
readonly outputs: readonly [];
|
|
174
148
|
}, {
|
|
175
|
-
readonly name: "
|
|
149
|
+
readonly name: "hasUserClaimedEmissions";
|
|
176
150
|
readonly type: "function";
|
|
177
|
-
readonly stateMutability: "
|
|
151
|
+
readonly stateMutability: "view";
|
|
178
152
|
readonly inputs: readonly [{
|
|
179
153
|
readonly type: "uint256";
|
|
180
|
-
readonly name: "
|
|
154
|
+
readonly name: "epoch";
|
|
181
155
|
}, {
|
|
182
156
|
readonly type: "uint256";
|
|
183
|
-
readonly name: "
|
|
157
|
+
readonly name: "podId";
|
|
158
|
+
}, {
|
|
159
|
+
readonly type: "address";
|
|
160
|
+
readonly name: "user";
|
|
161
|
+
}];
|
|
162
|
+
readonly outputs: readonly [{
|
|
163
|
+
readonly type: "bool";
|
|
184
164
|
}];
|
|
185
|
-
readonly outputs: readonly [];
|
|
186
165
|
}, {
|
|
187
166
|
readonly name: "Transfer";
|
|
188
167
|
readonly type: "event";
|
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":"
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYvB,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
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Minimal ABIs for the Reppo contract surface the CLI touches.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
7
|
-
*
|
|
2
|
+
* Minimal ABIs for the Reppo contract surface the CLI touches.
|
|
3
|
+
*
|
|
4
|
+
* As of PodManager V2 (mainnet impl 0x474d4f03... — verified on basescan),
|
|
5
|
+
* mainnet and testnet share the same PodManager shape:
|
|
6
|
+
* `mintPodWithREPPO(to, subnetId)` / `mintPodWithPrimaryToken(to, subnetId)`
|
|
7
|
+
* for minting, and `vote(podId, votes, upVote)` for voting.
|
|
8
|
+
*
|
|
9
|
+
* The pre-V2 mainnet variant `mintPod(to, emissionSharePercent)` and the
|
|
10
|
+
* `publishingFee()` getter are gone — fee logic moved into SubnetManager
|
|
11
|
+
* (`getAccessFeeREPPO(subnetId)`).
|
|
12
|
+
*
|
|
13
|
+
* The vote selector is unchanged (`vote(uint256,uint256,bool)`) but the
|
|
14
|
+
* second argument's meaning shifted from `subnetId` to `votes` (the voting
|
|
15
|
+
* power to spend on the call). The CLI now requires `--votes <n>`.
|
|
8
16
|
*/
|
|
9
17
|
import { parseAbi } from 'viem';
|
|
10
|
-
export const
|
|
11
|
-
'function mintPod(address to, uint8 emissionSharePercent) returns (uint256 podId)',
|
|
12
|
-
'function publishingFee() view returns (uint256)',
|
|
13
|
-
'function ownerOf(uint256 tokenId) view returns (address)',
|
|
14
|
-
'function vote(uint256 podId, uint256 subnetId, bool like_)',
|
|
15
|
-
'function claimPodOwnerEmissions(uint256 podId, uint256 epoch)',
|
|
16
|
-
'function getPodEmissionsOfEpoch(uint256 epoch, uint256 podId) view returns (uint256)',
|
|
17
|
-
'function hasPodOwnerClaimedEmissions(uint256 epoch, uint256 podId) view returns (bool)',
|
|
18
|
-
'function getEpochTotalVotes(uint256 epoch) view returns (uint256)',
|
|
19
|
-
'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)',
|
|
20
|
-
]);
|
|
21
|
-
export const POD_MANAGER_TESTNET_ABI = parseAbi([
|
|
18
|
+
export const POD_MANAGER_ABI = parseAbi([
|
|
22
19
|
'function mintPodWithREPPO(address to, uint256 subnetId) returns (uint256 podId)',
|
|
23
20
|
'function mintPodWithPrimaryToken(address to, uint256 subnetId) returns (uint256 podId)',
|
|
24
|
-
'function
|
|
25
|
-
'function vote(uint256 podId, uint256 subnetId, bool like_)',
|
|
21
|
+
'function vote(uint256 podId, uint256 votes, bool upVote)',
|
|
26
22
|
'function claimPodOwnerEmissions(uint256 podId, uint256 epoch)',
|
|
23
|
+
'function claimVoterEmissions(address voter, uint256 podId, uint256 epoch)',
|
|
24
|
+
'function ownerOf(uint256 tokenId) view returns (address)',
|
|
25
|
+
'function podValid(uint256 podId) view returns (bool)',
|
|
26
|
+
'function getPodValidityEpoch(uint256 podId) view returns (uint256)',
|
|
27
|
+
'function getPodUpVotesOfEpoch(uint256 epoch, uint256 podId) view returns (uint256)',
|
|
28
|
+
'function getPodDownVotesOfEpoch(uint256 epoch, uint256 podId) view returns (uint256)',
|
|
29
|
+
'function hasPodOwnerClaimedEmissions(uint256 epoch, uint256 podId) view returns (bool)',
|
|
30
|
+
'function hasUserClaimedEmissions(uint256 epoch, uint256 podId, address user) view returns (bool)',
|
|
27
31
|
'event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)',
|
|
28
32
|
]);
|
|
29
33
|
export const SUBNET_MANAGER_ABI = parseAbi([
|
package/dist/chain/abis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abis.js","sourceRoot":"","sources":["../../src/chain/abis.ts"],"names":[],"mappings":"AAAA
|
|
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,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,26 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Network-aware contract resolver. Returns `{ address, abi }` for each
|
|
3
3
|
* contract so callers can't accidentally pair the wrong ABI with the
|
|
4
|
-
* wrong address
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* wrong address.
|
|
5
|
+
*
|
|
6
|
+
* As of PodManager V2 (CLI 0.3.0+), mainnet and testnet share the same
|
|
7
|
+
* PodManager ABI. The pre-V2 mainnet-specific `mintPod(to, share)` /
|
|
8
|
+
* `publishingFee()` shape is gone; both networks use
|
|
9
|
+
* `mintPodWithREPPO(to, subnetId)` and `vote(podId, votes, upVote)`.
|
|
7
10
|
*
|
|
8
11
|
* Throws via requireAddress() if the network's address is the TBD
|
|
9
12
|
* placeholder — fails loud rather than silently calling 0x0.
|
|
10
13
|
*/
|
|
11
14
|
import type { Address } from 'viem';
|
|
12
15
|
import { type Network } from './addresses.js';
|
|
13
|
-
import {
|
|
16
|
+
import { POD_MANAGER_ABI, SUBNET_MANAGER_ABI, VE_REPPO_ABI, ERC20_ABI } from './abis.js';
|
|
14
17
|
export interface Contract<TAbi> {
|
|
15
18
|
address: Address;
|
|
16
19
|
abi: TAbi;
|
|
17
20
|
}
|
|
18
|
-
export declare function podManager(network: Network): Contract<typeof
|
|
21
|
+
export declare function podManager(network: Network): Contract<typeof POD_MANAGER_ABI>;
|
|
19
22
|
export declare function subnetManager(network: Network): Contract<typeof SUBNET_MANAGER_ABI>;
|
|
20
23
|
export declare function veReppo(network: Network): Contract<typeof VE_REPPO_ABI>;
|
|
21
24
|
export declare function reppoToken(network: Network): Contract<typeof ERC20_ABI>;
|
|
22
25
|
export declare function usdcToken(network: Network): Contract<typeof ERC20_ABI>;
|
|
23
|
-
export declare function tryPodManager(network: Network): Contract<typeof
|
|
26
|
+
export declare function tryPodManager(network: Network): Contract<typeof POD_MANAGER_ABI> | null;
|
|
24
27
|
export declare function trySubnetManager(network: Network): Contract<typeof SUBNET_MANAGER_ABI> | null;
|
|
25
28
|
export declare function tryVeReppo(network: Network): Contract<typeof VE_REPPO_ABI> | null;
|
|
26
29
|
export declare function tryReppoToken(network: Network): Contract<typeof ERC20_ABI> | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/chain/contracts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/chain/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,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ist/chain/contracts.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getAddresses, requireAddress } from './addresses.js';
|
|
2
|
-
import {
|
|
2
|
+
import { POD_MANAGER_ABI, SUBNET_MANAGER_ABI, VE_REPPO_ABI, ERC20_ABI, } from './abis.js';
|
|
3
3
|
export function podManager(network) {
|
|
4
4
|
const addrs = getAddresses(network);
|
|
5
5
|
return {
|
|
6
6
|
address: requireAddress(addrs.podManager, 'PodManager'),
|
|
7
|
-
abi:
|
|
7
|
+
abi: POD_MANAGER_ABI,
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
export function subnetManager(network) {
|
|
@@ -49,7 +49,7 @@ export function tryPodManager(network) {
|
|
|
49
49
|
const a = tryAddress(getAddresses(network).podManager);
|
|
50
50
|
if (!a)
|
|
51
51
|
return null;
|
|
52
|
-
return { address: a, abi:
|
|
52
|
+
return { address: a, abi: POD_MANAGER_ABI };
|
|
53
53
|
}
|
|
54
54
|
export function trySubnetManager(network) {
|
|
55
55
|
const a = tryAddress(getAddresses(network).subnetManager);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/chain/contracts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/chain/contracts.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAgB,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,SAAS,GACV,MAAM,WAAW,CAAC;AAOnB,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO;QACL,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,UAAU,EAAE,YAAY,CAAC;QACvD,GAAG,EAAE,eAAe;KACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa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":[],"mappings":"AAaA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/chain/errors.ts"],"names":[],"mappings":"AAaA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAiDD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAoCvD"}
|
package/dist/chain/errors.js
CHANGED
|
@@ -19,11 +19,37 @@ const SELECTORS = {
|
|
|
19
19
|
code: 'PUBLISHER_LACKS_SUBNET_ACCESS',
|
|
20
20
|
hint: 'Grant subnet access to the publisher: `reppo grant-access --subnet <id>`.',
|
|
21
21
|
},
|
|
22
|
-
// Voter-vs-publisher revert observed but not yet name-matched. Keep
|
|
23
|
-
// the raw selector here so the hint still helps even without the name.
|
|
24
22
|
'0x11e43eec': {
|
|
25
|
-
code: '
|
|
26
|
-
hint: '
|
|
23
|
+
code: 'POD_NOT_VALID_FOR_EPOCH',
|
|
24
|
+
hint: 'Pod is not valid for the current voting epoch. Check `reppo query pod <id>` to verify validity; pod publishers may need to republish.',
|
|
25
|
+
},
|
|
26
|
+
'0x7ded0cc1': {
|
|
27
|
+
code: 'CANNOT_VOTE_FOR_OWN_POD',
|
|
28
|
+
hint: 'Publishers cannot vote on their own pods. Use a different voter EOA — set REPPO_VOTER_PRIVATE_KEY to a wallet that did not mint the pod.',
|
|
29
|
+
},
|
|
30
|
+
'0x48582090': {
|
|
31
|
+
code: 'VOTER_LACKS_SUBNET_ACCESS',
|
|
32
|
+
hint: 'Voter lacks subnet access. Run `reppo grant-access --datanet <subnetId>` first.',
|
|
33
|
+
},
|
|
34
|
+
'0x076bb706': {
|
|
35
|
+
code: 'INVALID_SUBNET',
|
|
36
|
+
hint: 'Subnet id does not exist on SubnetManager. Run `reppo list datanets` to find a valid id.',
|
|
37
|
+
},
|
|
38
|
+
'0x826fbca3': {
|
|
39
|
+
code: 'POD_NOT_FOUND',
|
|
40
|
+
hint: 'Pod id does not exist. Run `reppo query pod <id>` to verify.',
|
|
41
|
+
},
|
|
42
|
+
'0x2e9fe0d6': {
|
|
43
|
+
code: 'POD_DOES_NOT_EXIST',
|
|
44
|
+
hint: 'Pod id does not exist. Run `reppo query pod <id>` to verify.',
|
|
45
|
+
},
|
|
46
|
+
'0xcdad98fd': {
|
|
47
|
+
code: 'ZERO_VOTES',
|
|
48
|
+
hint: 'Vote amount cannot be zero. Pass `--votes <n>` with n >= 1.',
|
|
49
|
+
},
|
|
50
|
+
'0x82b42900': {
|
|
51
|
+
code: 'UNAUTHORIZED',
|
|
52
|
+
hint: 'Caller is not authorized for this action.',
|
|
27
53
|
},
|
|
28
54
|
'0xfb8f41b2': {
|
|
29
55
|
code: 'INSUFFICIENT_ALLOWANCE',
|
package/dist/chain/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/chain/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,6BAA6B,EAAE,MAAM,MAAM,CAAC;AAOhE,MAAM,SAAS,GAAiC;IAC9C,YAAY,EAAE;QACZ,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,uIAAuI;KAC9I;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,+BAA+B;QACrC,IAAI,EAAE,2EAA2E;KAClF;IACD,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/chain/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,6BAA6B,EAAE,MAAM,MAAM,CAAC;AAOhE,MAAM,SAAS,GAAiC;IAC9C,YAAY,EAAE;QACZ,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE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3,"file":"claim-emissions.d.ts","sourceRoot":"","sources":["../../src/commands/claim-emissions.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AASzC,qBAAa,qBAAsB,SAAQ,WAAW;IACpD,OAAgB,KAAK,aAAyB;IAE9C,OAAgB,KAAK,4BAUlB;IAEH,GAAG,SAA8C;IACjD,KAAK,SAAgD;IACrD,cAAc,qBAAsC;IACpD,MAAM,UAAsC;IAEtC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAsJjC"}
|
|
@@ -2,18 +2,15 @@
|
|
|
2
2
|
* `reppo claim-emissions --pod <id> --epoch <n>` — claim a pod's
|
|
3
3
|
* emissions for a given epoch.
|
|
4
4
|
*
|
|
5
|
-
* Pre-flight (
|
|
5
|
+
* Pre-flight (V2, both networks):
|
|
6
6
|
* 1. INVALID_POD_ID, INVALID_EPOCH (parse)
|
|
7
7
|
* 2. NOT_POD_OWNER (ownerOf(podId) !== caller)
|
|
8
8
|
* 3. ALREADY_CLAIMED (hasPodOwnerClaimedEmissions(epoch, podId) === true)
|
|
9
|
-
* 4. NO_EMISSIONS_DUE (getPodEmissionsOfEpoch(epoch, podId) === 0)
|
|
10
9
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* getPodEmissionsOfEpoch — caller bears the cost of a doomed
|
|
16
|
-
* re-claim. Documented in usage.)
|
|
10
|
+
* PodManager V2 does not expose a per-pod "emissions due" view, so the
|
|
11
|
+
* legacy NO_EMISSIONS_DUE pre-flight is gone — if there's nothing to
|
|
12
|
+
* claim the contract reverts and the structured decoder surfaces the
|
|
13
|
+
* code.
|
|
17
14
|
*
|
|
18
15
|
* Two-phase write protocol via peekIdempotent.
|
|
19
16
|
*
|
|
@@ -21,7 +18,6 @@
|
|
|
21
18
|
* across different (podId, epoch) is rejected with IDEMPOTENCY_ARGS_MISMATCH.
|
|
22
19
|
*/
|
|
23
20
|
import { Option } from 'clipanion';
|
|
24
|
-
import { formatUnits } from 'viem';
|
|
25
21
|
import { BaseCommand } from './_base.js';
|
|
26
22
|
import { cliError, emit } from '../output/format.js';
|
|
27
23
|
import { createClients, nextNonce } from '../chain/clients.js';
|
|
@@ -93,25 +89,15 @@ export class ClaimEmissionsCommand extends BaseCommand {
|
|
|
93
89
|
if (owner.toLowerCase() !== clients.account.address.toLowerCase()) {
|
|
94
90
|
throw cliError('NOT_POD_OWNER', `Pod ${podId} is owned by ${owner}, not by the configured signer ${clients.account.address}.`, 'Use the private key of the pod owner.');
|
|
95
91
|
}
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
address: pm.address, abi: pm.abi, functionName: 'getPodEmissionsOfEpoch', args: [epoch, podId],
|
|
106
|
-
}),
|
|
107
|
-
]);
|
|
108
|
-
if (alreadyClaimed) {
|
|
109
|
-
throw cliError('ALREADY_CLAIMED', `Pod ${podId} emissions for epoch ${epoch} have already been claimed.`, 'Nothing to do — pick a different epoch.');
|
|
110
|
-
}
|
|
111
|
-
if (due === 0n) {
|
|
112
|
-
throw cliError('NO_EMISSIONS_DUE', `Pod ${podId} has no emissions due for epoch ${epoch}.`, 'Try a different epoch (e.g. one where the pod received votes).');
|
|
113
|
-
}
|
|
114
|
-
amountDue = due;
|
|
92
|
+
// Pre-flight: already-claimed check. PodManager V2 does not
|
|
93
|
+
// expose a per-pod "emissions due" view, so we no longer pre-
|
|
94
|
+
// flight NO_EMISSIONS_DUE — the contract reverts cleanly if
|
|
95
|
+
// there's nothing to claim and the decoder surfaces the code.
|
|
96
|
+
const alreadyClaimed = await clients.publicClient.readContract({
|
|
97
|
+
address: pm.address, abi: pm.abi, functionName: 'hasPodOwnerClaimedEmissions', args: [epoch, podId],
|
|
98
|
+
});
|
|
99
|
+
if (alreadyClaimed) {
|
|
100
|
+
throw cliError('ALREADY_CLAIMED', `Pod ${podId} emissions for epoch ${epoch} have already been claimed.`, 'Nothing to do — pick a different epoch.');
|
|
115
101
|
}
|
|
116
102
|
if (this.dryRun) {
|
|
117
103
|
const sim = await clients.publicClient.simulateContract({
|
|
@@ -126,9 +112,7 @@ export class ClaimEmissionsCommand extends BaseCommand {
|
|
|
126
112
|
podId: podId.toString(),
|
|
127
113
|
epoch: epoch.toString(),
|
|
128
114
|
owner,
|
|
129
|
-
|
|
130
|
-
? { amountDue: { raw: amountDue.toString(), formatted: formatUnits(amountDue, 18) } }
|
|
131
|
-
: { amountDue: { unavailable: 'testnet ABI does not expose getPodEmissionsOfEpoch' } }),
|
|
115
|
+
amountDue: { unavailable: 'PodManager V2 does not expose a per-pod emissions-due view' },
|
|
132
116
|
gas: sim.request.gas?.toString() ?? null,
|
|
133
117
|
});
|
|
134
118
|
return 0;
|
|
@@ -163,9 +147,7 @@ export class ClaimEmissionsCommand extends BaseCommand {
|
|
|
163
147
|
txHash: tx,
|
|
164
148
|
podId: podId.toString(),
|
|
165
149
|
epoch: epoch.toString(),
|
|
166
|
-
|
|
167
|
-
? { amountClaimed: { raw: amountDue.toString(), formatted: formatUnits(amountDue, 18) } }
|
|
168
|
-
: { amountClaimed: { unavailable: 'testnet ABI does not expose getPodEmissionsOfEpoch' } }),
|
|
150
|
+
amountClaimed: { unavailable: 'PodManager V2 does not expose a per-pod emissions-due view' },
|
|
169
151
|
block: receipt.blockNumber.toString(),
|
|
170
152
|
basescanUrl: cfg.network === 'mainnet'
|
|
171
153
|
? `https://basescan.org/tx/${tx}`
|
|
@@ -173,12 +155,9 @@ export class ClaimEmissionsCommand extends BaseCommand {
|
|
|
173
155
|
};
|
|
174
156
|
if (this.idempotencyKey)
|
|
175
157
|
await markConfirmed(this.idempotencyKey, COMMAND, args, result, tx);
|
|
176
|
-
const amountStr = amountDue !== null
|
|
177
|
-
? `${formatUnits(amountDue, 18)} REPPO`
|
|
178
|
-
: '(amount unknown — testnet)';
|
|
179
158
|
emit(result, [
|
|
180
159
|
`✓ Claimed pod ${podId} emissions for epoch ${epoch}`,
|
|
181
|
-
` amount:
|
|
160
|
+
` amount: (unknown — V2 has no per-pod emissions-due view)`,
|
|
182
161
|
` tx: ${result.basescanUrl}`,
|
|
183
162
|
` block: ${receipt.blockNumber}`,
|
|
184
163
|
]);
|