@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.
- package/dist/targets/akash/bids.d.ts +183 -0
- package/dist/targets/akash/bids.d.ts.map +1 -0
- package/dist/targets/akash/bids.js +247 -0
- package/dist/targets/akash/bids.js.map +1 -0
- package/dist/targets/akash/certificate-manager.d.ts +89 -167
- package/dist/targets/akash/certificate-manager.d.ts.map +1 -1
- package/dist/targets/akash/certificate-manager.js +193 -301
- package/dist/targets/akash/certificate-manager.js.map +1 -1
- package/dist/targets/akash/client.d.ts +644 -0
- package/dist/targets/akash/client.d.ts.map +1 -0
- package/dist/targets/akash/client.js +972 -0
- package/dist/targets/akash/client.js.map +1 -0
- package/dist/targets/akash/constants.d.ts +12 -149
- package/dist/targets/akash/constants.d.ts.map +1 -1
- package/dist/targets/akash/constants.js +14 -136
- package/dist/targets/akash/constants.js.map +1 -1
- package/dist/targets/akash/deployer.d.ts +3 -82
- package/dist/targets/akash/deployer.d.ts.map +1 -1
- package/dist/targets/akash/deployer.js +122 -160
- package/dist/targets/akash/deployer.js.map +1 -1
- package/dist/targets/akash/environment.d.ts +16 -214
- package/dist/targets/akash/environment.d.ts.map +1 -1
- package/dist/targets/akash/environment.js +20 -210
- package/dist/targets/akash/environment.js.map +1 -1
- package/dist/targets/akash/index.d.ts +95 -189
- package/dist/targets/akash/index.d.ts.map +1 -1
- package/dist/targets/akash/index.js +69 -197
- package/dist/targets/akash/index.js.map +1 -1
- package/dist/targets/akash/lease-monitor.d.ts +3 -21
- package/dist/targets/akash/lease-monitor.d.ts.map +1 -1
- package/dist/targets/akash/lease-monitor.js +39 -56
- package/dist/targets/akash/lease-monitor.js.map +1 -1
- package/dist/targets/akash/logs.d.ts +103 -4
- package/dist/targets/akash/logs.d.ts.map +1 -1
- package/dist/targets/akash/logs.js +12 -3
- package/dist/targets/akash/logs.js.map +1 -1
- package/dist/targets/akash/pricing.d.ts +12 -191
- package/dist/targets/akash/pricing.d.ts.map +1 -1
- package/dist/targets/akash/pricing.js +12 -188
- package/dist/targets/akash/pricing.js.map +1 -1
- package/dist/targets/akash/provider-manager.d.ts +120 -0
- package/dist/targets/akash/provider-manager.d.ts.map +1 -0
- package/dist/targets/akash/provider-manager.js +574 -0
- package/dist/targets/akash/provider-manager.js.map +1 -0
- package/dist/targets/akash/sdl-generator.d.ts +2 -2
- package/dist/targets/akash/sdl-generator.d.ts.map +1 -1
- package/dist/targets/akash/sdl-generator.js +6 -39
- package/dist/targets/akash/sdl-generator.js.map +1 -1
- package/dist/targets/akash/types.d.ts +66 -243
- package/dist/targets/akash/types.d.ts.map +1 -1
- package/dist/targets/akash/types.js +4 -41
- package/dist/targets/akash/types.js.map +1 -1
- package/dist/targets/akash/wallet-manager.d.ts +35 -352
- package/dist/targets/akash/wallet-manager.d.ts.map +1 -1
- package/dist/targets/akash/wallet-manager.js +37 -439
- package/dist/targets/akash/wallet-manager.js.map +1 -1
- package/dist/targets/local/compose-generator.d.ts.map +1 -1
- package/dist/targets/local/compose-generator.js +1 -0
- package/dist/targets/local/compose-generator.js.map +1 -1
- package/dist/targets/local/deployer.js +4 -4
- package/dist/targets/local/deployer.js.map +1 -1
- package/dist/targets/local/types.d.ts +4 -0
- package/dist/targets/local/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/options.d.ts +45 -4
- package/dist/types/options.d.ts.map +1 -1
- package/dist/utils/registry/manager.js +6 -6
- package/dist/utils/registry/manager.js.map +1 -1
- package/dist/utils/registry/setup.js +4 -4
- package/dist/utils/registry/setup.js.map +1 -1
- package/docs/KADI_ABILITY_CONVERSION.md +1365 -0
- package/docs/PIPELINE_BUILDER_DESIGN.md +1149 -0
- package/package.json +8 -11
- package/dist/targets/akash/bid-selectors.d.ts +0 -251
- package/dist/targets/akash/bid-selectors.d.ts.map +0 -1
- package/dist/targets/akash/bid-selectors.js +0 -322
- package/dist/targets/akash/bid-selectors.js.map +0 -1
- package/dist/targets/akash/bid-types.d.ts +0 -297
- package/dist/targets/akash/bid-types.d.ts.map +0 -1
- package/dist/targets/akash/bid-types.js +0 -89
- package/dist/targets/akash/bid-types.js.map +0 -1
- package/dist/targets/akash/blockchain-client.d.ts +0 -577
- package/dist/targets/akash/blockchain-client.d.ts.map +0 -1
- package/dist/targets/akash/blockchain-client.js +0 -803
- package/dist/targets/akash/blockchain-client.js.map +0 -1
- package/dist/targets/akash/logs.types.d.ts +0 -102
- package/dist/targets/akash/logs.types.d.ts.map +0 -1
- package/dist/targets/akash/logs.types.js +0 -9
- package/dist/targets/akash/logs.types.js.map +0 -1
- package/dist/targets/akash/provider-client.d.ts +0 -114
- package/dist/targets/akash/provider-client.d.ts.map +0 -1
- package/dist/targets/akash/provider-client.js +0 -318
- package/dist/targets/akash/provider-client.js.map +0 -1
- package/dist/targets/akash/provider-metadata.d.ts +0 -228
- package/dist/targets/akash/provider-metadata.d.ts.map +0 -1
- package/dist/targets/akash/provider-metadata.js +0 -14
- package/dist/targets/akash/provider-metadata.js.map +0 -1
- package/dist/targets/akash/provider-service.d.ts +0 -133
- package/dist/targets/akash/provider-service.d.ts.map +0 -1
- package/dist/targets/akash/provider-service.js +0 -391
- package/dist/targets/akash/provider-service.js.map +0 -1
- package/dist/targets/akash/query-client.d.ts +0 -125
- package/dist/targets/akash/query-client.d.ts.map +0 -1
- package/dist/targets/akash/query-client.js +0 -332
- package/dist/targets/akash/query-client.js.map +0 -1
- package/docs/EXAMPLES.md +0 -293
- package/docs/PLACEMENT.md +0 -433
- package/docs/STORAGE.md +0 -318
|
@@ -1,157 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Akash Lease Pricing Utilities
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* **Price Calculation Background:**
|
|
9
|
-
*
|
|
10
|
-
* Akash leases are priced per block on the blockchain. The raw price from the
|
|
11
|
-
* blockchain is in uAKT (micro AKT, where 1 AKT = 1,000,000 uAKT) per block.
|
|
12
|
-
*
|
|
13
|
-
* To make this human-readable, we calculate:
|
|
14
|
-
* - Price per hour: Based on average blocks per hour
|
|
15
|
-
* - Price per month: Based on average blocks per month
|
|
16
|
-
* - Price in USD: Requires current AKT market price
|
|
17
|
-
*
|
|
18
|
-
* **Constants (from Akash Console):**
|
|
19
|
-
* - Average block time: 6.098 seconds
|
|
20
|
-
* - Average days in month: 30.437 days (365.25 / 12)
|
|
4
|
+
* Price calculations for Akash Network deployments using the same formulas as
|
|
5
|
+
* Akash Console. Converts per-block prices to human-readable formats (hour/month)
|
|
6
|
+
* and supports USD conversion.
|
|
21
7
|
*
|
|
22
8
|
* @module targets/akash/pricing
|
|
23
9
|
*/
|
|
24
|
-
/**
|
|
25
|
-
* Average time between blocks on Akash Network (in seconds)
|
|
26
|
-
*
|
|
27
|
-
* This value is determined empirically by observing actual block times.
|
|
28
|
-
* Akash Console uses 6.098 seconds as the average.
|
|
29
|
-
*
|
|
30
|
-
* @see https://github.com/akash-network/console
|
|
31
|
-
*/
|
|
10
|
+
/** Average block time on Akash Network (empirically determined) */
|
|
32
11
|
export const AVERAGE_BLOCK_TIME_SECONDS = 6.098;
|
|
33
|
-
/**
|
|
34
|
-
* Average number of days in a month (365.25 / 12)
|
|
35
|
-
*
|
|
36
|
-
* Using the astronomical year (365.25 days) divided by 12 months
|
|
37
|
-
* provides accurate monthly cost estimates.
|
|
38
|
-
*/
|
|
12
|
+
/** Average days in a month (365.25 / 12) for accurate monthly estimates */
|
|
39
13
|
export const AVERAGE_DAYS_IN_MONTH = 30.437;
|
|
40
|
-
/**
|
|
41
|
-
* Conversion factor: 1 AKT = 1,000,000 uAKT
|
|
42
|
-
*/
|
|
14
|
+
/** Conversion factor: 1 AKT = 1,000,000 uAKT */
|
|
43
15
|
export const UAKT_PER_AKT = 1_000_000;
|
|
44
16
|
/**
|
|
45
|
-
* Lease price
|
|
46
|
-
*
|
|
47
|
-
* This class encapsulates all pricing information for an Akash lease and provides
|
|
48
|
-
* methods to convert between different formats (per block, per hour, per month)
|
|
49
|
-
* and currencies (uAKT, AKT, USD).
|
|
50
|
-
*
|
|
51
|
-
* **Usage Philosophy:**
|
|
52
|
-
*
|
|
53
|
-
* The blockchain provides raw price per block in uAKT. This class:
|
|
54
|
-
* 1. Stores the raw value (immutable)
|
|
55
|
-
* 2. Pre-computes common formats (per hour, per month)
|
|
56
|
-
* 3. Provides USD conversion only when caller provides AKT price
|
|
57
|
-
*
|
|
58
|
-
* This design keeps deploy-ability pure (no external API dependencies) while
|
|
59
|
-
* giving callers maximum flexibility in displaying prices.
|
|
60
|
-
*
|
|
61
|
-
* @example Basic usage - uAKT prices
|
|
62
|
-
* ```typescript
|
|
63
|
-
* const price = new LeasePrice({ denom: 'uakt', amount: '1234' });
|
|
64
|
-
*
|
|
65
|
-
* console.log(price.uakt.perBlock); // 1234
|
|
66
|
-
* console.log(price.uakt.perHour); // ~720,000
|
|
67
|
-
* console.log(price.uakt.perMonth); // ~522,000,000
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
* @example USD conversion
|
|
71
|
-
* ```typescript
|
|
72
|
-
* const price = new LeasePrice({ denom: 'uakt', amount: '1234' });
|
|
73
|
-
*
|
|
74
|
-
* // Fetch current AKT price from your preferred source
|
|
75
|
-
* const aktPrice = 0.50; // $0.50 per AKT
|
|
76
|
-
*
|
|
77
|
-
* const usd = price.toUSD(aktPrice);
|
|
78
|
-
* console.log(`$${usd.perMonth.toFixed(2)}/month`); // "$0.26/month"
|
|
79
|
-
* console.log(`$${usd.perHour.toFixed(4)}/hour`); // "$0.0004/hour"
|
|
80
|
-
* ```
|
|
81
|
-
*
|
|
82
|
-
* @example Displaying in kadi-deploy CLI
|
|
83
|
-
* ```typescript
|
|
84
|
-
* const result = await deployToAkash({ ... });
|
|
85
|
-
*
|
|
86
|
-
* if (result.success) {
|
|
87
|
-
* const { leasePrice } = result.data;
|
|
88
|
-
*
|
|
89
|
-
* // Fetch AKT price
|
|
90
|
-
* const aktPrice = await fetchAktPriceFromCoinGecko();
|
|
91
|
-
* const usd = leasePrice.toUSD(aktPrice);
|
|
92
|
-
*
|
|
93
|
-
* logger.log('Lease Pricing:');
|
|
94
|
-
* logger.log(` ${leasePrice.uakt.perMonth} uAKT/month ($${usd.perMonth.toFixed(2)}/month)`);
|
|
95
|
-
* logger.log(` ${leasePrice.uakt.perHour} uAKT/hour ($${usd.perHour.toFixed(4)}/hour)`);
|
|
96
|
-
* logger.log(` ${leasePrice.perBlock.amount} uAKT/block ($${usd.perBlock.toFixed(6)}/block)`);
|
|
97
|
-
* }
|
|
98
|
-
* ```
|
|
17
|
+
* Lease price with multiple time periods (block/hour/month) and currencies (uAKT/AKT/USD).
|
|
18
|
+
* All prices derived from blockchain's raw per-block price.
|
|
99
19
|
*/
|
|
100
20
|
export class LeasePrice {
|
|
101
|
-
/**
|
|
102
|
-
* Raw price from blockchain (per block)
|
|
103
|
-
*
|
|
104
|
-
* This is the authoritative source - all other prices are computed from this.
|
|
105
|
-
*/
|
|
106
21
|
perBlock;
|
|
107
|
-
/**
|
|
108
|
-
* Pre-computed prices in uAKT for different time periods
|
|
109
|
-
*
|
|
110
|
-
* All values are in micro AKT (uAKT). To convert to AKT, divide by 1,000,000.
|
|
111
|
-
*/
|
|
112
22
|
uakt;
|
|
113
|
-
/**
|
|
114
|
-
* Pre-computed prices in AKT (1 AKT = 1,000,000 uAKT)
|
|
115
|
-
*
|
|
116
|
-
* Convenient for display without manual conversion.
|
|
117
|
-
*/
|
|
118
23
|
akt;
|
|
119
|
-
/**
|
|
120
|
-
* Create a LeasePrice instance from blockchain price data
|
|
121
|
-
*
|
|
122
|
-
* @param price - Price object from blockchain query
|
|
123
|
-
* @param price.denom - Denomination (typically "uakt")
|
|
124
|
-
* @param price.amount - Amount per block as string
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* const price = new LeasePrice({
|
|
129
|
-
* denom: 'uakt',
|
|
130
|
-
* amount: '1234'
|
|
131
|
-
* });
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
24
|
constructor(price) {
|
|
135
|
-
// Store raw blockchain price
|
|
136
25
|
this.perBlock = {
|
|
137
26
|
denom: price.denom,
|
|
138
27
|
amount: price.amount,
|
|
139
28
|
};
|
|
140
|
-
// Parse amount to number for calculations
|
|
141
29
|
const pricePerBlock = parseFloat(price.amount);
|
|
142
|
-
// Calculate blocks per hour
|
|
143
|
-
// 60 seconds/minute * 60 minutes/hour / 6.098 seconds/block = ~590.8 blocks/hour
|
|
144
30
|
const blocksPerHour = (60 * 60) / AVERAGE_BLOCK_TIME_SECONDS;
|
|
145
|
-
// Calculate blocks per month
|
|
146
|
-
// 30.437 days/month * 24 hours/day * 60 minutes/hour * 60 seconds/minute / 6.098 seconds/block
|
|
147
31
|
const blocksPerMonth = (AVERAGE_DAYS_IN_MONTH * 24 * 60 * 60) / AVERAGE_BLOCK_TIME_SECONDS;
|
|
148
|
-
// Pre-compute uAKT prices
|
|
149
32
|
this.uakt = {
|
|
150
33
|
perBlock: pricePerBlock,
|
|
151
34
|
perHour: pricePerBlock * blocksPerHour,
|
|
152
35
|
perMonth: pricePerBlock * blocksPerMonth,
|
|
153
36
|
};
|
|
154
|
-
// Pre-compute AKT prices (divide uAKT by 1,000,000)
|
|
155
37
|
this.akt = {
|
|
156
38
|
perBlock: pricePerBlock / UAKT_PER_AKT,
|
|
157
39
|
perHour: this.uakt.perHour / UAKT_PER_AKT,
|
|
@@ -159,64 +41,17 @@ export class LeasePrice {
|
|
|
159
41
|
};
|
|
160
42
|
}
|
|
161
43
|
/**
|
|
162
|
-
* Convert
|
|
163
|
-
*
|
|
164
|
-
* **Important:** This method requires you to provide the current AKT price.
|
|
165
|
-
* deploy-ability does not fetch market data to remain pure and dependency-free.
|
|
166
|
-
*
|
|
167
|
-
* **Where to get AKT price:**
|
|
168
|
-
* - CoinGecko API: https://api.coingecko.com/api/v3/simple/price?ids=akash-network&vs_currencies=usd
|
|
169
|
-
* - Your own price oracle
|
|
170
|
-
* - Akash Console API (if available)
|
|
171
|
-
* - Cached/hardcoded value for estimates
|
|
172
|
-
*
|
|
173
|
-
* @param aktPriceUSD - Current price of 1 AKT in USD
|
|
174
|
-
* @returns Prices in USD for different time periods
|
|
175
|
-
*
|
|
176
|
-
* @example Fetch from CoinGecko
|
|
177
|
-
* ```typescript
|
|
178
|
-
* const aktPrice = await fetch(
|
|
179
|
-
* 'https://api.coingecko.com/api/v3/simple/price?ids=akash-network&vs_currencies=usd'
|
|
180
|
-
* )
|
|
181
|
-
* .then(r => r.json())
|
|
182
|
-
* .then(data => data['akash-network'].usd);
|
|
183
|
-
*
|
|
184
|
-
* const usdPricing = leasePrice.toUSD(aktPrice);
|
|
185
|
-
* console.log(`Cost: $${usdPricing.perMonth.toFixed(2)}/month`);
|
|
186
|
-
* ```
|
|
187
|
-
*
|
|
188
|
-
* @example Use hardcoded estimate
|
|
189
|
-
* ```typescript
|
|
190
|
-
* // For quick estimates (update periodically)
|
|
191
|
-
* const aktPrice = 0.50; // $0.50 per AKT
|
|
192
|
-
* const usdPricing = leasePrice.toUSD(aktPrice);
|
|
193
|
-
* ```
|
|
44
|
+
* Convert to USD. You provide the AKT price (library stays dependency-free).
|
|
45
|
+
* Get AKT price from CoinGecko, your oracle, or hardcode for estimates.
|
|
194
46
|
*/
|
|
195
47
|
toUSD(aktPriceUSD) {
|
|
196
|
-
// Convert AKT prices to USD by multiplying by AKT price
|
|
197
48
|
return {
|
|
198
49
|
perBlock: this.akt.perBlock * aktPriceUSD,
|
|
199
50
|
perHour: this.akt.perHour * aktPriceUSD,
|
|
200
51
|
perMonth: this.akt.perMonth * aktPriceUSD,
|
|
201
52
|
};
|
|
202
53
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Get a formatted summary of all pricing information
|
|
205
|
-
*
|
|
206
|
-
* Useful for logging or debugging. Returns a plain object with all computed prices.
|
|
207
|
-
*
|
|
208
|
-
* @returns Complete pricing breakdown
|
|
209
|
-
*
|
|
210
|
-
* @example
|
|
211
|
-
* ```typescript
|
|
212
|
-
* console.log(leasePrice.toJSON());
|
|
213
|
-
* // {
|
|
214
|
-
* // perBlock: { denom: 'uakt', amount: '1234' },
|
|
215
|
-
* // uakt: { perBlock: 1234, perHour: 729234, perMonth: 522456789 },
|
|
216
|
-
* // akt: { perBlock: 0.001234, perHour: 0.729234, perMonth: 522.456789 }
|
|
217
|
-
* // }
|
|
218
|
-
* ```
|
|
219
|
-
*/
|
|
54
|
+
/** Get formatted pricing summary */
|
|
220
55
|
toJSON() {
|
|
221
56
|
return {
|
|
222
57
|
perBlock: this.perBlock,
|
|
@@ -224,18 +59,7 @@ export class LeasePrice {
|
|
|
224
59
|
akt: this.akt,
|
|
225
60
|
};
|
|
226
61
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Create LeasePrice from uAKT amount (convenience method)
|
|
229
|
-
*
|
|
230
|
-
* @param amountUakt - Price per block in uAKT
|
|
231
|
-
* @returns New LeasePrice instance
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```typescript
|
|
235
|
-
* const price = LeasePrice.fromUakt(1234);
|
|
236
|
-
* // Equivalent to: new LeasePrice({ denom: 'uakt', amount: '1234' })
|
|
237
|
-
* ```
|
|
238
|
-
*/
|
|
62
|
+
/** Create LeasePrice from uAKT amount (convenience method) */
|
|
239
63
|
static fromUakt(amountUakt) {
|
|
240
64
|
return new LeasePrice({
|
|
241
65
|
denom: 'uakt',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../../src/targets/akash/pricing.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../../src/targets/akash/pricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mE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QAAQ,GAAG,WAAW;SAC1C,CAAC;IACJ,CAAC;IAED,oCAAoC;IACpC,MAAM;QACJ,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC;IACJ,CAAC;IAED,8DAA8D;IAC9D,MAAM,CAAC,QAAQ,CAAC,UAAkB;QAChC,OAAO,IAAI,UAAU,CAAC;YACpB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Akash Provider Management
|
|
3
|
+
*
|
|
4
|
+
* Complete provider operations including communication, metadata fetching,
|
|
5
|
+
* and reliability tracking. Handles both direct provider interaction via
|
|
6
|
+
* mTLS and provider discovery via Console API and blockchain queries.
|
|
7
|
+
*
|
|
8
|
+
* @module targets/akash/providers
|
|
9
|
+
*/
|
|
10
|
+
import type { Result } from '../../types/index.js';
|
|
11
|
+
import { DeploymentError } from '../../errors/index.js';
|
|
12
|
+
import { ProviderError } from '../../errors/index.js';
|
|
13
|
+
import type { AkashProviderTlsCertificate, ProviderInfo } from './types.js';
|
|
14
|
+
import type { AkashNetwork } from './environment.js';
|
|
15
|
+
/** Minimal lease identifier required for provider API operations */
|
|
16
|
+
export interface LeaseReference {
|
|
17
|
+
readonly dseq: string | number;
|
|
18
|
+
readonly gseq: number;
|
|
19
|
+
readonly oseq: number;
|
|
20
|
+
}
|
|
21
|
+
/** Options for manifest delivery */
|
|
22
|
+
export interface ManifestDeliveryOptions {
|
|
23
|
+
readonly providerUri: string;
|
|
24
|
+
readonly lease: LeaseReference;
|
|
25
|
+
readonly manifest: string;
|
|
26
|
+
readonly certificate: AkashProviderTlsCertificate;
|
|
27
|
+
readonly timeoutMs?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Status information for a single service reported by the provider */
|
|
30
|
+
export interface ProviderServiceStatus {
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly available: number;
|
|
33
|
+
readonly total: number;
|
|
34
|
+
readonly ready: number;
|
|
35
|
+
readonly uris: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
/** Forwarded port definition (useful when provider maps ports externally) */
|
|
38
|
+
export interface ProviderForwardedPort {
|
|
39
|
+
readonly port: number;
|
|
40
|
+
readonly externalPort: number;
|
|
41
|
+
readonly host: string;
|
|
42
|
+
readonly available: number;
|
|
43
|
+
}
|
|
44
|
+
/** Assigned IP metadata reported by provider */
|
|
45
|
+
export interface ProviderAssignedIp {
|
|
46
|
+
readonly ip: string;
|
|
47
|
+
readonly port: number;
|
|
48
|
+
readonly externalPort: number;
|
|
49
|
+
readonly protocol: string;
|
|
50
|
+
}
|
|
51
|
+
/** Normalised provider lease status response */
|
|
52
|
+
export interface ProviderLeaseStatus {
|
|
53
|
+
readonly services: Readonly<Record<string, ProviderServiceStatus>>;
|
|
54
|
+
readonly forwardedPorts?: Readonly<Record<string, readonly ProviderForwardedPort[]>>;
|
|
55
|
+
readonly assignedIps?: Readonly<Record<string, readonly ProviderAssignedIp[]>>;
|
|
56
|
+
}
|
|
57
|
+
/** Options for querying provider container status */
|
|
58
|
+
export interface ProviderStatusOptions {
|
|
59
|
+
readonly providerUri: string;
|
|
60
|
+
readonly lease: LeaseReference;
|
|
61
|
+
readonly certificate: AkashProviderTlsCertificate;
|
|
62
|
+
readonly timeoutMs?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Sends the deployment manifest to the provider over mTLS
|
|
66
|
+
*
|
|
67
|
+
* @param options - Manifest delivery configuration
|
|
68
|
+
* @returns Result signalling success or a ProviderError on failure
|
|
69
|
+
*/
|
|
70
|
+
export declare function sendManifestToProvider(options: ManifestDeliveryOptions): Promise<Result<void, ProviderError>>;
|
|
71
|
+
/**
|
|
72
|
+
* Queries the provider status endpoint for container readiness information
|
|
73
|
+
*
|
|
74
|
+
* @param options - Provider status request configuration
|
|
75
|
+
* @returns Result containing normalised provider status data
|
|
76
|
+
*/
|
|
77
|
+
export declare function fetchProviderLeaseStatus(options: ProviderStatusOptions): Promise<Result<ProviderLeaseStatus, ProviderError>>;
|
|
78
|
+
/**
|
|
79
|
+
* Fetch ALL providers with metadata from Console API
|
|
80
|
+
*
|
|
81
|
+
* Fetches the complete list of providers from the Akash Console API in a single call.
|
|
82
|
+
* Returns complete metadata including reliability metrics and geographic location.
|
|
83
|
+
*
|
|
84
|
+
* @param network - Akash network (mainnet/testnet)
|
|
85
|
+
* @returns Result with map of provider address to provider info
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const result = await fetchAllProviders('mainnet');
|
|
90
|
+
* if (result.success) {
|
|
91
|
+
* console.log(`Loaded ${result.data.size} providers`);
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function fetchAllProviders(network: AkashNetwork): Promise<Result<Map<string, ProviderInfo>, DeploymentError>>;
|
|
96
|
+
/**
|
|
97
|
+
* Fetch provider information with enriched metadata
|
|
98
|
+
*
|
|
99
|
+
* Attempts to fetch complete provider information from the Akash Console API,
|
|
100
|
+
* falling back to blockchain-only data if the API is unavailable.
|
|
101
|
+
*
|
|
102
|
+
* @deprecated Use fetchAllProviders() instead for better performance
|
|
103
|
+
*
|
|
104
|
+
* @param network - Akash network (mainnet/testnet)
|
|
105
|
+
* @param providerAddress - Provider's blockchain address
|
|
106
|
+
* @returns Result with complete provider information
|
|
107
|
+
*/
|
|
108
|
+
export declare function fetchProviderInfo(network: AkashNetwork, providerAddress: string): Promise<Result<ProviderInfo, DeploymentError>>;
|
|
109
|
+
/**
|
|
110
|
+
* Fetch multiple providers in batch for efficiency
|
|
111
|
+
*
|
|
112
|
+
* Fetches provider information for multiple providers in parallel. Failed fetches return
|
|
113
|
+
* minimal provider info. Never fails entirely - partial data is acceptable.
|
|
114
|
+
*
|
|
115
|
+
* @param network - Akash network (mainnet/testnet)
|
|
116
|
+
* @param providerAddresses - Array of provider addresses to fetch
|
|
117
|
+
* @returns Result with map of provider address to provider info
|
|
118
|
+
*/
|
|
119
|
+
export declare function fetchProviderInfoBatch(network: AkashNetwork, providerAddresses: string[]): Promise<Result<Map<string, ProviderInfo>, DeploymentError>>;
|
|
120
|
+
//# sourceMappingURL=provider-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-manager.d.ts","sourceRoot":"","sources":["../../../src/targets/akash/provider-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,aAAa,EAId,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,YAAY,EAAyC,MAAM,YAAY,CAAC;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOrD,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,oCAAoC;AACpC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,2BAA2B,CAAC;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,uEAAuE;AACvE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAA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