common

package
v0.0.0-...-d5522c5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StdErrToXchainErrMap = map[int]pb.XChainErrorEnum{
	ecom.ErrSuccess.Code:                  pb.XChainErrorEnum_SUCCESS,
	ecom.ErrInternal.Code:                 pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrUnknown.Code:                  pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrForbidden.Code:                pb.XChainErrorEnum_CONNECT_REFUSE,
	ecom.ErrUnauthorized.Code:             pb.XChainErrorEnum_CONNECT_REFUSE,
	ecom.ErrParameter.Code:                pb.XChainErrorEnum_CONNECT_REFUSE,
	ecom.ErrNewEngineCtxFailed.Code:       pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrNotEngineType.Code:            pb.XChainErrorEnum_CONNECT_REFUSE,
	ecom.ErrLoadEngConfFailed.Code:        pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrNewLogFailed.Code:             pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrNewChainCtxFailed.Code:        pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrChainExist.Code:               pb.XChainErrorEnum_CONNECT_REFUSE,
	ecom.ErrChainNotExist.Code:            pb.XChainErrorEnum_BLOCKCHAIN_NOTEXIST,
	ecom.ErrChainAlreadyExist.Code:        pb.XChainErrorEnum_CONNECT_REFUSE,
	ecom.ErrChainStatus.Code:              pb.XChainErrorEnum_NOT_READY_ERROR,
	ecom.ErrRootChainNotExist.Code:        pb.XChainErrorEnum_CONNECT_REFUSE,
	ecom.ErrLoadChainFailed.Code:          pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrContractNewCtxFailed.Code:     pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrContractInvokeFailed.Code:     pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrContractNewSandboxFailed.Code: pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrTxVerifyFailed.Code:           pb.XChainErrorEnum_TX_VERIFICATION_ERROR,
	ecom.ErrTxAlreadyExist.Code:           pb.XChainErrorEnum_TX_DUPLICATE_ERROR,
	ecom.ErrTxNotExist.Code:               pb.XChainErrorEnum_TX_NOT_FOUND_ERROR,
	ecom.ErrTxNotEnough.Code:              pb.XChainErrorEnum_NOT_ENOUGH_UTXO_ERROR,
	ecom.ErrSubmitTxFailed.Code:           pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrBlockNotExist.Code:            pb.XChainErrorEnum_BLOCK_EXIST_ERROR,
	ecom.ErrProcBlockFailed.Code:          pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrNewNetEventFailed.Code:        pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrNewNetworkFailed.Code:         pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrSendMessageFailed.Code:        pb.XChainErrorEnum_UNKNOW_ERROR,
	ecom.ErrNetworkNoResponse.Code:        pb.XChainErrorEnum_UNKNOW_ERROR,
}

错误映射配置

Functions

func AclToXchain

func AclToXchain(acl *protos.Acl) *pb.Acl

func BalanceDetailToXchain

func BalanceDetailToXchain(detail *xldgpb.BalanceDetailInfo) *pb.TokenFrozenDetail

func BalanceDetailsToXchain

func BalanceDetailsToXchain(details []*xldgpb.BalanceDetailInfo) ([]*pb.TokenFrozenDetail, error)

func BlockToXchain

func BlockToXchain(block *xldgpb.InternalBlock) *pb.InternalBlock

为了完全兼容老版本pb结构,转换区块结构

func BlockToXledger

func BlockToXledger(block *pb.InternalBlock) *xldgpb.InternalBlock

为了完全兼容老版本pb结构,转换区块结构

func ComputeTxSign

func ComputeTxSign(cryptoClient crypto_base.CryptoClient, tx *pb.Transaction, jsonSK []byte) ([]byte, error)

适配原结构签名

func ContractStatusListToXchain

func ContractStatusListToXchain(contractStatusList []*protos.ContractStatus) ([]*pb.ContractStatus, error)

func ContractStatusToXchain

func ContractStatusToXchain(contractStatus *protos.ContractStatus) *pb.ContractStatus

func ConvertEventSubType

func ConvertEventSubType(typ pb.SubscribeType) protos.SubscribeType

func ConvertInvokeReq

func ConvertInvokeReq(reqs []*pb.InvokeRequest) ([]*protos.InvokeRequest, error)

func ConvertInvokeResp

func ConvertInvokeResp(resp *protos.InvokeResponse) *pb.InvokeResponse

func LedgerMetaToXchain

func LedgerMetaToXchain(meta *xldgpb.LedgerMeta) *pb.LedgerMeta

func MakeTxDigestHash

func MakeTxDigestHash(tx *pb.Transaction) ([]byte, error)

func MakeTxId

func MakeTxId(tx *pb.Transaction) ([]byte, error)

适配原结构计算txid

func PeerInfoToStrings

func PeerInfoToStrings(info protos.PeerInfo) []string

func TxToXchain

func TxToXchain(tx *xldgpb.Transaction) *pb.Transaction

为了完全兼容老版本pb结构,转换交易结构

func TxToXledger

func TxToXledger(tx *pb.Transaction) *xldgpb.Transaction

为了完全兼容老版本pb结构,转换交易结构

func UtxoListToXchain

func UtxoListToXchain(utxoList []*xldgpb.Utxo) ([]*pb.Utxo, error)

func UtxoMetaToXchain

func UtxoMetaToXchain(meta *xldgpb.UtxoMeta) *pb.UtxoMeta

func UtxoRecordToXchain

func UtxoRecordToXchain(record *xldgpb.UtxoRecord) *pb.UtxoRecord

func UtxoToXchain

func UtxoToXchain(utxo *xldgpb.Utxo) *pb.Utxo

func UtxoToXledger

func UtxoToXledger(utxo *pb.Utxo) *xldgpb.Utxo

Types

This section is empty.

Jump to

Keyboard shortcuts

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