Universal adapter to Ethereum and Solana
- 🚀 Built-in functions for working with signatures, connecting wallets, tracking the status of transactions, ENS names, and more.
- 💼 Built-in wallet connectors for MetaMask, WalletConnect, Coinbase Wallet, Keplr, xDefi, Phantom (Solana) and Injected wallets.
- 🌀 Auto-refresh data on wallet, block, and network changes
- 🦄 TypeScript ready
- 🌏 All supported networks are in networks.ts
- MetaMask
- WalletConnect (all WalletConnect-compatible wallets are supported, >100 wallets!)
- Coinbase Wallet
- Phantom (Solana)
- Keplr (Cosmos, Osmosis, Astar)
- xDeFi (EVM networks, Bitcoin, Bitcoin Cash, Litecoin)
- Safe (aka Gnosis Safe Multisig Wallet)
yarn add @viaprotocol/web3-wallets
import { useContext } from 'react'
import { WalletContext, WalletProvider } from '@viaprotocol/web3-wallets'
function App() {
return (
<WalletProvider>
<NestedComponent />
</WalletProvider>
)
}
function NestedComponent() {
const { connect, isConnected, address } = useContext(WalletContext)
if (!isConnected) {
return (
// Select MetaMask and connect to ETH Mainnet
<button
type="button"
onClick={() => connect({ name: 'MetaMask', chainId: 1 })}
>Connect wallet</button>
)
}
return (
<p>{address}</p>
)
}
Unfortunately, there is no playground in the library at the moment, so local development is done with yalc.
- First, install the library:
yarn global add yalc
-
Make changes to the
web3-wallets
code -
Run the following command to build the library:
yarn publish:yalc
- In the project you are going to test your functionality, initialize the package fetch from
yalc
yalc add @viaprotocol/web3-wallets
- Install
yalc
version of web3-wallets
yarn add @viaprotocol/web3-wallets
- After the library is installed, you can use it in your project.
(if you are using vite, you need to run it with --force
param)
- Run the following command to remove the library, after you are done with testing:
yalc remove @viaprotocol/web3-wallets && yarn
We use Conventional Commits in our project to name commits. And we would be very grateful if you would also follow this convention.
Scope is optional.
✌🏻 Additionally, it would be cool to put emoji according to Gitmoji's guide (VSCode plugin, WebStorm plugin)
- Fork it (https://github.com/viaprotocol/web3-wallets/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am '✨ feat: add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
You can write us in Discord with any questions about usage, integrations, adding new wallets, etc.