web3

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateWeb3Server

func GenerateWeb3Server(server *aggregator.Server, privateKeys []*ecdsa.PrivateKey, ganacheMode bool, plugins map[string]interface{}) (*rpc.Server, error)

func HandleCallError

func HandleCallError(res *evm.TxResult, ganacheMode bool) error

func HandleNodeInterfaceCall

func HandleNodeInterfaceCall(srv *aggregator.Server, calldata []byte) ([]byte, error)

Types

type Accounts

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

func NewAccounts

func NewAccounts(ethServer *Server, privateKeys []*ecdsa.PrivateKey) *Accounts

func (*Accounts) Accounts

func (s *Accounts) Accounts() []common.Address

func (*Accounts) SendTransaction

func (s *Accounts) SendTransaction(ctx context.Context, args *SendTransactionArgs) (common.Hash, error)

func (*Accounts) Sign

func (s *Accounts) Sign(account common.Address, data hexutil.Bytes) (hexutil.Bytes, error)

type CallTxArgs

type CallTxArgs struct {
	From     *common.Address `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Data     *hexutil.Bytes  `json:"data"`
}

type EthClient

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

func NewEthClient

func NewEthClient(srv *aggregator.Server, ganacheMode bool) *EthClient

func (*EthClient) CallContract

func (c *EthClient) CallContract(_ context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*EthClient) CodeAt

func (c *EthClient) CodeAt(_ context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)

func (*EthClient) EstimateGas

func (c *EthClient) EstimateGas(_ context.Context, call ethereum.CallMsg) (uint64, error)

func (*EthClient) FilterLogs

func (c *EthClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

func (*EthClient) PendingCodeAt

func (c *EthClient) PendingCodeAt(_ context.Context, account common.Address) ([]byte, error)

func (*EthClient) PendingNonceAt

func (c *EthClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*EthClient) SendTransaction

func (c *EthClient) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*EthClient) SubscribeFilterLogs

func (c *EthClient) SubscribeFilterLogs(_ context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

func (*EthClient) SuggestGasPrice

func (c *EthClient) SuggestGasPrice(_ context.Context) (*big.Int, error)

func (*EthClient) TransactionReceipt

func (c *EthClient) TransactionReceipt(_ context.Context, txHash common.Hash) (*types.Receipt, error)

type FeeSetResult

type FeeSetResult struct {
	L1Transaction *hexutil.Big `json:"l1Transaction"`
	L1Calldata    *hexutil.Big `json:"l1Calldata"`
	L2Storage     *hexutil.Big `json:"l2Storage"`
	L2Computation *hexutil.Big `json:"l2Computation"`
}

type FeeStatsResult

type FeeStatsResult struct {
	Prices    *FeeSetResult `json:"prices"`
	UnitsUsed *FeeSetResult `json:"unitsUsed"`
	Paid      *FeeSetResult `json:"paid"`
}

type GetBlockResult

type GetBlockResult struct {
	Number           *hexutil.Big      `json:"number"`
	Hash             hexutil.Bytes     `json:"hash"`
	ParentHash       hexutil.Bytes     `json:"parentHash"`
	MixDigest        hexutil.Bytes     `json:"mixHash"`
	Nonce            *types.BlockNonce `json:"nonce"`
	Sha3Uncles       hexutil.Bytes     `json:"sha3Uncles"`
	LogsBloom        hexutil.Bytes     `json:"logsBloom"`
	TransactionsRoot hexutil.Bytes     `json:"transactionsRoot"`
	StateRoot        hexutil.Bytes     `json:"stateRoot"`
	ReceiptsRoot     hexutil.Bytes     `json:"receiptsRoot"`
	Miner            hexutil.Bytes     `json:"miner"`
	Difficulty       *hexutil.Big      `json:"difficulty"`
	TotalDifficulty  *hexutil.Big      `json:"totalDifficulty"`
	ExtraData        *hexutil.Bytes    `json:"extraData"`
	Size             *hexutil.Uint64   `json:"size"`
	GasLimit         *hexutil.Uint64   `json:"gasLimit"`
	GasUsed          *hexutil.Uint64   `json:"gasUsed"`
	Timestamp        *hexutil.Uint64   `json:"timestamp"`
	Transactions     interface{}       `json:"transactions"`
	Uncles           *[]hexutil.Bytes  `json:"uncles"`

	L1BlockNumber *hexutil.Big `json:"l1BlockNumber"`
}

type GetTransactionReceiptResult

type GetTransactionReceiptResult struct {
	TransactionHash   common.Hash     `json:"transactionHash"`
	TransactionIndex  hexutil.Uint64  `json:"transactionIndex"`
	BlockHash         common.Hash     `json:"blockHash"`
	BlockNumber       *hexutil.Big    `json:"blockNumber"`
	From              common.Address  `json:"from"`
	To                *common.Address `json:"to"`
	CumulativeGasUsed hexutil.Uint64  `json:"cumulativeGasUsed"`
	GasUsed           hexutil.Uint64  `json:"gasUsed"`
	ContractAddress   *common.Address `json:"contractAddress"`
	Logs              []*types.Log    `json:"logs"`
	LogsBloom         hexutil.Bytes   `json:"logsBloom"`
	Status            hexutil.Uint64  `json:"status"`

	// Arbitrum Specific Fields
	ReturnCode    hexutil.Uint64  `json:"returnCode"`
	ReturnData    hexutil.Bytes   `json:"returnData"`
	FeeStats      *FeeStatsResult `json:"feeStats"`
	L1BlockNumber *hexutil.Big    `json:"l1BlockNumber"`
}

Receipt represents the results of a transaction.

type Net

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

func (*Net) Version

func (net *Net) Version() string

type PersonalAccounts

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

func NewPersonalAccounts

func NewPersonalAccounts(privateKeys []*ecdsa.PrivateKey) *PersonalAccounts

func (*PersonalAccounts) Sign

func (s *PersonalAccounts) Sign(data hexutil.Bytes, account common.Address, _ *hexutil.Bytes) (hexutil.Bytes, error)

type SendTransactionArgs

type SendTransactionArgs struct {
	From     *common.Address `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
	Data     *hexutil.Bytes  `json:"data"`
}

