@kadi.build/deploy-ability 0.0.3 → 0.0.5

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 (110) hide show
  1. package/dist/targets/akash/bids.d.ts +183 -0
  2. package/dist/targets/akash/bids.d.ts.map +1 -0
  3. package/dist/targets/akash/bids.js +247 -0
  4. package/dist/targets/akash/bids.js.map +1 -0
  5. package/dist/targets/akash/certificate-manager.d.ts +89 -167
  6. package/dist/targets/akash/certificate-manager.d.ts.map +1 -1
  7. package/dist/targets/akash/certificate-manager.js +193 -301
  8. package/dist/targets/akash/certificate-manager.js.map +1 -1
  9. package/dist/targets/akash/client.d.ts +644 -0
  10. package/dist/targets/akash/client.d.ts.map +1 -0
  11. package/dist/targets/akash/client.js +972 -0
  12. package/dist/targets/akash/client.js.map +1 -0
  13. package/dist/targets/akash/constants.d.ts +12 -149
  14. package/dist/targets/akash/constants.d.ts.map +1 -1
  15. package/dist/targets/akash/constants.js +14 -136
  16. package/dist/targets/akash/constants.js.map +1 -1
  17. package/dist/targets/akash/deployer.d.ts +3 -82
  18. package/dist/targets/akash/deployer.d.ts.map +1 -1
  19. package/dist/targets/akash/deployer.js +122 -160
  20. package/dist/targets/akash/deployer.js.map +1 -1
  21. package/dist/targets/akash/environment.d.ts +16 -214
  22. package/dist/targets/akash/environment.d.ts.map +1 -1
  23. package/dist/targets/akash/environment.js +20 -210
  24. package/dist/targets/akash/environment.js.map +1 -1
  25. package/dist/targets/akash/index.d.ts +95 -189
  26. package/dist/targets/akash/index.d.ts.map +1 -1
  27. package/dist/targets/akash/index.js +69 -197
  28. package/dist/targets/akash/index.js.map +1 -1
  29. package/dist/targets/akash/lease-monitor.d.ts +3 -21
  30. package/dist/targets/akash/lease-monitor.d.ts.map +1 -1
  31. package/dist/targets/akash/lease-monitor.js +39 -56
  32. package/dist/targets/akash/lease-monitor.js.map +1 -1
  33. package/dist/targets/akash/logs.d.ts +103 -4
  34. package/dist/targets/akash/logs.d.ts.map +1 -1
  35. package/dist/targets/akash/logs.js +12 -3
  36. package/dist/targets/akash/logs.js.map +1 -1
  37. package/dist/targets/akash/pricing.d.ts +12 -191
  38. package/dist/targets/akash/pricing.d.ts.map +1 -1
  39. package/dist/targets/akash/pricing.js +12 -188
  40. package/dist/targets/akash/pricing.js.map +1 -1
  41. package/dist/targets/akash/provider-manager.d.ts +120 -0
  42. package/dist/targets/akash/provider-manager.d.ts.map +1 -0
  43. package/dist/targets/akash/provider-manager.js +574 -0
  44. package/dist/targets/akash/provider-manager.js.map +1 -0
  45. package/dist/targets/akash/sdl-generator.d.ts +2 -2
  46. package/dist/targets/akash/sdl-generator.d.ts.map +1 -1
  47. package/dist/targets/akash/sdl-generator.js +6 -39
  48. package/dist/targets/akash/sdl-generator.js.map +1 -1
  49. package/dist/targets/akash/types.d.ts +66 -243
  50. package/dist/targets/akash/types.d.ts.map +1 -1
  51. package/dist/targets/akash/types.js +4 -41
  52. package/dist/targets/akash/types.js.map +1 -1
  53. package/dist/targets/akash/wallet-manager.d.ts +35 -352
  54. package/dist/targets/akash/wallet-manager.d.ts.map +1 -1
  55. package/dist/targets/akash/wallet-manager.js +37 -439
  56. package/dist/targets/akash/wallet-manager.js.map +1 -1
  57. package/dist/targets/local/compose-generator.d.ts.map +1 -1
  58. package/dist/targets/local/compose-generator.js +1 -0
  59. package/dist/targets/local/compose-generator.js.map +1 -1
  60. package/dist/targets/local/deployer.js +4 -4
  61. package/dist/targets/local/deployer.js.map +1 -1
  62. package/dist/targets/local/types.d.ts +4 -0
  63. package/dist/targets/local/types.d.ts.map +1 -1
  64. package/dist/types/index.d.ts +1 -1
  65. package/dist/types/index.d.ts.map +1 -1
  66. package/dist/types/index.js.map +1 -1
  67. package/dist/types/options.d.ts +45 -4
  68. package/dist/types/options.d.ts.map +1 -1
  69. package/dist/utils/registry/manager.js +6 -6
  70. package/dist/utils/registry/manager.js.map +1 -1
  71. package/dist/utils/registry/setup.js +4 -4
  72. package/dist/utils/registry/setup.js.map +1 -1
  73. package/docs/KADI_ABILITY_CONVERSION.md +1365 -0
  74. package/docs/PIPELINE_BUILDER_DESIGN.md +1149 -0
  75. package/package.json +8 -11
  76. package/dist/targets/akash/bid-selectors.d.ts +0 -251
  77. package/dist/targets/akash/bid-selectors.d.ts.map +0 -1
  78. package/dist/targets/akash/bid-selectors.js +0 -322
  79. package/dist/targets/akash/bid-selectors.js.map +0 -1
  80. package/dist/targets/akash/bid-types.d.ts +0 -297
  81. package/dist/targets/akash/bid-types.d.ts.map +0 -1
  82. package/dist/targets/akash/bid-types.js +0 -89
  83. package/dist/targets/akash/bid-types.js.map +0 -1
  84. package/dist/targets/akash/blockchain-client.d.ts +0 -577
  85. package/dist/targets/akash/blockchain-client.d.ts.map +0 -1
  86. package/dist/targets/akash/blockchain-client.js +0 -803
  87. package/dist/targets/akash/blockchain-client.js.map +0 -1
  88. package/dist/targets/akash/logs.types.d.ts +0 -102
  89. package/dist/targets/akash/logs.types.d.ts.map +0 -1
  90. package/dist/targets/akash/logs.types.js +0 -9
  91. package/dist/targets/akash/logs.types.js.map +0 -1
  92. package/dist/targets/akash/provider-client.d.ts +0 -114
  93. package/dist/targets/akash/provider-client.d.ts.map +0 -1
  94. package/dist/targets/akash/provider-client.js +0 -318
  95. package/dist/targets/akash/provider-client.js.map +0 -1
  96. package/dist/targets/akash/provider-metadata.d.ts +0 -228
  97. package/dist/targets/akash/provider-metadata.d.ts.map +0 -1
  98. package/dist/targets/akash/provider-metadata.js +0 -14
  99. package/dist/targets/akash/provider-metadata.js.map +0 -1
  100. package/dist/targets/akash/provider-service.d.ts +0 -133
  101. package/dist/targets/akash/provider-service.d.ts.map +0 -1
  102. package/dist/targets/akash/provider-service.js +0 -391
  103. package/dist/targets/akash/provider-service.js.map +0 -1
  104. package/dist/targets/akash/query-client.d.ts +0 -125
  105. package/dist/targets/akash/query-client.d.ts.map +0 -1
  106. package/dist/targets/akash/query-client.js +0 -332
  107. package/dist/targets/akash/query-client.js.map +0 -1
  108. package/docs/EXAMPLES.md +0 -293
  109. package/docs/PLACEMENT.md +0 -433
  110. package/docs/STORAGE.md +0 -318
