@blockend/widget 1.0.31 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/AllRoutes-CPwuTwqd.js +2209 -0
  2. package/dist/Box-CIChapvH.js +55 -0
  3. package/dist/EstGas-CEFILtyf.js +12867 -0
  4. package/dist/Grow-DJZj9zjv.js +1656 -0
  5. package/dist/InputComp-DqF1JGIu.js +106 -0
  6. package/dist/LoadRoute-r3sHTYXM.js +126 -0
  7. package/dist/QuotesProgress-BXVLxZ8U.js +28 -0
  8. package/dist/SwapAsset-07WvVwl-.js +64 -0
  9. package/dist/Tooltip-CNAsCF8n.js +572 -0
  10. package/dist/TxnButton-D2TTkFYA.js +207 -0
  11. package/dist/WidgetForm.module-QHJ0-m5f.js +9 -0
  12. package/dist/{add-B8AfyNIx.js → add-t2GqC9VA.js} +3 -3
  13. package/dist/{all-wallets-BaLLU39i.js → all-wallets-DFyf0q31.js} +3 -3
  14. package/dist/{app-store-DNpoABj1.js → app-store-aAahwmBP.js} +3 -3
  15. package/dist/{apple-DzzHtaL4.js → apple-DeRgpwlc.js} +3 -3
  16. package/dist/{arrow-bottom-D2c13c51.js → arrow-bottom-DdEOkaAj.js} +3 -3
  17. package/dist/{arrow-bottom-circle-ls9OCLx1.js → arrow-bottom-circle-BWwREWcv.js} +3 -3
  18. package/dist/{arrow-left-BI3rQkNI.js → arrow-left-CulyLmoH.js} +3 -3
  19. package/dist/{arrow-right-rnMzhVod.js → arrow-right-Dwr7TISn.js} +3 -3
  20. package/dist/{arrow-top-CfA6PVMz.js → arrow-top-pL4rM_y8.js} +3 -3
  21. package/dist/{bank-CmpAmHgg.js → bank-CPuyK_08.js} +3 -3
  22. package/dist/basic-CVc9xEvb.js +5783 -0
  23. package/dist/{browser-mEcjgS1H.js → browser-Cbq2Zbp4.js} +3 -3
  24. package/dist/{card-DkgIWcMc.js → card-B_hUtPWK.js} +3 -3
  25. package/dist/ccip-BLVGcR4A.js +228 -0
  26. package/dist/{checkmark-B_A013n2.js → checkmark-WEqTsFAc.js} +3 -3
  27. package/dist/{checkmark-bold-DestuG2T.js → checkmark-bold-Du_ZvhqM.js} +3 -3
  28. package/dist/{chevron-bottom-Di3S86dj.js → chevron-bottom-C-s-lv4L.js} +3 -3
  29. package/dist/{chevron-left-A9Wj-3tj.js → chevron-left-C7NcRElx.js} +3 -3
  30. package/dist/{chevron-right-UFxJogOZ.js → chevron-right-CSzmAmdn.js} +3 -3
  31. package/dist/{chevron-top-BbZs3eaC.js → chevron-top-Dd99Wfel.js} +3 -3
  32. package/dist/{chrome-store-B4F6hJmy.js → chrome-store-C4p77Of0.js} +3 -3
  33. package/dist/{clock-BbAQ09uV.js → clock-Cib24qjH.js} +3 -3
  34. package/dist/clockIcon-C2W5xvyt.js +76 -0
  35. package/dist/{close-CY3oZP_D.js → close-BXjEkTvS.js} +3 -3
  36. package/dist/{coinPlaceholder-DpfsobZT.js → coinPlaceholder-BFNC7cQN.js} +3 -3
  37. package/dist/{compass-CHS7RZFk.js → compass-CXPX5Ycp.js} +3 -3
  38. package/dist/{copy-CEd4nGhs.js → copy-BEawMbmF.js} +3 -3
  39. package/dist/core-Bez9Ow7F.js +14967 -0
  40. package/dist/cursor-Cxq4Q9jk.js +7 -0
  41. package/dist/{cursor-transparent-Tm6k6Ws4.js → cursor-transparent-ZjJ0P2vr.js} +3 -3
  42. package/dist/{desktop-CrSyXZkL.js → desktop-BhZVovAp.js} +3 -3
  43. package/dist/{disconnect-BooT10E1.js → disconnect-AC-bffZO.js} +3 -3
  44. package/dist/{discord-B982Qaml.js → discord-dT97h-CC.js} +3 -3
  45. package/dist/down-DP56YSKp.js +606 -0
  46. package/dist/{etherscan-CFL0IcNl.js → etherscan-rYFRhRTM.js} +3 -3
  47. package/dist/ethertousd-CC_ezooz.js +6 -0
  48. package/dist/{exclamation-triangle-BBeGXYgt.js → exclamation-triangle-C-pCuC08.js} +3 -3
  49. package/dist/{extension-C5WqJw73.js → extension-BnqauLSn.js} +3 -3
  50. package/dist/{external-link-CcSxVDcd.js → external-link-M9D6e_F3.js} +3 -3
  51. package/dist/{facebook-DF0v9ED8.js → facebook-DHezcoD-.js} +3 -3
  52. package/dist/{farcaster-Boq7M4VK.js → farcaster-D0Ky-Imv.js} +3 -3
  53. package/dist/{filters-DfeymbPx.js → filters-B02NYLWq.js} +3 -3
  54. package/dist/getChainIds-CJd2TZYT.js +1888 -0
  55. package/dist/getCosmosAddress-DTZfw04G.js +9565 -0
  56. package/dist/{github-DQ8FV4bD.js → github-BzQkIMuE.js} +3 -3
  57. package/dist/{google-Dm8FDDZR.js → google-BpwCJ4Fs.js} +3 -3
  58. package/dist/hamburger-BzqwkUjE.js +3915 -0
  59. package/dist/{help-circle-CbgiAebR.js → help-circle-C0nOySHC.js} +3 -3
  60. package/dist/{id-CzqxUksI.js → id-DFP_kFd4.js} +3 -3
  61. package/dist/{image-CsCGTIN-.js → image-QiYOAGjM.js} +3 -3
  62. package/dist/index-CDq3vNnP.js +22 -0
  63. package/dist/index-CLzkn733.js +28223 -0
  64. package/dist/index-CjtwASJt.js +252 -0
  65. package/dist/index-CrC4B7xn.js +331 -0
  66. package/dist/index-D5hLIe-N.js +9 -0
  67. package/dist/index-DDk00SOL.js +159 -0
  68. package/dist/index-DTish3yr.js +1014 -0
  69. package/dist/index-DW3W7zaF.js +473 -0
  70. package/dist/index-DXdD3L9f.js +1460 -0
  71. package/dist/index-DaJ1272l.js +18613 -0
  72. package/dist/index-DxPp2gBS.js +992 -0
  73. package/dist/index-Dy_n2MPD.js +3010 -0
  74. package/dist/index-oc8HPfOF.js +13583 -0
  75. package/dist/index.es-Bsr7zP98.js +366 -0
  76. package/dist/index.es-C-j-Ghef.js +11678 -0
  77. package/dist/index.es.js +4 -4
  78. package/dist/{info-fKCfLW0k.js → info-BTLQJ-wd.js} +3 -3
  79. package/dist/{info-circle-Bt350Yzj.js → info-circle-Dla9169_.js} +3 -3
  80. package/dist/{lightbulb-BL9YBxiA.js → lightbulb-PN8DA_Wh.js} +3 -3
  81. package/dist/{mail-_g6CHQeQ.js → mail-BGYZut_4.js} +3 -3
  82. package/dist/{mobile-B-EQ4IcH.js → mobile-BM760ZzX.js} +3 -3
  83. package/dist/{more-C3rpOdUy.js → more-rHGnl2ck.js} +3 -3
  84. package/dist/{network-placeholder-D9Ak7Xj_.js → network-placeholder-CyQl-3_2.js} +3 -3
  85. package/dist/{nftPlaceholder-CIIm2V_o.js → nftPlaceholder-nuUJ8nKY.js} +3 -3
  86. package/dist/{off-DZjgI0eE.js → off-GYlwYDrT.js} +3 -3
  87. package/dist/{play-store-DvRnagoF.js → play-store-Ck01Ez1F.js} +3 -3
  88. package/dist/{plus-C2jN2huZ.js → plus-CQfXWgLw.js} +3 -3
  89. package/dist/{qr-code-B64HnZgi.js → qr-code-CyLVwLY7.js} +3 -3
  90. package/dist/{recycle-horizontal-CovcJGa_.js → recycle-horizontal-DvnWPcEQ.js} +3 -3
  91. package/dist/{refresh-J1Vw6QMA.js → refresh-BOxj8b2n.js} +3 -3
  92. package/dist/{reown-logo-BsXoZ3KT.js → reown-logo-D1iprOTg.js} +3 -3
  93. package/dist/{search-BC86wYXR.js → search-DrPaZPnc.js} +3 -3
  94. package/dist/secp256k1-DgmH1qVg.js +1251 -0
  95. package/dist/{send-BPA1bK5G.js → send-ybBREe4b.js} +3 -3
  96. package/dist/shareicon-D3Qj5j1T.js +262 -0
  97. package/dist/{sortDown-cDA6MpOw.js → sortDown-CjBaDQTU.js} +13 -13
  98. package/dist/{swapHorizontal-47_8ePle.js → swapHorizontal-BddjZdXK.js} +3 -3
  99. package/dist/{swapHorizontalBold-CJ7TzeQP.js → swapHorizontalBold-B6AWjPZ9.js} +3 -3
  100. package/dist/{swapHorizontalMedium-CTACgUR9.js → swapHorizontalMedium-CNacWoBn.js} +3 -3
  101. package/dist/{swapHorizontalRoundedBold-Ht3_LABp.js → swapHorizontalRoundedBold-B8VcPnqt.js} +3 -3
  102. package/dist/{swapVertical-DlS0V6DD.js → swapVertical-zY2BbSyQ.js} +3 -3
  103. package/dist/{telegram-UZ00kvIE.js → telegram-DS4l-8Oc.js} +3 -3
  104. package/dist/{three-dots-D9zVXr1j.js → three-dots-RctNqamK.js} +3 -3
  105. package/dist/truncate-D9t92mVX.js +7 -0
  106. package/dist/{twitch-CP6rpz4m.js → twitch-CJ0llIIH.js} +3 -3
  107. package/dist/{twitterIcon-Cm3I3FRU.js → twitterIcon-pgvN9-bP.js} +3 -3
  108. package/dist/unsupportedProp-BJVuEW_b.js +10 -0
  109. package/dist/useRegisterError-C_YLA1dw.js +9857 -0
  110. package/dist/validError-CDlJpg_f.js +6 -0
  111. package/dist/{verify-DuUE85WT.js → verify-BeZLo1Fq.js} +3 -3
  112. package/dist/{verify-filled-CfgydKPa.js → verify-filled-meyb7E16.js} +3 -3
  113. package/dist/w3m-modal-C-Jp9NVv.js +1471 -0
  114. package/dist/{wallet-BC2LSDlF.js → wallet-CFcOgSsz.js} +3 -3
  115. package/dist/{wallet-placeholder-DugEJ7xM.js → wallet-placeholder-CeUMILZq.js} +3 -3
  116. package/dist/{walletconnect-wayCaYfk.js → walletconnect-D6LB1PyC.js} +7 -9
  117. package/dist/{warning-circle-Cy9YuvwU.js → warning-circle-BRtzofvT.js} +3 -3
  118. package/dist/{x-jggPFiy-.js → x-DKQAOOh3.js} +3 -3
  119. package/package.json +1 -1
  120. package/dist/AllRoutes-Bdi5ZW8W.js +0 -2604
  121. package/dist/Box-e4gA-y_H.js +0 -60
  122. package/dist/EstGas-C5ihS0Mw.js +0 -17108
  123. package/dist/Grow-B4K-I-E-.js +0 -2212
  124. package/dist/InputComp-C_UUZxNU.js +0 -114
  125. package/dist/LoadRoute-CnDhVKdh.js +0 -142
  126. package/dist/QuotesProgress-DxgPgPJE.js +0 -29
  127. package/dist/SwapAsset-CmmuxeQF.js +0 -65
  128. package/dist/Tooltip-D8YjOOKU.js +0 -718
  129. package/dist/TxnButton-CF-TLZrD.js +0 -302
  130. package/dist/WidgetForm.module-DhUUlwZP.js +0 -13
  131. package/dist/basic-Cx2xxgd9.js +0 -7109
  132. package/dist/ccip-BKpquA5i.js +0 -250
  133. package/dist/clockIcon-jSNFFrLy.js +0 -76
  134. package/dist/core-C-gr9X18.js +0 -17217
  135. package/dist/cursor-BTtIlTHP.js +0 -7
  136. package/dist/down-DDk8OoJG.js +0 -809
  137. package/dist/ethertousd-BOknTgU4.js +0 -7
  138. package/dist/getChainIds-6iugk2h0.js +0 -2431
  139. package/dist/getCosmosAddress-BgD5iV6f.js +0 -13998
  140. package/dist/hamburger-BYe_G11E.js +0 -4562
  141. package/dist/index-BAmjBHYR.js +0 -1087
  142. package/dist/index-BxHeZ9IF.js +0 -543
  143. package/dist/index-C7cb2O7r.js +0 -16078
  144. package/dist/index-CF9p4S_X.js +0 -11
  145. package/dist/index-C_vo1L7p.js +0 -24384
  146. package/dist/index-Ch7w83dW.js +0 -4217
  147. package/dist/index-Crhenmgw.js +0 -188
  148. package/dist/index-Cz5Dosd2.js +0 -412
  149. package/dist/index-D5OnT-__.js +0 -35858
  150. package/dist/index-DArR1lwi.js +0 -1759
  151. package/dist/index-hEJSpZe-.js +0 -308
  152. package/dist/index-m2O0cbD8.js +0 -1883
  153. package/dist/index-sLx4Edw4.js +0 -22
  154. package/dist/index.es-DIbGJsfa.js +0 -475
  155. package/dist/index.es-t6sHlseh.js +0 -12916
  156. package/dist/secp256k1-BkBK0mD5.js +0 -1681
  157. package/dist/shareicon-C88Wx-AM.js +0 -314
  158. package/dist/truncate-DSxFWEga.js +0 -7
  159. package/dist/unsupportedProp-DkeDzLfM.js +0 -14
  160. package/dist/useRegisterError-W_UfecIN.js +0 -19288
  161. package/dist/validError-rariWQ7G.js +0 -14
  162. package/dist/w3m-modal-Bl-DPlah.js +0 -1721
