codec

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2020 License: MIT Imports: 15 Imported by: 18

Documentation

Index

Constants

View Source
const ISO_DATE_FORMAT = "2006-01-02T15:04:05.000Z07:00"

Variables

This section is empty.

Functions

func EncodeGetBlockRequest added in v0.7.0

func EncodeGetBlockRequest(req *GetBlockRequest) ([]byte, error)

func EncodeGetTransactionReceiptProofRequest added in v0.5.3

func EncodeGetTransactionReceiptProofRequest(req *GetTransactionReceiptProofRequest) ([]byte, error)

func EncodeGetTransactionStatusRequest

func EncodeGetTransactionStatusRequest(req *GetTransactionStatusRequest) ([]byte, error)

func EncodeRunQueryRequest added in v0.6.0

func EncodeRunQueryRequest(req *RunQueryRequest) ([]byte, error)

func EncodeSendTransactionRequest

func EncodeSendTransactionRequest(req *SendTransactionRequest, privateKey []byte) ([]byte, []byte, error)

func PackedEventsEncode added in v0.5.3

func PackedEventsEncode(eventBuilders []*protocol.EventBuilder) []byte

Types

type BlockTransaction added in v0.7.0

type BlockTransaction struct {
	TxId            []byte
	TxHash          []byte
	ProtocolVersion uint32
	VirtualChainId  uint32
	Timestamp       time.Time
	SignerPublicKey []byte
	ContractName    string
	MethodName      string
	InputArguments  []interface{}
	ExecutionResult ExecutionResult
	OutputArguments []interface{}
	OutputEvents    []*Event
}

func (*BlockTransaction) MarshalJSON added in v0.7.0

func (r *BlockTransaction) MarshalJSON() ([]byte, error)

type Event added in v0.5.3

type Event struct {
	ContractName string
	EventName    string
	Arguments    []interface{}
}

func PackedEventsDecode added in v0.5.3

func PackedEventsDecode(buf []byte) (res []*Event, err error)

type ExecutionResult

type ExecutionResult string
const (
	EXECUTION_RESULT_PARSE_ERROR                 ExecutionResult = "<PARSE_ERROR>"
	EXECUTION_RESULT_SUCCESS                     ExecutionResult = "SUCCESS"
	EXECUTION_RESULT_ERROR_SMART_CONTRACT        ExecutionResult = "ERROR_SMART_CONTRACT"
	EXECUTION_RESULT_ERROR_INPUT                 ExecutionResult = "ERROR_INPUT"
	EXECUTION_RESULT_ERROR_CONTRACT_NOT_DEPLOYED ExecutionResult = "ERROR_CONTRACT_NOT_DEPLOYED"
	EXECUTION_RESULT_ERROR_UNEXPECTED            ExecutionResult = "ERROR_UNEXPECTED"
	EXECUTION_RESULT_NOT_EXECUTED                ExecutionResult = "NOT_EXECUTED"
)

func (ExecutionResult) String added in v0.5.3

func (x ExecutionResult) String() string

type GetBlockRequest added in v0.7.0

type GetBlockRequest struct {
	ProtocolVersion uint32
	VirtualChainId  uint32
	BlockHeight     uint64
}

func (*GetBlockRequest) UnmarshalJSON added in v0.7.0

func (r *GetBlockRequest) UnmarshalJSON(data []byte) error

type GetBlockResponse added in v0.7.0

type GetBlockResponse struct {
	*Response
	TransactionsBlockHash   []byte
	TransactionsBlockHeader *TransactionsBlockHeader
	ResultsBlockHash        []byte
	ResultsBlockHeader      *ResultsBlockHeader
	Transactions            []*BlockTransaction
}

func DecodeGetBlockResponse added in v0.7.0

func DecodeGetBlockResponse(buf []byte) (*GetBlockResponse, error)

func (*GetBlockResponse) MarshalJSON added in v0.7.0

func (r *GetBlockResponse) MarshalJSON() ([]byte, error)

type GetTransactionReceiptProofRequest added in v0.5.3

type GetTransactionReceiptProofRequest struct {
	ProtocolVersion uint32
	VirtualChainId  uint32
	TxId            []byte
}

func (*GetTransactionReceiptProofRequest) UnmarshalJSON added in v0.5.3

func (r *GetTransactionReceiptProofRequest) UnmarshalJSON(data []byte) error

type GetTransactionReceiptProofResponse added in v0.5.3

type GetTransactionReceiptProofResponse struct {
	*TransactionResponse
	PackedProof   []byte
	PackedReceipt []byte
}

