types

package
v0.0.0-...-4c8f420 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package types implements different core types of the API.

Package types implements different core types of the API.

Package types implements different core types of the API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	common.Address
}

Address is a wrapper around common.Address that implements the sql.Scanner and driver.Valuer interfaces.

func (*Address) Scan

func (a *Address) Scan(value interface{}) error

Scan implements the Scanner interface. It is used by the sql package to convert a database value into Address.

func (*Address) Value

func (a *Address) Value() (driver.Value, error)

Value implements the driver.Valuer interface. This method is used by the database/sql package to convert Address into a value that can be stored in a database. The converted value is a string without the 0x prefix.

type Big

type Big struct {
	hexutil.Big
}

Big is a wrapper around hexutil.Big that implements the sql.Scanner and driver.Valuer interfaces.

func (*Big) Scan

func (b *Big) Scan(value interface{}) error

Scan implements the Scanner interface. It is used by the sql package to convert a database value into Big.

func (*Big) Value

func (b *Big) Value() (driver.Value, error)

Value implements the driver.Valuer interface. This method is used by the database/sql package to convert Big into a value that can be stored in a database.

type Block

type Block struct {
	// Number represents the block number. nil when its pending block.
	Number hexutil.Uint64 `json:"number"`

	// Epoch represents the block epoch.
	Epoch hexutil.Uint64 `json:"epoch"`

	// Hash represents hash of the block. nil when its pending block.
	Hash common.Hash `json:"hash"`

	// ParentHash represents hash of the parent block.
	ParentHash common.Hash `json:"parentHash"`

	// Size represents the size of this block in bytes.
	Size hexutil.Uint64 `json:"size"`

	// GasLimit represents the maximum gas allowed in this block.
	GasLimit hexutil.Uint64 `json:"gasLimit"`

	// GasUsed represents the actual total used gas by all transactions in this block.
	GasUsed hexutil.Uint64 `json:"gasUsed"`

	// TimeStamp represents the unix timestamp for when the block was collated.
	TimeStamp hexutil.Uint64 `json:"timestamp"`

	// Txs represents array of 32 bytes hashes of transactions included in the block.
	Txs []*common.Hash `json:"transactions"`
}

Block represents basic information provided by the API about block inside Opera blockchain.

type Hash

type Hash struct {
	common.Hash
}

Hash is a wrapper around common.Hash that implements the sql.Scanner and driver.Valuer interfaces.

func (*Hash) Scan

func (h *Hash) Scan(value interface{}) error

Scan implements the Scanner interface. It is used by the sql package to convert a database value into Hash.

func (*Hash) Value

func (h *Hash) Value() (driver.Value, error)

Value implements the driver.Valuer interface. This method is used by the database/sql package to convert Hash into a value that can be stored in a database. The converted value is a string without the 0x prefix.

type Project

type Project struct {
	Id                  int64    `db:"id"`
	ProjectId           uint64   `db:"project_id"`
	OwnerAddress        *Address `db:"owner_address"`
	ReceiverAddress     *Address `db:"receiver_address"`
	Name                string   `db:"name"`
	Url                 string   `db:"url"`
	ImageUrl            string   `db:"image_url"`
	LastWithdrawalEpoch *uint64  `db:"last_withdrawal_epoch"`
	CollectedRewards    *Big     `db:"collected_rewards"`
	ClaimedRewards      *Big     `db:"claimed_rewards"`
	RewardsToClaim      *Big     `db:"rewards_to_claim"`
	TransactionsCount   uint64   `db:"transactions_count"`
	ActiveFromEpoch     uint64   `db:"active_from_epoch"`
	ActiveToEpoch       *uint64  `db:"active_to_epoch"`
}

type ProjectContract

type ProjectContract struct {
	Id        int64    `db:"id"`
	ProjectId int64    `db:"project_id"`
	Address   *Address `db:"address"`
	Approved  bool     `db:"is_approved"`
}

type ProjectMetadata

type ProjectMetadata struct {
	Name     string `json:"name"`
	ImageUrl string `json:"image_url"`
}

type Transaction

type Transaction struct {
	Id int64 `db:"id"`
	// ProjectId represents the project ID this transaction belongs to.
	ProjectId int64 `db:"project_id"`

	// Hash represents 32 bytes hash of the transaction.
	Hash *Hash `json:"hash" db:"hash"`

	// BlockHash represents hash of the block where this transaction was in. nil when it's pending.
	BlockHash *Hash `json:"blockHash" db:"block_hash"`

	// BlockNumber represents number of the block where this transaction was in. nil when it's pending.
	BlockNumber *hexutil.Uint64 `json:"blockNumber" db:"block_number"`

	// Epoch represents the epoch that transaction belongs to.
	Epoch hexutil.Uint64 `db:"epoch_number"`

	// Timestamp represents the time stamp of the transaction.
	Timestamp time.Time `json:"timestamp" db:"timestamp"`

	// From represents address of the sender.
	From *Address `json:"from" db:"from_address"`

	// To represents the address of the receiver. nil when it's a contract creation transaction.
	To *Address `json:"to,omitempty" db:"to_address"`

	// GasUsed represents the amount of gas used by this specific transaction alone.
	GasUsed *hexutil.Uint64 `json:"gasUsed" db:"gas_used"`

	// GasPrice represents gas price provided by the sender in Wei.
	GasPrice *Big `json:"gasPrice" db:"gas_price"`

	// RewardToClaim represents the amount of reward to claim in Wei.
	RewardToClaim *Big `db:"reward_to_claim"`

	// Logs represents a list of log records created along with the transaction
	Logs []types.Log `json:"logs"`
}

Transaction represents basic information provided by the API about transaction inside Opera blockchain.

type TransactionTrace

type TransactionTrace struct {
	Action       *TransactionTraceAction `json:"action"`
	Result       *TransactionTraceResult `json:"result"`
	Error        *string                 `json:"error"`
	TraceAddress []int                   `json:"traceAddress"`
}

TransactionTrace represents a transaction trace record.

func (*TransactionTrace) ParentStringPath

func (t *TransactionTrace) ParentStringPath() *string

ParentStringPath returns the trace address of a prent as a string path.

func (*TransactionTrace) StringPath

func (t *TransactionTrace) StringPath() string

StringPath returns the trace address as a string path.

type TransactionTraceAction

type TransactionTraceAction struct {
	From *common.Address `json:"from"`
	To   *common.Address `json:"to"`
}

type TransactionTraceResult

type TransactionTraceResult struct {
	GasUsed *hexutil.Uint64 `json:"gasUsed"`
}

type WithdrawalRequest

type WithdrawalRequest struct {
	Id            int64   `db:"id"`
	ProjectId     int64   `db:"project_id"`
	RequestEpoch  uint64  `db:"request_epoch"`
	WithdrawEpoch *uint64 `db:"withdraw_epoch"`
	Amount        *Big    `db:"amount"`
}

Jump to

Keyboard shortcuts

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