@injectivelabs/sdk-ts 1.17.2-alpha.8 → 1.17.2

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 (116) hide show
  1. package/dist/cjs/{AbacusGrpcApi-vcp-9fNL.cjs → AbacusGrpcApi-DXSuhb6R.cjs} +1 -1
  2. package/dist/cjs/{BaseGrpcConsumer-DUwCngI6.cjs → BaseGrpcConsumer-EtEQfhmo.cjs} +47 -6
  3. package/dist/{esm/BaseGrpcConsumer-BbvNzhrS.d.ts → cjs/BaseGrpcConsumer-Vvj4lzyS.d.cts} +14 -2
  4. package/dist/cjs/{BaseIndexerGrpcConsumer-BGLVnJtw.cjs → BaseIndexerGrpcConsumer-CW1kTn-_.cjs} +1 -1
  5. package/dist/cjs/{ChainGrpcExchangeApi-VVmtAGW5.cjs → ChainGrpcExchangeApi-CF9ATYqN.cjs} +3 -3
  6. package/dist/cjs/{ChainRestTendermintApi-CW49Mtmx.cjs → ChainRestTendermintApi-vL0g-BF-.cjs} +2 -2
  7. package/dist/cjs/{DirectEthSecp256k1Wallet-Chd5kOwo.cjs → DirectEthSecp256k1Wallet-CIdxvYjL.cjs} +2 -2
  8. package/dist/cjs/{ExecArgNeptuneWithdraw-BqrKFTTp.cjs → ExecArgNeptuneWithdraw-C-NQ72VM.cjs} +6 -6
  9. package/dist/cjs/{IndexerGrpcWeb3GwApi-RL0sxzNw.cjs → IndexerGrpcWeb3GwApi-C7kkr4Il.cjs} +7 -7
  10. package/dist/cjs/{MsgBase-BJ1-Qh5c.cjs → MsgBase-DqOmzCyS.cjs} +1 -0
  11. package/dist/cjs/{MsgSetDenomMetadata-BzFtwh7v.cjs → MsgSetDenomMetadata-CKvxIq_t.cjs} +26 -15
  12. package/dist/cjs/{OLPGrpcApi-B9O9HcGv.cjs → OLPGrpcApi-BCCb6fBZ.cjs} +1 -1
  13. package/dist/cjs/{QueryTradingStrategyContractTotalStrategies-t-5fuyN_.cjs → QueryTradingStrategyContractTotalStrategies-Ayot_18R.cjs} +3 -3
  14. package/dist/cjs/{IndexerGrpcAccountPortfolioStream-CGaNa5R7.cjs → StreamManagerV2-igv0mn2I.cjs} +1375 -378
  15. package/dist/cjs/{accounts-DC6uKJZm.cjs → accounts-CHKUxDIf.cjs} +6 -6
  16. package/dist/{esm/any_pb-B1YYUSUf.d.ts → cjs/any_pb-CutLnOUR.d.cts} +2 -2
  17. package/dist/cjs/{chain-CdI97AzZ.cjs → chain-CGHrf7gg.cjs} +4 -4
  18. package/dist/cjs/client/abacus.cjs +2 -2
  19. package/dist/cjs/client/abacus.d.cts +2 -2
  20. package/dist/cjs/client/chain.cjs +5 -5
  21. package/dist/cjs/client/chain.d.cts +9 -9
  22. package/dist/cjs/client/indexer.cjs +74 -60
  23. package/dist/cjs/client/indexer.d.cts +10 -10
  24. package/dist/cjs/client/olp.cjs +3 -3
  25. package/dist/cjs/client/olp.d.cts +2 -2
  26. package/dist/cjs/client/wasm.cjs +8 -8
  27. package/dist/cjs/client/wasm.d.cts +2 -2
  28. package/dist/cjs/core/accounts.cjs +3 -3
  29. package/dist/cjs/core/accounts.d.cts +9 -9
  30. package/dist/cjs/core/modules.cjs +11 -11
  31. package/dist/cjs/core/modules.d.cts +9 -9
  32. package/dist/cjs/core/tx.cjs +8 -8
  33. package/dist/cjs/core/tx.d.cts +9 -9
  34. package/dist/cjs/cosmjs.cjs +9 -9
  35. package/dist/cjs/cosmjs.d.cts +3 -3
  36. package/dist/cjs/exports.cjs +9 -9
  37. package/dist/cjs/exports.d.cts +3 -3
  38. package/dist/cjs/{index-Cc5Q73-y.d.cts → index-CGvISJoE.d.cts} +1 -1
  39. package/dist/cjs/{index-CKBod1ba.d.cts → index-CO3Y9drx.d.cts} +4 -3
  40. package/dist/cjs/{index-Cc4mqAsR.d.cts → index-D6ubyMlR.d.cts} +1 -1
  41. package/dist/{esm/index-DdGVE3_u.d.ts → cjs/index-DWbxb1AB.d.cts} +7 -13
  42. package/dist/cjs/{index-9KV6P3U_.d.cts → index-DemZnO3c.d.cts} +986 -292
  43. package/dist/cjs/{index-Cqfc1ppG.d.cts → index-DjRtDAy5.d.cts} +241 -19
  44. package/dist/cjs/{index-B19YRG03.d.cts → index-lRWP4rKg.d.cts} +1 -1
  45. package/dist/cjs/index.cjs +96 -72
  46. package/dist/cjs/index.d.cts +10 -10
  47. package/dist/cjs/{service-Do5zpuEu.cjs → service-BCLvTVy_.cjs} +2 -2
  48. package/dist/cjs/service.cjs +3 -3
  49. package/dist/cjs/service.d.cts +4 -4
  50. package/dist/cjs/{tx-D51SCHxX.cjs → tx-VwbP3UdI.cjs} +6 -6
  51. package/dist/cjs/{tx_pb-tECSPcSB.d.cts → tx_pb-D-cNmrlO.d.cts} +4 -3
  52. package/dist/cjs/{types-NFV4P_J_.cjs → types-BTuy007B.cjs} +135 -7
  53. package/dist/cjs/types.cjs +7 -1
  54. package/dist/cjs/types.d.cts +4 -4
  55. package/dist/cjs/{utils-CaAHoOvO.cjs → utils-CDl812vv.cjs} +158 -88
  56. package/dist/cjs/utils.cjs +5 -1
  57. package/dist/cjs/utils.d.cts +10 -10
  58. package/dist/esm/{AbacusGrpcApi-CXaVHTrN.js → AbacusGrpcApi-Ce1hRKuD.js} +1 -1
  59. package/dist/{cjs/BaseGrpcConsumer-PDufF0fz.d.cts → esm/BaseGrpcConsumer-6x4RlZ16.d.ts} +14 -2
  60. package/dist/esm/{BaseGrpcConsumer-DptVGP0n.js → BaseGrpcConsumer-BTWyD665.js} +48 -7
  61. package/dist/esm/{BaseIndexerGrpcConsumer-CjpUoGXy.js → BaseIndexerGrpcConsumer-BTZzA_Eg.js} +1 -1
  62. package/dist/esm/{ChainGrpcExchangeApi-CDMDxAJf.js → ChainGrpcExchangeApi-DqdCst2Z.js} +3 -3
  63. package/dist/esm/{ChainRestTendermintApi-Cy7hYJYp.js → ChainRestTendermintApi-BT_yOkAV.js} +2 -2
  64. package/dist/esm/{DirectEthSecp256k1Wallet-VC6TDitT.js → DirectEthSecp256k1Wallet-BqxC1b40.js} +2 -2
  65. package/dist/esm/{ExecArgNeptuneWithdraw-yQxlQZWQ.js → ExecArgNeptuneWithdraw-uLf3HttI.js} +6 -6
  66. package/dist/esm/{IndexerGrpcWeb3GwApi-BngLjriD.js → IndexerGrpcWeb3GwApi-B2mgt9tE.js} +7 -7
  67. package/dist/esm/{MsgBase-aKq3ln6R.js → MsgBase-BkRgVbdY.js} +1 -0
  68. package/dist/esm/{MsgSetDenomMetadata-CTc1ec1M.js → MsgSetDenomMetadata-CXgkQ3LF.js} +26 -15
  69. package/dist/esm/{OLPGrpcApi-CMwW7LXZ.js → OLPGrpcApi-DUCfcca_.js} +1 -1
  70. package/dist/esm/{QueryTradingStrategyContractTotalStrategies-DnsH6JLf.js → QueryTradingStrategyContractTotalStrategies-CZWdw3BE.js} +3 -3
  71. package/dist/esm/{IndexerGrpcAccountPortfolioStream-BOLdMeVd.js → StreamManagerV2-B9xiJYLj.js} +1116 -203
  72. package/dist/esm/{accounts-DXee44Zk.js → accounts-C5HEaz0B.js} +6 -6
  73. package/dist/{cjs/any_pb-CP-3DVyl.d.cts → esm/any_pb-DBt7qvTr.d.ts} +2 -2
  74. package/dist/esm/{chain-BquCFi0h.js → chain-CHX5uSpc.js} +4 -4
  75. package/dist/esm/client/abacus.d.ts +2 -2
  76. package/dist/esm/client/abacus.js +2 -2
  77. package/dist/esm/client/chain.d.ts +9 -9
  78. package/dist/esm/client/chain.js +5 -5
  79. package/dist/esm/client/indexer.d.ts +10 -10
  80. package/dist/esm/client/indexer.js +7 -7
  81. package/dist/esm/client/olp.d.ts +2 -2
  82. package/dist/esm/client/olp.js +3 -3
  83. package/dist/esm/client/wasm.d.ts +2 -2
  84. package/dist/esm/client/wasm.js +8 -8
  85. package/dist/esm/core/accounts.d.ts +9 -9
  86. package/dist/esm/core/accounts.js +3 -3
  87. package/dist/esm/core/modules.d.ts +9 -9
  88. package/dist/esm/core/modules.js +11 -11
  89. package/dist/esm/core/tx.d.ts +9 -9
  90. package/dist/esm/core/tx.js +8 -8
  91. package/dist/esm/cosmjs.d.ts +3 -3
  92. package/dist/esm/cosmjs.js +9 -9
  93. package/dist/esm/exports.d.ts +3 -3
  94. package/dist/esm/exports.js +9 -9
  95. package/dist/esm/{index-BOKuUpVZ.d.ts → index--sg5xbEP.d.ts} +1 -1
  96. package/dist/esm/{index-B1R417vW.d.ts → index-B-SD0p02.d.ts} +241 -19
  97. package/dist/esm/{index-qFCOVI7n.d.ts → index-BJQt8IpY.d.ts} +1 -1
  98. package/dist/esm/{index-DS6aJrL5.d.ts → index-C_3bL-y4.d.ts} +1 -1
  99. package/dist/esm/{index-CIU3qLo9.d.ts → index-Ch477yfL.d.ts} +1001 -307
  100. package/dist/esm/{index-aNMYd-s0.d.ts → index-DOyiZiUK.d.ts} +4 -3
  101. package/dist/{cjs/index-D4uWOVE5.d.cts → esm/index-Dn4OxoMy.d.ts} +7 -13
  102. package/dist/esm/index.d.ts +10 -10
  103. package/dist/esm/index.js +19 -19
  104. package/dist/esm/{service-DYSaTvVz.js → service-CnqMmybI.js} +2 -2
  105. package/dist/esm/service.d.ts +4 -4
  106. package/dist/esm/service.js +3 -3
  107. package/dist/esm/{tx-B9VusHOP.js → tx-DsGG15fH.js} +6 -6
  108. package/dist/esm/{tx_pb-TiSRD5ay.d.ts → tx_pb-zz4o4hHG.d.ts} +4 -3
  109. package/dist/esm/types-68OuBiEQ.js +162 -0
  110. package/dist/esm/types.d.ts +4 -4
  111. package/dist/esm/types.js +2 -2
  112. package/dist/esm/{utils-DlnuXIe8.js → utils-BFBu_LnJ.js} +135 -89
  113. package/dist/esm/utils.d.ts +10 -10
  114. package/dist/esm/utils.js +2 -2
  115. package/package.json +11 -13
  116. package/dist/esm/types-Cq0sRR6y.js +0 -70
