@multiversx/sdk-dapp-liquidity 1.0.12 → 1.0.14
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/ConstantsUtil-BinYIDR2.mjs +8 -0
- package/ConstantsUtil-CbnVdQ5P.js +8 -0
- package/add-D-ECcdUh.mjs +19 -0
- package/add-Diz8heiY.js +20 -0
- package/all-wallets-_iOQf3bl.js +11 -0
- package/all-wallets-puIIQy3Y.mjs +10 -0
- package/app-store-BGTKFL27.js +22 -0
- package/app-store-Bsf7w3pv.mjs +21 -0
- package/apple-Cw8e8IGH.mjs +22 -0
- package/apple-DF7n_Yzl.js +23 -0
- package/arrow-bottom-Cp2C4fQv.mjs +12 -0
- package/arrow-bottom-DTvIR3s3.js +13 -0
- package/arrow-bottom-circle-CN6i5mHz.mjs +15 -0
- package/arrow-bottom-circle-CzPwiwWH.js +16 -0
- package/arrow-left-9VFYHQSW.js +13 -0
- package/arrow-left-BDQHoEvX.mjs +12 -0
- package/arrow-right-BxkuSpWU.mjs +12 -0
- package/arrow-right-DBLQ6w92.js +13 -0
- package/arrow-top-BiQd5Aey.js +13 -0
- package/arrow-top-BrLVX4Rj.mjs +12 -0
- package/bank-B7EC6Kdz.mjs +18 -0
- package/bank-CvPn9sfV.js +19 -0
- package/{bignumber-CKZkoo0g.mjs → bignumber-2Z7uapuD.mjs} +6 -6
- package/{bignumber-B8vjg9qn.js → bignumber-D1Wl54dL.js} +6 -6
- package/bin-BXO1kNZh.js +9 -0
- package/bin-CwiYVJ1L.mjs +8 -0
- package/bitcoin-C3kBVar_.mjs +17 -0
- package/bitcoin-DAvQGpeP.js +3251 -0
- package/bitcoin-dNBGbS2B.mjs +3251 -0
- package/bitcoin-k6bvmzMA.js +18 -0
- package/browser-ShRLuKKz.mjs +18 -0
- package/browser-t7nfT7HL.js +19 -0
- package/card-BJg5bdoM.mjs +18 -0
- package/card-hxUDXttT.js +19 -0
- package/checkmark-BpR0Yy93.mjs +15 -0
- package/checkmark-D9AVWgl5.js +16 -0
- package/checkmark-bold-D3Xcby1U.mjs +12 -0
- package/checkmark-bold-De02hde8.js +13 -0
- package/chevron-bottom-DcBf7T5F.js +13 -0
- package/chevron-bottom-DfGpWIz7.mjs +12 -0
- package/chevron-left-BKvYVnUo.js +13 -0
- package/chevron-left-DGSG9WJQ.mjs +12 -0
- package/chevron-right-BLgYIEeO.js +13 -0
- package/chevron-right-C2nsTx_Y.mjs +12 -0
- package/chevron-top-CwFOEFy8.js +13 -0
- package/chevron-top-vk-9DvUU.mjs +12 -0
- package/chrome-store-4H_ie3vA.mjs +65 -0
- package/chrome-store-BWarxVMl.js +66 -0
- package/circle-BtqWJU0_.mjs +8 -0
- package/circle-DYjG6o7-.js +9 -0
- package/clock-Ba5SM-pl.mjs +12 -0
- package/clock-DPzNREdU.js +13 -0
- package/close-CJHKFOyp.mjs +12 -0
- package/close-DDWnJdJe.js +13 -0
- package/coinPlaceholder-Cbba3D1H.mjs +12 -0
- package/coinPlaceholder-DdxQIc2D.js +13 -0
- package/compass-CugCxeSC.js +13 -0
- package/compass-DbN5DkTl.mjs +12 -0
- package/copy-CHSZprYJ.mjs +19 -0
- package/copy-En5h5Uhu.js +20 -0
- package/cursor-DCRkvEhr.mjs +7 -0
- package/cursor-DnEQtrUK.js +8 -0
- package/cursor-transparent-CU8lk-xg.js +17 -0
- package/cursor-transparent-CliETg4d.mjs +16 -0
- package/desktop-BgD7aypB.js +14 -0
- package/desktop-Cg5I32-p.mjs +13 -0
- package/disconnect-CCyMbAdw.js +13 -0
- package/disconnect-Cp2vRWB2.mjs +12 -0
- package/discord-B1d-qeSk.mjs +21 -0
- package/discord-BEB5klec.js +22 -0
- package/email-CorlePKz.js +873 -0
- package/email-Znno7H8_.mjs +878 -0
- package/embedded-wallet-B9ro9Tel.js +549 -0
- package/embedded-wallet-CnTWeseG.mjs +552 -0
- package/ethereum-BRcsRjUU.mjs +14 -0
- package/ethereum-CZ_xe09e.js +15 -0
- package/etherscan-BZKGpKp8.mjs +10 -0
- package/etherscan-DtLi-C3z.js +11 -0
- package/exclamation-triangle-BLNnBLEc.js +9 -0
- package/exclamation-triangle-CFThXxRT.mjs +8 -0
- package/extension-CwUepr-W.mjs +12 -0
- package/extension-DOD67G1k.js +13 -0
- package/external-link-CZkQS5XK.js +13 -0
- package/external-link-ClYNKSPt.mjs +12 -0
- package/facebook-CFjrd4my.mjs +30 -0
- package/facebook-CbE6K6AK.js +31 -0
- package/farcaster-Ba7_C-Vm.js +17 -0
- package/farcaster-DyVJtVS9.mjs +16 -0
- package/filters-CpHaFNjT.mjs +12 -0
- package/filters-w5LC-r6e.js +13 -0
- package/github-CeO70C3E.mjs +22 -0
- package/github-uLFBWAa5.js +23 -0
- package/google-CyOdUlbw.mjs +22 -0
- package/google-ILGK-opP.js +23 -0
- package/help-circle-Dh3dRNoB.mjs +16 -0
- package/help-circle-HUMbz_KN.js +17 -0
- package/id-Cy3Qkrvb.js +17 -0
- package/id-D-Q0uPFM.mjs +16 -0
- package/if-defined-CJ5EZLw2.js +815 -0
- package/if-defined-DjC5UMfF.mjs +815 -0
- package/image-BTGOf8bb.mjs +8 -0
- package/image-WFQO5bWa.js +9 -0
- package/index--O5ypTeK.mjs +70 -0
- package/index--Vg7VI9t.js +173 -0
- package/index-2iRSO1sa.mjs +9964 -0
- package/index-42Rpweo5.mjs +95 -0
- package/index-70kjE43k.mjs +90 -0
- package/index-8VyNYS01.js +273 -0
- package/index-B-dx8l0g.mjs +82 -0
- package/index-BB0nW9RB.mjs +198 -0
- package/index-BBwuv2SS.js +97 -0
- package/index-BIe-kofv.mjs +273 -0
- package/index-BQf6VHil.js +278 -0
- package/index-BWIZXhFv.mjs +630 -0
- package/index-BXkamf-I.js +337 -0
- package/index-BYTxCmKH.js +64 -0
- package/index-BYoOxo0S.js +218 -0
- package/index-Ba0tVdql.js +200 -0
- package/index-BdOAPWyt.mjs +210 -0
- package/index-BirWzf8c.mjs +71 -0
- package/index-BnCJUHtW.mjs +346 -0
- package/index-BuL2FC61.mjs +216 -0
- package/index-BxSUTfaY.js +88 -0
- package/index-C49C5Rxf.js +743 -0
- package/index-CNMDBpW7.js +346 -0
- package/index-CP0CGjqQ.mjs +263 -0
- package/index-CQaHcTZM.mjs +86 -0
- package/index-CRGXQei1.js +178 -0
- package/index-CSykUIfV.mjs +176 -0
- package/index-CWIHaLkQ.mjs +101 -0
- package/index-CZSDJd0P.mjs +1070 -0
- package/index-CZaV8JgR.mjs +49 -0
- package/index-CZjdy6QP.js +101 -0
- package/index-C_lIGGlC.js +632 -0
- package/index-CcgeRPs2.mjs +57 -0
- package/index-CeY_DRuc.js +566 -0
- package/index-ChFNkSxT.js +92 -0
- package/index-CkjZc20w.js +677 -0
- package/index-CtFcWwAd.js +72 -0
- package/index-D0mOfznC.mjs +362 -0
- package/index-DAtWLY21.js +84 -0
- package/index-DEs8H3w2.js +262 -0
- package/index-DLnxotbC.mjs +566 -0
- package/index-DN4fGDgg.mjs +743 -0
- package/index-DT_mc1hV.mjs +335 -0
- package/index-DZEwxUMS.js +59 -0
- package/index-DaRH_4bD.js +9939 -0
- package/index-Daok2ZKn.js +73 -0
- package/index-DomzHmwk.js +210 -0
- package/index-Dx7NyDyv.mjs +101 -0
- package/index-DyGir6_2.mjs +675 -0
- package/index-GglJmM2C.js +2237 -0
- package/index-H5b7UTeJ.mjs +173 -0
- package/index-NNZ1lNuc.mjs +168 -0
- package/index-RJd-gQcv.mjs +2235 -0
- package/index-dnFzVpGy.js +103 -0
- package/index-kwVLu8EV.js +168 -0
- package/index-miQwZPmn.js +51 -0
- package/index-oCj_SpOa.mjs +62 -0
- package/index-pNK-h_x9.js +1069 -0
- package/index-r6Kre1rx.js +362 -0
- package/index-xBD0nXoB.mjs +276 -0
- package/index.js +3 -3
- package/index.mjs +3 -3
- package/info-BKNAiN0k.js +8 -0
- package/info-DQE0s-A4.mjs +7 -0
- package/info-circle-C3uTocjH.js +17 -0
- package/info-circle-CIn6yeQo.mjs +16 -0
- package/lightbulb-CB-BmIop.js +8 -0
- package/lightbulb-Gv7IbnzO.mjs +7 -0
- package/mail-CFYm95wn.mjs +12 -0
- package/mail-GEwk-Fzr.js +13 -0
- package/mobile-CZ7ZBfa5.js +14 -0
- package/mobile-OIbnpFsU.mjs +13 -0
- package/more-C8N_RV55.mjs +15 -0
- package/more-CiQpPZwq.js +16 -0
- package/network-placeholder-CxEcczEx.mjs +18 -0
- package/network-placeholder-DwR8E8hP.js +19 -0
- package/nftPlaceholder-BFexVcGX.js +13 -0
- package/nftPlaceholder-MiYL110I.mjs +12 -0
- package/off-BNiMlpUU.mjs +8 -0
- package/off-iJHSK3Z7.js +9 -0
- package/onramp-Bs8HHFFY.js +1474 -0
- package/onramp-C6fuQfX7.mjs +1480 -0
- package/package.json +11 -11
- package/play-store-B4ssIYUA.js +37 -0
- package/play-store-D6nmQXhX.mjs +36 -0
- package/plus-Bh7z7Oc0.js +18 -0
- package/plus-C8ioZuCD.mjs +17 -0
- package/qr-code-CSVwaBLf.mjs +10 -0
- package/qr-code-YgtXPokK.js +11 -0
- package/react-BWxe90Ar.mjs +6342 -0
- package/react-BzZcQig5.js +6342 -0
- package/react-C_wTMVq_.js +23003 -0
- package/react-M-DnxvZl.mjs +23003 -0
- package/reactjs/components/BridgeForm/BridgeForm.js +2 -1
- package/reactjs/components/BridgeForm/BridgeForm.mjs +2 -1
- package/reactjs/components/Connect/BridgeAccountDisplay.js +3 -2
- package/reactjs/components/Connect/BridgeAccountDisplay.mjs +3 -2
- package/reactjs/components/Connect/CustomConnectButton.js +3 -2
- package/reactjs/components/Connect/CustomConnectButton.mjs +3 -2
- package/reactjs/components/Connect/SwitchChainButton.js +4 -3
- package/reactjs/components/Connect/SwitchChainButton.mjs +4 -3
- package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -1
- package/reactjs/components/DisplayAmount/DisplayAmount.mjs +1 -1
- package/reactjs/components/TokenSelector/components/TokenItem.js +1 -1
- package/reactjs/components/TokenSelector/components/TokenItem.mjs +1 -1
- package/reactjs/hooks/useAccount.d.ts +4 -4
- package/reactjs/hooks/useAccount.js +3 -2
- package/reactjs/hooks/useAccount.mjs +3 -2
- package/reactjs/hooks/useGetChainId.js +1 -1
- package/reactjs/hooks/useGetChainId.mjs +1 -1
- package/reactjs/index.js +3 -3
- package/reactjs/index.mjs +3 -3
- package/reactjs/init/init.js +4 -3
- package/reactjs/init/init.mjs +4 -3
- package/reactjs/init/tests/init.spec.js +2 -2
- package/reactjs/init/tests/init.spec.mjs +2 -2
- package/reactjs/queries/useGetEvmTokensBalances.query.js +3 -2
- package/reactjs/queries/useGetEvmTokensBalances.query.mjs +3 -2
- package/reactjs/reexports.js +3 -3
- package/reactjs/reexports.mjs +3 -3
- package/reactjs/utils/getCleanStringAmount.js +1 -1
- package/reactjs/utils/getCleanStringAmount.mjs +1 -1
- package/reactjs/utils/hasEnoughFunds.js +1 -1
- package/reactjs/utils/hasEnoughFunds.mjs +1 -1
- package/reactjs/utils/isStringFloat.js +1 -1
- package/reactjs/utils/isStringFloat.mjs +1 -1
- package/reactjs/utils/roundAmount.js +1 -1
- package/reactjs/utils/roundAmount.mjs +1 -1
- package/receive-CK0hRQPr.js +212 -0
- package/receive-CQcD6bZf.mjs +212 -0
- package/recycle-horizontal--x5cMoTE.js +14 -0
- package/recycle-horizontal-QI0xtDHK.mjs +13 -0
- package/ref-CqxfRkBm.mjs +41 -0
- package/ref-FGI2cUQB.js +41 -0
- package/refresh-CFNHjhDi.js +13 -0
- package/refresh-CSOC1NUY.mjs +12 -0
- package/reown-logo-BfU5xFX5.js +17 -0
- package/reown-logo-CZAEp1jU.mjs +16 -0
- package/search-Do_rb-9-.mjs +12 -0
- package/search-V9CGMHkm.js +13 -0
- package/send-D-5G7tDL.mjs +1204 -0
- package/send-D4yYsIHV.mjs +19 -0
- package/send-DoiSHLsX.js +1202 -0
- package/send-_jfNFrys.js +20 -0
- package/socials-BL7-97fT.mjs +758 -0
- package/socials-DF0CK9cN.js +756 -0
- package/solana-BQ0Jh8lh.js +18 -0
- package/solana-YAkDp6j_.mjs +17 -0
- package/swapHorizontal-DOIo-Ccx.mjs +12 -0
- package/swapHorizontal-OHKtz4Gu.js +13 -0
- package/swapHorizontalBold-D7QmFj-c.js +13 -0
- package/swapHorizontalBold-DDroA0Af.mjs +12 -0
- package/swapHorizontalMedium-CU_v0kFz.mjs +20 -0
- package/swapHorizontalMedium-D-yMmtml.js +21 -0
- package/swapHorizontalRoundedBold-CHvbmnjw.js +13 -0
- package/swapHorizontalRoundedBold-DXMH0sgK.mjs +12 -0
- package/swapVertical-CH7fTK6w.js +13 -0
- package/swapVertical-HJZ6rFcr.mjs +12 -0
- package/swaps-CETflhdU.js +1952 -0
- package/swaps-DRUV6d3p.mjs +1954 -0
- package/telegram-CsCauOwj.mjs +20 -0
- package/telegram-DKEcF_Tq.js +21 -0
- package/three-dots-B-7hr8Nl.js +10 -0
- package/three-dots-LNZ_fjP7.mjs +9 -0
- package/transactions-BTTsGV2W.mjs +37 -0
- package/transactions-mpNNlClw.js +37 -0
- package/twitch-CCWVT2ij.js +23 -0
- package/twitch-Dg1CCQvd.mjs +22 -0
- package/twitterIcon-BjR09Cj9.mjs +10 -0
- package/twitterIcon-CeEs0iDJ.js +11 -0
- package/verify-B8WZq7kt.mjs +12 -0
- package/verify-filled-BeqC1imk.mjs +12 -0
- package/verify-filled-C-mv3ApD.js +13 -0
- package/verify-yATdPqt-.js +13 -0
- package/w3m-modal-3GziKj7h.js +1254 -0
- package/w3m-modal-81Z5PngE.mjs +1255 -0
- package/wallet-BMXEH23x.js +13 -0
- package/wallet-CNAVQCfm.mjs +12 -0
- package/wallet-placeholder-CQ-7CmVN.mjs +18 -0
- package/wallet-placeholder-CdoQy2e6.js +19 -0
- package/walletconnect-ACr-R1QZ.mjs +38 -0
- package/walletconnect-BWSkiS2F.js +39 -0
- package/warning-circle-CYnuYwpt.js +17 -0
- package/warning-circle-HV2lOiCj.mjs +16 -0
- package/x-CW5dozRj.js +17 -0
- package/x-Cgm2OFpL.mjs +16 -0
- package/x-mark-CR8SpZvu.js +8 -0
- package/x-mark-u0KJjUJ1.mjs +7 -0
- package/index-B4Eq5P3w.mjs +0 -91
- package/index-C4WV9nam.js +0 -329
- package/index-CWMcKi_X.js +0 -107
- package/index-D8E0O3qL.mjs +0 -68744
- package/index-DJ8CdHSw.mjs +0 -107
- package/index-nigVQYBu.js +0 -68665
- package/react-C43nEIqn.js +0 -3133
- package/react-DKUsVej7.js +0 -50
- package/react-Dp0H8q2z.mjs +0 -50
- package/react-wMhOUFOm.mjs +0 -3133
- package/w3m-modal-DLyg7Voy.js +0 -356
- package/w3m-modal-hC-B8qZP.mjs +0 -356
|
@@ -0,0 +1,1204 @@
|
|
|
1
|
+
import { i, f as i$1, x, c as resetStyles, e as elementStyles } from "./bitcoin-dNBGbS2B.mjs";
|
|
2
|
+
import { n, r, c as customElement, U as UiHelperUtil, o } from "./if-defined-DjC5UMfF.mjs";
|
|
3
|
+
import "./index-DT_mc1hV.mjs";
|
|
4
|
+
import "./index-42Rpweo5.mjs";
|
|
5
|
+
import { e, n as n$1 } from "./ref-CqxfRkBm.mjs";
|
|
6
|
+
import { d as CoreHelperUtil, c as ChainController, C as ConnectionController, s as SendController, R as RouterController, N as NumberUtil, m as AssetUtil, S as SnackController, E as EventsController, g as getPreferredAccountType, W as W3mFrameRpcConstants } from "./react-BWxe90Ar.mjs";
|
|
7
|
+
import { n as numbersRegex, s as specialCharactersRegex } from "./ConstantsUtil-BinYIDR2.mjs";
|
|
8
|
+
import "./index-CcgeRPs2.mjs";
|
|
9
|
+
import { S as SwapController } from "./index-DN4fGDgg.mjs";
|
|
10
|
+
import "./index-xBD0nXoB.mjs";
|
|
11
|
+
import "./index-BuL2FC61.mjs";
|
|
12
|
+
import "./index-CZaV8JgR.mjs";
|
|
13
|
+
import "./index--O5ypTeK.mjs";
|
|
14
|
+
const styles$8 = i`
|
|
15
|
+
:host {
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100px;
|
|
18
|
+
border-radius: var(--wui-border-radius-s);
|
|
19
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
20
|
+
background-color: var(--wui-color-gray-glass-002);
|
|
21
|
+
transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
|
|
22
|
+
will-change: background-color;
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host(:hover) {
|
|
27
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
wui-flex {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: fit-content;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
wui-button {
|
|
36
|
+
display: ruby;
|
|
37
|
+
color: var(--wui-color-fg-100);
|
|
38
|
+
margin: 0 var(--wui-spacing-xs);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.instruction {
|
|
42
|
+
position: absolute;
|
|
43
|
+
top: 50%;
|
|
44
|
+
transform: translateY(-50%);
|
|
45
|
+
z-index: 2;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.paste {
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
textarea {
|
|
53
|
+
background: transparent;
|
|
54
|
+
width: 100%;
|
|
55
|
+
font-family: var(--w3m-font-family);
|
|
56
|
+
font-size: var(--wui-font-size-medium);
|
|
57
|
+
font-style: normal;
|
|
58
|
+
font-weight: var(--wui-font-weight-light);
|
|
59
|
+
line-height: 130%;
|
|
60
|
+
letter-spacing: var(--wui-letter-spacing-medium);
|
|
61
|
+
color: var(--wui-color-fg-100);
|
|
62
|
+
caret-color: var(--wui-color-accent-100);
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
-webkit-appearance: none;
|
|
65
|
+
-moz-appearance: textfield;
|
|
66
|
+
padding: 0px;
|
|
67
|
+
border: none;
|
|
68
|
+
outline: none;
|
|
69
|
+
appearance: none;
|
|
70
|
+
resize: none;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
var __decorate$8 = function(decorators, target, key, desc) {
|
|
75
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
76
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
77
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
78
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
79
|
+
};
|
|
80
|
+
let W3mInputAddress = class W3mInputAddress2 extends i$1 {
|
|
81
|
+
constructor() {
|
|
82
|
+
super(...arguments);
|
|
83
|
+
this.inputElementRef = e();
|
|
84
|
+
this.instructionElementRef = e();
|
|
85
|
+
this.instructionHidden = Boolean(this.value);
|
|
86
|
+
this.pasting = false;
|
|
87
|
+
this.onDebouncedSearch = CoreHelperUtil.debounce(async (value) => {
|
|
88
|
+
if (!value.length) {
|
|
89
|
+
this.setReceiverAddress("");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const activeChain = ChainController.state.activeChain;
|
|
93
|
+
const isValidAddress = CoreHelperUtil.isAddress(value, activeChain);
|
|
94
|
+
if (isValidAddress) {
|
|
95
|
+
this.setReceiverAddress(value);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const resolvedAddress = await ConnectionController.getEnsAddress(value);
|
|
100
|
+
if (resolvedAddress) {
|
|
101
|
+
SendController.setReceiverProfileName(value);
|
|
102
|
+
SendController.setReceiverAddress(resolvedAddress);
|
|
103
|
+
const avatar = await ConnectionController.getEnsAvatar(value);
|
|
104
|
+
SendController.setReceiverProfileImageUrl(avatar || void 0);
|
|
105
|
+
}
|
|
106
|
+
} catch (error) {
|
|
107
|
+
this.setReceiverAddress(value);
|
|
108
|
+
} finally {
|
|
109
|
+
SendController.setLoading(false);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
firstUpdated() {
|
|
114
|
+
if (this.value) {
|
|
115
|
+
this.instructionHidden = true;
|
|
116
|
+
}
|
|
117
|
+
this.checkHidden();
|
|
118
|
+
}
|
|
119
|
+
render() {
|
|
120
|
+
return x` <wui-flex
|
|
121
|
+
@click=${this.onBoxClick.bind(this)}
|
|
122
|
+
flexDirection="column"
|
|
123
|
+
justifyContent="center"
|
|
124
|
+
gap="4xs"
|
|
125
|
+
.padding=${["2xl", "l", "xl", "l"]}
|
|
126
|
+
>
|
|
127
|
+
<wui-text
|
|
128
|
+
${n$1(this.instructionElementRef)}
|
|
129
|
+
class="instruction"
|
|
130
|
+
color="fg-300"
|
|
131
|
+
variant="medium-400"
|
|
132
|
+
>
|
|
133
|
+
Type or
|
|
134
|
+
<wui-button
|
|
135
|
+
class="paste"
|
|
136
|
+
size="md"
|
|
137
|
+
variant="neutral"
|
|
138
|
+
iconLeft="copy"
|
|
139
|
+
@click=${this.onPasteClick.bind(this)}
|
|
140
|
+
>
|
|
141
|
+
<wui-icon size="sm" color="inherit" slot="iconLeft" name="copy"></wui-icon>
|
|
142
|
+
Paste
|
|
143
|
+
</wui-button>
|
|
144
|
+
address
|
|
145
|
+
</wui-text>
|
|
146
|
+
<textarea
|
|
147
|
+
spellcheck="false"
|
|
148
|
+
?disabled=${!this.instructionHidden}
|
|
149
|
+
${n$1(this.inputElementRef)}
|
|
150
|
+
@input=${this.onInputChange.bind(this)}
|
|
151
|
+
@blur=${this.onBlur.bind(this)}
|
|
152
|
+
.value=${this.value ?? ""}
|
|
153
|
+
autocomplete="off"
|
|
154
|
+
>
|
|
155
|
+
${this.value ?? ""}</textarea
|
|
156
|
+
>
|
|
157
|
+
</wui-flex>`;
|
|
158
|
+
}
|
|
159
|
+
async focusInput() {
|
|
160
|
+
var _a;
|
|
161
|
+
if (this.instructionElementRef.value) {
|
|
162
|
+
this.instructionHidden = true;
|
|
163
|
+
await this.toggleInstructionFocus(false);
|
|
164
|
+
this.instructionElementRef.value.style.pointerEvents = "none";
|
|
165
|
+
(_a = this.inputElementRef.value) == null ? void 0 : _a.focus();
|
|
166
|
+
if (this.inputElementRef.value) {
|
|
167
|
+
this.inputElementRef.value.selectionStart = this.inputElementRef.value.selectionEnd = this.inputElementRef.value.value.length;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async focusInstruction() {
|
|
172
|
+
var _a;
|
|
173
|
+
if (this.instructionElementRef.value) {
|
|
174
|
+
this.instructionHidden = false;
|
|
175
|
+
await this.toggleInstructionFocus(true);
|
|
176
|
+
this.instructionElementRef.value.style.pointerEvents = "auto";
|
|
177
|
+
(_a = this.inputElementRef.value) == null ? void 0 : _a.blur();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async toggleInstructionFocus(focus) {
|
|
181
|
+
if (this.instructionElementRef.value) {
|
|
182
|
+
await this.instructionElementRef.value.animate([{ opacity: focus ? 0 : 1 }, { opacity: focus ? 1 : 0 }], {
|
|
183
|
+
duration: 100,
|
|
184
|
+
easing: "ease",
|
|
185
|
+
fill: "forwards"
|
|
186
|
+
}).finished;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
onBoxClick() {
|
|
190
|
+
if (!this.value && !this.instructionHidden) {
|
|
191
|
+
this.focusInput();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
onBlur() {
|
|
195
|
+
if (!this.value && this.instructionHidden && !this.pasting) {
|
|
196
|
+
this.focusInstruction();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
checkHidden() {
|
|
200
|
+
if (this.instructionHidden) {
|
|
201
|
+
this.focusInput();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
async onPasteClick() {
|
|
205
|
+
this.pasting = true;
|
|
206
|
+
const text = await navigator.clipboard.readText();
|
|
207
|
+
SendController.setReceiverAddress(text);
|
|
208
|
+
this.focusInput();
|
|
209
|
+
}
|
|
210
|
+
onInputChange(e2) {
|
|
211
|
+
var _a;
|
|
212
|
+
const element = e2.target;
|
|
213
|
+
this.pasting = false;
|
|
214
|
+
this.value = (_a = e2.target) == null ? void 0 : _a.value;
|
|
215
|
+
if (element.value && !this.instructionHidden) {
|
|
216
|
+
this.focusInput();
|
|
217
|
+
}
|
|
218
|
+
SendController.setLoading(true);
|
|
219
|
+
this.onDebouncedSearch(element.value);
|
|
220
|
+
}
|
|
221
|
+
setReceiverAddress(address) {
|
|
222
|
+
SendController.setReceiverAddress(address);
|
|
223
|
+
SendController.setReceiverProfileName(void 0);
|
|
224
|
+
SendController.setReceiverProfileImageUrl(void 0);
|
|
225
|
+
SendController.setLoading(false);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
W3mInputAddress.styles = styles$8;
|
|
229
|
+
__decorate$8([
|
|
230
|
+
n()
|
|
231
|
+
], W3mInputAddress.prototype, "value", void 0);
|
|
232
|
+
__decorate$8([
|
|
233
|
+
r()
|
|
234
|
+
], W3mInputAddress.prototype, "instructionHidden", void 0);
|
|
235
|
+
__decorate$8([
|
|
236
|
+
r()
|
|
237
|
+
], W3mInputAddress.prototype, "pasting", void 0);
|
|
238
|
+
W3mInputAddress = __decorate$8([
|
|
239
|
+
customElement("w3m-input-address")
|
|
240
|
+
], W3mInputAddress);
|
|
241
|
+
const styles$7 = i`
|
|
242
|
+
:host {
|
|
243
|
+
position: relative;
|
|
244
|
+
display: inline-block;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
input {
|
|
248
|
+
background: transparent;
|
|
249
|
+
width: 100%;
|
|
250
|
+
height: auto;
|
|
251
|
+
font-family: var(--wui-font-family);
|
|
252
|
+
color: var(--wui-color-fg-100);
|
|
253
|
+
|
|
254
|
+
font-feature-settings: 'case' on;
|
|
255
|
+
font-size: 32px;
|
|
256
|
+
font-weight: var(--wui-font-weight-light);
|
|
257
|
+
caret-color: var(--wui-color-accent-100);
|
|
258
|
+
line-height: 130%;
|
|
259
|
+
letter-spacing: -1.28px;
|
|
260
|
+
box-sizing: border-box;
|
|
261
|
+
-webkit-appearance: none;
|
|
262
|
+
-moz-appearance: textfield;
|
|
263
|
+
padding: 0px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
input::-webkit-outer-spin-button,
|
|
267
|
+
input::-webkit-inner-spin-button {
|
|
268
|
+
-webkit-appearance: none;
|
|
269
|
+
margin: 0;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
input::placeholder {
|
|
273
|
+
color: var(--wui-color-fg-275);
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
276
|
+
var __decorate$7 = function(decorators, target, key, desc) {
|
|
277
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
278
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
279
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
280
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
281
|
+
};
|
|
282
|
+
let WuiInputAmount = class WuiInputAmount2 extends i$1 {
|
|
283
|
+
constructor() {
|
|
284
|
+
super(...arguments);
|
|
285
|
+
this.inputElementRef = e();
|
|
286
|
+
this.disabled = false;
|
|
287
|
+
this.value = "";
|
|
288
|
+
this.placeholder = "0";
|
|
289
|
+
}
|
|
290
|
+
render() {
|
|
291
|
+
var _a;
|
|
292
|
+
if (((_a = this.inputElementRef) == null ? void 0 : _a.value) && this.value) {
|
|
293
|
+
this.inputElementRef.value.value = this.value;
|
|
294
|
+
}
|
|
295
|
+
return x`<input
|
|
296
|
+
${n$1(this.inputElementRef)}
|
|
297
|
+
type="text"
|
|
298
|
+
inputmode="decimal"
|
|
299
|
+
pattern="[0-9,.]*"
|
|
300
|
+
placeholder=${this.placeholder}
|
|
301
|
+
?disabled=${this.disabled}
|
|
302
|
+
autofocus
|
|
303
|
+
value=${this.value ?? ""}
|
|
304
|
+
@input=${this.dispatchInputChangeEvent.bind(this)}
|
|
305
|
+
/> `;
|
|
306
|
+
}
|
|
307
|
+
dispatchInputChangeEvent(e2) {
|
|
308
|
+
var _a, _b;
|
|
309
|
+
const inputChar = e2.data;
|
|
310
|
+
if (inputChar && ((_a = this.inputElementRef) == null ? void 0 : _a.value)) {
|
|
311
|
+
if (inputChar === ",") {
|
|
312
|
+
const inputValue = this.inputElementRef.value.value.replace(",", ".");
|
|
313
|
+
this.inputElementRef.value.value = inputValue;
|
|
314
|
+
this.value = `${this.value}${inputValue}`;
|
|
315
|
+
} else if (!numbersRegex.test(inputChar)) {
|
|
316
|
+
this.inputElementRef.value.value = this.value.replace(new RegExp(inputChar.replace(specialCharactersRegex, "\\$&"), "gu"), "");
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
this.dispatchEvent(new CustomEvent("inputChange", {
|
|
320
|
+
detail: (_b = this.inputElementRef.value) == null ? void 0 : _b.value,
|
|
321
|
+
bubbles: true,
|
|
322
|
+
composed: true
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
WuiInputAmount.styles = [resetStyles, elementStyles, styles$7];
|
|
327
|
+
__decorate$7([
|
|
328
|
+
n({ type: Boolean })
|
|
329
|
+
], WuiInputAmount.prototype, "disabled", void 0);
|
|
330
|
+
__decorate$7([
|
|
331
|
+
n({ type: String })
|
|
332
|
+
], WuiInputAmount.prototype, "value", void 0);
|
|
333
|
+
__decorate$7([
|
|
334
|
+
n({ type: String })
|
|
335
|
+
], WuiInputAmount.prototype, "placeholder", void 0);
|
|
336
|
+
WuiInputAmount = __decorate$7([
|
|
337
|
+
customElement("wui-input-amount")
|
|
338
|
+
], WuiInputAmount);
|
|
339
|
+
const styles$6 = i`
|
|
340
|
+
:host {
|
|
341
|
+
width: 100%;
|
|
342
|
+
height: 100px;
|
|
343
|
+
border-radius: var(--wui-border-radius-s);
|
|
344
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
345
|
+
background-color: var(--wui-color-gray-glass-002);
|
|
346
|
+
transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
|
|
347
|
+
will-change: background-color;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
:host(:hover) {
|
|
351
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
wui-flex {
|
|
355
|
+
width: 100%;
|
|
356
|
+
height: fit-content;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
wui-button {
|
|
360
|
+
width: 100%;
|
|
361
|
+
display: flex;
|
|
362
|
+
justify-content: flex-end;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
wui-input-amount {
|
|
366
|
+
mask-image: linear-gradient(
|
|
367
|
+
270deg,
|
|
368
|
+
transparent 0px,
|
|
369
|
+
transparent 8px,
|
|
370
|
+
black 24px,
|
|
371
|
+
black 25px,
|
|
372
|
+
black 32px,
|
|
373
|
+
black 100%
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.totalValue {
|
|
378
|
+
width: 100%;
|
|
379
|
+
}
|
|
380
|
+
`;
|
|
381
|
+
var __decorate$6 = function(decorators, target, key, desc) {
|
|
382
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
383
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
384
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
385
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
386
|
+
};
|
|
387
|
+
let W3mInputToken = class W3mInputToken2 extends i$1 {
|
|
388
|
+
render() {
|
|
389
|
+
return x` <wui-flex
|
|
390
|
+
flexDirection="column"
|
|
391
|
+
gap="4xs"
|
|
392
|
+
.padding=${["xl", "s", "l", "l"]}
|
|
393
|
+
>
|
|
394
|
+
<wui-flex alignItems="center">
|
|
395
|
+
<wui-input-amount
|
|
396
|
+
@inputChange=${this.onInputChange.bind(this)}
|
|
397
|
+
?disabled=${!this.token && true}
|
|
398
|
+
.value=${this.sendTokenAmount ? String(this.sendTokenAmount) : ""}
|
|
399
|
+
></wui-input-amount>
|
|
400
|
+
${this.buttonTemplate()}
|
|
401
|
+
</wui-flex>
|
|
402
|
+
<wui-flex alignItems="center" justifyContent="space-between">
|
|
403
|
+
${this.sendValueTemplate()}
|
|
404
|
+
<wui-flex alignItems="center" gap="4xs" justifyContent="flex-end">
|
|
405
|
+
${this.maxAmountTemplate()} ${this.actionTemplate()}
|
|
406
|
+
</wui-flex>
|
|
407
|
+
</wui-flex>
|
|
408
|
+
</wui-flex>`;
|
|
409
|
+
}
|
|
410
|
+
buttonTemplate() {
|
|
411
|
+
if (this.token) {
|
|
412
|
+
return x`<wui-token-button
|
|
413
|
+
text=${this.token.symbol}
|
|
414
|
+
imageSrc=${this.token.iconUrl}
|
|
415
|
+
@click=${this.handleSelectButtonClick.bind(this)}
|
|
416
|
+
>
|
|
417
|
+
</wui-token-button>`;
|
|
418
|
+
}
|
|
419
|
+
return x`<wui-button
|
|
420
|
+
size="md"
|
|
421
|
+
variant="accent"
|
|
422
|
+
@click=${this.handleSelectButtonClick.bind(this)}
|
|
423
|
+
>Select token</wui-button
|
|
424
|
+
>`;
|
|
425
|
+
}
|
|
426
|
+
handleSelectButtonClick() {
|
|
427
|
+
RouterController.push("WalletSendSelectToken");
|
|
428
|
+
}
|
|
429
|
+
sendValueTemplate() {
|
|
430
|
+
if (this.token && this.sendTokenAmount) {
|
|
431
|
+
const price = this.token.price;
|
|
432
|
+
const totalValue = price * this.sendTokenAmount;
|
|
433
|
+
return x`<wui-text class="totalValue" variant="small-400" color="fg-200"
|
|
434
|
+
>${totalValue ? `$${UiHelperUtil.formatNumberToLocalString(totalValue, 2)}` : "Incorrect value"}</wui-text
|
|
435
|
+
>`;
|
|
436
|
+
}
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
maxAmountTemplate() {
|
|
440
|
+
if (this.token) {
|
|
441
|
+
if (this.sendTokenAmount && this.sendTokenAmount > Number(this.token.quantity.numeric)) {
|
|
442
|
+
return x` <wui-text variant="small-400" color="error-100">
|
|
443
|
+
${UiHelperUtil.roundNumber(Number(this.token.quantity.numeric), 6, 5)}
|
|
444
|
+
</wui-text>`;
|
|
445
|
+
}
|
|
446
|
+
return x` <wui-text variant="small-400" color="fg-200">
|
|
447
|
+
${UiHelperUtil.roundNumber(Number(this.token.quantity.numeric), 6, 5)}
|
|
448
|
+
</wui-text>`;
|
|
449
|
+
}
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
actionTemplate() {
|
|
453
|
+
if (this.token) {
|
|
454
|
+
if (this.sendTokenAmount && this.sendTokenAmount > Number(this.token.quantity.numeric)) {
|
|
455
|
+
return x`<wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>`;
|
|
456
|
+
}
|
|
457
|
+
return x`<wui-link @click=${this.onMaxClick.bind(this)}>Max</wui-link>`;
|
|
458
|
+
}
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
onInputChange(event) {
|
|
462
|
+
SendController.setTokenAmount(event.detail);
|
|
463
|
+
}
|
|
464
|
+
onMaxClick() {
|
|
465
|
+
if (this.token) {
|
|
466
|
+
const maxValue = NumberUtil.bigNumber(this.token.quantity.numeric);
|
|
467
|
+
SendController.setTokenAmount(Number(maxValue.toFixed(20)));
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
onBuyClick() {
|
|
471
|
+
RouterController.push("OnRampProviders");
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
W3mInputToken.styles = styles$6;
|
|
475
|
+
__decorate$6([
|
|
476
|
+
n({ type: Object })
|
|
477
|
+
], W3mInputToken.prototype, "token", void 0);
|
|
478
|
+
__decorate$6([
|
|
479
|
+
n({ type: Number })
|
|
480
|
+
], W3mInputToken.prototype, "sendTokenAmount", void 0);
|
|
481
|
+
W3mInputToken = __decorate$6([
|
|
482
|
+
customElement("w3m-input-token")
|
|
483
|
+
], W3mInputToken);
|
|
484
|
+
const styles$5 = i`
|
|
485
|
+
:host {
|
|
486
|
+
display: block;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
wui-flex {
|
|
490
|
+
position: relative;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
wui-icon-box {
|
|
494
|
+
width: 40px;
|
|
495
|
+
height: 40px;
|
|
496
|
+
border-radius: var(--wui-border-radius-xs) !important;
|
|
497
|
+
border: 5px solid var(--wui-color-bg-125);
|
|
498
|
+
background: var(--wui-color-bg-175);
|
|
499
|
+
position: absolute;
|
|
500
|
+
top: 50%;
|
|
501
|
+
left: 50%;
|
|
502
|
+
transform: translate(-50%, -50%);
|
|
503
|
+
z-index: 3;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
wui-button {
|
|
507
|
+
--local-border-radius: var(--wui-border-radius-xs) !important;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.inputContainer {
|
|
511
|
+
height: fit-content;
|
|
512
|
+
}
|
|
513
|
+
`;
|
|
514
|
+
var __decorate$5 = function(decorators, target, key, desc) {
|
|
515
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
516
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
517
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
518
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
519
|
+
};
|
|
520
|
+
let W3mWalletSendView = class W3mWalletSendView2 extends i$1 {
|
|
521
|
+
constructor() {
|
|
522
|
+
super();
|
|
523
|
+
this.unsubscribe = [];
|
|
524
|
+
this.token = SendController.state.token;
|
|
525
|
+
this.sendTokenAmount = SendController.state.sendTokenAmount;
|
|
526
|
+
this.receiverAddress = SendController.state.receiverAddress;
|
|
527
|
+
this.receiverProfileName = SendController.state.receiverProfileName;
|
|
528
|
+
this.loading = SendController.state.loading;
|
|
529
|
+
this.message = "Preview Send";
|
|
530
|
+
this.fetchNetworkPrice();
|
|
531
|
+
this.fetchBalances();
|
|
532
|
+
this.unsubscribe.push(...[
|
|
533
|
+
SendController.subscribe((val) => {
|
|
534
|
+
this.token = val.token;
|
|
535
|
+
this.sendTokenAmount = val.sendTokenAmount;
|
|
536
|
+
this.receiverAddress = val.receiverAddress;
|
|
537
|
+
this.receiverProfileName = val.receiverProfileName;
|
|
538
|
+
this.loading = val.loading;
|
|
539
|
+
})
|
|
540
|
+
]);
|
|
541
|
+
}
|
|
542
|
+
disconnectedCallback() {
|
|
543
|
+
this.unsubscribe.forEach((unsubscribe) => unsubscribe());
|
|
544
|
+
}
|
|
545
|
+
render() {
|
|
546
|
+
this.getMessage();
|
|
547
|
+
return x` <wui-flex flexDirection="column" .padding=${["0", "l", "l", "l"]}>
|
|
548
|
+
<wui-flex class="inputContainer" gap="xs" flexDirection="column">
|
|
549
|
+
<w3m-input-token
|
|
550
|
+
.token=${this.token}
|
|
551
|
+
.sendTokenAmount=${this.sendTokenAmount}
|
|
552
|
+
></w3m-input-token>
|
|
553
|
+
<wui-icon-box
|
|
554
|
+
size="inherit"
|
|
555
|
+
backgroundColor="fg-300"
|
|
556
|
+
iconSize="lg"
|
|
557
|
+
iconColor="fg-250"
|
|
558
|
+
background="opaque"
|
|
559
|
+
icon="arrowBottom"
|
|
560
|
+
></wui-icon-box>
|
|
561
|
+
<w3m-input-address
|
|
562
|
+
.value=${this.receiverProfileName ? this.receiverProfileName : this.receiverAddress}
|
|
563
|
+
></w3m-input-address>
|
|
564
|
+
</wui-flex>
|
|
565
|
+
<wui-flex .margin=${["l", "0", "0", "0"]}>
|
|
566
|
+
<wui-button
|
|
567
|
+
@click=${this.onButtonClick.bind(this)}
|
|
568
|
+
?disabled=${!this.message.startsWith("Preview Send")}
|
|
569
|
+
size="lg"
|
|
570
|
+
variant="main"
|
|
571
|
+
?loading=${this.loading}
|
|
572
|
+
fullWidth
|
|
573
|
+
>
|
|
574
|
+
${this.message}
|
|
575
|
+
</wui-button>
|
|
576
|
+
</wui-flex>
|
|
577
|
+
</wui-flex>`;
|
|
578
|
+
}
|
|
579
|
+
async fetchBalances() {
|
|
580
|
+
await SendController.fetchTokenBalance();
|
|
581
|
+
SendController.fetchNetworkBalance();
|
|
582
|
+
}
|
|
583
|
+
async fetchNetworkPrice() {
|
|
584
|
+
await SwapController.getNetworkTokenPrice();
|
|
585
|
+
}
|
|
586
|
+
onButtonClick() {
|
|
587
|
+
RouterController.push("WalletSendPreview");
|
|
588
|
+
}
|
|
589
|
+
getMessage() {
|
|
590
|
+
var _a;
|
|
591
|
+
this.message = "Preview Send";
|
|
592
|
+
if (this.receiverAddress && !CoreHelperUtil.isAddress(this.receiverAddress, ChainController.state.activeChain)) {
|
|
593
|
+
this.message = "Invalid Address";
|
|
594
|
+
}
|
|
595
|
+
if (!this.receiverAddress) {
|
|
596
|
+
this.message = "Add Address";
|
|
597
|
+
}
|
|
598
|
+
if (this.sendTokenAmount && this.token && this.sendTokenAmount > Number(this.token.quantity.numeric)) {
|
|
599
|
+
this.message = "Insufficient Funds";
|
|
600
|
+
}
|
|
601
|
+
if (!this.sendTokenAmount) {
|
|
602
|
+
this.message = "Add Amount";
|
|
603
|
+
}
|
|
604
|
+
if (this.sendTokenAmount && ((_a = this.token) == null ? void 0 : _a.price)) {
|
|
605
|
+
const value = this.sendTokenAmount * this.token.price;
|
|
606
|
+
if (!value) {
|
|
607
|
+
this.message = "Incorrect Value";
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (!this.token) {
|
|
611
|
+
this.message = "Select Token";
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
W3mWalletSendView.styles = styles$5;
|
|
616
|
+
__decorate$5([
|
|
617
|
+
r()
|
|
618
|
+
], W3mWalletSendView.prototype, "token", void 0);
|
|
619
|
+
__decorate$5([
|
|
620
|
+
r()
|
|
621
|
+
], W3mWalletSendView.prototype, "sendTokenAmount", void 0);
|
|
622
|
+
__decorate$5([
|
|
623
|
+
r()
|
|
624
|
+
], W3mWalletSendView.prototype, "receiverAddress", void 0);
|
|
625
|
+
__decorate$5([
|
|
626
|
+
r()
|
|
627
|
+
], W3mWalletSendView.prototype, "receiverProfileName", void 0);
|
|
628
|
+
__decorate$5([
|
|
629
|
+
r()
|
|
630
|
+
], W3mWalletSendView.prototype, "loading", void 0);
|
|
631
|
+
__decorate$5([
|
|
632
|
+
r()
|
|
633
|
+
], W3mWalletSendView.prototype, "message", void 0);
|
|
634
|
+
W3mWalletSendView = __decorate$5([
|
|
635
|
+
customElement("w3m-wallet-send-view")
|
|
636
|
+
], W3mWalletSendView);
|
|
637
|
+
const styles$4 = i`
|
|
638
|
+
.contentContainer {
|
|
639
|
+
height: 440px;
|
|
640
|
+
overflow: scroll;
|
|
641
|
+
scrollbar-width: none;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.contentContainer::-webkit-scrollbar {
|
|
645
|
+
display: none;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
wui-icon-box {
|
|
649
|
+
width: 40px;
|
|
650
|
+
height: 40px;
|
|
651
|
+
border-radius: var(--wui-border-radius-xxs);
|
|
652
|
+
}
|
|
653
|
+
`;
|
|
654
|
+
var __decorate$4 = function(decorators, target, key, desc) {
|
|
655
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
656
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
657
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
658
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
659
|
+
};
|
|
660
|
+
let W3mSendSelectTokenView = class W3mSendSelectTokenView2 extends i$1 {
|
|
661
|
+
constructor() {
|
|
662
|
+
super();
|
|
663
|
+
this.unsubscribe = [];
|
|
664
|
+
this.tokenBalances = SendController.state.tokenBalances;
|
|
665
|
+
this.search = "";
|
|
666
|
+
this.onDebouncedSearch = CoreHelperUtil.debounce((value) => {
|
|
667
|
+
this.search = value;
|
|
668
|
+
});
|
|
669
|
+
this.unsubscribe.push(...[
|
|
670
|
+
SendController.subscribe((val) => {
|
|
671
|
+
this.tokenBalances = val.tokenBalances;
|
|
672
|
+
})
|
|
673
|
+
]);
|
|
674
|
+
}
|
|
675
|
+
disconnectedCallback() {
|
|
676
|
+
this.unsubscribe.forEach((unsubscribe) => unsubscribe());
|
|
677
|
+
}
|
|
678
|
+
render() {
|
|
679
|
+
return x`
|
|
680
|
+
<wui-flex flexDirection="column">
|
|
681
|
+
${this.templateSearchInput()} <wui-separator></wui-separator> ${this.templateTokens()}
|
|
682
|
+
</wui-flex>
|
|
683
|
+
`;
|
|
684
|
+
}
|
|
685
|
+
templateSearchInput() {
|
|
686
|
+
return x`
|
|
687
|
+
<wui-flex gap="xs" padding="s">
|
|
688
|
+
<wui-input-text
|
|
689
|
+
@inputChange=${this.onInputChange.bind(this)}
|
|
690
|
+
class="network-search-input"
|
|
691
|
+
size="sm"
|
|
692
|
+
placeholder="Search token"
|
|
693
|
+
icon="search"
|
|
694
|
+
></wui-input-text>
|
|
695
|
+
</wui-flex>
|
|
696
|
+
`;
|
|
697
|
+
}
|
|
698
|
+
templateTokens() {
|
|
699
|
+
var _a, _b;
|
|
700
|
+
this.tokens = (_a = this.tokenBalances) == null ? void 0 : _a.filter((token) => {
|
|
701
|
+
var _a2;
|
|
702
|
+
return token.chainId === ((_a2 = ChainController.state.activeCaipNetwork) == null ? void 0 : _a2.caipNetworkId);
|
|
703
|
+
});
|
|
704
|
+
if (this.search) {
|
|
705
|
+
this.filteredTokens = (_b = this.tokenBalances) == null ? void 0 : _b.filter((token) => token.name.toLowerCase().includes(this.search.toLowerCase()));
|
|
706
|
+
} else {
|
|
707
|
+
this.filteredTokens = this.tokens;
|
|
708
|
+
}
|
|
709
|
+
return x`
|
|
710
|
+
<wui-flex
|
|
711
|
+
class="contentContainer"
|
|
712
|
+
flexDirection="column"
|
|
713
|
+
.padding=${["0", "s", "0", "s"]}
|
|
714
|
+
>
|
|
715
|
+
<wui-flex justifyContent="flex-start" .padding=${["m", "s", "s", "s"]}>
|
|
716
|
+
<wui-text variant="paragraph-500" color="fg-200">Your tokens</wui-text>
|
|
717
|
+
</wui-flex>
|
|
718
|
+
<wui-flex flexDirection="column" gap="xs">
|
|
719
|
+
${this.filteredTokens && this.filteredTokens.length > 0 ? this.filteredTokens.map((token) => x`<wui-list-token
|
|
720
|
+
@click=${this.handleTokenClick.bind(this, token)}
|
|
721
|
+
?clickable=${true}
|
|
722
|
+
tokenName=${token.name}
|
|
723
|
+
tokenImageUrl=${token.iconUrl}
|
|
724
|
+
tokenAmount=${token.quantity.numeric}
|
|
725
|
+
tokenValue=${token.value}
|
|
726
|
+
tokenCurrency=${token.symbol}
|
|
727
|
+
></wui-list-token>`) : x`<wui-flex
|
|
728
|
+
.padding=${["4xl", "0", "0", "0"]}
|
|
729
|
+
alignItems="center"
|
|
730
|
+
flexDirection="column"
|
|
731
|
+
gap="l"
|
|
732
|
+
>
|
|
733
|
+
<wui-icon-box
|
|
734
|
+
icon="coinPlaceholder"
|
|
735
|
+
size="inherit"
|
|
736
|
+
iconColor="fg-200"
|
|
737
|
+
backgroundColor="fg-200"
|
|
738
|
+
iconSize="lg"
|
|
739
|
+
></wui-icon-box>
|
|
740
|
+
<wui-flex
|
|
741
|
+
class="textContent"
|
|
742
|
+
gap="xs"
|
|
743
|
+
flexDirection="column"
|
|
744
|
+
justifyContent="center"
|
|
745
|
+
flexDirection="column"
|
|
746
|
+
>
|
|
747
|
+
<wui-text variant="paragraph-500" align="center" color="fg-100"
|
|
748
|
+
>No tokens found</wui-text
|
|
749
|
+
>
|
|
750
|
+
<wui-text variant="small-400" align="center" color="fg-200"
|
|
751
|
+
>Your tokens will appear here</wui-text
|
|
752
|
+
>
|
|
753
|
+
</wui-flex>
|
|
754
|
+
<wui-link @click=${this.onBuyClick.bind(this)}>Buy</wui-link>
|
|
755
|
+
</wui-flex>`}
|
|
756
|
+
</wui-flex>
|
|
757
|
+
</wui-flex>
|
|
758
|
+
`;
|
|
759
|
+
}
|
|
760
|
+
onBuyClick() {
|
|
761
|
+
RouterController.push("OnRampProviders");
|
|
762
|
+
}
|
|
763
|
+
onInputChange(event) {
|
|
764
|
+
this.onDebouncedSearch(event.detail);
|
|
765
|
+
}
|
|
766
|
+
handleTokenClick(token) {
|
|
767
|
+
SendController.setToken(token);
|
|
768
|
+
SendController.setTokenAmount(void 0);
|
|
769
|
+
RouterController.goBack();
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
W3mSendSelectTokenView.styles = styles$4;
|
|
773
|
+
__decorate$4([
|
|
774
|
+
r()
|
|
775
|
+
], W3mSendSelectTokenView.prototype, "tokenBalances", void 0);
|
|
776
|
+
__decorate$4([
|
|
777
|
+
r()
|
|
778
|
+
], W3mSendSelectTokenView.prototype, "tokens", void 0);
|
|
779
|
+
__decorate$4([
|
|
780
|
+
r()
|
|
781
|
+
], W3mSendSelectTokenView.prototype, "filteredTokens", void 0);
|
|
782
|
+
__decorate$4([
|
|
783
|
+
r()
|
|
784
|
+
], W3mSendSelectTokenView.prototype, "search", void 0);
|
|
785
|
+
W3mSendSelectTokenView = __decorate$4([
|
|
786
|
+
customElement("w3m-wallet-send-select-token-view")
|
|
787
|
+
], W3mSendSelectTokenView);
|
|
788
|
+
const styles$3 = i`
|
|
789
|
+
:host {
|
|
790
|
+
display: flex;
|
|
791
|
+
gap: var(--wui-spacing-xs);
|
|
792
|
+
border-radius: var(--wui-border-radius-3xl);
|
|
793
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
794
|
+
background: var(--wui-color-gray-glass-002);
|
|
795
|
+
padding: var(--wui-spacing-2xs) var(--wui-spacing-xs) var(--wui-spacing-2xs)
|
|
796
|
+
var(--wui-spacing-s);
|
|
797
|
+
align-items: center;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
wui-avatar,
|
|
801
|
+
wui-icon,
|
|
802
|
+
wui-image {
|
|
803
|
+
width: 32px;
|
|
804
|
+
height: 32px;
|
|
805
|
+
border: 1px solid var(--wui-color-gray-glass-002);
|
|
806
|
+
border-radius: var(--wui-border-radius-3xl);
|
|
807
|
+
box-shadow: 0 0 0 2px var(--wui-color-gray-glass-002);
|
|
808
|
+
}
|
|
809
|
+
`;
|
|
810
|
+
var __decorate$3 = function(decorators, target, key, desc) {
|
|
811
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
812
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
813
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
814
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
815
|
+
};
|
|
816
|
+
let WuiPreviewItem = class WuiPreviewItem2 extends i$1 {
|
|
817
|
+
constructor() {
|
|
818
|
+
super(...arguments);
|
|
819
|
+
this.text = "";
|
|
820
|
+
this.address = "";
|
|
821
|
+
this.isAddress = false;
|
|
822
|
+
}
|
|
823
|
+
render() {
|
|
824
|
+
return x`<wui-text variant="large-500" color="fg-100">${this.text}</wui-text>
|
|
825
|
+
${this.imageTemplate()}`;
|
|
826
|
+
}
|
|
827
|
+
imageTemplate() {
|
|
828
|
+
if (this.isAddress) {
|
|
829
|
+
return x`<wui-avatar address=${this.address} .imageSrc=${this.imageSrc}></wui-avatar>`;
|
|
830
|
+
} else if (this.imageSrc) {
|
|
831
|
+
return x`<wui-image src=${this.imageSrc}></wui-image>`;
|
|
832
|
+
}
|
|
833
|
+
return x`<wui-icon size="inherit" color="fg-200" name="networkPlaceholder"></wui-icon>`;
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
WuiPreviewItem.styles = [resetStyles, elementStyles, styles$3];
|
|
837
|
+
__decorate$3([
|
|
838
|
+
n()
|
|
839
|
+
], WuiPreviewItem.prototype, "text", void 0);
|
|
840
|
+
__decorate$3([
|
|
841
|
+
n()
|
|
842
|
+
], WuiPreviewItem.prototype, "address", void 0);
|
|
843
|
+
__decorate$3([
|
|
844
|
+
n()
|
|
845
|
+
], WuiPreviewItem.prototype, "imageSrc", void 0);
|
|
846
|
+
__decorate$3([
|
|
847
|
+
n({ type: Boolean })
|
|
848
|
+
], WuiPreviewItem.prototype, "isAddress", void 0);
|
|
849
|
+
WuiPreviewItem = __decorate$3([
|
|
850
|
+
customElement("wui-preview-item")
|
|
851
|
+
], WuiPreviewItem);
|
|
852
|
+
const styles$2 = i`
|
|
853
|
+
:host {
|
|
854
|
+
display: flex;
|
|
855
|
+
column-gap: var(--wui-spacing-s);
|
|
856
|
+
padding: 17px 18px 17px var(--wui-spacing-m);
|
|
857
|
+
width: 100%;
|
|
858
|
+
background-color: var(--wui-color-gray-glass-002);
|
|
859
|
+
border-radius: var(--wui-border-radius-xs);
|
|
860
|
+
color: var(--wui-color-fg-250);
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
wui-image {
|
|
864
|
+
width: var(--wui-icon-size-lg);
|
|
865
|
+
height: var(--wui-icon-size-lg);
|
|
866
|
+
border-radius: var(--wui-border-radius-3xl);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
wui-icon {
|
|
870
|
+
width: var(--wui-icon-size-lg);
|
|
871
|
+
height: var(--wui-icon-size-lg);
|
|
872
|
+
}
|
|
873
|
+
`;
|
|
874
|
+
var __decorate$2 = function(decorators, target, key, desc) {
|
|
875
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
876
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
877
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
878
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
879
|
+
};
|
|
880
|
+
let WuiListContent = class WuiListContent2 extends i$1 {
|
|
881
|
+
constructor() {
|
|
882
|
+
super(...arguments);
|
|
883
|
+
this.imageSrc = void 0;
|
|
884
|
+
this.textTitle = "";
|
|
885
|
+
this.textValue = void 0;
|
|
886
|
+
}
|
|
887
|
+
render() {
|
|
888
|
+
return x`
|
|
889
|
+
<wui-flex justifyContent="space-between" alignItems="center">
|
|
890
|
+
<wui-text variant="paragraph-500" color=${this.textValue ? "fg-200" : "fg-100"}>
|
|
891
|
+
${this.textTitle}
|
|
892
|
+
</wui-text>
|
|
893
|
+
${this.templateContent()}
|
|
894
|
+
</wui-flex>
|
|
895
|
+
`;
|
|
896
|
+
}
|
|
897
|
+
templateContent() {
|
|
898
|
+
if (this.imageSrc) {
|
|
899
|
+
return x`<wui-image src=${this.imageSrc} alt=${this.textTitle}></wui-image>`;
|
|
900
|
+
} else if (this.textValue) {
|
|
901
|
+
return x` <wui-text variant="paragraph-400" color="fg-100"> ${this.textValue} </wui-text>`;
|
|
902
|
+
}
|
|
903
|
+
return x`<wui-icon size="inherit" color="fg-200" name="networkPlaceholder"></wui-icon>`;
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
WuiListContent.styles = [resetStyles, elementStyles, styles$2];
|
|
907
|
+
__decorate$2([
|
|
908
|
+
n()
|
|
909
|
+
], WuiListContent.prototype, "imageSrc", void 0);
|
|
910
|
+
__decorate$2([
|
|
911
|
+
n()
|
|
912
|
+
], WuiListContent.prototype, "textTitle", void 0);
|
|
913
|
+
__decorate$2([
|
|
914
|
+
n()
|
|
915
|
+
], WuiListContent.prototype, "textValue", void 0);
|
|
916
|
+
WuiListContent = __decorate$2([
|
|
917
|
+
customElement("wui-list-content")
|
|
918
|
+
], WuiListContent);
|
|
919
|
+
const styles$1 = i`
|
|
920
|
+
:host {
|
|
921
|
+
display: flex;
|
|
922
|
+
width: auto;
|
|
923
|
+
flex-direction: column;
|
|
924
|
+
gap: var(--wui-border-radius-1xs);
|
|
925
|
+
border-radius: var(--wui-border-radius-s);
|
|
926
|
+
background: var(--wui-color-gray-glass-002);
|
|
927
|
+
padding: var(--wui-spacing-s) var(--wui-spacing-1xs) var(--wui-spacing-1xs)
|
|
928
|
+
var(--wui-spacing-1xs);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
wui-text {
|
|
932
|
+
padding: 0 var(--wui-spacing-1xs);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
wui-flex {
|
|
936
|
+
margin-top: var(--wui-spacing-1xs);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
.network {
|
|
940
|
+
cursor: pointer;
|
|
941
|
+
transition: background-color var(--wui-ease-out-power-1) var(--wui-duration-lg);
|
|
942
|
+
will-change: background-color;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
.network:focus-visible {
|
|
946
|
+
border: 1px solid var(--wui-color-accent-100);
|
|
947
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
948
|
+
-webkit-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
949
|
+
-moz-box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
950
|
+
box-shadow: 0px 0px 0px 4px var(--wui-box-shadow-blue);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
.network:hover {
|
|
954
|
+
background-color: var(--wui-color-gray-glass-005);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.network:active {
|
|
958
|
+
background-color: var(--wui-color-gray-glass-010);
|
|
959
|
+
}
|
|
960
|
+
`;
|
|
961
|
+
var __decorate$1 = function(decorators, target, key, desc) {
|
|
962
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
963
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
964
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
965
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
966
|
+
};
|
|
967
|
+
let W3mWalletSendDetails = class W3mWalletSendDetails2 extends i$1 {
|
|
968
|
+
render() {
|
|
969
|
+
return x` <wui-text variant="small-400" color="fg-200">Details</wui-text>
|
|
970
|
+
<wui-flex flexDirection="column" gap="xxs">
|
|
971
|
+
<wui-list-content
|
|
972
|
+
textTitle="Address"
|
|
973
|
+
textValue=${UiHelperUtil.getTruncateString({
|
|
974
|
+
string: this.receiverAddress ?? "",
|
|
975
|
+
charsStart: 4,
|
|
976
|
+
charsEnd: 4,
|
|
977
|
+
truncate: "middle"
|
|
978
|
+
})}
|
|
979
|
+
>
|
|
980
|
+
</wui-list-content>
|
|
981
|
+
${this.networkTemplate()}
|
|
982
|
+
</wui-flex>`;
|
|
983
|
+
}
|
|
984
|
+
networkTemplate() {
|
|
985
|
+
var _a;
|
|
986
|
+
if ((_a = this.caipNetwork) == null ? void 0 : _a.name) {
|
|
987
|
+
return x` <wui-list-content
|
|
988
|
+
@click=${() => this.onNetworkClick(this.caipNetwork)}
|
|
989
|
+
class="network"
|
|
990
|
+
textTitle="Network"
|
|
991
|
+
imageSrc=${o(AssetUtil.getNetworkImage(this.caipNetwork))}
|
|
992
|
+
></wui-list-content>`;
|
|
993
|
+
}
|
|
994
|
+
return null;
|
|
995
|
+
}
|
|
996
|
+
onNetworkClick(network) {
|
|
997
|
+
if (network) {
|
|
998
|
+
RouterController.push("Networks", { network });
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
W3mWalletSendDetails.styles = styles$1;
|
|
1003
|
+
__decorate$1([
|
|
1004
|
+
n()
|
|
1005
|
+
], W3mWalletSendDetails.prototype, "receiverAddress", void 0);
|
|
1006
|
+
__decorate$1([
|
|
1007
|
+
n({ type: Object })
|
|
1008
|
+
], W3mWalletSendDetails.prototype, "caipNetwork", void 0);
|
|
1009
|
+
W3mWalletSendDetails = __decorate$1([
|
|
1010
|
+
customElement("w3m-wallet-send-details")
|
|
1011
|
+
], W3mWalletSendDetails);
|
|
1012
|
+
const styles = i`
|
|
1013
|
+
wui-avatar,
|
|
1014
|
+
wui-image {
|
|
1015
|
+
display: ruby;
|
|
1016
|
+
width: 32px;
|
|
1017
|
+
height: 32px;
|
|
1018
|
+
border-radius: var(--wui-border-radius-3xl);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
.sendButton {
|
|
1022
|
+
width: 70%;
|
|
1023
|
+
--local-width: 100% !important;
|
|
1024
|
+
--local-border-radius: var(--wui-border-radius-xs) !important;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
.cancelButton {
|
|
1028
|
+
width: 30%;
|
|
1029
|
+
--local-width: 100% !important;
|
|
1030
|
+
--local-border-radius: var(--wui-border-radius-xs) !important;
|
|
1031
|
+
}
|
|
1032
|
+
`;
|
|
1033
|
+
var __decorate = function(decorators, target, key, desc) {
|
|
1034
|
+
var c = arguments.length, r2 = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1035
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key, desc);
|
|
1036
|
+
else for (var i2 = decorators.length - 1; i2 >= 0; i2--) if (d = decorators[i2]) r2 = (c < 3 ? d(r2) : c > 3 ? d(target, key, r2) : d(target, key)) || r2;
|
|
1037
|
+
return c > 3 && r2 && Object.defineProperty(target, key, r2), r2;
|
|
1038
|
+
};
|
|
1039
|
+
let W3mWalletSendPreviewView = class W3mWalletSendPreviewView2 extends i$1 {
|
|
1040
|
+
constructor() {
|
|
1041
|
+
super();
|
|
1042
|
+
this.unsubscribe = [];
|
|
1043
|
+
this.token = SendController.state.token;
|
|
1044
|
+
this.sendTokenAmount = SendController.state.sendTokenAmount;
|
|
1045
|
+
this.receiverAddress = SendController.state.receiverAddress;
|
|
1046
|
+
this.receiverProfileName = SendController.state.receiverProfileName;
|
|
1047
|
+
this.receiverProfileImageUrl = SendController.state.receiverProfileImageUrl;
|
|
1048
|
+
this.caipNetwork = ChainController.state.activeCaipNetwork;
|
|
1049
|
+
this.loading = SendController.state.loading;
|
|
1050
|
+
this.unsubscribe.push(...[
|
|
1051
|
+
SendController.subscribe((val) => {
|
|
1052
|
+
this.token = val.token;
|
|
1053
|
+
this.sendTokenAmount = val.sendTokenAmount;
|
|
1054
|
+
this.receiverAddress = val.receiverAddress;
|
|
1055
|
+
this.receiverProfileName = val.receiverProfileName;
|
|
1056
|
+
this.receiverProfileImageUrl = val.receiverProfileImageUrl;
|
|
1057
|
+
this.loading = val.loading;
|
|
1058
|
+
}),
|
|
1059
|
+
ChainController.subscribeKey("activeCaipNetwork", (val) => this.caipNetwork = val)
|
|
1060
|
+
]);
|
|
1061
|
+
}
|
|
1062
|
+
disconnectedCallback() {
|
|
1063
|
+
this.unsubscribe.forEach((unsubscribe) => unsubscribe());
|
|
1064
|
+
}
|
|
1065
|
+
render() {
|
|
1066
|
+
var _a, _b;
|
|
1067
|
+
return x` <wui-flex flexDirection="column" .padding=${["0", "l", "l", "l"]}>
|
|
1068
|
+
<wui-flex gap="xs" flexDirection="column" .padding=${["0", "xs", "0", "xs"]}>
|
|
1069
|
+
<wui-flex alignItems="center" justifyContent="space-between">
|
|
1070
|
+
<wui-flex flexDirection="column" gap="4xs">
|
|
1071
|
+
<wui-text variant="small-400" color="fg-150">Send</wui-text>
|
|
1072
|
+
${this.sendValueTemplate()}
|
|
1073
|
+
</wui-flex>
|
|
1074
|
+
<wui-preview-item
|
|
1075
|
+
text="${this.sendTokenAmount ? UiHelperUtil.roundNumber(this.sendTokenAmount, 6, 5) : "unknown"} ${(_a = this.token) == null ? void 0 : _a.symbol}"
|
|
1076
|
+
.imageSrc=${(_b = this.token) == null ? void 0 : _b.iconUrl}
|
|
1077
|
+
></wui-preview-item>
|
|
1078
|
+
</wui-flex>
|
|
1079
|
+
<wui-flex>
|
|
1080
|
+
<wui-icon color="fg-200" size="md" name="arrowBottom"></wui-icon>
|
|
1081
|
+
</wui-flex>
|
|
1082
|
+
<wui-flex alignItems="center" justifyContent="space-between">
|
|
1083
|
+
<wui-text variant="small-400" color="fg-150">To</wui-text>
|
|
1084
|
+
<wui-preview-item
|
|
1085
|
+
text="${this.receiverProfileName ? UiHelperUtil.getTruncateString({
|
|
1086
|
+
string: this.receiverProfileName,
|
|
1087
|
+
charsStart: 20,
|
|
1088
|
+
charsEnd: 0,
|
|
1089
|
+
truncate: "end"
|
|
1090
|
+
}) : UiHelperUtil.getTruncateString({
|
|
1091
|
+
string: this.receiverAddress ? this.receiverAddress : "",
|
|
1092
|
+
charsStart: 4,
|
|
1093
|
+
charsEnd: 4,
|
|
1094
|
+
truncate: "middle"
|
|
1095
|
+
})}"
|
|
1096
|
+
address=${this.receiverAddress ?? ""}
|
|
1097
|
+
.imageSrc=${this.receiverProfileImageUrl ?? void 0}
|
|
1098
|
+
.isAddress=${true}
|
|
1099
|
+
></wui-preview-item>
|
|
1100
|
+
</wui-flex>
|
|
1101
|
+
</wui-flex>
|
|
1102
|
+
<wui-flex flexDirection="column" .padding=${["xxl", "0", "0", "0"]}>
|
|
1103
|
+
<w3m-wallet-send-details
|
|
1104
|
+
.caipNetwork=${this.caipNetwork}
|
|
1105
|
+
.receiverAddress=${this.receiverAddress}
|
|
1106
|
+
></w3m-wallet-send-details>
|
|
1107
|
+
<wui-flex justifyContent="center" gap="xxs" .padding=${["s", "0", "0", "0"]}>
|
|
1108
|
+
<wui-icon size="sm" color="fg-200" name="warningCircle"></wui-icon>
|
|
1109
|
+
<wui-text variant="small-400" color="fg-200">Review transaction carefully</wui-text>
|
|
1110
|
+
</wui-flex>
|
|
1111
|
+
<wui-flex justifyContent="center" gap="s" .padding=${["l", "0", "0", "0"]}>
|
|
1112
|
+
<wui-button
|
|
1113
|
+
class="cancelButton"
|
|
1114
|
+
@click=${this.onCancelClick.bind(this)}
|
|
1115
|
+
size="lg"
|
|
1116
|
+
variant="neutral"
|
|
1117
|
+
>
|
|
1118
|
+
Cancel
|
|
1119
|
+
</wui-button>
|
|
1120
|
+
<wui-button
|
|
1121
|
+
class="sendButton"
|
|
1122
|
+
@click=${this.onSendClick.bind(this)}
|
|
1123
|
+
size="lg"
|
|
1124
|
+
variant="main"
|
|
1125
|
+
.loading=${this.loading}
|
|
1126
|
+
>
|
|
1127
|
+
Send
|
|
1128
|
+
</wui-button>
|
|
1129
|
+
</wui-flex>
|
|
1130
|
+
</wui-flex></wui-flex
|
|
1131
|
+
>`;
|
|
1132
|
+
}
|
|
1133
|
+
sendValueTemplate() {
|
|
1134
|
+
if (this.token && this.sendTokenAmount) {
|
|
1135
|
+
const price = this.token.price;
|
|
1136
|
+
const totalValue = price * this.sendTokenAmount;
|
|
1137
|
+
return x`<wui-text variant="paragraph-400" color="fg-100"
|
|
1138
|
+
>$${totalValue.toFixed(2)}</wui-text
|
|
1139
|
+
>`;
|
|
1140
|
+
}
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
1143
|
+
async onSendClick() {
|
|
1144
|
+
var _a, _b;
|
|
1145
|
+
if (!this.sendTokenAmount || !this.receiverAddress) {
|
|
1146
|
+
SnackController.showError("Please enter a valid amount and receiver address");
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
try {
|
|
1150
|
+
await SendController.sendToken();
|
|
1151
|
+
SnackController.showSuccess("Transaction started");
|
|
1152
|
+
RouterController.replace("Account");
|
|
1153
|
+
} catch (error) {
|
|
1154
|
+
SnackController.showError("Failed to send transaction. Please try again.");
|
|
1155
|
+
console.error("SendController:sendToken - failed to send transaction", error);
|
|
1156
|
+
const activeChainNamespace = ChainController.state.activeChain;
|
|
1157
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
1158
|
+
EventsController.sendEvent({
|
|
1159
|
+
type: "track",
|
|
1160
|
+
event: "SEND_ERROR",
|
|
1161
|
+
properties: {
|
|
1162
|
+
message: errorMessage,
|
|
1163
|
+
isSmartAccount: getPreferredAccountType(activeChainNamespace) === W3mFrameRpcConstants.ACCOUNT_TYPES.SMART_ACCOUNT,
|
|
1164
|
+
token: ((_a = this.token) == null ? void 0 : _a.symbol) || "",
|
|
1165
|
+
amount: this.sendTokenAmount,
|
|
1166
|
+
network: ((_b = ChainController.state.activeCaipNetwork) == null ? void 0 : _b.caipNetworkId) || ""
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
onCancelClick() {
|
|
1172
|
+
RouterController.goBack();
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
W3mWalletSendPreviewView.styles = styles;
|
|
1176
|
+
__decorate([
|
|
1177
|
+
r()
|
|
1178
|
+
], W3mWalletSendPreviewView.prototype, "token", void 0);
|
|
1179
|
+
__decorate([
|
|
1180
|
+
r()
|
|
1181
|
+
], W3mWalletSendPreviewView.prototype, "sendTokenAmount", void 0);
|
|
1182
|
+
__decorate([
|
|
1183
|
+
r()
|
|
1184
|
+
], W3mWalletSendPreviewView.prototype, "receiverAddress", void 0);
|
|
1185
|
+
__decorate([
|
|
1186
|
+
r()
|
|
1187
|
+
], W3mWalletSendPreviewView.prototype, "receiverProfileName", void 0);
|
|
1188
|
+
__decorate([
|
|
1189
|
+
r()
|
|
1190
|
+
], W3mWalletSendPreviewView.prototype, "receiverProfileImageUrl", void 0);
|
|
1191
|
+
__decorate([
|
|
1192
|
+
r()
|
|
1193
|
+
], W3mWalletSendPreviewView.prototype, "caipNetwork", void 0);
|
|
1194
|
+
__decorate([
|
|
1195
|
+
r()
|
|
1196
|
+
], W3mWalletSendPreviewView.prototype, "loading", void 0);
|
|
1197
|
+
W3mWalletSendPreviewView = __decorate([
|
|
1198
|
+
customElement("w3m-wallet-send-preview-view")
|
|
1199
|
+
], W3mWalletSendPreviewView);
|
|
1200
|
+
export {
|
|
1201
|
+
W3mSendSelectTokenView,
|
|
1202
|
+
W3mWalletSendPreviewView,
|
|
1203
|
+
W3mWalletSendView
|
|
1204
|
+
};
|