signerv2

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyStoreSignerFn

func KeyStoreSignerFn(path string, password string, chainID *big.Int) (bind.SignerFn, error)

func PrivateKeySignerFn

func PrivateKeySignerFn(privateKey *ecdsa.PrivateKey, chainID *big.Int) (bind.SignerFn, error)

func Web3SignerFn

func Web3SignerFn(remoteSignerURL string) (bind.SignerFn, error)

Web3SignerFn creates a signer function that uses a remote signer It exposes `eth_SignTransaction` endpoint which return rlp encoded signed tx

Types

type Config

type Config struct {
	PrivateKey   *ecdsa.PrivateKey
	KeystorePath string
	Password     string
	Endpoint     string
	Address      string
}

func (Config) IsLocalKeystoreSigner

func (c Config) IsLocalKeystoreSigner() bool

func (Config) IsPrivateKeySigner

func (c Config) IsPrivateKeySigner() bool

func (Config) IsWeb3Signer

func (c Config) IsWeb3Signer() bool

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
	ID      string      `json:"id"`
}

JSONRPCRequest is a struct for JSON RPC 2.0 request See: https://www.jsonrpc.org/specification

type SignerFn

type SignerFn func(ctx context.Context, address common.Address) (bind.SignerFn, error)

func SignerFromConfig

func SignerFromConfig(c Config, chainID *big.Int) (SignerFn, common.Address, error)

type Web3Signer

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

Web3Signer is a client for a remote signer It currently implements `eth_signTransaction` method of Consensys Web3 Signer Reference: https://docs.web3signer.consensys.io/reference/api/json-rpc#eth_signtransaction

func (Web3Signer) SignTransaction

func (r Web3Signer) SignTransaction(
	from common.Address,
	tx *types.Transaction,
) (*types.Transaction, error)

type Web3SignerClient

type Web3SignerClient interface {
	SignTransaction(from common.Address, tx *types.Transaction) (*types.Transaction, error)
}

func NewWeb3SignerClient

func NewWeb3SignerClient(url string) Web3SignerClient

Jump to

Keyboard shortcuts

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