client

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoReceipt      = errors.New("no receipt found")
	ErrShouldNotBeNil = errors.New("should not be nil")
	ErrEstimated      = errors.New("estimated")
)
View Source
var (
	SimpleStorage = &Contract{
		Code: simpleStorageCode,
		Abi:  simpleStorageAbi,
	}
)

Functions

func SignDataRequester

func SignDataRequester(dr models.DataRequester, privs ...[]byte) error

Types

type AccountChange

type AccountChange struct {
	TxHash    *common.Hash      `json:"txhash,omitempty"`
	ChainID   common.ChainID    `json:"chainid"`   // Chain ID of from. When from is empty, it is the chain ID of delta.
	Height    common.Height     `json:"height"`    // Block height of the chain in which the transaction is executed
	From      *common.Address   `json:"from"`      // When the account change is delta, from is empty. Otherwise, it is the transfer out account address
	To        *common.Address   `json:"to"`        // Transfer in account address
	Nonce     uint64            `json:"nonce"`     // Nonce when a transfer out account performs a transaction. This value is meaningless when the account changes to delta.
	Val       *big.Int          `json:"value"`     // Account change amount
	Input     hexutil.Bytes     `json:"input"`     // Transaction input information
	UseLocal  bool              `json:"uselocal"`  // Is it a second currency transaction? False: base currency, true: second currency
	Extra     hexutil.Bytes     `json:"extra"`     // It is currently used to save transaction types. If it does not exist, it is a normal transaction. Otherwise, it will correspond to special operations
	Version   uint16            `json:"version"`   // Version number used to distinguish different execution methods when the transaction execution is incompatible due to upgrade
	TimeStamp uint64            `json:"timestamp"` // The timestamp of the block in which it is located
	Hash      []byte            `json:"hash"`      // transaction hash
	MultiSigs models.PubAndSigs `json:"multiSigs"`
	Sig       *models.PubAndSig `json:"signature"`
}

func (*AccountChange) InfoString

func (c *AccountChange) InfoString(level common.IndentLevel) string

func (*AccountChange) String

func (c *AccountChange) String() string

type AccountChanges

type AccountChanges []*AccountChange

func (AccountChanges) InfoString

func (cs AccountChanges) InfoString(level common.IndentLevel) string

type AccountHeight

type AccountHeight struct {
	Height          common.Height  `json:"height"`          // Current height of chain
	Addr            common.Address `json:"address"`         // Address of account
	Nonce           uint64         `json:"nonce"`           // Nonce of account
	Balance         *big.Int       `json:"balance"`         // Base currency,can't be nil
	LocalCurrency   *big.Int       `json:"localCurrency"`   // Second currency(if exists),could be nil
	StorageRoot     []byte         `json:"storageRoot"`     // Storage root of contract,Trie(key: Hash, value: Hash)
	CodeHash        []byte         `json:"codeHash"`        // Hash of contract code
	LongStorageRoot []byte         `json:"longStorageRoot"` // System contracts are used to hold more flexible data structures, Trie(key: Hash, value: []byte)
	Code            []byte         `json:"code"`
}

type AccountWithCode

type AccountWithCode struct {
	Addr            common.Address  `json:"address"`         // Address of account
	Creator         *common.Address `json:"creator"`         // creator of the contract
	Nonce           uint64          `json:"nonce"`           // Nonce of account
	Balance         *big.Int        `json:"balance"`         // Base currency,can't be nil
	LocalCurrency   *big.Int        `json:"localCurrency"`   // Second currency(if exists),could be nil
	StorageRoot     []byte          `json:"storageRoot"`     // Storage root of contract,Trie(key: Hash, value: Hash)
	CodeHash        []byte          `json:"codeHash"`        // Hash of contract code
	LongStorageRoot []byte          `json:"longStorageRoot"` // System contracts are used to hold more flexible data structures, Trie(key: Hash, value: []byte)
	Code            []byte          `json:"code"`
}

func (*AccountWithCode) InfoString

func (c *AccountWithCode) InfoString(level common.IndentLevel) string

func (*AccountWithCode) String

func (c *AccountWithCode) String() string

type Adminser

type Adminser interface {
	GetAdminPrivs() ([][]byte, bool)
}

type BTxs

type BTxs struct {
	Txs   TxReceipts
	Start common.Height
	End   common.Height
}

type BlockInfo

