types

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: LGPL-3.0 Imports: 15 Imported by: 88

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBigInt

func NewBigInt(x uint64) *hexutil.Big

NewBigInt creates a big number with specified uint64 value.

func NewBigIntByRaw added in v0.1.1

func NewBigIntByRaw(x *big.Int) *hexutil.Big

NewBigIntByRaw creates a hexutil.big with specified big.int value.

func NewBytes added in v0.1.1

func NewBytes(input []byte) hexutil.Bytes

NewBytes creates a hexutil.Bytes with specified input value.

func NewUint added in v0.1.1

func NewUint(x uint) *hexutil.Uint

NewUint creates a hexutil.Uint with specified uint value.

func NewUint64 added in v0.1.1

func NewUint64(x uint64) *hexutil.Uint64

NewUint64 creates a hexutil.Uint64 with specified uint64 value.

Types

type AccountInfo added in v0.1.1

type AccountInfo struct {
	Balance *hexutil.Big `json:"balance"`
	// : U256,
	Nonce *hexutil.Big `json:"nonce"`
	// : U256,
	CodeHash Hash `json:"codeHash"`
	//  : H256,
	StakingBalance *hexutil.Big `json:"stakingBalance"`
	// : U256,
	CollateralForStorage *hexutil.Big `json:"collateralForStorage"`
	// : U256,
	AccumulatedInterestReturn *hexutil.Big `json:"accumulatedInterestReturn"`
	// : U256,
	Admin Address `json:"admin"`
}

type AccountPendingInfo added in v0.1.1

type AccountPendingInfo struct {
	LocalNonce    *hexutil.Big `json:"localNonce"`
	PendingCount  *hexutil.Big `json:"pendingCount"`
	PendingNonce  *hexutil.Big `json:"pendingNonce"`
	NextPendingTx Hash         `json:"nextPendingTx"`
}

type AccountPendingTransactions added in v0.1.1

type AccountPendingTransactions struct {
	PendingTransactions []Transaction `json:"pendingTransactions"`
	// type maybe string/Pending
	FirstTxStatus *TransactionStatus `json:"firstTxStatus"`
	PendingCount  hexutil.Uint64     `json:"pendingCount"`
}

type Address

type Address = address.Address

type Block

type Block struct {
	BlockHeader
	Transactions []Transaction `json:"transactions"`
}

Block represents a block in Conflux, including block header and a list of detailed transactions.

func (*Block) DecodeRLP added in v0.1.1