type Server

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

func NewServer

func NewServer(
	srv *aggregator.Server,
	ganacheMode bool,
) *Server

func (*Server) Accounts

func (s *Server) Accounts() []common.Address

func (*Server) BlockNumber

func (s *Server) BlockNumber() (hexutil.Uint64, error)

func (*Server) Call

func (s *Server) Call(callArgs CallTxArgs, blockNum *rpc.BlockNumber) (hexutil.Bytes, error)

func (*Server) ChainId

func (s *Server) ChainId() hexutil.Uint64

func (*Server) EstimateGas

func (s *Server) EstimateGas(args CallTxArgs) (hexutil.Uint64, error)

func (*Server) GasPrice

func (s *Server) GasPrice() *hexutil.Big

func (*Server) GetBalance

func (s *Server) GetBalance(address *common.Address, blockNum *rpc.BlockNumber) (*hexutil.Big, error)

func (*Server) GetBlockByHash

func (s *Server) GetBlockByHash(blockHashRaw hexutil.Bytes, includeTxData bool) (*GetBlockResult, error)

func (*Server) GetBlockByNumber

func (s *Server) GetBlockByNumber(blockNum *rpc.BlockNumber, includeTxData bool) (*GetBlockResult, error)

func (*Server) GetBlockTransactionCountByHash

func (s *Server) GetBlockTransactionCountByHash(blockHash common.Hash) (*hexutil.Big, error)

func (*Server) GetBlockTransactionCountByNumber

func (s *Server) GetBlockTransactionCountByNumber(blockNum *rpc.BlockNumber) (*hexutil.Big, error)

func (*Server) GetCode

func (s *Server) GetCode(address *common.Address, blockNum *rpc.BlockNumber) (hexutil.Bytes, error)

func (*Server) GetStorageAt

func (s *Server) GetStorageAt(address *common.Address, index *hexutil.Big, blockNum *rpc.BlockNumber) (*hexutil.Big, error)

func (*Server) GetTransactionByBlockHashAndIndex

func (s *Server) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint64) (*TransactionResult, error)

func (*Server) GetTransactionByBlockNumberAndIndex

func (s *Server) GetTransactionByBlockNumberAndIndex(blockNum *rpc.BlockNumber, index hexutil.Uint64) (*TransactionResult, error)

func (*Server) GetTransactionByHash

func (s *Server) GetTransactionByHash(txHash hexutil.Bytes) (*TransactionResult, error)

func (*Server) GetTransactionCount

func (s *Server) GetTransactionCount(ctx context.Context, address *common.Address, blockNum *rpc.BlockNumber) (hexutil.Uint64, error)

func (*Server) GetTransactionReceipt

func (s *Server) GetTransactionReceipt(txHash hexutil.Bytes) (*GetTransactionReceiptResult, error)

func (*Server) SendRawTransaction

func (s *Server) SendRawTransaction(ctx context.Context, data hexutil.Bytes) (hexutil.Bytes, error)

type TransactionResult

type TransactionResult struct {
	BlockHash        *common.Hash    `json:"blockHash"`
	BlockNumber      *hexutil.Big    `json:"blockNumber"`
	From             common.Address  `json:"from"`
	Gas              hexutil.Uint64  `json:"gas"`
	GasPrice         *hexutil.Big    `json:"gasPrice"`
	Hash             common.Hash     `json:"hash"`
	Input            hexutil.Bytes   `json:"input"`
	Nonce            hexutil.Uint64  `json:"nonce"`
	To               *common.Address `json:"to"`
	TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
	Value            *hexutil.Big    `json:"value"`
	V                *hexutil.Big    `json:"v"`
	R                *hexutil.Big    `json:"r"`
	S                *hexutil.Big    `json:"s"`

	// Arbitrum Specific Fields
	L1SeqNum        *hexutil.Big    `json:"l1SequenceNumber"`
	ParentRequestId *common.Hash    `json:"parentRequestId"`
	IndexInParent   *hexutil.Big    `json:"indexInParent"`
	ArbType         hexutil.Uint64  `json:"arbType"`
	ArbSubType      *hexutil.Uint64 `json:"arbSubType"`
	L1BlockNumber   *hexutil.Big    `json:"l1BlockNumber"`
}

type Web3

type Web3 struct {
}

func (*Web3) ClientVersion

func (web3 *Web3) ClientVersion() string

func (*Web3) Sha3

func (web3 *Web3) Sha3(data hexutil.Bytes) hexutil.Bytes

Jump to

Keyboard shortcuts

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