Documentation
¶
Index ¶
- func InitChainClient() error
- func InitChainClientMock() error
- type BCOSBlock
- type BCOSConfigTemplate
- func (t *BCOSConfigTemplate) SetAccount(accountText []byte) error
- func (t *BCOSConfigTemplate) SetCa(caText string) error
- func (t *BCOSConfigTemplate) SetCert(certText []byte) error
- func (t *BCOSConfigTemplate) SetKey(keyText []byte) error
- func (t *BCOSConfigTemplate) ToConfig() (*conf.Config, error)
- type BCOSEvent
- type ChainClient
- func (c *ChainClient) CheckChain() bool
- func (c *ChainClient) GetTxProve(tx *bcostypes.TransactionDetail, chainRid string) string
- func (c *ChainClient) InvokeContract(chainRid, contractName, method, abiStr string, args string, needTx bool, ...) ([]string, *bcostypes.TransactionDetail, error)
- func (c *ChainClient) TxProve(txProve string) bool
- type ChainClientItfc
- type ChainClientMock
- func (c *ChainClientMock) CheckChain() bool
- func (c *ChainClientMock) GetTxProve(tx *bcostypes.TransactionDetail, chainId string) string
- func (c *ChainClientMock) InvokeContract(hainId, contractName, method, abiStr string, args string, needTx bool, ...) ([]string, *bcostypes.TransactionDetail, error)
- func (c *ChainClientMock) TxProve(txProve string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BCOSBlock ¶
type BCOSBlock struct {
Transactions []string `json:"transactions"`
Number string `json:"number"`
Hash string `json:"hash"`
ParentHash string `json:"parentHash"`
TransactionsRoot string `json:"transactionsRoot"`
ReceiptsRoot string `json:"receiptsRoot"`
DbHash string `json:"dbHash"`
StateRoot string `json:"stateRoot"`
Timestamp string `json:"timestamp"`
}
BCOSBlock bcos的区块结构
type BCOSConfigTemplate ¶
type BCOSConfigTemplate struct {
CaText string
CaFilePath string
KeyText []byte
KeyFilePath string
CertFilePath string
CertText []byte
AccountText []byte
GroupID int
Address string
Http bool
ChainID int64
SMCrypto bool
}
BCOSConfigTemplate bcos配置结构体
func NewBCOSConfigTemplate ¶
func NewBCOSConfigTemplate(chainID int64, groupIDStr, address string, isSMCrypto bool) (*BCOSConfigTemplate, error)
NewBCOSConfigTemplate 新建bcos的配置结构
@param chainID @param groupIDStr @param address @param isSMCrypto @return *BCOSConfigTemplate @return error
func (*BCOSConfigTemplate) SetAccount ¶
func (t *BCOSConfigTemplate) SetAccount(accountText []byte) error
SetAccount 设置account
@receiver t @param accountText @return error
func (*BCOSConfigTemplate) SetCa ¶
func (t *BCOSConfigTemplate) SetCa(caText string) error
SetCa 设置ca
@receiver t @param caText @return error
func (*BCOSConfigTemplate) SetCert ¶
func (t *BCOSConfigTemplate) SetCert(certText []byte) error
SetCert 设置cert
@receiver t @param certText @return error
func (*BCOSConfigTemplate) SetKey ¶
func (t *BCOSConfigTemplate) SetKey(keyText []byte) error
SetKey 设置key
@receiver t @param keyText @return error
func (*BCOSConfigTemplate) ToConfig ¶
func (t *BCOSConfigTemplate) ToConfig() (*conf.Config, error)
ToConfig 生成bcos config
@receiver t @return *conf.Config @return error
type BCOSEvent ¶
BCOSEvent bcos的event
type ChainClient ¶
type ChainClient struct {
// contains filtered or unexported fields
}
ChainClient 链客户端结构体
func (*ChainClient) CheckChain ¶
func (c *ChainClient) CheckChain() bool
CheckChain 检查链的连通性
@receiver c @return bool
func (*ChainClient) GetTxProve ¶
func (c *ChainClient) GetTxProve(tx *bcostypes.TransactionDetail, chainRid string) string
GetTxProve 获取交易证明
@receiver c @param tx 交易 @param chainRid 链资源id @return string 交易证明
func (*ChainClient) InvokeContract ¶
func (c *ChainClient) InvokeContract(chainRid, contractName, method, abiStr string, args string, needTx bool, paramType []tcipcommon.EventDataType) ([]string, *bcostypes.TransactionDetail, error)
InvokeContract 调用合约
@receiver c @param chainRid 链资源id @param contractName 合约名称 @param method 调用方法 @param abiStr abi @param args 参数 @param needTx 是否需要交易 @param paramType 参数类型 @return []string 返回参数 @return *bcostypes.TransactionDetail 交易 @return error 错误信息
func (*ChainClient) TxProve ¶
func (c *ChainClient) TxProve(txProve string) bool
TxProve 交易认证
@receiver c @param txProve @return bool
type ChainClientItfc ¶
type ChainClientItfc interface {
// InvokeContract 调用合约
InvokeContract(chainRid, contractName, method, abiStr string, args string,
needTx bool, paramType []tcipcommon.EventDataType) ([]string, *bcostypes.TransactionDetail, error)
// GetTxProve 获取交易凭证
GetTxProve(tx *bcostypes.TransactionDetail, chainRid string) string
// TxProve 交易验证
TxProve(txProve string) bool
// CheckChain 验证了链的连通性
CheckChain() bool
}
ChainClientItfc 链客户端接口
var ChainClientV1 ChainClientItfc
ChainClientV1 连交互模块对象
type ChainClientMock ¶
type ChainClientMock struct {
// contains filtered or unexported fields
}
ChainClientMock 链客户端结构体Mock
func (*ChainClientMock) CheckChain ¶
func (c *ChainClientMock) CheckChain() bool
CheckChain 检查链
@receiver c @return bool
func (*ChainClientMock) GetTxProve ¶
func (c *ChainClientMock) GetTxProve(tx *bcostypes.TransactionDetail, chainId string) string
GetTxProve 获取交易证明
@receiver c @param tx @param chainId @return string
func (*ChainClientMock) InvokeContract ¶
func (c *ChainClientMock) InvokeContract(hainId, contractName, method, abiStr string, args string, needTx bool, paramType []tcipcommon.EventDataType) ([]string, *bcostypes.TransactionDetail, error)
InvokeContract 调用合约
@receiver c @param hainId @param contractName @param method @param abiStr @param args @param needTx @param paramType @return []string @return *bcostypes.TransactionDetail @return error
func (*ChainClientMock) TxProve ¶
func (c *ChainClientMock) TxProve(txProve string) bool
TxProve 交易认证
@receiver c @param txProve @return bool
Source Files
¶
- bcos_data.go
- chain_client.go
- chain_client_helper.go
- chain_client_mock.go
Click to show internal directories.
Click to hide internal directories.