authz

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 12 Imported by: 0

README

Authz module

Usage

(Tx) Authz grant
authzGrantMsg := types.AuthzGrantMsg{
    Granter: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
    Grantee: "xpla19yq7kjcgse7x672faptju0lxmy4cvdlcpmxnyn",
    AuthorizationType: "send",
    SpendLimit: "1000axpla",		
}

txbytes, err := xplac.AuthzGrant(authzGrantMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Authz revoke
authzRevokeMsg := types.AuthzRevokeMsg{
    Granter: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
    Grantee: "xpla19yq7kjcgse7x672faptju0lxmy4cvdlcpmxnyn",
    MsgType: "/cosmos.bank.v1beta1.MsgSend",
}

txbytes, err := xplac.AuthzRevoke(authzRevokeMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Tx) Authz exec
// Execute by using file
authzExecMsg := types.AuthzExecMsg{
    Grantee: "xpla19yq7kjcgse7x672faptju0lxmy4cvdlcpmxnyn",
    ExecFile: "execFile.json",
}

// Execute by using transaction json string
authzExecMsg := types.AuthzExecMsg{
    Grantee: "xpla19yq7kjcgse7x672faptju0lxmy4cvdlcpmxnyn",
    ExecTxString: `{TRANSACTION_JSON}`,
}

txbytes, err := xplac.AuthzExec(authzExecMsg).CreateAndSignTx()
res, err := xplac.Broadcast(txbytes)
(Query) Authz grants
// Query grants for a granter-grantee pair and optionally a msg-type-url
queryAuthzGrantMsg := types.QueryAuthzGrantMsg {
    Granter: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
    Grantee: "xpla19yq7kjcgse7x672faptju0lxmy4cvdlcpmxnyn",
}

// Query authorization grants granted by granter
queryAuthzGrantMsg := types.QueryAuthzGrantMsg {
    Granter: "xpla1e4f6k98es55vxxv2pcfzpsjrf3mvazeyqpw8g9",
}

// Query authorization grants granted to a grantee
queryAuthzGrantMsg := types.QueryAuthzGrantMsg {
    Grantee: "xpla19yq7kjcgse7x672faptju0lxmy4cvdlcpmxnyn",
}

res, err := xplac.QueryAuthzGrants(queryAuthzGrantMsg).Query()

Documentation

Index

Constants

View Source
const (
	AuthzModule                      = "authz"
	AuthzGrantMsgType                = "authz-grant"
	AuthzRevokeMsgType               = "authz-revoke"
	AuthzExecMsgType                 = "authz-exec"
	AuthzQueryGrantMsgType           = "query-authz-grant"
	AuthzQueryGrantsByGranteeMsgType = "authz-grants-by-grantee"
	AuthzQueryGrantsByGranterMsgType = "authz-grants-by-granter"
)

Variables

This section is empty.

Functions

func MakeAuthzExecMsg

func MakeAuthzExecMsg(authzExecMsg types.AuthzExecMsg, encodingConfig params.EncodingConfig) (authz.MsgExec, error)

(Tx) make msg - authz execute

func MakeAuthzGrantMsg

func MakeAuthzGrantMsg(authzGrantMsg types.AuthzGrantMsg, privKey key.PrivateKey) (authz.MsgGrant, error)

(Tx) make msg - authz grant

func MakeAuthzRevokeMsg

func MakeAuthzRevokeMsg(authzRevokeMsg types.AuthzRevokeMsg, privKey key.PrivateKey) (authz.MsgRevoke, error)

(Tx) make msg - revoke

func MakeQueryAuthzGrantsByGranteeMsg

func MakeQueryAuthzGrantsByGranteeMsg(queryAuthzGrantMsg types.QueryAuthzGrantMsg) (authz.QueryGranteeGrantsRequest, error)

(Query) make msg - authz grants by grantee

func MakeQueryAuthzGrantsByGranterMsg

func MakeQueryAuthzGrantsByGranterMsg(queryAuthzGrantMsg types.QueryAuthzGrantMsg) (authz.QueryGranterGrantsRequest, error)

(Query) make msg - authz grants by granter

func MakeQueryAuthzGrantsMsg

func MakeQueryAuthzGrantsMsg(queryAuthzGrantMsg types.QueryAuthzGrantMsg) (authz.QueryGrantsRequest, error)

(Query) make msg - authz grants

Types

This section is empty.

Jump to

Keyboard shortcuts

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