@super-protocol/sp-cli 0.0.5 → 0.0.7

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.
Files changed (83) hide show
  1. package/README.md +97 -229
  2. package/dist/commands/account/base.d.ts +20 -0
  3. package/dist/commands/account/base.js +49 -0
  4. package/dist/commands/{config/delete.d.ts → account/forget.d.ts} +5 -2
  5. package/dist/commands/{config/delete.js → account/forget.js} +12 -5
  6. package/dist/commands/account/get-sppi.d.ts +2 -2
  7. package/dist/commands/account/get-sppi.js +8 -13
  8. package/dist/commands/account/info.d.ts +5 -2
  9. package/dist/commands/account/info.js +53 -3
  10. package/dist/commands/account/list.d.ts +9 -0
  11. package/dist/commands/{config → account}/list.js +16 -9
  12. package/dist/commands/account/login.d.ts +35 -0
  13. package/dist/commands/account/login.js +254 -0
  14. package/dist/commands/account/switch.d.ts +12 -0
  15. package/dist/commands/account/switch.js +40 -0
  16. package/dist/commands/base.d.ts +4 -3
  17. package/dist/commands/base.js +3 -1
  18. package/dist/commands/files/download.js +13 -5
  19. package/dist/commands/files/upload.js +11 -7
  20. package/dist/commands/storage/base.d.ts +2 -2
  21. package/dist/commands/storage/create.js +1 -1
  22. package/dist/commands/storage/select.js +3 -5
  23. package/dist/commands/storage/show.js +2 -4
  24. package/dist/commands/storage/update.js +31 -14
  25. package/dist/commands/workflows/extend-lease.d.ts +1 -1
  26. package/dist/commands/workflows/extend-lease.js +19 -10
  27. package/dist/config/config-file.schema.d.ts +1 -2
  28. package/dist/config/config-file.schema.js +0 -1
  29. package/dist/config/config.schema.d.ts +1 -1
  30. package/dist/errors.d.ts +2 -0
  31. package/dist/errors.js +2 -0
  32. package/dist/hooks/finally/shutdown-blockchain.d.ts +1 -1
  33. package/dist/hooks/finally/shutdown-blockchain.js +1 -1
  34. package/dist/hooks/finally/unlock-config.d.ts +3 -0
  35. package/dist/hooks/finally/unlock-config.js +5 -0
  36. package/dist/hooks/init/init-container.d.ts +1 -1
  37. package/dist/hooks/init/init-container.js +2 -3
  38. package/dist/hooks/init/lock-config.d.ts +3 -0
  39. package/dist/hooks/init/lock-config.js +19 -0
  40. package/dist/hooks/prerun/auth.d.ts +3 -0
  41. package/dist/hooks/prerun/auth.js +70 -0
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.js +1 -1
  44. package/dist/interfaces/account-manager.interface.d.ts +1 -1
  45. package/dist/interfaces/config-manager.interface.d.ts +2 -2
  46. package/dist/lib/cli-instance-lock.d.ts +2 -0
  47. package/dist/lib/cli-instance-lock.js +37 -0
  48. package/dist/lib/container.d.ts +6 -4
  49. package/dist/lib/container.js +108 -38
  50. package/dist/logger.d.ts +1 -1
  51. package/dist/logger.js +4 -1
  52. package/dist/managers/account-manager.d.ts +7 -8
  53. package/dist/managers/account-manager.js +20 -45
  54. package/dist/managers/config-file-manager.d.ts +6 -7
  55. package/dist/managers/config-file-manager.js +35 -32
  56. package/dist/managers/config-manager.d.ts +5 -5
  57. package/dist/managers/config-manager.js +5 -2
  58. package/dist/middlewares/auth-middleware.d.ts +1 -1
  59. package/dist/services/auth.service.d.ts +10 -15
  60. package/dist/services/auth.service.js +71 -5
  61. package/dist/services/storage.service.d.ts +3 -3
  62. package/dist/services/storage.service.js +46 -19
  63. package/dist/utils/helper.d.ts +1 -0
  64. package/dist/utils/helper.js +15 -1
  65. package/oclif.manifest.json +258 -399
  66. package/package.json +18 -25
  67. package/dist/commands/auth/login.d.ts +0 -12
  68. package/dist/commands/auth/login.js +0 -50
  69. package/dist/commands/auth/me.d.ts +0 -5
  70. package/dist/commands/auth/me.js +0 -16
  71. package/dist/commands/config/add.d.ts +0 -13
  72. package/dist/commands/config/add.js +0 -73
  73. package/dist/commands/config/base.d.ts +0 -16
  74. package/dist/commands/config/base.js +0 -78
  75. package/dist/commands/config/create.d.ts +0 -11
  76. package/dist/commands/config/create.js +0 -41
  77. package/dist/commands/config/index.d.ts +0 -6
  78. package/dist/commands/config/index.js +0 -22
  79. package/dist/commands/config/list.d.ts +0 -6
  80. package/dist/commands/config/show.d.ts +0 -6
  81. package/dist/commands/config/show.js +0 -10
  82. package/dist/commands/config/use.d.ts +0 -6
  83. package/dist/commands/config/use.js +0 -27
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.5 linux-x64 node-v22.21.1
24
+ @super-protocol/sp-cli/0.0.7 linux-x64 node-v22.21.1
25
25
  $ sp --help [COMMAND]
