@lifi/widget 1.1.0 → 1.1.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/config/env.d.ts CHANGED
@@ -1,12 +1,3 @@
1
1
  export declare const env: {
2
2
  LIFI_API_URL: string;
3
- LIFI_RPC_URL_MAINNET: string;
4
- LIFI_RPC_URL_ROPSTEN: string;
5
- LIFI_RPC_URL_RINKEBY: string;
6
- LIFI_RPC_URL_GORLI: string;
7
- LIFI_RPC_URL_KOVAN: string;
8
- LIFI_RPC_URL_ARBITRUM_RINKEBY: string;
9
- LIFI_RPC_URL_OPTIMISM_KOVAN: string;
10
- LIFI_RPC_URL_POLYGON_MUMBAI: string;
11
- LIFI_RPC_URL_BSC_TESTNET: string;
12
3
  };
package/config/env.js CHANGED
@@ -1,19 +1,3 @@
1
1
  export const env = {
2
- LIFI_API_URL: 'https://li.quest/v1/',
3
- // RPC - Mainnet (overwrites)
4
- LIFI_RPC_URL_MAINNET: 'https://speedy-nodes-nyc.moralis.io/5ed6053dc39eba789ff466c9/eth/mainnet',
5
- // LIFI_RPC_URL_POLYGON:
6
- // LIFI_RPC_URL_BSC:
7
- // LIFI_RPC_URL_XDAI:
8
- // LIFI_RPC_URL_FANTOM:
9
- // LIFI_RPC_URL_ARBITRUM:
10
- // RPC - Testnet (overwrites)
11
- LIFI_RPC_URL_ROPSTEN: 'https://ropsten.infura.io/v3/c7fe4abb5bbc466cb56038efbb0b9930',
12
- LIFI_RPC_URL_RINKEBY: 'https://rinkeby.infura.io/v3/c7fe4abb5bbc466cb56038efbb0b9930',
13
- LIFI_RPC_URL_GORLI: 'https://goerli.infura.io/v3/c7fe4abb5bbc466cb56038efbb0b9930',
14
- LIFI_RPC_URL_KOVAN: 'https://kovan.infura.io/v3/c7fe4abb5bbc466cb56038efbb0b9930',
15
- LIFI_RPC_URL_ARBITRUM_RINKEBY: 'https://arbitrum-rinkeby.infura.io/v3/c7fe4abb5bbc466cb56038efbb0b9930',
16
- LIFI_RPC_URL_OPTIMISM_KOVAN: 'https://optimism-kovan.infura.io/v3/c7fe4abb5bbc466cb56038efbb0b9930',
17
- LIFI_RPC_URL_POLYGON_MUMBAI: 'https://rpc-mumbai.maticvigil.com/v1/e4dadaac060844094a667194c20f79cc9bb0bc59',
18
- LIFI_RPC_URL_BSC_TESTNET: 'https://data-seed-prebsc-1-s2.binance.org:8545',
2
+ LIFI_API_URL: 'https://li.quest/v1/', // 'https://developkub.li.finance/v1/',
19
3
  };
@@ -23,10 +23,10 @@ import { useQuery } from 'react-query';
23
23
  import { LiFi } from '../lifi';
24
24
  import { useWidgetConfig } from '../providers/WidgetProvider';
25
25
  export const useChains = () => {
26
- const { enabledChains } = useWidgetConfig();
26
+ const { disabledChains } = useWidgetConfig();
27
27
  const _a = useQuery(['chains'], () => __awaiter(void 0, void 0, void 0, function* () {
28
28
  const chains = yield LiFi.getChains();
29
- return chains.filter((chain) => enabledChains.includes(chain.id));
29
+ return chains.filter((chain) => !(disabledChains === null || disabledChains === void 0 ? void 0 : disabledChains.includes(chain.id)));
30
30
  })), { data } = _a, other = __rest(_a, ["data"]);
31
31
  const getChainById = useCallback((chainId) => {
32
32
  const chain = data === null || data === void 0 ? void 0 : data.find((chain) => chain.id === chainId);
package/lifi.js CHANGED
@@ -1,9 +1,6 @@
1
1
  import LIFI from '@lifinance/sdk';
2
- import { env } from './config/env';
3
- import { getRpcs } from './config/rpcs';
4
2
  export const LiFi = new LIFI({
5
- apiUrl: env.LIFI_API_URL,
6
- rpcs: getRpcs(),
3
+ // apiUrl: env.LIFI_API_URL,
7
4
  defaultRouteOptions: {
8
5
  integrator: 'li.fi',
9
6
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "1.1.0",
3
+ "version": "1.1.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
  "sideEffects": false,
6
6
  "main": "./index.js",
@@ -16,7 +16,7 @@ const stub = () => {
16
16
  throw new Error('You forgot to wrap your component in <WidgetProvider>.');
17
17
  };
18
18
  const initialContext = {
19
- enabledChains: [],
19
+ disabledChains: [],
20
20
  };
21
21
  const WidgetContext = createContext(initialContext);
22
22
  export const useWidgetConfig = () => useContext(WidgetContext);
package/types/widget.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface WidgetConfig {
15
15
  fromToken?: string;
16
16
  toChain?: `${ChainKey}` | number;
17
17
  toToken?: string;
18
- enabledChains: number[];
18
+ disabledChains?: number[];
19
19
  disableInternalWalletManagement?: boolean;
20
20
  walletCallbacks?: {
21
21
  connect: {
package/config/rpcs.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const getRpcs: () => Record<number, string[]>;
package/config/rpcs.js DELETED
@@ -1,20 +0,0 @@
1
- import { ChainId } from '@lifinance/sdk';
2
- import { env } from './env';
3
- const rpcs = {
4
- [ChainId.ETH]: [env.LIFI_RPC_URL_MAINNET],
5
- // [ChainId.POL]: [env.LIFI_RPC_URL_POLYGON],
6
- // [ChainId.BSC]: [env.LIFI_RPC_URL_BSC],
7
- // [ChainId.DAI]: [env.LIFI_RPC_URL_XDAI],
8
- // [ChainId.FTM]: [env.LIFI_RPC_URL_FANTOM],
9
- // [ChainId.ARB]: [env.LIFI_RPC_URL_ARBITRUM],
10
- // Testnet
11
- [ChainId.ROP]: [env.LIFI_RPC_URL_ROPSTEN],
12
- [ChainId.RIN]: [env.LIFI_RPC_URL_RINKEBY],
13
- [ChainId.GOR]: [env.LIFI_RPC_URL_GORLI],
14
- [ChainId.KOV]: [env.LIFI_RPC_URL_KOVAN],
15
- [ChainId.ARBT]: [env.LIFI_RPC_URL_ARBITRUM_RINKEBY],
16
- [ChainId.OPTT]: [env.LIFI_RPC_URL_OPTIMISM_KOVAN],
17
- [ChainId.MUM]: [env.LIFI_RPC_URL_POLYGON_MUMBAI],
18
- [ChainId.BSCT]: [env.LIFI_RPC_URL_BSC_TESTNET],
19
- };
20
- export const getRpcs = () => Object.fromEntries(Object.entries(rpcs).filter(([_, value]) => !value));