localsigner

package
v0.11.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2024 License: MIT Imports: 10 Imported by: 3

Documentation

Overview

Package localsigner is a local signer

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer is a new local signer. TODO: this should not be exported.

func NewSigner

func NewSigner(key *ecdsa.PrivateKey) *Signer

NewSigner creates a new signer.

Example
testWallet, err := wallet.FromHex("63e21d10fd50155dbba0e7d3f7431a400b84b4c2ac1ee38872f82448fe3ecfb9")
if err != nil {
	panic(err)
}

newSigner := localsigner.NewSigner(testWallet.PrivateKey())
fmt.Println(newSigner.Address())
Output:

0xC49926C4124cEe1cbA0Ea94Ea31a6c12318df947

func (*Signer) Address

func (s *Signer) Address() common.Address

Address gets the address of the signer.

func (*Signer) GetTransactor

func (s *Signer) GetTransactor(ctx context.Context, chainID *big.Int) (*bind.TransactOpts, error)

GetTransactor gets the transcator.

func (*Signer) PrivKey added in v0.2.0

func (s *Signer) PrivKey() libp2p.PrivKey

PrivKey gets the private key.

func (*Signer) SignMessage

func (s *Signer) SignMessage(_ context.Context, message []byte, hash bool) (signer.Signature, error)

SignMessage signs a message w/o eip-155.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL