Connect a Wallet
The Swing SDK requires a connected wallet provider to initiate signing and sending transactions. A variety of wallets, including Metamask, Coinbase, and Keplr are supported.
Web3-React
If you are using web3-react, connect using the active provider.
const { provider } = useWeb3React()
useEffect(() => {
if (provider) {
sdk.wallet.connect(provider)
}
}, [provider])
Metamask
When connecting to an EVM wallet, provide the wallet interface located on the window.
await sdk.wallet.connect(window.ethereum)
Coinbase
When connecting to the Coinbase wallet, provide the wallet interface located on the window.
await sdk.wallet.connect(window.CoinbaseWalletProvider)
Brave
When connecting to an EVM wallet, provide the wallet interface located on the window.
await sdk.wallet.connect(window.ethereum)
WalletConnect
When connecting to wallet connect, provide the wallet interface located on the window.
await sdk.wallet.connect(window.ethereum)
Keplr
When connecting to an Cosmos wallet, provide the Keplr interface located on the window.
await sdk.wallet.connect(window.keplr)
Other wallets
Not seeing your wallet? We're constantly adding new wallet integrations. If you need a specific wallet, please reach out in our Discord.