app

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg Config) error

func Start

func Start(ctx context.Context, cfg Config) (string, error)

Types

type Config

type Config struct {
	ListenAddr  string
	Network     netconf.ID
	BaseRPC     string
	FireAPIKey  string
	FireKeyPath string
}

func DefaultConfig

func DefaultConfig() Config

type JSONRPCError

type JSONRPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

type JSONRPCMessage

type JSONRPCMessage struct {
	Version string          `json:"jsonrpc,omitempty"`
	ID      json.RawMessage `json:"id,omitempty"`
	Method  string          `json:"method,omitempty"`
	Params  json.RawMessage `json:"params,omitempty"`
	Error   *JSONRPCError   `json:"error,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
}

JSONRPCMessage is a JSON-RPC request, notification, successful response or error response. Which one it is depends on the fields.

type Middleware

type Middleware func(context.Context, JSONRPCMessage) (JSONRPCMessage, error)

func NewSendTxMiddleware

func NewSendTxMiddleware(txsigner txSigner, chainID uint64) Middleware

NewSendTxMiddleware returns a middleware func that

  • intercepts eth_sendTransaction requests, signs them `txsigner` and replaces them with eth_sendRawTransaction requests
  • leaves all other requests unmodified

type TransactionArgs

type TransactionArgs struct {
	From                 *common.Address `json:"from"`
	To                   *common.Address `json:"to"`
	Gas                  *hexutil.Uint64 `json:"gas"`
	GasPrice             *hexutil.Big    `json:"gasPrice"`
	MaxFeePerGas         *hexutil.Big    `json:"maxFeePerGas"`
	MaxPriorityFeePerGas *hexutil.Big    `json:"maxPriorityFeePerGas"`
	Value                *hexutil.Big    `json:"value"`
	Nonce                *hexutil.Uint64 `json:"nonce"`

	// We accept "data" and "input" for backwards-compatibility reasons.
	// "input" is the newer name and should be preferred by clients.
	// Issue detail: https://github.com/ethereum/go-ethereum/issues/15628
	Data  *hexutil.Bytes `json:"data"`
	Input *hexutil.Bytes `json:"input"`

	// Introduced by AccessListTxType transaction.
	AccessList *types.AccessList `json:"accessList,omitempty"`
	ChainID    *hexutil.Big      `json:"chainId,omitempty"`
}

TransactionArgs represents the arguments to construct a new transaction or a message call.

func (*TransactionArgs) ToTransaction

func (args *TransactionArgs) ToTransaction() *types.Transaction

ToTransaction converts the arguments to a transaction. This assumes that setDefaults has been called. NOTE: setDefaults omitted in this copy, instead keeping txargs as provided.

Jump to

Keyboard shortcuts

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