func (block *Block) DecodeRLP(r *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface.

func (Block) EncodeRLP added in v0.1.1

func (block Block) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface.

type BlockHeader

type BlockHeader struct {
	Hash                  Hash           `json:"hash"`
	ParentHash            Hash           `json:"parentHash"`
	Height                *hexutil.Big   `json:"height"`
	Miner                 Address        `json:"miner"`
	DeferredStateRoot     Hash           `json:"deferredStateRoot"`
	DeferredReceiptsRoot  Hash           `json:"deferredReceiptsRoot"`
	DeferredLogsBloomHash Hash           `json:"deferredLogsBloomHash"`
	Blame                 hexutil.Uint64 `json:"blame"`
	TransactionsRoot      Hash           `json:"transactionsRoot"`
	EpochNumber           *hexutil.Big   `json:"epochNumber"`
	BlockNumber           *hexutil.Big   `json:"blockNumber"`
	GasLimit              *hexutil.Big   `json:"gasLimit"`
	GasUsed               *hexutil.Big   `json:"gasUsed"`
	Timestamp             *hexutil.Big   `json:"timestamp"`
	Difficulty            *hexutil.Big   `json:"difficulty"`
	PowQuality            *hexutil.Big   `json:"powQuality"`
	RefereeHashes         []Hash         `json:"refereeHashes"`
	Adaptive              bool           `json:"adaptive"`
	Nonce                 *hexutil.Big   `json:"nonce"`
	Size                  *hexutil.Big   `json:"size"`
	Custom                [][]byte       `json:"custom"`
}

BlockHeader represents a block header in Conflux.

func (*BlockHeader) DecodeRLP added in v0.1.1

func (bh *BlockHeader) DecodeRLP(r *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface.

func (BlockHeader) EncodeRLP added in v0.1.1

func (bh BlockHeader) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface.

type BlockSummary

type BlockSummary struct {
	BlockHeader
	Transactions []Hash `json:"transactions"`
}

BlockSummary includes block header and a list of transaction hashes

func (*BlockSummary) DecodeRLP added in v0.1.1

func (bs *BlockSummary) DecodeRLP(r *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface.

func (BlockSummary) EncodeRLP added in v0.1.1

func (bs BlockSummary) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface.

type Bloom

type Bloom string

Bloom is a hash type with 256 bytes.

type Call added in v0.1.1

type Call struct {
	From     Address       `json:"from"`
	To       Address       `json:"to"`
	Value    hexutil.Big   `json:"value"`
	Gas      hexutil.Big   `json:"gas"`
	Input    hexutil.Bytes `json:"input"`
	CallType string        `json:"callType"`
}

independent action structs

type CallRequest

type CallRequest struct {
	From     *Address     `json:"from,omitempty"`
	To       *Address     `json:"to,omitempty"`
	GasPrice *hexutil.Big `json:"gasPrice,omitempty"`
	Gas      *hexutil.Big `json:"gas,omitempty"`
	Value    *hexutil.Big `json:"value,omitempty"`
	// NOTE, cannot use *hexutil.Bytes or hexutil.Bytes here.
	// Otherwise, hexutil.Bytes.UnmarshalJSON will called to
	// unmarshal from nil and cause to errNonString error.
	Data         *string         `json:"data,omitempty"`
	Nonce        *hexutil.Big    `json:"nonce,omitempty"`
	StorageLimit *hexutil.Uint64 `json:"storageLimit,omitempty"`
}

CallRequest represents a request to execute contract.

func (*CallRequest) FillByCallOption added in v0.1.1

func (request *CallRequest) FillByCallOption(option *ContractMethodCallOption)

FillByCallOption fills CallRequest fields by

func (*CallRequest) FillByUnsignedTx

func (request *CallRequest) FillByUnsignedTx(tx *UnsignedTransaction)

FillByUnsignedTx fills CallRequest fields by tx

type CallResult added in v0.1.1

type CallResult struct {
	Outcome    string        `json:"outcome"`
	GasLeft    hexutil.Big   `json:"gasLeft"`
	ReturnData hexutil.Bytes `json:"returnData"`
}

type ChainReorg added in v0.1.1

type ChainReorg struct {
	RevertTo *hexutil.Big `json:"revertTo"`
}

type CheckBalanceAgainstTransactionResponse added in v0.1.1

type CheckBalanceAgainstTransactionResponse struct {
	/// Whether the account should pay transaction fee by self.
	WillPayTxFee bool `json:"willPayTxFee"`
	/// Whether the account should pay collateral by self.
	WillPayCollateral bool `json:"willPayCollateral"`
	/// Whether the account balance is enough for this transaction.
	IsBalanceEnough bool `json:"isBalanceEnough"`
}

type ContractDeployOption

type ContractDeployOption struct {
	UnsignedTransactionBase
	// TimeoutInSecond represents the timeout of deploy contract,
	// default value is 0 which means never timeout
	Timeout time.Duration
}

ContractDeployOption for setting option when deploying contract

type ContractMethodCallOption

type ContractMethodCallOption struct {
	From         *Address
	Nonce        *hexutil.Big
	GasPrice     *hexutil.Big
	Gas          *hexutil.Big
	Value        *hexutil.Big
	StorageLimit *hexutil.Uint64
	ChainID      *hexutil.Big
	Epoch        *Epoch
}

ContractMethodCallOption for setting option when call contract method

type ContractMethodSendOption

type ContractMethodSendOption UnsignedTransactionBase

ContractMethodSendOption for setting option when call contract method

type Create added in v0.1.1

type Create struct {
	From  Address       `json:"from"`
	Value hexutil.Big   `json:"value"`
	Gas   hexutil.Big   `json:"gas"`
	Init  hexutil.Bytes `json:"init"`
}

type CreateResult added in v0.1.1

type CreateResult struct {
	Outcome    string        `json:"outcome"`
	Addr       Address       `json:"addr"`
	GasLeft    hexutil.Big   `json:"gasLeft"`
	ReturnData hexutil.Bytes `json:"returnData"`
}

type DepositInfo added in v0.1.1

type DepositInfo struct {
	AccumulatedInterestRate *hexutil.Big `json:"accumulatedInterestRate"`
	Amount                  *hexutil.Big `json:"amount"`
	DepositTime             uint64       `json:"depositTime"`
}

DepositInfo represents user deposit history

type Epoch

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

Epoch represents an epoch in Conflux.

var (
	EpochEarliest         *Epoch = &Epoch{"earliest", nil}
	EpochLatestCheckpoint *Epoch = &Epoch{"latest_checkpoint", nil}
	EpochLatestConfirmed  *Epoch = &Epoch{"latest_confirmed", nil}
	EpochLatestState      *Epoch = &Epoch{"latest_state", nil}
	EpochLatestMined      *Epoch = &Epoch{"latest_mined", nil}
)

Const epoch definitions

func NewEpochNumber

func NewEpochNumber(number *hexutil.Big) *Epoch

NewEpochNumber creates an instance of Epoch with specified number.

func NewEpochNumberBig added in v0.1.1

func NewEpochNumberBig(number *big.Int) *Epoch

NewEpochNumberBig creates an instance of Epoch with specified big number.

func NewEpochNumberUint64 added in v0.1.1

func NewEpochNumberUint64(number uint64) *Epoch

NewEpochNumberUint64 creates an instance of Epoch with specified uint64 number.

func NewEpochWithBlockHash

func NewEpochWithBlockHash(blockHash Hash) *Epoch

NewEpochWithBlockHash creates an instance of Epoch with specified block hash.

func (*Epoch) Equals added in v0.1.1

func (e *Epoch) Equals(target *Epoch) bool

Equals checks if e equals target

func (Epoch) MarshalText

func (e Epoch) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Epoch) String

func (e *Epoch) String() string

String implements the fmt.Stringer interface

func (*Epoch) ToInt added in v0.1.1

func (e *Epoch) ToInt() (result *big.Int, isSuccess bool)

ToInt returns epoch number in type big.Int

func (*Epoch) UnmarshalJSON added in v0.1.1

func (e *Epoch) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Estimate

type Estimate struct {
	GasLimit              *hexutil.Big `json:"gasLimit"`
	GasUsed               *hexutil.Big `json:"gasUsed"`
	StorageCollateralized *hexutil.Big `json:"storageCollateralized"`
}

Estimate represents estimated gas will be used and storage will be collateralized when transaction excutes

type Hash

type Hash string

Hash represents the 32 byte Keccak256 hash of arbitrary data in HEX format.

func (Hash) String

func (hash Hash) String() string

String implements the interface stringer

func (Hash) ToCommonHash added in v0.1.1

func (hash Hash) ToCommonHash() *common.Hash

ToCommonHash converts hash to common.Hash

func (*Hash) UnmarshalJSON added in v0.1.1

func (hash *Hash) UnmarshalJSON(input []byte) error

type InternalTransferAction added in v0.1.1

type InternalTransferAction struct {
	From  Address     `json:"from"`
	To    Address     `json:"to"`
	Value hexutil.Big `json:"value"`
}

type LocalizedBlockTrace added in v0.1.1

type LocalizedBlockTrace struct {
	TransactionTraces []LocalizedTransactionTrace `json:"transactionTraces"`
	EpochHash         Hash                        `json:"epochHash"`
	EpochNumber       hexutil.Big                 `json:"epochNumber"`
	BlockHash         Hash                        `json:"blockHash"`
}

type LocalizedTrace added in v0.1.1

type LocalizedTrace struct {
	Action              interface{}     `json:"action"`
	Type                TraceType       `json:"type"`
	EpochHash           *Hash           `json:"epochHash,omitempty"`
	EpochNumber         *hexutil.Big    `json:"epochNumber,omitempty"`
	BlockHash           *Hash           `json:"blockHash,omitempty"`
	TransactionPosition *hexutil.Uint64 `json:"transactionPosition,omitempty"`
	TransactionHash     *Hash           `json:"transactionHash,omitempty"`
}

func (*LocalizedTrace) UnmarshalJSON added in v0.1.1

func (l *LocalizedTrace) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals Input and Init type from []byte to hexutil.Bytes

type LocalizedTraceNode added in v0.1.1

type LocalizedTraceNode struct {
	Type                TraceType       `json:"type"`
	EpochHash           *Hash           `json:"epochHash,omitempty"`
	EpochNumber         *hexutil.Big    `json:"epochNumber,omitempty"`
	BlockHash           *Hash           `json:"blockHash,omitempty"`
	TransactionPosition *hexutil.Uint64 `json:"transactionPosition,omitempty"`
	TransactionHash     *Hash           `json:"transactionHash,omitempty"`

	CallWithResult         *TraceCallWithResult    `json:"callWithResult,omitempty"`
	CreateWithResult       *TraceCreateWithResult  `json:"createWithResult,omitempty"`
	InternalTransferAction *InternalTransferAction `json:"internalTransferAction,omitempty"`

	Childs []*LocalizedTraceNode `json:"childs"`
}

TODO: should move to go sdk=========================

func TraceInTree added in v1.0.20

func TraceInTree(traces []LocalizedTrace) (node *LocalizedTraceNode, err error)

func (LocalizedTraceNode) Flatten added in v0.1.1

func (l LocalizedTraceNode) Flatten() (flattened []*LocalizedTraceNode)

type LocalizedTransactionTrace added in v0.1.1

type LocalizedTransactionTrace struct {
	Traces              []LocalizedTrace `json:"traces"`
	TransactionPosition hexutil.Uint64   `json:"transactionPosition"`
	TransactionHash     Hash             `json:"transactionHash"`
}

type Log

type Log struct {
	Address             Address       `json:"address"`
	Topics              []Hash        `json:"topics"`
	Data                hexutil.Bytes `json:"data"`
	BlockHash           *Hash         `json:"blockHash,omitempty"`
	EpochNumber         *hexutil.Big  `json:"epochNumber,omitempty"`
	TransactionHash     *Hash         `json:"transactionHash,omitempty"`
	TransactionIndex    *hexutil.Big  `json:"transactionIndex,omitempty"`
	LogIndex            *hexutil.Big  `json:"logIndex,omitempty"`
	TransactionLogIndex *hexutil.Big  `json:"transactionLogIndex,omitempty"`
}

Log represents the event in a smart contract

func (*Log) DecodeRLP added in v0.1.1

func (log *Log) DecodeRLP(r *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface.

func (Log) EncodeRLP added in v0.1.1

func (log Log) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface.

type LogFilter

type LogFilter struct {
	FromEpoch   *Epoch          `json:"fromEpoch,omitempty"`
	ToEpoch     *Epoch          `json:"toEpoch,omitempty"`
	FromBlock   *hexutil.Big    `json:"fromBlock,omitempty"`
	ToBlock     *hexutil.Big    `json:"toBlock,omitempty"`
	BlockHashes []Hash          `json:"blockHashes,omitempty"`
	Address     []Address       `json:"address,omitempty"`
	Topics      [][]Hash        `json:"topics,omitempty"`
	Offset      *hexutil.Uint64 `json:"offset,omitempty"`
	Limit       *hexutil.Uint64 `json:"limit,omitempty"`
}

LogFilter represents the filter of event in a smart contract.

func (*LogFilter) UnmarshalJSON added in v0.1.1

func (l *LogFilter) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type PoSEconomics added in v0.1.1

type PoSEconomics struct {
	TotalPosStakingTokens    *hexutil.Big   `json:"totalPosStakingTokens"`
	DistributablePosInterest *hexutil.Big   `json:"distributablePosInterest"`
	LastDistributeBlock      hexutil.Uint64 `json:"lastDistributeBlock"`
}

type RewardInfo added in v0.1.1

type RewardInfo struct {
	BlockHash Hash `json:"blockHash"`
	// H256,
	Author Address `json:"author"`
	// H160,
	TotalReward *hexutil.Big `json:"totalReward"`
	// U256,
	BaseReward *hexutil.Big `json:"baseReward"`
	// U256,
	TxFee *hexutil.Big `json:"txFee"`
}

type SignedTransaction

type SignedTransaction struct {
	UnsignedTransaction UnsignedTransaction
	V                   byte
	R                   hexutil.Bytes
	S                   hexutil.Bytes
}

SignedTransaction represents a transaction with signature, it is the transaction information for sending transaction.

func (*SignedTransaction) Decode

func (tx *SignedTransaction) Decode(data []byte, networkID uint32) error

Decode decodes RLP encoded data to tx

func (*SignedTransaction) Encode

func (tx *SignedTransaction) Encode() ([]byte, error)

Encode encodes tx and returns its RLP encoded data

func (*SignedTransaction) Hash added in v0.1.1

func (tx *SignedTransaction) Hash() ([]byte, error)

func (*SignedTransaction) Sender added in v0.1.1

func (tx *SignedTransaction) Sender(networkId uint32) (Address, error)

func (*SignedTransaction) Signature added in v0.1.1

func (tx *SignedTransaction) Signature() []byte

type SponsorInfo added in v0.1.1

type SponsorInfo struct {
	SponsorForGas               Address      `json:"sponsorForGas"`
	SponsorForCollateral        Address      `json:"sponsorForCollateral"`
	SponsorGasBound             *hexutil.Big `json:"sponsorGasBound"`
	SponsorBalanceForGas        *hexutil.Big `json:"sponsorBalanceForGas"`
	SponsorBalanceForCollateral *hexutil.Big `json:"sponsorBalanceForCollateral"`
}

type Status added in v0.1.1

type Status struct {
	BestHash         Hash           `json:"bestHash"`
	ChainID          hexutil.Uint   `json:"chainId"`
	NetworkID        hexutil.Uint   `json:"networkId"`
	EpochNumber      hexutil.Uint64 `json:"epochNumber"`
	BlockNumber      hexutil.Uint64 `json:"blockNumber"`
	PendingTxNumber  hexutil.Uint64 `json:"pendingTxNumber"`
	LatestCheckpoint hexutil.Uint64 `json:"latestCheckpoint"`
	LatestConfirmed  hexutil.Uint64 `json:"latestConfirmed"`
	LatestState      hexutil.Uint64 `json:"latestState"`
}

Status represents current blockchain status

type StorageChange added in v0.1.1

type StorageChange struct {
	Address Address `json:"address"`
	/// Number of storage collateral units to deposit / refund (absolute value).
	Collaterals hexutil.Uint64 `json:"collaterals"`
}

StorageChange represents storage change information of the address

type StorageRoot added in v0.1.1

type StorageRoot struct {
	Delta        Hash `json:"delta"`        //delta: H256,
	Intermediate Hash `json:"intermediate"` //intermediate: H256,
	Snapshot     Hash `json:"snapshot"`     //snapshot: H256,
}

type SubscriptionLog added in v0.1.1

type SubscriptionLog struct {
	*Log
	*ChainReorg
}

func (*SubscriptionLog) DecodeRLP added in v0.1.1

func (s *SubscriptionLog) DecodeRLP(r *rlp.Stream) error

func (SubscriptionLog) EncodeRLP added in v0.1.1

func (s SubscriptionLog) EncodeRLP(w io.Writer) error

func (SubscriptionLog) IsRevertLog added in v0.1.1

func (s SubscriptionLog) IsRevertLog() bool

func (SubscriptionLog) MarshalJSON added in v0.1.1

func (s SubscriptionLog) MarshalJSON() ([]byte, error)

type TokenSupplyInfo added in v0.1.1

type TokenSupplyInfo struct {
	TotalCirculating *hexutil.Big `json:"totalCirculating"`
	TotalIssued      *hexutil.Big `json:"totalIssued"`
	TotalStaking     *hexutil.Big `json:"totalStaking"`
	TotalCollateral  *hexutil.Big `json:"totalCollateral"`
}

type TraceCallWithResult added in v0.1.1

type TraceCallWithResult struct {
	*Call       `json:"call"`
	*CallResult `json:"callResult"`
}

type TraceCreateWithResult added in v0.1.1

type TraceCreateWithResult struct {
	*Create       `json:"create"`
	*CreateResult `json:"createResult"`
}

type TraceFilter added in v0.1.1

type TraceFilter struct {
	FromEpoch   *Epoch `json:"fromEpoch"`
	ToEpoch     *Epoch `json:"toEpoch"`
	BlockHashes []Hash `json:"blockHashes"`
	// action types could be "call","create","callResult","createResult","internalTransferAction"
	ActionTypes []string        `json:"actionTypes"`
	After       *hexutil.Uint64 `json:"after"`
	Count       *hexutil.Uint64 `json:"count"`
}

type TraceType added in v0.1.1

type TraceType string
const (
	CALL_TYPE                      TraceType = "call"
	CALL_RESULT_TYPE               TraceType = "call_result"
	CREATE_TYPE                    TraceType = "create"
	CREATE_RESULT_TYPE             TraceType = "create_result"
	INTERNAL_TRANSFER_ACTIION_TYPE TraceType = "internal_transfer_action"
)

type Transaction

type Transaction struct {
	Hash             Hash            `json:"hash"`
	Nonce            *hexutil.Big    `json:"nonce"`
	BlockHash        *Hash           `json:"blockHash"`
	TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
	From             Address         `json:"from"`
	To               *Address        `json:"to"`
	Value            *hexutil.Big    `json:"value"`
	GasPrice         *hexutil.Big    `json:"gasPrice"`
	Gas              *hexutil.Big    `json:"gas"`
	ContractCreated  *Address        `json:"contractCreated"`
	Data             string          `json:"data"`
	StorageLimit     *hexutil.Big    `json:"storageLimit"`
	EpochHeight      *hexutil.Big    `json:"epochHeight"`
	ChainID          *hexutil.Big    `json:"chainId"`
	Status           *hexutil.Uint64 `json:"status"`

	//signature
	V *hexutil.Big `json:"v"`
	R *hexutil.Big `json:"r"`
	S *hexutil.Big `json:"s"`
}

Transaction represents a transaction with signature in Conflux. it is the response from conflux node when sending rpc request, such as cfx_getTransactionByHash

func (*Transaction) DecodeRLP added in v0.1.1

func (tx *Transaction) DecodeRLP(r *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface.

func (Transaction) EncodeRLP added in v0.1.1

func (tx Transaction) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface.

type TransactionReceipt

type TransactionReceipt struct {
	TransactionHash Hash            `json:"transactionHash"`
	Index           hexutil.Uint64  `json:"index"`
	BlockHash       Hash            `json:"blockHash"`
	EpochNumber     *hexutil.Uint64 `json:"epochNumber"`
	From            Address         `json:"from"`
	To              *Address        `json:"to"`
	GasUsed         *hexutil.Big    `json:"gasUsed"`
	GasFee          *hexutil.Big    `json:"gasFee"`
	ContractCreated *Address        `json:"contractCreated"`
	Logs            []Log           `json:"logs"`
	LogsBloom       Bloom           `json:"logsBloom"`
	StateRoot       Hash            `json:"stateRoot"`
	OutcomeStatus   hexutil.Uint64  `json:"outcomeStatus"`
	TxExecErrorMsg  *string         `json:"txExecErrorMsg"`
	// Whether gas costs were covered by the sponsor.
	GasCoveredBySponsor bool `json:"gasCoveredBySponsor"`
	// Whether storage costs were covered by the sponsor.
	StorageCoveredBySponsor bool `json:"storageCoveredBySponsor"`
	// The amount of storage collateralized by the sender.
	StorageCollateralized hexutil.Uint64 `json:"storageCollateralized"`
	// Storage collaterals released during the execution of the transaction.
	StorageReleased []StorageChange `json:"storageReleased"`
}

TransactionReceipt represents the transaction execution result in Conflux. it is the response from conflux node when sending rpc request, such as cfx_getTransactionReceipt

func (*TransactionReceipt) DecodeRLP added in v0.1.1

func (tr *TransactionReceipt) DecodeRLP(r *rlp.Stream) error

DecodeRLP implements the rlp.Decoder interface.

func (TransactionReceipt) EncodeRLP added in v0.1.1

func (tr TransactionReceipt) EncodeRLP(w io.Writer) error

EncodeRLP implements the rlp.Encoder interface.

type TransactionStatus added in v0.1.1

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

func (*TransactionStatus) IsPending added in v0.1.1

func (ts *TransactionStatus) IsPending() (bool, string)

func (TransactionStatus) MarshalJSON added in v0.1.1

func (ts TransactionStatus) MarshalJSON() ([]byte, error)

func (TransactionStatus) String added in v0.1.1

func (ts TransactionStatus) String() string

func (*TransactionStatus) UnmarshalJSON added in v0.1.1

func (ts *TransactionStatus) UnmarshalJSON(data []byte) error

type TxPoolPendingNonceRange added in v0.1.1

type TxPoolPendingNonceRange struct {
	MinNonce *hexutil.Big `json:"minNonce"`
	MaxNonce *hexutil.Big `json:"maxNonce"`
}

type TxPoolStatus added in v0.1.1

type TxPoolStatus struct {
	Deferred   hexutil.Uint64 `json:"deferred"`
	Ready      hexutil.Uint64 `json:"ready"`
	Received   hexutil.Uint64 `json:"received"`
	Unexecuted hexutil.Uint64 `json:"unexecuted"`
}

type TxWithPoolInfo added in v0.1.1

type TxWithPoolInfo struct {
	Exist              bool         `json:"exist"`
	Packed             bool         `json:"packed"`
	LocalNonce         *hexutil.Big `json:"localNonce"`
	LocalBalance       *hexutil.Big `json:"localBalance"`
	StateNonce         *hexutil.Big `json:"stateNonce"`
	StateBalance       *hexutil.Big `json:"stateBalance"`
	LocalBalanceEnough bool         `json:"localBalanceEnough"`
	StateBalanceEnough bool         `json:"stateBalanceEnough"`
}

type UnsignedTransaction

type UnsignedTransaction struct {
	UnsignedTransactionBase
	To   *Address
	Data hexutil.Bytes
}

UnsignedTransaction represents a transaction without signature, it is the transaction information for sending transaction.

func (*UnsignedTransaction) ApplyDefault

func (tx *UnsignedTransaction) ApplyDefault()

ApplyDefault applys default value for these fields if they are empty

func (*UnsignedTransaction) Decode

func (tx *UnsignedTransaction) Decode(data []byte, networkID uint32) error

Decode decodes RLP encoded data to tx

func (*UnsignedTransaction) Encode

func (tx *UnsignedTransaction) Encode() ([]byte, error)

Encode encodes tx and returns its RLP encoded data

func (*UnsignedTransaction) EncodeWithSignature

func (tx *UnsignedTransaction) EncodeWithSignature(v byte, r, s []byte) ([]byte, error)

EncodeWithSignature encodes tx with signature and return its RLP encoded data

func (*UnsignedTransaction) Hash

func (tx *UnsignedTransaction) Hash() ([]byte, error)

Hash hashes the tx by keccak256 and returns the result

type UnsignedTransactionBase

type UnsignedTransactionBase struct {
	From         *Address
	Nonce        *hexutil.Big
	GasPrice     *hexutil.Big
	Gas          *hexutil.Big
	Value        *hexutil.Big
	StorageLimit *hexutil.Uint64
	EpochHeight  *hexutil.Uint64
	ChainID      *hexutil.Uint
}

UnsignedTransactionBase represents a transaction without To, Data and signature

type VoteStakeInfo added in v0.1.1

type VoteStakeInfo struct {
	/// This is the number of tokens should be locked before
	/// `unlock_block_number`.
	Amount *hexutil.Big `json:"amount"`
	/// This is the timestamp when the vote right will be invalid, measured in
	/// the number of past blocks.
	UnlockBlockNumber uint64 `json:"unlockBlockNumber"`
}

VoteStakeInfo represents user vote history

type WebsocketEpochResponse added in v0.1.1

type WebsocketEpochResponse struct {
	EpochHashesOrdered []Hash       `json:"epochHashesOrdered"`
	EpochNumber        *hexutil.Big `json:"epochNumber"`
}

WebsocketEpochResponse represents result of epoch websocket subscription

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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