rpc

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 52 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// FileDownload Type
	TypeDownload = "download"
	// FileUpload Type
	TypeUpload = "upload"
	//
	TypePush = "push"
	// content type stream
	Stream = "application/octet-stream"
)
View Source
const (
	// KVExtraVersionValue is private transaction extra field version
	KVExtraVersionValue = "1.0"
	// KVExtraVersionKey is private transaction extra field name
	KVExtraVersionKey = "__version__"
	// KVExtraPrivateKey is private transaction extra payload
	KVExtraPrivateKey = "__privateData__"
	// KVExtraPrivatePayloadKey is private transaction real payload
	KVExtraPrivatePayloadKey = "payload"
	// KVExtraPrivatePubSigKey is private transaction public signature
	KVExtraPrivatePubSigKey = "publicSignature"
)
View Source
const (
	// DBOPBatch event
	DBOPBatch MqEvent = "DBOPBatch"
	// TxExec event
	TxExec MqEvent = "TxExec"
	// MQTxContent event
	MQTxContent MqEvent = "MQTxContent"

	DefaultAmdpURL string = "amqp://guest:guest@localhost:5672/"
)
View Source
const (
	// MQBlock MQBlock
	MQBlock routingKey = "MQBlock"
	// MQLog MQLog
	MQLog routingKey = "MQLog"
	// MQException MQException
	MQException routingKey = "MQException"
)
View Source
const (
	// TRANSACTION type
	TRANSACTION = "tx_"
	// CONTRACT type
	CONTRACT = "contract_"
	// CONTRACT type
	CROSS_CHAIN = "crosschain_"
	// BLOCK type
	BLOCK = "block_"
	// ACCOUNT type
	ACCOUNT = "account_"
	// NODE type
	NODE = "node_"
	// CERT type
	CERT = "cert_"
	// SUB type
	SUB = "sub_"
	// ARCHIVE type
	ARCHIVE = "archive_"
	// MQ type
	MQ = "mq_"
	// RADAR type
	RADAR = "radar_"
	// CONFIG type
	CONFIG = "config_"
	// FILE type
	FILE = "fm_"
	// AUTH type
	AUTH = "auth_"
	// SIMULATE type
	SIMULATE = "simulate_"
	//DID type
	DID = "did_"
	// PROOF type
	PROOF = "proof_"

	DefaultNamespace          = "global"
	DefaultResendTime         = 10
	DefaultFirstPollInterval  = 100
	DefaultFirstPollTime      = 10
	DefaultSecondPollInterval = 1000
	DefaultSecondPollTime     = 10
	DefaultReConnectTime      = 10000
	DefaultTxVersion          = "3.0"
)
View Source
const (
	EVM      VMType = "EVM"
	JVM      VMType = "JVM"
	HVM      VMType = "HVM"
	BVM      VMType = "BVM"
	TRANSFER VMType = "TRANSFER"
	KVSQL    VMType = "KVSQL"
	FVM      VMType = "FVM"
	UNIT            = 32

	//default transaction gas limit
	DefaultTxGasLimit = 1000000000
	// flato gas limit
	DefaultTxGasLimitV2 = 10000000

	// TimeLength is the number length of timestamp
	TimeLength = 8

	UPDATE                 = 1
	DID_REGISTER           = 200
	DID_FREEZE             = 201
	DID_UNFREEZE           = 202
	DID_ABANDON            = 203
	DID_UPDATEPUBLICKEY    = 204
	DID_UPDATEADMINS       = 205
	DIDCREDENTIAL_UPLOAD   = 206
	DIDCREDENTIAL_DOWNLOAD = 207
	DIDCREDENTIAL_ABANDON  = 208
	DID_SETEXTRA           = 209
	DID_GETEXTRA           = 210
)

VMType vm type, could by evm and jvm for now

View Source
const (
	TxVersion25 string = "2.5"
	TxVersion30 string = "3.0"
)
View Source
const (
	SystemErrorCode         = -9996
	AsnycRequestErrorCode   = -9997
	RequestTimeoutErrorCode = -9998
	GetResponseErrorCode    = -9999
	SuccessCode             = 0
	//InvalidJSONCode             = -32700
	//InvalidRequestCode          = -32600
	MethodNotExistOrInvalidCode = -32601
	//InvalidMethodArgsCode       = -32602
	//JSONRPCInternalErrorCode    = -32603
	DataNotExistCode          = -32001
	BalanceInsufficientCode   = -32002
	InvalidSignature          = -32003
	SystemBusyCode            = -32006
	DuplicateTransactionsCode = -32007
	InvalidParams             = -32602
	ConsensusStatusAbnormal   = -32024
	QPSLimit                  = -32026
	DispatcherFull            = -32025
	SimulateLimit             = -32027

	ALGOTYPE_SM2 = "sm2"
	ALGOTYPE_EC  = "ecdsa"
	ALGOTYPE_ED  = "ed25519"

	NORMAL  = 0
	FREEZE  = 1
	ABANDON = 2
)

reponse codes

View Source
const (
	ContractManifestPath = "META-INF/MANIFEST.MF"
	ContractClassSuffix  = ".class"

	// ContractDeployMagic hvm contract deploy magic
	ContractDeployMagic = "fefffbcd"
)
View Source
const (
	// ReadBufferSize read buff size
	ReadBufferSize = 1024 * 256
	//WriteBufferSize write buff size
	WriteBufferSize = 1024 * 256
)
View Source
const (
	// JSONRPCVersion is rpc version
	JSONRPCVersion = "2.0"
)

Variables

View Source
var (
	TxVersion       = DefaultTxVersion
	GasPrice  int64 = 0
)
View Source
var (
	ErrInvalidLengthTransaction = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTransaction   = fmt.Errorf("proto: integer overflow")
)
View Source
var TransactionValue_Opcode_name = map[int32]string{
	0:   "NORMAL",
	1:   "UPDATE",
	2:   "FREEZE",
	3:   "UNFREEZE",
	4:   "SKIPVM",
	100: "ARCHIVE",
}
View Source
var TransactionValue_Opcode_value = map[string]int32{
	"NORMAL":   0,
	"UPDATE":   1,
	"FREEZE":   2,
	"UNFREEZE": 3,
	"SKIPVM":   4,
	"ARCHIVE":  100,
}
View Source
var TransactionValue_VmType_name = map[int32]string{
	0: "EVM",
	1: "JVM",
	2: "HVM",
	3: "BVM",
	4: "TRANSFER",
}
View Source
var TransactionValue_VmType_value = map[string]int32{
	"EVM":      0,
	"JVM":      1,
	"HVM":      2,
	"BVM":      3,
	"TRANSFER": 4,
}

Functions

func CompareTxVersion added in v1.2.0

func CompareTxVersion(a, b string) int

CompareTxVersion the value of TXVersion , return 1 if a > b ,0 if a = b, -1 if a < bq

func DecompressFromJar

func DecompressFromJar(filepath string) ([]byte, error)

DecompressFromJar encode jarcode for deploy or upgrade

func DecompressFromJarWithTxVersion

func DecompressFromJarWithTxVersion(filepath, txversion string) ([]byte, error)

func FetchOutputTypes

func FetchOutputTypes(rawAbi string, funcName string) ([]string, error)

FetchOutputTypes return output args type by function name

func GenSinPub

func GenSinPub(key account.Key, needHashString string) string

GenSinPub is used to signature needString

func GetFileHash

func GetFileHash(file io.Reader) (string, error)

GetFileHash evaluate the md5 of the file

func ReadZipFile

func ReadZipFile(zipf *zip.File) ([]byte, error)

ReadZipFile read a file data from a zip

func SignWithDID

func SignWithDID(key interface{}, needHash string, batch, isKPIAccount, isDID bool) (string, error)

func ValidateAccountProof added in v1.2.2

func ValidateAccountProof(account string, path *AccountProofPath) bool

Types

type AccountProofPath added in v1.1.0

type AccountProofPath struct {
	AccountProof types.ProofPath `json:"accountProof"`
}

AccountProofPath represents the result returned by proof query.

type ArchiveResult

type ArchiveResult struct {
	FilterID string `json:"filterId"`
	Status   string `json:"status"`
	Reason   string `json:"reason"`
}

ArchiveResult used for return archive result, tell caller which step is processing

type Authentication

type Authentication struct {
	Timestamp int64          `json:"timestamp"`
	Address   common.Address `json:"address"`
	Signature string         `json:"signature"`
}

Authentication contains params for api auth

type BalanceAndAmount

type BalanceAndAmount struct {
	NewBalance string
	Amount     string
}

type Block

type Block struct {
	Version      string
	Number       uint64
	Hash         string
	ParentHash   string
	WriteTime    uint64
	AvgTime      int64
	TxCounts     uint64
	MerkleRoot   string
	Transactions []TransactionInfo
	TxRoot       string
}

Block is packaged result of Block

type BlockEventFilter

type BlockEventFilter struct {
	BlockInfo bool
	// contains filtered or unexported fields
}

BlockEventFilter block filter

func NewBlockEventFilter

func NewBlockEventFilter() *BlockEventFilter

NewBlockEventFilter return a BlockEventFilter

func (*BlockEventFilter) GetEventType

func (bf *BlockEventFilter) GetEventType() EventType

GetEventType return event type

func (*BlockEventFilter) Serialize

func (bf *BlockEventFilter) Serialize() interface{}

Serialize serialize

func (*BlockEventFilter) SetBlockInfo

func (bf *BlockEventFilter) SetBlockInfo(b bool)

SetBlockInfo blockInfo setter

type BlockInterval

type BlockInterval struct {
	SumOfBlocks uint64
	StartBlock  uint64
	EndBlock    uint64
}

BlockInterval describe the BlockInterval related information(decoded)

type BlockIntervalRaw

type BlockIntervalRaw struct {
	SumOfBlocks string
	StartBlock  string
	EndBlock    string
}

BlockIntervalRaw describe the BlockInterval related information(not decoded yet)

func (*BlockIntervalRaw) ToBlockInterval

func (b *BlockIntervalRaw) ToBlockInterval() (*BlockInterval, StdError)

ToBlockInterval decode BlockIntervalRaw to BlockInterval

type BlockRaw

type BlockRaw struct {
	Version      string           `json:"version"`
	Number       string           `json:"number"`                 // the block number
	Hash         string           `json:"hash"`                   // hash of the block
	ParentHash   string           `json:"parentHash"`             // hash of the parent block
	WriteTime    uint64           `json:"writeTime"`              // the unix timestamp for when the block was written
	AvgTime      string           `json:"avgTime"`                // the average time it takes to execute transactions in the block (ms)
	TxCounts     string           `json:"txcounts"`               // the number of transactions in the block
	MerkleRoot   string           `json:"merkleRoot"`             // merkle tree root hash
	Transactions []TransactionRaw `json:"transactions,omitempty"` // the list of transactions in the block
}

BlockRaw is packaged result of block

func (*BlockRaw) ToBlock

func (b *BlockRaw) ToBlock() (*Block, StdError)

ToBlock is used to transform BlockRaw to Block

type Bookmark

type Bookmark struct {
	BlockNumber uint64 `json:"blkNum"`
	TxIndex     int64  `json:"txIndex"`
}

type ClientOption added in v1.2.0

type ClientOption struct {
	StreamNumber int
}

type CompileResult

type CompileResult struct {
	Abi   []string
	Bin   []string
	Types []string
}

CompileResult is packaged compile contract result

type ConsumeParams added in v1.2.0

type ConsumeParams struct {
	QueueName string `json:"queueName"`
}

type ContractGrpc added in v1.2.0

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

func (*ContractGrpc) Close added in v1.2.0

func (c *ContractGrpc) Close() error

func (*ContractGrpc) DeployContract added in v1.2.0

func (c *ContractGrpc) DeployContract(trans *Transaction) (string, StdError)

func (*ContractGrpc) DeployContractReturnReceipt added in v1.2.0

func (c *ContractGrpc) DeployContractReturnReceipt(trans *Transaction) (*TxReceipt, StdError)

func (*ContractGrpc) InvokeContract added in v1.2.0

