@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.
Files changed (198) hide show
  1. package/README.md +523 -0
  2. package/dist/constants.d.ts +82 -0
  3. package/dist/constants.d.ts.map +1 -0
  4. package/dist/constants.js +82 -0
  5. package/dist/constants.js.map +1 -0
  6. package/dist/errors/certificate-error.d.ts +95 -0
  7. package/dist/errors/certificate-error.d.ts.map +1 -0
  8. package/dist/errors/certificate-error.js +111 -0
  9. package/dist/errors/certificate-error.js.map +1 -0
  10. package/dist/errors/deployment-error.d.ts +122 -0
  11. package/dist/errors/deployment-error.d.ts.map +1 -0
  12. package/dist/errors/deployment-error.js +185 -0
  13. package/dist/errors/deployment-error.js.map +1 -0
  14. package/dist/errors/index.d.ts +13 -0
  15. package/dist/errors/index.d.ts.map +1 -0
  16. package/dist/errors/index.js +18 -0
  17. package/dist/errors/index.js.map +1 -0
  18. package/dist/errors/profile-error.d.ts +106 -0
  19. package/dist/errors/profile-error.d.ts.map +1 -0
  20. package/dist/errors/profile-error.js +127 -0
  21. package/dist/errors/profile-error.js.map +1 -0
  22. package/dist/errors/provider-error.d.ts +104 -0
  23. package/dist/errors/provider-error.d.ts.map +1 -0
  24. package/dist/errors/provider-error.js +120 -0
  25. package/dist/errors/provider-error.js.map +1 -0
  26. package/dist/errors/wallet-error.d.ts +131 -0
  27. package/dist/errors/wallet-error.d.ts.map +1 -0
  28. package/dist/errors/wallet-error.js +154 -0
  29. package/dist/errors/wallet-error.js.map +1 -0
  30. package/dist/index.d.ts +49 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +53 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/targets/akash/bid-selectors.d.ts +251 -0
  35. package/dist/targets/akash/bid-selectors.d.ts.map +1 -0
  36. package/dist/targets/akash/bid-selectors.js +322 -0
  37. package/dist/targets/akash/bid-selectors.js.map +1 -0
  38. package/dist/targets/akash/bid-types.d.ts +297 -0
  39. package/dist/targets/akash/bid-types.d.ts.map +1 -0
  40. package/dist/targets/akash/bid-types.js +89 -0
  41. package/dist/targets/akash/bid-types.js.map +1 -0
  42. package/dist/targets/akash/blockchain-client.d.ts +577 -0
  43. package/dist/targets/akash/blockchain-client.d.ts.map +1 -0
  44. package/dist/targets/akash/blockchain-client.js +803 -0
  45. package/dist/targets/akash/blockchain-client.js.map +1 -0
  46. package/dist/targets/akash/certificate-manager.d.ts +228 -0
  47. package/dist/targets/akash/certificate-manager.d.ts.map +1 -0
  48. package/dist/targets/akash/certificate-manager.js +395 -0
  49. package/dist/targets/akash/certificate-manager.js.map +1 -0
  50. package/dist/targets/akash/constants.d.ts +231 -0
  51. package/dist/targets/akash/constants.d.ts.map +1 -0
  52. package/dist/targets/akash/constants.js +225 -0
  53. package/dist/targets/akash/constants.js.map +1 -0
  54. package/dist/targets/akash/deployer.d.ts +136 -0
  55. package/dist/targets/akash/deployer.d.ts.map +1 -0
  56. package/dist/targets/akash/deployer.js +599 -0
  57. package/dist/targets/akash/deployer.js.map +1 -0
  58. package/dist/targets/akash/environment.d.ts +241 -0
  59. package/dist/targets/akash/environment.d.ts.map +1 -0
  60. package/dist/targets/akash/environment.js +245 -0
  61. package/dist/targets/akash/environment.js.map +1 -0
  62. package/dist/targets/akash/index.d.ts +1113 -0
  63. package/dist/targets/akash/index.d.ts.map +1 -0
  64. package/dist/targets/akash/index.js +909 -0
  65. package/dist/targets/akash/index.js.map +1 -0
  66. package/dist/targets/akash/lease-monitor.d.ts +51 -0
  67. package/dist/targets/akash/lease-monitor.d.ts.map +1 -0
  68. package/dist/targets/akash/lease-monitor.js +110 -0
  69. package/dist/targets/akash/lease-monitor.js.map +1 -0
  70. package/dist/targets/akash/logs.d.ts +71 -0
  71. package/dist/targets/akash/logs.d.ts.map +1 -0
  72. package/dist/targets/akash/logs.js +311 -0
  73. package/dist/targets/akash/logs.js.map +1 -0
  74. package/dist/targets/akash/logs.types.d.ts +102 -0
  75. package/dist/targets/akash/logs.types.d.ts.map +1 -0
  76. package/dist/targets/akash/logs.types.js +9 -0
  77. package/dist/targets/akash/logs.types.js.map +1 -0
  78. package/dist/targets/akash/pricing.d.ts +247 -0
  79. package/dist/targets/akash/pricing.d.ts.map +1 -0
  80. package/dist/targets/akash/pricing.js +246 -0
  81. package/dist/targets/akash/pricing.js.map +1 -0
  82. package/dist/targets/akash/provider-client.d.ts +114 -0
  83. package/dist/targets/akash/provider-client.d.ts.map +1 -0
  84. package/dist/targets/akash/provider-client.js +318 -0
  85. package/dist/targets/akash/provider-client.js.map +1 -0
  86. package/dist/targets/akash/provider-metadata.d.ts +228 -0
  87. package/dist/targets/akash/provider-metadata.d.ts.map +1 -0
  88. package/dist/targets/akash/provider-metadata.js +14 -0
  89. package/dist/targets/akash/provider-metadata.js.map +1 -0
  90. package/dist/targets/akash/provider-service.d.ts +133 -0
  91. package/dist/targets/akash/provider-service.d.ts.map +1 -0
  92. package/dist/targets/akash/provider-service.js +391 -0
  93. package/dist/targets/akash/provider-service.js.map +1 -0
  94. package/dist/targets/akash/query-client.d.ts +125 -0
  95. package/dist/targets/akash/query-client.d.ts.map +1 -0
  96. package/dist/targets/akash/query-client.js +332 -0
  97. package/dist/targets/akash/query-client.js.map +1 -0
  98. package/dist/targets/akash/sdl-generator.d.ts +31 -0
  99. package/dist/targets/akash/sdl-generator.d.ts.map +1 -0
  100. package/dist/targets/akash/sdl-generator.js +279 -0
  101. package/dist/targets/akash/sdl-generator.js.map +1 -0
  102. package/dist/targets/akash/types.d.ts +285 -0
  103. package/dist/targets/akash/types.d.ts.map +1 -0
  104. package/dist/targets/akash/types.js +54 -0
  105. package/dist/targets/akash/types.js.map +1 -0
  106. package/dist/targets/akash/wallet-manager.d.ts +526 -0
  107. package/dist/targets/akash/wallet-manager.d.ts.map +1 -0
  108. package/dist/targets/akash/wallet-manager.js +953 -0
  109. package/dist/targets/akash/wallet-manager.js.map +1 -0
  110. package/dist/targets/local/compose-generator.d.ts +244 -0
  111. package/dist/targets/local/compose-generator.d.ts.map +1 -0
  112. package/dist/targets/local/compose-generator.js +324 -0
  113. package/dist/targets/local/compose-generator.js.map +1 -0
  114. package/dist/targets/local/deployer.d.ts +82 -0
  115. package/dist/targets/local/deployer.d.ts.map +1 -0
  116. package/dist/targets/local/deployer.js +367 -0
  117. package/dist/targets/local/deployer.js.map +1 -0
  118. package/dist/targets/local/engine-manager.d.ts +155 -0
  119. package/dist/targets/local/engine-manager.d.ts.map +1 -0
  120. package/dist/targets/local/engine-manager.js +250 -0
  121. package/dist/targets/local/engine-manager.js.map +1 -0
  122. package/dist/targets/local/index.d.ts +40 -0
  123. package/dist/targets/local/index.d.ts.map +1 -0
  124. package/dist/targets/local/index.js +43 -0
  125. package/dist/targets/local/index.js.map +1 -0
  126. package/dist/targets/local/network-manager.d.ts +160 -0
  127. package/dist/targets/local/network-manager.d.ts.map +1 -0
  128. package/dist/targets/local/network-manager.js +337 -0
  129. package/dist/targets/local/network-manager.js.map +1 -0
  130. package/dist/targets/local/types.d.ts +327 -0
  131. package/dist/targets/local/types.d.ts.map +1 -0
  132. package/dist/targets/local/types.js +9 -0
  133. package/dist/targets/local/types.js.map +1 -0
  134. package/dist/types/common.d.ts +585 -0
  135. package/dist/types/common.d.ts.map +1 -0
  136. package/dist/types/common.js +13 -0
  137. package/dist/types/common.js.map +1 -0
  138. package/dist/types/index.d.ts +15 -0
  139. package/dist/types/index.d.ts.map +1 -0
  140. package/dist/types/index.js +12 -0
  141. package/dist/types/index.js.map +1 -0
  142. package/dist/types/options.d.ts +329 -0
  143. package/dist/types/options.d.ts.map +1 -0
  144. package/dist/types/options.js +10 -0
  145. package/dist/types/options.js.map +1 -0
  146. package/dist/types/profiles.d.ts +329 -0
  147. package/dist/types/profiles.d.ts.map +1 -0
  148. package/dist/types/profiles.js +27 -0
  149. package/dist/types/profiles.js.map +1 -0
  150. package/dist/types/results.d.ts +443 -0
  151. package/dist/types/results.d.ts.map +1 -0
  152. package/dist/types/results.js +64 -0
  153. package/dist/types/results.js.map +1 -0
  154. package/dist/types/validators.d.ts +118 -0
  155. package/dist/types/validators.d.ts.map +1 -0
  156. package/dist/types/validators.js +198 -0
  157. package/dist/types/validators.js.map +1 -0
  158. package/dist/utils/command-runner.d.ts +128 -0
  159. package/dist/utils/command-runner.d.ts.map +1 -0
  160. package/dist/utils/command-runner.js +210 -0
  161. package/dist/utils/command-runner.js.map +1 -0
  162. package/dist/utils/index.d.ts +10 -0
  163. package/dist/utils/index.d.ts.map +1 -0
  164. package/dist/utils/index.js +10 -0
  165. package/dist/utils/index.js.map +1 -0
  166. package/dist/utils/logger.d.ts +68 -0
  167. package/dist/utils/logger.d.ts.map +1 -0
  168. package/dist/utils/logger.js +93 -0
  169. package/dist/utils/logger.js.map +1 -0
  170. package/dist/utils/profile-loader.d.ts +76 -0
  171. package/dist/utils/profile-loader.d.ts.map +1 -0
  172. package/dist/utils/profile-loader.js +194 -0
  173. package/dist/utils/profile-loader.js.map +1 -0
  174. package/dist/utils/registry/index.d.ts +27 -0
  175. package/dist/utils/registry/index.d.ts.map +1 -0
  176. package/dist/utils/registry/index.js +29 -0
  177. package/dist/utils/registry/index.js.map +1 -0
  178. package/dist/utils/registry/manager.d.ts +319 -0
  179. package/dist/utils/registry/manager.d.ts.map +1 -0
  180. package/dist/utils/registry/manager.js +671 -0
  181. package/dist/utils/registry/manager.js.map +1 -0
  182. package/dist/utils/registry/setup.d.ts +135 -0
  183. package/dist/utils/registry/setup.d.ts.map +1 -0
  184. package/dist/utils/registry/setup.js +207 -0
  185. package/dist/utils/registry/setup.js.map +1 -0
  186. package/dist/utils/registry/transformer.d.ts +92 -0
  187. package/dist/utils/registry/transformer.d.ts.map +1 -0
  188. package/dist/utils/registry/transformer.js +131 -0
  189. package/dist/utils/registry/transformer.js.map +1 -0
  190. package/dist/utils/registry/types.d.ts +241 -0
  191. package/dist/utils/registry/types.d.ts.map +1 -0
  192. package/dist/utils/registry/types.js +10 -0
  193. package/dist/utils/registry/types.js.map +1 -0
  194. package/docs/EXAMPLES.md +293 -0
  195. package/docs/PLACEMENT.md +433 -0
  196. package/docs/STORAGE.md +318 -0
  197. package/docs/building-provider-reliability-tracker.md +2581 -0
  198. package/package.json +109 -0
