tx

package
v0.0.0-...-4859bee Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFilter

type BaseFilter struct {
	FilterId    string
	Filter      Filter
	FilterQuery FilterQuery

	LogChan chan interface{}
	// contains filtered or unexported fields
}

func (BaseFilter) ReInstall

func (b BaseFilter) ReInstall()

func (BaseFilter) Run

func (b BaseFilter) Run(pullInterval int64)

type DefaultGasProvider

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

func (*DefaultGasProvider) GetGasLimit

func (d *DefaultGasProvider) GetGasLimit(contractFunc string) *big.Int

func (*DefaultGasProvider) GetGasPrice

func (d *DefaultGasProvider) GetGasPrice(contractFunc string) *big.Int

type DynamicGasProvider

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

func (*DynamicGasProvider) GetGasLimit

func (d *DynamicGasProvider) GetGasLimit(contractFunc string) *big.Int

func (*DynamicGasProvider) GetGasPrice

func (d *DynamicGasProvider) GetGasPrice(contractFunc string) *big.Int

type FastRawTransactionManager

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

func (*FastRawTransactionManager) ExecuteTransaction

func (f *FastRawTransactionManager) ExecuteTransaction(to string, data []byte, value *big.Int,
	gasPrice *big.Int, gasLimit uint64) (string, error)

func (*FastRawTransactionManager) GetNonce

func (f *FastRawTransactionManager) GetNonce(ctx context.Context, account string, refresh bool) (uint64, error)

func (*FastRawTransactionManager) GetPrivateKey

func (f *FastRawTransactionManager) GetPrivateKey() string

type Filter

type Filter interface {
	GetFilterId() (string, error)
	Type() reflect.Type
}

type FilterQuery

type FilterQuery struct {
	BlockHash *common.Hash     // used by eth_getLogs, return logs only from block with this hash
	FromBlock rpc.BlockNumber  // beginning of the queried range, nil means genesis block
	ToBlock   rpc.BlockNumber  // end of the range, nil means latest block
	Addresses []common.Address // restricts matches to events created by specific contracts

	// The Topic list restricts matches to particular event topics. Each event has a list
	// of topics. Topics matches a prefix of that list. An empty element slice matches any
	// topic. Non-empty elements represent an alternative that matches any of the
	// contained topics.
	//
	// Examples:
	// {} or nil          matches any topic list
	// {{A}}              matches topic A in first position
	// {{}, {B}}          matches any topic in first position AND B in second position
	// {{A}, {B}}         matches topic A in first position AND B in second position
	// {{A, B}, {C, D}}   matches topic (A OR B) in first position AND (C OR D) in second position
	Topics [][]common.Hash
}

type GasProvider

type GasProvider interface {
	GetGasPrice(contractFunc string) *big.Int

	GetGasLimit(contractFunc string) *big.Int
}

func NewDynamicGasProvider

func NewDynamicGasProvider(ethClient *ethclient.Client) GasProvider

func NewGasProvider

func NewGasProvider() GasProvider

type LogFilter

type LogFilter struct {
	*BaseFilter
}

func NewLogFilterFilter

func NewLogFilterFilter(rpcClient *rpc.Client, filterQuery FilterQuery) *LogFilter

func (*LogFilter) GetFilterId

func (f *LogFilter) GetFilterId() (string, error)

func (*LogFilter) Type

func (f *LogFilter) Type() reflect.Type

type PendingTransactionFilter

type PendingTransactionFilter struct {
	*BaseFilter
}

func NewPendingTransactionFilter

func NewPendingTransactionFilter(rpcClient *rpc.Client) *PendingTransactionFilter

func (*PendingTransactionFilter) GetFilterId

func (f *PendingTransactionFilter) GetFilterId() (string, error)

func (*PendingTransactionFilter) Type

type RPCTransaction

type RPCTransaction 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"`
	Type             hexutil.Uint64    `json:"type"`
	Accesses         *types.AccessList `json:"accessList,omitempty"`
	ChainID          *hexutil.Big      `json:"chainId,omitempty"`
	V                *hexutil.Big      `json:"v"`
	R                *hexutil.Big      `json:"r"`
	S                *hexutil.Big      `json:"s"`
}