func (c *ContractGrpc) InvokeContract(trans *Transaction) (string, StdError)

func (*ContractGrpc) InvokeContractReturnReceipt added in v1.2.0

func (c *ContractGrpc) InvokeContractReturnReceipt(trans *Transaction) (*TxReceipt, StdError)

func (*ContractGrpc) MaintainContract added in v1.2.0

func (c *ContractGrpc) MaintainContract(trans *Transaction) (string, StdError)

func (*ContractGrpc) MaintainContractReturnReceipt added in v1.2.0

func (c *ContractGrpc) MaintainContractReturnReceipt(trans *Transaction) (*TxReceipt, StdError)

func (*ContractGrpc) ManageContractByVote added in v1.2.0

func (c *ContractGrpc) ManageContractByVote(trans *Transaction) (string, StdError)

func (*ContractGrpc) ManageContractByVoteReturnReceipt added in v1.2.0

func (c *ContractGrpc) ManageContractByVoteReturnReceipt(trans *Transaction) (*TxReceipt, StdError)

type CrossChainMethod added in v1.2.0

type CrossChainMethod string
const (
	// InvokeAnchorContract method used for normal cross chain request
	InvokeAnchorContract CrossChainMethod = "invokeAnchorContract"
	// InvokeTimeoutContract method used for timeout cross chain request
	InvokeTimeoutContract CrossChainMethod = "invokeTimeoutContract"
)

func (CrossChainMethod) String added in v1.2.0

func (c CrossChainMethod) String() string

type DIDCredential

type DIDCredential struct {
	ID             string `json:"id,omitempty"`
	Type           string `json:"type,omitempty"`
	Issuer         string `json:"issuer,omitempty"`
	Holder         string `json:"holder,omitempty"`
	IssuanceDate   int64  `json:"issuanceDate,omitempty"`
	ExpirationDate int64  `json:"expirationDate,omitempty"`
	SignType       string `json:"signType,omitempty"`
	Signature      string `json:"signature,omitempty"`
	Subject        string `json:"subject,omitempty"`
}

func NewDIDCredential

func NewDIDCredential(ctype, issuer, holder, subject string, issuanceDate, expirationDate int64) *DIDCredential

func (*DIDCredential) Sign

func (credential *DIDCredential) Sign(key interface{}) error

type DIDDocument

type DIDDocument struct {
	DidAddress string                 `json:"didAddress,omitempty"`
	State      int                    `json:"state,omitempty"`
	PublicKey  *DIDPublicKey          `json:"publicKey,omitempty"`
	Admins     []string               `json:"admins,omitempty"`
	Extra      map[string]interface{} `json:"extra,omitempty"`
}

func NewDIDDocument

func NewDIDDocument(didAddress string, publicKey *DIDPublicKey, admins []string) *DIDDocument

type DIDPublicKey

type DIDPublicKey struct {
	KeyType  string `json:"type,omitempty"`
	KeyValue []byte `json:"key,omitempty"`
}

func GenDIDPublicKeyFromDIDKey

func GenDIDPublicKeyFromDIDKey(didKey *account.DIDKey) (*DIDPublicKey, error)

type DidGrpc added in v1.2.0

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

func (*DidGrpc) Close added in v1.2.0

func (d *DidGrpc) Close() error

func (*DidGrpc) SendDIDTransaction added in v1.2.0

func (d *DidGrpc) SendDIDTransaction(trans *Transaction) (string, StdError)

func (*DidGrpc) SendDIDTransactionReturnReceipt added in v1.2.0

func (d *DidGrpc) SendDIDTransactionReturnReceipt(trans *Transaction) (*TxReceipt, StdError)

type EventFilter

type EventFilter interface {
	Serialize() interface{}
	GetEventType() EventType
}

EventFilter event filter

type EventType

type EventType string

EventType type

const (
	// BLOCKEVENT block
	BLOCKEVENT EventType = "block"
	// SYSTEMSTATUSEVENT systemStatus
	SYSTEMSTATUSEVENT EventType = "systemStatus"
	// LOGSEVENT logs
	LOGSEVENT EventType = "logs"
)

type FileExtra

type FileExtra struct {
	Hash            string   `json:"hash"`
	FileName        string   `json:"file_name"`
	FileSize        int64    `json:"file_size"`
	UpdateTime      string   `json:"update_time"`
	NodeList        []string `json:"node_list"`
	UserList        []string `json:"user_list,omitempty"`
	FileDescription string   `json:"file_description"`
}

FileExtra represents the arguments to upload a new file into node.

func (*FileExtra) ToJson

func (fExtra *FileExtra) ToJson() (string, error)

ToJson convert FileExtra to json

type Filter

type Filter struct {
	TxHash    string        `json:"txHash,omitempty"`
	BlkNumber uint64        `json:"blkNumber,omitempty"`
	TxIndex   int64         `json:"txIndex,omitempty"`
	TxFrom    string        `json:"txFrom,omitempty"`
	TxTo      string        `json:"txTo,omitempty"`
	Name      string        `json:"txName,omitempty"`
	ExtraId   []interface{} `json:"extraId,omitempty"`
}

type GRPC added in v1.2.0

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

func NewGRPC added in v1.2.0

func NewGRPC(opt ...GRPCOption) *GRPC

func NewGRPCWithConfPath added in v1.2.0

func NewGRPCWithConfPath(path string, opts ...GRPCOption) *GRPC

func (*GRPC) CheckClientOption added in v1.2.0

func (g *GRPC) CheckClientOption(copt ClientOption) (bool, error)

func (*GRPC) Close added in v1.2.0

func (g *GRPC) Close() error

func (*GRPC) NewContractGrpc added in v1.2.0

func (g *GRPC) NewContractGrpc(opt ClientOption) (*ContractGrpc, error)

func (*GRPC) NewDidGrpc added in v1.2.0

func (g *GRPC) NewDidGrpc(opt ClientOption) (*DidGrpc, error)

func (*GRPC) NewGrpcMQ added in v1.2.0

func (g *GRPC) NewGrpcMQ() (*grpcMQ, error)

func (*GRPC) NewTransactionGrpc added in v1.2.0

func (g *GRPC) NewTransactionGrpc(opt ClientOption) (*TransactionGrpc, error)

type GRPCOption added in v1.2.0

type GRPCOption interface {
	// contains filtered or unexported methods
}

func BindNodes added in v1.2.0

func BindNodes(s ...int) GRPCOption

BindNodes binding grpc nodes, begin at 0

type InspectorRule

type InspectorRule struct {
	// AllowAnyone determines whether the resources can be accessed freely by anyone
	AllowAnyone bool `json:"allow_anyone" mapstructure:"allow_anyone"`

	// AuthorizedRoles determine who can access the resource if the resources can not be accessed freely
	AuthorizedRoles []string `json:"authorized_roles" mapstructure:"authorized_roles"`

	// ForbiddenRoles determine who can not access the resources though he has the authorized roles
	ForbiddenRoles []string `json:"forbidden_roles" mapstructure:"forbidden_roles"`

	// ID is the identity sequence number for priority
	ID int `json:"id" mapstructure:"id"`

	// Name is the identity string for reading
	Name string `json:"name" mapstructure:"name"`

	// To is  the `to` address used to define resources of tx api
	Method []string `json:"method" mapstructure:"method"`
}

InspectorRule is the rule of api filter

type IntervalTime

type IntervalTime struct {
	StartTime int64 `json:"startTime"`
	Endtime   int64 `json:"endTime"`

	Metadata *Metadata `json:"metadata"`

	Filter *Filter `json:"filter"`
}

IntervalTime represents the parameter used by criteria query.

type JSONError

type JSONError struct {
	Code      int         `json:"code"`
	Message   string      `json:"message"`
	Namespace string      `json:"namespace"`
	Data      interface{} `json:"data,omitempty"`
}

JSONError is used to package http error info

type JSONRequest

type JSONRequest struct {
	Method    string          `json:"method"`
	Version   string          `json:"jsonrpc"`
	ID        int             `json:"id,omitempty"`
	Namespace string          `json:"namespace,omitempty"`
	Params    []interface{}   `json:"params,omitempty"`
	Auth      *Authentication `json:"auth,omitempty"`
	// contains filtered or unexported fields
}

JSONRequest is used to package http request

type JSONResponse

type JSONResponse struct {
	Version   string          `json:"jsonrpc"`
	ID        int             `json:"id"`
	Result    json.RawMessage `json:"result"`
	Namespace string          `json:"namespace"`
	Code      int             `json:"code"`
	Message   string          `json:"message"`
}

JSONResponse is used to package http response

type JsonMq added in v1.4.0

type JsonMq interface {
	GetAllQueueNames(nodeId int) ([]string, error)
}

type KVExtra

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

KVExtra is transaction extra field

func NewKVExtra

func NewKVExtra() *KVExtra

NewKVExtra is used to private transaction

func (*KVExtra) AddKV

func (k *KVExtra) AddKV(key string, value interface{}) error

AddKV is used to add key into KVExtra

func (*KVExtra) Stringify

func (k *KVExtra) Stringify() string

Stringify is used to convert a KVExtra struct into a string

type KafkaClient added in v1.4.0

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

func (*KafkaClient) GetAllQueueNames added in v1.4.0

func (k *KafkaClient) GetAllQueueNames(nodeId int) ([]string, error)

func (*KafkaClient) Listen added in v1.4.0

func (k *KafkaClient) Listen(queue, url string, listener MqListener) StdError

func (*KafkaClient) Register added in v1.4.0

func (k *KafkaClient) Register(id int, meta *RegisterMeta) (string, StdError)

func (*KafkaClient) UnRegister added in v1.4.0

func (k *KafkaClient) UnRegister(id int, meta *UnRegisterMeta) (bool, StdError)

type KeyParam added in v1.2.2

type KeyParam struct {
	Address   common.Address `json:"address"`
	FieldName string         `json:"fieldName"`
	Params    []string       `json:"params"`
	VMType    string         `json:"vmType"`
}

KeyParam is the ledger-key related user-defined param

func (*KeyParam) String added in v1.2.2

func (kp *KeyParam) String() string

String return a standard format for KeyParam value

type LedgerMetaParam added in v1.2.2

type LedgerMetaParam struct {
	SnapshotID string `json:"snapshotID"`
	SeqNo      uint64 `json:"seqNo"`
}

LedgerMetaParam is the ledger info related user-defined param

func (*LedgerMetaParam) String added in v1.2.2

func (lp *LedgerMetaParam) String() string

String return a standard format for LedgerMetaParam value

type LogsFilter

type LogsFilter struct {
	FromBlock uint64           `json:"fromBlock,omitempty"`
	ToBlock   uint64           `json:"toBlock,omitempty"`
	Addresses []string         `json:"addresses,omitempty"`
	Topics    [4][]common.Hash `json:"topics,omitempty"`
	// contains filtered or unexported fields
}

LogsFilter logs filter

func NewLogsFilter

func NewLogsFilter() *LogsFilter

NewLogsFilter init logs filter

func (*LogsFilter) AddAddress

func (lf *LogsFilter) AddAddress(addresses ...string) *LogsFilter

AddAddress add address into filter

func (*LogsFilter) GetEventType

func (lf *LogsFilter) GetEventType() EventType

GetEventType get event type

func (*LogsFilter) Serialize

func (lf *LogsFilter) Serialize() interface{}

Serialize serialize

func (*LogsFilter) SetFromBlock

func (lf *LogsFilter) SetFromBlock(from uint64) *LogsFilter

SetFromBlock add from block into filter

func (*LogsFilter) SetToBlock

func (lf *LogsFilter) SetToBlock(to uint64) *LogsFilter

SetToBlock add to block into filter

func (*LogsFilter) SetTopic

func (lf *LogsFilter) SetTopic(pos int, topics ...common.Hash) *LogsFilter

SetTopic set topic of specific position

type Manifest

