@multiversx/sdk-dapp-liquidity 1.1.0-alpha.2 → 1.1.0-alpha.21

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 (234) hide show
  1. package/README.md +6 -1
  2. package/api/getTransactions.d.ts +8 -2
  3. package/api/getTransactions.js +23 -3
  4. package/api/getTransactions.mjs +23 -3
  5. package/api/tests/getChains.spec.js +2 -1
  6. package/api/tests/getChains.spec.mjs +2 -1
  7. package/api/tests/getTokens.spec.js +2 -2
  8. package/api/tests/getTokens.spec.mjs +2 -2
  9. package/api/tests/getTransactions.spec.js +79 -69
  10. package/api/tests/getTransactions.spec.mjs +79 -69
  11. package/constants/index.d.ts +1 -1
  12. package/constants/index.js +1 -1
  13. package/constants/index.mjs +1 -1
  14. package/dto/Chain.dto.d.ts +3 -1
  15. package/dto/ConfirmRate.dto.d.ts +1 -0
  16. package/dto/Token.dto.d.ts +7 -2
  17. package/index.js +44 -16
  18. package/index.mjs +14 -16
  19. package/package.json +10 -6
  20. package/reactjs/components/BridgeForm/BridgeForm.d.ts +3 -1
  21. package/reactjs/components/BridgeForm/BridgeForm.js +182 -87
  22. package/reactjs/components/BridgeForm/BridgeForm.mjs +153 -58
  23. package/reactjs/components/BridgeHistory/BridgeHistory.js +73 -26
  24. package/reactjs/components/BridgeHistory/BridgeHistory.mjs +68 -21
  25. package/reactjs/components/Connect/BridgeAccountDisplay.js +2 -5
  26. package/reactjs/components/Connect/BridgeAccountDisplay.mjs +2 -5
  27. package/reactjs/components/Connect/CustomConnectButton.js +2 -5
  28. package/reactjs/components/Connect/CustomConnectButton.mjs +1 -4
  29. package/reactjs/components/Connect/MvxConnectButton.d.ts +2 -4
  30. package/reactjs/components/Connect/MvxConnectButton.js +2 -2
  31. package/reactjs/components/Connect/MvxConnectButton.mjs +2 -2
  32. package/reactjs/components/Connect/SwitchChainButton.js +2 -6
  33. package/reactjs/components/Connect/SwitchChainButton.mjs +1 -5
  34. package/reactjs/components/CopyButton/CopyButton.js +2 -2
  35. package/reactjs/components/CopyButton/CopyButton.mjs +2 -2
  36. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +5 -5
  37. package/reactjs/components/Error/Error.d.ts +6 -0
  38. package/reactjs/components/Error/Error.js +67 -0
  39. package/reactjs/components/Error/Error.mjs +66 -0
  40. package/reactjs/components/Error/index.d.ts +1 -0
  41. package/reactjs/components/Error/index.js +5 -0
  42. package/reactjs/components/Error/index.mjs +4 -0
  43. package/reactjs/components/TokenSelector/TokenSelector.d.ts +2 -1
  44. package/reactjs/components/TokenSelector/TokenSelector.js +17 -9
  45. package/reactjs/components/TokenSelector/TokenSelector.mjs +13 -5
  46. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.d.ts +2 -1
  47. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +7 -3
  48. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +4 -0
  49. package/reactjs/components/TokenSelector/components/SelectContent.d.ts +2 -1
  50. package/reactjs/components/TokenSelector/components/SelectContent.js +12 -9
  51. package/reactjs/components/TokenSelector/components/SelectContent.mjs +4 -1
  52. package/reactjs/components/TokenSelector/components/TokenIcon.js +3 -3
  53. package/reactjs/components/TokenSelector/components/TokenItem.js +9 -9
  54. package/reactjs/components/TokenSelector/components/TokenItem.mjs +6 -6
  55. package/reactjs/components/base/MxCard/MxCard.js +2 -2
  56. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.d.ts +4 -0
  57. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +29 -0
  58. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +28 -0
  59. package/reactjs/components/base/MxCircleLoader/index.d.ts +1 -0
  60. package/reactjs/components/base/MxCircleLoader/index.js +5 -0
  61. package/reactjs/components/base/MxCircleLoader/index.mjs +4 -0
  62. package/reactjs/components/base/MxLink/MxLink.js +2 -2
  63. package/reactjs/components/base/MxSearch/MxSearch.js +4 -4
  64. package/reactjs/components/base/MxSlideover/MxSlideover.js +4 -4
  65. package/reactjs/components/base/MxTooltip/MxTooltip.js +9 -9
  66. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +2 -2
  67. package/reactjs/components/index.d.ts +1 -0
  68. package/reactjs/components/index.js +2 -0
  69. package/reactjs/components/index.mjs +2 -0
  70. package/reactjs/context/Web3AppProvider.d.ts +3 -1
  71. package/reactjs/context/Web3AppProvider.js +7 -5
  72. package/reactjs/context/Web3AppProvider.mjs +4 -2
  73. package/reactjs/context/useWeb3App.js +2 -2
  74. package/reactjs/hooks/index.js +1 -1
  75. package/reactjs/hooks/index.mjs +1 -1
  76. package/reactjs/hooks/useAccount.js +1 -5
  77. package/reactjs/hooks/useAccount.mjs +1 -5
  78. package/reactjs/hooks/useBalances.d.ts +4 -4
  79. package/reactjs/hooks/useBalances.js +16 -1
  80. package/reactjs/hooks/useBalances.mjs +16 -1
  81. package/reactjs/hooks/useBridgeFormik.js +9 -16
  82. package/reactjs/hooks/useBridgeFormik.mjs +0 -7
  83. package/reactjs/hooks/useDebounce.js +3 -3
  84. package/reactjs/hooks/useFetchBridgeData.d.ts +14 -4
  85. package/reactjs/hooks/useFetchTokens.d.ts +14 -4
  86. package/reactjs/hooks/useFetchTokens.js +9 -9
  87. package/reactjs/hooks/useFetchTokens.mjs +2 -2
  88. package/reactjs/hooks/useFiatData.d.ts +7 -2
  89. package/reactjs/hooks/useFiatData.js +6 -6
  90. package/reactjs/hooks/useFiatData.mjs +1 -1
  91. package/reactjs/hooks/useGetChainId.js +3 -3
  92. package/reactjs/hooks/useGetChainId.mjs +1 -1
  93. package/reactjs/hooks/useResolveTokenChain.js +2 -2
  94. package/reactjs/hooks/useSendTransactions.js +2 -2
  95. package/reactjs/hooks/useSignTransaction.d.ts +93 -67
  96. package/reactjs/hooks/useSignTransaction.js +53 -4
  97. package/reactjs/hooks/useSignTransaction.mjs +53 -4
  98. package/reactjs/hooks/validation/useTestHasEnoughFunds.js +3 -3
  99. package/reactjs/hooks/validation/useTestIsConnected.js +2 -2
  100. package/reactjs/index.js +44 -16
  101. package/reactjs/index.mjs +14 -16
  102. package/reactjs/init/init.d.ts +220 -1
  103. package/reactjs/init/init.js +34 -10
  104. package/reactjs/init/init.mjs +31 -7
  105. package/reactjs/init/tests/init.spec.js +5 -6
  106. package/reactjs/init/tests/init.spec.mjs +5 -6
  107. package/reactjs/queries/index.d.ts +0 -1
  108. package/reactjs/queries/index.js +0 -2
  109. package/reactjs/queries/index.mjs +1 -3
  110. package/reactjs/queries/useGetEvmTokensBalances.query.d.ts +8 -3
  111. package/reactjs/queries/useGetEvmTokensBalances.query.js +15 -18
  112. package/reactjs/queries/useGetEvmTokensBalances.query.mjs +15 -18
  113. package/reactjs/queries/useGetHistory.query.d.ts +9 -1
  114. package/reactjs/queries/useGetHistory.query.js +23 -5
  115. package/reactjs/queries/useGetHistory.query.mjs +23 -5
  116. package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +7 -2
  117. package/reactjs/queries/useGetMvxTokensBalances.query.js +2 -2
  118. package/reactjs/reexports.d.ts +2 -1
  119. package/reactjs/reexports.js +41 -13
  120. package/reactjs/reexports.mjs +11 -13
  121. package/reactjs/utils/getInitialTokens.d.ts +4 -1
  122. package/reactjs/utils/getInitialTokens.js +3 -3
  123. package/reactjs/utils/getInitialTokens.mjs +3 -3
  124. package/style.css +33 -1730
  125. package/types/chainType.d.ts +6 -0
  126. package/types/chainType.js +11 -0
  127. package/types/chainType.mjs +10 -0
  128. package/types/transaction.d.ts +28 -0
  129. package/types/utxo.d.ts +11 -0
  130. package/types/utxo.js +2 -0
  131. package/types/utxo.mjs +1 -0
  132. package/{useBalances-C_69CFoa.mjs → useBalances-Bom1mw1J.mjs} +101 -23
  133. package/{useBalances-C4YhEYxy.js → useBalances-gZTsFZHe.js} +102 -24
  134. package/index-BIVnypNe.mjs +0 -108
  135. package/index-Ben8n3bd.js +0 -58656
  136. package/index-CnKr4rL1.mjs +0 -91
  137. package/index-CnuruJNu.js +0 -329
  138. package/index-DsBh-EBw.js +0 -108
  139. package/index-iN9APQ6x.mjs +0 -58735
  140. package/modules/fiat/components/FiatForm/FiatForm.d.ts +0 -9
  141. package/modules/fiat/components/FiatForm/FiatForm.js +0 -314
  142. package/modules/fiat/components/FiatForm/FiatForm.mjs +0 -313
  143. package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.d.ts +0 -13
  144. package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.js +0 -117
  145. package/modules/fiat/components/FiatForm/components/AmountInput/AmountInput.mjs +0 -116
  146. package/modules/fiat/components/FiatForm/components/AmountInput/index.d.ts +0 -1
  147. package/modules/fiat/components/FiatForm/components/AmountInput/index.js +0 -5
  148. package/modules/fiat/components/FiatForm/components/AmountInput/index.mjs +0 -4
  149. package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.d.ts +0 -7
  150. package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.js +0 -74
  151. package/modules/fiat/components/FiatForm/components/RateReloading/RateReloading.mjs +0 -73
  152. package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.d.ts +0 -14
  153. package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.js +0 -94
  154. package/modules/fiat/components/FiatForm/components/TokenSelector/TokenSelector.mjs +0 -93
  155. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.d.ts +0 -7
  156. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.js +0 -82
  157. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContainer.mjs +0 -81
  158. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.d.ts +0 -7
  159. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.js +0 -91
  160. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectContent.mjs +0 -90
  161. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.d.ts +0 -5
  162. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.js +0 -30
  163. package/modules/fiat/components/FiatForm/components/TokenSelector/components/SelectedOption.mjs +0 -29
  164. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.d.ts +0 -8
  165. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.js +0 -103
  166. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenIcon.mjs +0 -102
  167. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.d.ts +0 -7
  168. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.js +0 -33
  169. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenItem.mjs +0 -32
  170. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.d.ts +0 -7
  171. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.js +0 -21
  172. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenList.mjs +0 -20
  173. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.d.ts +0 -9
  174. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.js +0 -26
  175. package/modules/fiat/components/FiatForm/components/TokenSelector/components/TokenSymbol.mjs +0 -25
  176. package/modules/fiat/components/FiatForm/components/TokenSelector/index.d.ts +0 -1
  177. package/modules/fiat/components/FiatForm/components/TokenSelector/index.js +0 -5
  178. package/modules/fiat/components/FiatForm/components/TokenSelector/index.mjs +0 -4
  179. package/modules/fiat/components/FiatForm/index.d.ts +0 -1
  180. package/modules/fiat/components/FiatForm/index.js +0 -5
  181. package/modules/fiat/components/FiatForm/index.mjs +0 -4
  182. package/modules/fiat/components/index.d.ts +0 -1
  183. package/modules/fiat/components/index.js +0 -5
  184. package/modules/fiat/components/index.mjs +0 -4
  185. package/modules/fiat/context/FiatProvider.d.ts +0 -8
  186. package/modules/fiat/context/FiatProvider.js +0 -24
  187. package/modules/fiat/context/FiatProvider.mjs +0 -23
  188. package/modules/fiat/context/queryClient.d.ts +0 -3
  189. package/modules/fiat/context/queryClient.js +0 -12
  190. package/modules/fiat/context/queryClient.mjs +0 -11
  191. package/modules/fiat/context/useFiat.d.ts +0 -1
  192. package/modules/fiat/context/useFiat.js +0 -13
  193. package/modules/fiat/context/useFiat.mjs +0 -12
  194. package/modules/fiat/hooks/index.d.ts +0 -2
  195. package/modules/fiat/hooks/index.js +0 -7
  196. package/modules/fiat/hooks/index.mjs +0 -6
  197. package/modules/fiat/hooks/useFiatData.d.ts +0 -7
  198. package/modules/fiat/hooks/useFiatData.js +0 -75
  199. package/modules/fiat/hooks/useFiatData.mjs +0 -74
  200. package/modules/fiat/hooks/validation/index.d.ts +0 -1
  201. package/modules/fiat/hooks/validation/index.js +0 -5
  202. package/modules/fiat/hooks/validation/index.mjs +0 -4
  203. package/modules/fiat/hooks/validation/useAmountSchema.d.ts +0 -2
  204. package/modules/fiat/hooks/validation/useAmountSchema.js +0 -27
  205. package/modules/fiat/hooks/validation/useAmountSchema.mjs +0 -9
  206. package/modules/fiat/index.d.ts +0 -8
  207. package/modules/fiat/index.js +0 -22
  208. package/modules/fiat/index.mjs +0 -21
  209. package/modules/fiat/init/index.d.ts +0 -2
  210. package/modules/fiat/init/index.js +0 -5
  211. package/modules/fiat/init/index.mjs +0 -4
  212. package/modules/fiat/init/init.d.ts +0 -22
  213. package/modules/fiat/init/init.js +0 -15
  214. package/modules/fiat/init/init.mjs +0 -14
  215. package/modules/fiat/queries/index.d.ts +0 -2
  216. package/modules/fiat/queries/index.js +0 -7
  217. package/modules/fiat/queries/index.mjs +0 -6
  218. package/modules/fiat/queries/useGetRate.mutation.d.ts +0 -6
  219. package/modules/fiat/queries/useGetRate.mutation.js +0 -20
  220. package/modules/fiat/queries/useGetRate.mutation.mjs +0 -19
  221. package/modules/fiat/queries/useGetTokens.query.d.ts +0 -5
  222. package/modules/fiat/queries/useGetTokens.query.js +0 -33
  223. package/modules/fiat/queries/useGetTokens.query.mjs +0 -32
  224. package/react-47kZTyAT.mjs +0 -51
  225. package/react-B_iI3-1z.mjs +0 -3133
  226. package/react-BomcNL1v.js +0 -254
  227. package/react-CqKlu0W0.js +0 -51
  228. package/react-R_xxu7fN.js +0 -3133
  229. package/react-cXurUY4Z.mjs +0 -254
  230. package/reactjs/queries/useGetTokens.query.d.ts +0 -3
  231. package/reactjs/queries/useGetTokens.query.js +0 -34
  232. package/reactjs/queries/useGetTokens.query.mjs +0 -33
  233. package/w3m-modal-Bhg44d6I.js +0 -356
  234. package/w3m-modal-Br2Ec3MM.mjs +0 -356
