herald-exchange-glide-widget 1.0.0 → 1.0.2
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/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/rollup.config-1750247216339.cjs +96 -0
- package/src/assets/css/style.module.css +13 -10
- package/src/components/SellAdminCryptoAccount.tsx +23 -11
- package/src/components/SellField.tsx +3 -3
- package/src/components/WidgetComponent.tsx +0 -6
- package/src/components/WidgetContent.tsx +0 -4
- package/src/components/WidgetSuccesDetails.tsx +0 -4
- package/src/hooks/useSocketExchange.tsx +12 -1
package/package.json
CHANGED
@@ -0,0 +1,96 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
4
|
+
|
5
|
+
var commonjs = require('@rollup/plugin-commonjs');
|
6
|
+
var resolve = require('@rollup/plugin-node-resolve');
|
7
|
+
var terser = require('@rollup/plugin-terser');
|
8
|
+
var typescript = require('@rollup/plugin-typescript');
|
9
|
+
var PeerDepsExternal = require('rollup-plugin-peer-deps-external');
|
10
|
+
var dts = require('rollup-plugin-dts');
|
11
|
+
var postcss = require('rollup-plugin-postcss');
|
12
|
+
var babel = require('@rollup/plugin-babel');
|
13
|
+
var url = require('@rollup/plugin-url');
|
14
|
+
var inject = require('@rollup/plugin-inject');
|
15
|
+
var strip = require('rollup-plugin-strip');
|
16
|
+
|
17
|
+
const packageJSON = require("./package.json");
|
18
|
+
|
19
|
+
var rollup_config = [
|
20
|
+
{
|
21
|
+
input: "src/index.ts",
|
22
|
+
output: [
|
23
|
+
{
|
24
|
+
file: packageJSON.main,
|
25
|
+
format: "cjs",
|
26
|
+
sourcemap: true,
|
27
|
+
},
|
28
|
+
{
|
29
|
+
file: packageJSON.module,
|
30
|
+
format: "esm",
|
31
|
+
sourcemap: true,
|
32
|
+
},
|
33
|
+
],
|
34
|
+
plugins: [
|
35
|
+
PeerDepsExternal(),
|
36
|
+
resolve({
|
37
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
38
|
+
browser: true,
|
39
|
+
preferBuiltins: false,
|
40
|
+
}),
|
41
|
+
commonjs(),
|
42
|
+
inject({
|
43
|
+
Buffer: ["buffer", "Buffer"], // 👈 Inject Buffer globally
|
44
|
+
}),
|
45
|
+
typescript({ tsconfig: "./tsconfig.json" }),
|
46
|
+
terser(),
|
47
|
+
postcss({
|
48
|
+
modules: {
|
49
|
+
generateScopedName: "glide_[name]__[local]___[hash:base64:5]",
|
50
|
+
},
|
51
|
+
inject: true, // 👈 This ensures CSS is injected via <style> tag at runtime
|
52
|
+
extract: false, // 👈 Don't extract a separate .css file
|
53
|
+
minimize: true,
|
54
|
+
sourceMap: true,
|
55
|
+
}),
|
56
|
+
strip({
|
57
|
+
include: "**/*.(js|ts|tsx)",
|
58
|
+
functions: ["console.*", "assert.*"], // remove all console.* calls & assert.*
|
59
|
+
}),
|
60
|
+
babel({
|
61
|
+
babelHelpers: "bundled",
|
62
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
63
|
+
presets: ["@babel/preset-react", "@babel/preset-typescript"],
|
64
|
+
exclude: "node_modules/**",
|
65
|
+
}),
|
66
|
+
url({
|
67
|
+
include: ["**/*.svg", "**/*.png", "**/*.jpg", "**/*.gif"],
|
68
|
+
limit: 8192, // Inline files < 8kb, emit files for larger ones
|
69
|
+
emitFiles: true,
|
70
|
+
fileName: "[name][hash][extname]",
|
71
|
+
}),
|
72
|
+
],
|
73
|
+
external: [
|
74
|
+
"react",
|
75
|
+
"react-dom",
|
76
|
+
"fs",
|
77
|
+
"url",
|
78
|
+
"http",
|
79
|
+
"https",
|
80
|
+
"stream",
|
81
|
+
"crypto",
|
82
|
+
"child_process",
|
83
|
+
"zlib",
|
84
|
+
"net",
|
85
|
+
"tls",
|
86
|
+
],
|
87
|
+
},
|
88
|
+
{
|
89
|
+
input: "src/index.ts",
|
90
|
+
output: [{ file: packageJSON.types }],
|
91
|
+
plugins: [dts.default()],
|
92
|
+
external: [/\.css/],
|
93
|
+
},
|
94
|
+
];
|
95
|
+
|
96
|
+
exports.default = rollup_config;
|
@@ -22,7 +22,7 @@
|
|
22
22
|
}
|
23
23
|
|
24
24
|
:root {
|
25
|
-
--primary-color-des: #
|
25
|
+
--primary-color-des: #000;
|
26
26
|
--fade-color-des: #ffffff;
|
27
27
|
--hightlight-color-des: #000;
|
28
28
|
--gray-color-des: #6b7178;
|
@@ -229,8 +229,11 @@ button:disabled {
|
|
229
229
|
display: block;
|
230
230
|
min-width: 600px;
|
231
231
|
max-width: 600px;
|
232
|
-
min-height:
|
232
|
+
min-height: 550px;
|
233
233
|
overflow: auto;
|
234
|
+
background: #f6f3ef;
|
235
|
+
padding: 2em;
|
236
|
+
border-radius: 12px;
|
234
237
|
|
235
238
|
}
|
236
239
|
|
@@ -393,7 +396,7 @@ button:disabled {
|
|
393
396
|
|
394
397
|
.gilde_field_select_card {
|
395
398
|
width: 50%;
|
396
|
-
background-color: #
|
399
|
+
background-color: #efefef;
|
397
400
|
padding: 1em;
|
398
401
|
border-bottom-right-radius: 10px;
|
399
402
|
border-top-right-radius: 10px;
|
@@ -407,7 +410,7 @@ button:disabled {
|
|
407
410
|
height: 2em;
|
408
411
|
display: grid;
|
409
412
|
place-items: center;
|
410
|
-
background-color: #
|
413
|
+
background-color: #fff;
|
411
414
|
border-radius: 50%;
|
412
415
|
font-weight: 700;
|
413
416
|
font-size: 1.2em;
|
@@ -441,7 +444,7 @@ button:disabled {
|
|
441
444
|
width: 1em;
|
442
445
|
height: 1em;
|
443
446
|
border-radius: 50%;
|
444
|
-
background-color: #
|
447
|
+
background-color: #fff;
|
445
448
|
margin-left: 10px;
|
446
449
|
}
|
447
450
|
|
@@ -481,8 +484,8 @@ button:disabled {
|
|
481
484
|
}
|
482
485
|
|
483
486
|
.gilde_payment_check_card.selected {
|
484
|
-
border-color: var(--primary-color-des);
|
485
|
-
background-color: #
|
487
|
+
/* border-color: var(--primary-color-des); */
|
488
|
+
background-color: #fff;
|
486
489
|
color: var(--primary-color-des);
|
487
490
|
}
|
488
491
|
|
@@ -501,7 +504,7 @@ button:disabled {
|
|
501
504
|
width: 2px;
|
502
505
|
height: 100%;
|
503
506
|
top: 0;
|
504
|
-
background: #
|
507
|
+
background: #fff;
|
505
508
|
left: 16px;
|
506
509
|
z-index: -1;
|
507
510
|
}
|
@@ -576,7 +579,7 @@ button:disabled {
|
|
576
579
|
display: grid;
|
577
580
|
grid-template-columns: 40px auto;
|
578
581
|
align-items: center;
|
579
|
-
background: #
|
582
|
+
background: #efefef;
|
580
583
|
}
|
581
584
|
|
582
585
|
.caution_info {
|
@@ -833,7 +836,7 @@ button:disabled {
|
|
833
836
|
}
|
834
837
|
}
|
835
838
|
.sell_wallet_address_card {
|
836
|
-
background:
|
839
|
+
background: #fff;
|
837
840
|
padding: 1.5em;
|
838
841
|
border-radius: 10px;
|
839
842
|
margin-bottom: 1.5em;
|
@@ -208,7 +208,13 @@ const SellAdminCryptoAccount = ({
|
|
208
208
|
intervalRef.current = setInterval(() => {
|
209
209
|
// console.log(token, networkType)
|
210
210
|
if (["USDT", "USDC"].includes(currency) && networkType) {
|
211
|
-
fetchTokenTransactions(
|
211
|
+
fetchTokenTransactions({
|
212
|
+
currency,
|
213
|
+
token: networkType,
|
214
|
+
walletAddress,
|
215
|
+
startTimestamp,
|
216
|
+
expected_amount,
|
217
|
+
});
|
212
218
|
} else {
|
213
219
|
fetchTransactions(token, walletAddress, startTimestamp, expected_amount);
|
214
220
|
}
|
@@ -304,12 +310,19 @@ const SellAdminCryptoAccount = ({
|
|
304
310
|
});
|
305
311
|
};
|
306
312
|
|
307
|
-
const fetchTokenTransactions = async (
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
+
const fetchTokenTransactions = async ({
|
314
|
+
currency,
|
315
|
+
token,
|
316
|
+
walletAddress,
|
317
|
+
startTimestamp,
|
318
|
+
expected_amount,
|
319
|
+
}: {
|
320
|
+
currency: string;
|
321
|
+
token: string;
|
322
|
+
walletAddress: string;
|
323
|
+
startTimestamp: any;
|
324
|
+
expected_amount: string;
|
325
|
+
}) => {
|
313
326
|
let apiUrl = "";
|
314
327
|
console.log({ token });
|
315
328
|
|
@@ -324,13 +337,13 @@ const SellAdminCryptoAccount = ({
|
|
324
337
|
|
325
338
|
const contract_address = getContactAddress({
|
326
339
|
mode,
|
327
|
-
token,
|
340
|
+
token: currency,
|
328
341
|
networkType,
|
329
342
|
});
|
330
343
|
|
331
344
|
console.log({ contract_address, rpcUrl });
|
332
345
|
|
333
|
-
console.log("Checking for Token @ ", networkType, contract_address, token);
|
346
|
+
console.log("Checking for Token @ ", currency, networkType, contract_address, token);
|
334
347
|
|
335
348
|
if (["ETH", "BNB", "MATIC"].includes(networkType)) {
|
336
349
|
const key = networkType == "ETH" ? ETH_KEY : networkType == "BNB" ? BNB_KEY : MATIC_KEY;
|
@@ -353,7 +366,7 @@ const SellAdminCryptoAccount = ({
|
|
353
366
|
token,
|
354
367
|
startTimestamp,
|
355
368
|
contract_address,
|
356
|
-
|
369
|
+
expected_amount
|
357
370
|
);
|
358
371
|
} catch (error) {
|
359
372
|
console.error("Error fetching token transactions:", error);
|
@@ -414,7 +427,6 @@ const SellAdminCryptoAccount = ({
|
|
414
427
|
// setMonitoring(false);
|
415
428
|
// setAutomaticHash(false);
|
416
429
|
// };
|
417
|
-
|
418
430
|
return (
|
419
431
|
<>
|
420
432
|
<div className={css.sell_payment_details_wrap}>
|
@@ -44,7 +44,7 @@ export type tokenSellDataType = {
|
|
44
44
|
// Sell Crypto and receive Fiat
|
45
45
|
const SellField = ({ apiKey, parameters, clientReferenceID, css, mode }: SellFieldProps) => {
|
46
46
|
const { addToast } = useToast(); // to show toast
|
47
|
-
const exchangeSocket: any = useExchangeSocket({}); // socket connevction to fetch exchange rate
|
47
|
+
const exchangeSocket: any = useExchangeSocket({ mode }); // socket connevction to fetch exchange rate
|
48
48
|
|
49
49
|
const [step, setStep] = useState(1); // used to render components
|
50
50
|
|
@@ -494,7 +494,7 @@ const SellField = ({ apiKey, parameters, clientReferenceID, css, mode }: SellFie
|
|
494
494
|
<div className={css.gilde_field_select}>
|
495
495
|
{cryptoCurrencyOptions?.length > 0 ? (
|
496
496
|
<CustomSelect
|
497
|
-
backgroundColor="#
|
497
|
+
backgroundColor="#fff"
|
498
498
|
placeholder="Select"
|
499
499
|
image={true}
|
500
500
|
singleicons={true}
|
@@ -626,7 +626,7 @@ const SellField = ({ apiKey, parameters, clientReferenceID, css, mode }: SellFie
|
|
626
626
|
<div className={css.gilde_field_select}>
|
627
627
|
{fiatCurrencyOptions?.length > 0 ? (
|
628
628
|
<CustomSelect
|
629
|
-
backgroundColor="#
|
629
|
+
backgroundColor="#fff"
|
630
630
|
placeholder="Select"
|
631
631
|
borderColor="var(--no-color)"
|
632
632
|
image={true}
|
@@ -20,9 +20,6 @@ const WidgetComponent = ({
|
|
20
20
|
}: WidgetComponentProps) => {
|
21
21
|
return (
|
22
22
|
<div style={{ position: "relative" }} className={css.widget_component} id="widget-container">
|
23
|
-
<div className={css.gilde_widget_wrapped}>
|
24
|
-
<div className={css.gilde_widget_modal}>
|
25
|
-
<div className={css.gilde_widget_content}>
|
26
23
|
<ToastProvider>
|
27
24
|
<WidgetContent
|
28
25
|
sellParameters={sellParameters}
|
@@ -33,9 +30,6 @@ const WidgetComponent = ({
|
|
33
30
|
/>
|
34
31
|
</ToastProvider>
|
35
32
|
</div>
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
</div>
|
39
33
|
);
|
40
34
|
};
|
41
35
|
|
@@ -19,8 +19,6 @@ const WidgetContent = ({
|
|
19
19
|
}: WidgetContentProps) => {
|
20
20
|
// const [activeTab, setActiveTab] = useState("sell");
|
21
21
|
return (
|
22
|
-
<div className={css.gilde_tabs_wrapped}>
|
23
|
-
<div className={css.gilde_tabs_content}>
|
24
22
|
<SellField
|
25
23
|
apiKey={apiKey}
|
26
24
|
parameters={sellParameters}
|
@@ -28,8 +26,6 @@ const WidgetContent = ({
|
|
28
26
|
css={css}
|
29
27
|
mode={mode}
|
30
28
|
/>
|
31
|
-
</div>
|
32
|
-
</div>
|
33
29
|
);
|
34
30
|
};
|
35
31
|
|
@@ -2,21 +2,32 @@
|
|
2
2
|
import { useEffect, useRef } from "react";
|
3
3
|
import { io } from "socket.io-client";
|
4
4
|
|
5
|
-
const
|
5
|
+
const getSocketUrl = (mode: string) => {
|
6
|
+
if (mode === "production") {
|
7
|
+
return "https://woowga-node.herald.exchange:9001/";
|
8
|
+
} else {
|
9
|
+
return "https://efi-exchange.blockstall.com:9001/";
|
10
|
+
}
|
11
|
+
};
|
12
|
+
|
6
13
|
let socket: any = null;
|
7
14
|
let refCount = 0;
|
8
15
|
|
9
16
|
export const useExchangeSocket = ({
|
10
17
|
onConnectCallback,
|
11
18
|
onDisconnectCallback,
|
19
|
+
mode,
|
12
20
|
}: {
|
13
21
|
onConnectCallback?: () => void;
|
14
22
|
onDisconnectCallback?: () => void;
|
23
|
+
mode: string;
|
15
24
|
}) => {
|
16
25
|
const socketRef = useRef(null);
|
17
26
|
|
18
27
|
useEffect(() => {
|
19
28
|
refCount += 1;
|
29
|
+
const socketUrl = getSocketUrl(mode);
|
30
|
+
|
20
31
|
if (!socket) {
|
21
32
|
socket = io(socketUrl, {
|
22
33
|
transports: ["websocket"],
|