func DecodeGetTransactionReceiptProofResponse added in v0.5.3

func DecodeGetTransactionReceiptProofResponse(buf []byte) (*GetTransactionReceiptProofResponse, error)

func (*GetTransactionReceiptProofResponse) MarshalJSON added in v0.5.3

func (r *GetTransactionReceiptProofResponse) MarshalJSON() ([]byte, error)

type GetTransactionStatusRequest

type GetTransactionStatusRequest struct {
	ProtocolVersion uint32
	VirtualChainId  uint32
	TxId            []byte
}

func (*GetTransactionStatusRequest) UnmarshalJSON

func (r *GetTransactionStatusRequest) UnmarshalJSON(data []byte) error

type GetTransactionStatusResponse

type GetTransactionStatusResponse struct {
	*TransactionResponse
}

func DecodeGetTransactionStatusResponse

func DecodeGetTransactionStatusResponse(buf []byte) (*GetTransactionStatusResponse, error)

func (*GetTransactionStatusResponse) MarshalJSON

func (r *GetTransactionStatusResponse) MarshalJSON() ([]byte, error)

type NetworkType

type NetworkType string
const (
	NETWORK_TYPE_MAIN_NET NetworkType = "MAIN_NET"
	NETWORK_TYPE_TEST_NET NetworkType = "TEST_NET"
)

func (NetworkType) String added in v0.5.3

func (x NetworkType) String() string

type ReadResponse added in v0.11.0

type ReadResponse struct {
	*Response
	ExecutionResult ExecutionResult
	OutputArguments []interface{}
	OutputEvents    []*Event
}

func NewReadResponse added in v0.11.0

func NewReadResponse(res requestResponser, rawReceipt []byte, receipt ReceiptLike) (*ReadResponse, error)

type ReceiptLike added in v0.11.0

type ReceiptLike interface {
	ExecutionResult() protocol.ExecutionResult
	RawOutputArgumentArrayWithHeader() []byte
	RawOutputEventsArrayWithHeader() []byte
}

type RequestStatus

type RequestStatus string
const (
	REQUEST_STATUS_PARSE_ERROR  RequestStatus = "<PARSE_ERROR>"
	REQUEST_STATUS_COMPLETED    RequestStatus = "COMPLETED"
	REQUEST_STATUS_IN_PROCESS   RequestStatus = "IN_PROCESS"
	REQUEST_STATUS_BAD_REQUEST  RequestStatus = "BAD_REQUEST"
	REQUEST_STATUS_CONGESTION   RequestStatus = "CONGESTION"
	REQUEST_STATUS_SYSTEM_ERROR RequestStatus = "SYSTEM_ERROR"
	REQUEST_STATUS_OUT_OF_SYNC  RequestStatus = "OUT_OF_SYNC"
	REQUEST_STATUS_NOT_FOUND    RequestStatus = "NOT_FOUND"
)

func (RequestStatus) String added in v0.5.3

func (x RequestStatus) String() string

type Response added in v0.11.0

type Response struct {
	RequestStatus  RequestStatus
	BlockHeight    uint64
	BlockTimestamp time.Time
}

func NewResponse added in v0.11.0

func NewResponse(res requestResponser) (*Response, error)

type ResultsBlockHeader added in v0.7.0

type ResultsBlockHeader struct {
	ProtocolVersion        uint32
	VirtualChainId         uint32
	BlockHeight            uint64
	PrevBlockHash          []byte
	Timestamp              time.Time
	TransactionsBlockHash  []byte
	NumTransactionReceipts uint32
	BlockProposerAddress   []byte
	ReferenceTime          uint32
}

func (*ResultsBlockHeader) MarshalJSON added in v0.7.0

func (r *ResultsBlockHeader) MarshalJSON() ([]byte, error)

type RunQueryRequest added in v0.6.0

type RunQueryRequest struct {
	ProtocolVersion uint32
	VirtualChainId  uint32
	Timestamp       time.Time
	NetworkType     NetworkType
	PublicKey       []byte
	ContractName    string
	MethodName      string
	InputArguments  []interface{}
}

func (*RunQueryRequest) UnmarshalJSON added in v0.6.0

func (r *RunQueryRequest) UnmarshalJSON(data []byte) error

type RunQueryResponse added in v0.6.0

type RunQueryResponse struct {
	*ReadResponse
}

func DecodeRunQueryResponse added in v0.6.0

func DecodeRunQueryResponse(buf []byte) (*RunQueryResponse, error)

func (*RunQueryResponse) MarshalJSON added in v0.6.0

func (r *RunQueryResponse) MarshalJSON() ([]byte, error)

