var img = document.createElement('img'); img.src = "https://terradocs.matomo.cloud//piwik.php?idsite=1&rec=1&url=https://docs.terra.money" + location.pathname; img.style = "border:0"; img.alt = "tracker"; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(img,s);
Skip to main content

Authz

ℹ️info

Terra's Authz module inherits from the Cosmos SDK's authz module. This document is a stub and mainly explains important Terra-specific notes on how it is used.

The authz (message authorization) module allows users to authorize another account to send messages on their behalf. Certain authorizations, such as the spending of another account's tokens, can be parameterized to constrain the permissions of the grantee, such as setting a spending limit.

Message types

MsgGrant


_7
// MsgGrant is a request type for Grant method. It declares authorization to the grantee
_7
// on behalf of the granter with the provided expiration time.
_7
type MsgGrant struct {
_7
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
_7
Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
_7
Grant Grant `protobuf:"bytes,3,opt,name=grant,proto3" json:"grant"`
_7
}

MsgRevoke


_8
// MsgRevoke revokes any authorization with the provided sdk.Msg type on the
_8
// granter's account with that has been granted to the grantee.
_8
type MsgRevoke struct {
_8
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
_8
Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
_8
MsgTypeUrl string `protobuf:"bytes,3,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"`
_8
}
_8
}

MsgExec


_10
// MsgExec attempts to execute the provided messages using
_10
// authorizations granted to the grantee. Each message should have only
_10
// one signer corresponding to the granter of the authorization.
_10
type MsgExec struct {
_10
Grantee string `protobuf:"bytes,1,opt,name=grantee,proto3" json:"grantee,omitempty"`
_10
// Authorization Msg requests to execute. Each msg must implement Authorization interface
_10
// The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg))
_10
// triple and validate it.
_10
Msgs []*types.Any `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"`
_10
}