@rocketh/verifier 0.17.18 → 0.17.20
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 +279 -3
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -1,7 +1,283 @@
|
|
|
1
1
|
# @rocketh/verifier
|
|
2
2
|
|
|
3
|
-
Contract verification tool for
|
|
3
|
+
Contract verification tool for Rocketh. Submit your deployed contracts for verification on Etherscan, Sourcify, Blockscout, and other verification services.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- ✅ **Multi-Platform** - Support for Etherscan, Sourcify, and Blockscout
|
|
8
|
+
- 🔧 **CLI Tool** - Easy-to-use command line interface
|
|
9
|
+
- 📦 **Automatic Metadata** - Uses deployment metadata for verification
|
|
10
|
+
- ⚙️ **Configurable** - Custom endpoints, API keys, and options
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Using pnpm
|
|
16
|
+
pnpm add @rocketh/verifier
|
|
17
|
+
|
|
18
|
+
# Using npm
|
|
19
|
+
npm install @rocketh/verifier
|
|
20
|
+
|
|
21
|
+
# Using yarn
|
|
22
|
+
yarn add @rocketh/verifier
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## CLI Usage
|
|
26
|
+
|
|
27
|
+
The package provides a `rocketh-verify` CLI command.
|
|
28
|
+
|
|
29
|
+
### Verify on Etherscan
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Basic usage
|
|
33
|
+
rocketh-verify -e mainnet etherscan
|
|
34
|
+
|
|
35
|
+
# With custom options
|
|
36
|
+
rocketh-verify -e mainnet etherscan --license MIT --force-license
|
|
37
|
+
|
|
38
|
+
# With custom endpoint (for Etherscan-compatible explorers)
|
|
39
|
+
rocketh-verify -e polygon etherscan --endpoint https://api.polygonscan.com/api
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Verify on Sourcify
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Basic usage
|
|
46
|
+
rocketh-verify -e mainnet sourcify
|
|
47
|
+
|
|
48
|
+
# With custom endpoint
|
|
49
|
+
rocketh-verify -e mainnet sourcify --endpoint https://sourcify.dev/server
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Verify on Blockscout
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Basic usage
|
|
56
|
+
rocketh-verify -e mainnet blockscout
|
|
57
|
+
|
|
58
|
+
# With custom endpoint
|
|
59
|
+
rocketh-verify -e gnosis blockscout --endpoint https://blockscout.com/xdai/mainnet/api
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Export Metadata
|
|
63
|
+
|
|
64
|
+
Export contract metadata for manual verification:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
rocketh-verify -e mainnet metadata --out ./metadata
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## CLI Options
|
|
71
|
+
|
|
72
|
+
### Global Options
|
|
73
|
+
|
|
74
|
+
| Option | Description |
|
|
75
|
+
|--------|-------------|
|
|
76
|
+
| `-e, --environment <value>` | **(Required)** Environment/network name |
|
|
77
|
+
| `-d, --deployments <value>` | Deployments folder path |
|
|
78
|
+
|
|
79
|
+
### Etherscan Options
|
|
80
|
+
|
|
81
|
+
| Option | Description |
|
|
82
|
+
|--------|-------------|
|
|
83
|
+
| `--endpoint <value>` | Custom API endpoint |
|
|
84
|
+
| `--license <value>` | Source code license (e.g., MIT, GPL-3.0) |
|
|
85
|
+
| `--force-license` | Force the specified license |
|
|
86
|
+
| `--min-interval <value>` | Minimum interval between requests (ms) |
|
|
87
|
+
| `--fix-mispell` | Fix misspelled form fields (some APIs) |
|
|
88
|
+
|
|
89
|
+
**Environment Variable:** `ETHERSCAN_API_KEY`
|
|
90
|
+
|
|
91
|
+
### Sourcify Options
|
|
92
|
+
|
|
93
|
+
| Option | Description |
|
|
94
|
+
|--------|-------------|
|
|
95
|
+
| `--endpoint <value>` | Custom Sourcify endpoint |
|
|
96
|
+
| `--min-interval <value>` | Minimum interval between requests (ms) |
|
|
97
|
+
|
|
98
|
+
### Blockscout Options
|
|
99
|
+
|
|
100
|
+
| Option | Description |
|
|
101
|
+
|--------|-------------|
|
|
102
|
+
| `--endpoint <value>` | Custom Blockscout API endpoint |
|
|
103
|
+
| `--min-interval <value>` | Minimum interval between requests (ms) |
|
|
104
|
+
|
|
105
|
+
## Programmatic Usage
|
|
106
|
+
|
|
107
|
+
You can also use the verifier programmatically:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { run } from '@rocketh/verifier';
|
|
111
|
+
|
|
112
|
+
await run(resolvedConfig, 'mainnet', {
|
|
113
|
+
verifier: {
|
|
114
|
+
type: 'etherscan',
|
|
115
|
+
apiKey: process.env.ETHERSCAN_API_KEY,
|
|
116
|
+
license: 'MIT',
|
|
117
|
+
},
|
|
118
|
+
deploymentNames: ['MyContract', 'MyToken'], // Optional: specific contracts
|
|
119
|
+
minInterval: 1000, // Optional: rate limiting
|
|
120
|
+
logErrorOnFailure: true,
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## API Reference
|
|
125
|
+
|
|
126
|
+
### `run(config, environmentName, options)`
|
|
127
|
+
|
|
128
|
+
Runs the verification process.
|
|
129
|
+
|
|
130
|
+
**Parameters:**
|
|
131
|
+
|
|
132
|
+
- `config: ResolvedUserConfig` - Resolved Rocketh configuration
|
|
133
|
+
- `environmentName: string` - Name of the environment (e.g., 'mainnet', 'sepolia')
|
|
134
|
+
- `options: VerificationOptions` - Verification options
|
|
135
|
+
|
|
136
|
+
### Verification Options
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
interface VerificationOptions {
|
|
140
|
+
verifier: EtherscanOptions | SourcifyOptions | BlockscoutOptions;
|
|
141
|
+
deploymentNames?: string[]; // Specific contracts to verify
|
|
142
|
+
minInterval?: number; // Rate limiting (ms between requests)
|
|
143
|
+
logErrorOnFailure?: boolean; // Log errors instead of throwing
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Etherscan Options
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
interface EtherscanOptions {
|
|
151
|
+
type: 'etherscan';
|
|
152
|
+
endpoint?: string; // Custom API endpoint
|
|
153
|
+
apiKey?: string; // Etherscan API key
|
|
154
|
+
license?: string; // SPDX license identifier
|
|
155
|
+
forceLicense?: boolean; // Override contract license
|
|
156
|
+
fixMispell?: boolean; // Fix API form field spelling
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Sourcify Options
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
interface SourcifyOptions {
|
|
164
|
+
type: 'sourcify';
|
|
165
|
+
endpoint?: string; // Custom Sourcify endpoint
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Blockscout Options
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
interface BlockscoutOptions {
|
|
173
|
+
type: 'blockscout';
|
|
174
|
+
endpoint?: string; // Custom Blockscout API endpoint
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Supported Networks
|
|
179
|
+
|
|
180
|
+
### Etherscan Networks
|
|
181
|
+
|
|
182
|
+
The verifier automatically detects the correct Etherscan endpoint for common networks:
|
|
183
|
+
|
|
184
|
+
| Network | Chain ID | Endpoint |
|
|
185
|
+
|---------|----------|----------|
|
|
186
|
+
| Ethereum Mainnet | 1 | api.etherscan.io |
|
|
187
|
+
| Goerli | 5 | api-goerli.etherscan.io |
|
|
188
|
+
| Sepolia | 11155111 | api-sepolia.etherscan.io |
|
|
189
|
+
| Polygon | 137 | api.polygonscan.com |
|
|
190
|
+
| Arbitrum | 42161 | api.arbiscan.io |
|
|
191
|
+
| Optimism | 10 | api-optimistic.etherscan.io |
|
|
192
|
+
| Base | 8453 | api.basescan.org |
|
|
193
|
+
|
|
194
|
+
For other networks, use the `--endpoint` option.
|
|
195
|
+
|
|
196
|
+
### Sourcify
|
|
197
|
+
|
|
198
|
+
Sourcify supports all EVM chains. The default endpoint is `https://sourcify.dev/server`.
|
|
199
|
+
|
|
200
|
+
### Blockscout
|
|
201
|
+
|
|
202
|
+
Blockscout is self-hosted by many chains. Use the `--endpoint` option to specify the correct API URL for your chain.
|
|
203
|
+
|
|
204
|
+
## Examples
|
|
205
|
+
|
|
206
|
+
### Verify All Contracts on Mainnet
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
# Set your API key
|
|
210
|
+
export ETHERSCAN_API_KEY=your-api-key
|
|
211
|
+
|
|
212
|
+
# Verify all deployed contracts
|
|
213
|
+
rocketh-verify -e mainnet etherscan
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Verify Specific Contracts
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import { run } from '@rocketh/verifier';
|
|
220
|
+
|
|
221
|
+
await run(config, 'mainnet', {
|
|
222
|
+
verifier: {
|
|
223
|
+
type: 'etherscan',
|
|
224
|
+
apiKey: process.env.ETHERSCAN_API_KEY,
|
|
225
|
+
},
|
|
226
|
+
deploymentNames: ['Token', 'TokenSale'], // Only verify these
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Verify on Multiple Platforms
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Verify on Etherscan
|
|
234
|
+
rocketh-verify -e mainnet etherscan
|
|
235
|
+
|
|
236
|
+
# Also verify on Sourcify for decentralized verification
|
|
237
|
+
rocketh-verify -e mainnet sourcify
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Custom Deployments Folder
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
rocketh-verify -d ./custom-deployments -e mainnet etherscan
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Troubleshooting
|
|
247
|
+
|
|
248
|
+
### "Already Verified"
|
|
249
|
+
|
|
250
|
+
This is not an error - it means the contract is already verified on the platform.
|
|
251
|
+
|
|
252
|
+
### Rate Limiting
|
|
253
|
+
|
|
254
|
+
Use `--min-interval` to add delays between verification requests:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
rocketh-verify -e mainnet etherscan --min-interval 5000
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Missing API Key
|
|
261
|
+
|
|
262
|
+
Etherscan requires an API key. Get one at:
|
|
263
|
+
- [Etherscan](https://etherscan.io/apis)
|
|
264
|
+
- [Polygonscan](https://polygonscan.com/apis)
|
|
265
|
+
- [Arbiscan](https://arbiscan.io/apis)
|
|
266
|
+
|
|
267
|
+
### Wrong Network Endpoint
|
|
268
|
+
|
|
269
|
+
For Etherscan-compatible explorers, ensure you're using the correct API endpoint:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
rocketh-verify -e bsc etherscan --endpoint https://api.bscscan.com/api
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Related Packages
|
|
276
|
+
|
|
277
|
+
- [`rocketh`](../rocketh) - Core deployment environment
|
|
278
|
+
- [`@rocketh/node`](../rocketh-node) - Node.js deployment executor
|
|
279
|
+
- [`@rocketh/deploy`](../rocketh-deploy) - Standard deployment functions
|
|
280
|
+
|
|
281
|
+
## License
|
|
282
|
+
|
|
283
|
+
[MIT](../../LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocketh/verifier",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.20",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"description": "submit verification proof to verifier services (blockchain explorer, sourcify...",
|
|
5
6
|
"publishConfig": {
|
|
6
7
|
"access": "public"
|
|
@@ -32,17 +33,17 @@
|
|
|
32
33
|
"fs-extra": "^11.3.3",
|
|
33
34
|
"ldenv": "^0.3.16",
|
|
34
35
|
"neoqs": "^6.13.0",
|
|
35
|
-
"@rocketh/core": "0.17.
|
|
36
|
+
"@rocketh/core": "0.17.11"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@types/node": "^25.0.10",
|
|
39
|
-
"as-soon": "^0.1.
|
|
40
|
+
"as-soon": "^0.1.5",
|
|
40
41
|
"rimraf": "^6.1.2",
|
|
41
42
|
"typescript": "^5.9.3",
|
|
42
|
-
"@rocketh/node": "0.17.
|
|
43
|
+
"@rocketh/node": "0.17.20"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
|
-
"@rocketh/node": "0.17.
|
|
46
|
+
"@rocketh/node": "0.17.20"
|
|
46
47
|
},
|
|
47
48
|
"scripts": {
|
|
48
49
|
"build": "tsc --project tsconfig.json",
|