requester

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EVM

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

func NewEVM

func NewEVM(
	client access.Client,
	address flow.Address,
	signer crypto.Signer,
	network string,
	createCOA bool,
	logger zerolog.Logger,
) (*EVM, error)

func (*EVM) Call

func (e *EVM) Call(ctx context.Context, address common.Address, data []byte) ([]byte, error)

func (*EVM) EstimateGas

func (e *EVM) EstimateGas(ctx context.Context, data []byte) (uint64, error)

func (*EVM) GetBalance

func (e *EVM) GetBalance(ctx context.Context, address common.Address, height uint64) (*big.Int, error)

func (*EVM) SendRawTransaction

func (e *EVM) SendRawTransaction(ctx context.Context, data []byte) (common.Hash, error)

type KeyRotationSigner

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

KeyRotationSigner is a crypto signer that contains a pool of key pairs to sign with, and it rotates the key used for each signing request. This allows for faster submission of transactions to the network, due to a sequence number not being reused between different keys used. It also contains logic to queue up signature requests and in case there are more transactions pending than the keys in the pool it will wait for transactions to get executed so the new sequence key can be obtained. The signer is concurrency-safe.

func NewKeyRotationSigner

func NewKeyRotationSigner(keys []crypto.PrivateKey, hashAlgo crypto.HashAlgorithm) (*KeyRotationSigner, error)

func (*KeyRotationSigner) PublicKey

func (k *KeyRotationSigner) PublicKey() crypto.PublicKey

PublicKey returns the current public key which is available for signing.

func (*KeyRotationSigner) Sign

func (k *KeyRotationSigner) Sign(message []byte) ([]byte, error)

Sign signs the message and then rotates to the next key. note: if you want to get the public key pair, you should first call PublicKey and then Sign.

type Requester

type Requester interface {
	// SendRawTransaction will submit signed transaction data to the network.
	// The submitted EVM transaction hash is returned.
	SendRawTransaction(ctx context.Context, data []byte) (common.Hash, error)

	// GetBalance returns the amount of wei for the given address in the state of the
	// given block height.
	// todo in future this should be deprecated for local data
	GetBalance(ctx context.Context, address common.Address, height uint64) (*big.Int, error)

	// Call executes the given signed transaction data on the state for the given block number.
	// Note, this function doesn't make and changes in the state/blockchain and is
	// useful to execute and retrieve values.
	Call(ctx context.Context, address common.Address, data []byte) ([]byte, error)

	// EstimateGas executes the given signed transaction data on the state.
	// Note, this function doesn't make any changes in the state/blockchain and is
	// useful to executed and retrieve the gas consumption and possible failures.
	EstimateGas(ctx context.Context, data []byte) (uint64, error)
}

Jump to

Keyboard shortcuts

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