@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,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bid Types and Pricing
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for enhanced provider bids including comprehensive pricing
|
|
5
|
+
* calculations across multiple time periods (hour, day, week, month) and
|
|
6
|
+
* currencies (uAKT, AKT, USD).
|
|
7
|
+
*
|
|
8
|
+
* @module targets/akash/bid-types
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Average time between blocks on Akash Network (in seconds)
|
|
12
|
+
*
|
|
13
|
+
* This value is determined empirically by observing actual block times.
|
|
14
|
+
* Akash Console uses 6.098 seconds as the average.
|
|
15
|
+
*
|
|
16
|
+
* Used for calculating time-based pricing from per-block prices.
|
|
17
|
+
*/
|
|
18
|
+
const AVERAGE_BLOCK_TIME_SECONDS = 6.098;
|
|
19
|
+
/**
|
|
20
|
+
* Average number of days in a month (365.25 / 12)
|
|
21
|
+
*
|
|
22
|
+
* Using the astronomical year (365.25 days) divided by 12 months
|
|
23
|
+
* provides accurate monthly cost estimates accounting for leap years.
|
|
24
|
+
*/
|
|
25
|
+
const AVERAGE_DAYS_IN_MONTH = 30.437;
|
|
26
|
+
/**
|
|
27
|
+
* Conversion factor: 1 AKT = 1,000,000 uAKT
|
|
28
|
+
*/
|
|
29
|
+
const UAKT_PER_AKT = 1_000_000;
|
|
30
|
+
/**
|
|
31
|
+
* Create BidPricing instance from blockchain price data
|
|
32
|
+
*
|
|
33
|
+
* Calculates all time-period prices from the raw per-block price.
|
|
34
|
+
*
|
|
35
|
+
* @param price - Price object from blockchain bid
|
|
36
|
+
* @param price.denom - Denomination (typically "uakt")
|
|
37
|
+
* @param price.amount - Amount per block as string
|
|
38
|
+
* @returns Complete pricing information across all time periods
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const pricing = createBidPricing({
|
|
43
|
+
* denom: 'uakt',
|
|
44
|
+
* amount: '1234'
|
|
45
|
+
* });
|
|
46
|
+
* console.log(pricing.akt.perMonth); // Monthly cost in AKT
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export function createBidPricing(price) {
|
|
50
|
+
// Parse raw price per block
|
|
51
|
+
const pricePerBlock = parseFloat(price.amount);
|
|
52
|
+
// Calculate number of blocks for each time period
|
|
53
|
+
const blocksPerHour = (60 * 60) / AVERAGE_BLOCK_TIME_SECONDS;
|
|
54
|
+
const blocksPerDay = (24 * 60 * 60) / AVERAGE_BLOCK_TIME_SECONDS;
|
|
55
|
+
const blocksPerWeek = (7 * 24 * 60 * 60) / AVERAGE_BLOCK_TIME_SECONDS;
|
|
56
|
+
const blocksPerMonth = (AVERAGE_DAYS_IN_MONTH * 24 * 60 * 60) / AVERAGE_BLOCK_TIME_SECONDS;
|
|
57
|
+
// Calculate prices in uAKT for all time periods
|
|
58
|
+
const uaktPricing = {
|
|
59
|
+
perBlock: pricePerBlock,
|
|
60
|
+
perHour: pricePerBlock * blocksPerHour,
|
|
61
|
+
perDay: pricePerBlock * blocksPerDay,
|
|
62
|
+
perWeek: pricePerBlock * blocksPerWeek,
|
|
63
|
+
perMonth: pricePerBlock * blocksPerMonth,
|
|
64
|
+
};
|
|
65
|
+
// Calculate prices in AKT (divide uAKT by 1,000,000)
|
|
66
|
+
const aktPricing = {
|
|
67
|
+
perBlock: uaktPricing.perBlock / UAKT_PER_AKT,
|
|
68
|
+
perHour: uaktPricing.perHour / UAKT_PER_AKT,
|
|
69
|
+
perDay: uaktPricing.perDay / UAKT_PER_AKT,
|
|
70
|
+
perWeek: uaktPricing.perWeek / UAKT_PER_AKT,
|
|
71
|
+
perMonth: uaktPricing.perMonth / UAKT_PER_AKT,
|
|
72
|
+
};
|
|
73
|
+
// Return pricing object with USD conversion method
|
|
74
|
+
return {
|
|
75
|
+
raw: {
|
|
76
|
+
denom: price.denom,
|
|
77
|
+
amount: price.amount,
|
|
78
|
+
},
|
|
79
|
+
uakt: uaktPricing,
|
|
80
|
+
akt: aktPricing,
|
|
81
|
+
toUSD: (aktPriceUSD) => ({
|
|
82
|
+
perHour: aktPricing.perHour * aktPriceUSD,
|
|
83
|
+
perDay: aktPricing.perDay * aktPriceUSD,
|
|
84
|
+
perWeek: aktPricing.perWeek * aktPriceUSD,
|
|
85
|
+
perMonth: aktPricing.perMonth * aktPriceUSD,
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=bid-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bid-types.js","sourceR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,EAAE,WAAW,CAAC,QAAQ,GAAG,YAAY;KAC9C,CAAC;IAEF,mDAAmD;IACnD,OAAO;QACL,GAAG,EAAE;YACH,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB;QACD,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE,UAAU;QACf,KAAK,EAAE,CAAC,WAAmB,EAAE,EAAE,CAAC,CAAC;YAC/B,OAAO,EAAE,UAAU,CAAC,OAAO,GAAG,WAAW;YACzC,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,WAAW;YACvC,OAAO,EAAE,UAAU,CAAC,OAAO,GAAG,WAAW;YACzC,QAAQ,EAAE,UAAU,CAAC,QAAQ,GAAG,WAAW;SAC5C,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Akash Network Blockchain Client Module
|
|
3
|
+
*
|
|
4
|
+
* Handles all blockchain operations for Akash Network deployments including:
|
|
5
|
+
* - Signing client creation and management
|
|
6
|
+
* - Deployment creation on blockchain
|
|
7
|
+
* - Provider bid collection and filtering
|
|
8
|
+
* - Lease creation with selected providers
|
|
9
|
+
*
|
|
10
|
+
* Design Philosophy:
|
|
11
|
+
* This is a LIBRARY, not a CLI. Operations return Result types with detailed
|
|
12
|
+
* data. The caller (deployer.ts) handles progress tracking and user feedback.
|
|
13
|
+
*
|
|
14
|
+
* We use the Akash SDK types and helpers directly rather than reinventing them.
|
|
15
|
+
* The SDK is well-designed and thoroughly tested - we enhance the DX with Result
|
|
16
|
+
* types and comprehensive comments.
|
|
17
|
+
*
|
|
18
|
+
* @module targets/akash/blockchain-client
|
|
19
|
+
*/
|
|
20
|
+
import { SigningStargateClient } from '@cosmjs/stargate';
|
|
21
|
+
import { Bid, LeaseID } from '@akashnetwork/akash-api/akash/market/v1beta4';
|
|
22
|
+
import type { Result } from '../../types/index.js';
|
|
23
|
+
import type { WalletContext } from './types.js';
|
|
24
|
+
import { DeploymentError } from '../../errors/index.js';
|
|
25
|
+
import { type AkashNetwork } from './environment.js';
|
|
26
|
+
import type { EnhancedBid } from './bid-types.js';
|
|
27
|
+
/**
|
|
28
|
+
* Re-export SDK types for convenience
|
|
29
|
+
*
|
|
30
|
+
* We use the native Akash SDK types directly rather than creating
|
|
31
|
+
* custom interfaces. This ensures type compatibility with SDK functions
|
|
32
|
+
* and reduces maintenance burden when SDK updates.
|
|
33
|
+
*
|
|
34
|
+
* @example Using SDK types
|
|
35
|
+
* ```typescript
|
|
36
|
+
* import { ProviderBid, LeaseId } from './blockchain-client.js';
|
|
37
|
+
*
|
|
38
|
+
* function processBid(bid: ProviderBid) {
|
|
39
|
+
* console.log('Provider:', bid.bidId?.provider);
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export type ProviderBid = Bid;
|
|
44
|
+
export type LeaseId = LeaseID;
|
|
45
|
+
/**
|
|
46
|
+
* Signing client with account information
|
|
47
|
+
*
|
|
48
|
+
* Contains the SigningStargateClient needed for broadcasting transactions
|
|
49
|
+
* plus account information for transaction signing.
|
|
50
|
+
*/
|
|
51
|
+
export interface SigningClientContext {
|
|
52
|
+
/** Signing client for blockchain transactions */
|
|
53
|
+
client: SigningStargateClient;
|
|
54
|
+
/** Account information */
|
|
55
|
+
account: {
|
|
56
|
+
/** Account address (bech32 format) */
|
|
57
|
+
address: string;
|
|
58
|
+
/** Account public key (null if never used) */
|
|
59
|
+
pubkey: Uint8Array | null;
|
|
60
|
+
/** Unique account number */
|
|
61
|
+
accountNumber: number;
|
|
62
|
+
/** Transaction sequence (nonce) */
|
|
63
|
+
sequence: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Deployment creation result
|
|
68
|
+
*
|
|
69
|
+
* Contains the deployment sequence number (dseq) which uniquely identifies
|
|
70
|
+
* your deployment on the Akash Network, plus transaction metadata.
|
|
71
|
+
*/
|
|
72
|
+
export interface DeploymentResult {
|
|
73
|
+
/** Deployment sequence number - unique identifier for this deployment */
|
|
74
|
+
dseq: number;
|
|
75
|
+
/** Transaction hash on the blockchain */
|
|
76
|
+
transactionHash: string;
|
|
77
|
+
/** Block height where transaction was included */
|
|
78
|
+
height: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Lease creation result
|
|
82
|
+
*
|
|
83
|
+
* Contains the lease identifier and transaction metadata after successfully
|
|
84
|
+
* accepting a provider's bid.
|
|
85
|
+
*/
|
|
86
|
+
export interface LeaseResult {
|
|
87
|
+
/** Lease identifier with all coordinates */
|
|
88
|
+
leaseId: LeaseId;
|
|
89
|
+
/** Transaction hash on the blockchain */
|
|
90
|
+
transactionHash: string;
|
|
91
|
+
/** Block height where transaction was included */
|
|
92
|
+
height: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Deployment closure result
|
|
96
|
+
*
|
|
97
|
+
* Contains confirmation details after successfully closing a deployment.
|
|
98
|
+
* When a deployment is closed, all associated leases are terminated and
|
|
99
|
+
* the escrow deposit is returned to the deployment owner.
|
|
100
|
+
*/
|
|
101
|
+
export interface DeploymentCloseResult {
|
|
102
|
+
/** Deployment sequence number that was closed */
|
|
103
|
+
dseq: string;
|
|
104
|
+
/** Owner address of the deployment */
|
|
105
|
+
owner: string;
|
|
106
|
+
/** Transaction hash on the blockchain */
|
|
107
|
+
transactionHash: string;
|
|
108
|
+
/** Block height where transaction was included */
|
|
109
|
+
height: number;
|
|
110
|
+
/** Timestamp when closure was completed */
|
|
111
|
+
closedAt: Date;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* SDL (Stack Definition Language) interface
|
|
115
|
+
*
|
|
116
|
+
* Represents a parsed Akash deployment manifest. The SDL defines
|
|
117
|
+
* your application's compute resources, networking, and placement
|
|
118
|
+
* requirements.
|
|
119
|
+
*
|
|
120
|
+
* This interface describes the minimal SDL operations needed by
|
|
121
|
+
* the blockchain client. The actual SDL parsing and validation
|
|
122
|
+
* is handled by @akashnetwork/akashjs.
|
|
123
|
+
*
|
|
124
|
+
* **The SDK handles all validation:**
|
|
125
|
+
* - Resource requirement validation
|
|
126
|
+
* - Service configuration validation
|
|
127
|
+
* - Network configuration validation
|
|
128
|
+
* - Pricing validation
|
|
129
|
+
*
|
|
130
|
+
* You get back properly-structured deployment groups ready for blockchain.
|
|
131
|
+
*
|
|
132
|
+
* @see https://akash.network/docs/guides/sdl
|
|
133
|
+
*
|
|
134
|
+
* @example Using SDL
|
|
135
|
+
* ```typescript
|
|
136
|
+
* import { SDL } from '@akashnetwork/akashjs/build/sdl';
|
|
137
|
+
*
|
|
138
|
+
* const sdl = SDL.fromString(yamlContent, 'beta3');
|
|
139
|
+
* const groups = sdl.groups(); // Already validated and structured!
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export interface SDL {
|
|
143
|
+
/**
|
|
144
|
+
* Get deployment groups from SDL
|
|
145
|
+
*
|
|
146
|
+
* Groups organize services with similar resource requirements.
|
|
147
|
+
* Each group becomes a separate order on the marketplace.
|
|
148
|
+
*
|
|
149
|
+
* The SDK returns these already validated and in the correct
|
|
150
|
+
* protobuf structure for MsgCreateDeployment.
|
|
151
|
+
*
|
|
152
|
+
* @returns Array of deployment group specifications
|
|
153
|
+
*/
|
|
154
|
+
groups(): unknown[];
|
|
155
|
+
/**
|
|
156
|
+
* Calculate manifest version hash
|
|
157
|
+
*
|
|
158
|
+
* The manifest version is a SHA-256 hash of your deployment configuration.
|
|
159
|
+
* Providers use this to verify they're running the correct manifest.
|
|
160
|
+
*
|
|
161
|
+
* This hash changes whenever you update your deployment configuration,
|
|
162
|
+
* ensuring providers always run the latest version.
|
|
163
|
+
*
|
|
164
|
+
* @returns Uint8Array containing SHA256 hash of manifest
|
|
165
|
+
*/
|
|
166
|
+
manifestVersion(): Promise<Uint8Array>;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Create a signing client for Akash blockchain operations
|
|
170
|
+
*
|
|
171
|
+
* Creates a SigningStargateClient configured with Akash-specific message
|
|
172
|
+
* types. This client is used for all blockchain transactions including
|
|
173
|
+
* deployment creation, lease creation, and certificate broadcasting.
|
|
174
|
+
*
|
|
175
|
+
* **Why you need this:**
|
|
176
|
+
* The Akash blockchain uses custom message types (MsgCreateDeployment,
|
|
177
|
+
* MsgCreateLease, etc.) that aren't in the standard Cosmos SDK. We need
|
|
178
|
+
* to register these types so the client can encode/decode them correctly.
|
|
179
|
+
*
|
|
180
|
+
* **What you get:**
|
|
181
|
+
* - A signing client connected to Akash RPC
|
|
182
|
+
* - Account information for transaction signing
|
|
183
|
+
* - Ability to broadcast any Akash transaction
|
|
184
|
+
*
|
|
185
|
+
* @param wallet - Wallet context with offline signer
|
|
186
|
+
* @param network - Akash network to connect to
|
|
187
|
+
* @returns Result with signing client and account info
|
|
188
|
+
*
|
|
189
|
+
* @example Basic usage
|
|
190
|
+
* ```typescript
|
|
191
|
+
* const clientResult = await createSigningClient(wallet, 'mainnet');
|
|
192
|
+
* if (!clientResult.success) {
|
|
193
|
+
* console.error('Failed to create client:', clientResult.error.message);
|
|
194
|
+
* return;
|
|
195
|
+
* }
|
|
196
|
+
*
|
|
197
|
+
* const { client, account } = clientResult.data;
|
|
198
|
+
* console.log('Connected with address:', account.address);
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* @example Error handling
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const result = await createSigningClient(wallet, 'testnet');
|
|
204
|
+
* if (!result.success) {
|
|
205
|
+
* if (result.error.code === 'WALLET_ERROR') {
|
|
206
|
+
* console.error('Wallet issue - check connection');
|
|
207
|
+
* } else if (result.error.code === 'RPC_ERROR') {
|
|
208
|
+
* console.error('Network issue - try different RPC endpoint');
|
|
209
|
+
* }
|
|
210
|
+
* return;
|
|
211
|
+
* }
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
export declare function createSigningClient(wallet: WalletContext, network: AkashNetwork): Promise<Result<SigningClientContext, DeploymentError>>;
|
|
215
|
+
/**
|
|
216
|
+
* Create a new Akash deployment on the blockchain
|
|
217
|
+
*
|
|
218
|
+
* Broadcasts a MsgCreateDeployment transaction that registers your application
|
|
219
|
+
* with the Akash marketplace. Providers will see this deployment and submit bids.
|
|
220
|
+
*
|
|
221
|
+
* **The deployment process:**
|
|
222
|
+
* 1. Your deployment gets a unique identifier (dseq = deployment sequence)
|
|
223
|
+
* 2. Deployment is posted to the blockchain with resource requirements
|
|
224
|
+
* 3. An escrow deposit is held (default 5 AKT, returned when you close)
|
|
225
|
+
* 4. Providers see your deployment and submit competitive bids
|
|
226
|
+
* 5. You choose a bid and create a lease
|
|
227
|
+
*
|
|
228
|
+
* **Escrow Deposit:**
|
|
229
|
+
* The deposit ensures you can pay for resources. It's returned when you
|
|
230
|
+
* close the deployment. Default is 5 AKT but you can customize it.
|
|
231
|
+
*
|
|
232
|
+
* **About dseq:**
|
|
233
|
+
* The deployment sequence number (dseq) is taken from the current block
|
|
234
|
+
* height, ensuring it's unique and monotonically increasing.
|
|
235
|
+
*
|
|
236
|
+
* @param clientContext - Signing client and account info
|
|
237
|
+
* @param wallet - Wallet context with address
|
|
238
|
+
* @param sdl - SDL object with deployment configuration
|
|
239
|
+
* @param depositAkt - Optional deposit amount in AKT (default: 5)
|
|
240
|
+
* @returns Result with deployment sequence number and transaction info
|
|
241
|
+
*
|
|
242
|
+
* @example Basic deployment
|
|
243
|
+
* ```typescript
|
|
244
|
+
* import { SDL } from '@akashnetwork/akashjs/build/sdl';
|
|
245
|
+
*
|
|
246
|
+
* // Parse SDL from YAML
|
|
247
|
+
* const sdl = SDL.fromString(yamlContent, 'beta3');
|
|
248
|
+
*
|
|
249
|
+
* // Create signing client
|
|
250
|
+
* const clientResult = await createSigningClient(wallet, 'mainnet');
|
|
251
|
+
* if (!clientResult.success) return clientResult;
|
|
252
|
+
*
|
|
253
|
+
* // Deploy with default 5 AKT deposit
|
|
254
|
+
* const deployResult = await createDeployment(
|
|
255
|
+
* clientResult.data,
|
|
256
|
+
* wallet,
|
|
257
|
+
* sdl
|
|
258
|
+
* );
|
|
259
|
+
*
|
|
260
|
+
* if (deployResult.success) {
|
|
261
|
+
* console.log('Deployment created!');
|
|
262
|
+
* console.log('DSEQ:', deployResult.data.dseq);
|
|
263
|
+
* console.log('TX:', deployResult.data.transactionHash);
|
|
264
|
+
* }
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* @example Custom deposit
|
|
268
|
+
* ```typescript
|
|
269
|
+
* // Deploy with 10 AKT deposit for larger deployments
|
|
270
|
+
* const result = await createDeployment(
|
|
271
|
+
* clientContext,
|
|
272
|
+
* wallet,
|
|
273
|
+
* sdl,
|
|
274
|
+
* 10 // 10 AKT deposit
|
|
275
|
+
* );
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
export declare function createDeployment(clientContext: SigningClientContext, wallet: WalletContext, sdl: SDL, depositAkt?: number): Promise<Result<DeploymentResult, DeploymentError>>;
|
|
279
|
+
/**
|
|
280
|
+
* Query provider bids for a deployment with enhanced information
|
|
281
|
+
*
|
|
282
|
+
* Queries the Akash marketplace for provider bids and enriches each bid with:
|
|
283
|
+
* - Complete provider information (name, location, audit status)
|
|
284
|
+
* - Reliability metrics (uptime percentages)
|
|
285
|
+
* - Pre-calculated pricing for all time periods (hour, day, week, month)
|
|
286
|
+
*
|
|
287
|
+
* Returns ALL valid bids so the caller can implement custom selection logic.
|
|
288
|
+
*
|
|
289
|
+
* **The Akash Bidding Process:**
|
|
290
|
+
* After you create a deployment, here's what happens:
|
|
291
|
+
* 1. Providers monitor the blockchain for new deployments
|
|
292
|
+
* 2. They check if they can fulfill your resource requirements
|
|
293
|
+
* 3. They submit competitive bids with their pricing
|
|
294
|
+
* 4. You query to see available bids (this function)
|
|
295
|
+
* 5. You choose the best bid based on your criteria
|
|
296
|
+
* 6. You create a lease with the selected provider
|
|
297
|
+
*
|
|
298
|
+
* **Bid Filtering:**
|
|
299
|
+
* We automatically exclude:
|
|
300
|
+
* - Blacklisted providers (known to be unreliable)
|
|
301
|
+
* - Custom blacklist from your deployment configuration
|
|
302
|
+
* - Bids without valid provider addresses
|
|
303
|
+
*
|
|
304
|
+
* **Note:** This returns immediately with current state. Use `waitForBids()`
|
|
305
|
+
* if you want to poll until bids arrive.
|
|
306
|
+
*
|
|
307
|
+
* @param wallet - Wallet context with owner address
|
|
308
|
+
* @param network - Akash network to query
|
|
309
|
+
* @param dseq - Deployment sequence number
|
|
310
|
+
* @param options - Optional query options
|
|
311
|
+
* @param options.customBlacklist - Additional provider addresses to exclude
|
|
312
|
+
* @param options.includeOffline - Include offline providers (default: false)
|
|
313
|
+
* @returns Result with array of enhanced bids (empty array if none found)
|
|
314
|
+
*
|
|
315
|
+
* @example Query and display bids
|
|
316
|
+
* ```typescript
|
|
317
|
+
* const result = await queryBids(wallet, 'mainnet', dseq);
|
|
318
|
+
*
|
|
319
|
+
* if (result.success) {
|
|
320
|
+
* console.log(`Received ${result.data.length} bids`);
|
|
321
|
+
* for (const bid of result.data) {
|
|
322
|
+
* const provider = bid.provider;
|
|
323
|
+
* const uptime = provider.reliability?.uptime7d;
|
|
324
|
+
* console.log(`
|
|
325
|
+
* Provider: ${provider.name || provider.owner}
|
|
326
|
+
* Price: ${bid.pricing.akt.perMonth.toFixed(2)} AKT/month
|
|
327
|
+
* Uptime (7d): ${uptime ? (uptime * 100).toFixed(1) + '%' : 'Unknown'}
|
|
328
|
+
* Location: ${provider.location?.country || 'Unknown'}
|
|
329
|
+
* `);
|
|
330
|
+
* }
|
|
331
|
+
* }
|
|
332
|
+
* ```
|
|
333
|
+
*
|
|
334
|
+
* @example With filtering options
|
|
335
|
+
* ```typescript
|
|
336
|
+
* const blacklist = ['akash1badprovider...', 'akash1another...'];
|
|
337
|
+
* const result = await queryBids(wallet, 'mainnet', dseq, {
|
|
338
|
+
* customBlacklist: blacklist,
|
|
339
|
+
* includeOffline: false
|
|
340
|
+
* });
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
export declare function queryBids(wallet: WalletContext, network: AkashNetwork, dseq: number, options?: {
|
|
344
|
+
readonly customBlacklist?: string[];
|
|
345
|
+
readonly includeOffline?: boolean;
|
|
346
|
+
}): Promise<Result<EnhancedBid[], DeploymentError>>;
|
|
347
|
+
/**
|
|
348
|
+
* Wait for provider bids with polling
|
|
349
|
+
*
|
|
350
|
+
* Polls the marketplace for provider bids until at least one valid bid is received
|
|
351
|
+
* or timeout is reached. This is a convenience wrapper around `queryBids()` that
|
|
352
|
+
* handles the polling logic for you.
|
|
353
|
+
*
|
|
354
|
+
* Returns ALL enhanced bids received, allowing the caller to implement custom
|
|
355
|
+
* selection logic based on price, reliability, location, or other criteria.
|
|
356
|
+
*
|
|
357
|
+
* **Why this is useful:**
|
|
358
|
+
* After creating a deployment, providers need time to:
|
|
359
|
+
* 1. See your deployment on the blockchain
|
|
360
|
+
* 2. Check if they can fulfill requirements
|
|
361
|
+
* 3. Calculate pricing
|
|
362
|
+
* 4. Submit their bid
|
|
363
|
+
*
|
|
364
|
+
* This usually takes 30-60 seconds. This function handles the wait for you.
|
|
365
|
+
*
|
|
366
|
+
* **Polling Strategy:**
|
|
367
|
+
* - Poll interval: 5 seconds (reasonable for network latency)
|
|
368
|
+
* - Default timeout: 5 minutes (enough for providers to respond)
|
|
369
|
+
* - Returns immediately when at least one bid is found
|
|
370
|
+
* - Returns all errors from query operation
|
|
371
|
+
*
|
|
372
|
+
* @param wallet - Wallet context with owner address
|
|
373
|
+
* @param network - Akash network to query
|
|
374
|
+
* @param dseq - Deployment sequence number
|
|
375
|
+
* @param options - Optional query and polling options
|
|
376
|
+
* @param options.customBlacklist - Provider addresses to exclude
|
|
377
|
+
* @param options.includeOffline - Include offline providers (default: false)
|
|
378
|
+
* @param options.timeoutMs - Timeout in milliseconds (default: 300000 = 5 min)
|
|
379
|
+
* @returns Result with array of enhanced bids or timeout error
|
|
380
|
+
*
|
|
381
|
+
* @example Wait for bids and display
|
|
382
|
+
* ```typescript
|
|
383
|
+
* console.log('Waiting for provider bids...');
|
|
384
|
+
*
|
|
385
|
+
* const result = await waitForBids(wallet, 'mainnet', dseq);
|
|
386
|
+
*
|
|
387
|
+
* if (result.success) {
|
|
388
|
+
* console.log(`Received ${result.data.length} bids!`);
|
|
389
|
+
* for (const bid of result.data) {
|
|
390
|
+
* console.log(`Provider: ${bid.provider.name || bid.provider.owner}`);
|
|
391
|
+
* console.log(`Price: ${bid.pricing.akt.perMonth} AKT/month`);
|
|
392
|
+
* }
|
|
393
|
+
* } else {
|
|
394
|
+
* if (result.error.code === 'TIMEOUT') {
|
|
395
|
+
* console.error('No bids received within timeout');
|
|
396
|
+
* console.log('Try increasing deployment resources or deposit');
|
|
397
|
+
* } else {
|
|
398
|
+
* console.error('Query failed:', result.error.message);
|
|
399
|
+
* }
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*
|
|
403
|
+
* @example Custom timeout and options
|
|
404
|
+
* ```typescript
|
|
405
|
+
* // Wait up to 10 minutes, excluding specific providers
|
|
406
|
+
* const result = await waitForBids(wallet, 'mainnet', dseq, {
|
|
407
|
+
* customBlacklist: ['akash1bad...', 'akash1another...'],
|
|
408
|
+
* includeOffline: false,
|
|
409
|
+
* timeoutMs: 600000 // 10 minutes
|
|
410
|
+
* });
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
export declare function waitForBids(wallet: WalletContext, network: AkashNetwork, dseq: number, options?: {
|
|
414
|
+
readonly customBlacklist?: string[];
|
|
415
|
+
readonly includeOffline?: boolean;
|
|
416
|
+
readonly timeoutMs?: number;
|
|
417
|
+
}): Promise<Result<EnhancedBid[], DeploymentError>>;
|
|
418
|
+
/**
|
|
419
|
+
* Create a lease by accepting a provider bid
|
|
420
|
+
*
|
|
421
|
+
* Broadcasts a MsgCreateLease transaction to accept a provider's bid and
|
|
422
|
+
* establish a lease. This commits the deployment to the selected provider
|
|
423
|
+
* and allows them to start running your containers.
|
|
424
|
+
*
|
|
425
|
+
* **What happens when you create a lease:**
|
|
426
|
+
* 1. You accept a specific provider's bid
|
|
427
|
+
* 2. A lease is created on the blockchain
|
|
428
|
+
* 3. The provider is notified of the accepted bid
|
|
429
|
+
* 4. The provider prepares to receive your manifest
|
|
430
|
+
* 5. You send the manifest (deployment details) to the provider
|
|
431
|
+
* 6. The provider starts your containers
|
|
432
|
+
*
|
|
433
|
+
* **Important:** After creating the lease, you MUST send the manifest
|
|
434
|
+
* to the provider within a reasonable time, or they may close the lease.
|
|
435
|
+
*
|
|
436
|
+
* @param clientContext - Signing client and account info
|
|
437
|
+
* @param bid - Provider bid to accept
|
|
438
|
+
* @returns Result with lease identifier and transaction info
|
|
439
|
+
*
|
|
440
|
+
* @example Accept bid and create lease
|
|
441
|
+
* ```typescript
|
|
442
|
+
* // Wait for bids
|
|
443
|
+
* const bidResult = await waitForBids(wallet, 'mainnet', dseq);
|
|
444
|
+
* if (!bidResult.success) return bidResult;
|
|
445
|
+
*
|
|
446
|
+
* // Accept the bid by creating a lease
|
|
447
|
+
* const leaseResult = await createLease(clientContext, bidResult.data);
|
|
448
|
+
*
|
|
449
|
+
* if (leaseResult.success) {
|
|
450
|
+
* const lease = leaseResult.data.leaseId;
|
|
451
|
+
* console.log('Lease created!');
|
|
452
|
+
* console.log('DSEQ:', lease.dseq);
|
|
453
|
+
* console.log('Provider:', lease.provider);
|
|
454
|
+
* console.log('TX:', leaseResult.data.transactionHash);
|
|
455
|
+
*
|
|
456
|
+
* // Next step: send manifest to provider
|
|
457
|
+
* await sendManifest(lease, manifest, certificate);
|
|
458
|
+
* }
|
|
459
|
+
* ```
|
|
460
|
+
*
|
|
461
|
+
* @example Error handling
|
|
462
|
+
* ```typescript
|
|
463
|
+
* const result = await createLease(clientContext, bid);
|
|
464
|
+
* if (!result.success) {
|
|
465
|
+
* if (result.error.code === 'TRANSACTION_FAILED') {
|
|
466
|
+
* console.error('Transaction failed:', result.error.context.rawLog);
|
|
467
|
+
* console.log('Common causes: insufficient funds, bid expired');
|
|
468
|
+
* }
|
|
469
|
+
* }
|
|
470
|
+
* ```
|
|
471
|
+
*/
|
|
472
|
+
export declare function createLease(clientContext: SigningClientContext, bid: ProviderBid): Promise<Result<LeaseResult, DeploymentError>>;
|
|
473
|
+
/**
|
|
474
|
+
* Close an active Akash deployment
|
|
475
|
+
*
|
|
476
|
+
* Broadcasts a MsgCloseDeployment transaction that terminates all leases
|
|
477
|
+
* associated with the deployment and returns the escrow deposit to the owner.
|
|
478
|
+
*
|
|
479
|
+
* **What happens when you close a deployment:**
|
|
480
|
+
* 1. All active leases for this deployment are terminated
|
|
481
|
+
* 2. Providers stop running your containers
|
|
482
|
+
* 3. The escrow deposit (typically 5 AKT) is returned to your wallet
|
|
483
|
+
* 4. The deployment is marked as closed on the blockchain
|
|
484
|
+
*
|
|
485
|
+
* **When to close a deployment:**
|
|
486
|
+
* - When you're done with the deployment and want to stop paying
|
|
487
|
+
* - When migrating to a different provider or configuration
|
|
488
|
+
* - When cleaning up test/development deployments
|
|
489
|
+
* - Before wallet maintenance (to recover locked funds)
|
|
490
|
+
*
|
|
491
|
+
* **Important Notes:**
|
|
492
|
+
* - You can only close deployments you own
|
|
493
|
+
* - Closed deployments cannot be reopened (create a new deployment instead)
|
|
494
|
+
* - Always close deployments when done to avoid ongoing charges
|
|
495
|
+
* - The escrow deposit is returned immediately upon closure
|
|
496
|
+
*
|
|
497
|
+
* @param clientContext - Signing client and account info
|
|
498
|
+
* @param wallet - Wallet context (must be deployment owner)
|
|
499
|
+
* @param dseq - Deployment sequence number to close
|
|
500
|
+
* @returns Result with closure confirmation or error
|
|
501
|
+
*
|
|
502
|
+
* @example Close a deployment
|
|
503
|
+
* ```typescript
|
|
504
|
+
* import { closeDeployment, createSigningClient } from 'deploy-ability/akash';
|
|
505
|
+
*
|
|
506
|
+
* // Create signing client
|
|
507
|
+
* const clientResult = await createSigningClient(wallet, 'mainnet');
|
|
508
|
+
* if (!clientResult.success) {
|
|
509
|
+
* console.error('Failed to create client:', clientResult.error.message);
|
|
510
|
+
* return;
|
|
511
|
+
* }
|
|
512
|
+
*
|
|
513
|
+
* // Close the deployment
|
|
514
|
+
* const result = await closeDeployment(
|
|
515
|
+
* clientResult.data,
|
|
516
|
+
* wallet,
|
|
517
|
+
* 1234567 // DSEQ from deployment
|
|
518
|
+
* );
|
|
519
|
+
*
|
|
520
|
+
* if (result.success) {
|
|
521
|
+
* console.log('Deployment closed successfully!');
|
|
522
|
+
* console.log('DSEQ:', result.data.dseq);
|
|
523
|
+
* console.log('TX:', result.data.transactionHash);
|
|
524
|
+
* console.log('Deposit returned to:', result.data.owner);
|
|
525
|
+
* } else {
|
|
526
|
+
* console.error('Failed to close:', result.error.message);
|
|
527
|
+
* }
|
|
528
|
+
* ```
|
|
529
|
+
*
|
|
530
|
+
* @example Close with error handling
|
|
531
|
+
* ```typescript
|
|
532
|
+
* const result = await closeDeployment(clientContext, wallet, dseq);
|
|
533
|
+
*
|
|
534
|
+
* if (!result.success) {
|
|
535
|
+
* if (result.error.code === 'TRANSACTION_FAILED') {
|
|
536
|
+
* console.error('Transaction failed:', result.error.context.rawLog);
|
|
537
|
+
* // Common causes:
|
|
538
|
+
* // - Not the deployment owner
|
|
539
|
+
* // - Deployment already closed
|
|
540
|
+
* // - Insufficient funds for transaction fee
|
|
541
|
+
* } else if (result.error.code === 'WALLET_ERROR') {
|
|
542
|
+
* console.error('Wallet issue - check connection');
|
|
543
|
+
* }
|
|
544
|
+
* }
|
|
545
|
+
* ```
|
|
546
|
+
*
|
|
547
|
+
* @example Complete deployment lifecycle
|
|
548
|
+
* ```typescript
|
|
549
|
+
* // Deploy
|
|
550
|
+
* const deployment = await deployToAkash({
|
|
551
|
+
* wallet,
|
|
552
|
+
* certificate,
|
|
553
|
+
* projectRoot: './',
|
|
554
|
+
* profile: 'dev',
|
|
555
|
+
* bidSelector: selectCheapestBid
|
|
556
|
+
* });
|
|
557
|
+
*
|
|
558
|
+
* if (deployment.success) {
|
|
559
|
+
* console.log('Deployed with DSEQ:', deployment.data.dseq);
|
|
560
|
+
*
|
|
561
|
+
* // ... use the deployment ...
|
|
562
|
+
*
|
|
563
|
+
* // Close when done
|
|
564
|
+
* const close = await closeDeployment(
|
|
565
|
+
* clientContext,
|
|
566
|
+
* wallet,
|
|
567
|
+
* deployment.data.dseq
|
|
568
|
+
* );
|
|
569
|
+
*
|
|
570
|
+
* if (close.success) {
|
|
571
|
+
* console.log('Cleaned up successfully');
|
|
572
|
+
* }
|
|
573
|
+
* }
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
576
|
+
export declare function closeDeployment(clientContext: SigningClientContext, wallet: WalletContext, dseq: number | string): Promise<Result<DeploymentCloseResult, DeploymentError>>;
|
|
577
|
+
//# sourceMappingURL=blockchain-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockchain-client.d.ts","sourceRoot":"","sources":["../../../src/targets/akash/blockchain-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,OAAO,EAKL,GAAG,EACH,OAAO,EACR,MAAM,8CAA8C,CAAC;AAMtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAoB,KAAK,YAAY,EAAyB,MAAM,kBAAkB,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC;AAC9B,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,MAAM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