backend

package
v0.0.0-...-1302c52 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMixinBackend

func NewMixinBackend(ctx context.Context, chain string, rawurl string, dbdsn string) (*mixinBackend, error)

Types

type Backend

type Backend interface {
	HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
	BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
	BlockTimestamp(ctx context.Context, number rpc.BlockNumber) (uint64, error)
	TransactionByHash(ctx context.Context, txHash common.Hash) (*types.Transaction, uint64, uint64, error)
	TraceBlock(ctx context.Context, number rpc.BlockNumber) ([]*CallFrame, error)
	TraceTransaction(ctx context.Context, txHash common.Hash) ([]*CallFrame, error)
}

Backend interface provides the common API services

type CallAction

type CallAction struct {
	Author         *common.Address `json:"author,omitempty"`
	RewardType     string          `json:"rewardType,omitempty"`
	SelfDestructed *common.Address `json:"address,omitempty"`
	Balance        *big.Int        `json:"balance,omitempty"`
	CallType       string          `json:"callType,omitempty"`
	CreationMethod string          `json:"creationMethod,omitempty"`
	From           *common.Address `json:"from,omitempty"`
	Gas            *uint64         `json:"gas,omitempty"`
	Init           *[]byte         `json:"init,omitempty"`
	Input          *[]byte         `json:"input,omitempty"`
	RefundAddress  *common.Address `json:"refundAddress,omitempty"`
	To             *common.Address `json:"to,omitempty"`
	Value          *big.Int        `json:"value,omitempty"`
}

func (CallAction) MarshalJSON

func (f CallAction) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*CallAction) UnmarshalJSON

func (f *CallAction) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type CallFrame

type CallFrame struct {
	Action              CallAction   `json:"action"`
	BlockHash           *common.Hash `json:"blockHash,omitempty"`
	BlockNumber         uint64       `json:"blockNumber"`
	Error               string       `json:"error,omitempty"`
	Result              *CallResult  `json:"result,omitempty"`
	Subtraces           int          `json:"subtraces"`
	TraceAddress        []int        `json:"traceAddress"`
	TransactionHash     *common.Hash `json:"transactionHash"`
	TransactionPosition uint64       `json:"transactionPosition"`
	Type                string       `json:"type"`
}

type CallResult

type CallResult struct {
	Address *common.Address `json:"address,omitempty"`
	Code    *[]byte         `json:"code,omitempty"`
	GasUsed *uint64         `json:"gasUsed,omitempty"`
	Output  *[]byte         `json:"output,omitempty"`
}

func (CallResult) MarshalJSON

func (f CallResult) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*CallResult) UnmarshalJSON

func (f *CallResult) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type Trace

type Trace struct {
	Timestamp       time.Time        `json:"block_timestamp" gorm:"column:block_timestamp" example:"2023-01-02 12:00:23"`
	BlockNum        uint64           `json:"blknum" gorm:"column:blknum" example:"14218502"`
	TransactionHash *string          `json:"txhash" gorm:"column:txhash" example:"0xaae3c030ee04b1ef071e00198818a113a3ac20db252fbfba4f78572aa59f5226"`
	TransactionPos  uint64           `json:"txpos" gorm:"column:txpos" example:"0"`
	FromAddress     *string          `json:"from_address" gorm:"column:from_address" example:"0x1dc907d55f1be2bc4370feb0f01fb89324b8941c"`
	ToAddress       *string          `json:"to_address" gorm:"column:to_address" example:"0x7a250d5630b4cf539739df2c5dacb4c659f2488d"`
	Value           *decimal.Decimal `json:"value" gorm:"column:value" example:"250000000000000000"`
	Input           string           `json:"input" gorm:"column:input" example:"0x"`
	Output          string           `json:"output" gorm:"column:output" example:"0x"`
	TraceType       string           `json:"trace_type" gorm:"column:trace_type" example:"call"`
	CallType        string           `json:"call_type" gorm:"column:call_type" example:"call"`
	RewardType      string           `json:"reward_type" gorm:"column:reward_type" example:"block"`
	Gas             *decimal.Decimal `json:"gas" gorm:"column:gas" example:"477212"`
	GasUsed         uint64           `json:"gas_used" gorm:"column:gas_used" example:"91903"`
	SubTraces       int              `json:"subtraces" gorm:"column:subtraces" example:"0"`
	TraceAddress    string           `json:"trace_address" gorm:"column:trace_address" example:"[]"`
	Error           string           `json:"error" gorm:"column:error" example:"Reverted"`
}

func (*Trace) AsCallFrame

func (t *Trace) AsCallFrame() *CallFrame

Jump to

Keyboard shortcuts

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