@injectivelabs/exceptions 1.16.38 → 1.17.2-alpha.0

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 (133) hide show
  1. package/dist/cjs/index.cjs +2759 -0
  2. package/dist/cjs/index.d.cts +826 -0
  3. package/dist/cjs/package.json +2 -2
  4. package/dist/esm/index.d.ts +826 -3
  5. package/dist/esm/index.js +2712 -2
  6. package/dist/esm/package.json +2 -2
  7. package/package.json +37 -38
  8. package/dist/cjs/exceptions/base.d.ts +0 -81
  9. package/dist/cjs/exceptions/base.js +0 -179
  10. package/dist/cjs/exceptions/exceptions/BitGetException.d.ts +0 -7
  11. package/dist/cjs/exceptions/exceptions/BitGetException.js +0 -31
  12. package/dist/cjs/exceptions/exceptions/CosmosWalletException.d.ts +0 -7
  13. package/dist/cjs/exceptions/exceptions/CosmosWalletException.js +0 -16
  14. package/dist/cjs/exceptions/exceptions/GeneralException.d.ts +0 -5
  15. package/dist/cjs/exceptions/exceptions/GeneralException.js +0 -11
  16. package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.d.ts +0 -7
  17. package/dist/cjs/exceptions/exceptions/GrpcUnaryRequestException.js +0 -21
  18. package/dist/cjs/exceptions/exceptions/HttpRequestException.d.ts +0 -11
  19. package/dist/cjs/exceptions/exceptions/HttpRequestException.js +0 -21
  20. package/dist/cjs/exceptions/exceptions/LedgerCosmosException.d.ts +0 -7
  21. package/dist/cjs/exceptions/exceptions/LedgerCosmosException.js +0 -40
  22. package/dist/cjs/exceptions/exceptions/LedgerException.d.ts +0 -7
  23. package/dist/cjs/exceptions/exceptions/LedgerException.js +0 -40
  24. package/dist/cjs/exceptions/exceptions/MetamaskException.d.ts +0 -7
  25. package/dist/cjs/exceptions/exceptions/MetamaskException.js +0 -31
  26. package/dist/cjs/exceptions/exceptions/OkxWalletException.d.ts +0 -7
  27. package/dist/cjs/exceptions/exceptions/OkxWalletException.js +0 -31
  28. package/dist/cjs/exceptions/exceptions/RabbyWalletException.d.ts +0 -7
  29. package/dist/cjs/exceptions/exceptions/RabbyWalletException.js +0 -33
  30. package/dist/cjs/exceptions/exceptions/RainbowWalletException.d.ts +0 -7
  31. package/dist/cjs/exceptions/exceptions/RainbowWalletException.js +0 -31
  32. package/dist/cjs/exceptions/exceptions/TransactionException.d.ts +0 -7
  33. package/dist/cjs/exceptions/exceptions/TransactionException.js +0 -34
  34. package/dist/cjs/exceptions/exceptions/TrezorException.d.ts +0 -7
  35. package/dist/cjs/exceptions/exceptions/TrezorException.js +0 -16
  36. package/dist/cjs/exceptions/exceptions/TrustWalletException.d.ts +0 -7
  37. package/dist/cjs/exceptions/exceptions/TrustWalletException.js +0 -33
  38. package/dist/cjs/exceptions/exceptions/TurnkeyWalletSessionException.d.ts +0 -5
  39. package/dist/cjs/exceptions/exceptions/TurnkeyWalletSessionException.js +0 -11
  40. package/dist/cjs/exceptions/exceptions/WalletConnectException.d.ts +0 -7
  41. package/dist/cjs/exceptions/exceptions/WalletConnectException.js +0 -31
  42. package/dist/cjs/exceptions/exceptions/WalletException.d.ts +0 -5
  43. package/dist/cjs/exceptions/exceptions/WalletException.js +0 -11
  44. package/dist/cjs/exceptions/exceptions/Web3Exception.d.ts +0 -7
  45. package/dist/cjs/exceptions/exceptions/Web3Exception.js +0 -16
  46. package/dist/cjs/exceptions/exceptions/index.d.ts +0 -18
  47. package/dist/cjs/exceptions/exceptions/index.js +0 -37
  48. package/dist/cjs/exceptions/index.d.ts +0 -2
  49. package/dist/cjs/exceptions/index.js +0 -18
  50. package/dist/cjs/exceptions/messages.d.ts +0 -13
  51. package/dist/cjs/exceptions/messages.js +0 -1600
  52. package/dist/cjs/exceptions/types/codes.d.ts +0 -441
  53. package/dist/cjs/exceptions/types/codes.js +0 -774
  54. package/dist/cjs/exceptions/types/context.d.ts +0 -93
  55. package/dist/cjs/exceptions/types/context.js +0 -21
  56. package/dist/cjs/exceptions/types/index.d.ts +0 -3
  57. package/dist/cjs/exceptions/types/index.js +0 -19
  58. package/dist/cjs/exceptions/types/modules.d.ts +0 -67
  59. package/dist/cjs/exceptions/types/modules.js +0 -66
  60. package/dist/cjs/exceptions/utils/grpc.d.ts +0 -3
  61. package/dist/cjs/exceptions/utils/grpc.js +0 -43
  62. package/dist/cjs/exceptions/utils/helpers.d.ts +0 -1
  63. package/dist/cjs/exceptions/utils/helpers.js +0 -24
  64. package/dist/cjs/exceptions/utils/maps.d.ts +0 -13
  65. package/dist/cjs/exceptions/utils/maps.js +0 -127
  66. package/dist/cjs/index.d.ts +0 -3
  67. package/dist/cjs/index.js +0 -18
  68. package/dist/cjs/types.d.ts +0 -2
  69. package/dist/cjs/types.js +0 -2
  70. package/dist/cjs/utils.d.ts +0 -8
  71. package/dist/cjs/utils.js +0 -49
  72. package/dist/esm/exceptions/base.d.ts +0 -81
  73. package/dist/esm/exceptions/base.js +0 -175
  74. package/dist/esm/exceptions/exceptions/BitGetException.d.ts +0 -7
  75. package/dist/esm/exceptions/exceptions/BitGetException.js +0 -27
  76. package/dist/esm/exceptions/exceptions/CosmosWalletException.d.ts +0 -7
  77. package/dist/esm/exceptions/exceptions/CosmosWalletException.js +0 -12
  78. package/dist/esm/exceptions/exceptions/GeneralException.d.ts +0 -5
  79. package/dist/esm/exceptions/exceptions/GeneralException.js +0 -7
  80. package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.d.ts +0 -7
  81. package/dist/esm/exceptions/exceptions/GrpcUnaryRequestException.js +0 -17
  82. package/dist/esm/exceptions/exceptions/HttpRequestException.d.ts +0 -11
  83. package/dist/esm/exceptions/exceptions/HttpRequestException.js +0 -17
  84. package/dist/esm/exceptions/exceptions/LedgerCosmosException.d.ts +0 -7
  85. package/dist/esm/exceptions/exceptions/LedgerCosmosException.js +0 -36
  86. package/dist/esm/exceptions/exceptions/LedgerException.d.ts +0 -7
  87. package/dist/esm/exceptions/exceptions/LedgerException.js +0 -36
  88. package/dist/esm/exceptions/exceptions/MetamaskException.d.ts +0 -7
  89. package/dist/esm/exceptions/exceptions/MetamaskException.js +0 -27
  90. package/dist/esm/exceptions/exceptions/OkxWalletException.d.ts +0 -7
  91. package/dist/esm/exceptions/exceptions/OkxWalletException.js +0 -27
  92. package/dist/esm/exceptions/exceptions/RabbyWalletException.d.ts +0 -7
  93. package/dist/esm/exceptions/exceptions/RabbyWalletException.js +0 -29
  94. package/dist/esm/exceptions/exceptions/RainbowWalletException.d.ts +0 -7
  95. package/dist/esm/exceptions/exceptions/RainbowWalletException.js +0 -27
  96. package/dist/esm/exceptions/exceptions/TransactionException.d.ts +0 -7
  97. package/dist/esm/exceptions/exceptions/TransactionException.js +0 -30
  98. package/dist/esm/exceptions/exceptions/TrezorException.d.ts +0 -7
  99. package/dist/esm/exceptions/exceptions/TrezorException.js +0 -12
  100. package/dist/esm/exceptions/exceptions/TrustWalletException.d.ts +0 -7
  101. package/dist/esm/exceptions/exceptions/TrustWalletException.js +0 -29
  102. package/dist/esm/exceptions/exceptions/TurnkeyWalletSessionException.d.ts +0 -5
  103. package/dist/esm/exceptions/exceptions/TurnkeyWalletSessionException.js +0 -7
  104. package/dist/esm/exceptions/exceptions/WalletConnectException.d.ts +0 -7
  105. package/dist/esm/exceptions/exceptions/WalletConnectException.js +0 -27
  106. package/dist/esm/exceptions/exceptions/WalletException.d.ts +0 -5
  107. package/dist/esm/exceptions/exceptions/WalletException.js +0 -7
  108. package/dist/esm/exceptions/exceptions/Web3Exception.d.ts +0 -7
  109. package/dist/esm/exceptions/exceptions/Web3Exception.js +0 -12
  110. package/dist/esm/exceptions/exceptions/index.d.ts +0 -18
  111. package/dist/esm/exceptions/exceptions/index.js +0 -18
  112. package/dist/esm/exceptions/index.d.ts +0 -2
  113. package/dist/esm/exceptions/index.js +0 -2
  114. package/dist/esm/exceptions/messages.d.ts +0 -13
  115. package/dist/esm/exceptions/messages.js +0 -1597
  116. package/dist/esm/exceptions/types/codes.d.ts +0 -441
  117. package/dist/esm/exceptions/types/codes.js +0 -770
  118. package/dist/esm/exceptions/types/context.d.ts +0 -93
  119. package/dist/esm/exceptions/types/context.js +0 -18
  120. package/dist/esm/exceptions/types/index.d.ts +0 -3
  121. package/dist/esm/exceptions/types/index.js +0 -3
  122. package/dist/esm/exceptions/types/modules.d.ts +0 -67
  123. package/dist/esm/exceptions/types/modules.js +0 -63
  124. package/dist/esm/exceptions/utils/grpc.d.ts +0 -3
  125. package/dist/esm/exceptions/utils/grpc.js +0 -6
  126. package/dist/esm/exceptions/utils/helpers.d.ts +0 -1
  127. package/dist/esm/exceptions/utils/helpers.js +0 -20
  128. package/dist/esm/exceptions/utils/maps.d.ts +0 -13
  129. package/dist/esm/exceptions/utils/maps.js +0 -120
  130. package/dist/esm/types.d.ts +0 -2
  131. package/dist/esm/types.js +0 -1
  132. package/dist/esm/utils.d.ts +0 -8
  133. package/dist/esm/utils.js +0 -44
