@lifi/widget 1.16.0 → 1.16.1
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/AppProvider.d.ts +0 -4
- package/AppProvider.js +2 -10
- package/cjs/AppProvider.d.ts +0 -4
- package/cjs/AppProvider.js +3 -12
- package/cjs/components/AppContainer.js +2 -2
- package/cjs/components/SelectChainAndToken.js +5 -5
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChains.js +4 -4
- package/cjs/hooks/useFeaturedTokens.js +2 -2
- package/cjs/hooks/useGasSufficiency.js +6 -7
- package/cjs/hooks/useInitializer.js +6 -0
- package/cjs/hooks/useRouteExecution.js +7 -7
- package/cjs/hooks/useSwapRoutes.js +10 -11
- package/cjs/hooks/useTokenBalances.js +4 -4
- package/cjs/hooks/useTokenSearch.js +3 -2
- package/cjs/hooks/useTokens.js +3 -2
- package/cjs/hooks/useTools.js +3 -2
- package/cjs/providers/SDKProvider/SDKProvider.d.ts +4 -0
- package/cjs/providers/SDKProvider/SDKProvider.js +27 -0
- package/cjs/providers/SDKProvider/index.d.ts +1 -0
- package/cjs/providers/SDKProvider/index.js +17 -0
- package/cjs/providers/TelemetryProvider/TelemetryProvider.d.ts +4 -0
- package/cjs/providers/TelemetryProvider/TelemetryProvider.js +11 -0
- package/cjs/providers/TelemetryProvider/index.d.ts +1 -0
- package/cjs/providers/TelemetryProvider/index.js +17 -0
- package/cjs/providers/WalletProvider/WalletProvider.d.ts +1 -4
- package/cjs/providers/WalletProvider/WalletProvider.js +3 -1
- package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -12
- package/cjs/providers/index.d.ts +2 -0
- package/cjs/providers/index.js +2 -0
- package/cjs/utils/colors.d.ts +1 -1
- package/components/AppContainer.js +1 -1
- package/components/SelectChainAndToken.js +1 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChains.js +3 -3
- package/hooks/useFeaturedTokens.js +1 -1
- package/hooks/useGasSufficiency.js +1 -2
- package/hooks/useInitializer.js +6 -0
- package/hooks/useRouteExecution.js +6 -6
- package/hooks/useSwapRoutes.js +3 -4
- package/hooks/useTokenBalances.js +3 -3
- package/hooks/useTokenSearch.js +3 -2
- package/hooks/useTokens.js +3 -2
- package/hooks/useTools.js +3 -2
- package/package.json +1 -1
- package/providers/SDKProvider/SDKProvider.d.ts +4 -0
- package/providers/SDKProvider/SDKProvider.js +19 -0
- package/providers/SDKProvider/index.d.ts +1 -0
- package/providers/SDKProvider/index.js +1 -0
- package/providers/TelemetryProvider/TelemetryProvider.d.ts +4 -0
- package/providers/TelemetryProvider/TelemetryProvider.js +7 -0
- package/providers/TelemetryProvider/index.d.ts +1 -0
- package/providers/TelemetryProvider/index.js +1 -0
- package/providers/WalletProvider/WalletProvider.d.ts +1 -4
- package/providers/WalletProvider/WalletProvider.js +3 -1
- package/providers/WidgetProvider/WidgetProvider.js +3 -14
- package/providers/index.d.ts +2 -0
- package/providers/index.js +2 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/utils/colors.d.ts +1 -1
- package/cjs/config/lifi.d.ts +0 -4
- package/cjs/config/lifi.js +0 -14
- package/config/lifi.d.ts +0 -4
- package/config/lifi.js +0 -7
package/hooks/useChains.js
CHANGED
|
@@ -9,14 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { useQuery } from '@tanstack/react-query';
|
|
11
11
|
import { useCallback } from 'react';
|
|
12
|
-
import {
|
|
13
|
-
import { useWidgetConfig } from '../providers/WidgetProvider';
|
|
12
|
+
import { useLiFi, useWidgetConfig } from '../providers';
|
|
14
13
|
import { useSetChainOrder } from '../stores/chains';
|
|
15
14
|
export const useChains = () => {
|
|
16
15
|
const { disabledChains } = useWidgetConfig();
|
|
16
|
+
const lifi = useLiFi();
|
|
17
17
|
const [, initializeChains] = useSetChainOrder();
|
|
18
18
|
const { data, isLoading } = useQuery(['chains'], () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
-
const chains = yield
|
|
19
|
+
const chains = yield lifi.getChains();
|
|
20
20
|
const filteredChains = chains.filter((chain) => !(disabledChains === null || disabledChains === void 0 ? void 0 : disabledChains.includes(chain.id)));
|
|
21
21
|
initializeChains(filteredChains.map((chain) => chain.id));
|
|
22
22
|
return filteredChains;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { useWidgetConfig } from '../providers
|
|
2
|
+
import { useWidgetConfig } from '../providers';
|
|
3
3
|
export const useFeaturedTokens = (selectedChainId) => {
|
|
4
4
|
const { featuredTokens } = useWidgetConfig();
|
|
5
5
|
return useMemo(() => featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.filter((token) => token.chainId === selectedChainId), [featuredTokens, selectedChainId]);
|
|
@@ -2,8 +2,7 @@ import Big from 'big.js';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { useWatch } from 'react-hook-form';
|
|
4
4
|
import { useChains, useDebouncedWatch } from '.';
|
|
5
|
-
import { SwapFormKey, SwapFormKeyHelper } from '../providers
|
|
6
|
-
import { useWallet } from '../providers/WalletProvider';
|
|
5
|
+
import { SwapFormKey, SwapFormKeyHelper, useWallet } from '../providers';
|
|
7
6
|
import { useTokenBalances } from './useTokenBalances';
|
|
8
7
|
export const useGasSufficiency = (route) => {
|
|
9
8
|
const { account } = useWallet();
|
package/hooks/useInitializer.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
|
+
import { checkPackageUpdates } from '@lifi/sdk';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { name, version } from '../config/version';
|
|
2
5
|
import { useTools } from './useTools';
|
|
3
6
|
export const useInitializer = () => {
|
|
4
7
|
useTools();
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
checkPackageUpdates(name, version);
|
|
10
|
+
}, []);
|
|
5
11
|
};
|
|
@@ -10,13 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { useMutation } from '@tanstack/react-query';
|
|
11
11
|
import { useCallback, useEffect, useRef } from 'react';
|
|
12
12
|
import shallow from 'zustand/shallow';
|
|
13
|
-
import {
|
|
14
|
-
import { useWallet } from '../providers/WalletProvider';
|
|
13
|
+
import { useLiFi, useWallet } from '../providers';
|
|
15
14
|
import { isRouteActive, isRouteCompleted, isRouteFailed, useRouteStore, } from '../stores';
|
|
16
15
|
import { WidgetEvent } from '../types/events';
|
|
17
16
|
import { deepClone } from '../utils';
|
|
18
17
|
import { useWidgetEvents } from './useWidgetEvents';
|
|
19
18
|
export const useRouteExecution = (routeId, executeInBackground) => {
|
|
19
|
+
const lifi = useLiFi();
|
|
20
20
|
const { account, switchChain } = useWallet();
|
|
21
21
|
const resumedAfterMount = useRef(false);
|
|
22
22
|
const emitter = useWidgetEvents();
|
|
@@ -53,7 +53,7 @@ export const useRouteExecution = (routeId, executeInBackground) => {
|
|
|
53
53
|
if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
|
|
54
54
|
throw Error('Execution route not found.');
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return lifi.executeRoute(account.signer, routeExecution.route, {
|
|
57
57
|
updateCallback,
|
|
58
58
|
switchChainHook,
|
|
59
59
|
infiniteApproval: false,
|
|
@@ -72,7 +72,7 @@ export const useRouteExecution = (routeId, executeInBackground) => {
|
|
|
72
72
|
if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
|
|
73
73
|
throw Error('Execution route not found.');
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return lifi.resumeRoute(account.signer, resumedRoute !== null && resumedRoute !== void 0 ? resumedRoute : routeExecution.route, {
|
|
76
76
|
updateCallback,
|
|
77
77
|
switchChainHook,
|
|
78
78
|
infiniteApproval: false,
|
|
@@ -132,11 +132,11 @@ export const useRouteExecution = (routeId, executeInBackground) => {
|
|
|
132
132
|
if (!route || !isRouteActive(route)) {
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
lifi.updateRouteExecution(route, { executeInBackground: true });
|
|
136
136
|
console.log('Move route execution to background.', routeId);
|
|
137
137
|
resumedAfterMount.current = false;
|
|
138
138
|
};
|
|
139
|
-
}, [routeId]);
|
|
139
|
+
}, [lifi, routeId]);
|
|
140
140
|
return {
|
|
141
141
|
executeRoute,
|
|
142
142
|
restartRoute: restartRouteMutation,
|
package/hooks/useSwapRoutes.js
CHANGED
|
@@ -12,13 +12,12 @@ import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
|
12
12
|
import Big from 'big.js';
|
|
13
13
|
import { useWatch } from 'react-hook-form';
|
|
14
14
|
import { useDebouncedWatch, useToken } from '.';
|
|
15
|
-
import {
|
|
16
|
-
import { SwapFormKey } from '../providers/SwapFormProvider';
|
|
17
|
-
import { useWallet } from '../providers/WalletProvider';
|
|
15
|
+
import { SwapFormKey, useLiFi, useWallet } from '../providers';
|
|
18
16
|
import { useSettings } from '../stores';
|
|
19
17
|
const refetchTime = 60000;
|
|
20
18
|
export const useSwapRoutes = () => {
|
|
21
19
|
var _a;
|
|
20
|
+
const lifi = useLiFi();
|
|
22
21
|
const { account, provider } = useWallet();
|
|
23
22
|
const queryClient = useQueryClient();
|
|
24
23
|
const { slippage, enabledBridges, enabledExchanges, routePriority } = useSettings([
|
|
@@ -75,7 +74,7 @@ export const useSwapRoutes = () => {
|
|
|
75
74
|
catch (_d) {
|
|
76
75
|
toWalletAddress = isAddress(toAddress) ? toAddress : fromAddress;
|
|
77
76
|
}
|
|
78
|
-
return
|
|
77
|
+
return lifi.getRoutes({
|
|
79
78
|
fromChainId,
|
|
80
79
|
fromAmount: Big(Number(fromTokenAmount) * Math.pow(10, ((_c = token === null || token === void 0 ? void 0 : token.decimals) !== null && _c !== void 0 ? _c : 0))).toString(),
|
|
81
80
|
fromTokenAddress,
|
|
@@ -10,14 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
/* eslint-disable consistent-return */
|
|
11
11
|
import { useQuery } from '@tanstack/react-query';
|
|
12
12
|
import { useState } from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import { useWallet } from '../providers/WalletProvider';
|
|
13
|
+
import { useLiFi, useWallet } from '../providers';
|
|
15
14
|
import { formatTokenAmount } from '../utils';
|
|
16
15
|
import { useFeaturedTokens } from './useFeaturedTokens';
|
|
17
16
|
import { useTokens } from './useTokens';
|
|
18
17
|
const defaultRefetchInterval = 60000;
|
|
19
18
|
const minRefetchInterval = 1000;
|
|
20
19
|
export const useTokenBalances = (selectedChainId) => {
|
|
20
|
+
const lifi = useLiFi();
|
|
21
21
|
const { account } = useWallet();
|
|
22
22
|
const featuredTokens = useFeaturedTokens(selectedChainId);
|
|
23
23
|
const { tokens, isLoading } = useTokens(selectedChainId);
|
|
@@ -27,7 +27,7 @@ export const useTokenBalances = (selectedChainId) => {
|
|
|
27
27
|
if (!accountAddress || !tokens) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const tokenBalances = yield
|
|
30
|
+
const tokenBalances = yield lifi.getTokenBalances(accountAddress, tokens);
|
|
31
31
|
if (!(tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length)) {
|
|
32
32
|
// Sometimes RPCs (e.g. Arbitrum) don't return balances on first call
|
|
33
33
|
// TODO: fix and remove backplane
|
package/hooks/useTokenSearch.js
CHANGED
|
@@ -8,11 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import {
|
|
11
|
+
import { useLiFi } from '../providers';
|
|
12
12
|
export const useTokenSearch = (token, chainId, enabled) => {
|
|
13
|
+
const lifi = useLiFi();
|
|
13
14
|
const queryClient = useQueryClient();
|
|
14
15
|
const { data, isLoading, isFetching, isFetched } = useQuery(['token-search', chainId, token], ({ queryKey: [, chainId, token], signal }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
-
const data = yield
|
|
16
|
+
const data = yield lifi.getToken(chainId, token, {
|
|
16
17
|
signal,
|
|
17
18
|
});
|
|
18
19
|
if (data) {
|
package/hooks/useTokens.js
CHANGED
|
@@ -8,13 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { useQuery } from '@tanstack/react-query';
|
|
11
|
-
import {
|
|
11
|
+
import { useLiFi } from '../providers';
|
|
12
12
|
import { useFeaturedTokens } from './useFeaturedTokens';
|
|
13
13
|
export const useTokens = (selectedChainId) => {
|
|
14
|
+
const lifi = useLiFi();
|
|
14
15
|
const featuredTokens = useFeaturedTokens(selectedChainId);
|
|
15
16
|
const { data: tokens, isLoading, isFetching, } = useQuery(['tokens', selectedChainId, featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.length], () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
17
|
var _a, _b, _c;
|
|
17
|
-
const data = yield
|
|
18
|
+
const data = yield lifi.getTokens({ chains: [selectedChainId] });
|
|
18
19
|
const featuredTokenAddresses = new Set(featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.map((token) => token.address));
|
|
19
20
|
return [
|
|
20
21
|
...((_a = featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.map((token) => {
|
package/hooks/useTools.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useLiFi } from '../providers';
|
|
4
4
|
import { useSettingsStore } from '../stores';
|
|
5
5
|
export const useTools = () => {
|
|
6
|
+
const lifi = useLiFi();
|
|
6
7
|
const initializeTools = useSettingsStore((state) => state.initializeTools);
|
|
7
|
-
const { data } = useQuery(['tools'], ({ signal }) =>
|
|
8
|
+
const { data } = useQuery(['tools'], ({ signal }) => lifi.getTools(undefined, { signal }), {
|
|
8
9
|
onSuccess(data) {
|
|
9
10
|
initializeTools('Bridges', data.bridges.map((bridge) => bridge.key));
|
|
10
11
|
initializeTools('Exchanges', data.exchanges.map((exchange) => exchange.key));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.1",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import LIFI from '@lifi/sdk';
|
|
3
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
4
|
+
import { useWidgetConfig } from '../WidgetProvider';
|
|
5
|
+
let lifi;
|
|
6
|
+
const SDKContext = createContext(null);
|
|
7
|
+
export const useLiFi = () => useContext(SDKContext);
|
|
8
|
+
export const SDKProvider = ({ children, }) => {
|
|
9
|
+
const { sdkConfig, integrator } = useWidgetConfig();
|
|
10
|
+
const value = useMemo(() => {
|
|
11
|
+
const config = Object.assign(Object.assign({}, sdkConfig), { defaultRouteOptions: Object.assign(Object.assign({}, sdkConfig === null || sdkConfig === void 0 ? void 0 : sdkConfig.defaultRouteOptions), { integrator: integrator !== null && integrator !== void 0 ? integrator : window.location.hostname }) });
|
|
12
|
+
if (!lifi) {
|
|
13
|
+
lifi = new LIFI(Object.assign({ disableVersionCheck: true }, config));
|
|
14
|
+
}
|
|
15
|
+
lifi.setConfig(config);
|
|
16
|
+
return lifi;
|
|
17
|
+
}, [integrator, sdkConfig]);
|
|
18
|
+
return _jsx(SDKContext.Provider, Object.assign({ value: value }, { children: children }));
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SDKProvider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SDKProvider';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useWidgetConfig } from '..';
|
|
2
|
+
import { useTelemetry } from '../../hooks';
|
|
3
|
+
export const TelemetryProvider = ({ children }) => {
|
|
4
|
+
const config = useWidgetConfig();
|
|
5
|
+
useTelemetry(config === null || config === void 0 ? void 0 : config.disableTelemetry);
|
|
6
|
+
return children;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TelemetryProvider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TelemetryProvider';
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { Signer } from 'ethers';
|
|
2
2
|
import type { FC, PropsWithChildren } from 'react';
|
|
3
|
-
import type { WidgetWalletManagement } from '../../types';
|
|
4
3
|
import type { WalletContextProps } from './types';
|
|
5
4
|
export declare const useWallet: () => WalletContextProps;
|
|
6
|
-
export declare const WalletProvider: FC<PropsWithChildren
|
|
7
|
-
walletManagement?: WidgetWalletManagement;
|
|
8
|
-
}>>;
|
|
5
|
+
export declare const WalletProvider: FC<PropsWithChildren>;
|
|
9
6
|
export declare const extractAccountFromSigner: (signer?: Signer) => Promise<{
|
|
10
7
|
address: string | undefined;
|
|
11
8
|
isActive: boolean;
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { addChain as walletAddChain, switchChain as walletSwitchChain, switchChainAndAddToken, useLiFiWalletManagement, } from '@lifi/wallet-management';
|
|
12
12
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
13
|
+
import { useWidgetConfig } from '../WidgetProvider';
|
|
13
14
|
const stub = () => {
|
|
14
15
|
throw new Error('You forgot to wrap your component in <WalletProvider>.');
|
|
15
16
|
};
|
|
@@ -23,7 +24,8 @@ const initialContext = {
|
|
|
23
24
|
};
|
|
24
25
|
const WalletContext = createContext(initialContext);
|
|
25
26
|
export const useWallet = () => useContext(WalletContext);
|
|
26
|
-
export const WalletProvider = ({ children
|
|
27
|
+
export const WalletProvider = ({ children }) => {
|
|
28
|
+
const { walletManagement } = useWidgetConfig();
|
|
27
29
|
const { connect: walletManagementConnect, disconnect: walletManagementDisconnect, signer, provider, } = useLiFiWalletManagement();
|
|
28
30
|
const [account, setAccount] = useState({});
|
|
29
31
|
const connect = useCallback((wallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -10,20 +10,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import {
|
|
14
|
-
import { createContext, useContext,
|
|
15
|
-
import { updateLiFiConfig } from '../../config/lifi';
|
|
16
|
-
import { name, version } from '../../config/version';
|
|
17
|
-
const stub = () => {
|
|
18
|
-
throw new Error('You forgot to wrap your component in <WidgetProvider>.');
|
|
19
|
-
};
|
|
13
|
+
import { getChainByKey } from '@lifi/sdk';
|
|
14
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
20
15
|
const initialContext = {
|
|
21
16
|
disabledChains: [],
|
|
22
17
|
};
|
|
23
18
|
const WidgetContext = createContext(initialContext);
|
|
24
19
|
export const useWidgetConfig = () => useContext(WidgetContext);
|
|
25
20
|
export const WidgetProvider = (_a) => {
|
|
26
|
-
var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, fromAmount
|
|
21
|
+
var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, fromAmount } = _c, config = __rest(_c, ["fromChain", "fromToken", "toChain", "toToken", "fromAmount"]);
|
|
27
22
|
const value = useMemo(() => {
|
|
28
23
|
var _a, _b, _c, _d;
|
|
29
24
|
try {
|
|
@@ -53,11 +48,5 @@ export const WidgetProvider = (_a) => {
|
|
|
53
48
|
return config;
|
|
54
49
|
}
|
|
55
50
|
}, [config, fromAmount, fromChain, fromToken, toChain, toToken]);
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
updateLiFiConfig(Object.assign(Object.assign({}, sdkConfig), { defaultRouteOptions: Object.assign(Object.assign({}, sdkConfig === null || sdkConfig === void 0 ? void 0 : sdkConfig.defaultRouteOptions), { integrator: integrator !== null && integrator !== void 0 ? integrator : window.location.hostname }) }));
|
|
58
|
-
}, [integrator, sdkConfig]);
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
checkPackageUpdates(name, version);
|
|
61
|
-
}, []);
|
|
62
51
|
return (_jsx(WidgetContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
63
52
|
};
|
package/providers/index.d.ts
CHANGED