@@ -1,254 +0,0 @@
1
- import require$$0, { useRef, useCallback, useEffect, useMemo, useDebugValue } from "react";
2
- import { aS as getDefaultExportFromCjs, aT as subscribe, aU as snapshot, aV as p, aW as a, aX as w } from "./index-iN9APQ6x.mjs";
3
- var shim = { exports: {} };
4
- var useSyncExternalStoreShim_production_min = {};
5
- /**
6
- * @license React
7
- * use-sync-external-store-shim.production.min.js
8
- *
9
- * Copyright (c) Facebook, Inc. and its affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- */
14
- var hasRequiredUseSyncExternalStoreShim_production_min;
15
- function requireUseSyncExternalStoreShim_production_min() {
16
- if (hasRequiredUseSyncExternalStoreShim_production_min) return useSyncExternalStoreShim_production_min;
17
- hasRequiredUseSyncExternalStoreShim_production_min = 1;
18
- var e = require$$0;
19
- function h(a2, b) {
20
- return a2 === b && (0 !== a2 || 1 / a2 === 1 / b) || a2 !== a2 && b !== b;
21
- }
22
- var k = "function" === typeof Object.is ? Object.is : h, l = e.useState, m = e.useEffect, n = e.useLayoutEffect, p2 = e.useDebugValue;
23
- function q(a2, b) {
24
- var d = b(), f = l({ inst: { value: d, getSnapshot: b } }), c = f[0].inst, g = f[1];
25
- n(function() {
26
- c.value = d;
27
- c.getSnapshot = b;
28
- r(c) && g({ inst: c });
29
- }, [a2, d, b]);
30
- m(function() {
31
- r(c) && g({ inst: c });
32
- return a2(function() {
33
- r(c) && g({ inst: c });
34
- });
35
- }, [a2]);
36
- p2(d);
37
- return d;
38
- }
39
- function r(a2) {
40
- var b = a2.getSnapshot;
41
- a2 = a2.value;
42
- try {
43
- var d = b();
44
- return !k(a2, d);
45
- } catch (f) {
46
- return true;
47
- }
48
- }
49
- function t(a2, b) {
50
- return b();
51
- }
52
- var u = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? t : q;
53
- useSyncExternalStoreShim_production_min.useSyncExternalStore = void 0 !== e.useSyncExternalStore ? e.useSyncExternalStore : u;
54
- return useSyncExternalStoreShim_production_min;
55
- }
56
- var useSyncExternalStoreShim_development = {};
57
- /**
58
- * @license React
59
- * use-sync-external-store-shim.development.js
60
- *
61
- * Copyright (c) Facebook, Inc. and its affiliates.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE file in the root directory of this source tree.
65
- */
66
- var hasRequiredUseSyncExternalStoreShim_development;
67
- function requireUseSyncExternalStoreShim_development() {
68
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
69
- hasRequiredUseSyncExternalStoreShim_development = 1;
70
- if (process.env.NODE_ENV !== "production") {
71
- (function() {
72
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
73
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
74
- }
75
- var React = require$$0;
76
- var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
77
- function error(format) {
78
- {
79
- {
80
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
81
- args[_key2 - 1] = arguments[_key2];
82
- }
83
- printWarning("error", format, args);
84
- }
85
- }
86
- }
87
- function printWarning(level, format, args) {
88
- {
89
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
90
- var stack = ReactDebugCurrentFrame.getStackAddendum();
91
- if (stack !== "") {
92
- format += "%s";
93
- args = args.concat([stack]);
94
- }
95
- var argsWithFormat = args.map(function(item) {
96
- return String(item);
97
- });
98
- argsWithFormat.unshift("Warning: " + format);
99
- Function.prototype.apply.call(console[level], console, argsWithFormat);
100
- }
101
- }
102
- function is(x, y) {
103
- return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
104
- }
105
- var objectIs = typeof Object.is === "function" ? Object.is : is;
106
- var useState = React.useState, useEffect2 = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue2 = React.useDebugValue;
107
- var didWarnOld18Alpha = false;
108
- var didWarnUncachedGetSnapshot = false;
109
- function useSyncExternalStore2(subscribe2, getSnapshot, getServerSnapshot) {
110
- {
111
- if (!didWarnOld18Alpha) {
112
- if (React.startTransition !== void 0) {
113
- didWarnOld18Alpha = true;
114
- error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
115
- }
116
- }
117
- }
118
- var value = getSnapshot();
119
- {
120
- if (!didWarnUncachedGetSnapshot) {
121
- var cachedValue = getSnapshot();
122
- if (!objectIs(value, cachedValue)) {
123
- error("The result of getSnapshot should be cached to avoid an infinite loop");
124
- didWarnUncachedGetSnapshot = true;
125
- }
126
- }
127
- }
128
- var _useState = useState({
129
- inst: {
130
- value,
131
- getSnapshot
132
- }
133
- }), inst = _useState[0].inst, forceUpdate = _useState[1];
134
- useLayoutEffect(function() {
135
- inst.value = value;
136
- inst.getSnapshot = getSnapshot;
137
- if (checkIfSnapshotChanged(inst)) {
138
- forceUpdate({
139
- inst
140
- });
141
- }
142
- }, [subscribe2, value, getSnapshot]);
143
- useEffect2(function() {
144
- if (checkIfSnapshotChanged(inst)) {
145
- forceUpdate({
146
- inst
147
- });
148
- }
149
- var handleStoreChange = function() {
150
- if (checkIfSnapshotChanged(inst)) {
151
- forceUpdate({
152
- inst
153
- });
154
- }
155
- };
156
- return subscribe2(handleStoreChange);
157
- }, [subscribe2]);
158
- useDebugValue2(value);
159
- return value;
160
- }
161
- function checkIfSnapshotChanged(inst) {
162
- var latestGetSnapshot = inst.getSnapshot;
163
- var prevValue = inst.value;
164
- try {
165
- var nextValue = latestGetSnapshot();
166
- return !objectIs(prevValue, nextValue);
167
- } catch (error2) {
168
- return true;
169
- }
170
- }
171
- function useSyncExternalStore$1(subscribe2, getSnapshot, getServerSnapshot) {
172
- return getSnapshot();
173
- }
174
- var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
175
- var isServerEnvironment = !canUseDOM;
176
- var shim2 = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore2;
177
- var useSyncExternalStore$2 = React.useSyncExternalStore !== void 0 ? React.useSyncExternalStore : shim2;
178
- useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
179
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
180
- __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
181
- }
182
- })();
183
- }
184
- return useSyncExternalStoreShim_development;
185
- }
186
- if (process.env.NODE_ENV === "production") {
187
- shim.exports = requireUseSyncExternalStoreShim_production_min();
188
- } else {
189
- shim.exports = requireUseSyncExternalStoreShim_development();
190
- }
191
- var shimExports = shim.exports;
192
- const useSyncExternalStoreExports = /* @__PURE__ */ getDefaultExportFromCjs(shimExports);
193
- const __vite_import_meta_env__ = {};
194
- const { use } = require$$0;
195
- const { useSyncExternalStore } = useSyncExternalStoreExports;
196
- const useAffectedDebugValue = (state, affected) => {
197
- const pathList = useRef();
198
- useEffect(() => {
199
- pathList.current = w(state, affected);
200
- });
201
- useDebugValue(pathList.current);
202
- };
203
- const targetCache = /* @__PURE__ */ new WeakMap();
204
- function useSnapshot(proxyObject, options) {
205
- const notifyInSync = void 0;
206
- const lastSnapshot = useRef();
207
- const lastAffected = useRef();
208
- let inRender = true;
209
- const currSnapshot = useSyncExternalStore(
210
- useCallback(
211
- (callback) => {
212
- const unsub = subscribe(proxyObject, callback);
213
- callback();
214
- return unsub;
215
- },
216
- [proxyObject, notifyInSync]
217
- ),
218
- () => {
219
- const nextSnapshot = snapshot(proxyObject, use);
220
- try {
221
- if (!inRender && lastSnapshot.current && lastAffected.current && !p(
222
- lastSnapshot.current,
223
- nextSnapshot,
224
- lastAffected.current,
225
- /* @__PURE__ */ new WeakMap()
226
- )) {
227
- return lastSnapshot.current;
228
- }
229
- } catch (e) {
230
- }
231
- return nextSnapshot;
232
- },
233
- () => snapshot(proxyObject, use)
234
- );
235
- inRender = false;
236
- const currAffected = /* @__PURE__ */ new WeakMap();
237
- useEffect(() => {
238
- lastSnapshot.current = currSnapshot;
239
- lastAffected.current = currAffected;
240
- });
241
- if ((__vite_import_meta_env__ ? "production" : void 0) !== "production") {
242
- useAffectedDebugValue(currSnapshot, currAffected);
243
- }
244
- const proxyCache = useMemo(() => /* @__PURE__ */ new WeakMap(), []);
245
- return a(
246
- currSnapshot,
247
- currAffected,
248
- proxyCache,
249
- targetCache
250
- );
251
- }
252
- export {
253
- useSnapshot as u
254
- };
@@ -1,3 +0,0 @@
1
- import { AxiosError } from 'axios';
2
-
3
- export declare const useGetTokensQuery: () => import('@tanstack/react-query').UseQueryResult<import('../..').TokenType[], AxiosError<unknown, any>>;
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const reactQuery = require("@tanstack/react-query");
5
- const api_getTokens = require("../../api/getTokens.js");
6
- const helpers_getApiURL = require("../../helpers/getApiURL.js");
7
- const reactjs_hooks_useGetChainId = require("../hooks/useGetChainId.js");
8
- const useGetTokensQuery = () => {
9
- const chainId = reactjs_hooks_useGetChainId.useGetChainId();
10
- const queryFn = async () => {
11
- try {
12
- const { data } = await api_getTokens.getTokens({
13
- url: helpers_getApiURL.getApiURL(),
14
- chainId: Number(chainId)
15
- });
16
- return data;
17
- } catch (error) {
18
- throw error;
19
- }
20
- };
21
- const retry = (_failureCount, error) => {
22
- var _a;
23
- return ((_a = error.response) == null ? void 0 : _a.status) === 404;
24
- };
25
- return reactQuery.useQuery({
26
- queryKey: ["tokens", chainId],
27
- queryFn,
28
- retry,
29
- refetchOnWindowFocus: false,
30
- gcTime: 5 * 60 * 1e3,
31
- staleTime: 0
32
- });
33
- };
34
- exports.useGetTokensQuery = useGetTokensQuery;
@@ -1,33 +0,0 @@
1
- import { useQuery } from "@tanstack/react-query";
2
- import { getTokens } from "../../api/getTokens.mjs";
3
- import { getApiURL } from "../../helpers/getApiURL.mjs";
4
- import { useGetChainId } from "../hooks/useGetChainId.mjs";
5
- const useGetTokensQuery = () => {
6
- const chainId = useGetChainId();
7
- const queryFn = async () => {
8
- try {
9
- const { data } = await getTokens({
10
- url: getApiURL(),
11
- chainId: Number(chainId)
12
- });
13
- return data;
14
- } catch (error) {
15
- throw error;
16
- }
17
- };
18
- const retry = (_failureCount, error) => {
19
- var _a;
20
- return ((_a = error.response) == null ? void 0 : _a.status) === 404;
21
- };
22
- return useQuery({
23
- queryKey: ["tokens", chainId],
24
- queryFn,
25
- retry,
26
- refetchOnWindowFocus: false,
27
- gcTime: 5 * 60 * 1e3,
28
- staleTime: 0
29
- });
30
- };
31
- export {
32
- useGetTokensQuery
33
- };
@@ -1,356 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const index = require("./index-Ben8n3bd.js");
5
- const styles = index.i`
6
- :host {
7
- z-index: var(--w3m-z-index);
8
- display: block;
9
- backface-visibility: hidden;
10
- will-change: opacity;
11
- position: fixed;
12
- top: 0;
13
- left: 0;
14
- right: 0;
15
- bottom: 0;
16
- pointer-events: none;
17
- opacity: 0;
18
- background-color: var(--wui-cover);
19
- transition: opacity 0.2s var(--wui-ease-out-power-2);
20
- will-change: opacity;
21
- }
22
-
23
- :host(.open) {
24
- opacity: 1;
25
- }
26
-
27
- :host(.embedded) {
28
- position: relative;
29
- pointer-events: unset;
30
- background: none;
31
- width: 100%;
32
- opacity: 1;
33
- }
34
-
35
- wui-card {
36
- max-width: var(--w3m-modal-width);
37
- width: 100%;
38
- position: relative;
39
- animation: zoom-in 0.2s var(--wui-ease-out-power-2);
40
- animation-fill-mode: backwards;
41
- outline: none;
42
- transition:
43
- border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1),
44
- background-color var(--wui-duration-lg) var(--wui-ease-out-power-1);
45
- will-change: border-radius, background-color;
46
- }
47
-
48
- :host(.embedded) wui-card {
49
- max-width: 400px;
50
- }
51
-
52
- wui-card[shake='true'] {
53
- animation:
54
- zoom-in 0.2s var(--wui-ease-out-power-2),
55
- w3m-shake 0.5s var(--wui-ease-out-power-2);
56
- }
57
-
58
- wui-flex {
59
- overflow-x: hidden;
60
- overflow-y: auto;
61
- display: flex;
62
- align-items: center;
63
- justify-content: center;
64
- width: 100%;
65
- height: 100%;
66
- }
67
-
68
- @media (max-height: 700px) and (min-width: 431px) {
69
- wui-flex {
70
- align-items: flex-start;
71
- }
72
-
73
- wui-card {
74
- margin: var(--wui-spacing-xxl) 0px;
75
- }
76
- }
77
-
78
- @media (max-width: 430px) {
79
- wui-flex {
80
- align-items: flex-end;
81
- }
82
-
83
- wui-card {
84
- max-width: 100%;
85
- border-bottom-left-radius: var(--local-border-bottom-mobile-radius);
86
- border-bottom-right-radius: var(--local-border-bottom-mobile-radius);
87
- border-bottom: none;
88
- animation: slide-in 0.2s var(--wui-ease-out-power-2);
89
- }
90
-
91
- wui-card[shake='true'] {
92
- animation:
93
- slide-in 0.2s var(--wui-ease-out-power-2),
94
- w3m-shake 0.5s var(--wui-ease-out-power-2);
95
- }
96
- }
97
-
98
- @keyframes zoom-in {
99
- 0% {
100
- transform: scale(0.95) translateY(0);
101
- }
102
- 100% {
103
- transform: scale(1) translateY(0);
104
- }
105
- }
106
-
107
- @keyframes slide-in {
108
- 0% {
109
- transform: scale(1) translateY(50px);
110
- }
111
- 100% {
112
- transform: scale(1) translateY(0);
113
- }
114
- }
115
-
116
- @keyframes w3m-shake {
117
- 0% {
118
- transform: scale(1) rotate(0deg);
119
- }
120
- 20% {
121
- transform: scale(1) rotate(-1deg);
122
- }
123
- 40% {
124
- transform: scale(1) rotate(1.5deg);
125
- }
126
- 60% {
127
- transform: scale(1) rotate(-1.5deg);
128
- }
129
- 80% {
130
- transform: scale(1) rotate(1deg);
131
- }
132
- 100% {
133
- transform: scale(1) rotate(0deg);
134
- }
135
- }
136
-
137
- @keyframes w3m-view-height {
138
- from {
139
- height: var(--prev-height);
140
- }
141
- to {
142
- height: var(--new-height);
143
- }
144
- }
145
- `;
146
- var __decorate = function(decorators, target, key, desc) {
147
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
148
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
149
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
150
- return c > 3 && r && Object.defineProperty(target, key, r), r;
151
- };
152
- const SCROLL_LOCK = "scroll-lock";
153
- exports.W3mModal = class W3mModal extends index.r {
154
- constructor() {
155
- super();
156
- this.unsubscribe = [];
157
- this.abortController = void 0;
158
- this.hasPrefetched = false;
159
- this.enableEmbedded = index.OptionsController.state.enableEmbedded;
160
- this.open = index.ModalController.state.open;
161
- this.caipAddress = index.ChainController.state.activeCaipAddress;
162
- this.caipNetwork = index.ChainController.state.activeCaipNetwork;
163
- this.shake = index.ModalController.state.shake;
164
- this.initializeTheming();
165
- index.ApiController.prefetchAnalyticsConfig();
166
- this.unsubscribe.push(...[
167
- index.ModalController.subscribeKey("open", (val) => val ? this.onOpen() : this.onClose()),
168
- index.ModalController.subscribeKey("shake", (val) => this.shake = val),
169
- index.ChainController.subscribeKey("activeCaipNetwork", (val) => this.onNewNetwork(val)),
170
- index.ChainController.subscribeKey("activeCaipAddress", (val) => this.onNewAddress(val)),
171
- index.OptionsController.subscribeKey("enableEmbedded", (val) => this.enableEmbedded = val)
172
- ]);
173
- }
174
- firstUpdated() {
175
- var _a, _b;
176
- index.AssetUtil.fetchNetworkImage((_b = (_a = this.caipNetwork) == null ? void 0 : _a.assets) == null ? void 0 : _b.imageId);
177
- if (this.caipAddress) {
178
- if (this.enableEmbedded) {
179
- index.ModalController.close();
180
- this.prefetch();
181
- return;
182
- }
183
- this.onNewAddress(this.caipAddress);
184
- }
185
- if (this.open) {
186
- this.onOpen();
187
- }
188
- if (this.enableEmbedded) {
189
- this.prefetch();
190
- }
191
- }
192
- disconnectedCallback() {
193
- this.unsubscribe.forEach((unsubscribe) => unsubscribe());
194
- this.onRemoveKeyboardListener();
195
- }
196
- render() {
197
- this.style.cssText = `
198
- --local-border-bottom-mobile-radius: ${this.enableEmbedded ? "clamp(0px, var(--wui-border-radius-l), 44px)" : "0px"};
199
- `;
200
- if (this.enableEmbedded) {
201
- return index.x`${this.contentTemplate()}
202
- <w3m-tooltip></w3m-tooltip> `;
203
- }
204
- return this.open ? index.x`
205
- <wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
206
- ${this.contentTemplate()}
207
- </wui-flex>
208
- <w3m-tooltip></w3m-tooltip>
209
- ` : null;
210
- }
211
- contentTemplate() {
212
- return index.x` <wui-card
213
- shake="${this.shake}"
214
- data-embedded="${index.o(this.enableEmbedded)}"
215
- role="alertdialog"
216
- aria-modal="true"
217
- tabindex="0"
218
- data-testid="w3m-modal-card"
219
- >
220
- <w3m-header></w3m-header>
221
- <w3m-router></w3m-router>
222
- <w3m-snackbar></w3m-snackbar>
223
- <w3m-alertbar></w3m-alertbar>
224
- </wui-card>`;
225
- }
226
- async onOverlayClick(event) {
227
- if (event.target === event.currentTarget) {
228
- await this.handleClose();
229
- }
230
- }
231
- async handleClose() {
232
- const isUnsupportedChain = index.RouterController.state.view === "UnsupportedChain";
233
- if (isUnsupportedChain || await index.SIWXUtil.isSIWXCloseDisabled()) {
234
- index.ModalController.shake();
235
- } else {
236
- index.ModalController.close();
237
- }
238
- }
239
- initializeTheming() {
240
- const { themeVariables, themeMode } = index.ThemeController.state;
241
- const defaultThemeMode = index.UiHelperUtil.getColorTheme(themeMode);
242
- index.initializeTheming(themeVariables, defaultThemeMode);
243
- }
244
- onClose() {
245
- this.open = false;
246
- this.classList.remove("open");
247
- this.onScrollUnlock();
248
- index.SnackController.hide();
249
- this.onRemoveKeyboardListener();
250
- }
251
- onOpen() {
252
- this.prefetch();
253
- this.open = true;
254
- this.classList.add("open");
255
- this.onScrollLock();
256
- this.onAddKeyboardListener();
257
- }
258
- onScrollLock() {
259
- const styleTag = document.createElement("style");
260
- styleTag.dataset["w3m"] = SCROLL_LOCK;
261
- styleTag.textContent = `
262
- body {
263
- touch-action: none;
264
- overflow: hidden;
265
- overscroll-behavior: contain;
266
- }
267
- w3m-modal {
268
- pointer-events: auto;
269
- }
270
- `;
271
- document.head.appendChild(styleTag);
272
- }
273
- onScrollUnlock() {
274
- const styleTag = document.head.querySelector(`style[data-w3m="${SCROLL_LOCK}"]`);
275
- if (styleTag) {
276
- styleTag.remove();
277
- }
278
- }
279
- onAddKeyboardListener() {
280
- var _a;
281
- this.abortController = new AbortController();
282
- const card = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("wui-card");
283
- card == null ? void 0 : card.focus();
284
- window.addEventListener("keydown", (event) => {
285
- if (event.key === "Escape") {
286
- this.handleClose();
287
- } else if (event.key === "Tab") {
288
- const { tagName } = event.target;
289
- if (tagName && !tagName.includes("W3M-") && !tagName.includes("WUI-")) {
290
- card == null ? void 0 : card.focus();
291
- }
292
- }
293
- }, this.abortController);
294
- }
295
- onRemoveKeyboardListener() {
296
- var _a;
297
- (_a = this.abortController) == null ? void 0 : _a.abort();
298
- this.abortController = void 0;
299
- }
300
- async onNewAddress(caipAddress) {
301
- const isSwitchingNamespace = index.ChainController.state.isSwitchingNamespace;
302
- const nextConnected = index.CoreHelperUtil.getPlainAddress(caipAddress);
303
- const isDisconnectedInSameNamespace = !nextConnected && !isSwitchingNamespace;
304
- const isSwitchingNamespaceAndConnected = isSwitchingNamespace && nextConnected;
305
- if (isDisconnectedInSameNamespace) {
306
- index.ModalController.close();
307
- } else if (isSwitchingNamespaceAndConnected) {
308
- index.RouterController.goBack();
309
- }
310
- await index.SIWXUtil.initializeIfEnabled();
311
- this.caipAddress = caipAddress;
312
- index.ChainController.setIsSwitchingNamespace(false);
313
- }
314
- onNewNetwork(nextCaipNetwork) {
315
- var _a, _b, _c, _d, _e;
316
- index.AssetUtil.fetchNetworkImage((_a = nextCaipNetwork == null ? void 0 : nextCaipNetwork.assets) == null ? void 0 : _a.imageId);
317
- const prevCaipNetworkId = (_c = (_b = this.caipNetwork) == null ? void 0 : _b.caipNetworkId) == null ? void 0 : _c.toString();
318
- const nextNetworkId = (_d = nextCaipNetwork == null ? void 0 : nextCaipNetwork.caipNetworkId) == null ? void 0 : _d.toString();
319
- const networkChanged = prevCaipNetworkId && nextNetworkId && prevCaipNetworkId !== nextNetworkId;
320
- const isSwitchingNamespace = index.ChainController.state.isSwitchingNamespace;
321
- const isUnsupportedNetwork = ((_e = this.caipNetwork) == null ? void 0 : _e.name) === index.ConstantsUtil.UNSUPPORTED_NETWORK_NAME;
322
- const isConnectingExternal = index.RouterController.state.view === "ConnectingExternal";
323
- const isNotConnected = !this.caipAddress;
324
- const isNetworkChangedInSameNamespace = networkChanged && !isUnsupportedNetwork && !isSwitchingNamespace;
325
- const isUnsupportedNetworkScreen = index.RouterController.state.view === "UnsupportedChain";
326
- if (!isConnectingExternal && (isNotConnected || isUnsupportedNetworkScreen || isNetworkChangedInSameNamespace)) {
327
- index.RouterController.goBack();
328
- }
329
- this.caipNetwork = nextCaipNetwork;
330
- }
331
- prefetch() {
332
- if (!this.hasPrefetched) {
333
- this.hasPrefetched = true;
334
- index.ApiController.prefetch();
335
- }
336
- }
337
- };
338
- exports.W3mModal.styles = styles;
339
- __decorate([
340
- index.n({ type: Boolean })
341
- ], exports.W3mModal.prototype, "enableEmbedded", void 0);
342
- __decorate([
343
- index.r$1()
344
- ], exports.W3mModal.prototype, "open", void 0);
345
- __decorate([
346
- index.r$1()
347
- ], exports.W3mModal.prototype, "caipAddress", void 0);
348
- __decorate([
349
- index.r$1()
350
- ], exports.W3mModal.prototype, "caipNetwork", void 0);
351
- __decorate([
352
- index.r$1()
353
- ], exports.W3mModal.prototype, "shake", void 0);
354
- exports.W3mModal = __decorate([
355
- index.customElement("w3m-modal")
356
- ], exports.W3mModal);