@kadi.build/deploy-ability 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +523 -0
- package/dist/constants.d.ts +82 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +82 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors/certificate-error.d.ts +95 -0
- package/dist/errors/certificate-error.d.ts.map +1 -0
- package/dist/errors/certificate-error.js +111 -0
- package/dist/errors/certificate-error.js.map +1 -0
- package/dist/errors/deployment-error.d.ts +122 -0
- package/dist/errors/deployment-error.d.ts.map +1 -0
- package/dist/errors/deployment-error.js +185 -0
- package/dist/errors/deployment-error.js.map +1 -0
- package/dist/errors/index.d.ts +13 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +18 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/profile-error.d.ts +106 -0
- package/dist/errors/profile-error.d.ts.map +1 -0
- package/dist/errors/profile-error.js +127 -0
- package/dist/errors/profile-error.js.map +1 -0
- package/dist/errors/provider-error.d.ts +104 -0
- package/dist/errors/provider-error.d.ts.map +1 -0
- package/dist/errors/provider-error.js +120 -0
- package/dist/errors/provider-error.js.map +1 -0
- package/dist/errors/wallet-error.d.ts +131 -0
- package/dist/errors/wallet-error.d.ts.map +1 -0
- package/dist/errors/wallet-error.js +154 -0
- package/dist/errors/wallet-error.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/targets/akash/bid-selectors.d.ts +251 -0
- package/dist/targets/akash/bid-selectors.d.ts.map +1 -0
- package/dist/targets/akash/bid-selectors.js +322 -0
- package/dist/targets/akash/bid-selectors.js.map +1 -0
- package/dist/targets/akash/bid-types.d.ts +297 -0
- package/dist/targets/akash/bid-types.d.ts.map +1 -0
- package/dist/targets/akash/bid-types.js +89 -0
- package/dist/targets/akash/bid-types.js.map +1 -0
- package/dist/targets/akash/blockchain-client.d.ts +577 -0
- package/dist/targets/akash/blockchain-client.d.ts.map +1 -0
- package/dist/targets/akash/blockchain-client.js +803 -0
- package/dist/targets/akash/blockchain-client.js.map +1 -0
- package/dist/targets/akash/certificate-manager.d.ts +228 -0
- package/dist/targets/akash/certificate-manager.d.ts.map +1 -0
- package/dist/targets/akash/certificate-manager.js +395 -0
- package/dist/targets/akash/certificate-manager.js.map +1 -0
- package/dist/targets/akash/constants.d.ts +231 -0
- package/dist/targets/akash/constants.d.ts.map +1 -0
- package/dist/targets/akash/constants.js +225 -0
- package/dist/targets/akash/constants.js.map +1 -0
- package/dist/targets/akash/deployer.d.ts +136 -0
- package/dist/targets/akash/deployer.d.ts.map +1 -0
- package/dist/targets/akash/deployer.js +599 -0
- package/dist/targets/akash/deployer.js.map +1 -0
- package/dist/targets/akash/environment.d.ts +241 -0
- package/dist/targets/akash/environment.d.ts.map +1 -0
- package/dist/targets/akash/environment.js +245 -0
- package/dist/targets/akash/environment.js.map +1 -0
- package/dist/targets/akash/index.d.ts +1113 -0
- package/dist/targets/akash/index.d.ts.map +1 -0
- package/dist/targets/akash/index.js +909 -0
- package/dist/targets/akash/index.js.map +1 -0
- package/dist/targets/akash/lease-monitor.d.ts +51 -0
- package/dist/targets/akash/lease-monitor.d.ts.map +1 -0
- package/dist/targets/akash/lease-monitor.js +110 -0
- package/dist/targets/akash/lease-monitor.js.map +1 -0
- package/dist/targets/akash/logs.d.ts +71 -0
- package/dist/targets/akash/logs.d.ts.map +1 -0
- package/dist/targets/akash/logs.js +311 -0
- package/dist/targets/akash/logs.js.map +1 -0
- package/dist/targets/akash/logs.types.d.ts +102 -0
- package/dist/targets/akash/logs.types.d.ts.map +1 -0
- package/dist/targets/akash/logs.types.js +9 -0
- package/dist/targets/akash/logs.types.js.map +1 -0
- package/dist/targets/akash/pricing.d.ts +247 -0
- package/dist/targets/akash/pricing.d.ts.map +1 -0
- package/dist/targets/akash/pricing.js +246 -0
- package/dist/targets/akash/pricing.js.map +1 -0
- package/dist/targets/akash/provider-client.d.ts +114 -0
- package/dist/targets/akash/provider-client.d.ts.map +1 -0
- package/dist/targets/akash/provider-client.js +318 -0
- package/dist/targets/akash/provider-client.js.map +1 -0
- package/dist/targets/akash/provider-metadata.d.ts +228 -0
- package/dist/targets/akash/provider-metadata.d.ts.map +1 -0
- package/dist/targets/akash/provider-metadata.js +14 -0
- package/dist/targets/akash/provider-metadata.js.map +1 -0
- package/dist/targets/akash/provider-service.d.ts +133 -0
- package/dist/targets/akash/provider-service.d.ts.map +1 -0
- package/dist/targets/akash/provider-service.js +391 -0
- package/dist/targets/akash/provider-service.js.map +1 -0
- package/dist/targets/akash/query-client.d.ts +125 -0
- package/dist/targets/akash/query-client.d.ts.map +1 -0
- package/dist/targets/akash/query-client.js +332 -0
- package/dist/targets/akash/query-client.js.map +1 -0
- package/dist/targets/akash/sdl-generator.d.ts +31 -0
- package/dist/targets/akash/sdl-generator.d.ts.map +1 -0
- package/dist/targets/akash/sdl-generator.js +279 -0
- package/dist/targets/akash/sdl-generator.js.map +1 -0
- package/dist/targets/akash/types.d.ts +285 -0
- package/dist/targets/akash/types.d.ts.map +1 -0
- package/dist/targets/akash/types.js +54 -0
- package/dist/targets/akash/types.js.map +1 -0
- package/dist/targets/akash/wallet-manager.d.ts +526 -0
- package/dist/targets/akash/wallet-manager.d.ts.map +1 -0
- package/dist/targets/akash/wallet-manager.js +953 -0
- package/dist/targets/akash/wallet-manager.js.map +1 -0
- package/dist/targets/local/compose-generator.d.ts +244 -0
- package/dist/targets/local/compose-generator.d.ts.map +1 -0
- package/dist/targets/local/compose-generator.js +324 -0
- package/dist/targets/local/compose-generator.js.map +1 -0
- package/dist/targets/local/deployer.d.ts +82 -0
- package/dist/targets/local/deployer.d.ts.map +1 -0
- package/dist/targets/local/deployer.js +367 -0
- package/dist/targets/local/deployer.js.map +1 -0
- package/dist/targets/local/engine-manager.d.ts +155 -0
- package/dist/targets/local/engine-manager.d.ts.map +1 -0
- package/dist/targets/local/engine-manager.js +250 -0
- package/dist/targets/local/engine-manager.js.map +1 -0
- package/dist/targets/local/index.d.ts +40 -0
- package/dist/targets/local/index.d.ts.map +1 -0
- package/dist/targets/local/index.js +43 -0
- package/dist/targets/local/index.js.map +1 -0
- package/dist/targets/local/network-manager.d.ts +160 -0
- package/dist/targets/local/network-manager.d.ts.map +1 -0
- package/dist/targets/local/network-manager.js +337 -0
- package/dist/targets/local/network-manager.js.map +1 -0
- package/dist/targets/local/types.d.ts +327 -0
- package/dist/targets/local/types.d.ts.map +1 -0
- package/dist/targets/local/types.js +9 -0
- package/dist/targets/local/types.js.map +1 -0
- package/dist/types/common.d.ts +585 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +13 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/options.d.ts +329 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/options.js +10 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/profiles.d.ts +329 -0
- package/dist/types/profiles.d.ts.map +1 -0
- package/dist/types/profiles.js +27 -0
- package/dist/types/profiles.js.map +1 -0
- package/dist/types/results.d.ts +443 -0
- package/dist/types/results.d.ts.map +1 -0
- package/dist/types/results.js +64 -0
- package/dist/types/results.js.map +1 -0
- package/dist/types/validators.d.ts +118 -0
- package/dist/types/validators.d.ts.map +1 -0
- package/dist/types/validators.js +198 -0
- package/dist/types/validators.js.map +1 -0
- package/dist/utils/command-runner.d.ts +128 -0
- package/dist/utils/command-runner.d.ts.map +1 -0
- package/dist/utils/command-runner.js +210 -0
- package/dist/utils/command-runner.js.map +1 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +68 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +93 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/profile-loader.d.ts +76 -0
- package/dist/utils/profile-loader.d.ts.map +1 -0
- package/dist/utils/profile-loader.js +194 -0
- package/dist/utils/profile-loader.js.map +1 -0
- package/dist/utils/registry/index.d.ts +27 -0
- package/dist/utils/registry/index.d.ts.map +1 -0
- package/dist/utils/registry/index.js +29 -0
- package/dist/utils/registry/index.js.map +1 -0
- package/dist/utils/registry/manager.d.ts +319 -0
- package/dist/utils/registry/manager.d.ts.map +1 -0
- package/dist/utils/registry/manager.js +671 -0
- package/dist/utils/registry/manager.js.map +1 -0
- package/dist/utils/registry/setup.d.ts +135 -0
- package/dist/utils/registry/setup.d.ts.map +1 -0
- package/dist/utils/registry/setup.js +207 -0
- package/dist/utils/registry/setup.js.map +1 -0
- package/dist/utils/registry/transformer.d.ts +92 -0
- package/dist/utils/registry/transformer.d.ts.map +1 -0
- package/dist/utils/registry/transformer.js +131 -0
- package/dist/utils/registry/transformer.js.map +1 -0
- package/dist/utils/registry/types.d.ts +241 -0
- package/dist/utils/registry/types.d.ts.map +1 -0
- package/dist/utils/registry/types.js +10 -0
- package/dist/utils/registry/types.js.map +1 -0
- package/docs/EXAMPLES.md +293 -0
- package/docs/PLACEMENT.md +433 -0
- package/docs/STORAGE.md +318 -0
- package/docs/building-provider-reliability-tracker.md +2581 -0
- package/package.json +109 -0
|
@@ -0,0 +1,909 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Akash Network Deployment SDK
|
|
3
|
+
*
|
|
4
|
+
* A delightful API for deploying to Akash Network with excellent TypeScript support.
|
|
5
|
+
*
|
|
6
|
+
* This module provides a clean, organized public API for all Akash deployment operations.
|
|
7
|
+
* Functions are grouped by responsibility for easy discovery and intuitive usage.
|
|
8
|
+
*
|
|
9
|
+
* @example Quick Start - Simple Deployment
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { deployToAkash, connectWallet, ensureCertificate, createSigningClient } from '@deploy-ability/akash';
|
|
12
|
+
*
|
|
13
|
+
* // 1. Connect wallet
|
|
14
|
+
* const walletResult = await connectWallet({ network: 'mainnet' });
|
|
15
|
+
* if (!walletResult.success) throw walletResult.error;
|
|
16
|
+
*
|
|
17
|
+
* // 2. Create signing client
|
|
18
|
+
* const clientResult = await createSigningClient(walletResult.data, 'mainnet');
|
|
19
|
+
* if (!clientResult.success) throw clientResult.error;
|
|
20
|
+
*
|
|
21
|
+
* // 3. Ensure certificate exists
|
|
22
|
+
* const certResult = await ensureCertificate(
|
|
23
|
+
* walletResult.data,
|
|
24
|
+
* 'mainnet',
|
|
25
|
+
* clientResult.data.client
|
|
26
|
+
* );
|
|
27
|
+
* if (!certResult.success) throw certResult.error;
|
|
28
|
+
*
|
|
29
|
+
* // 4. Deploy!
|
|
30
|
+
* const result = await deployToAkash({
|
|
31
|
+
* wallet: walletResult.data,
|
|
32
|
+
* certificate: certResult.data,
|
|
33
|
+
* projectRoot: './my-app',
|
|
34
|
+
* profile: 'production',
|
|
35
|
+
* network: 'mainnet'
|
|
36
|
+
* });
|
|
37
|
+
*
|
|
38
|
+
* if (result.success) {
|
|
39
|
+
* console.log(`🚀 Deployed! DSEQ: ${result.data.dseq}`);
|
|
40
|
+
* console.log(`🌐 Endpoints:`, result.data.endpoints);
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Advanced - Custom Bid Selection
|
|
45
|
+
* ```typescript
|
|
46
|
+
* import { createDeployment, queryBids, createLease } from '@deploy-ability/akash';
|
|
47
|
+
*
|
|
48
|
+
* // Create deployment
|
|
49
|
+
* const deployment = await createDeployment(clientContext, wallet, sdl, 5);
|
|
50
|
+
* if (!deployment.success) throw deployment.error;
|
|
51
|
+
*
|
|
52
|
+
* // Get bids
|
|
53
|
+
* const bids = await queryBids(wallet, 'mainnet', deployment.data.dseq);
|
|
54
|
+
* if (!bids.success) throw bids.error;
|
|
55
|
+
*
|
|
56
|
+
* // Filter for cheapest GPU bid under budget
|
|
57
|
+
* const affordableBids = bids.data.filter(bid =>
|
|
58
|
+
* parseInt(bid.price?.amount ?? '0') < 1000 // uakt per block
|
|
59
|
+
* );
|
|
60
|
+
*
|
|
61
|
+
* if (affordableBids.length === 0) {
|
|
62
|
+
* throw new Error('No affordable bids found');
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* // Create lease with selected bid
|
|
66
|
+
* const lease = await createLease(clientContext, affordableBids[0]);
|
|
67
|
+
* if (!lease.success) throw lease.error;
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example Expert - Full Control with Primitives
|
|
71
|
+
* ```typescript
|
|
72
|
+
* import * as akash from '@deploy-ability/akash';
|
|
73
|
+
*
|
|
74
|
+
* // Full access to all primitives for custom workflows
|
|
75
|
+
* const wallet = await akash.connectWallet({ network: 'mainnet' });
|
|
76
|
+
* const cert = await akash.generateCertificate(wallet.data.address);
|
|
77
|
+
* const sdl = akash.createSdlObject(profile);
|
|
78
|
+
* // ... compose your own deployment flow with complete control
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @module akash
|
|
82
|
+
*/
|
|
83
|
+
// ========================================
|
|
84
|
+
// 🚀 High-Level Deployment API
|
|
85
|
+
// ========================================
|
|
86
|
+
/**
|
|
87
|
+
* Main deployment orchestration function
|
|
88
|
+
*
|
|
89
|
+
* Handles the complete deployment workflow:
|
|
90
|
+
* - Profile loading and SDL generation
|
|
91
|
+
* - Deployment creation on blockchain
|
|
92
|
+
* - Provider bid collection
|
|
93
|
+
* - Lease creation
|
|
94
|
+
* - Manifest delivery
|
|
95
|
+
* - Optional container readiness monitoring
|
|
96
|
+
*/
|
|
97
|
+
export { deployToAkash } from './deployer.js';
|
|
98
|
+
// ========================================
|
|
99
|
+
// 👛 Wallet Management
|
|
100
|
+
// ========================================
|
|
101
|
+
/**
|
|
102
|
+
* Connect wallet (Keplr browser extension or WalletConnect)
|
|
103
|
+
*
|
|
104
|
+
* Primary wallet connection method. Automatically detects and uses Keplr
|
|
105
|
+
* if available, otherwise falls back to WalletConnect if project ID provided.
|
|
106
|
+
*
|
|
107
|
+
* @example Connect with Keplr
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const result = await connectWallet({ network: 'mainnet' });
|
|
110
|
+
* if (result.success) {
|
|
111
|
+
* console.log('Connected:', result.data.address);
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @example Connect with WalletConnect
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const result = await connectWallet({
|
|
118
|
+
* network: 'mainnet',
|
|
119
|
+
* walletConnectProjectId: 'your-project-id'
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export { connectWallet } from './wallet-manager.js';
|
|
124
|
+
/**
|
|
125
|
+
* Initialize WalletConnect client
|
|
126
|
+
*
|
|
127
|
+
* Lower-level function for manual WalletConnect setup.
|
|
128
|
+
* Use connectWallet() for most cases.
|
|
129
|
+
*/
|
|
130
|
+
export { initWalletConnect } from './wallet-manager.js';
|
|
131
|
+
/**
|
|
132
|
+
* Generate WalletConnect connection URI
|
|
133
|
+
*
|
|
134
|
+
* Creates connection URI for QR code display.
|
|
135
|
+
*/
|
|
136
|
+
export { generateConnectionUri } from './wallet-manager.js';
|
|
137
|
+
/**
|
|
138
|
+
* Wait for WalletConnect approval
|
|
139
|
+
*
|
|
140
|
+
* Polls for user approval from mobile wallet.
|
|
141
|
+
*/
|
|
142
|
+
export { waitForApproval } from './wallet-manager.js';
|
|
143
|
+
/**
|
|
144
|
+
* Create wallet context from signer
|
|
145
|
+
*
|
|
146
|
+
* Converts offline signer into full wallet context with account info.
|
|
147
|
+
*/
|
|
148
|
+
export { createWalletContext } from './wallet-manager.js';
|
|
149
|
+
/**
|
|
150
|
+
* Create wallet context from signer (for automated deployments)
|
|
151
|
+
*
|
|
152
|
+
* Use this for **automated deployments** where you have direct access to a signer
|
|
153
|
+
* instead of interactive wallet connection. Perfect for agents, CI/CD, hardware
|
|
154
|
+
* wallets, or KMS - accepts signer interface without requiring mnemonic exposure.
|
|
155
|
+
*
|
|
156
|
+
* **Security Model**: Signers can sign transactions without exposing private keys!
|
|
157
|
+
*
|
|
158
|
+
* @example Agent with encrypted wallet
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const agentSigner = await myAgent.wallet.getSigner();
|
|
161
|
+
* const walletCtx = await createWalletContextFromSigner(agentSigner, 'mainnet');
|
|
162
|
+
*
|
|
163
|
+
* if (walletCtx.success) {
|
|
164
|
+
* await deployToAkash({
|
|
165
|
+
* wallet: walletCtx.data,
|
|
166
|
+
* certificate: cert,
|
|
167
|
+
* projectRoot: './',
|
|
168
|
+
* profile: 'prod'
|
|
169
|
+
* });
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @example CI/CD with secrets manager
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const signer = await loadSignerFromSecretsManager();
|
|
176
|
+
* const walletCtx = await createWalletContextFromSigner(signer, 'mainnet');
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
export { createWalletContextFromSigner } from './wallet-manager.js';
|
|
180
|
+
/**
|
|
181
|
+
* Create wallet context from mnemonic (for agent-controlled wallets)
|
|
182
|
+
*
|
|
183
|
+
* ⚠️ **SECURITY WARNING**: Only use this for wallets YOU control!
|
|
184
|
+
*
|
|
185
|
+
* Use this for:
|
|
186
|
+
* - ✅ Your own CI/CD automation
|
|
187
|
+
* - ✅ Your own agents (running on your infrastructure)
|
|
188
|
+
* - ✅ Custodial services you operate
|
|
189
|
+
*
|
|
190
|
+
* **NEVER** give your mnemonic to third-party agents!
|
|
191
|
+
* For third-party services, use `connectWallet()` with WalletConnect instead.
|
|
192
|
+
*
|
|
193
|
+
* @example CI/CD deployment
|
|
194
|
+
* ```typescript
|
|
195
|
+
* // Mnemonic from GitHub Secrets
|
|
196
|
+
* const mnemonic = process.env.DEPLOYMENT_WALLET_MNEMONIC!;
|
|
197
|
+
* const wallet = await createWalletFromMnemonic(mnemonic, 'mainnet');
|
|
198
|
+
*
|
|
199
|
+
* if (wallet.success) {
|
|
200
|
+
* await deployToAkash({ wallet: wallet.data, ... });
|
|
201
|
+
* }
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* **Note**: This function is not yet fully implemented - see function documentation
|
|
205
|
+
* for complete implementation plan and security considerations.
|
|
206
|
+
*/
|
|
207
|
+
export { createWalletFromMnemonic } from './wallet-manager.js';
|
|
208
|
+
/**
|
|
209
|
+
* Disconnect wallet
|
|
210
|
+
*
|
|
211
|
+
* Safely disconnects wallet and cleans up WalletConnect sessions if applicable.
|
|
212
|
+
*/
|
|
213
|
+
export { disconnectWallet } from './wallet-manager.js';
|
|
214
|
+
// ========================================
|
|
215
|
+
// 📜 Certificate Management
|
|
216
|
+
// ========================================
|
|
217
|
+
/**
|
|
218
|
+
* Generate a new Akash certificate
|
|
219
|
+
*
|
|
220
|
+
* Creates fresh X.509 certificate for mTLS authentication with providers.
|
|
221
|
+
* Certificate must be broadcast to blockchain before use.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const cert = generateCertificate(wallet.address);
|
|
226
|
+
* if (cert.success) {
|
|
227
|
+
* // Now broadcast to blockchain
|
|
228
|
+
* await broadcastCertificate(wallet, cert.data, client);
|
|
229
|
+
* }
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
export { generateCertificate } from './certificate-manager.js';
|
|
233
|
+
/**
|
|
234
|
+
* Parse and validate certificate from JSON
|
|
235
|
+
*
|
|
236
|
+
* Validates certificate structure and PEM format before use.
|
|
237
|
+
*/
|
|
238
|
+
export { parseCertificate } from './certificate-manager.js';
|
|
239
|
+
/**
|
|
240
|
+
* Broadcast certificate to blockchain
|
|
241
|
+
*
|
|
242
|
+
* Submits certificate transaction, making it available for provider authentication.
|
|
243
|
+
*/
|
|
244
|
+
export { broadcastCertificate } from './certificate-manager.js';
|
|
245
|
+
/**
|
|
246
|
+
* Query certificate from blockchain
|
|
247
|
+
*
|
|
248
|
+
* Checks if valid certificate exists on-chain for wallet address.
|
|
249
|
+
*/
|
|
250
|
+
export { queryCertificate } from './certificate-manager.js';
|
|
251
|
+
/**
|
|
252
|
+
* Ensure certificate exists (convenience)
|
|
253
|
+
*
|
|
254
|
+
* High-level helper that handles complete certificate workflow:
|
|
255
|
+
* - Use existing certificate if provided
|
|
256
|
+
* - Query blockchain for existing certificate
|
|
257
|
+
* - Generate and broadcast new certificate if needed
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```typescript
|
|
261
|
+
* const cert = await ensureCertificate(wallet, 'mainnet', client);
|
|
262
|
+
* // Certificate is guaranteed ready to use
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
export { ensureCertificate } from './certificate-manager.js';
|
|
266
|
+
// ========================================
|
|
267
|
+
// ⛓️ Blockchain Operations
|
|
268
|
+
// ========================================
|
|
269
|
+
/**
|
|
270
|
+
* Create signing client for Akash blockchain
|
|
271
|
+
*
|
|
272
|
+
* Creates SigningStargateClient configured with Akash-specific message types.
|
|
273
|
+
* Required for all blockchain transactions.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* const result = await createSigningClient(wallet, 'mainnet');
|
|
278
|
+
* if (result.success) {
|
|
279
|
+
* const { client, account } = result.data;
|
|
280
|
+
* // Use client for transactions
|
|
281
|
+
* }
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
export { createSigningClient } from './blockchain-client.js';
|
|
285
|
+
/**
|
|
286
|
+
* Create deployment on Akash blockchain
|
|
287
|
+
*
|
|
288
|
+
* Submits deployment transaction with SDL manifest.
|
|
289
|
+
* Returns deployment sequence number (dseq) for tracking.
|
|
290
|
+
*/
|
|
291
|
+
export { createDeployment } from './blockchain-client.js';
|
|
292
|
+
/**
|
|
293
|
+
* Query provider bids for deployment
|
|
294
|
+
*
|
|
295
|
+
* Fetches current bids from providers willing to host your deployment.
|
|
296
|
+
* Supports provider blacklisting.
|
|
297
|
+
*/
|
|
298
|
+
export { queryBids } from './blockchain-client.js';
|
|
299
|
+
/**
|
|
300
|
+
* Wait for provider bids (polling)
|
|
301
|
+
*
|
|
302
|
+
* Continuously polls for bids until timeout.
|
|
303
|
+
* Useful when bids don't appear immediately.
|
|
304
|
+
*/
|
|
305
|
+
export { waitForBids } from './blockchain-client.js';
|
|
306
|
+
/**
|
|
307
|
+
* Create lease with selected provider
|
|
308
|
+
*
|
|
309
|
+
* Accepts provider bid and creates lease on blockchain.
|
|
310
|
+
* After this, you can send manifest to provider.
|
|
311
|
+
*/
|
|
312
|
+
export { createLease } from './blockchain-client.js';
|
|
313
|
+
/**
|
|
314
|
+
* Close/terminate a deployment
|
|
315
|
+
*
|
|
316
|
+
* Closes an active deployment on the blockchain, terminating the lease
|
|
317
|
+
* and stopping all containers on the provider. The provider will release
|
|
318
|
+
* resources and stop billing.
|
|
319
|
+
*
|
|
320
|
+
* **Important Notes:**
|
|
321
|
+
* - Closing a deployment is permanent and cannot be undone
|
|
322
|
+
* - You'll lose access to all data in ephemeral storage
|
|
323
|
+
* - Persistent storage may be retained by provider for a limited time
|
|
324
|
+
* - You can redeploy using the same SDL if needed
|
|
325
|
+
*
|
|
326
|
+
* **When to Use:**
|
|
327
|
+
* - Gracefully shut down deployments you no longer need
|
|
328
|
+
* - Stop billing for inactive services
|
|
329
|
+
* - Clean up test/development deployments
|
|
330
|
+
* - Migrate to a different provider
|
|
331
|
+
*
|
|
332
|
+
* @example Close a deployment
|
|
333
|
+
* ```typescript
|
|
334
|
+
* import { createSigningClient, closeDeployment } from 'deploy-ability/akash';
|
|
335
|
+
*
|
|
336
|
+
* const clientResult = await createSigningClient(wallet, 'mainnet');
|
|
337
|
+
* if (!clientResult.success) throw clientResult.error;
|
|
338
|
+
*
|
|
339
|
+
* const result = await closeDeployment(
|
|
340
|
+
* clientResult.data,
|
|
341
|
+
* wallet,
|
|
342
|
+
* '12345' // DSEQ from deployment
|
|
343
|
+
* );
|
|
344
|
+
*
|
|
345
|
+
* if (result.success) {
|
|
346
|
+
* console.log('Deployment closed:', result.data.transactionHash);
|
|
347
|
+
* }
|
|
348
|
+
* ```
|
|
349
|
+
*
|
|
350
|
+
* @see DeploymentCloseResult for details on the response structure
|
|
351
|
+
*/
|
|
352
|
+
export { closeDeployment } from './blockchain-client.js';
|
|
353
|
+
/**
|
|
354
|
+
* Create BidPricing from raw blockchain price
|
|
355
|
+
*
|
|
356
|
+
* Calculates all time-period prices from per-block price.
|
|
357
|
+
* Used internally by queryBids, but exposed for advanced use cases.
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```typescript
|
|
361
|
+
* const pricing = createBidPricing({
|
|
362
|
+
* denom: 'uakt',
|
|
363
|
+
* amount: '1234' // uAKT per block
|
|
364
|
+
* });
|
|
365
|
+
*
|
|
366
|
+
* console.log(pricing.akt.perMonth); // Monthly cost in AKT
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
export { createBidPricing } from './bid-types.js';
|
|
370
|
+
/**
|
|
371
|
+
* Select cheapest bid
|
|
372
|
+
*
|
|
373
|
+
* Returns the bid with the lowest monthly price. Best for development
|
|
374
|
+
* and testing where cost is the primary concern.
|
|
375
|
+
*
|
|
376
|
+
* **Considerations:**
|
|
377
|
+
* - Only considers price, not reliability or location
|
|
378
|
+
* - For production, combine with filterBids for quality constraints
|
|
379
|
+
* - Cheapest doesn't always mean best value
|
|
380
|
+
*
|
|
381
|
+
* @example Simple cheapest selection
|
|
382
|
+
* ```typescript
|
|
383
|
+
* import { deployToAkash, selectCheapestBid } from 'deploy-ability/akash';
|
|
384
|
+
*
|
|
385
|
+
* const result = await deployToAkash({
|
|
386
|
+
* wallet,
|
|
387
|
+
* certificate,
|
|
388
|
+
* projectRoot: './',
|
|
389
|
+
* profile: 'dev',
|
|
390
|
+
* bidSelector: selectCheapestBid
|
|
391
|
+
* });
|
|
392
|
+
* ```
|
|
393
|
+
*
|
|
394
|
+
* @example With quality filtering
|
|
395
|
+
* ```typescript
|
|
396
|
+
* const result = await deployToAkash({
|
|
397
|
+
* wallet,
|
|
398
|
+
* certificate,
|
|
399
|
+
* projectRoot: './',
|
|
400
|
+
* profile: 'prod',
|
|
401
|
+
* bidSelector: (bids) => {
|
|
402
|
+
* const qualityBids = filterBids(bids, {
|
|
403
|
+
* requireAudited: true,
|
|
404
|
+
* minUptime: { value: 0.95, period: '7d' }
|
|
405
|
+
* });
|
|
406
|
+
* return selectCheapestBid(qualityBids);
|
|
407
|
+
* }
|
|
408
|
+
* });
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
export { selectCheapestBid } from './bid-selectors.js';
|
|
412
|
+
/**
|
|
413
|
+
* Select most reliable bid
|
|
414
|
+
*
|
|
415
|
+
* Returns the bid with highest uptime percentage. Best for production
|
|
416
|
+
* deployments where reliability is critical.
|
|
417
|
+
*
|
|
418
|
+
* **Uptime Periods:**
|
|
419
|
+
* - '1d': Last 24 hours (most recent, limited sample)
|
|
420
|
+
* - '7d': Last 7 days (recommended default)
|
|
421
|
+
* - '30d': Last 30 days (long-term stability)
|
|
422
|
+
*
|
|
423
|
+
* **Fallback:**
|
|
424
|
+
* If no providers have reliability data, returns first bid.
|
|
425
|
+
*
|
|
426
|
+
* @example Default 7-day uptime
|
|
427
|
+
* ```typescript
|
|
428
|
+
* const result = await deployToAkash({
|
|
429
|
+
* wallet,
|
|
430
|
+
* certificate,
|
|
431
|
+
* projectRoot: './',
|
|
432
|
+
* profile: 'production',
|
|
433
|
+
* bidSelector: selectMostReliableBid
|
|
434
|
+
* });
|
|
435
|
+
* ```
|
|
436
|
+
*
|
|
437
|
+
* @example Custom 30-day period
|
|
438
|
+
* ```typescript
|
|
439
|
+
* const result = await deployToAkash({
|
|
440
|
+
* wallet,
|
|
441
|
+
* certificate,
|
|
442
|
+
* projectRoot: './',
|
|
443
|
+
* profile: 'production',
|
|
444
|
+
* bidSelector: (bids) => selectMostReliableBid(bids, '30d')
|
|
445
|
+
* });
|
|
446
|
+
* ```
|
|
447
|
+
*/
|
|
448
|
+
export { selectMostReliableBid } from './bid-selectors.js';
|
|
449
|
+
/**
|
|
450
|
+
* Select balanced bid (price + reliability)
|
|
451
|
+
*
|
|
452
|
+
* Calculates weighted score combining normalized price and uptime,
|
|
453
|
+
* then selects highest-scoring bid. Best for production where both
|
|
454
|
+
* cost and reliability matter.
|
|
455
|
+
*
|
|
456
|
+
* **Scoring:**
|
|
457
|
+
* - Price score: 0-1 (lower price = higher score)
|
|
458
|
+
* - Reliability score: uptime7d (0-1)
|
|
459
|
+
* - Total: (price × weight) + (reliability × weight)
|
|
460
|
+
*
|
|
461
|
+
* **Default weights:** 0.5 price, 0.5 reliability (equal balance)
|
|
462
|
+
*
|
|
463
|
+
* @example Equal balance (default)
|
|
464
|
+
* ```typescript
|
|
465
|
+
* const result = await deployToAkash({
|
|
466
|
+
* wallet,
|
|
467
|
+
* certificate,
|
|
468
|
+
* projectRoot: './',
|
|
469
|
+
* profile: 'production',
|
|
470
|
+
* bidSelector: selectBalancedBid
|
|
471
|
+
* });
|
|
472
|
+
* ```
|
|
473
|
+
*
|
|
474
|
+
* @example Prioritize reliability (70/30)
|
|
475
|
+
* ```typescript
|
|
476
|
+
* const result = await deployToAkash({
|
|
477
|
+
* wallet,
|
|
478
|
+
* certificate,
|
|
479
|
+
* projectRoot: './',
|
|
480
|
+
* profile: 'critical-prod',
|
|
481
|
+
* bidSelector: (bids) => selectBalancedBid(bids, {
|
|
482
|
+
* price: 0.3,
|
|
483
|
+
* reliability: 0.7
|
|
484
|
+
* })
|
|
485
|
+
* });
|
|
486
|
+
* ```
|
|
487
|
+
*
|
|
488
|
+
* @example Prioritize cost (80/20)
|
|
489
|
+
* ```typescript
|
|
490
|
+
* const result = await deployToAkash({
|
|
491
|
+
* wallet,
|
|
492
|
+
* certificate,
|
|
493
|
+
* projectRoot: './',
|
|
494
|
+
* profile: 'dev',
|
|
495
|
+
* bidSelector: (bids) => selectBalancedBid(bids, {
|
|
496
|
+
* price: 0.8,
|
|
497
|
+
* reliability: 0.2
|
|
498
|
+
* })
|
|
499
|
+
* });
|
|
500
|
+
* ```
|
|
501
|
+
*/
|
|
502
|
+
export { selectBalancedBid } from './bid-selectors.js';
|
|
503
|
+
/**
|
|
504
|
+
* Filter bids by criteria
|
|
505
|
+
*
|
|
506
|
+
* Apply multiple filters to narrow down options. All criteria are
|
|
507
|
+
* optional and combined with AND logic.
|
|
508
|
+
*
|
|
509
|
+
* **Philosophy:**
|
|
510
|
+
* Use this to establish minimum quality standards, then apply a
|
|
511
|
+
* selection strategy to choose from acceptable bids.
|
|
512
|
+
*
|
|
513
|
+
* **Available Filters:**
|
|
514
|
+
* - maxPricePerMonth: Budget constraint (uAKT or USD)
|
|
515
|
+
* - minUptime: Minimum reliability requirement
|
|
516
|
+
* - requireAudited: Only audited providers
|
|
517
|
+
* - preferredRegions: Geographic requirements
|
|
518
|
+
* - requireOnline: Only currently online providers
|
|
519
|
+
*
|
|
520
|
+
* @example Price and uptime filtering
|
|
521
|
+
* ```typescript
|
|
522
|
+
* const filtered = filterBids(bids, {
|
|
523
|
+
* maxPricePerMonth: { usd: 50, aktPrice: 0.45 },
|
|
524
|
+
* minUptime: { value: 0.95, period: '7d' }
|
|
525
|
+
* });
|
|
526
|
+
* const selected = selectCheapestBid(filtered);
|
|
527
|
+
* ```
|
|
528
|
+
*
|
|
529
|
+
* @example Audit and location filtering
|
|
530
|
+
* ```typescript
|
|
531
|
+
* const filtered = filterBids(bids, {
|
|
532
|
+
* requireAudited: true,
|
|
533
|
+
* preferredRegions: ['US', 'EU'],
|
|
534
|
+
* requireOnline: true
|
|
535
|
+
* });
|
|
536
|
+
* ```
|
|
537
|
+
*
|
|
538
|
+
* @example Price filtering in uAKT
|
|
539
|
+
* ```typescript
|
|
540
|
+
* const filtered = filterBids(bids, {
|
|
541
|
+
* maxPricePerMonth: { uakt: 500_000_000 }
|
|
542
|
+
* });
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
export { filterBids } from './bid-selectors.js';
|
|
546
|
+
/**
|
|
547
|
+
* Fetch provider metadata
|
|
548
|
+
*
|
|
549
|
+
* Fetches complete provider information from Cloudmos API with
|
|
550
|
+
* blockchain fallback. Includes reliability metrics, location,
|
|
551
|
+
* and audit status.
|
|
552
|
+
*
|
|
553
|
+
* **Use Cases:**
|
|
554
|
+
* - Pre-deployment provider research
|
|
555
|
+
* - Building custom provider directories
|
|
556
|
+
* - Monitoring provider status
|
|
557
|
+
*
|
|
558
|
+
* @example Fetch single provider
|
|
559
|
+
* ```typescript
|
|
560
|
+
* const result = await fetchProviderInfo('mainnet', 'akash1...');
|
|
561
|
+
* if (result.success) {
|
|
562
|
+
* const provider = result.data;
|
|
563
|
+
* console.log('Provider:', provider.name || provider.owner);
|
|
564
|
+
* if (provider.reliability) {
|
|
565
|
+
* console.log('Uptime:', (provider.reliability.uptime7d * 100) + '%');
|
|
566
|
+
* }
|
|
567
|
+
* }
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
export { fetchProviderInfo } from './provider-service.js';
|
|
571
|
+
/**
|
|
572
|
+
* Fetch multiple providers in parallel
|
|
573
|
+
*
|
|
574
|
+
* Efficiently fetches information for multiple providers at once.
|
|
575
|
+
* Used internally by queryBids, but exposed for advanced use cases.
|
|
576
|
+
*
|
|
577
|
+
* @example Batch fetch
|
|
578
|
+
* ```typescript
|
|
579
|
+
* const addresses = ['akash1...', 'akash2...', 'akash3...'];
|
|
580
|
+
* const result = await fetchProviderInfoBatch('mainnet', addresses);
|
|
581
|
+
*
|
|
582
|
+
* if (result.success) {
|
|
583
|
+
* for (const [address, info] of result.data) {
|
|
584
|
+
* console.log(address, ':', info.name || 'Unknown');
|
|
585
|
+
* }
|
|
586
|
+
* }
|
|
587
|
+
* ```
|
|
588
|
+
*/
|
|
589
|
+
export { fetchProviderInfoBatch } from './provider-service.js';
|
|
590
|
+
// ========================================
|
|
591
|
+
// 🔍 Query & Monitoring
|
|
592
|
+
// ========================================
|
|
593
|
+
/**
|
|
594
|
+
* Fetch lease records from blockchain
|
|
595
|
+
*
|
|
596
|
+
* Query leases with flexible filtering (owner, provider, dseq, etc.)
|
|
597
|
+
*/
|
|
598
|
+
export { getLeaseRecords } from './query-client.js';
|
|
599
|
+
/**
|
|
600
|
+
* Fetch single lease by ID
|
|
601
|
+
*
|
|
602
|
+
* Get detailed lease information for specific deployment.
|
|
603
|
+
*/
|
|
604
|
+
export { getLeaseById } from './query-client.js';
|
|
605
|
+
/**
|
|
606
|
+
* Fetch deployment details
|
|
607
|
+
*
|
|
608
|
+
* Get deployment configuration, resource specs, and group information.
|
|
609
|
+
*/
|
|
610
|
+
export { getDeploymentDetails } from './query-client.js';
|
|
611
|
+
/**
|
|
612
|
+
* Fetch provider metadata
|
|
613
|
+
*
|
|
614
|
+
* Get provider host URI and attributes for deployment monitoring.
|
|
615
|
+
*/
|
|
616
|
+
export { getProviderMetadata } from './query-client.js';
|
|
617
|
+
/**
|
|
618
|
+
* Get complete deployment overview
|
|
619
|
+
*
|
|
620
|
+
* Aggregates lease, deployment, and provider info into single object.
|
|
621
|
+
*/
|
|
622
|
+
export { getDeploymentOverview } from './query-client.js';
|
|
623
|
+
/**
|
|
624
|
+
* Wait for containers to reach running state
|
|
625
|
+
*
|
|
626
|
+
* Polls provider for container status until all containers are running or timeout.
|
|
627
|
+
*/
|
|
628
|
+
export { waitForContainersRunning } from './lease-monitor.js';
|
|
629
|
+
/**
|
|
630
|
+
* Send manifest to provider
|
|
631
|
+
*
|
|
632
|
+
* Delivers deployment manifest to provider via HTTPS with mTLS authentication.
|
|
633
|
+
*/
|
|
634
|
+
export { sendManifestToProvider } from './provider-client.js';
|
|
635
|
+
/**
|
|
636
|
+
* Fetch lease status from provider
|
|
637
|
+
*
|
|
638
|
+
* Query provider for current lease status and service URIs.
|
|
639
|
+
*/
|
|
640
|
+
export { fetchProviderLeaseStatus } from './provider-client.js';
|
|
641
|
+
// ========================================
|
|
642
|
+
// 📜 Log Streaming
|
|
643
|
+
// ========================================
|
|
644
|
+
/**
|
|
645
|
+
* Stream container logs from Akash deployment in real-time
|
|
646
|
+
*
|
|
647
|
+
* Returns an EventEmitter that emits parsed log lines as they arrive from the provider.
|
|
648
|
+
* Uses WebSocket with mTLS authentication to connect directly to the Akash provider.
|
|
649
|
+
*
|
|
650
|
+
* **Key Features:**
|
|
651
|
+
* - Real-time log streaming with WebSocket
|
|
652
|
+
* - Service filtering (filter by specific containers)
|
|
653
|
+
* - Tail support (show last N lines)
|
|
654
|
+
* - Automatic log parsing and service name extraction
|
|
655
|
+
* - Event-based API for flexible consumption
|
|
656
|
+
*
|
|
657
|
+
* @example Stream logs and watch for specific messages
|
|
658
|
+
* ```typescript
|
|
659
|
+
* const stream = streamDeploymentLogs({
|
|
660
|
+
* deployment: deploymentData,
|
|
661
|
+
* wallet: walletContext,
|
|
662
|
+
* certificate: certData,
|
|
663
|
+
* network: 'mainnet',
|
|
664
|
+
* services: ['ollama'],
|
|
665
|
+
* follow: true,
|
|
666
|
+
* tail: 100
|
|
667
|
+
* });
|
|
668
|
+
*
|
|
669
|
+
* stream.on('log', (log) => {
|
|
670
|
+
* console.log(`[${log.service}] ${log.message}`);
|
|
671
|
+
*
|
|
672
|
+
* // Watch for specific events
|
|
673
|
+
* if (log.message.includes('Model ready!')) {
|
|
674
|
+
* console.log('✅ Model is ready!');
|
|
675
|
+
* stream.close();
|
|
676
|
+
* }
|
|
677
|
+
* });
|
|
678
|
+
*
|
|
679
|
+
* stream.on('error', (error) => {
|
|
680
|
+
* console.error('Stream error:', error);
|
|
681
|
+
* });
|
|
682
|
+
* ```
|
|
683
|
+
*
|
|
684
|
+
* @example Monitor model weight downloads
|
|
685
|
+
* ```typescript
|
|
686
|
+
* const stream = streamDeploymentLogs({
|
|
687
|
+
* deployment: modelDeployment,
|
|
688
|
+
* wallet: walletContext,
|
|
689
|
+
* certificate: certData,
|
|
690
|
+
* network: 'mainnet',
|
|
691
|
+
* tail: 0 // Start from now
|
|
692
|
+
* });
|
|
693
|
+
*
|
|
694
|
+
* stream.on('log', (log) => {
|
|
695
|
+
* if (log.message.includes('pulling manifest')) {
|
|
696
|
+
* console.log('📦 Downloading model weights...');
|
|
697
|
+
* }
|
|
698
|
+
* if (log.message.includes('100%')) {
|
|
699
|
+
* console.log('✅ Download complete!');
|
|
700
|
+
* }
|
|
701
|
+
* });
|
|
702
|
+
* ```
|
|
703
|
+
*/
|
|
704
|
+
export { streamDeploymentLogs } from './logs.js';
|
|
705
|
+
/**
|
|
706
|
+
* Get deployment logs as a complete array (non-streaming)
|
|
707
|
+
*
|
|
708
|
+
* Collects logs up to maxLogs or timeout, then returns them as an array.
|
|
709
|
+
* Useful for downloading full logs or one-time log retrieval.
|
|
710
|
+
*
|
|
711
|
+
* @example Download logs to file
|
|
712
|
+
* ```typescript
|
|
713
|
+
* const logs = await getDeploymentLogs({
|
|
714
|
+
* deployment: deploymentData,
|
|
715
|
+
* wallet: walletContext,
|
|
716
|
+
* certificate: certData,
|
|
717
|
+
* network: 'mainnet',
|
|
718
|
+
* tail: 1000,
|
|
719
|
+
* maxLogs: 1000
|
|
720
|
+
* });
|
|
721
|
+
*
|
|
722
|
+
* const logText = logs.map(log =>
|
|
723
|
+
* `[${log.receivedAt.toISOString()}] [${log.service}] ${log.message}`
|
|
724
|
+
* ).join('\n');
|
|
725
|
+
*
|
|
726
|
+
* fs.writeFileSync('deployment.log', logText);
|
|
727
|
+
* ```
|
|
728
|
+
*/
|
|
729
|
+
export { getDeploymentLogs } from './logs.js';
|
|
730
|
+
// ========================================
|
|
731
|
+
// 📋 SDL Generation
|
|
732
|
+
// ========================================
|
|
733
|
+
/**
|
|
734
|
+
* Generate Akash SDL YAML from profile
|
|
735
|
+
*
|
|
736
|
+
* Transforms deployment profile into SDL format for blockchain submission.
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* ```typescript
|
|
740
|
+
* const yaml = generateAkashSdl(profile, {
|
|
741
|
+
* defaultCpuUnits: 1.0,
|
|
742
|
+
* defaultMemorySize: '1Gi'
|
|
743
|
+
* });
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
export { generateAkashSdl } from './sdl-generator.js';
|
|
747
|
+
/**
|
|
748
|
+
* Create SDL object instance
|
|
749
|
+
*
|
|
750
|
+
* Generates SDL YAML and returns instantiated SDL helper from akashjs.
|
|
751
|
+
* Provides access to groups() and manifestVersion() methods.
|
|
752
|
+
*/
|
|
753
|
+
export { createSdlObject } from './sdl-generator.js';
|
|
754
|
+
// ========================================
|
|
755
|
+
// 💰 Pricing Utilities
|
|
756
|
+
// ========================================
|
|
757
|
+
/**
|
|
758
|
+
* Lease price calculator with multi-format support
|
|
759
|
+
*
|
|
760
|
+
* Calculates lease costs in multiple formats (per block, per hour, per month)
|
|
761
|
+
* and supports USD conversion when AKT market price is provided.
|
|
762
|
+
*
|
|
763
|
+
* **Key Features:**
|
|
764
|
+
* - Pre-computed prices in uAKT and AKT
|
|
765
|
+
* - Per-block, per-hour, and per-month calculations
|
|
766
|
+
* - USD conversion with custom AKT price
|
|
767
|
+
* - Matches Akash Console calculations exactly
|
|
768
|
+
*
|
|
769
|
+
* **Constants Used:**
|
|
770
|
+
* - Average block time: 6.098 seconds
|
|
771
|
+
* - Average days per month: 30.437 days
|
|
772
|
+
*
|
|
773
|
+
* @example Display pricing in uAKT
|
|
774
|
+
* ```typescript
|
|
775
|
+
* const result = await deployToAkash({ ... });
|
|
776
|
+
* if (result.success) {
|
|
777
|
+
* const { leasePrice } = result.data;
|
|
778
|
+
* console.log(`Cost: ${leasePrice.uakt.perMonth} uAKT/month`);
|
|
779
|
+
* console.log(`Cost: ${leasePrice.akt.perMonth} AKT/month`);
|
|
780
|
+
* }
|
|
781
|
+
* ```
|
|
782
|
+
*
|
|
783
|
+
* @example Convert to USD
|
|
784
|
+
* ```typescript
|
|
785
|
+
* // Fetch AKT price from CoinGecko or other source
|
|
786
|
+
* const aktPrice = 0.50; // $0.50 per AKT
|
|
787
|
+
*
|
|
788
|
+
* const result = await deployToAkash({ ... });
|
|
789
|
+
* if (result.success) {
|
|
790
|
+
* const usd = result.data.leasePrice.toUSD(aktPrice);
|
|
791
|
+
* console.log(`💰 Cost: $${usd.perMonth.toFixed(2)}/month`);
|
|
792
|
+
* console.log(`💰 Cost: $${usd.perHour.toFixed(4)}/hour`);
|
|
793
|
+
* }
|
|
794
|
+
* ```
|
|
795
|
+
*
|
|
796
|
+
* @see LeasePrice class documentation for detailed usage
|
|
797
|
+
*/
|
|
798
|
+
export { LeasePrice } from './pricing.js';
|
|
799
|
+
/**
|
|
800
|
+
* Pricing constants
|
|
801
|
+
*
|
|
802
|
+
* Average block time and days in month used for price calculations.
|
|
803
|
+
* These match the values used by Akash Console.
|
|
804
|
+
*/
|
|
805
|
+
export { AVERAGE_BLOCK_TIME_SECONDS, AVERAGE_DAYS_IN_MONTH, UAKT_PER_AKT, } from './pricing.js';
|
|
806
|
+
// ========================================
|
|
807
|
+
// 🌐 Environment & Configuration
|
|
808
|
+
// ========================================
|
|
809
|
+
/**
|
|
810
|
+
* Get network configuration
|
|
811
|
+
*
|
|
812
|
+
* Returns RPC endpoint and chain ID for specified network.
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* ```typescript
|
|
816
|
+
* const config = getNetworkConfig('mainnet');
|
|
817
|
+
* console.log('RPC:', config.rpc);
|
|
818
|
+
* ```
|
|
819
|
+
*/
|
|
820
|
+
export { getNetworkConfig } from './environment.js';
|
|
821
|
+
/**
|
|
822
|
+
* Network configurations for mainnet and testnet
|
|
823
|
+
*/
|
|
824
|
+
export { AKASH_NETWORKS } from './environment.js';
|
|
825
|
+
/**
|
|
826
|
+
* Check if provider is blacklisted
|
|
827
|
+
*
|
|
828
|
+
* Verifies provider against known problematic providers.
|
|
829
|
+
*/
|
|
830
|
+
export { isProviderBlacklisted } from './environment.js';
|
|
831
|
+
/**
|
|
832
|
+
* Placement attribute constants
|
|
833
|
+
*
|
|
834
|
+
* Valid values for geographic and provider targeting when deploying to Akash.
|
|
835
|
+
* These reflect **actual provider values** from mainnet, not the official schema.
|
|
836
|
+
*
|
|
837
|
+
* @example
|
|
838
|
+
* ```typescript
|
|
839
|
+
* import { AKASH_REGIONS, AKASH_TIERS } from 'deploy-ability';
|
|
840
|
+
*
|
|
841
|
+
* console.log(AKASH_REGIONS['us-west']);
|
|
842
|
+
* // "Western United States (California, Oregon, Washington, Nevada)"
|
|
843
|
+
*
|
|
844
|
+
* console.log(AKASH_TIERS['community']);
|
|
845
|
+
* // "Community-tier providers (standard pricing, good for most workloads)"
|
|
846
|
+
* ```
|
|
847
|
+
*/
|
|
848
|
+
export { AKASH_REGIONS, AKASH_TIERS, getAkashRegions, getAkashTiers, } from './constants.js';
|
|
849
|
+
// ========================================
|
|
850
|
+
// 🐳 Local Image Registry
|
|
851
|
+
// ========================================
|
|
852
|
+
/**
|
|
853
|
+
* Setup temporary registry for local images
|
|
854
|
+
*
|
|
855
|
+
* Automatically detects local images and makes them accessible to Akash providers:
|
|
856
|
+
* 1. Starts temporary registry on localhost
|
|
857
|
+
* 2. Pushes local images to registry
|
|
858
|
+
* 3. Exposes registry publicly via tunnel (ngrok/serveo/bore)
|
|
859
|
+
* 4. Rewrites profile to use public registry URLs
|
|
860
|
+
* 5. Returns cleanup function to shut down registry after deployment
|
|
861
|
+
*
|
|
862
|
+
* **Three Outcomes:**
|
|
863
|
+
* - No local images → Returns profile unchanged
|
|
864
|
+
* - User opted out (useRemoteRegistry: true) → Returns profile unchanged
|
|
865
|
+
* - Local images found → Starts registry, transforms profile
|
|
866
|
+
*
|
|
867
|
+
* @example
|
|
868
|
+
* ```typescript
|
|
869
|
+
* const ctx = await setupRegistryIfNeeded(profile, logger, {
|
|
870
|
+
* containerEngine: 'docker',
|
|
871
|
+
* tunnelService: 'serveo'
|
|
872
|
+
* });
|
|
873
|
+
*
|
|
874
|
+
* try {
|
|
875
|
+
* await deployToAkash({
|
|
876
|
+
* loadedProfile: { profile: ctx.deployableProfile }
|
|
877
|
+
* });
|
|
878
|
+
* } finally {
|
|
879
|
+
* await ctx.cleanup(); // Always cleanup
|
|
880
|
+
* }
|
|
881
|
+
* ```
|
|
882
|
+
*/
|
|
883
|
+
export { setupRegistryIfNeeded } from '../../utils/registry/index.js';
|
|
884
|
+
/**
|
|
885
|
+
* Check if profile contains local images
|
|
886
|
+
*
|
|
887
|
+
* Uses reality-based detection (docker images -q) to check if images
|
|
888
|
+
* actually exist locally rather than guessing based on name patterns.
|
|
889
|
+
*
|
|
890
|
+
* @example
|
|
891
|
+
* ```typescript
|
|
892
|
+
* if (hasLocalImages(profile, 'docker')) {
|
|
893
|
+
* console.log('Local images detected - registry will be needed');
|
|
894
|
+
* }
|
|
895
|
+
* ```
|
|
896
|
+
*/
|
|
897
|
+
export { hasLocalImages } from '../../utils/registry/index.js';
|
|
898
|
+
/**
|
|
899
|
+
* Registry manager class for advanced use cases
|
|
900
|
+
*
|
|
901
|
+
* Provides low-level control over registry operations. Most users should
|
|
902
|
+
* use `setupRegistryIfNeeded()` instead.
|
|
903
|
+
*/
|
|
904
|
+
export { TemporaryContainerRegistryManager } from '../../utils/registry/index.js';
|
|
905
|
+
/**
|
|
906
|
+
* Type guards for wallet context
|
|
907
|
+
*/
|
|
908
|
+
export { isWalletConnectSession, hasAccountData } from './types.js';
|
|
909
|
+
//# sourceMappingURL=index.js.map
|