type Manifest struct {
	Height         uint64 `json:"height"`
	Genesis        uint64 `json:"genesis"`
	BlockHash      string `json:"hash"`
	FilterID       string `json:"filterId"`
	MerkleRoot     string `json:"merkleRoot"`
	Namespace      string `json:"Namespace"`
	TxCount        uint64 `json:"txCount"`
	InvalidTxCount uint64 `json:"invalidTxCount,omitEmpty"`
	Status         uint   `json:"status"`
	DBVersion      string `json:"dbVersion"`
	// use for hyperchain
	Date string `json:"date"`
}

Manifest represents all basic information of a snapshot.

type Manifests

type Manifests []Manifest

Manifests Manifests

type Metadata

type Metadata struct {
	PageSize int32     `json:"pagesize"`
	Bookmark *Bookmark `json:"bookmark"`

	// true means to search backward from the bookmark position,
	// otherwise to search forward from the bookmark position
	Backward bool `json:"backward"`
}

type MqClient

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

MqClient mq client support some function

func (*MqClient) DeleteExchange

func (mc *MqClient) DeleteExchange(id uint, exchange string) (bool, StdError)

DeleteExchange delete exchange

func (*MqClient) GetAllQueueNames

func (mc *MqClient) GetAllQueueNames(id uint) ([]string, StdError)

GetAllQueueNames get all queue name

func (*MqClient) GetExchangerName

func (mc *MqClient) GetExchangerName(id uint) (string, StdError)

GetExchangerName get mq exchange name

func (*MqClient) InformNormal

func (mc *MqClient) InformNormal(id uint, brokerURL string) (bool, StdError)

InformNormal notice service the connection is normal

func (*MqClient) Listen

func (mc *MqClient) Listen(queue, url string, autoAck bool, listener MqListener) StdError

Listen add listener for mq

func (*MqClient) Register

func (mc *MqClient) Register(id uint, meta *RegisterMeta) (*QueueRegister, StdError)

Register register mq channel

func (*MqClient) UnRegister

func (mc *MqClient) UnRegister(id uint, meta *UnRegisterMeta) (*QueueUnRegister, StdError)

UnRegister unRegister mq channel

type MqEvent

type MqEvent string

MqEvent event name

type MqListener

type MqListener interface {
	HandleDelivery(data []byte)
}

MqListener handle register

type Node

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

Node is used to contain node info

func NewNode

func NewNode(url string, rpcPort string, wsPort string) (node *Node)

NewNode create a new node

func (*Node) SetNodePriority added in v1.4.0

func (n *Node) SetNodePriority(pri int)

type NodeInfo

type NodeInfo struct {
	Status    uint
	IP        string
	Port      string
	ID        uint
	Isprimary bool   `json:"isPrimary"`
	Delay     uint   //表示该节点与本节点的延迟时间(单位ns),若为0,则为本节点
	IsVp      bool   `json:"isvp"`
	PeerType  string `json:"peerType"`
	Namespace string
	Hash      string
	HostName  string `json:"hostname"`
}

NodeInfo is packaged return result of node

type NodeStateInfo

type NodeStateInfo struct {
	Id          uint64 `json:"id,omitempty"`
	Hostname    string `json:"hostname,omitempty"`
	Hash        string `json:"hash"`
	Status      string `json:"status"` // TIMEOUT, NORMAL, VIEWCHANGE...
	View        uint64 `json:"view"`
	Epoch       uint64 `json:"epoch,omitempty"`
	Checkpoint  uint64 `json:"checkpoint,omitempty"`
	BlockHeight uint64 `json:"blockHeight"` // latest block height of node
	BlockHash   string `json:"blockHash"`   // latest block hash of node
}

NodeStateInfo records the node status(including consensus status)

type PageResult

type PageResult struct {
	HasMore bool        `json:"hasmore"` // 是否还有符合条件的区块或交易
	Data    interface{} `json:"data"`    // 这里其实为以前result里的内容
}

type PageTxs

type PageTxs struct {
	HasMore bool             `json:"hasmore"` // 是否还有符合条件的区块或交易
	Data    []TransactionRaw `json:"data"`    // 这里其实为以前result里的内容
}

type Params

type Params interface {
	// Serialize serialize to map
	Serialize() interface{}
	// SerializeToString serialize to string
	SerializeToString() string
}

Params interface

type Participant added in v1.5.0

type Participant struct {
	Initiator   []byte   `json:"initiator"`
	Withholding [][]byte `json:"withholding"`
}

type PrivateTransactionRawData

type PrivateTransactionRawData struct {
	Collection      []string `json:"collection"`
	PublicSignature string   `json:"publicSignature"`
	Payload         string   `json:"payload"`
}

PrivateTransactionRawData is raw private transaction extra field

type ProofParam added in v1.2.2

type ProofParam struct {
	Meta *LedgerMetaParam `json:"meta"`
	Key  *KeyParam        `json:"key"`
}

ProofParam contains ledger info and key info two parts param

type ProposalRaw

type ProposalRaw struct {
	ID        uint64      `json:"id,omitempty"`
	Code      string      `json:"code,omitempty"`
	Timestamp int64       `json:"timestamp,omitempty"`
	Timeout   int64       `json:"timeout,omitempty"`
	Status    string      `json:"status,omitempty"`
	Assentor  []*VoteInfo `json:"assentor,omitempty"`
	Objector  []*VoteInfo `json:"objector,omitempty"`
	Threshold uint32      `json:"threshold,omitempty"`
	Score     uint32      `json:"score,omitempty"`
	Creator   string      `json:"creator,omitempty"`
	Version   string      `json:"version,omitempty"`
	Type      string      `json:"type,omitempty"`
	Completed string      `json:"completed,omitempty"`
	Cancel    string      `json:"cancel,omitempty"`
}

ProposalRaw ProposalRaw

type QueryTxRange

type QueryTxRange struct {
	From     uint64    `json:"from"`
	To       uint64    `json:"to"`
	Metadata *Metadata `json:"metadata,omitempty"`
}

QueryTxRange packaged query transaction by block number range

func (*QueryTxRange) Serialize

func (qtr *QueryTxRange) Serialize() interface{}

Serialize serialize to map

func (*QueryTxRange) SerializeToString

func (qtr *QueryTxRange) SerializeToString() string

SerializeToString serialize to string

type QueueRegister

type QueueRegister struct {
	QueueName     string
	ExchangerName string
}

QueueRegister MQ register result

type QueueUnRegister

type QueueUnRegister struct {
	Count   uint
	Success bool
	Error   error
}

QueueUnRegister MQ unRegister result

type RPC

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

RPC represents rpc apis

func DefaultRPC

func DefaultRPC(nodes ...*Node) *RPC

DefaultRPC return a *RPC with some default configs

func NewRPC

func NewRPC() *RPC

NewRPC get a RPC instance with default conf directory path "../conf"

func NewRPCWithPath

func NewRPCWithPath(confRootPath string) *RPC

NewRPCWithPath get a RPC instance with user defined root conf directory path the default conf root file structure should like this:

     conf
		├── certs
		│   ├── ecert.cert
		│   ├── ecert.priv
		│   ├── sdkcert.cert
		│   ├── sdkcert.priv
		│   ├── tls
		│   │   ├── tls_peer.cert
		│   │   ├── tls_peer.priv
		│   │   └── tlsca.ca
		│   ├── unique.priv
		│   └── unique.pub
		└── hpc.toml

func (*RPC) AddNode

func (rpc *RPC) AddNode(url, rpcPort, wsPort string) *RPC

func (*RPC) AddRoleForNode

func (rpc *RPC) AddRoleForNode(address string, roles ...string) StdError

AddRoleForNode add roles for given address in node

func (*RPC) Archive

func (rpc *RPC) Archive(filterID string, sync bool) (bool, StdError)

Archive will archive data of the given snapshot. If successful, returns true. Deprecated: use ArchiveNoPredict instead

func (*RPC) ArchiveNoPredict

func (rpc *RPC) ArchiveNoPredict(filterId string) (string, StdError)

ArchiveNoPredict used for archive to specific committed block-number Deprecated: use ArchiveNoPredictForBlockNumber instead

func (*RPC) ArchiveNoPredictForBlockNumber added in v1.1.0

func (rpc *RPC) ArchiveNoPredictForBlockNumber(blockNumber uint64) (string, StdError)

ArchiveNoPredictForBlockNumber used for archive to specific committed block-number

func (*RPC) BindNodes

func (rpc *RPC) BindNodes(nodeIndexes ...int) (*RPC, error)

BindNodes generate a new RPC instance that bind with given indexes

func (*RPC) Call

func (rpc *RPC) Call(method string, param interface{}) (*TxReceipt, StdError)

Call call and get tx receipt directly without polling

func (*RPC) CallByPolling

func (rpc *RPC) CallByPolling(method string, param interface{}, isPrivateTx bool) (*TxReceipt, StdError)

CallByPolling call and get tx receipt by polling

func (*RPC) CheckCredentialAbandoned

func (rpc *RPC) CheckCredentialAbandoned(id string) (bool, StdError)

func (*RPC) CheckCredentialValid

func (rpc *RPC) CheckCredentialValid(id string) (bool, StdError)

func (*RPC) CheckHmValue

func (rpc *RPC) CheckHmValue(rawValue []uint64, encryValue []string, invalidHmValue string) (*ValidResult, StdError)

CheckHmValue 获取收款方对所有未验证同态交易的验证结果 Deprecated

func (*RPC) CheckSnapshot

func (rpc *RPC) CheckSnapshot(filterID string) (bool, StdError)

CheckSnapshot will check that the snapshot is correct. If correct, returns true. Otherwise, returns false. Deprecated

func (*RPC) Close

func (rpc *RPC) Close()

Close close release goroutine and http connection

func (*RPC) CompileContract

func (rpc *RPC) CompileContract(code string) (*CompileResult, StdError)

CompileContract Compile contract rpc

func (*RPC) DeleteNodeNVP

func (rpc *RPC) DeleteNodeNVP(hash string) (bool, StdError)

DeleteNodeNVP 删除NVP节点

func (*RPC) DeleteNodeVP

func (rpc *RPC) DeleteNodeVP(hash string) (bool, StdError)

DeleteNodeVP 删除VP节点 Deprecated

func (*RPC) DeleteRoleFromNode

func (rpc *RPC) DeleteRoleFromNode(address string, roles ...string) StdError

DeleteRoleFromNode delete roles from address in node

func (*RPC) DeleteSnapshot

func (rpc *RPC) DeleteSnapshot(filterID string) (bool, StdError)

DeleteSnapshot delete snapshot by id Deprecated

func (*RPC) DeployContract

func (rpc *RPC) DeployContract(transaction *Transaction) (*TxReceipt, StdError)

DeployContract Deploy contract rpc Deprecated: use SignAndDeployContract instead

func (*RPC) DisconnectNodeVP

func (rpc *RPC) DisconnectNodeVP(hash string) (bool, StdError)

DisconnectNodeVP NVP断开与VP节点的链接

func (*RPC) EncryptoMessage

func (rpc *RPC) EncryptoMessage(balance, amount uint64, invalidHmValue string) (*BalanceAndAmount, StdError)

EncryptoMessage 获取同态加密之后的账户余额以及转账金额 Deprecated

func (*RPC) FastInvokeContract

func (rpc *RPC) FastInvokeContract(body []byte, randomURL string) (*RpcStatistic, StdError)

func (*RPC) FileDownload

func (rpc *RPC) FileDownload(tarPath, hash, owner string, nodeID int, accountJson string, password string) (string, StdError)

FileDownload 文件下载接口,tarPath有两种使用:1.传有效目录,会在给路径下以hash作为文件名保存文件;2.传有效文件路径,对该文件进行断点续传

func (*RPC) FileDownloadByTxHash

func (rpc *RPC) FileDownloadByTxHash(tarPath, txHash string, nodeID int, accountJson string, password string) (string, StdError)

FileDownloadByTxHash 文件下载接口,通过交易哈希直接下载文件

func (*RPC) FilePush

func (rpc *RPC) FilePush(hash string, pushNodes []int, accountJson, password string, nodeID int) (string, StdError)

FilePush 文件推送接口

func (*RPC) FileUpdate

func (rpc *RPC) FileUpdate(fileUpdateTX *Transaction) StdError