26
26
  USAGE
27
27
  $ sp COMMAND
@@ -30,18 +30,13 @@ USAGE
30
30
  <!-- usagestop -->
31
31
  # Commands
32
32
  <!-- commands -->
33
+ * [`sp account forget`](#sp-account-forget)
33
34
  * [`sp account get-sppi`](#sp-account-get-sppi)
34
35
  * [`sp account info`](#sp-account-info)
35
- * [`sp auth login`](#sp-auth-login)
36
- * [`sp auth me`](#sp-auth-me)
36
+ * [`sp account list`](#sp-account-list)
37
+ * [`sp account login`](#sp-account-login)
38
+ * [`sp account switch`](#sp-account-switch)
37
39
  * [`sp autocomplete [SHELL]`](#sp-autocomplete-shell)
38
- * [`sp config`](#sp-config)
39
- * [`sp config add [FILE]`](#sp-config-add-file)
40
- * [`sp config create`](#sp-config-create)
41
- * [`sp config delete`](#sp-config-delete)
42
- * [`sp config list`](#sp-config-list)
43
- * [`sp config show`](#sp-config-show)
44
- * [`sp config use`](#sp-config-use)
45
40
  * [`sp files download RESOURCEFILE LOCALDIRECTORY`](#sp-files-download-resourcefile-localdirectory)
46
41
  * [`sp files upload PATH`](#sp-files-upload-path)
47
42
  * [`sp help [COMMAND]`](#sp-help-command)
@@ -52,296 +47,172 @@ USAGE
52
47
  * [`sp storage update`](#sp-storage-update)
53
48
  * [`sp workflows extend-lease ORDERID`](#sp-workflows-extend-lease-orderid)
54
49
 
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.5/src/commands/account/get-sppi.ts)_
75
-
76
- ## `sp account info`
50
+ ## `sp account forget`
77
51
 
78
- Information about current authorized user
52
+ Purge all account details
79
53
 
80
54
  ```
81
55
  USAGE
82
- $ sp account info [--json] [--config <value>]
83
-
84
- GLOBAL FLAGS
85
- --config=<value> Specify config file.
86
- --json Format output as json.
87
-
88
- DESCRIPTION
89
- Information about current authorized user
90
- ```
91
-
92
- _See code: [src/commands/account/info.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/account/info.ts)_
93
-
94
- ## `sp auth login`
56
+ $ sp account forget [--json] [-f] [-n <value>]
95
57
 
96
- Login to SuperProtocol (sign up or sign in).
97
-
98
- ```
99
- USAGE
100
- $ sp auth login [--json] [--config <value>]
58
+ FLAGS
59
+ -f, --force Force deletion without confirmation
60
+ -n, --name=<value> Configuration name to delete
101
61
 
102
62
  GLOBAL FLAGS
103
- --config=<value> Specify config file.
104
- --json Format output as json.
63
+ --json Format output as json.
105
64
 
106
65
  DESCRIPTION
107
- Login to SuperProtocol (sign up or sign in).
108
-
109
- ALIASES
110
- $ sp login
66
+ Purge all account details
111
67
 
112
68
  EXAMPLES
113
- $ sp auth login
114
- ```
115
-
116
- _See code: [src/commands/auth/login.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/auth/login.ts)_
117
-
118
- ## `sp auth me`
119
-
120
- ```
121
- USAGE
122
- $ sp auth me [--json] [--config <value>]
69
+ $ sp account forget
123
70
 
124
- GLOBAL FLAGS
125
- --config=<value> Specify config file.
126
- --json Format output as json.
127
- ```
128
-
129
- _See code: [src/commands/auth/me.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/auth/me.ts)_
130
-
131
- ## `sp autocomplete [SHELL]`
132
-
133
- Display autocomplete installation instructions.
71
+ $ sp account forget --name "My Account"
134
72
 
73
+ $ sp account forget --name "My Account" --force
135
74
  ```
136
- USAGE
137
- $ sp autocomplete [SHELL] [-r]
138
75
 
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
76
+ _See code: [src/commands/account/forget.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/account/forget.ts)_
150
77
 
151
- $ sp autocomplete bash
152
-
153
- $ sp autocomplete zsh
154
-
155
- $ sp autocomplete powershell
156
-
157
- $ sp autocomplete --refresh-cache
158
- ```
159
-
160
- _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.39/src/commands/autocomplete/index.ts)_
161
-
162
- ## `sp config`
78
+ ## `sp account get-sppi`
163
79
 
164
- Manage configuration configs
80
+ Get SPPI (Super Protocol incentive tokens)
165
81
 
166
82
  ```
167
83
  USAGE
168
- $ sp config [--json]
84
+ $ sp account get-sppi [--json]
169
85
 
170
86
  GLOBAL FLAGS
171
87
  --json Format output as json.
172
88
 
173
89
  DESCRIPTION
174
- Manage configuration configs
90
+ Get SPPI (Super Protocol incentive tokens)
175
91
 
176
92
  EXAMPLES
177
- $ sp config show - Show current configuration details
178
-
179
- $ sp config list - List all configurations
180
-
181
- $ sp config use - Switch to a configuration
182
-
183
- $ sp config create --name "My Config" - Create new configuration
184
-
185
- $ sp config add ./config.json - Import configuration from file
186
-
187
- $ sp config delete - Delete a configuration
93
+ $ sp account get-sppi
188
94
  ```
189
95
 
190
- _See code: [src/commands/config/index.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/config/index.ts)_
96
+ _See code: [src/commands/account/get-sppi.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/account/get-sppi.ts)_
191
97
 
192
- ## `sp config add [FILE]`
98
+ ## `sp account info`
193
99
 
194
- Import a configuration from a file
100
+ Information about current authorized user
195
101
 
196
102
  ```
197
103
  USAGE
198
- $ sp config add [FILE] [--json] [-n <value>] [-y]
199
-
200
- ARGUMENTS
201
- [FILE] Configuration file path to import
104
+ $ sp account info [--json] [--detail]
202
105
 
203
106
  FLAGS
204
- -n, --name=<value> Custom name for the imported configuration
205
- -y, --yes Automatically switch to imported configuration
107
+ --detail Detailed information about Account
206
108
 
207
109
  GLOBAL FLAGS
208
110
  --json Format output as json.
209
111
 
210
112
  DESCRIPTION
211
- Import a configuration from a file
212
-
213
- EXAMPLES
214
- $ sp config add ./my-config.json
215
-
216
- $ sp config add ./my-config.json --name "Imported"
217
-
218
- Configuration files must follow this schema:
219
- {
220
- "providerUrl": "https://api.dp.superprotocol.com",
221
- "name": "Some name",
222
- "account": {
223
- "address": "0x111222333444555....",
224
- "privateKey": "0x000011122233344555..."
225
- }
226
- }
113
+ Information about current authorized user
227
114
  ```
228
115
 
229
- _See code: [src/commands/config/add.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/config/add.ts)_
116
+ _See code: [src/commands/account/info.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/account/info.ts)_
230
117
 
231
- ## `sp config create`
118
+ ## `sp account list`
232
119
 
233
- Create a new configuration
120
+ List all Accounts
234
121
 
235
122
  ```
236
123
  USAGE
237
- $ sp config create -n <value> [--json] [-u <value>] [-y]
238
-
239
- FLAGS
240
- -n, --name=<value> (required) Configuration name
241
- -u, --url=<value> Provider base URL
242
- -y, --yes Switch to new config
124
+ $ sp account list [--json]
243
125
 
244
126
  GLOBAL FLAGS
245
127
  --json Format output as json.
246
128
 
247
129
  DESCRIPTION
248
- Create a new configuration
130
+ List all Accounts
249
131
 
250
132
  EXAMPLES
251
- $ sp config create --name "My Config"
252
-
253
- $ sp config create --name "Production" --url "https://api.dp.superprotocol.com"
133
+ $ sp account list
254
134
  ```
255
135
 
256
- _See code: [src/commands/config/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/config/create.ts)_
136
+ _See code: [src/commands/account/list.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/account/list.ts)_
257
137
 
258
- ## `sp config delete`
138
+ ## `sp account login`
259
139
 
260
- Delete a configuration file
140
+ Login to SuperProtocol (sign up or sign in).
261
141
 
262
142
  ```
263
143
  USAGE
264
- $ sp config delete [--json] [-f] [-n <value>]
144
+ $ sp account login [--json] [--name <value>] [--privateKey <value>] [-y]
265
145
 
266
146
  FLAGS
267
- -f, --force Force deletion without confirmation
268
- -n, --name=<value> Configuration name to delete
147
+ -y, --yes Skip questions (generate keys when needed).
148
+ --name=<value> Account readable name
149
+ --privateKey=<value> Account private key used for authentication
269
150
 
270
151
  GLOBAL FLAGS
271
152
  --json Format output as json.
272
153
 
273
154
  DESCRIPTION
274
- Delete a configuration file
275
-
276
- EXAMPLES
277
- $ sp config delete
155
+ Login to SuperProtocol (sign up or sign in).
278
156
 
279
- $ sp config delete --name "My Config"
157
+ ALIASES
158
+ $ sp login
280
159
 
281
- $ sp config delete --name "My Config" --force
160
+ EXAMPLES
161
+ $ sp account login
282
162
  ```
283
163
 
284
- _See code: [src/commands/config/delete.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/config/delete.ts)_
164
+ _See code: [src/commands/account/login.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/account/login.ts)_
285
165
 
286
- ## `sp config list`
166
+ ## `sp account switch`
287
167
 
288
- List all configurations
168
+ Switch to a different account
289
169
 
290
170
  ```
291
171
  USAGE
292
- $ sp config list [--json]
172
+ $ sp account switch [--json]
293
173
 
294
174
  GLOBAL FLAGS
295
175
  --json Format output as json.
296
176
 
297
177
  DESCRIPTION
298
- List all configurations
178
+ Switch to a different account
299
179
 
300
180
  EXAMPLES
301
- $ sp config list
181
+ $ sp account switch
302
182
  ```
303
183
 
304
- _See code: [src/commands/config/list.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/config/list.ts)_
184
+ _See code: [src/commands/account/switch.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/account/switch.ts)_
305
185
 
306
- ## `sp config show`
186
+ ## `sp autocomplete [SHELL]`
307
187
 
308
- Show current configuration
188
+ Display autocomplete installation instructions.
309
189
 
310
190
  ```
311
191
  USAGE
312
- $ sp config show [--json]
192
+ $ sp autocomplete [SHELL] [-r]
313
193
 
314
- GLOBAL FLAGS
315
- --json Format output as json.
194
+ ARGUMENTS
195
+ [SHELL] (zsh|bash|powershell) Shell type
196
+
197
+ FLAGS
198
+ -r, --refresh-cache Refresh cache (ignores displaying instructions)
316
199
 
317
200
  DESCRIPTION
318
- Show current configuration
201
+ Display autocomplete installation instructions.
319
202
 
320
203
  EXAMPLES
321
- $ sp config show
322
- ```
323
-
324
- _See code: [src/commands/config/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/config/show.ts)_
325
-
326
- ## `sp config use`
327
-
328
- Switch to a different configuration file
204
+ $ sp autocomplete
329
205
 
330
- ```
331
- USAGE
332
- $ sp config use [--json]
206
+ $ sp autocomplete bash
333
207
 
334
- GLOBAL FLAGS
335
- --json Format output as json.
208
+ $ sp autocomplete zsh
336
209
 
337
- DESCRIPTION
338
- Switch to a different configuration file
210
+ $ sp autocomplete powershell
339
211
 
340
- EXAMPLES
341
- $ sp config use
212
+ $ sp autocomplete --refresh-cache
342
213
  ```
343
214
 
344
- _See code: [src/commands/config/use.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/config/use.ts)_
215
+ _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.39/src/commands/autocomplete/index.ts)_
345
216
 
346
217
  ## `sp files download RESOURCEFILE LOCALDIRECTORY`
347
218
 
@@ -349,7 +220,7 @@ Download file or directory described in resource file
349
220
 
350
221
  ```
351
222
  USAGE
352
- $ sp files download RESOURCEFILE LOCALDIRECTORY [--json] [--config <value>] [--maximum-concurrent <value>]
223
+ $ sp files download RESOURCEFILE LOCALDIRECTORY [--json] [--maximum-concurrent <value>]
353
224
 
354
225
  ARGUMENTS
355
226
  RESOURCEFILE Path to a resource file
@@ -359,8 +230,7 @@ FLAGS
359
230
  --maximum-concurrent=<value> [default: 1] Maximum concurrent pieces to download at once per transfer
360
231
 
361
232
  GLOBAL FLAGS
362
- --config=<value> Specify config file.
363
- --json Format output as json.
233
+ --json Format output as json.
364
234
 
365
235
  DESCRIPTION
366
236
  Download file or directory described in resource file
@@ -369,7 +239,7 @@ EXAMPLES
369
239
  $ sp files download ./resource.json ./pathToDownload
370
240
  ```
371
241
 
372
- _See code: [src/commands/files/download.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/files/download.ts)_
242
+ _See code: [src/commands/files/download.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/files/download.ts)_
373
243
 
374
244
  ## `sp files upload PATH`
375
245
 
@@ -377,8 +247,8 @@ Upload file or directory to remote storage
377
247
 
378
248
  ```
379
249
  USAGE
380
- $ sp files upload PATH [--json] [--config <value>] [--filename <value>] [--maximum-concurrent <value>]
381
- [--metadata <value>] [--output <value>] [--skip-encryption] [--sync]
250
+ $ sp files upload PATH [--json] [--filename <value>] [--maximum-concurrent <value>] [--metadata <value>]
251
+ [--output <value>] [--skip-encryption] [--sync]
382
252
 
383
253
  ARGUMENTS
384
254
  PATH file or directory to upload
@@ -393,8 +263,7 @@ FLAGS
393
263
  --sync Sync mode: delete files in target that don't exist in source
394
264
 
395
265
  GLOBAL FLAGS
396
- --config=<value> Specify config file.
397
- --json Format output as json.
266
+ --json Format output as json.
398
267
 
399
268
  DESCRIPTION
400
269
  Upload file or directory to remote storage
@@ -403,7 +272,7 @@ EXAMPLES
403
272
  $ sp files upload ./file.txt
404
273
  ```
405
274
 
406
- _See code: [src/commands/files/upload.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/files/upload.ts)_
275
+ _See code: [src/commands/files/upload.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/files/upload.ts)_
407
276
 
408
277
  ## `sp help [COMMAND]`
409
278
 
@@ -431,11 +300,15 @@ Login to SuperProtocol (sign up or sign in).
431
300
 
432
301
  ```
433
302
  USAGE
434
- $ sp login [--json] [--config <value>]
303
+ $ sp login [--json] [--name <value>] [--privateKey <value>] [-y]
304
+
305
+ FLAGS
306
+ -y, --yes Skip questions (generate keys when needed).
307
+ --name=<value> Account readable name
308
+ --privateKey=<value> Account private key used for authentication
435
309
 
436
310
  GLOBAL FLAGS
437
- --config=<value> Specify config file.
438
- --json Format output as json.
311
+ --json Format output as json.
439
312
 
440
313
  DESCRIPTION
441
314
  Login to SuperProtocol (sign up or sign in).
@@ -453,15 +326,14 @@ Create a new storage entry from file or interactive prompts.
453
326
 
454
327
  ```
455
328
  USAGE
456
- $ sp storage create [--json] [--config <value>] [-f <value>] [--notDefault]
329
+ $ sp storage create [--json] [-f <value>] [--notDefault]
457
330
 
458
331
  FLAGS
459
332
  -f, --fromFile=<value> Path to a JSON file that contains AddStorageDto payload.
460
333
  --notDefault Skip setting the created storage as default.
461
334
 
462
335
  GLOBAL FLAGS
463
- --config=<value> Specify config file.
464
- --json Format output as json.
336
+ --json Format output as json.
465
337
 
466
338
  DESCRIPTION
467
339
  Create a new storage entry from file or interactive prompts.
@@ -474,7 +346,7 @@ EXAMPLES
474
346
  $ sp storage create --not-default
475
347
  ```
476
348
 
477
- _See code: [src/commands/storage/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/storage/create.ts)_
349
+ _See code: [src/commands/storage/create.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/storage/create.ts)_
478
350
 
479
351
  ## `sp storage select`
480
352
 
@@ -482,11 +354,10 @@ Select a storage that will be used by subsequent commands.
482
354
 
483
355
  ```
484
356
  USAGE
485
- $ sp storage select [--json] [--config <value>]
357
+ $ sp storage select [--json]
486
358
 
487
359
  GLOBAL FLAGS
488
- --config=<value> Specify config file.
489
- --json Format output as json.
360
+ --json Format output as json.
490
361
 
491
362
  DESCRIPTION
492
363
  Select a storage that will be used by subsequent commands.
@@ -495,7 +366,7 @@ EXAMPLES
495
366
  $ sp storage select
496
367
  ```
497
368
 
498
- _See code: [src/commands/storage/select.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/storage/select.ts)_
369
+ _See code: [src/commands/storage/select.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/storage/select.ts)_
499
370
 
500
371
  ## `sp storage show`
501
372
 
@@ -503,11 +374,10 @@ Show current selected storage
503
374
 
504
375
  ```
505
376
  USAGE
506
- $ sp storage show [--json] [--config <value>]
377
+ $ sp storage show [--json]
507
378
 
508
379
  GLOBAL FLAGS
509
- --config=<value> Specify config file.
510
- --json Format output as json.
380
+ --json Format output as json.
511
381
 
512
382
  DESCRIPTION
513
383
  Show current selected storage
@@ -516,7 +386,7 @@ EXAMPLES
516
386
  $ sp storage show
517
387
  ```
518
388
 
519
- _See code: [src/commands/storage/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/storage/show.ts)_
389
+ _See code: [src/commands/storage/show.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/storage/show.ts)_
520
390
 
521
391
  ## `sp storage update`
522
392
 
@@ -524,15 +394,14 @@ Update the configuration of an existing storage.
524
394
 
525
395
  ```
526
396
  USAGE
527
- $ sp storage update [--json] [--config <value>] [-f <value>] [-i <value>]
397
+ $ sp storage update [--json] [-f <value>] [-i <value>]
528
398
 
529
399
  FLAGS
530
400
  -f, --fromFile=<value> Path to a JSON file that contains UpdateStorageDto payload.
531
401
  -i, --id=<value> Storage ID to update
532
402
 
533
403
  GLOBAL FLAGS
534
- --config=<value> Specify config file.
535
- --json Format output as json.
404
+ --json Format output as json.
536
405
 
537
406
  DESCRIPTION
538
407
  Update the configuration of an existing storage.
@@ -543,7 +412,7 @@ EXAMPLES
543
412
  $ sp storage update --id=2de3e3a4-0000-1111-2222-333344445555
544
413
  ```
545
414
 
546
- _See code: [src/commands/storage/update.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/storage/update.ts)_
415
+ _See code: [src/commands/storage/update.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/storage/update.ts)_
547
416
 
548
417
  ## `sp workflows extend-lease ORDERID`
549
418
 
@@ -551,7 +420,7 @@ Replenish deposit for a workflow to extend its lease time
551
420
 
552
421
  ```
553
422
  USAGE
554
- $ sp workflows extend-lease ORDERID [--json] [--config <value>] [--minutes <value>] [--sppi <value>] [-y]
423
+ $ sp workflows extend-lease ORDERID [--json] [--minutes <value>] [--sppi <value>] [-y]
555
424
 
556
425
  ARGUMENTS
557
426
  ORDERID Order ID
@@ -562,8 +431,7 @@ FLAGS
562
431
  --sppi=<value> SPPI token amount to add to the order
563
432
 
564
433
  GLOBAL FLAGS
565
- --config=<value> Specify config file.
566
- --json Format output as json.
434
+ --json Format output as json.
567
435
 
568
436
  DESCRIPTION
569
437
  Replenish deposit for a workflow to extend its lease time
@@ -576,5 +444,5 @@ EXAMPLES
576
444
  $ sp workflows extend-lease <orderId> --sppi 2 --yes
577
445
  ```
578
446
 
579
- _See code: [src/commands/workflows/extend-lease.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.5/src/commands/workflows/extend-lease.ts)_
447
+ _See code: [src/commands/workflows/extend-lease.ts](https://github.com/Super-Protocol/sp-cli/blob/v0.0.7/src/commands/workflows/extend-lease.ts)_
580
448
  <!-- commandsstop -->
@@ -0,0 +1,20 @@
1
+ import { select } from '@clack/prompts';
2
+ import type { Command } from '@oclif/core';
3
+ import type { AccountManager } from '../../managers/index.js';
4
+ import { BaseCommand } from '../base.js';
5
+ type SelectOptions<T> = Parameters<typeof select<T>>[0];
6
+ type ProviderInitOptions = {
7
+ assumeYes?: boolean;
8
+ enableAuth?: boolean;
9
+ enableCookies?: boolean;
10
+ rebuild?: boolean;
11
+ };
12
+ export declare abstract class BaseAccountCommand<T extends typeof Command> extends BaseCommand<T> {
13
+ protected initAccountContext(providerOptions?: ProviderInitOptions): Promise<void>;
14
+ interactWithUser(accountManager: AccountManager): Promise<{
15
+ address: string;
16
+ privateKey: string;
17
+ }>;
18
+ protected selectPrompt<Value>(options: SelectOptions<Value>): Promise<Value>;
19
+ }
20
+ export {};
@@ -0,0 +1,49 @@
1
+ import { confirm, isCancel, password, select } from '@clack/prompts';
2
+ import { BaseCommand } from '../base.js';
3
+ export class BaseAccountCommand extends BaseCommand {
4
+ async initAccountContext(providerOptions = {}) {
5
+ const rebuild = Boolean(providerOptions.rebuild);
6
+ const { accountManager } = await this.container.initAccountManager(rebuild).build();
7
+ if (!(await accountManager.hasAccount())) {
8
+ await (providerOptions.assumeYes
9
+ ? accountManager.create()
10
+ : this.interactWithUser(accountManager));
11
+ }
12
+ const { assumeYes: _assumeYes, rebuild: _rebuild, ...initOptions } = providerOptions;
13
+ await this.container.initProviderClient({ ...initOptions, rebuild }).build();
14
+ }
15
+ async interactWithUser(accountManager) {
16
+ this.warn("Account doesn't exist in current configuration");
17
+ const ask = await confirm({
18
+ message: 'Do you want to create a new account?',
19
+ });
20
+ if (isCancel(ask)) {
21
+ this.error('Operation cancelled.', { exit: 1 });
22
+ }
23
+ if (ask) {
24
+ const account = await accountManager.create();
25
+ this.log('Generated new keyPair for new account.');
26
+ return account;
27
+ }
28
+ const privateKeyInput = await password({
29
+ message: 'Please input your privateKey for using in account',
30
+ });
31
+ if (isCancel(privateKeyInput)) {
32
+ this.error('Operation cancelled.', { exit: 1 });
33
+ }
34
+ const privateKey = privateKeyInput.trim();
35
+ try {
36
+ const account = await accountManager.createFromKey(privateKey);
37
+ this.log('Your privateKey will be used in config. Keypair created');
38
+ return account;
39
+ }
40
+ catch (error) {
41
+ this.debug(error);
42
+ this.error('Invalid private key format. Please try again.');
43
+ }
44
+ }
45
+ async selectPrompt(options) {
46
+ const result = await select(options);
47
+ return this.ensurePromptValue(result);
48
+ }
49
+ }
@@ -1,10 +1,13 @@
1
- import { BaseConfigCommand } from './base.js';
2
- export default class ConfigDelete extends BaseConfigCommand<typeof ConfigDelete> {
1
+ import { BaseAccountCommand } from './base.js';
2
+ export default class AccountForget extends BaseAccountCommand<typeof AccountForget> {
3
+ static authenticate: boolean;
3
4
  static description: string;
4
5
  static examples: string[];
5
6
  static flags: {
6
7
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
8
  name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  };
10
+ private configFileManager;
11
+ init(): Promise<void>;
9
12
  run(): Promise<void>;
10
13
  }