@reown/appkit-common-react-native 0.0.0-fix-approved-networks-20250822000414 → 0.0.0-fix-improvements-20250827190629

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 (292) hide show
  1. package/lib/commonjs/adapters/BlockchainAdapter.js +94 -0
  2. package/lib/commonjs/adapters/BlockchainAdapter.js.map +1 -0
  3. package/lib/commonjs/adapters/EvmAdapter.js +193 -0
  4. package/lib/commonjs/adapters/EvmAdapter.js.map +1 -0
  5. package/lib/commonjs/adapters/SolanaBaseAdapter.js +10 -0
  6. package/lib/commonjs/adapters/SolanaBaseAdapter.js.map +1 -0
  7. package/lib/commonjs/contracts/erc20.js.map +1 -1
  8. package/lib/commonjs/contracts/usdt.js.map +1 -1
  9. package/lib/commonjs/index.js +66 -5
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/networks/bitcoin.js +40 -0
  12. package/lib/commonjs/networks/bitcoin.js.map +1 -0
  13. package/lib/commonjs/networks/solana.js +78 -0
  14. package/lib/commonjs/networks/solana.js.map +1 -0
  15. package/lib/commonjs/package.json +1 -0
  16. package/lib/commonjs/types/api/blockchain-api.js +15 -0
  17. package/lib/commonjs/types/api/blockchain-api.js.map +1 -0
  18. package/lib/commonjs/types/api/events.js +6 -0
  19. package/lib/commonjs/types/api/events.js.map +1 -0
  20. package/lib/commonjs/types/api/index.js +39 -0
  21. package/lib/commonjs/types/api/index.js.map +1 -0
  22. package/lib/commonjs/types/api/wallet-api.js +6 -0
  23. package/lib/commonjs/types/api/wallet-api.js.map +1 -0
  24. package/lib/commonjs/types/blockchain/adapter.js +6 -0
  25. package/lib/commonjs/types/blockchain/adapter.js.map +1 -0
  26. package/lib/commonjs/types/blockchain/balance.js +6 -0
  27. package/lib/commonjs/types/blockchain/balance.js.map +1 -0
  28. package/lib/commonjs/types/blockchain/index.js +50 -0
  29. package/lib/commonjs/types/blockchain/index.js.map +1 -0
  30. package/lib/commonjs/types/blockchain/network.js +6 -0
  31. package/lib/commonjs/types/blockchain/network.js.map +1 -0
  32. package/lib/commonjs/types/blockchain/transaction.js +2 -0
  33. package/lib/commonjs/types/blockchain/transaction.js.map +1 -0
  34. package/lib/commonjs/types/common.js +2 -0
  35. package/lib/commonjs/types/common.js.map +1 -0
  36. package/lib/commonjs/types/index.js +105 -0
  37. package/lib/commonjs/types/index.js.map +1 -0
  38. package/lib/commonjs/types/onramp/countries.js +2 -0
  39. package/lib/commonjs/types/onramp/countries.js.map +1 -0
  40. package/lib/commonjs/types/onramp/currencies.js +2 -0
  41. package/lib/commonjs/types/onramp/currencies.js.map +1 -0
  42. package/lib/commonjs/types/onramp/errors.js +22 -0
  43. package/lib/commonjs/types/onramp/errors.js.map +1 -0
  44. package/lib/commonjs/types/onramp/index.js +50 -0
  45. package/lib/commonjs/types/onramp/index.js.map +1 -0
  46. package/lib/commonjs/types/onramp/quotes.js +2 -0
  47. package/lib/commonjs/types/onramp/quotes.js.map +1 -0
  48. package/lib/commonjs/types/siwe/config.js +6 -0
  49. package/lib/commonjs/types/siwe/config.js.map +1 -0
  50. package/lib/commonjs/types/siwe/index.js +28 -0
  51. package/lib/commonjs/types/siwe/index.js.map +1 -0
  52. package/lib/commonjs/types/siwe/message.js +6 -0
  53. package/lib/commonjs/types/siwe/message.js.map +1 -0
  54. package/lib/commonjs/types/storage.js +2 -0
  55. package/lib/commonjs/types/storage.js.map +1 -0
  56. package/lib/commonjs/types/swap/index.js +17 -0
  57. package/lib/commonjs/types/swap/index.js.map +1 -0
  58. package/lib/commonjs/types/swap/tokens.js +6 -0
  59. package/lib/commonjs/types/swap/tokens.js.map +1 -0
  60. package/lib/commonjs/types/ui.js +6 -0
  61. package/lib/commonjs/{utils/TypeUtil.js.map → types/ui.js.map} +1 -1
  62. package/lib/commonjs/types/wallet/connection.js +6 -0
  63. package/lib/commonjs/types/wallet/connection.js.map +1 -0
  64. package/lib/commonjs/types/wallet/connector.js +30 -0
  65. package/lib/commonjs/types/wallet/connector.js.map +1 -0
  66. package/lib/commonjs/types/wallet/index.js +39 -0
  67. package/lib/commonjs/types/wallet/index.js.map +1 -0
  68. package/lib/commonjs/types/wallet/wallet-info.js +6 -0
  69. package/lib/commonjs/types/wallet/wallet-info.js.map +1 -0
  70. package/lib/commonjs/utils/ConstantsUtil.js +52 -6
  71. package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
  72. package/lib/commonjs/utils/ContractUtil.js.map +1 -1
  73. package/lib/commonjs/utils/DateUtil.js.map +1 -1
  74. package/lib/commonjs/utils/ErrorUtil.js.map +1 -1
  75. package/lib/commonjs/utils/NamesUtil.js.map +1 -1
  76. package/lib/commonjs/utils/NetworkUtil.js +3 -0
  77. package/lib/commonjs/utils/NetworkUtil.js.map +1 -1
  78. package/lib/commonjs/utils/NumberUtil.js +53 -13
  79. package/lib/commonjs/utils/NumberUtil.js.map +1 -1
  80. package/lib/commonjs/utils/PresetsUtil.js +34 -21
  81. package/lib/commonjs/utils/PresetsUtil.js.map +1 -1
  82. package/lib/commonjs/utils/StringUtil.js +7 -0
  83. package/lib/commonjs/utils/StringUtil.js.map +1 -1
  84. package/lib/module/adapters/BlockchainAdapter.js +89 -0
  85. package/lib/module/adapters/BlockchainAdapter.js.map +1 -0
  86. package/lib/module/adapters/EvmAdapter.js +189 -0
  87. package/lib/module/adapters/EvmAdapter.js.map +1 -0
  88. package/lib/module/adapters/SolanaBaseAdapter.js +5 -0
  89. package/lib/module/adapters/SolanaBaseAdapter.js.map +1 -0
  90. package/lib/module/contracts/erc20.js +2 -0
  91. package/lib/module/contracts/erc20.js.map +1 -1
  92. package/lib/module/contracts/usdt.js +2 -0
  93. package/lib/module/contracts/usdt.js.map +1 -1
  94. package/lib/module/index.js +8 -1
  95. package/lib/module/index.js.map +1 -1
  96. package/lib/module/networks/bitcoin.js +36 -0
  97. package/lib/module/networks/bitcoin.js.map +1 -0
  98. package/lib/module/networks/solana.js +74 -0
  99. package/lib/module/networks/solana.js.map +1 -0
  100. package/lib/module/types/api/blockchain-api.js +10 -0
  101. package/lib/module/types/api/blockchain-api.js.map +1 -0
  102. package/lib/module/types/api/events.js +4 -0
  103. package/lib/module/types/api/events.js.map +1 -0
  104. package/lib/module/types/api/index.js +7 -0
  105. package/lib/module/types/api/index.js.map +1 -0
  106. package/lib/module/types/api/wallet-api.js +4 -0
  107. package/lib/module/types/api/wallet-api.js.map +1 -0
  108. package/lib/module/types/blockchain/adapter.js +4 -0
  109. package/lib/module/types/blockchain/adapter.js.map +1 -0
  110. package/lib/module/types/blockchain/balance.js +4 -0
  111. package/lib/module/types/blockchain/balance.js.map +1 -0
  112. package/lib/module/types/blockchain/index.js +8 -0
  113. package/lib/module/types/blockchain/index.js.map +1 -0
  114. package/lib/module/types/blockchain/network.js +4 -0
  115. package/lib/module/types/blockchain/network.js.map +1 -0
  116. package/lib/module/types/blockchain/transaction.js +2 -0
  117. package/lib/module/types/blockchain/transaction.js.map +1 -0
  118. package/lib/module/types/common.js +2 -0
  119. package/lib/module/types/common.js.map +1 -0
  120. package/lib/module/types/index.js +31 -0
  121. package/lib/module/types/index.js.map +1 -0
  122. package/lib/module/types/onramp/countries.js +2 -0
  123. package/lib/module/types/onramp/countries.js.map +1 -0
  124. package/lib/module/types/onramp/currencies.js +2 -0
  125. package/lib/module/types/onramp/currencies.js.map +1 -0
  126. package/lib/module/types/onramp/errors.js +18 -0
  127. package/lib/module/types/onramp/errors.js.map +1 -0
  128. package/lib/module/types/onramp/index.js +8 -0
  129. package/lib/module/types/onramp/index.js.map +1 -0
  130. package/lib/module/types/onramp/quotes.js +2 -0
  131. package/lib/module/types/onramp/quotes.js.map +1 -0
  132. package/lib/module/types/siwe/config.js +4 -0
  133. package/lib/module/types/siwe/config.js.map +1 -0
  134. package/lib/module/types/siwe/index.js +6 -0
  135. package/lib/module/types/siwe/index.js.map +1 -0
  136. package/lib/module/types/siwe/message.js +4 -0
  137. package/lib/module/types/siwe/message.js.map +1 -0
  138. package/lib/module/types/storage.js +2 -0
  139. package/lib/module/types/storage.js.map +1 -0
  140. package/lib/module/types/swap/index.js +5 -0
  141. package/lib/module/types/swap/index.js.map +1 -0
  142. package/lib/module/types/swap/tokens.js +4 -0
  143. package/lib/module/types/swap/tokens.js.map +1 -0
  144. package/lib/module/types/ui.js +4 -0
  145. package/lib/module/{utils/TypeUtil.js.map → types/ui.js.map} +1 -1
  146. package/lib/module/types/wallet/connection.js +4 -0
  147. package/lib/module/types/wallet/connection.js.map +1 -0
  148. package/lib/module/types/wallet/connector.js +25 -0
  149. package/lib/module/types/wallet/connector.js.map +1 -0
  150. package/lib/module/types/wallet/index.js +7 -0
  151. package/lib/module/types/wallet/index.js.map +1 -0
  152. package/lib/module/types/wallet/wallet-info.js +4 -0
  153. package/lib/module/types/wallet/wallet-info.js.map +1 -0
  154. package/lib/module/utils/ConstantsUtil.js +54 -6
  155. package/lib/module/utils/ConstantsUtil.js.map +1 -1
  156. package/lib/module/utils/ContractUtil.js +2 -0
  157. package/lib/module/utils/ContractUtil.js.map +1 -1
  158. package/lib/module/utils/DateUtil.js +2 -0
  159. package/lib/module/utils/DateUtil.js.map +1 -1
  160. package/lib/module/utils/ErrorUtil.js +2 -0
  161. package/lib/module/utils/ErrorUtil.js.map +1 -1
  162. package/lib/module/utils/NamesUtil.js +2 -0
  163. package/lib/module/utils/NamesUtil.js.map +1 -1
  164. package/lib/module/utils/NetworkUtil.js +5 -0
  165. package/lib/module/utils/NetworkUtil.js.map +1 -1
  166. package/lib/module/utils/NumberUtil.js +54 -11
  167. package/lib/module/utils/NumberUtil.js.map +1 -1
  168. package/lib/module/utils/PresetsUtil.js +36 -21
  169. package/lib/module/utils/PresetsUtil.js.map +1 -1
  170. package/lib/module/utils/StringUtil.js +9 -0
  171. package/lib/module/utils/StringUtil.js.map +1 -1
  172. package/lib/typescript/adapters/BlockchainAdapter.d.ts +26 -0
  173. package/lib/typescript/adapters/BlockchainAdapter.d.ts.map +1 -0
  174. package/lib/typescript/adapters/EvmAdapter.d.ts +26 -0
  175. package/lib/typescript/adapters/EvmAdapter.d.ts.map +1 -0
  176. package/lib/typescript/adapters/SolanaBaseAdapter.d.ts +6 -0
  177. package/lib/typescript/adapters/SolanaBaseAdapter.d.ts.map +1 -0
  178. package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts +2 -0
  179. package/lib/typescript/adapters/__tests__/EvmAdapter.test.d.ts.map +1 -0
  180. package/lib/typescript/index.d.ts +6 -1
  181. package/lib/typescript/index.d.ts.map +1 -1
  182. package/lib/typescript/networks/bitcoin.d.ts +4 -0
  183. package/lib/typescript/networks/bitcoin.d.ts.map +1 -0
  184. package/lib/typescript/networks/solana.d.ts +5 -0
  185. package/lib/typescript/networks/solana.d.ts.map +1 -0
  186. package/lib/typescript/types/api/blockchain-api.d.ts +183 -0
  187. package/lib/typescript/types/api/blockchain-api.d.ts.map +1 -0
  188. package/lib/typescript/types/api/events.d.ts +304 -0
  189. package/lib/typescript/types/api/events.d.ts.map +1 -0
  190. package/lib/typescript/types/api/index.d.ts +4 -0
  191. package/lib/typescript/types/api/index.d.ts.map +1 -0
  192. package/lib/typescript/types/api/wallet-api.d.ts +50 -0
  193. package/lib/typescript/types/api/wallet-api.d.ts.map +1 -0
  194. package/lib/typescript/types/blockchain/adapter.d.ts +40 -0
  195. package/lib/typescript/types/blockchain/adapter.d.ts.map +1 -0
  196. package/lib/typescript/types/blockchain/balance.d.ts +28 -0
  197. package/lib/typescript/types/blockchain/balance.d.ts.map +1 -0
  198. package/lib/typescript/types/blockchain/index.d.ts +5 -0
  199. package/lib/typescript/types/blockchain/index.d.ts.map +1 -0
  200. package/lib/typescript/types/blockchain/network.d.ts +47 -0
  201. package/lib/typescript/types/blockchain/network.d.ts.map +1 -0
  202. package/lib/typescript/{utils/TypeUtil.d.ts → types/blockchain/transaction.d.ts} +1 -22
  203. package/lib/typescript/types/blockchain/transaction.d.ts.map +1 -0
  204. package/lib/typescript/types/common.d.ts +24 -0
  205. package/lib/typescript/types/common.d.ts.map +1 -0
  206. package/lib/typescript/types/index.d.ts +10 -0
  207. package/lib/typescript/types/index.d.ts.map +1 -0
  208. package/lib/typescript/types/onramp/countries.d.ts +11 -0
  209. package/lib/typescript/types/onramp/countries.d.ts.map +1 -0
  210. package/lib/typescript/types/onramp/currencies.d.ts +30 -0
  211. package/lib/typescript/types/onramp/currencies.d.ts.map +1 -0
  212. package/lib/typescript/types/onramp/errors.d.ts +21 -0
  213. package/lib/typescript/types/onramp/errors.d.ts.map +1 -0
  214. package/lib/typescript/types/onramp/index.d.ts +5 -0
  215. package/lib/typescript/types/onramp/index.d.ts.map +1 -0
  216. package/lib/typescript/types/onramp/quotes.d.ts +45 -0
  217. package/lib/typescript/types/onramp/quotes.d.ts.map +1 -0
  218. package/lib/typescript/types/siwe/config.d.ts +31 -0
  219. package/lib/typescript/types/siwe/config.d.ts.map +1 -0
  220. package/lib/typescript/types/siwe/index.d.ts +3 -0
  221. package/lib/typescript/types/siwe/index.d.ts.map +1 -0
  222. package/lib/typescript/types/siwe/message.d.ts +57 -0
  223. package/lib/typescript/types/siwe/message.d.ts.map +1 -0
  224. package/lib/typescript/types/storage.d.ts +27 -0
  225. package/lib/typescript/types/storage.d.ts.map +1 -0
  226. package/lib/typescript/types/swap/index.d.ts +2 -0
  227. package/lib/typescript/types/swap/index.d.ts.map +1 -0
  228. package/lib/typescript/types/swap/tokens.d.ts +19 -0
  229. package/lib/typescript/types/swap/tokens.d.ts.map +1 -0
  230. package/lib/typescript/types/ui.d.ts +26 -0
  231. package/lib/typescript/types/ui.d.ts.map +1 -0
  232. package/lib/typescript/types/wallet/connection.d.ts +30 -0
  233. package/lib/typescript/types/wallet/connection.d.ts.map +1 -0
  234. package/lib/typescript/types/wallet/connector.d.ts +61 -0
  235. package/lib/typescript/types/wallet/connector.d.ts.map +1 -0
  236. package/lib/typescript/types/wallet/index.d.ts +4 -0
  237. package/lib/typescript/types/wallet/index.d.ts.map +1 -0
  238. package/lib/typescript/types/wallet/wallet-info.d.ts +36 -0
  239. package/lib/typescript/types/wallet/wallet-info.d.ts.map +1 -0
  240. package/lib/typescript/utils/ConstantsUtil.d.ts +48 -4
  241. package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
  242. package/lib/typescript/utils/NetworkUtil.d.ts +2 -0
  243. package/lib/typescript/utils/NetworkUtil.d.ts.map +1 -1
  244. package/lib/typescript/utils/NumberUtil.d.ts +39 -11
  245. package/lib/typescript/utils/NumberUtil.d.ts.map +1 -1
  246. package/lib/typescript/utils/PresetsUtil.d.ts +1 -6
  247. package/lib/typescript/utils/PresetsUtil.d.ts.map +1 -1
  248. package/lib/typescript/utils/StringUtil.d.ts +1 -0
  249. package/lib/typescript/utils/StringUtil.d.ts.map +1 -1
  250. package/package.json +6 -16
  251. package/src/adapters/BlockchainAdapter.ts +126 -0
  252. package/src/adapters/EvmAdapter.ts +247 -0
  253. package/src/adapters/SolanaBaseAdapter.ts +6 -0
  254. package/src/adapters/__tests__/EvmAdapter.test.ts +126 -0
  255. package/src/index.ts +7 -1
  256. package/src/networks/bitcoin.ts +32 -0
  257. package/src/networks/solana.ts +44 -0
  258. package/src/types/api/blockchain-api.ts +213 -0
  259. package/src/types/api/events.ts +394 -0
  260. package/src/types/api/index.ts +4 -0
  261. package/src/types/api/wallet-api.ts +70 -0
  262. package/src/types/blockchain/adapter.ts +52 -0
  263. package/src/types/blockchain/balance.ts +31 -0
  264. package/src/types/blockchain/index.ts +5 -0
  265. package/src/types/blockchain/network.ts +39 -0
  266. package/src/{utils/TypeUtil.ts → types/blockchain/transaction.ts} +0 -26
  267. package/src/types/common.ts +56 -0
  268. package/src/types/index.ts +28 -0
  269. package/src/types/onramp/countries.ts +11 -0
  270. package/src/types/onramp/currencies.ts +32 -0
  271. package/src/types/onramp/errors.ts +22 -0
  272. package/src/types/onramp/index.ts +5 -0
  273. package/src/types/onramp/quotes.ts +46 -0
  274. package/src/types/siwe/config.ts +44 -0
  275. package/src/types/siwe/index.ts +3 -0
  276. package/src/types/siwe/message.ts +62 -0
  277. package/src/types/storage.ts +30 -0
  278. package/src/types/swap/index.ts +2 -0
  279. package/src/types/swap/tokens.ts +21 -0
  280. package/src/types/ui.ts +26 -0
  281. package/src/types/wallet/connection.ts +33 -0
  282. package/src/types/wallet/connector.ts +85 -0
  283. package/src/types/wallet/index.ts +4 -0
  284. package/src/types/wallet/wallet-info.ts +41 -0
  285. package/src/utils/ConstantsUtil.ts +55 -8
  286. package/src/utils/NetworkUtil.ts +5 -0
  287. package/src/utils/NumberUtil.ts +54 -11
  288. package/src/utils/PresetsUtil.ts +34 -26
  289. package/src/utils/StringUtil.ts +7 -0
  290. package/lib/commonjs/utils/TypeUtil.js +0 -2
  291. package/lib/module/utils/TypeUtil.js +0 -2
  292. package/lib/typescript/utils/TypeUtil.d.ts.map +0 -1