type BlockInfo struct {
	Hash             common.Hash    `json:"hash"`          // Big hash, that is, big hash
	PreviousHash     common.Hash    `json:"previoushash"`  // Hash of last block
	ChainID          common.ChainID `json:"chainid"`       // Current chain ID
	Height           common.Height  `json:"height"`        // Block height
	Empty            bool           `json:"empty"`         // Whether it is an empty block, that is, whether it is a skipped block
	RewardAddress    common.Address `json:"rewardaddress"` // The reward address bound to the packing node (it can be any value, and the basis for issuing rewards is in the reward chain pledge contract, not depending on this value)
	MergedDeltaRoot  *common.Hash   `json:"mergeroot"`     // Root hash of delta merged from other partitions
	BalanceDeltaRoot *common.Hash   `json:"deltaroot"`     // The root hash of the delta tree generated by the current block transaction of the current partition needs to be sent to other partitions
	StateRoot        common.Hash    `json:"stateroot"`     // Hash root of the chain account
	RREra            *common.EraNum `json:"rrera"`         // Charging cycle of current block (main chain and reward chain)
	RRCurrent        *common.Hash   `json:"rrcurrent"`     // Pledge tree root hash (main chain and reward chain) when the current block is located
	RRNext           *common.Hash   `json:"rrnext"`        // Pledge tree root hash (main chain and reward chain) in the next billing cycle
	TxCount          int            `json:"txcount"`       // Transaction count in block
	TimeStamp        uint64         `json:"timestamp"`     // The time stamp of Proposer proposal can not be used as a basis
}

func (*BlockInfo) String

func (b *BlockInfo) String() string

type BlockMessage

type BlockMessage struct {
	Elections      []*models.ElectMessage `json:"elections"`      // start election msg
	AccountChanges []*AccountChange       `json:"accountchanges"` // transaction
}

func (*BlockMessage) InfoString

func (m *BlockMessage) InfoString(level common.IndentLevel) string

func (*BlockMessage) String

func (m *BlockMessage) String() string

type BlockWithAuditings

type BlockWithAuditings struct {
	BlockHeader *models.BlockHeader
	BlockBody   *models.BlockBody
	BlockPass   models.PubAndSigs
	Auditings   models.AuditorPass
}

func (*BlockWithAuditings) Build

func (*BlockWithAuditings) Clear

func (p *BlockWithAuditings) Clear()

func (*BlockWithAuditings) InfoString

func (p *BlockWithAuditings) InfoString(level common.IndentLevel) string

type CashedCheckExistence

type CashedCheckExistence struct {
	Existence bool   `json:"existence"` // Check exists in cashed tree and can be cancelled if it does not exist (other conditions must be met)
	Input     string `json:"input"`     // The data to be provided when canceling a check is the serialization of cancelcashcheckrequest
}

type ChainInfo

type ChainInfo struct {
	ChainId   common.ChainID   `json:"chainId"`   // Chain ID
	Mode      common.ChainMode `json:"mode"`      // Root?Branch?Shard?
	ParentId  common.ChainID   `json:"parent"`    // Parent chain
	DataNodes []DataNodeInfo   `json:"datanodes"` // Data node list
}

information of a chain

type ChainSettings

type ChainSettings struct {
	Addr       string
	AdminPrivs [][]byte
}

type Client

type Client struct {
	Server        string
	CurrentChain  common.ChainID
	ChainInfo     ChainSettings
	NodeConn      *grpc.ClientConn
	NodeClient    tkmrpc.NodeClient
	Forwarders    []common.Identifier
	Estimating    bool
	EstimatedRept *ReceiptWithFwds // receipt of estimate while Estimating is true
	Err           error            // error returned by estimate while Estimating is true
}

func (*Client) Account

func (c *Client) Account(ctx context.Context, addr common.Address) (*AccountWithCode, error)

func (*Client) AccountAtHeight

func (c *Client) AccountAtHeight(ctx context.Context, height common.Height, addr common.Address) (*AccountWithCode, error)

func (*Client) BlockHeader

func (c *Client) BlockHeader(ctx context.Context, height common.Height) (*BlockInfo, error)

func (*Client) BridgeInfoCall added in v0.4.0

func (c *Client) BridgeInfoCall(ctx context.Context, requester common.Identifier, parser func([]byte) error,
	name string, params ...interface{}) error

