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