-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathtruffle.ts
613 lines (612 loc) · 17.4 KB
/
truffle.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
const truffleCommands: Fig.Suggestion[] = [
{
name: "build",
},
{
name: "compile",
},
{
name: "config",
},
{
name: "console",
},
{
name: "create",
},
{
name: "debug",
},
{
name: "deploy",
},
{
name: "develop",
},
{
name: "exec",
},
{
name: "help",
},
{
name: "init",
},
{
name: "install",
},
{
name: "networks",
},
{
name: "obtain",
},
{
name: "opcode",
},
{
name: "publish",
},
{
name: "run",
},
{
name: "version",
},
{
name: "watch",
},
{
name: "preserve",
},
{
name: "migrate",
},
{
name: "unbox",
},
{
name: "test",
},
];
const completionSpec: Fig.Spec = {
name: "truffle",
description:
"A world class development environment, testing framework and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM), aiming to make life as a developer easier",
subcommands: [
{
name: "build",
description: "Execute build pipeline (if configuration present)",
},
{
name: "compile",
description: "Compile contract source files",
options: [
{
name: "--list",
description:
"List all recent stable releases from solc-bin. If filter is specified then it will display only that type of release or docker tags",
args: {
name: "filter",
description:
"The filter parameter must be one of the following: prereleases, releases, latestRelease or docker",
suggestions: [
{
name: "prereleases",
},
{
name: "releases",
},
{
name: "latestRelease",
},
{
name: "docker",
},
],
},
},
{
name: "--all",
description:
"Compile all contracts instead of only the contracts changed since last compile",
},
{
name: "--quiet",
description: "Suppress all compilation output",
},
],
},
{
name: "config",
description: "Set user-level configuration options",
subcommands: [
{
name: "get",
description: "Get a Truffle configuration option value",
args: {
name: "key",
},
},
{
name: "set",
description: "Set a Truffle configuration option value",
args: [
{
name: "key",
},
{
name: "value-for-set",
},
],
},
],
options: [
{
name: "--enable-analytics",
description: "Enable Truffle to send usage data to Google Analytics",
exclusiveOn: ["--disable-analytics"],
},
{
name: "--disable-analytics",
description:
"Disable Truffle's ability to send usage data to Google Analytics",
exclusiveOn: ["--enable-analytics"],
},
],
},
{
name: "console",
description:
"Run a console with contract abstractions and commands available",
options: [
{
name: "--network",
description: "Specify the network to use",
args: {
name: "name",
description: "Network name must exist in the configuration",
},
},
{
name: "--verbose-rpc",
description:
"Log communication between Truffle and the Ethereum client",
},
{
name: ["--require", "-r"],
description:
"Preload console environment from required JavaScript file",
args: {
name: "file",
description:
'The default export must be an object with named keys that will be used to populate the console environment. For example, if your JavaScript is module.exports = { desert: "yes please!" } then breakfast will be available in the console with the value "yes please!."',
template: "filepaths",
},
},
{
name: "--require-none",
description:
"Do not load any user-defined JavaScript into the console environment. This option takes precedence over --require, -r, and values provided for console.require in your project's truffle-config.js",
},
],
},
{
name: "create",
description: "Helper to create new contracts, migrations and tests",
args: [
{
name: "artifact_type",
description:
"Create a new artifact where artifact_type is one of the following: contract, migration, test or all. The new artifact is created along with one(or all) of the followingfiles: `contracts/ArtifactName.sol`, `migrations/####_artifact_name.js` or`tests/artifact_name.js`. (required)",
suggestions: [
{
name: "contract",
},
{
name: "migration",
},
{
name: "test",
},
{
name: "all",
},
],
},
{
name: "ArtifactName",
description: "Name of new artifact. (required)",
},
],
},
{
name: "debug",
description: "Interactively debug any transaction on the blockchain",
args: {
name: "transaction_hash",
isOptional: true,
description:
"Transaction ID to use for debugging. You can omit this to simply start the debugger and then load a transaction later",
},
options: [
{
name: "--network",
description: "The network to connect to",
args: {
name: "network",
},
},
{
name: ["--fetch-external", "-x"],
description:
"Allows the debugger to download source from source verification services to debug transactions involving external contracts. When used, a transaction hash is required. May be abbreviated -x",
},
{
name: "--compile-tests",
description:
"Allows the debugger to compile Solidity test contracts. Implies --compile-all",
exclusiveOn: ["--compile-all", "--compile-none"],
},
{
name: "--compile-all",
description:
"Forces the debugger to recompile all contracts, even when it would otherwise judge doing so unnecessary. Compilation results are not saved",
exclusiveOn: ["--compile-tests", "--compile-none"],
},
{
name: "--compile-none",
description:
"Forces the debugger not to recompile contracts, even when it would otherwise judge it necessary. This option is dangerous and may cause errors. Please only use this if you are sure a recompilation is not necessary",
exclusiveOn: ["--compile-tests", "--compile-all"],
},
],
},
{
name: "deploy",
description: "Alias for migrate. See migrate for details",
},
{
name: "develop",
description: "Open a console with a development blockchaine",
options: [
{
name: "--log",
description:
"Start/Connect to a Truffle develop session and log all RPC activity. See the Log RPC Activity docs for more information about using this option",
args: {
name: "network",
},
},
{
name: ["--require", "-r"],
description:
"Preload console environment from required JavaScript file",
args: {
name: "file",
description:
'The default export must be an object with named keys that will be used to populate the console environment. For example, if your JavaScript is module.exports = { desert: "yes please!" } then breakfast will be available in the console with the value "yes please!."',
template: "filepaths",
},
},
{
name: "--require-none",
description:
"Do not load any user-defined JavaScript into the console environment. This option takes precedence over --require, -r, and values provided for console.require in your project's truffle-config.js",
},
],
},
{
name: "exec",
description: "Execute a JS module within the Truffle environment",
args: {
name: "script.js",
description:
"JavaScript file to be executed. Can include path information if the script does not exist in the current directory. (required)",
template: "filepaths",
},
options: [
{
name: "--network",
description:
"Specify the network to use, using artifacts specific to that network",
args: {
name: "name",
description: "Network name must exist in the configuration",
},
},
{
name: "--compile",
description: "Compile contracts before executing the script",
},
],
},
{
name: "help",
description:
"Display a list of all commands or information about a specific command",
args: {
name: "command",
description: "Display usage information about the specified command",
suggestions: truffleCommands,
},
},
{
name: "init",
description: "Initialize new and empty Ethereum project",
options: [
{
name: "--force",
description:
"Initialize project regardless of the current working directory's state. Be careful, this could overwrite existing files that have name conflicts",
isDangerous: true,
},
],
},
{
name: "install",
description: "Install a package from the Ethereum Package Registry",
args: [
{
name: "package_name",
description:
"Name of the package as listed in the Ethereum Package Registry. (required)",
},
{
name: "@version",
description:
"When specified, will install a specific version of the package, otherwise will install the latest version",
},
],
},
{
name: "networks",
description: "Show addresses for deployed contracts on each network",
options: [
{
name: "--clean",
description:
"Remove all network artifacts that aren't associated with a named network",
},
],
},
{
name: "obtain",
description: "Fetch and cache a specified compiler",
options: [
{
name: "--solc",
description:
"Download and cache a version of the solc compiler. (required)",
isRequired: true,
args: {
name: "version",
},
},
],
},
{
name: "opcode",
description: "Print the compiled opcodes for a given contract",
args: {
name: "contract_name",
description:
"Name of the contract to print opcodes for. Must be a contract name, not a file name. (required)",
},
},
{
name: "publish",
description: "Publish a package to the Ethereum Package Registry",
},
{
name: "run",
description: "Run a third-party plugin command",
args: {
name: "command",
description:
"Name of a command defined by an installed plugin. (required)",
},
},
{
name: "version",
description: "Show version number and exit",
},
{
name: "watch",
description:
"Watch filesystem for changes and rebuild the project automatically",
},
{
name: "preserve",
description:
"Save data to decentralized storage platforms like IPFS and Filecoin",
args: {
name: "path",
template: "filepaths",
},
options: [
{
name: "--environment",
description:
"Environment name, as defined in truffle-config `environments` object",
args: {
name: "name",
default: "development",
},
},
{
name: "--ipfs",
description: "Preserve to IPFS",
},
{
name: "--filecoin",
description: "Preserve to Filecoin",
},
{
name: "--buckets",
description: "Preserve to Textile Buckets",
},
],
},
{
name: "migrate",
description: "Run migrations to deploy contracts",
options: [
{
name: "--reset",
description:
"Run all migrations from the beginning, instead of running from the last completed migration",
},
{
name: "--f",
description: "Run contracts from a specific migration",
args: {
name: "number",
description:
"The number refers to the prefix of the migration file",
},
},
{
name: "--to",
description: "Run contracts to a specific migration",
args: {
name: "number",
description:
"The number refers to the prefix of the migration file",
},
},
{
name: "--network",
description:
"Specify the network to use, saving artifacts specific to that network",
args: {
name: "name",
description: "Network name must exist in the configuration",
},
},
{
name: "--compile-all",
description:
"Compile all contracts instead of intelligently choosing which contracts need to be compiled",
},
{
name: "--verbose-rpc",
description:
"Log communication between Truffle and the Ethereum client",
},
{
name: "--dry-run",
description:
"Fork the network specified and only perform a test migration",
},
{
name: "--skip-dry-run",
description:
"Skip the test migration performed before the real migration",
},
{
name: "--interactive",
description:
"Prompt to confirm that the user wants to proceed after the dry run",
},
{
name: "--describe-json",
description: "Prints additional status messages",
},
],
},
{
name: "unbox",
description: "Download a Truffle Box, a pre-built Truffle project",
args: [
{
name: "box_name",
description: "Name of the Truffle Box. (required)",
},
{
name: "path",
isOptional: true,
generators: {
template: "filepaths",
},
},
],
options: [
{
name: "--force",
description:
"Unbox project in the current directory regardless of its state. Be careful, this will potentially overwrite files that exist in the directory",
isDangerous: true,
},
],
},
{
name: "test",
description: "Run JavaScript and Solidity tests",
args: {
name: "test_file",
description:
"Name of the test file to be run. Can include path information if the file does not exist in the current directory",
template: "filepaths",
},
options: [
{
name: "--compile-all",
description:
"Compile all contracts instead of intelligently choosing which contracts need to be compiled",
},
{
name: "--compile-all-debug",
description:
"Like --compile-all, but compiles contracts in debug mode for extra information. Has no effect on Solidity <0.6.3",
},
{
name: "--network",
description:
"Specify the network to use, using artifacts specific to that network",
args: {
name: "name",
description: "Network name must exist in the configuration",
},
},
{
name: "--verbose-rpc",
description:
"Log communication between Truffle and the Ethereum client",
},
{
name: "--show-events",
description: "Log all contract events",
},
{
name: "--debug",
description:
"Provides global debug() function for in-test debugging. Usable with Javascript tests only; implies --compile-all",
},
{
name: "--debug-global",
description:
"Allows one to rename the debug() function to something else",
args: {
name: "identifier",
},
},
{
name: ["--bail", "-b"],
description:
"Bail after the first test failure. May be abbreviated -b",
},
{
name: ["--stacktrace", "-t"],
description:
"Allows for mixed Javascript-and-Solidity stacktraces when a Truffle Contract transaction or deployment reverts. Does not apply to calls or gas estimates. Implies --compile-all. May be abbreviated -t. Warning: This option is still somewhat experimental",
},
{
name: "--stacktrace-extra",
description: "Shortcut for --stacktrace --compile-all-debug",
},
],
},
],
};
export default completionSpec;