func (*Client) BridgeInfoManage added in v0.4.0

func (c *Client) BridgeInfoManage(ctx context.Context, requester common.Identifier,
	adminPrivs [][]byte, name string, params ...interface{}) error

func (*Client) CSGet

func (c *Client) CSGet(ctx context.Context, requester common.Identifier, key string) (value []byte, exist bool, err error)

func (*Client) CSSet

func (c *Client) CSSet(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, key string, value []byte) (bool, error)

func (*Client) CSSetOrUnset

func (c *Client) CSSetOrUnset(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, name string, params ...interface{}) (bool, error)

func (*Client) CSUnset

func (c *Client) CSUnset(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, key string) (bool, error)

func (*Client) Call

func (c *Client) Call(ctx context.Context, from, to *common.Address, nonce uint64, val *big.Int, input []byte,
	uselocal bool) (*ReceiptWithFwds, error)

func (*Client) CallMS

func (c *Client) CallMS(ctx context.Context, from, to *common.Address, nonce uint64, val *big.Int, input []byte,
	uselocal bool, gasLimit uint64, extraBytes []byte, mprivs ...[]byte) (receipt *ReceiptWithFwds, err error)

func (*Client) CallRRInfo

func (c *Client) CallRRInfo(ctx context.Context, requester common.Identifier, nid common.NodeID) (*models.POSInfo, bool, error)

func (*Client) CallRRProof

func (c *Client) CallRRProof(ctx context.Context, requester common.Identifier, nid common.NodeID,
	era common.EraNum, rrRoot common.Hash) (*models.RRProofs, bool, error)

func (*Client) CallbackAndCheck

func (c *Client) CallbackAndCheck(ctx context.Context, sender common.Identifier,
	callback func(nonce uint64) (txHash []byte, runErr error)) (*ReceiptWithFwds, error)

func (*Client) ChainSetting

func (c *Client) ChainSetting(ctx context.Context, chainAdminPrivs [][]byte, sender common.Identifier,
	name string, value []byte) (bool, *ReceiptWithFwds, error)

func (*Client) ChainStats

func (c *Client) ChainStats(ctx context.Context) (*models.ChainStats, error)

func (*Client) ChangeRRStatus

func (c *Client) ChangeRRStatus(ctx context.Context, auth common.Identifier, nid common.NodeID,
	statusVal int16, setOrClr bool) (bool, string, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Committee

func (c *Client) Committee(ctx context.Context, epoch common.EpochNum) ([]common.NodeID, error)

func (*Client) Deposit

func (c *Client) Deposit(ctx context.Context, sender common.Identifier, nodeType common.NodeType, nodeId common.NodeID,
	nodePriv []byte, nonce uint64, amount *big.Int, binderAddrs ...common.Address) (txHash []byte, err error)

func (*Client) DepositAndCheck

func (c *Client) DepositAndCheck(ctx context.Context, binder common.Identifier, nodeType common.NodeType,
	node common.NodeIdentifier, amount *big.Int) (bool, error)

func (*Client) Estimate

func (c *Client) Estimate(ctx context.Context, from, to *common.Address, nonce uint64, val *big.Int,
	input []byte, useLocal bool, gasLimit uint64) (*tkmrpc.RpcTx, *ReceiptWithFwds, error)

func (*Client) GetBTransactions

func (c *Client) GetBTransactions(ctx context.Context, addr common.Address, start, end common.Height) (*BTxs, error)

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, height common.Height) (*BlockWithAuditings, error)

func (*Client) GetBlockTxs

func (c *Client) GetBlockTxs(ctx context.Context, height common.Height, page, size int32) (*BlockMessage, error)

func (*Client) GetBridgeInfoTo added in v0.4.0

func (c *Client) GetBridgeInfoTo(ctx context.Context, requester common.Identifier, toChain common.ChainID,
	toContract common.Address) (from *models.ScErcInfo, ttype models.TokenType, exist bool, err error)

func (*Client) GetCCCRelativeTx

func (c *Client) GetCCCRelativeTx(ctx context.Context, cc *models.CashCheck) (hash []byte, err error)

func (*Client) GetCommProof

func (c *Client) GetCommProof(ctx context.Context, epoch common.EpochNum) (*RpcCommProof, error)

func (*Client) GetRRCurrent

func (c *Client) GetRRCurrent(ctx context.Context) ([]byte, error)

