@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,106 @@
1
+ /**
2
+ * Profile-related error classes
3
+ *
4
+ * Errors specific to deployment profile loading and validation
5
+ *
6
+ * @module errors/profile-error
7
+ */
8
+ import { DeploymentError, type ErrorContext, type ErrorSeverity } from './deployment-error.js';
9
+ /**
10
+ * Profile error codes
11
+ */
12
+ export declare const ProfileErrorCodes: {
13
+ /** agent.json file not found */
14
+ readonly AGENT_JSON_NOT_FOUND: "AGENT_JSON_NOT_FOUND";
15
+ /** agent.json parsing failed */
16
+ readonly AGENT_JSON_PARSE_ERROR: "AGENT_JSON_PARSE_ERROR";
17
+ /** Requested profile not found in agent.json */
18
+ readonly PROFILE_NOT_FOUND: "PROFILE_NOT_FOUND";
19
+ /** Profile is missing required fields */
20
+ readonly PROFILE_INVALID: "PROFILE_INVALID";
21
+ /** No profiles defined in agent.json */
22
+ readonly NO_PROFILES_DEFINED: "NO_PROFILES_DEFINED";
23
+ /** Profile validation failed */
24
+ readonly PROFILE_VALIDATION_ERROR: "PROFILE_VALIDATION_ERROR";
25
+ /** Service configuration is invalid */
26
+ readonly SERVICE_CONFIG_INVALID: "SERVICE_CONFIG_INVALID";
27
+ /** Generic profile error */
28
+ readonly PROFILE_ERROR: "PROFILE_ERROR";
29
+ };
30
+ export type ProfileErrorCode = (typeof ProfileErrorCodes)[keyof typeof ProfileErrorCodes];
31
+ /**
32
+ * Profile loading or validation error
33
+ *
34
+ * Thrown when profile-related operations fail, including:
35
+ * - agent.json not found or invalid
36
+ * - Profile not found
37
+ * - Profile validation failures
38
+ * - Service configuration errors
39
+ *
40
+ * @example
41
+ * throw new ProfileError(
42
+ * 'Profile "production" not found in agent.json',
43
+ * ProfileErrorCodes.PROFILE_NOT_FOUND,
44
+ * { profile: 'production', availableProfiles: ['dev', 'staging'] },
45
+ * false,
46
+ * 'Available profiles: dev, staging'
47
+ * );
48
+ */
49
+ export declare class ProfileError extends DeploymentError {
50
+ constructor(message: string, code?: ProfileErrorCode, context?: ErrorContext, recoverable?: boolean, suggestion?: string, severity?: ErrorSeverity, cause?: Error);
51
+ }
52
+ /**
53
+ * Create an agent.json not found error
54
+ *
55
+ * @param projectRoot - Project root path
56
+ * @returns ProfileError instance
57
+ */
58
+ export declare function agentJsonNotFoundError(projectRoot: string): ProfileError;
59
+ /**
60
+ * Create an agent.json parse error
61
+ *
62
+ * @param path - Path to agent.json
63
+ * @param cause - Original parsing error
64
+ * @returns ProfileError instance
65
+ */
66
+ export declare function agentJsonParseError(path: string, cause: Error): ProfileError;
67
+ /**
68
+ * Create a profile not found error
69
+ *
70
+ * @param profileName - Name of profile that wasn't found
71
+ * @param availableProfiles - List of available profile names
72
+ * @returns ProfileError instance
73
+ */
74
+ export declare function profileNotFoundError(profileName: string, availableProfiles: readonly string[]): ProfileError;
75
+ /**
76
+ * Create a no profiles defined error
77
+ *
78
+ * @param path - Path to agent.json
79
+ * @returns ProfileError instance
80
+ */
81
+ export declare function noProfilesDefinedError(path: string): ProfileError;
82
+ /**
83
+ * Create a profile invalid error
84
+ *
85
+ * @param profileName - Name of invalid profile
86
+ * @param reason - Why the profile is invalid
87
+ * @param field - Field that is invalid
88
+ * @returns ProfileError instance
89
+ */
90
+ export declare function profileInvalidError(profileName: string, reason: string, field?: string): ProfileError;
91
+ /**
92
+ * Create a service config invalid error
93
+ *
94
+ * @param serviceName - Name of service with invalid config
95
+ * @param reason - Why the config is invalid
96
+ * @returns ProfileError instance
97
+ */
98
+ export declare function serviceConfigInvalidError(serviceName: string, reason: string): ProfileError;
99
+ /**
100
+ * Type guard to check if an error is a ProfileError
101
+ *
102
+ * @param error - The error to check
103
+ * @returns True if error is a ProfileError
104
+ */
105
+ export declare function isProfileError(error: unknown): error is ProfileError;
106
+ //# sourceMappingURL=profile-error.d.ts.map
@@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EAAE,MAAM,GACb,YAAY,CASd;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,YAAY,CASd;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Profile-related error classes
3
+ *
4
+ * Errors specific to deployment profile loading and validation
5
+ *
6
+ * @module errors/profile-error
7
+ */
8
+ import { DeploymentError } from './deployment-error.js';
9
+ /**
10
+ * Profile error codes
11
+ */
12
+ export const ProfileErrorCodes = {
13
+ /** agent.json file not found */
14
+ AGENT_JSON_NOT_FOUND: 'AGENT_JSON_NOT_FOUND',
15
+ /** agent.json parsing failed */
16
+ AGENT_JSON_PARSE_ERROR: 'AGENT_JSON_PARSE_ERROR',
17
+ /** Requested profile not found in agent.json */
18
+ PROFILE_NOT_FOUND: 'PROFILE_NOT_FOUND',
19
+ /** Profile is missing required fields */
20
+ PROFILE_INVALID: 'PROFILE_INVALID',
21
+ /** No profiles defined in agent.json */
22
+ NO_PROFILES_DEFINED: 'NO_PROFILES_DEFINED',
23
+ /** Profile validation failed */
24
+ PROFILE_VALIDATION_ERROR: 'PROFILE_VALIDATION_ERROR',
25
+ /** Service configuration is invalid */
26
+ SERVICE_CONFIG_INVALID: 'SERVICE_CONFIG_INVALID',
27
+ /** Generic profile error */
28
+ PROFILE_ERROR: 'PROFILE_ERROR',
29
+ };
30
+ /**
31
+ * Profile loading or validation error
32
+ *
33
+ * Thrown when profile-related operations fail, including:
34
+ * - agent.json not found or invalid
35
+ * - Profile not found
36
+ * - Profile validation failures
37
+ * - Service configuration errors
38
+ *
39
+ * @example
40
+ * throw new ProfileError(
41
+ * 'Profile "production" not found in agent.json',
42
+ * ProfileErrorCodes.PROFILE_NOT_FOUND,
43
+ * { profile: 'production', availableProfiles: ['dev', 'staging'] },
44
+ * false,
45
+ * 'Available profiles: dev, staging'
46
+ * );
47
+ */
48
+ export class ProfileError extends DeploymentError {
49
+ constructor(message, code = ProfileErrorCodes.PROFILE_ERROR, context = {}, recoverable = false, suggestion, severity = 'error', cause) {
50
+ super(message, code, context, recoverable, suggestion, severity, cause);
51
+ // Maintain proper prototype chain
52
+ Object.setPrototypeOf(this, ProfileError.prototype);
53
+ this.name = 'ProfileError';
54
+ }
55
+ }
56
+ /**
57
+ * Create an agent.json not found error
58
+ *
59
+ * @param projectRoot - Project root path
60
+ * @returns ProfileError instance
61
+ */
62
+ export function agentJsonNotFoundError(projectRoot) {
63
+ return new ProfileError(`agent.json not found in ${projectRoot}`, ProfileErrorCodes.AGENT_JSON_NOT_FOUND, { projectRoot }, false, 'Create an agent.json file with deployment configuration', 'error');
64
+ }
65
+ /**
66
+ * Create an agent.json parse error
67
+ *
68
+ * @param path - Path to agent.json
69
+ * @param cause - Original parsing error
70
+ * @returns ProfileError instance
71
+ */
72
+ export function agentJsonParseError(path, cause) {
73
+ return new ProfileError(`Failed to parse agent.json at ${path}`, ProfileErrorCodes.AGENT_JSON_PARSE_ERROR, { path }, false, 'Check that agent.json contains valid JSON', 'error', cause);
74
+ }
75
+ /**
76
+ * Create a profile not found error
77
+ *
78
+ * @param profileName - Name of profile that wasn't found
79
+ * @param availableProfiles - List of available profile names
80
+ * @returns ProfileError instance
81
+ */
82
+ export function profileNotFoundError(profileName, availableProfiles) {
83
+ const suggestion = availableProfiles.length > 0
84
+ ? `Available profiles: ${availableProfiles.join(', ')}`
85
+ : 'No deployment profiles are defined in agent.json';
86
+ return new ProfileError(`Profile "${profileName}" not found`, ProfileErrorCodes.PROFILE_NOT_FOUND, { profileName, availableProfiles }, false, suggestion, 'error');
87
+ }
88
+ /**
89
+ * Create a no profiles defined error
90
+ *
91
+ * @param path - Path to agent.json
92
+ * @returns ProfileError instance
93
+ */
94
+ export function noProfilesDefinedError(path) {
95
+ return new ProfileError('No deployment profiles defined in agent.json', ProfileErrorCodes.NO_PROFILES_DEFINED, { path }, false, 'Add at least one profile to the "deploy" section of agent.json', 'error');
96
+ }
97
+ /**
98
+ * Create a profile invalid error
99
+ *
100
+ * @param profileName - Name of invalid profile
101
+ * @param reason - Why the profile is invalid
102
+ * @param field - Field that is invalid
103
+ * @returns ProfileError instance
104
+ */
105
+ export function profileInvalidError(profileName, reason, field) {
106
+ return new ProfileError(`Profile "${profileName}" is invalid: ${reason}`, ProfileErrorCodes.PROFILE_INVALID, { profileName, reason, field }, false, field ? `Fix the "${field}" field in the profile` : 'Fix the profile configuration', 'error');
107
+ }
108
+ /**
109
+ * Create a service config invalid error
110
+ *
111
+ * @param serviceName - Name of service with invalid config
112
+ * @param reason - Why the config is invalid
113
+ * @returns ProfileError instance
114
+ */
115
+ export function serviceConfigInvalidError(serviceName, reason) {
116
+ return new ProfileError(`Service "${serviceName}" has invalid configuration: ${reason}`, ProfileErrorCodes.SERVICE_CONFIG_INVALID, { serviceName, reason }, false, 'Review the service configuration in your deployment profile', 'error');
117
+ }
118
+ /**
119
+ * Type guard to check if an error is a ProfileError
120
+ *
121
+ * @param error - The error to check
122
+ * @returns True if error is a ProfileError
123
+ */
124
+ export function isProfileError(error) {
125
+ return error instanceof ProfileError;
126
+ }
127
+ //# sourceMappingURL=profile-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-error.js","sourceRoot":"","sources":["../../src/errors/profile-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAyC,MAAM,uBAAuB,CAAC;AAE/F;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,gCAAgC;IAChC,oBAAoB,EAAE,sBAAsB;IAE5C,gCAAgC;IAChC,sBAAsB,EAAE,wBAAwB;IAEhD,gDAAgD;IAChD,iBAAiB,EAAE,mBAAmB;IAEtC,yCAAyC;IACzC,eAAe,EAAE,iBAAiB;IAElC,wCAAwC;IACxC,mBAAmB,EAAE,qBAAqB;IAE1C,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AC,IAAI,CAAC,EAAE;QACvD,CAAC,CAAC,kDAAkD,CAAC;IAEzD,OAAO,IAAI,YAAY,CACrB,YAAY,WAAW,aAAa,EACpC,iBAAiB,CAAC,iBAAiB,EACnC,EAAE,WAAW,EAAE,iBAAiB,EAAE,EAClC,KAAK,EACL,UAAU,EACV,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,OAAO,IAAI,YAAY,CACrB,8CAA8C,EAC9C,iBAAiB,CAAC,mBAAmB,EACrC,EAAE,IAAI,EAAE,EACR,KAAK,EACL,gEAAgE,EAChE,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,WAAmB,EACnB,MAAc,EACd,KAAc;IAEd,OAAO,IAAI,YAAY,CACrB,YAAY,WAAW,iBAAiB,MAAM,EAAE,EAChD,iBAAiB,CAAC,eAAe,EACjC,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,EAC9B,KAAK,EACL,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,wBAAwB,CAAC,CAAC,CAAC,+BAA+B,EACnF,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,WAAmB,EACnB,MAAc;IAEd,OAAO,IAAI,YAAY,CACrB,YAAY,WAAW,gCAAgC,MAAM,EAAE,EAC/D,iBAAiB,CAAC,sBAAsB,EACxC,EAAE,WAAW,EAAE,MAAM,EAAE,EACvB,KAAK,EACL,6DAA6D,EAC7D,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,KAAK,YAAY,YAAY,CAAC;AACvC,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Provider-related error classes
3
+ *
4
+ * Errors specific to Akash provider communication and operations
5
+ *
6
+ * @module errors/provider-error
7
+ */
8
+ import { DeploymentError, type ErrorContext, type ErrorSeverity } from './deployment-error.js';
9
+ /**
10
+ * Provider error codes
11
+ */
12
+ export declare const ProviderErrorCodes: {
13
+ /** Provider unreachable or offline */
14
+ readonly PROVIDER_UNREACHABLE: "PROVIDER_UNREACHABLE";
15
+ /** Provider rejected the manifest */
16
+ readonly MANIFEST_REJECTED: "MANIFEST_REJECTED";
17
+ /** Failed to send manifest to provider */
18
+ readonly MANIFEST_SEND_FAILED: "MANIFEST_SEND_FAILED";
19
+ /** Provider returned error status */
20
+ readonly PROVIDER_STATUS_ERROR: "PROVIDER_STATUS_ERROR";
21
+ /** Container failed to start on provider */
22
+ readonly CONTAINER_START_FAILED: "CONTAINER_START_FAILED";
23
+ /** Timeout waiting for containers to run */
24
+ readonly CONTAINER_TIMEOUT: "CONTAINER_TIMEOUT";
25
+ /** Provider certificate validation failed */
26
+ readonly PROVIDER_CERT_INVALID: "PROVIDER_CERT_INVALID";
27
+ /** No providers responded to the deployment */
28
+ readonly NO_BIDS_RECEIVED: "NO_BIDS_RECEIVED";
29
+ /** All providers are blacklisted */
30
+ readonly ALL_PROVIDERS_BLACKLISTED: "ALL_PROVIDERS_BLACKLISTED";
31
+ /** Provider communication timeout */
32
+ readonly PROVIDER_TIMEOUT: "PROVIDER_TIMEOUT";
33
+ /** Generic provider error */
34
+ readonly PROVIDER_ERROR: "PROVIDER_ERROR";
35
+ };
36
+ export type ProviderErrorCode = (typeof ProviderErrorCodes)[keyof typeof ProviderErrorCodes];
37
+ /**
38
+ * Provider communication or operation error
39
+ *
40
+ * Thrown when provider-related operations fail, including:
41
+ * - Provider unreachable
42
+ * - Manifest rejection
43
+ * - Container startup failures
44
+ * - Communication timeouts
45
+ *
46
+ * @example
47
+ * throw new ProviderError(
48
+ * 'Provider rejected manifest',
49
+ * ProviderErrorCodes.MANIFEST_REJECTED,
50
+ * { provider: 'akash1...', reason: 'Invalid image reference' },
51
+ * true,
52
+ * 'Check your image name and try again'
53
+ * );
54
+ */
55
+ export declare class ProviderError extends DeploymentError {
56
+ constructor(message: string, code?: ProviderErrorCode, context?: ErrorContext, recoverable?: boolean, suggestion?: string, severity?: ErrorSeverity, cause?: Error);
57
+ }
58
+ /**
59
+ * Create a provider unreachable error
60
+ *
61
+ * @param providerUri - URI of unreachable provider
62
+ * @param cause - Original error
63
+ * @returns ProviderError instance
64
+ */
65
+ export declare function providerUnreachableError(providerUri: string, cause?: Error): ProviderError;
66
+ /**
67
+ * Create a manifest rejected error
68
+ *
69
+ * @param provider - Provider address
70
+ * @param reason - Rejection reason
71
+ * @returns ProviderError instance
72
+ */
73
+ export declare function manifestRejectedError(provider: string, reason?: string): ProviderError;
74
+ /**
75
+ * Create a no bids received error
76
+ *
77
+ * @param timeout - How long we waited
78
+ * @returns ProviderError instance
79
+ */
80
+ export declare function noBidsReceivedError(timeout: number): ProviderError;
81
+ /**
82
+ * Create a container timeout error
83
+ *
84
+ * @param service - Service that timed out
85
+ * @param timeout - Timeout duration
86
+ * @returns ProviderError instance
87
+ */
88
+ export declare function containerTimeoutError(service: string, timeout: number): ProviderError;
89
+ /**
90
+ * Create a container start failed error
91
+ *
92
+ * @param service - Service that failed
93
+ * @param reason - Failure reason
94
+ * @returns ProviderError instance
95
+ */
96
+ export declare function containerStartFailedError(service: string, reason?: string): ProviderError;
97
+ /**
98
+ * Type guard to check if an error is a ProviderError
99
+ *
100
+ * @param error - The error to check
101
+ * @returns True if error is a ProviderError
102
+ */
103
+ export declare function isProviderError(error: unknown): error is ProviderError;
104
+ //# sourceMappingURL=provider-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-error.d.ts","sourceRoot":"","sources":["../../src/errors/provider-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE/F;;GAEG;AACH,eAAO,MAAM,kBAAkB;IAC7B,sCAAsC;;IAGtC,qCAAqC;;IAGrC,0CAA0C;;IAG1C,qCAAqC;;IAGrC,4CAA4C;;IAG5C,4CAA4C;;IAG5C,6CAA6C;;IAG7C,+CAA+C;;IAG/C,oCAAoC;;IAGpC,qCAAqC;;IAGrC,6BAA6B;;CAErB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAc,SAAQ,eAAe;gBAE9C,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,iBAAqD,EAC3D,OAAO,GAAE,YAAiB,EAC1B,WAAW,GAAE,OAAe,EAC5B,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,GAAE,aAAuB,EACjC,KAAK,CAAC,EAAE,KAAK;CAShB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,KAAK,GACZ,aAAa,CAUf;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,aAAa,CASf;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CASlE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,aAAa,CASf;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,GACd,aAAa,CASf;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Provider-related error classes
3
+ *
4
+ * Errors specific to Akash provider communication and operations
5
+ *
6
+ * @module errors/provider-error
7
+ */
8
+ import { DeploymentError } from './deployment-error.js';
9
+ /**
10
+ * Provider error codes
11
+ */
12
+ export const ProviderErrorCodes = {
13
+ /** Provider unreachable or offline */
14
+ PROVIDER_UNREACHABLE: 'PROVIDER_UNREACHABLE',
15
+ /** Provider rejected the manifest */
16
+ MANIFEST_REJECTED: 'MANIFEST_REJECTED',
17
+ /** Failed to send manifest to provider */
18
+ MANIFEST_SEND_FAILED: 'MANIFEST_SEND_FAILED',
19
+ /** Provider returned error status */
20
+ PROVIDER_STATUS_ERROR: 'PROVIDER_STATUS_ERROR',
21
+ /** Container failed to start on provider */
22
+ CONTAINER_START_FAILED: 'CONTAINER_START_FAILED',
23
+ /** Timeout waiting for containers to run */
24
+ CONTAINER_TIMEOUT: 'CONTAINER_TIMEOUT',
25
+ /** Provider certificate validation failed */
26
+ PROVIDER_CERT_INVALID: 'PROVIDER_CERT_INVALID',
27
+ /** No providers responded to the deployment */
28
+ NO_BIDS_RECEIVED: 'NO_BIDS_RECEIVED',
29
+ /** All providers are blacklisted */
30
+ ALL_PROVIDERS_BLACKLISTED: 'ALL_PROVIDERS_BLACKLISTED',
31
+ /** Provider communication timeout */
32
+ PROVIDER_TIMEOUT: 'PROVIDER_TIMEOUT',
33
+ /** Generic provider error */
34
+ PROVIDER_ERROR: 'PROVIDER_ERROR',
35
+ };
36
+ /**
37
+ * Provider communication or operation error
38
+ *
39
+ * Thrown when provider-related operations fail, including:
40
+ * - Provider unreachable
41
+ * - Manifest rejection
42
+ * - Container startup failures
43
+ * - Communication timeouts
44
+ *
45
+ * @example
46
+ * throw new ProviderError(
47
+ * 'Provider rejected manifest',
48
+ * ProviderErrorCodes.MANIFEST_REJECTED,
49
+ * { provider: 'akash1...', reason: 'Invalid image reference' },
50
+ * true,
51
+ * 'Check your image name and try again'
52
+ * );
53
+ */
54
+ export class ProviderError extends DeploymentError {
55
+ constructor(message, code = ProviderErrorCodes.PROVIDER_ERROR, context = {}, recoverable = false, suggestion, severity = 'error', cause) {
56
+ super(message, code, context, recoverable, suggestion, severity, cause);
57
+ // Maintain proper prototype chain
58
+ Object.setPrototypeOf(this, ProviderError.prototype);
59
+ this.name = 'ProviderError';
60
+ }
61
+ }
62
+ /**
63
+ * Create a provider unreachable error
64
+ *
65
+ * @param providerUri - URI of unreachable provider
66
+ * @param cause - Original error
67
+ * @returns ProviderError instance
68
+ */
69
+ export function providerUnreachableError(providerUri, cause) {
70
+ return new ProviderError(`Provider ${providerUri} is unreachable`, ProviderErrorCodes.PROVIDER_UNREACHABLE, { providerUri }, true, 'The provider may be temporarily offline. Try selecting a different provider.', 'error', cause);
71
+ }
72
+ /**
73
+ * Create a manifest rejected error
74
+ *
75
+ * @param provider - Provider address
76
+ * @param reason - Rejection reason
77
+ * @returns ProviderError instance
78
+ */
79
+ export function manifestRejectedError(provider, reason) {
80
+ return new ProviderError(`Provider ${provider} rejected the manifest${reason ? `: ${reason}` : ''}`, ProviderErrorCodes.MANIFEST_REJECTED, { provider, reason }, true, 'Review your deployment configuration and try again with a different provider', 'error');
81
+ }
82
+ /**
83
+ * Create a no bids received error
84
+ *
85
+ * @param timeout - How long we waited
86
+ * @returns ProviderError instance
87
+ */
88
+ export function noBidsReceivedError(timeout) {
89
+ return new ProviderError(`No bids received after waiting ${timeout}ms`, ProviderErrorCodes.NO_BIDS_RECEIVED, { timeout }, true, 'Try increasing your max price or adjusting resource requirements', 'warning');
90
+ }
91
+ /**
92
+ * Create a container timeout error
93
+ *
94
+ * @param service - Service that timed out
95
+ * @param timeout - Timeout duration
96
+ * @returns ProviderError instance
97
+ */
98
+ export function containerTimeoutError(service, timeout) {
99
+ return new ProviderError(`Container '${service}' failed to start within ${timeout}ms`, ProviderErrorCodes.CONTAINER_TIMEOUT, { service, timeout }, false, 'Check container logs for startup errors. The image may be too large or have configuration issues.', 'error');
100
+ }
101
+ /**
102
+ * Create a container start failed error
103
+ *
104
+ * @param service - Service that failed
105
+ * @param reason - Failure reason
106
+ * @returns ProviderError instance
107
+ */
108
+ export function containerStartFailedError(service, reason) {
109
+ return new ProviderError(`Container '${service}' failed to start${reason ? `: ${reason}` : ''}`, ProviderErrorCodes.CONTAINER_START_FAILED, { service, reason }, true, 'Check the container image and environment configuration', 'error');
110
+ }
111
+ /**
112
+ * Type guard to check if an error is a ProviderError
113
+ *
114
+ * @param error - The error to check
115
+ * @returns True if error is a ProviderError
116
+ */
117
+ export function isProviderError(error) {
118
+ return error instanceof ProviderError;
119
+ }
120
+ //# sourceMappingURL=provider-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-error.js","sourceRoot":"","sources":["../../src/errors/provider-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAyC,MAAM,uBAAuB,CAAC;AAE/F;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,sCAAsC;IACtC,oBAAoB,EAAE,sBAAsB;IAE5C,qCAAqC;IACrC,iBAAiB,EAAE,mBAAmB;IAEtC,0CAA0C;IAC1C,oBAAoB,EAAE,sBAAsB;IAE5C,qCAAqC;IACrC,qBAAqB,EAAE,uBAAuB;IAE9C,4CAA4C;IAC5C,sBAAsB,EAAE,wBAAwB;IAEhD,4CAA4C;IAC5C,iBAAiB,EAAE,mBAAmB;IAEtC,6CAA6C;IAC7C,qBAAqB,EAAE,uBAAuB;IAE9C,+CAA+C;IAC/C,gBAAgB,EAAE,kBAAkB;IAEpC,oCAAoC;IACpC,yBAAyB,EAAE,2BAA2B;IAEtD,qCAAqC;IACrC,gBAAgB,EAAE,kBAAkB;IAEpC,6BAA6B;IAC7B,cAAc,EAAE,gBAAgB;CACxB,CAAC;AAKX;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,aAAc,SAAQ,eAAe;IAChD,YACE,OAAe,EACf,OAA0B,kBAAkB,CAAC,cAAc,EAC3D,UAAwB,EAAE,EAC1B,cAAuB,KAAK,EAC5B,UAAmB,EACnB,WAA0B,OAAO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,OAAO,EAAE,EACpB,KAAK,EACL,mGAAmG,EACnG,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAe,EACf,MAAe;IAEf,OAAO,IAAI,aAAa,CACtB,cAAc,OAAO,oBAAoB,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EACtE,kBAAkB,CAAC,sBAAsB,EACzC,EAAE,OAAO,EAAE,MAAM,EAAE,EACnB,IAAI,EACJ,yDAAyD,EACzD,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,KAAK,YAAY,aAAa,CAAC;AACxC,CAAC"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Wallet-related error classes
3
+ *
4
+ * Errors specific to wallet connection, signing, and balance operations
5
+ *
6
+ * @module errors/wallet-error
7
+ */
8
+ import { DeploymentError, type ErrorContext, type ErrorSeverity } from './deployment-error.js';
9
+ /**
10
+ * Wallet error codes
11
+ */
12
+ export declare const WalletErrorCodes: {
13
+ /** Wallet extension not found (e.g., Keplr not installed) */
14
+ readonly WALLET_NOT_FOUND: "WALLET_NOT_FOUND";
15
+ /** User rejected wallet connection */
16
+ readonly CONNECTION_REJECTED: "CONNECTION_REJECTED";
17
+ /** Wallet is locked */
18
+ readonly WALLET_LOCKED: "WALLET_LOCKED";
19
+ /** Insufficient funds for transaction */
20
+ readonly INSUFFICIENT_FUNDS: "INSUFFICIENT_FUNDS";
21
+ /** Transaction signing failed */
22
+ readonly SIGNING_FAILED: "SIGNING_FAILED";
23
+ /** WalletConnect initialization failed */
24
+ readonly WALLETCONNECT_INIT_FAILED: "WALLETCONNECT_INIT_FAILED";
25
+ /** QR code modal was closed */
26
+ readonly QR_MODAL_CLOSED: "QR_MODAL_CLOSED";
27
+ /** Network mismatch (wallet on wrong network) */
28
+ readonly NETWORK_MISMATCH: "NETWORK_MISMATCH";
29
+ /** Account not found */
30
+ readonly ACCOUNT_NOT_FOUND: "ACCOUNT_NOT_FOUND";
31
+ /** WalletConnect project ID missing or invalid */
32
+ readonly MISSING_PROJECT_ID: "MISSING_PROJECT_ID";
33
+ /** WalletConnect client initialization failed */
34
+ readonly INIT_FAILED: "INIT_FAILED";
35
+ /** Failed to generate connection URI */
36
+ readonly URI_GENERATION_FAILED: "URI_GENERATION_FAILED";
37
+ /** WalletConnect connection failed */
38
+ readonly CONNECTION_FAILED: "CONNECTION_FAILED";
39
+ /** No accounts in WalletConnect session */
40
+ readonly NO_ACCOUNTS: "NO_ACCOUNTS";
41
+ /** Connection approval timed out */
42
+ readonly APPROVAL_TIMEOUT: "APPROVAL_TIMEOUT";
43
+ /** User rejected connection approval */
44
+ readonly APPROVAL_REJECTED: "APPROVAL_REJECTED";
45
+ /** Approval process failed */
46
+ readonly APPROVAL_FAILED: "APPROVAL_FAILED";
47
+ /** No accounts available from signer */
48
+ readonly NO_SIGNER_ACCOUNTS: "NO_SIGNER_ACCOUNTS";
49
+ /** Failed to create wallet context */
50
+ readonly CONTEXT_CREATION_FAILED: "CONTEXT_CREATION_FAILED";
51
+ /** Failed to disconnect wallet */
52
+ readonly DISCONNECT_FAILED: "DISCONNECT_FAILED";
53
+ /** Feature not yet implemented */
54
+ readonly NOT_IMPLEMENTED: "NOT_IMPLEMENTED";
55
+ /** Generic wallet error */
56
+ readonly WALLET_ERROR: "WALLET_ERROR";
57
+ };
58
+ export type WalletErrorCode = (typeof WalletErrorCodes)[keyof typeof WalletErrorCodes];
59
+ /**
60
+ * Wallet connection or operation error
61
+ *
62
+ * Thrown when wallet-related operations fail, including:
63
+ * - Wallet not found/installed
64
+ * - Connection rejected by user
65
+ * - Signing failures
66
+ * - Insufficient balance
67
+ *
68
+ * @example
69
+ * throw new WalletError(
70
+ * 'Keplr wallet not found',
71
+ * WalletErrorCodes.WALLET_NOT_FOUND,
72
+ * {},
73
+ * false,
74
+ * 'Please install the Keplr browser extension from https://keplr.app'
75
+ * );
76
+ */
77
+ export declare class WalletError extends DeploymentError {
78
+ constructor(message: string, code?: WalletErrorCode, context?: ErrorContext, recoverable?: boolean, suggestion?: string, severity?: ErrorSeverity, cause?: Error);
79
+ }
80
+ /**
81
+ * Create a wallet not found error
82
+ *
83
+ * @param walletType - Type of wallet that wasn't found
84
+ * @returns WalletError instance
85
+ */
86
+ export declare function walletNotFoundError(walletType: 'keplr' | 'walletconnect'): WalletError;
87
+ /**
88
+ * Create a connection rejected error
89
+ *
90
+ * @returns WalletError instance
91
+ */
92
+ export declare function connectionRejectedError(): WalletError;
93
+ /**
94
+ * Create an insufficient funds error
95
+ *
96
+ * @param required - Amount required
97
+ * @param available - Amount available
98
+ * @param denom - Token denomination
99
+ * @returns WalletError instance
100
+ */
101
+ export declare function insufficientFundsError(required: number, available: number, denom?: string): WalletError;
102
+ /**
103
+ * Create a wallet locked error
104
+ *
105
+ * @returns WalletError instance
106
+ */
107
+ export declare function walletLockedError(): WalletError;
108
+ /**
109
+ * Create a signing failed error
110
+ *
111
+ * @param operation - The operation that failed
112
+ * @param cause - Original error
113
+ * @returns WalletError instance
114
+ */
115
+ export declare function signingFailedError(operation: string, cause?: Error): WalletError;
116
+ /**
117
+ * Create a network mismatch error
118
+ *
119
+ * @param expected - Expected network
120
+ * @param actual - Actual network
121
+ * @returns WalletError instance
122
+ */
123
+ export declare function networkMismatchError(expected: string, actual: string): WalletError;
124
+ /**
125
+ * Type guard to check if an error is a WalletError
126
+ *
127
+ * @param error - The error to check
128
+ * @returns True if error is a WalletError
129
+ */
130
+ export declare function isWalletError(error: unknown): error is WalletError;
131
+ //# sourceMappingURL=wallet-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-error.d.ts","sourceRoot":"","sources":["../../src/errors/wallet-error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa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