Authz

API

class terra_sdk.client.lcd.api.authz.AuthzAPI(c)[source]
grants(granter, grantee, msg_type=None, params=None)[source]

Fetches current active message authorization grants.

Parameters
  • granter (AccAddress) – granter account address

  • grantee (AccAddress) – grantee account address

  • msg_type (str, optional) – message type.

  • params (APIParams, optional) – additional params for the API like pagination

Returns

message authorization grants matching criteria

Return type

List[AuthorizationGrant]

Data

Authz module data types.

class terra_sdk.core.authz.data.Authorization[source]

Base class for authorization types.

class terra_sdk.core.authz.data.AuthorizationGrant(authorization, expiration)[source]

Contains information about an existing granted authorization between two users.

authorization: terra_sdk.core.authz.data.Authorization

Grant authorization details.

expiration: datetime.datetime

Grant expiration.

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

class terra_sdk.core.authz.data.AuthorizationType(value)[source]

AuthorizationType defines the type of staking module authorization type

class terra_sdk.core.authz.data.GenericAuthorization(msg)[source]

Generic type of Authorization, specifying the type of message to allow.

Parameters

grant_msg_type – type of message allowed by authorization

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

type_amino = 'msgauth/GenericAuthorization'
class terra_sdk.core.authz.data.SendAuthorization(spend_limit)[source]

Type of Authorization for MsgSend, which can be parameterized by setting a spend_limit allowance for the grantee.

Parameters

spend_limit (Coins.Input) – coins representing allowance of grant

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

type_amino = 'msgauth/SendAuthorization'

Messages

Authz module message types.

class terra_sdk.core.authz.msgs.MsgExecAuthorized(grantee, msgs)[source]

Execute a set of messages, exercising an existing authorization.

Parameters
  • grantee (NewType()(AccAddress, str)) – grantee account (submitting on behalf of granter)

  • msg (List[Msg]) – list of messages to execute using authorization grant

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

type_amino = 'msgauth/MsgExecAuthorized'
type_url: str = '/cosmos.authz.v1beta1.MsgExec'
class terra_sdk.core.authz.msgs.MsgGrantAuthorization(granter, grantee, grant)[source]

Grant an authorization to grantee to call messages on behalf of granter.

Parameters
  • granter (NewType()(AccAddress, str)) – account granting authorization

  • grantee (NewType()(AccAddress, str)) – account receiving authorization

  • grant (AuthorizationGrant) – pair of authorization, expiration

to_data()[source]

Converts the object to its JSON-serializable Python data representation.

Return type

dict

type_amino = 'msgauth/MsgGrantAuthorization'
type_url: str = '/cosmos.authz.v1beta1.MsgGrant'
class terra_sdk.core.authz.msgs.MsgRevokeAuthorization(granter, grantee, msg_type_url)[source]

Remove existing authorization grant of the specified message type.

Parameters
  • granter (NewType()(AccAddress, str)) – account removing authorization

  • grantee (NewType()(AccAddress, str)) – account having authorization removed

  • msg_type_url (str) – type of message to remove authorization for

type_amino = 'msgauth/MsgRevokeAuthorization'
type_url: str = '/cosmos.authz.v1beta1.MsgRevoke'