BaseSigner
The BaseSigner
class is designed to handle the creation and management of signing keys, allowing secure and
authenticated interactions with the ZKsync Era blockchain.
Init
Creates a new instance of BaseSigner
based on the provided mnemonic phrase.
func NewBaseSignerFromMnemonic(mnemonic string, chainId int64) (*BaseSigner, error)
Creates a new instance of BaseSigner
based on the provided mnemonic phrase and account ID.
func NewBaseSignerFromMnemonicAndAccountId(mnemonic string, accountId uint32, chainId int64) (*BaseSigner, error)
Creates a new instance of BaseSigner based on the provided raw private key.
func NewBaseSignerFromRawPrivateKey(rawPk []byte, chainId int64) (*BaseSigner, error)
Creates an instance of Signer with a randomly generated private key.
func NewRandomBaseSigner(chainId int64) (*BaseSigner, error)
Address
Returns the address associated with the signer.
Address() common.Address
Domain
Returns the EIP-712 domain used for signing.
Domain() *eip712.Domain
PrivateKey
Returns the private key associated with the signer.
PrivateKey() *ecdsa.PrivateKey
Signs the given hash using the signer's private key and returns the signature. The hash should be the 32-byte hash of the data to be signed.
SignHash
SignHash(msg []byte) ([]byte, error)
SignTypeData
Signs the given EIP-712 typed data using the signer's private key and returns the signature. The domain parameter is the EIP-712 domain separator, and the data parameter is the EIP-712 typed data.
SignTypedData(d *eip712.Domain, data eip712.TypedData) ([]byte, error)