FileUpdate 文件信息更新接口

func (*RPC) FileUpload

func (rpc *RPC) FileUpload(filePath string, description string, userList []string, nodeIdList []int, pushNodes []int, accountJson string, password string) (string, StdError)

FileUpload 文件上传接口

func (*RPC) FirstPollInterval

func (rpc *RPC) FirstPollInterval(fpi int64) *RPC

FirstPollInterval setter

func (*RPC) FirstPollTime

func (rpc *RPC) FirstPollTime(fpt int64) *RPC

FirstPollTime setter

func (*RPC) GetAccountProof added in v1.1.0

func (rpc *RPC) GetAccountProof(account string) (*AccountProofPath, StdError)

GetAccountProof query proofPath of given account.

func (*RPC) GetAccountStatus

func (rpc *RPC) GetAccountStatus(address string) (string, StdError)

GetAccountStatus 获取账户状态

func (*RPC) GetAccountsByRole

func (rpc *RPC) GetAccountsByRole(role string) ([]string, StdError)

GetAccountsByRole 根据角色获取账户

func (*RPC) GetAddressByName

func (rpc *RPC) GetAddressByName(name string) (string, StdError)

GetAddressByName get contract address by contract name

func (*RPC) GetAddressFromNode

func (rpc *RPC) GetAddressFromNode(role string) ([]string, StdError)

GetAddressFromNode get address by role in node

func (*RPC) GetAllCNS

func (rpc *RPC) GetAllCNS() (map[string]string, StdError)

GetAllCNS get all contract address to contract name mapping

func (*RPC) GetAllRoles

func (rpc *RPC) GetAllRoles() (map[string]int, StdError)

func (*RPC) GetAllRolesFromNode

func (rpc *RPC) GetAllRolesFromNode() ([]string, StdError)

GetAllRolesFromNode get address by role in node

func (*RPC) GetAvgGenTimeByBlockNum

func (rpc *RPC) GetAvgGenTimeByBlockNum(from, to uint64) (int64, StdError)

GetAvgGenTimeByBlockNum calculates the average generation time of all blocks for the given block number.

func (*RPC) GetBalance

func (rpc *RPC) GetBalance(account string) (string, StdError)

GetBalance 获取账户余额 Deprecated

func (*RPC) GetBatchBlocksByHash

func (rpc *RPC) GetBatchBlocksByHash(blockHashes []string, isPlain bool) ([]*Block, StdError)

GetBatchBlocksByHash returns a list of blocks by a list of specific block hash. Deprecated

func (*RPC) GetBatchBlocksByNumber

func (rpc *RPC) GetBatchBlocksByNumber(blockNums []uint64, isPlain bool) ([]*Block, StdError)

GetBatchBlocksByNumber returns a list of blocks by a list of specific block number. Deprecated

func (*RPC) GetBatchReceipt

func (rpc *RPC) GetBatchReceipt(hashes []string) ([]TxReceipt, StdError)

GetBatchReceipt 批量获取回执 Deprecated

func (*RPC) GetBatchTxByHash

func (rpc *RPC) GetBatchTxByHash(hashes []string) ([]TransactionInfo, StdError)

GetBatchTxByHash 批量获取交易 Deprecated

func (*RPC) GetBlkTxCountByHash

func (rpc *RPC) GetBlkTxCountByHash(blkHash string) (uint64, StdError)

GetBlkTxCountByHash 通过区块hash获取区块上交易数

func (*RPC) GetBlkTxCountByNumber

func (rpc *RPC) GetBlkTxCountByNumber(blkNum string) (uint64, StdError)

GetBlkTxCountByNumber 通过区块number获取区块上交易数

func (*RPC) GetBlockByHash

func (rpc *RPC) GetBlockByHash(blockHash string, isPlain bool) (*Block, StdError)

GetBlockByHash returns information about a block by hash. If the param isPlain value is true, it returns block excluding transactions. If false, it returns block including transactions.

func (*RPC) GetBlockByNumber

func (rpc *RPC) GetBlockByNumber(blockNum interface{}, isPlain bool) (*Block, StdError)

GetBlockByNumber returns information about a block by number. If the param isPlain value is true, it returns block excluding transactions. If false, it returns block including transactions. blockNum can use `latest`, means get latest block

func (*RPC) GetBlocks

func (rpc *RPC) GetBlocks(from, to uint64, isPlain bool) ([]*Block, StdError)

GetBlocks returns a list of blocks from start block number to end block number isPlain indicates if the result includes transaction information. if false, includes, otherwise not. Deprecated

func (*RPC) GetBlocksByTime

func (rpc *RPC) GetBlocksByTime(startTime, endTime uint64) (*BlockInterval, StdError)

GetBlocksByTime returns the number of blocks, starting block and ending block at specific time periods. startTime and endTime are timestamps Deprecated

func (*RPC) GetBlocksWithLimit

func (rpc *RPC) GetBlocksWithLimit(from, to uint64, isPlain bool, metadata *Metadata) (*PageResult, StdError)

func (*RPC) GetChainHeight

func (rpc *RPC) GetChainHeight() (string, StdError)

GetChainHeight returns the current chain height. result is hex string

func (*RPC) GetChainID

func (rpc *RPC) GetChainID() string

func (*RPC) GetCode

func (rpc *RPC) GetCode(contractAddress string) (string, StdError)

GetCode 获取合约字节编码

func (*RPC) GetConfig

func (rpc *RPC) GetConfig() (string, StdError)

func (*RPC) GetContractCountByAddr

func (rpc *RPC) GetContractCountByAddr(accountAddress string) (uint64, StdError)

GetContractCountByAddr 获取合约数量

func (*RPC) GetContractStatus

func (rpc *RPC) GetContractStatus(contractAddress string) (string, StdError)

GetContractStatus 获取合约状态

func (*RPC) GetContractStatusByName

func (rpc *RPC) GetContractStatusByName(contractName string) (string, StdError)

GetContractStatusByName 获取合约状态

func (*RPC) GetCreateTime

func (rpc *RPC) GetCreateTime(contractAddress string) (string, StdError)

GetCreateTime 查询合约部署时间

func (*RPC) GetCreateTimeByName

func (rpc *RPC) GetCreateTimeByName(contractName string) (string, StdError)

GetCreateTimeByName 查询合约部署时间

func (*RPC) GetCreator

func (rpc *RPC) GetCreator(contractAddress string) (string, StdError)

GetCreator 查询合约部署者

func (*RPC) GetCreatorByName

func (rpc *RPC) GetCreatorByName(contractName string) (string, StdError)

GetCreatorByName 查询合约部署者

func (*RPC) GetCredentialPrimaryMessage

func (rpc *RPC) GetCredentialPrimaryMessage(id string) (*DIDCredential, StdError)

func (*RPC) GetDIDDocument

func (rpc *RPC) GetDIDDocument(didAddress string) (*DIDDocument, StdError)

func (*RPC) GetDeployedList

func (rpc *RPC) GetDeployedList(address string) ([]string, StdError)

GetDeployedList 获取已部署的合约列表

func (*RPC) GetDiscardTransactionsByTime

func (rpc *RPC) GetDiscardTransactionsByTime(start, end uint64) ([]TransactionInfo, StdError)

GetDiscardTransactionsByTime 查询指定时间区间内的旧版本(flato-1.1.0及以前)非法交易 Deprecated

func (*RPC) GetDiscardTx

func (rpc *RPC) GetDiscardTx() ([]TransactionInfo, StdError)

GetDiscardTx 获取所有旧版本(flato-1.1.0及以前)的非法交易 Deprecated

func (*RPC) GetFileExtraByExtraId

func (rpc *RPC) GetFileExtraByExtraId(extraId string) (*FileExtra, error)

GetFileExtraByExtraId 通过extraId获取文件信息FileExtra

func (*RPC) GetFileExtraByFilter

func (rpc *RPC) GetFileExtraByFilter(from, extraId string) (*FileExtra, StdError)

GetFileExtraByFilter 通过filter获取文件信息FileExtra

func (*RPC) GetFileExtraByTxHash

func (rpc *RPC) GetFileExtraByTxHash(txHash string) (*FileExtra, StdError)

GetFileExtraByTxHash 通过交易哈希获取文件信息FileExtra

func (*RPC) GetGasPrice added in v1.5.0

func (rpc *RPC) GetGasPrice() (int64, error)

func (*RPC) GetGenesisBlock

func (rpc *RPC) GetGenesisBlock() (string, StdError)

GetGenesisBlock returns current genesis block number. result is hex string

func (*RPC) GetGenesisInfo added in v1.2.2

func (rpc *RPC) GetGenesisInfo() (string, StdError)

GetGenesisInfo get genesis info.

func (*RPC) GetHosts

func (rpc *RPC) GetHosts(role string) (map[string][]byte, StdError)

func (*RPC) GetInvalidTransactionsByBlkHash added in v1.1.0

func (rpc *RPC) GetInvalidTransactionsByBlkHash(blkHash string) ([]TransactionInfo, StdError)

GetInvalidTransactionsByBlkHash 根据区块哈希查询区块内的非法交易

func (*RPC) GetInvalidTransactionsByBlkNum added in v1.1.0

func (rpc *RPC) GetInvalidTransactionsByBlkNum(blkNum uint64) ([]TransactionInfo, StdError)

GetInvalidTransactionsByBlkNum 根据区块号查询区块内的非法交易

func (*RPC) GetInvalidTransactionsByBlkNumWithLimit added in v1.1.0

func (rpc *RPC) GetInvalidTransactionsByBlkNumWithLimit(start, end uint64, metadata *Metadata) (*PageResult, StdError)

func (*RPC) GetInvalidTxCount added in v1.1.0

func (rpc *RPC) GetInvalidTxCount() (uint64, StdError)

GetInvalidTxCount 获取链上非法交易数

func (*RPC) GetLatestBlock

func (rpc *RPC) GetLatestBlock() (*Block, StdError)

GetLatestBlock returns information about the latest block

func (*RPC) GetMqClient

func (rpc *RPC) GetMqClient() *MqClient

GetMqClient 获取mq客户端 Deprecated, for this mq client can be used for rabbit as well, but can not use for kafka use NewRabbitMqClient instead

func (*RPC) GetNameByAddress

func (rpc *RPC) GetNameByAddress(address string) (string, StdError)

GetNameByAddress get contract name by contract address

func (*RPC) GetNextPageTxs

func (rpc *RPC) GetNextPageTxs(blkNumber, txIndex, minBlkNumber, maxBlkNumber, separated, pageSize uint64, containCurrent bool, contractAddr string) ([]TransactionInfo, StdError)

GetNextPageTxs 获取下一页的交易 Deprecated

func (*RPC) GetNextPageTxsByName

func (rpc *RPC) GetNextPageTxsByName(blkNumber, txIndex, minBlkNumber, maxBlkNumber, separated, pageSize uint64, containCurrent bool, contractName string) ([]TransactionInfo, StdError)

GetNextPageTxsByName 获取下一页的交易 Deprecated

func (*RPC) GetNodeChainID

func (rpc *RPC) GetNodeChainID() (string, StdError)

func (*RPC) GetNodeHash

func (rpc *RPC) GetNodeHash() (string, StdError)

GetNodeHash 获取随机节点hash

func (*RPC) GetNodeHashByID

func (rpc *RPC) GetNodeHashByID(id int) (string, StdError)

GetNodeHashByID 从指定节点获取hash

func (*RPC) GetNodeStates

func (rpc *RPC) GetNodeStates() ([]NodeStateInfo, StdError)

GetNodeStates 获取节点状态信息

func (*RPC) GetNodes

func (rpc *RPC) GetNodes() ([]NodeInfo, StdError)

GetNodes 获取区块链节点信息

func (*RPC) GetNodesNum added in v1.2.0

func (rpc *RPC) GetNodesNum() int

GetNodesNum 获取rpc连接的节点数

func (*RPC) GetPrevPageTxs

func (rpc *RPC) GetPrevPageTxs(blkNumber, txIndex, minBlkNumber, maxBlkNumber, separated, pageSize uint64, containCurrent bool, contractAddr string) ([]TransactionInfo, StdError)