func (*Client) GetRRNodeInfo

func (c *Client) GetRRNodeInfo(ctx context.Context, era common.EraNum, root []byte, nodeId common.NodeID) (*RRNodeInfo, error)

func (*Client) GetRRProofs

func (c *Client) GetRRProofs(ctx context.Context, rootHash common.Hash, id common.NodeIdentifier) (*models.RRProofs, error)

func (*Client) LastConfirmedsAt

func (c *Client) LastConfirmedsAt(ctx context.Context, id common.ChainID, height common.Height) (*Confirmeds, error)

func (*Client) ListBridgeInfosOf added in v0.4.0

func (c *Client) ListBridgeInfosOf(ctx context.Context, requester common.Identifier, fromChain common.ChainID,
	fromContract common.Address) ([]models.ScErcInfo, error)

func (*Client) ListRRChanges

func (c *Client) ListRRChanges(ctx context.Context, root []byte) (*RRChanges, error)

func (*Client) ListRRInfos added in v0.4.0

func (c *Client) ListRRInfos(ctx context.Context, chainid common.ChainID, height common.Height, page, size int32) ([]*models.RRInfo, error)

func (*Client) MCHAddAdmin

func (c *Client) MCHAddAdmin(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID,
	newAdmin common.Identifier) error

func (*Client) MCHAddBootNode

func (c *Client) MCHAddBootNode(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID,
	bn *models.MChainBootNode) error

func (*Client) MCHAddDataNode

func (c *Client) MCHAddDataNode(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID,
	nid common.NodeID, rrProof *models.RRProofs) error

func (*Client) MCHClrNoGas

func (c *Client) MCHClrNoGas(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID) error

func (*Client) MCHCreateChain

func (c *Client) MCHCreateChain(ctx context.Context, requester common.Identifier, adminPrivs [][]byte,
	chainInfoInput *models.MChainInfoInput) error

func (*Client) MCHDelAdmin

func (c *Client) MCHDelAdmin(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID,
	pub []byte) error

func (*Client) MCHGetInfo

func (c *Client) MCHGetInfo(ctx context.Context, requester common.Identifier, id common.ChainID) (*models.MChainInfoOutput, error)

func (*Client) MCHRemoveBootNode

func (c *Client) MCHRemoveBootNode(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID, nid common.NodeID) error

func (*Client) MCHRemoveChain

func (c *Client) MCHRemoveChain(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID) error

func (*Client) MCHRemoveDataNode

func (c *Client) MCHRemoveDataNode(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID, nid common.NodeID) error

func (*Client) MCHRestartChain

func (c *Client) MCHRestartChain(ctx context.Context, requester common.Identifier, adminPrivs [][]byte,
	chainComm *models.MChainCommInput) error

func (*Client) MCHSetNoGas

func (c *Client) MCHSetNoGas(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID) error

func (*Client) MCHStartChain

func (c *Client) MCHStartChain(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, id common.ChainID) error

func (*Client) MCMAddNodes

func (c *Client) MCMAddNodes(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, nids []common.NodeID) (delta int, err error)

func (*Client) MCMDelNodes

func (c *Client) MCMDelNodes(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, nids []common.NodeID) (delta int, err error)

func (*Client) MCMListNodes

func (c *Client) MCMListNodes(ctx context.Context, requester common.Identifier) ([]common.NodeID, error)

func (*Client) MakeCCCExistenceProof

func (c *Client) MakeCCCExistenceProof(ctx context.Context, cc *models.CashCheck) (cce *CashedCheckExistence, err error)

func (*Client) MakeRpcTx

func (c *Client) MakeRpcTx(from, to *common.Address, nonce uint64, val *big.Int, input []byte, uselocal bool,
	gasLimit uint64, extraBytes []byte, priv []byte, mprivs ...[]byte) (*tkmrpc.RpcTx, error)

func (*Client) MakeVccProof

func (c *Client) MakeVccProof(ctx context.Context, cc *models.CashCheck) (proof string, err error)

func (*Client) ManageChain

func (c *Client) ManageChain(ctx context.Context, requester common.Identifier, adminPrivs [][]byte,
	name string, params ...interface{}) error

func (*Client) ManagedComm

func (c *Client) ManagedComm(ctx context.Context, requester common.Identifier, adminPrivs [][]byte, name string,
	params ...interface{}) (delta int, err error)