@@ -1,6 +1,12 @@
1
1
  import * as BigNumber from 'bignumber.js';
2
2
 
3
3
  export const NumberUtil = {
4
+ /**
5
+ * Creates a BigNumber instance from a given value.
6
+ * If the value is a string, commas are removed before conversion.
7
+ * @param value - The input value (string, number, or BigNumber) to convert to a BigNumber.
8
+ * @returns A BigNumber instance.
9
+ */
4
10
  bigNumber(value: BigNumber.BigNumber.Value) {
5
11
  if (typeof value === 'string') {
6
12
  return new BigNumber.BigNumber(value.replace(/,/g, ''));
@@ -10,10 +16,11 @@ export const NumberUtil = {
10
16
  },
11
17
 
12
18
  /**
13
- * Multiply two numbers represented as strings with BigNumber to handle decimals correctly
14
- * @param a string
15
- * @param b string
16
- * @returns
19
+ * Multiplies two numbers using BigNumber for precision, especially with decimals.
20
+ * Handles undefined inputs by returning BigNumber(0).
21
+ * @param a - The first multiplicand (string, number, or BigNumber). Commas are removed if it's a string.
22
+ * @param b - The second multiplicand (string, number, or BigNumber). Commas are removed if it's a string.
23
+ * @returns The product as a BigNumber instance, or BigNumber(0) if either input is undefined.
17
24
  */
18
25
  multiply(a: BigNumber.BigNumber.Value | undefined, b: BigNumber.BigNumber.Value | undefined) {
19
26
  if (a === undefined || b === undefined) {
@@ -26,6 +33,13 @@ export const NumberUtil = {
26
33
  return aBigNumber.multipliedBy(bBigNumber);
27
34
  },
28
35
 
36
+ /**
37
+ * Rounds a number to a specified number of decimal places if its string representation meets a certain length threshold.
38
+ * @param number - The number to potentially round.
39
+ * @param threshold - The minimum string length of the number to trigger rounding.
40
+ * @param fixed - The number of decimal places to round to.
41
+ * @returns The rounded number (as a string if rounded, otherwise the original number) or the original number.
42
+ */
29
43
  roundNumber(number: number, threshold: number, fixed: number) {
30
44
  const roundedNumber =
31
45
  number.toString().length >= threshold ? Number(number).toFixed(fixed) : number;
@@ -33,6 +47,12 @@ export const NumberUtil = {
33
47
  return roundedNumber;
34
48
  },
35
49
 
50
+ /**
51
+ * Calculates the next multiple of ten greater than or equal to the given amount.
52
+ * Defaults to 10 if no amount is provided or if the calculated multiple is less than 10.
53
+ * @param amount - The number for which to find the next multiple of ten. Optional.
54
+ * @returns The next multiple of ten, at least 10.
55
+ */
36
56
  nextMultipleOfTen(amount?: number) {
37
57
  if (!amount) return 10;
38
58
 
@@ -40,10 +60,10 @@ export const NumberUtil = {
40
60
  },
41
61
 
42
62
  /**
43
- * Format the given number or string to human readable numbers with the given number of decimals
44
- * @param value - The value to format. It could be a number or string. If it's a string, it will be parsed to a float then formatted.
45
- * @param decimals - number of decimals after dot
46
- * @returns
63
+ * Formats a number or string to a human-readable string with a specified number of decimal places, using US locale formatting.
64
+ * @param value - The value to format (string, number, or undefined). If undefined, returns '0.00'.
65
+ * @param decimals - The number of decimal places to display. Defaults to 2.
66
+ * @returns A locale-formatted string representation of the number.
47
67
  */
48
68
  formatNumberToLocalString(value: string | number | undefined, decimals = 2) {
49
69
  if (value === undefined) {
@@ -62,10 +82,11 @@ export const NumberUtil = {
62
82
  minimumFractionDigits: decimals
63
83
  });
64
84
  },
85
+
65
86
  /**
66
- * Parse a formatted local string back to a number
67
- * @param value - The formatted string to parse
68
- * @returns
87
+ * Parses a locale-formatted numeric string (e.g., with commas) back into a number.
88
+ * @param value - The formatted string to parse. If undefined, returns 0.
89
+ * @returns The parsed number, or 0 if the input is undefined.
69
90
  */
70
91
  parseLocalStringToNumber(value: string | undefined) {
71
92
  if (value === undefined) {
@@ -74,5 +95,27 @@ export const NumberUtil = {
74
95
 
75
96
  // Remove any commas used as thousand separators and parse the float
76
97
  return parseFloat(value.replace(/,/gu, ''));
98
+ },
99
+
100
+ /**
101
+ * Converts a numeric value (BigInt, number, or string representation of a number) to a 0x-prefixed hexadecimal string.
102
+ * This is often required for Ethereum RPC parameters like value, gas, gasPrice.
103
+ * @param value - The value to convert. Can be BigInt, number, or a string (decimal or hex).
104
+ * @returns A 0x-prefixed hexadecimal string, or undefined if the input is undefined or null.
105
+ * @throws Error if the value cannot be converted to BigInt.
106
+ */
107
+ convertNumericToHexString: (value: any): string | undefined => {
108
+ if (value === undefined || value === null) {
109
+ return undefined;
110
+ }
111
+ try {
112
+ // This handles BigInt, number, or string representation of a number (decimal or hex)
113
+ const bigIntValue = BigInt(value);
114
+ // Ethereum RPC spec requires "0x0" for zero, and other values to be 0x-prefixed hex.
115
+
116
+ return '0x' + bigIntValue.toString(16);
117
+ } catch (error) {
118
+ throw new Error(`NumberUtil: Invalid parameter, cannot convert to hex: ${value}`);
119
+ }
77
120
  }
78
121
  };
@@ -1,17 +1,9 @@
1
- import type { ConnectorType } from './TypeUtil';
2
- import { ConstantsUtil } from './ConstantsUtil';
3
-
4
1
  export const PresetsUtil = {
5
- ConnectorExplorerIds: {
6
- [ConstantsUtil.COINBASE_CONNECTOR_ID]:
7
- 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa'
8
- } as Record<string, string>,
9
-
10
- EIP155NetworkImageIds: {
2
+ NetworkImageIds: {
11
3
  // Ethereum
12
4
  1: 'ba0ba0cd-17c6-4806-ad93-f9d174f17900',
13
5
  // Arbitrum
14
- 42161: '600a9a04-c1b9-42ca-6785-9b4b6ff85200',
6
+ 42161: '3bff954d-5cb0-47a0-9a23-d20192e74600',
15
7
  // Avalanche
16
8
  43114: '30c46e53-e989-45fb-4549-be3bd4eb3b00',
17
9
  // Binance Smart Chain
@@ -22,6 +14,20 @@ export const PresetsUtil = {
22
14
  10: 'ab9c186a-c52f-464b-2906-ca59d760a400',
23
15
  // Polygon
24
16
  137: '41d04d42-da3b-4453-8506-668cc0727900',
17
+ // Mantle
18
+ 5000: 'e86fae9b-b770-4eea-e520-150e12c81100',
19
+ // Hedera Mainnet
20
+ 295: '6a97d510-cac8-4e58-c7ce-e8681b044c00',
21
+ // Sepolia
22
+ 11_155_111: 'e909ea0a-f92a-4512-c8fc-748044ea6800',
23
+ // Base Sepolia
24
+ 84532: 'a18a7ecd-e307-4360-4746-283182228e00',
25
+ // Unichain Sepolia
26
+ 1301: '4eeea7ef-0014-4649-5d1d-07271a80f600',
27
+ // Unichain Mainnet
28
+ 130: '2257980a-3463-48c6-cbac-a42d2a956e00',
29
+ // Monad Testnet
30
+ 10_143: '0a728e83-bacb-46db-7844-948f05434900',
25
31
  // Gnosis
26
32
  100: '02b53f6a-e3d4-479e-1cb4-21178987d100',
27
33
  // EVMos
@@ -45,26 +51,28 @@ export const PresetsUtil = {
45
51
  // Base
46
52
  8453: '7289c336-3981-4081-c5f4-efc26ac64a00',
47
53
  // Aurora
48
- 1313161554: '3ff73439-a619-4894-9262-4470c773a100'
49
- } as Record<string, string>,
54
+ 1313161554: '3ff73439-a619-4894-9262-4470c773a100',
55
+ // Ronin Mainnet
56
+ 2020: 'b8101fc0-9c19-4b6f-ec65-f6dfff106e00',
57
+ // Saigon Testnet (a.k.a. Ronin)
58
+ 2021: 'b8101fc0-9c19-4b6f-ec65-f6dfff106e00',
59
+ // Berachain Mainnet
60
+ 80094: 'e329c2c9-59b0-4a02-83e4-212ff3779900',
61
+ // Abstract Mainnet
62
+ 2741: 'fc2427d1-5af9-4a9c-8da5-6f94627cd900',
50
63
 
51
- ConnectorNamesMap: {
52
- [ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'WalletConnect',
53
- [ConstantsUtil.COINBASE_CONNECTOR_ID]: 'Coinbase Wallet',
54
- [ConstantsUtil.AUTH_CONNECTOR_ID]: 'AppKit Universal Wallet'
55
- } as Record<string, string>,
64
+ // Solana networks
65
+ /// Mainnet
66
+ '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': 'a1b58899-f671-4276-6a5e-56ca5bd59700',
67
+ /// Testnet
68
+ '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z': 'a1b58899-f671-4276-6a5e-56ca5bd59700',
56
69
 
57
- ConnectorImageIds: {
58
- [ConstantsUtil.COINBASE_CONNECTOR_ID]: '0c2840c3-5b04-4c44-9661-fbd4b49e1800',
59
- [ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400'
70
+ // Bitcoin
71
+ '000000000019d6689c085ae165831e93': '0b4838db-0161-4ffe-022d-532bf03dba00',
72
+ // Bitcoin Testnet
73
+ '000000000933ea01ad0ee984209779ba': '39354064-d79b-420b-065d-f980c4b78200'
60
74
  } as Record<string, string>,
61
75
 
62
- ConnectorTypesMap: {
63
- [ConstantsUtil.WALLET_CONNECT_CONNECTOR_ID]: 'WALLET_CONNECT',
64
- [ConstantsUtil.COINBASE_CONNECTOR_ID]: 'COINBASE',
65
- [ConstantsUtil.AUTH_CONNECTOR_ID]: 'AUTH'
66
- } as Record<string, ConnectorType>,
67
-
68
76
  RpcChainIds: [
69
77
  // Ethereum
70
78
  1,
@@ -5,5 +5,12 @@ export const StringUtil = {
5
5
  }
6
6
 
7
7
  return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
8
+ },
9
+ hexToString(hexValue: string) {
10
+ // Remove 0x prefix if present
11
+ const cleanHex = hexValue.startsWith('0x') ? hexValue.slice(2) : hexValue;
12
+ // Convert hex to decimal number, then to string
13
+
14
+ return parseInt(cleanHex, 16).toString();
8
15
  }
9
16
  };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=TypeUtil.js.map
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=TypeUtil.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypeUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/TypeUtil.ts"],"names":[],"mappings":"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"}