astra-modal-test 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/astra-sdk.es.js +8 -0
- package/dist/astra-sdk.umd.js +12576 -0
- package/dist/ccip-Bpb4GlU6.mjs +146 -0
- package/dist/hooks.module-BBZfodGH.mjs +506 -0
- package/dist/index-BTsa09iy.mjs +84805 -0
- package/dist/index-CEtKkuP2.mjs +133 -0
- package/dist/index-CbWGAz3l.mjs +445 -0
- package/dist/index-DRPxIWUd.mjs +13720 -0
- package/dist/index-h9_6XS0r.mjs +2929 -0
- package/dist/secp256k1-3OC5y4qp.mjs +1578 -0
- package/dist/vite.svg +1 -0
- package/dist/w3m-modal-R9m1z1SQ.mjs +267 -0
- package/eslint.config.js +39 -0
- package/index.html +13 -0
- package/package.json +50 -0
- package/public/vite.svg +1 -0
- package/src/App.css +170 -0
- package/src/apis/lspApi.js +59 -0
- package/src/apis/request.js +59 -0
- package/src/assets/arrow-right.svg +3 -0
- package/src/assets/astr.svg +13 -0
- package/src/assets/bridge-loading.png +0 -0
- package/src/assets/network/base.png +0 -0
- package/src/assets/network/eth.png +0 -0
- package/src/assets/network/lighting.png +0 -0
- package/src/assets/network/ligtning.svg +22 -0
- package/src/assets/network/solona.png +0 -0
- package/src/assets/powerby.svg +14 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/success.svg +3 -0
- package/src/assets/tip.svg +5 -0
- package/src/assets/tokens/sol.png +0 -0
- package/src/assets/tokens/usdc.png +0 -0
- package/src/assets/tokens/usdt.png +0 -0
- package/src/comps/AstraImage.jsx +23 -0
- package/src/comps/AstraModal.jsx +207 -0
- package/src/comps/AstraModalLogo.jsx +53 -0
- package/src/comps/AstraNetwork.jsx +115 -0
- package/src/comps/CheckErc20Button.jsx +28 -0
- package/src/comps/ConnectButton.jsx +37 -0
- package/src/comps/EllipsisMiddle.jsx +42 -0
- package/src/comps/ResultModal.jsx +307 -0
- package/src/comps/ToLightning.jsx +502 -0
- package/src/comps/ToToken.jsx +467 -0
- package/src/constants/contracts/abi/bridge.js +1246 -0
- package/src/constants/contracts/abi/index.js +3 -0
- package/src/constants/contracts/abi/usdt.js +130 -0
- package/src/constants/contracts/abi/watcher.js +523 -0
- package/src/constants/contracts/index.js +37 -0
- package/src/constants/index.js +5 -0
- package/src/font/ClashDisplay-Variable.ttf +0 -0
- package/src/font/ClashDisplay-Variable.woff +0 -0
- package/src/font/ClashDisplay-Variable.woff2 +0 -0
- package/src/hooks/useContract.js +127 -0
- package/src/hooks/useLspApi.js +53 -0
- package/src/hooks/useParseInvoice.js +85 -0
- package/src/index.css +69 -0
- package/src/index.jsx +112 -0
- package/src/lib/bolt11.min.js +1 -0
- package/src/main.jsx +41 -0
- package/src/store/index.js +25 -0
- package/src/theme.js +108 -0
- package/src/utils/index.js +36 -0
- package/vite.config.js +44 -0
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
useChainId,
|
|
4
|
+
useReadContract,
|
|
5
|
+
useWriteContract,
|
|
6
|
+
useConfig,
|
|
7
|
+
} from "wagmi";
|
|
8
|
+
import { waitForTransactionReceipt, readContract } from "@wagmi/core";
|
|
9
|
+
import { useMemo, useCallback } from "react";
|
|
10
|
+
import contractConfig from "../constants/contracts";
|
|
11
|
+
import useStore from "../store";
|
|
12
|
+
import { formatAssetByDecimal } from "../utils";
|
|
13
|
+
export function useBridgeContract(account) {
|
|
14
|
+
|
|
15
|
+
const chainId = useChainId();
|
|
16
|
+
const config = contractConfig[chainId];
|
|
17
|
+
|
|
18
|
+
const { currentAssetPair } = useStore();
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const bridgeContractConfig = useMemo(() => {
|
|
22
|
+
return {
|
|
23
|
+
address: config?.Bridge?.address,
|
|
24
|
+
abi: config?.Bridge?.abi,
|
|
25
|
+
enabled: !!config && !!account?.address
|
|
26
|
+
};
|
|
27
|
+
}, [account?.address, config]);
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const tokenContractConfig = useMemo(() => {
|
|
31
|
+
return {
|
|
32
|
+
address: currentAssetPair?.token?.address,
|
|
33
|
+
abi: config?.USDT?.abi,
|
|
34
|
+
enabled: !!currentAssetPair
|
|
35
|
+
}
|
|
36
|
+
}, [config?.USDT?.abi, currentAssetPair])
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const { data: allowanceRet, isLoading: allowanceLoading, refetch: onReloadAllowance } = useReadContract({
|
|
41
|
+
...tokenContractConfig,
|
|
42
|
+
functionName: "allowance",
|
|
43
|
+
args: [account?.address, config?.Bridge?.address],
|
|
44
|
+
enabled: !!account?.address
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const formatAllowance = useMemo(() => {
|
|
48
|
+
if (!allowanceRet) return 0;
|
|
49
|
+
return formatAssetByDecimal(allowanceRet?.toString(), currentAssetPair?.token?.decimal);
|
|
50
|
+
}, [allowanceRet, currentAssetPair?.token?.decimal])
|
|
51
|
+
|
|
52
|
+
const wagmiConfig = useConfig();
|
|
53
|
+
const { writeContractAsync } = useWriteContract();
|
|
54
|
+
|
|
55
|
+
const onApprove = useCallback(
|
|
56
|
+
async (approveAmount, wait = true) => {
|
|
57
|
+
//console.log("🚀 ~ onApprove ~ approveAmount:", approveAmount, config?.address)
|
|
58
|
+
const tx = await writeContractAsync({
|
|
59
|
+
...tokenContractConfig,
|
|
60
|
+
functionName: "approve",
|
|
61
|
+
args: [config?.Bridge?.address, BigInt(approveAmount)],
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (wait) {
|
|
65
|
+
await waitForTransactionReceipt(
|
|
66
|
+
wagmiConfig,
|
|
67
|
+
{
|
|
68
|
+
hash: tx
|
|
69
|
+
},
|
|
70
|
+
1
|
|
71
|
+
);
|
|
72
|
+
if (onReloadAllowance) {
|
|
73
|
+
await onReloadAllowance();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return tx;
|
|
77
|
+
},
|
|
78
|
+
[config?.Bridge?.address, onReloadAllowance, tokenContractConfig, wagmiConfig, writeContractAsync]
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
const onDeposit = useCallback(
|
|
84
|
+
async ({ hashlock, fromAddr, toAddr, tokenAddr, amount, timeLock, fee, toLightning = true, signature = '0x' }, wait = true, reloadAllowance = true) => {
|
|
85
|
+
|
|
86
|
+
const contractInfo = await readContract(wagmiConfig, {
|
|
87
|
+
...bridgeContractConfig,
|
|
88
|
+
functionName: "getContractByKey",
|
|
89
|
+
args: [hashlock],
|
|
90
|
+
});
|
|
91
|
+
if (contractInfo?.hashlock === hashlock) {
|
|
92
|
+
throw new Error('Invoice already exists.');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const tx = await writeContractAsync({
|
|
96
|
+
...bridgeContractConfig,
|
|
97
|
+
functionName: "deposit",
|
|
98
|
+
args: [hashlock, fromAddr, toAddr, tokenAddr, BigInt(amount), timeLock, fee, toLightning, signature],
|
|
99
|
+
value: fee
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (wait) {
|
|
103
|
+
await waitForTransactionReceipt(
|
|
104
|
+
wagmiConfig,
|
|
105
|
+
{
|
|
106
|
+
hash: tx
|
|
107
|
+
},
|
|
108
|
+
1
|
|
109
|
+
);
|
|
110
|
+
if (onReloadAllowance && reloadAllowance) {
|
|
111
|
+
await onReloadAllowance();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return tx;
|
|
115
|
+
},
|
|
116
|
+
[bridgeContractConfig, onReloadAllowance, wagmiConfig, writeContractAsync]
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
return {
|
|
120
|
+
allowanceRet,
|
|
121
|
+
formatAllowance,
|
|
122
|
+
allowanceLoading,
|
|
123
|
+
onReloadAllowance,
|
|
124
|
+
onApprove,
|
|
125
|
+
onDeposit
|
|
126
|
+
};
|
|
127
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useRequest } from "ahooks";
|
|
2
|
+
import { useEffect, useMemo } from "react";
|
|
3
|
+
import { getPairs, getReserveInfo } from "../apis/lspApi";
|
|
4
|
+
import useStore from "../store";
|
|
5
|
+
export const useGetPairs = () => {
|
|
6
|
+
const { setCurrentAssetPair, setAllAssetPairs, targetNetwork, astraApiUrl } = useStore();
|
|
7
|
+
const { data, run, loading, refresh, cancel } = useRequest(() => getPairs({ chainId: targetNetwork?.id }), {
|
|
8
|
+
refreshDeps: [targetNetwork?.id, astraApiUrl],
|
|
9
|
+
ready: !!targetNetwork?.id && !!astraApiUrl
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (data?.data?.pairs) {
|
|
14
|
+
setAllAssetPairs(data?.data?.pairs);
|
|
15
|
+
//setCurrentAssetPair(data?.data?.pairs[0]);
|
|
16
|
+
}
|
|
17
|
+
}, [data?.data?.pairs, setAllAssetPairs, setCurrentAssetPair])
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
summary: data?.data || null,
|
|
21
|
+
loading,
|
|
22
|
+
run,
|
|
23
|
+
refresh,
|
|
24
|
+
cancel
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const useGetReserveInfo = (targetNetwork, currentAssetPair) => {
|
|
29
|
+
|
|
30
|
+
const assetId = useMemo(() => {
|
|
31
|
+
return currentAssetPair?.asset?.assetId
|
|
32
|
+
}, [currentAssetPair?.asset?.assetId])
|
|
33
|
+
const chainId = useMemo(() => {
|
|
34
|
+
return targetNetwork?.id
|
|
35
|
+
}, [targetNetwork?.id])
|
|
36
|
+
|
|
37
|
+
const pairName = useMemo(() => {
|
|
38
|
+
return currentAssetPair?.pairName
|
|
39
|
+
}, [currentAssetPair])
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const { data, loading, refresh } = useRequest(() => getReserveInfo({ chainId: chainId, assetId: assetId, pairName: pairName }), {
|
|
43
|
+
refreshDeps: [assetId, chainId, pairName],
|
|
44
|
+
ready: !!chainId && !!assetId && !!pairName,
|
|
45
|
+
debounceWait: 300,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
reserveInfo: data?.data,
|
|
50
|
+
loading,
|
|
51
|
+
refresh
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from "react";
|
|
2
|
+
import "../lib/bolt11.min.js"
|
|
3
|
+
import useStore from "../store";
|
|
4
|
+
import { msatsToTprAsset } from "../utils";
|
|
5
|
+
// import { useEffect } from "react";
|
|
6
|
+
import Decimal from "decimal.js";
|
|
7
|
+
import { useDebounceEffect } from "ahooks";
|
|
8
|
+
// window.decode = decode;
|
|
9
|
+
function getPaymentHash(requestObject) {
|
|
10
|
+
// go through the tags and find the 'payment_hash' tagName and return the 'data'
|
|
11
|
+
const paymentHash = requestObject.tags.find(tag => tag.tagName === "payment_hash");
|
|
12
|
+
if (!paymentHash) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return "0x" + paymentHash.data.toString();
|
|
16
|
+
}
|
|
17
|
+
export default function useParseInvoice(invoice) {
|
|
18
|
+
const [assetAmt, setAssetAmt] = useState(0);
|
|
19
|
+
const [hashlock, setHashlock] = useState("");
|
|
20
|
+
const { currentAssetPair } = useStore();
|
|
21
|
+
const [parseInvoiceLoading, setParseInvoiceLoading] = useState(false);
|
|
22
|
+
const formatAssetAmt = useMemo(() => {
|
|
23
|
+
if (assetAmt && currentAssetPair) {
|
|
24
|
+
const decimal = currentAssetPair.asset.decimal;
|
|
25
|
+
return new Decimal(assetAmt).div(10 ** decimal).toFixed(decimal);
|
|
26
|
+
}
|
|
27
|
+
return 0;
|
|
28
|
+
}, [assetAmt, currentAssetPair])
|
|
29
|
+
|
|
30
|
+
const tokenAmt = useMemo(() => {
|
|
31
|
+
if (currentAssetPair) {
|
|
32
|
+
const decimal = currentAssetPair.token.decimal;
|
|
33
|
+
return new Decimal(formatAssetAmt).mul(10 ** decimal).toFixed(0);
|
|
34
|
+
}
|
|
35
|
+
return 0;
|
|
36
|
+
}, [currentAssetPair, formatAssetAmt])
|
|
37
|
+
|
|
38
|
+
const formatTokenAmt = useMemo(() => {
|
|
39
|
+
if (currentAssetPair) {
|
|
40
|
+
const decimal = currentAssetPair.token.decimal;
|
|
41
|
+
return new Decimal(tokenAmt).div(10 ** decimal).toFixed(decimal);
|
|
42
|
+
}
|
|
43
|
+
return 0;
|
|
44
|
+
|
|
45
|
+
}, [currentAssetPair, tokenAmt])
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const parseInvoice = useCallback(async () => {
|
|
49
|
+
try {
|
|
50
|
+
setParseInvoiceLoading(true)
|
|
51
|
+
const decoded = window.lightningPayReq.decode(invoice);
|
|
52
|
+
const numMsat = decoded.millisatoshis;
|
|
53
|
+
const amt = await msatsToTprAsset(numMsat, currentAssetPair.asset.assetId);
|
|
54
|
+
setAssetAmt(amt);
|
|
55
|
+
const hashlock = getPaymentHash(decoded);
|
|
56
|
+
setHashlock(hashlock);
|
|
57
|
+
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.log(e.message)
|
|
60
|
+
setAssetAmt(0);
|
|
61
|
+
} finally {
|
|
62
|
+
setParseInvoiceLoading(false)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
}, [currentAssetPair, invoice])
|
|
67
|
+
useDebounceEffect(() => {
|
|
68
|
+
if (invoice && currentAssetPair) {
|
|
69
|
+
parseInvoice();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}, [currentAssetPair, invoice, parseInvoice], {
|
|
73
|
+
wait: 500
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
assetAmt,
|
|
79
|
+
formatAssetAmt,
|
|
80
|
+
tokenAmt,
|
|
81
|
+
formatTokenAmt,
|
|
82
|
+
hashlock,
|
|
83
|
+
parseInvoiceLoading
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/index.css
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: rgba(26, 26, 26, 0.5);
|
|
9
|
+
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* a {
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
color: #646cff;
|
|
19
|
+
text-decoration: inherit;
|
|
20
|
+
}
|
|
21
|
+
a:hover {
|
|
22
|
+
color: #535bf2;
|
|
23
|
+
} */
|
|
24
|
+
|
|
25
|
+
body {
|
|
26
|
+
margin: 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
place-items: center;
|
|
29
|
+
min-width: 320px;
|
|
30
|
+
min-height: 100vh;
|
|
31
|
+
background-color: #041011;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
font-size: 3.2em;
|
|
36
|
+
line-height: 1.1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* button {
|
|
40
|
+
border-radius: 8px;
|
|
41
|
+
border: 1px solid transparent;
|
|
42
|
+
padding: 0.6em 1.2em;
|
|
43
|
+
font-size: 1em;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
font-family: inherit;
|
|
46
|
+
background-color: #1a1a1a;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
transition: border-color 0.25s;
|
|
49
|
+
}
|
|
50
|
+
button:hover {
|
|
51
|
+
border-color: #646cff;
|
|
52
|
+
}
|
|
53
|
+
button:focus,
|
|
54
|
+
button:focus-visible {
|
|
55
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
56
|
+
} */
|
|
57
|
+
|
|
58
|
+
@media (prefers-color-scheme: light) {
|
|
59
|
+
:root {
|
|
60
|
+
color: #213547;
|
|
61
|
+
background-color: #ffffff;
|
|
62
|
+
}
|
|
63
|
+
a:hover {
|
|
64
|
+
color: #747bff;
|
|
65
|
+
}
|
|
66
|
+
button {
|
|
67
|
+
background-color: #f9f9f9;
|
|
68
|
+
}
|
|
69
|
+
}
|
package/src/index.jsx
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// import { Button } from "antd";
|
|
2
|
+
import { ConfigProvider, theme } from "antd";
|
|
3
|
+
import { createAppKit } from "@reown/appkit/react";
|
|
4
|
+
import { WagmiProvider } from "wagmi";
|
|
5
|
+
import { sepolia, baseSepolia } from "@reown/appkit/networks";
|
|
6
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
7
|
+
import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
|
|
8
|
+
import AstraDialog from "./comps/AstraModal.jsx";
|
|
9
|
+
import useStore from "./store/index.js";
|
|
10
|
+
import { themeConfig } from "./theme.js";
|
|
11
|
+
import { MODAL_DISPLAY_TYPE } from "./constants/index.js";
|
|
12
|
+
import IconEthNetwork from "./assets/network/eth.png";
|
|
13
|
+
import IconBaseNetwork from "./assets/network/base.png";
|
|
14
|
+
const defaultMetadata = {
|
|
15
|
+
name: "Lnfi",
|
|
16
|
+
description: "Lnfi",
|
|
17
|
+
url: "https://devoflnfi.unift.xyz/", // origin must match your domain & subdomain
|
|
18
|
+
icons: ["https://avatars.githubusercontent.com/u/37784886"],
|
|
19
|
+
};
|
|
20
|
+
// 3. Set the networks
|
|
21
|
+
const networks = [sepolia, baseSepolia];
|
|
22
|
+
let wagmiAdapter = null;
|
|
23
|
+
let appKit = null;
|
|
24
|
+
export default function AstraProvider({
|
|
25
|
+
projectId,
|
|
26
|
+
metadata,
|
|
27
|
+
adapter,
|
|
28
|
+
children,
|
|
29
|
+
}) {
|
|
30
|
+
const queryClient = new QueryClient();
|
|
31
|
+
|
|
32
|
+
if (!wagmiAdapter) {
|
|
33
|
+
wagmiAdapter = adapter
|
|
34
|
+
? adapter
|
|
35
|
+
: new WagmiAdapter({
|
|
36
|
+
networks,
|
|
37
|
+
projectId: projectId,
|
|
38
|
+
ssr: false,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (!appKit) {
|
|
42
|
+
createAppKit({
|
|
43
|
+
adapters: [wagmiAdapter],
|
|
44
|
+
networks,
|
|
45
|
+
chainImages: {
|
|
46
|
+
[sepolia.id]: IconEthNetwork,
|
|
47
|
+
[baseSepolia.id]: IconBaseNetwork,
|
|
48
|
+
},
|
|
49
|
+
debug: false,
|
|
50
|
+
themeMode: "dark",
|
|
51
|
+
projectId: projectId,
|
|
52
|
+
metadata: metadata || defaultMetadata,
|
|
53
|
+
showWallets: true,
|
|
54
|
+
featuredWalletIds: [
|
|
55
|
+
"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",
|
|
56
|
+
"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",
|
|
57
|
+
"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",
|
|
58
|
+
"20459438007b75f4f4acb98bf29aa3b800550309646d375da5fd4aac6c2a2c66",
|
|
59
|
+
"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",
|
|
60
|
+
],
|
|
61
|
+
features: {
|
|
62
|
+
analytics: false,
|
|
63
|
+
swaps: false,
|
|
64
|
+
onramp: false,
|
|
65
|
+
socials: [],
|
|
66
|
+
email: false,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<>
|
|
74
|
+
<ConfigProvider theme={{ algorithm: theme.darkAlgorithm, cssVar: false, ...themeConfig }} prefixCls="astra">
|
|
75
|
+
<WagmiProvider config={wagmiAdapter.wagmiConfig}>
|
|
76
|
+
<QueryClientProvider client={queryClient}>
|
|
77
|
+
<>{children}</>
|
|
78
|
+
</QueryClientProvider>
|
|
79
|
+
</WagmiProvider>
|
|
80
|
+
</ConfigProvider>
|
|
81
|
+
</>
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const AstraModal = AstraDialog;
|
|
87
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
88
|
+
export function astraReceive({ invoice, assetId }) {
|
|
89
|
+
//evm2lightning
|
|
90
|
+
const store = useStore;
|
|
91
|
+
store.setState(() => ({
|
|
92
|
+
astraModalShow: true,
|
|
93
|
+
receiveArgs: { invoice, assetId },
|
|
94
|
+
modalDisplayType: MODAL_DISPLAY_TYPE.TO_LIGHTNING,
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
98
|
+
export function astraSend({
|
|
99
|
+
amount,
|
|
100
|
+
assetId,
|
|
101
|
+
onAstraInvoice,
|
|
102
|
+
waitConfirm = true,
|
|
103
|
+
}) {
|
|
104
|
+
// lightning2evm
|
|
105
|
+
const store = useStore;
|
|
106
|
+
store.setState(() => ({
|
|
107
|
+
astraModalShow: true,
|
|
108
|
+
sendArgs: { amount, assetId, waitConfirm },
|
|
109
|
+
modalDisplayType: MODAL_DISPLAY_TYPE.TO_EVM,
|
|
110
|
+
onAstraInvoice,
|
|
111
|
+
}));
|
|
112
|
+
}
|