GetPrevPageTxs 获取上一页的交易 Deprecated

func (*RPC) GetPrevPageTxsByName

func (rpc *RPC) GetPrevPageTxsByName(blkNumber, txIndex, minBlkNumber, maxBlkNumber, separated, pageSize uint64, containCurrent bool, contractName string) ([]TransactionInfo, StdError)

GetPrevPageTxsByName 获取上一页的交易 Deprecated

func (*RPC) GetPrivateTransactionByHash

func (rpc *RPC) GetPrivateTransactionByHash(txHash string) (*TransactionInfo, StdError)

GetPrivateTransactionByHash 查询隐私交易 Deprecated

func (*RPC) GetProposal

func (rpc *RPC) GetProposal() (*ProposalRaw, StdError)

func (*RPC) GetRoleFromNode

func (rpc *RPC) GetRoleFromNode(address string) ([]string, StdError)

GetRoleFromNode get account role in node

func (*RPC) GetRoles

func (rpc *RPC) GetRoles(account string) ([]string, StdError)

GetRoles 获取账户角色

func (*RPC) GetRulesFromNode

func (rpc *RPC) GetRulesFromNode() ([]*InspectorRule, StdError)

GetRulesFromNode get inspector rules for auth api in node

func (*RPC) GetSignHash

func (rpc *RPC) GetSignHash(transaction *Transaction) (string, StdError)

GetSignHash 获取交易签名哈希

func (*RPC) GetStateProof added in v1.2.2

func (rpc *RPC) GetStateProof(proofParam *ProofParam) (*StateProof, StdError)

GetStateProof get state proof from archive reader

func (*RPC) GetTCert

func (rpc *RPC) GetTCert(index uint) (string, StdError)

GetTCert 获取TCert Deprecated:

func (*RPC) GetTransactionByHash

func (rpc *RPC) GetTransactionByHash(txHash string) (*TransactionInfo, StdError)

GetTransactionByHash 通过交易hash获取交易 参数txHash应该是"0x...."的形式

func (*RPC) GetTransactionByHashByPolling added in v1.2.2

func (rpc *RPC) GetTransactionByHashByPolling(txHash string) (*TransactionInfo, StdError)

func (*RPC) GetTransactionsByBlkNum

func (rpc *RPC) GetTransactionsByBlkNum(start, end uint64) ([]TransactionInfo, StdError)

GetTransactionsByBlkNum 根据区块号查询范围内的交易 Deprecated: use GetTransactionsByBlkNumWithLimit instead

func (*RPC) GetTransactionsByBlkNumWithLimit

func (rpc *RPC) GetTransactionsByBlkNumWithLimit(start, end uint64, metadata *Metadata) (*PageResult, StdError)

func (*RPC) GetTransactionsByExtraID

func (rpc *RPC) GetTransactionsByExtraID(extraId []interface{}, txTo string, detail bool, mode int, metadata *Metadata) (*PageResult, StdError)

GetTransactionsByExtraID 根据extraID查询交易 extraId 为必选字段,其他字段可选

func (*RPC) GetTransactionsCountByMethodID

func (rpc *RPC) GetTransactionsCountByMethodID(from, to uint64, address string, methodID string) (*TransactionsCountByContract, StdError)

GetTransactionsCountByMethodID 查询区块区间交易数量(by method ID) Deprecated

func (*RPC) GetTransactionsCountByMethodIDAndContractName

func (rpc *RPC) GetTransactionsCountByMethodIDAndContractName(from, to uint64, name string, methodID string) (*TransactionsCountByContract, StdError)

GetTransactionsCountByMethodIDAndContractName 查询区块区间交易数量(by method ID and contract name)

func (*RPC) GetTransactionsCountByTime

func (rpc *RPC) GetTransactionsCountByTime(startTime, endTime uint64) (uint64, StdError)

GetTransactionsCountByTime 查询指定时间区间内的交易数量 Deprecated

func (*RPC) GetTxAvgTimeByBlockNumber

func (rpc *RPC) GetTxAvgTimeByBlockNumber(from, to uint64) (uint64, StdError)

GetTxAvgTimeByBlockNumber 通过区块号区间获取交易平均处理时间

func (*RPC) GetTxByBlkHashAndIdx

func (rpc *RPC) GetTxByBlkHashAndIdx(blkHash string, index uint64) (*TransactionInfo, StdError)

GetTxByBlkHashAndIdx 通过区块hash和交易序号返回交易信息

func (*RPC) GetTxByBlkNumAndIdx

func (rpc *RPC) GetTxByBlkNumAndIdx(blkNum, index uint64) (*TransactionInfo, StdError)

GetTxByBlkNumAndIdx 通过区块号和交易序号查询交易

func (*RPC) GetTxByTime

func (rpc *RPC) GetTxByTime(start, end uint64) ([]TransactionInfo, StdError)

GetTxByTime 根据范围时间戳查询交易信息 Deprecated : use GetTxByTimeWithLimit instead

func (*RPC) GetTxByTimeAndContractAddrWithLimit

func (rpc *RPC) GetTxByTimeAndContractAddrWithLimit(start, end uint64, metadata *Metadata, contractAddr string) (*PageTxs, StdError)

GetTxByTimeAndContractAddrWithLimit get txs by time and contract address with limit

func (*RPC) GetTxByTimeAndContractNameWithLimit

func (rpc *RPC) GetTxByTimeAndContractNameWithLimit(start, end uint64, metadata *Metadata, contractName string) (*PageTxs, StdError)

GetTxByTimeAndContractNameWithLimit get txs by time and contract name with limit

func (*RPC) GetTxByTimeWithLimit

func (rpc *RPC) GetTxByTimeWithLimit(start, end uint64, metadata *Metadata) (*PageTxs, StdError)

func (*RPC) GetTxConfirmedReceipt added in v1.1.0

func (rpc *RPC) GetTxConfirmedReceipt(txHash string) (*TxReceipt, StdError)

GetTxConfirmedReceipt 通过交易hash获取产生了checkpoint之后的交易回执 参数txHash应该是"0x...."的形式

func (*RPC) GetTxCount

func (rpc *RPC) GetTxCount() (*TransactionsCount, StdError)

GetTxCount 获取链上所有交易数量

func (*RPC) GetTxCountByContractAddr

func (rpc *RPC) GetTxCountByContractAddr(from, to uint64, address string, txExtra bool) (*TransactionsCountByContract, StdError)

GetTxCountByContractAddr 查询区块间指定合约的交易量 txExtra过滤是否带有额外字段 Deprecated

func (*RPC) GetTxCountByContractName

func (rpc *RPC) GetTxCountByContractName(from, to uint64, name string, txExtra bool) (*TransactionsCountByContract, StdError)

GetTxCountByContractName 查询区块间指定合约的交易量 txExtra过滤是否带有额外字段 Deprecated

func (*RPC) GetTxProof added in v1.2.2

func (rpc *RPC) GetTxProof(txhash string) (*TxProofPath, StdError)

GetTxProof query proofPath of given txhash.

func (*RPC) GetTxReceipt

func (rpc *RPC) GetTxReceipt(txHash string, isPrivateTx bool) (*TxReceipt, StdError)

GetTxReceipt 通过交易hash获取交易回执 参数txHash应该是"0x...."的形式

func (*RPC) GetTxReceiptByPolling

func (rpc *RPC) GetTxReceiptByPolling(txHash string, isPrivateTx bool) (*TxReceipt, StdError, bool)

GetTxReceiptByPolling get tx receipt by polling

func (*RPC) GetTxVersion

func (rpc *RPC) GetTxVersion() (string, StdError)

func (*RPC) GetVSet

func (rpc *RPC) GetVSet() ([]string, StdError)

func (*RPC) GetWebSocketClient

func (rpc *RPC) GetWebSocketClient() *WebSocketClient

GetWebSocketClient 获取WebSocket客户端

func (*RPC) Https

func (rpc *RPC) Https(tlscaPath, tlspeerCertPath, tlspeerPrivPath string) *RPC

Https use sets the https related options

func (*RPC) InvokeContract

func (rpc *RPC) InvokeContract(transaction *Transaction) (*TxReceipt, StdError)

InvokeContract invoke contract rpc Deprecated

func (*RPC) InvokeContractReturnHash

func (rpc *RPC) InvokeContractReturnHash(transaction *Transaction) (string, StdError)

InvokeContractReturnHash for pressure test Deprecated:

func (*RPC) InvokeCrossChainContractReturnHash added in v1.2.0

func (rpc *RPC) InvokeCrossChainContractReturnHash(transaction *Transaction, methodName CrossChainMethod) (string, StdError)

InvokeCrossChainContractReturnHash for pressure test Deprecated:

func (*RPC) IsRoleExist

func (rpc *RPC) IsRoleExist(role string) (bool, StdError)

func (*RPC) ListSnapshot

func (rpc *RPC) ListSnapshot() (Manifests, StdError)

ListSnapshot returns all the existed snapshot information.

func (*RPC) ListenContract

func (rpc *RPC) ListenContract(srcCode, addr string) (string, StdError)

ListenContract Deprecated

func (*RPC) MaintainContract

func (rpc *RPC) MaintainContract(transaction *Transaction) (*TxReceipt, StdError)

MaintainContract 管理合约 opcode 1.升级合约 2.冻结 3.解冻 Deprecated use SignAndMaintainContract instead

func (*RPC) MakeSnapshot4Flato added in v1.2.2

func (rpc *RPC) MakeSnapshot4Flato(blockHeight interface{}) (string, StdError)

MakeSnapshot4Flato used in flato version: make a snapshot for an existed block number param requirement: blockNumber <= flato latest checkpoint

func (*RPC) ManageContractByVote

func (rpc *RPC) ManageContractByVote(transaction *Transaction) (*TxReceipt, StdError)

ManageContractByVote manage contract by vote rpc Deprecated: use SignAndManageContractByVote instead

func (*RPC) Namespace

func (rpc *RPC) Namespace(ns string) *RPC

Namespace setter

func (*RPC) NewKafkaMqClient added in v1.4.0

func (rpc *RPC) NewKafkaMqClient() *KafkaClient

func (*RPC) NewRabbitMqClient added in v1.4.0

func (rpc *RPC) NewRabbitMqClient() *RabbitClient

func (*RPC) Pending

func (rpc *RPC) Pending() ([]SnapshotEvent, StdError)

Pending returns all pending snapshot requests in ascend sort. Deprecated

func (*RPC) QueryArchive

func (rpc *RPC) QueryArchive(filterID string) (string, StdError)

QueryArchive query archive status with the give snapshot. the results will be 1. this snapshot is old version, cannot get status 2. this snapshot has not finished archive 3. this snapshot has been archived 4. "" (this will be with err message)

func (*RPC) QueryArchiveExist

func (rpc *RPC) QueryArchiveExist(filterID string) (bool, StdError)

QueryArchiveExist checks if the given snapshot has been archived.

func (*RPC) QueryLatestArchive

func (rpc *RPC) QueryLatestArchive() (*ArchiveResult, StdError)

QueryLatestArchive query latest archive job status.

func (*RPC) QuerySnapshotExist

func (rpc *RPC) QuerySnapshotExist(filterID string) (bool, StdError)

QuerySnapshotExist checks if the given snapshot existed, so you can confirm that the last step Archive.Snapshot is successful. Deprecated

func (*RPC) QueryTPS

func (rpc *RPC) QueryTPS(startTime, endTime uint64) (*TPSInfo, StdError)

QueryTPS queries the block generation speed and tps within a given time range.

func (*RPC) ReConnTime

func (rpc *RPC) ReConnTime(rct int64) *RPC

ReConnTime setter

func (*RPC) ReadSnapshot

func (rpc *RPC) ReadSnapshot(filterID string) (*Manifest, StdError)

ReadSnapshot returns the snapshot information for the given snapshot ID. Deprecated

func (*RPC) ReplaceNodeCerts

func (rpc *RPC) ReplaceNodeCerts(hostname string) (string, StdError)

func (*RPC) ResendTimes