type SendTransactionRequest

type SendTransactionRequest struct {
	ProtocolVersion uint32
	VirtualChainId  uint32
	Timestamp       time.Time
	NetworkType     NetworkType
	PublicKey       []byte
	ContractName    string
	MethodName      string
	InputArguments  []interface{}
}

func (*SendTransactionRequest) UnmarshalJSON

func (r *SendTransactionRequest) UnmarshalJSON(data []byte) error

type SendTransactionResponse

type SendTransactionResponse struct {
	*TransactionResponse
}

func DecodeSendTransactionResponse

func DecodeSendTransactionResponse(buf []byte) (*SendTransactionResponse, error)

func (*SendTransactionResponse) MarshalJSON

func (r *SendTransactionResponse) MarshalJSON() ([]byte, error)

type TransactionResponse added in v0.11.0

type TransactionResponse struct {
	*ReadResponse
	TransactionStatus TransactionStatus
	TxHash            []byte
}

func NewTransactionResponse added in v0.11.0

func NewTransactionResponse(res txResponse) (*TransactionResponse, error)

type TransactionStatus

type TransactionStatus string
const (
	TRANSACTION_STATUS_PARSE_ERROR                             TransactionStatus = "<PARSE_ERROR>"
	TRANSACTION_STATUS_COMMITTED                               TransactionStatus = "COMMITTED"
	TRANSACTION_STATUS_DUPLICATE_TRANSACTION_ALREADY_COMMITTED TransactionStatus = "DUPLICATE_TRANSACTION_ALREADY_COMMITTED"
	TRANSACTION_STATUS_PENDING                                 TransactionStatus = "PENDING"
	TRANSACTION_STATUS_DUPLICATE_TRANSACTION_ALREADY_PENDING   TransactionStatus = "DUPLICATE_TRANSACTION_ALREADY_PENDING"
	TRANSACTION_STATUS_NO_RECORD_FOUND                         TransactionStatus = "NO_RECORD_FOUND"
	TRANSACTION_STATUS_REJECTED_UNSUPPORTED_VERSION            TransactionStatus = "REJECTED_UNSUPPORTED_VERSION"
	TRANSACTION_STATUS_REJECTED_VIRTUAL_CHAIN_MISMATCH         TransactionStatus = "REJECTED_VIRTUAL_CHAIN_MISMATCH"
	TRANSACTION_STATUS_REJECTED_TIMESTAMP_WINDOW_EXCEEDED      TransactionStatus = "REJECTED_TIMESTAMP_WINDOW_EXCEEDED"
	TRANSACTION_STATUS_REJECTED_SIGNATURE_MISMATCH             TransactionStatus = "REJECTED_SIGNATURE_MISMATCH"
	TRANSACTION_STATUS_REJECTED_UNKNOWN_SIGNER_SCHEME          TransactionStatus = "REJECTED_UNKNOWN_SIGNER_SCHEME"
	TRANSACTION_STATUS_REJECTED_GLOBAL_PRE_ORDER               TransactionStatus = "REJECTED_GLOBAL_PRE_ORDER"
	TRANSACTION_STATUS_REJECTED_VIRTUAL_CHAIN_PRE_ORDER        TransactionStatus = "REJECTED_VIRTUAL_CHAIN_PRE_ORDER"
	TRANSACTION_STATUS_REJECTED_SMART_CONTRACT_PRE_ORDER       TransactionStatus = "REJECTED_SMART_CONTRACT_PRE_ORDER"
	TRANSACTION_STATUS_REJECTED_TIMESTAMP_AHEAD_OF_NODE_TIME   TransactionStatus = "REJECTED_TIMESTAMP_AHEAD_OF_NODE_TIME"
	TRANSACTION_STATUS_REJECTED_CONGESTION                     TransactionStatus = "REJECTED_CONGESTION"
	TRANSACTION_STATUS_REJECTED_NODE_OUT_OF_SYNC               TransactionStatus = "REJECTED_NODE_OUT_OF_SYNC"
)

func (TransactionStatus) String added in v0.5.3

func (x TransactionStatus) String() string

type TransactionsBlockHeader added in v0.7.0

type TransactionsBlockHeader struct {
	ProtocolVersion      uint32
	VirtualChainId       uint32
	BlockHeight          uint64
	PrevBlockHash        []byte
	Timestamp            time.Time
	NumTransactions      uint32
	BlockProposerAddress []byte
	ReferenceTime        uint32
}

func (*TransactionsBlockHeader) MarshalJSON added in v0.7.0

func (r *TransactionsBlockHeader) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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