herald-exchange-onramp_offramp-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.
Files changed (37) hide show
  1. package/.babelrc +3 -0
  2. package/Readme.md +166 -0
  3. package/dist/index.css +1 -0
  4. package/dist/index.d.ts +24 -0
  5. package/dist/index.js +47 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +47 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +59 -0
  10. package/rollup.config.js +90 -0
  11. package/src/assets/css/style.module.css +1435 -0
  12. package/src/assets/icons-one.png +0 -0
  13. package/src/assets/react.svg +1 -0
  14. package/src/components/ButtonStepper.tsx +144 -0
  15. package/src/components/BuyField.tsx +632 -0
  16. package/src/components/CommonCenterLoader.tsx +119 -0
  17. package/src/components/CustomeSelect.tsx +180 -0
  18. package/src/components/DotLoader.tsx +8 -0
  19. package/src/components/NewBuyField.tsx +687 -0
  20. package/src/components/SellAdminCryptoAccount.tsx +601 -0
  21. package/src/components/SellField.tsx +712 -0
  22. package/src/components/WidgetBankDetails.tsx +612 -0
  23. package/src/components/WidgetComponent.tsx +49 -0
  24. package/src/components/WidgetContent.tsx +71 -0
  25. package/src/components/WidgetSuccesDetails.tsx +113 -0
  26. package/src/components/api.ts +59 -0
  27. package/src/components/chains.ts +319 -0
  28. package/src/components/images.d.ts +5 -0
  29. package/src/components/loader.tsx +14 -0
  30. package/src/components/style.module.css.d.ts +4 -0
  31. package/src/components/toast.tsx +51 -0
  32. package/src/components/types.ts +237 -0
  33. package/src/components/utils.ts +17 -0
  34. package/src/hooks/toastProvider.tsx +64 -0
  35. package/src/hooks/useSocketExchange.tsx +48 -0
  36. package/src/index.ts +3 -0
  37. package/tsconfig.json +118 -0
