@multiversx/sdk-dapp-liquidity 1.1.0-alpha.8 → 1.1.0-alpha.9
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.
- package/api/getTransactions.js +4 -3
- package/api/getTransactions.mjs +4 -3
- package/api/tests/getTransactions.spec.js +80 -68
- package/api/tests/getTransactions.spec.mjs +80 -68
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/constants/index.mjs +1 -1
- package/index.js +42 -14
- package/index.mjs +11 -13
- package/package.json +9 -5
- package/reactjs/components/BridgeForm/BridgeForm.js +42 -37
- package/reactjs/components/BridgeForm/BridgeForm.mjs +10 -5
- package/reactjs/components/BridgeHistory/BridgeHistory.js +6 -6
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +1 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.js +2 -6
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +2 -6
- package/reactjs/components/Connect/CustomConnectButton.js +2 -6
- package/reactjs/components/Connect/CustomConnectButton.mjs +1 -5
- package/reactjs/components/Connect/SwitchChainButton.js +2 -7
- package/reactjs/components/Connect/SwitchChainButton.mjs +1 -6
- package/reactjs/components/CopyButton/CopyButton.js +2 -2
- package/reactjs/components/CopyButton/CopyButton.mjs +2 -2
- package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +5 -5
- package/reactjs/components/TokenSelector/TokenSelector.js +5 -5
- package/reactjs/components/TokenSelector/TokenSelector.mjs +1 -1
- package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +3 -3
- package/reactjs/components/TokenSelector/components/SelectContent.js +8 -8
- package/reactjs/components/TokenSelector/components/TokenIcon.js +3 -3
- package/reactjs/components/TokenSelector/components/TokenItem.js +9 -4
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +6 -1
- package/reactjs/components/base/MxCard/MxCard.js +2 -2
- package/reactjs/components/base/MxLink/MxLink.js +2 -2
- package/reactjs/components/base/MxSearch/MxSearch.js +4 -4
- package/reactjs/components/base/MxSlideover/MxSlideover.js +4 -4
- package/reactjs/components/base/MxTooltip/MxTooltip.js +9 -9
- package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +2 -2
- package/reactjs/context/Web3AppProvider.js +3 -3
- package/reactjs/context/useWeb3App.js +2 -2
- package/reactjs/hooks/index.js +1 -1
- package/reactjs/hooks/useAccount.js +1 -6
- package/reactjs/hooks/useAccount.mjs +1 -6
- package/reactjs/hooks/useBalances.js +1 -1
- package/reactjs/hooks/useBridgeFormik.js +9 -9
- package/reactjs/hooks/useDebounce.js +3 -3
- package/reactjs/hooks/useFetchTokens.js +9 -9
- package/reactjs/hooks/useFetchTokens.mjs +2 -2
- package/reactjs/hooks/useFiatData.js +6 -6
- package/reactjs/hooks/useFiatData.mjs +1 -1
- package/reactjs/hooks/useGetChainId.js +3 -3
- package/reactjs/hooks/useGetChainId.mjs +1 -1
- package/reactjs/hooks/useResolveTokenChain.js +2 -2
- package/reactjs/hooks/useSendTransactions.js +2 -2
- package/reactjs/hooks/validation/useTestHasEnoughFunds.js +3 -3
- package/reactjs/hooks/validation/useTestIsConnected.js +2 -2
- package/reactjs/index.js +42 -14
- package/reactjs/index.mjs +11 -13
- package/reactjs/init/init.d.ts +1 -1
- package/reactjs/init/init.js +30 -16
- package/reactjs/init/init.mjs +21 -7
- package/reactjs/init/tests/init.spec.js +6 -7
- package/reactjs/init/tests/init.spec.mjs +5 -6
- package/reactjs/queries/useGetEvmTokensBalances.query.js +3 -7
- package/reactjs/queries/useGetEvmTokensBalances.query.mjs +2 -6
- package/reactjs/queries/useGetMvxTokensBalances.query.js +2 -2
- package/reactjs/reexports.js +41 -13
- package/reactjs/reexports.mjs +11 -13
- package/{useBalances-CMixgIRU.js → useBalances-FCILRNAy.js} +2 -2
- package/add-6Hktd7HI.mjs +0 -19
- package/add-juzQkMr_.js +0 -20
- package/all-wallets-CDBHcdBW.mjs +0 -10
- package/all-wallets-DWuLhbnN.js +0 -11
- package/app-store-2Caui3Hv.mjs +0 -21
- package/app-store-Cppxe4t5.js +0 -22
- package/apple-DKtoJZe9.mjs +0 -22
- package/apple-nexFyqTC.js +0 -23
- package/arrow-bottom-BVz7XUz-.js +0 -13
- package/arrow-bottom-C5NamQSq.mjs +0 -12
- package/arrow-bottom-circle-CvWQP3gd.js +0 -16
- package/arrow-bottom-circle-DZRlr5gZ.mjs +0 -15
- package/arrow-left-BjtUA8Tn.mjs +0 -12
- package/arrow-left-ywqF3CIm.js +0 -13
- package/arrow-right-BM5qYgEx.js +0 -13
- package/arrow-right-EfRPXJ8g.mjs +0 -12
- package/arrow-top-DIZLgKAv.mjs +0 -12
- package/arrow-top-MEfOCzpg.js +0 -13
- package/bank-B5GtM-iL.mjs +0 -18
- package/bank-dWinx5sN.js +0 -19
- package/bitcoin-1SWAuj8n.mjs +0 -3792
- package/bitcoin-DHwiZolS.js +0 -3792
- package/browser-BCJFo3OQ.mjs +0 -18
- package/browser-DbtgVP-h.js +0 -19
- package/card-Bgar5aKz.js +0 -19
- package/card-vGuo5IOR.mjs +0 -18
- package/checkmark-BKBFeuP5.mjs +0 -15
- package/checkmark-bold-BYb8CUZ8.js +0 -13
- package/checkmark-bold-BiFMlocx.mjs +0 -12
- package/checkmark-l8h3sm_g.js +0 -16
- package/chevron-bottom-DfebxTNv.js +0 -13
- package/chevron-bottom-qpBNc49E.mjs +0 -12
- package/chevron-left-Coi_nNKR.mjs +0 -12
- package/chevron-left-FnvKOdGV.js +0 -13
- package/chevron-right-Be3FE3hr.js +0 -13
- package/chevron-right-CRz3MalJ.mjs +0 -12
- package/chevron-top-C68v_E2c.mjs +0 -12
- package/chevron-top-COvCOnB2.js +0 -13
- package/chrome-store-CPJDJNPu.mjs +0 -65
- package/chrome-store-FqwxUZG7.js +0 -66
- package/clock-ByjZ4ilt.js +0 -13
- package/clock-DrLinnc4.mjs +0 -12
- package/close-CKfcXm4W.js +0 -13
- package/close-yanFPosb.mjs +0 -12
- package/coinPlaceholder-3S4HUg2d.js +0 -13
- package/coinPlaceholder-BIfIkMfn.mjs +0 -12
- package/compass-CV7Q0BRl.mjs +0 -12
- package/compass-Cbi2jkxk.js +0 -13
- package/copy-Ca63iQNd.mjs +0 -19
- package/copy-DwGrXa_8.js +0 -20
- package/cursor-BOhtgld_.mjs +0 -7
- package/cursor-CWmF-b84.js +0 -8
- package/cursor-transparent-BwVGzwtu.mjs +0 -16
- package/cursor-transparent-C1tHtAAt.js +0 -17
- package/desktop-332WWCVu.mjs +0 -13
- package/desktop-DFpoQ2XQ.js +0 -14
- package/disconnect-_clyltwg.js +0 -13
- package/disconnect-i16vASLo.mjs +0 -12
- package/discord-B3xzyS21.js +0 -22
- package/discord-Cmks8AXc.mjs +0 -21
- package/email-B4Qs8Wql.mjs +0 -797
- package/email-CSDaC3PV.js +0 -793
- package/embedded-wallet-Z38VX5nD.js +0 -547
- package/embedded-wallet-iJQprDOK.mjs +0 -550
- package/etherscan-DiQKb9JJ.mjs +0 -10
- package/etherscan-DiZfBzq1.js +0 -11
- package/exclamation-triangle-BzIxINm5.js +0 -9
- package/exclamation-triangle-DgSYWQO-.mjs +0 -8
- package/extension-BO0Cd6z8.mjs +0 -12
- package/extension-bF9Sb9iB.js +0 -13
- package/external-link-5DYOaT3U.js +0 -13
- package/external-link-C6tOSZPl.mjs +0 -12
- package/facebook-BNpFIEwz.js +0 -31
- package/facebook-BxE8Pfgx.mjs +0 -30
- package/farcaster-Cn4wtliN.js +0 -17
- package/farcaster-lOD2t_ep.mjs +0 -16
- package/filters-DIWesbdh.js +0 -13
- package/filters-DQYjZNck.mjs +0 -12
- package/github-BK40bIpw.js +0 -23
- package/github-DvTIEePs.mjs +0 -22
- package/google-BEZdehYk.js +0 -23
- package/google-BQODtHO9.mjs +0 -22
- package/help-circle-BoaBQK8j.mjs +0 -16
- package/help-circle-Dafpc2S0.js +0 -17
- package/id-D38R6u_z.js +0 -17
- package/id-Te72spgu.mjs +0 -16
- package/if-defined-Ckbxb_LZ.js +0 -808
- package/if-defined-DwE54thp.mjs +0 -808
- package/image-Dtdls2gL.js +0 -9
- package/image-pcAZlse8.mjs +0 -8
- package/index-B0-hXPyA.mjs +0 -276
- package/index-B5VBriCp.js +0 -166
- package/index-B6PAkUMD.mjs +0 -55
- package/index-BI3g_V6a.js +0 -258
- package/index-BMOzU0g_.mjs +0 -101
- package/index-BREDoavK.mjs +0 -62
- package/index-BieKpvUd.mjs +0 -166
- package/index-Bm64lTwT.mjs +0 -101
- package/index-BmdNakBG.mjs +0 -176
- package/index-BqWHWBPd.js +0 -2237
- package/index-BsSQctOn.mjs +0 -107
- package/index-CB8Xl3BI.mjs +0 -273
- package/index-CE-ThOUU.js +0 -682
- package/index-CJtYUGWk.js +0 -101
- package/index-CNBa_yb_.js +0 -273
- package/index-CNGSm-3v.js +0 -144
- package/index-CZ8svgH6.js +0 -566
- package/index-CgQUQyKy.mjs +0 -812
- package/index-CkqN9i4B.js +0 -103
- package/index-Cwx48WwC.js +0 -265
- package/index-CxbGh3dD.js +0 -59
- package/index-D-QW67ts.js +0 -57
- package/index-D09okGU-.mjs +0 -329
- package/index-D5JBvvTH.mjs +0 -82
- package/index-D97ZdUzy.mjs +0 -95
- package/index-D9W5rupt.js +0 -107
- package/index-DAAXziQn.mjs +0 -57
- package/index-DF_4TKAG.js +0 -344
- package/index-DFgTp8ma.mjs +0 -259
- package/index-DHQBI2q7.mjs +0 -9536
- package/index-DHd3241q.mjs +0 -2235
- package/index-DLv0901W.js +0 -9510
- package/index-DNH3d6sj.js +0 -97
- package/index-DTpnJ3r_.mjs +0 -344
- package/index-DahyraMD.js +0 -178
- package/index-Dp8ypte2.js +0 -84
- package/index-HSJrj1ec.mjs +0 -680
- package/index-Ksar04rg.js +0 -64
- package/index-Oc6Afuhx.mjs +0 -263
- package/index-Sl878vk4.mjs +0 -566
- package/index-Uj_cxq0b.js +0 -152
- package/index-VLLsIwhe.mjs +0 -70
- package/index-XZhf4PTD.js +0 -72
- package/index-f9NdzhLG.mjs +0 -145
- package/index-h3HYCin8.js +0 -331
- package/index-kH104rXk.js +0 -814
- package/index-o5mkLIxK.js +0 -278
- package/index-zw-X0o15.mjs +0 -150
- package/info-DIiGb1WG.mjs +0 -7
- package/info-_1FcljSX.js +0 -8
- package/info-circle-C0cfc1Ai.mjs +0 -16
- package/info-circle-DNrGAlaC.js +0 -17
- package/lightbulb-DAhFAQxe.mjs +0 -7
- package/lightbulb-xep8mw9e.js +0 -8
- package/mail-BP4O1jha.mjs +0 -12
- package/mail-DizrQGIr.js +0 -13
- package/mobile-DN0RkiUA.mjs +0 -13
- package/mobile-jaedeM4x.js +0 -14
- package/more-BwUSQJtS.mjs +0 -15
- package/more-Db1xellQ.js +0 -16
- package/network-placeholder-BFwoDmjz.mjs +0 -18
- package/network-placeholder-Bnr8tbL-.js +0 -19
- package/nftPlaceholder-B1JCCbzW.mjs +0 -12
- package/nftPlaceholder-BwnfvXxH.js +0 -13
- package/off-DgfbvVEQ.js +0 -13
- package/off-HoeLvIQv.mjs +0 -12
- package/onramp-D1g6Jbkc.js +0 -1587
- package/onramp-LOJyQFpR.mjs +0 -1593
- package/play-store-3rRSeyAn.js +0 -37
- package/play-store-BzzZjkgk.mjs +0 -36
- package/plus-DY8W7EOO.js +0 -18
- package/plus-wT-ccjDA.mjs +0 -17
- package/qr-code-BEaXe2LV.js +0 -11
- package/qr-code-BjTH6iOp.mjs +0 -10
- package/react-59f9mIHr.mjs +0 -25357
- package/react-DGsKaIEu.mjs +0 -6077
- package/react-dVsV8KsZ.js +0 -6077
- package/react-m2gZQZx4.js +0 -25357
- package/receive-Cs1s1gYM.mjs +0 -216
- package/receive-UwRW4C9x.js +0 -216
- package/recycle-horizontal-BNBaqSZz.js +0 -14
- package/recycle-horizontal-CeHfqJIc.mjs +0 -13
- package/refresh-BA2xhh9V.js +0 -13
- package/refresh-qhuKtgB7.mjs +0 -12
- package/reown-logo-CuHLfpEw.mjs +0 -16
- package/reown-logo-Tq7bFUT6.js +0 -17
- package/search-6n0Ff_dt.mjs +0 -12
- package/search-Cx4Blqfv.js +0 -13
- package/send-B657IEsU.mjs +0 -1193
- package/send-B8cwQAnQ.js +0 -1191
- package/send-D1dMQkPK.js +0 -20
- package/send-t0dgu5ob.mjs +0 -19
- package/socials-BxPH0UFz.js +0 -723
- package/socials-_cnavCl9.mjs +0 -725
- package/swapHorizontal-BVGXUTXy.js +0 -13
- package/swapHorizontal-CZDLEGAJ.mjs +0 -12
- package/swapHorizontalBold-CYGMAdYJ.mjs +0 -12
- package/swapHorizontalBold-CtYibkOJ.js +0 -13
- package/swapHorizontalMedium-BWtcSeVX.mjs +0 -20
- package/swapHorizontalMedium-CX8g5USa.js +0 -21
- package/swapHorizontalRoundedBold-D69LbTIY.js +0 -13
- package/swapHorizontalRoundedBold-DLqIi8XJ.mjs +0 -12
- package/swapVertical-Bygn2_8O.mjs +0 -12
- package/swapVertical-YEu2FTpl.js +0 -13
- package/swaps-BUgwNzkE.js +0 -1906
- package/swaps-CN6V4itg.mjs +0 -1908
- package/telegram-B3TsPPWG.mjs +0 -20
- package/telegram-BzZxoCON.js +0 -21
- package/three-dots-B9-WRm9o.mjs +0 -9
- package/three-dots-kGCFeW5_.js +0 -10
- package/transactions-C4LyMy2H.js +0 -37
- package/transactions-Cgbyv_T6.mjs +0 -37
- package/twitch-BBdiYoRQ.js +0 -23
- package/twitch-BNJQGRXy.mjs +0 -22
- package/twitterIcon-CR6NDfBD.js +0 -11
- package/twitterIcon-Onqp_sDr.mjs +0 -10
- package/verify-B99cyMD7.js +0 -13
- package/verify-Eoq8GSce.mjs +0 -12
- package/verify-filled-BQXXBU08.mjs +0 -12
- package/verify-filled-CiEDnETf.js +0 -13
- package/w3m-modal-B7NYvu08.js +0 -1208
- package/w3m-modal-Bu0ZSyML.mjs +0 -1208
- package/wallet-BcT8lNii.js +0 -13
- package/wallet-dOYVmmoC.mjs +0 -12
- package/wallet-placeholder-D_dKjqBq.mjs +0 -18
- package/wallet-placeholder-_pc2YkIy.js +0 -19
- package/walletconnect-CP6kDQcs.mjs +0 -38
- package/walletconnect-yIf5ci65.js +0 -39
- package/warning-circle-CKiBhLmZ.js +0 -17
- package/warning-circle-D0zgojhL.mjs +0 -16
- package/x-D4lyzn0g.js +0 -17
- package/x-DyfNtc-k.mjs +0 -16
package/api/getTransactions.js
CHANGED
|
@@ -19,13 +19,14 @@ async function getTransactions({
|
|
|
19
19
|
tokenIn: tokenIn || "",
|
|
20
20
|
tokenOut: tokenOut || ""
|
|
21
21
|
});
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const params = Object.entries(Object.fromEntries(queryParams.entries()));
|
|
23
|
+
for (const [key, value] of params) {
|
|
24
|
+
if (value === "") {
|
|
24
25
|
queryParams.delete(key);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
const queryString = queryParams.toString();
|
|
28
|
-
const endpointWithParams = `/transactions
|
|
29
|
+
const endpointWithParams = `/transactions?${queryString}`;
|
|
29
30
|
return await axios.get(endpointWithParams, {
|
|
30
31
|
baseURL: url
|
|
31
32
|
});
|
package/api/getTransactions.mjs
CHANGED
|
@@ -16,13 +16,14 @@ async function getTransactions({
|
|
|
16
16
|
tokenIn: tokenIn || "",
|
|
17
17
|
tokenOut: tokenOut || ""
|
|
18
18
|
});
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const params = Object.entries(Object.fromEntries(queryParams.entries()));
|
|
20
|
+
for (const [key, value] of params) {
|
|
21
|
+
if (value === "") {
|
|
21
22
|
queryParams.delete(key);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
const queryString = queryParams.toString();
|
|
25
|
-
const endpointWithParams = `/transactions
|
|
26
|
+
const endpointWithParams = `/transactions?${queryString}`;
|
|
26
27
|
return await axios.get(endpointWithParams, {
|
|
27
28
|
baseURL: url
|
|
28
29
|
});
|
|
@@ -7,85 +7,97 @@ jest.mock("axios");
|
|
|
7
7
|
const mockedAxios = axios;
|
|
8
8
|
describe("getTransactions", () => {
|
|
9
9
|
const url = "https://api.example.com";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
mockedAxios.get.
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
const mockResponse = [
|
|
11
|
+
{
|
|
12
|
+
fromChainId: "97",
|
|
13
|
+
toChainId: "44",
|
|
14
|
+
tokenIn: "0x063b637324e6115f8da67f761A99B7F00B7Fd908",
|
|
15
|
+
tokenOut: "USDT-58d5d0",
|
|
16
|
+
amountIn: "11000000",
|
|
17
|
+
amountOut: "11000000",
|
|
18
|
+
depositTimestamp: 1738054613,
|
|
19
|
+
sender: "0x1009c2f59e03c383ca8f2766cfe305a1e79f4c8d",
|
|
20
|
+
status: "success",
|
|
21
|
+
receiver: "erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",
|
|
22
|
+
txHash: "0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",
|
|
23
|
+
fee: "0",
|
|
24
|
+
provider: types_providerType.ProviderType.MultiversxBridge
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
mockedAxios.get.mockClear();
|
|
29
|
+
mockedAxios.get.mockResolvedValue({ data: mockResponse });
|
|
30
|
+
});
|
|
31
|
+
it("fetches transactions with only address parameter", async () => {
|
|
32
|
+
const address = "0x123";
|
|
33
|
+
const result = await api_getTransactions.getTransactions({ url, address });
|
|
34
|
+
expect(mockedAxios.get).toHaveBeenCalledWith(
|
|
35
|
+
"/transactions?receiver=0x123",
|
|
36
|
+
{ baseURL: url }
|
|
37
|
+
);
|
|
38
|
+
expect(result.data).toEqual(mockResponse);
|
|
39
|
+
});
|
|
40
|
+
it("fetches transactions with empty address", async () => {
|
|
41
|
+
const address = "";
|
|
42
|
+
const result = await api_getTransactions.getTransactions({ url, address });
|
|
43
|
+
expect(mockedAxios.get).toHaveBeenCalledWith("/transactions?", {
|
|
31
44
|
baseURL: url
|
|
32
45
|
});
|
|
33
|
-
expect(result.data).toEqual(
|
|
46
|
+
expect(result.data).toEqual(mockResponse);
|
|
34
47
|
});
|
|
35
|
-
it("
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
depositTimestamp: 1738054613,
|
|
46
|
-
sender: "0x1009c2f59e03c383ca8f2766cfe305a1e79f4c8d",
|
|
47
|
-
status: "success",
|
|
48
|
-
receiver: "erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",
|
|
49
|
-
txHash: "0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",
|
|
50
|
-
fee: "0",
|
|
51
|
-
provider: types_providerType.ProviderType.MultiversxBridge
|
|
52
|
-
}
|
|
53
|
-
];
|
|
54
|
-
mockedAxios.get.mockResolvedValue({ data: response });
|
|
55
|
-
const result = await api_getTransactions.getTransactions({ url });
|
|
48
|
+
it("includes all non-empty parameters in the query", async () => {
|
|
49
|
+
const result = await api_getTransactions.getTransactions({
|
|
50
|
+
url,
|
|
51
|
+
address: "0x123",
|
|
52
|
+
sender: "0xABC",
|
|
53
|
+
provider: types_providerType.ProviderType.MultiversxBridge,
|
|
54
|
+
status: "success",
|
|
55
|
+
tokenIn: "0xTOKEN",
|
|
56
|
+
tokenOut: "WEGLD-123456"
|
|
57
|
+
});
|
|
56
58
|
expect(mockedAxios.get).toHaveBeenCalledWith(
|
|
57
|
-
|
|
59
|
+
"/transactions?receiver=0x123&sender=0xABC&provider=multiversx-bridge&status=success&tokenIn=0xTOKEN&tokenOut=WEGLD-123456",
|
|
58
60
|
{ baseURL: url }
|
|
59
61
|
);
|
|
60
|
-
expect(result.data).toEqual(
|
|
62
|
+
expect(result.data).toEqual(mockResponse);
|
|
61
63
|
});
|
|
62
|
-
it("
|
|
63
|
-
const userWalletAddress = "0x123";
|
|
64
|
-
const response = [
|
|
65
|
-
{
|
|
66
|
-
fromChainId: "97",
|
|
67
|
-
toChainId: "44",
|
|
68
|
-
tokenIn: "0x063b637324e6115f8da67f761A99B7F00B7Fd908",
|
|
69
|
-
tokenOut: "USDT-58d5d0",
|
|
70
|
-
amountIn: "11000000",
|
|
71
|
-
amountOut: "11000000",
|
|
72
|
-
depositTimestamp: 1738054613,
|
|
73
|
-
sender: "0x1009c2f59e03c383ca8f2766cfe305a1e79f4c8d",
|
|
74
|
-
status: "success",
|
|
75
|
-
receiver: "erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",
|
|
76
|
-
txHash: "0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",
|
|
77
|
-
fee: "0",
|
|
78
|
-
provider: types_providerType.ProviderType.MultiversxBridge
|
|
79
|
-
}
|
|
80
|
-
];
|
|
81
|
-
mockedAxios.get.mockResolvedValue({ data: response });
|
|
64
|
+
it("excludes empty parameters from the query", async () => {
|
|
82
65
|
const result = await api_getTransactions.getTransactions({
|
|
83
|
-
url
|
|
66
|
+
url,
|
|
67
|
+
address: "0x123",
|
|
68
|
+
sender: "",
|
|
69
|
+
provider: types_providerType.ProviderType.MultiversxBridge,
|
|
70
|
+
status: "",
|
|
71
|
+
tokenIn: "0xTOKEN",
|
|
72
|
+
tokenOut: ""
|
|
84
73
|
});
|
|
85
74
|
expect(mockedAxios.get).toHaveBeenCalledWith(
|
|
86
|
-
|
|
75
|
+
"/transactions?receiver=0x123&provider=multiversx-bridge&tokenIn=0xTOKEN",
|
|
87
76
|
{ baseURL: url }
|
|
88
77
|
);
|
|
89
|
-
expect(result.data).toEqual(
|
|
78
|
+
expect(result.data).toEqual(mockResponse);
|
|
79
|
+
});
|
|
80
|
+
it("handles axios error", async () => {
|
|
81
|
+
const error = new Error("Network error");
|
|
82
|
+
mockedAxios.get.mockRejectedValueOnce(error);
|
|
83
|
+
await expect(api_getTransactions.getTransactions({ url, address: "0x123" })).rejects.toThrow(
|
|
84
|
+
"Network error"
|
|
85
|
+
);
|
|
86
|
+
expect(mockedAxios.get).toHaveBeenCalledWith(
|
|
87
|
+
"/transactions?receiver=0x123",
|
|
88
|
+
{ baseURL: url }
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
it("passes through axios response", async () => {
|
|
92
|
+
const axiosResponse = {
|
|
93
|
+
data: mockResponse,
|
|
94
|
+
status: 200,
|
|
95
|
+
statusText: "OK",
|
|
96
|
+
headers: {},
|
|
97
|
+
config: {}
|
|
98
|
+
};
|
|
99
|
+
mockedAxios.get.mockResolvedValueOnce(axiosResponse);
|
|
100
|
+
const result = await api_getTransactions.getTransactions({ url, address: "0x123" });
|
|
101
|
+
expect(result).toEqual(axiosResponse);
|
|
90
102
|
});
|
|
91
103
|
});
|
|
@@ -5,85 +5,97 @@ jest.mock("axios");
|
|
|
5
5
|
const mockedAxios = axios;
|
|
6
6
|
describe("getTransactions", () => {
|
|
7
7
|
const url = "https://api.example.com";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
mockedAxios.get.
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
const mockResponse = [
|
|
9
|
+
{
|
|
10
|
+
fromChainId: "97",
|
|
11
|
+
toChainId: "44",
|
|
12
|
+
tokenIn: "0x063b637324e6115f8da67f761A99B7F00B7Fd908",
|
|
13
|
+
tokenOut: "USDT-58d5d0",
|
|
14
|
+
amountIn: "11000000",
|
|
15
|
+
amountOut: "11000000",
|
|
16
|
+
depositTimestamp: 1738054613,
|
|
17
|
+
sender: "0x1009c2f59e03c383ca8f2766cfe305a1e79f4c8d",
|
|
18
|
+
status: "success",
|
|
19
|
+
receiver: "erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",
|
|
20
|
+
txHash: "0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",
|
|
21
|
+
fee: "0",
|
|
22
|
+
provider: ProviderType.MultiversxBridge
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
mockedAxios.get.mockClear();
|
|
27
|
+
mockedAxios.get.mockResolvedValue({ data: mockResponse });
|
|
28
|
+
});
|
|
29
|
+
it("fetches transactions with only address parameter", async () => {
|
|
30
|
+
const address = "0x123";
|
|
31
|
+
const result = await getTransactions({ url, address });
|
|
32
|
+
expect(mockedAxios.get).toHaveBeenCalledWith(
|
|
33
|
+
"/transactions?receiver=0x123",
|
|
34
|
+
{ baseURL: url }
|
|
35
|
+
);
|
|
36
|
+
expect(result.data).toEqual(mockResponse);
|
|
37
|
+
});
|
|
38
|
+
it("fetches transactions with empty address", async () => {
|
|
39
|
+
const address = "";
|
|
40
|
+
const result = await getTransactions({ url, address });
|
|
41
|
+
expect(mockedAxios.get).toHaveBeenCalledWith("/transactions?", {
|
|
29
42
|
baseURL: url
|
|
30
43
|
});
|
|
31
|
-
expect(result.data).toEqual(
|
|
44
|
+
expect(result.data).toEqual(mockResponse);
|
|
32
45
|
});
|
|
33
|
-
it("
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
depositTimestamp: 1738054613,
|
|
44
|
-
sender: "0x1009c2f59e03c383ca8f2766cfe305a1e79f4c8d",
|
|
45
|
-
status: "success",
|
|
46
|
-
receiver: "erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",
|
|
47
|
-
txHash: "0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",
|
|
48
|
-
fee: "0",
|
|
49
|
-
provider: ProviderType.MultiversxBridge
|
|
50
|
-
}
|
|
51
|
-
];
|
|
52
|
-
mockedAxios.get.mockResolvedValue({ data: response });
|
|
53
|
-
const result = await getTransactions({ url });
|
|
46
|
+
it("includes all non-empty parameters in the query", async () => {
|
|
47
|
+
const result = await getTransactions({
|
|
48
|
+
url,
|
|
49
|
+
address: "0x123",
|
|
50
|
+
sender: "0xABC",
|
|
51
|
+
provider: ProviderType.MultiversxBridge,
|
|
52
|
+
status: "success",
|
|
53
|
+
tokenIn: "0xTOKEN",
|
|
54
|
+
tokenOut: "WEGLD-123456"
|
|
55
|
+
});
|
|
54
56
|
expect(mockedAxios.get).toHaveBeenCalledWith(
|
|
55
|
-
|
|
57
|
+
"/transactions?receiver=0x123&sender=0xABC&provider=multiversx-bridge&status=success&tokenIn=0xTOKEN&tokenOut=WEGLD-123456",
|
|
56
58
|
{ baseURL: url }
|
|
57
59
|
);
|
|
58
|
-
expect(result.data).toEqual(
|
|
60
|
+
expect(result.data).toEqual(mockResponse);
|
|
59
61
|
});
|
|
60
|
-
it("
|
|
61
|
-
const userWalletAddress = "0x123";
|
|
62
|
-
const response = [
|
|
63
|
-
{
|
|
64
|
-
fromChainId: "97",
|
|
65
|
-
toChainId: "44",
|
|
66
|
-
tokenIn: "0x063b637324e6115f8da67f761A99B7F00B7Fd908",
|
|
67
|
-
tokenOut: "USDT-58d5d0",
|
|
68
|
-
amountIn: "11000000",
|
|
69
|
-
amountOut: "11000000",
|
|
70
|
-
depositTimestamp: 1738054613,
|
|
71
|
-
sender: "0x1009c2f59e03c383ca8f2766cfe305a1e79f4c8d",
|
|
72
|
-
status: "success",
|
|
73
|
-
receiver: "erd1sp0aaszznqnuvyvkmxkv2ultcvlf637c093sfc26dszks60jdqsqy2knqu",
|
|
74
|
-
txHash: "0xe7e706c1793d06a252a3f040f07732989e4a6466d804cae17105c09818bc2994",
|
|
75
|
-
fee: "0",
|
|
76
|
-
provider: ProviderType.MultiversxBridge
|
|
77
|
-
}
|
|
78
|
-
];
|
|
79
|
-
mockedAxios.get.mockResolvedValue({ data: response });
|
|
62
|
+
it("excludes empty parameters from the query", async () => {
|
|
80
63
|
const result = await getTransactions({
|
|
81
|
-
url
|
|
64
|
+
url,
|
|
65
|
+
address: "0x123",
|
|
66
|
+
sender: "",
|
|
67
|
+
provider: ProviderType.MultiversxBridge,
|
|
68
|
+
status: "",
|
|
69
|
+
tokenIn: "0xTOKEN",
|
|
70
|
+
tokenOut: ""
|
|
82
71
|
});
|
|
83
72
|
expect(mockedAxios.get).toHaveBeenCalledWith(
|
|
84
|
-
|
|
73
|
+
"/transactions?receiver=0x123&provider=multiversx-bridge&tokenIn=0xTOKEN",
|
|
85
74
|
{ baseURL: url }
|
|
86
75
|
);
|
|
87
|
-
expect(result.data).toEqual(
|
|
76
|
+
expect(result.data).toEqual(mockResponse);
|
|
77
|
+
});
|
|
78
|
+
it("handles axios error", async () => {
|
|
79
|
+
const error = new Error("Network error");
|
|
80
|
+
mockedAxios.get.mockRejectedValueOnce(error);
|
|
81
|
+
await expect(getTransactions({ url, address: "0x123" })).rejects.toThrow(
|
|
82
|
+
"Network error"
|
|
83
|
+
);
|
|
84
|
+
expect(mockedAxios.get).toHaveBeenCalledWith(
|
|
85
|
+
"/transactions?receiver=0x123",
|
|
86
|
+
{ baseURL: url }
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
it("passes through axios response", async () => {
|
|
90
|
+
const axiosResponse = {
|
|
91
|
+
data: mockResponse,
|
|
92
|
+
status: 200,
|
|
93
|
+
statusText: "OK",
|
|
94
|
+
headers: {},
|
|
95
|
+
config: {}
|
|
96
|
+
};
|
|
97
|
+
mockedAxios.get.mockResolvedValueOnce(axiosResponse);
|
|
98
|
+
const result = await getTransactions({ url, address: "0x123" });
|
|
99
|
+
expect(result).toEqual(axiosResponse);
|
|
88
100
|
});
|
|
89
101
|
});
|
package/constants/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MVX_CHAIN_IDS:
|
|
1
|
+
export declare const MVX_CHAIN_IDS: string[];
|
package/constants/index.js
CHANGED
package/constants/index.mjs
CHANGED
package/index.js
CHANGED
|
@@ -53,7 +53,7 @@ const reactjs_hooks_validation_useSecondAmountSchema = require("./reactjs/hooks/
|
|
|
53
53
|
const reactjs_hooks_validation_useTestHasEnoughFunds = require("./reactjs/hooks/validation/useTestHasEnoughFunds.js");
|
|
54
54
|
const reactjs_hooks_validation_useTestIsConnected = require("./reactjs/hooks/validation/useTestIsConnected.js");
|
|
55
55
|
const reactjs_hooks_useAccount = require("./reactjs/hooks/useAccount.js");
|
|
56
|
-
const reactjs_hooks_useBalances = require("./useBalances-
|
|
56
|
+
const reactjs_hooks_useBalances = require("./useBalances-FCILRNAy.js");
|
|
57
57
|
const reactjs_hooks_useBridgeFormik = require("./reactjs/hooks/useBridgeFormik.js");
|
|
58
58
|
const reactjs_hooks_useDebounce = require("./reactjs/hooks/useDebounce.js");
|
|
59
59
|
const reactjs_hooks_useFetchBridgeData = require("./reactjs/hooks/useFetchBridgeData.js");
|
|
@@ -82,11 +82,9 @@ const reactjs_utils_pipe = require("./reactjs/utils/pipe.js");
|
|
|
82
82
|
const reactjs_utils_removeCommas = require("./reactjs/utils/removeCommas.js");
|
|
83
83
|
const reactjs_utils_roundAmount = require("./reactjs/utils/roundAmount.js");
|
|
84
84
|
const reactjs_utils_testNumber = require("./reactjs/utils/testNumber.js");
|
|
85
|
-
const react
|
|
85
|
+
const react = require("@reown/appkit/react");
|
|
86
86
|
const wagmi = require("wagmi");
|
|
87
87
|
const reactjs_constants_chains = require("./reactjs/constants/chains.js");
|
|
88
|
-
const index = require("./index-D9W5rupt.js");
|
|
89
|
-
const react = require("./react-dVsV8KsZ.js");
|
|
90
88
|
exports.confirmRate = api_confirmRate.confirmRate;
|
|
91
89
|
exports.getChains = api_getChains.getChains;
|
|
92
90
|
exports.getRate = api_getRate.getRate;
|
|
@@ -175,19 +173,49 @@ exports.pipe = reactjs_utils_pipe.pipe;
|
|
|
175
173
|
exports.removeCommas = reactjs_utils_removeCommas.removeCommas;
|
|
176
174
|
exports.roundAmount = reactjs_utils_roundAmount.roundAmount;
|
|
177
175
|
exports.testNumber = reactjs_utils_testNumber.testNumber;
|
|
178
|
-
exports
|
|
176
|
+
Object.defineProperty(exports, "useAppKit", {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: () => react.useAppKit
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "useAppKitAccount", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: () => react.useAppKitAccount
|
|
183
|
+
});
|
|
184
|
+
Object.defineProperty(exports, "useAppKitEvents", {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
get: () => react.useAppKitEvents
|
|
187
|
+
});
|
|
188
|
+
Object.defineProperty(exports, "useAppKitNetwork", {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: () => react.useAppKitNetwork
|
|
191
|
+
});
|
|
192
|
+
Object.defineProperty(exports, "useAppKitNetworkCore", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get: () => react.useAppKitNetworkCore
|
|
195
|
+
});
|
|
196
|
+
Object.defineProperty(exports, "useAppKitProvider", {
|
|
197
|
+
enumerable: true,
|
|
198
|
+
get: () => react.useAppKitProvider
|
|
199
|
+
});
|
|
200
|
+
Object.defineProperty(exports, "useAppKitState", {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
get: () => react.useAppKitState
|
|
203
|
+
});
|
|
204
|
+
Object.defineProperty(exports, "useAppKitTheme", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: () => react.useAppKitTheme
|
|
207
|
+
});
|
|
208
|
+
Object.defineProperty(exports, "useDisconnect", {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
get: () => react.useDisconnect
|
|
211
|
+
});
|
|
212
|
+
Object.defineProperty(exports, "useWalletInfo", {
|
|
213
|
+
enumerable: true,
|
|
214
|
+
get: () => react.useWalletInfo
|
|
215
|
+
});
|
|
179
216
|
Object.defineProperty(exports, "useWaitForTransactionReceipt", {
|
|
180
217
|
enumerable: true,
|
|
181
218
|
get: () => wagmi.useWaitForTransactionReceipt
|
|
182
219
|
});
|
|
183
220
|
exports.ALL_NETWORK_ID = reactjs_constants_chains.ALL_NETWORK_ID;
|
|
184
221
|
exports.chainIdentifier = reactjs_constants_chains.chainIdentifier;
|
|
185
|
-
exports.useAppKit = index.useAppKit;
|
|
186
|
-
exports.useAppKitEvents = index.useAppKitEvents;
|
|
187
|
-
exports.useAppKitProvider = index.useAppKitProvider;
|
|
188
|
-
exports.useAppKitState = index.useAppKitState;
|
|
189
|
-
exports.useAppKitTheme = index.useAppKitTheme;
|
|
190
|
-
exports.useWalletInfo = index.useWalletInfo;
|
|
191
|
-
exports.useAppKitAccount = react.useAppKitAccount;
|
|
192
|
-
exports.useAppKitNetworkCore = react.useAppKitNetworkCore;
|
|
193
|
-
exports.useDisconnect = react.useDisconnect;
|
package/index.mjs
CHANGED
|
@@ -79,11 +79,9 @@ import { pipe } from "./reactjs/utils/pipe.mjs";
|
|
|
79
79
|
import { removeCommas } from "./reactjs/utils/removeCommas.mjs";
|
|
80
80
|
import { roundAmount } from "./reactjs/utils/roundAmount.mjs";
|
|
81
81
|
import { testNumber } from "./reactjs/utils/testNumber.mjs";
|
|
82
|
-
import {
|
|
82
|
+
import { useAppKit, useAppKitAccount, useAppKitEvents, useAppKitNetwork, useAppKitNetworkCore, useAppKitProvider, useAppKitState, useAppKitTheme, useDisconnect, useWalletInfo } from "@reown/appkit/react";
|
|
83
83
|
import { useWaitForTransactionReceipt } from "wagmi";
|
|
84
84
|
import { ALL_NETWORK_ID, chainIdentifier } from "./reactjs/constants/chains.mjs";
|
|
85
|
-
import { u as u3, a, e, b, c, d } from "./index-BsSQctOn.mjs";
|
|
86
|
-
import { u as u4, b as b2, a as a2 } from "./react-DGsKaIEu.mjs";
|
|
87
85
|
export {
|
|
88
86
|
ALL_NETWORK_ID,
|
|
89
87
|
AccountAddress,
|
|
@@ -155,18 +153,18 @@ export {
|
|
|
155
153
|
testNumber,
|
|
156
154
|
useAccount,
|
|
157
155
|
useAmountSchema,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
useAppKit,
|
|
157
|
+
useAppKitAccount,
|
|
158
|
+
useAppKitEvents,
|
|
159
|
+
useAppKitNetwork,
|
|
160
|
+
useAppKitNetworkCore,
|
|
161
|
+
useAppKitProvider,
|
|
162
|
+
useAppKitState,
|
|
163
|
+
useAppKitTheme,
|
|
166
164
|
u as useBalances,
|
|
167
165
|
useBridgeFormik,
|
|
168
166
|
useDebounce,
|
|
169
|
-
|
|
167
|
+
useDisconnect,
|
|
170
168
|
useFetchBridgeData,
|
|
171
169
|
useFetchTokens,
|
|
172
170
|
useGetAllTokensQuery,
|
|
@@ -184,6 +182,6 @@ export {
|
|
|
184
182
|
useTestHasEnoughFunds,
|
|
185
183
|
useTestIsConnected,
|
|
186
184
|
useWaitForTransactionReceipt,
|
|
187
|
-
|
|
185
|
+
useWalletInfo,
|
|
188
186
|
useWeb3App
|
|
189
187
|
};
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/multiversx/mx-sdk-dapp-liquidity#readme",
|
|
30
30
|
"license": "MIT",
|
|
31
|
-
"version": "1.1.0-alpha.
|
|
31
|
+
"version": "1.1.0-alpha.9",
|
|
32
32
|
"main": "index.js",
|
|
33
33
|
"module": "index.mjs",
|
|
34
34
|
"types": "index.d.ts",
|
|
@@ -52,8 +52,12 @@
|
|
|
52
52
|
"@headlessui/react": "2.2.0",
|
|
53
53
|
"@multiversx/sdk-dapp-utils": "1.0.5",
|
|
54
54
|
"@popperjs/core": "^2.11.8",
|
|
55
|
-
"@reown/appkit
|
|
56
|
-
"@
|
|
55
|
+
"@reown/appkit": "^1.7.1",
|
|
56
|
+
"@reown/appkit-adapter-bitcoin": "1.7.1",
|
|
57
|
+
"@reown/appkit-adapter-solana": "1.7.1",
|
|
58
|
+
"@reown/appkit-adapter-wagmi": "1.7.1",
|
|
59
|
+
"@solana/web3.js": "^1.98.0",
|
|
60
|
+
"@tanstack/react-query": "^5.70.0",
|
|
57
61
|
"animated-number-react": "0.1.2",
|
|
58
62
|
"axios": "1.7.9",
|
|
59
63
|
"formik": "2.4.6",
|
|
@@ -65,8 +69,8 @@
|
|
|
65
69
|
"react-select": "5.10.0",
|
|
66
70
|
"react-toastify": "11.0.3",
|
|
67
71
|
"tailwind-merge": "2.6.0",
|
|
68
|
-
"viem": "2.
|
|
69
|
-
"wagmi": "2.14.
|
|
72
|
+
"viem": "^2.24.1",
|
|
73
|
+
"wagmi": "^2.14.15",
|
|
70
74
|
"yup": "1.4.0"
|
|
71
75
|
},
|
|
72
76
|
"peerDependencies": {
|