forked from abduramann/incognito-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflags.go
318 lines (310 loc) · 9.37 KB
/
flags.go
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
package main
import (
"fmt"
"github.com/incognitochain/go-incognito-sdk-v2/common"
"github.com/incognitochain/go-incognito-sdk-v2/incclient"
"github.com/incognitochain/incognito-cli/pdex_v3"
"github.com/urfave/cli/v2"
)
var defaultFlags = map[string]cli.Flag{
networkFlag: &cli.StringFlag{
Name: networkFlag,
Aliases: aliases[networkFlag],
Usage: "Network environment (mainnet, testnet, testnet1, local)",
Value: "mainnet",
Destination: &network,
},
hostFlag: &cli.StringFlag{
Name: hostFlag,
Usage: "Custom full-node host. This flag is combined with the `network` flag to initialize the environment" +
" in which the custom host points to.",
Value: "",
Destination: &host,
},
clientVersionFlag: &cli.IntFlag{
Name: clientVersionFlag,
Usage: "Version of the incclient",
Value: 2,
Destination: &clientVersion,
},
debugFlag: &cli.IntFlag{
Name: debugFlag,
Aliases: []string{"d"},
Usage: "Whether to enable the debug mode (0 - disabled, <> 0 - enabled)",
Value: 0,
Destination: &debug,
},
cacheFlag: &cli.IntFlag{
Name: cacheFlag,
Aliases: []string{"c", "cache"},
Usage: "Whether to use the UTXO cache (0 - disabled, <> 0 - enabled). See https://github.com/incognitochain/go-incognito-sdk-v2/blob/master/tutorials/docs/accounts/utxo_cache.md for more information.",
Value: 0,
Destination: &cache,
},
privateKeyFlag: &cli.StringFlag{
Name: privateKeyFlag,
Aliases: aliases[privateKeyFlag],
Usage: "A base58-encoded Incognito private key",
Required: true,
},
addressFlag: &cli.StringFlag{
Name: addressFlag,
Aliases: []string{"addr"},
Usage: "A base58-encoded payment address",
Required: true,
},
otaKeyFlag: &cli.StringFlag{
Name: otaKeyFlag,
Aliases: aliases[otaKeyFlag],
Usage: "A base58-encoded ota key",
Required: true,
},
readonlyKeyFlag: &cli.StringFlag{
Name: readonlyKeyFlag,
Aliases: aliases[readonlyKeyFlag],
Usage: "A base58-encoded read-only key",
Value: "",
},
tokenIDFlag: &cli.StringFlag{
Name: tokenIDFlag,
Aliases: aliases[tokenIDFlag],
Usage: "The Incognito ID of the token",
Value: common.PRVIDStr,
},
amountFlag: &cli.Uint64Flag{
Name: amountFlag,
Aliases: aliases[amountFlag],
Usage: "The Incognito (uint64) amount of the action (e.g, 1000, 1000000, 1000000000)",
Required: true,
},
feeFlag: &cli.Uint64Flag{
Name: feeFlag,
Usage: "The PRV amount for paying the transaction fee",
Value: incclient.DefaultPRVFee,
},
versionFlag: &cli.IntFlag{
Name: versionFlag,
Aliases: aliases[versionFlag],
Usage: "Version of the transaction (1 or 2)",
Value: 2,
},
numThreadsFlag: &cli.IntFlag{
Name: numThreadsFlag,
Usage: "Number of threads used in this action",
Value: 4,
},
enableLogFlag: &cli.BoolFlag{
Name: enableLogFlag,
Usage: "Enable log for this action",
Value: false,
},
logFileFlag: &cli.StringFlag{
Name: logFileFlag,
Usage: "Location of the log file",
Value: "os.Stdout",
},
csvFileFlag: &cli.StringFlag{
Name: csvFileFlag,
Aliases: aliases[csvFileFlag],
Usage: "The csv file location to store the history",
},
accessTokenFlag: &cli.StringFlag{
Name: accessTokenFlag,
Usage: "A 64-character long hex-encoded authorized access token",
Value: "",
},
fromHeightFlag: &cli.Uint64Flag{
Name: fromHeightFlag,
Usage: "The beacon height at which the full-node will sync from",
Value: 0,
},
isResetFlag: &cli.BoolFlag{
Name: isResetFlag,
Usage: "Whether the full-node should reset the cache for this ota key",
Value: false,
},
txHashFlag: &cli.StringFlag{
Name: txHashFlag,
Aliases: aliases[txHashFlag],
Usage: "An Incognito transaction hash",
Required: true,
},
tokenIDToSellFlag: &cli.StringFlag{
Name: tokenIDToSellFlag,
Aliases: aliases[tokenIDToSellFlag],
Usage: "ID of the token to sell",
Required: true,
},
tokenIDToBuyFlag: &cli.StringFlag{
Name: tokenIDToBuyFlag,
Aliases: aliases[tokenIDToBuyFlag],
Usage: "ID of the token to buy",
Required: true,
},
sellingAmountFlag: &cli.Uint64Flag{
Name: sellingAmountFlag,
Aliases: aliases[sellingAmountFlag],
Usage: fmt.Sprintf("The amount of %v wished to sell", tokenIDToSellFlag),
Required: true,
},
minAcceptableAmountFlag: &cli.Uint64Flag{
Name: minAcceptableAmountFlag,
Aliases: aliases[minAcceptableAmountFlag],
Usage: fmt.Sprintf("The minimum acceptable amount of %v wished to receive", tokenIDToBuyFlag),
Value: 0,
},
tradingFeeFlag: &cli.Uint64Flag{
Name: tradingFeeFlag,
Usage: "The trading fee",
Required: true,
},
tokenID1Flag: &cli.StringFlag{
Name: tokenID1Flag,
Aliases: aliases[tokenID1Flag],
Usage: "ID of the first token",
Required: true,
},
tokenID2Flag: &cli.StringFlag{
Name: tokenID2Flag,
Aliases: aliases[tokenID2Flag],
Usage: "ID of the second token",
Value: common.PRVIDStr,
},
prvFeeFlag: &cli.IntFlag{
Name: prvFeeFlag,
Usage: "Whether or not to pay fee in PRV (0 - no, <> 0 - yes)",
Value: 1,
},
tradingPathFlag: &cli.StringFlag{
Name: tradingPathFlag,
Usage: "A list of trading pair IDs seperated by a comma (Example: `pairID1,pairID2`). If none is given, the tool will automatically find " +
"a suitable path.",
Value: "",
},
maxTradingPathLengthFlag: &cli.UintFlag{
Name: maxTradingPathLengthFlag,
Usage: "The maximum length of the trading path.",
Value: pdex_v3.MaxPaths,
},
nftIDFlag: &cli.StringFlag{
Name: nftIDFlag,
Aliases: aliases[nftIDFlag],
Usage: "A pDEX NFT generated by the nft minting command",
Required: true,
},
orderIDFlag: &cli.StringFlag{
Name: orderIDFlag,
Aliases: aliases[orderIDFlag],
Usage: "The ID of the order.",
Required: true,
},
pairHashFlag: &cli.StringFlag{
Name: pairHashFlag,
Usage: "A unique string representing the contributing pair",
Required: true,
},
pairIDFlag: &cli.StringFlag{
Name: pairIDFlag,
Aliases: aliases[pairIDFlag],
Usage: "The ID of the target pool pair",
Required: true,
},
amplifierFlag: &cli.Uint64Flag{
Name: amplifierFlag,
Aliases: aliases[amplifierFlag],
Usage: "The amplifier for the target contributing pool",
Required: true,
},
mnemonicFlag: &cli.StringFlag{
Name: mnemonicFlag,
Aliases: []string{"m"},
Usage: "A 12-word mnemonic phrase, words are separated by a \"-\", or put in \"\" (Examples: artist-decline-pepper-spend-good-enemy-caught-sister-sure-opinion-hundred-lake, \"artist decline pepper spend good enemy caught sister sure opinion hundred lake\").",
Required: true,
},
numShardsFlag: &cli.IntFlag{
Name: numShardsFlag,
Usage: "The number of shards",
Value: 8,
},
numAccountsFlag: &cli.IntFlag{
Name: numAccountsFlag,
Usage: "The number of accounts",
Value: 1,
},
shardIDFlag: &cli.IntFlag{
Name: shardIDFlag,
Usage: fmt.Sprintf("A specific shardID (-2: same shard as the first account (i.e, `Anon`); -1: any shard)"),
Value: -2,
},
evmAddressFlag: &cli.StringFlag{
Name: evmAddressFlag,
Usage: "A hex-encoded address on ETH/BSC networks",
Value: "",
},
tokenAddressFlag: &cli.StringFlag{
Name: tokenAddressFlag,
Aliases: aliases[tokenAddressFlag],
Usage: "ID of the token on ETH/BSC networks",
Value: nativeToken,
},
shieldAmountFlag: &cli.Float64Flag{
Name: shieldAmountFlag,
Aliases: aliases[shieldAmountFlag],
Usage: "The shielding amount measured in token unit (e.g, 10, 1, 0.1, 0.01)",
Required: true,
},
evmFlag: &cli.StringFlag{
Name: evmFlag,
Usage: "The EVM network (ETH, BSC, PLG or FTM)",
Value: "ETH",
},
externalTxIDFlag: &cli.StringFlag{
Name: externalTxIDFlag,
Aliases: aliases[externalTxIDFlag],
Usage: "The external transaction hash",
Required: true,
},
externalAddressFlag: &cli.StringFlag{
Name: externalAddressFlag,
Aliases: aliases[externalAddressFlag],
Usage: "A valid remote address for the currently-processed tokenID. User MUST make sure this address is valid to avoid the loss of money.",
Value: "",
},
miningKeyFlag: &cli.StringFlag{
Name: miningKeyFlag,
Aliases: aliases[miningKeyFlag],
Usage: "An Incognito mining key of the committee candidate (default: the mining key associated with the privateKey)",
Required: false,
},
candidateAddressFlag: &cli.StringFlag{
Name: candidateAddressFlag,
Aliases: aliases[candidateAddressFlag],
Usage: "The Incognito payment address of the committee candidate (default: the payment address of the privateKey)",
Required: false,
},
rewardReceiverFlag: &cli.StringFlag{
Name: rewardReceiverFlag,
Aliases: aliases[rewardReceiverFlag],
Usage: "The Incognito payment address of the reward receiver (default: the payment address of the privateKey)",
Required: false,
},
autoReStakeFlag: &cli.IntFlag{
Name: autoReStakeFlag,
Aliases: aliases[autoReStakeFlag],
Usage: "Whether or not to automatically re-stake (0 - false, <> 0 - true)",
Value: 1,
Required: false,
},
adminPrivateKeyFlag: &cli.StringFlag{
Name: adminPrivateKeyFlag,
Aliases: aliases[adminPrivateKeyFlag],
Usage: "A base58-encoded Incognito private key of the admin account",
Required: true,
},
tokenNameFlag: &cli.StringFlag{
Name: tokenNameFlag,
Aliases: aliases[tokenNameFlag],
Usage: "The name of the shielding token",
Required: true,
},
}