transport

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MPL-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = fmt.Errorf("timeout")

ErrTimeout happens when the websocket requests times out

Functions

This section is empty.

Types

type CallMsg added in v0.1.7

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

func (CallMsg) CheckNonce added in v0.1.7

func (self CallMsg) CheckNonce() bool

func (CallMsg) Data added in v0.1.7

func (self CallMsg) Data() []byte

func (CallMsg) From added in v0.1.7

func (self CallMsg) From() web3.Address

func (CallMsg) Gas added in v0.1.7

func (self CallMsg) Gas() uint64

func (CallMsg) GasPrice added in v0.1.7

func (self CallMsg) GasPrice() *big.Int

func (CallMsg) Hash added in v0.1.7

func (self CallMsg) Hash() web3.Hash

func (CallMsg) Nonce added in v0.1.7

func (self CallMsg) Nonce() uint64

func (CallMsg) To added in v0.1.7

func (self CallMsg) To() *web3.Address

func (CallMsg) Value added in v0.1.7

func (self CallMsg) Value() *big.Int

type Codec

type Codec interface {
	Read([]byte) ([]byte, error)
	Write([]byte) error
	Close() error
}

Codec is the codec to write and read messages

type HTTP

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

HTTP is an http transport

func (*HTTP) Call

func (h *HTTP) Call(method string, out interface{}, params ...interface{}) error

Call implements the transport interface

func (*HTTP) Close

func (h *HTTP) Close() error

Close implements the transport interface

type Local added in v0.1.7

type Local struct {
	Executor    *executor.Executor
	BlockNumber uint64
	BlockHashes map[uint64]web3.Hash
	Receipts    map[web3.Hash]*web3.Receipt
	// contains filtered or unexported fields
}

func NewLocal added in v0.1.7

func NewLocal(db schema.ChainDB, chainID uint64) *Local

func (*Local) Call added in v0.1.7

func (self *Local) Call(method string, out interface{}, params ...interface{}) error

Call implements the transport interface

func (*Local) CallEvm added in v0.1.7

func (self *Local) CallEvm(msg *web3.CallMsg) (*web3.ExecutionResult, error)

func (*Local) Close added in v0.1.7

func (self *Local) Close() error

Close implements the transport interface

func (*Local) GetBalance added in v0.1.7

func (self *Local) GetBalance(acct web3.Address) (amount *big.Int)

func (*Local) SetBalance added in v0.1.7

func (self *Local) SetBalance(acct web3.Address, amount *big.Int)

type PubSubTransport

type PubSubTransport interface {
	// Subscribe starts a subscription to a new event
	Subscribe(method string, param interface{}, callback func(b []byte)) (func() error, error)
}

PubSubTransport is a transport that allows subscriptions

type Transport

type Transport interface {
	// Call makes a jsonrpc request
	Call(method string, out interface{}, params ...interface{}) error

	// Close closes the transport connection if necessary
	Close() error
}

Transport is an inteface for transport methods to send jsonrpc requests

func NewTransport

func NewTransport(url string) (Transport, error)

NewTransport creates a new transport object

Jump to

Keyboard shortcuts

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