type TransactionInfo

type TransactionInfo struct {
	To   string
	Data []byte
	//WalletAddress string
	PrivateKeyStr string
	Value         *big.Int
}

type TransactionManager

type TransactionManager interface {
	// 返回hash
	ExecuteTransaction(to string, data []byte, value *big.Int, gasPrice *big.Int, gasLimit uint64) (string, error)
	GetNonce(ctx context.Context, account string, refresh bool) (uint64, error)
	GetPrivateKey() string
}

func NewDefaultTransactionManager

func NewDefaultTransactionManager(web3Client *Web3Client,
	privateKeyStr string) TransactionManager

type Web3Client

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

func NewWeb3Client

func NewWeb3Client(nodeUrl string) *Web3Client

func (*Web3Client) EthLogFlowable

func (e *Web3Client) EthLogFlowable(filterQuery FilterQuery, pullInterval int64) chan interface{}

pending Filter 时返回 数组hash 获取LOG 时候返回Log对象 0 or nil means latest block -1 pending

func (*Web3Client) EthPendingFlowable

func (e *Web3Client) EthPendingFlowable(pullInterval int64) chan interface{}

pending Filter 时返回 数组hash 获取LOG 时候返回Log对象 0 or nil means latest block -1 pending

func (*Web3Client) GetEthClient

func (e *Web3Client) GetEthClient() *ethclient.Client

func (*Web3Client) GetGEthClient

func (e *Web3Client) GetGEthClient() *gethclient.Client

func (*Web3Client) GetGasPrice

func (e *Web3Client) GetGasPrice(ctx context.Context) (*big.Int, error)

func (*Web3Client) GetNonce

func (e *Web3Client) GetNonce(ctx context.Context, walletAddress string) (uint64, error)

func (*Web3Client) GetSigner

func (e *Web3Client) GetSigner() types.Signer

func (*Web3Client) NetworkID

func (e *Web3Client) NetworkID() (*big.Int, error)

func (*Web3Client) NewLogFilter

func (e *Web3Client) NewLogFilter(filterQuery FilterQuery) (string, error)

func (*Web3Client) NewPendingTransactionFilter

func (e *Web3Client) NewPendingTransactionFilter() (string, error)

func (*Web3Client) ParityAllTransactions

func (e *Web3Client) ParityAllTransactions(ctx context.Context) ([]*RPCTransaction, error)

func (*Web3Client) SendTransaction

func (e *Web3Client) SendTransaction(ctx context.Context, tx *types.Transaction) (string, error)

func (*Web3Client) SignNewTx

func (e *Web3Client) SignNewTx(ctx context.Context, txInfo TransactionInfo) (*types.Transaction, error)

func (*Web3Client) SignNewTxInfo

func (e *Web3Client) SignNewTxInfo(txInfo TransactionInfo,
	nonce uint64, gasPrice *big.Int, gas uint64) (*types.Transaction, error)

func (*Web3Client) SubscribePendingTransactions

func (e *Web3Client) SubscribePendingTransactions(ctx context.Context, ch chan *types.Transaction, coroutines int) (*rpc.ClientSubscription, error)

func (*Web3Client) TraceTransaction

func (e *Web3Client) TraceTransaction(ctx context.Context, hashStr string) (result interface{}, err error)

func (*Web3Client) TransactionByHash

func (e *Web3Client) TransactionByHash(ctx context.Context, hashStr string) (tx *types.Transaction, isPending bool, err error)

func (*Web3Client) TxPoolContent

func (e *Web3Client) TxPoolContent(ctx context.Context) (map[string]map[string]map[string]*RPCTransaction, error)
content := map[string]map[string]map[string]*RPCTransaction{
		"pending": make(map[string]map[string]*RPCTransaction),
		"queued":  make(map[string]map[string]*RPCTransaction),
	}

func (*Web3Client) TxPoolContentPending

func (e *Web3Client) TxPoolContentPending(ctx context.Context, filter func(toAddress string) bool) ([]*RPCTransaction, error)

Jump to

Keyboard shortcuts

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