@@ -0,0 +1,71 @@
1
+ import React, { useState } from "react";
2
+ import SellField from "./SellField";
3
+ // import BuyField from "./BuyField";
4
+ import NewBuyField from "./NewBuyField";
5
+ import type { BuyParamsType, SellParamsType } from "./types";
6
+ import styles from "../assets/css/style.module.css";
7
+
8
+ type WidgetContentProps = {
9
+ defaultTab: string;
10
+ apiKey: string;
11
+ redirectUrl: string;
12
+ buyParameters: BuyParamsType;
13
+ sellParameters: SellParamsType;
14
+ clientReferenceID: string;
15
+ mode: string;
16
+ };
17
+
18
+ const WidgetContent = ({
19
+ defaultTab,
20
+ apiKey,
21
+ redirectUrl,
22
+ buyParameters,
23
+ sellParameters,
24
+ clientReferenceID,
25
+ mode,
26
+ }: WidgetContentProps) => {
27
+ const [activeTab, setActiveTab] = useState(
28
+ ["buy", "sell"].includes(defaultTab) ? defaultTab : "buy"
29
+ );
30
+ return (
31
+ <div className={styles.tabs_wrapped}>
32
+ <div className={styles.tabs_link}>
33
+ <div className={styles.tabs_box}>
34
+ <button
35
+ className={`${activeTab === "buy" && styles.active_btn}`}
36
+ onClick={() => setActiveTab("buy")}
37
+ >
38
+ Buy Crypto
39
+ </button>
40
+ <button
41
+ className={`${activeTab === "sell" && styles.active_btn}`}
42
+ onClick={() => setActiveTab("sell")}
43
+ >
44
+ Sell Crypto
45
+ </button>
46
+ </div>
47
+ </div>
48
+ <div className={styles.tabs_content}>
49
+ {activeTab === "buy" && (
50
+ <NewBuyField
51
+ apiKey={apiKey}
52
+ redirectUrl={redirectUrl}
53
+ parameters={buyParameters}
54
+ clientReferenceID={clientReferenceID}
55
+ mode={mode}
56
+ />
57
+ )}
58
+ {activeTab === "sell" && (
59
+ <SellField
60
+ apiKey={apiKey}
61
+ parameters={sellParameters}
62
+ clientReferenceID={clientReferenceID}
63
+ mode={mode}
64
+ />
65
+ )}
66
+ </div>
67
+ </div>
68
+ );
69
+ };
70
+
71
+ export default WidgetContent;
@@ -0,0 +1,113 @@
1
+ import React from "react";
2
+ import type { tokenSellDataType } from "./SellField";
3
+ import styles from "../assets/css/style.module.css";
4
+
5
+ const WidgetSuccesDetails = ({ tokenSellData }: { tokenSellData: tokenSellDataType }) => {
6
+ return (
7
+ <>
8
+ <div className={styles.details_frame}>
9
+ <div className={styles.f_details_head}>
10
+ <div></div>
11
+ <div className={styles.f_details_titles}>
12
+ Sell{" "}
13
+ {parseFloat(tokenSellData?.response?.offramp_transaction?.from_value || "0")?.toFixed(
14
+ 4
15
+ )}{" "}
16
+ {tokenSellData?.response?.offramp_transaction?.from}{" "}
17
+ {tokenSellData?.response?.offramp_transaction?.network_type
18
+ ? `(${tokenSellData?.response?.offramp_transaction?.network_type})`
19
+ : ""}{" "}
20
+ @{" "}
21
+ {parseFloat(tokenSellData?.response?.offramp_transaction?.to_value || "0")?.toFixed(4)}{" "}
22
+ {tokenSellData?.response?.offramp_transaction?.to}
23
+ </div>
24
+ </div>
25
+ <div className={styles.f_details_info_box}>
26
+ <div className={styles.f_details_card}>
27
+ <span>Order Status</span>
28
+ <span className={styles.span_d_align}>
29
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
30
+ <g id="Flat_Color" fill="#20bf55" data-name="Flat Color">
31
+ <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>
32
+ <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>
33
+ </g>
34
+ </svg>
35
+ {tokenSellData?.response?.offramp_transaction?.status}
36
+ </span>
37
+ </div>
38
+ <div className={styles.f_details_card}>
39
+ <span>Transaction Hash</span>
40
+ <span className={styles.span_d_align}>
41
+ <a
42
+ href={tokenSellData?.response?.offramp_transaction?.explorer_url}
43
+ target="_blank"
44
+ rel="noreferrer"
45
+ >
46
+ {tokenSellData?.response?.offramp_transaction?.transaction_hash?.slice(0, 10)}...
47
+ {tokenSellData?.response?.offramp_transaction?.transaction_hash?.slice(
48
+ tokenSellData?.response?.offramp_transaction?.transaction_hash?.length - 10,
49
+ tokenSellData?.response?.offramp_transaction?.transaction_hash?.length
50
+ )}
51
+ </a>
52
+ <svg
53
+ xmlns="http://www.w3.org/2000/svg"
54
+ viewBox="0 0 24 24"
55
+ stroke-width="1.5"
56
+ stroke="#F9C201"
57
+ className="size-6"
58
+ style={{ cursor: "pointer" }}
59
+ fill="none"
60
+ width="24"
61
+ height="24"
62
+ onClick={async () => {
63
+ window.open(tokenSellData?.response?.offramp_transaction?.explorer_url, "_blank");
64
+ }}
65
+ >
66
+ <path
67
+ stroke-linecap="round"
68
+ stroke-linejoin="round"
69
+ 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"
70
+ />
71
+ </svg>
72
+ </span>
73
+ </div>
74
+ <div className={styles.f_details_card}>
75
+ <span>Order Date</span>
76
+ <span>
77
+ {" "}
78
+ {new Date(tokenSellData?.response?.offramp_transaction?.created_at || "")
79
+ .toUTCString()
80
+ .replace("GMT", "UTC")}
81
+ </span>
82
+ </div>
83
+ <div className={styles.f_details_card}>
84
+ <span>Exchange Rate</span>
85
+ <span>
86
+ 1 {tokenSellData?.response?.offramp_transaction?.from} ={" "}
87
+ {parseFloat(
88
+ tokenSellData?.response?.offramp_transaction?.exchange_rate || ""
89
+ )?.toFixed(4)}{" "}
90
+ {tokenSellData?.response?.offramp_transaction?.to}
91
+ </span>
92
+ </div>
93
+ <div className={styles.f_details_card}>
94
+ <span>Network</span>
95
+ <span>{tokenSellData?.response?.offramp_transaction?.network_type}</span>
96
+ </div>
97
+
98
+ <div className={styles.f_details_card}>
99
+ <span>Bank Details</span>
100
+ <span>
101
+ {tokenSellData?.response?.offramp_transaction?.bank_account_transaction?.bank_account
102
+ ?.bank_account?.account_number ||
103
+ tokenSellData?.response?.offramp_transaction?.bank_account_transaction?.bank_account
104
+ ?.bank_account?.iban}
105
+ </span>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ </>
110
+ );
111
+ };
112
+
113
+ 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,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,5 @@
1
+ // src/images.d.ts or src/custom.d.ts
2
+ declare module "*.png" {
3
+ const value: string;
4
+ export default value;
5
+ }
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import styles from "../assets/css/style.module.css";
3
+ const Loader = () => {
4
+ return <div className={styles.preloading_sec}></div>;
5
+ };
6
+
7
+ export default Loader;
8
+
9
+ /* HTML: <div class="loader"></div> */
10
+ /* HTML: <div class="loader"></div> */
11
+
12
+ export const Spinner = ({ size }: { size?: number }) => {
13
+ return <div className={styles.spinnerLoader} style={{ width: size ? size : 12 }}></div>;
14
+ };
@@ -0,0 +1,4 @@
1
+ declare module "*.module.css" {
2
+ const classes: { [key: string]: string };
3
+ export default classes;
4
+ }
@@ -0,0 +1,51 @@
1
+ import React, { useEffect, useRef } from "react";
2
+ import styles 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
26
+ ref={toastRef}
27
+ className={`${styles.toast_container} ${styles.position_fixed} ${styles.bottom_0} ${styles.end_0} ${styles.p_3}`}
28
+ >
29
+ <div
30
+ id="liveToast"
31
+ className={styles.toast}
32
+ role="alert"
33
+ aria-live="assertive"
34
+ aria-atomic="true"
35
+ >
36
+ <div className={styles.toast_header}>
37
+ <strong className="me-auto">{toastType}</strong>
38
+ <button
39
+ type="button"
40
+ data-bs-dismiss="toast"
41
+ aria-label="Close"
42
+ onClick={onClose}
43
+ ></button>
44
+ </div>
45
+ <div className={styles.toast_body}>{message}</div>
46
+ </div>
47
+ </div>
48
+ );
49
+ };
50
+
51
+ export default Toast;