func (*Client) NewClient

func (c *Client) NewClient() error

func (*Client) Nonce

func (c *Client) Nonce(ctx context.Context, addr common.Address) (uint64, error)

func (*Client) RRDelegate

func (c *Client) RRDelegate(ctx context.Context, sender common.Identifier, nonce uint64, nodeId common.NodeID,
	amount *big.Int) (txHash []byte, err error)

func (*Client) RRTxByHash

func (c *Client) RRTxByHash(ctx context.Context, txHash []byte) (*RRTx, error)

func (*Client) RRUnDelegate

func (c *Client) RRUnDelegate(ctx context.Context, sender common.Identifier, nonce uint64, nodeId common.NodeID,
	amount *big.Int) (txHash []byte, err error)

func (*Client) ReceiptByHash

func (c *Client) ReceiptByHash(ctx context.Context, txHash []byte) (*TransactionReceipt, error)

func (*Client) RunAndCheck

func (c *Client) RunAndCheck(ctx context.Context, txHash []byte, runErr error) (*ReceiptWithFwds, error)

func (*Client) SendCancelCashCheck

func (c *Client) SendCancelCashCheck(ctx context.Context, from common.Identifier, input []byte) (txhash []byte, err error)

func (*Client) SendCashCashCheck

func (c *Client) SendCashCashCheck(ctx context.Context, from common.Identifier, input []byte) (txhash []byte, err error)

func (*Client) SendMakeVccProofTx

func (c *Client) SendMakeVccProofTx(ctx context.Context, from common.Identifier, cc *models.CashCheck) (txhash []byte, err error)

func (*Client) SendTx

func (c *Client) SendTx(ctx context.Context, from common.Identifier, to *common.Address, val *big.Int, input []byte,
	uselocal bool) (txHash []byte, err error)

func (*Client) SendTxMS

func (c *Client) SendTxMS(ctx context.Context, from common.Identifier, to *common.Address, val *big.Int, input []byte,
	uselocal bool, gasLimit uint64, extra []byte, mprivs ...[]byte) (txHash []byte, err error)

func (*Client) SetChainSetting

func (c *Client) SetChainSetting(ctx context.Context, privs [][]byte, sender common.Identifier, nonce uint64,
	name string, value []byte) ([]byte, error)

func (*Client) SetForwarderPrivs

func (c *Client) SetForwarderPrivs(privs ...[]byte) error

func (*Client) Tokens

func (c *Client) Tokens(ctx context.Context, addr common.Address) (*big.Int, *big.Int, error)

func (*Client) Tx

func (c *Client) Tx(ctx context.Context, from common.Identifier, to *common.Address, nonce uint64, val *big.Int,
	input []byte, uselocal bool) (txHash []byte, err error)

func (*Client) TxByHash

func (c *Client) TxByHash(ctx context.Context, txHash []byte) (*ReceiptWithFwds, error)

func (*Client) TxMS

func (c *Client) TxMS(ctx context.Context, from common.Identifier, to *common.Address, nonce uint64, val *big.Int,
	input []byte, uselocal bool, gasLimit uint64, extraBytes []byte, mprivs ...[]byte) (txHash []byte, err error)

func (*Client) TxProof

func (c *Client) TxProof(ctx context.Context, txHash []byte) (*TxProof, error)

func (*Client) TxReceipt

func (c *Client) TxReceipt(ctx context.Context, txHash []byte) (*ReceiptWithFwds, error)

根据txHash,获取交易执行回执, 第一个为回执内容 第二个为可能出现的错误,如果回执不为nil,且err不为nil,则说明执行失败,err为失败原因

func (*Client) Withdraw

func (c *Client) Withdraw(ctx context.Context, sender common.Identifier, nonce uint64, nodeId common.NodeID,
	binderAddrs ...common.Address) ([]byte, error)

func (*Client) WithdrawPart

func (c *Client) WithdrawPart(ctx context.Context, sender common.Identifier, nonce uint64, nodeId common.NodeID,
	amount *big.Int, binderAddrs ...common.Address) ([]byte, error)

type Confirmeds

type Confirmeds struct {
	At   common.Height
	Data models.ChainConfirmeds
	Root []byte
}

func (*Confirmeds) InfoString

func (c *Confirmeds) InfoString(level common.IndentLevel) string