func (rpc *RPC) ResendTimes(resTime int64) *RPC

ResendTimes setter

func (*RPC) Restore

func (rpc *RPC) Restore(filterID string, sync bool) (bool, StdError)

Restore restores datas that have been archived for given snapshot. If successful, returns true. Deprecated

func (*RPC) RestoreAll

func (rpc *RPC) RestoreAll(sync bool) (bool, StdError)

RestoreAll restores all datas that have been archived. If successful, returns true. Deprecated

func (*RPC) SecondPollInterval

func (rpc *RPC) SecondPollInterval(spi int64) *RPC

SecondPollInterval setter

func (*RPC) SecondPollTime

func (rpc *RPC) SecondPollTime(spt int64) *RPC

SecondPollTime setter

func (*RPC) SendDIDTransaction

func (rpc *RPC) SendDIDTransaction(transaction *Transaction, key interface{}) (*TxReceipt, StdError)

func (*RPC) SendTx

func (rpc *RPC) SendTx(transaction *Transaction) (*TxReceipt, StdError)

SendTx 同步发送交易 Deprecated: use SignAndSendTx instead

func (*RPC) SendTxReturnHash

func (rpc *RPC) SendTxReturnHash(transaction *Transaction) (string, StdError)

SendTxReturnHash for pressure test Deprecated:

func (*RPC) SetAccount

func (rpc *RPC) SetAccount(key account.Key)

SetAccount set account key for sign request

func (*RPC) SetGasPrice added in v1.5.0

func (rpc *RPC) SetGasPrice() error

func (*RPC) SetLocalChainID

func (rpc *RPC) SetLocalChainID() error

func (*RPC) SetNodePriority added in v1.4.0

func (rpc *RPC) SetNodePriority(id int, priority int) *RPC

func (*RPC) SetRulesInNode

func (rpc *RPC) SetRulesInNode(rules []*InspectorRule) StdError

SetRulesInNode set inspector rules for auth api in node

func (*RPC) SignAndDeployContract

func (rpc *RPC) SignAndDeployContract(transaction *Transaction, key interface{}) (*TxReceipt, StdError)

SignAndDeployContract Deploy contract rpc

func (*RPC) SignAndDeployCrossChainContract added in v1.2.0

func (rpc *RPC) SignAndDeployCrossChainContract(transaction *Transaction, key interface{}) (*TxReceipt, StdError)

SignAndDeployCrossChainContract deploy cross_chain contract rpc

func (*RPC) SignAndInvokeContract

func (rpc *RPC) SignAndInvokeContract(transaction *Transaction, key interface{}) (*TxReceipt, StdError)

SignAndInvokeContract invoke contract rpc

func (*RPC) SignAndInvokeContractCombineReturns

func (rpc *RPC) SignAndInvokeContractCombineReturns(transaction *Transaction, key interface{}) (*TxReceipt, *TransactionInfo, StdError)

SignAndInvokeContractCombineReturns invoke contract rpc, return *TxReceipt and *TransactionInfo

func (*RPC) SignAndInvokeCrossChainContract added in v1.2.0

func (rpc *RPC) SignAndInvokeCrossChainContract(transaction *Transaction, methodName CrossChainMethod, key interface{}) (*TxReceipt, StdError)

func (*RPC) SignAndMaintainContract

func (rpc *RPC) SignAndMaintainContract(transaction *Transaction, key interface{}) (*TxReceipt, StdError)

SignAndMaintainContract 管理合约 opcode 1.升级合约 2.冻结 3.解冻

func (*RPC) SignAndManageContractByVote

func (rpc *RPC) SignAndManageContractByVote(transaction *Transaction, key interface{}) (*TxReceipt, StdError)

SignAndManageContractByVote manage contract by vote rpc

func (*RPC) SignAndSendTx

func (rpc *RPC) SignAndSendTx(transaction *Transaction, key interface{}) (*TxReceipt, StdError)

SignAndSendTx 同步发送交易并签名

func (*RPC) Snapshot

func (rpc *RPC) Snapshot(blockHeight interface{}) (string, StdError)

Snapshot makes the snapshot for given the future block number or current the latest block number. It returns the snapshot id for the client to query. blockHeight can use `latest`, means make snapshot now Deprecated

func (*RPC) String

func (rpc *RPC) String() string

func (*RPC) Tcert

func (rpc *RPC) Tcert(cfca bool, sdkcertPath, sdkcertPrivPath, uniquePubPath, uniquePrivPath string) *RPC

func (*RPC) ValidateStateProof added in v1.2.2

func (rpc *RPC) ValidateStateProof(proofParam *ProofParam, stateProof *StateProof, merkleRoot string) (bool, StdError)

ValidateStateProof validate the proof is right in the snapshot

type RabbitClient added in v1.4.0

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

func (*RabbitClient) DeleteExchange added in v1.4.0

func (r *RabbitClient) DeleteExchange(id int, exchange string) (bool, StdError)

func (*RabbitClient) GetAllQueueNames added in v1.4.0

func (r *RabbitClient) GetAllQueueNames(nodeId int) ([]string, error)

func (*RabbitClient) GetExchangerName added in v1.4.0

func (r *RabbitClient) GetExchangerName(id int) (string, StdError)

func (*RabbitClient) InformNormal added in v1.4.0

func (r *RabbitClient) InformNormal(id int, brokerURL string) (bool, StdError)

func (*RabbitClient) Listen added in v1.4.0

func (r *RabbitClient) Listen(queue, url string, autoAck bool, listener MqListener) StdError

func (*RabbitClient) Register added in v1.4.0

func (r *RabbitClient) Register(id int, meta *RegisterMeta) (*QueueRegister, StdError)

func (*RabbitClient) UnRegister added in v1.4.0

func (r *RabbitClient) UnRegister(id int, meta *UnRegisterMeta) (*QueueUnRegister, StdError)

type RegisterMeta

type RegisterMeta struct {
	//queue related
	RoutingKeys []routingKey `json:"routingKeys,omitempty"`
	QueueName   string       `json:"queueName,omitempty"`
	//self info
	From      string `json:"from,omitempty"`
	Signature string `json:"signature,omitempty"`
	// block accounts
	IsVerbose bool `json:"isVerbose"`
	// vm log criteria
	FromBlock string           `json:"fromBlock,omitempty"`
	ToBlock   string           `json:"toBlock,omitempty"`
	Addresses []common.Address `json:"addresses,omitempty"`
	Topics    [][]common.Hash  `json:"topics,omitempty"`
	Delay     bool             `json:"delay"`
}

RegisterMeta mq register

func NewRegisterMeta

func NewRegisterMeta(from, queueName string, keys ...routingKey) *RegisterMeta

NewRegisterMeta create a new instance of RegisterMeta

func (*RegisterMeta) AddAddress

func (rm *RegisterMeta) AddAddress(address ...common.Address) *RegisterMeta

AddAddress add address

func (*RegisterMeta) Serialize

func (rm *RegisterMeta) Serialize() interface{}

Serialize Serialize

func (*RegisterMeta) SerializeToString

func (rm *RegisterMeta) SerializeToString() string

SerializeToString SerializeToString

func (*RegisterMeta) SetDelay

func (rm *RegisterMeta) SetDelay(delay bool) *RegisterMeta

SetDelay set delay

func (*RegisterMeta) SetFromBlock

func (rm *RegisterMeta) SetFromBlock(from string) *RegisterMeta

SetFromBlock set from block

func (*RegisterMeta) SetToBlock

func (rm *RegisterMeta) SetToBlock(to string) *RegisterMeta

SetToBlock set to block

func (*RegisterMeta) SetTopics

func (rm *RegisterMeta) SetTopics(pos int, topics ...common.Hash) *RegisterMeta

SetTopics set topic

func (*RegisterMeta) Sign

func (rm *RegisterMeta) Sign(key interface{})

Sign sign RegisterMeta

func (*RegisterMeta) Verbose

func (rm *RegisterMeta) Verbose(v bool) *RegisterMeta

Verbose node info is verbose

type RequestType

type RequestType string
const (
	GENERAL  RequestType = "GENERAL"
	UPLOAD   RequestType = "UPLOAD"
	DOWNLOAD RequestType = "DOWNLOAD"
)

type RetError

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

RetError is packaged ret code and message

func (*RetError) Code

func (re *RetError) Code() int

Code is used to get error code

func (*RetError) Error

func (re *RetError) Error() string

func (*RetError) String

func (re *RetError) String() string

type RpcStatistic

type RpcStatistic struct {
	TxReceipt    []byte
	RequestTime  time.Time
	ResponseTime time.Time
}

type Snapshot

type Snapshot struct {
	Height     uint64
	Hash       string
	FilterID   string
	MerkleRoot string
	Date       string
	Namespace  string
}

Snapshot is packaged result of snapshot

type SnapshotEvent

type SnapshotEvent struct {
	FilterID    string `json:"filterId"`
	BlockNumber uint64 `json:"blockNumber"`
}

SnapshotEvent SnapshotEvent

type StateProof added in v1.2.2

type StateProof struct {
	StatePath   types.ProofPath `json:"statePath"`
	AccountPath types.ProofPath `json:"accountPath"`
}

StateProof is the proof path for a ledger key

type StdError

type StdError interface {
	fmt.Stringer
	error
	Code() int
}

StdError is a interface of code and error info

func NewGetResponseError

func NewGetResponseError(e error) StdError

NewGetResponseError is used to construct StdError

func NewHttpResponseError

func NewHttpResponseError(code int, msg string) StdError

NewHttpResponseError is used to construct StdError by HTTP error

func NewRequestTimeoutError

func NewRequestTimeoutError(e error) StdError

NewRequestTimeoutError is used to construct StdError

func NewServerError

func NewServerError(c int, msg string) StdError

NewServerError is used to construct RetError

func NewSystemError

func NewSystemError(e error) StdError

NewSystemError is used to construct StdError

func ValidateTxProof added in v1.2.2

func ValidateTxProof(txhash string, txroot string, path *TxProofPath) (bool, StdError)

type StopConsumeParams added in v1.2.0

type StopConsumeParams struct {
	QueueName string `json:"queueName"`
}

type Subscription

type Subscription struct {
	Event          EventType      `json:"event"`
	SubscriptionID SubscriptionID `json:"subId"`
}

Subscription -

type SubscriptionID

type SubscriptionID string

SubscriptionID subscription id

type SystemStatusFilter

type SystemStatusFilter struct {
	Modules           []string `json:"modules,omitempty"`
	ModulesExclude    []string `json:"modules_exclude,omitempty"`
	Subtypes          []string `json:"subtypes,omitempty"`
	SubtypesExclude   []string `json:"subtypes_exclude,omitempty"`
	ErrorCodes        []string `json:"error_codes,omitempty"`
	ErrorCodesExclude []string `json:"error_codes_exclude,omitempty"`
	// contains filtered or unexported fields
}

SystemStatusFilter system status filter

func NewSystemStatusFilter

func NewSystemStatusFilter() *SystemStatusFilter

NewSystemStatusFilter init SystemStatusFilter

func (*SystemStatusFilter) AddErrorCode

func (ssf *SystemStatusFilter) AddErrorCode(errorCodes ...string) *SystemStatusFilter

AddErrorCode add error code into filter

func (*SystemStatusFilter) AddErrorCodeExclude

func (ssf *SystemStatusFilter) AddErrorCodeExclude(errorCodesExclude ...string) *SystemStatusFilter

AddErrorCodeExclude add error code exclude into filter

func (*SystemStatusFilter) AddModules

func (ssf *SystemStatusFilter) AddModules(modules ...string) *SystemStatusFilter

AddModules add modules into filter

func (*SystemStatusFilter) AddModulesExclude

func (ssf *SystemStatusFilter) AddModulesExclude(modulesExclude ...string) *SystemStatusFilter

AddModulesExclude add modules exclude into filter

func (*SystemStatusFilter) AddSubtypes

func (ssf *SystemStatusFilter) AddSubtypes(subtypes ...string) *SystemStatusFilter

AddSubtypes add subtype into filter

func (*SystemStatusFilter) AddSubtypesExclude

