Seamlessly connecting every ecosystem for your needs
EVM
and Solana
, both with similar configuration options respective to their ecosystems.
window.ethereum
, and managing the user’s account within the browser or mobile context. This setup is popular among dApps UIs and is often used together with libraries like Wagmi
or @solana/web3.js
.
These account types and interaction methods allow developers to choose the most suitable approach for integrating the SDK with their applications.
Viem
library, using some of its types and terminology.
Options available for configuring the EVM provider:
getWalletClient
: A function that returns a WalletClient
instance.
switchChain
: A hook for switching between different networks.
viem/chains
package or fetched from LI.FI API and adopted to viem’s Chain
type.
Here’s a basic example using chains from viem/chains
:
WalletClient
to the EVM
provider is to use the Wagmi library. Developers can configure Wagmi chains either by using chains from the viem/chains
package or fetching chains from LI.FI API and adapting them to Viem’s Chain
type.
Below is a simplified example of how to set up the EVM provider using chains from the LI.FI API in conjunction with Wagmi and React.
We provide a useSyncWagmiConfig
hook that synchronizes fetched chains with the Wagmi configuration and updates connectors. Please note that we do not initialize the Wagmi configuration with connectors. Additionally, we set reconnectOnMount
to false
since the reconnect
action will be called within useSyncWagmiConfig
hook after the chains are synchronized with the configuration and connectors.
setOptions
function.
Here’s an example of how to modify the initial configuration for EVM
provider:
Signer
/Provider
objects to Viem’s WalletClient
before passing it to the EVM provider configuration.
getWalletAdapter
: A function that returns a WalletAdapter instance.KeypairWalletAdapter
. This custom adapter enables users to create a wallet adapter from a private key.
It is worth noting that the KeypairWalletAdapter
is designed specifically for backend or testing purposes and should not be used in user-facing code to prevent the risk of exposing your private key.
WalletAdapter
to the Solana provider, we recommend using the @solana/wallet-adapter-base and @solana/wallet-adapter-react libraries. Unlike Wagmi, Solana configuration for React does not have global configurations. Therefore, we need to use React hooks to update the SDK configuration at runtime.
Below is a simplified example of how to set up the Solana provider.