anchor

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 5 Imported by: 0

README

Anchor module

Usage

(Tx) Register anchor account
// register anchor account with validator of the private chain
// the validator send anchor tx to public chain by using mapped anchor account
registerAnchorAccMsg := types.RegisterAnchorAccMsg{
    AnchorAccountAddr: "xpla148f0qtq5zrujl8ed02lq4e9x2v7zavxzses5hc",
    ValidatorAddr:     "xprivvaloper1chmr83fzt5gyz6k72pw9czut8lg6crg6kpz95z",
}

txbytes, err := xplac.RegisterAnchorAcc(registerAnchorAccMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Change anchor account
// change anchor account of the validator
changeAnchorAccMsg := types.ChangeAnchorAccMsg{
    AnchorAccountAddr: "xpla148f0qtq5zrujl8ed02lq4e9x2v7zavxzses5hc",
    ValidatorAddr:     "xprivvaloper1chmr83fzt5gyz6k72pw9czut8lg6crg6kpz95z",
}

txbytese, err := xplac.ChangeAnchorAcc(changeAnchorAccMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Query) Anchor account
// query anchor account of the validator
anchorAccMsg := types.AnchorAccMsg{
    ValidatorAddr: "xprivvaloper1jmf9krhvv9l0ds6ughst5ffd30dvmjf57y9hdd",
}

res, err = xplac.AnchorAcc(anchorAccMsg).Query()
(Query) All aggregated blocks
// query all aggregated blocks for anchoring
res, err = xplac.AllAggregatedBlocks().Query()
(Query) Anchor info
// query anchoring info
anchorInfoMsg := types.AnchorInfoMsg{
    PrivChainHeight: "20",
}?

res, err = xplac.AnchorInfo(anchorInfoMsg).Query()
(Query) Anchor block
// query anchoring block info in the anchor contract
anchorBlockMsg := types.AnchorBlockMsg{
    PrivChainHeight:    "20",
    AnchorContractAddr: "xpla1fyr2mptjswz4w6xmgnpgm93x0q4s4wdl6srv3rtz3utc4f6fmxeqajvryg",
}

res, err = xplac.AnchorBlock(anchorBlockMsg).Query()
(Query) Anchor tx body
// query anchoring transaction in the public chain
anchorTxBodyMsg := types.AnchorTxBodyMsg{
    PrivChainHeight: "20",
}

res, err = xplac.AnchorTxBody(anchorTxBodyMsg).Query()
(Query) Verify
// check the consistency of the block in the private chain
anchorVerifyMsg := types.AnchorVerifyMsg{
    PrivChainHeight:    "20",
    AnchorContractAddr: "xpla1fyr2mptjswz4w6xmgnpgm93x0q4s4wdl6srv3rtz3utc4f6fmxeqajvryg",
}

res, err = xplac.AnchorVerify(anchorVerifyMsg).Query()
(Query) Anchor balances
// query balances of the anchot account in the public chain
anchorBalancesMsg := types.AnchorBalancesMsg{
    ValidatorAddr: "xprivvaloper1jmf9krhvv9l0ds6ughst5ffd30dvmjf57y9hdd",
}

res, err = xplac.AnchorBalances(anchorBalancesMsg).Query()
(Query) Params
// Get params of anchor module
res, err := xplac.AnchorParams().Query()

Documentation

Index

Constants

View Source
const (
	AnchorModule                     = "anchor"
	AnchorRegisterAnchorAccMsgType   = "register-anchor-acc"
	AnchorChangeAnchorAccMsgType     = "change-anchor-acc"
	AnchorQueryAnchorAccMsgType      = "query-anchor-acc"
	AnchorAllAggregatedBlocksMsgType = "all-aggregated-blocks"
	AnchorAnchorInfoMsgType          = "anchor-info"
	AnchorAnchorBlockMsgType         = "anchor-block"
	AnchorAnchorTxBodyMsgType        = "anchor-tx-body"
	AnchorVerifyMsgType              = "verify"
	AnchorAnchorBalancesMsgType      = "anchor-balances"
	AnchorParamsMsgType              = "params"
)

Variables

This section is empty.

Functions

func MakeAllAggregatedBlocksMsg

func MakeAllAggregatedBlocksMsg() (anchortypes.QueryAllAggregatedBlocksRequest, error)

(Query) make msg - all aggregated blocks

func MakeAnchorAccMsg

func MakeAnchorAccMsg(anchorAccMsg types.AnchorAccMsg) (anchortypes.QueryAnchorAccountRequest, error)

(Query) make msg - query anchor account

func MakeAnchorBalancesMsg

func MakeAnchorBalancesMsg(anchorBalancesMsg types.AnchorBalancesMsg) (anchortypes.QueryAnchorBalancesRequest, error)

(Query) make msg - anchor balances

func MakeAnchorBlockMsg

func MakeAnchorBlockMsg(anchorBlockMsg types.AnchorBlockMsg) (anchortypes.QueryAnchorBlockRequest, error)

(Query) make msg - anchor block

func MakeAnchorInfoMsg

func MakeAnchorInfoMsg(anchorInfoMsg types.AnchorInfoMsg) (anchortypes.QueryAnchorInfoRequest, error)

(Query) make msg - anchor info

func MakeAnchorParamsMsg added in v0.0.2

func MakeAnchorParamsMsg() (anchortypes.QueryParamsRequest, error)

(Query) make msg - params of anchor module

func MakeAnchorTxBodyMsg

func MakeAnchorTxBodyMsg(anchorTxBodyMsg types.AnchorTxBodyMsg) (anchortypes.QueryAnchorTxBodyRequest, error)

(Query) make msg - anchor tx body

func MakeAnchorVerifyMsg

func MakeAnchorVerifyMsg(anchorVerifyMsg types.AnchorVerifyMsg) (anchortypes.QueryVerifyRequest, error)

(Query) make msg - verify

func MakeChangeAnchorAccMsg

func MakeChangeAnchorAccMsg(changeAnchorAccMsg types.ChangeAnchorAccMsg, privKey key.PrivateKey) (anchortypes.MsgChangeAnchorAcc, error)

(Tx) make msg - change anchor account

func MakeRegisterAnchorAccMsg

func MakeRegisterAnchorAccMsg(registerAnchorAccMsg types.RegisterAnchorAccMsg, privKey key.PrivateKey) (anchortypes.MsgRegisterAnchorAcc, error)

(Tx) make msg - register anchor account

func ParseChangeAnchorAccArgs

func ParseChangeAnchorAccArgs(changeAnchorAccMsg types.ChangeAnchorAccMsg, privKey key.PrivateKey) (anchortypes.MsgChangeAnchorAcc, error)

Parsing - change anchor account

func ParseRegisterAnchorAccArgs

func ParseRegisterAnchorAccArgs(registerAnchorAccMsg types.RegisterAnchorAccMsg, privKey key.PrivateKey) (anchortypes.MsgRegisterAnchorAcc, error)

Parsing - register anchor account

Types

This section is empty.

Jump to

Keyboard shortcuts

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