provider

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderLocal represents a local node provider such as Geth, Hardhat etc.
	ProviderLocal string = "local"
	// ProviderAlchemy represents blockchain provider ProviderAlchemy (https://www.alchemy.com/)
	ProviderAlchemy = "alchemy"

	// DefaultTimeout is the default value for request timeout
	DefaultTimeout = 30 * time.Second
)

Variables

View Source
var (
	ErrProviderNotSupport = errors.New("provider does not support this vendor-specific api")
)

Functions

This section is empty.

Types

type AlchemyRawContract

type AlchemyRawContract struct {
	Value   string `json:"value"`
	Address string `json:"address"`
	Decimal string `json:"decimal"`
}

type AlchemyTransfer

type AlchemyTransfer struct {
	Category    string              `json:"category"`
	BlockNum    string              `json:"blockNum"`
	From        string              `json:"from"`
	To          string              `json:"to"`
	Value       float64             `json:"value"`
	TokenId     string              `json:"tokenId"`
	Asset       string              `json:"asset"`
	UniqueId    string              `json:"uniqueId"`
	Hash        string              `json:"hash"`
	RawContract *AlchemyRawContract `json:"rawContract"`
}

type GetAssetTransfersParams

type GetAssetTransfersParams struct {
	FromBlock         string   `json:"fromBlock,omitempty"`
	ToBlock           string   `json:"toBlock,omitempty"`
	FromAddress       string   `json:"fromAddress,omitempty"`
	ToAddress         string   `json:"toAddress,omitempty"`
	ContractAddresses []string `json:"contractAddresses,omitempty"`
	Category          []string `json:"category,omitempty"`
	Order             string   `json:"order,omitempty"`
	WithMetadata      bool     `json:"withMetadata,omitempty"`
	ExcludeZeroValue  bool     `json:"excludeZeroValue,omitempty"`
	MaxCount          string   `json:"maxCount,omitempty"`
	PageKey           string   `json:"pageKey,omitempty"`
}

type GetAssetTransfersResult

type GetAssetTransfersResult struct {
	PageKey   string             `json:"pageKey"`
	Transfers []*AlchemyTransfer `json:"transfers"`
}

type Provider

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

func NewProvider

func NewProvider(url string, providerType string) *Provider

NewProvider returns

func (*Provider) BatchBlockByNumber added in v0.2.1

func (p *Provider) BatchBlockByNumber(numberList []common.BigInt) ([]*common.Block, error)

func (*Provider) BatchTransactionByHash

func (p *Provider) BatchTransactionByHash(hashList []common.Hash) (common.Transactions, error)

func (*Provider) CallContract

func (p *Provider) CallContract(address common.Address, abi *abi.ABI, method string, args ...any) ([]any, error)

func (*Provider) EstimateGas

func (p *Provider) EstimateGas(address common.Address, from common.Address, input []byte) (uint64, error)

func (*Provider) GetAssetTransfers

func (p *Provider) GetAssetTransfers(params GetAssetTransfersParams) (*GetAssetTransfersResult, error)

func (*Provider) GetBalance

func (p *Provider) GetBalance(addr common.Address) (common.BigInt, error)

func (*Provider) GetBlockByHash

func (p *Provider) GetBlockByHash(hash common.Hash) (*common.Block, error)

func (*Provider) GetBlockByNumber

func (p *Provider) GetBlockByNumber(number common.BigInt) (*common.Block, error)

func (*Provider) GetBlockHeight

func (p *Provider) GetBlockHeight() (uint64, error)

func (*Provider) GetCode

func (p *Provider) GetCode(addr common.Address) ([]byte, error)

func (*Provider) GetGasPrice

func (p *Provider) GetGasPrice() (common.BigInt, error)

func (*Provider) GetNetwork

func (p *Provider) GetNetwork() (common.BigInt, error)

func (*Provider) GetSigner

func (p *Provider) GetSigner() (types.Signer, error)

func (*Provider) GetType

func (p *Provider) GetType() string

func (*Provider) SendTransaction

func (p *Provider) SendTransaction(txnReq *common.TxnRequest) (common.Hash, error)

func (*Provider) SubscribeNewHead

func (p *Provider) SubscribeNewHead(ch chan<- *common.Header) (ethereum.Subscription, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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