@super-protocol/sp-cli 0.0.6 → 0.0.8

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