@@ -4,31 +4,6 @@
4
4
  * Provides a clean, step-by-step API for connecting to Keplr wallet via WalletConnect.
5
5
  * This is a LIBRARY - no QR code display, no prompts, just pure wallet operations.
6
6
  *
7
- * Key Improvements from kadi-deploy:
8
- * - ✅ ZERO CLI dependencies (no QRCode, chalk, enquirer)
9
- * - ✅ ZERO `any` types (was 5 any types)
10
- * - ✅ Split into 4 clear steps for composability
11
- * - ✅ Result types for all operations
12
- * - ✅ Natural, intuitive API design
13
- *
14
- * Architecture:
15
- * ```
16
- * Step 1: initWalletConnect() → Create SignClient
17
- * ↓
18
- * Step 2: generateConnectionUri() → Get URI for QR code
19
- * ↓
20
- * Step 3: waitForApproval() → Poll for user approval
21
- * ↓
22
- * Step 4: createWalletContext() → Get ready-to-use wallet
23
- * ```
24
- *
25
- * Design Philosophy:
26
- * Each step is independent and composable. Callers can:
27
- * - Display QR codes however they want (terminal, web, mobile)
28
- * - Add their own timeout logic
29
- * - Implement custom retry mechanisms
30
- * - Show progress however they prefer
31
- *
32
7
  * @module targets/akash/wallet