func (ssf *SystemStatusFilter) AddSubtypesExclude(subtypesExclude ...string) *SystemStatusFilter

AddSubtypesExclude add subtypesExclude into filter

func (*SystemStatusFilter) GetEventType

func (ssf *SystemStatusFilter) GetEventType() EventType

GetEventType get event type

func (*SystemStatusFilter) Serialize

func (ssf *SystemStatusFilter) Serialize() interface{}

Serialize serialize

type TCert

type TCert string

TCert tcert message

type TCertManager

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

TCertManager manager tcert

func NewTCertManager

func NewTCertManager(vip *viper.Viper, confRootPath string) *TCertManager

NewTCertManager create a new TCert manager

func (*TCertManager) GetECert

func (tcm *TCertManager) GetECert() string

GetECert get ecert

func (*TCertManager) GetSDKCert added in v1.2.0

func (tcm *TCertManager) GetSDKCert() *bvm.KeyPair

type TCertResponse

type TCertResponse struct {
	TCert string
}

TCertResponse tcert response

type TPSInfo

type TPSInfo struct {
	StartTime     string
	EndTime       string
	TotalBlockNum uint64
	BlocksPerSec  float64
	Tps           float64
}

TPSInfo describe the TPS related information

type Transaction

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

Transaction transaction entity

func NewPrivateTransaction

func NewPrivateTransaction(from string, participants []string) *Transaction

NewPrivateTransaction return a empty private transaction

func NewTransaction

func NewTransaction(from string) *Transaction

NewTransaction return a empty transaction

func (*Transaction) DIDGetExtra added in v1.1.0

func (t *Transaction) DIDGetExtra(to, key string) *Transaction

func (*Transaction) DIDSetExtra added in v1.1.0

func (t *Transaction) DIDSetExtra(to, key, value string) *Transaction

func (*Transaction) Deploy

func (t *Transaction) Deploy(payload string) *Transaction

Deploy add transaction isDeploy

func (*Transaction) DeployArgs

func (t *Transaction) DeployArgs(abiString string, args ...interface{}) *Transaction

DeployArgs add transaction deploy args

func (*Transaction) DeployStringArgs

func (t *Transaction) DeployStringArgs(abiString string, args ...interface{}) *Transaction

DeployArgs add transaction deploy string args (args should be string or []interface{})

func (*Transaction) DeployWithArgs added in v1.4.0

func (t *Transaction) DeployWithArgs(bin []byte, params []byte) *Transaction

DeployWithArgs deploy contract with params encoded bytes.

func (*Transaction) DestroyCredential

func (t *Transaction) DestroyCredential(credentialID string) *Transaction

func (*Transaction) DownloadCredential

func (t *Transaction) DownloadCredential(credentialID string) *Transaction

func (*Transaction) Extra

func (t *Transaction) Extra(extra string) *Transaction

Extra add extra into transaction

func (*Transaction) GetCName added in v1.2.0

func (t *Transaction) GetCName() string

func (*Transaction) GetExtra added in v1.2.0

func (t *Transaction) GetExtra() string

func (*Transaction) GetExtraIdInt64 added in v1.2.0

func (t *Transaction) GetExtraIdInt64() []int64

func (*Transaction) GetExtraIdString

func (t *Transaction) GetExtraIdString() (string, error)

GetExtraIdString get extraId string

func (*Transaction) GetExtraIdStringArray added in v1.2.0

func (t *Transaction) GetExtraIdStringArray() []string

func (*Transaction) GetFrom added in v1.2.0

func (t *Transaction) GetFrom() string

func (*Transaction) GetNonce added in v1.2.0

func (t *Transaction) GetNonce() int64

func (*Transaction) GetOpcode added in v1.2.0

func (t *Transaction) GetOpcode() int64

func (*Transaction) GetPayload added in v1.2.0

func (t *Transaction) GetPayload() string

func (*Transaction) GetSignature added in v1.2.0

func (t *Transaction) GetSignature() string

func (*Transaction) GetTimestamp added in v1.2.0

func (t *Transaction) GetTimestamp() int64

func (*Transaction) GetTo added in v1.2.0

func (t *Transaction) GetTo() string

func (*Transaction) GetTransactionHash

func (t *Transaction) GetTransactionHash(gasLimit int64) string

func (*Transaction) GetValue added in v1.2.0

func (t *Transaction) GetValue() int64

func (*Transaction) GetVmType added in v1.2.0

func (t *Transaction) GetVmType() string

func (*Transaction) Invoke

func (t *Transaction) Invoke(to string, payload []byte) *Transaction

Invoke add transaction isInvoke

func (*Transaction) InvokeByName

func (t *Transaction) InvokeByName(name string, payload []byte) *Transaction

Invoke add transaction isInvoke

func (*Transaction) InvokeContract

func (t *Transaction) InvokeContract(to string, rawAbi string, funcName string, args ...string) *Transaction

Deprecated InvokeContract invoke evm contract by raw ABI, function name and arguments in string format use abi.Encode instead

func (*Transaction) InvokeSql

func (t *Transaction) InvokeSql(to string, payload []byte) *Transaction

func (*Transaction) IsSimulate added in v1.2.0

func (t *Transaction) IsSimulate() bool

func (*Transaction) KVExtra

func (t *Transaction) KVExtra(kvExtra *KVExtra) *Transaction

func (*Transaction) Maintain

func (t *Transaction) Maintain(op int64, to, payload string) *Transaction

Maintain maintain contract transaction

func (*Transaction) MaintainByName

func (t *Transaction) MaintainByName(op int64, name, payload string) *Transaction

MaintainByName maintain contract transaction by contract name

func (*Transaction) MaintainDID

func (t *Transaction) MaintainDID(to string, op int64) *Transaction

func (*Transaction) Nonce

func (t *Transaction) Nonce(nonce int64) *Transaction

Nonce add transaction nonce

func (*Transaction) OpCode

func (t *Transaction) OpCode(op int64) *Transaction

OpCode add transaction opCode

func (*Transaction) Payload

func (t *Transaction) Payload(payload string) *Transaction

Payload add transaction payload

func (*Transaction) PreSign

func (t *Transaction) PreSign(key account.Key)

PreSign is used to constructor extra field in private transaction

func (*Transaction) Register

func (t *Transaction) Register(document *DIDDocument) *Transaction

func (*Transaction) Serialize

func (t *Transaction) Serialize() interface{}

Serialize serialize the tx instance to a map

func (*Transaction) SerializeToString

func (t *Transaction) SerializeToString() string

SerializeToString serialize the tx instance to json string

func (*Transaction) SetCName

func (t *Transaction) SetCName(cName string)

func (*Transaction) SetExtra

func (t *Transaction) SetExtra(extra string)

func (*Transaction) SetExtraIDInt64

func (t *Transaction) SetExtraIDInt64(extraId ...int64)

SetExtraIDInt64 set transaction int64 extraId

func (*Transaction) SetExtraIDString

func (t *Transaction) SetExtraIDString(extraId ...string)

SetExtraIDString set transaction string extraId

func (*Transaction) SetFrom

func (t *Transaction) SetFrom(from string)

func (*Transaction) SetHasExtra

func (t *Transaction) SetHasExtra(hasExtra bool)

func (*Transaction) SetIsByName

func (t *Transaction) SetIsByName(isByName bool)

func (*Transaction) SetIsDeploy

func (t *Transaction) SetIsDeploy(isDeploy bool)

func (*Transaction) SetIsInvoke

func (t *Transaction) SetIsInvoke(isInvoke bool)

func (*Transaction) SetIsMaintain

func (t *Transaction) SetIsMaintain(isMaintain bool)

func (*Transaction) SetIsPrivateTxm

func (t *Transaction) SetIsPrivateTxm(isPrivateTx bool)

func (*Transaction) SetIsValue

func (t *Transaction) SetIsValue(isValue bool)

func (*Transaction) SetKvExtra

func (t *Transaction) SetKvExtra(kvExtra *KVExtra)

func (*Transaction) SetNonce

func (t *Transaction) SetNonce(nonce int64)

func (*Transaction) SetOpcode

func (t *Transaction) SetOpcode(opcode int64)

func (*Transaction) SetOptionExtra

func (t *Transaction) SetOptionExtra(option string)

SetOptionExtra set transaction string extraId

func (*Transaction) SetParticipants

func (t *Transaction) SetParticipants(participants []string)

func (*Transaction) SetPayload

func (t *Transaction) SetPayload(payload string)

func (*Transaction) SetSignature

func (t *Transaction) SetSignature(signature string)

func (*Transaction) SetSimulate

func (t *Transaction) SetSimulate(simulate bool)

func (*Transaction) SetTimestamp

func (t *Transaction) SetTimestamp(timestamp int64)

func (*Transaction) SetTo

func (t *Transaction) SetTo(to string)

func (*Transaction) SetValue

func (t *Transaction) SetValue(value int64)

func (*Transaction) SetVmType

func (t *Transaction) SetVmType(vmType string)

func (*Transaction) Sign

func (t *Transaction) Sign(key interface{})

Sign support ecdsa\SM2\Ed25519 signature

func (*Transaction) SignWithBatchFlag

func (t *Transaction) SignWithBatchFlag(key interface{})

SignWithBatchFlag SignWIthBatch support ecdsa\SM2\Ed25519 signature Only affect sm2 signature, other types (ED25519/ECDSA) are the same as Sign Only flato 1.0.2 +

func (*Transaction) SignWithClang

func (t *Transaction) SignWithClang(key interface{})

func (*Transaction) Signature

func (t *Transaction) Signature(signature string) *Transaction

Signature add transaction signature

func (*Transaction) Simulate

func (t *Transaction) Simulate(simulate bool) *Transaction

Simulate add transaction simulate

func (*Transaction) Timestamp

func (t *Transaction) Timestamp(timestamp int64) *Transaction

Timestamp add transaction timestamp

func (*Transaction) To

func (t *Transaction) To(to string) *Transaction

To add transaction to

func (*Transaction) Transfer

func (t *Transaction) Transfer(to string, value int64) *Transaction

Transfer transfer balance to account

func (*Transaction) UpdateAdmins

func (t *Transaction) UpdateAdmins(to string, admins []string) *Transaction

func (*Transaction) UpdatePublicKey

func (t *Transaction) UpdatePublicKey(to string, puKey *DIDPublicKey) *Transaction

func (*Transaction) UploadCredential

func (t *Transaction) UploadCredential(credential *DIDCredential) *Transaction

func (*Transaction) VMType

func (t *Transaction) VMType(vmType VMType) *Transaction

VMType add transaction vmType

func (*Transaction) Value

func (t *Transaction) Value(value int64) *Transaction

Value add transaction value

type TransactionGrpc added in v1.2.0

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

func (*TransactionGrpc) Close added in v1.2.0

func (t *TransactionGrpc) Close() error

func (*TransactionGrpc) SendTransaction added in v1.2.0

func (t *TransactionGrpc) SendTransaction(trans *Transaction) (string, StdError)

func (*TransactionGrpc) SendTransactionReturnReceipt added in v1.2.0

func (t *TransactionGrpc) SendTransactionReturnReceipt(trans *Transaction) (*TxReceipt, StdError)

type TransactionInfo

type TransactionInfo struct {
	Version        string
	Hash           string
	BlockNumber    uint64
	BlockHash      string
	TxIndex        uint64
	From           string
	To             string
	CName          string
	Amount         uint64
	Timestamp      uint64
	Nonce          uint64
	ExecuteTime    int64
	Payload        string
	Extra          string
	Invalid        bool
	InvalidMsg     string
	BlockTimestamp int64
	BlockWriteTime int64
}

TransactionInfo is packaged result of TransactionInfo

type TransactionPageArg

type TransactionPageArg struct {
	BlkNumber      string `json:"blkNumber,omitempty"`
	MaxBlkNumber   string `json:"maxBlkNumber,omitempty"`
	MinBlkNumber   string `json:"minBlkNumber,omitempty"`
	TxIndex        uint64 `json:"txIndex,omitempty"`
	Separated      uint64 `json:"separated,omitempty"`
	PageSize       uint64 `json:"pageSize,omitempty"`
	ContainCurrent bool   `json:"containCurrent,omitempty"`
	Address        string `json:"address,omitempty"`
	CName          string `json:"cName,omitempty"`
}

