herald-exchange-glide-widget 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/.babelrc +3 -0
- package/Readme.md +116 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +24 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
- package/rollup.config.js +90 -0
- package/src/assets/css/style.module.css +1352 -0
- package/src/assets/icons-one.png +0 -0
- package/src/assets/swap.svg +8 -0
- package/src/components/ButtonStepper.tsx +143 -0
- package/src/components/CommonCenterLoader.tsx +118 -0
- package/src/components/CustomeSelect.tsx +179 -0
- package/src/components/DotLoader.tsx +8 -0
- package/src/components/SellAdminCryptoAccount.tsx +604 -0
- package/src/components/SellField.tsx +705 -0
- package/src/components/WidgetBankDetails.tsx +592 -0
- package/src/components/WidgetComponent.tsx +42 -0
- package/src/components/WidgetContent.tsx +36 -0
- package/src/components/WidgetSuccesDetails.tsx +122 -0
- package/src/components/api.ts +59 -0
- package/src/components/api.tsx +61 -0
- package/src/components/chains.ts +319 -0
- package/src/components/images.d.ts +5 -0
- package/src/components/loader.tsx +12 -0
- package/src/components/style.module.css.d.ts +4 -0
- package/src/components/toast.tsx +43 -0
- package/src/components/types.ts +237 -0
- package/src/components/utils.ts +17 -0
- package/src/components/utils.tsx +10 -0
- package/src/hooks/toastProvider.tsx +63 -0
- package/src/hooks/useSocketExchange.tsx +48 -0
- package/src/index.ts +3 -0
- package/tsconfig.json +118 -0
@@ -0,0 +1,122 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type { tokenSellDataType } from "./SellField";
|
3
|
+
|
4
|
+
const WidgetSuccesDetails = ({
|
5
|
+
tokenSellData,
|
6
|
+
css,
|
7
|
+
}: {
|
8
|
+
tokenSellData: tokenSellDataType;
|
9
|
+
css: any;
|
10
|
+
}) => {
|
11
|
+
return (
|
12
|
+
<>
|
13
|
+
<div className={css.gilde_details_frame}>
|
14
|
+
<div className={css.gilde_details_head}>
|
15
|
+
<div></div>
|
16
|
+
<div className={css.details_titles}>
|
17
|
+
Sell{" "}
|
18
|
+
{parseFloat(tokenSellData?.response?.offramp_transaction?.from_value || "0")?.toFixed(
|
19
|
+
4
|
20
|
+
)}{" "}
|
21
|
+
{tokenSellData?.response?.offramp_transaction?.from}{" "}
|
22
|
+
{tokenSellData?.response?.offramp_transaction?.network_type
|
23
|
+
? `(${tokenSellData?.response?.offramp_transaction?.network_type})`
|
24
|
+
: ""}{" "}
|
25
|
+
@{" "}
|
26
|
+
{parseFloat(tokenSellData?.response?.offramp_transaction?.to_value || "0")?.toFixed(4)}{" "}
|
27
|
+
{tokenSellData?.response?.offramp_transaction?.to}
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
<div className={css.gilde_details_info_box}>
|
31
|
+
<div className={css.gilde_details_card}>
|
32
|
+
<span>Order Status</span>
|
33
|
+
<span className={css.span_d_align}>
|
34
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
35
|
+
<g id="Flat_Color" fill="#20bf55" data-name="Flat Color">
|
36
|
+
<path d="M12 22.75a10.75 10.75 0 0 1 0-21.5 10.5 10.5 0 0 1 4.82 1.15.75.75 0 0 1-.68 1.34 9 9 0 0 0-4.14-1A9.25 9.25 0 1 0 21.25 12a2 2 0 0 0 0-.25.75.75 0 1 1 1.5-.14V12A10.76 10.76 0 0 1 12 22.75"></path>
|
37
|
+
<path d="M11.82 15.41a.7.7 0 0 1-.52-.22l-4.83-4.74a.75.75 0 0 1 0-1.06.77.77 0 0 1 1.07 0l4.29 4.23 9.65-9.49a.77.77 0 0 1 1.07 0 .75.75 0 0 1 0 1.06l-10.18 10a.74.74 0 0 1-.55.22"></path>
|
38
|
+
</g>
|
39
|
+
</svg>
|
40
|
+
<span>{tokenSellData?.response?.offramp_transaction?.status}</span>
|
41
|
+
</span>
|
42
|
+
</div>
|
43
|
+
<div className={css.gilde_details_card}>
|
44
|
+
<span>Transaction Hash</span>
|
45
|
+
<span className={css.span_d_copy}>
|
46
|
+
<a
|
47
|
+
href={tokenSellData?.response?.offramp_transaction?.explorer_url}
|
48
|
+
target="_blank"
|
49
|
+
rel="noreferrer"
|
50
|
+
>
|
51
|
+
{tokenSellData?.response?.offramp_transaction?.transaction_hash?.slice(0, 10)}...
|
52
|
+
{tokenSellData?.response?.offramp_transaction?.transaction_hash?.slice(
|
53
|
+
tokenSellData?.response?.offramp_transaction?.transaction_hash?.length - 10,
|
54
|
+
tokenSellData?.response?.offramp_transaction?.transaction_hash?.length
|
55
|
+
)}
|
56
|
+
</a>
|
57
|
+
<svg
|
58
|
+
xmlns="http://www.w3.org/2000/svg"
|
59
|
+
viewBox="0 0 24 24"
|
60
|
+
stroke-width="1.5"
|
61
|
+
stroke="#F9C201"
|
62
|
+
className="size-6"
|
63
|
+
style={{ cursor: "pointer" }}
|
64
|
+
fill="none"
|
65
|
+
width="24"
|
66
|
+
height="24"
|
67
|
+
onClick={async () => {
|
68
|
+
window.open(tokenSellData?.response?.offramp_transaction?.explorer_url, "_blank");
|
69
|
+
}}
|
70
|
+
>
|
71
|
+
<path
|
72
|
+
stroke-linecap="round"
|
73
|
+
stroke-linejoin="round"
|
74
|
+
d="M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418"
|
75
|
+
/>
|
76
|
+
</svg>
|
77
|
+
</span>
|
78
|
+
</div>
|
79
|
+
<div className={css.gilde_details_card}>
|
80
|
+
<span>Order Date</span>
|
81
|
+
<span>
|
82
|
+
{" "}
|
83
|
+
{new Date(tokenSellData?.response?.offramp_transaction?.created_at || "")
|
84
|
+
.toUTCString()
|
85
|
+
.replace("GMT", "UTC")}
|
86
|
+
</span>
|
87
|
+
</div>
|
88
|
+
<div className={css.gilde_details_card}>
|
89
|
+
<span>Exchange Rate</span>
|
90
|
+
<span>
|
91
|
+
1 {tokenSellData?.response?.offramp_transaction?.from} ={" "}
|
92
|
+
{parseFloat(
|
93
|
+
tokenSellData?.response?.offramp_transaction?.exchange_rate || ""
|
94
|
+
)?.toFixed(4)}{" "}
|
95
|
+
{tokenSellData?.response?.offramp_transaction?.to}
|
96
|
+
</span>
|
97
|
+
</div>
|
98
|
+
<div className={css.gilde_details_card}>
|
99
|
+
<span>Network</span>
|
100
|
+
<span>{tokenSellData?.response?.offramp_transaction?.network_type}</span>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
<div className={css.gilde_details_card}>
|
104
|
+
<span>Bank Details</span>
|
105
|
+
<span>
|
106
|
+
{tokenSellData?.response?.offramp_transaction?.bank_account_transaction?.bank_account
|
107
|
+
?.bank_account?.account_number ||
|
108
|
+
tokenSellData?.response?.offramp_transaction?.bank_account_transaction?.bank_account
|
109
|
+
?.bank_account?.iban}
|
110
|
+
</span>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
</div>{" "}
|
114
|
+
{
|
115
|
+
tokenSellData?.response?.offramp_transaction?.bank_account_transaction?.bank_account
|
116
|
+
?.bank_account?.account_number
|
117
|
+
}
|
118
|
+
</>
|
119
|
+
);
|
120
|
+
};
|
121
|
+
|
122
|
+
export default WidgetSuccesDetails;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
type ApiCallProps = {
|
2
|
+
url: string;
|
3
|
+
body?: any;
|
4
|
+
headers?: any;
|
5
|
+
method?: string;
|
6
|
+
onError?: any;
|
7
|
+
onSuccess?: any;
|
8
|
+
};
|
9
|
+
|
10
|
+
interface RequestInit {
|
11
|
+
method?: string;
|
12
|
+
headers?: HeadersInit;
|
13
|
+
body?: BodyInit | null;
|
14
|
+
mode?: RequestMode;
|
15
|
+
credentials?: RequestCredentials;
|
16
|
+
cache?: RequestCache;
|
17
|
+
redirect?: RequestRedirect;
|
18
|
+
referrer?: string;
|
19
|
+
referrerPolicy?: ReferrerPolicy;
|
20
|
+
integrity?: string;
|
21
|
+
keepalive?: boolean;
|
22
|
+
signal?: AbortSignal | null;
|
23
|
+
window?: any;
|
24
|
+
}
|
25
|
+
|
26
|
+
export const handleApiCall = async ({
|
27
|
+
url,
|
28
|
+
body,
|
29
|
+
headers,
|
30
|
+
method,
|
31
|
+
onError,
|
32
|
+
onSuccess,
|
33
|
+
}: ApiCallProps) => {
|
34
|
+
try {
|
35
|
+
let apiParam: RequestInit = {
|
36
|
+
method: method || "GET",
|
37
|
+
};
|
38
|
+
|
39
|
+
if (headers) {
|
40
|
+
apiParam = { ...apiParam, headers };
|
41
|
+
}
|
42
|
+
|
43
|
+
if (body) {
|
44
|
+
apiParam = {
|
45
|
+
...apiParam,
|
46
|
+
body,
|
47
|
+
};
|
48
|
+
}
|
49
|
+
|
50
|
+
const response = await fetch(url, apiParam);
|
51
|
+
|
52
|
+
const result = await response?.json();
|
53
|
+
|
54
|
+
return onSuccess(result);
|
55
|
+
} catch (error: any) {
|
56
|
+
console.error(error);
|
57
|
+
return onError(error);
|
58
|
+
}
|
59
|
+
};
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
type ApiCallProps = {
|
4
|
+
url: string;
|
5
|
+
body?: any;
|
6
|
+
headers?: any;
|
7
|
+
method?: string;
|
8
|
+
onError?: any;
|
9
|
+
onSuccess?: any;
|
10
|
+
};
|
11
|
+
|
12
|
+
interface RequestInit {
|
13
|
+
method?: string;
|
14
|
+
headers?: HeadersInit;
|
15
|
+
body?: BodyInit | null;
|
16
|
+
mode?: RequestMode;
|
17
|
+
credentials?: RequestCredentials;
|
18
|
+
cache?: RequestCache;
|
19
|
+
redirect?: RequestRedirect;
|
20
|
+
referrer?: string;
|
21
|
+
referrerPolicy?: ReferrerPolicy;
|
22
|
+
integrity?: string;
|
23
|
+
keepalive?: boolean;
|
24
|
+
signal?: AbortSignal | null;
|
25
|
+
window?: any;
|
26
|
+
}
|
27
|
+
|
28
|
+
export const handleApiCall = async ({
|
29
|
+
url,
|
30
|
+
body,
|
31
|
+
headers,
|
32
|
+
method,
|
33
|
+
onError,
|
34
|
+
onSuccess,
|
35
|
+
}: ApiCallProps) => {
|
36
|
+
try {
|
37
|
+
let apiParam: RequestInit = {
|
38
|
+
method: method || "GET",
|
39
|
+
};
|
40
|
+
|
41
|
+
if (headers) {
|
42
|
+
apiParam = { ...apiParam, headers };
|
43
|
+
}
|
44
|
+
|
45
|
+
if (body) {
|
46
|
+
apiParam = {
|
47
|
+
...apiParam,
|
48
|
+
body,
|
49
|
+
};
|
50
|
+
}
|
51
|
+
|
52
|
+
const response = await fetch(url, apiParam);
|
53
|
+
|
54
|
+
const result = await response?.json();
|
55
|
+
|
56
|
+
return onSuccess(result);
|
57
|
+
} catch (error: any) {
|
58
|
+
console.error(error);
|
59
|
+
return onError(error);
|
60
|
+
}
|
61
|
+
};
|
@@ -0,0 +1,319 @@
|
|
1
|
+
let SupportedTokens: any,
|
2
|
+
SOL_SPL_CONTRACT_ADDRESS: any,
|
3
|
+
SPECIAL_CONTRACT_ADDRESS: any,
|
4
|
+
SUPPORTED_RPC_NODES: any,
|
5
|
+
SupportedChainId: any;
|
6
|
+
|
7
|
+
if (process.env.NODE_ENV != "production") {
|
8
|
+
SupportedChainId = {
|
9
|
+
ETHEREUM: 11155111,
|
10
|
+
MATIC: 84432,
|
11
|
+
BINANCE: 97,
|
12
|
+
BITCOIN: 10001,
|
13
|
+
AVAX: 43113,
|
14
|
+
SOLANA: 102,
|
15
|
+
RIPPLE: 2,
|
16
|
+
POLYGON_AMOY: 84432,
|
17
|
+
NILE: 3,
|
18
|
+
TRX: 1,
|
19
|
+
};
|
20
|
+
|
21
|
+
SupportedTokens = {
|
22
|
+
BNB: 97,
|
23
|
+
BUSD: 97,
|
24
|
+
ETH: 11155111,
|
25
|
+
USDT: 11155111,
|
26
|
+
BITCOIN: 10001,
|
27
|
+
AVAX: 43113,
|
28
|
+
MATIC: 84432,
|
29
|
+
SOL: 102,
|
30
|
+
XRP: 2,
|
31
|
+
POLYGON_AMOY: 84432,
|
32
|
+
NILE: 3,
|
33
|
+
TRX: 1,
|
34
|
+
};
|
35
|
+
|
36
|
+
SUPPORTED_RPC_NODES = {
|
37
|
+
[SupportedChainId.ETHEREUM]: "https://api-sepolia.etherscan.io",
|
38
|
+
[SupportedChainId.MATIC]: "https://api-amoy.polygonscan.com",
|
39
|
+
[SupportedChainId.BINANCE]: "https://api-testnet.bscscan.com",
|
40
|
+
[SupportedChainId.SOLANA]: "https://api.devnet.solana.com",
|
41
|
+
[SupportedChainId.POLYGON_AMOY]: "https://api-amoy.polygonscan.com",
|
42
|
+
[SupportedChainId.NILE]: "https://nile.trongrid.io",
|
43
|
+
[SupportedChainId.TRX]: "https://api.shasta.trongrid.io",
|
44
|
+
};
|
45
|
+
|
46
|
+
SOL_SPL_CONTRACT_ADDRESS = {
|
47
|
+
USDC: "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
48
|
+
USDT: "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
49
|
+
};
|
50
|
+
|
51
|
+
SPECIAL_CONTRACT_ADDRESS = {
|
52
|
+
ETH: {
|
53
|
+
USDC: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
54
|
+
// USDT: "0xA1d7f71cbBb361A77820279958BAC38fC3667c1a",
|
55
|
+
USDT: "0x7169D38820dfd117C3FA1f22a697dBA58d90BA06",
|
56
|
+
LINK: "0xb227f007804c16546Bd054dfED2E7A1fD5437678",
|
57
|
+
MATIC: "0x8D38d6Ffa17FFD6dA49D4b53B6f0DFc8D291E867",
|
58
|
+
},
|
59
|
+
MATIC: {
|
60
|
+
USDC: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
61
|
+
USDT: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
62
|
+
DAI: "0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce",
|
63
|
+
},
|
64
|
+
POLYGON_AMOY: {
|
65
|
+
USDC: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
66
|
+
USDT: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
67
|
+
DAI: "0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce",
|
68
|
+
},
|
69
|
+
BNB: {
|
70
|
+
USDT: "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
|
71
|
+
USDC: "0xfbe87897c07Cc64b6FFc04257672854b90e5B17b",
|
72
|
+
},
|
73
|
+
SHASTA: {
|
74
|
+
USDT: "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
|
75
|
+
USDC: "TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id",
|
76
|
+
},
|
77
|
+
TRX: {
|
78
|
+
USDT: "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
|
79
|
+
USDC: "TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id",
|
80
|
+
},
|
81
|
+
};
|
82
|
+
} else {
|
83
|
+
SupportedChainId = {
|
84
|
+
ETHEREUM: 1,
|
85
|
+
POLYGON: 137,
|
86
|
+
BINANCE: 56,
|
87
|
+
BITCOIN: 10001, // Not sure to use this chain
|
88
|
+
AVAX: 43113,
|
89
|
+
SOLANA: 101,
|
90
|
+
TRX: 1,
|
91
|
+
};
|
92
|
+
|
93
|
+
SupportedTokens = {
|
94
|
+
BNB: 56,
|
95
|
+
ETH: 1,
|
96
|
+
USDT: 1,
|
97
|
+
BITCOIN: 10001, // Not sure to use this chain
|
98
|
+
AVAX: 43113,
|
99
|
+
MATIC: 137,
|
100
|
+
SOL: 101,
|
101
|
+
TRX: 1,
|
102
|
+
};
|
103
|
+
|
104
|
+
SUPPORTED_RPC_NODES = {
|
105
|
+
[SupportedChainId.ETHEREUM]: "https://api.etherscan.io",
|
106
|
+
[SupportedChainId.MATIC]: "https://api.polygonscan.com",
|
107
|
+
[SupportedChainId.BINANCE]: "https://api.bscscan.com",
|
108
|
+
[SupportedChainId.SOLANA]: "https://api.mainnet-beta.solana.com",
|
109
|
+
[SupportedChainId.POLYGON_AMOY]: "https://api.polygonscan.com",
|
110
|
+
[SupportedChainId.TRX]: "https://api.trongrid.io",
|
111
|
+
};
|
112
|
+
}
|
113
|
+
|
114
|
+
export {
|
115
|
+
SupportedChainId,
|
116
|
+
SupportedTokens,
|
117
|
+
SPECIAL_CONTRACT_ADDRESS,
|
118
|
+
SOL_SPL_CONTRACT_ADDRESS,
|
119
|
+
SUPPORTED_RPC_NODES,
|
120
|
+
};
|
121
|
+
|
122
|
+
export function getSupportedTokens({ mode, token }: { mode: string; token: string }) {
|
123
|
+
let SupportedTokens: any, SUPPORTED_RPC_NODES: any, SupportedChainId: any;
|
124
|
+
|
125
|
+
if (mode === "development") {
|
126
|
+
SupportedChainId = {
|
127
|
+
ETHEREUM: 11155111,
|
128
|
+
MATIC: 84432,
|
129
|
+
BINANCE: 97,
|
130
|
+
BITCOIN: 10001,
|
131
|
+
AVAX: 43113,
|
132
|
+
SOLANA: 102,
|
133
|
+
RIPPLE: 2,
|
134
|
+
POLYGON_AMOY: 84432,
|
135
|
+
NILE: 3,
|
136
|
+
TRX: 1,
|
137
|
+
};
|
138
|
+
|
139
|
+
SupportedTokens = {
|
140
|
+
BNB: 97,
|
141
|
+
BUSD: 97,
|
142
|
+
ETH: 11155111,
|
143
|
+
USDT: 11155111,
|
144
|
+
BITCOIN: 10001,
|
145
|
+
AVAX: 43113,
|
146
|
+
MATIC: 84432,
|
147
|
+
SOL: 102,
|
148
|
+
XRP: 2,
|
149
|
+
POLYGON_AMOY: 84432,
|
150
|
+
NILE: 3,
|
151
|
+
TRX: 1,
|
152
|
+
};
|
153
|
+
|
154
|
+
SUPPORTED_RPC_NODES = {
|
155
|
+
[SupportedChainId.ETHEREUM]: "https://api-sepolia.etherscan.io",
|
156
|
+
[SupportedChainId.MATIC]: "https://api-amoy.polygonscan.com",
|
157
|
+
[SupportedChainId.BINANCE]: "https://api-testnet.bscscan.com",
|
158
|
+
[SupportedChainId.SOLANA]: "https://api.devnet.solana.com",
|
159
|
+
[SupportedChainId.POLYGON_AMOY]: "https://api-amoy.polygonscan.com",
|
160
|
+
[SupportedChainId.NILE]: "https://nile.trongrid.io",
|
161
|
+
[SupportedChainId.TRX]: "https://api.shasta.trongrid.io",
|
162
|
+
};
|
163
|
+
|
164
|
+
SOL_SPL_CONTRACT_ADDRESS = {
|
165
|
+
USDC: "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
166
|
+
USDT: "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
167
|
+
};
|
168
|
+
|
169
|
+
SPECIAL_CONTRACT_ADDRESS = {
|
170
|
+
ETH: {
|
171
|
+
USDC: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
172
|
+
// USDT: "0xA1d7f71cbBb361A77820279958BAC38fC3667c1a",
|
173
|
+
USDT: "0x7169D38820dfd117C3FA1f22a697dBA58d90BA06",
|
174
|
+
LINK: "0xb227f007804c16546Bd054dfED2E7A1fD5437678",
|
175
|
+
MATIC: "0x8D38d6Ffa17FFD6dA49D4b53B6f0DFc8D291E867",
|
176
|
+
},
|
177
|
+
MATIC: {
|
178
|
+
USDC: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
179
|
+
USDT: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
180
|
+
DAI: "0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce",
|
181
|
+
},
|
182
|
+
POLYGON_AMOY: {
|
183
|
+
USDC: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
184
|
+
USDT: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
185
|
+
DAI: "0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce",
|
186
|
+
},
|
187
|
+
BNB: {
|
188
|
+
USDT: "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
|
189
|
+
USDC: "0xfbe87897c07Cc64b6FFc04257672854b90e5B17b",
|
190
|
+
},
|
191
|
+
SHASTA: {
|
192
|
+
USDT: "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
|
193
|
+
USDC: "TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id",
|
194
|
+
},
|
195
|
+
TRX: {
|
196
|
+
USDT: "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
|
197
|
+
USDC: "TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id",
|
198
|
+
},
|
199
|
+
};
|
200
|
+
} else {
|
201
|
+
SupportedChainId = {
|
202
|
+
ETHEREUM: 1,
|
203
|
+
POLYGON: 137,
|
204
|
+
BINANCE: 56,
|
205
|
+
BITCOIN: 10001, // Not sure to use this chain
|
206
|
+
AVAX: 43113,
|
207
|
+
SOLANA: 101,
|
208
|
+
TRX: 2,
|
209
|
+
};
|
210
|
+
|
211
|
+
SupportedTokens = {
|
212
|
+
BNB: 56,
|
213
|
+
ETH: 1,
|
214
|
+
BITCOIN: 10001, // Not sure to use this chain
|
215
|
+
AVAX: 43113,
|
216
|
+
MATIC: 137,
|
217
|
+
SOL: 101,
|
218
|
+
TRX: 2,
|
219
|
+
};
|
220
|
+
|
221
|
+
SUPPORTED_RPC_NODES = {
|
222
|
+
[SupportedChainId.ETHEREUM]: "https://api.etherscan.io",
|
223
|
+
[SupportedChainId.MATIC]: "https://api.polygonscan.com",
|
224
|
+
[SupportedChainId.BINANCE]: "https://api.bscscan.com",
|
225
|
+
[SupportedChainId.SOLANA]: "https://api.mainnet-beta.solana.com",
|
226
|
+
[SupportedChainId.POLYGON_AMOY]: "https://api.polygonscan.com",
|
227
|
+
[SupportedChainId.TRX]: "https://api.trongrid.io",
|
228
|
+
};
|
229
|
+
}
|
230
|
+
|
231
|
+
return SUPPORTED_RPC_NODES[SupportedTokens[token]];
|
232
|
+
}
|
233
|
+
|
234
|
+
export function getContactAddress({
|
235
|
+
mode,
|
236
|
+
token,
|
237
|
+
networkType,
|
238
|
+
}: {
|
239
|
+
mode: string;
|
240
|
+
token: string;
|
241
|
+
networkType: string;
|
242
|
+
}) {
|
243
|
+
let SOL_SPL_CONTRACT_ADDRESS: any, SPECIAL_CONTRACT_ADDRESS: any;
|
244
|
+
|
245
|
+
if (mode === "development") {
|
246
|
+
SOL_SPL_CONTRACT_ADDRESS = {
|
247
|
+
USDC: "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
248
|
+
USDT: "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
249
|
+
};
|
250
|
+
|
251
|
+
SPECIAL_CONTRACT_ADDRESS = {
|
252
|
+
ETH: {
|
253
|
+
USDC: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
254
|
+
// USDT: "0xA1d7f71cbBb361A77820279958BAC38fC3667c1a",
|
255
|
+
USDT: "0x7169D38820dfd117C3FA1f22a697dBA58d90BA06",
|
256
|
+
LINK: "0xb227f007804c16546Bd054dfED2E7A1fD5437678",
|
257
|
+
MATIC: "0x8D38d6Ffa17FFD6dA49D4b53B6f0DFc8D291E867",
|
258
|
+
},
|
259
|
+
MATIC: {
|
260
|
+
USDC: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
261
|
+
USDT: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
262
|
+
DAI: "0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce",
|
263
|
+
},
|
264
|
+
POLYGON_AMOY: {
|
265
|
+
USDC: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
266
|
+
USDT: "0x702207d9c124c86c85A97222Cde98476f987ddaE",
|
267
|
+
DAI: "0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce",
|
268
|
+
},
|
269
|
+
BNB: {
|
270
|
+
USDT: "0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",
|
271
|
+
USDC: "0xfbe87897c07Cc64b6FFc04257672854b90e5B17b",
|
272
|
+
},
|
273
|
+
SHASTA: {
|
274
|
+
USDT: "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
|
275
|
+
USDC: "TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id",
|
276
|
+
},
|
277
|
+
TRX: {
|
278
|
+
USDT: "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",
|
279
|
+
USDC: "TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id",
|
280
|
+
},
|
281
|
+
};
|
282
|
+
} else {
|
283
|
+
SOL_SPL_CONTRACT_ADDRESS = {
|
284
|
+
USDC: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
285
|
+
USDT: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
|
286
|
+
};
|
287
|
+
|
288
|
+
SPECIAL_CONTRACT_ADDRESS = {
|
289
|
+
ETH: {
|
290
|
+
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
291
|
+
USDT: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
292
|
+
},
|
293
|
+
MATIC: {
|
294
|
+
USDC: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
295
|
+
USDT: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
|
296
|
+
},
|
297
|
+
POLYGON: {
|
298
|
+
USDC: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
299
|
+
USDT: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
|
300
|
+
},
|
301
|
+
POLYGON_AMOY: {
|
302
|
+
USDC: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
303
|
+
USDT: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
|
304
|
+
},
|
305
|
+
BNB: {
|
306
|
+
USDT: "0x55d398326f99059fF775485246999027B3197955",
|
307
|
+
USDC: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
|
308
|
+
},
|
309
|
+
TRX: {
|
310
|
+
USDT: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
|
311
|
+
USDC: "TLZSucJRjnqBKwvQz6n5hd29gbS4P7u7w8",
|
312
|
+
},
|
313
|
+
};
|
314
|
+
}
|
315
|
+
|
316
|
+
return networkType === "SOL"
|
317
|
+
? SOL_SPL_CONTRACT_ADDRESS[token]
|
318
|
+
: SPECIAL_CONTRACT_ADDRESS[networkType][token] || "";
|
319
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import css from "../assets/css/style.module.css";
|
3
|
+
|
4
|
+
const Loader = () => {
|
5
|
+
return <div className={css.preloading_sec}></div>;
|
6
|
+
};
|
7
|
+
|
8
|
+
export default Loader;
|
9
|
+
|
10
|
+
export const Spinner = ({ size }: { size?: number }) => {
|
11
|
+
return <div className={css.spinnerLoader} style={{ width: size ? size : 12 }}></div>;
|
12
|
+
};
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
2
|
+
import css from "../assets/css/style.module.css";
|
3
|
+
|
4
|
+
type ToastProps = {
|
5
|
+
message: string;
|
6
|
+
toastType?: string;
|
7
|
+
imageSrc?: string;
|
8
|
+
onClose?: () => void;
|
9
|
+
};
|
10
|
+
const Toast = ({ message, toastType = "Info", imageSrc, onClose }: ToastProps) => {
|
11
|
+
const toastRef = useRef(null);
|
12
|
+
|
13
|
+
useEffect(() => {
|
14
|
+
if (toastRef.current) {
|
15
|
+
const timer = setTimeout(() => {
|
16
|
+
onClose?.();
|
17
|
+
}, 3100);
|
18
|
+
|
19
|
+
return () => clearTimeout(timer);
|
20
|
+
}
|
21
|
+
}, [onClose]);
|
22
|
+
|
23
|
+
// / data-bs-config='{"hide": "150"}'
|
24
|
+
return (
|
25
|
+
<div ref={toastRef} className={css.toast_container}>
|
26
|
+
<div id="liveToast" className={css.toast} role="alert" aria-live="assertive" aria-atomic="true">
|
27
|
+
<div className={css.toast_header}>
|
28
|
+
<strong className="me-auto">{toastType}</strong>
|
29
|
+
<button
|
30
|
+
type="button"
|
31
|
+
className="btn-close"
|
32
|
+
data-bs-dismiss="toast"
|
33
|
+
aria-label="Close"
|
34
|
+
onClick={onClose}
|
35
|
+
></button>
|
36
|
+
</div>
|
37
|
+
<div className={css.toast_body}>{message}</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
);
|
41
|
+
};
|
42
|
+
|
43
|
+
export default Toast;
|