Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@wagmi/connectors
Advanced tools
@wagmi/connectors is a package that provides a set of connectors for integrating with various Ethereum wallets. It is part of the wagmi library, which is designed to make it easier to work with Ethereum in JavaScript and TypeScript applications. The connectors facilitate the connection between your application and different wallet providers, enabling functionalities such as authentication, transaction signing, and more.
MetaMask Connector
This feature allows you to connect your application to the MetaMask wallet. The MetaMaskConnector can be configured with various options, such as supported chains and whether to shim the disconnect functionality.
const { MetaMaskConnector } = require('@wagmi/connectors');
const metaMaskConnector = new MetaMaskConnector({
chains: [/* array of supported chains */],
options: {
shimDisconnect: true,
},
});
WalletConnect Connector
This feature allows you to connect your application to wallets that support WalletConnect. The WalletConnectConnector can be configured with options like whether to display a QR code for connection.
const { WalletConnectConnector } = require('@wagmi/connectors');
const walletConnectConnector = new WalletConnectConnector({
chains: [/* array of supported chains */],
options: {
qrcode: true,
},
});
Coinbase Wallet Connector
This feature allows you to connect your application to the Coinbase Wallet. The CoinbaseWalletConnector can be configured with options such as the name of your application.
const { CoinbaseWalletConnector } = require('@wagmi/connectors');
const coinbaseWalletConnector = new CoinbaseWalletConnector({
chains: [/* array of supported chains */],
options: {
appName: 'MyApp',
},
});
Web3Modal is a library that allows developers to easily integrate multiple wallet providers into their applications. It provides a modal component that lets users choose their preferred wallet. Compared to @wagmi/connectors, Web3Modal offers a more user-friendly interface for selecting wallets but may not provide as much granular control over individual connectors.
Web3-react is a library for managing Ethereum wallet connections in React applications. It provides hooks and connectors for various wallet providers. Compared to @wagmi/connectors, web3-react is more tightly integrated with React and offers a more React-centric API, whereas @wagmi/connectors can be used in any JavaScript or TypeScript environment.
Ethers.js is a library for interacting with the Ethereum blockchain and its ecosystem. While it is not specifically focused on wallet connectors, it provides utilities for connecting to various providers and signing transactions. Compared to @wagmi/connectors, ethers.js offers a broader range of functionalities beyond just wallet connections.
@wagmi/connectors
Collection of connectors for wagmi.
Install the @wagmi/connectors
package.
npm i @wagmi/connectors
Configure your wagmi client with connectors!
import { configureChains, createClient } from 'wagmi'
import { InjectedConnector } from '@wagmi/connectors/injected'
import { CoinbaseWalletConnector } from '@wagmi/connectors/coinbaseWallet'
import { WalletConnectConnector } from '@wagmi/connectors/walletConnect'
const { chains, provider } = configureChains(...)
const client = createClient({
connectors: [
new CoinbaseWalletConnector({
chains,
options: {
appName: 'wagmi',
},
}),
new WalletConnectConnector({
chains,
options: {
qrcode: true,
},
}),
new InjectedConnector({ chains }),
],
provider,
})
If your bundler supports tree-shaking (most likely), only the used connectors will be included in the bundle, so you don't have to worry about bundle size. 😊
CoinbaseWalletConnector
InjectedConnector
LedgerConnector
MetaMaskConnector
MockConnector
WalletConnectConnector
Want to add another chain to the list? Make sure you read the contributing guide first.
FAQs
Collection of connectors for Wagmi
The npm package @wagmi/connectors receives a total of 189,233 weekly downloads. As such, @wagmi/connectors popularity was classified as popular.
We found that @wagmi/connectors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.