33
8
  */
34
9
  import { SignClient } from '@walletconnect/sign-client';
@@ -37,15 +12,9 @@ import type { Result } from '../../types/index.js';
37
12
  import type { WalletContext } from './types.js';
38
13
  import { WalletError } from '../../errors/index.js';
39
14
  import { type AkashNetwork } from './environment.js';
40
- /**
41
- * WalletConnect client wrapper
42
- *
43
- * Contains the SignClient and metadata for managing connections.
44
- */
15
+ /** WalletConnect client wrapper */
45
16
  export interface WalletConnectClient {
46
- /** SignClient instance for WalletConnect operations */
47
17
  readonly client: InstanceType<typeof SignClient>;
48
- /** Project metadata for display in wallets */
49
18
  readonly metadata: {
50
19
  readonly name: string;
51
20
  readonly description: string;
@@ -53,52 +22,30 @@ export interface WalletConnectClient {
53
22
  readonly icons: readonly string[];
54
23
  };
55
24
  }
56
- /**
57
- * Connection URI result
58
- *
59
- * Contains the URI to display as QR code and approval promise.
60
- */
25
+ /** Connection URI result */
61
26
  export interface ConnectionUriResult {
62
- /** URI to display as QR code or clickable link */
63
27
  readonly uri: string;
64
- /** Approval promise that resolves when user approves */
65
28
  readonly approval: () => Promise<SessionTypes.Struct>;
66
29
  }
67
- /**
68
- * Connection approval result
69
- *
70
- * Contains the approved session and account information.
71
- */
30
+ /** Connection approval result */
72
31
  export interface ApprovalResult {
73
- /** Approved WalletConnect session */
74
32
  readonly session: SessionTypes.Struct;
75
- /** Connected wallet address */
76
33
  readonly address: string;
77
- /** Chain ID that was connected */
78
34
  readonly chainId: string;
79
35
  }
80
36
  /**
81
37
  * Step 1: Initialize WalletConnect client
82
38
  *
83
- * Creates a WalletConnect SignClient with proper configuration.
84
- * This is a one-time setup that can be reused for multiple connections.
85
- *
86
39
  * @param projectId - WalletConnect Cloud project ID
87
40
  * @param metadata - Optional app metadata (defaults to KADI Deploy)
88
41
  * @returns Result with WalletConnect client or error
89
42
  *
90
43
  * @example
91
44
  * ```typescript
92
- * // Initialize with your project ID
93
45
  * const clientResult = await initWalletConnect('your-project-id-here');
94
- *
95
- * if (!clientResult.success) {
96
- * console.error('Failed to initialize:', clientResult.error);
97
- * return;
46
+ * if (clientResult.success) {
47
+ * console.log('WalletConnect ready!');
98
48
  * }
99
- *
100
- * const wcClient = clientResult.data;
101
- * console.log('WalletConnect ready!');
102
49
  * ```
103
50
  */
104
51
  export declare function initWalletConnect(projectId: string, metadata?: {
@@ -119,21 +66,10 @@ export declare function initWalletConnect(projectId: string, metadata?: {
119
66
  *
120
67
  * @example
121
68
  * ```typescript
122
- * // Generate URI for QR code
123
69
  * const uriResult = await generateConnectionUri(wcClient, 'mainnet');
124
- *
125
- * if (!uriResult.success) {
126
- * console.error('Failed to generate URI:', uriResult.error);
127
- * return;
70
+ * if (uriResult.success) {
71
+ * console.log('Scan this QR code:', uriResult.data.uri);
128
72
  * }
129
- *
130
- * const { uri, pairingTopic, approval } = uriResult.data;
131
- *
132
- * // Caller displays QR code however they want:
133
- * // - Terminal: QRCode.generate(uri)
134
- * // - Web: <QRCode value={uri} />
135
- * // - Or just show as text: console.log(uri)
136
- * console.log('Scan this QR code:', uri);
137
73
  * ```
138
74
  */
139
75
  export declare function generateConnectionUri(wcClient: WalletConnectClient, network: AkashNetwork): Promise<Result<ConnectionUriResult, WalletError>>;
@@ -141,7 +77,6 @@ export declare function generateConnectionUri(wcClient: WalletConnectClient, net
141
77
  * Step 3: Wait for user to approve connection
142
78
  *
143
79
  * Polls for wallet approval with configurable timeout.
144
- * Returns immediately when user approves or rejects.
145
80
  *
146
81
  * @param approval - Approval promise from step 2
147
82
  * @param timeoutMs - Maximum wait time in milliseconds (default: 5 minutes)
@@ -149,25 +84,10 @@ export declare function generateConnectionUri(wcClient: WalletConnectClient, net
149
84
  *
150
85
  * @example
151
86
  * ```typescript
152
- * // Wait for user to scan QR and approve
153
- * console.log('Waiting for approval...');
154
- *
155
- * const approvalResult = await waitForApproval(
156
- * approval,
157
- * 60000 // 60 second timeout
158
- * );
159
- *
160
- * if (!approvalResult.success) {
161
- * if (approvalResult.error.code === 'APPROVAL_TIMEOUT') {
162
- * console.log('User did not approve in time');
163
- * } else if (approvalResult.error.code === 'APPROVAL_REJECTED') {
164
- * console.log('User rejected connection');
165
- * }
166
- * return;
87
+ * const approvalResult = await waitForApproval(approval, 60000);
88
+ * if (approvalResult.success) {
89
+ * console.log(`Connected to ${approvalResult.data.address}`);
167
90
  * }
168
- *
169
- * const { session, address } = approvalResult.data;
170
- * console.log(`Connected to ${address}!`);
171
91
  * ```
172
92
  */
173
93
  export declare function waitForApproval(approval: () => Promise<SessionTypes.Struct>, timeoutMs?: number): Promise<Result<ApprovalResult, WalletError>>;
@@ -175,7 +95,6 @@ export declare function waitForApproval(approval: () => Promise<SessionTypes.Str
175
95
  * Step 4: Create complete wallet context for Akash operations
176
96
  *
177
97
  * Finalizes the connection by creating signers and querying account data.
178
- * Returns a ready-to-use WalletContext for all Akash operations.
179
98
  *
180
99
  * @param wcClient - WalletConnect client from step 1
181
100
  * @param approvalResult - Approval result from step 3
@@ -184,143 +103,50 @@ export declare function waitForApproval(approval: () => Promise<SessionTypes.Str
184
103
  *
185
104
  * @example
186
105
  * ```typescript
187
- * // Create final wallet context
188
- * const walletResult = await createWalletContext(
189
- * wcClient,
190
- * approvalResult.data,
191
- * 'mainnet'
192
- * );
193
- *
194
- * if (!walletResult.success) {
195
- * console.error('Failed to create wallet:', walletResult.error);
196
- * return;
106
+ * const walletResult = await createWalletContext(wcClient, approvalResult.data, 'mainnet');
107
+ * if (walletResult.success) {
108
+ * console.log('Wallet ready:', walletResult.data.address);
197
109
  * }
198
- *
199
- * const wallet = walletResult.data;
200
- * console.log('Wallet ready!');
201
- * console.log('Address:', wallet.address);
202
- * console.log('Chain:', wallet.chainId);
203
- *
204
- * // Now ready for Akash operations
205
- * const deployment = await deployToAkash({ wallet, ... });
206
110
  * ```
207
111
  */
208
112
  export declare function createWalletContext(wcClient: WalletConnectClient, approvalResult: ApprovalResult, network: AkashNetwork): Promise<Result<WalletContext, WalletError>>;
209
113
  /**
210
114
  * Create wallet context from any offline signer
211
115
  *
212
- * Use this for **automated deployments** where you have direct access to a signer
213
- * (e.g., agent wallet, CI/CD, hardware wallet, KMS) instead of interactive wallet
214
- * connection via browser or WalletConnect.
215
- *
216
- * **Security Model:**
217
- * This function accepts a **signer interface**, NOT a private key or mnemonic!
218
- * The signer can sign transactions without exposing the underlying key.
219
- *
220
- * **Common Use Cases:**
221
- * - Self-deploying agents (signer from encrypted storage)
222
- * - CI/CD pipelines (signer from secrets manager)
223
- * - Hardware wallets (Ledger - key never leaves device)
224
- * - Cloud KMS (AWS/GCP - key stays in cloud)
225
- * - Multi-signature wallets (threshold signing)
116
+ * Use this for automated deployments where you have direct access to a signer (e.g., agent wallet,
117
+ * CI/CD, hardware wallet, KMS). The signer can sign transactions without exposing the underlying key.
226
118
  *
227
119
  * @param signer - Any offline signer (must implement OfflineAminoSigner & OfflineDirectSigner)
228
120
  * @param network - Akash network to connect to
229
121
  * @returns Result with wallet context ready for deployments
230
122
  *
231
- * @example Agent with encrypted wallet
123
+ * @example
232
124
  * ```typescript
233
- * import { DirectSecp256k1Wallet } from '@cosmjs/proto-signing';
234
- * import { createWalletContextFromSigner } from '@kadi.build/deploy-ability/akash';
235
- *
236
- * // Agent loads signer from secure storage (mnemonic never exposed to caller)
237
125
  * const agentSigner = await myAgent.wallet.getSigner();
238
- *
239
- * // Create wallet context
240
126
  * const walletCtx = await createWalletContextFromSigner(agentSigner, 'mainnet');
241
- *
242
127
  * if (walletCtx.success) {
243
- * // Ready to deploy - signer will handle signing internally
244
- * await deployToAkash({
245
- * wallet: walletCtx.data,
246
- * certificate: cert,
247
- * projectRoot: './',
248
- * profile: 'prod'
249
- * });
250
- * }
251
- * ```
252
- *
253
- * @example CI/CD with secrets manager
254
- * ```typescript
255
- * // Load signer from AWS Secrets Manager / GitHub Secrets
256
- * const mnemonic = await loadFromSecretsManager('deploy-wallet-key');
257
- * const signer = await DirectSecp256k1Wallet.fromMnemonic(mnemonic, {
258
- * prefix: 'akash'
259
- * });
260
- *
261
- * const walletCtx = await createWalletContextFromSigner(signer, 'testnet');
262
- * // Now deploy without any user interaction
263
- * ```
264
- *
265
- * @example Hardware wallet (Ledger)
266
- * ```typescript
267
- * import Ledger from '@cosmjs/ledger-amino';
268
- *
269
- * // Connect to Ledger - key never leaves device
270
- * const transport = await TransportWebUSB.create();
271
- * const ledgerSigner = new Ledger(transport, {
272
- * hdPaths: [makeCosmoshubPath(0)],
273
- * prefix: 'akash'
274
- * });
275
- *
276
- * const walletCtx = await createWalletContextFromSigner(ledgerSigner, 'mainnet');
277
- * // Ledger will prompt for approval when signing
278
- * ```
279
- *
280
- * @example Cloud KMS
281
- * ```typescript
282
- * // Custom signer using AWS KMS / GCP KMS
283
- * class KmsSigner implements OfflineSigner {
284
- * constructor(private keyId: string) {}
285
- *
286
- * async signDirect(address: string, signDoc: SignDoc) {
287
- * // Sign using KMS - key never leaves cloud
288
- * return await kms.sign(this.keyId, signDoc);
289
- * }
128
+ * await deployToAkash({ wallet: walletCtx.data, ... });
290
129
  * }
291
- *
292
- * const kmsSigner = new KmsSigner('arn:aws:kms:...');
293
- * const walletCtx = await createWalletContextFromSigner(kmsSigner, 'mainnet');
294
130
  * ```
295
131
  */
296
132
  export declare function createWalletContextFromSigner(signer: WalletContext['signer'], network: AkashNetwork): Promise<Result<WalletContext, WalletError>>;
297
133
  /**
298
134
  * Disconnect an active WalletConnect session
299
135
  *
300
- * Cleanly disconnects from the wallet, clearing the session and cleaning up
301
- * all internal resources (relay transport, heartbeat, event listeners).
302
- *
303
- * This ensures the Node.js event loop can exit by releasing all timers and
304
- * connections. Without this cleanup, the WalletConnect client keeps the
305
- * process alive indefinitely.
136
+ * Cleanly disconnects from the wallet and cleans up all internal resources. Always call this
137
+ * when done with wallet operations to allow Node.js event loop to exit.
306
138
  *
307
- * Always call this when done with wallet operations to prevent hanging.
308
- *
309
- * Note: This only applies to WalletConnect sessions. Wallets created
310
- * with `createWalletContextFromSigner()` don't need disconnection.
139
+ * Note: This only applies to WalletConnect sessions. Wallets created with
140
+ * createWalletContextFromSigner() don't need disconnection.
311
141
  *
312
142
  * @param wallet - Wallet context to disconnect
313
143
  * @returns Result indicating success or error
314
144
  *
315
145
  * @example
316
146
  * ```typescript
317
- * // Disconnect when done
318
147
  * const result = await disconnectWallet(wallet);
319
- *
320
148
  * if (result.success) {
321
149
  * console.log('Wallet disconnected');
322
- * } else {
323
- * console.warn('Disconnect failed:', result.error);
324
150
  * }
325
151
  * ```
326
152
  */
@@ -329,7 +155,6 @@ export declare function disconnectWallet(wallet: WalletContext): Promise<Result<
329
155
  * Complete wallet connection flow (convenience function)
330
156
  *
331
157
  * Combines all 4 steps into a single function for simple use cases.
332
- * For more control, use the individual step functions.
333
158
  *
334
159
  * @param projectId - WalletConnect project ID
335
160
  * @param network - Akash network to connect to
@@ -338,27 +163,13 @@ export declare function disconnectWallet(wallet: WalletContext): Promise<Result<
338
163
  *
339
164
  * @example
340
165
  * ```typescript
341
- * // Simple one-call connection
342
- * const walletResult = await connectWallet(
343
- * 'your-project-id',
344
- * 'mainnet',
345
- * {
346
- * onUriGenerated: (uri) => {
347
- * // Display QR code
348
- * QRCode.generate(uri);
349
- * console.log('Scan QR code with Keplr');
350
- * },
351
- * timeoutMs: 60000
352
- * }
353
- * );
354
- *
355
- * if (!walletResult.success) {
356
- * console.error('Connection failed:', walletResult.error);
357
- * return;
166
+ * const walletResult = await connectWallet('your-project-id', 'mainnet', {
167
+ * onUriGenerated: (uri) => console.log('Scan QR code:', uri),
168
+ * timeoutMs: 60000
169
+ * });
170
+ * if (walletResult.success) {
171
+ * console.log('Connected to:', walletResult.data.address);
358
172
  * }
359
- *
360
- * const wallet = walletResult.data;
361
- * console.log('Connected to:', wallet.address);
362
173
  * ```
363
174
  */
364
175
  export declare function connectWallet(projectId: string, network: AkashNetwork, options?: {
@@ -377,150 +188,22 @@ export declare function connectWallet(projectId: string, network: AkashNetwork,
377
188
  /**
378
189
  * Create wallet context from mnemonic (for agent-controlled wallets)
379
190
  *
380
- * ⚠️ **CRITICAL SECURITY WARNING** ⚠️
381
- *
382
- * This function is ONLY for scenarios where YOU control the mnemonic:
383
- * - ✅ Your own automation (CI/CD, personal scripts)
384
- * - ✅ Your own agent (running on infrastructure you control)
385
- * - ✅ Custodial services YOU operate (creating wallets for your users)
386
- *
387
- * **NEVER use this if:**
388
- * - ❌ Someone else's agent asks for your mnemonic
389
- * - ❌ Third-party service requests your mnemonic
390
- * - ❌ You don't fully control where the mnemonic is stored/used
391
- *
392
- * **For third-party agents/services:**
393
- * Use `connectWallet()` with WalletConnect instead! This lets you approve
394
- * transactions on YOUR device without exposing your mnemonic.
395
- *
396
- * **Security Model:**
397
- * ```
398
- * ┌─────────────────────────────────────────────────────────────┐
399
- * │ WHO CONTROLS THE AGENT? │
400
- * ├─────────────────────────────────────────────────────────────┤
401
- * │ │
402
- * │ YOU control it: │
403
- * │ ✅ createWalletFromMnemonic() - You trust your own code │
404
- * │ │
405
- * │ SOMEONE ELSE controls it: │
406
- * │ ✅ connectWallet() - WalletConnect for approval │
407
- * │ ❌ createWalletFromMnemonic() - NEVER share mnemonic! │
408
- * │ │
409
- * └─────────────────────────────────────────────────────────────┘
410
- * ```
191
+ * **SECURITY WARNING:** Only use this for automation YOU control (CI/CD, your own agents).
192
+ * For third-party services, use connectWallet() with WalletConnect instead to avoid
193
+ * exposing your mnemonic.
411
194
  *
412
- * **Common Use Cases:**
195
+ * @param mnemonic - BIP39 mnemonic phrase (12 or 24 words)
196
+ * @param network - Akash network to connect to
197
+ * @returns Result with wallet context or error
413
198
  *
414
- * @example 1. Your own CI/CD pipeline
199
+ * @example
415
200
  * ```typescript
416
- * // Mnemonic stored in GitHub Secrets / GitLab CI Variables
417
201
  * const mnemonic = process.env.DEPLOYMENT_WALLET_MNEMONIC!;
418
202
  * const wallet = await createWalletFromMnemonic(mnemonic, 'mainnet');
419
- *
420
203
  * if (wallet.success) {
421
- * // Automated deployment from CI/CD
422
- * await deployToAkash({
423
- * wallet: wallet.data,
424
- * projectRoot: './',
425
- * profile: 'production'
426
- * });
427
- * }
428
- * ```
429
- *
430
- * @example 2. Your own agent with encrypted storage
431
- * ```typescript
432
- * // Agent loads its OWN mnemonic (not user's!)
433
- * class DeploymentAgent {
434
- * async deploy(projectConfig: Config) {
435
- * // Agent uses its own wallet to pay for deployments
436
- * const mnemonic = await this.secrets.getEncryptedMnemonic();
437
- * const wallet = await createWalletFromMnemonic(mnemonic, 'mainnet');
438
- *
439
- * if (wallet.success) {
440
- * // Agent deploys using its own funds
441
- * return deployToAkash({
442
- * wallet: wallet.data,
443
- * ...projectConfig
444
- * });
445
- * }
446
- * }
204
+ * await deployToAkash({ wallet: wallet.data, ... });
447
205
  * }
448
206
  * ```
449
- *
450
- * @example 3. Custodial wallet service (you operate the service)
451
- * ```typescript
452
- * // Service creates and manages wallets FOR users
453
- * class CustodialWalletService {
454
- * async createUserWallet(userId: string) {
455
- * // Generate new wallet for user
456
- * const { DirectSecp256k1HdWallet } = await import('@cosmjs/proto-signing');
457
- * const newWallet = await DirectSecp256k1HdWallet.generate(24);
458
- * const mnemonic = newWallet.mnemonic;
459
- *
460
- * // Store encrypted mnemonic in your secure database
461
- * await this.db.storeEncryptedMnemonic(userId, mnemonic);
462
- *
463
- * return { userId, address: (await newWallet.getAccounts())[0].address };
464
- * }
465
- *
466
- * async deployForUser(userId: string, projectConfig: Config) {
467
- * // Load user's mnemonic from secure storage
468
- * const mnemonic = await this.db.getDecryptedMnemonic(userId);
469
- * const wallet = await createWalletFromMnemonic(mnemonic, 'mainnet');
470
- *
471
- * if (wallet.success) {
472
- * // Deploy on user's behalf
473
- * return deployToAkash({
474
- * wallet: wallet.data,
475
- * ...projectConfig
476
- * });
477
- * }
478
- * }
479
- * }
480
- * ```
481
- *
482
- * @example 4. WRONG - Never do this!
483
- * ```typescript
484
- * // ❌ DANGEROUS - Third-party agent asking for your mnemonic!
485
- * const thirdPartyAgent = new SomeoneElsesAgent();
486
- *
487
- * // ❌ DO NOT DO THIS!
488
- * await thirdPartyAgent.deploy({
489
- * mnemonic: myMnemonic, // ❌ Now they can steal all your funds!
490
- * project: './my-app'
491
- * });
492
- *
493
- * // ✅ DO THIS INSTEAD - Use WalletConnect!
494
- * const wallet = await connectWallet(projectId, 'mainnet', {
495
- * onUriGenerated: (uri) => {
496
- * console.log('Scan QR code to approve');
497
- * // You approve on YOUR device, agent never gets mnemonic
498
- * }
499
- * });
500
- * await thirdPartyAgent.deploy({ wallet: wallet.data, ... });
501
- * ```
502
- *
503
- * **Implementation Notes for Future:**
504
- *
505
- * This function should:
506
- * 1. Import DirectSecp256k1HdWallet from @cosmjs/proto-signing
507
- * 2. Create signer with proper network prefix:
508
- * - mainnet/testnet → 'akash'
509
- * - sandbox → 'akash'
510
- * 3. Call createWalletContextFromSigner() with the signer
511
- * 4. Return Result<WalletContext, WalletError>
512
- *
513
- * Dependencies needed:
514
- * - @cosmjs/proto-signing (DirectSecp256k1HdWallet)
515
- *
516
- * Error handling:
517
- * - Invalid mnemonic format
518
- * - Network configuration issues
519
- * - Account fetch failures
520
- *
521
- * @param mnemonic - BIP39 mnemonic phrase (12 or 24 words)
522
- * @param network - Akash network to connect to
523
- * @returns Result with wallet context or error
524
207
  */
525
208
  export declare function createWalletFromMnemonic(_mnemonic: string, network: AkashNetwork): Promise<Result<WalletContext, WalletError>>;
526
209
  //# sourceMappingURL=wallet-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-manager.d.ts","sourceRoot":"","sources":["../../../src/targets/akash/wallet-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAoB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEvE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;IAEjD,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;KACnC,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,WAAW,mBA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