@namera-ai/cli 0.1.4 → 1.0.0

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 (148) hide show
  1. package/README.md +91 -221
  2. package/dist/index.js +1660 -0
  3. package/dist/index.js.map +1 -0
  4. package/package.json +57 -50
  5. package/LICENSE +0 -201
  6. package/dist/commands/index.mjs +0 -21
  7. package/dist/commands/index.mjs.map +0 -1
  8. package/dist/commands/keystore/create.mjs +0 -74
  9. package/dist/commands/keystore/create.mjs.map +0 -1
  10. package/dist/commands/keystore/decrypt.mjs +0 -71
  11. package/dist/commands/keystore/decrypt.mjs.map +0 -1
  12. package/dist/commands/keystore/import.mjs +0 -84
  13. package/dist/commands/keystore/import.mjs.map +0 -1
  14. package/dist/commands/keystore/index.mjs +0 -28
  15. package/dist/commands/keystore/index.mjs.map +0 -1
  16. package/dist/commands/keystore/info.mjs +0 -62
  17. package/dist/commands/keystore/info.mjs.map +0 -1
  18. package/dist/commands/keystore/list.mjs +0 -46
  19. package/dist/commands/keystore/list.mjs.map +0 -1
  20. package/dist/commands/keystore/remove.mjs +0 -51
  21. package/dist/commands/keystore/remove.mjs.map +0 -1
  22. package/dist/commands/mcp/index.mjs +0 -13
  23. package/dist/commands/mcp/index.mjs.map +0 -1
  24. package/dist/commands/mcp/start.mjs +0 -82
  25. package/dist/commands/mcp/start.mjs.map +0 -1
  26. package/dist/commands/schema/index.mjs +0 -53
  27. package/dist/commands/schema/index.mjs.map +0 -1
  28. package/dist/commands/session-key/create/index.mjs +0 -87
  29. package/dist/commands/session-key/create/index.mjs.map +0 -1
  30. package/dist/commands/session-key/create/prompts/base.mjs +0 -52
  31. package/dist/commands/session-key/create/prompts/base.mjs.map +0 -1
  32. package/dist/commands/session-key/create/prompts/call.mjs +0 -85
  33. package/dist/commands/session-key/create/prompts/call.mjs.map +0 -1
  34. package/dist/commands/session-key/create/prompts/common.mjs +0 -27
  35. package/dist/commands/session-key/create/prompts/common.mjs.map +0 -1
  36. package/dist/commands/session-key/create/prompts/gas.mjs +0 -19
  37. package/dist/commands/session-key/create/prompts/gas.mjs.map +0 -1
  38. package/dist/commands/session-key/create/prompts/index.mjs +0 -44
  39. package/dist/commands/session-key/create/prompts/index.mjs.map +0 -1
  40. package/dist/commands/session-key/create/prompts/rate-limit.mjs +0 -40
  41. package/dist/commands/session-key/create/prompts/rate-limit.mjs.map +0 -1
  42. package/dist/commands/session-key/create/prompts/signature-caller.mjs +0 -26
  43. package/dist/commands/session-key/create/prompts/signature-caller.mjs.map +0 -1
  44. package/dist/commands/session-key/create/prompts/timestamp.mjs +0 -32
  45. package/dist/commands/session-key/create/prompts/timestamp.mjs.map +0 -1
  46. package/dist/commands/session-key/index.mjs +0 -26
  47. package/dist/commands/session-key/index.mjs.map +0 -1
  48. package/dist/commands/session-key/info.mjs +0 -64
  49. package/dist/commands/session-key/info.mjs.map +0 -1
  50. package/dist/commands/session-key/list.mjs +0 -54
  51. package/dist/commands/session-key/list.mjs.map +0 -1
  52. package/dist/commands/session-key/remove.mjs +0 -51
  53. package/dist/commands/session-key/remove.mjs.map +0 -1
  54. package/dist/commands/session-key/status.mjs +0 -64
  55. package/dist/commands/session-key/status.mjs.map +0 -1
  56. package/dist/commands/smart-account/create.mjs +0 -94
  57. package/dist/commands/smart-account/create.mjs.map +0 -1
  58. package/dist/commands/smart-account/import.mjs +0 -45
  59. package/dist/commands/smart-account/import.mjs.map +0 -1
  60. package/dist/commands/smart-account/index.mjs +0 -30
  61. package/dist/commands/smart-account/index.mjs.map +0 -1
  62. package/dist/commands/smart-account/info.mjs +0 -66
  63. package/dist/commands/smart-account/info.mjs.map +0 -1
  64. package/dist/commands/smart-account/list.mjs +0 -48
  65. package/dist/commands/smart-account/list.mjs.map +0 -1
  66. package/dist/commands/smart-account/remove.mjs +0 -54
  67. package/dist/commands/smart-account/remove.mjs.map +0 -1
  68. package/dist/commands/smart-account/status.mjs +0 -63
  69. package/dist/commands/smart-account/status.mjs.map +0 -1
  70. package/dist/dto/index.mjs +0 -6
  71. package/dist/dto/keystore.mjs +0 -44
  72. package/dist/dto/keystore.mjs.map +0 -1
  73. package/dist/dto/mcp.mjs +0 -13
  74. package/dist/dto/mcp.mjs.map +0 -1
  75. package/dist/dto/session-key.mjs +0 -54
  76. package/dist/dto/session-key.mjs.map +0 -1
  77. package/dist/dto/smart-account.mjs +0 -45
  78. package/dist/dto/smart-account.mjs.map +0 -1
  79. package/dist/flags/global.mjs +0 -29
  80. package/dist/flags/global.mjs.map +0 -1
  81. package/dist/flags/shared.mjs +0 -11
  82. package/dist/flags/shared.mjs.map +0 -1
  83. package/dist/helpers/humanize.mjs +0 -153
  84. package/dist/helpers/humanize.mjs.map +0 -1
  85. package/dist/helpers/paths.mjs +0 -31
  86. package/dist/helpers/paths.mjs.map +0 -1
  87. package/dist/helpers/policy.mjs +0 -89
  88. package/dist/helpers/policy.mjs.map +0 -1
  89. package/dist/helpers/pretty.mjs +0 -71
  90. package/dist/helpers/pretty.mjs.map +0 -1
  91. package/dist/index.d.mts +0 -2
  92. package/dist/index.mjs +0 -36
  93. package/dist/index.mjs.map +0 -1
  94. package/dist/layers/config.mjs +0 -124
  95. package/dist/layers/config.mjs.map +0 -1
  96. package/dist/layers/index.mjs +0 -11
  97. package/dist/layers/keystore.mjs +0 -225
  98. package/dist/layers/keystore.mjs.map +0 -1
  99. package/dist/layers/mcp-context.mjs +0 -8
  100. package/dist/layers/mcp-context.mjs.map +0 -1
  101. package/dist/layers/mcp.mjs +0 -31
  102. package/dist/layers/mcp.mjs.map +0 -1
  103. package/dist/layers/output.mjs +0 -21
  104. package/dist/layers/output.mjs.map +0 -1
  105. package/dist/layers/prompt.mjs +0 -78
  106. package/dist/layers/prompt.mjs.map +0 -1
  107. package/dist/layers/session-key.mjs +0 -218
  108. package/dist/layers/session-key.mjs.map +0 -1
  109. package/dist/layers/smart-account.mjs +0 -175
  110. package/dist/layers/smart-account.mjs.map +0 -1
  111. package/dist/layers/web3.mjs +0 -83
  112. package/dist/layers/web3.mjs.map +0 -1
  113. package/dist/mcp/helpers/common.mjs +0 -9
  114. package/dist/mcp/helpers/common.mjs.map +0 -1
  115. package/dist/mcp/helpers/index.mjs +0 -4
  116. package/dist/mcp/helpers/session-key.mjs +0 -129
  117. package/dist/mcp/helpers/session-key.mjs.map +0 -1
  118. package/dist/mcp/index.mjs +0 -43
  119. package/dist/mcp/index.mjs.map +0 -1
  120. package/dist/mcp/mcp.mjs +0 -15
  121. package/dist/mcp/mcp.mjs.map +0 -1
  122. package/dist/mcp/tools/account/address.mjs +0 -20
  123. package/dist/mcp/tools/account/address.mjs.map +0 -1
  124. package/dist/mcp/tools/account/get-balance.mjs +0 -54
  125. package/dist/mcp/tools/account/get-balance.mjs.map +0 -1
  126. package/dist/mcp/tools/account/index.mjs +0 -15
  127. package/dist/mcp/tools/account/index.mjs.map +0 -1
  128. package/dist/mcp/tools/read/index.mjs +0 -11
  129. package/dist/mcp/tools/read/index.mjs.map +0 -1
  130. package/dist/mcp/tools/read/read-contract.mjs +0 -49
  131. package/dist/mcp/tools/read/read-contract.mjs.map +0 -1
  132. package/dist/mcp/tools/transaction/execute-transaction.mjs +0 -38
  133. package/dist/mcp/tools/transaction/execute-transaction.mjs.map +0 -1
  134. package/dist/mcp/tools/transaction/index.mjs +0 -15
  135. package/dist/mcp/tools/transaction/index.mjs.map +0 -1
  136. package/dist/mcp/tools/transaction/native-transfer.mjs +0 -59
  137. package/dist/mcp/tools/transaction/native-transfer.mjs.map +0 -1
  138. package/dist/schema/chain.mjs +0 -124
  139. package/dist/schema/chain.mjs.map +0 -1
  140. package/dist/schema/common.mjs +0 -29
  141. package/dist/schema/common.mjs.map +0 -1
  142. package/dist/schema/index.mjs +0 -5
  143. package/dist/schema/policy.mjs +0 -114
  144. package/dist/schema/policy.mjs.map +0 -1
  145. package/dist/schema/tx.mjs +0 -19
  146. package/dist/schema/tx.mjs.map +0 -1
  147. package/dist/types/index.mjs +0 -11
  148. package/dist/types/index.mjs.map +0 -1
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [2026] Namespace Inc.
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
- import { keystoreCommands } from "./keystore/index.mjs";
3
- import { mcpCommands } from "./mcp/index.mjs";
4
- import { schemaCommand } from "./schema/index.mjs";
5
- import { sessionKeyCommands } from "./session-key/index.mjs";
6
- import { smartAccountCommands } from "./smart-account/index.mjs";
7
- //#region src/commands/index.ts
8
- /**
9
- * Root CLI command set.
10
- */
11
- const commands = [
12
- keystoreCommands,
13
- smartAccountCommands,
14
- sessionKeyCommands,
15
- mcpCommands,
16
- schemaCommand
17
- ];
18
- //#endregion
19
- export { commands };
20
-
21
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/commands/index.ts"],"sourcesContent":["import { keystoreCommands } from \"./keystore\";\nimport { mcpCommands } from \"./mcp\";\nimport { schemaCommand } from \"./schema\";\nimport { sessionKeyCommands } from \"./session-key\";\nimport { smartAccountCommands } from \"./smart-account\";\n\n/**\n * Root CLI command set.\n */\nexport const commands = [\n keystoreCommands,\n smartAccountCommands,\n sessionKeyCommands,\n mcpCommands,\n schemaCommand,\n] as const;\n"],"mappings":";;;;;;;;;;AASA,MAAa,WAAW;CACtB;CACA;CACA;CACA;CACA;CACD"}
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env node
2
- import { CreateKeystoreParams } from "../../dto/keystore.mjs";
3
- import "../../dto/index.mjs";
4
- import { getGlobalFlags } from "../../flags/global.mjs";
5
- import { PromptManager } from "../../layers/prompt.mjs";
6
- import { KeystoreManager } from "../../layers/keystore.mjs";
7
- import { OutputFormatter } from "../../layers/output.mjs";
8
- import "../../layers/index.mjs";
9
- import { Console, Effect, Redacted, Schema } from "effect";
10
- import { Command, Flag } from "effect/unstable/cli";
11
- //#region src/commands/keystore/create.ts
12
- const createKeystoreHandler = (flagAlias, flagPassword) => Effect.gen(function* () {
13
- const promptManager = yield* PromptManager;
14
- const keystoreManager = yield* KeystoreManager;
15
- const outputFormatter = yield* OutputFormatter;
16
- const globalFlags = yield* getGlobalFlags();
17
- let params;
18
- if (globalFlags.params._tag === "Some") params = Schema.decodeUnknownSync(Schema.fromJsonString(CreateKeystoreParams))(globalFlags.params.value);
19
- else {
20
- let alias;
21
- let password;
22
- if (flagAlias._tag === "Some") alias = flagAlias.value;
23
- else alias = yield* promptManager.aliasPrompt({
24
- aliasType: "new",
25
- message: "Enter alias for keystore:",
26
- type: "keystore"
27
- });
28
- if (flagPassword._tag === "Some") password = flagPassword.value;
29
- else password = yield* promptManager.passwordPrompt({ message: "Enter password for keystore:" });
30
- params = {
31
- alias,
32
- password: Redacted.value(password)
33
- };
34
- }
35
- const res = yield* keystoreManager.createKeystore(params);
36
- const data = {
37
- address: res.data.address,
38
- alias: res.alias,
39
- path: res.path
40
- };
41
- if (globalFlags.quiet) return;
42
- const output = yield* outputFormatter.format(data, globalFlags.out);
43
- yield* Console.log(output);
44
- });
45
- const alias = Flag.string("alias").pipe(Flag.withDescription("The alias of the keystore to create"), Flag.withAlias("a"), Flag.optional);
46
- const password = Flag.redacted("password").pipe(Flag.withDescription("The password to encrypt the keystore with"), Flag.withAlias("p"), Flag.optional);
47
- /**
48
- * Command that creates a new keystore and stores it locally.
49
- */
50
- const createKeystoreCommand = Command.make("create", {
51
- alias,
52
- password
53
- }, ({ alias, password }) => createKeystoreHandler(alias, password)).pipe(Command.withAlias("c"), Command.withDescription("Creates a random keypair and stores it as keystore"), Command.withExamples([
54
- {
55
- command: "namera keystore create -a my-wallet",
56
- description: "Creates a new keystore with alias 'my-wallet'"
57
- },
58
- {
59
- command: "namera keystore create --alias my-wallet --password my-password",
60
- description: "Creates a new keystore with alias 'my-wallet' and password 'my-password'"
61
- },
62
- {
63
- command: `namera keystore create --params '{"alias":"my-wallet","password":"my-password"}'`,
64
- description: "Creates a new keystore with json params"
65
- },
66
- {
67
- command: "namera schema keystore.create",
68
- description: "Get the schema for the create command"
69
- }
70
- ]));
71
- //#endregion
72
- export { createKeystoreCommand };
73
-
74
- //# sourceMappingURL=create.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.mjs","names":["PromptManager.PromptManager","KeystoreManager.KeystoreManager","OutputFormatter.OutputFormatter"],"sources":["../../../src/commands/keystore/create.ts"],"sourcesContent":["import { Console, Effect, type Option, Redacted, Schema } from \"effect\";\nimport { Command, Flag } from \"effect/unstable/cli\";\n\nimport { CreateKeystoreParams } from \"@/dto\";\nimport { getGlobalFlags } from \"@/flags/global\";\nimport { KeystoreManager, OutputFormatter, PromptManager } from \"@/layers\";\n\nconst createKeystoreHandler = (\n flagAlias: Option.Option<string>,\n flagPassword: Option.Option<Redacted.Redacted<string>>,\n) =>\n Effect.gen(function* () {\n const promptManager = yield* PromptManager.PromptManager;\n const keystoreManager = yield* KeystoreManager.KeystoreManager;\n const outputFormatter = yield* OutputFormatter.OutputFormatter;\n const globalFlags = yield* getGlobalFlags();\n\n let params: CreateKeystoreParams;\n\n if (globalFlags.params._tag === \"Some\") {\n params = Schema.decodeUnknownSync(\n Schema.fromJsonString(CreateKeystoreParams),\n )(globalFlags.params.value);\n } else {\n let alias: string;\n let password: Redacted.Redacted<string>;\n\n if (flagAlias._tag === \"Some\") {\n alias = flagAlias.value;\n } else {\n alias = yield* promptManager.aliasPrompt({\n aliasType: \"new\",\n message: \"Enter alias for keystore:\",\n type: \"keystore\",\n });\n }\n\n if (flagPassword._tag === \"Some\") {\n password = flagPassword.value;\n } else {\n password = yield* promptManager.passwordPrompt({\n message: \"Enter password for keystore:\",\n });\n }\n\n params = { alias, password: Redacted.value(password) };\n }\n\n const res = yield* keystoreManager.createKeystore(params);\n\n const data = {\n address: res.data.address,\n alias: res.alias,\n path: res.path,\n };\n\n if (globalFlags.quiet) return;\n\n const output = yield* outputFormatter.format(data, globalFlags.out);\n yield* Console.log(output);\n });\n\nconst alias = Flag.string(\"alias\").pipe(\n Flag.withDescription(\"The alias of the keystore to create\"),\n Flag.withAlias(\"a\"),\n Flag.optional,\n);\n\nconst password = Flag.redacted(\"password\").pipe(\n Flag.withDescription(\"The password to encrypt the keystore with\"),\n Flag.withAlias(\"p\"),\n Flag.optional,\n);\n\n/**\n * Command that creates a new keystore and stores it locally.\n */\nexport const createKeystoreCommand = Command.make(\n \"create\",\n { alias, password },\n ({ alias, password }) => createKeystoreHandler(alias, password),\n).pipe(\n Command.withAlias(\"c\"),\n Command.withDescription(\"Creates a random keypair and stores it as keystore\"),\n Command.withExamples([\n {\n command: \"namera keystore create -a my-wallet\",\n description: \"Creates a new keystore with alias 'my-wallet'\",\n },\n {\n command:\n \"namera keystore create --alias my-wallet --password my-password\",\n description:\n \"Creates a new keystore with alias 'my-wallet' and password 'my-password'\",\n },\n {\n command: `namera keystore create --params '{\"alias\":\"my-wallet\",\"password\":\"my-password\"}'`,\n description: \"Creates a new keystore with json params\",\n },\n {\n command: \"namera schema keystore.create\",\n description: \"Get the schema for the create command\",\n },\n ]),\n);\n"],"mappings":";;;;;;;;;;;AAOA,MAAM,yBACJ,WACA,iBAEA,OAAO,IAAI,aAAa;CACtB,MAAM,gBAAgB,OAAOA;CAC7B,MAAM,kBAAkB,OAAOC;CAC/B,MAAM,kBAAkB,OAAOC;CAC/B,MAAM,cAAc,OAAO,gBAAgB;CAE3C,IAAI;AAEJ,KAAI,YAAY,OAAO,SAAS,OAC9B,UAAS,OAAO,kBACd,OAAO,eAAe,qBAAqB,CAC5C,CAAC,YAAY,OAAO,MAAM;MACtB;EACL,IAAI;EACJ,IAAI;AAEJ,MAAI,UAAU,SAAS,OACrB,SAAQ,UAAU;MAElB,SAAQ,OAAO,cAAc,YAAY;GACvC,WAAW;GACX,SAAS;GACT,MAAM;GACP,CAAC;AAGJ,MAAI,aAAa,SAAS,OACxB,YAAW,aAAa;MAExB,YAAW,OAAO,cAAc,eAAe,EAC7C,SAAS,gCACV,CAAC;AAGJ,WAAS;GAAE;GAAO,UAAU,SAAS,MAAM,SAAS;GAAE;;CAGxD,MAAM,MAAM,OAAO,gBAAgB,eAAe,OAAO;CAEzD,MAAM,OAAO;EACX,SAAS,IAAI,KAAK;EAClB,OAAO,IAAI;EACX,MAAM,IAAI;EACX;AAED,KAAI,YAAY,MAAO;CAEvB,MAAM,SAAS,OAAO,gBAAgB,OAAO,MAAM,YAAY,IAAI;AACnE,QAAO,QAAQ,IAAI,OAAO;EAC1B;AAEJ,MAAM,QAAQ,KAAK,OAAO,QAAQ,CAAC,KACjC,KAAK,gBAAgB,sCAAsC,EAC3D,KAAK,UAAU,IAAI,EACnB,KAAK,SACN;AAED,MAAM,WAAW,KAAK,SAAS,WAAW,CAAC,KACzC,KAAK,gBAAgB,4CAA4C,EACjE,KAAK,UAAU,IAAI,EACnB,KAAK,SACN;;;;AAKD,MAAa,wBAAwB,QAAQ,KAC3C,UACA;CAAE;CAAO;CAAU,GAClB,EAAE,OAAO,eAAe,sBAAsB,OAAO,SAAS,CAChE,CAAC,KACA,QAAQ,UAAU,IAAI,EACtB,QAAQ,gBAAgB,qDAAqD,EAC7E,QAAQ,aAAa;CACnB;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SACE;EACF,aACE;EACH;CACD;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SAAS;EACT,aAAa;EACd;CACF,CAAC,CACH"}
@@ -1,71 +0,0 @@
1
- #!/usr/bin/env node
2
- import { DecryptKeystoreParams } from "../../dto/keystore.mjs";
3
- import "../../dto/index.mjs";
4
- import { getGlobalFlags } from "../../flags/global.mjs";
5
- import { PromptManager } from "../../layers/prompt.mjs";
6
- import { KeystoreManager } from "../../layers/keystore.mjs";
7
- import { OutputFormatter } from "../../layers/output.mjs";
8
- import "../../layers/index.mjs";
9
- import { Console, Effect, Redacted, Schema } from "effect";
10
- import { Command, Flag } from "effect/unstable/cli";
11
- //#region src/commands/keystore/decrypt.ts
12
- const handler = (flagAlias, flagPassword) => Effect.gen(function* () {
13
- const keystoreManager = yield* KeystoreManager;
14
- const promptManager = yield* PromptManager;
15
- const outputFormatter = yield* OutputFormatter;
16
- const globalFlags = yield* getGlobalFlags();
17
- let params;
18
- if (globalFlags.params._tag === "Some") params = Schema.decodeUnknownSync(Schema.fromJsonString(DecryptKeystoreParams))(globalFlags.params.value);
19
- else {
20
- let alias;
21
- let password;
22
- if (flagAlias._tag === "Some") alias = flagAlias.value;
23
- else alias = (yield* keystoreManager.selectKeystore({ message: "Select keystore:" })).alias;
24
- if (flagPassword._tag === "Some") password = flagPassword.value;
25
- else password = yield* promptManager.passwordPrompt({ message: "Enter password for keystore:" });
26
- params = {
27
- alias,
28
- password: Redacted.value(password)
29
- };
30
- }
31
- const res = yield* keystoreManager.decryptKeystore(params);
32
- const data = {
33
- alias: res.alias,
34
- address: res.address,
35
- publicKey: res.publicKey,
36
- privateKey: Redacted.value(res.privateKey)
37
- };
38
- if (globalFlags.quiet) return;
39
- const output = yield* outputFormatter.format(data, globalFlags.out);
40
- yield* Console.log(output);
41
- });
42
- const alias = Flag.string("alias").pipe(Flag.withDescription("The alias of the keystore to decrypt"), Flag.withAlias("a"), Flag.optional);
43
- const password = Flag.redacted("password").pipe(Flag.withDescription("The password to decrypt the keystore with"), Flag.withAlias("p"), Flag.optional);
44
- /**
45
- * Command that decrypts a keystore and prints key material.
46
- */
47
- const decryptKeystoreCommand = Command.make("decrypt", {
48
- alias,
49
- password
50
- }, ({ alias, password }) => handler(alias, password)).pipe(Command.withAlias("d"), Command.withDescription("Decrypt a keystore to get the private key"), Command.withExamples([
51
- {
52
- command: "namera keystore decrypt",
53
- description: "Decrypt a keystore with alias and password prompts"
54
- },
55
- {
56
- command: "namera keystore decrypt --alias my-wallet --password my-password",
57
- description: "Decrypt a keystore with alias and password"
58
- },
59
- {
60
- command: `namera keystore decrypt --params '{"alias":"my-wallet","password":"my-password"}'`,
61
- description: "Decrypt a keystore with json params"
62
- },
63
- {
64
- command: "namera schema keystore.decrypt",
65
- description: "Get the schema for the decrypt command"
66
- }
67
- ]));
68
- //#endregion
69
- export { decryptKeystoreCommand };
70
-
71
- //# sourceMappingURL=decrypt.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decrypt.mjs","names":["KeystoreManager.KeystoreManager","PromptManager.PromptManager","OutputFormatter.OutputFormatter"],"sources":["../../../src/commands/keystore/decrypt.ts"],"sourcesContent":["import { Console, Effect, type Option, Redacted, Schema } from \"effect\";\nimport { Command, Flag } from \"effect/unstable/cli\";\n\nimport { DecryptKeystoreParams } from \"@/dto\";\nimport { getGlobalFlags } from \"@/flags/global\";\nimport { KeystoreManager, OutputFormatter, PromptManager } from \"@/layers\";\n\nconst handler = (\n flagAlias: Option.Option<string>,\n flagPassword: Option.Option<Redacted.Redacted<string>>,\n) =>\n Effect.gen(function* () {\n const keystoreManager = yield* KeystoreManager.KeystoreManager;\n const promptManager = yield* PromptManager.PromptManager;\n const outputFormatter = yield* OutputFormatter.OutputFormatter;\n\n const globalFlags = yield* getGlobalFlags();\n\n let params: DecryptKeystoreParams;\n\n if (globalFlags.params._tag === \"Some\") {\n params = Schema.decodeUnknownSync(\n Schema.fromJsonString(DecryptKeystoreParams),\n )(globalFlags.params.value);\n } else {\n let alias: string;\n let password: Redacted.Redacted<string>;\n\n if (flagAlias._tag === \"Some\") {\n alias = flagAlias.value;\n } else {\n const res = yield* keystoreManager.selectKeystore({\n message: \"Select keystore:\",\n });\n alias = res.alias;\n }\n\n if (flagPassword._tag === \"Some\") {\n password = flagPassword.value;\n } else {\n password = yield* promptManager.passwordPrompt({\n message: \"Enter password for keystore:\",\n });\n }\n\n params = { alias, password: Redacted.value(password) };\n }\n\n const res = yield* keystoreManager.decryptKeystore(params);\n\n const data = {\n alias: res.alias,\n address: res.address,\n publicKey: res.publicKey,\n privateKey: Redacted.value(res.privateKey),\n };\n\n if (globalFlags.quiet) return;\n const output = yield* outputFormatter.format(data, globalFlags.out);\n yield* Console.log(output);\n });\n\nconst alias = Flag.string(\"alias\").pipe(\n Flag.withDescription(\"The alias of the keystore to decrypt\"),\n Flag.withAlias(\"a\"),\n Flag.optional,\n);\n\nconst password = Flag.redacted(\"password\").pipe(\n Flag.withDescription(\"The password to decrypt the keystore with\"),\n Flag.withAlias(\"p\"),\n Flag.optional,\n);\n\n/**\n * Command that decrypts a keystore and prints key material.\n */\nexport const decryptKeystoreCommand = Command.make(\n \"decrypt\",\n { alias, password },\n ({ alias, password }) => handler(alias, password),\n).pipe(\n Command.withAlias(\"d\"),\n Command.withDescription(\"Decrypt a keystore to get the private key\"),\n Command.withExamples([\n {\n command: \"namera keystore decrypt\",\n description: \"Decrypt a keystore with alias and password prompts\",\n },\n {\n command:\n \"namera keystore decrypt --alias my-wallet --password my-password\",\n description: \"Decrypt a keystore with alias and password\",\n },\n {\n command: `namera keystore decrypt --params '{\"alias\":\"my-wallet\",\"password\":\"my-password\"}'`,\n description: \"Decrypt a keystore with json params\",\n },\n {\n command: \"namera schema keystore.decrypt\",\n description: \"Get the schema for the decrypt command\",\n },\n ]),\n);\n"],"mappings":";;;;;;;;;;;AAOA,MAAM,WACJ,WACA,iBAEA,OAAO,IAAI,aAAa;CACtB,MAAM,kBAAkB,OAAOA;CAC/B,MAAM,gBAAgB,OAAOC;CAC7B,MAAM,kBAAkB,OAAOC;CAE/B,MAAM,cAAc,OAAO,gBAAgB;CAE3C,IAAI;AAEJ,KAAI,YAAY,OAAO,SAAS,OAC9B,UAAS,OAAO,kBACd,OAAO,eAAe,sBAAsB,CAC7C,CAAC,YAAY,OAAO,MAAM;MACtB;EACL,IAAI;EACJ,IAAI;AAEJ,MAAI,UAAU,SAAS,OACrB,SAAQ,UAAU;MAKlB,UAAQ,OAHW,gBAAgB,eAAe,EAChD,SAAS,oBACV,CAAC,EACU;AAGd,MAAI,aAAa,SAAS,OACxB,YAAW,aAAa;MAExB,YAAW,OAAO,cAAc,eAAe,EAC7C,SAAS,gCACV,CAAC;AAGJ,WAAS;GAAE;GAAO,UAAU,SAAS,MAAM,SAAS;GAAE;;CAGxD,MAAM,MAAM,OAAO,gBAAgB,gBAAgB,OAAO;CAE1D,MAAM,OAAO;EACX,OAAO,IAAI;EACX,SAAS,IAAI;EACb,WAAW,IAAI;EACf,YAAY,SAAS,MAAM,IAAI,WAAW;EAC3C;AAED,KAAI,YAAY,MAAO;CACvB,MAAM,SAAS,OAAO,gBAAgB,OAAO,MAAM,YAAY,IAAI;AACnE,QAAO,QAAQ,IAAI,OAAO;EAC1B;AAEJ,MAAM,QAAQ,KAAK,OAAO,QAAQ,CAAC,KACjC,KAAK,gBAAgB,uCAAuC,EAC5D,KAAK,UAAU,IAAI,EACnB,KAAK,SACN;AAED,MAAM,WAAW,KAAK,SAAS,WAAW,CAAC,KACzC,KAAK,gBAAgB,4CAA4C,EACjE,KAAK,UAAU,IAAI,EACnB,KAAK,SACN;;;;AAKD,MAAa,yBAAyB,QAAQ,KAC5C,WACA;CAAE;CAAO;CAAU,GAClB,EAAE,OAAO,eAAe,QAAQ,OAAO,SAAS,CAClD,CAAC,KACA,QAAQ,UAAU,IAAI,EACtB,QAAQ,gBAAgB,4CAA4C,EACpE,QAAQ,aAAa;CACnB;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SACE;EACF,aAAa;EACd;CACD;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SAAS;EACT,aAAa;EACd;CACF,CAAC,CACH"}
@@ -1,84 +0,0 @@
1
- #!/usr/bin/env node
2
- import { ImportKeystoreParams } from "../../dto/keystore.mjs";
3
- import "../../dto/index.mjs";
4
- import { getGlobalFlags } from "../../flags/global.mjs";
5
- import { PromptManager } from "../../layers/prompt.mjs";
6
- import { KeystoreManager } from "../../layers/keystore.mjs";
7
- import { OutputFormatter } from "../../layers/output.mjs";
8
- import "../../layers/index.mjs";
9
- import { Console, Effect, Redacted, Schema } from "effect";
10
- import { Command, Flag } from "effect/unstable/cli";
11
- //#region src/commands/keystore/import.ts
12
- const handler = (flagAlias, flagPassword, flagPrivateKey) => Effect.gen(function* () {
13
- const keystoreManager = yield* KeystoreManager;
14
- const promptManager = yield* PromptManager;
15
- const outputFormatter = yield* OutputFormatter;
16
- const globalFlags = yield* getGlobalFlags();
17
- let params;
18
- if (globalFlags.params._tag === "Some") params = Schema.decodeUnknownSync(Schema.fromJsonString(ImportKeystoreParams))(globalFlags.params.value);
19
- else {
20
- let alias;
21
- let password;
22
- let privateKey;
23
- if (flagAlias._tag === "Some") alias = flagAlias.value;
24
- else alias = yield* promptManager.aliasPrompt({
25
- aliasType: "new",
26
- message: "Enter alias for keystore:",
27
- type: "keystore"
28
- });
29
- if (flagPassword._tag === "Some") password = flagPassword.value;
30
- else password = yield* promptManager.passwordPrompt({ message: "Enter password for keystore:" });
31
- if (flagPrivateKey._tag === "Some") privateKey = flagPrivateKey.value;
32
- else privateKey = yield* promptManager.hexPrompt({
33
- redacted: true,
34
- length: 32,
35
- message: "Enter private key:"
36
- });
37
- params = {
38
- alias,
39
- password: Redacted.value(password),
40
- privateKey: Redacted.value(privateKey)
41
- };
42
- }
43
- const res = yield* keystoreManager.importKeystore(params);
44
- const data = {
45
- alias: res.alias,
46
- address: res.data.address,
47
- path: res.path
48
- };
49
- if (globalFlags.quiet) return;
50
- const output = yield* outputFormatter.format(data, globalFlags.out);
51
- yield* Console.log(output);
52
- });
53
- const alias = Flag.string("alias").pipe(Flag.withDescription("The alias of the keystore to import"), Flag.withAlias("a"), Flag.optional);
54
- const privateKey = Flag.redacted("private-key").pipe(Flag.withDescription("The private key of the keystore to import"), Flag.optional);
55
- const password = Flag.redacted("password").pipe(Flag.withDescription("The password to encrypt the keystore with"), Flag.withAlias("p"), Flag.optional);
56
- /**
57
- * Command that imports a keystore from a private key.
58
- */
59
- const importKeystoreCommand = Command.make("import", {
60
- alias,
61
- privateKey,
62
- password
63
- }, ({ alias, password, privateKey }) => handler(alias, password, privateKey)).pipe(Command.withAlias("i"), Command.withDescription("Import a keystore from a private key"), Command.withExamples([
64
- {
65
- command: "namera keystore import",
66
- description: "Import a keystore with interactive prompts"
67
- },
68
- {
69
- command: "namera keystore import --alias my-wallet",
70
- description: "Import a keystore with alias 'my-wallet'"
71
- },
72
- {
73
- command: "namera keystore import -a my-wallet -p my-password --private-key 0x1234567890abcdef",
74
- description: "Import a keystore with alias 'my-wallet', password 'my-password', and private key '0x1234567890abcdef'"
75
- },
76
- {
77
- command: "namera schema keystore.import",
78
- description: "Get the schema for the import command"
79
- }
80
- ]));
81
- //#endregion
82
- export { importKeystoreCommand };
83
-
84
- //# sourceMappingURL=import.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"import.mjs","names":["KeystoreManager.KeystoreManager","PromptManager.PromptManager","OutputFormatter.OutputFormatter"],"sources":["../../../src/commands/keystore/import.ts"],"sourcesContent":["import { Console, Effect, type Option, Redacted, Schema } from \"effect\";\nimport { Command, Flag } from \"effect/unstable/cli\";\n\nimport { ImportKeystoreParams } from \"@/dto\";\nimport { getGlobalFlags } from \"@/flags/global\";\nimport { KeystoreManager, OutputFormatter, PromptManager } from \"@/layers\";\n\nconst handler = (\n flagAlias: Option.Option<string>,\n flagPassword: Option.Option<Redacted.Redacted<string>>,\n flagPrivateKey: Option.Option<Redacted.Redacted<string>>,\n) =>\n Effect.gen(function* () {\n const keystoreManager = yield* KeystoreManager.KeystoreManager;\n const promptManager = yield* PromptManager.PromptManager;\n const outputFormatter = yield* OutputFormatter.OutputFormatter;\n\n const globalFlags = yield* getGlobalFlags();\n\n let params: ImportKeystoreParams;\n\n if (globalFlags.params._tag === \"Some\") {\n params = Schema.decodeUnknownSync(\n Schema.fromJsonString(ImportKeystoreParams),\n )(globalFlags.params.value);\n } else {\n let alias: string;\n let password: Redacted.Redacted<string>;\n let privateKey: Redacted.Redacted<string>;\n\n if (flagAlias._tag === \"Some\") {\n alias = flagAlias.value;\n } else {\n const res = yield* promptManager.aliasPrompt({\n aliasType: \"new\",\n message: \"Enter alias for keystore:\",\n type: \"keystore\",\n });\n alias = res;\n }\n\n if (flagPassword._tag === \"Some\") {\n password = flagPassword.value;\n } else {\n password = yield* promptManager.passwordPrompt({\n message: \"Enter password for keystore:\",\n });\n }\n\n if (flagPrivateKey._tag === \"Some\") {\n privateKey = flagPrivateKey.value;\n } else {\n privateKey = yield* promptManager.hexPrompt({\n redacted: true,\n length: 32,\n message: \"Enter private key:\",\n });\n }\n\n params = {\n alias,\n password: Redacted.value(password),\n privateKey: Redacted.value(privateKey),\n };\n }\n\n const res = yield* keystoreManager.importKeystore(params);\n\n const data = {\n alias: res.alias,\n address: res.data.address,\n path: res.path,\n };\n\n if (globalFlags.quiet) return;\n\n const output = yield* outputFormatter.format(data, globalFlags.out);\n yield* Console.log(output);\n });\n\nconst alias = Flag.string(\"alias\").pipe(\n Flag.withDescription(\"The alias of the keystore to import\"),\n Flag.withAlias(\"a\"),\n Flag.optional,\n);\n\nconst privateKey = Flag.redacted(\"private-key\").pipe(\n Flag.withDescription(\"The private key of the keystore to import\"),\n Flag.optional,\n);\n\nconst password = Flag.redacted(\"password\").pipe(\n Flag.withDescription(\"The password to encrypt the keystore with\"),\n Flag.withAlias(\"p\"),\n Flag.optional,\n);\n\n/**\n * Command that imports a keystore from a private key.\n */\nexport const importKeystoreCommand = Command.make(\n \"import\",\n { alias, privateKey, password },\n ({ alias, password, privateKey }) => handler(alias, password, privateKey),\n).pipe(\n Command.withAlias(\"i\"),\n Command.withDescription(\"Import a keystore from a private key\"),\n Command.withExamples([\n {\n command: \"namera keystore import\",\n description: \"Import a keystore with interactive prompts\",\n },\n {\n command: \"namera keystore import --alias my-wallet\",\n description: \"Import a keystore with alias 'my-wallet'\",\n },\n {\n command:\n \"namera keystore import -a my-wallet -p my-password --private-key 0x1234567890abcdef\",\n description:\n \"Import a keystore with alias 'my-wallet', password 'my-password', and private key '0x1234567890abcdef'\",\n },\n {\n command: \"namera schema keystore.import\",\n description: \"Get the schema for the import command\",\n },\n ]),\n);\n"],"mappings":";;;;;;;;;;;AAOA,MAAM,WACJ,WACA,cACA,mBAEA,OAAO,IAAI,aAAa;CACtB,MAAM,kBAAkB,OAAOA;CAC/B,MAAM,gBAAgB,OAAOC;CAC7B,MAAM,kBAAkB,OAAOC;CAE/B,MAAM,cAAc,OAAO,gBAAgB;CAE3C,IAAI;AAEJ,KAAI,YAAY,OAAO,SAAS,OAC9B,UAAS,OAAO,kBACd,OAAO,eAAe,qBAAqB,CAC5C,CAAC,YAAY,OAAO,MAAM;MACtB;EACL,IAAI;EACJ,IAAI;EACJ,IAAI;AAEJ,MAAI,UAAU,SAAS,OACrB,SAAQ,UAAU;MAOlB,SAAQ,OALW,cAAc,YAAY;GAC3C,WAAW;GACX,SAAS;GACT,MAAM;GACP,CAAC;AAIJ,MAAI,aAAa,SAAS,OACxB,YAAW,aAAa;MAExB,YAAW,OAAO,cAAc,eAAe,EAC7C,SAAS,gCACV,CAAC;AAGJ,MAAI,eAAe,SAAS,OAC1B,cAAa,eAAe;MAE5B,cAAa,OAAO,cAAc,UAAU;GAC1C,UAAU;GACV,QAAQ;GACR,SAAS;GACV,CAAC;AAGJ,WAAS;GACP;GACA,UAAU,SAAS,MAAM,SAAS;GAClC,YAAY,SAAS,MAAM,WAAW;GACvC;;CAGH,MAAM,MAAM,OAAO,gBAAgB,eAAe,OAAO;CAEzD,MAAM,OAAO;EACX,OAAO,IAAI;EACX,SAAS,IAAI,KAAK;EAClB,MAAM,IAAI;EACX;AAED,KAAI,YAAY,MAAO;CAEvB,MAAM,SAAS,OAAO,gBAAgB,OAAO,MAAM,YAAY,IAAI;AACnE,QAAO,QAAQ,IAAI,OAAO;EAC1B;AAEJ,MAAM,QAAQ,KAAK,OAAO,QAAQ,CAAC,KACjC,KAAK,gBAAgB,sCAAsC,EAC3D,KAAK,UAAU,IAAI,EACnB,KAAK,SACN;AAED,MAAM,aAAa,KAAK,SAAS,cAAc,CAAC,KAC9C,KAAK,gBAAgB,4CAA4C,EACjE,KAAK,SACN;AAED,MAAM,WAAW,KAAK,SAAS,WAAW,CAAC,KACzC,KAAK,gBAAgB,4CAA4C,EACjE,KAAK,UAAU,IAAI,EACnB,KAAK,SACN;;;;AAKD,MAAa,wBAAwB,QAAQ,KAC3C,UACA;CAAE;CAAO;CAAY;CAAU,GAC9B,EAAE,OAAO,UAAU,iBAAiB,QAAQ,OAAO,UAAU,WAAW,CAC1E,CAAC,KACA,QAAQ,UAAU,IAAI,EACtB,QAAQ,gBAAgB,uCAAuC,EAC/D,QAAQ,aAAa;CACnB;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SACE;EACF,aACE;EACH;CACD;EACE,SAAS;EACT,aAAa;EACd;CACF,CAAC,CACH"}
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createKeystoreCommand } from "./create.mjs";
3
- import { decryptKeystoreCommand } from "./decrypt.mjs";
4
- import { importKeystoreCommand } from "./import.mjs";
5
- import { getKeystoreInfoCommand } from "./info.mjs";
6
- import { listKeystoresCommand } from "./list.mjs";
7
- import { removeKeystoreCommand } from "./remove.mjs";
8
- import { Effect } from "effect";
9
- import { CliError, Command } from "effect/unstable/cli";
10
- //#region src/commands/keystore/index.ts
11
- /**
12
- * Command group for keystore-related operations.
13
- */
14
- const keystoreCommands = Command.make("keystore", {}, () => Effect.fail(new CliError.ShowHelp({
15
- commandPath: ["namera", "keystore"],
16
- errors: []
17
- }))).pipe(Command.withDescription("Keystore management utilities."), Command.withAlias("k"), Command.withSubcommands([
18
- createKeystoreCommand,
19
- listKeystoresCommand,
20
- getKeystoreInfoCommand,
21
- decryptKeystoreCommand,
22
- importKeystoreCommand,
23
- removeKeystoreCommand
24
- ]));
25
- //#endregion
26
- export { keystoreCommands };
27
-
28
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/commands/keystore/index.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { CliError, Command } from \"effect/unstable/cli\";\n\nimport { createKeystoreCommand } from \"./create\";\nimport { decryptKeystoreCommand } from \"./decrypt\";\nimport { importKeystoreCommand } from \"./import\";\nimport { getKeystoreInfoCommand } from \"./info\";\nimport { listKeystoresCommand } from \"./list\";\nimport { removeKeystoreCommand } from \"./remove\";\n\n/**\n * Command group for keystore-related operations.\n */\nexport const keystoreCommands = Command.make(\"keystore\", {}, () =>\n Effect.fail(\n new CliError.ShowHelp({\n commandPath: [\"namera\", \"keystore\"],\n errors: [],\n }),\n ),\n).pipe(\n Command.withDescription(\"Keystore management utilities.\"),\n Command.withAlias(\"k\"),\n Command.withSubcommands([\n createKeystoreCommand,\n listKeystoresCommand,\n getKeystoreInfoCommand,\n decryptKeystoreCommand,\n importKeystoreCommand,\n removeKeystoreCommand,\n ]),\n);\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,mBAAmB,QAAQ,KAAK,YAAY,EAAE,QACzD,OAAO,KACL,IAAI,SAAS,SAAS;CACpB,aAAa,CAAC,UAAU,WAAW;CACnC,QAAQ,EAAE;CACX,CAAC,CACH,CACF,CAAC,KACA,QAAQ,gBAAgB,iCAAiC,EACzD,QAAQ,UAAU,IAAI,EACtB,QAAQ,gBAAgB;CACtB;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,CACH"}
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env node
2
- import { GetKeystoreParams } from "../../dto/keystore.mjs";
3
- import "../../dto/index.mjs";
4
- import { getGlobalFlags } from "../../flags/global.mjs";
5
- import { KeystoreManager } from "../../layers/keystore.mjs";
6
- import { OutputFormatter } from "../../layers/output.mjs";
7
- import "../../layers/index.mjs";
8
- import { Console, Effect, Schema } from "effect";
9
- import { Command, Flag } from "effect/unstable/cli";
10
- //#region src/commands/keystore/info.ts
11
- const getKeystoreInfoHandler = (flagAlias) => Effect.gen(function* () {
12
- const keystoreManager = yield* KeystoreManager;
13
- const outputFormatter = yield* OutputFormatter;
14
- const globalFlags = yield* getGlobalFlags();
15
- let params;
16
- if (globalFlags.params._tag === "Some") params = Schema.decodeUnknownSync(Schema.fromJsonString(GetKeystoreParams))(globalFlags.params.value);
17
- else {
18
- let alias;
19
- if (flagAlias._tag === "Some") alias = flagAlias.value;
20
- else alias = (yield* keystoreManager.selectKeystore({ message: "Select keystore:" })).alias;
21
- params = { alias };
22
- }
23
- const res = yield* keystoreManager.getKeystore(params);
24
- const data = {
25
- alias: res.alias,
26
- address: res.data.address,
27
- path: res.path
28
- };
29
- if (globalFlags.quiet) return;
30
- const output = yield* outputFormatter.format(data, globalFlags.out);
31
- yield* Console.log(output);
32
- });
33
- const alias = Flag.string("alias").pipe(Flag.withDescription("The alias of the keystore to retrieve"), Flag.withAlias("a"), Flag.optional);
34
- /**
35
- * Command that returns metadata for a keystore.
36
- */
37
- const getKeystoreInfoCommand = Command.make("info", { alias }, ({ alias }) => getKeystoreInfoHandler(alias)).pipe(Command.withDescription("Get information about a keystore"), Command.withExamples([
38
- {
39
- command: "namera keystore info",
40
- description: "Get information about a keystore with alias prompt"
41
- },
42
- {
43
- command: "namera keystore info --alias my-wallet",
44
- description: "Get information about a keystore with alias 'my-wallet'"
45
- },
46
- {
47
- command: `namera keystore info --params '{"alias":"my-wallet"}'`,
48
- description: "Get information about a keystore with json params"
49
- },
50
- {
51
- command: "namera keystore info --alias my-wallet --output json",
52
- description: "Get information about a keystore in json format"
53
- },
54
- {
55
- command: "namera schema keystore.info",
56
- description: "Get the schema for the info command"
57
- }
58
- ]));
59
- //#endregion
60
- export { getKeystoreInfoCommand };
61
-
62
- //# sourceMappingURL=info.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"info.mjs","names":["KeystoreManager.KeystoreManager","OutputFormatter.OutputFormatter"],"sources":["../../../src/commands/keystore/info.ts"],"sourcesContent":["import { Console, Effect, type Option, Schema } from \"effect\";\nimport { Command, Flag } from \"effect/unstable/cli\";\n\nimport { GetKeystoreParams } from \"@/dto\";\nimport { getGlobalFlags } from \"@/flags/global\";\nimport { KeystoreManager, OutputFormatter } from \"@/layers\";\n\nconst getKeystoreInfoHandler = (flagAlias: Option.Option<string>) =>\n Effect.gen(function* () {\n const keystoreManager = yield* KeystoreManager.KeystoreManager;\n const outputFormatter = yield* OutputFormatter.OutputFormatter;\n\n const globalFlags = yield* getGlobalFlags();\n\n let params: GetKeystoreParams;\n\n if (globalFlags.params._tag === \"Some\") {\n params = Schema.decodeUnknownSync(\n Schema.fromJsonString(GetKeystoreParams),\n )(globalFlags.params.value);\n } else {\n let alias: string;\n\n if (flagAlias._tag === \"Some\") {\n alias = flagAlias.value;\n } else {\n const res = yield* keystoreManager.selectKeystore({\n message: \"Select keystore:\",\n });\n alias = res.alias;\n }\n\n params = { alias };\n }\n\n const res = yield* keystoreManager.getKeystore(params);\n\n const data = {\n alias: res.alias,\n address: res.data.address,\n path: res.path,\n };\n\n if (globalFlags.quiet) return;\n\n const output = yield* outputFormatter.format(data, globalFlags.out);\n yield* Console.log(output);\n });\n\nconst alias = Flag.string(\"alias\").pipe(\n Flag.withDescription(\"The alias of the keystore to retrieve\"),\n Flag.withAlias(\"a\"),\n Flag.optional,\n);\n\n/**\n * Command that returns metadata for a keystore.\n */\nexport const getKeystoreInfoCommand = Command.make(\n \"info\",\n { alias },\n ({ alias }) => getKeystoreInfoHandler(alias),\n).pipe(\n Command.withDescription(\"Get information about a keystore\"),\n Command.withExamples([\n {\n command: \"namera keystore info\",\n description: \"Get information about a keystore with alias prompt\",\n },\n {\n command: \"namera keystore info --alias my-wallet\",\n description: \"Get information about a keystore with alias 'my-wallet'\",\n },\n {\n command: `namera keystore info --params '{\"alias\":\"my-wallet\"}'`,\n description: \"Get information about a keystore with json params\",\n },\n {\n command: \"namera keystore info --alias my-wallet --output json\",\n description: \"Get information about a keystore in json format\",\n },\n {\n command: \"namera schema keystore.info\",\n description: \"Get the schema for the info command\",\n },\n ]),\n);\n"],"mappings":";;;;;;;;;;AAOA,MAAM,0BAA0B,cAC9B,OAAO,IAAI,aAAa;CACtB,MAAM,kBAAkB,OAAOA;CAC/B,MAAM,kBAAkB,OAAOC;CAE/B,MAAM,cAAc,OAAO,gBAAgB;CAE3C,IAAI;AAEJ,KAAI,YAAY,OAAO,SAAS,OAC9B,UAAS,OAAO,kBACd,OAAO,eAAe,kBAAkB,CACzC,CAAC,YAAY,OAAO,MAAM;MACtB;EACL,IAAI;AAEJ,MAAI,UAAU,SAAS,OACrB,SAAQ,UAAU;MAKlB,UAAQ,OAHW,gBAAgB,eAAe,EAChD,SAAS,oBACV,CAAC,EACU;AAGd,WAAS,EAAE,OAAO;;CAGpB,MAAM,MAAM,OAAO,gBAAgB,YAAY,OAAO;CAEtD,MAAM,OAAO;EACX,OAAO,IAAI;EACX,SAAS,IAAI,KAAK;EAClB,MAAM,IAAI;EACX;AAED,KAAI,YAAY,MAAO;CAEvB,MAAM,SAAS,OAAO,gBAAgB,OAAO,MAAM,YAAY,IAAI;AACnE,QAAO,QAAQ,IAAI,OAAO;EAC1B;AAEJ,MAAM,QAAQ,KAAK,OAAO,QAAQ,CAAC,KACjC,KAAK,gBAAgB,wCAAwC,EAC7D,KAAK,UAAU,IAAI,EACnB,KAAK,SACN;;;;AAKD,MAAa,yBAAyB,QAAQ,KAC5C,QACA,EAAE,OAAO,GACR,EAAE,YAAY,uBAAuB,MAAM,CAC7C,CAAC,KACA,QAAQ,gBAAgB,mCAAmC,EAC3D,QAAQ,aAAa;CACnB;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SAAS;EACT,aAAa;EACd;CACD;EACE,SAAS;EACT,aAAa;EACd;CACF,CAAC,CACH"}