@@ -0,0 +1,279 @@
1
+ /**
2
+ * Akash SDL Generator
3
+ *
4
+ * Transforms a loaded Akash deployment profile into an SDL (Stack Definition
5
+ * Language) document that can be submitted to the Akash blockchain and
6
+ * providers. The generator mirrors the logic from the legacy kadi-deploy
7
+ * implementation, but is rewritten for clarity and type safety.
8
+ *
9
+ * @module targets/akash/sdl-generator
10
+ */
11
+ import yaml from 'js-yaml';
12
+ import { SDL } from '@akashnetwork/akashjs/build/sdl/index.js';
13
+ /**
14
+ * Generates Akash SDL YAML string from a loaded deployment profile.
15
+ */
16
+ export function generateAkashSdl(loadedProfile, options = {}) {
17
+ const defaults = {
18
+ defaultCpuUnits: 0.5,
19
+ defaultMemorySize: '512Mi',
20
+ defaultStorageSize: '1Gi',
21
+ defaultPricingDenom: 'uakt',
22
+ defaultPricingAmount: 1000,
23
+ ...options,
24
+ };
25
+ const services = {};
26
+ const computeProfiles = {};
27
+ // Build placement profile with attributes and signedBy from profile
28
+ const akashProfile = loadedProfile.profile;
29
+ // Merge placement attributes with any existing attributes
30
+ // Placement attributes control where the deployment runs (geographic targeting)
31
+ //
32
+ // **Important:** The 'placement' field provides type-safe convenience for common
33
+ // attributes, but it maps to the actual provider attribute names that providers
34
+ // use on mainnet (e.g., 'region' not 'location-region').
35
+ const placementAttributes = {
36
+ ...akashProfile.attributes, // Existing attributes (GPU requirements, etc.)
37
+ };
38
+ // Add placement attributes if specified
39
+ // Maps typed placement fields to actual provider attribute names
40
+ if (akashProfile.placement) {
41
+ if (akashProfile.placement.region) {
42
+ placementAttributes.region = akashProfile.placement.region;
43
+ }
44
+ if (akashProfile.placement.tier) {
45
+ placementAttributes.tier = akashProfile.placement.tier;
46
+ }
47
+ }
48
+ const placementProfiles = {
49
+ global: {
50
+ attributes: placementAttributes,
51
+ signedBy: akashProfile.signedBy || {
52
+ allOf: ['akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63'],
53
+ },
54
+ pricing: {},
55
+ },
56
+ };
57
+ const deploymentProfiles = {};
58
+ for (const [serviceName, serviceConfig] of Object.entries(loadedProfile.profile.services)) {
59
+ const akashServiceName = normaliseServiceName(serviceName);
60
+ // Support pricing at both profile level and service level
61
+ const pricing = loadedProfile.profile.pricing?.[serviceName] ?? serviceConfig.pricing;
62
+ services[akashServiceName] = buildServiceSection(serviceConfig);
63
+ computeProfiles[akashServiceName] = buildComputeProfile(serviceConfig, defaults);
64
+ placementProfiles.global.pricing[akashServiceName] = buildPricingProfile(pricing, defaults);
65
+ deploymentProfiles[akashServiceName] = buildDeploymentProfile(akashServiceName, serviceConfig);
66
+ }
67
+ // Build SDL document in the conventional order:
68
+ // 1. version
69
+ // 2. services
70
+ // 3. profiles (compute, placement)
71
+ // 4. deployment
72
+ // Clean up placement profile - remove attributes if empty
73
+ const cleanPlacement = { ...placementProfiles };
74
+ if (Object.keys(cleanPlacement.global.attributes || {}).length === 0) {
75
+ delete cleanPlacement.global.attributes;
76
+ }
77
+ const sdlDocument = {
78
+ version: '2.0',
79
+ services,
80
+ profiles: {
81
+ compute: computeProfiles,
82
+ placement: cleanPlacement,
83
+ },
84
+ deployment: deploymentProfiles,
85
+ };
86
+ return yaml.dump(sdlDocument, {
87
+ noRefs: true,
88
+ lineWidth: 120,
89
+ indent: 2,
90
+ });
91
+ }
92
+ /**
93
+ * Generates SDL string and returns an instantiated SDL helper from akashjs.
94
+ */
95
+ export function createSdlObject(loadedProfile, options) {
96
+ const yamlString = generateAkashSdl(loadedProfile, options);
97
+ return SDL.fromString(yamlString, 'beta3');
98
+ }
99
+ /**
100
+ * Ensures service names are DNS-friendly (lowercase alphanumeric).
101
+ */
102
+ function normaliseServiceName(name) {
103
+ const cleaned = name.trim().toLowerCase().replace(/[^a-z0-9]/g, '');
104
+ return cleaned || 'service';
105
+ }
106
+ /** Converts EnvironmentVariable definitions into KEY=value strings. */
107
+ function normaliseEnvironment(env) {
108
+ if (!env || env.length === 0) {
109
+ return undefined;
110
+ }
111
+ const entries = env
112
+ .map((variable) => {
113
+ if (typeof variable === 'string') {
114
+ return variable;
115
+ }
116
+ if (variable && typeof variable.name === 'string') {
117
+ return `${variable.name}=${variable.value ?? ''}`;
118
+ }
119
+ return null;
120
+ })
121
+ .filter((value) => value !== null);
122
+ return entries.length > 0 ? entries : undefined;
123
+ }
124
+ /**
125
+ * Maps PortExposure definitions to Akash SDL format
126
+ *
127
+ * Transforms deploy-ability's port exposure format into Akash SDL YAML structure,
128
+ * including HTTP options for ingress timeout configuration.
129
+ */
130
+ function normaliseExpose(expose) {
131
+ if (!expose || expose.length === 0) {
132
+ return undefined;
133
+ }
134
+ return expose.map((exposure) => {
135
+ const targets = exposure.to?.map((target) => typeof target === 'string'
136
+ ? { service: target }
137
+ : { global: target.global ?? false });
138
+ // Build base exposure object
139
+ const exposureObj = {
140
+ port: exposure.port,
141
+ as: exposure.as ?? exposure.port,
142
+ to: targets ?? [{ global: false }],
143
+ };
144
+ // Add HTTP options if specified
145
+ // Only relevant for Akash deployments with global exposure
146
+ if (exposure.http_options) {
147
+ exposureObj.http_options = exposure.http_options;
148
+ }
149
+ return exposureObj;
150
+ });
151
+ }
152
+ /** Builds services section entry. */
153
+ function buildServiceSection(service) {
154
+ const section = {
155
+ image: service.image,
156
+ };
157
+ // Add registry credentials if present (for private registries)
158
+ const credentials = service.credentials;
159
+ if (credentials) {
160
+ section.credentials = credentials;
161
+ }
162
+ const env = normaliseEnvironment(service.env);
163
+ if (env)
164
+ section.env = env;
165
+ if (service.command && service.command.length > 0) {
166
+ section.command = service.command;
167
+ }
168
+ const expose = normaliseExpose(service.expose);
169
+ if (expose)
170
+ section.expose = expose;
171
+ // Add params for persistent volume mounts
172
+ const persistentVolumes = service.resources?.persistentVolumes ?? [];
173
+ if (persistentVolumes.length > 0) {
174
+ section.params = buildServiceParams(persistentVolumes);
175
+ }
176
+ return section;
177
+ }
178
+ /**
179
+ * Builds service params section for persistent volume mounts
180
+ *
181
+ * Generates the params.storage section that maps volume names to mount paths.
182
+ * This is required for Akash to mount persistent volumes into the container.
183
+ *
184
+ * @param volumes - Array of persistent volume specifications
185
+ * @returns Params object with storage mount configuration
186
+ *
187
+ * @example
188
+ * Input: [{ name: "data", size: "10Gi", mount: "/data", class: "beta2" }]
189
+ * Output: { storage: { data: { mount: "/data" } } }
190
+ */
191
+ function buildServiceParams(volumes) {
192
+ const storage = {};
193
+ for (const volume of volumes) {
194
+ storage[volume.name] = {
195
+ mount: volume.mount,
196
+ };
197
+ }
198
+ return { storage };
199
+ }
200
+ /**
201
+ * Builds compute profile for CPU/memory/storage/GPU requirements
202
+ *
203
+ * Handles the new storage format with separate ephemeral and persistent storage.
204
+ *
205
+ * **Format:**
206
+ * ```yaml
207
+ * resources:
208
+ * storage:
209
+ * - size: "512Mi" # Ephemeral (from ephemeralStorage)
210
+ * - name: data # Persistent volume
211
+ * size: "10Gi"
212
+ * attributes:
213
+ * persistent: true
214
+ * class: beta2
215
+ * ```
216
+ */
217
+ function buildComputeProfile(service, defaults) {
218
+ const cpuUnits = service.resources?.cpu ?? defaults.defaultCpuUnits;
219
+ const memory = service.resources?.memory ?? defaults.defaultMemorySize;
220
+ const ephemeralSize = service.resources?.ephemeralStorage ?? defaults.defaultStorageSize;
221
+ const persistentVolumes = service.resources?.persistentVolumes ?? [];
222
+ const resources = {
223
+ cpu: { units: cpuUnits },
224
+ memory: { size: memory },
225
+ };
226
+ // Generate storage section
227
+ if (persistentVolumes.length > 0) {
228
+ // Array format: ephemeral + persistent volumes
229
+ const storageArray = [
230
+ { size: ephemeralSize }, // Ephemeral storage (first element)
231
+ ];
232
+ // Add each persistent volume with attributes
233
+ for (const volume of persistentVolumes) {
234
+ storageArray.push({
235
+ name: volume.name,
236
+ size: volume.size,
237
+ attributes: {
238
+ persistent: true,
239
+ class: volume.class ?? 'beta2', // Default to SSD if not specified
240
+ },
241
+ });
242
+ }
243
+ resources.storage = storageArray;
244
+ }
245
+ else {
246
+ // Simple format: only ephemeral storage
247
+ resources.storage = { size: ephemeralSize };
248
+ }
249
+ // Add GPU configuration if present
250
+ if (service.resources?.gpu) {
251
+ resources.gpu = service.resources.gpu;
252
+ }
253
+ return { resources };
254
+ }
255
+ /** Builds pricing profile (max bid per service). */
256
+ function buildPricingProfile(pricing, defaults) {
257
+ if (pricing) {
258
+ return {
259
+ denom: pricing.denom,
260
+ amount: parseInt(pricing.amount, 10), // Convert string to number
261
+ };
262
+ }
263
+ return {
264
+ denom: defaults.defaultPricingDenom,
265
+ amount: defaults.defaultPricingAmount,
266
+ };
267
+ }
268
+ /** Builds deployment profile specifying replica count. */
269
+ function buildDeploymentProfile(computeProfileName, _service // Prefix unused param to avoid TS error
270
+ ) {
271
+ const count = 1;
272
+ return {
273
+ global: {
274
+ profile: computeProfileName,
275
+ count,
276
+ },
277
+ };
278
+ }
279
+ //# sourceMappingURL=sdl-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdl-generator.js","sourceRoot":"","sources":["../../../src/targets/akash/sdl-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,0CAA0C,CAAC;AAqB/D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,aAAoD,EACpD,UAAqC,EAAE;IAEvC,MAAM,QAAQ,GAAG;QACf,eAAe,EAAE,GAAG;QACpB,iBAAiB,EAAE,OAAO;QAC1B,kBAAkB,EAAE,KAAK;QACzB,mBAAmB,EAAE,MAAM;QAC3B,oBAAoB,EAAE,IAAI;QAC1B,GAAG,OAAO;KACX,CAAC;IAEF,MAAM,QAAQ,GAA4C,EAAE,CAAC;IAC7D,MAAM,eAAe,GAA4C,EAAE,CAAC;IAEpE,oEAAoE;IACpE,MAAM,Y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+ * Akash Network Type Definitions
3
+ *
4
+ * This module provides type-safe interfaces for Akash Network deployment operations.
5
+ * ALL `any` types from the original kadi-deploy implementation have been replaced
6
+ * with proper TypeScript interfaces from @cosmjs and @walletconnect libraries.
7
+ *
8
+ * Key Improvements from kadi-deploy:
9
+ * - ✅ ZERO `any` types (was 5 any types)
10
+ * - ✅ Proper imports from typed libraries
11
+ * - ✅ Readonly properties to prevent mutations
12
+ * - ✅ Comprehensive JSDoc documentation
13
+ *
14
+ * @module targets/akash/types
15
+ */
16
+ import type { OfflineAminoSigner } from '@cosmjs/amino';
17
+ import type { OfflineDirectSigner } from '@cosmjs/proto-signing';
18
+ import type { SessionTypes } from '@walletconnect/types';
19
+ import { SignClient } from '@walletconnect/sign-client';
20
+ /**
21
+ * Keplr wallet signer with dual signing capabilities
22
+ *
23
+ * Keplr wallet provides BOTH Amino (legacy JSON) and Direct (protobuf) signing.
24
+ * This intersection type ensures we have access to both signing methods,
25
+ * which is required for compatibility with different Cosmos SDK versions.
26
+ *
27
+ * Note: There's a known type incompatibility between @keplr-wallet/types and
28
+ * @cosmjs/proto-signing (Long vs bigint for SignDoc.accountNumber). The actual
29
+ * runtime objects work fine - this is purely a TypeScript type issue.
30
+ *
31
+ * Why both?
32
+ * - Amino: Legacy format, required by some older chains
33
+ * - Direct: Modern protobuf format, more efficient and type-safe
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * const signer: KeplrSigner = await keplrWallet.getOfflineSigner(chainId);
38
+ * // Can use both signing methods:
39
+ * await signer.signAmino(address, signDoc); // Amino signing
40
+ * await signer.signDirect(address, signDoc); // Direct signing
41
+ * ```
42
+ */
43
+ export type KeplrSigner = OfflineAminoSigner & OfflineDirectSigner;
44
+ /**
45
+ * Account data from the Cosmos blockchain
46
+ *
47
+ * Represents the on-chain state of a blockchain account.
48
+ * Used for transaction signing and nonce management.
49
+ *
50
+ * @property address - Bech32 encoded address (e.g., "akash1...")
51
+ * @property pubkey - Public key bytes (null if account never used)
52
+ * @property accountNumber - Unique account number (never changes)
53
+ * @property sequence - Transaction sequence/nonce (increments per tx)
54
+ */
55
+ export interface AccountData {
56
+ /** Bech32 address of the account */
57
+ readonly address: string;
58
+ /** Public key bytes (null if account has never sent a transaction) */
59
+ readonly pubkey: Uint8Array | null;
60
+ /** Unique account number assigned when account first used */
61
+ readonly accountNumber: number;
62
+ /**
63
+ * Transaction sequence number (nonce)
64
+ * Increments with each transaction to prevent replays
65
+ */
66
+ readonly sequence: number;
67
+ }
68
+ /**
69
+ * Wallet connection context for Akash Network operations
70
+ *
71
+ * Contains all the data needed to interact with the Akash blockchain:
72
+ * - Signing transactions
73
+ * - Querying account state
74
+ * - Managing WalletConnect session
75
+ *
76
+ * This is the core data structure passed through all deployment operations.
77
+ *
78
+ * Key Design Decisions:
79
+ * - All properties are readonly to prevent accidental mutations
80
+ * - WalletConnect fields are optional (only needed when using WalletConnect)
81
+ * - Both signer and offlineSigner are KeplrSigner type (no more `any`!)
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * // Create wallet context after successful connection
86
+ * const walletCtx: WalletContext = {
87
+ * address: 'akash1abc...',
88
+ * signer: keplrSigner,
89
+ * offlineSigner: keplrSigner,
90
+ * chainId: 'akashnet-2',
91
+ * account: {
92
+ * address: 'akash1abc...',
93
+ * pubkey: new Uint8Array([...]),
94
+ * accountNumber: 12345,
95
+ * sequence: 0
96
+ * }
97
+ * };
98
+ *
99
+ * // Use in deployment operations
100
+ * const result = await deployToAkash({ walletCtx, ... });
101
+ * ```
102
+ */
103
+ export interface WalletContext {
104
+ /**
105
+ * Wallet address in bech32 format
106
+ * Example: "akash1abc123def456..."
107
+ */
108
+ readonly address: string;
109
+ /**
110
+ * Keplr signer with both Amino and Direct signing capabilities
111
+ *
112
+ * This is a stable offline signer wrapper that provides consistent
113
+ * transaction signing across different signing modes.
114
+ *
115
+ * Type: KeplrSigner (OfflineAminoSigner & OfflineDirectSigner)
116
+ */
117
+ readonly signer: KeplrSigner;
118
+ /**
119
+ * Offline signer for transaction creation
120
+ *
121
+ * Same as `signer` but explicitly typed for offline operations.
122
+ * Used when creating and signing transactions without network access.
123
+ *
124
+ * Type: KeplrSigner (OfflineAminoSigner & OfflineDirectSigner)
125
+ */
126
+ readonly offlineSigner: KeplrSigner;
127
+ /**
128
+ * WalletConnect SignClient instance (optional)
129
+ *
130
+ * Only present when using WalletConnect for mobile wallet connection.
131
+ * Used for session management and connection lifecycle.
132
+ *
133
+ * If undefined, means using browser extension (Keplr) instead of mobile.
134
+ */
135
+ readonly signClient?: InstanceType<typeof SignClient>;
136
+ /**
137
+ * Active WalletConnect session (optional)
138
+ *
139
+ * Contains session data needed for disconnection and session management.
140
+ * Only present when using WalletConnect.
141
+ *
142
+ * Type: SessionTypes.Struct from @walletconnect/types
143
+ */
144
+ readonly session?: SessionTypes.Struct;
145
+ /**
146
+ * Connected Akash network chain ID (optional)
147
+ *
148
+ * Examples:
149
+ * - 'akashnet-2' (mainnet)
150
+ * - 'sandbox-01' (testnet)
151
+ *
152
+ * Used to verify we're connected to the correct network.
153
+ */
154
+ readonly chainId?: string;
155
+ /**
156
+ * On-chain account data (optional)
157
+ *
158
+ * Cached account state from the blockchain.
159
+ * Used for transaction nonce (sequence) management.
160
+ *
161
+ * If undefined, means we haven't queried account state yet.
162
+ */
163
+ readonly account?: AccountData;
164
+ }
165
+ /**
166
+ * Akash Provider TLS Certificate
167
+ *
168
+ * X.509 certificate used for mutual TLS (mTLS) authentication with Akash providers.
169
+ * Required for secure communication with provider APIs after lease creation.
170
+ *
171
+ * Why mTLS?
172
+ * - Akash providers require client certificates for authentication
173
+ * - Prevents unauthorized access to deployment management APIs
174
+ * - Certificate is tied to wallet address via blockchain registration
175
+ *
176
+ * Certificate Lifecycle:
177
+ * 1. Generate key pair (privateKey, publicKey)
178
+ * 2. Create X.509 certificate signing request
179
+ * 3. Submit certificate to blockchain
180
+ * 4. Use for all provider API calls
181
+ *
182
+ * @property privateKey - Private key in PEM format (keep secret!)
183
+ * @property publicKey - Public key in PEM format
184
+ * @property cert - X.509 certificate in PEM format
185
+ * @property chain - Certificate chain in PEM format (optional)
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const certificate: AkashProviderTlsCertificate = {
190
+ * privateKey: '-----BEGIN PRIVATE KEY-----\n...',
191
+ * publicKey: '-----BEGIN PUBLIC KEY-----\n...',
192
+ * cert: '-----BEGIN CERTIFICATE-----\n...',
193
+ * chain: '-----BEGIN CERTIFICATE-----\n...' // Optional
194
+ * };
195
+ *
196
+ * // Use for provider API calls
197
+ * const response = await fetch(providerUri, {
198
+ * method: 'POST',
199
+ * headers: {
200
+ * 'Content-Type': 'application/json',
201
+ * },
202
+ * // mTLS authentication:
203
+ * cert: certificate.cert,
204
+ * key: certificate.privateKey
205
+ * });
206
+ * ```
207
+ */
208
+ export interface AkashProviderTlsCertificate {
209
+ /**
210
+ * Private key in PEM format
211
+ *
212
+ * SECURITY: Keep this secret! Never log or expose in errors.
213
+ * Used for mTLS client authentication with providers.
214
+ *
215
+ * Format: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"
216
+ */
217
+ readonly privateKey: string;
218
+ /**
219
+ * Public key in PEM format
220
+ *
221
+ * Paired with privateKey, can be shared publicly.
222
+ * Used for certificate verification.
223
+ *
224
+ * Format: "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
225
+ */
226
+ readonly publicKey: string;
227
+ /**
228
+ * X.509 certificate in PEM format
229
+ *
230
+ * This is the actual certificate used for mTLS authentication.
231
+ * Contains public key + metadata signed by certificate authority.
232
+ *
233
+ * Format: "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
234
+ */
235
+ readonly cert: string;
236
+ /**
237
+ * Certificate chain in PEM format (optional)
238
+ *
239
+ * Some certificate sources provide the full certificate chain.
240
+ * Not always required for Akash provider communication.
241
+ *
242
+ * Format: "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
243
+ */
244
+ readonly chain?: string;
245
+ }
246
+ /**
247
+ * Type guard: Check if wallet context has WalletConnect session
248
+ *
249
+ * @param ctx - Wallet context to check
250
+ * @returns True if using WalletConnect (has signClient and session)
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * if (isWalletConnectSession(walletCtx)) {
255
+ * // Can safely disconnect WalletConnect
256
+ * await walletCtx.signClient.disconnect({
257
+ * topic: walletCtx.session.topic,
258
+ * reason: { code: 1, message: 'User disconnected' }
259
+ * });
260
+ * }
261
+ * ```
262
+ */
263
+ export declare function isWalletConnectSession(ctx: WalletContext): ctx is WalletContext & {
264
+ signClient: InstanceType<typeof SignClient>;
265
+ session: SessionTypes.Struct;
266
+ };
267
+ /**
268
+ * Type guard: Check if wallet context has account data
269
+ *
270
+ * @param ctx - Wallet context to check
271
+ * @returns True if account data is present
272
+ *
273
+ * @example
274
+ * ```typescript
275
+ * if (hasAccountData(walletCtx)) {
276
+ * // Can safely access account properties
277
+ * console.log('Account number:', walletCtx.account.accountNumber);
278
+ * console.log('Sequence:', walletCtx.account.sequence);
279
+ * }
280
+ * ```
281
+ */
282
+ export declare function hasAccountData(ctx: WalletContext): ctx is WalletContext & {
283
+ account: AccountData;
284
+ };
285
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/targets/akash/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EACV,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAEnE;;;;;;;;;;GAUG;AACH,MAA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AAgB,sBAAsB,CAAC,GAAG,EAAE,aAAa,GAAG,GAAG,IAAI,aAAa,GAAG;IACjF,UAAU,EAAE,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;IAC5C,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC;CAC9B,CAEA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,GAAG,IAAI,aAAa,GAAG;IACzE,OAAO,EAAE,WAAW,CAAC;CACtB,CAEA"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Akash Network Type Definitions
3
+ *
4
+ * This module provides type-safe interfaces for Akash Network deployment operations.
5
+ * ALL `any` types from the original kadi-deploy implementation have been replaced
6
+ * with proper TypeScript interfaces from @cosmjs and @walletconnect libraries.
7
+ *
8
+ * Key Improvements from kadi-deploy:
9
+ * - ✅ ZERO `any` types (was 5 any types)
10
+ * - ✅ Proper imports from typed libraries
11
+ * - ✅ Readonly properties to prevent mutations
12
+ * - ✅ Comprehensive JSDoc documentation
13
+ *
14
+ * @module targets/akash/types
15
+ */
16
+ /**
17
+ * Type guard: Check if wallet context has WalletConnect session
18
+ *
19
+ * @param ctx - Wallet context to check
20
+ * @returns True if using WalletConnect (has signClient and session)
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * if (isWalletConnectSession(walletCtx)) {
25
+ * // Can safely disconnect WalletConnect
26
+ * await walletCtx.signClient.disconnect({
27
+ * topic: walletCtx.session.topic,
28
+ * reason: { code: 1, message: 'User disconnected' }
29
+ * });
30
+ * }
31
+ * ```
32
+ */
33
+ export function isWalletConnectSession(ctx) {
34
+ return ctx.signClient !== undefined && ctx.session !== undefined;
35
+ }
36
+ /**
37
+ * Type guard: Check if wallet context has account data
38
+ *
39
+ * @param ctx - Wallet context to check
40
+ * @returns True if account data is present
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * if (hasAccountData(walletCtx)) {
45
+ * // Can safely access account properties
46
+ * console.log('Account number:', walletCtx.account.accountNumber);
47
+ * console.log('Sequence:', walletCtx.account.sequence);
48
+ * }
49
+ * ```
50
+ */
51
+ export function hasAccountData(ctx) {
52
+ return ctx.account !== undefined;
53
+ }
54
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/targets/akash/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA8PH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAkB;IAIvD,OAAO,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,GAAkB;IAG/C,OAAO,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC;AACnC,CAAC"}