ethsigner

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionTypeLegacy byte = 0x00
	TransactionType2930   byte = 0x01 // unused
	TransactionType1559   byte = 0x02
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Transaction

type Transaction struct {
	From                 json.RawMessage           `json:"from,omitempty"` // only here as a possible input to signing key selection (eth_sendTransaction)
	Nonce                *ethtypes.HexInteger      `json:"nonce,omitempty"`
	GasPrice             *ethtypes.HexInteger      `json:"gasPrice,omitempty"`
	MaxPriorityFeePerGas *ethtypes.HexInteger      `json:"maxPriorityFeePerGas,omitempty"`
	MaxFeePerGas         *ethtypes.HexInteger      `json:"maxFeePerGas,omitempty"`
	GasLimit             *ethtypes.HexInteger      `json:"gas"`
	To                   *ethtypes.Address0xHex    `json:"to,omitempty"`
	Value                *ethtypes.HexInteger      `json:"value"`
	Data                 ethtypes.HexBytes0xPrefix `json:"data"`
}

func (*Transaction) AddEIP155HashValues

func (t *Transaction) AddEIP155HashValues(rlpList rlp.List, chainID int64) rlp.List

func (*Transaction) Build1559

func (t *Transaction) Build1559(chainID int64) rlp.List

func (*Transaction) BuildLegacy

func (t *Transaction) BuildLegacy() rlp.List

func (*Transaction) Sign

func (t *Transaction) Sign(signer *secp256k1.KeyPair, chainID int64) ([]byte, error)

Automatically pick signer, based on input fields. - If either of the new EIP-1559 fields are set, use EIP-1559 - By default use EIP-155 signing Never picks legacy-legacy (non EIP-155), or EIP-2930

func (*Transaction) SignEIP1559

func (t *Transaction) SignEIP1559(signer *secp256k1.KeyPair, chainID int64) ([]byte, error)

SignEIP1559 uses EIP-1559 transaction structure (with EIP-2718 transaction type byte), with EIP-2930 V value (0 / 1 - direct parity-Y)

func (*Transaction) SignLegacyEIP155

func (t *Transaction) SignLegacyEIP155(signer *secp256k1.KeyPair, chainID int64) ([]byte, error)

SignLegacyEIP155 uses legacy transaction structure, with EIP-155 signing V value (2*ChainID + 35 + Y-parity)

func (*Transaction) SignLegacyOriginal

func (t *Transaction) SignLegacyOriginal(signer *secp256k1.KeyPair) ([]byte, error)

SignLegacyOriginal uses legacy transaction structure, with legacy V value (27/28)

type Wallet

type Wallet interface {
	Sign(ctx context.Context, txn *Transaction, chainID int64) ([]byte, error)
	// SignPrivateTxn(ctx context.Context, addr ethtypes.Address, ptx *Transaction, chainID int64) ([]byte, error)
	Initialize(ctx context.Context) error
	GetAccounts(ctx context.Context) ([]*ethtypes.Address0xHex, error)
	Refresh(ctx context.Context) error
	Close() error
}

Wallet is the common interface can be implemented across wallet/signing capabilities

Jump to

Keyboard shortcuts

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