distribution

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: 14 Imported by: 0

README

Distribution module

Usage

(Tx) Fund community pool
fundCommunityPoolMsg := types.FundCommunityPoolMsg {
    Amount: "1000",
}

txbytes, err := xplac.FundCommunityPool(fundCommunityPoolMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Proposal community pool spend
// Input data
communityPoolSpendMsg := types.CommunityPoolSpendMsg{
    Title: "community pool spend",
    Description: "pay me",
    Recipient: "xpla1ka84cuec6339t8s4nh3sp5zf2fre6dh2v2g9mp",
    Amount: "10000",
    Deposit: "1000",
}

// Use json file
communityPoolSpendMsg := types.CommunityPoolSpendMsg{
    JsonFilePath: "./proposal.json"
}

txbytes, err := xplac.CommunityPoolSpend(communityPoolSpendMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Withdraw rewards
withdrawRewardsMsg := types.WithdrawRewardsMsg{
    DelegatorAddr: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
}
txbytes, err := xplac.WithdrawRewards(withdrawRewardsMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Withdraw all rewards
txbytes, err := xplac.WithdrawAllRewards().CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Set withdraw address
setWithdrawAddrMsg := types.SetwithdrawAddrMsg {
    WithdrawAddr: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
}
txbytes, err := xplac.SetWithdrawAddr(setWithdrawAddrMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Query) distribution parameters
res, err := xplac.DistributionParams().Query()
(Query) validator outstanding rewards
validatorOutstandingRewardsMsg := types.ValidatorOutstandingRewardsMsg {
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
}
res, err := xplac.ValidatorOutstandingRewards(validatorOutstandingRewardsMsg).Query()
(Query) commission
queryDistCommissionMsg := types.QueryDistCommissionMsg {
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
}
res, err := xplac.DistCommission(queryDistCommissionMsg).Query()
(Query) validator slashes
queryDistSlashesMsg := types.QueryDistSlashesMsg{
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
}

res, err := xplac.DistSlashes(queryDistSlashesMsg).Query()
(Query) rewards
// reward for a validator
queryDistRewardsMsg := types.QueryDistRewardsMsg{
    ValidatorAddr: "xplavaloper19yq7kjcgse7x672faptju0lxmy4cvdlcsx9ftw",
    DelegatorAddr: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
}

// total rewards
queryDistRewardsMsg := types.QueryDistRewardsMsg{
    DelegatorAddr: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
}
res, err := xplac.DistRewards(queryDistRewardsMsg).Query()
(Query) community pool
res, err := xplac.CommunityPool().Query()

Documentation

Index

Constants

View Source
const (
	DistributionModule                             = "distribution"
	DistributionFundCommunityPoolMsgType           = "fund-community-pool"
	DistributionProposalCommunityPoolSpendMsgType  = "proposal-community-pool-spend"
	DistributionWithdrawRewardsMsgType             = "withdraw-rewards"
	DistributionWithdrawAllRewardsMsgType          = "withdraw-all-rewards"
	DistributionSetWithdrawAddrMsgType             = "set-withdraw-addr"
	DistributionQueryDistributionParamsMsgType     = "query-distribution-params"
	DistributionValidatorOutstandingRewardsMSgType = "validator-outstanding-rewards"
	DistributionQueryDistCommissionMsgType         = "dist-query-commission"
	DistributionQuerySlashesMsgType                = "dist-slashes"
	DistributionQueryRewardsMsgType                = "dist-rewards"
	DistributionQueryTotalRewardsMsgType           = "dist-total-rewards"
	DistributionQueryCommunityPoolMsgType          = "query-community-pool"
)

Variables

This section is empty.

Functions

func MakeFundCommunityPoolMsg

func MakeFundCommunityPoolMsg(fundCommunityPoolMsg types.FundCommunityPoolMsg, privKey key.PrivateKey) (disttypes.MsgFundCommunityPool, error)

(Tx) make msg - fund community pool

func MakeProposalCommunityPoolSpendMsg

func MakeProposalCommunityPoolSpendMsg(communityPoolSpendMsg types.CommunityPoolSpendMsg, privKey key.PrivateKey, encodingConfig params.EncodingConfig) (govtypes.MsgSubmitProposal, error)

(Tx) make msg - proposal community pool

func MakeQueryCommunityPoolMsg

func MakeQueryCommunityPoolMsg() (disttypes.QueryCommunityPoolRequest, error)

(Query) make msg - community pool

func MakeQueryDistCommissionMsg

func MakeQueryDistCommissionMsg(queryDistCommissionMsg types.QueryDistCommissionMsg) (disttypes.QueryValidatorCommissionRequest, error)

(Query) make msg - commission

func MakeQueryDistSlashesMsg

func MakeQueryDistSlashesMsg(queryDistSlashesMsg types.QueryDistSlashesMsg) (disttypes.QueryValidatorSlashesRequest, error)

(Query) make msg - distribution slashes

func MakeQueryDistributionParamsMsg

func MakeQueryDistributionParamsMsg() (disttypes.QueryParamsRequest, error)

(Query) make msg - distribution params

func MakeSetWithdrawAddrMsg

func MakeSetWithdrawAddrMsg(setWithdrawAddrMsg types.SetwithdrawAddrMsg, privKey key.PrivateKey) (disttypes.MsgSetWithdrawAddress, error)

(Tx) make msg - withdraw address

func MakeValidatorOutstandingRewardsMsg

func MakeValidatorOutstandingRewardsMsg(validatorOutstandingRewardsMsg types.ValidatorOutstandingRewardsMsg) (disttypes.QueryValidatorOutstandingRewardsRequest, error)

(Query) make msg - validator outstanding rewards

func MakeWithdrawAllRewardsMsg

func MakeWithdrawAllRewardsMsg(privKey key.PrivateKey, lcdUrl, grpcUrl string, grpcConn grpc.ClientConn, ctx context.Context) ([]sdk.Msg, error)

(Tx) make msg - withdraw all rewards

func MakeWithdrawRewardsMsg

func MakeWithdrawRewardsMsg(withdrawRewardsMsg types.WithdrawRewardsMsg, privKey key.PrivateKey) ([]sdk.Msg, error)

(Tx) make msg - withdraw rewards

func MakeyQueryDistRewardsMsg

func MakeyQueryDistRewardsMsg(queryDistRewardsMsg types.QueryDistRewardsMsg) (disttypes.QueryDelegationRewardsRequest, error)

(Query) make msg - distribution rewards

func MakeyQueryDistTotalRewardsMsg

func MakeyQueryDistTotalRewardsMsg(queryDistRewardsMsg types.QueryDistRewardsMsg) (disttypes.QueryDelegationTotalRewardsRequest, error)

(Query) make msg - distribution all rewards

Types

This section is empty.

Jump to

Keyboard shortcuts

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