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,601 @@
1
+ import React, { useEffect, useState, useRef } from "react";
2
+ import CommonCenterLoader, { ButtonLoader } from "./CommonCenterLoader";
3
+ // import CopyToClipboard from "react-copy-to-clipboard";
4
+ import ButtonStepper from "./ButtonStepper";
5
+ import { QRCodeCanvas } from "qrcode.react";
6
+
7
+ import { handleApiCall } from "./api";
8
+ import { useToast } from "../hooks/toastProvider";
9
+ import type { tokenSellDataType } from "./SellField";
10
+ import type { OfframpTransactionAPIResponse, WalletAddressAPIRespone } from "./types";
11
+ import styles from "../assets/css/style.module.css";
12
+ import { getContactAddress, getSupportedTokens } from "./chains";
13
+ import { getBaseUrl } from "./utils";
14
+
15
+ type WalletAddressKeys = "evm" | "trx" | "sol";
16
+
17
+ type SellAdminCryptoAccountProps = {
18
+ tokenSellData: tokenSellDataType;
19
+ setTokenSellData: (data: any) => void;
20
+ apiKey: string;
21
+ setStep: (step: number) => void;
22
+ clientReferenceID: string;
23
+ mode: string;
24
+ };
25
+
26
+ const SellAdminCryptoAccount = ({
27
+ tokenSellData,
28
+ setTokenSellData,
29
+ apiKey,
30
+ setStep,
31
+ clientReferenceID,
32
+ mode,
33
+ }: SellAdminCryptoAccountProps) => {
34
+ const { addToast } = useToast(); // to show toast
35
+
36
+ // const updateTokenSellData = (data) => setTokenSellData(data);
37
+
38
+ // const [errorMessage, setErrorMessage] = useState(false);
39
+ const [transactionSuccess, setTransactionSuccess] = useState(false);
40
+ const [skipRender, setSkipRender] = useState(true);
41
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
+ const [sellStaticCaseWallet, setSellStaticCaseWallet] = useState(false);
43
+ // const [files, setFiles] = useState([]);
44
+ const [generatedQr, setGeneratedQr] = useState<string>("");
45
+ const [monitoring, setMonitoring] = useState(true);
46
+ // const [tronMonitoring, setTronMonitoring] = useState(false);
47
+ // const [solanaMonitoring, setSolanaMonitoring] = useState(false);
48
+ const [automaticHash, setAutomaticHash] = useState(true);
49
+ const [walletLoading, setWalletLoading] = useState(false);
50
+ const [adminWallet, setAdminWallet] = useState<string | null>(null);
51
+ const [transactionHash, setTransactionHash] = useState<string>("");
52
+ const [selltokensLoading, setSellTokensLoading] = useState(false);
53
+ const [tokenSell, setTokenSell] = useState<any>(null);
54
+
55
+ const intervalRef = useRef<any>(null);
56
+ const inputRef = useRef<any>(null);
57
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
58
+ const [networkType, setNetworkType] = useState(tokenSellData.network_type || "");
59
+
60
+ // const validationSchema = Yup.object().shape({
61
+ // transaction_hash: Yup.string()
62
+ // .required(t("transaction.required"))
63
+ // .min(3, t("transaction.invalid"))
64
+ // });
65
+
66
+ useEffect(() => {
67
+ window.scrollTo(0, 0);
68
+ fetchAdminWallet();
69
+ }, []);
70
+
71
+ const onSubmit = () => {
72
+ sellTokenStart({
73
+ ...tokenSellData,
74
+ transaction_hash: transactionHash,
75
+ });
76
+ };
77
+
78
+ useEffect(() => {
79
+ if (!skipRender && adminWallet) {
80
+ const wallet_address = adminWallet;
81
+
82
+ const token = ["USDT", "USDC"].includes(tokenSellData.selectedCrypto)
83
+ ? tokenSellData.network_type
84
+ : tokenSellData.selectedCrypto;
85
+ console.log({ wallet_address });
86
+ generateQRDetails(wallet_address, token, tokenSellData.selectedCrypto);
87
+ }
88
+ setSkipRender(false);
89
+ }, [adminWallet, tokenSellData]);
90
+
91
+ const generateQRDetails = async (wallet_address: string, token: string, currency: string) => {
92
+ const network = token === "TRX" ? "tron" : token === "SOL" ? "solana" : "ethereum";
93
+ const depositAmountInWei = ["TRX", "SOL"].includes(token)
94
+ ? tokenSellData.from_amount.toString()
95
+ : ["USDC", "USDT"].includes(currency)
96
+ ? tokenSellData.from_amount.toString()
97
+ : tokenSellData.from_amount.toString();
98
+ const depositLabel = "HeraldExchangeSell";
99
+ const uri = `${network}:${wallet_address}?amount=${depositAmountInWei}&label=${encodeURIComponent(
100
+ depositLabel
101
+ )}`;
102
+ setGeneratedQr(uri);
103
+ };
104
+
105
+ const fetchAdminWallet = async () => {
106
+ const baseUrl = getBaseUrl(mode);
107
+ setWalletLoading(true);
108
+
109
+ handleApiCall({
110
+ url: `${baseUrl}/api/offramp/wallet_address`,
111
+ headers: {
112
+ "Content-Type": "application/json",
113
+ "X-API-KEY": apiKey,
114
+ "User-Id": clientReferenceID,
115
+ },
116
+ onSuccess: (result: WalletAddressAPIRespone) => {
117
+ if (result?.data?.wallet_address) {
118
+ const networkType: string = (
119
+ ["USDT", "USDC"].includes(tokenSellData.selectedCrypto)
120
+ ? tokenSellData.network_type
121
+ : tokenSellData.selectedCrypto
122
+ ).toLowerCase();
123
+
124
+ const walletKeys: WalletAddressKeys[] = ["evm", "trx", "sol"];
125
+
126
+ const wallet_address: string = ["eth", "bnb", "matic"].includes(networkType)
127
+ ? result?.data?.wallet_address["evm"]
128
+ : walletKeys.includes(networkType as WalletAddressKeys)
129
+ ? result?.data?.wallet_address[networkType as WalletAddressKeys]
130
+ : "";
131
+
132
+ setAdminWallet(wallet_address);
133
+ setWalletLoading(false);
134
+ }
135
+ },
136
+ onError: () => {
137
+ addToast("Error fetching exchange rate", "error");
138
+ setWalletLoading(false);
139
+ },
140
+ });
141
+ };
142
+
143
+ const sellTokenStart = async (data: any) => {
144
+ setSellTokensLoading(true);
145
+ const baseUrl = getBaseUrl(mode);
146
+
147
+ const formdata = new FormData();
148
+
149
+ formdata.append("from", tokenSellData.selectedCrypto);
150
+ formdata.append("to", tokenSellData.selectedFiat);
151
+ if (["USDT", "USDC"].includes(tokenSellData.selectedCrypto)) {
152
+ formdata.append("network_type", tokenSellData.network_type);
153
+ }
154
+ formdata.append("value", tokenSellData.from_amount);
155
+ formdata.append("initial_exchange_rate", tokenSellData.exchange_rate?.toString());
156
+ formdata.append("transaction_hash", data.transaction_hash);
157
+ formdata.append("bank_account", tokenSellData.selectedBeneficiary);
158
+
159
+ handleApiCall({
160
+ url: `${baseUrl}/api/offramp/transactions`,
161
+ headers: {
162
+ "X-API-KEY": apiKey,
163
+ "User-Id": clientReferenceID,
164
+ },
165
+ method: "POST",
166
+ body: formdata,
167
+ onSuccess: (result: OfframpTransactionAPIResponse) => {
168
+ if (result?.success) {
169
+ setTokenSell({
170
+ data: result?.data,
171
+ });
172
+ setTransactionSuccess(true);
173
+ setTokenSellData({
174
+ ...tokenSellData,
175
+ response: result?.data,
176
+ });
177
+ setSellTokensLoading(false);
178
+ addToast(`${result?.message}`, "success");
179
+ setStep(4);
180
+ } else {
181
+ addToast(`${result?.message}`, "error");
182
+ setTransactionSuccess(false);
183
+ setSellTokensLoading(false);
184
+ }
185
+ },
186
+ onError: (error: any) => {
187
+ addToast(` ${error}`, "error");
188
+ setTransactionSuccess(false);
189
+ setSellTokensLoading(false);
190
+ },
191
+ });
192
+ };
193
+
194
+ useEffect(() => {
195
+ if (!skipRender && adminWallet && monitoring) {
196
+ const walletAddress = adminWallet;
197
+
198
+ const token = ["USDT", "USDC"].includes(tokenSellData.selectedCrypto)
199
+ ? tokenSellData.network_type
200
+ : tokenSellData.selectedCrypto;
201
+ const currency = tokenSellData.selectedCrypto;
202
+ const expected_amount = tokenSellData.from_amount;
203
+
204
+ if (walletAddress) {
205
+ const startTimestamp = Date.now();
206
+ // let rpcUrl = SUPPORTED_RPC_NODES[SupportedTokens[token]];
207
+
208
+ intervalRef.current = setInterval(() => {
209
+ // console.log(token, networkType)
210
+ if (["USDT", "USDC"].includes(currency) && networkType) {
211
+ fetchTokenTransactions(networkType, walletAddress, startTimestamp, expected_amount);
212
+ } else {
213
+ fetchTransactions(token, walletAddress, startTimestamp, expected_amount);
214
+ }
215
+ }, 10000);
216
+ }
217
+ // generateQRDetails(walletAddress, token, tokenSellData.from_currency);
218
+ }
219
+ setSkipRender(false);
220
+ return () => {
221
+ if (intervalRef.current) {
222
+ clearInterval(intervalRef.current);
223
+ }
224
+ };
225
+ }, [adminWallet, tokenSellData, monitoring]);
226
+
227
+ const fetchTransactions = async (
228
+ token: string,
229
+ walletAddress: string,
230
+ startTimestamp: any,
231
+ expectedAmount: string
232
+ ) => {
233
+ let apiUrl = "";
234
+
235
+ // const rpcUrl = SUPPORTED_RPC_NODES[SupportedTokens[token]];
236
+ const rpcUrl = getSupportedTokens({
237
+ mode,
238
+ token,
239
+ });
240
+
241
+ const ETH_KEY = "B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V";
242
+ const BNB_KEY = "876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA";
243
+ const MATIC_KEY = "KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT";
244
+
245
+ if (token === "ETH") {
246
+ apiUrl = `${rpcUrl}/api?module=account&action=txlist&address=${walletAddress}&startblock=0&endblock=99999999&sort=desc&apikey=${ETH_KEY}`;
247
+ } else if (token === "BNB") {
248
+ apiUrl = `${rpcUrl}/api?module=account&action=txlist&address=${walletAddress}&startblock=0&endblock=99999999&sort=desc&apikey=${BNB_KEY}`;
249
+ } else if (token === "MATIC" || token === "POLYGON" || token === "POLYGON_AMOY") {
250
+ apiUrl = `${rpcUrl}/api?module=account&action=txlist&address=${walletAddress}&startblock=0&endblock=99999999&sort=desc&apikey=${MATIC_KEY}`;
251
+ } else if (token === "TRX") {
252
+ apiUrl = `${rpcUrl}/v1/accounts/${walletAddress}/transactions?limit=10`;
253
+ } else if (token === "SOL") {
254
+ return fetchSolanaTransactions();
255
+ // apiUrl = `https://api.mainnet-beta.solana.com/`;
256
+ } else {
257
+ console.error("Unsupported network");
258
+ return;
259
+ }
260
+
261
+ if (automaticHash) {
262
+ try {
263
+ const response = await fetch(apiUrl);
264
+ const data = await response.json();
265
+ processTransactions(data, walletAddress, token, startTimestamp, expectedAmount);
266
+ } catch (error) {
267
+ console.error("Error fetching transactions:", error);
268
+ }
269
+ }
270
+ };
271
+
272
+ const processTransactions = (
273
+ data: any,
274
+ walletAddress: string,
275
+ token: string,
276
+ startTimestamp: any,
277
+ expectedAmount: any
278
+ ) => {
279
+ let transactions = [];
280
+
281
+ if (token === "ETH" || token === "BNB" || token === "MATIC") {
282
+ transactions = data.result;
283
+ } else if (token === "TRX") {
284
+ transactions = data.data;
285
+ } else if (token === "SOL") {
286
+ transactions = data.result;
287
+ }
288
+
289
+ transactions.forEach((tx: any) => {
290
+ const timestamp = token == "TRX" ? tx.block_timestamp : tx.timeStamp * 1000;
291
+ // console.log(timestamp, startTimestamp, timestamp > startTimestamp)
292
+ if (timestamp > startTimestamp) {
293
+ const hash = tx.hash || tx.transactionHash || tx.txID;
294
+ const amount =
295
+ token == "TRX" ? tx.raw_data.contract[0].parameter.value.amount / 1e6 : tx.value / 1e18;
296
+ if (expectedAmount == amount) {
297
+ console.log("New Transaction Detected:", { hash, amount });
298
+ // formRef?.current?.setFieldValue("transaction_hash", hash);
299
+ inputRef.current.value = hash;
300
+ setTransactionHash(hash);
301
+ setMonitoring(false);
302
+ }
303
+ }
304
+ });
305
+ };
306
+
307
+ const fetchTokenTransactions = async (
308
+ token: string,
309
+ walletAddress: string,
310
+ startTimestamp: any,
311
+ expectedAmount: any
312
+ ) => {
313
+ let apiUrl = "";
314
+ console.log({ token });
315
+
316
+ const rpcUrl = getSupportedTokens({
317
+ mode,
318
+ token,
319
+ });
320
+
321
+ const ETH_KEY = "B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V";
322
+ const BNB_KEY = "876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA";
323
+ const MATIC_KEY = "KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT";
324
+
325
+ const contract_address = getContactAddress({
326
+ mode,
327
+ token,
328
+ networkType,
329
+ });
330
+
331
+ console.log({ contract_address, rpcUrl });
332
+
333
+ console.log("Checking for Token @ ", networkType, contract_address, token);
334
+
335
+ if (["ETH", "BNB", "MATIC"].includes(networkType)) {
336
+ const key = networkType == "ETH" ? ETH_KEY : networkType == "BNB" ? BNB_KEY : MATIC_KEY;
337
+ apiUrl = `${rpcUrl}/api?module=account&action=tokentx&address=${walletAddress}&startblock=0&endblock=99999999&sort=desc&apikey=${key}`;
338
+ } else if (networkType === "TRX") {
339
+ apiUrl = `${rpcUrl}/v1/accounts/${walletAddress}/transactions/trc20`;
340
+ } else if (networkType === "SOL") {
341
+ return fetchSolanaTransactions();
342
+ } else {
343
+ console.error("Unsupported token network");
344
+ return;
345
+ }
346
+
347
+ try {
348
+ const response = await fetch(apiUrl);
349
+ const data = await response.json();
350
+ processTokenTransactions(
351
+ data,
352
+ walletAddress,
353
+ token,
354
+ startTimestamp,
355
+ contract_address,
356
+ expectedAmount
357
+ );
358
+ } catch (error) {
359
+ console.error("Error fetching token transactions:", error);
360
+ }
361
+ };
362
+
363
+ const processTokenTransactions = (
364
+ data: any,
365
+ walletAddress: string,
366
+ token: string,
367
+ startTimestamp: any,
368
+ contract_address: any,
369
+ expectedAmount: any
370
+ ) => {
371
+ const transactions = data.result || data.data || [];
372
+
373
+ transactions.forEach((tx: any) => {
374
+ const timestamp = networkType == "TRX" ? tx.block_timestamp : tx.timeStamp * 1000;
375
+ if (timestamp > startTimestamp) {
376
+ if (networkType == "TRX") {
377
+ // Check if the token is same and then proceed
378
+ // if(contract_address.toLowerCase() == tx.token_info.address.toLowerCase()){
379
+ const hash = tx.hash || tx.transaction_id || tx.txID;
380
+ const amount = parseFloat(tx.value) / 10 ** parseInt(tx.token_info.decimals);
381
+
382
+ console.log("New TRC20 Transaction Detected:", { hash, amount });
383
+
384
+ if (amount == expectedAmount) {
385
+ // formRef?.current?.setFieldValue("transaction_hash", hash);
386
+ inputRef.current.value = hash;
387
+ setTransactionHash(hash);
388
+ setMonitoring(false);
389
+ }
390
+ // }
391
+ } else {
392
+ if (contract_address.toLowerCase() == tx.contractAddress.toLowerCase()) {
393
+ const hash = tx.hash || tx.transactionHash || tx.txID;
394
+ const amount = parseFloat(tx.value) / 10 ** parseInt(tx.tokenDecimal);
395
+ console.log("New ERC20 Transaction Detected:", { hash, amount });
396
+ if (amount == expectedAmount) {
397
+ // formRef?.current?.setFieldValue("transaction_hash", hash);
398
+ inputRef.current.value = hash;
399
+ setTransactionHash(hash);
400
+ setMonitoring(false);
401
+ }
402
+ }
403
+ }
404
+ }
405
+ });
406
+ };
407
+
408
+ const fetchSolanaTransactions = async () => {
409
+ setAutomaticHash(false);
410
+ setMonitoring(false);
411
+ };
412
+
413
+ // const handleManualHash = () => {
414
+ // setMonitoring(false);
415
+ // setAutomaticHash(false);
416
+ // };
417
+
418
+ return (
419
+ <>
420
+ <div className={styles.bank_head}>
421
+ <div style={{ cursor: "pointer" }} onClick={() => setStep(2)}>
422
+ <svg
423
+ xmlns="http://www.w3.org/2000/svg"
424
+ xmlSpace="preserve"
425
+ width="18"
426
+ height="18"
427
+ viewBox="0 0 240.823 240.823"
428
+ >
429
+ <path
430
+ d="M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191"
431
+ data-original="#000000"
432
+ ></path>
433
+ </svg>
434
+ </div>
435
+ <div className={styles.bank_titles}>Sell Crypto</div>
436
+ </div>
437
+
438
+ {walletLoading ? (
439
+ <CommonCenterLoader />
440
+ ) : adminWallet && Object.keys(adminWallet)?.length > 0 ? (
441
+ <>
442
+ <div className={styles.payment_details_wrap}>
443
+ <div className={styles.sell_qr_payemnt_wrap}>
444
+ <div className={styles.sell_amt_details}>
445
+ <div className={styles.sell_amt_details_wrap}>
446
+ <div className={styles.sell_amt_pay}>
447
+ <span className={styles.sell_pay_label}>You Pay </span>
448
+ <span className={styles.sell_pay_amt}>
449
+ {tokenSellData.from_amount} {tokenSellData.selectedCrypto}{" "}
450
+ {["USDT", "USDC"].includes(tokenSellData.selectedCrypto) &&
451
+ tokenSellData.network_type
452
+ ? `(${tokenSellData.network_type})`
453
+ : ""}
454
+ </span>
455
+ </div>
456
+ <div className={styles.sell_pay_amt}>
457
+ <span className={styles.sell_pay_label}>You Get </span>
458
+ <span className={styles.sell_pay_amt}>
459
+ {tokenSellData.to_currency_conversion_value?.toFixed(4)}{" "}
460
+ {tokenSellData.selectedFiat}
461
+ </span>
462
+ </div>
463
+ </div>
464
+ <div className={styles.sell_estimated_info}>
465
+ <p>
466
+ {" "}
467
+ <span>Estimated Rate </span>{" "}
468
+ <span>
469
+ 1 {tokenSellData.selectedCrypto} ={" "}
470
+ {!isNaN(tokenSellData.exchange_rate)
471
+ ? tokenSellData.exchange_rate.toFixed(4)
472
+ : 0.0}{" "}
473
+ {tokenSellData.selectedFiat}
474
+ </span>
475
+ </p>
476
+ </div>
477
+ </div>
478
+ <div className={styles.sell_payment_qr_box}>
479
+ <div className={styles.sell_payment_qr_frame}>
480
+ {generatedQr ? (
481
+ <QRCodeCanvas
482
+ value={generatedQr}
483
+ size={128}
484
+ bgColor={"#ffffff"}
485
+ fgColor={"#000000"}
486
+ level={"H"}
487
+ />
488
+ ) : (
489
+ <CommonCenterLoader />
490
+ )}
491
+ </div>
492
+ </div>
493
+ </div>
494
+ </div>
495
+ <form onSubmit={onSubmit}>
496
+ <div className={styles.sell_wallet_address_card}>
497
+ {sellStaticCaseWallet ||
498
+ (adminWallet && (
499
+ <div className={styles.sell_wallet_data_card}>
500
+ <h6>Wallet Address</h6>
501
+ <div className={styles.sell_wallet_code_card}>
502
+ <div className={styles.sell_wallet_code}>
503
+ <span> {adminWallet}</span>{" "}
504
+ </div>
505
+ <button
506
+ className={`${styles.action_btn} ${styles.overlay} ${styles.item_center_column} ${styles.p_0}`}
507
+ type="button"
508
+ onClick={async () => {
509
+ await navigator.clipboard.writeText(adminWallet);
510
+ addToast("Copied", "success");
511
+ }}
512
+ >
513
+ <svg
514
+ xmlns="http://www.w3.org/2000/svg"
515
+ width="20"
516
+ height="20"
517
+ viewBox="0 0 24 24"
518
+ fill="none"
519
+ stroke="#298BFF"
520
+ stroke-width="2"
521
+ stroke-linecap="round"
522
+ stroke-linejoin="round"
523
+ >
524
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
525
+ <path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" />
526
+ <path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" />
527
+ </svg>
528
+ </button>
529
+ </div>
530
+ </div>
531
+ ))}
532
+ <div className={styles.sell_hash_box}>
533
+ <div
534
+ style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}
535
+ >
536
+ <div className={styles.sell_hash_label}>
537
+ Transaction Hash <span>*</span>
538
+ </div>
539
+ {/* {automaticHash ? (
540
+ <button
541
+ className={styles.manual_hash_btn}
542
+ style={{ fontSize: "0.8em" }}
543
+ onClick={() => handleManualHash()}
544
+ >
545
+ Enter Manually
546
+ </button>
547
+ ) : null} */}
548
+ </div>
549
+ <input
550
+ className={styles.sell_hash_fields}
551
+ type="text"
552
+ placeholder={"Enter Transaction Hash"}
553
+ name="transaction_hash"
554
+ onChange={(e) => setTransactionHash(e.target.value)}
555
+ ref={inputRef}
556
+ disabled={automaticHash}
557
+ // disabled={tokenSell.buttonDisable}
558
+ />
559
+ {/* {!transactionHash && <p className="errorMsg">Required</p>} */}
560
+ </div>
561
+ </div>
562
+ <div className={styles.efi_swap_action}>
563
+ {monitoring || selltokensLoading || transactionSuccess ? (
564
+ <div className="mt-3">
565
+ <ButtonStepper props={tokenSell} monitoring={monitoring} />
566
+ </div>
567
+ ) : (
568
+ <button
569
+ className={`${styles.action_btn} ${styles.primary} `}
570
+ onClick={(e) => {
571
+ e.preventDefault();
572
+ onSubmit();
573
+ }}
574
+ disabled={!transactionHash || selltokensLoading}
575
+ >
576
+ {selltokensLoading ? <ButtonLoader /> : "Submit"}
577
+ </button>
578
+ )}
579
+ </div>
580
+ </form>
581
+ </>
582
+ ) : (
583
+ <>
584
+ <div className={styles.no_wallet_details}>
585
+ <p>No Wallet Details Found</p>
586
+ <div>
587
+ <button
588
+ className={`${styles.action_btn} ${styles.primary} `}
589
+ onClick={() => fetchAdminWallet()}
590
+ >
591
+ Retry
592
+ </button>
593
+ </div>
594
+ </div>
595
+ </>
596
+ )}
597
+ </>
598
+ );
599
+ };
600
+
601
+ export default SellAdminCryptoAccount;