type Contract

type Contract struct {
	Code []byte
	Abi  abi.ABI
}

type DataNodeInfo

type DataNodeInfo struct {
	DataNodeId   common.NodeID `json:"dataNodeId"`   // Node ID
	DataNodeIp   string        `json:"dataNodeIp"`   // IP
	DataNodePort uint16        `json:"dataNodePort"` // RPC port
}

type MerkleItem

type MerkleItem struct {
	HashVal   hexutil.Bytes `json:"hash"`
	Direction uint8         `json:"direction"`
}

func (MerkleItem) Proof

func (m MerkleItem) Proof(toBeProof []byte) ([]byte, error)

func (MerkleItem) String

func (m MerkleItem) String() string

type MerkleItems

type MerkleItems []MerkleItem

func (MerkleItems) InfoString

func (ms MerkleItems) InfoString(level common.IndentLevel) string

func (MerkleItems) Proof

func (ms MerkleItems) Proof(toBeProof []byte) ([]byte, error)

type NodeInfo

type NodeInfo struct {
	NodeId        common.NodeID                    `json:"nodeId"`
	Version       string                           `json:"version"`
	IsDataNode    bool                             `json:"isDataNode"`
	DataNodeOf    common.ChainID                   `json:"dataNodeOf"`
	LastMsgTime   int64                            `json:"lastMsgTime"`
	LastEventTime int64                            `json:"lastEventTime"`
	LastBlockTime int64                            `json:"lastBlockTime"`
	Overflow      bool                             `json:"overflow"`
	LastBlocks    map[common.ChainID]common.Height `json:"lastBlocks"`
	OpTypes       map[common.ChainID][]string      `json:"opTypes"`
}

type RRChanges

type RRChanges struct {
	Era          common.EraNum
	Root         common.Hash
	Next         common.Hash
	Changing     common.Hash
	MaxDeposit   *big.Int
	ConsDepSum   *big.Int
	DelegatedSum *big.Int
	DataDepSum   *big.Int
	Changes      RRNodeChangings
}

func (*RRChanges) InfoString

func (c *RRChanges) InfoString(level common.IndentLevel) string

type RRNodeChanging

type RRNodeChanging struct {
	Info     *models.RRInfo
	Changing *models.RRC
}

func (*RRNodeChanging) InfoString

func (c *RRNodeChanging) InfoString(level common.IndentLevel) string

type RRNodeChangings

type RRNodeChangings []*RRNodeChanging

type RRNodeInfo

type RRNodeInfo struct {
	Era                                  common.EraNum
	Root                                 common.Hash
	Info                                 *models.RRInfo
	Changing                             *models.RRC
	MaxDeposit                           *big.Int
	ConsDepSum, DelegatedSum, DataDepSum *big.Int
}

func (*RRNodeInfo) String

func (m *RRNodeInfo) String() string

type RRTx

type RRTx struct {
	TxReceipt *TransactionReceipt
	RRReceipt *models.RRActReceipt
}

func (*RRTx) InfoString

func (t *RRTx) InfoString(level common.IndentLevel) string

type ReceiptWithFwds

type ReceiptWithFwds struct {
	TransactionReceipt
	RealOut        []byte
	InnerTx        *models.Transaction
	ForwardedTimes int
	Estimated      bool
}

func NewReceiptWithForwards

func NewReceiptWithForwards(rept *TransactionReceipt, estimated ...bool) (*ReceiptWithFwds, error)

func (*ReceiptWithFwds) InfoString

func (r *ReceiptWithFwds) InfoString(level common.IndentLevel) string

func (*ReceiptWithFwds) Parse

func (r *ReceiptWithFwds) Parse(outputParser func(out []byte) error, logParsers ...func(logs []*models.Log) error) error

func (*ReceiptWithFwds) String

func (r *ReceiptWithFwds) String() string

type RpcBlocks

type RpcBlocks struct {
	ChainID common.ChainID
	Current common.Height
	Blocks  []*models.BlockEMessage
}

func (*RpcBlocks) InfoString

func (b *RpcBlocks) InfoString(level common.IndentLevel) string

func (*RpcBlocks) String

func (b *RpcBlocks) String() string

type RpcCommProof

