@super-protocol/sp-cli 0.0.2-beta.9 → 0.0.3
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 +134 -65
- package/bin/dev.js +1 -1
- package/dist/commands/account/get-sppi.d.ts +8 -0
- package/dist/commands/account/get-sppi.js +23 -0
- package/dist/commands/account/info.d.ts +1 -0
- package/dist/commands/account/info.js +5 -2
- package/dist/commands/auth/login.d.ts +4 -1
- package/dist/commands/auth/login.js +4 -2
- package/dist/commands/config/add.js +1 -16
- package/dist/commands/config/base.d.ts +1 -0
- package/dist/commands/config/base.js +22 -4
- package/dist/commands/config/create.js +1 -11
- package/dist/commands/config/list.js +20 -19
- package/dist/commands/files/download.js +8 -6
- package/dist/commands/files/upload.js +8 -6
- package/dist/commands/storage/base.js +3 -1
- package/dist/commands/storage/select.d.ts +4 -4
- package/dist/commands/storage/select.js +15 -21
- package/dist/commands/storage/show.d.ts +17 -0
- package/dist/commands/storage/show.js +36 -0
- package/dist/commands/workflows/extend-lease.d.ts +17 -0
- package/dist/commands/workflows/extend-lease.js +94 -0
- package/dist/config/config.schema.d.ts +9 -0
- package/dist/config/config.schema.js +5 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +3 -0
- package/dist/hooks/finally/shutdown-blockchain.d.ts +3 -0
- package/dist/hooks/finally/shutdown-blockchain.js +8 -0
- package/dist/lib/container.d.ts +1 -0
- package/dist/lib/container.js +23 -1
- package/dist/managers/account-manager.d.ts +1 -0
- package/dist/managers/account-manager.js +17 -13
- package/dist/managers/config-file-manager.d.ts +1 -1
- package/dist/managers/config-file-manager.js +16 -4
- package/dist/services/storage.service.d.ts +3 -1
- package/dist/services/storage.service.js +87 -44
- package/dist/utils/helper.d.ts +1 -0
- package/dist/utils/helper.js +1 -0
- package/dist/utils/progress.js +10 -2
- package/oclif.manifest.json +190 -151
- package/package.json +10 -6
- package/dist/config/resource.schema.d.ts +0 -31
- package/dist/config/resource.schema.js +0 -14
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @super-protocol/sp-cli
|
|
|
21
21
|
$ sp COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ sp (--version)
|
|
24
|
-
@super-protocol/sp-cli/0.0.
|
|
24
|
+
@super-protocol/sp-cli/0.0.3 linux-x64 node-v22.21.1
|
|
25
25
|
$ sp --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ sp COMMAND
|
|
@@ -30,13 +30,13 @@ USAGE
|
|
|
30
30
|
<!-- usagestop -->
|
|
31
31
|
# Commands
|
|
32
32
|
<!-- commands -->
|
|
33
|
+
* [`sp account get-sppi`](#sp-account-get-sppi)
|
|
33
34
|
* [`sp account info`](#sp-account-info)
|
|
34
35
|
* [`sp auth login`](#sp-auth-login)
|
|
35
36
|
* [`sp auth me`](#sp-auth-me)
|
|
36
|
-
* [`sp
|
|
37
|
+
* [`sp autocomplete [SHELL]`](#sp-autocomplete-shell)
|
|
37
38
|
* [`sp config`](#sp-config)
|
|
38
39
|
* [`sp config add [FILE]`](#sp-config-add-file)
|
|
39
|
-
* [`sp config base`](#sp-config-base)
|
|
40
40
|
* [`sp config create`](#sp-config-create)
|
|
41
41
|
* [`sp config delete`](#sp-config-delete)
|
|
42
42
|
* [`sp config list`](#sp-config-list)
|
|
@@ -46,13 +46,37 @@ USAGE
|
|
|
46
46
|
* [`sp files upload PATH`](#sp-files-upload-path)
|
|
47
47
|
* [`sp help [COMMAND]`](#sp-help-command)
|
|
48
48
|
* [`sp login`](#sp-login)
|
|
49
|
-
* [`sp storage base`](#sp-storage-base)
|
|
50
49
|
* [`sp storage create`](#sp-storage-create)
|
|
51
50
|
* [`sp storage select`](#sp-storage-select)
|
|
51
|
+
* [`sp storage show`](#sp-storage-show)
|
|
52
52
|
* [`sp storage update`](#sp-storage-update)
|
|
53
|
+
* [`sp workflows extend-lease ORDERID`](#sp-workflows-extend-lease-orderid)
|
|
54
|
+
|
|
55
|
+
## `sp account get-sppi`
|
|
56
|
+
|
|
57
|
+
Get SPPI (Super Protocol incentive tokens)
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
USAGE
|
|
61
|
+
$ sp account get-sppi [--json] [--config <value>]
|
|
62
|
+
|
|
63
|
+
GLOBAL FLAGS
|
|
64
|
+
--config=<value> Specify config file.
|
|
65
|
+
--json Format output as json.
|
|
66
|
+
|
|
67
|
+
DESCRIPTION
|
|
68
|
+
Get SPPI (Super Protocol incentive tokens)
|
|
69
|
+
|
|
70
|
+
EXAMPLES
|
|
71
|
+
$ sp account get-sppi
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
_See code: [src/commands/account/get-sppi.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/account/get-sppi.ts)_
|
|
53
75
|
|
|
54
76
|
## `sp account info`
|
|
55
77
|
|
|
78
|
+
Information about current authorized user
|
|
79
|
+
|
|
56
80
|
```
|
|
57
81
|
USAGE
|
|
58
82
|
$ sp account info [--json] [--config <value>]
|
|
@@ -60,13 +84,16 @@ USAGE
|
|
|
60
84
|
GLOBAL FLAGS
|
|
61
85
|
--config=<value> Specify config file.
|
|
62
86
|
--json Format output as json.
|
|
87
|
+
|
|
88
|
+
DESCRIPTION
|
|
89
|
+
Information about current authorized user
|
|
63
90
|
```
|
|
64
91
|
|
|
65
|
-
_See code: [src/commands/account/info.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
92
|
+
_See code: [src/commands/account/info.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/account/info.ts)_
|
|
66
93
|
|
|
67
94
|
## `sp auth login`
|
|
68
95
|
|
|
69
|
-
|
|
96
|
+
Login to SuperProtocol (sign up or sign in).
|
|
70
97
|
|
|
71
98
|
```
|
|
72
99
|
USAGE
|
|
@@ -77,7 +104,7 @@ GLOBAL FLAGS
|
|
|
77
104
|
--json Format output as json.
|
|
78
105
|
|
|
79
106
|
DESCRIPTION
|
|
80
|
-
|
|
107
|
+
Login to SuperProtocol (sign up or sign in).
|
|
81
108
|
|
|
82
109
|
ALIASES
|
|
83
110
|
$ sp login
|
|
@@ -86,7 +113,7 @@ EXAMPLES
|
|
|
86
113
|
$ sp auth login
|
|
87
114
|
```
|
|
88
115
|
|
|
89
|
-
_See code: [src/commands/auth/login.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
116
|
+
_See code: [src/commands/auth/login.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/auth/login.ts)_
|
|
90
117
|
|
|
91
118
|
## `sp auth me`
|
|
92
119
|
|
|
@@ -99,20 +126,38 @@ GLOBAL FLAGS
|
|
|
99
126
|
--json Format output as json.
|
|
100
127
|
```
|
|
101
128
|
|
|
102
|
-
_See code: [src/commands/auth/me.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
129
|
+
_See code: [src/commands/auth/me.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/auth/me.ts)_
|
|
103
130
|
|
|
104
|
-
## `sp
|
|
131
|
+
## `sp autocomplete [SHELL]`
|
|
132
|
+
|
|
133
|
+
Display autocomplete installation instructions.
|
|
105
134
|
|
|
106
135
|
```
|
|
107
136
|
USAGE
|
|
108
|
-
$ sp
|
|
137
|
+
$ sp autocomplete [SHELL] [-r]
|
|
109
138
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
139
|
+
ARGUMENTS
|
|
140
|
+
[SHELL] (zsh|bash|powershell) Shell type
|
|
141
|
+
|
|
142
|
+
FLAGS
|
|
143
|
+
-r, --refresh-cache Refresh cache (ignores displaying instructions)
|
|
144
|
+
|
|
145
|
+
DESCRIPTION
|
|
146
|
+
Display autocomplete installation instructions.
|
|
147
|
+
|
|
148
|
+
EXAMPLES
|
|
149
|
+
$ sp autocomplete
|
|
150
|
+
|
|
151
|
+
$ sp autocomplete bash
|
|
152
|
+
|
|
153
|
+
$ sp autocomplete zsh
|
|
154
|
+
|
|
155
|
+
$ sp autocomplete powershell
|
|
156
|
+
|
|
157
|
+
$ sp autocomplete --refresh-cache
|
|
113
158
|
```
|
|
114
159
|
|
|
115
|
-
_See code: [
|
|
160
|
+
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.39/src/commands/autocomplete/index.ts)_
|
|
116
161
|
|
|
117
162
|
## `sp config`
|
|
118
163
|
|
|
@@ -142,7 +187,7 @@ EXAMPLES
|
|
|
142
187
|
$ sp config delete - Delete a configuration
|
|
143
188
|
```
|
|
144
189
|
|
|
145
|
-
_See code: [src/commands/config/index.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
190
|
+
_See code: [src/commands/config/index.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/config/index.ts)_
|
|
146
191
|
|
|
147
192
|
## `sp config add [FILE]`
|
|
148
193
|
|
|
@@ -181,19 +226,7 @@ EXAMPLES
|
|
|
181
226
|
}
|
|
182
227
|
```
|
|
183
228
|
|
|
184
|
-
_See code: [src/commands/config/add.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
185
|
-
|
|
186
|
-
## `sp config base`
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
USAGE
|
|
190
|
-
$ sp config base [--json]
|
|
191
|
-
|
|
192
|
-
GLOBAL FLAGS
|
|
193
|
-
--json Format output as json.
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
_See code: [src/commands/config/base.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.9/src/commands/config/base.ts)_
|
|
229
|
+
_See code: [src/commands/config/add.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/config/add.ts)_
|
|
197
230
|
|
|
198
231
|
## `sp config create`
|
|
199
232
|
|
|
@@ -220,7 +253,7 @@ EXAMPLES
|
|
|
220
253
|
$ sp config create --name "Production" --url "https://api.dp.superprotocol.com"
|
|
221
254
|
```
|
|
222
255
|
|
|
223
|
-
_See code: [src/commands/config/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
256
|
+
_See code: [src/commands/config/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/config/create.ts)_
|
|
224
257
|
|
|
225
258
|
## `sp config delete`
|
|
226
259
|
|
|
@@ -248,7 +281,7 @@ EXAMPLES
|
|
|
248
281
|
$ sp config delete --name "My Config" --force
|
|
249
282
|
```
|
|
250
283
|
|
|
251
|
-
_See code: [src/commands/config/delete.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
284
|
+
_See code: [src/commands/config/delete.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/config/delete.ts)_
|
|
252
285
|
|
|
253
286
|
## `sp config list`
|
|
254
287
|
|
|
@@ -268,7 +301,7 @@ EXAMPLES
|
|
|
268
301
|
$ sp config list
|
|
269
302
|
```
|
|
270
303
|
|
|
271
|
-
_See code: [src/commands/config/list.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
304
|
+
_See code: [src/commands/config/list.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/config/list.ts)_
|
|
272
305
|
|
|
273
306
|
## `sp config show`
|
|
274
307
|
|
|
@@ -288,7 +321,7 @@ EXAMPLES
|
|
|
288
321
|
$ sp config show
|
|
289
322
|
```
|
|
290
323
|
|
|
291
|
-
_See code: [src/commands/config/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
324
|
+
_See code: [src/commands/config/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/config/show.ts)_
|
|
292
325
|
|
|
293
326
|
## `sp config use`
|
|
294
327
|
|
|
@@ -308,11 +341,11 @@ EXAMPLES
|
|
|
308
341
|
$ sp config use
|
|
309
342
|
```
|
|
310
343
|
|
|
311
|
-
_See code: [src/commands/config/use.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
344
|
+
_See code: [src/commands/config/use.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/config/use.ts)_
|
|
312
345
|
|
|
313
346
|
## `sp files download RESOURCEFILE LOCALDIRECTORY`
|
|
314
347
|
|
|
315
|
-
|
|
348
|
+
Download file or directory described in resource file
|
|
316
349
|
|
|
317
350
|
```
|
|
318
351
|
USAGE
|
|
@@ -323,24 +356,24 @@ ARGUMENTS
|
|
|
323
356
|
LOCALDIRECTORY Path to save downloaded file
|
|
324
357
|
|
|
325
358
|
FLAGS
|
|
326
|
-
--maximum-concurrent=<value> [default: 1] Maximum concurrent pieces to
|
|
359
|
+
--maximum-concurrent=<value> [default: 1] Maximum concurrent pieces to download at once per transfer
|
|
327
360
|
|
|
328
361
|
GLOBAL FLAGS
|
|
329
362
|
--config=<value> Specify config file.
|
|
330
363
|
--json Format output as json.
|
|
331
364
|
|
|
332
365
|
DESCRIPTION
|
|
333
|
-
|
|
366
|
+
Download file or directory described in resource file
|
|
334
367
|
|
|
335
368
|
EXAMPLES
|
|
336
369
|
$ sp files download ./resource.json ./pathToDownload
|
|
337
370
|
```
|
|
338
371
|
|
|
339
|
-
_See code: [src/commands/files/download.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
372
|
+
_See code: [src/commands/files/download.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/files/download.ts)_
|
|
340
373
|
|
|
341
374
|
## `sp files upload PATH`
|
|
342
375
|
|
|
343
|
-
|
|
376
|
+
Upload file or directory to remote storage
|
|
344
377
|
|
|
345
378
|
```
|
|
346
379
|
USAGE
|
|
@@ -364,13 +397,13 @@ GLOBAL FLAGS
|
|
|
364
397
|
--json Format output as json.
|
|
365
398
|
|
|
366
399
|
DESCRIPTION
|
|
367
|
-
|
|
400
|
+
Upload file or directory to remote storage
|
|
368
401
|
|
|
369
402
|
EXAMPLES
|
|
370
403
|
$ sp files upload ./file.txt
|
|
371
404
|
```
|
|
372
405
|
|
|
373
|
-
_See code: [src/commands/files/upload.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
406
|
+
_See code: [src/commands/files/upload.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/files/upload.ts)_
|
|
374
407
|
|
|
375
408
|
## `sp help [COMMAND]`
|
|
376
409
|
|
|
@@ -390,11 +423,11 @@ DESCRIPTION
|
|
|
390
423
|
Display help for sp.
|
|
391
424
|
```
|
|
392
425
|
|
|
393
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.
|
|
426
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.36/src/commands/help.ts)_
|
|
394
427
|
|
|
395
428
|
## `sp login`
|
|
396
429
|
|
|
397
|
-
|
|
430
|
+
Login to SuperProtocol (sign up or sign in).
|
|
398
431
|
|
|
399
432
|
```
|
|
400
433
|
USAGE
|
|
@@ -405,7 +438,7 @@ GLOBAL FLAGS
|
|
|
405
438
|
--json Format output as json.
|
|
406
439
|
|
|
407
440
|
DESCRIPTION
|
|
408
|
-
|
|
441
|
+
Login to SuperProtocol (sign up or sign in).
|
|
409
442
|
|
|
410
443
|
ALIASES
|
|
411
444
|
$ sp login
|
|
@@ -414,19 +447,6 @@ EXAMPLES
|
|
|
414
447
|
$ sp login
|
|
415
448
|
```
|
|
416
449
|
|
|
417
|
-
## `sp storage base`
|
|
418
|
-
|
|
419
|
-
```
|
|
420
|
-
USAGE
|
|
421
|
-
$ sp storage base [--json] [--config <value>]
|
|
422
|
-
|
|
423
|
-
GLOBAL FLAGS
|
|
424
|
-
--config=<value> Specify config file.
|
|
425
|
-
--json Format output as json.
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
_See code: [src/commands/storage/base.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.2-beta.9/src/commands/storage/base.ts)_
|
|
429
|
-
|
|
430
450
|
## `sp storage create`
|
|
431
451
|
|
|
432
452
|
Create a new storage entry from file or interactive prompts.
|
|
@@ -454,7 +474,7 @@ EXAMPLES
|
|
|
454
474
|
$ sp storage create --not-default
|
|
455
475
|
```
|
|
456
476
|
|
|
457
|
-
_See code: [src/commands/storage/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
477
|
+
_See code: [src/commands/storage/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/storage/create.ts)_
|
|
458
478
|
|
|
459
479
|
## `sp storage select`
|
|
460
480
|
|
|
@@ -462,10 +482,7 @@ Select a storage that will be used by subsequent commands.
|
|
|
462
482
|
|
|
463
483
|
```
|
|
464
484
|
USAGE
|
|
465
|
-
$ sp storage select [--json] [--config <value>]
|
|
466
|
-
|
|
467
|
-
FLAGS
|
|
468
|
-
-i, --id=<value> Storage ID to select
|
|
485
|
+
$ sp storage select [--json] [--config <value>]
|
|
469
486
|
|
|
470
487
|
GLOBAL FLAGS
|
|
471
488
|
--config=<value> Specify config file.
|
|
@@ -476,11 +493,30 @@ DESCRIPTION
|
|
|
476
493
|
|
|
477
494
|
EXAMPLES
|
|
478
495
|
$ sp storage select
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
_See code: [src/commands/storage/select.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/storage/select.ts)_
|
|
499
|
+
|
|
500
|
+
## `sp storage show`
|
|
501
|
+
|
|
502
|
+
Show current selected storage
|
|
479
503
|
|
|
480
|
-
$ sp storage select --id=2de3e3a4-0000-1111-2222-333344445555
|
|
481
504
|
```
|
|
505
|
+
USAGE
|
|
506
|
+
$ sp storage show [--json] [--config <value>]
|
|
482
507
|
|
|
483
|
-
|
|
508
|
+
GLOBAL FLAGS
|
|
509
|
+
--config=<value> Specify config file.
|
|
510
|
+
--json Format output as json.
|
|
511
|
+
|
|
512
|
+
DESCRIPTION
|
|
513
|
+
Show current selected storage
|
|
514
|
+
|
|
515
|
+
EXAMPLES
|
|
516
|
+
$ sp storage show
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
_See code: [src/commands/storage/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/storage/show.ts)_
|
|
484
520
|
|
|
485
521
|
## `sp storage update`
|
|
486
522
|
|
|
@@ -507,5 +543,38 @@ EXAMPLES
|
|
|
507
543
|
$ sp storage update --id=2de3e3a4-0000-1111-2222-333344445555
|
|
508
544
|
```
|
|
509
545
|
|
|
510
|
-
_See code: [src/commands/storage/update.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.
|
|
546
|
+
_See code: [src/commands/storage/update.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/storage/update.ts)_
|
|
547
|
+
|
|
548
|
+
## `sp workflows extend-lease ORDERID`
|
|
549
|
+
|
|
550
|
+
Replenish deposit for a workflow to extend its lease time
|
|
551
|
+
|
|
552
|
+
```
|
|
553
|
+
USAGE
|
|
554
|
+
$ sp workflows extend-lease ORDERID [--json] [--config <value>] [--minutes <value>] [--sppi <value>] [-y]
|
|
555
|
+
|
|
556
|
+
ARGUMENTS
|
|
557
|
+
ORDERID Order ID
|
|
558
|
+
|
|
559
|
+
FLAGS
|
|
560
|
+
-y, --yes Skip confirmation prompt
|
|
561
|
+
--minutes=<value> Time to extend order in minutes (automatically calculates tokens)
|
|
562
|
+
--sppi=<value> SPPI token amount to add to the order
|
|
563
|
+
|
|
564
|
+
GLOBAL FLAGS
|
|
565
|
+
--config=<value> Specify config file.
|
|
566
|
+
--json Format output as json.
|
|
567
|
+
|
|
568
|
+
DESCRIPTION
|
|
569
|
+
Replenish deposit for a workflow to extend its lease time
|
|
570
|
+
|
|
571
|
+
EXAMPLES
|
|
572
|
+
$ sp workflows extend-lease <orderId> --sppi 1.5
|
|
573
|
+
|
|
574
|
+
$ sp workflows extend-lease <orderId> --minutes 120
|
|
575
|
+
|
|
576
|
+
$ sp workflows extend-lease <orderId> --sppi 2 --yes
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
_See code: [src/commands/workflows/extend-lease.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.3/src/commands/workflows/extend-lease.ts)_
|
|
511
580
|
<!-- commandsstop -->
|
package/bin/dev.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { formatEther } from 'viem';
|
|
2
|
+
import { BaseCommand } from '../base.js';
|
|
3
|
+
export default class AccountGetSppi extends BaseCommand {
|
|
4
|
+
static description = 'Get SPPI (Super Protocol incentive tokens) ';
|
|
5
|
+
static examples = [
|
|
6
|
+
'<%= config.bin %> <%= command.id %>',
|
|
7
|
+
];
|
|
8
|
+
async run() {
|
|
9
|
+
const { providerClient } = await this.container
|
|
10
|
+
.initConfigFileManager()
|
|
11
|
+
.initConfigManager()
|
|
12
|
+
.initAccountManager()
|
|
13
|
+
.initProviderClient()
|
|
14
|
+
.build();
|
|
15
|
+
const { data, error } = await providerClient.POST('/api/faucet/request-tokens');
|
|
16
|
+
if (error) {
|
|
17
|
+
this.error(`Request tokens failed. Reason ${error.message}`);
|
|
18
|
+
}
|
|
19
|
+
const tokens = formatEther(BigInt(data.amount || '0'));
|
|
20
|
+
this.log(`Requested tokens: ${tokens} SPPI`);
|
|
21
|
+
return { tokens };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -2,6 +2,7 @@ import { formatEther } from 'viem';
|
|
|
2
2
|
import { StorageService } from '../../services/storage.service.js';
|
|
3
3
|
import { BaseCommand } from '../base.js';
|
|
4
4
|
export class InfoCommand extends BaseCommand {
|
|
5
|
+
static description = 'Information about current authorized user';
|
|
5
6
|
async init() {
|
|
6
7
|
await super.init();
|
|
7
8
|
await this.container.initProviderClient().initAccountManager().initConfigManager().build();
|
|
@@ -21,7 +22,7 @@ export class InfoCommand extends BaseCommand {
|
|
|
21
22
|
this.error('Failed to retrieve wallet information');
|
|
22
23
|
}
|
|
23
24
|
const storage = await storageService.getCurrentStorage();
|
|
24
|
-
const balance = formatEther(BigInt(wallet?.teeBalance || '0')
|
|
25
|
+
const balance = formatEther(BigInt(wallet?.teeBalance || '0'));
|
|
25
26
|
this.log(`Login: ${data.address}`);
|
|
26
27
|
this.log(`Super Wallet: ${data.internalAddress}`);
|
|
27
28
|
this.log(`Balance: ${balance} SPPI`);
|
|
@@ -31,7 +32,9 @@ export class InfoCommand extends BaseCommand {
|
|
|
31
32
|
else {
|
|
32
33
|
this.log('Active storage:');
|
|
33
34
|
this.log(` bucket: ${storage.bucket}`);
|
|
34
|
-
|
|
35
|
+
if (storage.prefix) {
|
|
36
|
+
this.log(` prefix: ${storage.prefix}`);
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
return {
|
|
37
40
|
address: data.address,
|
|
@@ -3,7 +3,7 @@ import { StorageService } from '../../services/storage.service.js';
|
|
|
3
3
|
import { BaseCommand } from '../base.js';
|
|
4
4
|
export default class SpLogin extends BaseCommand {
|
|
5
5
|
static aliases = ['login'];
|
|
6
|
-
static description = '
|
|
6
|
+
static description = 'Login to SuperProtocol (sign up or sign in).';
|
|
7
7
|
static examples = [
|
|
8
8
|
`<%= config.bin %> <%= command.id %>
|
|
9
9
|
`,
|
|
@@ -43,6 +43,8 @@ export default class SpLogin extends BaseCommand {
|
|
|
43
43
|
this.logger.error({ err: error }, 'Storage initialization failed');
|
|
44
44
|
this.warn('Storage initialization failed. You can set up storage later using "sp storage create" or "sp storage select".');
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
const account = accountManager.getAddress();
|
|
47
|
+
this.log(`Logged in with account ${account}`);
|
|
48
|
+
return { account, success: true };
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -64,22 +64,7 @@ export default class ConfigAdd extends BaseConfigCommand {
|
|
|
64
64
|
const displayName = importedConfig?.name || importedFileName;
|
|
65
65
|
this.log(`Successfully imported configuration: ${displayName}`);
|
|
66
66
|
this.log(`Configuration file: ${importedFileName}`);
|
|
67
|
-
|
|
68
|
-
message: 'Switch to this configuration now?',
|
|
69
|
-
options: [
|
|
70
|
-
{ label: 'Yes', value: true },
|
|
71
|
-
{ label: 'No', value: false },
|
|
72
|
-
],
|
|
73
|
-
});
|
|
74
|
-
if (shouldSwitch) {
|
|
75
|
-
await this.configFileManager.setCurrentConfig(importedFileName);
|
|
76
|
-
this.log(`Switched to configuration: ${displayName}`);
|
|
77
|
-
await this.container
|
|
78
|
-
.initConfigFileManager(true)
|
|
79
|
-
.initConfigManager(true)
|
|
80
|
-
.initAccountManager(true)
|
|
81
|
-
.build();
|
|
82
|
-
}
|
|
67
|
+
await this.switchToNewConfig(importedFileName, displayName, this.flags.yes);
|
|
83
68
|
}
|
|
84
69
|
catch (error) {
|
|
85
70
|
this.error(`Failed to import configuration: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -11,5 +11,6 @@ export declare abstract class BaseConfigCommand<T extends typeof Command> extend
|
|
|
11
11
|
init(): Promise<void>;
|
|
12
12
|
protected inputPrompt(options: TextOptions): Promise<string>;
|
|
13
13
|
protected selectPrompt<Value>(options: SelectOptions<Value>): Promise<Value>;
|
|
14
|
+
protected switchToNewConfig(configFile: string, displayName: string, yes: boolean): Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
export {};
|
|
@@ -25,16 +25,16 @@ export class BaseConfigCommand extends BaseCommand {
|
|
|
25
25
|
this.log(` Provider URL: ${PROVIDER_URL} (using default)`);
|
|
26
26
|
}
|
|
27
27
|
if (configData.auth?.accessKey) {
|
|
28
|
-
this.log(' Authorization:
|
|
28
|
+
this.log(' Authorization: Configured');
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
this.log(' Authorization:
|
|
31
|
+
this.log(' Authorization: Unauthorized');
|
|
32
32
|
}
|
|
33
33
|
if (configData.account?.address) {
|
|
34
|
-
this.log(` Account:
|
|
34
|
+
this.log(` Account: ${configData.account.address}`);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
this.log(' Account:
|
|
37
|
+
this.log(' Account: Not configured');
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -57,4 +57,22 @@ export class BaseConfigCommand extends BaseCommand {
|
|
|
57
57
|
const result = await select(options);
|
|
58
58
|
return this.ensurePromptValue(result);
|
|
59
59
|
}
|
|
60
|
+
async switchToNewConfig(configFile, displayName, yes) {
|
|
61
|
+
const shouldSwitch = yes || await this.selectPrompt({
|
|
62
|
+
message: 'Switch to this configuration now?',
|
|
63
|
+
options: [
|
|
64
|
+
{ label: 'Yes', value: true },
|
|
65
|
+
{ label: 'No', value: false },
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
if (shouldSwitch) {
|
|
69
|
+
await this.configFileManager.setCurrentConfig(configFile);
|
|
70
|
+
this.log(`Switched to configuration: ${displayName}`);
|
|
71
|
+
await this.container
|
|
72
|
+
.initConfigFileManager(true)
|
|
73
|
+
.initConfigManager(true)
|
|
74
|
+
.initAccountManager(true)
|
|
75
|
+
.build();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
60
78
|
}
|
|
@@ -32,17 +32,7 @@ export default class ConfigCreate extends BaseConfigCommand {
|
|
|
32
32
|
if (url) {
|
|
33
33
|
this.log(`Provider URL: ${url}`);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
message: 'Switch to this configuration now?',
|
|
37
|
-
options: [
|
|
38
|
-
{ label: 'Yes', value: true },
|
|
39
|
-
{ label: 'No', value: false },
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
if (shouldSwitch) {
|
|
43
|
-
await this.configFileManager.setCurrentConfig(fileName);
|
|
44
|
-
this.log(`Switched to configuration: ${name}`);
|
|
45
|
-
}
|
|
35
|
+
await this.switchToNewConfig(fileName, name, yes);
|
|
46
36
|
}
|
|
47
37
|
catch (error) {
|
|
48
38
|
this.error(`Failed to create configuration: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { printTable } from 'console-table-printer';
|
|
2
|
+
import { PROVIDER_URL } from '../../constants.js';
|
|
1
3
|
import { BaseConfigCommand } from './base.js';
|
|
2
4
|
export default class ConfigList extends BaseConfigCommand {
|
|
3
5
|
static description = 'List all configurations';
|
|
@@ -12,28 +14,27 @@ export default class ConfigList extends BaseConfigCommand {
|
|
|
12
14
|
this.log('Create a new configuration with: sp config create --name "Config Name"');
|
|
13
15
|
return;
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
const rows = [];
|
|
16
18
|
for (const config of configs) {
|
|
17
19
|
const marker = config.file === current ? '* ' : ' ';
|
|
18
20
|
const configData = this.configFileManager.getConfigData(config.file);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
if (configData.account) {
|
|
29
|
-
parts.push(`Account: [OK] ${configData.account.address} `);
|
|
30
|
-
}
|
|
31
|
-
if (parts.length > 0) {
|
|
32
|
-
statusInfo = ` | ${parts.join(', ')}`;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
this.log(`${marker}${config.name}${statusInfo}`);
|
|
36
|
-
this.log(` File: ${config.file}`);
|
|
21
|
+
const row = {
|
|
22
|
+
account: configData?.account?.address ?? '[not found in config file]',
|
|
23
|
+
current: marker,
|
|
24
|
+
file: config.file,
|
|
25
|
+
name: config.name,
|
|
26
|
+
url: configData?.providerUrl ?? PROVIDER_URL,
|
|
27
|
+
};
|
|
28
|
+
rows.push(row);
|
|
37
29
|
}
|
|
30
|
+
printTable(rows, {
|
|
31
|
+
columns: [
|
|
32
|
+
{ name: 'current', title: 'Current' },
|
|
33
|
+
{ name: 'name', title: 'Config name' },
|
|
34
|
+
{ name: 'account', title: 'Account' },
|
|
35
|
+
{ name: 'url', title: 'Provider Url' },
|
|
36
|
+
{ name: 'file', title: 'Configuration File' },
|
|
37
|
+
], title: 'Available configurations',
|
|
38
|
+
});
|
|
38
39
|
}
|
|
39
40
|
}
|