@@ -1,302 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { useSwitchNetwork, useDynamicContext, useIsLoggedIn } from "@dynamic-labs/sdk-react-core";
4
- import { a as useWallet, u as useStore, aJ as useBlockendEvents, aK as blockendEvents } from "./index-D5OnT-__.js";
5
- import { s as styles } from "./WidgetForm.module-DhUUlwZP.js";
6
- import { useAccount, useSwitchChain, useBalance } from "wagmi";
7
- import { u as useWalletDetails, k as useRegisterError, j as fixString, C as CircularProgress } from "./useRegisterError-W_UfecIN.js";
8
- import "./getCosmosAddress-BgD5iV6f.js";
9
- import { v as validError } from "./validError-rariWQ7G.js";
10
- import { u as useCosmosBalance, p as parseAddress } from "./index-m2O0cbD8.js";
11
- function useTronBalance(fromChain) {
12
- const { wallet, address } = useWallet();
13
- const [balance, setBalance] = useState(0);
14
- async function getBalance() {
15
- const balanceTron = await window.tronWeb.trx.getBalance(address);
16
- setBalance(balanceTron / Math.pow(10, 6));
17
- }
18
- useEffect(() => {
19
- if (address && (fromChain == null ? void 0 : fromChain.networkType) === "tron") getBalance();
20
- }, [address, fromChain == null ? void 0 : fromChain.networkType]);
21
- return { tronBal: balance };
22
- }
23
- function getWalletSupport(primaryWallet) {
24
- if (primaryWallet.key.toLowerCase() === "backpacksol") {
25
- return true;
26
- }
27
- }
28
- function TxnButton({ routesData, routes, amount, isAmountTyped, handleShowWallet, setConnectWalletField, handleConfirmClose, balanceSol, getCoinBalance, handleSuccess }) {
29
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
30
- const gradient = useStore((state) => state.gradient);
31
- const configuration = useStore((state) => state.configuration);
32
- const fromChain = useStore((state) => state.fromChain);
33
- const fromCoin = useStore((state) => state.fromCoin);
34
- const toChain = useStore((state) => state.toChain);
35
- const toCoin = useStore((state) => state.toCoin);
36
- const { isConnected, address, chain } = useAccount();
37
- const switchNetwork = useSwitchNetwork();
38
- const { getBothWalletConnection, getConnectWallet } = useWalletDetails({
39
- chainData: fromChain
40
- });
41
- const { connected, address: tronAdrress, disconnect } = useWallet();
42
- const toDisconnect = useStore((state) => state.toDisconnect);
43
- const customWallet = useStore((state) => state.customWallet);
44
- const { getWallet } = useWalletDetails({ chainData: fromChain });
45
- const connectWalletName = getConnectWallet(fromChain, toChain);
46
- const [solNetwork, setSolNetwork] = useState("101");
47
- const { tronBal } = useTronBalance(fromChain);
48
- const { cosmosBalance } = useCosmosBalance();
49
- const isChainsLoaded = ((_a = fromChain.chain) == null ? void 0 : _a.length) && ((_b = toChain.chain) == null ? void 0 : _b.length);
50
- const isCoinsLoaded = ((_c = fromCoin.address) == null ? void 0 : _c.length) && ((_d = toCoin.address) == null ? void 0 : _d.length);
51
- const registerError = useRegisterError();
52
- const blockendEvents$1 = useBlockendEvents();
53
- const { switchChain, isPending } = useSwitchChain({
54
- chainId: Number((fromChain == null ? void 0 : fromChain.chainId) || "0"),
55
- throwForSwitchChainNotSupported: true,
56
- onError(error) {
57
- let isValidError = validError(error.message);
58
- if (isValidError) registerError({ module: "wallet-error-switch", error: error.message });
59
- }
60
- });
61
- const balances = useBalance({
62
- address,
63
- token: "",
64
- chainId: Number((fromChain == null ? void 0 : fromChain.chainId) || 0),
65
- enabled: (fromChain == null ? void 0 : fromChain.networkType) == "evm" ? true : false
66
- });
67
- const parseCoinBalance = getCoinBalance;
68
- const selectedCoinbalance = fixString(parseCoinBalance || 0, 11);
69
- const [ctaInfoText, setCtaInfoText] = useState({
70
- text: "",
71
- isGradient: false,
72
- color: "bw-bg-border-primary"
73
- });
74
- async function handleSubmit() {
75
- if ((fromChain == null ? void 0 : fromChain.networkType) === "evm" && Number((fromChain == null ? void 0 : fromChain.chainId) || "0") !== (chain == null ? void 0 : chain.id)) {
76
- try {
77
- switchChain({ chainId: Number((fromChain == null ? void 0 : fromChain.chainId) || "0") });
78
- } catch (err) {
79
- }
80
- } else if ((fromChain == null ? void 0 : fromChain.networkType) === "sol" && solNetwork !== ((fromChain == null ? void 0 : fromChain.chainId) == "eclipse-svm" ? "201" : "101")) {
81
- try {
82
- let network = await switchNetwork({ wallet: primaryWallet, network: fromChain.chainId == "eclipse-svm" ? "201" : "101" });
83
- getCurrentNetwork();
84
- } catch (err) {
85
- }
86
- } else {
87
- blockendEvents$1.emit(blockendEvents.TransactionStarted, {
88
- ...routesData
89
- });
90
- handleSuccess(false);
91
- handleConfirmClose();
92
- }
93
- }
94
- const { primaryWallet } = useDynamicContext();
95
- const isFullyConnected = useIsLoggedIn();
96
- const isBothWalletConnected = (fromChain == null ? void 0 : fromChain.networkType) === toChain.networkType ? Boolean(((_f = (_e = getWallet(fromChain)) == null ? void 0 : _e.address) == null ? void 0 : _f.length) || 0) : getBothWalletConnection(fromChain == null ? void 0 : fromChain.networkType, (customWallet == null ? void 0 : customWallet.length) > 30 ? "customWallet" : toChain == null ? void 0 : toChain.networkType);
97
- const getCurrentNetwork = async () => {
98
- if (primaryWallet) {
99
- try {
100
- const network = await primaryWallet.getNetwork();
101
- setSolNetwork(network);
102
- } catch (error) {
103
- }
104
- } else {
105
- return;
106
- }
107
- };
108
- useEffect(() => {
109
- getCurrentNetwork();
110
- }, [primaryWallet]);
111
- function getGas(amountInEther, decimals) {
112
- let parsedVal = amountInEther / Math.pow(10, decimals);
113
- if (parsedVal < 1e-6) {
114
- return parsedVal.toFixed(20);
115
- } else {
116
- return parsedVal;
117
- }
118
- }
119
- function getNativeBal() {
120
- var _a2;
121
- return Number(((_a2 = balances == null ? void 0 : balances.data) == null ? void 0 : _a2.formatted) || 0);
122
- }
123
- function getCosmosNativeBalance(token) {
124
- var _a2;
125
- return Number(((_a2 = cosmosBalance[parseAddress(token.address)]) == null ? void 0 : _a2.amount) || 0) / Math.pow(10, token.decimals);
126
- }
127
- function handleError() {
128
- var _a2;
129
- let gasItem = {};
130
- function setGasObj(token, item) {
131
- let keyArray = Object.keys(gasItem);
132
- if (gasItem[token == null ? void 0 : token.chainId]) {
133
- gasItem[token == null ? void 0 : token.chainId].amountInToken += item.amountInToken;
134
- gasItem[token == null ? void 0 : token.chainId].gas += getGas(item.amountInToken, token == null ? void 0 : token.decimals);
135
- } else {
136
- gasItem[token == null ? void 0 : token.chainId] = {
137
- amountInToken: item.amountInToken,
138
- gas: getGas(item.amountInToken, token == null ? void 0 : token.decimals),
139
- token,
140
- nativeBal: (customWallet == null ? void 0 : customWallet.length) > 30 && !toDisconnect && (token == null ? void 0 : token.chainId) == (toChain == null ? void 0 : toChain.chainId) && (toChain == null ? void 0 : toChain.chainId) !== (fromChain == null ? void 0 : fromChain.chainId) ? 0 : (token == null ? void 0 : token.networkType) == "sol" ? balanceSol : (token == null ? void 0 : token.networkType) == "tron" ? tronBal : (token == null ? void 0 : token.networkType) == "cosmos" ? getCosmosNativeBalance(token) : getNativeBal(),
141
- isFromChain: (fromChain == null ? void 0 : fromChain.chainId) === (token == null ? void 0 : token.chainId.toString()),
142
- order: (fromChain == null ? void 0 : fromChain.chainId) === (token == null ? void 0 : token.chainId) ? 1 : (toChain == null ? void 0 : toChain.chainId) === (token == null ? void 0 : token.chainId) ? 2 : keyArray.length > 2 ? 3 : 2
143
- };
144
- }
145
- }
146
- (_a2 = routesData == null ? void 0 : routesData.fee) == null ? void 0 : _a2.forEach((item) => {
147
- const { token } = item;
148
- if (item.source.toLowerCase() == "from_source_wallet") {
149
- setGasObj(token, item);
150
- }
151
- });
152
- let coinBalance = selectedCoinbalance;
153
- if (Number(amount) > Number(coinBalance)) {
154
- setCtaInfoText({
155
- text: `Insufficient Balance ${fromCoin.coin || ""}`,
156
- isGradient: false,
157
- color: "bw-bg-border-primary"
158
- });
159
- } else if (((balances == null ? void 0 : balances.isLoading) || balances.isFetching) && (fromChain == null ? void 0 : fromChain.networkType) === "evm" || (typeof balanceSol == "undefined" || balanceSol === null) && (fromChain == null ? void 0 : fromChain.networkType) === "sol" || !tronBal && (fromChain == null ? void 0 : fromChain.networkType) === "tron") {
160
- setCtaInfoText({
161
- text: `Fetching Balance..`,
162
- isGradient: false,
163
- color: "bw-bg-border-primary"
164
- });
165
- } else {
166
- let sortGas = Object.values(gasItem).sort((a, b) => a.order - b.order);
167
- sortGas.some((val) => {
168
- var _a3, _b2, _c2;
169
- if ((val == null ? void 0 : val.isFromChain) && Number(amount) <= Number(coinBalance) && Number(val.nativeBal) - Number(amount) < val.gas && (fromCoin == null ? void 0 : fromCoin.isNative) || Number(amount) <= Number(coinBalance) && Number(val.nativeBal) < val.gas && !(fromCoin == null ? void 0 : fromCoin.isNative) && (val == null ? void 0 : val.isFromChain)) {
170
- setCtaInfoText({
171
- text: `Insufficient ${((_a3 = val == null ? void 0 : val.token) == null ? void 0 : _a3.symbol) || ""} for gas on ${val.token.blockchain}`,
172
- isGradient: false,
173
- color: "bw-bg-border-primary"
174
- });
175
- return true;
176
- } else {
177
- if (val.nativeBal < val.gas && !((customWallet == null ? void 0 : customWallet.length) > 30 && ((_b2 = val == null ? void 0 : val.token) == null ? void 0 : _b2.chainId) == (toChain == null ? void 0 : toChain.chainId))) {
178
- setCtaInfoText({
179
- text: `Insufficient ${((_c2 = val == null ? void 0 : val.token) == null ? void 0 : _c2.symbol) || ""} for gas on ${val.token.blockchain}`,
180
- isGradient: false,
181
- color: "bw-bg-border-primary"
182
- });
183
- return true;
184
- } else
185
- setCtaInfoText({
186
- text: "",
187
- isGradient: true,
188
- color: gradient ? gradient : styles.gradientbutton
189
- });
190
- return true;
191
- }
192
- });
193
- if (sortGas.length == 0 && ((routesData == null ? void 0 : routesData.gasless) || (routesData == null ? void 0 : routesData.provider) == "meson")) {
194
- setCtaInfoText({
195
- text: "",
196
- isGradient: true,
197
- color: gradient ? gradient : styles.gradientbutton
198
- });
199
- }
200
- }
201
- }
202
- useEffect(() => {
203
- var _a2, _b2, _c2;
204
- if (!fromCoin.coin.length || !(toCoin == null ? void 0 : toCoin.coin.length)) {
205
- setCtaInfoText({
206
- text: "Select Token",
207
- isGradient: true,
208
- color: gradient ? gradient : styles.gradientbutton
209
- });
210
- } else if (!isBothWalletConnected) {
211
- setCtaInfoText({
212
- text: ``,
213
- isGradient: true,
214
- color: gradient ? gradient : styles.gradientbutton
215
- });
216
- } else if (typeof amount !== "undefined" && Number(amount || 0) <= 0) {
217
- setCtaInfoText({
218
- text: "Enter Amount",
219
- isGradient: false,
220
- color: "bw-bg-border-primary"
221
- });
222
- } else if (routes.isFetching || !isAmountTyped) {
223
- setCtaInfoText({
224
- text: "Loading Routes...",
225
- isGradient: false,
226
- color: "bw-bg-border-primary"
227
- });
228
- } else if (fromChain.chainId === "eclipse-svm" && !getWalletSupport(primaryWallet)) {
229
- setCtaInfoText({
230
- text: `Select ${fromChain.name} wallet`,
231
- isGradient: true,
232
- color: gradient ? gradient : styles.gradientbutton
233
- });
234
- } else if (toChain.chainId === "eclipse-svm" && fromChain.chainId !== "eclipse-svm" && !getWalletSupport(primaryWallet) && customWallet.length < 30) {
235
- setCtaInfoText({
236
- text: `Enter recipient wallet address`,
237
- isGradient: true,
238
- color: gradient ? gradient : styles.gradientbutton
239
- });
240
- } else if ((fromCoin == null ? void 0 : fromCoin.address) == (toCoin == null ? void 0 : toCoin.address) && (fromChain == null ? void 0 : fromChain.chainId) == (toChain == null ? void 0 : toChain.chainId) && !(customWallet == null ? void 0 : customWallet.length) || (fromChain == null ? void 0 : fromChain.networkType) == "evm" && address === customWallet && (fromCoin == null ? void 0 : fromCoin.address) == (toCoin == null ? void 0 : toCoin.address) || (fromChain == null ? void 0 : fromChain.networkType) == "sol" && (primaryWallet == null ? void 0 : primaryWallet.address) === customWallet && (fromCoin == null ? void 0 : fromCoin.address) == (toCoin == null ? void 0 : toCoin.address)) {
241
- setCtaInfoText({
242
- text: "From and To asset can not be the same!",
243
- isGradient: false,
244
- color: "bw-bg-border-primary"
245
- });
246
- } else if (!((_c2 = (_b2 = (_a2 = routes == null ? void 0 : routes.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.quotes) == null ? void 0 : _c2.length)) {
247
- setCtaInfoText({
248
- text: "No Routes Found",
249
- isGradient: false,
250
- color: "bw-bg-border-primary"
251
- });
252
- } else if (isConnected && Number((fromChain == null ? void 0 : fromChain.chainId) || "0") !== (chain == null ? void 0 : chain.id) && (fromChain == null ? void 0 : fromChain.networkType) === "evm" || isFullyConnected && ((fromChain == null ? void 0 : fromChain.chainId) === "eclipse-svm" ? "201" : "101") !== solNetwork && (fromChain == null ? void 0 : fromChain.networkType) === "sol") {
253
- setCtaInfoText({
254
- text: `Switch Chain to ${fromChain.chain}`,
255
- isGradient: true,
256
- color: gradient ? gradient : styles.gradientbutton
257
- });
258
- } else {
259
- handleError();
260
- }
261
- }, [solNetwork, primaryWallet, fromCoin, toCoin, amount, fromChain, toChain, (_g = balances.data) == null ? void 0 : _g.formatted, routesData, balances.isFetching, balances.isLoading, isConnected, selectedCoinbalance, isBothWalletConnected, routes.isFetching, chain == null ? void 0 : chain.id, isAmountTyped, tronBal, balanceSol, customWallet, cosmosBalance]);
262
- let enableButtonText = [`switch chain to ${(_h = fromChain.chain) == null ? void 0 : _h.toLowerCase()}`, `select ${(_i = fromChain.chain) == null ? void 0 : _i.toLowerCase()} wallet`, "connect custom wallet", "enter recipient wallet address"];
263
- function handleDisable() {
264
- var _a2, _b2, _c2, _d2;
265
- return isBothWalletConnected ? routes.isFetching ? true : ctaInfoText.text.length ? enableButtonText.includes((_a2 = ctaInfoText.text) == null ? void 0 : _a2.toLowerCase()) ? false : true : !((_d2 = (_c2 = (_b2 = routes.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.quotes) == null ? void 0 : _d2.length) ? true : false : false;
266
- }
267
- return /* @__PURE__ */ jsx(
268
- "button",
269
- {
270
- disabled: handleDisable(),
271
- style: (ctaInfoText == null ? void 0 : ctaInfoText.isGradient) && isChainsLoaded && isCoinsLoaded ? {
272
- ...configuration == null ? void 0 : configuration.gradientStyle,
273
- boxShadow: configuration && configuration.customTheme && ((_k = (_j = configuration.customTheme) == null ? void 0 : _j.shadow) == null ? void 0 : _k.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.15)"
274
- } : {
275
- boxShadow: configuration && configuration.customTheme && ((_m = (_l = configuration.customTheme) == null ? void 0 : _l.shadow) == null ? void 0 : _m.boxShadow) || "1px 1px 7px rgba(0, 0, 0, 0.15)"
276
- },
277
- className: `bw-w-full bw-rounded-sm bw-h-[52px] ${(ctaInfoText == null ? void 0 : ctaInfoText.isGradient) ? "bw-p-[3px]" : "bw-p-[1px]"} bw-mt-3 bw-border-0 bw-relative bw-z-0 disabled:bw-opacity-70 ${isChainsLoaded && isCoinsLoaded && ctaInfoText.color} ${ctaInfoText.text.length > 29 ? "bw-text-xl" : "bw-text-2xl"} ${(ctaInfoText == null ? void 0 : ctaInfoText.isGradient) ? "bw-font-bold bw-text-text-primary" : "bw-font-normal bw-text-text-secondary"}`,
278
- onClick: () => {
279
- if (!isBothWalletConnected) {
280
- handleShowWallet(true);
281
- if (((fromChain == null ? void 0 : fromChain.networkType) !== "evm" && isConnected || (fromChain == null ? void 0 : fromChain.networkType) !== "sol" && isFullyConnected && primaryWallet !== null || (fromChain == null ? void 0 : fromChain.networkType) !== "tron" && connected && tronAdrress) && !toDisconnect) {
282
- setConnectWalletField("from");
283
- } else if (isConnected && (toChain == null ? void 0 : toChain.networkType) !== "evm" || isFullyConnected && (toChain == null ? void 0 : toChain.networkType) !== "sol" || (toChain == null ? void 0 : toChain.networkType) !== "tron" && connected && tronAdrress || toDisconnect) setConnectWalletField("to");
284
- else {
285
- setConnectWalletField("from");
286
- }
287
- }
288
- if (fromChain.chainId === "eclipse-svm" && !getWalletSupport(primaryWallet)) {
289
- handleShowWallet(true);
290
- setConnectWalletField("from");
291
- } else if (toChain.chainId === "eclipse-svm" && fromChain.chainId !== "eclipse-svm" && !getWalletSupport(primaryWallet) && customWallet.length < 30) {
292
- handleShowWallet(true);
293
- setConnectWalletField("to");
294
- } else handleSubmit();
295
- },
296
- children: /* @__PURE__ */ jsx("div", { className: "bw-rounded-sm bw-bg-background-container bw-flex bw-items-center bw-justify-center b-w-full bw-h-full", children: /* @__PURE__ */ jsx("p", { className: `bw-relative bw-z-20`, children: isChainsLoaded && isCoinsLoaded ? !isPending ? isBothWalletConnected ? ctaInfoText.text.length ? ctaInfoText.text : "Start Transaction" : `Connect ${connectWalletName} Wallet` : /* @__PURE__ */ jsx("div", { className: "bw-w-[30px] bw-flex bw-text-text-secondary bw-justify-center bw-items-center bw-h-[30px]", children: /* @__PURE__ */ jsx(CircularProgress, { size: 22, thickness: 5, color: "inherit" }) }) : /* @__PURE__ */ jsx("div", { className: "bw-w-[30px] bw-flex bw-text-text-secondary bw-justify-center bw-items-center bw-h-[30px]", children: /* @__PURE__ */ jsx(CircularProgress, { size: 22, thickness: 5, color: "inherit" }) }) }) })
297
- }
298
- );
299
- }
300
- export {
301
- TxnButton as default
302
- };
@@ -1,13 +0,0 @@
1
- const gradientbutton = "_gradientbutton_1b5f1_4";
2
- const overlay = "_overlay_1b5f1_8";
3
- const overlayshow = "_overlayshow_1b5f1_18";
4
- const gradienttext = "_gradienttext_1b5f1_31";
5
- const styles = {
6
- gradientbutton,
7
- overlay,
8
- overlayshow,
9
- gradienttext
10
- };
11
- export {
12
- styles as s
13
- };