astra-modal-test 1.0.5 → 1.0.7
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/.github/workflows/code-quality.yml +43 -0
- package/.github/workflows/publish.yml +64 -0
- package/README.md +204 -0
- package/dist/SwapController-CsNqEWIM.js +447 -0
- package/dist/add-Dm_oSEbv.js +19 -0
- package/dist/all-wallets-DfLlzQJ3.js +10 -0
- package/dist/app-store-BMdJkp6P.js +21 -0
- package/dist/apple-BetlVMKw.js +22 -0
- package/dist/arrow-bottom-BddPptxy.js +12 -0
- package/dist/arrow-bottom-circle-CvdJJniv.js +15 -0
- package/dist/arrow-left-Bbq-z1nQ.js +12 -0
- package/dist/arrow-right-Bu4_SVLC.js +12 -0
- package/dist/arrow-top-CynlXB-M.js +12 -0
- package/dist/astra-sdk.es.js +4 -4
- package/dist/bank-B9QscNnS.js +18 -0
- package/dist/bin-v-tshf8_.js +8 -0
- package/dist/bitcoin-C01gkYyN.js +17 -0
- package/dist/browser-9uNaCY31.js +18 -0
- package/dist/card-hKR9lRzU.js +18 -0
- package/dist/{ccip-oZOrZYR9.js → ccip-CUCziAPw.js} +52 -49
- package/dist/checkmark-D1M40aM5.js +15 -0
- package/dist/checkmark-bold-1_UGl24m.js +12 -0
- package/dist/chevron-bottom-BleoRNRL.js +12 -0
- package/dist/chevron-left-C9JMU-3B.js +12 -0
- package/dist/chevron-right-Daue4WBx.js +12 -0
- package/dist/chevron-top-yuXekbUC.js +12 -0
- package/dist/chrome-store-BsUFRR7F.js +65 -0
- package/dist/circle-BCxdhM5X.js +8 -0
- package/dist/clock-7a-DWZQa.js +12 -0
- package/dist/close-DMQYuJ0z.js +12 -0
- package/dist/clsx.m-DCYaa4RU.js +20 -0
- package/dist/coinPlaceholder-DjQ-HnSH.js +12 -0
- package/dist/compass-AMecXNVm.js +12 -0
- package/dist/copy-CgIPGYbU.js +19 -0
- package/dist/cursor-DpYbTNcO.js +7 -0
- package/dist/cursor-transparent-C8iPJkn8.js +16 -0
- package/dist/desktop-BWVQVGng.js +13 -0
- package/dist/disconnect-C6IQRrtF.js +12 -0
- package/dist/discord-gH3i-QsC.js +21 -0
- package/dist/email-BxYwJC5T.js +10 -0
- package/dist/embedded-wallet-DCcVNgkc.js +464 -0
- package/dist/ethereum-CGWsmZaC.js +14 -0
- package/dist/etherscan-D4EFsAJ4.js +10 -0
- package/dist/exclamation-triangle-DNwQ1Xq6.js +8 -0
- package/dist/extension-DxQPsN2z.js +12 -0
- package/dist/external-link-BeEzrdgR.js +12 -0
- package/dist/facebook-B2Ix8_d3.js +30 -0
- package/dist/farcaster-BB83p8dC.js +16 -0
- package/dist/filters-PzdIomB1.js +12 -0
- package/dist/github-gcp1rxX0.js +22 -0
- package/dist/google-Qv9lTZcz.js +22 -0
- package/dist/help-circle-BLXTMjzX.js +16 -0
- package/dist/id-BHg2CRhj.js +16 -0
- package/dist/image-DWi1V30x.js +8 -0
- package/dist/index-4lbsZ6RQ.js +33 -0
- package/dist/index-64U3D9_n.js +21034 -0
- package/dist/index-CRU49I0g.js +15911 -0
- package/dist/index-ChxXyuZj.js +572 -0
- package/dist/index-ClS956E1.js +74511 -0
- package/dist/index-Cs4fWw01.js +386 -0
- package/dist/index-DfWqgW4h.js +709 -0
- package/dist/index-VYNI76FM.js +315 -0
- package/dist/index-qfkTLN90.js +10785 -0
- package/dist/index-r2ztgVN2.js +1060 -0
- package/dist/index-wvh7Yd5J.js +70 -0
- package/dist/info-Bl5tmiBJ.js +7 -0
- package/dist/info-circle-D2uYywg-.js +16 -0
- package/dist/lightbulb-HvXH2AVF.js +7 -0
- package/dist/mail-DXOPfnog.js +12 -0
- package/dist/mobile-Dd0Gj4vZ.js +13 -0
- package/dist/more-DYcnClbB.js +15 -0
- package/dist/network-placeholder-CfRZGQfi.js +18 -0
- package/dist/nftPlaceholder-DHmFkY55.js +12 -0
- package/dist/off-CG2Y30qN.js +8 -0
- package/dist/onramp-DoAMTeNm.js +917 -0
- package/dist/play-store-B5EYBQto.js +36 -0
- package/dist/plus-DPo25_zL.js +17 -0
- package/dist/qr-code-BRTO19PL.js +10 -0
- package/dist/receive-BvclNdV_.js +179 -0
- package/dist/recycle-horizontal-ng_b2eJV.js +13 -0
- package/dist/refresh-3kiwRV0w.js +12 -0
- package/dist/reown-logo-_9cuIfJD.js +16 -0
- package/dist/search-CoJvIxpi.js +12 -0
- package/dist/secp256k1-wZyK2iIX.js +1257 -0
- package/dist/send-BVKGSR-Z.js +19 -0
- package/dist/send-Bkj5YtHe.js +1039 -0
- package/dist/socials-DL42HlL5.js +589 -0
- package/dist/solana-BjP-_Ioa.js +17 -0
- package/dist/swapHorizontal-Do3uBbum.js +12 -0
- package/dist/swapHorizontalBold-D7N75BE-.js +12 -0
- package/dist/swapHorizontalMedium-BahEVO2x.js +20 -0
- package/dist/swapHorizontalRoundedBold-D6Hoi132.js +12 -0
- package/dist/swapVertical-P-fnrADh.js +12 -0
- package/dist/swaps-DZgbVJZ2.js +1713 -0
- package/dist/telegram-DmaL2iB8.js +20 -0
- package/dist/three-dots-oXyAsUA6.js +9 -0
- package/dist/transactions-BjB5yZN7.js +35 -0
- package/dist/twitch-0UGrMr2K.js +22 -0
- package/dist/twitterIcon-B97KAbaJ.js +10 -0
- package/dist/ui-r6nnVhBA.js +812 -0
- package/dist/user-BG1yp56Q.js +7 -0
- package/dist/verify-CgzkMSuV.js +12 -0
- package/dist/verify-filled-D-TRpWtN.js +12 -0
- package/dist/w3m-modal-Drsibcs0.js +1041 -0
- package/dist/wallet-CAHsZdfj.js +12 -0
- package/dist/wallet-placeholder-agbbreqw.js +18 -0
- package/dist/walletconnect-Yd8iXqY9.js +36 -0
- package/dist/warning-circle-C0hqC6h_.js +16 -0
- package/dist/x-mark-D9_ai2sI.js +7 -0
- package/dist/x-z6v1Jegg.js +16 -0
- package/eslint.config.mjs +1 -1
- package/package.json +14 -13
- package/src/apis/lspApi.js +47 -24
- package/src/assets/ln.png +0 -0
- package/src/assets/network/Arbitrum.png +0 -0
- package/src/assets/network/Polygon.png +0 -0
- package/src/assets/network/Solana.png +0 -0
- package/src/assets/network/botanix.png +0 -0
- package/src/assets/network/bsc.svg +13 -0
- package/src/assets/pay.png +0 -0
- package/src/assets/tokens/usdc.png +0 -0
- package/src/assets/tokens/usdt.png +0 -0
- package/src/comps/AstraImage.jsx +17 -3
- package/src/comps/AstraModal.jsx +22 -16
- package/src/comps/AstraModalLogo.jsx +9 -9
- package/src/comps/AstraNetwork.jsx +174 -45
- package/src/comps/CheckErc20Button.jsx +1 -1
- package/src/comps/CommonStyle.jsx +4 -0
- package/src/comps/ConnectButton.jsx +16 -33
- package/src/comps/ResultModal.jsx +45 -39
- package/src/comps/ToLightning.jsx +207 -80
- package/src/comps/ToToken.jsx +278 -217
- package/src/constants/index.js +20 -4
- package/src/hooks/useContract.js +164 -125
- package/src/hooks/useGetMinAndMax.js +48 -0
- package/src/hooks/useLspApi.js +56 -39
- package/src/hooks/useParseInvoice.js +82 -72
- package/src/index.jsx +43 -10
- package/src/main.jsx +36 -5
- package/src/utils/index.js +136 -24
- package/vite.config.js +7 -1
- package/dist/astra-sdk.umd.js +0 -12578
- package/dist/hooks.module-BBZfodGH.js +0 -506
- package/dist/index-BKKAfRrw.js +0 -87520
- package/dist/index-C2MAIRET.js +0 -2929
- package/dist/index-CsRxokSv.js +0 -445
- package/dist/index-DQ6iiHxJ.js +0 -13720
- package/dist/index-SJhlkSif.js +0 -133
- package/dist/w3m-modal-CYJpmgnf.js +0 -267
- package/src/constants/contracts/abi/bridge.js +0 -1281
- package/src/constants/contracts/abi/index.js +0 -3
- package/src/constants/contracts/abi/usdt.js +0 -130
- package/src/constants/contracts/abi/watcher.js +0 -437
- package/src/constants/contracts/index.js +0 -37
|
@@ -1,15 +1,76 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
1
|
+
import styled, { createGlobalStyle } from "styled-components";
|
|
2
2
|
import { Select, Form, Flex, Spin, Space } from "antd";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useAccount,
|
|
5
|
+
useChains,
|
|
6
|
+
useChainId,
|
|
7
|
+
useSwitchChain,
|
|
8
|
+
useDisconnect,
|
|
9
|
+
} from "wagmi";
|
|
4
10
|
import EllipsisMiddle from "./EllipsisMiddle";
|
|
5
11
|
import AstraImg from "./AstraImage";
|
|
6
12
|
import { useCallback, useMemo, useState } from "react";
|
|
7
|
-
import { DisconnectOutlined } from
|
|
13
|
+
import { DisconnectOutlined } from "@ant-design/icons";
|
|
8
14
|
import Decimal from "decimal.js";
|
|
15
|
+
import { AvalibleBalance } from "./CommonStyle";
|
|
16
|
+
import { numberWithCommas } from "../utils";
|
|
17
|
+
const GlobalStyle = createGlobalStyle`
|
|
18
|
+
.popup-astra-select-content {
|
|
19
|
+
border-radius: 5px;
|
|
20
|
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
|
|
21
|
+
width: 200px;
|
|
22
|
+
|
|
23
|
+
.label-box {
|
|
24
|
+
display: flex;
|
|
25
|
+
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: space-between;
|
|
28
|
+
.label-flex{
|
|
29
|
+
display: flex;
|
|
30
|
+
gap: 3px;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
.label-soon {
|
|
34
|
+
border-radius: 10px;
|
|
35
|
+
background: rgba(202, 255, 51, 0.1);
|
|
36
|
+
color: #caff33;
|
|
37
|
+
padding: 0px 10px 2px;
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
font-weight: 400;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
9
46
|
const AstraSelect = styled(Select)`
|
|
10
|
-
width: 60px !important;
|
|
47
|
+
// width: 60px !important;
|
|
11
48
|
.astra-select-selector {
|
|
12
49
|
padding: 0 0px !important;
|
|
50
|
+
.label-box {
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
.label-flex {
|
|
54
|
+
display: flex;
|
|
55
|
+
gap: 3px;
|
|
56
|
+
align-items: center;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
@media (max-width: 768px) {
|
|
61
|
+
.astra-select-selector {
|
|
62
|
+
padding: 0 0px !important;
|
|
63
|
+
.label-box {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
.label-flex {
|
|
67
|
+
font-size: 13px;
|
|
68
|
+
display: flex;
|
|
69
|
+
gap: 3px;
|
|
70
|
+
align-items: center;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
13
74
|
}
|
|
14
75
|
.astra-select-selection-item {
|
|
15
76
|
display: flex !important;
|
|
@@ -18,6 +79,14 @@ const AstraSelect = styled(Select)`
|
|
|
18
79
|
}
|
|
19
80
|
.astra-select-arrow {
|
|
20
81
|
color: #fff;
|
|
82
|
+
right: 3px;
|
|
83
|
+
}
|
|
84
|
+
@media (max-width: 768px) {
|
|
85
|
+
.astra-select-arrow {
|
|
86
|
+
color: #fff;
|
|
87
|
+
right: 5px;
|
|
88
|
+
font-size: 12px;
|
|
89
|
+
}
|
|
21
90
|
}
|
|
22
91
|
`;
|
|
23
92
|
const AstraAccount = styled.div`
|
|
@@ -39,7 +108,7 @@ const StyledDisconnectOutlined = styled(DisconnectOutlined)`
|
|
|
39
108
|
color: rgba(202, 255, 51, 1);
|
|
40
109
|
cursor: pointer;
|
|
41
110
|
&:hover {
|
|
42
|
-
color:red;
|
|
111
|
+
color: red;
|
|
43
112
|
}
|
|
44
113
|
`;
|
|
45
114
|
const FormItemPair = styled(Form.Item)`
|
|
@@ -86,47 +155,107 @@ export default function AstraNetwork({ messageApi, balance }) {
|
|
|
86
155
|
|
|
87
156
|
const memoBalance = useMemo(() => {
|
|
88
157
|
if (!balance?.formatted) return 0;
|
|
89
|
-
return new Decimal(balance?.formatted).toFixed(
|
|
158
|
+
return numberWithCommas(new Decimal(balance?.formatted).toFixed(5, Decimal.ROUND_DOWN));
|
|
90
159
|
}, [balance?.formatted]);
|
|
160
|
+
const newworkOptions = useMemo(() => {
|
|
161
|
+
const openChains = chains.map((chain) => ({
|
|
162
|
+
label: (
|
|
163
|
+
<div className="label-box">
|
|
164
|
+
<div className="label-flex">
|
|
165
|
+
<AstraImg name={chain.name} width="22px" />
|
|
166
|
+
<div className="label-name">{chain.name}</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
),
|
|
170
|
+
value: chain.id,
|
|
171
|
+
}));
|
|
172
|
+
const soon = [
|
|
173
|
+
{
|
|
174
|
+
label: (
|
|
175
|
+
<div className="label-box">
|
|
176
|
+
<div className="label-flex">
|
|
177
|
+
<AstraImg name="Arbitrum" width="22px" />
|
|
178
|
+
<div className="label-name">Arbitrum</div>
|
|
179
|
+
</div>
|
|
180
|
+
<div className="label-soon">soon</div>
|
|
181
|
+
</div>
|
|
182
|
+
),
|
|
183
|
+
value: "Arbitrum",
|
|
184
|
+
disabled: true,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
label: (
|
|
188
|
+
<div className="label-box">
|
|
189
|
+
<div className="label-flex">
|
|
190
|
+
<AstraImg name="Solana" width="22px" />
|
|
191
|
+
<div className="label-name">Solana</div>
|
|
192
|
+
</div>
|
|
193
|
+
<div className="label-soon">soon</div>
|
|
194
|
+
</div>
|
|
195
|
+
),
|
|
196
|
+
value: "Solana",
|
|
197
|
+
disabled: true,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: (
|
|
201
|
+
<div className="label-box">
|
|
202
|
+
<div className="label-flex">
|
|
203
|
+
<AstraImg name="Polygon" width="22px" />
|
|
204
|
+
<div className="label-name">Polygon</div>
|
|
205
|
+
</div>
|
|
206
|
+
<div className="label-soon">soon</div>
|
|
207
|
+
</div>
|
|
208
|
+
),
|
|
209
|
+
value: "Polygon",
|
|
210
|
+
disabled: true,
|
|
211
|
+
},
|
|
212
|
+
];
|
|
213
|
+
return openChains.concat(soon);
|
|
214
|
+
}, [chains]);
|
|
91
215
|
return (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
216
|
+
<>
|
|
217
|
+
<GlobalStyle />
|
|
218
|
+
<FormItemPair
|
|
219
|
+
label={
|
|
220
|
+
<AstraSelect
|
|
221
|
+
variant="borderless"
|
|
222
|
+
value={chainId}
|
|
223
|
+
dropdownStyle={{
|
|
224
|
+
width: "200px",
|
|
225
|
+
}}
|
|
226
|
+
popupClassName="popup-astra-select-content"
|
|
227
|
+
options={newworkOptions}
|
|
228
|
+
onChange={onNetWorkChange}
|
|
229
|
+
/>
|
|
230
|
+
}
|
|
231
|
+
>
|
|
232
|
+
<Spin spinning={loading}>
|
|
233
|
+
<Flex justify="end">
|
|
234
|
+
<AstraAccount>
|
|
235
|
+
{account?.address ? (
|
|
236
|
+
<>
|
|
237
|
+
<Space>
|
|
238
|
+
<EllipsisMiddle suffixCount={6}>
|
|
239
|
+
{account?.address}
|
|
240
|
+
</EllipsisMiddle>
|
|
241
|
+
<StyledDisconnectOutlined onClick={() => disconnect()} />
|
|
242
|
+
</Space>
|
|
243
|
+
</>
|
|
244
|
+
) : (
|
|
245
|
+
"Connect Wallet"
|
|
246
|
+
)}
|
|
247
|
+
</AstraAccount>
|
|
248
|
+
</Flex>
|
|
249
|
+
<BalanceFlex justify="end">
|
|
250
|
+
<span className="available_token_balance">
|
|
251
|
+
Available:{" "}
|
|
252
|
+
<AvalibleBalance>
|
|
253
|
+
{memoBalance} {balance?.symbol}
|
|
254
|
+
</AvalibleBalance>
|
|
255
|
+
</span>
|
|
256
|
+
</BalanceFlex>
|
|
257
|
+
</Spin>
|
|
258
|
+
</FormItemPair>
|
|
259
|
+
</>
|
|
131
260
|
);
|
|
132
261
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// import React, { useCallback } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useAppKitAccount } from "@reown/appkit/react";
|
|
4
4
|
|
|
5
5
|
export default function CheckErc20ButtonWrap({ children }) {
|
|
6
6
|
// const { open } = useAppKit();
|
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button } from "antd";
|
|
2
|
+
import { useConnect } from "wagmi";
|
|
3
|
+
import { injected } from '@wagmi/connectors'
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
const AstraButton = styled(Button)`
|
|
6
|
+
width: 100%;
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
padding: 0 30px;
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
line-height: 42px;
|
|
12
|
+
background-color: #33ba91;
|
|
13
|
+
`;
|
|
2
14
|
export default function ConnectButton() {
|
|
3
|
-
|
|
4
|
-
|
|
15
|
+
|
|
16
|
+
const { connect } = useConnect();
|
|
5
17
|
|
|
6
|
-
|
|
7
|
-
const interval = setInterval(() => {
|
|
8
|
-
if (appkitConnectButton.shadowRoot) {
|
|
9
|
-
const wuiConnectButton =
|
|
10
|
-
appkitConnectButton.shadowRoot.querySelector("wui-connect-button");
|
|
11
|
-
if (wuiConnectButton) {
|
|
12
|
-
const shadowRoot = wuiConnectButton.shadowRoot;
|
|
13
|
-
if (shadowRoot) {
|
|
14
|
-
const button = shadowRoot.querySelector("button");
|
|
15
|
-
if (button) {
|
|
16
|
-
button.style.backgroundColor = "#33ba91";
|
|
17
|
-
button.style.width = "100%";
|
|
18
|
-
button.style.color = "#1A1A1A";
|
|
19
|
-
button.style.padding = "12px 30px";
|
|
20
|
-
button.style.borderRadius = "12px";
|
|
21
|
-
button.style.fontSize = "16px";
|
|
22
|
-
button.style.border = "none";
|
|
23
|
-
button.style.fontFamily = "ClashDisplay";
|
|
24
|
-
}
|
|
25
|
-
clearInterval(interval);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}, 100);
|
|
30
|
-
|
|
31
|
-
setTimeout(() => clearInterval(interval), 5000);
|
|
32
|
-
}
|
|
33
|
-
}, []);
|
|
34
|
-
|
|
35
|
-
return <appkit-connect-button class="custom-connect-button" />;
|
|
18
|
+
return <AstraButton type="primary" onClick={() => connect({ connector: injected() })}>Connect Wallet</AstraButton>;
|
|
36
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Modal, Flex } from "antd";
|
|
2
|
-
import { useCallback,
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import { MODAL_DISPLAY_TYPE } from "../constants/index.js";
|
|
5
5
|
import useStore from "../store/index.js";
|
|
@@ -9,7 +9,6 @@ import AstraImg from "./AstraImage.jsx";
|
|
|
9
9
|
import IconBridgeLoading from "../assets/bridge-loading.png";
|
|
10
10
|
import IconSuccess from "../assets/success.svg";
|
|
11
11
|
import AstraModalLogo from "./AstraModalLogo.jsx";
|
|
12
|
-
import { toLightning } from "../apis/lspApi";
|
|
13
12
|
const ModalWrapper = styled.div``;
|
|
14
13
|
const BridgeDetail = styled.div`
|
|
15
14
|
padding: 10px 20px;
|
|
@@ -108,47 +107,46 @@ const StyledModal = styled(Modal)`
|
|
|
108
107
|
}
|
|
109
108
|
`;
|
|
110
109
|
export default function ResultModal({
|
|
111
|
-
messageApi,
|
|
112
110
|
resultModalShow = false,
|
|
113
111
|
requestData,
|
|
114
112
|
setResultModalShow,
|
|
115
113
|
setResultModalRequest,
|
|
116
114
|
}) {
|
|
117
|
-
const { modalDisplayType, targetNetwork } = useStore();
|
|
118
|
-
const [submitLoading
|
|
115
|
+
const { modalDisplayType, targetNetwork, currentAssetPair } = useStore();
|
|
116
|
+
const [submitLoading] = useState(false);
|
|
119
117
|
const onCancel = useCallback(() => {
|
|
120
118
|
setResultModalShow(false);
|
|
121
119
|
setResultModalRequest(null);
|
|
122
120
|
}, [setResultModalRequest, setResultModalShow]);
|
|
123
|
-
const handleRequest = useCallback(async () => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}, [messageApi, modalDisplayType, requestData?.request]);
|
|
121
|
+
// const handleRequest = useCallback(async () => {
|
|
122
|
+
// try {
|
|
123
|
+
// setSubmitLoading(true);
|
|
124
|
+
// if (modalDisplayType === MODAL_DISPLAY_TYPE.TO_LIGHTNING) {
|
|
125
|
+
// const retToLightning = await toLightning(requestData?.request);
|
|
126
|
+
// if (retToLightning?.code == 200) {
|
|
127
|
+
// messageApi.open({
|
|
128
|
+
// type: "success",
|
|
129
|
+
// content: "Deposit success",
|
|
130
|
+
// });
|
|
131
|
+
// }
|
|
132
|
+
// } else {
|
|
133
|
+
// // handle ethereum request
|
|
134
|
+
// }
|
|
135
|
+
// } catch (e) {
|
|
136
|
+
// messageApi.open({
|
|
137
|
+
// type: "error",
|
|
138
|
+
// content: e.message,
|
|
139
|
+
// });
|
|
140
|
+
// } finally {
|
|
141
|
+
// setSubmitLoading(false);
|
|
142
|
+
// }
|
|
143
|
+
// }, [messageApi, modalDisplayType, requestData?.request]);
|
|
146
144
|
|
|
147
|
-
useEffect(() => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}, [handleRequest, requestData, resultModalShow]);
|
|
145
|
+
// useEffect(() => {
|
|
146
|
+
// if (resultModalShow && requestData) {
|
|
147
|
+
// handleRequest();
|
|
148
|
+
// }
|
|
149
|
+
// }, [handleRequest, requestData, resultModalShow]);
|
|
152
150
|
|
|
153
151
|
return (
|
|
154
152
|
<>
|
|
@@ -158,8 +156,8 @@ export default function ResultModal({
|
|
|
158
156
|
<Flex align="center">
|
|
159
157
|
<span className="modal-title">
|
|
160
158
|
{modalDisplayType === MODAL_DISPLAY_TYPE.TO_LIGHTNING
|
|
161
|
-
?
|
|
162
|
-
:
|
|
159
|
+
? `${targetNetwork?.name} to Lightning`
|
|
160
|
+
: `Lightning to ${targetNetwork?.name}`}
|
|
163
161
|
</span>
|
|
164
162
|
</Flex>
|
|
165
163
|
</ModalTitle>
|
|
@@ -189,7 +187,10 @@ export default function ResultModal({
|
|
|
189
187
|
<BridgeDetailItem justify="space-between" align="center">
|
|
190
188
|
<div>Value</div>
|
|
191
189
|
<div className="lightning">
|
|
192
|
-
{numberWithCommas(requestData?.formatTokenAmt)}
|
|
190
|
+
{numberWithCommas(requestData?.formatTokenAmt)}
|
|
191
|
+
<span style={{ paddingLeft: "5px" }}>
|
|
192
|
+
{currentAssetPair?.asset?.name}
|
|
193
|
+
</span>
|
|
193
194
|
</div>
|
|
194
195
|
</BridgeDetailItem>
|
|
195
196
|
</BridgeDetail>
|
|
@@ -206,7 +207,7 @@ export default function ResultModal({
|
|
|
206
207
|
target="_blank"
|
|
207
208
|
rel="noreferrer"
|
|
208
209
|
>
|
|
209
|
-
View on
|
|
210
|
+
View on explorer
|
|
210
211
|
</a>
|
|
211
212
|
</Flex>
|
|
212
213
|
<Flex
|
|
@@ -251,7 +252,12 @@ export default function ResultModal({
|
|
|
251
252
|
</BridgeDetailItem>
|
|
252
253
|
<BridgeDetailItem justify="space-between" align="center">
|
|
253
254
|
<div>Value</div>
|
|
254
|
-
<div className="lightning">
|
|
255
|
+
<div className="lightning">
|
|
256
|
+
{numberWithCommas(10000)}
|
|
257
|
+
<span style={{ paddingLeft: "5px" }}>
|
|
258
|
+
{currentAssetPair?.asset?.name}
|
|
259
|
+
</span>
|
|
260
|
+
</div>
|
|
255
261
|
</BridgeDetailItem>
|
|
256
262
|
</BridgeDetail>
|
|
257
263
|
<BridgeDetailShow align="center" justify="center">
|
|
@@ -292,7 +298,7 @@ export default function ResultModal({
|
|
|
292
298
|
target="_blank"
|
|
293
299
|
rel="noreferrer"
|
|
294
300
|
>
|
|
295
|
-
View on
|
|
301
|
+
View on explorer
|
|
296
302
|
</a>
|
|
297
303
|
</Flex>
|
|
298
304
|
</BridgeDetailShow>
|