@@ -8,6 +8,132 @@ let __noble_hashes_legacy = require("@noble/hashes/legacy");
8
8
  let __injectivelabs_core_proto_ts_v2_generated_cosmos_base_query_v1beta1_pagination_pb = require("@injectivelabs/core-proto-ts-v2/generated/cosmos/base/query/v1beta1/pagination_pb");
9
9
  __injectivelabs_core_proto_ts_v2_generated_cosmos_base_query_v1beta1_pagination_pb = require_chunk.__toESM(__injectivelabs_core_proto_ts_v2_generated_cosmos_base_query_v1beta1_pagination_pb);
10
10
 
11
+ //#region src/utils/helpers.ts
12
+ const isServerSide = () => typeof window === "undefined";
13
+ const isReactNative = () => {
14
+ return typeof document === "undefined" && typeof navigator !== "undefined" && navigator.product === "ReactNative";
15
+ };
16
+ const isNode = () => {
17
+ if (typeof window === "undefined") return true;
18
+ return typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined";
19
+ };
20
+ const isBrowser = () => {
21
+ if (isReactNative()) return false;
22
+ if (isNode()) return false;
23
+ return typeof window !== "undefined";
24
+ };
25
+ const objectToJson = (object, params) => {
26
+ const { replacer, indentation } = params || {
27
+ replacer: void 0,
28
+ indentation: 2
29
+ };
30
+ return safeBigIntStringify(object, replacer, indentation);
31
+ };
32
+ const protoObjectToJson = (object, params) => {
33
+ const { replacer, indentation } = params || {
34
+ replacer: void 0,
35
+ indentation: 2
36
+ };
37
+ if (object.toObject !== void 0) return safeBigIntStringify(object.toObject(), replacer, indentation);
38
+ return objectToJson(object, {
39
+ replacer,
40
+ indentation
41
+ });
42
+ };
43
+ const grpcCoinToUiCoin = (coin) => ({
44
+ amount: coin.amount,
45
+ denom: coin.denom
46
+ });
47
+ const sortObjectByKeysWithReduce = (obj) => {
48
+ if (typeof obj !== "object" || obj === null) return obj;
49
+ if (Array.isArray(obj)) return obj.map((e) => sortObjectByKeysWithReduce(e)).sort();
50
+ return Object.keys(obj).sort().reduce((sorted, k) => {
51
+ const key = k;
52
+ sorted[key] = sortObjectByKeysWithReduce(obj[key]);
53
+ return sorted;
54
+ }, {});
55
+ };
56
+ const sortObjectByKeys = (obj) => {
57
+ if (typeof obj !== "object" || obj === null) return obj;
58
+ if (Array.isArray(obj)) return obj.map(sortObjectByKeys);
59
+ const sortedKeys = Object.keys(obj).sort();
60
+ const result = {};
61
+ sortedKeys.forEach((key) => {
62
+ result[key] = sortObjectByKeys(obj[key]);
63
+ });
64
+ return result;
65
+ };
66
+ const getErrorMessage = (error, endpoint) => {
67
+ if (!error.response) return `The request to ${endpoint} has failed.`;
68
+ return error.response.data ? error.response.data.message || error.response.data : error.response.statusText;
69
+ };
70
+ /**
71
+ * Converts value to it's number representation
72
+ */
73
+ const hexToNumber = (value) => {
74
+ const [negative, hexValue] = value.startsWith("-") ? [true, value.slice(1)] : [false, value];
75
+ const num = BigInt(hexValue);
76
+ if (num > Number.MAX_SAFE_INTEGER) return Number(negative ? -num : num);
77
+ if (num < Number.MIN_SAFE_INTEGER) return Number(num);
78
+ return negative ? -1 * Number(num) : Number(num);
79
+ };
80
+ function isJsonString(str) {
81
+ if (typeof str !== "string") return false;
82
+ try {
83
+ JSON.parse(str);
84
+ } catch (_unused) {
85
+ return false;
86
+ }
87
+ return true;
88
+ }
89
+ /**
90
+ * BigInt-safe JSON replacer function.
91
+ * Converts BigInt values to strings during JSON serialization.
92
+ */
93
+ const bigIntReplacer = (_key, value) => typeof value === "bigint" ? bigIntToString(value) : value;
94
+ /**
95
+ * Converts a potentially bigint value to a number.
96
+ * Handles bigint, string, and other number-like types.
97
+ * Returns 0 for null/undefined values.
98
+ */
99
+ const bigIntToNumber = (value) => {
100
+ if (value === null || value === void 0) return 0;
101
+ if (typeof value === "bigint") return Number(value);
102
+ if (typeof value === "string") return parseInt(value || "0", 10);
103
+ if (typeof value === "number") return value;
104
+ return parseInt(String(value || "0"), 10);
105
+ };
106
+ /**
107
+ * Converts a potentially bigint value to a string.
108
+ * Handles bigint, string, and other types that can be converted to string.
109
+ * Returns empty string for null/undefined values.
110
+ */
111
+ const bigIntToString = (value) => {
112
+ if (value === null || value === void 0) return "";
113
+ if (typeof value === "bigint") return value.toString();
114
+ if (typeof value === "string") return value;
115
+ if (typeof value === "number") return value.toString();
116
+ return String(value || "");
117
+ };
118
+ /**
119
+ * Stringify an object to JSON with BigInt support.
120
+ * Converts BigInt values to strings during serialization to prevent
121
+ * "Do not know how to serialize a BigInt" errors.
122
+ *
123
+ * @param value - The value to serialize
124
+ * @param replacer - Optional custom replacer function (BigInt handling is applied first)
125
+ * @param space - Optional indentation for pretty printing
126
+ * @returns JSON string
127
+ */
128
+ const safeBigIntStringify = (value, replacer, space) => {
129
+ const combinedReplacer = (key, val) => {
130
+ const bigIntHandled = bigIntReplacer(key, val);
131
+ return replacer ? replacer(key, bigIntHandled) : bigIntHandled;
132
+ };
133
+ return JSON.stringify(value, combinedReplacer, space);
134
+ };
135
+
136
+ //#endregion
11
137
  //#region src/utils/encoding.ts
