signer
Configuration Description
This option is used to sign transactions initiated via wallets such as Ethereum.
Can be obtained via
new Web3Provider(window.ethereum).
Ethereum wallets: imToken / MetaMask, etc.
To maintain version consistency, please use the
Web3Providerfromhymatrix-js.
import HyMatrix, { Web3Provider } from 'hymatrix-js'
const provider = new Web3Provider(window.ethereum)
const hyMatrix = new HyMatrix({
signer: provider
})
tip
- In a WEB environment where multiple Ethereum wallets coexist, such as
MetaMask,OKX Wallet,TokenPocket Wallet, you can useeip6963:announceProviderandeip6963:requestProviderto distinguish them. - Related docs: https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events