type RpcCommProof struct {
	ChainID common.ChainID
	// epoch where committee used
	Epoch common.EpochNum
	// block height where committee pronounced, ({Height}.EpochNum()+1)=={Epoch}
	Height common.Height
	// block hash of height
	HashOfHeader []byte
	// committee node id list of {Epoch}
	Committee *models.Committee
	// signature list of block
	Pass models.PubAndSigs
	// proof from header.ElectedNextRoot to hash of header
	HeaderProof trie.ProofChain
	// last height where committee of (Epoch-1) pronounced. ({LastHeight}.EpochNum()+2)=={Epoch}
	LastHeight common.Height
	// proof from last block hash to current block hash
	LastProof trie.ProofChain
}

func (*RpcCommProof) InfoString

func (p *RpcCommProof) InfoString(level common.IndentLevel) string

func (*RpcCommProof) String

func (p *RpcCommProof) String() string

func (*RpcCommProof) Validate

func (p *RpcCommProof) Validate() error

func (*RpcCommProof) VerifyHeader

func (p *RpcCommProof) VerifyHeader(curComm *models.Committee) error

func (*RpcCommProof) VerifyLast

func (p *RpcCommProof) VerifyLast(lastHeight common.Height, lastHash common.Hash) error

type TransactionReceipt

type TransactionReceipt struct {
	Transaction     *models.Transaction `json:"tx"`                                  // Transaction data object
	Sig             *models.PubAndSig   `json:"signature"`                           // transaction signature
	PostState       []byte              `json:"root"`                                // It is used to record the information of transaction execution in JSON format, such as gas, cost "gas", and world state "root" after execution.
	Status          uint64              `json:"status"`                              // Transaction execution status, 0: failed, 1: successful. (refers to whether the execution is abnormal)
	Logs            []*models.Log       `json:"logs" gencodec:"required"`            // The log written by the contract during execution
	GasBonuses      []*models.Bonus     `json:"gasBonuses"`                          // gas bonuses if the tx is a contract call
	TxHash          common.Hash         `json:"transactionHash" gencodec:"required"` // Transaction Hash
	ContractAddress common.Address      `json:"contractAddress"`                     // If you are creating a contract, save the address of the created contract here
	Out             hexutil.Bytes       `json:"out"`                                 // Return value of contract execution
	Height          common.Height       `json:"blockHeight"`                         // The block where the transaction is packaged is high and will not be returned when calling
	GasUsed         uint64              `json:"gasUsed"`                             // The gas value consumed by transaction execution is not returned in call
	GasFee          string              `json:"gasFee"`                              // The gas cost of transaction execution is not returned in call
	PostRoot        []byte              `json:"postroot"`                            // World state root after transaction execution (never return, always empty)
	Error           string              `json:"errorMsg"`                            // Error message in case of transaction execution failure
	Param           []byte              `json:"txParam"`                             // tx param generated by block proposer
}

func (*TransactionReceipt) Err added in v0.1.3

func (r *TransactionReceipt) Err() error

func (*TransactionReceipt) FullReceipt

func (r *TransactionReceipt) FullReceipt(tx *models.Transaction, pas *models.PubAndSig, blockHeight common.Height,
	rpt *models.Receipt) *TransactionReceipt

func (*TransactionReceipt) InfoString

func (r *TransactionReceipt) InfoString(level common.IndentLevel) string

func (*TransactionReceipt) Parse added in v0.4.0

func (r *TransactionReceipt) Parse(outputParser func(out []byte) error, logParsers ...func(logs []*models.Log) error) error

func (*TransactionReceipt) PartReceipt

func (*TransactionReceipt) Reset

func (r *TransactionReceipt) Reset()

func (*TransactionReceipt) Revert

func (r *TransactionReceipt) Revert() []byte

func (*TransactionReceipt) RevertError

func (r *TransactionReceipt) RevertError() error

func (*TransactionReceipt) String

func (r *TransactionReceipt) String() string

func (*TransactionReceipt) Success added in v0.1.3

func (r *TransactionReceipt) Success() bool

type TxProof

type TxProof struct {
	TransactionReceipt
	Proof MerkleItems `json:"proof"`
}

func (*TxProof) InfoString

func (t *TxProof) InfoString(level common.IndentLevel) string

type TxReceipts

type TxReceipts []*TransactionReceipt

func (TxReceipts) InfoString

func (ts TxReceipts) InfoString(level common.IndentLevel) string

Jump to

Keyboard shortcuts

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