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,632 @@
1
+ // import React, { useContext, useEffect, useState } from "react";
2
+ // import CustomSelect from "./CustomeSelect";
3
+ // import { useToast } from "../hooks/toastProvider";
4
+ // import Loader from "./loader";
5
+ // import DotLoader from "./DotLoader";
6
+ // import { isValidDecimal } from "./utils";
7
+ // import { useExchangeSocket } from "../hooks/useSocketExchange";
8
+ // import { handleApiCall } from "./api";
9
+ // import WAValidator from "multicoin-address-validator";
10
+
11
+ // type BuyFieldProps = {
12
+ // onHide: () => void;
13
+ // defaultTab: string;
14
+ // apiKey: string;
15
+ // setStep: (step: string) => void;
16
+ // redirectUrl: string;
17
+ // parameters: any;
18
+ // placeholder: string;
19
+ // clientReferenceID: string;
20
+ // };
21
+
22
+ // const BuyField = ({
23
+ // onHide,
24
+ // defaultTab,
25
+ // apiKey,
26
+ // setStep,
27
+ // redirectUrl,
28
+ // parameters,
29
+ // placeholder,
30
+ // clientReferenceID,
31
+ // }: BuyFieldProps) => {
32
+ // const { addToast } = useToast();
33
+ // const exchangeSocket = useExchangeSocket({}); // socket connection to fetch exchange rate
34
+
35
+ // const [loading, setLoading] = useState(false);
36
+ // const [fiatOptions, setFiatOptions] = useState([]);
37
+ // const [cryptoOptions, setCryptoOptions] = useState([]);
38
+ // const [selectedCrypto, setSelectedCrypto] = useState(null);
39
+ // const [selectedFiat, setSelectedFiat] = useState(null);
40
+ // const [exchangeRateForThisUser, setExchangeRateForThisUser] = useState(0);
41
+ // const [commissionForThisUser, setCommissionForThisUser] = useState(0);
42
+ // const [actualCommission, setActualCommission] = useState(0);
43
+ // const [inputRules, setInputRules] = useState(null);
44
+ // const [currencies, setCurrencies] = useState(null);
45
+ // const [commissionApiResponse, setComissionApiResponse] = useState(null);
46
+ // const [invalidAmount, setInvalidAmount] = useState({
47
+ // min: false,
48
+ // max: false,
49
+ // });
50
+ // const [addCommission, setAddCommission] = useState(null);
51
+ // const [userReceivableCryptoValue, setUserReceivableCryptoValue] = useState(0);
52
+ // const [exchangeLoading, setExchangeLoading] = useState(true);
53
+ // const [buyStep, setBuyStep] = useState(1);
54
+ // const [redirectURL, setRedirectURL] = useState();
55
+ // const [walletAddress, setWalletAddress] = useState("");
56
+ // const [walletAddressError, setWalletAddressError] = useState("");
57
+ // // const [exchangeRateApiResponse, setExchangeRateApiResponse] = useState(null);
58
+ // // You Pay / Fiat
59
+ // const [fiatDetails, setfiatDetails] = useState({
60
+ // from_amount:
61
+ // parameters?.from_amount && parseFloat(parameters?.from_amount) > 0
62
+ // ? parameters.from_amount
63
+ // : 0,
64
+ // selectedCrypto: parameters.token_type,
65
+ // });
66
+
67
+ // useEffect(() => {
68
+ // fetchCurrencies();
69
+ // fetchCommissions();
70
+ // }, []);
71
+
72
+ // const fetchCurrencies = () => {
73
+ // handleApiCall({
74
+ // url: "https://hexchangepay.rare-able.com/api/lookup/currencies",
75
+ // headers: {
76
+ // "Content-Type": "application/json",
77
+ // "X-API-KEY": apiKey,
78
+ // "User-Id": clientReferenceID,
79
+ // },
80
+ // onSuccess: (result) => {
81
+ // if (result?.success) {
82
+ // setCurrencies(result?.data);
83
+ // }
84
+ // },
85
+ // onError: (error) => {
86
+ // addToast("Error fetching currency", "error");
87
+ // },
88
+ // });
89
+ // };
90
+
91
+ // useEffect(() => {
92
+ // if (currencies) {
93
+ // const fiatCurrencyOptions = currencies?.currencies
94
+ // ?.filter((item) => item?.supported_currency?.type === "FIAT")
95
+ // ?.map((item) => ({
96
+ // label: item?.supported_currency?.code,
97
+ // value: item?.unique_id,
98
+ // icon: item?.supported_currency?.icon,
99
+ // }));
100
+
101
+ // setFiatOptions(fiatCurrencyOptions);
102
+
103
+ // const selected_forex = fiatDetails?.selectedFiat
104
+ // ? currencies?.currencies.find(
105
+ // (currency) => currency?.supported_currency?.code === fiatDetails?.selectedFiat
106
+ // )
107
+ // : currencies?.currencies?.[0];
108
+
109
+ // setSelectedFiat(
110
+ // fiatDetails.selectedFiat
111
+ // ? fiatCurrencyOptions.find((fiat) => fiat.label === fiatDetails.selectedFiat)
112
+ // : fiatCurrencyOptions?.[0]
113
+ // );
114
+
115
+ // // setCategoriesOptions(categories);
116
+
117
+ // const cryptoOptions =
118
+ // currencies?.currencies
119
+ // ?.filter((item) => item?.supported_currency?.type === "CRYPTO")
120
+ // ?.map((item) => ({
121
+ // label: item?.supported_currency?.code,
122
+ // value: item?.unique_id,
123
+ // icon: item?.supported_currency?.icon,
124
+ // })) || [];
125
+
126
+ // setCryptoOptions(cryptoOptions);
127
+ // // console.log("param ", parameters?.token_type);
128
+
129
+ // const selected_crypto = parameters?.token_type
130
+ // ? currencies?.currencies?.find(
131
+ // (currency) => currency?.supported_currency?.code === parameters?.token_type
132
+ // ) || currencies?.currencies?.[0]
133
+ // : currencies?.currencies?.[0];
134
+
135
+ // setSelectedCrypto(
136
+ // parameters?.token_type
137
+ // ? cryptoOptions.find((currency) => currency.label === parameters?.token_type) ||
138
+ // cryptoOptions?.[0]
139
+ // : cryptoOptions?.[0] || []
140
+ // );
141
+
142
+ // setfiatDetails((prev) => ({
143
+ // ...prev,
144
+ // selectedCrypto: selected_crypto?.supported_currency?.code,
145
+ // selectedFiat: selected_forex?.supported_currency?.code,
146
+ // }));
147
+ // }
148
+ // }, [currencies]);
149
+
150
+ // const fetchCommissions = () => {
151
+ // handleApiCall({
152
+ // url: "https://hexchangepay.rare-able.com/api/lookup/commissions",
153
+ // headers: {
154
+ // "Content-Type": "application/json",
155
+ // "X-API-KEY": apiKey,
156
+ // "User-Id": clientReferenceID,
157
+ // },
158
+ // onSuccess: (result) => {
159
+ // if (result?.success) {
160
+ // setComissionApiResponse(result?.data);
161
+ // }
162
+ // },
163
+ // onError: (error) => {
164
+ // addToast("Error fetching comission", "error");
165
+ // },
166
+ // });
167
+ // };
168
+ // // console.log({ selectedCrypto });
169
+
170
+ // useEffect(() => {
171
+ // if (commissionApiResponse && currencies) {
172
+ // const rules = commissionApiResponse?.rules?.find((item) => item?.service === "onramp");
173
+ // setInputRules(rules);
174
+ // const commission = commissionApiResponse?.commission?.find(
175
+ // (item) => item?.service === "onramp"
176
+ // );
177
+ // setActualCommission(commission);
178
+
179
+ // setfiatDetails((prev) => ({
180
+ // ...prev,
181
+ // minAmount:
182
+ // parseFloat(rules?.schema?.min) <= 0
183
+ // ? 0.0000001
184
+ // : parseFloat(rules?.schema?.min)?.toFixed(8),
185
+ // maxAmount:
186
+ // parseFloat(rules?.schema?.max) <= 0 ? 100000 : parseFloat(rules?.schema?.max)?.toFixed(8),
187
+ // buy_commission: commission,
188
+ // }));
189
+ // let range = commissionApiResponse?.commission_ranges?.find(
190
+ // (item) =>
191
+ // parseFloat(item.from_amount) <= parseFloat(fiatDetails.from_amount) &&
192
+ // parseFloat(item.to_amount) >= parseFloat(fiatDetails.from_amount) &&
193
+ // item.currency === selectedFiat?.label &&
194
+ // item.type === "f-c"
195
+ // );
196
+
197
+ // setAddCommission(range);
198
+ // }
199
+ // }, [commissionApiResponse, currencies]);
200
+
201
+ // const handleFiatCurrencyChange = (selectedOption) => {
202
+ // const fiat = currencies?.currencies?.find((fiat) => fiat.unique_id === selectedOption.value);
203
+ // setfiatDetails({
204
+ // ...fiatDetails,
205
+ // selectedFiat: fiat?.supported_currency?.code,
206
+ // });
207
+ // setSelectedFiat(selectedOption);
208
+ // };
209
+
210
+ // const handleFiatCurrencyValueChange = (value) => {
211
+ // if (value.includes(".")) {
212
+ // if (inputRules && !isValidDecimal(value, inputRules?.schema?.decimal)) {
213
+ // addToast(`You can input upto ${inputRules?.schema?.decimal} decimal places.`, "error");
214
+ // return;
215
+ // } else {
216
+ // if (Number(value) == value) {
217
+ // setfiatDetails({
218
+ // ...fiatDetails,
219
+ // from_amount: value,
220
+ // });
221
+ // }
222
+ // }
223
+ // } else {
224
+ // if (Number(value) == value) {
225
+ // setfiatDetails({
226
+ // ...fiatDetails,
227
+ // from_amount: value,
228
+ // });
229
+ // }
230
+ // }
231
+ // };
232
+
233
+ // const onCryptoChange = (selectedOption) => {
234
+ // const crypto = currencies?.currencies?.find(
235
+ // (crypto) => crypto?.unique_id === selectedOption.value
236
+ // );
237
+ // setfiatDetails({
238
+ // ...fiatDetails,
239
+ // selectedCrypto: crypto?.supported_currency?.code,
240
+ // });
241
+ // setSelectedCrypto(selectedOption);
242
+ // };
243
+
244
+ // useEffect(() => {
245
+ // if (selectedCrypto?.label) {
246
+ // setExchangeRateForThisUser(0);
247
+ // fetchExchangeRate(selectedCrypto.label);
248
+ // }
249
+ // // eslint-disable-next-line react-hooks/exhaustive-deps
250
+ // }, [selectedCrypto]);
251
+
252
+ // useEffect(() => {
253
+ // if (exchangeSocket && selectedFiat && selectedCrypto) {
254
+ // fetchExchangeRate();
255
+ // }
256
+ // }, [selectedCrypto, selectedFiat]);
257
+
258
+ // const [exchangeRate, setExchangeRate] = useState(0);
259
+
260
+ // useEffect(() => {
261
+ // exchangeSocket &&
262
+ // exchangeSocket.on("getSDKExchangeRate", (data) => {
263
+ // console.log("ex rate :", data);
264
+ // setExchangeRate(data);
265
+ // // fetchExchangeRate(false);
266
+ // setExchangeLoading(false);
267
+ // });
268
+ // }, [exchangeSocket]);
269
+
270
+ // const fetchExchangeRate = () => {
271
+ // // fetchExchangeRate(true);
272
+ // setExchangeLoading(true);
273
+ // exchangeSocket.emit("fetchSDKExchangeRate", {
274
+ // pair: `${selectedFiat?.label}-${selectedCrypto?.label}`,
275
+ // user_id: "",
276
+ // type: "buy",
277
+ // apiKey: apiKey,
278
+ // userId: clientReferenceID,
279
+ // });
280
+ // };
281
+
282
+ // useEffect(() => {
283
+ // setInvalidAmount({
284
+ // min:
285
+ // parseFloat(fiatDetails.from_amount) < fiatDetails.minAmount ||
286
+ // fiatDetails.from_amount == "" ||
287
+ // fiatDetails.from_amount <= 0,
288
+ // max: parseFloat(fiatDetails.from_amount) > fiatDetails.maxAmount,
289
+ // });
290
+ // }, [exchangeRateForThisUser, fiatDetails]);
291
+
292
+ // useEffect(() => {
293
+ // if (exchangeRate && exchangeRate > 0 && fiatDetails) {
294
+ // // setExchangeApiResponse(data?.data);
295
+ // const userCommission = actualCommission?.commission
296
+ // ? parseFloat(actualCommission?.commission) || 0
297
+ // : 0;
298
+
299
+ // let actualExchangeRate = parseFloat(exchangeRate);
300
+
301
+ // const additonalCommissionRate = addCommission
302
+ // ? addCommission.from_commission -
303
+ // ((addCommission.from_commission - addCommission.to_commission) /
304
+ // (addCommission.to_amount - addCommission.from_amount)) *
305
+ // (fiatDetails.from_amount - addCommission.from_amount)
306
+ // : 0;
307
+
308
+ // let newCommission = ((userCommission + additonalCommissionRate) / 100) * actualExchangeRate;
309
+ // setCommissionForThisUser(newCommission || 0);
310
+
311
+ // let newExchangeRate = actualExchangeRate - newCommission;
312
+
313
+ // setExchangeRateForThisUser(newExchangeRate || 0);
314
+
315
+ // setUserReceivableCryptoValue(fiatDetails.from_amount * newExchangeRate);
316
+ // }
317
+ // }, [exchangeRate, fiatDetails, commissionApiResponse]);
318
+
319
+ // const onComplete = async () => {
320
+ // if (fiatDetails.from_amount > 0) {
321
+ // // setExchangeLoading(true);
322
+ // setLoading(true);
323
+
324
+ // const payload = {
325
+ // from: fiatDetails?.selectedFiat || selectedFiat?.label,
326
+ // to: fiatDetails?.selectedCrypto || selectedCrypto?.label,
327
+ // value: fiatDetails?.from_amount,
328
+ // wallet_address: walletAddress,
329
+ // initial_exchange_rate: exchangeRateForThisUser,
330
+ // };
331
+
332
+ // try {
333
+ // await fetch("https://hexchangepay.rare-able.com/api/onramp/transactions", {
334
+ // method: "POST",
335
+ // headers: {
336
+ // "Content-Type": "application/json",
337
+ // "X-API-KEY": apiKey,
338
+ // "User-Id": clientReferenceID,
339
+ // },
340
+ // body: JSON.stringify(payload),
341
+ // })
342
+ // .then((response) => response.json())
343
+ // .then((data) => {
344
+ // if (data?.data?.redirect_url) {
345
+ // setRedirectURL(data.data.redirect_url);
346
+ // setBuyStep(2);
347
+ // } else if (!data.success) {
348
+ // addToast(data?.message, "error");
349
+ // }
350
+ // })
351
+ // .catch((error) => {
352
+ // addToast(error, "error");
353
+ // console.error("Error in Buy Tokens:", error);
354
+ // });
355
+ // } catch (error) {
356
+ // addToast(error, "error");
357
+ // console.error("Error in Buy Tokens:", error);
358
+ // } finally {
359
+ // // setExchangeLoading(false);
360
+ // setLoading(false);
361
+ // }
362
+ // } else {
363
+ // addToast("Please enter valid amount", "error");
364
+ // }
365
+ // };
366
+
367
+ // return (
368
+ // <>
369
+ // {buyStep === 1 ? (
370
+ // <>
371
+ // <div className="off-ramp-field-card">
372
+ // <div className="off-ramp-field-box">
373
+ // <div className="off-ramp-field-label">You pay</div>
374
+ // <div className="off-ramp-field-form">
375
+ // <input
376
+ // type="text"
377
+ // value={fiatDetails?.from_amount}
378
+ // onChange={(e) => {
379
+ // const newValue = e.target.value;
380
+ // handleFiatCurrencyValueChange(
381
+ // newValue <= 100000 ? newValue : fiatDetails?.from_amount
382
+ // );
383
+ // }}
384
+ // className="input-control"
385
+ // />
386
+ // </div>
387
+ // </div>
388
+
389
+ // <div className="off-ramp-field-select-card">
390
+ // <div className="off-ramp-field-select">
391
+ // {fiatOptions?.length > 0 ? (
392
+ // <CustomSelect
393
+ // backgroundColor="#f3e2c3"
394
+ // placeholder={placeholder || "Select an option"}
395
+ // image={true}
396
+ // singleicons={true}
397
+ // options={fiatOptions}
398
+ // isSearchable={false}
399
+ // value={selectedFiat}
400
+ // onChange={(selectedOption) => handleFiatCurrencyChange(selectedOption)}
401
+ // />
402
+ // ) : (
403
+ // <div style={{ display: "flex", justifyContent: "center", alignItems: "center" }}>
404
+ // <Loader />
405
+ // </div>
406
+ // )}
407
+ // </div>
408
+ // </div>
409
+ // </div>
410
+ // {invalidAmount?.min && (
411
+ // <p className="error-msg text-danger select-date buy-form">
412
+ // Invalid, Min : {parseFloat(fiatDetails?.minAmount)?.toFixed(8)}
413
+ // </p>
414
+ // )}
415
+ // {invalidAmount?.max && (
416
+ // <p className="error-msg text-danger select-date buy-form">
417
+ // Invalid, Max : {parseFloat(fiatDetails?.maxAmount)?.toString()}
418
+ // </p>
419
+ // )}
420
+ // <div className="off-ramp-info-box">
421
+ // <div className="off-ramp-label-card off-ramp-space">
422
+ // <div className="off-ramp-label-icons">
423
+ // <svg
424
+ // xmlns="http://www.w3.org/2000/svg"
425
+ // xmlSpace="preserve"
426
+ // width="12"
427
+ // height="12"
428
+ // viewBox="0 0 300 300"
429
+ // >
430
+ // <path
431
+ // d="M240.3 171.5H59.7c-11.9 0-21.5-9.6-21.5-21.5s9.6-21.5 21.5-21.5h180.6c11.9 0 21.5 9.6 21.5 21.5s-9.6 21.5-21.5 21.5"
432
+ // data-original="#000000"
433
+ // ></path>
434
+ // <circle cx="150" cy="65.5" r="30.5" data-original="#000000"></circle>
435
+ // <circle cx="150.5" cy="234.5" r="30.5" data-original="#000000"></circle>
436
+ // </svg>
437
+ // </div>
438
+ // <div className="off-ramp-label-value">
439
+ // <span style={{ marginRight: 10 }}>Rate :</span>
440
+ // {exchangeLoading ? (
441
+ // <DotLoader />
442
+ // ) : (
443
+ // `1
444
+ // ${selectedFiat?.label || "N/A"}
445
+ // = ${exchangeRateForThisUser?.toFixed(4)} ${selectedCrypto?.label}`
446
+ // )}
447
+ // </div>
448
+ // </div>
449
+ // <div className="off-ramp-label-titles off-ramp-space-top">
450
+ // <div className="off-ramp-label-dots"></div>
451
+ // <div className="off-ramp-details">
452
+ // <div className="off-ramp-head"> See Fees Calculation</div>
453
+ // </div>
454
+ // </div>
455
+ // <div className="off-ramp-label-card off-ramp-space">
456
+ // <div className="off-ramp-label-icons">
457
+ // <svg
458
+ // xmlns="http://www.w3.org/2000/svg"
459
+ // xmlSpace="preserve"
460
+ // width="10"
461
+ // height="10"
462
+ // viewBox="0 0 121.805 121.804"
463
+ // >
464
+ // <path
465
+ // d="M7.308 68.211h107.188a7.31 7.31 0 0 0 7.309-7.31 7.31 7.31 0 0 0-7.309-7.309H7.308a7.31 7.31 0 0 0 0 14.619"
466
+ // data-original="#000000"
467
+ // ></path>
468
+ // </svg>
469
+ // </div>
470
+ // <div className="off-ramp-label-value">
471
+ // <span style={{ marginRight: 10 }}>Total Fees :</span>
472
+ // {exchangeLoading ? (
473
+ // <DotLoader />
474
+ // ) : (
475
+ // `${(commissionForThisUser * fiatDetails?.from_amount)?.toFixed(4)} ${
476
+ // selectedCrypto?.label
477
+ // }`
478
+ // )}
479
+ // </div>
480
+ // </div>
481
+ // <div className="off-ramp-label-titles off-ramp-space-top">
482
+ // <div className="off-ramp-label-dots"></div>
483
+ // <div className="off-ramp-details">
484
+ // <div className="off-ramp-head">Withdrawal Method</div>
485
+ // <div className="off-payment-box">
486
+ // <div className="off-payment-check-card selected">
487
+ // <input
488
+ // type="radio"
489
+ // name="radioDefault"
490
+ // id="radioDefault1"
491
+ // value="0.10234"
492
+ // className="input-control"
493
+ // />
494
+ // <div>Card Payment</div>
495
+ // <svg
496
+ // xmlns="http://www.w3.org/2000/svg"
497
+ // width="20"
498
+ // height="20"
499
+ // viewBox="0 0 408.576 408.576"
500
+ // >
501
+ // <g>
502
+ // <path
503
+ // d="M204.288 0C91.648 0 0 91.648 0 204.288s91.648 204.288 204.288 204.288 204.288-91.648 204.288-204.288S316.928 0 204.288 0zm114.176 150.528-130.56 129.536c-7.68 7.68-19.968 8.192-28.16.512L90.624 217.6c-8.192-7.68-8.704-20.48-1.536-28.672 7.68-8.192 20.48-8.704 28.672-1.024l54.784 50.176L289.28 121.344c8.192-8.192 20.992-8.192 29.184 0s8.192 20.992 0 29.184z"
504
+ // fill="#F9C201"
505
+ // ></path>
506
+ // </g>
507
+ // </svg>
508
+ // </div>
509
+ // </div>
510
+ // </div>
511
+ // </div>
512
+ // </div>
513
+ // <div className="off-ramp-field-card">
514
+ // <div className="off-ramp-field-box">
515
+ // <div className="off-ramp-field-label">You Receive ( estimate )</div>
516
+ // <div className="off-ramp-field-form">
517
+ // {exchangeLoading ? (
518
+ // <DotLoader size={20} />
519
+ // ) : (
520
+ // <input
521
+ // type="text"
522
+ // value={userReceivableCryptoValue?.toFixed(4)}
523
+ // className="input-control"
524
+ // disabled
525
+ // />
526
+ // )}
527
+ // </div>
528
+ // </div>
529
+ // <div className="off-ramp-field-select-card">
530
+ // <div className="off-ramp-field-select">
531
+ // {cryptoOptions?.length > 0 ? (
532
+ // <CustomSelect
533
+ // backgroundColor="#f3e2c3"
534
+ // placeholder="Select"
535
+ // borderColor="var(--no-color)"
536
+ // image={true}
537
+ // singleicons={true}
538
+ // options={cryptoOptions}
539
+ // value={selectedCrypto}
540
+ // isSearchable={false}
541
+ // onChange={(selectedOption) => {
542
+ // setExchangeRateForThisUser(0);
543
+ // setWalletAddress("");
544
+ // setWalletAddressError("Required");
545
+ // onCryptoChange(selectedOption);
546
+ // }}
547
+ // isDisabled={exchangeLoading}
548
+ // />
549
+ // ) : (
550
+ // <div style={{ display: "flex", justifyContent: "center", alignItems: "center" }}>
551
+ // <Loader />
552
+ // </div>
553
+ // )}
554
+ // </div>
555
+ // </div>
556
+ // </div>
557
+
558
+ // <div style={{ marginTop: "20px" }} className="off-ramp-new-bank-box">
559
+ // <div className="off-ramp-new-bank-label">
560
+ // Wallet Address <span className={styles.required}>*</span>
561
+ // </div>
562
+ // <div className="off-ramp-new-bank-fields">
563
+ // <input
564
+ // type="text"
565
+ // value={walletAddress}
566
+ // className="input-control"
567
+ // placeholder="Enter Wallet Address"
568
+ // onChange={(e) => {
569
+ // let value = e.target.value.trim();
570
+ // setWalletAddress(value);
571
+ // if (e.target.value != "") {
572
+ // setWalletAddressError("");
573
+ // let network = ["USDT", "USDC"].includes(selectedCrypto.label)
574
+ // ? ("ETH", "TRX", "SOL")
575
+ // : selectedCrypto.label;
576
+ // const valid = ["USDT", "USDC"].includes(selectedCrypto.label)
577
+ // ? WAValidator.validate(value, "ETH") ||
578
+ // WAValidator.validate(value, "TRX") ||
579
+ // WAValidator.validate(value, "SOL")
580
+ // : WAValidator.validate(value, network);
581
+ // if (!valid) {
582
+ // setWalletAddressError("Invalid wallet address");
583
+ // } else {
584
+ // setWalletAddressError("");
585
+ // }
586
+ // } else {
587
+ // setWalletAddressError("Required");
588
+ // }
589
+ // }}
590
+ // name="bank_name"
591
+ // />
592
+ // </div>
593
+ // {walletAddressError && <span className="input-error">{walletAddressError}</span>}
594
+ // </div>
595
+
596
+ // <div className="off-ramp-action">
597
+ // <button
598
+ // disabled={
599
+ // !exchangeRateForThisUser > 0 ||
600
+ // exchangeLoading ||
601
+ // !walletAddress ||
602
+ // loading ||
603
+ // walletAddressError
604
+ // }
605
+ // className="action-btn primary"
606
+ // onClick={onComplete}
607
+ // >
608
+ // Continue
609
+ // </button>
610
+ // </div>
611
+ // </>
612
+ // ) : (
613
+ // <iframe
614
+ // title="Buy Crypto"
615
+ // id="chat-widget"
616
+ // src={redirectURL}
617
+ // style={{
618
+ // width: "100%",
619
+ // minHeight: "calc(100vh - 400px)",
620
+ // // minHeight: "calc(100vh - 23%)",
621
+ // // maxHeight: "calc(100vh - 10%)",
622
+ // border: "none",
623
+ // zIndex: "9999",
624
+ // overflow: "auto",
625
+ // }}
626
+ // ></iframe>
627
+ // )}
628
+ // </>
629
+ // );
630
+ // };
631
+
632
+ // export default BuyField;