Documentation
¶
Index ¶
- Variables
- type Agent
- type BxhAgent
- func (agent *BxhAgent) Appchain() (*rpcx.Appchain, error)
- func (agent *BxhAgent) GetAppchains() ([]*rpcx.Appchain, error)
- func (agent *BxhAgent) GetAssetExchangeSigns(id string) ([]byte, error)
- func (agent *BxhAgent) GetBlockHeader(ctx context.Context, begin, end uint64, ch chan *pb.BlockHeader) error
- func (agent *BxhAgent) GetChainMeta() (*pb.ChainMeta, error)
- func (agent *BxhAgent) GetIBTPByID(id string) (*pb.IBTP, error)
- func (agent *BxhAgent) GetIBTPSigns(ibtp *pb.IBTP) ([]byte, error)
- func (agent *BxhAgent) GetInterchainById(from string) *pb.Interchain
- func (agent *BxhAgent) GetInterchainMeta() (*pb.Interchain, error)
- func (agent *BxhAgent) GetInterchainTxWrappers(ctx context.Context, begin, end uint64, ch chan *pb.InterchainTxWrappers) error
- func (agent *BxhAgent) GetPendingNonceByAccount(account string) (uint64, error)
- func (agent *BxhAgent) GetReceipt(hash string) (*pb.Receipt, error)
- func (agent *BxhAgent) InvokeContract(vmType pb.TransactionData_VMType, address *types.Address, method string, ...) (*pb.Receipt, error)
- func (agent *BxhAgent) SendIBTP(ibtp *pb.IBTP) (*pb.Receipt, error)
- func (agent *BxhAgent) SendTransaction(tx *pb.Transaction) (*pb.Receipt, error)
- func (agent *BxhAgent) Stop() error
- func (agent *BxhAgent) SyncBlockHeader(ctx context.Context, headerCh chan *pb.BlockHeader) error
- func (agent *BxhAgent) SyncInterchainTxWrappers(ctx context.Context, txCh chan *pb.InterchainTxWrappers) error
- func (agent *BxhAgent) SyncUnionInterchainTxWrappers(ctx context.Context, txCh chan *pb.InterchainTxWrappers) error
- type BxhClient
- func (client *BxhClient) CommitCallback(ibtp *pb.IBTP) error
- func (client *BxhClient) GetCallbackMeta() (map[string]uint64, error)
- func (client *BxhClient) GetIBTP() chan *pb.IBTP
- func (client *BxhClient) GetInMessage(from string, idx uint64) ([][]byte, error)
- func (client *BxhClient) GetInMeta() (map[string]uint64, error)
- func (client *BxhClient) GetOutMessage(to string, idx uint64) (*pb.IBTP, error)
- func (client *BxhClient) GetOutMeta() (map[string]uint64, error)
- func (client *BxhClient) Initialize(configPath string, pierID string, extra []byte) error
- func (client *BxhClient) Name() string
- func (client *BxhClient) Start() error
- func (client *BxhClient) Stop() error
- func (client *BxhClient) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error)
- func (client *BxhClient) Type() string
Constants ¶
This section is empty.
Variables ¶
var (
ErrIBTPNotFound = fmt.Errorf("receipt from bitxhub failed")
)
agent is responsible for interacting with bitxhub
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent interface { // Appchain will query if this appchain has registered to bitxhub. // If this appchain related to the pier has registered, bitxhub will return // some basic info about this chain. Otherwise, pier will get not exist appchain error. Appchain() (*rpcx.Appchain, error) // syncBlockHeaer tries to get an channel of Headers from bitxhub. // Note: only the header beyond the height of sync-header request moment will be sent to this channel SyncBlockHeader(ctx context.Context, ch chan *pb.BlockHeader) error // GetBlockHeader tries to get headers whose height is in the interval of [begin, end] // All these headers will be sent the channel. GetBlockHeader(ctx context.Context, begin, end uint64, ch chan *pb.BlockHeader) error // SyncInterchainTxWrapper tries to get an channel of interchain tx wrapper from bitxhub. // Note: only the interchain tx wrappers beyond the height of sync-header request moment will be sent to this channel SyncInterchainTxWrappers(ctx context.Context, ch chan *pb.InterchainTxWrappers) error // SyncUnionInterchainTxWrapper tries to get an channel of union interchain tx wrapper from bitxhub. // Note: only the union interchain tx wrappers beyond the height of sync-header request moment will be sent to this channel SyncUnionInterchainTxWrappers(ctx context.Context, txCh chan *pb.InterchainTxWrappers) error // GetInterchainTxWrapper tries to get txWrappers whose height is in the interval of [begin, end] // All these wrappers will be sent the channel. GetInterchainTxWrappers(ctx context.Context, begin, end uint64, ch chan *pb.InterchainTxWrappers) error // SendTransaction sends the wrapped interchain tx to bitxhub SendTransaction(tx *pb.Transaction) (*pb.Receipt, error) // InvokeContract invokes contract of bitxhub InvokeContract(vmType pb.TransactionData_VMType, address *types.Address, method string, opts *rpcx.TransactOpts, args ...*pb.Arg) (*pb.Receipt, error) // SendIBTP sends wrapped ibtp to bitxhub internal VM to execute SendIBTP(ibtp *pb.IBTP) (*pb.Receipt, error) // GetIBTPByID queries interchain ibtp package record given an unique id of ibtp from bitxhub GetIBTPByID(id string) (*pb.IBTP, error) // GetChainMeta gets chain meta of relay chain GetChainMeta() (*pb.ChainMeta, error) GetInterchainMeta() (*pb.Interchain, error) GetAssetExchangeSigns(id string) ([]byte, error) //GetIBTPSigns gets ibtp signs from bitxhub cluster GetIBTPSigns(ibtp *pb.IBTP) ([]byte, error) //GetAppchains gets appchains from bitxhub node GetAppchains() ([]*rpcx.Appchain, error) //GetInterchainById gets interchain meta by appchain id GetInterchainById(from string) *pb.Interchain // GetPendingNonceByAccount get the latest pending nonce of the account GetPendingNonceByAccount(account string) (uint64, error) }
type BxhAgent ¶
type BxhAgent struct {
// contains filtered or unexported fields
}
BxhAgent represents the necessary data for interacting with bitxhub
func New ¶
New create an instance of BxhAgent given the client of bitxhub and the appchain id and some configuration of bitxhub
func (*BxhAgent) GetAppchains ¶ added in v1.4.0
func (*BxhAgent) GetAssetExchangeSigns ¶ added in v1.4.0
func (*BxhAgent) GetBlockHeader ¶
func (*BxhAgent) GetChainMeta ¶
GetChainMeta implements Agent
func (*BxhAgent) GetIBTPByID ¶
GetIBTPByID implements Agent
func (*BxhAgent) GetIBTPSigns ¶ added in v1.4.0
func (*BxhAgent) GetInterchainById ¶ added in v1.4.0
func (agent *BxhAgent) GetInterchainById(from string) *pb.Interchain
func (*BxhAgent) GetInterchainMeta ¶
func (agent *BxhAgent) GetInterchainMeta() (*pb.Interchain, error)
func (*BxhAgent) GetInterchainTxWrappers ¶ added in v1.4.0
func (agent *BxhAgent) GetInterchainTxWrappers(ctx context.Context, begin, end uint64, ch chan *pb.InterchainTxWrappers) error
GetInterchainTxWrapper implements Agent
func (*BxhAgent) GetPendingNonceByAccount ¶ added in v1.4.0
func (*BxhAgent) GetReceipt ¶
GetReceipt implements Agent
func (*BxhAgent) InvokeContract ¶ added in v1.4.0
func (agent *BxhAgent) InvokeContract(vmType pb.TransactionData_VMType, address *types.Address, method string, opts *rpcx.TransactOpts, args ...*pb.Arg) (*pb.Receipt, error)
InvokeContract implements Agent
func (*BxhAgent) SendTransaction ¶
SendTransaction implements Agent
func (*BxhAgent) SyncBlockHeader ¶
func (*BxhAgent) SyncInterchainTxWrappers ¶ added in v1.4.0
func (*BxhAgent) SyncUnionInterchainTxWrappers ¶ added in v1.4.0
type BxhClient ¶ added in v1.4.0
BxhClient represents plugin client fo relaychain, by packing operations of relaychain to an appchain plugin-client, we can easily excute ibtp.Payload on relaychain just like what we used to do on an appchain.
func CreateClient ¶ added in v1.4.0
CreateClient creates plugin client from agent
func (*BxhClient) CommitCallback ¶ added in v1.4.0
CommitCallback .
func (*BxhClient) GetCallbackMeta ¶ added in v1.4.0
GetCallbackMeta gets an index map, which implicates the greatest index of executed callback txs for each receiving chain TODO
func (*BxhClient) GetInMessage ¶ added in v1.4.0
GetInMessage gets receipt by index and source chain_id TODO
func (*BxhClient) GetInMeta ¶ added in v1.4.0
GetInMeta gets an index map, which implicates the greatest index of ingoing interchain txs for each source chain
func (*BxhClient) GetOutMessage ¶ added in v1.4.0
GetOutMessage .
func (*BxhClient) GetOutMeta ¶ added in v1.4.0
GetOutMeta .
func (*BxhClient) Initialize ¶ added in v1.4.0
Initialize .
func (*BxhClient) SubmitIBTP ¶ added in v1.4.0
SubmitIBTP submits the inter-relaychain ibtp to relaychain to execute ibtp.Payload
Directories
¶
Path | Synopsis |
---|---|
Package mock_agent is a generated GoMock package.
|
Package mock_agent is a generated GoMock package. |