12
138
  /**
13
139
  * Encoding/decoding utilities using industry-standard libraries
@@ -146,7 +272,7 @@ function binaryToBase64(data) {
146
272
  * @returns Base64 encoded string
147
273
  */
148
274
  function toBase64(data) {
149
- return uint8ArrayToBase64(stringToUint8Array(JSON.stringify(data)));
275
+ return uint8ArrayToBase64(stringToUint8Array(safeBigIntStringify(data)));
150
276
  }
151
277
  /**
152
278
  * Convert a base64 string to JSON object
@@ -434,7 +560,7 @@ const sanitizeTypedData = (data) => {
434
560
  return Object.fromEntries(entries);
435
561
  }
436
562
  case "[object Array]": return data.map((v) => sanitizeTypedData(v));
437
- case "[object BigInt]": return data.toString();
563
+ case "[object BigInt]": return bigIntToString(data);
438
564
  default: return data;
439
565
  }
440
566
  };
@@ -463,86 +589,6 @@ const TypedDataUtilsSanitizeData = sanitizeTypedData;
463
589
  const TypedDataUtilsHashStruct = hashStruct;
464
590
  const SignTypedDataVersionV4 = "V4";
465
591
 
466
- //#endregion
467
- //#region src/utils/helpers.ts
468
- const isServerSide = () => typeof window === "undefined";
469
- const isReactNative = () => {
470
- return typeof document === "undefined" && typeof navigator !== "undefined" && navigator.product === "ReactNative";
471
- };
472
- const isNode = () => {
473
- if (typeof window === "undefined") return true;
474
- return typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined";
475
- };
476
- const isBrowser = () => {
477
- if (isReactNative()) return false;
478
- if (isNode()) return false;
479
- return typeof window !== "undefined";
480
- };
481
- const objectToJson = (object, params) => {
482
- const { replacer, indentation } = params || {
483
- replacer: null,
484
- indentation: 2
485
- };
486
- return JSON.stringify(object, replacer, indentation);
487
- };
488
- const protoObjectToJson = (object, params) => {
489
- const { replacer, indentation } = params || {
490
- replacer: null,
491
- indentation: 2
492
- };
493
- if (object.toObject !== void 0) return JSON.stringify(object.toObject(), replacer, indentation);
494
- return objectToJson(object, {
495
- replacer,
496
- indentation
497
- });
498
- };
499
- const grpcCoinToUiCoin = (coin) => ({
500
- amount: coin.amount,
501
- denom: coin.denom
502
- });
503
- const sortObjectByKeysWithReduce = (obj) => {
504
- if (typeof obj !== "object" || obj === null) return obj;
505
- if (Array.isArray(obj)) return obj.map((e) => sortObjectByKeysWithReduce(e)).sort();
506
- return Object.keys(obj).sort().reduce((sorted, k) => {
507
- const key = k;
508
- sorted[key] = sortObjectByKeysWithReduce(obj[key]);
509
- return sorted;
510
- }, {});
511
- };
512
- const sortObjectByKeys = (obj) => {
513
- if (typeof obj !== "object" || obj === null) return obj;
514
- if (Array.isArray(obj)) return obj.map(sortObjectByKeys);
515
- const sortedKeys = Object.keys(obj).sort();
516
- const result = {};
517
- sortedKeys.forEach((key) => {
518
- result[key] = sortObjectByKeys(obj[key]);
519
- });
520
- return result;
521
- };
522
- const getErrorMessage = (error, endpoint) => {
523
- if (!error.response) return `The request to ${endpoint} has failed.`;
524
- return error.response.data ? error.response.data.message || error.response.data : error.response.statusText;
525
- };
526
- /**
527
- * Converts value to it's number representation
528
- */
529
- const hexToNumber = (value) => {
530
- const [negative, hexValue] = value.startsWith("-") ? [true, value.slice(1)] : [false, value];
531
- const num = BigInt(hexValue);
532
- if (num > Number.MAX_SAFE_INTEGER) return Number(negative ? -num : num);
533
- if (num < Number.MIN_SAFE_INTEGER) return Number(num);
534
- return negative ? -1 * Number(num) : Number(num);
535
- };
536
- function isJsonString(str) {
537
- if (typeof str !== "string") return false;
538
- try {
539
- JSON.parse(str);
540
- } catch (_unused) {
541
- return false;
542
- }
543
- return true;
544
- }
545
-
546
592
  //#endregion
547
593
  //#region src/utils/numbers.ts
548
594
  const $BigNumber = __injectivelabs_utils.BigNumber.clone({ ROUNDING_MODE: __injectivelabs_utils.BigNumber.ROUND_DOWN });
@@ -1000,7 +1046,7 @@ var ChainGrpcCommonTransformer = class ChainGrpcCommonTransformer {
1000
1046
  }
1001
1047
  static grpcPaginationToPaginationV2(pagination) {
1002
1048
  return {
1003
- total: pagination ? Number(pagination.total) : 0,
1049
+ total: pagination ? bigIntToNumber(pagination.total) : 0,
1004
1050
  next: pagination ? ChainGrpcCommonTransformer.paginationUint8ArrayToString(pagination.nextKey) : ""
1005
1051
  };
1006
1052
  }
@@ -1040,15 +1086,16 @@ const grpcPagingToPaging = (pagination) => {
1040
1086
  };
1041
1087
  return {
1042
1088
  ...pagination,
1089
+ total: bigIntToNumber(pagination.total),
1043
1090
  to: parseInt(pagination.to.toString() || "0", 10),
1044
1091
  from: parseInt(pagination.from.toString() || "0", 10),
1045
- total: parseInt((pagination.total || 0n).toString(), 10)
1092
+ countBySubaccount: bigIntToNumber(pagination.countBySubaccount)
1046
1093
  };
1047
1094
  };
1048
1095
  /**
1049
1096
  * Converts gRPC Paging to ExchangePagination for V2 proto packages.
1050
1097
  * Handles both InjectiveAccountsRpcPb.Paging and InjectiveExplorerRpcPb.Paging types.
1051
- * Supports bigint and string types for the total field.
1098
+ * Supports bigint and string types for the total and countBySubaccount fields.
1052
1099
  */
