@skip-go/widget 2.4.4 → 2.4.6
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/build/hooks/use-swap-widget.d.ts +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.es.js +2 -51
- package/build/index.es.js.map +1 -1
- package/package.json +2 -6
- package/build/ui/WebComponent.d.ts +0 -16
|
@@ -31,7 +31,7 @@ export declare function useSwapWidget(persistSwapWidgetState?: boolean): {
|
|
|
31
31
|
onSourceAssetChange: (asset: Asset) => void;
|
|
32
32
|
onSourceChainChange: (chain: Chain, injectAsset?: Asset) => Promise<void>;
|
|
33
33
|
priceImpactThresholdReached: boolean;
|
|
34
|
-
route: import("@skip-go/client/dist/shared-
|
|
34
|
+
route: import("@skip-go/client/dist/shared-D1dMlI_1").R | undefined;
|
|
35
35
|
routeError: string;
|
|
36
36
|
routeLoading: boolean;
|
|
37
37
|
routeWarningMessage: string | undefined;
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { SwapWidgetProvider, SwapWidgetProviderProps } from './provider';
|
|
2
2
|
export { SwapWidget, SwapWidgetProps, SwapWidgetWithoutProviders, SwapWidgetWithoutProvidersProps, } from './ui';
|
|
3
|
-
export { initializeSwapWidget } from './ui/WebComponent';
|
|
4
3
|
export { useAssets } from './provider/assets';
|
|
5
4
|
export { useChains, useChainByID } from './hooks/use-chains';
|
|
6
5
|
export { MinimalWallet } from './hooks/use-make-wallets';
|
package/build/index.es.js
CHANGED
|
@@ -2219,19 +2219,8 @@ function useSwapWidget(persistSwapWidgetState = true) {
|
|
|
2219
2219
|
const destinationChainIDs = (filter === null || filter === void 0 ? void 0 : filter.destination)
|
|
2220
2220
|
? Object.keys(filter.destination)
|
|
2221
2221
|
: undefined;
|
|
2222
|
-
const allChainIDs = useMemo(() => {
|
|
2223
|
-
return [...(sourceChainIDs !== null && sourceChainIDs !== void 0 ? sourceChainIDs : []), ...(destinationChainIDs !== null && destinationChainIDs !== void 0 ? destinationChainIDs : [])];
|
|
2224
|
-
}, [sourceChainIDs, destinationChainIDs]);
|
|
2225
2222
|
const { assetsByChainID, getFeeAsset, isReady: isAssetsReady, getAsset, } = useAssets();
|
|
2226
|
-
const { data: chains } = useChains(
|
|
2227
|
-
select: (chains) => {
|
|
2228
|
-
if (allChainIDs.length === 0)
|
|
2229
|
-
return chains;
|
|
2230
|
-
return chains === null || chains === void 0 ? void 0 : chains.filter(({ chainID }) => {
|
|
2231
|
-
return allChainIDs.includes(chainID);
|
|
2232
|
-
});
|
|
2233
|
-
},
|
|
2234
|
-
});
|
|
2223
|
+
const { data: chains } = useChains();
|
|
2235
2224
|
const { getWalletRepo } = useManager();
|
|
2236
2225
|
const { connector, chain: evmChain } = useAccount$1();
|
|
2237
2226
|
const { switchChainAsync: switchNetworkAsync } = useSwitchChain({
|
|
@@ -5630,43 +5619,5 @@ const SwapWidget = ({ settings, onlyTestnet, defaultRoute, routeConfig, theme, c
|
|
|
5630
5619
|
return (jsx(WithStyledShadowDom, { children: jsx(ThemeProvider, { theme: mergedThemes, children: jsx(SwapWidgetProvider, { ...swapWidgetProviderProps, children: jsx(SwapWidgetUI, { className: className, style: style, toasterProps: toasterProps, persistSwapWidgetState: persistSwapWidgetState }) }) }) }));
|
|
5631
5620
|
};
|
|
5632
5621
|
|
|
5633
|
-
|
|
5634
|
-
try {
|
|
5635
|
-
JSON.parse(str);
|
|
5636
|
-
}
|
|
5637
|
-
catch (e) {
|
|
5638
|
-
return false;
|
|
5639
|
-
}
|
|
5640
|
-
return true;
|
|
5641
|
-
}
|
|
5642
|
-
const camelize = (inputString) => inputString.replace(/-./g, (x) => x[1].toUpperCase());
|
|
5643
|
-
const WidgetWithProvider = (props) => {
|
|
5644
|
-
// @ts-ignore
|
|
5645
|
-
const parsedProps = Array.from(props.container.attributes).map(({ name, value }) => {
|
|
5646
|
-
return { key: name, value };
|
|
5647
|
-
});
|
|
5648
|
-
const realProps = parsedProps.reduce((accumulator, initialValue) => {
|
|
5649
|
-
const { key, value } = initialValue;
|
|
5650
|
-
accumulator[camelize(key)] = isJsonString(value)
|
|
5651
|
-
? JSON.parse(value)
|
|
5652
|
-
: value;
|
|
5653
|
-
return accumulator;
|
|
5654
|
-
}, {});
|
|
5655
|
-
return jsx(SwapWidget, { ...realProps });
|
|
5656
|
-
};
|
|
5657
|
-
const WEB_COMPONENT_NAME = 'skip-widget';
|
|
5658
|
-
let initialized = false;
|
|
5659
|
-
const initializeSwapWidget = () => {
|
|
5660
|
-
if (!initialized && typeof window !== 'undefined') {
|
|
5661
|
-
import('@r2wc/react-to-web-component').then(({ default: ReactToWebComponent }) => {
|
|
5662
|
-
const WebComponent = ReactToWebComponent(WidgetWithProvider);
|
|
5663
|
-
if (!customElements.get(WEB_COMPONENT_NAME)) {
|
|
5664
|
-
customElements.define(WEB_COMPONENT_NAME, WebComponent);
|
|
5665
|
-
}
|
|
5666
|
-
initialized = true;
|
|
5667
|
-
});
|
|
5668
|
-
}
|
|
5669
|
-
};
|
|
5670
|
-
|
|
5671
|
-
export { SwapWidget, SwapWidgetProvider, SwapWidgetWithoutProviders, initializeSwapWidget, useAssets, useChainByID, useChains };
|
|
5622
|
+
export { SwapWidget, SwapWidgetProvider, SwapWidgetWithoutProviders, useAssets, useChainByID, useChains };
|
|
5672
5623
|
//# sourceMappingURL=index.es.js.map
|