The feegrant module is responsible for allowing accounts to grant fee allowances and to use fees from their accounts. Grantees can execute any transaction without the need to maintain sufficient fees.

For more information, visit https://docs.cosmos.network/main/modules/feegrant/

Message Types

Msg defines the feegrant msg service.

tx.proto
service Msg {

  // GrantAllowance grants fee allowance to the grantee on the granter's
  // account with the provided expiration time.
  rpc GrantAllowance(MsgGrantAllowance) returns (MsgGrantAllowanceResponse);

  // RevokeAllowance revokes any fee allowance of granter's account that
  // has been granted to the grantee.
  rpc RevokeAllowance(MsgRevokeAllowance) returns (MsgRevokeAllowanceResponse);
}

MsgGrantAllowance

MsgGrantAllowance adds permission for Grantee to spend up to Allowance of fees from the account of Granter.

tx.proto
message MsgGrantAllowance {
  option (cosmos.msg.v1.signer) = "granter";

  // granter is the address of the user granting an allowance of their funds.
  string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // grantee is the address of the user being granted an allowance of another user's funds.
  string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // allowance can be any of basic, periodic, allowed fee allowance.
  google.protobuf.Any allowance = 3 [(cosmos_proto.accepts_interface) = "FeeAllowanceI"];
}

MsgGrantAllowanceResponse

MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type.

tx.proto
message MsgGrantAllowanceResponse {}

MsgRevokeAllowance

MsgRevokeAllowance removes any existing Allowance from Granter to Grantee.

tx.proto
message MsgRevokeAllowance {
  option (cosmos.msg.v1.signer) = "granter";

  // granter is the address of the user granting an allowance of their funds.
  string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // grantee is the address of the user being granted an allowance of another user's funds.
  string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

MsgRevokeAllowanceResponse

MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type.

tx.proto
message MsgRevokeAllowanceResponse {}

Queries

Query defines the gRPC querier service.

query.proto
service Query {

  // Allowance returns fee granted to the grantee by the granter.
  rpc Allowance(QueryAllowanceRequest) returns (QueryAllowanceResponse) {
    option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowance/{granter}/{grantee}";
  }

  // Allowances returns all the grants for address.
  rpc Allowances(QueryAllowancesRequest) returns (QueryAllowancesResponse) {
    option (google.api.http).get = "/cosmos/feegrant/v1beta1/allowances/{grantee}";
  }

  // AllowancesByGranter returns all the grants given by an address
  // Since v0.46
  rpc AllowancesByGranter(QueryAllowancesByGranterRequest) returns (QueryAllowancesByGranterResponse) {
    option (google.api.http).get = "/cosmos/feegrant/v1beta1/issued/{granter}";
  }
}

QueryAllowanceRequest

QueryAllowanceRequest is the request type for the Query/Allowance RPC method.

query.proto
message QueryAllowanceRequest {
  // granter is the address of the user granting an allowance of their funds.
  string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // grantee is the address of the user being granted an allowance of another user's funds.
  string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

QueryAllowanceResponse

QueryAllowanceResponse is the response type for the Query/Allowance RPC method.

query.proto
message QueryAllowanceResponse {
  // allowance is a allowance granted for grantee by granter.
  cosmos.feegrant.v1beta1.Grant allowance = 1;
}

QueryAllowancesRequest

QueryAllowancesRequest is the request type for the Query/Allowances RPC method.

query.proto
message QueryAllowancesRequest {
  string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // pagination defines an pagination for the request.
  cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

QueryAllowancesResponse

QueryAllowancesResponse is the response type for the Query/Allowances RPC method.

query.proto
message QueryAllowancesResponse {
  // allowances are allowance's granted for grantee by granter.
  repeated cosmos.feegrant.v1beta1.Grant allowances = 1;

  // pagination defines an pagination for the response.
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

QueryAllowancesByGranterRequest

QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method.

query.proto
message QueryAllowancesByGranterRequest {
  string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // pagination defines an pagination for the request.
  cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

QueryAllowancesByGranterResponse

QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.

query.proto
message QueryAllowancesByGranterResponse {
  // allowances that have been issued by the granter.
  repeated cosmos.feegrant.v1beta1.Grant allowances = 1;

  // pagination defines an pagination for the response.
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}