-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/si-1594-ledger-hid-connection-via-lo…
…w-speed-internet
- Loading branch information
Showing
86 changed files
with
811 additions
and
580 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { useCallback } from 'react'; | ||
import { useClientConfig } from 'providers/client-config'; | ||
import { | ||
HeadingStyle, | ||
DataTableRowAction, | ||
DataTableRowInput, | ||
DataTableRowStyle, | ||
} from './styles'; | ||
import { useRpcUrls } from 'hooks/useRpcUrls'; | ||
|
||
export const ChainsConfig = () => { | ||
const { defaultChain, supportedChainIds, setSavedClientConfig } = | ||
useClientConfig(); | ||
|
||
const rpcUrls = useRpcUrls(); | ||
|
||
const onChangeDefaultChain = useCallback( | ||
(chainId: number) => { | ||
setSavedClientConfig({ defaultChain: chainId }); | ||
}, | ||
[setSavedClientConfig], | ||
); | ||
|
||
return ( | ||
<> | ||
<HeadingStyle>Chains config:</HeadingStyle> | ||
<div> | ||
<code> | ||
{supportedChainIds.map((chainId) => ( | ||
<DataTableRowStyle | ||
key={chainId} | ||
highlight | ||
title={ | ||
<> | ||
{chainId} | ||
{chainId === defaultChain ? <i> (default 🛎️)</i> : ''} | ||
</> | ||
} | ||
> | ||
<DataTableRowInput | ||
value={rpcUrls[chainId]} | ||
variant="small" | ||
readOnly | ||
disabled | ||
/> | ||
<DataTableRowAction | ||
onClick={() => onChangeDefaultChain(chainId)} | ||
variant={chainId === defaultChain ? 'filled' : 'translucent'} | ||
> | ||
🛎️ | ||
</DataTableRowAction> | ||
</DataTableRowStyle> | ||
))} | ||
</code> | ||
</div> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
import { mainnet, holesky, Chain } from 'wagmi/chains'; | ||
import { Chain } from 'wagmi/chains'; | ||
import dynamics from './dynamics'; | ||
|
||
export const getBackendRPCPath = (chainId: Chain['id']) => { | ||
return dynamics.rpcProviderUrls[chainId]; | ||
}; | ||
|
||
export const backendRPC = { | ||
[mainnet.id]: getBackendRPCPath(mainnet.id), | ||
[holesky.id]: getBackendRPCPath(holesky.id), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { useMemo } from 'react'; | ||
import { CHAINS } from '@lido-sdk/constants'; | ||
import { useClientConfig } from 'providers/client-config'; | ||
import { getBackendRPCPath } from 'config'; | ||
|
||
export const useRpcUrls = (): Record<number, string> => { | ||
const { supportedChainIds } = useClientConfig(); | ||
|
||
const backendRPC: Record<number, string> = useMemo( | ||
() => | ||
supportedChainIds.reduce( | ||
(res, curr) => ({ ...res, [curr]: getBackendRPCPath(curr) }), | ||
{ | ||
// Mainnet RPC is always required for some requests, e.g. ETH to USD price, ENS lookup | ||
[CHAINS.Mainnet]: getBackendRPCPath(CHAINS.Mainnet), | ||
}, | ||
), | ||
[supportedChainIds], | ||
); | ||
|
||
return backendRPC; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.