@gzeoneth/gov-tracker 0.2.1-beta.b2eeb41 → 0.2.1-beta.e9f73a3
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 +86 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,40 +9,30 @@ Track and execute Arbitrum DAO governance proposal lifecycle stages.
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
yarn add @gzeoneth/gov-tracker
|
|
12
|
+
yarn add @gzeoneth/gov-tracker
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import {
|
|
19
|
-
import { createTracker, findExecutableStage, ADDRESSES } from "@gzeoneth/gov-tracker";
|
|
18
|
+
import { createTracker, ADDRESSES } from "@gzeoneth/gov-tracker";
|
|
20
19
|
|
|
21
20
|
// Use StaticJsonRpcProvider for better performance
|
|
22
21
|
const tracker = createTracker({
|
|
23
|
-
l2Provider: new ethers.providers.StaticJsonRpcProvider(
|
|
24
|
-
l1Provider: new ethers.providers.StaticJsonRpcProvider(
|
|
25
|
-
novaProvider: new ethers.providers.StaticJsonRpcProvider(
|
|
26
|
-
cachePath: "./gov-tracker-cache.json",
|
|
22
|
+
l2Provider: new ethers.providers.StaticJsonRpcProvider(ARB1_RPC_URL),
|
|
23
|
+
l1Provider: new ethers.providers.StaticJsonRpcProvider(ETH_RPC_URL),
|
|
24
|
+
novaProvider: new ethers.providers.StaticJsonRpcProvider(NOVA_RPC),
|
|
27
25
|
});
|
|
28
26
|
|
|
29
|
-
// Track from
|
|
30
|
-
const results = await tracker.trackByTxHash("0x...");
|
|
31
|
-
for (const stage of results[0].stages) {
|
|
32
|
-
console.log(`${stage.type}: ${stage.status}`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Or track from governor
|
|
27
|
+
// Track from governor proposal
|
|
36
28
|
const result = await tracker.trackFromGovernor(ADDRESSES.CONSTITUTIONAL_GOVERNOR, proposalId);
|
|
37
29
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (readyStage) {
|
|
41
|
-
const prep = await tracker.prepareTransaction(readyStage);
|
|
42
|
-
if (prep.success) {
|
|
43
|
-
await signer.sendTransaction(prep.prepared);
|
|
44
|
-
}
|
|
30
|
+
for (const stage of result.stages) {
|
|
31
|
+
console.log(`${stage.type}: ${stage.status}`);
|
|
45
32
|
}
|
|
33
|
+
|
|
34
|
+
// Track from transaction hash
|
|
35
|
+
const results = await tracker.trackByTxHash("0x...");
|
|
46
36
|
```
|
|
47
37
|
|
|
48
38
|
## Stages
|
|
@@ -59,34 +49,89 @@ if (readyStage) {
|
|
|
59
49
|
|
|
60
50
|
Statuses: `NOT_STARTED`, `PENDING`, `READY`, `COMPLETED`, `FAILED`, `SKIPPED`
|
|
61
51
|
|
|
52
|
+
## Execution
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { findExecutableStage } from "@gzeoneth/gov-tracker";
|
|
56
|
+
|
|
57
|
+
const readyStage = findExecutableStage(result.stages);
|
|
58
|
+
if (readyStage) {
|
|
59
|
+
const prepResult = await tracker.prepareTransaction(readyStage);
|
|
60
|
+
if (prepResult.success) {
|
|
61
|
+
const { to, data, value, chain } = prepResult.prepared;
|
|
62
|
+
const tx = await signer.sendTransaction({ to, data, value });
|
|
63
|
+
await tx.wait();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Calldata Decoding & Simulation
|
|
69
|
+
|
|
70
|
+
Decode proposal calldata and prepare simulation data for Tenderly, Foundry, or other tools.
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import {
|
|
74
|
+
decodeCalldata,
|
|
75
|
+
extractAllSimulationsFromDecoded,
|
|
76
|
+
getAddressLabel
|
|
77
|
+
} from "@gzeoneth/gov-tracker";
|
|
78
|
+
|
|
79
|
+
// Decode proposal actions
|
|
80
|
+
const stage = result.stages[0]; // PROPOSAL_CREATED
|
|
81
|
+
const { calldatas, targets } = stage.data;
|
|
82
|
+
|
|
83
|
+
for (let i = 0; i < calldatas.length; i++) {
|
|
84
|
+
const decoded = await decodeCalldata(calldatas[i], targets[i], 0, "arb1");
|
|
85
|
+
|
|
86
|
+
console.log(`${decoded.signature}`);
|
|
87
|
+
console.log(`Target: ${getAddressLabel(targets[i], "arb1")}`);
|
|
88
|
+
|
|
89
|
+
// Extract simulation data
|
|
90
|
+
const sims = extractAllSimulationsFromDecoded(decoded, "arb1");
|
|
91
|
+
for (const sim of sims) {
|
|
92
|
+
console.log(`Network: ${sim.simulation.networkId}`);
|
|
93
|
+
console.log(`From: ${sim.simulation.from}`);
|
|
94
|
+
console.log(`To: ${sim.simulation.to}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See [Examples](./docs/EXAMPLES.md#calldata-decoding--simulation) for Tenderly and Foundry integration.
|
|
100
|
+
|
|
62
101
|
## CLI
|
|
63
102
|
|
|
64
103
|
```bash
|
|
65
|
-
# Track a proposal
|
|
104
|
+
# Track a proposal by transaction hash
|
|
66
105
|
npx @gzeoneth/gov-tracker track 0x...
|
|
67
106
|
|
|
68
|
-
# Track AND
|
|
69
|
-
npx @gzeoneth/gov-tracker track 0x...
|
|
107
|
+
# Track AND inspect calldata (new in v0.2.1)
|
|
108
|
+
npx @gzeoneth/gov-tracker track 0x... --inspect
|
|
109
|
+
npx @gzeoneth/gov-tracker track 0x... -i # shorthand
|
|
70
110
|
|
|
71
111
|
# Decode calldata only (no tracking)
|
|
72
112
|
npx @gzeoneth/gov-tracker track 0x... --inspect-only
|
|
73
113
|
|
|
74
|
-
# Show simulation data
|
|
114
|
+
# Show simulation data for Tenderly/Foundry integration
|
|
75
115
|
npx @gzeoneth/gov-tracker track 0x... --show-simulation
|
|
76
116
|
|
|
77
|
-
# Execute ready stages
|
|
117
|
+
# Execute ready stages (with shorthands)
|
|
78
118
|
npx @gzeoneth/gov-tracker track 0x... -w --private-key $PRIVATE_KEY
|
|
119
|
+
npx @gzeoneth/gov-tracker track 0x... -v -p -w --private-key $PRIVATE_KEY # verbose + prepare + write
|
|
79
120
|
|
|
80
121
|
# Discover and track all proposals
|
|
81
122
|
npx @gzeoneth/gov-tracker run
|
|
82
123
|
|
|
83
|
-
# Disable caching
|
|
124
|
+
# Disable caching (useful for one-off checks)
|
|
84
125
|
npx @gzeoneth/gov-tracker track 0x... --no-cache
|
|
85
126
|
```
|
|
86
127
|
|
|
87
|
-
**Shorthands
|
|
128
|
+
**CLI Shorthands** (v0.2.1+):
|
|
129
|
+
- `-v` for `--verbose` - Enable verbose logging
|
|
130
|
+
- `-p` for `--prepare` - Prepare transactions for ready stages
|
|
131
|
+
- `-w` for `--write` - Execute prepared transactions
|
|
132
|
+
- `-i` for `--inspect` - Track AND decode calldata
|
|
88
133
|
|
|
89
|
-
**Bundled Cache**: The CLI includes a pre-built cache of completed proposals. On first run, this
|
|
134
|
+
**Bundled Cache**: The CLI includes a pre-built cache of completed proposals (~95 proposals). On first run, this is copied to your local cache directory, eliminating initial discovery RPC calls. SDK users can access via `getBundledCachePath()` (Node.js) or direct JSON import for bundlers - see [Bundled Cache](./docs/EXAMPLES.md#bundled-cache-bootstrap).
|
|
90
135
|
|
|
91
136
|
## Environment
|
|
92
137
|
|
|
@@ -97,23 +142,29 @@ NOVA_RPC=https://nova.arbitrum.io/rpc
|
|
|
97
142
|
PRIVATE_KEY=0x... # For execution
|
|
98
143
|
```
|
|
99
144
|
|
|
100
|
-
The CLI warns when using default public RPCs. For production, set these environment variables.
|
|
101
|
-
|
|
102
145
|
## Security & Privacy
|
|
103
146
|
|
|
104
|
-
**
|
|
147
|
+
**RPC URLs**: The CLI warns when using default public RPCs. For production use, set `ETH_RPC`, `ARB1_RPC`, and `NOVA_RPC` environment variables to avoid rate limits and ensure reliability.
|
|
148
|
+
|
|
149
|
+
**External API Lookups**: When decoding calldata, unknown function selectors are looked up via [4byte.directory](https://www.4byte.directory/). This sends selector hashes to an external API. To disable:
|
|
105
150
|
|
|
106
151
|
```bash
|
|
152
|
+
# Via environment variable
|
|
107
153
|
DISABLE_4BYTE_LOOKUP=1 npx @gzeoneth/gov-tracker track 0x...
|
|
108
154
|
```
|
|
109
155
|
|
|
110
156
|
```typescript
|
|
157
|
+
// Via SDK option
|
|
111
158
|
import { lookupSignature } from "@gzeoneth/gov-tracker";
|
|
159
|
+
|
|
112
160
|
const result = await lookupSignature("0x12345678", { disableApiLookup: true });
|
|
113
161
|
```
|
|
114
162
|
|
|
163
|
+
When disabled, only local signatures (governance-related functions) are available.
|
|
164
|
+
|
|
115
165
|
## Documentation
|
|
116
166
|
|
|
167
|
+
- [Getting Started](./docs/GETTING_STARTED.md) - Installation and basic usage
|
|
117
168
|
- [API Reference](./docs/API.md) - Complete API documentation
|
|
118
169
|
- [Examples](./docs/EXAMPLES.md) - Common patterns and use cases
|
|
119
170
|
- [Architecture](./docs/ARCHITECTURE.md) - SDK internals and design
|
|
@@ -124,10 +175,12 @@ const result = await lookupSignature("0x12345678", { disableApiLookup: true });
|
|
|
124
175
|
yarn build # Compile TypeScript
|
|
125
176
|
yarn test # Run fast tests (no RPC)
|
|
126
177
|
yarn test:coverage # Run tests with coverage
|
|
178
|
+
yarn test:coverage:fork # Run fork tests with coverage (requires archive RPC)
|
|
179
|
+
yarn test:coverage:all # Merge all coverage reports
|
|
127
180
|
yarn lint # Run ESLint
|
|
128
181
|
```
|
|
129
182
|
|
|
130
|
-
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development workflow.
|
|
183
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for development workflow and publishing instructions.
|
|
131
184
|
|
|
132
185
|
## Terminology
|
|
133
186
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gzeoneth/gov-tracker",
|
|
3
|
-
"version": "0.2.1-beta.
|
|
3
|
+
"version": "0.2.1-beta.e9f73a3",
|
|
4
4
|
"description": "Lightweight, high-performance library for tracking Arbitrum DAO governance proposal lifecycle stages",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "gzeoneth",
|