@velora-dex/widget 0.3.11 → 0.3.12
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/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +183 -133
- package/dist/core/index.js.map +1 -1
- package/dist/core/state/apiConfigAtom.d.ts +14 -0
- package/dist/core/state/apiConfigAtom.d.ts.map +1 -0
- package/dist/core/state/apiConfigAtom.js +20 -0
- package/dist/core/state/apiConfigAtom.js.map +1 -0
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.js +69 -65
- package/dist/hooks/swap/prices/useSwapPrices.js.map +1 -1
- package/dist/hooks/useSDK.d.ts.map +1 -1
- package/dist/hooks/useSDK.js +32 -19
- package/dist/hooks/useSDK.js.map +1 -1
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +18 -1
- package/dist/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { WidgetProps } from './types';
|
|
2
|
-
export declare const Widget: ({ config, provider, events, input }: WidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Widget: ({ config, apiConfig, provider, events, input, }: WidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.tsx"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAiB7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA4V3C,eAAO,MAAM,MAAM,GAAI,iDAMpB,WAAW,4CAcb,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -70,6 +70,7 @@ import { isBridgePrice } from '../hooks/swap/prices/delta/queries/useDeltaPriceQ
|
|
|
70
70
|
import { BridgeSelectorExpandable } from '../components/widget/BridgeSelectorExpandable/BridgeSelectorExpandable.js';
|
|
71
71
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
72
72
|
import { useInitialValue } from './screen/hooks/useInitialValue.js';
|
|
73
|
+
import { apiConfigAtom } from './state/apiConfigAtom.js';
|
|
73
74
|
|
|
74
75
|
runSubscriptions();
|
|
75
76
|
const SwapScreen = () => {
|
|
@@ -279,9 +280,10 @@ const App = () => {
|
|
|
279
280
|
return t2;
|
|
280
281
|
};
|
|
281
282
|
const WidgetBase = (t0) => {
|
|
282
|
-
const $ = distExports.c(
|
|
283
|
+
const $ = distExports.c(86);
|
|
283
284
|
const {
|
|
284
285
|
config: _config,
|
|
286
|
+
apiConfig,
|
|
285
287
|
provider,
|
|
286
288
|
events,
|
|
287
289
|
input: formInputProps
|
|
@@ -289,6 +291,7 @@ const WidgetBase = (t0) => {
|
|
|
289
291
|
const queryClient = useQueryClient();
|
|
290
292
|
const setWidgetConfig = useSetAtom(setWidgetConfigAtom);
|
|
291
293
|
const setSubConfig = useSetAtom(setSubConfigAtom);
|
|
294
|
+
const setApiConfig = useSetAtom(apiConfigAtom);
|
|
292
295
|
let t1;
|
|
293
296
|
if ($[0] !== _config) {
|
|
294
297
|
t1 = _config || {};
|
|
@@ -369,84 +372,101 @@ const WidgetBase = (t0) => {
|
|
|
369
372
|
} else {
|
|
370
373
|
t3 = $[20];
|
|
371
374
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
$[
|
|
377
|
-
$[22] = t5;
|
|
375
|
+
let t4;
|
|
376
|
+
if ($[21] !== apiConfig) {
|
|
377
|
+
t4 = apiConfig || {};
|
|
378
|
+
$[21] = apiConfig;
|
|
379
|
+
$[22] = t4;
|
|
378
380
|
} else {
|
|
379
|
-
|
|
381
|
+
t4 = $[22];
|
|
380
382
|
}
|
|
381
|
-
let
|
|
382
|
-
if ($[23] !==
|
|
383
|
-
|
|
384
|
-
$[23] =
|
|
385
|
-
$[24] =
|
|
383
|
+
let t5;
|
|
384
|
+
if ($[23] !== t4) {
|
|
385
|
+
t5 = [apiConfigAtom, t4];
|
|
386
|
+
$[23] = t4;
|
|
387
|
+
$[24] = t5;
|
|
386
388
|
} else {
|
|
387
|
-
|
|
389
|
+
t5 = $[24];
|
|
388
390
|
}
|
|
391
|
+
const t6 = provider || null;
|
|
389
392
|
let t7;
|
|
390
393
|
if ($[25] !== t6) {
|
|
391
|
-
t7 = [
|
|
394
|
+
t7 = [externalProviderAtom, t6];
|
|
392
395
|
$[25] = t6;
|
|
393
396
|
$[26] = t7;
|
|
394
397
|
} else {
|
|
395
398
|
t7 = $[26];
|
|
396
399
|
}
|
|
397
400
|
let t8;
|
|
398
|
-
if ($[27] !==
|
|
399
|
-
t8 =
|
|
400
|
-
$[27] =
|
|
401
|
+
if ($[27] !== events) {
|
|
402
|
+
t8 = events || {};
|
|
403
|
+
$[27] = events;
|
|
401
404
|
$[28] = t8;
|
|
402
405
|
} else {
|
|
403
406
|
t8 = $[28];
|
|
404
407
|
}
|
|
405
408
|
let t9;
|
|
406
409
|
if ($[29] !== t8) {
|
|
407
|
-
t9 = [
|
|
410
|
+
t9 = [widgetEventsAtom, t8];
|
|
408
411
|
$[29] = t8;
|
|
409
412
|
$[30] = t9;
|
|
410
413
|
} else {
|
|
411
414
|
t9 = $[30];
|
|
412
415
|
}
|
|
413
416
|
let t10;
|
|
414
|
-
if ($[31] !==
|
|
415
|
-
t10 =
|
|
416
|
-
$[31] =
|
|
417
|
+
if ($[31] !== formInputProps) {
|
|
418
|
+
t10 = formInputProps || {};
|
|
419
|
+
$[31] = formInputProps;
|
|
417
420
|
$[32] = t10;
|
|
418
421
|
} else {
|
|
419
422
|
t10 = $[32];
|
|
420
423
|
}
|
|
421
424
|
let t11;
|
|
422
|
-
if ($[33] !== t10
|
|
423
|
-
t11 = [
|
|
425
|
+
if ($[33] !== t10) {
|
|
426
|
+
t11 = [formInputPropsAtom, t10];
|
|
424
427
|
$[33] = t10;
|
|
425
|
-
$[34] =
|
|
426
|
-
$[35] = t3;
|
|
427
|
-
$[36] = t5;
|
|
428
|
-
$[37] = t7;
|
|
429
|
-
$[38] = t9;
|
|
430
|
-
$[39] = t11;
|
|
428
|
+
$[34] = t11;
|
|
431
429
|
} else {
|
|
432
|
-
t11 = $[
|
|
430
|
+
t11 = $[34];
|
|
433
431
|
}
|
|
434
432
|
let t12;
|
|
435
|
-
if ($[
|
|
436
|
-
t12 =
|
|
433
|
+
if ($[35] !== queryClient) {
|
|
434
|
+
t12 = [queryClientAtom, queryClient];
|
|
435
|
+
$[35] = queryClient;
|
|
436
|
+
$[36] = t12;
|
|
437
|
+
} else {
|
|
438
|
+
t12 = $[36];
|
|
439
|
+
}
|
|
440
|
+
let t13;
|
|
441
|
+
if ($[37] !== t11 || $[38] !== t12 || $[39] !== t2 || $[40] !== t3 || $[41] !== t5 || $[42] !== t7 || $[43] !== t9) {
|
|
442
|
+
t13 = [t2, t3, t5, t7, t9, t11, t12];
|
|
443
|
+
$[37] = t11;
|
|
444
|
+
$[38] = t12;
|
|
445
|
+
$[39] = t2;
|
|
446
|
+
$[40] = t3;
|
|
447
|
+
$[41] = t5;
|
|
448
|
+
$[42] = t7;
|
|
449
|
+
$[43] = t9;
|
|
450
|
+
$[44] = t13;
|
|
451
|
+
} else {
|
|
452
|
+
t13 = $[44];
|
|
453
|
+
}
|
|
454
|
+
let t14;
|
|
455
|
+
if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
|
|
456
|
+
t14 = {
|
|
437
457
|
store: jotaiStore
|
|
438
458
|
};
|
|
439
|
-
$[
|
|
459
|
+
$[45] = t14;
|
|
440
460
|
} else {
|
|
441
|
-
|
|
461
|
+
t14 = $[45];
|
|
442
462
|
}
|
|
443
|
-
useHydrateAtoms(
|
|
463
|
+
useHydrateAtoms(t13, t14);
|
|
444
464
|
useWidgetEventsSetter(events);
|
|
445
465
|
useSetFormInputFromProps(formInputProps);
|
|
446
|
-
let
|
|
447
|
-
let
|
|
448
|
-
if ($[
|
|
449
|
-
|
|
466
|
+
let t15;
|
|
467
|
+
let t16;
|
|
468
|
+
if ($[46] !== config.debug || $[47] !== config.enableCrossChain || $[48] !== config.enableDelta || $[49] !== config.ignoreBadUsdPrice || $[50] !== config.privyAppId || $[51] !== config.privyClientId || $[52] !== config.theme || $[53] !== config.widgetMode || $[54] !== setWidgetConfig) {
|
|
469
|
+
t15 = () => {
|
|
450
470
|
setWidgetConfig({
|
|
451
471
|
theme: config.theme,
|
|
452
472
|
enableDelta: config.enableDelta,
|
|
@@ -458,27 +478,27 @@ const WidgetBase = (t0) => {
|
|
|
458
478
|
ignoreBadUsdPrice: config.ignoreBadUsdPrice
|
|
459
479
|
});
|
|
460
480
|
};
|
|
461
|
-
|
|
462
|
-
$[
|
|
463
|
-
$[
|
|
464
|
-
$[
|
|
465
|
-
$[
|
|
466
|
-
$[
|
|
467
|
-
$[
|
|
468
|
-
$[
|
|
469
|
-
$[
|
|
470
|
-
$[
|
|
471
|
-
$[
|
|
472
|
-
$[
|
|
473
|
-
} else {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
useLayoutEffect(
|
|
478
|
-
let
|
|
479
|
-
let
|
|
480
|
-
if ($[
|
|
481
|
-
|
|
481
|
+
t16 = [config.theme, config.enableDelta, config.enableCrossChain, config.privyAppId, config.privyClientId, config.debug, config.widgetMode, config.ignoreBadUsdPrice, setWidgetConfig];
|
|
482
|
+
$[46] = config.debug;
|
|
483
|
+
$[47] = config.enableCrossChain;
|
|
484
|
+
$[48] = config.enableDelta;
|
|
485
|
+
$[49] = config.ignoreBadUsdPrice;
|
|
486
|
+
$[50] = config.privyAppId;
|
|
487
|
+
$[51] = config.privyClientId;
|
|
488
|
+
$[52] = config.theme;
|
|
489
|
+
$[53] = config.widgetMode;
|
|
490
|
+
$[54] = setWidgetConfig;
|
|
491
|
+
$[55] = t15;
|
|
492
|
+
$[56] = t16;
|
|
493
|
+
} else {
|
|
494
|
+
t15 = $[55];
|
|
495
|
+
t16 = $[56];
|
|
496
|
+
}
|
|
497
|
+
useLayoutEffect(t15, t16);
|
|
498
|
+
let t17;
|
|
499
|
+
let t18;
|
|
500
|
+
if ($[57] !== destChains || $[58] !== devURLs || $[59] !== excludeUI || $[60] !== partnerConfig || $[61] !== setSubConfig || $[62] !== srcChains || $[63] !== tokenLists || $[64] !== tradeModes) {
|
|
501
|
+
t17 = () => {
|
|
482
502
|
setSubConfig({
|
|
483
503
|
srcChains,
|
|
484
504
|
destChains,
|
|
@@ -489,98 +509,128 @@ const WidgetBase = (t0) => {
|
|
|
489
509
|
partnerConfig
|
|
490
510
|
});
|
|
491
511
|
};
|
|
492
|
-
|
|
493
|
-
$[
|
|
494
|
-
$[
|
|
495
|
-
$[
|
|
496
|
-
$[
|
|
497
|
-
$[
|
|
498
|
-
$[
|
|
499
|
-
$[
|
|
500
|
-
$[
|
|
501
|
-
$[
|
|
502
|
-
$[
|
|
503
|
-
} else {
|
|
504
|
-
|
|
505
|
-
|
|
512
|
+
t18 = [srcChains, destChains, tokenLists, setSubConfig, tradeModes, excludeUI, devURLs, partnerConfig];
|
|
513
|
+
$[57] = destChains;
|
|
514
|
+
$[58] = devURLs;
|
|
515
|
+
$[59] = excludeUI;
|
|
516
|
+
$[60] = partnerConfig;
|
|
517
|
+
$[61] = setSubConfig;
|
|
518
|
+
$[62] = srcChains;
|
|
519
|
+
$[63] = tokenLists;
|
|
520
|
+
$[64] = tradeModes;
|
|
521
|
+
$[65] = t17;
|
|
522
|
+
$[66] = t18;
|
|
523
|
+
} else {
|
|
524
|
+
t17 = $[65];
|
|
525
|
+
t18 = $[66];
|
|
506
526
|
}
|
|
507
|
-
useLayoutEffect(
|
|
527
|
+
useLayoutEffect(t17, t18);
|
|
528
|
+
let t19;
|
|
529
|
+
if ($[67] !== apiConfig?.apiKey || $[68] !== apiConfig?.headers || $[69] !== setApiConfig) {
|
|
530
|
+
t19 = () => {
|
|
531
|
+
setApiConfig({
|
|
532
|
+
apiKey: apiConfig?.apiKey,
|
|
533
|
+
headers: apiConfig?.headers
|
|
534
|
+
});
|
|
535
|
+
};
|
|
536
|
+
$[67] = apiConfig?.apiKey;
|
|
537
|
+
$[68] = apiConfig?.headers;
|
|
538
|
+
$[69] = setApiConfig;
|
|
539
|
+
$[70] = t19;
|
|
540
|
+
} else {
|
|
541
|
+
t19 = $[70];
|
|
542
|
+
}
|
|
543
|
+
const t20 = apiConfig?.apiKey;
|
|
544
|
+
const t21 = apiConfig?.headers;
|
|
545
|
+
let t22;
|
|
546
|
+
if ($[71] !== setApiConfig || $[72] !== t20 || $[73] !== t21) {
|
|
547
|
+
t22 = [t20, t21, setApiConfig];
|
|
548
|
+
$[71] = setApiConfig;
|
|
549
|
+
$[72] = t20;
|
|
550
|
+
$[73] = t21;
|
|
551
|
+
$[74] = t22;
|
|
552
|
+
} else {
|
|
553
|
+
t22 = $[74];
|
|
554
|
+
}
|
|
555
|
+
useLayoutEffect(t19, t22);
|
|
508
556
|
const setExternalProvider = useSetAtom(externalProviderAtom);
|
|
509
|
-
let
|
|
510
|
-
let
|
|
511
|
-
if ($[
|
|
512
|
-
|
|
557
|
+
let t23;
|
|
558
|
+
let t24;
|
|
559
|
+
if ($[75] !== provider || $[76] !== setExternalProvider) {
|
|
560
|
+
t23 = () => {
|
|
513
561
|
setExternalProvider(provider || null);
|
|
514
562
|
};
|
|
515
|
-
|
|
516
|
-
$[
|
|
517
|
-
$[
|
|
518
|
-
$[
|
|
519
|
-
$[
|
|
563
|
+
t24 = [provider, setExternalProvider];
|
|
564
|
+
$[75] = provider;
|
|
565
|
+
$[76] = setExternalProvider;
|
|
566
|
+
$[77] = t23;
|
|
567
|
+
$[78] = t24;
|
|
520
568
|
} else {
|
|
521
|
-
|
|
522
|
-
|
|
569
|
+
t23 = $[77];
|
|
570
|
+
t24 = $[78];
|
|
523
571
|
}
|
|
524
|
-
useLayoutEffect(
|
|
572
|
+
useLayoutEffect(t23, t24);
|
|
525
573
|
const isDappMode = config?.widgetMode === "dapp";
|
|
526
574
|
const reconnectOnMountInit = useInitialValue(!isDappMode);
|
|
527
|
-
let
|
|
528
|
-
let
|
|
529
|
-
let
|
|
530
|
-
let
|
|
531
|
-
let
|
|
532
|
-
if ($[
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
$[
|
|
539
|
-
$[
|
|
540
|
-
$[
|
|
541
|
-
$[
|
|
542
|
-
$[
|
|
543
|
-
} else {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
let
|
|
551
|
-
if ($[
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
575
|
+
let t25;
|
|
576
|
+
let t26;
|
|
577
|
+
let t27;
|
|
578
|
+
let t28;
|
|
579
|
+
let t29;
|
|
580
|
+
if ($[79] === Symbol.for("react.memo_cache_sentinel")) {
|
|
581
|
+
t25 = /* @__PURE__ */ jsx(AutoconnectExternalProvider, {});
|
|
582
|
+
t26 = /* @__PURE__ */ jsx(PrivyIframeDependency, {});
|
|
583
|
+
t27 = /* @__PURE__ */ jsx(Updaters, {});
|
|
584
|
+
t28 = /* @__PURE__ */ jsx(App, {});
|
|
585
|
+
t29 = false;
|
|
586
|
+
$[79] = t25;
|
|
587
|
+
$[80] = t26;
|
|
588
|
+
$[81] = t27;
|
|
589
|
+
$[82] = t28;
|
|
590
|
+
$[83] = t29;
|
|
591
|
+
} else {
|
|
592
|
+
t25 = $[79];
|
|
593
|
+
t26 = $[80];
|
|
594
|
+
t27 = $[81];
|
|
595
|
+
t28 = $[82];
|
|
596
|
+
t29 = $[83];
|
|
597
|
+
}
|
|
598
|
+
let t30;
|
|
599
|
+
if ($[84] !== reconnectOnMountInit) {
|
|
600
|
+
t30 = /* @__PURE__ */ jsxs(Web3Providers, { reconnectOnMount: reconnectOnMountInit, children: [
|
|
601
|
+
t25,
|
|
602
|
+
t26,
|
|
603
|
+
t27,
|
|
604
|
+
t28,
|
|
605
|
+
t29
|
|
558
606
|
] });
|
|
559
|
-
$[
|
|
560
|
-
$[
|
|
607
|
+
$[84] = reconnectOnMountInit;
|
|
608
|
+
$[85] = t30;
|
|
561
609
|
} else {
|
|
562
|
-
|
|
610
|
+
t30 = $[85];
|
|
563
611
|
}
|
|
564
|
-
return
|
|
612
|
+
return t30;
|
|
565
613
|
};
|
|
566
614
|
const Widget = (t0) => {
|
|
567
|
-
const $ = distExports.c(
|
|
615
|
+
const $ = distExports.c(6);
|
|
568
616
|
const {
|
|
569
617
|
config,
|
|
618
|
+
apiConfig,
|
|
570
619
|
provider,
|
|
571
620
|
events,
|
|
572
621
|
input
|
|
573
622
|
} = t0;
|
|
574
623
|
let t1;
|
|
575
|
-
if ($[0] !==
|
|
576
|
-
t1 = /* @__PURE__ */ jsx(JotaiProvider, { children: /* @__PURE__ */ jsx(QueryClientProvider, { children: /* @__PURE__ */ jsx(WidgetBase, { config, provider, events, input }) }) });
|
|
577
|
-
$[0] =
|
|
578
|
-
$[1] =
|
|
579
|
-
$[2] =
|
|
580
|
-
$[3] =
|
|
581
|
-
$[4] =
|
|
582
|
-
|
|
583
|
-
|
|
624
|
+
if ($[0] !== apiConfig || $[1] !== config || $[2] !== events || $[3] !== input || $[4] !== provider) {
|
|
625
|
+
t1 = /* @__PURE__ */ jsx(JotaiProvider, { children: /* @__PURE__ */ jsx(QueryClientProvider, { children: /* @__PURE__ */ jsx(WidgetBase, { config, apiConfig, provider, events, input }) }) });
|
|
626
|
+
$[0] = apiConfig;
|
|
627
|
+
$[1] = config;
|
|
628
|
+
$[2] = events;
|
|
629
|
+
$[3] = input;
|
|
630
|
+
$[4] = provider;
|
|
631
|
+
$[5] = t1;
|
|
632
|
+
} else {
|
|
633
|
+
t1 = $[5];
|
|
584
634
|
}
|
|
585
635
|
return t1;
|
|
586
636
|
};
|