@@ -0,0 +1,2759 @@
1
+
2
+ //#region src/utils.ts
3
+ const THROWN_EXCEPTIONS = [
4
+ "Web3Exception",
5
+ "LedgerException",
6
+ "TrezorException",
7
+ "WalletException",
8
+ "BitGetException",
9
+ "GeneralException",
10
+ "MetamaskException",
11
+ "OkxWalletException",
12
+ "HttpRequestException",
13
+ "TransactionException",
14
+ "TrustWalletException",
15
+ "LedgerCosmosException",
16
+ "CosmosWalletException",
17
+ "WalletConnectException",
18
+ "GrpcUnaryRequestException",
19
+ "TurnkeyWalletSessionException"
20
+ ];
21
+ const isThrownException = (exception) => {
22
+ if (THROWN_EXCEPTIONS.includes(exception.constructor.name)) return true;
23
+ if (THROWN_EXCEPTIONS.includes(exception.name)) return true;
24
+ if ("errorClass" in exception && THROWN_EXCEPTIONS.includes(exception.errorClass)) return true;
25
+ return false;
26
+ };
27
+ const formatNotificationDescription = (description) => {
28
+ const DESCRIPTION_CHARACTER_LIMIT = 50;
29
+ if (description.length <= DESCRIPTION_CHARACTER_LIMIT) return {
30
+ description,
31
+ tooltip: ""
32
+ };
33
+ return {
34
+ description: description.slice(0, DESCRIPTION_CHARACTER_LIMIT) + " ...",
35
+ tooltip: description
36
+ };
37
+ };
38
+
39
+ //#endregion
40
+ //#region src/exceptions/types/codes.ts
41
+ const GrpcErrorCode = {
42
+ OK: 0,
43
+ Canceled: 1,
44
+ Unknown: 2,
45
+ InvalidArgument: 3,
46
+ DeadlineExceeded: 4,
47
+ NotFound: 5,
48
+ AlreadyExists: 6,
49
+ PermissionDenied: 7,
50
+ ResourceExhausted: 8,
51
+ FailedPrecondition: 9,
52
+ Aborted: 10,
53
+ OutOfRange: 11,
54
+ Unimplemented: 12,
55
+ Internal: 13,
56
+ Unavailable: 14,
57
+ DataLoss: 15,
58
+ Unauthenticated: 16
59
+ };
60
+ const grpcErrorCodeToErrorCode = (grpcErrorCode) => {
61
+ return grpcErrorCode;
62
+ };
63
+ const TransactionChainErrorModule = {
64
+ Auction: "auction",
65
+ CosmosSdk: "sdk",
66
+ Staking: "staking",
67
+ Bank: "bank",
68
+ Distribution: "distribution",
69
+ Gov: "gov",
70
+ Exchange: "exchange",
71
+ Insurance: "insurance",
72
+ Ocr: "ocr",
73
+ Oracle: "oracle",
74
+ Peggy: "peggy",
75
+ TokenFactory: "tokenfactory",
76
+ Wasmx: "wasmx",
77
+ Wasm: "wasm",
78
+ AuthZ: "authz"
79
+ };
80
+ const ChainCosmosErrorCode = {
81
+ ErrTxDecode: 2,
82
+ ErrInvalidSequence: 3,
83
+ ErrUnauthorized: 4,
84
+ ErrInsufficientFunds: 5,
85
+ ErrUnknownRequest: 6,
86
+ ErrInvalidAddress: 7,
87
+ ErrInvalidPubKey: 8,
88
+ ErrUnknownAddress: 9,
89
+ ErrInvalidCoins: 10,
90
+ ErrOutOfGas: 11,
91
+ ErrMemoTooLarge: 12,
92
+ ErrInsufficientFee: 13,
93
+ ErrTooManySignatures: 14,
94
+ ErrNoSignatures: 15,
95
+ ErrJSONMarshal: 16,
96
+ ErrJSONUnmarshal: 17,
97
+ ErrInvalidRequest: 18,
98
+ ErrTxInMempoolCache: 19,
99
+ ErrMempoolIsFull: 20,
100
+ ErrTxTooLarge: 21,
101
+ ErrKeyNotFound: 22,
102
+ ErrWrongPassword: 23,
103
+ ErrorInvalidSigner: 24,
104
+ ErrorInvalidGasAdjustment: 25,
105
+ ErrInvalidHeight: 26,
106
+ ErrInvalidVersion: 27,
107
+ ErrInvalidChainID: 28,
108
+ ErrInvalidType: 29,
109
+ ErrTxTimeoutHeight: 30,
110
+ ErrUnknownExtensionOptions: 31,
111
+ ErrWrongSequence: 32,
112
+ ErrPackAny: 33,
113
+ ErrUnpackAny: 34,
114
+ ErrLogic: 35,
115
+ ErrConflict: 36,
116
+ ErrNotSupported: 37,
117
+ ErrNotFound: 38,
118
+ ErrIO: 39,
119
+ ErrAppConfig: 40,
120
+ ErrInvalidGasLimit: 41
121
+ };
122
+ const ChainExchangeModuleErrorCode = {
123
+ ErrOrderInvalid: 1,
124
+ ErrSpotMarketNotFound: 2,
125
+ ErrSpotMarketExists: 3,
126
+ ErrBadField: 4,
127
+ ErrMarketInvalid: 5,
128
+ ErrInsufficientDeposit: 6,
129
+ ErrUnrecognizedOrderType: 7,
130
+ ErrInsufficientPositionQuantity: 8,
131
+ ErrOrderHashInvalid: 9,
132
+ ErrBadSubaccountID: 10,
133
+ ErrInvalidTicker: 11,
134
+ ErrInvalidBaseDenom: 12,
135
+ ErrInvalidQuoteDenom: 13,
136
+ ErrInvalidOracle: 14,
137
+ ErrInvalidExpiry: 15,
138
+ ErrInvalidPrice: 16,
139
+ ErrInvalidQuantity: 17,
140
+ ErrUnsupportedOracleType: 18,
141
+ ErrOrderDoesntExist: 19,
142
+ ErrOrderbookFillInvalid: 20,
143
+ ErrPerpetualMarketExists: 21,
144
+ ErrExpiryFuturesMarketExists: 22,
145
+ ErrExpiryFuturesMarketExpired: 23,
146
+ ErrNoLiquidity: 24,
147
+ ErrSlippageExceedsWorstPrice: 25,
148
+ ErrInsufficientOrderMargin: 26,
149
+ ErrDerivativeMarketNotFound: 27,
150
+ ErrPositionNotFound: 28,
151
+ ErrInvalidReduceOnlyPositionDirection: 29,
152
+ ErrPriceSurpassesBankruptcyPrice: 30,
153
+ ErrPositionNotLiquidable: 31,
154
+ ErrInvalidTriggerPrice: 32,
155
+ ErrInvalidOracleType: 33,
156
+ ErrInvalidPriceTickSize: 34,
157
+ ErrInvalidQuantityTickSize: 35,
158
+ ErrInvalidMargin: 36,
159
+ ErrExceedsOrderSideCount: 37,
160
+ ErrMarketOrderAlreadyExists: 38,
161
+ ErrConditionalMarketOrderAlreadyExists: 39,
162
+ ErrMarketLaunchProposalAlreadyExists: 40,
163
+ ErrInvalidMarketStatus: 41,
164
+ ErrSameDenoms: 42,
165
+ ErrSameOracles: 43,
166
+ ErrFeeRatesRelation: 44,
167
+ ErrMarginsRelation: 45,
168
+ ErrExceedsMaxOracleScaleFactor: 46,
169
+ ErrSpotExchangeNotEnabled: 47,
170
+ ErrDerivativesExchangeNotEnabled: 48,
171
+ ErrOraclePriceDeltaExceedsThreshold: 49,
172
+ ErrInvalidHourlyInterestRate: 50,
173
+ ErrInvalidHourlyFundingRateCap: 51,
174
+ ErrInvalidMarketFundingParamUpdate: 52,
175
+ ErrInvalidTradingRewardCampaign: 53,
176
+ ErrInvalidFeeDiscountSchedule: 54,
177
+ ErrInvalidLiquidationOrder: 55,
178
+ ErrTradingRewardCampaignDistributionError: 56,
179
+ ErrInvalidTradingRewardsPendingPointsUpdate: 57,
180
+ ErrInvalidBatchMsgUpdate: 58,
181
+ ErrExceedsTopOfBookPrice: 59,
182
+ ErrInvalidOrderTypeForMessage: 60,
183
+ ErrInvalidDMMSender: 61,
184
+ ErrAlreadyOptedOutOfRewards: 62,
185
+ ErrInvalidMarginRatio: 63,
186
+ ErrBelowMinimalContribution: 64,
187
+ ErrLowPositionMargin: 65,
188
+ ErrInvalidTotalSupply: 66,
189
+ ErrInvalidLpTokenBurnAmount: 67,
190
+ ErrUnsupportedAction: 68,
191
+ ErrNegativePositionQuantity: 69,
192
+ ErrBinaryOptionsMarketExists: 70,
193
+ ErrBinaryOptionsMarketNotFound: 71,
194
+ ErrInvalidSettlement: 72,
195
+ ErrAccountDoesntExist: 73,
196
+ ErrSenderIsNotAnAdmin: 74,
197
+ ErrMarketAlreadyScheduledToSettle: 75,
198
+ ErrGenericMarketNotFound: 76,
199
+ ErrInvalidDenomDecimal: 77,
200
+ ErrInvalidState: 78,
201
+ ErrTransientOrdersUpToCancelNotSupported: 79,
202
+ ErrInvalidTrade: 80,
203
+ ErrNoMarginLocked: 81,
204
+ ErrInvalidAccessLevel: 82,
205
+ ErrInvalidAddress: 83,
206
+ ErrInvalidArgument: 84,
207
+ ErrInvalidFundsDirection: 85,
208
+ ErrNoFundsProvided: 86,
209
+ ErrInvalidSignature: 87,
210
+ ErrNoFundsToUnlock: 88,
211
+ ErrNoMsgsProvided: 89,
212
+ ErrNoMsgProvided: 90,
213
+ ErrInvalidAmount: 91,
214
+ ErrFeatureDisabled: 92,
215
+ ErrTooMuchOrderMargin: 93,
216
+ ErrBadSubaccountNonce: 94,
217
+ ErrInsufficientFunds: 95,
218
+ ErrPostOnlyMode: 96,
219
+ ErrClientOrderIdAlreadyExists: 97,
220
+ ErrInvalidCid: 98
221
+ };
222
+ const ChainAuctionErrorCodes = {
223
+ ErrBidInvalid: 1,
224
+ ErrBidRound: 2
225
+ };
226
+ const ChainAuthZErrorCodes = {
227
+ ErrNoAuthorizationFound: 2,
228
+ ErrInvalidExpirationTime: 3,
229
+ ErrUnknownAuthorizationType: 4,
230
+ ErrNoGrantKeyFound: 5,
231
+ ErrAuthorizationExpired: 6,
232
+ ErrGranteeIsGranter: 7,
233
+ ErrAuthorizationNumOfSigners: 9,
234
+ ErrNegativeMaxTokens: 12
235
+ };
236
+ const ChainInsuranceErrorCodes = {
237
+ ErrInsuranceFundAlreadyExists: 1,
238
+ ErrInsuranceFundNotFound: 2,
239
+ ErrRedemptionAlreadyExists: 3,
240
+ ErrInvalidDepositAmount: 4,
241
+ ErrInvalidDepositDenom: 5,
242
+ ErrPayoutTooLarge: 6,
243
+ ErrInvalidTicker: 7,
244
+ ErrInvalidQuoteDenom: 8,
245
+ ErrInvalidOracle: 9,
246
+ ErrInvalidExpirationTime: 10,
247
+ ErrInvalidMarketID: 11,
248
+ ErrInvalidShareDenom: 12
249
+ };
250
+ const ChainOcrErrorCodes = {
251
+ ErrStaleReport: 1,
252
+ ErrIncompleteProposal: 2,
253
+ ErrRepeatedAddress: 3,
254
+ ErrTooManySigners: 4,
255
+ ErrIncorrectConfig: 5,
256
+ ErrConfigDigestNotMatch: 6,
257
+ ErrWrongNumberOfSignatures: 7,
258
+ ErrIncorrectSignature: 8,
259
+ ErrNoTransmitter: 9,
260
+ ErrIncorrectTransmissionData: 10,
261
+ ErrNoTransmissionsFound: 11,
262
+ ErrMedianValueOutOfBounds: 12,
263
+ ErrIncorrectRewardPoolDenom: 13,
264
+ ErrNoRewardPool: 14,
265
+ ErrInvalidPayees: 15,
266
+ ErrModuleAdminRestricted: 16,
267
+ ErrFeedAlreadyExists: 17,
268
+ ErrFeedDoesntExists: 19,
269
+ ErrAdminRestricted: 20,
270
+ ErrInsufficientRewardPool: 21,
271
+ ErrPayeeAlreadySet: 22,
272
+ ErrPayeeRestricted: 23,
273
+ ErrFeedConfigNotFound: 24
274
+ };
275
+ const ChainOracleErrorCodes = {
276
+ ErrEmptyRelayerAddr: 1,
277
+ ErrBadRatesCount: 2,
278
+ ErrBadResolveTimesCount: 3,
279
+ ErrBadRequestIDsCount: 4,
280
+ ErrRelayerNotAuthorized: 5,
281
+ ErrBadPriceFeedBaseCount: 6,
282
+ ErrBadPriceFeedQuoteCount: 7,
283
+ ErrUnsupportedOracleType: 8,
284
+ ErrBadMessagesCount: 9,
285
+ ErrBadCoinbaseMessage: 10,
286
+ ErrInvalidEthereumSignature: 11,
287
+ ErrBadCoinbaseMessageTimestamp: 12,
288
+ ErrCoinbasePriceNotFound: 13,
289
+ ErrBadPrice: 14,
290
+ ErrPriceTooLarge: 15,
291
+ ErrInvalidBandIBCRequest: 16,
292
+ ErrSample: 17,
293
+ ErrInvalidPacketTimeout: 18,
294
+ ErrBadSymbolsCount: 19,
295
+ ErrBadIBCPortBind: 20,
296
+ ErrInvalidPortID: 21,
297
+ ErrInvalidChannelID: 22,
298
+ ErrBadRequestInterval: 23,
299
+ ErrInvalidBandIBCUpdateRequest: 24,
300
+ ErrBandIBCRequestNotFound: 25,
301
+ ErrEmptyBaseInfo: 26,
302
+ ErrEmptyProvider: 27,
303
+ ErrInvalidProvider: 28,
304
+ ErrInvalidSymbol: 29,
305
+ ErrRelayerAlreadyExists: 30,
306
+ ErrProviderPriceNotFound: 31,
307
+ ErrInvalidOracleRequest: 32,
308
+ ErrOraclePriceNotFound: 33
309
+ };
310
+ const ChainPeggyErrorCodes = {
311
+ ErrInternal: 1,
312
+ ErrDuplicate: 2,
313
+ ErrInvalid: 3,
314
+ ErrTimeout: 4,
315
+ ErrUnknown: 5,
316
+ ErrEmpty: 6,
317
+ ErrOutdated: 7,
318
+ ErrUnsupported: 8,
319
+ ErrNonContiguousEventNonce: 9,
320
+ ErrNoUnbatchedTxsFound: 10,
321
+ ErrResetDelegateKeys: 11,
322
+ ErrSupplyOverflow: 12,
323
+ ErrInvalidEthSender: 13,
324
+ ErrInvalidEthDestination: 14
325
+ };
326
+ const ChainTokenFactoryErrorCodes = {
327
+ ErrDenomExists: 2,
328
+ ErrUnauthorized: 3,
329
+ ErrInvalidDenom: 4,
330
+ ErrInvalidCreator: 5,
331
+ ErrInvalidAuthorityMetadata: 6,
332
+ ErrInvalidGenesis: 7,
333
+ ErrSubdenomTooLong: 8,
334
+ ErrSubdenomTooShort: 9,
335
+ ErrSubdenomNestedTooShort: 10,
336
+ ErrCreatorTooLong: 11,
337
+ ErrDenomDoesNotExist: 12,
338
+ ErrAmountNotPositive: 13
339
+ };
340
+ const ChainWasmXErrorCodes = {
341
+ ErrInvalidGasLimit: 1,
342
+ ErrInvalidGasPrice: 2,
343
+ ErrInvalidContractAddress: 3,
344
+ ErrAlreadyRegistered: 4,
345
+ ErrDuplicateContract: 5,
346
+ ErrNoContractAddresses: 6,
347
+ ErrInvalidCodeId: 7
348
+ };
349
+ const ChainStakingErrorCodes = {
350
+ ErrEmptyValidatorAddr: 2,
351
+ ErrNoValidatorFound: 3,
352
+ ErrValidatorOwnerExists: 4,
353
+ ErrValidatorPubKeyExists: 5,
354
+ ErrValidatorPubKeyTypeNotSupported: 6,
355
+ ErrValidatorJailed: 7,
356
+ ErrBadRemoveValidator: 8,
357
+ ErrCommissionNegative: 9,
358
+ ErrCommissionHuge: 10,
359
+ ErrCommissionGTMaxRate: 11,
360
+ ErrCommissionUpdateTime: 12,
361
+ ErrCommissionChangeRateNegative: 13,
362
+ ErrCommissionChangeRateGTMaxRate: 14,
363
+ ErrCommissionGTMaxChangeRate: 15,
364
+ ErrSelfDelegationBelowMinimum: 16,
365
+ ErrMinSelfDelegationDecreased: 17,
366
+ ErrEmptyDelegatorAddr: 18,
367
+ ErrNoDelegation: 19,
368
+ ErrBadDelegatorAddr: 20,
369
+ ErrNoDelegatorForAddress: 21,
370
+ ErrInsufficientShares: 22,
371
+ ErrDelegationValidatorEmpty: 23,
372
+ ErrNotEnoughDelegationShares: 24,
373
+ ErrNotMature: 25,
374
+ ErrNoUnbondingDelegation: 26,
375
+ ErrMaxUnbondingDelegationEntries: 27,
376
+ ErrNoRedelegation: 28,
377
+ ErrSelfRedelegation: 29,
378
+ ErrTinyRedelegationAmount: 30,
379
+ ErrBadRedelegationDst: 31,
380
+ ErrTransitiveRedelegation: 32,
381
+ ErrMaxRedelegationEntries: 33,
382
+ ErrDelegatorShareExRateInvalid: 34,
383
+ ErrBothShareMsgsGiven: 35,
384
+ ErrNeitherShareMsgsGiven: 36,
385
+ ErrInvalidHistoricalInfo: 37,
386
+ ErrNoHistoricalInfo: 38,
387
+ ErrEmptyValidatorPubKey: 39,
388
+ ErrCommissionLTMinRate: 40,
389
+ ErrUnbondingNotFound: 41,
390
+ ErrUnbondingOnHoldRefCountNegative: 42
391
+ };
392
+ const ChainGovErrorCodes = {
393
+ ErrUnknownProposal: 2,
394
+ ErrInactiveProposal: 3,
395
+ ErrAlreadyActiveProposal: 4,
396
+ ErrInvalidProposalContent: 5,
397
+ ErrInvalidProposalType: 6,
398
+ ErrInvalidVote: 7,
399
+ ErrInvalidGenesis: 8,
400
+ ErrNoProposalHandlerExists: 9,
401
+ ErrUnroutableProposalMsg: 10,
402
+ ErrNoProposalMsgs: 11,
403
+ ErrInvalidProposalMsg: 12,
404
+ ErrInvalidSigner: 13,
405
+ ErrInvalidSignalMsg: 14,
406
+ ErrMetadataTooLong: 15,
407
+ ErrMinDepositTooSmall: 16,
408
+ ErrProposalNotFound: 17,
409
+ ErrInvalidProposer: 18,
410
+ ErrNoDeposits: 19,
411
+ ErrVotingPeriodEnded: 20,
412
+ ErrInvalidProposal: 21
413
+ };
414
+ const ChainDistributionErrorCodes = {
415
+ ErrEmptyDelegatorAddr: 2,
416
+ ErrEmptyWithdrawAddr: 3,
417
+ ErrEmptyValidatorAddr: 4,
418
+ ErrEmptyDelegationDistInfo: 5,
419
+ ErrNoValidatorDistInfo: 6,
420
+ ErrNoValidatorCommission: 7,
421
+ ErrSetWithdrawAddrDisabled: 8,
422
+ ErrBadDistribution: 9,
423
+ ErrInvalidProposalAmount: 10,
424
+ ErrEmptyProposalRecipient: 11,
425
+ ErrNoValidatorExists: 12,
426
+ ErrNoDelegationExists: 13
427
+ };
428
+ const ChainBankErrorCodes = {
429
+ ErrNoInputs: 2,
430
+ ErrNoOutputs: 3,
431
+ ErrInputOutputMismatch: 4,
432
+ ErrSendDisabled: 5,
433
+ ErrDenomMetadataNotFound: 6,
434
+ ErrInvalidKey: 7,
435
+ ErrDuplicateEntry: 8,
436
+ ErrMultipleSenders: 9
437
+ };
438
+ const ChainWasmErrorCodes = {
439
+ ErrCreateFailed: 2,
440
+ ErrAccountExists: 3,
441
+ ErrInstantiateFailed: 4,
442
+ ErrExecuteFailed: 5,
443
+ ErrGasLimit: 6,
444
+ ErrInvalidGenesis: 7,
445
+ ErrNotFound: 8,
446
+ ErrQueryFailed: 9,
447
+ ErrInvalidMsg: 10,
448
+ ErrMigrationFailed: 11,
449
+ ErrEmpty: 12,
450
+ ErrLimit: 13,
451
+ ErrInvalid: 14,
452
+ ErrDuplicate: 15,
453
+ ErrMaxIBCChannels: 16,
454
+ ErrUnsupportedForContract: 17,
455
+ ErrPinContractFailed: 18,
456
+ ErrUnpinContractFailed: 19,
457
+ ErrUnknownMsg: 20,
458
+ ErrInvalidEvent: 21
459
+ };
460
+ const UnspecifiedErrorCode = -1;
461
+ const GRPC_REQUEST_FAILED = GrpcErrorCode.Unavailable;
462
+
463
+ //#endregion
464
+ //#region src/exceptions/types/modules.ts
465
+ const ContractErrorModule = {
466
+ Peggy: "peggy-contract",
467
+ PeggyOld: "peggy-old-contract",
468
+ Erc20Contract: "erc20-contract"
469
+ };
470
+ const ChainErrorModule = {
471
+ Gov: "chain-gov",
472
+ Ibc: "chain-ibc",
473
+ Evm: "chain-evm",
474
+ Auth: "chain-auth",
475
+ Bank: "chain-bank",
476
+ Mint: "chain-mint",
477
+ Wasm: "chain-wasm",
478
+ Authz: "chain-authz",
479
+ Peggy: "chain-peggy",
480
+ WasmX: "chain-wasmx",
481
+ Erc20: "chain-erc20",
482
+ Oracle: "chain-oracle",
483
+ TxFees: "chain-tx-fees",
484
+ Auction: "chain-auction",
485
+ Staking: "chain-staking",
486
+ Exchange: "chain-exchange",
487
+ Tendermint: "chain-tendermint",
488
+ InsuranceFund: "chain-insurance",
489
+ Permissions: "chain-permissions",
490
+ Distribution: "chain-distribution"
491
+ };
492
+ const IndexerErrorModule = {
493
+ Dmm: "dmm",
494
+ OLP: "olp",
495
+ Abacus: "abacus",
496
+ Meta: "indexer-meta",
497
+ Mito: "indexer-mito",
498
+ Referral: "referral",
499
+ Spot: "indexer-spot",
500
+ Web3Gw: "web3-gateway",
501
+ Oracle: "indexer-oracle",
502
+ Account: "indexer-account",
503
+ Auction: "indexer-auction",
504
+ Trading: "indexer-trading",
505
+ Archiver: "indexer-archiver",
506
+ Explorer: "indexer-explorer",
507
+ Campaign: "indexer-campaign",
508
+ Portfolio: "indexer-portfolio",
509
+ MegaVault: "indexer-mega-vault",
510
+ Derivatives: "indexer-derivatives",
511
+ Transaction: "indexer-transaction",
512
+ ChronosSpot: "indexer-chronos-spot",
513
+ InsuranceFund: "indexer-insurance-fund",
514
+ ChronosMarkets: "indexer-chronos-markets",
515
+ ChronosDerivative: "indexer-chronos-derivative"
516
+ };
517
+ const WalletErrorActionModule = {
518
+ GetChainId: "get-chain-id",
519
+ GetAccounts: "get-accounts",
520
+ GetNetworkId: "get-network-id",
521
+ SignArbitrary: "sign-arbitrary",
522
+ SignTransaction: "sign-transaction",
523
+ SendTransaction: "send-transaction",
524
+ SendEvmTransaction: "send-evm-transaction",
525
+ SignEvmTransaction: "sign-evm-transaction",
526
+ GetEvmTransactionReceipt: "get-evm-transaction-receipt"
527
+ };
528
+
529
+ //#endregion
530
+ //#region src/exceptions/types/context.ts
531
+ const HttpRequestMethod = {
532
+ Get: "GET",
533
+ Post: "POST",
534
+ Options: "OPTIONS"
535
+ };
536
+ const ErrorType = {
537
+ Unspecified: "unspecified",
538
+ ChainError: "chain-error",
539
+ ExecutionError: "execution-error",
540
+ NotFoundError: "not-found-error",
541
+ ValidationError: "validation-error",
542
+ WalletError: "wallet-error",
543
+ WalletNotInstalledError: "wallet-not-installed-error",
544
+ GrpcUnaryRequest: "grpc-unary-request",
545
+ HttpRequest: "http-request",
546
+ Web3: "web3",
547
+ Web3Gateway: "web3-gateway"
548
+ };
549
+
550
+ //#endregion
551
+ //#region \0@oxc-project+runtime@0.98.0/helpers/typeof.js
552
+ function _typeof(o) {
553
+ "@babel/helpers - typeof";
554
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
555
+ return typeof o$1;
556
+ } : function(o$1) {
557
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
558
+ }, _typeof(o);
559
+ }
560
+
561
+ //#endregion
562
+ //#region \0@oxc-project+runtime@0.98.0/helpers/toPrimitive.js
563
+ function toPrimitive(t, r) {
564
+ if ("object" != _typeof(t) || !t) return t;
565
+ var e = t[Symbol.toPrimitive];
566
+ if (void 0 !== e) {
567
+ var i = e.call(t, r || "default");
568
+ if ("object" != _typeof(i)) return i;
569
+ throw new TypeError("@@toPrimitive must return a primitive value.");
570
+ }
571
+ return ("string" === r ? String : Number)(t);
572
+ }
573
+
574
+ //#endregion
575
+ //#region \0@oxc-project+runtime@0.98.0/helpers/toPropertyKey.js
576
+ function toPropertyKey(t) {
577
+ var i = toPrimitive(t, "string");
578
+ return "symbol" == _typeof(i) ? i : i + "";
579
+ }
580
+
581
+ //#endregion
582
+ //#region \0@oxc-project+runtime@0.98.0/helpers/defineProperty.js
583
+ function _defineProperty(e, r, t) {
584
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
585
+ value: t,
586
+ enumerable: !0,
587
+ configurable: !0,
588
+ writable: !0
589
+ }) : e[r] = t, e;
590
+ }
591
+
592
+ //#endregion
593
+ //#region src/exceptions/base.ts
594
+ /**
595
+ * we have to define it here as
596
+ * well as in @injectivelabs/utils as that package is
597
+ * importing the exceptions package
598
+ * */
599
+ const toPascalCase = (str) => {
600
+ return `${str}`.toLowerCase().replace(new RegExp(/[-_]+/, "g"), " ").replace(new RegExp(/[^\w\s]/, "g"), "").replace(new RegExp(/\s+(.)(\w*)/, "g"), (_$1, $2, $3) => `${$2.toUpperCase() + $3}`).replace(/* @__PURE__ */ new RegExp(/\w/), (s) => s.toUpperCase());
601
+ };
602
+ var ConcreteException = class extends Error {
603
+ constructor(error, context) {
604
+ super(error.message);
605
+ _defineProperty(this, "type", ErrorType.Unspecified);
606
+ _defineProperty(this, "code", UnspecifiedErrorCode);
607
+ _defineProperty(this, "name", void 0);
608
+ _defineProperty(this, "errorClass", void 0);
609
+ _defineProperty(this, "context", void 0);
610
+ _defineProperty(this, "contextModule", void 0);
611
+ _defineProperty(this, "contextCode", void 0);
612
+ _defineProperty(this, "message", "");
613
+ _defineProperty(this, "stack", "");
614
+ _defineProperty(this, "originalMessage", "");
615
+ _defineProperty(this, "skipParsing", false);
616
+ this.skipParsing = (context === null || context === void 0 ? void 0 : context.skipParsing) || false;
617
+ this.parseError(error);
618
+ this.parseContext(context);
619
+ this.parse();
620
+ }
621
+ parse() {}
622
+ parseError(error) {
623
+ this.setStack(error.stack || "");
624
+ this.setMessage(error.message);
625
+ this.originalMessage = error.message;
626
+ }
627
+ parseContext(errorContext) {
628
+ const { contextModule, type, code, context } = errorContext || {
629
+ contextModule: "Unknown",
630
+ context: "Unknown",
631
+ code: UnspecifiedErrorCode,
632
+ type: ErrorType.Unspecified
633
+ };
634
+ this.context = context;
635
+ this.contextModule = contextModule;
636
+ this.type = type || ErrorType.Unspecified;
637
+ this.code = code || UnspecifiedErrorCode;
638
+ }
639
+ setType(type) {
640
+ this.type = type;
641
+ }
642
+ setCode(code) {
643
+ this.code = code;
644
+ }
645
+ setContext(context) {
646
+ this.context = context;
647
+ }
648
+ setOriginalMessage(message) {
649
+ this.originalMessage = message;
650
+ }
651
+ setStack(stack) {
652
+ try {
653
+ this.stack = stack;
654
+ } catch (_unused) {}
655
+ }
656
+ setName(name) {
657
+ this.name = name;
658
+ this.errorClass = name;
659
+ super.name = name;
660
+ }
661
+ setMessage(message) {
662
+ this.message = message;
663
+ super.message = message;
664
+ }
665
+ setContextModule(contextModule) {
666
+ this.contextModule = contextModule;
667
+ }
668
+ setContextCode(code) {
669
+ this.contextCode = code;
670
+ }
671
+ toOriginalError() {
672
+ const error = new Error(this.originalMessage);
673
+ error.stack = this.stack;
674
+ error.name = this.name || "";
675
+ return error;
676
+ }
677
+ toError() {
678
+ const error = new Error(this.message);
679
+ error.stack = this.stack;
680
+ error.name = this.name || "";
681
+ return error;
682
+ }
683
+ toCompactError() {
684
+ const name = this.name || toPascalCase(this.type);
685
+ const error = /* @__PURE__ */ new Error(`${this.message} | ${JSON.stringify({
686
+ type: this.type,
687
+ code: this.code,
688
+ errorClass: name,
689
+ message: this.message,
690
+ context: this.context,
691
+ contextCode: this.contextCode,
692
+ contextModule: this.contextModule,
693
+ originalMessage: this.originalMessage,
694
+ stack: (this.stack || "").split("\n").map((line) => line.trim())
695
+ })}`);
696
+ error.stack = this.stack;
697
+ error.name = this.name || toPascalCase(this.type);
698
+ return error;
699
+ }
700
+ toJson() {
701
+ return JSON.stringify({
702
+ error: this.message,
703
+ stack: this.stack
704
+ });
705
+ }
706
+ toObject() {
707
+ const name = this.name || toPascalCase(this.type);
708
+ return {
709
+ code: this.code,
710
+ type: this.type,
711
+ errorClass: name,
712
+ message: this.message,
713
+ context: this.context,
714
+ contextCode: this.contextCode,
715
+ contextModule: this.contextModule,
716
+ originalMessage: this.originalMessage,
717
+ stack: (this.stack || "").split("\n").map((line) => line.trim())
718
+ };
719
+ }
720
+ toString() {
721
+ return this.message;
722
+ }
723
+ };
724
+
725
+ //#endregion
726
+ //#region src/exceptions/exceptions/Web3Exception.ts
727
+ var Web3Exception = class Web3Exception extends ConcreteException {
728
+ constructor(error, context) {
729
+ super(error, context);
730
+ this.type = ErrorType.Web3;
731
+ }
732
+ parse() {
733
+ this.setName(Web3Exception.errorClass);
734
+ }
735
+ };
736
+ _defineProperty(Web3Exception, "errorClass", "Web3Exception");
737
+
738
+ //#endregion
739
+ //#region src/exceptions/messages.ts
740
+ const auctionErrorMap = {
741
+ [ChainAuctionErrorCodes.ErrBidInvalid]: "The gas limit provided in the transaction is not valid",
742
+ [ChainAuctionErrorCodes.ErrBidRound]: "The gas limit provided in the transaction is not valid"
743
+ };
744
+ const authZErrorMap = {
745
+ [ChainAuthZErrorCodes.ErrNoAuthorizationFound]: "Authorization not found",
746
+ [ChainAuthZErrorCodes.ErrInvalidExpirationTime]: "Expiration time of authorization should be more than current time",
747
+ [ChainAuthZErrorCodes.ErrUnknownAuthorizationType]: "Unknown authorization type",
748
+ [ChainAuthZErrorCodes.ErrNoGrantKeyFound]: "Grant key not found",
749
+ [ChainAuthZErrorCodes.ErrAuthorizationExpired]: "Authorization expired",
750
+ [ChainAuthZErrorCodes.ErrGranteeIsGranter]: "Grantee and granter should be different",
751
+ [ChainAuthZErrorCodes.ErrAuthorizationNumOfSigners]: "Authorization can be given to msg with only one signer",
752
+ [ChainAuthZErrorCodes.ErrNegativeMaxTokens]: "Max tokens should be positive"
753
+ };
754
+ const cosmosErrorMap = {
755
+ [ChainCosmosErrorCode.ErrInsufficientFee]: "You do not have enough funds to cover the transaction fees.",
756
+ [ChainCosmosErrorCode.ErrInsufficientFunds]: "You do not have enough funds.",
757
+ [ChainCosmosErrorCode.ErrTxTimeoutHeight]: "The transaction failed to be included within a block on time.",
758
+ [ChainCosmosErrorCode.ErrTxDecode]: "There is an issue while parsing the transaction",
759
+ [ChainCosmosErrorCode.ErrInvalidSequence]: "The sequence number is not valid",
760
+ [ChainCosmosErrorCode.ErrUnauthorized]: "Unauthorized",
761
+ [ChainCosmosErrorCode.ErrUnknownRequest]: "The request is not known",
762
+ [ChainCosmosErrorCode.ErrInvalidAddress]: "The address is not valid",
763
+ [ChainCosmosErrorCode.ErrInvalidPubKey]: "The public key is not valid",
764
+ [ChainCosmosErrorCode.ErrUnknownAddress]: "The address is unknown",
765
+ [ChainCosmosErrorCode.ErrInvalidCoins]: "The coins are not valid",
766
+ [ChainCosmosErrorCode.ErrOutOfGas]: "The transaction run out of gas",
767
+ [ChainCosmosErrorCode.ErrMemoTooLarge]: "The memo field in the transaction is too large",
768
+ [ChainCosmosErrorCode.ErrTooManySignatures]: "The transaction exceeded the maximum number of signatures",
769
+ [ChainCosmosErrorCode.ErrNoSignatures]: "There are no signatures appended on the transaction",
770
+ [ChainCosmosErrorCode.ErrJSONMarshal]: "There is an issue while parsing the transaction",
771
+ [ChainCosmosErrorCode.ErrJSONUnmarshal]: "There is an issue while parsing the transaction",
772
+ [ChainCosmosErrorCode.ErrInvalidRequest]: "invalid request",
773
+ [ChainCosmosErrorCode.ErrTxInMempoolCache]: "The transaction is already in the mempool",
774
+ [ChainCosmosErrorCode.ErrMempoolIsFull]: "The mempool is full",
775
+ [ChainCosmosErrorCode.ErrTxTooLarge]: "The transaction is too large",
776
+ [ChainCosmosErrorCode.ErrKeyNotFound]: "Address is not yet active on the chain as it has a $0 balance. To activate it, please send a small amount of funds. Once funded, the network will recognize the address, allowing you to proceed.",
777
+ [ChainCosmosErrorCode.ErrWrongPassword]: "invalid account password",
778
+ [ChainCosmosErrorCode.ErrorInvalidSigner]: "tx intended signer does not match the given signer",
779
+ [ChainCosmosErrorCode.ErrorInvalidGasAdjustment]: "invalid gas adjustment",
780
+ [ChainCosmosErrorCode.ErrInvalidHeight]: "The height provided in the transaction is not valid",
781
+ [ChainCosmosErrorCode.ErrInvalidVersion]: "The version provided in the transaction is not valid",
782
+ [ChainCosmosErrorCode.ErrInvalidChainID]: "The chainId provided in the transaction is not valid",
783
+ [ChainCosmosErrorCode.ErrInvalidType]: "The type provided in the transaction is not valid",
784
+ [ChainCosmosErrorCode.ErrUnknownExtensionOptions]: "The extension options provided in the transaction is unknown",
785
+ [ChainCosmosErrorCode.ErrWrongSequence]: "The sequence number provided in the transaction is incorrect",
786
+ [ChainCosmosErrorCode.ErrPackAny]: "failed packing protobuf message to Any",
787
+ [ChainCosmosErrorCode.ErrUnpackAny]: "failed unpacking protobuf message from Any",
788
+ [ChainCosmosErrorCode.ErrLogic]: "Internal logic error",
789
+ [ChainCosmosErrorCode.ErrConflict]: "conflict",
790
+ [ChainCosmosErrorCode.ErrNotSupported]: "The feature is not supported",
791
+ [ChainCosmosErrorCode.ErrNotFound]: "not found",
792
+ [ChainCosmosErrorCode.ErrIO]: "Internal IO error",
793
+ [ChainCosmosErrorCode.ErrAppConfig]: "error in app.toml",
794
+ [ChainCosmosErrorCode.ErrInvalidGasLimit]: "The gas limit provided in the transaction is not valid"
795
+ };
796
+ const exchangeErrorMap = {
797
+ [ChainExchangeModuleErrorCode.ErrOrderInvalid]: "Your order failed to validate",
798
+ [ChainExchangeModuleErrorCode.ErrSpotMarketNotFound]: "The spot market has not been found",
799
+ [ChainExchangeModuleErrorCode.ErrSpotMarketExists]: "The spot market already exists",
800
+ [ChainExchangeModuleErrorCode.ErrBadField]: "There is an issue with your order",
801
+ [ChainExchangeModuleErrorCode.ErrMarketInvalid]: "The market failed to validate",
802
+ [ChainExchangeModuleErrorCode.ErrInsufficientDeposit]: "Your trading account has insufficient funds",
803
+ [ChainExchangeModuleErrorCode.ErrUnrecognizedOrderType]: "The order type is not recognized",
804
+ [ChainExchangeModuleErrorCode.ErrInsufficientPositionQuantity]: "The position quantity is insufficient for the order",
805
+ [ChainExchangeModuleErrorCode.ErrOrderHashInvalid]: "The order hash is not valid",
806
+ [ChainExchangeModuleErrorCode.ErrBadSubaccountID]: "The subaccount id is not valid",
807
+ [ChainExchangeModuleErrorCode.ErrInvalidBaseDenom]: "",
808
+ [ChainExchangeModuleErrorCode.ErrInvalidExpiry]: "The expiry date is not valid",
809
+ [ChainExchangeModuleErrorCode.ErrInvalidPrice]: "The price is not valid",
810
+ [ChainExchangeModuleErrorCode.ErrInvalidQuantity]: "The quantity is not valid",
811
+ [ChainExchangeModuleErrorCode.ErrUnsupportedOracleType]: "The oracle type is not supported",
812
+ [ChainExchangeModuleErrorCode.ErrOrderDoesntExist]: "The order does not exist",
813
+ [ChainExchangeModuleErrorCode.ErrOrderbookFillInvalid]: "",
814
+ [ChainExchangeModuleErrorCode.ErrPerpetualMarketExists]: "The perpetual market already exists",
815
+ [ChainExchangeModuleErrorCode.ErrExpiryFuturesMarketExists]: "The expiry futures market market already exists",
816
+ [ChainExchangeModuleErrorCode.ErrExpiryFuturesMarketExpired]: "The expiry futures market has expired",
817
+ [ChainExchangeModuleErrorCode.ErrNoLiquidity]: "There is not enough liquidity",
818
+ [ChainExchangeModuleErrorCode.ErrSlippageExceedsWorstPrice]: "There is not enough liquidity",
819
+ [ChainExchangeModuleErrorCode.ErrInsufficientOrderMargin]: "The order has insufficient margin",
820
+ [ChainExchangeModuleErrorCode.ErrDerivativeMarketNotFound]: "The derivative market cannot be found",
821
+ [ChainExchangeModuleErrorCode.ErrPositionNotFound]: "The position cannot be found",
822
+ [ChainExchangeModuleErrorCode.ErrInvalidReduceOnlyPositionDirection]: "Position direction does not oppose the reduce-only order",
823
+ [ChainExchangeModuleErrorCode.ErrPriceSurpassesBankruptcyPrice]: "Your order price surpasses bankruptcy price",
824
+ [ChainExchangeModuleErrorCode.ErrPositionNotLiquidable]: "The position is not liquidable",
825
+ [ChainExchangeModuleErrorCode.ErrInvalidTriggerPrice]: "Your order trigger price is not valid",
826
+ [ChainExchangeModuleErrorCode.ErrInvalidOracleType]: "The oracle type is not valid",
827
+ [ChainExchangeModuleErrorCode.ErrInvalidPriceTickSize]: "The minimum price tick size is not valid",
828
+ [ChainExchangeModuleErrorCode.ErrInvalidQuantityTickSize]: "The minimum quantity tick size is not valid",
829
+ [ChainExchangeModuleErrorCode.ErrInvalidMargin]: "Your order's minimum margin is not valid ",
830
+ [ChainExchangeModuleErrorCode.ErrExceedsOrderSideCount]: "You cannot have more orders for this market for this direction",
831
+ [ChainExchangeModuleErrorCode.ErrMarketOrderAlreadyExists]: "You cannot place another market order within this block",
832
+ [ChainExchangeModuleErrorCode.ErrConditionalMarketOrderAlreadyExists]: "You cannot place another conditional market order",
833
+ [ChainExchangeModuleErrorCode.ErrMarketLaunchProposalAlreadyExists]: "There is an existing equivalent market launch proposal.",
834
+ [ChainExchangeModuleErrorCode.ErrInvalidMarketStatus]: "The market status is not valid",
835
+ [ChainExchangeModuleErrorCode.ErrSameDenoms]: "The base denom and quote denom cannot be same",
836
+ [ChainExchangeModuleErrorCode.ErrSameOracles]: "The oracle base and the oracle quote cannot be the same",
837
+ [ChainExchangeModuleErrorCode.ErrFeeRatesRelation]: "The MakerFeeRate does not match TakerFeeRate requirements",
838
+ [ChainExchangeModuleErrorCode.ErrMarginsRelation]: "The MaintenanceMarginRatio cannot be greater than InitialMarginRatio",
839
+ [ChainExchangeModuleErrorCode.ErrExceedsMaxOracleScaleFactor]: "The OracleScaleFactor cannot be greater than MaxOracleScaleFactor",
840
+ [ChainExchangeModuleErrorCode.ErrSpotExchangeNotEnabled]: "Spot exchange is not enabled yet",
841
+ [ChainExchangeModuleErrorCode.ErrDerivativesExchangeNotEnabled]: "Derivatives exchange is not enabled yet",
842
+ [ChainExchangeModuleErrorCode.ErrOraclePriceDeltaExceedsThreshold]: "The oracle price delta exceeds threshold",
843
+ [ChainExchangeModuleErrorCode.ErrInvalidHourlyInterestRate]: "The hourly interest rate is not valid",
844
+ [ChainExchangeModuleErrorCode.ErrInvalidHourlyFundingRateCap]: "The hourly funding rate cap is not valid",
845
+ [ChainExchangeModuleErrorCode.ErrInvalidMarketFundingParamUpdate]: "You can only update funding parameters on perpetual markets.",
846
+ [ChainExchangeModuleErrorCode.ErrInvalidTradingRewardCampaign]: "The trading reward campaign is not valid",
847
+ [ChainExchangeModuleErrorCode.ErrInvalidFeeDiscountSchedule]: "The fee discount schedule is not valid",
848
+ [ChainExchangeModuleErrorCode.ErrInvalidLiquidationOrder]: "The liquidation order is not valid",
849
+ [ChainExchangeModuleErrorCode.ErrTradingRewardCampaignDistributionError]: "Unknown error happened for campaign distributions",
850
+ [ChainExchangeModuleErrorCode.ErrInvalidTradingRewardsPendingPointsUpdate]: "The updated trading reward points is not valid",
851
+ [ChainExchangeModuleErrorCode.ErrInvalidBatchMsgUpdate]: "The MsgBatchUpdate is not valid",
852
+ [ChainExchangeModuleErrorCode.ErrExceedsTopOfBookPrice]: "The post-only order price exceeds top of the orderbook price",
853
+ [ChainExchangeModuleErrorCode.ErrInvalidOrderTypeForMessage]: "The order type is not supported for this message",
854
+ [ChainExchangeModuleErrorCode.ErrInvalidDMMSender]: "The sender must match the DMM address",
855
+ [ChainExchangeModuleErrorCode.ErrAlreadyOptedOutOfRewards]: "The DMM address already opted out of rewards",
856
+ [ChainExchangeModuleErrorCode.ErrInvalidMarginRatio]: "The margin ratio is not valid",
857
+ [ChainExchangeModuleErrorCode.ErrBelowMinimalContribution]: "The provided funds are below minimum",
858
+ [ChainExchangeModuleErrorCode.ErrLowPositionMargin]: "The position is below initial margin requirement",
859
+ [ChainExchangeModuleErrorCode.ErrInvalidTotalSupply]: "The pool has non-positive total LP token supply",
860
+ [ChainExchangeModuleErrorCode.ErrInvalidLpTokenBurnAmount]: "The passed LP token burn amount is greater than total LP token supply",
861
+ [ChainExchangeModuleErrorCode.ErrUnsupportedAction]: "This action is not supported",
862
+ [ChainExchangeModuleErrorCode.ErrNegativePositionQuantity]: "The position quantity cannot be negative",
863
+ [ChainExchangeModuleErrorCode.ErrBinaryOptionsMarketExists]: "The BinaryOptions market already exists",
864
+ [ChainExchangeModuleErrorCode.ErrBinaryOptionsMarketNotFound]: "The BinaryOptions market cannot be found",
865
+ [ChainExchangeModuleErrorCode.ErrInvalidSettlement]: "The settlement price is not valid",
866
+ [ChainExchangeModuleErrorCode.ErrAccountDoesntExist]: "The trading account does not exist",
867
+ [ChainExchangeModuleErrorCode.ErrSenderIsNotAnAdmin]: "The sender should be the admin of the market",
868
+ [ChainExchangeModuleErrorCode.ErrMarketAlreadyScheduledToSettle]: "The market is already scheduled to settle ",
869
+ [ChainExchangeModuleErrorCode.ErrGenericMarketNotFound]: "The market cannot be found",
870
+ [ChainExchangeModuleErrorCode.ErrInvalidDenomDecimal]: "The denom decimal cannot be below 1 or above max scale factor",
871
+ [ChainExchangeModuleErrorCode.ErrInvalidState]: "The state is not valid",
872
+ [ChainExchangeModuleErrorCode.ErrTransientOrdersUpToCancelNotSupported]: "The transient orders up to cancellation not supported",
873
+ [ChainExchangeModuleErrorCode.ErrInvalidTrade]: "The trade is not valid",
874
+ [ChainExchangeModuleErrorCode.ErrNoMarginLocked]: "There is no margin locked in the trading account",
875
+ [ChainExchangeModuleErrorCode.ErrInvalidAccessLevel]: "There is no access to perform action",
876
+ [ChainExchangeModuleErrorCode.ErrInvalidAddress]: "The address is not valid",
877
+ [ChainExchangeModuleErrorCode.ErrInvalidArgument]: "The argument is not valid",
878
+ [ChainExchangeModuleErrorCode.ErrInvalidFundsDirection]: "Invalid funds direction",
879
+ [ChainExchangeModuleErrorCode.ErrNoFundsProvided]: "No funds provided",
880
+ [ChainExchangeModuleErrorCode.ErrInvalidSignature]: "Invalid signature",
881
+ [ChainExchangeModuleErrorCode.ErrNoFundsToUnlock]: "No funds to unlock",
882
+ [ChainExchangeModuleErrorCode.ErrNoMsgsProvided]: "No msgs provided",
883
+ [ChainExchangeModuleErrorCode.ErrNoMsgProvided]: "No msg provided",
884
+ [ChainExchangeModuleErrorCode.ErrInvalidAmount]: "Invalid amount",
885
+ [ChainExchangeModuleErrorCode.ErrFeatureDisabled]: "The current feature has been disabled",
886
+ [ChainExchangeModuleErrorCode.ErrTooMuchOrderMargin]: "Order has too much margin",
887
+ [ChainExchangeModuleErrorCode.ErrBadSubaccountNonce]: "Subaccount nonce is invalid",
888
+ [ChainExchangeModuleErrorCode.ErrInsufficientFunds]: "Insufficient funds",
889
+ [ChainExchangeModuleErrorCode.ErrPostOnlyMode]: "Only post-only actions available for approximately 30 minutes after a chain upgrade.",
890
+ [ChainExchangeModuleErrorCode.ErrClientOrderIdAlreadyExists]: "Client order id already exists",
891
+ [ChainExchangeModuleErrorCode.ErrInvalidCid]: "Client order id is invalid. Max length is 36 chars"
892
+ };
893
+ const insuranceErrorMap = {
894
+ [ChainInsuranceErrorCodes.ErrInsuranceFundAlreadyExists]: "The insurance fund already exists",
895
+ [ChainInsuranceErrorCodes.ErrInsuranceFundNotFound]: "The insurance fund is not found",
896
+ [ChainInsuranceErrorCodes.ErrRedemptionAlreadyExists]: "The redemption already exists",
897
+ [ChainInsuranceErrorCodes.ErrInvalidDepositAmount]: "The deposit amount is not valid",
898
+ [ChainInsuranceErrorCodes.ErrInvalidDepositDenom]: "The deposit denom is not valid",
899
+ [ChainInsuranceErrorCodes.ErrPayoutTooLarge]: "The insurance fund payout exceeds the deposits",
900
+ [ChainInsuranceErrorCodes.ErrInvalidTicker]: "The ticker is not valid",
901
+ [ChainInsuranceErrorCodes.ErrInvalidQuoteDenom]: "The quote denom is not valid",
902
+ [ChainInsuranceErrorCodes.ErrInvalidOracle]: "The oracle is not valid",
903
+ [ChainInsuranceErrorCodes.ErrInvalidExpirationTime]: "The expiration time is not valid",
904
+ [ChainInsuranceErrorCodes.ErrInvalidMarketID]: "The marketId is not valid",
905
+ [ChainInsuranceErrorCodes.ErrInvalidShareDenom]: "The share denom is not valid"
906
+ };
907
+ const ocrErrorMap = {
908
+ [ChainOcrErrorCodes.ErrStaleReport]: "stale report",
909
+ [ChainOcrErrorCodes.ErrIncompleteProposal]: "incomplete proposal",
910
+ [ChainOcrErrorCodes.ErrRepeatedAddress]: "repeated oracle address",
911
+ [ChainOcrErrorCodes.ErrTooManySigners]: "too many signers",
912
+ [ChainOcrErrorCodes.ErrIncorrectConfig]: "incorrect config",
913
+ [ChainOcrErrorCodes.ErrConfigDigestNotMatch]: "config digest doesn't match",
914
+ [ChainOcrErrorCodes.ErrWrongNumberOfSignatures]: "wrong number of signatures",
915
+ [ChainOcrErrorCodes.ErrIncorrectSignature]: "incorrect signature",
916
+ [ChainOcrErrorCodes.ErrNoTransmitter]: "no transmitter specified",
917
+ [ChainOcrErrorCodes.ErrIncorrectTransmissionData]: "incorrect transmission data",
918
+ [ChainOcrErrorCodes.ErrNoTransmissionsFound]: "no transmissions found",
919
+ [ChainOcrErrorCodes.ErrMedianValueOutOfBounds]: "median value is out of bounds",
920
+ [ChainOcrErrorCodes.ErrIncorrectRewardPoolDenom]: "LINK denom doesn't match",
921
+ [ChainOcrErrorCodes.ErrNoRewardPool]: "Reward Pool doesn't exist",
922
+ [ChainOcrErrorCodes.ErrInvalidPayees]: "wrong number of payees and transmitters",
923
+ [ChainOcrErrorCodes.ErrModuleAdminRestricted]: "action is restricted to the module admin",
924
+ [ChainOcrErrorCodes.ErrFeedAlreadyExists]: "feed already exists",
925
+ [ChainOcrErrorCodes.ErrFeedDoesntExists]: "feed doesnt exists",
926
+ [ChainOcrErrorCodes.ErrAdminRestricted]: "action is admin-restricted",
927
+ [ChainOcrErrorCodes.ErrInsufficientRewardPool]: "insufficient reward pool",
928
+ [ChainOcrErrorCodes.ErrPayeeAlreadySet]: "payee already set",
929
+ [ChainOcrErrorCodes.ErrPayeeRestricted]: "action is payee-restricted",
930
+ [ChainOcrErrorCodes.ErrFeedConfigNotFound]: "feed config not found"
931
+ };
932
+ const oracleErrorMap = {
933
+ [ChainOracleErrorCodes.ErrEmptyRelayerAddr]: "relayer address is empty",
934
+ [ChainOracleErrorCodes.ErrBadRatesCount]: "bad rates count",
935
+ [ChainOracleErrorCodes.ErrBadResolveTimesCount]: "bad resolve times",
936
+ [ChainOracleErrorCodes.ErrBadRequestIDsCount]: "bad request ID",
937
+ [ChainOracleErrorCodes.ErrRelayerNotAuthorized]: "relayer not authorized",
938
+ [ChainOracleErrorCodes.ErrBadPriceFeedBaseCount]: "bad price feed base count",
939
+ [ChainOracleErrorCodes.ErrBadPriceFeedQuoteCount]: "bad price feed quote count",
940
+ [ChainOracleErrorCodes.ErrUnsupportedOracleType]: "unsupported oracle type",
941
+ [ChainOracleErrorCodes.ErrBadMessagesCount]: "bad messages count",
942
+ [ChainOracleErrorCodes.ErrBadCoinbaseMessage]: "bad Coinbase message",
943
+ [ChainOracleErrorCodes.ErrInvalidEthereumSignature]: "bad Ethereum signature",
944
+ [ChainOracleErrorCodes.ErrBadCoinbaseMessageTimestamp]: "bad Coinbase message timestamp",
945
+ [ChainOracleErrorCodes.ErrCoinbasePriceNotFound]: "Coinbase price not found",
946
+ [ChainOracleErrorCodes.ErrBadPrice]: "Prices must be positive",
947
+ [ChainOracleErrorCodes.ErrPriceTooLarge]: "Prices must be less than 10 million.",
948
+ [ChainOracleErrorCodes.ErrInvalidBandIBCRequest]: "Invalid Band IBC Request",
949
+ [ChainOracleErrorCodes.ErrSample]: "sample error",
950
+ [ChainOracleErrorCodes.ErrInvalidPacketTimeout]: "invalid packet timeout",
951
+ [ChainOracleErrorCodes.ErrBadSymbolsCount]: "invalid symbols count",
952
+ [ChainOracleErrorCodes.ErrBadIBCPortBind]: "could not claim port capability",
953
+ [ChainOracleErrorCodes.ErrInvalidPortID]: "invalid IBC Port ID",
954
+ [ChainOracleErrorCodes.ErrInvalidChannelID]: "invalid IBC Channel ID",
955
+ [ChainOracleErrorCodes.ErrBadRequestInterval]: "invalid Band IBC request interval",
956
+ [ChainOracleErrorCodes.ErrInvalidBandIBCUpdateRequest]: "Invalid Band IBC Update Request Proposal",
957
+ [ChainOracleErrorCodes.ErrBandIBCRequestNotFound]: "Band IBC Oracle Request not found",
958
+ [ChainOracleErrorCodes.ErrEmptyBaseInfo]: "Base Info is empty",
959
+ [ChainOracleErrorCodes.ErrEmptyProvider]: "provider is empty",
960
+ [ChainOracleErrorCodes.ErrInvalidProvider]: "invalid provider name",
961
+ [ChainOracleErrorCodes.ErrInvalidSymbol]: "invalid symbol",
962
+ [ChainOracleErrorCodes.ErrRelayerAlreadyExists]: "relayer already exists",
963
+ [ChainOracleErrorCodes.ErrProviderPriceNotFound]: "provider price not found",
964
+ [ChainOracleErrorCodes.ErrInvalidOracleRequest]: "invalid oracle request",
965
+ [ChainOracleErrorCodes.ErrOraclePriceNotFound]: "no price for oracle was found"
966
+ };
967
+ const peggyErrorMap = {
968
+ [ChainPeggyErrorCodes.ErrInternal]: "internal",
969
+ [ChainPeggyErrorCodes.ErrDuplicate]: "duplicate",
970
+ [ChainPeggyErrorCodes.ErrInvalid]: "invalid",
971
+ [ChainPeggyErrorCodes.ErrTimeout]: "timeout",
972
+ [ChainPeggyErrorCodes.ErrUnknown]: "unknown",
973
+ [ChainPeggyErrorCodes.ErrEmpty]: "empty",
974
+ [ChainPeggyErrorCodes.ErrOutdated]: "outdated",
975
+ [ChainPeggyErrorCodes.ErrUnsupported]: "unsupported",
976
+ [ChainPeggyErrorCodes.ErrNonContiguousEventNonce]: "non contiguous event nonce",
977
+ [ChainPeggyErrorCodes.ErrNoUnbatchedTxsFound]: "no unbatched txs found",
978
+ [ChainPeggyErrorCodes.ErrResetDelegateKeys]: "can not set orchestrator addresses more than once",
979
+ [ChainPeggyErrorCodes.ErrSupplyOverflow]: "supply cannot exceed max ERC20 value",
980
+ [ChainPeggyErrorCodes.ErrInvalidEthSender]: "invalid ethereum sender on claim",
981
+ [ChainPeggyErrorCodes.ErrInvalidEthDestination]: "invalid ethereum destination"
982
+ };
983
+ const tokenFactoryErrorMap = {
984
+ [ChainTokenFactoryErrorCodes.ErrDenomExists]: "attempting to create a denom that already exists",
985
+ [ChainTokenFactoryErrorCodes.ErrUnauthorized]: "unauthorized account",
986
+ [ChainTokenFactoryErrorCodes.ErrInvalidDenom]: "invalid denom",
987
+ [ChainTokenFactoryErrorCodes.ErrInvalidCreator]: "invalid creator",
988
+ [ChainTokenFactoryErrorCodes.ErrInvalidAuthorityMetadata]: "invalid authority metadata",
989
+ [ChainTokenFactoryErrorCodes.ErrInvalidGenesis]: "invalid genesis",
990
+ [ChainTokenFactoryErrorCodes.ErrSubdenomTooLong]: "subdenom too long",
991
+ [ChainTokenFactoryErrorCodes.ErrSubdenomTooShort]: "subdenom too short",
992
+ [ChainTokenFactoryErrorCodes.ErrSubdenomNestedTooShort]: "nested subdenom too short, each one should have at least",
993
+ [ChainTokenFactoryErrorCodes.ErrCreatorTooLong]: "creator too long",
994
+ [ChainTokenFactoryErrorCodes.ErrDenomDoesNotExist]: "denom does not exist"
995
+ };
996
+ const wasmxErrorMap = {
997
+ [ChainWasmXErrorCodes.ErrInvalidGasLimit]: "invalid gas limit",
998
+ [ChainWasmXErrorCodes.ErrInvalidGasPrice]: "invalid gas price",
999
+ [ChainWasmXErrorCodes.ErrInvalidContractAddress]: "invalid contract address",
1000
+ [ChainWasmXErrorCodes.ErrAlreadyRegistered]: "contract already registered",
1001
+ [ChainWasmXErrorCodes.ErrDuplicateContract]: "duplicate contract",
1002
+ [ChainWasmXErrorCodes.ErrNoContractAddresses]: "no contract addresses found",
1003
+ [ChainWasmXErrorCodes.ErrInvalidCodeId]: "invalid code id"
1004
+ };
1005
+ const stakingErrorMap = {
1006
+ [ChainStakingErrorCodes.ErrEmptyValidatorAddr]: "empty validator address",
1007
+ [ChainStakingErrorCodes.ErrNoValidatorFound]: "validator does not exist",
1008
+ [ChainStakingErrorCodes.ErrValidatorOwnerExists]: "validator already exist for this operator address; must use new validator operator address",
1009
+ [ChainStakingErrorCodes.ErrValidatorPubKeyExists]: "validator already exist for this pubkey; must use new validator pubkey",
1010
+ [ChainStakingErrorCodes.ErrValidatorPubKeyTypeNotSupported]: "validator pubkey type is not supported",
1011
+ [ChainStakingErrorCodes.ErrValidatorJailed]: "validator for this address is currently jailed",
1012
+ [ChainStakingErrorCodes.ErrBadRemoveValidator]: "failed to remove validator",
1013
+ [ChainStakingErrorCodes.ErrCommissionNegative]: "commission must be positive",
1014
+ [ChainStakingErrorCodes.ErrCommissionHuge]: "commission cannot be more than 100%",
1015
+ [ChainStakingErrorCodes.ErrCommissionGTMaxRate]: "commission cannot be more than the max rate",
1016
+ [ChainStakingErrorCodes.ErrCommissionUpdateTime]: "commission cannot be changed more than once in 24h",
1017
+ [ChainStakingErrorCodes.ErrCommissionChangeRateNegative]: "commission change rate must be positive",
1018
+ [ChainStakingErrorCodes.ErrCommissionChangeRateGTMaxRate]: "commission change rate cannot be more than the max rate",
1019
+ [ChainStakingErrorCodes.ErrCommissionGTMaxChangeRate]: "commission cannot be changed more than max change rate",
1020
+ [ChainStakingErrorCodes.ErrSelfDelegationBelowMinimum]: "validator's self delegation must be greater than their minimum self delegation",
1021
+ [ChainStakingErrorCodes.ErrMinSelfDelegationDecreased]: "minimum self delegation cannot be decrease",
1022
+ [ChainStakingErrorCodes.ErrEmptyDelegatorAddr]: "empty delegator address",
1023
+ [ChainStakingErrorCodes.ErrNoDelegation]: "no delegation for (address, validator) tuple",
1024
+ [ChainStakingErrorCodes.ErrBadDelegatorAddr]: "delegator does not exist with address",
1025
+ [ChainStakingErrorCodes.ErrNoDelegatorForAddress]: "delegator does not contain delegation",
1026
+ [ChainStakingErrorCodes.ErrInsufficientShares]: "insufficient delegation shares",
1027
+ [ChainStakingErrorCodes.ErrDelegationValidatorEmpty]: "cannot delegate to an empty validator",
1028
+ [ChainStakingErrorCodes.ErrNotEnoughDelegationShares]: "not enough delegation shares",
1029
+ [ChainStakingErrorCodes.ErrNotMature]: "entry not mature",
1030
+ [ChainStakingErrorCodes.ErrNoUnbondingDelegation]: "no unbonding delegation found",
1031
+ [ChainStakingErrorCodes.ErrMaxUnbondingDelegationEntries]: "too many unbonding delegation entries for (delegator, validator) tuple",
1032
+ [ChainStakingErrorCodes.ErrNoRedelegation]: "no redelegation found",
1033
+ [ChainStakingErrorCodes.ErrSelfRedelegation]: "cannot redelegate to the same validator",
1034
+ [ChainStakingErrorCodes.ErrTinyRedelegationAmount]: "too few tokens to redelegate (truncates to zero tokens)",
1035
+ [ChainStakingErrorCodes.ErrBadRedelegationDst]: "redelegation destination validator not found",
1036
+ [ChainStakingErrorCodes.ErrTransitiveRedelegation]: "redelegation to this validator already in progress; first redelegation to this validator must complete before next redelegation",
1037
+ [ChainStakingErrorCodes.ErrMaxRedelegationEntries]: "too many redelegation entries for (delegator, src-validator, dst-validator) tuple",
1038
+ [ChainStakingErrorCodes.ErrDelegatorShareExRateInvalid]: "cannot delegate to validators with invalid (zero) ex-rate",
1039
+ [ChainStakingErrorCodes.ErrBothShareMsgsGiven]: "both shares amount and shares percent provided",
1040
+ [ChainStakingErrorCodes.ErrNeitherShareMsgsGiven]: "neither shares amount nor shares percent provided",
1041
+ [ChainStakingErrorCodes.ErrInvalidHistoricalInfo]: "invalid historical info",
1042
+ [ChainStakingErrorCodes.ErrNoHistoricalInfo]: "no historical info found",
1043
+ [ChainStakingErrorCodes.ErrEmptyValidatorPubKey]: "empty validator public key",
1044
+ [ChainStakingErrorCodes.ErrCommissionLTMinRate]: "commission cannot be less than min rate",
1045
+ [ChainStakingErrorCodes.ErrUnbondingNotFound]: "unbonding operation not found",
1046
+ [ChainStakingErrorCodes.ErrUnbondingOnHoldRefCountNegative]: "cannot un-hold unbonding operation that is not on hold"
1047
+ };
1048
+ const govErrorMap = {
1049
+ [ChainGovErrorCodes.ErrUnknownProposal]: "unknown proposal",
1050
+ [ChainGovErrorCodes.ErrInactiveProposal]: "inactive proposal",
1051
+ [ChainGovErrorCodes.ErrAlreadyActiveProposal]: "proposal already active",
1052
+ [ChainGovErrorCodes.ErrInvalidProposalContent]: "invalid proposal content",
1053
+ [ChainGovErrorCodes.ErrInvalidProposalType]: "invalid proposal type",
1054
+ [ChainGovErrorCodes.ErrInvalidVote]: "invalid vote option",
1055
+ [ChainGovErrorCodes.ErrInvalidGenesis]: "invalid genesis state",
1056
+ [ChainGovErrorCodes.ErrNoProposalHandlerExists]: "no handler exists for proposal type",
1057
+ [ChainGovErrorCodes.ErrUnroutableProposalMsg]: "proposal message not recognized by router",
1058
+ [ChainGovErrorCodes.ErrNoProposalMsgs]: "no messages proposed",
1059
+ [ChainGovErrorCodes.ErrInvalidProposalMsg]: "invalid proposal message",
1060
+ [ChainGovErrorCodes.ErrInvalidSigner]: "expected gov account as only signer for proposal message",
1061
+ [ChainGovErrorCodes.ErrInvalidSignalMsg]: "signal message is invalid",
1062
+ [ChainGovErrorCodes.ErrMetadataTooLong]: "metadata too long",
1063
+ [ChainGovErrorCodes.ErrMinDepositTooSmall]: "minimum deposit is too small",
1064
+ [ChainGovErrorCodes.ErrProposalNotFound]: "proposal is not found",
1065
+ [ChainGovErrorCodes.ErrInvalidProposer]: "invalid proposer",
1066
+ [ChainGovErrorCodes.ErrNoDeposits]: "no deposits found",
1067
+ [ChainGovErrorCodes.ErrVotingPeriodEnded]: "voting period already ended",
1068
+ [ChainGovErrorCodes.ErrInvalidProposal]: "invalid proposal"
1069
+ };
1070
+ const bankErrorMap = {
1071
+ [ChainBankErrorCodes.ErrNoInputs]: "no inputs to send transaction",
1072
+ [ChainBankErrorCodes.ErrNoOutputs]: "no outputs to send transaction",
1073
+ [ChainBankErrorCodes.ErrInputOutputMismatch]: "sum inputs != sum outputs",
1074
+ [ChainBankErrorCodes.ErrSendDisabled]: "send transactions are disabled",
1075
+ [ChainBankErrorCodes.ErrDenomMetadataNotFound]: "client denom metadata not found",
1076
+ [ChainBankErrorCodes.ErrInvalidKey]: "invalid key",
1077
+ [ChainBankErrorCodes.ErrDuplicateEntry]: "duplicate entry",
1078
+ [ChainBankErrorCodes.ErrMultipleSenders]: "multiple senders not allowed"
1079
+ };
1080
+ const distributionErrorMap = {
1081
+ [ChainDistributionErrorCodes.ErrEmptyDelegatorAddr]: "delegator address is empty",
1082
+ [ChainDistributionErrorCodes.ErrEmptyWithdrawAddr]: "withdraw address is empty",
1083
+ [ChainDistributionErrorCodes.ErrEmptyValidatorAddr]: "validator address is empty",
1084
+ [ChainDistributionErrorCodes.ErrEmptyDelegationDistInfo]: "no delegation distribution info",
1085
+ [ChainDistributionErrorCodes.ErrNoValidatorDistInfo]: "no validator distribution info",
1086
+ [ChainDistributionErrorCodes.ErrNoValidatorCommission]: "no validator commission to withdraw",
1087
+ [ChainDistributionErrorCodes.ErrSetWithdrawAddrDisabled]: "set withdraw address disabled",
1088
+ [ChainDistributionErrorCodes.ErrBadDistribution]: "community pool does not have sufficient coins to distribute",
1089
+ [ChainDistributionErrorCodes.ErrInvalidProposalAmount]: "invalid community pool spend proposal amount",
1090
+ [ChainDistributionErrorCodes.ErrEmptyProposalRecipient]: "invalid community pool spend proposal recipient",
1091
+ [ChainDistributionErrorCodes.ErrNoValidatorExists]: "validator does not exist",
1092
+ [ChainDistributionErrorCodes.ErrNoDelegationExists]: "delegation does not exist"
1093
+ };
1094
+ const wasmErrorMap = {
1095
+ [ChainWasmErrorCodes.ErrCreateFailed]: "create wasm contract failed",
1096
+ [ChainWasmErrorCodes.ErrAccountExists]: "contract account already exists",
1097
+ [ChainWasmErrorCodes.ErrInstantiateFailed]: "instantiate wasm contract failed",
1098
+ [ChainWasmErrorCodes.ErrExecuteFailed]: "Contract execution failed",
1099
+ [ChainWasmErrorCodes.ErrGasLimit]: "insufficient gas",
1100
+ [ChainWasmErrorCodes.ErrInvalidGenesis]: "invalid genesis",
1101
+ [ChainWasmErrorCodes.ErrNotFound]: "not found",
1102
+ [ChainWasmErrorCodes.ErrQueryFailed]: "query wasm contract failed",
1103
+ [ChainWasmErrorCodes.ErrInvalidMsg]: "invalid CosmosMsg from the contract",
1104
+ [ChainWasmErrorCodes.ErrMigrationFailed]: "migrate wasm contract failed",
1105
+ [ChainWasmErrorCodes.ErrEmpty]: "empty",
1106
+ [ChainWasmErrorCodes.ErrLimit]: "exceeds limit",
1107
+ [ChainWasmErrorCodes.ErrInvalid]: "invalid",
1108
+ [ChainWasmErrorCodes.ErrDuplicate]: "duplicate",
1109
+ [ChainWasmErrorCodes.ErrMaxIBCChannels]: "max transfer channels",
1110
+ [ChainWasmErrorCodes.ErrUnsupportedForContract]: "unsupported for this contract",
1111
+ [ChainWasmErrorCodes.ErrPinContractFailed]: "pinning contract failed",
1112
+ [ChainWasmErrorCodes.ErrUnpinContractFailed]: "unpinning contract failed",
1113
+ [ChainWasmErrorCodes.ErrUnknownMsg]: "unknown message from the contract",
1114
+ [ChainWasmErrorCodes.ErrInvalidEvent]: "invalid event"
1115
+ };
1116
+ const chainModuleCodeErrorMessagesMap = {
1117
+ [TransactionChainErrorModule.AuthZ]: authZErrorMap,
1118
+ [TransactionChainErrorModule.Auction]: auctionErrorMap,
1119
+ [TransactionChainErrorModule.CosmosSdk]: cosmosErrorMap,
1120
+ [TransactionChainErrorModule.Exchange]: exchangeErrorMap,
1121
+ [TransactionChainErrorModule.Insurance]: insuranceErrorMap,
1122
+ [TransactionChainErrorModule.Ocr]: ocrErrorMap,
1123
+ [TransactionChainErrorModule.Oracle]: oracleErrorMap,
1124
+ [TransactionChainErrorModule.Peggy]: peggyErrorMap,
1125
+ [TransactionChainErrorModule.TokenFactory]: tokenFactoryErrorMap,
1126
+ [TransactionChainErrorModule.Wasmx]: wasmxErrorMap,
1127
+ [TransactionChainErrorModule.Wasm]: wasmErrorMap,
1128
+ [TransactionChainErrorModule.Staking]: stakingErrorMap,
1129
+ [TransactionChainErrorModule.Bank]: bankErrorMap,
1130
+ [TransactionChainErrorModule.Gov]: govErrorMap,
1131
+ [TransactionChainErrorModule.Distribution]: distributionErrorMap
1132
+ };
1133
+ /**
1134
+ * **Legacy** but needed for error messages from broadcasting transactions
1135
+ * where we don't control the response and only have the message
1136
+ * i.e Keplr, Leap, etc
1137
+ */
1138
+ const chainErrorMessagesMap = {
1139
+ "insufficient fee": {
1140
+ message: "You do not have enough funds to cover the transaction fees.",
1141
+ code: ChainCosmosErrorCode.ErrInsufficientFee,
1142
+ module: TransactionChainErrorModule.CosmosSdk
1143
+ },
1144
+ "insufficient funds": {
1145
+ message: "You do not have enough funds.",
1146
+ code: ChainCosmosErrorCode.ErrInsufficientFunds,
1147
+ module: TransactionChainErrorModule.CosmosSdk
1148
+ },
1149
+ "tx timeout height": {
1150
+ message: "The transaction failed to be included within a block on time.",
1151
+ code: ChainCosmosErrorCode.ErrTxTimeoutHeight,
1152
+ module: TransactionChainErrorModule.CosmosSdk
1153
+ },
1154
+ "tx parse error": {
1155
+ message: "There is an issue while parsing the transaction",
1156
+ code: ChainCosmosErrorCode.ErrTxDecode,
1157
+ module: TransactionChainErrorModule.CosmosSdk
1158
+ },
1159
+ "invalid sequence": {
1160
+ message: "The sequence number is not valid",
1161
+ code: ChainCosmosErrorCode.ErrInvalidSequence,
1162
+ module: TransactionChainErrorModule.CosmosSdk
1163
+ },
1164
+ unauthorized: {
1165
+ message: "Unauthorized",
1166
+ code: ChainCosmosErrorCode.ErrUnauthorized,
1167
+ module: TransactionChainErrorModule.CosmosSdk
1168
+ },
1169
+ "invalid address": {
1170
+ message: "The address is not valid",
1171
+ code: ChainCosmosErrorCode.ErrInvalidAddress,
1172
+ module: TransactionChainErrorModule.CosmosSdk
1173
+ },
1174
+ "cosmos account not exists": {
1175
+ message: "You need to create your address on Injective by transferring funds",
1176
+ code: ChainCosmosErrorCode.ErrInsufficientFee,
1177
+ module: TransactionChainErrorModule.CosmosSdk
1178
+ },
1179
+ "invalid pubkey": {
1180
+ message: "The public key is not valid",
1181
+ code: ChainCosmosErrorCode.ErrInvalidPubKey,
1182
+ module: TransactionChainErrorModule.CosmosSdk
1183
+ },
1184
+ "unknown address": {
1185
+ message: "The address is unknown",
1186
+ code: ChainCosmosErrorCode.ErrUnknownAddress,
1187
+ module: TransactionChainErrorModule.CosmosSdk
1188
+ },
1189
+ "invalid coins": {
1190
+ message: "The coins are not valid",
1191
+ code: ChainCosmosErrorCode.ErrInvalidCoins,
1192
+ module: TransactionChainErrorModule.CosmosSdk
1193
+ },
1194
+ "out of gas": {
1195
+ message: "The transaction run out of gas",
1196
+ code: ChainCosmosErrorCode.ErrOutOfGas,
1197
+ module: TransactionChainErrorModule.CosmosSdk
1198
+ },
1199
+ "memo too large": {
1200
+ message: "The memo field in the transaction is too large",
1201
+ code: ChainCosmosErrorCode.ErrMemoTooLarge,
1202
+ module: TransactionChainErrorModule.CosmosSdk
1203
+ },
1204
+ "maximum number of signatures exceeded": {
1205
+ message: "The transaction exceeded the maximum number of signatures",
1206
+ code: ChainCosmosErrorCode.ErrTooManySignatures,
1207
+ module: TransactionChainErrorModule.CosmosSdk
1208
+ },
1209
+ "no signatures supplied": {
1210
+ message: "There are no signatures appended on the transaction",
1211
+ code: ChainCosmosErrorCode.ErrNoSignatures,
1212
+ module: TransactionChainErrorModule.CosmosSdk
1213
+ },
1214
+ "failed to marshal JSON bytes": {
1215
+ message: "There is an issue while parsing the transaction",
1216
+ code: ChainCosmosErrorCode.ErrJSONMarshal,
1217
+ module: TransactionChainErrorModule.CosmosSdk
1218
+ },
1219
+ "failed to unmarshal JSON bytes": {
1220
+ message: "There is an issue while parsing the transaction",
1221
+ code: ChainCosmosErrorCode.ErrJSONUnmarshal,
1222
+ module: TransactionChainErrorModule.CosmosSdk
1223
+ },
1224
+ "invalid request": {
1225
+ message: "invalid request",
1226
+ code: ChainCosmosErrorCode.ErrInvalidRequest,
1227
+ module: TransactionChainErrorModule.CosmosSdk
1228
+ },
1229
+ "tx already in mempool": {
1230
+ message: "The transaction is already in the mempool",
1231
+ code: ChainCosmosErrorCode.ErrTxInMempoolCache,
1232
+ module: TransactionChainErrorModule.CosmosSdk
1233
+ },
1234
+ "mempool is full": {
1235
+ message: "The transaction failed to be included within a block on time.",
1236
+ code: ChainCosmosErrorCode.ErrMempoolIsFull,
1237
+ module: TransactionChainErrorModule.CosmosSdk
1238
+ },
1239
+ "tx too large": {
1240
+ message: "The transaction is too large",
1241
+ code: ChainCosmosErrorCode.ErrTxTooLarge,
1242
+ module: TransactionChainErrorModule.CosmosSdk
1243
+ },
1244
+ "key not found": {
1245
+ message: "Address is not yet active on the chain as it has a $0 balance. To activate it, please send a small amount of funds. Once funded, the network will recognize the address, allowing you to proceed.",
1246
+ code: ChainCosmosErrorCode.ErrKeyNotFound,
1247
+ module: TransactionChainErrorModule.CosmosSdk
1248
+ },
1249
+ "invalid account password": {
1250
+ message: "invalid account password",
1251
+ code: ChainCosmosErrorCode.ErrWrongPassword,
1252
+ module: TransactionChainErrorModule.CosmosSdk
1253
+ },
1254
+ "tx intended signer does not match the given signer": {
1255
+ message: "tx intended signer does not match the given signer",
1256
+ code: ChainCosmosErrorCode.ErrorInvalidSigner,
1257
+ module: TransactionChainErrorModule.CosmosSdk
1258
+ },
1259
+ "invalid gas adjustment": {
1260
+ message: "invalid gas adjustment",
1261
+ code: ChainCosmosErrorCode.ErrorInvalidGasAdjustment,
1262
+ module: TransactionChainErrorModule.CosmosSdk
1263
+ },
1264
+ "invalid height": {
1265
+ message: "The height provided in the transaction is not valid",
1266
+ code: ChainCosmosErrorCode.ErrInvalidHeight,
1267
+ module: TransactionChainErrorModule.CosmosSdk
1268
+ },
1269
+ "invalid version": {
1270
+ message: "The version provided in the transaction is not valid",
1271
+ code: ChainCosmosErrorCode.ErrInvalidVersion,
1272
+ module: TransactionChainErrorModule.CosmosSdk
1273
+ },
1274
+ "invalid chain-id": {
1275
+ message: "The chainId provided in the transaction is not valid",
1276
+ code: ChainCosmosErrorCode.ErrInvalidChainID,
1277
+ module: TransactionChainErrorModule.CosmosSdk
1278
+ },
1279
+ "invalid type": {
1280
+ message: "The type provided in the transaction is not valid",
1281
+ code: ChainCosmosErrorCode.ErrInvalidType,
1282
+ module: TransactionChainErrorModule.CosmosSdk
1283
+ },
1284
+ "unknown extension options": {
1285
+ message: "The extension options provided in the transaction is unknown",
1286
+ code: ChainCosmosErrorCode.ErrUnknownExtensionOptions,
1287
+ module: TransactionChainErrorModule.CosmosSdk
1288
+ },
1289
+ "incorrect account sequence": {
1290
+ message: "The sequence number provided in the transaction is incorrect",
1291
+ code: ChainCosmosErrorCode.ErrWrongSequence,
1292
+ module: TransactionChainErrorModule.CosmosSdk
1293
+ },
1294
+ "failed packing protobuf message to Any": {
1295
+ message: "failed packing protobuf message to Any",
1296
+ code: ChainCosmosErrorCode.ErrPackAny,
1297
+ module: TransactionChainErrorModule.CosmosSdk
1298
+ },
1299
+ "failed unpacking protobuf message from Any": {
1300
+ message: "failed unpacking protobuf message from Any",
1301
+ code: ChainCosmosErrorCode.ErrUnpackAny,
1302
+ module: TransactionChainErrorModule.CosmosSdk
1303
+ },
1304
+ "internal logic error": {
1305
+ message: "Internal logic error",
1306
+ code: ChainCosmosErrorCode.ErrLogic,
1307
+ module: TransactionChainErrorModule.CosmosSdk
1308
+ },
1309
+ conflict: {
1310
+ message: "conflict",
1311
+ code: ChainCosmosErrorCode.ErrConflict,
1312
+ module: TransactionChainErrorModule.CosmosSdk
1313
+ },
1314
+ "feature not supported": {
1315
+ message: "The feature is not supported",
1316
+ code: ChainCosmosErrorCode.ErrNotSupported,
1317
+ module: TransactionChainErrorModule.CosmosSdk
1318
+ },
1319
+ "Internal IO error": {
1320
+ message: "Internal IO error",
1321
+ code: ChainCosmosErrorCode.ErrIO,
1322
+ module: TransactionChainErrorModule.CosmosSdk
1323
+ },
1324
+ "error in app.toml": {
1325
+ message: "error in app.toml",
1326
+ code: ChainCosmosErrorCode.ErrAppConfig,
1327
+ module: TransactionChainErrorModule.CosmosSdk
1328
+ },
1329
+ "invalid gas limit": {
1330
+ message: "The gas limit provided in the transaction is not valid",
1331
+ code: ChainCosmosErrorCode.ErrInvalidGasLimit,
1332
+ module: TransactionChainErrorModule.CosmosSdk
1333
+ },
1334
+ "invalid bid denom": {
1335
+ message: "The gas limit provided in the transaction is not valid",
1336
+ code: ChainAuctionErrorCodes.ErrBidInvalid,
1337
+ module: TransactionChainErrorModule.Auction
1338
+ },
1339
+ "invalid bid round": {
1340
+ message: "The gas limit provided in the transaction is not valid",
1341
+ code: ChainAuctionErrorCodes.ErrBidRound,
1342
+ module: TransactionChainErrorModule.Auction
1343
+ },
1344
+ "insurance fund already exists": {
1345
+ message: "The insurance fund already exists",
1346
+ code: ChainInsuranceErrorCodes.ErrInsuranceFundAlreadyExists,
1347
+ module: TransactionChainErrorModule.Insurance
1348
+ },
1349
+ "insurance fund not found": {
1350
+ message: "The insurance fund is not found",
1351
+ code: ChainInsuranceErrorCodes.ErrInsuranceFundNotFound,
1352
+ module: TransactionChainErrorModule.Insurance
1353
+ },
1354
+ "redemption already exists": {
1355
+ message: "The redemption already exists",
1356
+ code: ChainInsuranceErrorCodes.ErrRedemptionAlreadyExists,
1357
+ module: TransactionChainErrorModule.Insurance
1358
+ },
1359
+ "invalid deposit amount": {
1360
+ message: "The deposit amount is not valid",
1361
+ code: ChainInsuranceErrorCodes.ErrInvalidDepositAmount,
1362
+ module: TransactionChainErrorModule.Insurance
1363
+ },
1364
+ "invalid deposit denom": {
1365
+ message: "The deposit denom is not valid",
1366
+ code: ChainInsuranceErrorCodes.ErrInvalidDepositDenom,
1367
+ module: TransactionChainErrorModule.Insurance
1368
+ },
1369
+ "insurance payout exceeds deposits": {
1370
+ message: "The insurance fund payout exceeds the deposits",
1371
+ code: ChainInsuranceErrorCodes.ErrPayoutTooLarge,
1372
+ module: TransactionChainErrorModule.Insurance
1373
+ },
1374
+ "invalid ticker": {
1375
+ message: "The ticker is not valid",
1376
+ code: ChainInsuranceErrorCodes.ErrInvalidTicker,
1377
+ module: TransactionChainErrorModule.Insurance
1378
+ },
1379
+ "invalid quote denom": {
1380
+ message: "The quote denom is not valid",
1381
+ code: ChainInsuranceErrorCodes.ErrInvalidQuoteDenom,
1382
+ module: TransactionChainErrorModule.Insurance
1383
+ },
1384
+ "invalid oracle": {
1385
+ message: "The oracle is not valid",
1386
+ code: ChainInsuranceErrorCodes.ErrInvalidOracle,
1387
+ module: TransactionChainErrorModule.Insurance
1388
+ },
1389
+ "invalid expiration time": {
1390
+ message: "The expiration time is not valid",
1391
+ code: ChainInsuranceErrorCodes.ErrInvalidExpirationTime,
1392
+ module: TransactionChainErrorModule.Insurance
1393
+ },
1394
+ "invalid marketID": {
1395
+ message: "The marketId is not valid",
1396
+ code: ChainInsuranceErrorCodes.ErrInvalidMarketID,
1397
+ module: TransactionChainErrorModule.Insurance
1398
+ },
1399
+ "invalid share denom": {
1400
+ message: "The share denom is not valid",
1401
+ code: ChainInsuranceErrorCodes.ErrInvalidShareDenom,
1402
+ module: TransactionChainErrorModule.Insurance
1403
+ },
1404
+ "failed to validate order": {
1405
+ message: "Your order failed to validate",
1406
+ code: ChainExchangeModuleErrorCode.ErrOrderInvalid,
1407
+ module: TransactionChainErrorModule.Exchange
1408
+ },
1409
+ "spot market not found": {
1410
+ message: "The spot market has not been found",
1411
+ code: ChainExchangeModuleErrorCode.ErrSpotMarketNotFound,
1412
+ module: TransactionChainErrorModule.Exchange
1413
+ },
1414
+ "spot market exists": {
1415
+ message: "The spot market already exists",
1416
+ code: ChainExchangeModuleErrorCode.ErrSpotMarketExists,
1417
+ module: TransactionChainErrorModule.Exchange
1418
+ },
1419
+ "struct field error": {
1420
+ message: "There is an issue with your order",
1421
+ code: ChainExchangeModuleErrorCode.ErrBadField,
1422
+ module: TransactionChainErrorModule.Exchange
1423
+ },
1424
+ "failed to validate market": {
1425
+ message: "The market failed to validate",
1426
+ code: ChainExchangeModuleErrorCode.ErrMarketInvalid,
1427
+ module: TransactionChainErrorModule.Exchange
1428
+ },
1429
+ "subaccount has insufficient deposits": {
1430
+ message: "Your trading account has insufficient funds",
1431
+ code: ChainExchangeModuleErrorCode.ErrInsufficientDeposit,
1432
+ module: TransactionChainErrorModule.Exchange
1433
+ },
1434
+ "unrecognized order type": {
1435
+ message: "The order type is not recognized",
1436
+ code: ChainExchangeModuleErrorCode.ErrUnrecognizedOrderType,
1437
+ module: TransactionChainErrorModule.Exchange
1438
+ },
1439
+ "position quantity insufficient for order": {
1440
+ message: "The position quantity is insufficient for the order",
1441
+ code: ChainExchangeModuleErrorCode.ErrInsufficientPositionQuantity,
1442
+ module: TransactionChainErrorModule.Exchange
1443
+ },
1444
+ "order hash is not valid": {
1445
+ message: "The order hash is not valid",
1446
+ code: ChainExchangeModuleErrorCode.ErrOrderHashInvalid,
1447
+ module: TransactionChainErrorModule.Exchange
1448
+ },
1449
+ "subaccount id is not valid": {
1450
+ message: "The subaccount id is not valid",
1451
+ code: ChainExchangeModuleErrorCode.ErrBadSubaccountID,
1452
+ module: TransactionChainErrorModule.Exchange
1453
+ },
1454
+ "invalid base denom": {
1455
+ message: "",
1456
+ code: ChainExchangeModuleErrorCode.ErrInvalidBaseDenom,
1457
+ module: TransactionChainErrorModule.Exchange
1458
+ },
1459
+ "invalid expiry": {
1460
+ message: "The expiry date is not valid",
1461
+ code: ChainExchangeModuleErrorCode.ErrInvalidExpiry,
1462
+ module: TransactionChainErrorModule.Exchange
1463
+ },
1464
+ "invalid price": {
1465
+ message: "The price is not valid",
1466
+ code: ChainExchangeModuleErrorCode.ErrInvalidPrice,
1467
+ module: TransactionChainErrorModule.Exchange
1468
+ },
1469
+ "invalid quantity": {
1470
+ message: "The quantity is not valid",
1471
+ code: ChainExchangeModuleErrorCode.ErrInvalidQuantity,
1472
+ module: TransactionChainErrorModule.Exchange
1473
+ },
1474
+ "unsupported oracle type": {
1475
+ message: "The oracle type is not supported",
1476
+ code: ChainExchangeModuleErrorCode.ErrUnsupportedOracleType,
1477
+ module: TransactionChainErrorModule.Exchange
1478
+ },
1479
+ "order doesnt exist": {
1480
+ message: "The order does not exist",
1481
+ code: ChainExchangeModuleErrorCode.ErrOrderDoesntExist,
1482
+ module: TransactionChainErrorModule.Exchange
1483
+ },
1484
+ "spot limit orderbook fill invalid": {
1485
+ message: "",
1486
+ code: ChainExchangeModuleErrorCode.ErrOrderbookFillInvalid,
1487
+ module: TransactionChainErrorModule.Exchange
1488
+ },
1489
+ "perpetual market exists": {
1490
+ message: "The perpetual market already exists",
1491
+ code: ChainExchangeModuleErrorCode.ErrPerpetualMarketExists,
1492
+ module: TransactionChainErrorModule.Exchange
1493
+ },
1494
+ "expiry futures market exists": {
1495
+ message: "The expiry futures market market already exists",
1496
+ code: ChainExchangeModuleErrorCode.ErrExpiryFuturesMarketExists,
1497
+ module: TransactionChainErrorModule.Exchange
1498
+ },
1499
+ "expiry futures market expired": {
1500
+ message: "The expiry futures market has expired",
1501
+ code: ChainExchangeModuleErrorCode.ErrExpiryFuturesMarketExpired,
1502
+ module: TransactionChainErrorModule.Exchange
1503
+ },
1504
+ "no liquidity on the orderbook": {
1505
+ message: "There is not enough liquidity",
1506
+ code: ChainExchangeModuleErrorCode.ErrNoLiquidity,
1507
+ module: TransactionChainErrorModule.Exchange
1508
+ },
1509
+ "orderbook liquidity cannot satisfy current worst price": {
1510
+ message: "There is not enough liquidity",
1511
+ code: ChainExchangeModuleErrorCode.ErrSlippageExceedsWorstPrice,
1512
+ module: TransactionChainErrorModule.Exchange
1513
+ },
1514
+ "order has insufficient margin": {
1515
+ message: "The order has insufficient margin",
1516
+ code: ChainExchangeModuleErrorCode.ErrInsufficientOrderMargin,
1517
+ module: TransactionChainErrorModule.Exchange
1518
+ },
1519
+ "derivative market not found": {
1520
+ message: "The derivative market cannot be found",
1521
+ code: ChainExchangeModuleErrorCode.ErrDerivativeMarketNotFound,
1522
+ module: TransactionChainErrorModule.Exchange
1523
+ },
1524
+ "position not found": {
1525
+ message: "The position cannot be found",
1526
+ code: ChainExchangeModuleErrorCode.ErrPositionNotFound,
1527
+ module: TransactionChainErrorModule.Exchange
1528
+ },
1529
+ "position direction does not oppose the reduce-only order": {
1530
+ message: "Position direction does not oppose the reduce-only order",
1531
+ code: ChainExchangeModuleErrorCode.ErrInvalidReduceOnlyPositionDirection,
1532
+ module: TransactionChainErrorModule.Exchange
1533
+ },
1534
+ "price surpasses bankruptcy price": {
1535
+ message: "Your order price surpasses bankruptcy price",
1536
+ code: ChainExchangeModuleErrorCode.ErrPriceSurpassesBankruptcyPrice,
1537
+ module: TransactionChainErrorModule.Exchange
1538
+ },
1539
+ "position not liquidable": {
1540
+ message: "The position is not liquidable",
1541
+ code: ChainExchangeModuleErrorCode.ErrPositionNotLiquidable,
1542
+ module: TransactionChainErrorModule.Exchange
1543
+ },
1544
+ "invalid trigger price": {
1545
+ message: "Your order trigger price is not valid",
1546
+ code: ChainExchangeModuleErrorCode.ErrInvalidTriggerPrice,
1547
+ module: TransactionChainErrorModule.Exchange
1548
+ },
1549
+ "invalid oracle type": {
1550
+ message: "The oracle type is not valid",
1551
+ code: ChainExchangeModuleErrorCode.ErrInvalidOracleType,
1552
+ module: TransactionChainErrorModule.Exchange
1553
+ },
1554
+ "invalid minimum price tick size": {
1555
+ message: "The minimum price tick size is not valid",
1556
+ code: ChainExchangeModuleErrorCode.ErrInvalidPriceTickSize,
1557
+ module: TransactionChainErrorModule.Exchange
1558
+ },
1559
+ "invalid minimum quantity tick size": {
1560
+ message: "The minimum quantity tick size is not valid",
1561
+ code: ChainExchangeModuleErrorCode.ErrInvalidQuantityTickSize,
1562
+ module: TransactionChainErrorModule.Exchange
1563
+ },
1564
+ "invalid minimum order margin": {
1565
+ message: "Your order's minimum margin is not valid ",
1566
+ code: ChainExchangeModuleErrorCode.ErrInvalidMargin,
1567
+ module: TransactionChainErrorModule.Exchange
1568
+ },
1569
+ "exceeds order side count": {
1570
+ message: "You cannot have more orders for this market for this direction",
1571
+ code: ChainExchangeModuleErrorCode.ErrExceedsOrderSideCount,
1572
+ module: TransactionChainErrorModule.Exchange
1573
+ },
1574
+ "subaccount cannot place a market order when a market order in the same market was already placed in same block": {
1575
+ message: "You cannot place another market order within this block",
1576
+ code: ChainExchangeModuleErrorCode.ErrMarketOrderAlreadyExists,
1577
+ module: TransactionChainErrorModule.Exchange
1578
+ },
1579
+ "cannot place a conditional market order when a conditional market order in same relative direction already exists": {
1580
+ message: "You cannot place another conditional market order",
1581
+ code: ChainExchangeModuleErrorCode.ErrConditionalMarketOrderAlreadyExists,
1582
+ module: TransactionChainErrorModule.Exchange
1583
+ },
1584
+ "an equivalent market launch proposal already exists.": {
1585
+ message: "There is an existing equivalent market launch proposal.",
1586
+ code: ChainExchangeModuleErrorCode.ErrMarketLaunchProposalAlreadyExists,
1587
+ module: TransactionChainErrorModule.Exchange
1588
+ },
1589
+ "invalid market status": {
1590
+ message: "The market status is not valid",
1591
+ code: ChainExchangeModuleErrorCode.ErrInvalidMarketStatus,
1592
+ module: TransactionChainErrorModule.Exchange
1593
+ },
1594
+ "base denom cannot be same with quote denom": {
1595
+ message: "The base denom and quote denom cannot be same",
1596
+ code: ChainExchangeModuleErrorCode.ErrSameDenoms,
1597
+ module: TransactionChainErrorModule.Exchange
1598
+ },
1599
+ "oracle base cannot be same with oracle quote": {
1600
+ message: "The oracle base and the oracle quote cannot be the same",
1601
+ code: ChainExchangeModuleErrorCode.ErrSameOracles,
1602
+ module: TransactionChainErrorModule.Exchange
1603
+ },
1604
+ "makerfeerate does not match takerfeeeate requirements": {
1605
+ message: "The MakerFeeRate does not match TakerFeeRate requirements",
1606
+ code: ChainExchangeModuleErrorCode.ErrFeeRatesRelation,
1607
+ module: TransactionChainErrorModule.Exchange
1608
+ },
1609
+ "maintenancemarginratio cannot be greater than initialmarginratio": {
1610
+ message: "The MaintenanceMarginRatio cannot be greater than InitialMarginRatio",
1611
+ code: ChainExchangeModuleErrorCode.ErrMarginsRelation,
1612
+ module: TransactionChainErrorModule.Exchange
1613
+ },
1614
+ "oraclescalefactor cannot be greater than maxoraclescalefactor": {
1615
+ message: "The OracleScaleFactor cannot be greater than MaxOracleScaleFactor",
1616
+ code: ChainExchangeModuleErrorCode.ErrExceedsMaxOracleScaleFactor,
1617
+ module: TransactionChainErrorModule.Exchange
1618
+ },
1619
+ "spot exchange is not enabled yet": {
1620
+ message: "Spot exchange is not enabled yet",
1621
+ code: ChainExchangeModuleErrorCode.ErrSpotExchangeNotEnabled,
1622
+ module: TransactionChainErrorModule.Exchange
1623
+ },
1624
+ "derivatives exchange is not enabled yet": {
1625
+ message: "Derivatives exchange is not enabled yet",
1626
+ code: ChainExchangeModuleErrorCode.ErrDerivativesExchangeNotEnabled,
1627
+ module: TransactionChainErrorModule.Exchange
1628
+ },
1629
+ "oracle price delta exceeds threshold": {
1630
+ message: "The oracle price delta exceeds threshold",
1631
+ code: ChainExchangeModuleErrorCode.ErrOraclePriceDeltaExceedsThreshold,
1632
+ module: TransactionChainErrorModule.Exchange
1633
+ },
1634
+ "invalid hourly interest rate": {
1635
+ message: "The hourly interest rate is not valid",
1636
+ code: ChainExchangeModuleErrorCode.ErrInvalidHourlyInterestRate,
1637
+ module: TransactionChainErrorModule.Exchange
1638
+ },
1639
+ "invalid hourly funding rate cap": {
1640
+ message: "The hourly funding rate cap is not valid",
1641
+ code: ChainExchangeModuleErrorCode.ErrInvalidHourlyFundingRateCap,
1642
+ module: TransactionChainErrorModule.Exchange
1643
+ },
1644
+ "only perpetual markets can update funding parameters": {
1645
+ message: "You can only update funding parameters on perpetual markets.",
1646
+ code: ChainExchangeModuleErrorCode.ErrInvalidMarketFundingParamUpdate,
1647
+ module: TransactionChainErrorModule.Exchange
1648
+ },
1649
+ "invalid trading reward campaign": {
1650
+ message: "The trading reward campaign is not valid",
1651
+ code: ChainExchangeModuleErrorCode.ErrInvalidTradingRewardCampaign,
1652
+ module: TransactionChainErrorModule.Exchange
1653
+ },
1654
+ "invalid fee discount schedule": {
1655
+ message: "The fee discount schedule is not valid",
1656
+ code: ChainExchangeModuleErrorCode.ErrInvalidFeeDiscountSchedule,
1657
+ module: TransactionChainErrorModule.Exchange
1658
+ },
1659
+ "invalid liquidation order": {
1660
+ message: "The liquidation order is not valid",
1661
+ code: ChainExchangeModuleErrorCode.ErrInvalidLiquidationOrder,
1662
+ module: TransactionChainErrorModule.Exchange
1663
+ },
1664
+ "unknown error happened for campaign distributions": {
1665
+ message: "Unknown error happened for campaign distributions",
1666
+ code: ChainExchangeModuleErrorCode.ErrTradingRewardCampaignDistributionError,
1667
+ module: TransactionChainErrorModule.Exchange
1668
+ },
1669
+ "invalid trading reward points update": {
1670
+ message: "The updated trading reward points is not valid",
1671
+ code: ChainExchangeModuleErrorCode.ErrInvalidTradingRewardsPendingPointsUpdate,
1672
+ module: TransactionChainErrorModule.Exchange
1673
+ },
1674
+ "invalid batch msg update": {
1675
+ message: "The MsgBatchUpdate is not valid",
1676
+ code: ChainExchangeModuleErrorCode.ErrInvalidBatchMsgUpdate,
1677
+ module: TransactionChainErrorModule.Exchange
1678
+ },
1679
+ "post-only order exceeds top of book price": {
1680
+ message: "The post-only order price exceeds top of the orderbook price",
1681
+ code: ChainExchangeModuleErrorCode.ErrExceedsTopOfBookPrice,
1682
+ module: TransactionChainErrorModule.Exchange
1683
+ },
1684
+ "order type not supported for given message": {
1685
+ message: "The order type is not supported for this message",
1686
+ code: ChainExchangeModuleErrorCode.ErrInvalidOrderTypeForMessage,
1687
+ module: TransactionChainErrorModule.Exchange
1688
+ },
1689
+ "sender must match dmm account": {
1690
+ message: "The sender must match the DMM address",
1691
+ code: ChainExchangeModuleErrorCode.ErrInvalidDMMSender,
1692
+ module: TransactionChainErrorModule.Exchange
1693
+ },
1694
+ "already opted out of rewards": {
1695
+ message: "The DMM address already opted out of rewards",
1696
+ code: ChainExchangeModuleErrorCode.ErrAlreadyOptedOutOfRewards,
1697
+ module: TransactionChainErrorModule.Exchange
1698
+ },
1699
+ "invalid margin ratio": {
1700
+ message: "The margin ratio is not valid",
1701
+ code: ChainExchangeModuleErrorCode.ErrInvalidMarginRatio,
1702
+ module: TransactionChainErrorModule.Exchange
1703
+ },
1704
+ "provided funds are below minimum": {
1705
+ message: "The provided funds are below minimum",
1706
+ code: ChainExchangeModuleErrorCode.ErrBelowMinimalContribution,
1707
+ module: TransactionChainErrorModule.Exchange
1708
+ },
1709
+ "position is below initial margin requirement": {
1710
+ message: "The position is below initial margin requirement",
1711
+ code: ChainExchangeModuleErrorCode.ErrLowPositionMargin,
1712
+ module: TransactionChainErrorModule.Exchange
1713
+ },
1714
+ "pool has non-positive total lp token supply": {
1715
+ message: "The pool has non-positive total LP token supply",
1716
+ code: ChainExchangeModuleErrorCode.ErrInvalidTotalSupply,
1717
+ module: TransactionChainErrorModule.Exchange
1718
+ },
1719
+ "passed lp token burn amount is greater than total lp token supply": {
1720
+ message: "The passed LP token burn amount is greater than total LP token supply",
1721
+ code: ChainExchangeModuleErrorCode.ErrInvalidLpTokenBurnAmount,
1722
+ module: TransactionChainErrorModule.Exchange
1723
+ },
1724
+ "unsupported action": {
1725
+ message: "This action is not supported",
1726
+ code: ChainExchangeModuleErrorCode.ErrUnsupportedAction,
1727
+ module: TransactionChainErrorModule.Exchange
1728
+ },
1729
+ "position quantity cannot be negative": {
1730
+ message: "The position quantity cannot be negative",
1731
+ code: ChainExchangeModuleErrorCode.ErrNegativePositionQuantity,
1732
+ module: TransactionChainErrorModule.Exchange
1733
+ },
1734
+ "binary options market exists": {
1735
+ message: "The BinaryOptions market already exists",
1736
+ code: ChainExchangeModuleErrorCode.ErrBinaryOptionsMarketExists,
1737
+ module: TransactionChainErrorModule.Exchange
1738
+ },
1739
+ "binary options market not found": {
1740
+ message: "The BinaryOptions market cannot be found",
1741
+ code: ChainExchangeModuleErrorCode.ErrBinaryOptionsMarketNotFound,
1742
+ module: TransactionChainErrorModule.Exchange
1743
+ },
1744
+ "invalid settlement": {
1745
+ message: "The settlement price is not valid",
1746
+ code: ChainExchangeModuleErrorCode.ErrInvalidSettlement,
1747
+ module: TransactionChainErrorModule.Exchange
1748
+ },
1749
+ "account doesnt exist": {
1750
+ message: "The trading account does not exist",
1751
+ code: ChainExchangeModuleErrorCode.ErrAccountDoesntExist,
1752
+ module: TransactionChainErrorModule.Exchange
1753
+ },
1754
+ "sender should be a market admin": {
1755
+ message: "The sender should be the admin of the market",
1756
+ code: ChainExchangeModuleErrorCode.ErrSenderIsNotAnAdmin,
1757
+ module: TransactionChainErrorModule.Exchange
1758
+ },
1759
+ "market is already scheduled to settle": {
1760
+ message: "The market is already scheduled to settle ",
1761
+ code: ChainExchangeModuleErrorCode.ErrMarketAlreadyScheduledToSettle,
1762
+ module: TransactionChainErrorModule.Exchange
1763
+ },
1764
+ "market not found": {
1765
+ message: "The market cannot be found",
1766
+ code: ChainExchangeModuleErrorCode.ErrGenericMarketNotFound,
1767
+ module: TransactionChainErrorModule.Exchange
1768
+ },
1769
+ "denom decimal cannot be below 1 or above max scale factor": {
1770
+ message: "The denom decimal cannot be below 1 or above max scale factor",
1771
+ code: ChainExchangeModuleErrorCode.ErrInvalidDenomDecimal,
1772
+ module: TransactionChainErrorModule.Exchange
1773
+ },
1774
+ "state is invalid": {
1775
+ message: "The state is not valid",
1776
+ code: ChainExchangeModuleErrorCode.ErrInvalidState,
1777
+ module: TransactionChainErrorModule.Exchange
1778
+ },
1779
+ "transient orders up to cancellation not supported": {
1780
+ message: "The transient orders up to cancellation not supported",
1781
+ code: ChainExchangeModuleErrorCode.ErrTransientOrdersUpToCancelNotSupported,
1782
+ module: TransactionChainErrorModule.Exchange
1783
+ },
1784
+ "invalid trade": {
1785
+ message: "The trade is not valid",
1786
+ code: ChainExchangeModuleErrorCode.ErrInvalidTrade,
1787
+ module: TransactionChainErrorModule.Exchange
1788
+ },
1789
+ "no margin locked in subaccount": {
1790
+ message: "There is no margin locked in the trading account",
1791
+ code: ChainExchangeModuleErrorCode.ErrNoMarginLocked,
1792
+ module: TransactionChainErrorModule.Exchange
1793
+ },
1794
+ "Invalid access level to perform action": {
1795
+ message: "There is no access to perform action",
1796
+ code: ChainExchangeModuleErrorCode.ErrInvalidAccessLevel,
1797
+ module: TransactionChainErrorModule.Exchange
1798
+ },
1799
+ "Invalid address": {
1800
+ message: "The address is not valid",
1801
+ code: ChainExchangeModuleErrorCode.ErrInvalidAddress,
1802
+ module: TransactionChainErrorModule.Exchange
1803
+ },
1804
+ "Invalid argument": {
1805
+ message: "The argument is not valid",
1806
+ code: ChainExchangeModuleErrorCode.ErrInvalidArgument,
1807
+ module: TransactionChainErrorModule.Exchange
1808
+ },
1809
+ "empty validator address": {
1810
+ message: "empty validator address",
1811
+ code: ChainStakingErrorCodes.ErrEmptyValidatorAddr,
1812
+ module: TransactionChainErrorModule.Staking
1813
+ },
1814
+ "validator does not exist": {
1815
+ message: "validator does not exist",
1816
+ code: ChainStakingErrorCodes.ErrNoValidatorFound,
1817
+ module: TransactionChainErrorModule.Staking
1818
+ },
1819
+ "validator already exist for this operator address; must use new validator operator address": {
1820
+ message: "validator already exist for this operator address; must use new validator operator address",
1821
+ code: ChainStakingErrorCodes.ErrValidatorOwnerExists,
1822
+ module: TransactionChainErrorModule.Staking
1823
+ },
1824
+ "validator already exist for this pubkey; must use new validator pubkey": {
1825
+ message: "validator already exist for this pubkey; must use new validator pubkey",
1826
+ code: ChainStakingErrorCodes.ErrValidatorPubKeyExists,
1827
+ module: TransactionChainErrorModule.Staking
1828
+ },
1829
+ "validator pubkey type is not supported": {
1830
+ message: "validator pubkey type is not supported",
1831
+ code: ChainStakingErrorCodes.ErrValidatorPubKeyTypeNotSupported,
1832
+ module: TransactionChainErrorModule.Staking
1833
+ },
1834
+ "validator for this address is currently jailed": {
1835
+ message: "validator for this address is currently jailed",
1836
+ code: ChainStakingErrorCodes.ErrValidatorJailed,
1837
+ module: TransactionChainErrorModule.Staking
1838
+ },
1839
+ "failed to remove validator": {
1840
+ message: "failed to remove validator",
1841
+ code: ChainStakingErrorCodes.ErrBadRemoveValidator,
1842
+ module: TransactionChainErrorModule.Staking
1843
+ },
1844
+ "commission must be positive": {
1845
+ message: "commission must be positive",
1846
+ code: ChainStakingErrorCodes.ErrCommissionNegative,
1847
+ module: TransactionChainErrorModule.Staking
1848
+ },
1849
+ "commission cannot be more than 100%": {
1850
+ message: "commission cannot be more than 100%",
1851
+ code: ChainStakingErrorCodes.ErrCommissionHuge,
1852
+ module: TransactionChainErrorModule.Staking
1853
+ },
1854
+ "commission cannot be more than the max rate": {
1855
+ message: "commission cannot be more than the max rate",
1856
+ code: ChainStakingErrorCodes.ErrCommissionGTMaxRate,
1857
+ module: TransactionChainErrorModule.Staking
1858
+ },
1859
+ "commission cannot be changed more than once in 24h": {
1860
+ message: "commission cannot be changed more than once in 24h",
1861
+ code: ChainStakingErrorCodes.ErrCommissionUpdateTime,
1862
+ module: TransactionChainErrorModule.Staking
1863
+ },
1864
+ "commission change rate must be positive": {
1865
+ message: "commission change rate must be positive",
1866
+ code: ChainStakingErrorCodes.ErrCommissionChangeRateNegative,
1867
+ module: TransactionChainErrorModule.Staking
1868
+ },
1869
+ "commission change rate cannot be more than the max rate": {
1870
+ message: "commission change rate cannot be more than the max rate",
1871
+ code: ChainStakingErrorCodes.ErrCommissionChangeRateGTMaxRate,
1872
+ module: TransactionChainErrorModule.Staking
1873
+ },
1874
+ "commission cannot be changed more than max change rate": {
1875
+ message: "commission cannot be changed more than max change rate",
1876
+ code: ChainStakingErrorCodes.ErrCommissionGTMaxChangeRate,
1877
+ module: TransactionChainErrorModule.Staking
1878
+ },
1879
+ "validator's self delegation must be greater than their minimum self delegation": {
1880
+ message: "validator's self delegation must be greater than their minimum self delegation",
1881
+ code: ChainStakingErrorCodes.ErrSelfDelegationBelowMinimum,
1882
+ module: TransactionChainErrorModule.Staking
1883
+ },
1884
+ "minimum self delegation cannot be decrease": {
1885
+ message: "minimum self delegation cannot be decrease",
1886
+ code: ChainStakingErrorCodes.ErrMinSelfDelegationDecreased,
1887
+ module: TransactionChainErrorModule.Staking
1888
+ },
1889
+ "empty delegator address": {
1890
+ message: "empty delegator address",
1891
+ code: ChainStakingErrorCodes.ErrEmptyDelegatorAddr,
1892
+ module: TransactionChainErrorModule.Staking
1893
+ },
1894
+ "no delegation for (address, validator) tuple": {
1895
+ message: "no delegation for (address, validator) tuple",
1896
+ code: ChainStakingErrorCodes.ErrNoDelegation,
1897
+ module: TransactionChainErrorModule.Staking
1898
+ },
1899
+ "delegator does not exist with address": {
1900
+ message: "delegator does not exist with address",
1901
+ code: ChainStakingErrorCodes.ErrBadDelegatorAddr,
1902
+ module: TransactionChainErrorModule.Staking
1903
+ },
1904
+ "delegator does not contain delegation": {
1905
+ message: "delegator does not contain delegation",
1906
+ code: ChainStakingErrorCodes.ErrNoDelegatorForAddress,
1907
+ module: TransactionChainErrorModule.Staking
1908
+ },
1909
+ "insufficient delegation shares": {
1910
+ message: "insufficient delegation shares",
1911
+ code: ChainStakingErrorCodes.ErrInsufficientShares,
1912
+ module: TransactionChainErrorModule.Staking
1913
+ },
1914
+ "cannot delegate to an empty validator": {
1915
+ message: "cannot delegate to an empty validator",
1916
+ code: ChainStakingErrorCodes.ErrDelegationValidatorEmpty,
1917
+ module: TransactionChainErrorModule.Staking
1918
+ },
1919
+ "not enough delegation shares": {
1920
+ message: "not enough delegation shares",
1921
+ code: ChainStakingErrorCodes.ErrNotEnoughDelegationShares,
1922
+ module: TransactionChainErrorModule.Staking
1923
+ },
1924
+ "entry not mature": {
1925
+ message: "entry not mature",
1926
+ code: ChainStakingErrorCodes.ErrNotMature,
1927
+ module: TransactionChainErrorModule.Staking
1928
+ },
1929
+ "no unbonding delegation found": {
1930
+ message: "no unbonding delegation found",
1931
+ code: ChainStakingErrorCodes.ErrNoUnbondingDelegation,
1932
+ module: TransactionChainErrorModule.Staking
1933
+ },
1934
+ "too many unbonding delegation entries for (delegator, validator) tuple": {
1935
+ message: "too many unbonding delegation entries for (delegator, validator) tuple",
1936
+ code: ChainStakingErrorCodes.ErrMaxUnbondingDelegationEntries,
1937
+ module: TransactionChainErrorModule.Staking
1938
+ },
1939
+ "no redelegation found": {
1940
+ message: "no redelegation found",
1941
+ code: ChainStakingErrorCodes.ErrNoRedelegation,
1942
+ module: TransactionChainErrorModule.Staking
1943
+ },
1944
+ "cannot redelegate to the same validator": {
1945
+ message: "cannot redelegate to the same validator",
1946
+ code: ChainStakingErrorCodes.ErrSelfRedelegation,
1947
+ module: TransactionChainErrorModule.Staking
1948
+ },
1949
+ "too few tokens to redelegate (truncates to zero tokens)": {
1950
+ message: "too few tokens to redelegate (truncates to zero tokens)",
1951
+ code: ChainStakingErrorCodes.ErrTinyRedelegationAmount,
1952
+ module: TransactionChainErrorModule.Staking
1953
+ },
1954
+ "redelegation destination validator not found": {
1955
+ message: "redelegation destination validator not found",
1956
+ code: ChainStakingErrorCodes.ErrBadRedelegationDst,
1957
+ module: TransactionChainErrorModule.Staking
1958
+ },
1959
+ "redelegation to this validator already in progress; first redelegation to this validator must complete before next redelegation": {
1960
+ message: "redelegation to this validator already in progress; first redelegation to this validator must complete before next redelegation",
1961
+ code: ChainStakingErrorCodes.ErrTransitiveRedelegation,
1962
+ module: TransactionChainErrorModule.Staking
1963
+ },
1964
+ "too many redelegation entries for (delegator, src-validator, dst-validator) tuple": {
1965
+ message: "too many redelegation entries for (delegator, src-validator, dst-validator) tuple",
1966
+ code: ChainStakingErrorCodes.ErrMaxRedelegationEntries,
1967
+ module: TransactionChainErrorModule.Staking
1968
+ },
1969
+ "cannot delegate to validators with invalid (zero) ex-rate": {
1970
+ message: "cannot delegate to validators with invalid (zero) ex-rate",
1971
+ code: ChainStakingErrorCodes.ErrDelegatorShareExRateInvalid,
1972
+ module: TransactionChainErrorModule.Staking
1973
+ },
1974
+ "both shares amount and shares percent provided": {
1975
+ message: "both shares amount and shares percent provided",
1976
+ code: ChainStakingErrorCodes.ErrBothShareMsgsGiven,
1977
+ module: TransactionChainErrorModule.Staking
1978
+ },
1979
+ "neither shares amount nor shares percent provided": {
1980
+ message: "neither shares amount nor shares percent provided",
1981
+ code: ChainStakingErrorCodes.ErrNeitherShareMsgsGiven,
1982
+ module: TransactionChainErrorModule.Staking
1983
+ },
1984
+ "invalid historical info": {
1985
+ message: "invalid historical info",
1986
+ code: ChainStakingErrorCodes.ErrInvalidHistoricalInfo,
1987
+ module: TransactionChainErrorModule.Staking
1988
+ },
1989
+ "no historical info found": {
1990
+ message: "no historical info found",
1991
+ code: ChainStakingErrorCodes.ErrNoHistoricalInfo,
1992
+ module: TransactionChainErrorModule.Staking
1993
+ },
1994
+ "empty validator public key": {
1995
+ message: "empty validator public key",
1996
+ code: ChainStakingErrorCodes.ErrEmptyValidatorPubKey,
1997
+ module: TransactionChainErrorModule.Staking
1998
+ },
1999
+ "commission cannot be less than min rate": {
2000
+ message: "commission cannot be less than min rate",
2001
+ code: ChainStakingErrorCodes.ErrCommissionLTMinRate,
2002
+ module: TransactionChainErrorModule.Staking
2003
+ },
2004
+ "unbonding operation not found": {
2005
+ message: "unbonding operation not found",
2006
+ code: ChainStakingErrorCodes.ErrUnbondingNotFound,
2007
+ module: TransactionChainErrorModule.Staking
2008
+ },
2009
+ "cannot un-hold unbonding operation that is not on hold": {
2010
+ message: "cannot un-hold unbonding operation that is not on hold",
2011
+ code: ChainStakingErrorCodes.ErrUnbondingOnHoldRefCountNegative,
2012
+ module: TransactionChainErrorModule.Staking
2013
+ },
2014
+ "delegator address is empty": {
2015
+ message: "delegator address is empty",
2016
+ code: ChainDistributionErrorCodes.ErrEmptyDelegatorAddr,
2017
+ module: TransactionChainErrorModule.Distribution
2018
+ },
2019
+ "withdraw address is empty": {
2020
+ message: "withdraw address is empty",
2021
+ code: ChainDistributionErrorCodes.ErrEmptyWithdrawAddr,
2022
+ module: TransactionChainErrorModule.Distribution
2023
+ },
2024
+ "validator address is empty": {
2025
+ message: "validator address is empty",
2026
+ code: ChainDistributionErrorCodes.ErrEmptyValidatorAddr,
2027
+ module: TransactionChainErrorModule.Distribution
2028
+ },
2029
+ "no delegation distribution info": {
2030
+ message: "no delegation distribution info",
2031
+ code: ChainDistributionErrorCodes.ErrEmptyDelegationDistInfo,
2032
+ module: TransactionChainErrorModule.Distribution
2033
+ },
2034
+ "no validator distribution info": {
2035
+ message: "no validator distribution info",
2036
+ code: ChainDistributionErrorCodes.ErrNoValidatorDistInfo,
2037
+ module: TransactionChainErrorModule.Distribution
2038
+ },
2039
+ "no validator commission to withdraw": {
2040
+ message: "no validator commission to withdraw",
2041
+ code: ChainDistributionErrorCodes.ErrNoValidatorCommission,
2042
+ module: TransactionChainErrorModule.Distribution
2043
+ },
2044
+ "set withdraw address disabled": {
2045
+ message: "set withdraw address disabled",
2046
+ code: ChainDistributionErrorCodes.ErrSetWithdrawAddrDisabled,
2047
+ module: TransactionChainErrorModule.Distribution
2048
+ },
2049
+ "community pool does not have sufficient coins to distribute": {
2050
+ message: "community pool does not have sufficient coins distribute",
2051
+ code: ChainDistributionErrorCodes.ErrBadDistribution,
2052
+ module: TransactionChainErrorModule.Distribution
2053
+ },
2054
+ "invalid community pool spend proposal amount": {
2055
+ message: "invalid community pool spend proposal amount",
2056
+ code: ChainDistributionErrorCodes.ErrInvalidProposalAmount,
2057
+ module: TransactionChainErrorModule.Distribution
2058
+ },
2059
+ "invalid community pool spend proposal recipient": {
2060
+ message: "invalid community pool spend proposal recipient",
2061
+ code: ChainDistributionErrorCodes.ErrEmptyProposalRecipient,
2062
+ module: TransactionChainErrorModule.Distribution
2063
+ },
2064
+ "delegation does not exist": {
2065
+ message: "delegation does not exist",
2066
+ code: ChainDistributionErrorCodes.ErrNoDelegationExists,
2067
+ module: TransactionChainErrorModule.Distribution
2068
+ },
2069
+ "unknown proposal": {
2070
+ message: "unknown proposal",
2071
+ code: ChainGovErrorCodes.ErrUnknownProposal,
2072
+ module: TransactionChainErrorModule.Gov
2073
+ },
2074
+ "inactive proposal": {
2075
+ message: "inactive proposal",
2076
+ code: ChainGovErrorCodes.ErrInactiveProposal,
2077
+ module: TransactionChainErrorModule.Gov
2078
+ },
2079
+ "proposal already active": {
2080
+ message: "proposal already active",
2081
+ code: ChainGovErrorCodes.ErrAlreadyActiveProposal,
2082
+ module: TransactionChainErrorModule.Gov
2083
+ },
2084
+ "invalid proposal content": {
2085
+ message: "invalid proposal content",
2086
+ code: ChainGovErrorCodes.ErrInvalidProposalContent,
2087
+ module: TransactionChainErrorModule.Gov
2088
+ },
2089
+ "invalid proposal type": {
2090
+ message: "invalid proposal type",
2091
+ code: ChainGovErrorCodes.ErrInvalidProposalType,
2092
+ module: TransactionChainErrorModule.Gov
2093
+ },
2094
+ "invalid vote option": {
2095
+ message: "invalid vote option",
2096
+ code: ChainGovErrorCodes.ErrInvalidVote,
2097
+ module: TransactionChainErrorModule.Gov
2098
+ },
2099
+ "invalid genesis state": {
2100
+ message: "invalid genesis state",
2101
+ code: ChainGovErrorCodes.ErrInvalidGenesis,
2102
+ module: TransactionChainErrorModule.Gov
2103
+ },
2104
+ "no handler exists for proposal type": {
2105
+ message: "no handler exists for proposal type",
2106
+ code: ChainGovErrorCodes.ErrNoProposalHandlerExists,
2107
+ module: TransactionChainErrorModule.Gov
2108
+ },
2109
+ "proposal message not recognized by router": {
2110
+ message: "proposal message not recognized by router",
2111
+ code: ChainGovErrorCodes.ErrUnroutableProposalMsg,
2112
+ module: TransactionChainErrorModule.Gov
2113
+ },
2114
+ "no messages proposed": {
2115
+ message: "no messages proposed",
2116
+ code: ChainGovErrorCodes.ErrNoProposalMsgs,
2117
+ module: TransactionChainErrorModule.Gov
2118
+ },
2119
+ "invalid proposal message": {
2120
+ message: "invalid proposal message",
2121
+ code: ChainGovErrorCodes.ErrInvalidProposalMsg,
2122
+ module: TransactionChainErrorModule.Gov
2123
+ },
2124
+ "expected gov account as only signer for proposal message": {
2125
+ message: "expected gov account as only signer for proposal message",
2126
+ code: ChainGovErrorCodes.ErrInvalidSigner,
2127
+ module: TransactionChainErrorModule.Gov
2128
+ },
2129
+ "signal message is invalid": {
2130
+ message: "signal message is invalid",
2131
+ code: ChainGovErrorCodes.ErrInvalidSignalMsg,
2132
+ module: TransactionChainErrorModule.Gov
2133
+ },
2134
+ "metadata too long": {
2135
+ message: "metadata too long",
2136
+ code: ChainGovErrorCodes.ErrMetadataTooLong,
2137
+ module: TransactionChainErrorModule.Gov
2138
+ },
2139
+ "minimum deposit is too small": {
2140
+ message: "minimum deposit is too small",
2141
+ code: ChainGovErrorCodes.ErrMinDepositTooSmall,
2142
+ module: TransactionChainErrorModule.Gov
2143
+ },
2144
+ "proposal is not found": {
2145
+ message: "proposal is not found",
2146
+ code: ChainGovErrorCodes.ErrProposalNotFound,
2147
+ module: TransactionChainErrorModule.Gov
2148
+ },
2149
+ "invalid proposer": {
2150
+ message: "invalid proposer",
2151
+ code: ChainGovErrorCodes.ErrInvalidProposer,
2152
+ module: TransactionChainErrorModule.Gov
2153
+ },
2154
+ "no deposits found": {
2155
+ message: "no deposits found",
2156
+ code: ChainGovErrorCodes.ErrNoDeposits,
2157
+ module: TransactionChainErrorModule.Gov
2158
+ },
2159
+ "voting period already ended": {
2160
+ message: "voting period already ended",
2161
+ code: ChainGovErrorCodes.ErrVotingPeriodEnded,
2162
+ module: TransactionChainErrorModule.Gov
2163
+ },
2164
+ "invalid proposal": {
2165
+ message: "invalid proposal",
2166
+ code: ChainGovErrorCodes.ErrInvalidProposal,
2167
+ module: TransactionChainErrorModule.Gov
2168
+ },
2169
+ "no inputs to send transaction": {
2170
+ message: "no inputs to send transaction",
2171
+ code: ChainBankErrorCodes.ErrNoInputs,
2172
+ module: TransactionChainErrorModule.Bank
2173
+ },
2174
+ "no outputs to send transaction": {
2175
+ message: "no outputs to send transaction",
2176
+ code: ChainBankErrorCodes.ErrNoOutputs,
2177
+ module: TransactionChainErrorModule.Bank
2178
+ },
2179
+ "sum inputs != sum outputs": {
2180
+ message: "sum inputs != sum outputs",
2181
+ code: ChainBankErrorCodes.ErrInputOutputMismatch,
2182
+ module: TransactionChainErrorModule.Bank
2183
+ },
2184
+ "send transactions are disabled": {
2185
+ message: "send transactions are disabled",
2186
+ code: ChainBankErrorCodes.ErrSendDisabled,
2187
+ module: TransactionChainErrorModule.Bank
2188
+ },
2189
+ "client denom metadata not found": {
2190
+ message: "client denom metadata not found",
2191
+ code: ChainBankErrorCodes.ErrDenomMetadataNotFound,
2192
+ module: TransactionChainErrorModule.Bank
2193
+ },
2194
+ "invalid key": {
2195
+ message: "invalid key",
2196
+ code: ChainBankErrorCodes.ErrInvalidKey,
2197
+ module: TransactionChainErrorModule.Bank
2198
+ },
2199
+ "duplicate entry": {
2200
+ message: "duplicate entry",
2201
+ code: ChainBankErrorCodes.ErrDuplicateEntry,
2202
+ module: TransactionChainErrorModule.Bank
2203
+ },
2204
+ "multiple senders not allowed": {
2205
+ message: "multiple senders not allowed",
2206
+ code: ChainBankErrorCodes.ErrMultipleSenders,
2207
+ module: TransactionChainErrorModule.Bank
2208
+ },
2209
+ "create wasm contract failed": {
2210
+ code: ChainWasmErrorCodes.ErrCreateFailed,
2211
+ message: "create wasm contract failed",
2212
+ module: TransactionChainErrorModule.Wasm
2213
+ },
2214
+ "contract account already exists": {
2215
+ code: ChainWasmErrorCodes.ErrAccountExists,
2216
+ message: "contract account already exists",
2217
+ module: TransactionChainErrorModule.Wasm
2218
+ },
2219
+ "instantiate wasm contract failed": {
2220
+ code: ChainWasmErrorCodes.ErrInstantiateFailed,
2221
+ message: "instantiate wasm contract failed",
2222
+ module: TransactionChainErrorModule.Wasm
2223
+ },
2224
+ "execute wasm contract failed": {
2225
+ code: ChainWasmErrorCodes.ErrExecuteFailed,
2226
+ message: "Contract execution failed",
2227
+ module: TransactionChainErrorModule.Wasm
2228
+ },
2229
+ "insufficient gas": {
2230
+ code: ChainWasmErrorCodes.ErrGasLimit,
2231
+ message: "insufficient gas",
2232
+ module: TransactionChainErrorModule.Wasm
2233
+ },
2234
+ "invalid genesis": {
2235
+ code: ChainWasmErrorCodes.ErrInvalidGenesis,
2236
+ message: "invalid genesis",
2237
+ module: TransactionChainErrorModule.Wasm
2238
+ },
2239
+ "query wasm contract failed": {
2240
+ code: ChainWasmErrorCodes.ErrQueryFailed,
2241
+ message: "query wasm contract failed",
2242
+ module: TransactionChainErrorModule.Wasm
2243
+ },
2244
+ "invalid CosmosMsg from the contract": {
2245
+ code: ChainWasmErrorCodes.ErrInvalidMsg,
2246
+ message: "invalid CosmosMsg from the contract",
2247
+ module: TransactionChainErrorModule.Wasm
2248
+ },
2249
+ "migrate wasm contract failed": {
2250
+ code: ChainWasmErrorCodes.ErrMigrationFailed,
2251
+ message: "migrate wasm contract failed",
2252
+ module: TransactionChainErrorModule.Wasm
2253
+ },
2254
+ empty: {
2255
+ code: ChainWasmErrorCodes.ErrEmpty,
2256
+ message: "empty",
2257
+ module: TransactionChainErrorModule.Wasm
2258
+ },
2259
+ "exceeds limit": {
2260
+ code: ChainWasmErrorCodes.ErrLimit,
2261
+ message: "exceeds limit",
2262
+ module: TransactionChainErrorModule.Wasm
2263
+ },
2264
+ invalid: {
2265
+ code: ChainWasmErrorCodes.ErrInvalid,
2266
+ message: "invalid",
2267
+ module: TransactionChainErrorModule.Wasm
2268
+ },
2269
+ duplicate: {
2270
+ code: ChainWasmErrorCodes.ErrDuplicate,
2271
+ message: "duplicate",
2272
+ module: TransactionChainErrorModule.Wasm
2273
+ },
2274
+ "max transfer channels": {
2275
+ code: ChainWasmErrorCodes.ErrMaxIBCChannels,
2276
+ message: "max transfer channels",
2277
+ module: TransactionChainErrorModule.Wasm
2278
+ },
2279
+ "unsupported for this contract": {
2280
+ code: ChainWasmErrorCodes.ErrUnsupportedForContract,
2281
+ message: "unsupported for this contract",
2282
+ module: TransactionChainErrorModule.Wasm
2283
+ },
2284
+ "pinning contract failed": {
2285
+ code: ChainWasmErrorCodes.ErrPinContractFailed,
2286
+ message: "pinning contract failed",
2287
+ module: TransactionChainErrorModule.Wasm
2288
+ },
2289
+ "unpinning contract failed": {
2290
+ code: ChainWasmErrorCodes.ErrUnpinContractFailed,
2291
+ message: "unpinning contract failed",
2292
+ module: TransactionChainErrorModule.Wasm
2293
+ },
2294
+ "unknown message from the contract": {
2295
+ code: ChainWasmErrorCodes.ErrUnknownMsg,
2296
+ message: "unknown message from the contract",
2297
+ module: TransactionChainErrorModule.Wasm
2298
+ },
2299
+ "invalid event": {
2300
+ code: ChainWasmErrorCodes.ErrInvalidEvent,
2301
+ message: "invalid event",
2302
+ module: TransactionChainErrorModule.Wasm
2303
+ },
2304
+ "authorization not found": {
2305
+ code: ChainAuthZErrorCodes.ErrNoAuthorizationFound,
2306
+ message: "Authorization not found",
2307
+ module: TransactionChainErrorModule.Wasm
2308
+ },
2309
+ "expiration time of authorization": {
2310
+ code: ChainAuthZErrorCodes.ErrAuthorizationExpired,
2311
+ message: "Authorization expired",
2312
+ module: TransactionChainErrorModule.Wasm
2313
+ },
2314
+ "not found": {
2315
+ message: "not found",
2316
+ code: ChainCosmosErrorCode.ErrNotFound,
2317
+ module: TransactionChainErrorModule.CosmosSdk
2318
+ },
2319
+ "failed to fetch account num/seq": {
2320
+ message: "Address is not yet active on the chain as it has a $0 balance. To activate it, please send a small amount of funds. Once funded, the network will recognize the address, allowing you to proceed.",
2321
+ code: ChainCosmosErrorCode.ErrKeyNotFound,
2322
+ module: TransactionChainErrorModule.CosmosSdk
2323
+ }
2324
+ };
2325
+
2326
+ //#endregion
2327
+ //#region src/exceptions/utils/maps.ts
2328
+ const parseErrorMessage = (message) => {
2329
+ const firstParse = message.split("message index: 0:");
2330
+ if (firstParse.length === 1) {
2331
+ const [firstParseString$1] = firstParse;
2332
+ const [secondParseString] = firstParseString$1.split(": invalid request");
2333
+ return secondParseString.trim().trimEnd();
2334
+ }
2335
+ const [, firstParseString] = firstParse;
2336
+ const [actualMessage] = firstParseString.split(": invalid request");
2337
+ return actualMessage.trim().trimEnd();
2338
+ };
2339
+ const mapFailedTransactionMessageFromString = (message) => {
2340
+ const parsedMessage = parseErrorMessage(message);
2341
+ const messageInMapKey = Object.keys(chainErrorMessagesMap).find((key) => parsedMessage.toLowerCase().includes(key.toLowerCase()));
2342
+ if (!messageInMapKey) return {
2343
+ message: parsedMessage,
2344
+ code: UnspecifiedErrorCode,
2345
+ module: void 0
2346
+ };
2347
+ return chainErrorMessagesMap[messageInMapKey];
2348
+ };
2349
+ const mapFailedTransactionMessage = (message, context) => {
2350
+ const getWasmErrorFromMessage = (message$1) => {
2351
+ if (!message$1.includes("execute wasm contract failed")) return;
2352
+ const reason$1 = /(.*?)execute wasm contract failed(.*?)/g.exec(message$1);
2353
+ if (!reason$1) return;
2354
+ if (reason$1.length < 2) return;
2355
+ return reason$1[1].replace("failed to execute message; message index: 0: ", "");
2356
+ };
2357
+ const getABCICode = (message$1) => {
2358
+ const ABCICode$1 = /{key:"ABCICode"[ \t]+value:"(.*?)"}/g.exec(message$1);
2359
+ if (!ABCICode$1 || ABCICode$1.length < 2) return;
2360
+ return Number(ABCICode$1[1]);
2361
+ };
2362
+ const getContextModule = (message$1) => {
2363
+ const codespace = /{key:"Codespace"[ \t]+value:"(.*?)"}/g.exec(message$1);
2364
+ if (!codespace || codespace.length < 2) return;
2365
+ return codespace[1];
2366
+ };
2367
+ const getReason = (message$1) => {
2368
+ const codespace = /\[reason:"(.*?)"/g.exec(message$1);
2369
+ if (!codespace || codespace.length < 2) {
2370
+ if (message$1.includes("execute wasm contract failed")) return getWasmErrorFromMessage(message$1);
2371
+ return;
2372
+ }
2373
+ const reason$1 = codespace[1];
2374
+ if (reason$1 === "execute wasm contract failed") {
2375
+ const subReason = /(.*?)Generic error:(.*?): execute wasm/g.exec(message$1);
2376
+ if (!subReason) return reason$1;
2377
+ return subReason[2] || reason$1;
2378
+ }
2379
+ return reason$1;
2380
+ };
2381
+ const ABCICode = context && context.code ? context.code : getABCICode(message);
2382
+ const contextModule = (context === null || context === void 0 ? void 0 : context.contextModule) || getContextModule(message);
2383
+ const reason = getReason(message);
2384
+ if (!ABCICode || !contextModule) {
2385
+ const failedTxMap = mapFailedTransactionMessageFromString(message);
2386
+ return {
2387
+ ...failedTxMap,
2388
+ contextModule: failedTxMap.module || contextModule,
2389
+ message: reason || failedTxMap.message
2390
+ };
2391
+ }
2392
+ const codespaceErrorMessages = chainModuleCodeErrorMessagesMap[contextModule];
2393
+ if (!codespaceErrorMessages) return {
2394
+ message: reason || message,
2395
+ code: ABCICode,
2396
+ contextModule
2397
+ };
2398
+ return {
2399
+ message: codespaceErrorMessages[ABCICode] || reason || message,
2400
+ code: ABCICode,
2401
+ contextModule
2402
+ };
2403
+ };
2404
+ const mapErrorMessage = (message) => {
2405
+ const parsedMessage = message.trim().toLowerCase();
2406
+ if (parsedMessage.includes("User denied message signature".toLowerCase())) return "The request has been rejected";
2407
+ if (parsedMessage.toLowerCase().includes("user denied".toLowerCase())) return "The request has been rejected";
2408
+ if (parsedMessage.toLowerCase().includes("provided chain".toLowerCase())) return "Your selected network is incorrect";
2409
+ if (parsedMessage.toLowerCase().includes("Keyring Controller signTypedMessage".toLowerCase())) return "Please ensure your Ledger is connected, unlocked and your Ethereum app is open.";
2410
+ return message.replaceAll("Keyring Controller signTypedMessage:", "");
2411
+ };
2412
+
2413
+ //#endregion
2414
+ //#region src/exceptions/exceptions/BitGetException.ts
2415
+ const removeBitGetFromErrorString = (message) => message.replaceAll("BitGet", "").replaceAll("Bitget:", "").replaceAll("Bitkeep:", "");
2416
+ var BitGetException = class BitGetException extends ConcreteException {
2417
+ constructor(error, context) {
2418
+ super(error, context);
2419
+ this.type = ErrorType.WalletError;
2420
+ }
2421
+ parse() {
2422
+ const { message } = this;
2423
+ if (message.trim().toLowerCase().includes("missing or invalid parameters".toLowerCase())) this.setMessage("Please make sure you are using BitGet Wallet");
2424
+ else this.setMessage(mapErrorMessage(removeBitGetFromErrorString(message)));
2425
+ this.setName(BitGetException.errorClass);
2426
+ }
2427
+ };
2428
+ _defineProperty(BitGetException, "errorClass", "BitGetException");
2429
+
2430
+ //#endregion
2431
+ //#region src/exceptions/utils/helpers.ts
2432
+ const isCommonLockedError = (error) => {
2433
+ const commonMessages = [
2434
+ "Ledger device: Incorrect length",
2435
+ "Ledger device: INS_NOT_SUPPORTED",
2436
+ "Ledger device: CLA_NOT_SUPPORTED",
2437
+ "Unknown",
2438
+ "Ledger device",
2439
+ "CLA_NOT_SUPPORTED",
2440
+ "CLA",
2441
+ "Locked",
2442
+ "Failed to open the device",
2443
+ "Failed to open the device",
2444
+ "Ledger Device is busy",
2445
+ "Ledger device",
2446
+ "UNKNOWN_ERROR"
2447
+ ];
2448
+ return commonMessages.some((m) => m.includes(error)) || commonMessages.some((m) => error.toLowerCase().includes(m)) || commonMessages.some((m) => m.toLowerCase().includes(error.toLowerCase()));
2449
+ };
2450
+
2451
+ //#endregion
2452
+ //#region src/exceptions/exceptions/LedgerException.ts
2453
+ var LedgerException = class LedgerException extends ConcreteException {
2454
+ constructor(error, context) {
2455
+ super(error, context);
2456
+ this.type = ErrorType.WalletError;
2457
+ }
2458
+ parse() {
2459
+ const { message } = this;
2460
+ if (isCommonLockedError(message)) this.setMessage("Please ensure your Ledger is connected, unlocked and your Ethereum app is open.");
2461
+ if (message.includes("No device selected.")) this.setMessage("Please make sure your Ledger device is connected, unlocked and your Ethereum app is open");
2462
+ if (message.includes("Unable to set device configuration.")) this.setMessage("Please restart your Ledger device and try connecting again");
2463
+ if (message.includes("Cannot read properties of undefined")) this.setMessage("Please make sure your Ledger device is connected");
2464
+ if (message.toLowerCase().includes("locked")) this.setMessage("Please make sure your Ledger device is connected, unlocked and your Ethereum app is open");
2465
+ if (message.includes("Condition of use not satisfied") || message.includes("0x6985")) this.setMessage("The request has been rejected");
2466
+ if (message.includes("U2F browser support is needed for Ledger.")) this.setMessage("Please use the latest Chrome/Firefox browser versions to connect with your Ledger device");
2467
+ this.setName(LedgerException.errorClass);
2468
+ }
2469
+ };
2470
+ _defineProperty(LedgerException, "errorClass", "LedgerException");
2471
+
2472
+ //#endregion
2473
+ //#region src/exceptions/exceptions/TrezorException.ts
2474
+ var TrezorException = class TrezorException extends ConcreteException {
2475
+ constructor(error, context) {
2476
+ super(error, context);
2477
+ this.type = ErrorType.WalletError;
2478
+ }
2479
+ parse() {
2480
+ this.setName(TrezorException.errorClass);
2481
+ }
2482
+ };
2483
+ _defineProperty(TrezorException, "errorClass", "TrezorException");
2484
+
2485
+ //#endregion
2486
+ //#region src/exceptions/exceptions/WalletException.ts
2487
+ var WalletException = class WalletException extends ConcreteException {
2488
+ parse() {
2489
+ this.setName(WalletException.errorClass);
2490
+ }
2491
+ };
2492
+ _defineProperty(WalletException, "errorClass", "WalletException");
2493
+
2494
+ //#endregion
2495
+ //#region src/exceptions/exceptions/GeneralException.ts
2496
+ var GeneralException = class GeneralException extends ConcreteException {
2497
+ parse() {
2498
+ this.setName(GeneralException.errorClass);
2499
+ }
2500
+ };
2501
+ _defineProperty(GeneralException, "errorClass", "GeneralException");
2502
+
2503
+ //#endregion
2504
+ //#region src/exceptions/exceptions/MetamaskException.ts
2505
+ const removeMetamaskFromErrorString$1 = (message) => message.replaceAll("Metamask", "").replaceAll("MetaMask", "").replaceAll("Metamask:", "");
2506
+ var MetamaskException = class MetamaskException extends ConcreteException {
2507
+ constructor(error, context) {
2508
+ super(error, context);
2509
+ this.type = ErrorType.WalletError;
2510
+ }
2511
+ parse() {
2512
+ const { message } = this;
2513
+ if (message.trim().toLowerCase().includes("missing or invalid parameters".toLowerCase())) this.setMessage("Please make sure you are using Metamask Wallet");
2514
+ else this.setMessage(mapErrorMessage(removeMetamaskFromErrorString$1(message)));
2515
+ this.setName(MetamaskException.errorClass);
2516
+ }
2517
+ };
2518
+ _defineProperty(MetamaskException, "errorClass", "MetamaskException");
2519
+
2520
+ //#endregion
2521
+ //#region src/exceptions/exceptions/KeplrEvmException.ts
2522
+ const removeKeplrFromErrorString = (message) => message.replaceAll("Keplr", "").replaceAll("Keplr", "").replaceAll("Keplr:", "");
2523
+ var KeplrEvmException = class KeplrEvmException extends ConcreteException {
2524
+ constructor(error, context) {
2525
+ super(error, context);
2526
+ this.type = ErrorType.WalletError;
2527
+ }
2528
+ parse() {
2529
+ const { message } = this;
2530
+ if (message.trim().toLowerCase().includes("missing or invalid parameters".toLowerCase())) this.setMessage("Please make sure you are using Keplr Wallet");
2531
+ else this.setMessage(mapErrorMessage(removeKeplrFromErrorString(message)));
2532
+ this.setName(KeplrEvmException.errorClass);
2533
+ }
2534
+ };
2535
+ _defineProperty(KeplrEvmException, "errorClass", "KeplrException");
2536
+
2537
+ //#endregion
2538
+ //#region src/exceptions/exceptions/OkxWalletException.ts
2539
+ const removeOkxWalletFromErrorString = (message) => message.replaceAll("OkxWallet", "").replaceAll("OkxWallet:", "").replaceAll("Okx", "");
2540
+ var OkxWalletException = class OkxWalletException extends ConcreteException {
2541
+ constructor(error, context) {
2542
+ super(error, context);
2543
+ this.type = ErrorType.WalletError;
2544
+ }
2545
+ parse() {
2546
+ const { message } = this;
2547
+ if (message.trim().toLowerCase().includes("missing or invalid parameters".toLowerCase())) this.setMessage("Please make sure you are using Okx Wallet");
2548
+ else this.setMessage(mapErrorMessage(removeOkxWalletFromErrorString(message)));
2549
+ this.setName(OkxWalletException.errorClass);
2550
+ }
2551
+ };
2552
+ _defineProperty(OkxWalletException, "errorClass", "OkxWalletException");
2553
+
2554
+ //#endregion
2555
+ //#region src/exceptions/exceptions/HttpRequestException.ts
2556
+ var HttpRequestException = class HttpRequestException extends ConcreteException {
2557
+ constructor(error, context) {
2558
+ super(error, context);
2559
+ _defineProperty(this, "method", HttpRequestMethod.Get);
2560
+ this.type = ErrorType.HttpRequest;
2561
+ this.method = context ? context.method || HttpRequestMethod.Get : HttpRequestMethod.Get;
2562
+ this.context = (context === null || context === void 0 ? void 0 : context.context) || "Unknown";
2563
+ }
2564
+ parse() {
2565
+ this.setName(HttpRequestException.errorClass);
2566
+ }
2567
+ };
2568
+ _defineProperty(HttpRequestException, "errorClass", "HttpRequestException");
2569
+
2570
+ //#endregion
2571
+ //#region src/exceptions/exceptions/TransactionException.ts
2572
+ var TransactionException = class TransactionException extends ConcreteException {
2573
+ constructor(error, context) {
2574
+ super(error, context);
2575
+ this.type = ErrorType.ChainError;
2576
+ }
2577
+ parse() {
2578
+ const { message, context, contextModule, contextCode } = this;
2579
+ if (this.skipParsing) {
2580
+ this.setContext(context || "Unknown");
2581
+ this.setMessage(message);
2582
+ this.setOriginalMessage(message);
2583
+ this.setName(TransactionException.errorClass);
2584
+ return;
2585
+ }
2586
+ const { code, message: parsedMessage, contextModule: parsedContextModule } = mapFailedTransactionMessage(message, {
2587
+ contextCode,
2588
+ contextModule
2589
+ });
2590
+ this.setContext(context || "Unknown");
2591
+ this.setMessage(parsedMessage);
2592
+ this.setContextCode(code);
2593
+ this.setOriginalMessage(parseErrorMessage(message));
2594
+ if (parsedContextModule) this.setContextModule(parsedContextModule);
2595
+ this.setName(TransactionException.errorClass);
2596
+ }
2597
+ };
2598
+ _defineProperty(TransactionException, "errorClass", "TransactionException");
2599
+
2600
+ //#endregion
2601
+ //#region src/exceptions/exceptions/TrustWalletException.ts
2602
+ const removeTrustWalletFromErrorString = (message) => message.replaceAll("Trust Wallet", "").replaceAll("TrustWallet", "").replaceAll("Trustwallet", "").replaceAll("TrustWallet:", "").replaceAll("Trust Wallet:", "");
2603
+ var TrustWalletException = class TrustWalletException extends ConcreteException {
2604
+ constructor(error, context) {
2605
+ super(error, context);
2606
+ this.type = ErrorType.WalletError;
2607
+ }
2608
+ parse() {
2609
+ const { message } = this;
2610
+ if (message.trim().toLowerCase().includes("missing or invalid parameters".toLowerCase())) this.setMessage("Please make sure you are using TrustWallet");
2611
+ else this.setMessage(mapErrorMessage(removeTrustWalletFromErrorString(message)));
2612
+ this.setName(TrustWalletException.errorClass);
2613
+ }
2614
+ };
2615
+ _defineProperty(TrustWalletException, "errorClass", "TrustWalletException");
2616
+
2617
+ //#endregion
2618
+ //#region src/exceptions/exceptions/CosmosWalletException.ts
2619
+ var CosmosWalletException = class CosmosWalletException extends ConcreteException {
2620
+ constructor(error, context) {
2621
+ super(error, context);
2622
+ this.type = ErrorType.WalletError;
2623
+ }
2624
+ parse() {
2625
+ this.setName(CosmosWalletException.errorClass);
2626
+ }
2627
+ };
2628
+ _defineProperty(CosmosWalletException, "errorClass", "CosmosWalletException");
2629
+
2630
+ //#endregion
2631
+ //#region src/exceptions/exceptions/LedgerCosmosException.ts
2632
+ var LedgerCosmosException = class LedgerCosmosException extends ConcreteException {
2633
+ constructor(error, context) {
2634
+ super(error, context);
2635
+ this.type = ErrorType.WalletError;
2636
+ }
2637
+ parse() {
2638
+ const { message } = this;
2639
+ if (isCommonLockedError(message)) this.setMessage("Please ensure your Ledger is connected, unlocked and your Cosmos app is open.");
2640
+ if (message.includes("No device selected.")) this.setMessage("Please make sure your Ledger device is connected, unlocked and your Cosmos app is open");
2641
+ if (message.includes("Unable to set device configuration.")) this.setMessage("Please restart your Ledger device and try connecting again");
2642
+ if (message.includes("Cannot read properties of undefined")) this.setMessage("Please make sure your Ledger device is connected");
2643
+ if (message.toLowerCase().includes("locked")) this.setMessage("Please make sure your Ledger device is connected, unlocked and your Cosmos app is open");
2644
+ if (message.includes("Condition of use not satisfied") || message.includes("0x6985")) this.setMessage("The request has been rejected");
2645
+ if (message.includes("U2F browser support is needed for Ledger.")) this.setMessage("Please use the latest Chrome/Firefox browser versions to connect with your Ledger device");
2646
+ this.setName(LedgerCosmosException.errorClass);
2647
+ }
2648
+ };
2649
+ _defineProperty(LedgerCosmosException, "errorClass", "LedgerCosmosException");
2650
+
2651
+ //#endregion
2652
+ //#region src/exceptions/exceptions/RainbowWalletException.ts
2653
+ const removeMetamaskFromErrorString = (message) => message.replaceAll("Rainbow", "").replaceAll("RainBow", "").replaceAll("Rainbow:", "");
2654
+ var RainbowWalletException = class RainbowWalletException extends ConcreteException {
2655
+ constructor(error, context) {
2656
+ super(error, context);
2657
+ this.type = ErrorType.WalletError;
2658
+ }
2659
+ parse() {
2660
+ const { message } = this;
2661
+ if (message.trim().toLowerCase().includes("missing or invalid parameters".toLowerCase())) this.setMessage("Please make sure you are using Rainbow Wallet");
2662
+ else this.setMessage(mapErrorMessage(removeMetamaskFromErrorString(message)));
2663
+ this.setName(RainbowWalletException.errorClass);
2664
+ }
2665
+ };
2666
+ _defineProperty(RainbowWalletException, "errorClass", "RainbowWalletException");
2667
+
2668
+ //#endregion
2669
+ //#region src/exceptions/exceptions/WalletConnectException.ts
2670
+ const removeWalletConnectFromErrorString = (message) => message.replaceAll("WalletConnect", "").replaceAll("WalletConnect", "").replaceAll("WalletConnect:", "");
2671
+ var WalletConnectException = class WalletConnectException extends ConcreteException {
2672
+ constructor(error, context) {
2673
+ super(error, context);
2674
+ this.type = ErrorType.WalletError;
2675
+ }
2676
+ parse() {
2677
+ const { message } = this;
2678
+ if (message.trim().toLowerCase().includes("missing or invalid parameters".toLowerCase())) this.setMessage("Please make sure you are using WalletConnect");
2679
+ else this.setMessage(mapErrorMessage(removeWalletConnectFromErrorString(message)));
2680
+ this.setName(WalletConnectException.errorClass);
2681
+ }
2682
+ };
2683
+ _defineProperty(WalletConnectException, "errorClass", "WalletConnectException");
2684
+
2685
+ //#endregion
2686
+ //#region src/exceptions/exceptions/GrpcUnaryRequestException.ts
2687
+ var GrpcUnaryRequestException = class GrpcUnaryRequestException extends ConcreteException {
2688
+ constructor(error, context) {
2689
+ super(error, context);
2690
+ this.type = ErrorType.GrpcUnaryRequest;
2691
+ }
2692
+ parse() {
2693
+ const { message } = this;
2694
+ if (message.toLowerCase().includes("response closed without headers")) {
2695
+ this.setMessage("The request has failed. The server has closed the connection without sending any headers.");
2696
+ this.setContextCode(GRPC_REQUEST_FAILED);
2697
+ }
2698
+ this.setName(GrpcUnaryRequestException.errorClass);
2699
+ }
2700
+ };
2701
+ _defineProperty(GrpcUnaryRequestException, "errorClass", "GrpcUnaryRequestException");
2702
+
2703
+ //#endregion
2704
+ //#region src/exceptions/exceptions/TurnkeyWalletSessionException.ts
2705
+ var TurnkeyWalletSessionException = class TurnkeyWalletSessionException extends ConcreteException {
2706
+ parse() {
2707
+ this.setName(TurnkeyWalletSessionException.errorClass);
2708
+ }
2709
+ };
2710
+ _defineProperty(TurnkeyWalletSessionException, "errorClass", "TurnkeyWalletSessionException");
2711
+
2712
+ //#endregion
2713
+ exports.BitGetException = BitGetException;
2714
+ exports.ChainAuctionErrorCodes = ChainAuctionErrorCodes;
2715
+ exports.ChainAuthZErrorCodes = ChainAuthZErrorCodes;
2716
+ exports.ChainBankErrorCodes = ChainBankErrorCodes;
2717
+ exports.ChainCosmosErrorCode = ChainCosmosErrorCode;
2718
+ exports.ChainDistributionErrorCodes = ChainDistributionErrorCodes;
2719
+ exports.ChainErrorModule = ChainErrorModule;
2720
+ exports.ChainExchangeModuleErrorCode = ChainExchangeModuleErrorCode;
2721
+ exports.ChainGovErrorCodes = ChainGovErrorCodes;
2722
+ exports.ChainInsuranceErrorCodes = ChainInsuranceErrorCodes;
2723
+ exports.ChainOcrErrorCodes = ChainOcrErrorCodes;
2724
+ exports.ChainOracleErrorCodes = ChainOracleErrorCodes;
2725
+ exports.ChainPeggyErrorCodes = ChainPeggyErrorCodes;
2726
+ exports.ChainStakingErrorCodes = ChainStakingErrorCodes;
2727
+ exports.ChainTokenFactoryErrorCodes = ChainTokenFactoryErrorCodes;
2728
+ exports.ChainWasmErrorCodes = ChainWasmErrorCodes;
2729
+ exports.ChainWasmXErrorCodes = ChainWasmXErrorCodes;
2730
+ exports.ContractErrorModule = ContractErrorModule;
2731
+ exports.CosmosWalletException = CosmosWalletException;
2732
+ exports.ErrorType = ErrorType;
2733
+ exports.GRPC_REQUEST_FAILED = GRPC_REQUEST_FAILED;
2734
+ exports.GeneralException = GeneralException;
2735
+ exports.GrpcErrorCode = GrpcErrorCode;
2736
+ exports.GrpcUnaryRequestException = GrpcUnaryRequestException;
2737
+ exports.HttpRequestException = HttpRequestException;
2738
+ exports.HttpRequestMethod = HttpRequestMethod;
2739
+ exports.IndexerErrorModule = IndexerErrorModule;
2740
+ exports.KeplrEvmException = KeplrEvmException;
2741
+ exports.LedgerCosmosException = LedgerCosmosException;
2742
+ exports.LedgerException = LedgerException;
2743
+ exports.MetamaskException = MetamaskException;
2744
+ exports.OkxWalletException = OkxWalletException;
2745
+ exports.RainbowWalletException = RainbowWalletException;
2746
+ exports.THROWN_EXCEPTIONS = THROWN_EXCEPTIONS;
2747
+ exports.TransactionChainErrorModule = TransactionChainErrorModule;
2748
+ exports.TransactionException = TransactionException;
2749
+ exports.TrezorException = TrezorException;
2750
+ exports.TrustWalletException = TrustWalletException;
2751
+ exports.TurnkeyWalletSessionException = TurnkeyWalletSessionException;
2752
+ exports.UnspecifiedErrorCode = UnspecifiedErrorCode;
2753
+ exports.WalletConnectException = WalletConnectException;
2754
+ exports.WalletErrorActionModule = WalletErrorActionModule;
2755
+ exports.WalletException = WalletException;
2756
+ exports.Web3Exception = Web3Exception;
2757
+ exports.formatNotificationDescription = formatNotificationDescription;
2758
+ exports.grpcErrorCodeToErrorCode = grpcErrorCodeToErrorCode;
2759
+ exports.isThrownException = isThrownException;