@multiversx/sdk-dapp-liquidity 2.4.0-alpha.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{BridgeHistory-BUSiuT1d.mjs → BridgeHistory-B86lT8s-.mjs} +13 -13
- package/BridgeHistory-D3Zg2V1U.js +2 -0
- package/index.js +1 -1
- package/index.mjs +59 -58
- package/package.json +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.js +1 -1
- package/reactjs/components/BridgeForm/BridgeForm.mjs +71 -74
- package/reactjs/components/BridgeForm/Deposit.js +1 -1
- package/reactjs/components/BridgeForm/Deposit.mjs +237 -237
- package/reactjs/components/BridgeForm/Transfer.js +1 -1
- package/reactjs/components/BridgeForm/Transfer.mjs +44 -44
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +1 -1
- package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +94 -96
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.d.ts +5 -0
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -1
- package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +7 -2
- package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -1
- package/reactjs/components/BridgeHistory/BridgeHistory.mjs +1 -1
- package/reactjs/components/BridgeHistory/index.js +1 -1
- package/reactjs/components/BridgeHistory/index.mjs +1 -1
- package/reactjs/components/Connect/ChainSelectConnect.js +1 -1
- package/reactjs/components/Connect/ChainSelectConnect.mjs +3 -3
- package/reactjs/components/base/MxLoadSkeleton/MxLoadSkeleton.d.ts +1 -0
- package/reactjs/components/base/MxLoadSkeleton/MxLoadSkeleton.js +2 -0
- package/reactjs/components/base/MxLoadSkeleton/MxLoadSkeleton.mjs +24 -0
- package/reactjs/components/base/MxLoadSkeleton/index.d.ts +1 -0
- package/reactjs/components/base/MxLoadSkeleton/index.js +2 -0
- package/reactjs/components/base/MxLoadSkeleton/index.mjs +2 -0
- package/reactjs/components/base/index.d.ts +1 -0
- package/reactjs/components/base/index.js +1 -1
- package/reactjs/components/base/index.mjs +6 -4
- package/reactjs/components/index.js +1 -1
- package/reactjs/components/index.mjs +23 -22
- package/reactjs/context/Web3AppProvider.js +1 -1
- package/reactjs/context/Web3AppProvider.mjs +31 -27
- package/reactjs/hooks/index.js +1 -1
- package/reactjs/hooks/index.mjs +14 -14
- package/reactjs/hooks/useBridgeFormik.js +1 -1
- package/reactjs/hooks/useBridgeFormik.mjs +14 -14
- package/reactjs/hooks/useFetchBridgeData.js +1 -1
- package/reactjs/hooks/useFetchBridgeData.mjs +1 -1
- package/reactjs/hooks/useFetchTokens.js +1 -1
- package/reactjs/hooks/useFetchTokens.mjs +1 -1
- package/reactjs/index.js +1 -1
- package/reactjs/index.mjs +59 -58
- package/reactjs/queries/index.js +1 -1
- package/reactjs/queries/index.mjs +3 -3
- package/reactjs/queries/useGetAllTokens.query.js +1 -1
- package/reactjs/queries/useGetAllTokens.query.mjs +1 -1
- package/reactjs/queries/useGetChains.query.js +1 -1
- package/reactjs/queries/useGetChains.query.mjs +1 -1
- package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +1 -2
- package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -1
- package/reactjs/queries/useGetMvxTokensBalances.query.mjs +3 -3
- package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -1
- package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +1 -1
- package/reactjs/utils/hasEnoughFunds.js +1 -1
- package/reactjs/utils/hasEnoughFunds.mjs +3 -3
- package/reactjs/utils/index.js +1 -1
- package/reactjs/utils/index.mjs +11 -11
- package/style.css +1 -1
- package/useFetchBridgeData-BUeRPF3t.js +2 -0
- package/{hooks-DMIHvAKb.mjs → useFetchBridgeData-C9hzwYG6.mjs} +20 -21
- package/BridgeHistory-0NVr8Uxp.js +0 -2
- package/hooks-SJPsZfDx.js +0 -2
|
@@ -7,11 +7,11 @@ import { MxCard as i } from "./reactjs/components/base/MxCard/MxCard.mjs";
|
|
|
7
7
|
import "./reactjs/components/base/MxCard/index.mjs";
|
|
8
8
|
import { MxTooltip as a } from "./reactjs/components/base/MxTooltip/MxTooltip.mjs";
|
|
9
9
|
import "./reactjs/components/base/index.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { formatAmount as o } from "./reactjs/utils/formatAmount.mjs";
|
|
11
11
|
import { useWeb3App as s } from "./reactjs/context/useWeb3App.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
12
|
+
import { useAccount as c } from "./reactjs/hooks/useAccount.mjs";
|
|
13
|
+
import { ProviderType as l } from "./types/providerType.mjs";
|
|
14
|
+
import { t as u } from "./useFetchBridgeData-C9hzwYG6.mjs";
|
|
15
15
|
import { useGetHistoryQuery as d } from "./reactjs/queries/useGetHistory.query.mjs";
|
|
16
16
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
17
17
|
import { useCallback as h, useMemo as g } from "react";
|
|
@@ -25,7 +25,7 @@ import { faClock as C } from "@fortawesome/free-solid-svg-icons/faClock";
|
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region src/reactjs/components/BridgeHistory/BridgeHistory.tsx
|
|
27
27
|
var w = ({ mvxAddress: w, onClose: T }) => {
|
|
28
|
-
let { options: E, bridgeOnly: D } = s(), O =
|
|
28
|
+
let { options: E, bridgeOnly: D } = s(), O = c(), { data: k, isLoading: A, isError: j } = d({ address: w }), { data: M } = d({ address: O.address ?? "" }), N = g(() => {
|
|
29
29
|
let e = k ?? [], t = D && M ? M : [];
|
|
30
30
|
return [...e, ...t].sort((e, t) => t.depositTimestamp - e.depositTimestamp);
|
|
31
31
|
}, [
|
|
@@ -56,7 +56,7 @@ var w = ({ mvxAddress: w, onClose: T }) => {
|
|
|
56
56
|
tokenSource: e.tokenIn.toLowerCase(),
|
|
57
57
|
sender: e.sender.toLowerCase(),
|
|
58
58
|
statusIcon: P(e)
|
|
59
|
-
})), [N, P]), { evmTokensWithBalances: I, mvxTokensWithBalances: L, chains: R, isTokensLoading: z, isChainsLoading: B } =
|
|
59
|
+
})), [N, P]), { evmTokensWithBalances: I, mvxTokensWithBalances: L, chains: R, isTokensLoading: z, isChainsLoading: B } = u({
|
|
60
60
|
mvxAddress: w,
|
|
61
61
|
mvxApiURL: E.mvxApiURL
|
|
62
62
|
}), V = g(() => [...I ?? [], ...L ?? []].reduce((e, t) => (e[t.address.toLowerCase()] = t, e), {}), [I, L]), H = g(() => (R ?? []).reduce((e, t) => (e[t.chainId.toString()] = t, e), {}), [R]), U = n("liq-flex liq-flex-col liq-absolute liq-left-0 liq-top-0 liq-order-1 liq-mx-auto liq-w-full liq-gap-1 liq-pt-12 lg:liq-order-2 lg:liq-max-w-[27.5rem] !liq-min-h-[26rem] !liq-h-[26rem] !lg:liq-pt-0 !liq-bg-neutral-850 !liq-z-[16] !liq-p-2 !liq-pointer-events-auto", { "!liq-disabled !liq-animate-pulse": A || z || B });
|
|
@@ -106,7 +106,7 @@ var w = ({ mvxAddress: w, onClose: T }) => {
|
|
|
106
106
|
})]
|
|
107
107
|
})]
|
|
108
108
|
})
|
|
109
|
-
}), F && F?.length > 0 && F.map((r,
|
|
109
|
+
}), F && F?.length > 0 && F.map((r, s) => /* @__PURE__ */ p(i, {
|
|
110
110
|
cardSize: "lg",
|
|
111
111
|
variant: "neutral-750",
|
|
112
112
|
className: "liq-flex liq-flex-col liq-gap-4 !liq-outline liq-outline-transparent !liq-p-4 liq-border liq-border-neutral-750 liq-bg-neutral-850 hover:!liq-bg-neutral-700 !liq-rounded-lg",
|
|
@@ -133,7 +133,7 @@ var w = ({ mvxAddress: w, onClose: T }) => {
|
|
|
133
133
|
}),
|
|
134
134
|
/* @__PURE__ */ p("span", {
|
|
135
135
|
className: "liq-text-wrap",
|
|
136
|
-
children:
|
|
136
|
+
children: o({
|
|
137
137
|
decimals: V[r.tokenDestination]?.decimals,
|
|
138
138
|
amount: r.amountOut,
|
|
139
139
|
addCommas: !1,
|
|
@@ -155,7 +155,7 @@ var w = ({ mvxAddress: w, onClose: T }) => {
|
|
|
155
155
|
}),
|
|
156
156
|
/* @__PURE__ */ p("span", {
|
|
157
157
|
className: "liq-text-wrap",
|
|
158
|
-
children:
|
|
158
|
+
children: o({
|
|
159
159
|
decimals: V[r.tokenSource]?.decimals,
|
|
160
160
|
amount: r.amountIn,
|
|
161
161
|
addCommas: !1,
|
|
@@ -195,7 +195,7 @@ var w = ({ mvxAddress: w, onClose: T }) => {
|
|
|
195
195
|
}),
|
|
196
196
|
/* @__PURE__ */ p("span", {
|
|
197
197
|
className: "liq-text-wrap",
|
|
198
|
-
children:
|
|
198
|
+
children: o({
|
|
199
199
|
decimals: V[r.tokenSource]?.decimals,
|
|
200
200
|
amount: r.amountIn,
|
|
201
201
|
addCommas: !1,
|
|
@@ -217,7 +217,7 @@ var w = ({ mvxAddress: w, onClose: T }) => {
|
|
|
217
217
|
}),
|
|
218
218
|
/* @__PURE__ */ p("span", {
|
|
219
219
|
className: "liq-text-wrap",
|
|
220
|
-
children:
|
|
220
|
+
children: o({
|
|
221
221
|
decimals: V[r.tokenDestination]?.decimals,
|
|
222
222
|
amount: r.amountOut,
|
|
223
223
|
addCommas: !1,
|
|
@@ -247,7 +247,7 @@ var w = ({ mvxAddress: w, onClose: T }) => {
|
|
|
247
247
|
})]
|
|
248
248
|
})
|
|
249
249
|
] })]
|
|
250
|
-
}), r.provider ===
|
|
250
|
+
}), r.provider === l.MultiversxBridge && /* @__PURE__ */ p("a", {
|
|
251
251
|
href: `${E.bridgeURL}/status/${r.txHash}`,
|
|
252
252
|
target: "_blank",
|
|
253
253
|
rel: "noopener noreferrer",
|
|
@@ -267,7 +267,7 @@ var w = ({ mvxAddress: w, onClose: T }) => {
|
|
|
267
267
|
})
|
|
268
268
|
})]
|
|
269
269
|
})
|
|
270
|
-
}, `${r.txHash}-${
|
|
270
|
+
}, `${r.txHash}-${s}`))]
|
|
271
271
|
})]
|
|
272
272
|
});
|
|
273
273
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const e=require("./constants/index.js"),t=require("./helpers/safeImageUrl.js"),n=require("./reactjs/utils/mxClsx.js"),r=require("./reactjs/components/base/MxButton/MxButton.js");require("./reactjs/components/base/MxButton/index.js");const i=require("./reactjs/components/base/MxCard/MxCard.js");require("./reactjs/components/base/MxCard/index.js");const a=require("./reactjs/components/base/MxTooltip/MxTooltip.js");require("./reactjs/components/base/index.js");const o=require("./reactjs/utils/formatAmount.js"),s=require("./reactjs/context/useWeb3App.js"),c=require("./reactjs/hooks/useAccount.js"),l=require("./types/providerType.js"),u=require("./useFetchBridgeData-BUeRPF3t.js"),d=require("./reactjs/queries/useGetHistory.query.js");let f=require("react/jsx-runtime"),p=require("react"),m=require("@fortawesome/react-fontawesome"),h=require("@fortawesome/free-solid-svg-icons/faClose"),g=require("@fortawesome/free-solid-svg-icons/faArrowDownShortWide"),_=require("@fortawesome/free-solid-svg-icons/faArrowUpShortWide"),v=require("@fortawesome/free-solid-svg-icons/faCircleCheck"),y=require("@fortawesome/free-solid-svg-icons/faCircleXmark"),b=require("@fortawesome/free-solid-svg-icons/faClock");var x=({mvxAddress:x,onClose:S})=>{let{options:C,bridgeOnly:w}=s.useWeb3App(),T=c.useAccount(),{data:E,isLoading:D,isError:O}=d.useGetHistoryQuery({address:x}),{data:k}=d.useGetHistoryQuery({address:T.address??``}),A=(0,p.useMemo)(()=>{let e=E??[],t=w&&k?k:[];return[...e,...t].sort((e,t)=>t.depositTimestamp-e.depositTimestamp)},[w,k,E]),j=(0,p.useCallback)(e=>{switch(e.status){case`success`:return(0,f.jsx)(m.FontAwesomeIcon,{icon:v.faCircleCheck,size:`lg`,className:`liq-flex liq-items-center liq-justify-center liq-rounded-full liq-text-green-400`});case`failed`:return(0,f.jsx)(m.FontAwesomeIcon,{icon:y.faCircleXmark,size:`lg`,className:`liq-flex liq-items-center liq-justify-center liq-rounded-full liq-text-red-400`});default:return(0,f.jsx)(m.FontAwesomeIcon,{icon:b.faClock,size:`lg`,className:`liq-flex liq-items-center liq-justify-center liq-rounded-full liq-text-yellow-400`})}},[]),M=(0,p.useMemo)(()=>A?.map(e=>({...e,tokenDestination:e.tokenOut.toLowerCase(),tokenSource:e.tokenIn.toLowerCase(),sender:e.sender.toLowerCase(),statusIcon:j(e)})),[A,j]),{evmTokensWithBalances:N,mvxTokensWithBalances:P,chains:F,isTokensLoading:I,isChainsLoading:L}=u.t({mvxAddress:x,mvxApiURL:C.mvxApiURL}),R=(0,p.useMemo)(()=>[...N??[],...P??[]].reduce((e,t)=>(e[t.address.toLowerCase()]=t,e),{}),[N,P]),z=(0,p.useMemo)(()=>(F??[]).reduce((e,t)=>(e[t.chainId.toString()]=t,e),{}),[F]),B=n.mxClsx(`liq-flex liq-flex-col liq-absolute liq-left-0 liq-top-0 liq-order-1 liq-mx-auto liq-w-full liq-gap-1 liq-pt-12 lg:liq-order-2 lg:liq-max-w-[27.5rem] !liq-min-h-[26rem] !liq-h-[26rem] !lg:liq-pt-0 !liq-bg-neutral-850 !liq-z-[16] !liq-p-2 !liq-pointer-events-auto`,{"!liq-disabled !liq-animate-pulse":D||I||L});return D&&!M?(0,f.jsx)(i.MxCard,{className:n.mxClsx(`liq-flex`,B)}):O&&!M?(0,f.jsx)(i.MxCard,{className:n.mxClsx(`liq-flex liq-flex-col liq-gap-1`,B),children:`Something went wrong. Please try again later.`}):(0,f.jsxs)(i.MxCard,{className:n.mxClsx(`liq-flex liq-flex-col liq-gap-1`,B),children:[(0,f.jsxs)(`div`,{className:`liq-flex liq-items-center liq-justify-between liq-py-1 liq-mt-0.5`,children:[(0,f.jsx)(`div`,{className:`liq-flex liq-flex-1 liq-items-center liq-justify-center liq-text-center liq-text-lg`,children:`History`}),(0,f.jsx)(r.MxButton,{btnSize:`md`,className:`liq-border-none !liq-p-0 !liq-mr-2`,variant:`link-neutral-500`,onClick:S,children:(0,f.jsx)(m.FontAwesomeIcon,{icon:h.faClose,size:`xl`})})]}),(0,f.jsxs)(`div`,{className:`scrollbar-thin liq-flex liq-flex-1 liq-flex-col liq-gap-1 liq-overflow-y-scroll`,children:[M?.length===0&&(0,f.jsx)(i.MxCard,{cardSize:`lg`,variant:`transparent`,className:`liq-align-center liq-flex liq-h-full liq-flex-col liq-justify-center liq-gap-4 liq-border-0 !liq-pb-8 !liq-pt-6 !sm:liq-pb-6 !lg:liq-p-4`,children:(0,f.jsxs)(`div`,{className:`liq-align-center liq-flex liq-flex-col liq-justify-center liq-gap-8`,children:[(0,f.jsx)(`div`,{className:`liq-flex liq-items-center liq-justify-center`,children:(0,f.jsx)(m.FontAwesomeIcon,{icon:b.faClock,size:`6x`,className:`liq-rounded-full liq-bg-primary-400 liq-text-[#2b617a]`})}),(0,f.jsxs)(`div`,{className:n.mxClsx(`liq-flex liq-flex-col liq-items-center`),children:[(0,f.jsx)(`div`,{className:`liq-text-xl`,children:`No transactions`}),(0,f.jsx)(`div`,{className:`liq-text-neutral-400`,children:`Your transactions history will appear here`})]})]})}),M&&M?.length>0&&M.map((r,s)=>(0,f.jsx)(i.MxCard,{cardSize:`lg`,variant:`neutral-750`,className:`liq-flex liq-flex-col liq-gap-4 !liq-outline liq-outline-transparent !liq-p-4 liq-border liq-border-neutral-750 liq-bg-neutral-850 hover:!liq-bg-neutral-700 !liq-rounded-lg`,children:(0,f.jsxs)(`div`,{className:`liq-align-center liq-flex liq-justify-between liq-gap-1`,children:[(0,f.jsxs)(`div`,{className:n.mxClsx(`liq-flex liq-items-center liq-gap-1`,{"liq-text-yellow-200":r.status===`pending`,"liq-text-green-200":r.status===`success`,"liq-text-red-200":r.status===`failed`}),children:[(0,f.jsx)(a.MxTooltip,{placement:`top`,buttonText:r.statusIcon,children:new Date(r.depositTimestamp*1e3).toLocaleString()}),e.MVX_CHAIN_IDS.includes(r.toChainId)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.MxTooltip,{placement:`top`,buttonText:(0,f.jsx)(m.FontAwesomeIcon,{icon:g.faArrowDownShortWide,className:`liq-mx-1 liq-flex liq-items-center`}),children:`Deposit`}),(0,f.jsx)(`span`,{className:`liq-text-wrap`,children:o.formatAmount({decimals:R[r.tokenDestination]?.decimals,amount:r.amountOut,addCommas:!1,digits:2})}),(0,f.jsx)(`span`,{className:`liq-whitespace-nowrap`,children:R[r.tokenDestination]?.symbol}),(0,f.jsx)(`img`,{src:t.safeImageUrl(R[r.tokenDestination]?.pngUrl),alt:``,className:`liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg`}),(0,f.jsx)(`span`,{className:`liq-whitespace-nowrap`,children:`from`}),(0,f.jsx)(`span`,{className:`liq-text-wrap`,children:o.formatAmount({decimals:R[r.tokenSource]?.decimals,amount:r.amountIn,addCommas:!1,digits:2})}),(0,f.jsx)(`span`,{className:`liq-whitespace-nowrap`,children:R[r.tokenSource]?.symbol}),(0,f.jsxs)(`div`,{className:`liq-flex liq-items-center liq-relative`,children:[(0,f.jsx)(`div`,{className:`liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full liq-h-8 liq-w-8 liq-flex liq-items-center liq-justify-center`,children:(0,f.jsx)(`div`,{className:`liq-h-6 liq-w-6 liq-flex liq-items-center liq-justify-center`,children:(0,f.jsx)(`img`,{src:t.safeImageUrl(R[r.tokenSource]?.pngUrl),alt:``,className:`liq-asset-icon liq-sm liq-p-0`})})}),(0,f.jsx)(`img`,{src:t.safeImageUrl(z[r.fromChainId]?.pngUrl),alt:``,className:`liq-absolute liq-left-3 liq-bottom-[-2px] liq-chain-icon liq-sm liq-w-5 liq-h-5 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg`})]})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.MxTooltip,{placement:`top`,buttonText:(0,f.jsx)(m.FontAwesomeIcon,{icon:_.faArrowUpShortWide,className:`liq-mx-1 liq-flex liq-items-center`}),children:`Transfer`}),(0,f.jsx)(`span`,{className:`liq-text-wrap`,children:o.formatAmount({decimals:R[r.tokenSource]?.decimals,amount:r.amountIn,addCommas:!1,digits:2})}),(0,f.jsx)(`span`,{className:`liq-whitespace-nowrap`,children:R[r.tokenSource]?.symbol}),(0,f.jsx)(`img`,{src:t.safeImageUrl(R[r.tokenSource]?.pngUrl),alt:``,className:`liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg`}),(0,f.jsx)(`span`,{className:`liq-whitespace-nowrap`,children:`to`}),(0,f.jsx)(`span`,{className:`liq-text-wrap`,children:o.formatAmount({decimals:R[r.tokenDestination]?.decimals,amount:r.amountOut,addCommas:!1,digits:2})}),(0,f.jsx)(`span`,{className:`liq-whitespace-nowrap`,children:R[r.tokenDestination]?.symbol}),(0,f.jsxs)(`div`,{className:`liq-flex liq-items-center liq-relative`,children:[(0,f.jsx)(`div`,{className:`liq-flex-shrink-0 liq-overflow-hidden liq-rounded-full liq-h-8 liq-w-8 liq-flex liq-items-center liq-justify-center`,children:(0,f.jsx)(`div`,{className:`liq-h-6 liq-w-6 liq-flex liq-items-center liq-justify-center`,children:(0,f.jsx)(`img`,{src:t.safeImageUrl(R[r.tokenDestination]?.pngUrl),alt:``,className:`liq-asset-icon liq-sm liq-p-0`})})}),(0,f.jsx)(`img`,{src:t.safeImageUrl(z[r.toChainId]?.pngUrl),alt:``,className:`liq-absolute liq-left-3 liq-bottom-[-2px] liq-chain-icon liq-sm liq-w-5 liq-h-5 liq-border-[3px] liq-border-neutral-850 liq-rounded-lg`})]})]})]}),r.provider===l.ProviderType.MultiversxBridge&&(0,f.jsx)(`a`,{href:`${C.bridgeURL}/status/${r.txHash}`,target:`_blank`,rel:`noopener noreferrer`,className:`liq-flex`,children:(0,f.jsx)(`div`,{className:`liq-ml-auto liq-mr-0 liq-flex liq-items-center liq-gap-1`,children:(0,f.jsx)(a.MxTooltip,{placement:`top`,buttonText:(0,f.jsx)(`img`,{src:`data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M15%206V13C15%2013.5625%2014.5312%2014%2014%2014C13.4375%2014%2013%2013.5625%2013%2013V8.4375L6.6875%2014.7188C6.3125%2015.125%205.65625%2015.125%205.28125%2014.7188C4.875%2014.3438%204.875%2013.6875%205.28125%2013.3125L11.5625%207H7C6.4375%207%206%206.5625%206%206C6%205.46875%206.4375%205%207%205H14C14.5312%205%2015%205.46875%2015%206Z'%20fill='%23CDD0DB'/%3e%3c/svg%3e`,alt:``,className:`liq-flex liq-items-center liq-justify-center liq-rounded-full liq-text-neutral-200`}),shouldStopPropagation:!1,children:`View`})})})]})},`${r.txHash}-${s}`))]})]})};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return x}});
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers/base64Utils.js"),t=require("./helpers/decodeLoginToken.js"),n=require("./helpers/decodeToken.js"),r=require("./api/confirmRate.js"),i=require("./api/getChains.js"),a=require("./api/getRate.js"),
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers/base64Utils.js"),t=require("./helpers/decodeLoginToken.js"),n=require("./helpers/decodeToken.js"),r=require("./api/confirmRate.js"),i=require("./api/getChains.js"),a=require("./api/getRate.js"),ee=require("./api/getTokens.js"),te=require("./api/getTokensBalances.js"),ne=require("./api/getTransactions.js"),re=require("./helpers/serializeTransaction.js"),ie=require("./api/sendTransactions.js"),ae=require("./api/checkAccount.js");require("./api/index.js");const o=require("./constants/index.js");require("./dto/index.js");const s=require("./helpers/getApiURL.js"),c=require("./helpers/getBridgeURL.js"),l=require("./chains-Bmeag21l.js"),u=require("./reactjs/constants/index.js"),d=require("./helpers/getDisplayName.js"),f=require("./helpers/getMvxApiURL.js"),p=require("./helpers/getMvxChainId.js"),m=require("./helpers/getMvxExplorerAddress.js"),h=require("./helpers/safeImageUrl.js"),g=require("./helpers/isValidAddressForChainType.js");require("./helpers/index.js");const _=require("./reactjs/utils/mxClsx.js"),v=require("./reactjs/components/TrimAddress/TrimAddress.js"),y=require("./reactjs/components/AccountAddress/AccountAddress.js"),b=require("./reactjs/components/base/MxButton/MxButton.js"),x=require("./reactjs/components/base/MxCard/MxCard.js"),S=require("./reactjs/components/base/MxLink/MxLink.js"),C=require("./reactjs/components/base/MxLoadSkeleton/MxLoadSkeleton.js"),w=require("./reactjs/hooks/useDebounce.js"),T=require("./reactjs/components/base/MxSearch/MxSearch.js"),E=require("./reactjs/components/base/MxSlideover/MxSlideover.js"),D=require("./reactjs/components/base/MxTooltip/MxTooltip.js"),O=require("./reactjs/components/AmountCard/AmountCard.js"),k=require("./reactjs/components/AmountInput/AmountInput.js"),A=require("./reactjs/utils/delay.js"),j=require("./reactjs/utils/isStringFloat.js"),M=require("./reactjs/utils/roundAmount.js"),N=require("./reactjs/utils/formatAmount.js"),P=require("./reactjs/utils/removeCommas.js"),F=require("./reactjs/utils/getCleanStringAmount.js"),I=require("./reactjs/utils/getCompletePathname.js"),L=require("./reactjs/utils/getInitialTokens.js"),R=require("./reactjs/utils/testNumber.js"),z=require("./reactjs/utils/hasEnoughFunds.js"),B=require("./reactjs/utils/pipe.js"),V=require("./reactjs/context/Web3AppProvider.js"),H=require("./reactjs/context/useWeb3App.js"),U=require("./reactjs/hooks/useAccount.js"),W=require("./reactjs/hooks/useBridgeApiChainId.js"),oe=require("./reactjs/hooks/validation/useTestHasEnoughFunds.js"),G=require("./reactjs/hooks/validation/useTestIsConnected.js"),K=require("./reactjs/hooks/validation/useAmountSchema.js"),q=require("./reactjs/hooks/validation/useSecondAmountSchema.js"),J=require("./reactjs/hooks/useBridgeFormik.js"),se=require("./reactjs/queries/useGetAllTokens.query.js"),Y=require("./reactjs/queries/useGetMvxTokensBalances.query.js"),ce=require("./reactjs/hooks/useBalances.js"),le=require("./reactjs/hooks/useGetChainId.js"),ue=require("./reactjs/queries/useGetChains.query.js"),de=require("./reactjs/hooks/useResolveTokenChain.js"),fe=require("./reactjs/hooks/useSendTransactions.js"),pe=require("./reactjs/hooks/useSignTransaction.js"),me=require("./reactjs/hooks/useSuiConnect.js"),X=require("./useFetchBridgeData-BUeRPF3t.js"),Z=require("./reactjs/queries/useGetHistory.query.js"),he=require("./reactjs/queries/useGetRate.mutation.js"),ge=require("./BridgeHistory-D3Zg2V1U.js"),_e=require("./reactjs/components/Connect/CustomConnectButton.js"),ve=require("./reactjs/components/Connect/BridgeConnectButton.js"),ye=require("./reactjs/components/Connect/MvxConnectButton.js"),be=require("./reactjs/components/Connect/SwitchChainButton.js"),xe=require("./reactjs/components/CopyButton/CopyButton.js"),Se=require("./reactjs/components/Connect/BridgeAccountDisplay.js"),Ce=require("./reactjs/components/Connect/MvxAccountDisplay.js"),we=require("./reactjs/components/Connect/ChainSelectConnect.js"),Te=require("./reactjs/components/SmallLoader/SmallLoader.js"),Ee=require("./reactjs/components/DisplayAmount/DisplayAmount.js"),De=require("./reactjs/components/TokenSelector/TokenSelector.js"),Oe=require("./reactjs/components/BridgeForm/BridgeForm.js"),ke=require("./reactjs/components/TransactionToast/TransactionToastContainer.js"),Ae=require("./reactjs/components/TransactionToast/TransactionToast.js"),je=require("./reactjs/components/Error/Error.js"),Me=require("./reactjs/context/queryClient.js"),Q=require("./reactjs/init/init.js");require("./reactjs/index.js"),require("./types/index.js");let $=require("@reown/appkit/react"),Ne=require("wagmi");exports.ALL_NETWORK_ID=l.t,exports.AccountAddress=y.AccountAddress,exports.AmountCard=O.AmountCard,exports.AmountInput=k.AmountInput,exports.BridgeAccountDisplay=Se.BridgeAccountDisplay,exports.BridgeConnectButton=ve.BridgeConnectButton,exports.BridgeForm=Oe.BridgeForm,exports.BridgeFormikValuesEnum=J.BridgeFormikValuesEnum,exports.BridgeHistory=ge.t,exports.ChainName=l.n,exports.ChainSelectConnect=we.ChainSelectConnect,exports.CopyButton=xe.CopyButton,exports.CustomConnectButton=_e.CustomConnectButton,exports.DisplayAmount=Ee.DisplayAmount,exports.Error=je.Error,exports.MVX_CHAIN_IDS=o.MVX_CHAIN_IDS,exports.MvxAccountDisplay=Ce.MvxAccountDisplay,exports.MvxConnectButton=ye.MvxConnectButton,exports.MxButton=b.MxButton,exports.MxCard=x.MxCard,exports.MxLink=S.MxLink,exports.MxLoadSkeleton=C.MxLoadSkeleton,exports.MxSearch=T.MxSearch,exports.MxSlideover=E.MxSlideover,exports.MxTooltip=D.MxTooltip,exports.SmallLoader=Te.SmallLoader,exports.SuiMethods=Q.SuiMethods,exports.SwitchChainButton=be.SwitchChainButton,exports.TokenSelector=De.TokenSelector,exports.TransactionToast=Ae.TransactionToast,exports.TransactionToastContainer=ke.TransactionToastContainer,exports.TrimAddress=v.TrimAddress,exports.Web3AppContext=V.Web3AppContext,exports.Web3AppProvider=V.Web3AppProvider,exports.chainIdentifier=l.r,exports.checkAccount=ae.checkAccount,exports.confirmRate=r.confirmRate,exports.decodeBase64=e.decodeBase64,exports.decodeLoginToken=t.decodeLoginToken,exports.decodeToken=n.decodeToken,exports.delay=A.delay,exports.encodeToBase64=e.encodeToBase64,exports.formatAmount=N.formatAmount,exports.getApiURL=s.getApiURL,exports.getBridgeURL=c.getBridgeURL,exports.getChains=i.getChains,exports.getCleanStringAmount=F.getCleanStringAmount,exports.getCompletePathname=I.getCompletePathname,exports.getDisplayName=d.getDisplayName,exports.getInitialTokens=L.getInitialTokens,exports.getMvxApiURL=f.getMvxApiURL,exports.getMvxChainId=p.getMvxChainId,exports.getMvxExplorerAddress=m.getMvxExplorerAddress,exports.getQueryClient=Me.getQueryClient,exports.getRate=a.getRate,exports.getTokens=ee.getTokens,exports.getTokensBalances=te.getTokensBalances,exports.getTransactions=ne.getTransactions,exports.hasEnoughFunds=z.hasEnoughFunds,exports.init=Q.init,exports.isStringBase64=e.isStringBase64,exports.isStringFloat=j.isStringFloat,exports.isValidAddressForChainType=g.isValidAddressForChainType,exports.mxClsx=_.mxClsx,exports.pipe=B.pipe,exports.removeCommas=P.removeCommas,exports.roundAmount=M.roundAmount,exports.safeDocument=u.safeDocument,exports.safeImageUrl=h.safeImageUrl,exports.safeWindow=u.safeWindow,exports.sendTransactions=ie.sendTransactions,exports.serializeTransaction=re.serializeTransaction,exports.testNumber=R.testNumber,exports.useAccount=U.useAccount,exports.useAmountSchema=K.useAmountSchema,exports.useAppKit=$.useAppKit,exports.useAppKitAccount=$.useAppKitAccount,exports.useAppKitEvents=$.useAppKitEvents,exports.useAppKitNetwork=$.useAppKitNetwork,exports.useAppKitNetworkCore=$.useAppKitNetworkCore,exports.useAppKitProvider=$.useAppKitProvider,exports.useAppKitState=$.useAppKitState,exports.useAppKitTheme=$.useAppKitTheme,exports.useBalances=ce.useBalances,exports.useBridgeApiChainId=W.useBridgeApiChainId,exports.useBridgeFormik=J.useBridgeFormik,exports.useDebounce=w.useDebounce,exports.useDisconnect=$.useDisconnect,exports.useFetchBridgeData=X.t,exports.useFetchTokens=X.n,exports.useGetAllTokensQuery=se.useGetAllTokensQuery,exports.useGetChainId=le.useGetChainId,exports.useGetChainsQuery=ue.useGetChainsQuery,exports.useGetHistoryQuery=Z.useGetHistoryQuery,exports.useGetMvxTokensBalancesQuery=Y.useGetMvxTokensBalancesQuery,exports.useGetNonMvxTokensBalancesQuery=X.r,exports.useGetRateMutation=he.useGetRateMutation,exports.useInvalidateEvmTokensBalances=X.i,exports.useInvalidateHistoryQuery=Z.useInvalidateHistoryQuery,exports.useInvalidateMvxTokensBalancesQuery=Y.useInvalidateMvxTokensBalancesQuery,exports.useResolveTokenChain=de.useResolveTokenChain,exports.useSecondAmountSchema=q.useSecondAmountSchema,exports.useSendTransactions=fe.useSendTransactions,exports.useSignTransaction=pe.useSignTransaction,exports.useSuiConnect=me.useSuiConnect,exports.useTestHasEnoughFunds=oe.useTestHasEnoughFunds,exports.useTestIsConnected=G.useTestIsConnected,exports.useWaitForTransactionReceipt=Ne.useWaitForTransactionReceipt,exports.useWalletInfo=$.useWalletInfo,exports.useWeb3App=H.useWeb3App;
|
package/index.mjs
CHANGED
|
@@ -30,63 +30,64 @@ import { AccountAddress as A } from "./reactjs/components/AccountAddress/Account
|
|
|
30
30
|
import { MxButton as j } from "./reactjs/components/base/MxButton/MxButton.mjs";
|
|
31
31
|
import { MxCard as M } from "./reactjs/components/base/MxCard/MxCard.mjs";
|
|
32
32
|
import { MxLink as N } from "./reactjs/components/base/MxLink/MxLink.mjs";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
33
|
+
import { MxLoadSkeleton as P } from "./reactjs/components/base/MxLoadSkeleton/MxLoadSkeleton.mjs";
|
|
34
|
+
import { useDebounce as F } from "./reactjs/hooks/useDebounce.mjs";
|
|
35
|
+
import { MxSearch as I } from "./reactjs/components/base/MxSearch/MxSearch.mjs";
|
|
36
|
+
import { MxSlideover as L } from "./reactjs/components/base/MxSlideover/MxSlideover.mjs";
|
|
37
|
+
import { MxTooltip as R } from "./reactjs/components/base/MxTooltip/MxTooltip.mjs";
|
|
38
|
+
import { AmountCard as z } from "./reactjs/components/AmountCard/AmountCard.mjs";
|
|
39
|
+
import { AmountInput as B } from "./reactjs/components/AmountInput/AmountInput.mjs";
|
|
40
|
+
import { delay as V } from "./reactjs/utils/delay.mjs";
|
|
41
|
+
import { isStringFloat as H } from "./reactjs/utils/isStringFloat.mjs";
|
|
42
|
+
import { roundAmount as U } from "./reactjs/utils/roundAmount.mjs";
|
|
43
|
+
import { formatAmount as W } from "./reactjs/utils/formatAmount.mjs";
|
|
44
|
+
import { removeCommas as G } from "./reactjs/utils/removeCommas.mjs";
|
|
45
|
+
import { getCleanStringAmount as K } from "./reactjs/utils/getCleanStringAmount.mjs";
|
|
46
|
+
import { getCompletePathname as q } from "./reactjs/utils/getCompletePathname.mjs";
|
|
47
|
+
import { getInitialTokens as J } from "./reactjs/utils/getInitialTokens.mjs";
|
|
48
|
+
import { testNumber as Y } from "./reactjs/utils/testNumber.mjs";
|
|
49
|
+
import { hasEnoughFunds as X } from "./reactjs/utils/hasEnoughFunds.mjs";
|
|
50
|
+
import { pipe as Z } from "./reactjs/utils/pipe.mjs";
|
|
51
|
+
import { Web3AppContext as Q, Web3AppProvider as $ } from "./reactjs/context/Web3AppProvider.mjs";
|
|
52
|
+
import { useWeb3App as ee } from "./reactjs/context/useWeb3App.mjs";
|
|
53
|
+
import { useAccount as te } from "./reactjs/hooks/useAccount.mjs";
|
|
54
|
+
import { useBridgeApiChainId as ne } from "./reactjs/hooks/useBridgeApiChainId.mjs";
|
|
55
|
+
import { useTestHasEnoughFunds as re } from "./reactjs/hooks/validation/useTestHasEnoughFunds.mjs";
|
|
56
|
+
import { useTestIsConnected as ie } from "./reactjs/hooks/validation/useTestIsConnected.mjs";
|
|
57
|
+
import { useAmountSchema as ae } from "./reactjs/hooks/validation/useAmountSchema.mjs";
|
|
58
|
+
import { useSecondAmountSchema as oe } from "./reactjs/hooks/validation/useSecondAmountSchema.mjs";
|
|
59
|
+
import { BridgeFormikValuesEnum as se, useBridgeFormik as ce } from "./reactjs/hooks/useBridgeFormik.mjs";
|
|
60
|
+
import { useGetAllTokensQuery as le } from "./reactjs/queries/useGetAllTokens.query.mjs";
|
|
61
|
+
import { useGetMvxTokensBalancesQuery as ue, useInvalidateMvxTokensBalancesQuery as de } from "./reactjs/queries/useGetMvxTokensBalances.query.mjs";
|
|
62
|
+
import { useBalances as fe } from "./reactjs/hooks/useBalances.mjs";
|
|
63
|
+
import { useGetChainId as pe } from "./reactjs/hooks/useGetChainId.mjs";
|
|
64
|
+
import { useGetChainsQuery as me } from "./reactjs/queries/useGetChains.query.mjs";
|
|
65
|
+
import { useResolveTokenChain as he } from "./reactjs/hooks/useResolveTokenChain.mjs";
|
|
66
|
+
import { useSendTransactions as ge } from "./reactjs/hooks/useSendTransactions.mjs";
|
|
67
|
+
import { useSignTransaction as _e } from "./reactjs/hooks/useSignTransaction.mjs";
|
|
68
|
+
import { useSuiConnect as ve } from "./reactjs/hooks/useSuiConnect.mjs";
|
|
69
|
+
import { i as ye, n as be, r as xe, t as Se } from "./useFetchBridgeData-C9hzwYG6.mjs";
|
|
70
|
+
import { useGetHistoryQuery as Ce, useInvalidateHistoryQuery as we } from "./reactjs/queries/useGetHistory.query.mjs";
|
|
71
|
+
import { useGetRateMutation as Te } from "./reactjs/queries/useGetRate.mutation.mjs";
|
|
72
|
+
import { t as Ee } from "./BridgeHistory-B86lT8s-.mjs";
|
|
73
|
+
import { CustomConnectButton as De } from "./reactjs/components/Connect/CustomConnectButton.mjs";
|
|
74
|
+
import { BridgeConnectButton as Oe } from "./reactjs/components/Connect/BridgeConnectButton.mjs";
|
|
75
|
+
import { MvxConnectButton as ke } from "./reactjs/components/Connect/MvxConnectButton.mjs";
|
|
76
|
+
import { SwitchChainButton as Ae } from "./reactjs/components/Connect/SwitchChainButton.mjs";
|
|
77
|
+
import { CopyButton as je } from "./reactjs/components/CopyButton/CopyButton.mjs";
|
|
78
|
+
import { BridgeAccountDisplay as Me } from "./reactjs/components/Connect/BridgeAccountDisplay.mjs";
|
|
79
|
+
import { MvxAccountDisplay as Ne } from "./reactjs/components/Connect/MvxAccountDisplay.mjs";
|
|
80
|
+
import { ChainSelectConnect as Pe } from "./reactjs/components/Connect/ChainSelectConnect.mjs";
|
|
81
|
+
import { SmallLoader as Fe } from "./reactjs/components/SmallLoader/SmallLoader.mjs";
|
|
82
|
+
import { DisplayAmount as Ie } from "./reactjs/components/DisplayAmount/DisplayAmount.mjs";
|
|
83
|
+
import { TokenSelector as Le } from "./reactjs/components/TokenSelector/TokenSelector.mjs";
|
|
84
|
+
import { BridgeForm as Re } from "./reactjs/components/BridgeForm/BridgeForm.mjs";
|
|
85
|
+
import { TransactionToastContainer as ze } from "./reactjs/components/TransactionToast/TransactionToastContainer.mjs";
|
|
86
|
+
import { TransactionToast as Be } from "./reactjs/components/TransactionToast/TransactionToast.mjs";
|
|
87
|
+
import { Error as Ve } from "./reactjs/components/Error/Error.mjs";
|
|
88
|
+
import { getQueryClient as He } from "./reactjs/context/queryClient.mjs";
|
|
89
|
+
import { SuiMethods as Ue, init as We } from "./reactjs/init/init.mjs";
|
|
90
|
+
import { useAppKit as Ge, useAppKitAccount as Ke, useAppKitEvents as qe, useAppKitNetwork as Je, useAppKitNetworkCore as Ye, useAppKitProvider as Xe, useAppKitState as Ze, useAppKitTheme as Qe, useDisconnect as $e, useWaitForTransactionReceipt as et, useWalletInfo as tt } from "./reactjs/reexports.mjs";
|
|
90
91
|
import "./reactjs/index.mjs";
|
|
91
92
|
import "./types/index.mjs";
|
|
92
|
-
export { y as ALL_NETWORK_ID, A as AccountAddress,
|
|
93
|
+
export { y as ALL_NETWORK_ID, A as AccountAddress, z as AmountCard, B as AmountInput, Me as BridgeAccountDisplay, Oe as BridgeConnectButton, Re as BridgeForm, se as BridgeFormikValuesEnum, Ee as BridgeHistory, _ as ChainName, Pe as ChainSelectConnect, je as CopyButton, De as CustomConnectButton, Ie as DisplayAmount, Ve as Error, m as MVX_CHAIN_IDS, Ne as MvxAccountDisplay, ke as MvxConnectButton, j as MxButton, M as MxCard, N as MxLink, P as MxLoadSkeleton, I as MxSearch, L as MxSlideover, R as MxTooltip, Fe as SmallLoader, Ue as SuiMethods, Ae as SwitchChainButton, Le as TokenSelector, Be as TransactionToast, ze as TransactionToastContainer, k as TrimAddress, Q as Web3AppContext, $ as Web3AppProvider, v as chainIdentifier, p as checkAccount, a as confirmRate, e as decodeBase64, r as decodeLoginToken, i as decodeToken, V as delay, t as encodeToBase64, W as formatAmount, h as getApiURL, g as getBridgeURL, o as getChains, K as getCleanStringAmount, q as getCompletePathname, S as getDisplayName, J as getInitialTokens, C as getMvxApiURL, w as getMvxChainId, T as getMvxExplorerAddress, He as getQueryClient, s as getRate, c as getTokens, l as getTokensBalances, u as getTransactions, X as hasEnoughFunds, We as init, n as isStringBase64, H as isStringFloat, D as isValidAddressForChainType, O as mxClsx, Z as pipe, G as removeCommas, U as roundAmount, b as safeDocument, E as safeImageUrl, x as safeWindow, f as sendTransactions, d as serializeTransaction, Y as testNumber, te as useAccount, ae as useAmountSchema, Ge as useAppKit, Ke as useAppKitAccount, qe as useAppKitEvents, Je as useAppKitNetwork, Ye as useAppKitNetworkCore, Xe as useAppKitProvider, Ze as useAppKitState, Qe as useAppKitTheme, fe as useBalances, ne as useBridgeApiChainId, ce as useBridgeFormik, F as useDebounce, $e as useDisconnect, Se as useFetchBridgeData, be as useFetchTokens, le as useGetAllTokensQuery, pe as useGetChainId, me as useGetChainsQuery, Ce as useGetHistoryQuery, ue as useGetMvxTokensBalancesQuery, xe as useGetNonMvxTokensBalancesQuery, Te as useGetRateMutation, ye as useInvalidateEvmTokensBalances, we as useInvalidateHistoryQuery, de as useInvalidateMvxTokensBalancesQuery, he as useResolveTokenChain, oe as useSecondAmountSchema, ge as useSendTransactions, _e as useSignTransaction, ve as useSuiConnect, re as useTestHasEnoughFunds, ie as useTestIsConnected, et as useWaitForTransactionReceipt, tt as useWalletInfo, ee as useWeb3App };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "MultiversX",
|
|
4
4
|
"description": "A complete toolkit for bridging assets between MultiversX, Ethereum, BNB Chain and Sui",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.4.0
|
|
6
|
+
"version": "2.4.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/multiversx/mx-sdk-dapp-liquidity.git"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../constants/index.js"),t=require("../base/MxLoadSkeleton/MxLoadSkeleton.js");require("../base/MxLoadSkeleton/index.js");const n=require("../../utils/getInitialTokens.js");require("../../utils/index.js");const r=require("../../context/useWeb3App.js"),i=require("../../queries/useGetAllTokens.query.js"),a=require("./Deposit.js"),o=require("./Transfer.js");let s=require("react/jsx-runtime"),c=require("react");var l=({mvxChainId:l,mvxAddress:u,username:d,callbackRoute:f=`/`,firstTokenIdentifier:p,secondTokenIdentifier:m,firstTokenAmount:h,secondTokenAmount:g,refetchTrigger:_,showHistory:v,forcedDestinationTokenSymbol:y,onSuccessfullySentTransaction:b,onSuccessfullySentMvxTransaction:x,onFailedSentMvxTransaction:S,onFailedSentTransaction:C,onMvxConnect:w,onMvxDisconnect:T,onHistoryClose:E,onNavigate:D})=>{let{bridgeOnly:O,nativeAuthToken:k}=r.useWeb3App(),{data:A,isLoading:j}=i.useGetAllTokensQuery({nativeAuthToken:k,bridgeOnly:O}),{firstTokenId:M}=n.getInitialTokens({firstTokenId:p}),[N,P]=(0,c.useState)(`deposit`),[F,I]=(0,c.useState)(!M),L=(0,c.useMemo)(()=>{if(!M||!A||j)return!1;let t=A.find(e=>e.address.toLowerCase()===M.toLowerCase());return!!(t&&e.MVX_CHAIN_IDS.includes(t.chainId.toString()))},[M,A,j]),R=(0,c.useRef)(!1);(0,c.useEffect)(()=>{R.current||!A||j||(R.current=!0,L&&P(`withdraw`),I(!0))},[A,L,j]);let z=()=>{O!==!1&&P(e=>e===`deposit`?`withdraw`:`deposit`)};return F?N===`withdraw`?(0,s.jsx)(o.Transfer,{mvxChainId:l,mvxAddress:u,username:d,callbackRoute:f,firstTokenIdentifier:p,secondTokenIdentifier:m,firstTokenAmount:h,secondTokenAmount:g,refetchTrigger:_,showHistory:v,forcedDestinationTokenSymbol:y,direction:N,onChangeDirection:z,onSuccessfullySentTransaction:x,onFailedSentTransaction:S,onHistoryClose:E,onMvxConnect:w,onMvxDisconnect:T,onNavigate:D}):(0,s.jsx)(a.Deposit,{mvxChainId:l,mvxAddress:u,username:d,callbackRoute:f,firstTokenIdentifier:p,secondTokenIdentifier:m,firstTokenAmount:h,secondTokenAmount:g,refetchTrigger:_,showHistory:v,forcedDestinationTokenSymbol:y,direction:N,onChangeDirection:z,onSuccessfullySentTransaction:b,onFailedSentTransaction:C,onHistoryClose:E,onMvxConnect:w,onMvxDisconnect:T,onNavigate:D}):(0,s.jsx)(t.MxLoadSkeleton,{})};exports.BridgeForm=l;
|
|
@@ -1,82 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "
|
|
1
|
+
import { MVX_CHAIN_IDS as e } from "../../../constants/index.mjs";
|
|
2
|
+
import { MxLoadSkeleton as t } from "../base/MxLoadSkeleton/MxLoadSkeleton.mjs";
|
|
3
|
+
import "../base/MxLoadSkeleton/index.mjs";
|
|
3
4
|
import { getInitialTokens as n } from "../../utils/getInitialTokens.mjs";
|
|
4
5
|
import "../../utils/index.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "../base/MxCircleLoader/index.mjs";
|
|
6
|
+
import { useWeb3App as r } from "../../context/useWeb3App.mjs";
|
|
7
|
+
import { useGetAllTokensQuery as i } from "../../queries/useGetAllTokens.query.mjs";
|
|
8
|
+
import { Deposit as a } from "./Deposit.mjs";
|
|
9
|
+
import { Transfer as o } from "./Transfer.mjs";
|
|
10
10
|
import { jsx as s } from "react/jsx-runtime";
|
|
11
|
-
import { useEffect as c,
|
|
11
|
+
import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
12
12
|
//#region src/reactjs/components/BridgeForm/BridgeForm.tsx
|
|
13
|
-
var
|
|
14
|
-
let { bridgeOnly:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}), B = () => {
|
|
22
|
-
k !== !1 && P((e) => e === "deposit" ? "withdraw" : "deposit");
|
|
23
|
-
}, V = F || I || L || R;
|
|
24
|
-
return c(() => {
|
|
25
|
-
if (!(V || N !== void 0)) {
|
|
26
|
-
if (k === !1) {
|
|
27
|
-
P("deposit");
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
P(j && M && r(j, z) ? "withdraw" : "deposit");
|
|
31
|
-
}
|
|
13
|
+
var f = ({ mvxChainId: f, mvxAddress: p, username: m, callbackRoute: h = "/", firstTokenIdentifier: g, secondTokenIdentifier: _, firstTokenAmount: v, secondTokenAmount: y, refetchTrigger: b, showHistory: x, forcedDestinationTokenSymbol: S, onSuccessfullySentTransaction: C, onSuccessfullySentMvxTransaction: w, onFailedSentMvxTransaction: T, onFailedSentTransaction: E, onMvxConnect: D, onMvxDisconnect: O, onHistoryClose: k, onNavigate: A }) => {
|
|
14
|
+
let { bridgeOnly: j, nativeAuthToken: M } = r(), { data: N, isLoading: P } = i({
|
|
15
|
+
nativeAuthToken: M,
|
|
16
|
+
bridgeOnly: j
|
|
17
|
+
}), { firstTokenId: F } = n({ firstTokenId: g }), [I, L] = d("deposit"), [R, z] = d(!F), B = l(() => {
|
|
18
|
+
if (!F || !N || P) return !1;
|
|
19
|
+
let t = N.find((e) => e.address.toLowerCase() === F.toLowerCase());
|
|
20
|
+
return !!(t && e.includes(t.chainId.toString()));
|
|
32
21
|
}, [
|
|
33
|
-
|
|
22
|
+
F,
|
|
34
23
|
N,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
z
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
24
|
+
P
|
|
25
|
+
]), V = u(!1);
|
|
26
|
+
c(() => {
|
|
27
|
+
V.current || !N || P || (V.current = !0, B && L("withdraw"), z(!0));
|
|
28
|
+
}, [
|
|
29
|
+
N,
|
|
30
|
+
B,
|
|
31
|
+
P
|
|
32
|
+
]);
|
|
33
|
+
let H = () => {
|
|
34
|
+
j !== !1 && L((e) => e === "deposit" ? "withdraw" : "deposit");
|
|
35
|
+
};
|
|
36
|
+
return R ? I === "withdraw" ? /* @__PURE__ */ s(o, {
|
|
37
|
+
mvxChainId: f,
|
|
38
|
+
mvxAddress: p,
|
|
39
|
+
username: m,
|
|
40
|
+
callbackRoute: h,
|
|
41
|
+
firstTokenIdentifier: g,
|
|
42
|
+
secondTokenIdentifier: _,
|
|
43
|
+
firstTokenAmount: v,
|
|
44
|
+
secondTokenAmount: y,
|
|
45
|
+
refetchTrigger: b,
|
|
46
|
+
showHistory: x,
|
|
47
|
+
forcedDestinationTokenSymbol: S,
|
|
48
|
+
direction: I,
|
|
49
|
+
onChangeDirection: H,
|
|
50
|
+
onSuccessfullySentTransaction: w,
|
|
51
|
+
onFailedSentTransaction: T,
|
|
52
|
+
onHistoryClose: k,
|
|
53
|
+
onMvxConnect: D,
|
|
54
|
+
onMvxDisconnect: O,
|
|
55
|
+
onNavigate: A
|
|
56
|
+
}) : /* @__PURE__ */ s(a, {
|
|
57
|
+
mvxChainId: f,
|
|
58
|
+
mvxAddress: p,
|
|
59
|
+
username: m,
|
|
60
|
+
callbackRoute: h,
|
|
61
|
+
firstTokenIdentifier: g,
|
|
62
|
+
secondTokenIdentifier: _,
|
|
63
|
+
firstTokenAmount: v,
|
|
64
|
+
secondTokenAmount: y,
|
|
65
|
+
refetchTrigger: b,
|
|
66
|
+
showHistory: x,
|
|
67
|
+
forcedDestinationTokenSymbol: S,
|
|
68
|
+
direction: I,
|
|
69
|
+
onChangeDirection: H,
|
|
70
|
+
onSuccessfullySentTransaction: C,
|
|
71
|
+
onFailedSentTransaction: E,
|
|
72
|
+
onHistoryClose: k,
|
|
73
|
+
onMvxConnect: D,
|
|
74
|
+
onMvxDisconnect: O,
|
|
75
|
+
onNavigate: A
|
|
76
|
+
}) : /* @__PURE__ */ s(t, {});
|
|
80
77
|
};
|
|
81
78
|
//#endregion
|
|
82
|
-
export {
|
|
79
|
+
export { f as BridgeForm };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunk-oiTVcehM.js"),t=require("../../../constants/index.js"),n=require("../../../helpers/getApiURL.js"),r=require("../../../helpers/safeImageUrl.js"),i=require("../../../types/chainType.js");require("../../../helpers/index.js");const a=require("../../utils/mxClsx.js"),o=require("../base/MxButton/MxButton.js");require("../base/index.js");const s=require("../AmountCard/AmountCard.js");require("../AmountCard/index.js");const c=require("../AmountInput/AmountInput.js");require("../AmountInput/index.js");const ee=require("../../hooks/useAccount.js"),te=require("../../context/useWeb3App.js"),l=require("../../hooks/useBridgeFormik.js"),u=require("../../helpers/resolveBridgeApiChainId.js"),ne=require("../../hooks/useBridgeApiChainId.js"),re=require("../../../hooks-SJPsZfDx.js"),ie=require("../../hooks/useGetChainId.js"),ae=require("../../hooks/useSendTransactions.js"),oe=require("../../hooks/useSignTransaction.js"),se=require("./utils/bridgeFormHelpers.js"),ce=require("./hooks/useBridgeTokenSelection.js"),le=require("../../hooks/useDisconnectOnChainTypeChange.js"),ue=require("../../hooks/useNamespaceAddress.js"),de=require("../../queries/useGetHistory.query.js"),fe=require("../../queries/useGetRate.mutation.js"),pe=require("../../../BridgeHistory-0NVr8Uxp.js");require("../BridgeHistory/index.js");const me=require("../Connect/BridgeConnectButton.js"),he=require("../Connect/MvxConnectButton.js"),ge=require("../Connect/BridgeAccountDisplay.js"),_e=require("../Connect/MvxAccountDisplay.js");require("../Connect/index.js");const ve=require("../../../ToggleDirection-CZ9-ZD7Y.js"),ye=require("../TokenSelector/TokenSelector.js");require("../TokenSelector/index.js");let d=require("react/jsx-runtime"),f=require("react"),be=require("@fortawesome/react-fontawesome"),xe=require("@reown/appkit/react"),Se=require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount"),Ce=require("@fortawesome/free-solid-svg-icons/faSpinner"),we=require("@wagmi/core"),p=require("lodash/debounce");p=e.n(p);let m=require("react-toastify");var h,g=({mvxChainId:e,mvxAddress:g,username:Te,callbackRoute:Ee=`/`,firstTokenIdentifier:De,secondTokenIdentifier:Oe,firstTokenAmount:_,secondTokenAmount:v,refetchTrigger:ke,showHistory:Ae,forcedDestinationTokenSymbol:je,onSuccessfullySentTransaction:Me,onFailedSentTransaction:Ne,onHistoryClose:Pe,onMvxConnect:Fe,onMvxDisconnect:Ie,onNavigate:Le,onChangeDirection:Re})=>{let ze=(0,f.useRef)(null),Be=(0,f.useRef)(void 0),[y,Ve]=(0,f.useState)(!1),[b,x]=(0,f.useState)(!1),[He,Ue]=(0,f.useState)(1),[S,C]=(0,f.useState)(0),We=ee.useAccount(),{switchNetwork:Ge}=(0,xe.useAppKitNetwork)(),Ke=de.useInvalidateHistoryQuery(),{config:qe,options:Je,supportedChains:w,nativeAuthToken:T,bridgeOnly:Ye}=te.useWeb3App(),E=ie.useGetChainId(),Xe=ne.useBridgeApiChainId(),{evmTokensWithBalances:Ze,mvxTokensWithBalances:Qe,isTokensLoading:$e,isLoadingEvmTokensBalances:et,isLoadingMvxTokensBalances:tt,chains:D=[],isChainsLoading:nt}=re.t({refetchTrigger:ke,mvxAddress:g,mvxApiURL:Je.mvxApiURL}),O=$e||et||tt||nt,rt=(0,f.useMemo)(()=>w.find(e=>u.sameBridgeApiChainId(e.id,E)),[E,w]),k=(0,f.useMemo)(()=>D.find(t=>t.chainId.toString()===e.toString()),[E,D]),{evm:it,solana:at,bitcoin:ot,sui:st}=oe.useSignTransaction(),ct=ae.useSendTransactions(),{mutate:lt,data:A,isPending:j,error:ut}=fe.useGetRateMutation(),M=ut?.response?.status===400?ut?.response?.data.message:void 0,{firstToken:N,secondToken:P,fromOptions:F,toOptions:dt,selectedChainOption:I,onChangeFirstSelect:ft,onChangeSecondSelect:pt,handleChangeDirection:mt}=ce.useBridgeTokenSelection({chains:D,activeChain:rt,sdkChains:w,switchNetwork:(0,f.useCallback)(e=>{let t=w.find(t=>u.sameBridgeApiChainId(t.id,e.id));t&&Ge(t)},[w,Ge]),fromTokens:Ze,toTokens:Qe,firstTokenIdentifier:De,secondTokenIdentifier:Oe,forcedDestinationTokenSymbol:je,isTokensLoading:O,callbackRoute:Ee,onNavigate:Le}),ht=(0,f.useMemo)(()=>N?t.MVX_CHAIN_IDS.includes(N.chainId.toString()):!1,[N?.chainId]),gt=(0,f.useMemo)(()=>P?t.MVX_CHAIN_IDS.includes(P.chainId.toString()):!1,[P?.chainId]),[L,_t]=(0,f.useState)(_??``),[R,z]=(0,f.useState)(v??``),B=(0,f.useMemo)(()=>N?D.find(e=>u.sameBridgeApiChainId(e.chainId,N.chainId))??I:I,[N?.chainId,D,I]),V=(0,f.useMemo)(()=>u.toBridgeApiChainId(N?.chainId)??Xe,[N?.chainId,Xe]);le.useDisconnectOnChainTypeChange(B?.chainType);let H=ue.useNamespaceAddress(B?.chainType),vt=H,yt=We.isConnected&&!!H,U=L!==``&&R!==``,W=(0,f.useCallback)((0,p.default)(async t=>{!t||!Number(t)||!H||!N?.address||!P?.address||!I||!V||lt({nativeAuthToken:T??``,body:{tokenIn:N.address,amountIn:t,fromChainId:V,tokenOut:P.address,toChainId:e}})},500),[H,V,N?.address,P?.address,I,e,T,lt]),G=(0,f.useCallback)(e=>{_t(()=>e)},[]),K=(0,f.useCallback)(e=>{z(()=>e)},[]),bt=(0,f.useCallback)(()=>{Pe?.()},[Pe]),xt=(0,f.useCallback)(()=>{let e=(0,Se.formatAmount)({decimals:N?.decimals,input:N?.balance??`0`,addCommas:!1,digits:4});q.setFieldValue(`firstAmount`,e),G(e)},[N?.balance,N?.decimals,G]),St=(0,f.useCallback)(async e=>{G(``),K(``),Ke(),Ke(),Me?.(e)},[G,K,Me]),Ct=()=>{mt(),Re()};(0,f.useEffect)(()=>{let e=Be.current;if(Be.current=I?.chainId,e&&N?.chainId&&I?.chainId!==N.chainId){let e=F?.find(e=>e.chainId.toString()===I?.chainId);if(!e)return;ft(e)}},[I?.chainId,N?.chainId,F]);let wt=(0,f.useCallback)(async({transactions:e,provider:t})=>{let r=[];x(!0),C(()=>e.length);try{let a=-1;for(let t of e){++a;try{switch(se.resolveSigningChainType(t,B)){case i.ChainType.evm:{let n=await it.signTransaction({...t,value:BigInt(t.value),gas:BigInt(t.gasLimit),account:vt});if(!n||(r.push({...t,txHash:n}),a===e.length-1||!n))break;let i=await(0,we.waitForTransactionReceipt)(qe,{confirmations:1,hash:n});console.info({transactionReceipt:i,hash:n});break}case i.ChainType.sol:if(!t.instructions||!t.feePayer)break;let n=await at.signTransaction({feePayer:t.feePayer,instructions:t.instructions,recentBlockhash:t.recentBlockhash});if(!n)break;r.push({...t,txHash:n});break;case i.ChainType.btc:if(!t.bitcoinParams){console.error(`No bitcoin params`);break}let o=await ot.signTransaction(t.bitcoinParams);r.push({...t,txHash:o});break;case i.ChainType.sui:{let e=t.suiParams?.transactionBytes,n=t.suiParams?.sender;if(!e||!n){console.error(`No Sui transaction bytes or sender address`);break}let i=await st.signTransaction({transaction:e,address:n});if(!i)break;r.push({...t,suiParams:{...t.suiParams,signature:i}});break}default:m.toast.error(`Provider not supported`),x(!1);return}C(()=>e.length-1-a)}catch{m.toast.dismiss(),m.toast.error(`Transaction aborted`),Ne?.(`Transaction aborted`),x(!1);return}}let{data:o}=await ct({transactions:r,provider:t,url:n.getApiURL()??``,token:T??``}),s=o.transactions?.map(e=>e.txHash).filter(e=>!!e)??[],c=r.map(e=>e.txHash).filter(e=>!!e);St(s.length>0?s:c.length>0?c:o.batchId?[o.batchId]:[]),x(!1)}catch(e){console.error(e),m.toast.dismiss(),m.toast.error(`Transaction cancelled`),Ne?.(`Transaction cancelled`),x(!1),C(0),Ot(),G(``),K(``)}},[B,vt,qe,G,K,T,St,ct,ot.signTransaction,it.signTransaction,at.signTransaction,st.signTransaction]),{formik:q,firstAmountError:J,secondAmountError:Y,fromChainError:X,senderAddressError:Z,receiverAddressError:Q,confirmRateError:Tt,handleBlur:$,handleChange:Et,handleSubmit:Dt,resetSwapForm:Ot}=l.useBridgeFormik({isMvxConnected:!!g,rate:A,sender:H??``,receiver:g??``,firstToken:N,firstAmount:L,fromChainId:V,toChainId:e,secondToken:P,secondAmount:R,setForceRefetchRate:Ue,senderChainType:B?.chainType,receiverChainType:i.ChainType.mvx,onSubmit:wt}),kt=!!(J||Y||X||M||Z||Q||Tt),At=(0,f.useMemo)(()=>L===``?void 0:M??J,[J,L,M]),jt=(0,f.useMemo)(()=>R===``?void 0:X??Y,[X,Y,R]);return(0,f.useEffect)(()=>(L||z(``),W(L),h&&clearInterval(h),h=setInterval(()=>{W(L)},50*1e3),()=>clearInterval(h)),[L,He,W]),(0,f.useEffect)(()=>{A?.amountOut&&(q.setFieldValue(l.BridgeFormikValuesEnum.secondAmount,A.amountOut),z(A.amountOut))},[A?.amountOut]),(0,f.useEffect)(()=>{M&&(q.setFieldValue(l.BridgeFormikValuesEnum.secondAmount,`0`),z(`0`))},[M]),(0,f.useEffect)(()=>{_&&(q.setFieldValue(l.BridgeFormikValuesEnum.firstAmount,_),G(_))},[]),(0,f.useEffect)(()=>{v&&(q.setFieldValue(l.BridgeFormikValuesEnum.secondAmount,v),K(v))},[v]),(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(`form`,{ref:ze,noValidate:!0,className:`liq-flex liq-flex-col liq-gap-1 liq-relative`,autoComplete:`off`,onSubmit:Dt,children:[Ae&&(0,d.jsx)(pe.t,{mvxAddress:g,onClose:bt}),(0,d.jsxs)(s.AmountCard,{className:a.mxClsx(`liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6`,{"liq-pointer-events-none":y,"focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80":!y}),children:[(0,d.jsxs)(`div`,{className:`liq-flex liq-items-center liq-gap-1`,children:[(0,d.jsx)(`span`,{children:`From`}),(0,d.jsx)(ge.BridgeAccountDisplay,{disabled:j,activeChain:B})]}),Z&&(0,d.jsx)(`div`,{className:`liq-text-red-400 liq-text-xs liq-mt-1`,children:Z}),(0,d.jsxs)(`div`,{className:`liq-flex liq-justify-between liq-gap-1`,children:[(0,d.jsx)(c.AmountInput,{inputName:`firstAmount`,inputValue:q.values.firstAmount,amountError:At,disabled:!1,onInputDebounceChange:G,onInputChange:Et,onBlur:$}),(0,d.jsx)(ye.TokenSelector,{name:`firstToken`,disabled:j,options:F,areOptionsLoading:O,isMvxSelector:ht,isDestination:!1,color:`neutral-850`,onChange:ft,onBlur:$,onMaxBtnClick:xt,selectedOption:N,onTokenSelectorDisplay:e=>Ve(e)})]})]}),(0,d.jsx)(`div`,{className:`liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10`,children:Ye&&(0,d.jsx)(ve.t,{onChangeDirection:Ct})}),(0,d.jsxs)(s.AmountCard,{className:a.mxClsx(`liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6`,{"liq-pointer-events-none":y}),children:[(0,d.jsxs)(`div`,{className:`liq-flex liq-items-center liq-gap-1`,children:[(0,d.jsx)(`span`,{children:`To`}),(0,d.jsx)(_e.MvxAccountDisplay,{accountAddress:g,chainIcon:r.safeImageUrl(k?.pngUrl),username:Te,accountExplorerUrl:`${Je.mvxExplorerAddress}/accounts/${g}`,showTag:!0,onDisconnect:Ie,onConnect:Fe})]}),Q&&(0,d.jsx)(`div`,{className:`liq-text-red-400 liq-text-xs liq-mt-1`,children:Q}),Tt&&(0,d.jsx)(`div`,{className:`liq-text-red-400 liq-text-xs liq-mt-1`,children:Tt}),(0,d.jsxs)(`div`,{className:`liq-flex liq-justify-between liq-gap-1`,children:[(0,d.jsx)(c.AmountInput,{inputName:`secondAmount`,inputValue:q.values.secondAmount,amountError:jt,disabled:!1,onInputDebounceChange:K,onInputChange:Et,onBlur:$}),(0,d.jsx)(ye.TokenSelector,{name:`secondToken`,disabled:j,omitDisableClass:!0,options:dt,areOptionsLoading:O,isMvxSelector:gt,color:`neutral-850`,onChange:pt,onBlur:$,selectedOption:P})]})]}),(0,d.jsxs)(`div`,{className:`liq-flex liq-items-center liq-justify-center`,children:[!g&&(0,d.jsx)(he.MvxConnectButton,{mvxAccountAddress:g,icon:r.safeImageUrl(k?.pngUrl),onClick:Fe}),g&&!yt&&(0,d.jsx)(me.BridgeConnectButton,{className:`liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50`,disabled:j,activeChain:B}),g&&yt&&(0,d.jsxs)(o.MxButton,{type:`submit`,variant:`neutral-850`,className:`liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200`,disabled:!U||j||!g||!H||kt||b,children:[U&&!b&&(0,d.jsxs)(`div`,{className:`liq-flex liq-justify-center liq-items-center liq-gap-2`,children:[(0,d.jsx)(`div`,{children:`Deposit on `}),(0,d.jsx)(`img`,{src:r.safeImageUrl(k?.pngUrl),alt:``,className:`liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg`}),(0,d.jsx)(`div`,{children:`MultiversX`})]}),!U&&!b&&(0,d.jsx)(`span`,{className:`liq-text-neutral-100`,children:`Enter amount`}),b&&(0,d.jsxs)(`div`,{className:`liq-flex liq-justify-center liq-items-center liq-gap-2`,children:[(0,d.jsx)(be.FontAwesomeIcon,{icon:Ce.faSpinner,spin:!0,className:`liq-mx-1 liq-flex liq-items-center`}),(0,d.jsx)(`div`,{children:`Depositing on`}),(0,d.jsx)(`img`,{src:r.safeImageUrl(k?.pngUrl),alt:``,className:`liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg`}),(0,d.jsx)(`div`,{children:`MultiversX`})]})]})]}),H&&S>0&&(0,d.jsx)(`div`,{className:`liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm`,children:(0,d.jsxs)(`div`,{children:[`You will be asked to sign `,S,` `,S>1?`transactions`:`transaction`,` `,`on your wallet`]})})]})})};exports.Deposit=g;
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../../chunk-oiTVcehM.js"),t=require("../../../constants/index.js"),n=require("../../../helpers/getApiURL.js"),r=require("../../../helpers/safeImageUrl.js"),i=require("../../../types/chainType.js");require("../../../helpers/index.js");const a=require("../../utils/mxClsx.js"),o=require("../base/MxButton/MxButton.js");require("../base/index.js");const s=require("../AmountCard/AmountCard.js");require("../AmountCard/index.js");const c=require("../AmountInput/AmountInput.js");require("../AmountInput/index.js");const l=require("../../helpers/resolveBridgeApiChainId.js"),ee=require("./utils/bridgeFormHelpers.js"),te=require("./hooks/useBridgeTokenSelection.js"),ne=require("../../context/useWeb3App.js"),re=require("../../hooks/useAccount.js"),ie=require("../../hooks/useBridgeApiChainId.js"),u=require("../../hooks/useBridgeFormik.js"),ae=require("../../hooks/useDisconnectOnChainTypeChange.js"),oe=require("../../hooks/useGetChainId.js"),se=require("../../hooks/useSendTransactions.js"),ce=require("../../hooks/useSignTransaction.js"),le=require("../../../useFetchBridgeData-BUeRPF3t.js"),ue=require("../../hooks/useNamespaceAddress.js"),de=require("../../queries/useGetHistory.query.js"),fe=require("../../queries/useGetRate.mutation.js"),pe=require("../../../BridgeHistory-D3Zg2V1U.js");require("../BridgeHistory/index.js");const me=require("../Connect/BridgeConnectButton.js"),he=require("../Connect/MvxConnectButton.js"),ge=require("../Connect/BridgeAccountDisplay.js"),_e=require("../Connect/MvxAccountDisplay.js");require("../Connect/index.js");const ve=require("../../../ToggleDirection-CZ9-ZD7Y.js"),ye=require("../TokenSelector/TokenSelector.js");require("../TokenSelector/index.js");let d=require("react/jsx-runtime"),f=require("react"),be=require("@fortawesome/react-fontawesome"),xe=require("@multiversx/sdk-dapp-utils/out/helpers/formatAmount"),Se=require("@fortawesome/free-solid-svg-icons/faSpinner"),Ce=require("@reown/appkit/react"),we=require("@wagmi/core"),p=require("lodash/debounce");p=e.n(p);let m=require("react-toastify");var h,g=({mvxChainId:e,mvxAddress:g,username:Te,callbackRoute:Ee=`/`,firstTokenIdentifier:De,secondTokenIdentifier:Oe,firstTokenAmount:_,secondTokenAmount:v,refetchTrigger:ke,showHistory:Ae,forcedDestinationTokenSymbol:je,onSuccessfullySentTransaction:Me,onFailedSentTransaction:Ne,onHistoryClose:Pe,onMvxConnect:Fe,onMvxDisconnect:Ie,onNavigate:Le,onChangeDirection:Re})=>{let ze=(0,f.useRef)(null),Be=(0,f.useRef)(void 0),[y,Ve]=(0,f.useState)(!1),[b,x]=(0,f.useState)(!1),[He,Ue]=(0,f.useState)(1),[S,C]=(0,f.useState)(0),We=re.useAccount(),{switchNetwork:Ge}=(0,Ce.useAppKitNetwork)(),Ke=de.useInvalidateHistoryQuery(),{config:qe,options:Je,supportedChains:w,nativeAuthToken:T,bridgeOnly:Ye}=ne.useWeb3App(),E=oe.useGetChainId(),Xe=ie.useBridgeApiChainId(),{evmTokensWithBalances:Ze,mvxTokensWithBalances:Qe,isTokensLoading:$e,isLoadingEvmTokensBalances:et,isLoadingMvxTokensBalances:tt,chains:D=[],isChainsLoading:nt}=le.t({refetchTrigger:ke,mvxAddress:g,mvxApiURL:Je.mvxApiURL}),O=$e||et||tt||nt,rt=(0,f.useMemo)(()=>w.find(e=>l.sameBridgeApiChainId(e.id,E)),[E,w]),k=(0,f.useMemo)(()=>D.find(t=>t.chainId.toString()===e.toString()),[E,D]),{evm:it,solana:at,bitcoin:ot,sui:st}=ce.useSignTransaction(),ct=se.useSendTransactions(),{mutate:lt,data:A,isPending:j,error:ut}=fe.useGetRateMutation(),M=ut?.response?.status===400?ut?.response?.data.message:void 0,{firstToken:N,secondToken:P,fromOptions:F,toOptions:dt,selectedChainOption:I,onChangeFirstSelect:ft,onChangeSecondSelect:pt,handleChangeDirection:mt}=te.useBridgeTokenSelection({chains:D,activeChain:rt,sdkChains:w,switchNetwork:(0,f.useCallback)(e=>{let t=w.find(t=>l.sameBridgeApiChainId(t.id,e.id));t&&Ge(t)},[w,Ge]),fromTokens:Ze,toTokens:Qe,firstTokenIdentifier:De,secondTokenIdentifier:Oe,forcedDestinationTokenSymbol:je,isTokensLoading:O,callbackRoute:Ee,onNavigate:Le}),ht=(0,f.useMemo)(()=>N?t.MVX_CHAIN_IDS.includes(N.chainId.toString()):!1,[N?.chainId]),gt=(0,f.useMemo)(()=>P?t.MVX_CHAIN_IDS.includes(P.chainId.toString()):!1,[P?.chainId]),[L,_t]=(0,f.useState)(_??``),[R,z]=(0,f.useState)(v??``),B=(0,f.useMemo)(()=>N?D.find(e=>l.sameBridgeApiChainId(e.chainId,N.chainId))??I:I,[N?.chainId,D,I]),V=(0,f.useMemo)(()=>l.toBridgeApiChainId(N?.chainId)??Xe,[N?.chainId,Xe]);ae.useDisconnectOnChainTypeChange(B?.chainType);let H=ue.useNamespaceAddress(B?.chainType),vt=H,yt=We.isConnected&&!!H,U=L!==``&&R!==``,W=(0,f.useCallback)((0,p.default)(async t=>{!t||!Number(t)||!H||!N?.address||!P?.address||!I||!V||lt({nativeAuthToken:T??``,body:{tokenIn:N.address,amountIn:t,fromChainId:V,tokenOut:P.address,toChainId:e}})},500),[H,V,N?.address,P?.address,I,e,T,lt]),G=(0,f.useCallback)(e=>{_t(()=>e)},[]),K=(0,f.useCallback)(e=>{z(()=>e)},[]),bt=(0,f.useCallback)(()=>{Pe?.()},[Pe]),xt=(0,f.useCallback)(()=>{let e=(0,xe.formatAmount)({decimals:N?.decimals,input:N?.balance??`0`,addCommas:!1,digits:4});q.setFieldValue(`firstAmount`,e),G(e)},[N?.balance,N?.decimals,G]),St=(0,f.useCallback)(async e=>{G(``),K(``),Ke(),Ke(),Me?.(e)},[G,K,Me]),Ct=()=>{mt(),Re()};(0,f.useEffect)(()=>{let e=Be.current;if(Be.current=I?.chainId,e&&N?.chainId&&I?.chainId!==N.chainId){let e=F?.find(e=>e.chainId.toString()===I?.chainId);if(!e)return;ft(e)}},[I?.chainId,N?.chainId,F]);let wt=(0,f.useCallback)(async({transactions:e,provider:t})=>{let r=[];x(!0),C(()=>e.length);try{let a=-1;for(let t of e){++a;try{switch(ee.resolveSigningChainType(t,B)){case i.ChainType.evm:{let n=await it.signTransaction({...t,value:BigInt(t.value),gas:BigInt(t.gasLimit),account:vt});if(!n||(r.push({...t,txHash:n}),a===e.length-1||!n))break;let i=await(0,we.waitForTransactionReceipt)(qe,{confirmations:1,hash:n});console.info({transactionReceipt:i,hash:n});break}case i.ChainType.sol:if(!t.instructions||!t.feePayer)break;let n=await at.signTransaction({feePayer:t.feePayer,instructions:t.instructions,recentBlockhash:t.recentBlockhash});if(!n)break;r.push({...t,txHash:n});break;case i.ChainType.btc:if(!t.bitcoinParams){console.error(`No bitcoin params`);break}let o=await ot.signTransaction(t.bitcoinParams);r.push({...t,txHash:o});break;case i.ChainType.sui:{let e=t.suiParams?.transactionBytes,n=t.suiParams?.sender;if(!e||!n){console.error(`No Sui transaction bytes or sender address`);break}let i=await st.signTransaction({transaction:e,address:n});if(!i)break;r.push({...t,suiParams:{...t.suiParams,signature:i}});break}default:m.toast.error(`Provider not supported`),x(!1);return}C(()=>e.length-1-a)}catch{m.toast.dismiss(),m.toast.error(`Transaction aborted`),Ne?.(`Transaction aborted`),x(!1);return}}let{data:o}=await ct({transactions:r,provider:t,url:n.getApiURL()??``,token:T??``}),s=o.transactions?.map(e=>e.txHash).filter(e=>!!e)??[],c=r.map(e=>e.txHash).filter(e=>!!e);St(s.length>0?s:c.length>0?c:o.batchId?[o.batchId]:[]),x(!1)}catch(e){console.error(e),m.toast.dismiss(),m.toast.error(`Transaction cancelled`),Ne?.(`Transaction cancelled`),x(!1),C(0),Ot(),G(``),K(``)}},[B,vt,qe,G,K,T,St,ct,ot.signTransaction,it.signTransaction,at.signTransaction,st.signTransaction]),{formik:q,firstAmountError:J,secondAmountError:Y,fromChainError:X,senderAddressError:Z,receiverAddressError:Q,confirmRateError:Tt,handleBlur:$,handleChange:Et,handleSubmit:Dt,resetSwapForm:Ot}=u.useBridgeFormik({isMvxConnected:!!g,rate:A,sender:H??``,receiver:g??``,firstToken:N,firstAmount:L,fromChainId:V,toChainId:e,secondToken:P,secondAmount:R,setForceRefetchRate:Ue,senderChainType:B?.chainType,receiverChainType:i.ChainType.mvx,onSubmit:wt}),kt=!!(J||Y||X||M||Z||Q||Tt),At=(0,f.useMemo)(()=>L===``?void 0:M??J,[J,L,M]),jt=(0,f.useMemo)(()=>R===``?void 0:X??Y,[X,Y,R]);return(0,f.useEffect)(()=>(L||z(``),W(L),h&&clearInterval(h),h=setInterval(()=>{W(L)},50*1e3),()=>clearInterval(h)),[L,He,W]),(0,f.useEffect)(()=>{A?.amountOut&&(q.setFieldValue(u.BridgeFormikValuesEnum.secondAmount,A.amountOut),z(A.amountOut))},[A?.amountOut]),(0,f.useEffect)(()=>{M&&(q.setFieldValue(u.BridgeFormikValuesEnum.secondAmount,`0`),z(`0`))},[M]),(0,f.useEffect)(()=>{_&&(q.setFieldValue(u.BridgeFormikValuesEnum.firstAmount,_),G(_))},[]),(0,f.useEffect)(()=>{v&&(q.setFieldValue(u.BridgeFormikValuesEnum.secondAmount,v),K(v))},[v]),(0,d.jsx)(d.Fragment,{children:(0,d.jsxs)(`form`,{ref:ze,noValidate:!0,className:`liq-flex liq-flex-col liq-gap-1 liq-relative`,autoComplete:`off`,onSubmit:Dt,children:[Ae&&(0,d.jsx)(pe.t,{mvxAddress:g,onClose:bt}),(0,d.jsxs)(s.AmountCard,{className:a.mxClsx(`liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6`,{"liq-pointer-events-none":y,"focus-within:liq-outline-neutral-700/75 hover:liq-outline-neutral-700/55 hover:focus-within:liq-outline-neutral-700/80":!y}),children:[(0,d.jsxs)(`div`,{className:`liq-flex liq-items-center liq-gap-1`,children:[(0,d.jsx)(`span`,{children:`From`}),(0,d.jsx)(ge.BridgeAccountDisplay,{disabled:j,activeChain:B})]}),Z&&(0,d.jsx)(`div`,{className:`liq-text-red-400 liq-text-xs liq-mt-1`,children:Z}),(0,d.jsxs)(`div`,{className:`liq-flex liq-justify-between liq-gap-1`,children:[(0,d.jsx)(c.AmountInput,{inputName:`firstAmount`,inputValue:q.values.firstAmount,amountError:At,disabled:!1,onInputDebounceChange:G,onInputChange:Et,onBlur:$}),(0,d.jsx)(ye.TokenSelector,{name:`firstToken`,disabled:j,options:F,areOptionsLoading:O,isMvxSelector:ht,isDestination:!1,color:`neutral-850`,onChange:ft,onBlur:$,onMaxBtnClick:xt,selectedOption:N,onTokenSelectorDisplay:e=>Ve(e)})]})]}),(0,d.jsx)(`div`,{className:`liq-absolute liq-left-[6%] liq-top-[40%] -liq-mt-1 liq-z-10`,children:Ye&&(0,d.jsx)(ve.t,{onChangeDirection:Ct})}),(0,d.jsxs)(s.AmountCard,{className:a.mxClsx(`liq-pb-8 liq-pt-6 hover:liq-bg-neutral-700/50 sm:liq-pb-6`,{"liq-pointer-events-none":y}),children:[(0,d.jsxs)(`div`,{className:`liq-flex liq-items-center liq-gap-1`,children:[(0,d.jsx)(`span`,{children:`To`}),(0,d.jsx)(_e.MvxAccountDisplay,{accountAddress:g,chainIcon:r.safeImageUrl(k?.pngUrl),username:Te,accountExplorerUrl:`${Je.mvxExplorerAddress}/accounts/${g}`,showTag:!0,onDisconnect:Ie,onConnect:Fe})]}),Q&&(0,d.jsx)(`div`,{className:`liq-text-red-400 liq-text-xs liq-mt-1`,children:Q}),Tt&&(0,d.jsx)(`div`,{className:`liq-text-red-400 liq-text-xs liq-mt-1`,children:Tt}),(0,d.jsxs)(`div`,{className:`liq-flex liq-justify-between liq-gap-1`,children:[(0,d.jsx)(c.AmountInput,{inputName:`secondAmount`,inputValue:q.values.secondAmount,amountError:jt,disabled:!1,onInputDebounceChange:K,onInputChange:Et,onBlur:$}),(0,d.jsx)(ye.TokenSelector,{name:`secondToken`,disabled:j,omitDisableClass:!0,options:dt,areOptionsLoading:O,isMvxSelector:gt,color:`neutral-850`,onChange:pt,onBlur:$,selectedOption:P})]})]}),(0,d.jsxs)(`div`,{className:`liq-flex liq-items-center liq-justify-center`,children:[!g&&(0,d.jsx)(he.MvxConnectButton,{mvxAccountAddress:g,icon:r.safeImageUrl(k?.pngUrl),onClick:Fe}),g&&!yt&&(0,d.jsx)(me.BridgeConnectButton,{className:`liq-w-full liq-rounded-xl liq-bg-neutral-850/50 liq-px-8 liq-py-3 liq-font-semibold liq-text-primary-200 liq-transition-colors liq-duration-200 hover:enabled:liq-bg-primary-700/80 disabled:liq-opacity-50`,disabled:j,activeChain:B}),g&&yt&&(0,d.jsxs)(o.MxButton,{type:`submit`,variant:`neutral-850`,className:`liq-w-full disabled:liq-bg-neutral-850/50 liq-py-3 hover:enabled:liq-bg-primary !liq-text-primary-200`,disabled:!U||j||!g||!H||kt||b,children:[U&&!b&&(0,d.jsxs)(`div`,{className:`liq-flex liq-justify-center liq-items-center liq-gap-2`,children:[(0,d.jsx)(`div`,{children:`Deposit on `}),(0,d.jsx)(`img`,{src:r.safeImageUrl(k?.pngUrl),alt:``,className:`liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg`}),(0,d.jsx)(`div`,{children:`MultiversX`})]}),!U&&!b&&(0,d.jsx)(`span`,{className:`liq-text-neutral-100`,children:`Enter amount`}),b&&(0,d.jsxs)(`div`,{className:`liq-flex liq-justify-center liq-items-center liq-gap-2`,children:[(0,d.jsx)(be.FontAwesomeIcon,{icon:Se.faSpinner,spin:!0,className:`liq-mx-1 liq-flex liq-items-center`}),(0,d.jsx)(`div`,{children:`Depositing on`}),(0,d.jsx)(`img`,{src:r.safeImageUrl(k?.pngUrl),alt:``,className:`liq-h-[1.5rem] liq-w-[1.5rem] liq-rounded-lg`}),(0,d.jsx)(`div`,{children:`MultiversX`})]})]})]}),H&&S>0&&(0,d.jsx)(`div`,{className:`liq-flex liq-items-center liq-justify-center liq-text-neutral-300 liq-text-sm`,children:(0,d.jsxs)(`div`,{children:[`You will be asked to sign `,S,` `,S>1?`transactions`:`transaction`,` `,`on your wallet`]})})]})})};exports.Deposit=g;
|