Skip to content

Commit

Permalink
fix: enable all default chains
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Jun 8, 2022
1 parent b490e7c commit 0215034
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/widget-embedded/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ if (!rootElement) {
const root = createRoot(rootElement);

const widgetDrawerConfig: WidgetConfig = {
enabledChains: JSON.parse(process.env.LIFI_ENABLED_CHAINS_JSON!),
fromChain: 'pol',
toChain: 'bsc',
// fromToken: '0x0000000000000000000000000000000000000000',
Expand Down
4 changes: 2 additions & 2 deletions packages/widget/src/hooks/useChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { LiFi } from '../lifi';
import { useWidgetConfig } from '../providers/WidgetProvider';

export const useChains = () => {
const { enabledChains } = useWidgetConfig();
const { disabledChains } = useWidgetConfig();
const { data, ...other } = useQuery(['chains'], async () => {
const chains = await LiFi.getChains();
return chains.filter((chain) => enabledChains.includes(chain.id));
return chains.filter((chain) => !disabledChains?.includes(chain.id));
});

const getChainById = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const stub = (): never => {
};

const initialContext: WidgetContextProps = {
enabledChains: [],
disabledChains: [],
};

const WidgetContext = createContext<WidgetContextProps>(initialContext);
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/src/types/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface WidgetConfig {
fromToken?: string;
toChain?: `${ChainKey}` | number;
toToken?: string;
enabledChains: number[];
disabledChains?: number[];
disableInternalWalletManagement?: boolean;
walletCallbacks?: {
connect: { (): Signer };
Expand Down

0 comments on commit 0215034

Please sign in to comment.