TransactionPageArg is packaged result of transaction page

type TransactionRaw

type TransactionRaw struct {
	Version        string        `json:"version"`               // hyperchain version when the transaction is executed
	Hash           string        `json:"hash"`                  // transaction hash
	BlockNumber    string        `json:"blockNumber,omitempty"` // block number where this transaction was in
	BlockHash      string        `json:"blockHash,omitempty"`   // hash of the block where this transaction was in
	TxIndex        string        `json:"txIndex,omitempty"`     // transaction index in the block
	From           string        `json:"from"`                  // the address of sender
	To             string        `json:"to"`                    // the address of receiver
	CName          string        `json:"CName,omitempty"`       // contract name
	Amount         string        `json:"amount,omitempty"`      // transfer amount
	Timestamp      int64         `json:"timestamp"`             // the unix timestamp for when the transaction was generated
	Nonce          int64         `json:"nonce"`
	Extra          string        `json:"extra"`
	ExtraID        []interface{} `json:"extraId,omitempty"`
	ExecuteTime    string        `json:"executeTime,omitempty"` // the time it takes to execute the transaction
	Payload        string        `json:"payload,omitempty"`
	Invalid        bool          `json:"invalid,omitempty"`    // indicate whether it is invalid or not
	InvalidMsg     string        `json:"invalidMsg,omitempty"` // if Invalid is true, printing invalid message
	Signature      string        `json:"signature,omitempty"`
	BlockTimestamp int64         `json:"blockTimestamp,omitempty"` // the unix timestamp for when the transaction was batched
	BlockWriteTime int64         `json:"blockWriteTime,omitempty"` // the unix timestamp for when the transaction was written
}

TransactionRaw is packaged result of TransactionRaw

func (*TransactionRaw) ToTransaction

func (t *TransactionRaw) ToTransaction() (*TransactionInfo, StdError)

ToTransaction is used to transform PlainBlockRaw to PlainBlock

type TransactionValue

type TransactionValue struct {
	Price              int64                   `protobuf:"varint,1,opt,name=price,proto3" json:"price,omitempty"`
	GasLimit           int64                   `protobuf:"varint,2,opt,name=gasLimit,proto3" json:"gasLimit,omitempty"`
	Amount             int64                   `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
	Payload            []byte                  `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"`
	EncryptedAmount    []byte                  `protobuf:"bytes,5,opt,name=encryptedAmount,proto3" json:"encryptedAmount,omitempty"`
	HomomorphicAmount  []byte                  `protobuf:"bytes,6,opt,name=homomorphicAmount,proto3" json:"homomorphicAmount,omitempty"`
	HomomorphicBalance []byte                  `protobuf:"bytes,7,opt,name=homomorphicBalance,proto3" json:"homomorphicBalance,omitempty"`
	Op                 TransactionValue_Opcode `protobuf:"varint,8,opt,name=op,proto3,enum=rpc.TransactionValue_Opcode" json:"op,omitempty"`
	Extra              []byte                  `protobuf:"bytes,9,opt,name=extra,proto3" json:"extra,omitempty"`
	ExtraId            []byte                  `protobuf:"bytes,10,opt,name=extraId,proto3" json:"extraId,omitempty"`
	VmType             TransactionValue_VmType `protobuf:"varint,11,opt,name=vmType,proto3,enum=rpc.TransactionValue_VmType" json:"vmType,omitempty"`
}

func (*TransactionValue) Descriptor

func (*TransactionValue) Descriptor() ([]byte, []int)

func (*TransactionValue) GetAmount

func (m *TransactionValue) GetAmount() int64

func (*TransactionValue) GetEncryptedAmount

func (m *TransactionValue) GetEncryptedAmount() []byte

func (*TransactionValue) GetExtra

func (m *TransactionValue) GetExtra() []byte

func (*TransactionValue) GetExtraId

func (m *TransactionValue) GetExtraId() []byte

func (*TransactionValue) GetGasLimit

func (m *TransactionValue) GetGasLimit() int64

func (*TransactionValue) GetHomomorphicAmount

func (m *TransactionValue) GetHomomorphicAmount() []byte

func (*TransactionValue) GetHomomorphicBalance

func (m *TransactionValue) GetHomomorphicBalance() []byte

func (*TransactionValue) GetOp

func (*TransactionValue) GetPayload

func (m *TransactionValue) GetPayload() []byte

func (*TransactionValue) GetPrice

func (m *TransactionValue) GetPrice() int64

func (*TransactionValue) GetVmType

func (*TransactionValue) Marshal

func (m *TransactionValue) Marshal() (dAtA []byte, err error)

func (*TransactionValue) MarshalTo

func (m *TransactionValue) MarshalTo(dAtA []byte) (int, error)

func (*TransactionValue) ProtoMessage

func (*TransactionValue) ProtoMessage()

func (*TransactionValue) Reset

func (m *TransactionValue) Reset()

func (*TransactionValue) Size

func (m *TransactionValue) Size() (n int)

func (*TransactionValue) String

func (m *TransactionValue) String() string

func (*TransactionValue) Unmarshal

func (m *TransactionValue) Unmarshal(dAtA []byte) error

func (*TransactionValue) XXX_DiscardUnknown

func (m *TransactionValue) XXX_DiscardUnknown()

func (*TransactionValue) XXX_Marshal

func (m *TransactionValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TransactionValue) XXX_Merge

func (m *TransactionValue) XXX_Merge(src proto.Message)

func (*TransactionValue) XXX_Size

func (m *TransactionValue) XXX_Size() int

func (*TransactionValue) XXX_Unmarshal

func (m *TransactionValue) XXX_Unmarshal(b []byte) error

type TransactionValue_Opcode

type TransactionValue_Opcode int32
const (
	TransactionValue_NORMAL   TransactionValue_Opcode = 0
	TransactionValue_UPDATE   TransactionValue_Opcode = 1
	TransactionValue_FREEZE   TransactionValue_Opcode = 2
	TransactionValue_UNFREEZE TransactionValue_Opcode = 3
	TransactionValue_SKIPVM   TransactionValue_Opcode = 4
	TransactionValue_ARCHIVE  TransactionValue_Opcode = 100
)

func (TransactionValue_Opcode) EnumDescriptor

func (TransactionValue_Opcode) EnumDescriptor() ([]byte, []int)

func (TransactionValue_Opcode) String

func (x TransactionValue_Opcode) String() string

type TransactionValue_VmType

type TransactionValue_VmType int32
const (
	TransactionValue_EVM      TransactionValue_VmType = 0
	TransactionValue_JVM      TransactionValue_VmType = 1
	TransactionValue_HVM      TransactionValue_VmType = 2
	TransactionValue_BVM      TransactionValue_VmType = 3
	TransactionValue_TRANSFER TransactionValue_VmType = 4
	TransactionValue_KVSQL    TransactionValue_VmType = 5
)

func (TransactionValue_VmType) EnumDescriptor

func (TransactionValue_VmType) EnumDescriptor() ([]byte, []int)

func (TransactionValue_VmType) String

func (x TransactionValue_VmType) String() string

type TransactionsCount

type TransactionsCount struct {
	Count     uint64
	Timestamp uint64
}

TransactionsCount is packaged result of transactionsCount

type TransactionsCountByContract

type TransactionsCountByContract struct {
	Count        uint64
	LastIndex    uint64
	LastBlockNum uint64
}

TransactionsCountByContract is packaged result of transaction code

type TransactionsCountByContractRaw

type TransactionsCountByContractRaw struct {
	Count        string
	LastIndex    string
	LastBlockNum string
}

TransactionsCountByContractRaw is packaged result of transaction code

func (*TransactionsCountByContractRaw) ToTransactionsCountByContract

func (tc *TransactionsCountByContractRaw) ToTransactionsCountByContract() (*TransactionsCountByContract, error)

ToTransactionsCountByContract transform to TransactionsCountByContract

type TransactionsCountRaw

type TransactionsCountRaw struct {
	Count     string
	Timestamp uint64
}

TransactionsCountRaw is packaged result of transactionCount

func (*TransactionsCountRaw) ToTransactionsCount

func (tr *TransactionsCountRaw) ToTransactionsCount() (*TransactionsCount, error)

ToTransactionsCount is used to transform TransactionsCountRaw to TransactionCount

type TxLog

type TxLog struct {
	Address     string
	Topics      []string
	Data        string
	BlockNumber uint64
	TxHash      string
	TxIndex     uint64
	Index       uint64
}

TxLog is packaged result of transaction log

type TxProofPath added in v1.2.2

type TxProofPath struct {
	TxProof types.MerkleProofPath `json:"txProof"`
}

TxProofPath represents the result returned by tx proof query.

type TxReceipt

type TxReceipt struct {
	TxHash          string
	PrivTxHash      string
	ContractAddress string
	ContractName    string
	Ret             string
	Log             []TxLog
	VMType          string
	Version         string
	Valid           bool
	ErrorMsg        string
	GasUsed         int64
}

TxReceipt is packaged result of transaction receipt

type UnRegisterMeta

type UnRegisterMeta struct {
	From         string
	QueueName    string
	ExchangeName string
	Signature    string
}

UnRegisterMeta UnRegisterMeta

func NewUnRegisterMeta

func NewUnRegisterMeta(from, queue, exchange string) *UnRegisterMeta

NewUnRegisterMeta create new instance

func (*UnRegisterMeta) Sign

func (urm *UnRegisterMeta) Sign(key interface{})

Sign sign UnRegisterMeta

type VMType

type VMType string

VMType vm type, could by evm and jvm

type ValidResult

type ValidResult struct {
	CheckResult     []bool
	IllegalHmAmount string
}

type VoteInfo

type VoteInfo struct {
	Addr   string `json:"addr,omitempty"`
	TxHash string `json:"txHash,omitempty"`
}

type WebSocketClient

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

WebSocketClient control the all APIs web socket related APIs

func (*WebSocketClient) CloseConn

func (wscli *WebSocketClient) CloseConn(nodeIndex int) StdError

CloseConn is used to close the connection of a specific node note: nodeIndex start from 1

func (*WebSocketClient) GetAllSubscription

func (wscli *WebSocketClient) GetAllSubscription(nodeIndex int) ([]Subscription, StdError)

GetAllSubscription get all subscriptions of a specific node note: nodeIndex start from 1

func (*WebSocketClient) Subscribe

func (wscli *WebSocketClient) Subscribe(nodeIndex int, filter EventFilter, eventHandler WsEventHandler) (SubscriptionID, StdError)

Subscribe is used to subscribe event(s) of the specific node, the user-defined callback will be called when events that fulfill the filters occurred. note: nodeIndex start from 1

func (*WebSocketClient) SubscribeForProposal

func (wscli *WebSocketClient) SubscribeForProposal(nodeIndex int, eventHandler WsEventHandler) (SubscriptionID, StdError)

SubscribeForProposal is used to subscribe logs about proposal of the specific node, the user-defined callback will be called when proposal status been changed. note: nodeIndex start from 1

func (*WebSocketClient) UnSubscribe

func (wscli *WebSocketClient) UnSubscribe(id SubscriptionID) StdError

UnSubscribe is used to unsubscribe a event by subID and user will not be notified by the event once the method called

type WebSocketNotification

type WebSocketNotification struct {
	Event        string          `json:"event"`
	Subscription SubscriptionID  `json:"subscription"`
	Data         json.RawMessage `json:"data"`
}

WebSocketNotification represents the notification data structure

type WsEventHandler

type WsEventHandler interface {
	// when subscribe success
	OnSubscribe()
	// when unsubscribe
	OnUnSubscribe()
	// when receive notification
	OnMessage([]byte)
	// when connection closed
	OnClose()
}

WsEventHandler web socket event handler note: if you unsubscribe a event, the OnClose() will never be called even if the connection is closed

Jump to

Keyboard shortcuts

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