1053
1100
  const grpcPagingToPagingV2 = (pagination) => {
1054
1101
  if (!pagination) return {
@@ -1056,13 +1103,12 @@ const grpcPagingToPagingV2 = (pagination) => {
1056
1103
  from: 0,
1057
1104
  total: 0
1058
1105
  };
1059
- const total = pagination.total;
1060
- const totalNumber = typeof total === "bigint" ? Number(total) : typeof total === "string" ? parseInt(total || "0", 10) : parseInt(String(total) || "0", 10);
1061
1106
  return {
1062
1107
  ...pagination,
1108
+ total: bigIntToNumber(pagination.total),
1063
1109
  to: parseInt(pagination.to.toString() || "0", 10),
1064
1110
  from: parseInt(pagination.from.toString() || "0", 10),
1065
- total: totalNumber
1111
+ countBySubaccount: bigIntToNumber(pagination.countBySubaccount)
1066
1112
  };
1067
1113
  };
1068
1114
  const fetchAllWithPagination = async (args, method, result = []) => {
@@ -1182,6 +1228,24 @@ Object.defineProperty(exports, 'base64ToUtf8', {
1182
1228
  return base64ToUtf8;
1183
1229
  }
1184
1230
  });
1231
+ Object.defineProperty(exports, 'bigIntReplacer', {
1232
+ enumerable: true,
1233
+ get: function () {
1234
+ return bigIntReplacer;
1235
+ }
1236
+ });
1237
+ Object.defineProperty(exports, 'bigIntToNumber', {
1238
+ enumerable: true,
1239
+ get: function () {
1240
+ return bigIntToNumber;
1241
+ }
1242
+ });
1243
+ Object.defineProperty(exports, 'bigIntToString', {
1244
+ enumerable: true,
1245
+ get: function () {
1246
+ return bigIntToString;
1247
+ }
1248
+ });
1185
1249
  Object.defineProperty(exports, 'binaryToBase64', {
1186
1250
  enumerable: true,
1187
1251
  get: function () {
@@ -1656,6 +1720,12 @@ Object.defineProperty(exports, 'ripemd160', {
1656
1720
  return ripemd160;
1657
1721
  }
1658
1722
  });
1723
+ Object.defineProperty(exports, 'safeBigIntStringify', {
1724
+ enumerable: true,
1725
+ get: function () {
1726
+ return safeBigIntStringify;
1727
+ }
1728
+ });
1659
1729
  Object.defineProperty(exports, 'sanitizeTypedData', {
1660
1730
  enumerable: true,
1661
1731
  get: function () {
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- const require_utils = require('./utils-CaAHoOvO.cjs');
2
+ const require_utils = require('./utils-CDl812vv.cjs');
3
3
  const require_time = require('./time-B4xLc27Y.cjs');
4
4
  const require_grpc = require('./grpc-DQDVCGpY.cjs');
5
5
  let __protobuf_ts_grpcweb_transport = require("@protobuf-ts/grpcweb-transport");
@@ -20,6 +20,9 @@ exports.addHexPrefix = require_utils.addHexPrefix;
20
20
  exports.amountToCosmosSdkDecAmount = require_utils.amountToCosmosSdkDecAmount;
21
21
  exports.base64ToUint8Array = require_utils.base64ToUint8Array;
22
22
  exports.base64ToUtf8 = require_utils.base64ToUtf8;
23
+ exports.bigIntReplacer = require_utils.bigIntReplacer;
24
+ exports.bigIntToNumber = require_utils.bigIntToNumber;
25
+ exports.bigIntToString = require_utils.bigIntToString;
23
26
  exports.binaryToBase64 = require_utils.binaryToBase64;
24
27
  exports.concatUint8Arrays = require_utils.concatUint8Arrays;
25
28
  exports.cosmosSdkDecToBigNumber = require_utils.cosmosSdkDecToBigNumber;
@@ -107,6 +110,7 @@ exports.publicKeyToAddress = require_utils.publicKeyToAddress;
107
110
  exports.recoverTypedSignaturePubKey = require_utils.recoverTypedSignaturePubKey;
108
111
  exports.removeHexPrefix = require_utils.removeHexPrefix;
109
112
  exports.ripemd160 = require_utils.ripemd160;
113
+ exports.safeBigIntStringify = require_utils.safeBigIntStringify;
110
114
  exports.sanitizeTypedData = require_utils.sanitizeTypedData;
111
115
  exports.sha256 = require_utils.sha256;
112
116
  exports.sortObjectByKeys = require_utils.sortObjectByKeys;
@@ -1,10 +1,10 @@
1
- import "./tx_pb-tECSPcSB.cjs";
2
- import "./BaseGrpcConsumer-PDufF0fz.cjs";
3
- import "./index-B19YRG03.cjs";
4
- import "./any_pb-CP-3DVyl.cjs";
5
- import { $c as cosmosSdkDecToBigNumber, $l as decompressPubKey, Ac as hexToBuff, Al as spotPriceFromChainPriceToFixed, Bc as getChecksumAddress, Bl as isBrowser, Cc as base64ToUint8Array, Cl as formatPriceToAllowablePrice, Dc as fromBase64, Dl as isNumber, Ec as concatUint8Arrays, El as getTensMultiplier, Fc as uint8ArrayToBase64, Fl as spotQuantityToChainQuantity, Gc as getSubaccountId, Gl as objectToJson, Hc as getEthereumAddress, Hl as isNode, Ic as uint8ArrayToHex, Il as spotQuantityToChainQuantityToFixed, Jc as getDerivativeMarketDecimals, Jl as sortObjectByKeysWithReduce, Kc as isCw20ContractAddress, Kl as protoObjectToJson, Lc as uint8ArrayToString, Ll as getErrorMessage, Mc as stringToUint8Array, Ml as spotPriceToChainPriceToFixed, Nc as toBase64, Nl as spotQuantityFromChainQuantity, Oc as fromUtf8, Ol as numberToCosmosSdkDecString, Pc as toUtf8, Pl as spotQuantityFromChainQuantityToFixed, Qc as amountToCosmosSdkDecAmount, Ql as TypedMessageV4, Rc as addHexPrefix, Rl as grpcCoinToUiCoin, Sc as DEFAULT_DERIVATION_PATH, Sl as formatPriceToAllowableDecimals, Tc as binaryToBase64, Tl as getSignificantDecimalsFromNumber, Uc as getInjectiveAddress, Ul as isReactNative, Vc as getDefaultSubaccountId, Vl as isJsonString, Wc as getInjectiveAddressFromSubaccountId, Wl as isServerSide, Xc as getSpotMarketDecimals, Xl as TypedDataUtilsHashStruct, Yc as getDerivativeMarketTensMultiplier, Yl as SignTypedDataVersionV4, Zc as getSpotMarketTensMultiplier, Zl as TypedDataUtilsSanitizeData, _c as BECH32_ADDR_CONS_PREFIX, _l as derivativeQuantityToChainQuantityToFixed, _u as makeTimeoutTimestampInNs, al as denomAmountToGrpcChainDenomAmount, au as privateKeyToPublicKey, bc as BECH32_PUBKEY_CONS_PREFIX, bl as formatNumberToAllowableDecimals, bu as protobufTimestampToUnixSeconds, cc as recoverTypedSignaturePubKey, cl as derivativeMarginToChainMargin, cu as ripemd160, dc as grpcPagingToPaging, dl as derivativePriceFromChainPriceToFixed, du as parseCoins, el as denomAmountFromChainDenomAmount, eu as domainHash, fc as grpcPagingToPagingV2, fl as derivativePriceToChainPrice, fu as ofacList, gc as BECH32_ADDR_ACC_PREFIX, gl as derivativeQuantityToChainQuantity, gu as makeTimeoutTimestamp, hc as paginationUint8ArrayToString, hl as derivativeQuantityFromChainQuantityToFixed, hu as getGasPriceBasedOnMessage, il as denomAmountToChainDenomAmountToFixed, iu as privateKeyHashToPublicKeyBase64, jc as hexToUint8Array, jl as spotPriceToChainPrice, kc as hexToBase64, kl as spotPriceFromChainPrice, lc as fetchAllWithPagination, ll as derivativeMarginToChainMarginToFixed, lu as sanitizeTypedData, mc as paginationRequestFromPagination, ml as derivativeQuantityFromChainQuantity, mu as GrpcWebFetchTransport, nl as denomAmountFromGrpcChainDenomAmount, nu as messageHash, ol as derivativeMarginFromChainMargin, ou as privateKeyToPublicKeyBase64, pc as pageRequestToGrpcPageRequestV2, pl as derivativePriceToChainPriceToFixed, pu as getGrpcWebTransport, qc as removeHexPrefix, ql as sortObjectByKeys, rl as denomAmountToChainDenomAmount, ru as privateKeyHashToPublicKey, sl as derivativeMarginFromChainMarginToFixed, su as publicKeyToAddress, tl as denomAmountFromChainDenomAmountToFixed, tu as hashToHex, uc as grpcPaginationToPagination, ul as derivativePriceFromChainPrice, uu as sha256, vc as BECH32_ADDR_VAL_PREFIX, vl as formatAmountToAllowableAmount, vu as protobufTimestampToDate, wc as base64ToUtf8, wl as getExactDecimalsFromNumber, xc as BECH32_PUBKEY_VAL_PREFIX, xl as formatNumberToAllowableTensMultiplier, yc as BECH32_PUBKEY_ACC_PREFIX, yl as formatAmountToAllowableDecimals, yu as protobufTimestampToUnixMs, zc as getAddressFromInjectiveAddress, zl as hexToNumber } from "./index-9KV6P3U_.cjs";
6
- import "./index-D4uWOVE5.cjs";
7
- import "./index-Cqfc1ppG.cjs";
8
- import "./index-CKBod1ba.cjs";
9
- import "./index-Cc5Q73-y.cjs";
10
- export { BECH32_ADDR_ACC_PREFIX, BECH32_ADDR_CONS_PREFIX, BECH32_ADDR_VAL_PREFIX, BECH32_PUBKEY_ACC_PREFIX, BECH32_PUBKEY_CONS_PREFIX, BECH32_PUBKEY_VAL_PREFIX, DEFAULT_DERIVATION_PATH, GrpcWebFetchTransport, SignTypedDataVersionV4, TypedDataUtilsHashStruct, TypedDataUtilsSanitizeData, TypedMessageV4, addHexPrefix, amountToCosmosSdkDecAmount, base64ToUint8Array, base64ToUtf8, binaryToBase64, concatUint8Arrays, cosmosSdkDecToBigNumber, decompressPubKey, denomAmountFromChainDenomAmount, denomAmountFromChainDenomAmountToFixed, denomAmountFromGrpcChainDenomAmount, denomAmountToChainDenomAmount, denomAmountToChainDenomAmountToFixed, denomAmountToGrpcChainDenomAmount, derivativeMarginFromChainMargin, derivativeMarginFromChainMarginToFixed, derivativeMarginToChainMargin, derivativeMarginToChainMarginToFixed, derivativePriceFromChainPrice, derivativePriceFromChainPriceToFixed, derivativePriceToChainPrice, derivativePriceToChainPriceToFixed, derivativeQuantityFromChainQuantity, derivativeQuantityFromChainQuantityToFixed, derivativeQuantityToChainQuantity, derivativeQuantityToChainQuantityToFixed, domainHash, fetchAllWithPagination, formatAmountToAllowableAmount, formatAmountToAllowableDecimals, formatNumberToAllowableDecimals, formatNumberToAllowableTensMultiplier, formatPriceToAllowableDecimals, formatPriceToAllowablePrice, fromBase64, fromUtf8, getAddressFromInjectiveAddress, getChecksumAddress, getDefaultSubaccountId, getDerivativeMarketDecimals, getDerivativeMarketTensMultiplier, getErrorMessage, getEthereumAddress, getExactDecimalsFromNumber, getGasPriceBasedOnMessage, getGrpcWebTransport, getInjectiveAddress, getInjectiveAddressFromSubaccountId, getSignificantDecimalsFromNumber, getSpotMarketDecimals, getSpotMarketTensMultiplier, getSubaccountId, getTensMultiplier, grpcCoinToUiCoin, grpcPaginationToPagination, grpcPagingToPaging, grpcPagingToPagingV2, hashToHex, hexToBase64, hexToBuff, hexToNumber, hexToUint8Array, isBrowser, isCw20ContractAddress, isJsonString, isNode, isNumber, isReactNative, isServerSide, makeTimeoutTimestamp, makeTimeoutTimestampInNs, messageHash, numberToCosmosSdkDecString, objectToJson, ofacList, pageRequestToGrpcPageRequestV2, paginationRequestFromPagination, paginationUint8ArrayToString, parseCoins, privateKeyHashToPublicKey, privateKeyHashToPublicKeyBase64, privateKeyToPublicKey, privateKeyToPublicKeyBase64, protoObjectToJson, protobufTimestampToDate, protobufTimestampToUnixMs, protobufTimestampToUnixSeconds, publicKeyToAddress, recoverTypedSignaturePubKey, removeHexPrefix, ripemd160, sanitizeTypedData, sha256, sortObjectByKeys, sortObjectByKeysWithReduce, spotPriceFromChainPrice, spotPriceFromChainPriceToFixed, spotPriceToChainPrice, spotPriceToChainPriceToFixed, spotQuantityFromChainQuantity, spotQuantityFromChainQuantityToFixed, spotQuantityToChainQuantity, spotQuantityToChainQuantityToFixed, stringToUint8Array, toBase64, toUtf8, uint8ArrayToBase64, uint8ArrayToHex, uint8ArrayToString };
1
+ import "./tx_pb-D-cNmrlO.cjs";
2
+ import "./BaseGrpcConsumer-Vvj4lzyS.cjs";
3
+ import "./index-lRWP4rKg.cjs";
4
+ import "./any_pb-CutLnOUR.cjs";
5
+ import { $c as grpcPagingToPagingV2, $l as derivativePriceToChainPrice, $u as ripemd160, Al as getInjectiveAddress, Au as isBrowser, Bl as cosmosSdkDecToBigNumber, Bu as SignTypedDataVersionV4, Cl as uint8ArrayToHex, Cu as spotQuantityToChainQuantityToFixed, Dl as getChecksumAddress, Du as getErrorMessage, El as getAddressFromInjectiveAddress, Eu as bigIntToString, Fl as getDerivativeMarketDecimals, Fu as objectToJson, Gl as denomAmountToChainDenomAmountToFixed, Gu as domainHash, Hl as denomAmountFromChainDenomAmountToFixed, Hu as TypedDataUtilsSanitizeData, Il as getDerivativeMarketTensMultiplier, Iu as protoObjectToJson, Jl as derivativeMarginFromChainMarginToFixed, Ju as privateKeyHashToPublicKey, Kl as denomAmountToGrpcChainDenomAmount, Ku as hashToHex, Ll as getSpotMarketDecimals, Lu as safeBigIntStringify, Ml as getSubaccountId, Mu as isNode, Nl as isCw20ContractAddress, Nu as isReactNative, Ol as getDefaultSubaccountId, Ou as grpcCoinToUiCoin, Pl as removeHexPrefix, Pu as isServerSide, Qc as grpcPagingToPaging, Ql as derivativePriceFromChainPriceToFixed, Qu as publicKeyToAddress, Rl as getSpotMarketTensMultiplier, Ru as sortObjectByKeys, Sl as uint8ArrayToBase64, Su as spotQuantityToChainQuantity, Tl as addHexPrefix, Tu as bigIntToNumber, Ul as denomAmountFromGrpcChainDenomAmount, Uu as TypedMessageV4, Vl as denomAmountFromChainDenomAmount, Vu as TypedDataUtilsHashStruct, Wl as denomAmountToChainDenomAmount, Wu as decompressPubKey, Xc as fetchAllWithPagination, Xl as derivativeMarginToChainMarginToFixed, Xu as privateKeyToPublicKey, Yc as recoverTypedSignaturePubKey, Yl as derivativeMarginToChainMargin, Yu as privateKeyHashToPublicKeyBase64, Zc as grpcPaginationToPagination, Zl as derivativePriceFromChainPrice, Zu as privateKeyToPublicKeyBase64, _l as hexToBuff, _u as spotPriceFromChainPriceToFixed, ad as GrpcWebFetchTransport, al as BECH32_ADDR_VAL_PREFIX, au as formatAmountToAllowableAmount, bl as toBase64, bu as spotQuantityFromChainQuantity, cd as makeTimeoutTimestampInNs, cl as BECH32_PUBKEY_VAL_PREFIX, cu as formatNumberToAllowableTensMultiplier, dd as protobufTimestampToUnixSeconds, dl as base64ToUtf8, du as getExactDecimalsFromNumber, ed as sanitizeTypedData, el as pageRequestToGrpcPageRequestV2, eu as derivativePriceToChainPriceToFixed, fl as binaryToBase64, fu as getSignificantDecimalsFromNumber, gl as hexToBase64, gu as spotPriceFromChainPrice, hl as fromUtf8, hu as numberToCosmosSdkDecString, id as getGrpcWebTransport, il as BECH32_ADDR_CONS_PREFIX, iu as derivativeQuantityToChainQuantityToFixed, jl as getInjectiveAddressFromSubaccountId, ju as isJsonString, kl as getEthereumAddress, ku as hexToNumber, ld as protobufTimestampToDate, ll as DEFAULT_DERIVATION_PATH, lu as formatPriceToAllowableDecimals, ml as fromBase64, mu as isNumber, nd as parseCoins, nl as paginationUint8ArrayToString, nu as derivativeQuantityFromChainQuantityToFixed, od as getGasPriceBasedOnMessage, ol as BECH32_PUBKEY_ACC_PREFIX, ou as formatAmountToAllowableDecimals, pl as concatUint8Arrays, pu as getTensMultiplier, ql as derivativeMarginFromChainMargin, qu as messageHash, rd as ofacList, rl as BECH32_ADDR_ACC_PREFIX, ru as derivativeQuantityToChainQuantity, sd as makeTimeoutTimestamp, sl as BECH32_PUBKEY_CONS_PREFIX, su as formatNumberToAllowableDecimals, td as sha256, tl as paginationRequestFromPagination, tu as derivativeQuantityFromChainQuantity, ud as protobufTimestampToUnixMs, ul as base64ToUint8Array, uu as formatPriceToAllowablePrice, vl as hexToUint8Array, vu as spotPriceToChainPrice, wl as uint8ArrayToString, wu as bigIntReplacer, xl as toUtf8, xu as spotQuantityFromChainQuantityToFixed, yl as stringToUint8Array, yu as spotPriceToChainPriceToFixed, zl as amountToCosmosSdkDecAmount, zu as sortObjectByKeysWithReduce } from "./index-DemZnO3c.cjs";
6
+ import "./index-DWbxb1AB.cjs";
7
+ import "./index-DjRtDAy5.cjs";
8
+ import "./index-CO3Y9drx.cjs";
9
+ import "./index-CGvISJoE.cjs";
10
+ export { BECH32_ADDR_ACC_PREFIX, BECH32_ADDR_CONS_PREFIX, BECH32_ADDR_VAL_PREFIX, BECH32_PUBKEY_ACC_PREFIX, BECH32_PUBKEY_CONS_PREFIX, BECH32_PUBKEY_VAL_PREFIX, DEFAULT_DERIVATION_PATH, GrpcWebFetchTransport, SignTypedDataVersionV4, TypedDataUtilsHashStruct, TypedDataUtilsSanitizeData, TypedMessageV4, addHexPrefix, amountToCosmosSdkDecAmount, base64ToUint8Array, base64ToUtf8, bigIntReplacer, bigIntToNumber, bigIntToString, binaryToBase64, concatUint8Arrays, cosmosSdkDecToBigNumber, decompressPubKey, denomAmountFromChainDenomAmount, denomAmountFromChainDenomAmountToFixed, denomAmountFromGrpcChainDenomAmount, denomAmountToChainDenomAmount, denomAmountToChainDenomAmountToFixed, denomAmountToGrpcChainDenomAmount, derivativeMarginFromChainMargin, derivativeMarginFromChainMarginToFixed, derivativeMarginToChainMargin, derivativeMarginToChainMarginToFixed, derivativePriceFromChainPrice, derivativePriceFromChainPriceToFixed, derivativePriceToChainPrice, derivativePriceToChainPriceToFixed, derivativeQuantityFromChainQuantity, derivativeQuantityFromChainQuantityToFixed, derivativeQuantityToChainQuantity, derivativeQuantityToChainQuantityToFixed, domainHash, fetchAllWithPagination, formatAmountToAllowableAmount, formatAmountToAllowableDecimals, formatNumberToAllowableDecimals, formatNumberToAllowableTensMultiplier, formatPriceToAllowableDecimals, formatPriceToAllowablePrice, fromBase64, fromUtf8, getAddressFromInjectiveAddress, getChecksumAddress, getDefaultSubaccountId, getDerivativeMarketDecimals, getDerivativeMarketTensMultiplier, getErrorMessage, getEthereumAddress, getExactDecimalsFromNumber, getGasPriceBasedOnMessage, getGrpcWebTransport, getInjectiveAddress, getInjectiveAddressFromSubaccountId, getSignificantDecimalsFromNumber, getSpotMarketDecimals, getSpotMarketTensMultiplier, getSubaccountId, getTensMultiplier, grpcCoinToUiCoin, grpcPaginationToPagination, grpcPagingToPaging, grpcPagingToPagingV2, hashToHex, hexToBase64, hexToBuff, hexToNumber, hexToUint8Array, isBrowser, isCw20ContractAddress, isJsonString, isNode, isNumber, isReactNative, isServerSide, makeTimeoutTimestamp, makeTimeoutTimestampInNs, messageHash, numberToCosmosSdkDecString, objectToJson, ofacList, pageRequestToGrpcPageRequestV2, paginationRequestFromPagination, paginationUint8ArrayToString, parseCoins, privateKeyHashToPublicKey, privateKeyHashToPublicKeyBase64, privateKeyToPublicKey, privateKeyToPublicKeyBase64, protoObjectToJson, protobufTimestampToDate, protobufTimestampToUnixMs, protobufTimestampToUnixSeconds, publicKeyToAddress, recoverTypedSignaturePubKey, removeHexPrefix, ripemd160, safeBigIntStringify, sanitizeTypedData, sha256, sortObjectByKeys, sortObjectByKeysWithReduce, spotPriceFromChainPrice, spotPriceFromChainPriceToFixed, spotPriceToChainPrice, spotPriceToChainPriceToFixed, spotQuantityFromChainQuantity, spotQuantityFromChainQuantityToFixed, spotQuantityToChainQuantity, spotQuantityToChainQuantityToFixed, stringToUint8Array, toBase64, toUtf8, uint8ArrayToBase64, uint8ArrayToHex, uint8ArrayToString };
@@ -1,5 +1,5 @@
1
1
  import { t as _defineProperty } from "./defineProperty-Bq6QU9Te.js";
2
- import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-DptVGP0n.js";
2
+ import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-BTWyD665.js";
3
3
  import { IndexerErrorModule } from "@injectivelabs/exceptions";
4
4
  import * as PointsSvcPb from "@injectivelabs/abacus-proto-ts-v2/generated/points_svc_pb";
5
5
  import { PointsSvcClient } from "@injectivelabs/abacus-proto-ts-v2/generated/points_svc_pb.client";
@@ -1805,8 +1805,20 @@ declare class BaseGrpcConsumer {
1805
1805
  */
1806
1806
  protected retry<TResponse>(grpcCall: () => Promise<TResponse>, retries?: number, delay?: number): Promise<TResponse>;
1807
1807
  /**
1808
- * Centralized error handler for gRPC calls
1809
- * Converts RpcError to GrpcUnaryRequestException with proper error codes
1808
+ * Extracts the ABCI error code from a gRPC error message.
1809
+ * Chain errors contain patterns like: {key:"ABCICode" value:"100"}
1810
+ */
1811
+ private getABCICodeFromMessage;
1812
+ /**
1813
+ * Extracts the codespace/module from a gRPC error message.
1814
+ * Chain errors contain patterns like: {key:"Codespace" value:"exchange"}
1815
+ */
1816
+ private getCodespaceFromMessage;
1817
+ /**
1818
+ * Centralized error handler for gRPC calls.
1819
+ * When the error contains chain error details (ABCI code and codespace),
1820
+ * throws a TransactionException which will map the error to a user-friendly message.
1821
+ * Otherwise throws a GrpcUnaryRequestException for generic gRPC errors.
1810
1822
  */
1811
1823
  protected handleGrpcError(e: unknown, context: string): never;
1812
1824
  /**
@@ -1,6 +1,6 @@
1
1
  import { t as _defineProperty } from "./defineProperty-Bq6QU9Te.js";
2
2
  import { n as getGrpcWebTransport } from "./grpc-lYZqzL0k.js";
3
- import { GrpcUnaryRequestException, UnspecifiedErrorCode, grpcErrorCodeToErrorCode } from "@injectivelabs/exceptions";
3
+ import { GrpcUnaryRequestException, TransactionException, UnspecifiedErrorCode, grpcErrorCodeToErrorCode } from "@injectivelabs/exceptions";
4
4
  import { RpcError } from "@protobuf-ts/runtime-rpc";
5
5
 
6
6
  //#region src/client/base/GrpcWebRpcTransport.ts
@@ -79,16 +79,57 @@ var BaseGrpcConsumer = class {
79
79
  return retryGrpcCall();
80
80
  }
81
81
  /**
82
- * Centralized error handler for gRPC calls
83
- * Converts RpcError to GrpcUnaryRequestException with proper error codes
82
+ * Extracts the ABCI error code from a gRPC error message.
83
+ * Chain errors contain patterns like: {key:"ABCICode" value:"100"}
84
+ */
85
+ getABCICodeFromMessage(message) {
86
+ const ABCICode = /{key:"ABCICode"[ \t]+value:"(.*?)"}/g.exec(message);
87
+ if (!ABCICode || ABCICode.length < 2) return;
88
+ return Number(ABCICode[1]);
89
+ }
90
+ /**
91
+ * Extracts the codespace/module from a gRPC error message.
92
+ * Chain errors contain patterns like: {key:"Codespace" value:"exchange"}
93
+ */
94
+ getCodespaceFromMessage(message) {
95
+ const codespace = /{key:"Codespace"[ \t]+value:"(.*?)"}/g.exec(message);
96
+ if (!codespace || codespace.length < 2) return;
97
+ return codespace[1];
98
+ }
99
+ /**
100
+ * Centralized error handler for gRPC calls.
101
+ * When the error contains chain error details (ABCI code and codespace),
102
+ * throws a TransactionException which will map the error to a user-friendly message.
103
+ * Otherwise throws a GrpcUnaryRequestException for generic gRPC errors.
84
104
  */
85
105
  handleGrpcError(e, context) {
86
- if (e instanceof RpcError) throw new GrpcUnaryRequestException(new Error(e.message), {
87
- code: grpcErrorCodeToErrorCode(Number(e.code)),
106
+ if (e instanceof RpcError) {
107
+ const message$1 = e.message;
108
+ const abciCode$1 = this.getABCICodeFromMessage(message$1);
109
+ const codespace$1 = this.getCodespaceFromMessage(message$1);
110
+ if (abciCode$1 && codespace$1) throw new TransactionException(new Error(message$1), {
111
+ code: grpcErrorCodeToErrorCode(Number(e.code)),
112
+ context,
113
+ contextModule: codespace$1,
114
+ contextCode: abciCode$1
115
+ });
116
+ throw new GrpcUnaryRequestException(new Error(message$1), {
117
+ code: grpcErrorCodeToErrorCode(Number(e.code)),
118
+ context,
119
+ contextModule: this.module
120
+ });
121
+ }
122
+ const error = e;
123
+ const message = (error === null || error === void 0 ? void 0 : error.message) || "";
124
+ const abciCode = this.getABCICodeFromMessage(message);
125
+ const codespace = this.getCodespaceFromMessage(message);
126
+ if (abciCode && codespace) throw new TransactionException(error, {
127
+ code: UnspecifiedErrorCode,
88
128
  context,
89
- contextModule: this.module
129
+ contextModule: codespace,
130
+ contextCode: abciCode
90
131
  });
91
- throw new GrpcUnaryRequestException(e, {
132
+ throw new GrpcUnaryRequestException(error, {
92
133
  code: UnspecifiedErrorCode,
93
134
  context,
94
135
  contextModule: this.module
@@ -1,4 +1,4 @@
1
- import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-DptVGP0n.js";
1
+ import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-BTWyD665.js";
2
2
 
3
3
  //#region src/client/base/BaseIndexerGrpcConsumer.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
- import { O as denomAmountFromGrpcChainDenomAmount } from "./utils-DlnuXIe8.js";
1
+ import { O as denomAmountFromGrpcChainDenomAmount } from "./utils-BFBu_LnJ.js";
2
2
  import { t as _defineProperty } from "./defineProperty-Bq6QU9Te.js";
3
- import { o as ChainModule } from "./ChainRestTendermintApi-Cy7hYJYp.js";
4
- import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-DptVGP0n.js";
3
+ import { o as ChainModule } from "./ChainRestTendermintApi-BT_yOkAV.js";
4
+ import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-BTWyD665.js";
5
5
  import { toHumanReadable } from "@injectivelabs/utils";
6
6
  import * as InjectiveExchangeV1Beta1QueryPb from "@injectivelabs/core-proto-ts-v2/generated/injective/exchange/v1beta1/query_pb";
7
7
  import { QueryClient } from "@injectivelabs/core-proto-ts-v2/generated/injective/exchange/v1beta1/query_pb.client";
@@ -1,6 +1,6 @@
1
- import { in as uint8ArrayToBase64, l as ChainGrpcCommonTransformer, on as uint8ArrayToString } from "./utils-DlnuXIe8.js";
1
+ import { Jt as uint8ArrayToString, Kt as uint8ArrayToBase64, l as ChainGrpcCommonTransformer } from "./utils-BFBu_LnJ.js";
2
2
  import { t as _defineProperty } from "./defineProperty-Bq6QU9Te.js";
3
- import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-DptVGP0n.js";
3
+ import { t as BaseGrpcConsumer } from "./BaseGrpcConsumer-BTWyD665.js";
4
4
  import { t as BaseRestConsumer } from "./BaseRestConsumer-rK4eS4W8.js";
5
5
  import { ChainErrorModule, HttpRequestException, UnspecifiedErrorCode } from "@injectivelabs/exceptions";
6
6
  import * as InjectiveCryptoV1Beta1Ethsecp256k1KeysPb from "@injectivelabs/core-proto-ts-v2/generated/injective/crypto/v1beta1/ethsecp256k1/keys_pb";
@@ -1,6 +1,6 @@
1
- import { Kt as base64ToUint8Array, an as uint8ArrayToHex, in as uint8ArrayToBase64 } from "./utils-DlnuXIe8.js";
1
+ import { Kt as uint8ArrayToBase64, Pt as base64ToUint8Array, qt as uint8ArrayToHex } from "./utils-BFBu_LnJ.js";
2
2
  import { t as _defineProperty } from "./defineProperty-Bq6QU9Te.js";
3
- import { O as getPublicKey, P as PublicKey, n as PrivateKey } from "./accounts-DXee44Zk.js";
3
+ import { O as getPublicKey, P as PublicKey, n as PrivateKey } from "./accounts-C5HEaz0B.js";
4
4
  import * as CosmosBaseV1Beta1CoinPb from "@injectivelabs/core-proto-ts-v2/generated/cosmos/base/v1beta1/coin_pb";
5
5
  import * as InjectiveTypesV1Beta1AccountPb from "@injectivelabs/core-proto-ts-v2/generated/injective/types/v1beta1/account_pb";
6
6
  import * as IbcCoreClientV1ClientPb from "@injectivelabs/core-proto-ts-v2/generated/ibc/core/client/v1/client_pb";
@@ -1,6 +1,6 @@
1
- import { Zt as fromUtf8, nn as toBase64 } from "./utils-DlnuXIe8.js";
1
+ import { Wt as toBase64, cn as safeBigIntStringify, zt as fromUtf8 } from "./utils-BFBu_LnJ.js";
2
2
  import { t as _defineProperty } from "./defineProperty-Bq6QU9Te.js";
3
- import { t as MsgBase } from "./MsgBase-aKq3ln6R.js";
3
+ import { t as MsgBase } from "./MsgBase-BkRgVbdY.js";
4
4
  import { GeneralException } from "@injectivelabs/exceptions";
5
5
  import * as InjectiveWasmxV1TxPb from "@injectivelabs/core-proto-ts-v2/generated/injective/wasmx/v1/tx_pb";
6
6
 
@@ -14,10 +14,10 @@ var ExecArgBase = class {
14
14
  this.params = params;
15
15
  }
16
16
  toJSON() {
17
- return fromUtf8(JSON.stringify(this.params));
17
+ return fromUtf8(safeBigIntStringify(this.params));
18
18
  }
19
19
  toExecJSON() {
20
- return fromUtf8(JSON.stringify(this.toExecData()));
20
+ return fromUtf8(safeBigIntStringify(this.toExecData()));
21
21
  }
22
22
  };
23
23
 
@@ -54,7 +54,7 @@ var MsgExecuteContractCompat = class MsgExecuteContractCompat extends MsgBase {
54
54
  return InjectiveWasmxV1TxPb.MsgExecuteContractCompat.create({
55
55
  sender: params.sender,
56
56
  contract: params.contractAddress,
57
- msg: JSON.stringify(msg),
57
+ msg: safeBigIntStringify(msg),
58
58
  funds
59
59
  });
60
60
  }
@@ -72,7 +72,7 @@ var MsgExecuteContractCompat = class MsgExecuteContractCompat extends MsgBase {
72
72
  value: {
73
73
  sender: proto.sender,
74
74
  contract: proto.contract,
75
- msg: JSON.stringify(this.getMsgObject()),
75
+ msg: safeBigIntStringify(this.getMsgObject()),
76
76
  funds: proto.funds
77
77
  }
78
78
  };
@@ -1,6 +1,6 @@
1
- import { Kt as base64ToUint8Array, an as uint8ArrayToHex, t as recoverTypedSignaturePubKey, tn as stringToUint8Array } from "./utils-DlnuXIe8.js";
1
+ import { Pt as base64ToUint8Array, Ut as stringToUint8Array, cn as safeBigIntStringify, qt as uint8ArrayToHex, t as recoverTypedSignaturePubKey } from "./utils-BFBu_LnJ.js";
2
2
  import { t as _defineProperty } from "./defineProperty-Bq6QU9Te.js";
3
- import { t as BaseIndexerGrpcConsumer } from "./BaseIndexerGrpcConsumer-CjpUoGXy.js";
3
+ import { t as BaseIndexerGrpcConsumer } from "./BaseIndexerGrpcConsumer-BTZzA_Eg.js";
4
4
  import * as CosmosTxV1Beta1TxPb from "@injectivelabs/core-proto-ts-v2/generated/cosmos/tx/v1beta1/tx_pb";
5
5
  import { DEFAULT_BRIDGE_FEE_DENOM, DEFAULT_BRIDGE_FEE_PRICE, DEFAULT_EXCHANGE_LIMIT, DEFAULT_GAS_LIMIT } from "@injectivelabs/utils";
6
6
  import { ErrorType, IndexerErrorModule, TransactionException, UnspecifiedErrorCode } from "@injectivelabs/exceptions";
@@ -93,7 +93,7 @@ var IndexerGrpcTransactionApi = class extends BaseIndexerGrpcConsumer {
93
93
  prepareTxRequest.chainId = BigInt(chainId);
94
94
  prepareTxRequest.signerAddress = address;
95
95
  prepareTxRequest.fee = cosmosTxFee;
96
- prepareTxRequest.msgs = (Array.isArray(message) ? message : [message]).map((message$1) => stringToUint8Array(JSON.stringify(message$1)));
96
+ prepareTxRequest.msgs = (Array.isArray(message) ? message : [message]).map((message$1) => stringToUint8Array(safeBigIntStringify(message$1)));
97
97
  if (timeoutHeight !== void 0) prepareTxRequest.timeoutHeight = BigInt(timeoutHeight);
98
98
  if (memo) prepareTxRequest.memo = typeof memo === "number" ? memo.toString() : memo;
99
99
  return await this.executeGrpcCall(prepareTxRequest, this.client.prepareTx.bind(this.client));
@@ -114,7 +114,7 @@ var IndexerGrpcTransactionApi = class extends BaseIndexerGrpcConsumer {
114
114
  const prepareTxRequest = InjectiveExchangeRpcPb.PrepareCosmosTxRequest.create();
115
115
  prepareTxRequest.fee = cosmosTxFee;
116
116
  prepareTxRequest.senderAddress = address;
117
- prepareTxRequest.msgs = (Array.isArray(message) ? message : [message]).map((message$1) => stringToUint8Array(JSON.stringify(message$1)));
117
+ prepareTxRequest.msgs = (Array.isArray(message) ? message : [message]).map((message$1) => stringToUint8Array(safeBigIntStringify(message$1)));
118
118
  if (timeoutHeight !== void 0) prepareTxRequest.timeoutHeight = BigInt(timeoutHeight);
119
119
  if (memo) prepareTxRequest.memo = typeof memo === "number" ? memo.toString() : memo;
120
120
  return await this.executeGrpcCall(prepareTxRequest, this.client.prepareCosmosTx.bind(this.client));
@@ -146,10 +146,10 @@ var IndexerGrpcTransactionApi = class extends BaseIndexerGrpcConsumer {
146
146
  broadcastTxRequest.chainId = BigInt(chainId);
147
147
  broadcastTxRequest.pubKey = cosmosPubKey;
148
148
  broadcastTxRequest.signature = signature;
149
- broadcastTxRequest.tx = stringToUint8Array(JSON.stringify(parsedTypedData.message));
149
+ broadcastTxRequest.tx = stringToUint8Array(safeBigIntStringify(parsedTypedData.message));
150
150
  broadcastTxRequest.feePayer = txResponse.feePayer;
151
151
  broadcastTxRequest.feePayerSig = txResponse.feePayerSig;
152
- broadcastTxRequest.msgs = (Array.isArray(message) ? message : [message]).map((message$1) => stringToUint8Array(JSON.stringify(message$1)));
152
+ broadcastTxRequest.msgs = (Array.isArray(message) ? message : [message]).map((message$1) => stringToUint8Array(safeBigIntStringify(message$1)));
153
153
  return await this.executeGrpcCall(broadcastTxRequest, this.client.broadcastTx.bind(this.client));
154
154
  }
155
155
  /**
@@ -200,7 +200,7 @@ var IndexerGrpcWeb3GwApi = class extends IndexerGrpcTransactionApi {
200
200
  prepareTxRequest.chainId = BigInt(chainId);
201
201
  prepareTxRequest.signerAddress = address;
202
202
  prepareTxRequest.fee = cosmosTxFee;
203
- prepareTxRequest.msgs = (Array.isArray(message) ? message : [message]).map((message$1) => stringToUint8Array(JSON.stringify(message$1, (_, value) => typeof value === "bigint" ? value.toString() : value)));
203
+ prepareTxRequest.msgs = (Array.isArray(message) ? message : [message]).map((message$1) => stringToUint8Array(safeBigIntStringify(message$1)));
204
204
  if (timeoutHeight !== void 0) prepareTxRequest.timeoutHeight = BigInt(timeoutHeight);
205
205
  if (memo) prepareTxRequest.memo = typeof memo === "number" ? memo.toString() : memo;
206
206
  if (eip712Version) prepareTxRequest.eip712Wrapper = eip712Version;
@@ -345,6 +345,7 @@ const protoTypeToAminoType = (type) => {
345
345
  //#region src/core/modules/utils.ts
346
346
  function prepareSignBytes(obj) {
347
347
  if (Array.isArray(obj)) return obj.map(prepareSignBytes);
348
+ if (typeof obj === "bigint") return obj.toString();
348
349
  if (typeof obj !== `object` || obj === null) return obj;
349
350
  const sorted = {};
350
351
  Object.keys(obj).sort().forEach((key) => {