Skip to main content

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 Web3Provider from hymatrix-js.

import HyMatrix, { Web3Provider } from 'hymatrix-js'

const provider = new Web3Provider(window.ethereum)

const hyMatrix = new HyMatrix({
signer: provider
})
tip
  1. In a WEB environment where multiple Ethereum wallets coexist, such as MetaMask, OKX Wallet, TokenPocket Wallet, you can use eip6963:announceProvider and eip6963:requestProvider to distinguish them.
  2. Related docs: https://eips.ethereum.org/EIPS/eip-6963#announce-and-request-events