README
¶
sidebar_position: 1
x/feegrant
Abstract
This document specifies the fee grant module. For the full ADR, please see Fee Grant ADR-029.
This module allows accounts to grant fee allowances and to use fees from their accounts. Grantees can execute any transaction without the need to maintain sufficient fees.
Contents
Concepts
Grant
Grant
is stored in the KVStore to record a grant with full context. Every grant will contain granter
, grantee
and what kind of allowance
is granted. granter
is an account address who is giving permission to grantee
(the beneficiary account address) to pay for some or all of grantee
's transaction fees. allowance
defines what kind of fee allowance (BasicAllowance
or PeriodicAllowance
, see below) is granted to grantee
. allowance
accepts an interface which implements FeeAllowanceI
, encoded as Any
type. There can be only one existing fee grant allowed for a grantee
and granter
, self grants are not allowed.
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L83-L93
FeeAllowanceI
looks like:
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/feegrant/fees.go#L9-L32
Fee Allowance types
There are two types of fee allowances present at the moment:
BasicAllowance
PeriodicAllowance
AllowedMsgAllowance
BasicAllowance
BasicAllowance
is permission for grantee
to use fee from a granter
's account. If any of the spend_limit
or expiration
reaches its limit, the grant will be removed from the state.
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L15-L28
-
spend_limit
is the limit of coins that are allowed to be used from thegranter
account. If it is empty, it assumes there's no spend limit,grantee
can use any number of available coins fromgranter
account address before the expiration. -
expiration
specifies an optional time when this allowance expires. If the value is left empty, there is no expiry for the grant. -
When a grant is created with empty values for
spend_limit
andexpiration
, it is still a valid grant. It won't restrict thegrantee
to use any number of coins fromgranter
and it won't have any expiration. The only way to restrict thegrantee
is by revoking the grant.
PeriodicAllowance
PeriodicAllowance
is a repeating fee allowance for the mentioned period, we can mention when the grant can expire as well as when a period can reset. We can also define the maximum number of coins that can be used in a mentioned period of time.
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L34-L68
-
basic
is the instance ofBasicAllowance
which is optional for periodic fee allowance. If empty, the grant will have noexpiration
and nospend_limit
. -
period
is the specific period of time, after each period passes,period_can_spend
will be reset. -
period_spend_limit
specifies the maximum number of coins that can be spent in the period. -
period_can_spend
is the number of coins left to be spent before the period_reset time. -
period_reset
keeps track of when a next period reset should happen.
AllowedMsgAllowance
AllowedMsgAllowance
is a fee allowance, it can be any of BasicFeeAllowance
, PeriodicAllowance
but restricted only to the allowed messages mentioned by the granter.
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/feegrant.proto#L70-L81
-
allowance
is eitherBasicAllowance
orPeriodicAllowance
. -
allowed_messages
is array of messages allowed to execute the given allowance.
FeeGranter flag
feegrant
module introduces a FeeGranter
flag for CLI for the sake of executing transactions with fee granter. When this flag is set, clientCtx
will append the granter account address for transactions generated through CLI.
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/client/cmd.go#L249-L260
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/client/tx/tx.go#L109-L109
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/auth/tx/builder.go#L275-L284
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/tx/v1beta1/tx.proto#L203-L224
Example cmd:
./simd tx gov submit-proposal --title="Test Proposal" --description="My awesome proposal" --type="Text" --from validator-key --fee-granter=cosmos1xh44hxt7spr67hqaa7nyx5gnutrz5fraw6grxn --chain-id=testnet --fees="10stake"
Granted Fee Deductions
Fees are deducted from grants in the x/auth
ante handler. To learn more about how ante handlers work, read the Auth Module AnteHandlers Guide.
Gas
In order to prevent DoS attacks, using a filtered x/feegrant
incurs gas. The SDK must assure that the grantee
's transactions all conform to the filter set by the granter
. The SDK does this by iterating over the allowed messages in the filter and charging 10 gas per filtered message. The SDK will then iterate over the messages being sent by the grantee
to ensure the messages adhere to the filter, also charging 10 gas per message. The SDK will stop iterating and fail the transaction if it finds a message that does not conform to the filter.
WARNING: The gas is charged against the granted allowance. Ensure your messages conform to the filter, if any, before sending transactions using your allowance.
Pruning
A queue in the state maintained with the prefix of expiration of the grants and checks them on EndBlock with the current block time for every block to prune.
State
FeeAllowance
Fee Allowances are identified by combining Grantee
(the account address of fee allowance grantee) with the Granter
(the account address of fee allowance granter).
Fee allowance grants are stored in the state as follows:
- Grant:
0x00 | grantee_addr_len (1 byte) | grantee_addr_bytes | granter_addr_len (1 byte) | granter_addr_bytes -> ProtocolBuffer(Grant)
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/feegrant/feegrant.pb.go#L222-L230
FeeAllowanceQueue
Fee Allowances queue items are identified by combining the FeeAllowancePrefixQueue
(i.e., 0x01), expiration
, grantee
(the account address of fee allowance grantee), granter
(the account address of fee allowance granter). Endblocker checks FeeAllowanceQueue
state for the expired grants and prunes them from FeeAllowance
if there are any found.
Fee allowance queue keys are stored in the state as follows:
- Grant:
0x01 | expiration_bytes | grantee_addr_len (1 byte) | grantee_addr_bytes | granter_addr_len (1 byte) | granter_addr_bytes -> EmptyBytes
Messages
Msg/GrantAllowance
A fee allowance grant will be created with the MsgGrantAllowance
message.
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/tx.proto#L25-L39
Msg/RevokeAllowance
An allowed grant fee allowance can be removed with the MsgRevokeAllowance
message.
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/feegrant/v1beta1/tx.proto#L41-L54
Events
The feegrant module emits the following events:
Msg Server
MsgGrantAllowance
Type | Attribute Key | Attribute Value |
---|---|---|
message | action | set_feegrant |
message | granter | {granterAddress} |
message | grantee | {granteeAddress} |
MsgRevokeAllowance
Type | Attribute Key | Attribute Value |
---|---|---|
message | action | revoke_feegrant |
message | granter | {granterAddress} |
message | grantee | {granteeAddress} |
Exec fee allowance
Type | Attribute Key | Attribute Value |
---|---|---|
message | action | use_feegrant |
message | granter | {granterAddress} |
message | grantee | {granteeAddress} |
Client
CLI
A user can query and interact with the feegrant
module using the CLI.
Query
The query
commands allow users to query feegrant
state.
simd query feegrant --help
grant
The grant
command allows users to query a grant for a given granter-grantee pair.
simd query feegrant grant [granter] [grantee] [flags]
Example:
simd query feegrant grant cosmos1.. cosmos1..
Example Output:
allowance:
'@type': /cosmos.feegrant.v1beta1.BasicAllowance
expiration: null
spend_limit:
- amount: "100"
denom: stake
grantee: cosmos1..
granter: cosmos1..
grants
The grants
command allows users to query all grants for a given grantee.
simd query feegrant grants [grantee] [flags]
Example:
simd query feegrant grants cosmos1..
Example Output:
allowances:
- allowance:
'@type': /cosmos.feegrant.v1beta1.BasicAllowance
expiration: null
spend_limit:
- amount: "100"
denom: stake
grantee: cosmos1..
granter: cosmos1..
pagination:
next_key: null
total: "0"
Transactions
The tx
commands allow users to interact with the feegrant
module.
simd tx feegrant --help
grant
The grant
command allows users to grant fee allowances to another account. The fee allowance can have an expiration date, a total spend limit, and/or a periodic spend limit.
simd tx feegrant grant [granter] [grantee] [flags]
Example (one-time spend limit):
simd tx feegrant grant cosmos1.. cosmos1.. --spend-limit 100stake
Example (periodic spend limit):
simd tx feegrant grant cosmos1.. cosmos1.. --period 3600 --period-limit 10stake
revoke
The revoke
command allows users to revoke a granted fee allowance.
simd tx feegrant revoke [granter] [grantee] [flags]
Example:
simd tx feegrant revoke cosmos1.. cosmos1..
gRPC
A user can query the feegrant
module using gRPC endpoints.
Allowance
The Allowance
endpoint allows users to query a granted fee allowance.
cosmos.feegrant.v1beta1.Query/Allowance
Example:
grpcurl -plaintext \
-d '{"grantee":"cosmos1..","granter":"cosmos1.."}' \
localhost:9090 \
cosmos.feegrant.v1beta1.Query/Allowance
Example Output:
{
"allowance": {
"granter": "cosmos1..",
"grantee": "cosmos1..",
"allowance": {"@type":"/cosmos.feegrant.v1beta1.BasicAllowance","spendLimit":[{"denom":"stake","amount":"100"}]}
}
}
Allowances
The Allowances
endpoint allows users to query all granted fee allowances for a given grantee.
cosmos.feegrant.v1beta1.Query/Allowances
Example:
grpcurl -plaintext \
-d '{"address":"cosmos1.."}' \
localhost:9090 \
cosmos.feegrant.v1beta1.Query/Allowances
Example Output:
{
"allowances": [
{
"granter": "cosmos1..",
"grantee": "cosmos1..",
"allowance": {"@type":"/cosmos.feegrant.v1beta1.BasicAllowance","spendLimit":[{"denom":"stake","amount":"100"}]}
}
],
"pagination": {
"total": "1"
}
}
Documentation
¶
Overview ¶
Package feegrant provides functionality for authorizing the payment of transaction fees from one account (key) to another account (key).
Effectively, this allows for a user to pay fees using the balance of an account different from their own. Example use cases would be allowing a key on a device to pay for fees using a master wallet, or a third party service allowing users to pay for transactions without ever really holding their own coins. This package provides ways for specifying fee allowances such that authorizing fee payment to another account can be done with clear and safe restrictions.
A user would authorize granting fee payment to another user using MsgGrantAllowance and revoke that delegation using MsgRevokeAllowance. In both cases, Granter is the one who is authorizing fee payment and Grantee is the one who is receiving the fee payment authorization. So grantee would correspond to the one who is signing a transaction and the granter would be the address that pays the fees.
The fee allowance that a grantee receives is specified by an implementation of the FeeAllowance interface. Two FeeAllowance implementations are provided in this package: BasicAllowance and PeriodicAllowance.
Package feegrant is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func AllowanceByExpTimeKey(exp *time.Time) []byte
- func FeeAllowanceKey(granter sdk.AccAddress, grantee sdk.AccAddress) []byte
- func FeeAllowancePrefixByGrantee(grantee sdk.AccAddress) []byte
- func FeeAllowancePrefixQueue(exp *time.Time, key []byte) []byte
- func ParseAddressesFromFeeAllowanceKey(key []byte) (granter, grantee sdk.AccAddress)
- func ParseAddressesFromFeeAllowanceQueueKey(key []byte) (granter, grantee sdk.AccAddress)
- func RegisterInterfaces(registry types.InterfaceRegistry)
- func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- func RegisterMsgServer(s grpc1.Server, srv MsgServer)
- func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error
- func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error
- func RegisterQueryServer(s grpc1.Server, srv QueryServer)
- func ValidateGenesis(data GenesisState) error
- type AccountKeeper
- type AllowedMsgAllowance
- func (a *AllowedMsgAllowance) Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk.Msg) (bool, error)
- func (*AllowedMsgAllowance) Descriptor() ([]byte, []int)
- func (a *AllowedMsgAllowance) ExpiresAt() (*time.Time, error)
- func (a *AllowedMsgAllowance) GetAllowance() (FeeAllowanceI, error)
- func (m *AllowedMsgAllowance) Marshal() (dAtA []byte, err error)
- func (m *AllowedMsgAllowance) MarshalTo(dAtA []byte) (int, error)
- func (m *AllowedMsgAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*AllowedMsgAllowance) ProtoMessage()
- func (m *AllowedMsgAllowance) Reset()
- func (a *AllowedMsgAllowance) SetAllowance(allowance FeeAllowanceI) error
- func (m *AllowedMsgAllowance) Size() (n int)
- func (m *AllowedMsgAllowance) String() string
- func (m *AllowedMsgAllowance) Unmarshal(dAtA []byte) error
- func (a *AllowedMsgAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error
- func (a *AllowedMsgAllowance) ValidateBasic() error
- func (m *AllowedMsgAllowance) XXX_DiscardUnknown()
- func (m *AllowedMsgAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AllowedMsgAllowance) XXX_Merge(src proto.Message)
- func (m *AllowedMsgAllowance) XXX_Size() int
- func (m *AllowedMsgAllowance) XXX_Unmarshal(b []byte) error
- type BankKeeper
- type BasicAllowance
- func (a *BasicAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error)
- func (*BasicAllowance) Descriptor() ([]byte, []int)
- func (a BasicAllowance) ExpiresAt() (*time.Time, error)
- func (m *BasicAllowance) GetExpiration() *time.Time
- func (m *BasicAllowance) GetSpendLimit() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *BasicAllowance) Marshal() (dAtA []byte, err error)
- func (m *BasicAllowance) MarshalTo(dAtA []byte) (int, error)
- func (m *BasicAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*BasicAllowance) ProtoMessage()
- func (m *BasicAllowance) Reset()
- func (m *BasicAllowance) Size() (n int)
- func (m *BasicAllowance) String() string
- func (m *BasicAllowance) Unmarshal(dAtA []byte) error
- func (a BasicAllowance) ValidateBasic() error
- func (m *BasicAllowance) XXX_DiscardUnknown()
- func (m *BasicAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *BasicAllowance) XXX_Merge(src proto.Message)
- func (m *BasicAllowance) XXX_Size() int
- func (m *BasicAllowance) XXX_Unmarshal(b []byte) error
- type FeeAllowanceI
- type GenesisState
- func (*GenesisState) Descriptor() ([]byte, []int)
- func (m *GenesisState) GetAllowances() []Grant
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error
- func (m *GenesisState) XXX_DiscardUnknown()
- func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisState) XXX_Merge(src proto.Message)
- func (m *GenesisState) XXX_Size() int
- func (m *GenesisState) XXX_Unmarshal(b []byte) error
- type Grant
- func (*Grant) Descriptor() ([]byte, []int)
- func (m *Grant) GetAllowance() *types1.Any
- func (a Grant) GetGrant() (FeeAllowanceI, error)
- func (m *Grant) GetGrantee() string
- func (m *Grant) GetGranter() string
- func (m *Grant) Marshal() (dAtA []byte, err error)
- func (m *Grant) MarshalTo(dAtA []byte) (int, error)
- func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Grant) ProtoMessage()
- func (m *Grant) Reset()
- func (m *Grant) Size() (n int)
- func (m *Grant) String() string
- func (m *Grant) Unmarshal(dAtA []byte) error
- func (a Grant) UnpackInterfaces(unpacker types.AnyUnpacker) error
- func (a Grant) ValidateBasic() error
- func (m *Grant) XXX_DiscardUnknown()
- func (m *Grant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Grant) XXX_Merge(src proto.Message)
- func (m *Grant) XXX_Size() int
- func (m *Grant) XXX_Unmarshal(b []byte) error
- type MsgClient
- type MsgGrantAllowance
- func (*MsgGrantAllowance) Descriptor() ([]byte, []int)
- func (m *MsgGrantAllowance) GetAllowance() *types.Any
- func (msg MsgGrantAllowance) GetFeeAllowanceI() (FeeAllowanceI, error)
- func (m *MsgGrantAllowance) GetGrantee() string
- func (m *MsgGrantAllowance) GetGranter() string
- func (msg MsgGrantAllowance) GetSignBytes() []byte
- func (msg MsgGrantAllowance) GetSigners() []sdk.AccAddress
- func (m *MsgGrantAllowance) Marshal() (dAtA []byte, err error)
- func (m *MsgGrantAllowance) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgGrantAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgGrantAllowance) ProtoMessage()
- func (m *MsgGrantAllowance) Reset()
- func (msg MsgGrantAllowance) Route() string
- func (m *MsgGrantAllowance) Size() (n int)
- func (m *MsgGrantAllowance) String() string
- func (msg MsgGrantAllowance) Type() string
- func (m *MsgGrantAllowance) Unmarshal(dAtA []byte) error
- func (msg MsgGrantAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error
- func (msg MsgGrantAllowance) ValidateBasic() error
- func (m *MsgGrantAllowance) XXX_DiscardUnknown()
- func (m *MsgGrantAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgGrantAllowance) XXX_Merge(src proto.Message)
- func (m *MsgGrantAllowance) XXX_Size() int
- func (m *MsgGrantAllowance) XXX_Unmarshal(b []byte) error
- type MsgGrantAllowanceResponse
- func (*MsgGrantAllowanceResponse) Descriptor() ([]byte, []int)
- func (m *MsgGrantAllowanceResponse) Marshal() (dAtA []byte, err error)
- func (m *MsgGrantAllowanceResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgGrantAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgGrantAllowanceResponse) ProtoMessage()
- func (m *MsgGrantAllowanceResponse) Reset()
- func (m *MsgGrantAllowanceResponse) Size() (n int)
- func (m *MsgGrantAllowanceResponse) String() string
- func (m *MsgGrantAllowanceResponse) Unmarshal(dAtA []byte) error
- func (m *MsgGrantAllowanceResponse) XXX_DiscardUnknown()
- func (m *MsgGrantAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgGrantAllowanceResponse) XXX_Merge(src proto.Message)
- func (m *MsgGrantAllowanceResponse) XXX_Size() int
- func (m *MsgGrantAllowanceResponse) XXX_Unmarshal(b []byte) error
- type MsgRevokeAllowance
- func (*MsgRevokeAllowance) Descriptor() ([]byte, []int)
- func (m *MsgRevokeAllowance) GetGrantee() string
- func (m *MsgRevokeAllowance) GetGranter() string
- func (msg MsgRevokeAllowance) GetSignBytes() []byte
- func (msg MsgRevokeAllowance) GetSigners() []sdk.AccAddress
- func (m *MsgRevokeAllowance) Marshal() (dAtA []byte, err error)
- func (m *MsgRevokeAllowance) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgRevokeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgRevokeAllowance) ProtoMessage()
- func (m *MsgRevokeAllowance) Reset()
- func (msg MsgRevokeAllowance) Route() string
- func (m *MsgRevokeAllowance) Size() (n int)
- func (m *MsgRevokeAllowance) String() string
- func (msg MsgRevokeAllowance) Type() string
- func (m *MsgRevokeAllowance) Unmarshal(dAtA []byte) error
- func (msg MsgRevokeAllowance) ValidateBasic() error
- func (m *MsgRevokeAllowance) XXX_DiscardUnknown()
- func (m *MsgRevokeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgRevokeAllowance) XXX_Merge(src proto.Message)
- func (m *MsgRevokeAllowance) XXX_Size() int
- func (m *MsgRevokeAllowance) XXX_Unmarshal(b []byte) error
- type MsgRevokeAllowanceResponse
- func (*MsgRevokeAllowanceResponse) Descriptor() ([]byte, []int)
- func (m *MsgRevokeAllowanceResponse) Marshal() (dAtA []byte, err error)
- func (m *MsgRevokeAllowanceResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgRevokeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgRevokeAllowanceResponse) ProtoMessage()
- func (m *MsgRevokeAllowanceResponse) Reset()
- func (m *MsgRevokeAllowanceResponse) Size() (n int)
- func (m *MsgRevokeAllowanceResponse) String() string
- func (m *MsgRevokeAllowanceResponse) Unmarshal(dAtA []byte) error
- func (m *MsgRevokeAllowanceResponse) XXX_DiscardUnknown()
- func (m *MsgRevokeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgRevokeAllowanceResponse) XXX_Merge(src proto.Message)
- func (m *MsgRevokeAllowanceResponse) XXX_Size() int
- func (m *MsgRevokeAllowanceResponse) XXX_Unmarshal(b []byte) error
- type MsgServer
- type PeriodicAllowance
- func (a *PeriodicAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error)
- func (*PeriodicAllowance) Descriptor() ([]byte, []int)
- func (a PeriodicAllowance) ExpiresAt() (*time.Time, error)
- func (m *PeriodicAllowance) GetBasic() BasicAllowance
- func (m *PeriodicAllowance) GetPeriod() time.Duration
- func (m *PeriodicAllowance) GetPeriodCanSpend() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *PeriodicAllowance) GetPeriodReset() time.Time
- func (m *PeriodicAllowance) GetPeriodSpendLimit() github_com_cosmos_cosmos_sdk_types.Coins
- func (m *PeriodicAllowance) Marshal() (dAtA []byte, err error)
- func (m *PeriodicAllowance) MarshalTo(dAtA []byte) (int, error)
- func (m *PeriodicAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*PeriodicAllowance) ProtoMessage()
- func (m *PeriodicAllowance) Reset()
- func (m *PeriodicAllowance) Size() (n int)
- func (m *PeriodicAllowance) String() string
- func (m *PeriodicAllowance) Unmarshal(dAtA []byte) error
- func (a PeriodicAllowance) ValidateBasic() error
- func (m *PeriodicAllowance) XXX_DiscardUnknown()
- func (m *PeriodicAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PeriodicAllowance) XXX_Merge(src proto.Message)
- func (m *PeriodicAllowance) XXX_Size() int
- func (m *PeriodicAllowance) XXX_Unmarshal(b []byte) error
- type QueryAllowanceRequest
- func (*QueryAllowanceRequest) Descriptor() ([]byte, []int)
- func (m *QueryAllowanceRequest) GetGrantee() string
- func (m *QueryAllowanceRequest) GetGranter() string
- func (m *QueryAllowanceRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryAllowanceRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryAllowanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryAllowanceRequest) ProtoMessage()
- func (m *QueryAllowanceRequest) Reset()
- func (m *QueryAllowanceRequest) Size() (n int)
- func (m *QueryAllowanceRequest) String() string
- func (m *QueryAllowanceRequest) Unmarshal(dAtA []byte) error
- func (m *QueryAllowanceRequest) XXX_DiscardUnknown()
- func (m *QueryAllowanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryAllowanceRequest) XXX_Merge(src proto.Message)
- func (m *QueryAllowanceRequest) XXX_Size() int
- func (m *QueryAllowanceRequest) XXX_Unmarshal(b []byte) error
- type QueryAllowanceResponse
- func (*QueryAllowanceResponse) Descriptor() ([]byte, []int)
- func (m *QueryAllowanceResponse) GetAllowance() *Grant
- func (m *QueryAllowanceResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryAllowanceResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryAllowanceResponse) ProtoMessage()
- func (m *QueryAllowanceResponse) Reset()
- func (m *QueryAllowanceResponse) Size() (n int)
- func (m *QueryAllowanceResponse) String() string
- func (m *QueryAllowanceResponse) Unmarshal(dAtA []byte) error
- func (m *QueryAllowanceResponse) XXX_DiscardUnknown()
- func (m *QueryAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryAllowanceResponse) XXX_Merge(src proto.Message)
- func (m *QueryAllowanceResponse) XXX_Size() int
- func (m *QueryAllowanceResponse) XXX_Unmarshal(b []byte) error
- type QueryAllowancesByGranterRequest
- func (*QueryAllowancesByGranterRequest) Descriptor() ([]byte, []int)
- func (m *QueryAllowancesByGranterRequest) GetGranter() string
- func (m *QueryAllowancesByGranterRequest) GetPagination() *query.PageRequest
- func (m *QueryAllowancesByGranterRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryAllowancesByGranterRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryAllowancesByGranterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryAllowancesByGranterRequest) ProtoMessage()
- func (m *QueryAllowancesByGranterRequest) Reset()
- func (m *QueryAllowancesByGranterRequest) Size() (n int)
- func (m *QueryAllowancesByGranterRequest) String() string
- func (m *QueryAllowancesByGranterRequest) Unmarshal(dAtA []byte) error
- func (m *QueryAllowancesByGranterRequest) XXX_DiscardUnknown()
- func (m *QueryAllowancesByGranterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryAllowancesByGranterRequest) XXX_Merge(src proto.Message)
- func (m *QueryAllowancesByGranterRequest) XXX_Size() int
- func (m *QueryAllowancesByGranterRequest) XXX_Unmarshal(b []byte) error
- type QueryAllowancesByGranterResponse
- func (*QueryAllowancesByGranterResponse) Descriptor() ([]byte, []int)
- func (m *QueryAllowancesByGranterResponse) GetAllowances() []*Grant
- func (m *QueryAllowancesByGranterResponse) GetPagination() *query.PageResponse
- func (m *QueryAllowancesByGranterResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryAllowancesByGranterResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryAllowancesByGranterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryAllowancesByGranterResponse) ProtoMessage()
- func (m *QueryAllowancesByGranterResponse) Reset()
- func (m *QueryAllowancesByGranterResponse) Size() (n int)
- func (m *QueryAllowancesByGranterResponse) String() string
- func (m *QueryAllowancesByGranterResponse) Unmarshal(dAtA []byte) error
- func (m *QueryAllowancesByGranterResponse) XXX_DiscardUnknown()
- func (m *QueryAllowancesByGranterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryAllowancesByGranterResponse) XXX_Merge(src proto.Message)
- func (m *QueryAllowancesByGranterResponse) XXX_Size() int
- func (m *QueryAllowancesByGranterResponse) XXX_Unmarshal(b []byte) error
- type QueryAllowancesRequest
- func (*QueryAllowancesRequest) Descriptor() ([]byte, []int)
- func (m *QueryAllowancesRequest) GetGrantee() string
- func (m *QueryAllowancesRequest) GetPagination() *query.PageRequest
- func (m *QueryAllowancesRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryAllowancesRequest) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryAllowancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryAllowancesRequest) ProtoMessage()
- func (m *QueryAllowancesRequest) Reset()
- func (m *QueryAllowancesRequest) Size() (n int)
- func (m *QueryAllowancesRequest) String() string
- func (m *QueryAllowancesRequest) Unmarshal(dAtA []byte) error
- func (m *QueryAllowancesRequest) XXX_DiscardUnknown()
- func (m *QueryAllowancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryAllowancesRequest) XXX_Merge(src proto.Message)
- func (m *QueryAllowancesRequest) XXX_Size() int
- func (m *QueryAllowancesRequest) XXX_Unmarshal(b []byte) error
- type QueryAllowancesResponse
- func (*QueryAllowancesResponse) Descriptor() ([]byte, []int)
- func (m *QueryAllowancesResponse) GetAllowances() []*Grant
- func (m *QueryAllowancesResponse) GetPagination() *query.PageResponse
- func (m *QueryAllowancesResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryAllowancesResponse) MarshalTo(dAtA []byte) (int, error)
- func (m *QueryAllowancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*QueryAllowancesResponse) ProtoMessage()
- func (m *QueryAllowancesResponse) Reset()
- func (m *QueryAllowancesResponse) Size() (n int)
- func (m *QueryAllowancesResponse) String() string
- func (m *QueryAllowancesResponse) Unmarshal(dAtA []byte) error
- func (m *QueryAllowancesResponse) XXX_DiscardUnknown()
- func (m *QueryAllowancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *QueryAllowancesResponse) XXX_Merge(src proto.Message)
- func (m *QueryAllowancesResponse) XXX_Size() int
- func (m *QueryAllowancesResponse) XXX_Unmarshal(b []byte) error
- type QueryClient
- type QueryServer
- type UnimplementedMsgServer
- type UnimplementedQueryServer
- func (*UnimplementedQueryServer) Allowance(ctx context.Context, req *QueryAllowanceRequest) (*QueryAllowanceResponse, error)
- func (*UnimplementedQueryServer) Allowances(ctx context.Context, req *QueryAllowancesRequest) (*QueryAllowancesResponse, error)
- func (*UnimplementedQueryServer) AllowancesByGranter(ctx context.Context, req *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error)
Constants ¶
const (
EventTypeUseFeeGrant = "use_feegrant"
EventTypeRevokeFeeGrant = "revoke_feegrant"
EventTypeSetFeeGrant = "set_feegrant"
EventTypeUpdateFeeGrant = "update_feegrant"
AttributeKeyGranter = "granter"
AttributeKeyGrantee = "grantee"
)
evidence module events
const (
// ModuleName is the module name constant used in many places
ModuleName = "feegrant"
// StoreKey is the store key string for supply
StoreKey = ModuleName
// RouterKey is the message route for supply
RouterKey = ModuleName
// QuerierRoute is the querier route for supply
QuerierRoute = ModuleName
)
const (
DefaultCodespace = ModuleName
)
Codes for governance errors
Variables ¶
var (
// ErrFeeLimitExceeded error if there are not enough allowance to cover the fees
ErrFeeLimitExceeded = sdkerrors.Register(DefaultCodespace, 2, "fee limit exceeded")
// ErrFeeLimitExpired error if the allowance has expired
ErrFeeLimitExpired = sdkerrors.Register(DefaultCodespace, 3, "fee allowance expired")
// ErrInvalidDuration error if the Duration is invalid or doesn't match the expiration
ErrInvalidDuration = sdkerrors.Register(DefaultCodespace, 4, "invalid duration")
// ErrNoAllowance error if there is no allowance for that pair
ErrNoAllowance = sdkerrors.Register(DefaultCodespace, 5, "no allowance")
// ErrNoMessages error if there is no message
ErrNoMessages = sdkerrors.Register(DefaultCodespace, 6, "allowed messages are empty")
// ErrMessageNotAllowed error if message is not allowed
ErrMessageNotAllowed = sdkerrors.Register(DefaultCodespace, 7, "message not allowed")
)
var (
ErrInvalidLengthFeegrant = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowFeegrant = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupFeegrant = fmt.Errorf("proto: unexpected end of group")
)
var (
ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
var (
// FeeAllowanceKeyPrefix is the set of the kvstore for fee allowance data
// - 0x00<allowance_key_bytes>: allowance
FeeAllowanceKeyPrefix = []byte{0x00}
// FeeAllowanceQueueKeyPrefix is the set of the kvstore for fee allowance keys data
// - 0x01<allowance_prefix_queue_key_bytes>: <empty value>
FeeAllowanceQueueKeyPrefix = []byte{0x01}
)
var (
ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
var (
ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTx = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
var (
// ModuleCdc references the global x/feegrant module codec. Note, the codec should
// ONLY be used in certain instances of tests and for JSON encoding as Amino is
// still used for that purpose.
//
// The actual codec used for serialization should be provided to x/feegrant and
// defined at the application level.
ModuleCdc = codec.NewAminoCodec(amino)
)
Functions ¶
func AllowanceByExpTimeKey ¶ added in v0.46.0
func AllowanceByExpTimeKey(exp *time.Time) []byte
AllowanceByExpTimeKey returns a key with `FeeAllowanceQueueKeyPrefix`, expiry
Key format: - <0x01><exp_bytes>
func FeeAllowanceKey ¶
func FeeAllowanceKey(granter sdk.AccAddress, grantee sdk.AccAddress) []byte
FeeAllowanceKey is the canonical key to store a grant from granter to grantee We store by grantee first to allow searching by everyone who granted to you
Key format: - <0x00><len(grantee_address_bytes)><grantee_address_bytes><len(granter_address_bytes)><granter_address_bytes>
func FeeAllowancePrefixByGrantee ¶
func FeeAllowancePrefixByGrantee(grantee sdk.AccAddress) []byte
FeeAllowancePrefixByGrantee returns a prefix to scan for all grants to this given address.
Key format: - <0x00><len(grantee_address_bytes)><grantee_address_bytes>
func FeeAllowancePrefixQueue ¶ added in v0.46.0
func FeeAllowancePrefixQueue(exp *time.Time, key []byte) []byte
FeeAllowancePrefixQueue is the canonical key to store grant key.
Key format: - <0x01><exp_bytes><len(grantee_address_bytes)><grantee_address_bytes><len(granter_address_bytes)><granter_address_bytes>
func ParseAddressesFromFeeAllowanceKey ¶ added in v0.45.5
func ParseAddressesFromFeeAllowanceKey(key []byte) (granter, grantee sdk.AccAddress)
ParseAddressesFromFeeAllowanceKey extracts and returns the granter, grantee from the given key.
func ParseAddressesFromFeeAllowanceQueueKey ¶ added in v0.46.0
func ParseAddressesFromFeeAllowanceQueueKey(key []byte) (granter, grantee sdk.AccAddress)
ParseAddressesFromFeeAllowanceQueueKey extracts and returns the granter, grantee from the given key.
func RegisterInterfaces ¶
func RegisterInterfaces(registry types.InterfaceRegistry)
RegisterInterfaces registers the interfaces types with the interface registry
func RegisterLegacyAminoCodec ¶ added in v0.46.0
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterLegacyAminoCodec registers the necessary x/feegrant interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization.
func RegisterMsgServer ¶
func RegisterMsgServer(s grpc1.Server, srv MsgServer)
func RegisterQueryHandler ¶
func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterQueryHandlerClient ¶
func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error
RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.
func RegisterQueryHandlerFromEndpoint ¶
func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQueryHandlerServer ¶
func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error
RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryServer ¶
func RegisterQueryServer(s grpc1.Server, srv QueryServer)
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis ensures all grants in the genesis state are valid
Types ¶
type AccountKeeper ¶
type AccountKeeper interface {
GetModuleAddress(moduleName string) sdk.AccAddress
GetModuleAccount(ctx sdk.Context, moduleName string) auth.ModuleAccountI
NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) auth.AccountI
GetAccount(ctx sdk.Context, addr sdk.AccAddress) auth.AccountI
SetAccount(ctx sdk.Context, acc auth.AccountI)
}
AccountKeeper defines the expected auth Account Keeper (noalias)
type AllowedMsgAllowance ¶
type AllowedMsgAllowance struct {
// allowance can be any of basic and periodic fee allowance.
Allowance *types1.Any `protobuf:"bytes,1,opt,name=allowance,proto3" json:"allowance,omitempty"`
// allowed_messages are the messages for which the grantee has the access.
AllowedMessages []string `protobuf:"bytes,2,rep,name=allowed_messages,json=allowedMessages,proto3" json:"allowed_messages,omitempty"`
}
AllowedMsgAllowance creates allowance only for specified message types.
func NewAllowedMsgAllowance ¶
func NewAllowedMsgAllowance(allowance FeeAllowanceI, allowedMsgs []string) (*AllowedMsgAllowance, error)
NewAllowedMsgFeeAllowance creates new filtered fee allowance.
func (*AllowedMsgAllowance) Accept ¶
func (a *AllowedMsgAllowance) Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk.Msg) (bool, error)
Accept method checks for the filtered messages has valid expiry
func (*AllowedMsgAllowance) Descriptor ¶
func (*AllowedMsgAllowance) Descriptor() ([]byte, []int)
func (*AllowedMsgAllowance) ExpiresAt ¶ added in v0.46.0
func (a *AllowedMsgAllowance) ExpiresAt() (*time.Time, error)
func (*AllowedMsgAllowance) GetAllowance ¶
func (a *AllowedMsgAllowance) GetAllowance() (FeeAllowanceI, error)
GetAllowance returns allowed fee allowance.
func (*AllowedMsgAllowance) Marshal ¶
func (m *AllowedMsgAllowance) Marshal() (dAtA []byte, err error)
func (*AllowedMsgAllowance) MarshalTo ¶
func (m *AllowedMsgAllowance) MarshalTo(dAtA []byte) (int, error)
func (*AllowedMsgAllowance) MarshalToSizedBuffer ¶
func (m *AllowedMsgAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*AllowedMsgAllowance) ProtoMessage ¶
func (*AllowedMsgAllowance) ProtoMessage()
func (*AllowedMsgAllowance) SetAllowance ¶ added in v0.46.0
func (a *AllowedMsgAllowance) SetAllowance(allowance FeeAllowanceI) error
SetAllowance sets allowed fee allowance.
func (*AllowedMsgAllowance) UnpackInterfaces ¶
func (a *AllowedMsgAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error
UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (*AllowedMsgAllowance) ValidateBasic ¶
func (a *AllowedMsgAllowance) ValidateBasic() error
ValidateBasic implements FeeAllowance and enforces basic sanity checks
func (*AllowedMsgAllowance) XXX_DiscardUnknown ¶
func (m *AllowedMsgAllowance) XXX_DiscardUnknown()
func (*AllowedMsgAllowance) XXX_Marshal ¶
func (m *AllowedMsgAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AllowedMsgAllowance) XXX_Unmarshal ¶
func (m *AllowedMsgAllowance) XXX_Unmarshal(b []byte) error
type BankKeeper ¶
type BankKeeper interface {
SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}
BankKeeper defines the expected supply Keeper (noalias)
type BasicAllowance ¶
type BasicAllowance struct {
// spend_limit specifies the maximum amount of coins that can be spent
// by this allowance and will be updated as coins are spent. If it is
// empty, there is no spend limit and any amount of coins can be spent.
SpendLimit github_com_cosmos_cosmos_sdk_types.Coins `` /* 135-byte string literal not displayed */
// expiration specifies an optional time when this allowance expires
Expiration *time.Time `protobuf:"bytes,2,opt,name=expiration,proto3,stdtime" json:"expiration,omitempty"`
}
BasicAllowance implements Allowance with a one-time grant of coins that optionally expires. The grantee can use up to SpendLimit to cover fees.
func (*BasicAllowance) Accept ¶
func (a *BasicAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error)
Accept can use fee payment requested as well as timestamp of the current block to determine whether or not to process this. This is checked in Keeper.UseGrantedFees and the return values should match how it is handled there.
If it returns an error, the fee payment is rejected, otherwise it is accepted. The FeeAllowance implementation is expected to update it's internal state and will be saved again after an acceptance.
If remove is true (regardless of the error), the FeeAllowance will be deleted from storage (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees)
func (*BasicAllowance) Descriptor ¶
func (*BasicAllowance) Descriptor() ([]byte, []int)
func (BasicAllowance) ExpiresAt ¶ added in v0.46.0
func (a BasicAllowance) ExpiresAt() (*time.Time, error)
func (*BasicAllowance) GetExpiration ¶
func (m *BasicAllowance) GetExpiration() *time.Time
func (*BasicAllowance) GetSpendLimit ¶
func (m *BasicAllowance) GetSpendLimit() github_com_cosmos_cosmos_sdk_types.Coins
func (*BasicAllowance) MarshalToSizedBuffer ¶
func (m *BasicAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*BasicAllowance) ProtoMessage ¶
func (*BasicAllowance) ProtoMessage()
func (BasicAllowance) ValidateBasic ¶
func (a BasicAllowance) ValidateBasic() error
ValidateBasic implements FeeAllowance and enforces basic sanity checks
func (*BasicAllowance) XXX_DiscardUnknown ¶
func (m *BasicAllowance) XXX_DiscardUnknown()
func (*BasicAllowance) XXX_Marshal ¶
func (m *BasicAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*BasicAllowance) XXX_Unmarshal ¶
func (m *BasicAllowance) XXX_Unmarshal(b []byte) error
type FeeAllowanceI ¶
type FeeAllowanceI interface {
// Accept can use fee payment requested as well as timestamp of the current block
// to determine whether or not to process this. This is checked in
// Keeper.UseGrantedFees and the return values should match how it is handled there.
//
// If it returns an error, the fee payment is rejected, otherwise it is accepted.
// The FeeAllowance implementation is expected to update it's internal state
// and will be saved again after an acceptance.
//
// If remove is true (regardless of the error), the FeeAllowance will be deleted from storage
// (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees)
Accept(ctx sdk.Context, fee sdk.Coins, msgs []sdk.Msg) (remove bool, err error)
// ValidateBasic should evaluate this FeeAllowance for internal consistency.
// Don't allow negative amounts, or negative periods for example.
ValidateBasic() error
// ExpiresAt returns the expiry time of the allowance.
ExpiresAt() (*time.Time, error)
}
FeeAllowance implementations are tied to a given fee delegator and delegatee, and are used to enforce fee grant limits.
type GenesisState ¶
type GenesisState struct {
Allowances []Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances"`
}
GenesisState contains a set of fee allowances, persisted from the store
func DefaultGenesisState ¶
func DefaultGenesisState() *GenesisState
DefaultGenesisState returns default state for feegrant module.
func NewGenesisState ¶
func NewGenesisState(entries []Grant) *GenesisState
NewGenesisState creates new GenesisState object
func (*GenesisState) Descriptor ¶
func (*GenesisState) Descriptor() ([]byte, []int)
func (*GenesisState) GetAllowances ¶
func (m *GenesisState) GetAllowances() []Grant
func (*GenesisState) MarshalToSizedBuffer ¶
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisState) ProtoMessage ¶
func (*GenesisState) ProtoMessage()
func (GenesisState) UnpackInterfaces ¶
func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error
UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (*GenesisState) XXX_DiscardUnknown ¶
func (m *GenesisState) XXX_DiscardUnknown()
func (*GenesisState) XXX_Marshal ¶
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GenesisState) XXX_Unmarshal ¶
func (m *GenesisState) XXX_Unmarshal(b []byte) error
type Grant ¶
type Grant struct {
// granter is the address of the user granting an allowance of their funds.
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
// grantee is the address of the user being granted an allowance of another user's funds.
Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
// allowance can be any of basic, periodic, allowed fee allowance.
Allowance *types1.Any `protobuf:"bytes,3,opt,name=allowance,proto3" json:"allowance,omitempty"`
}
Grant is stored in the KVStore to record a grant with full context
func NewGrant ¶
func NewGrant(granter, grantee sdk.AccAddress, feeAllowance FeeAllowanceI) (Grant, error)
NewGrant creates a new FeeAllowanceGrant.
func (*Grant) Descriptor ¶
func (*Grant) Descriptor() ([]byte, []int)
func (*Grant) GetAllowance ¶
func (m *Grant) GetAllowance() *types1.Any
func (*Grant) GetGrantee ¶
func (m *Grant) GetGrantee() string
func (*Grant) GetGranter ¶
func (m *Grant) GetGranter() string
func (*Grant) MarshalToSizedBuffer ¶
func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Grant) ProtoMessage ¶
func (*Grant) ProtoMessage()
func (Grant) UnpackInterfaces ¶
func (a Grant) UnpackInterfaces(unpacker types.AnyUnpacker) error
UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (Grant) ValidateBasic ¶
func (a Grant) ValidateBasic() error
ValidateBasic performs basic validation on FeeAllowanceGrant
func (*Grant) XXX_DiscardUnknown ¶
func (m *Grant) XXX_DiscardUnknown()
func (*Grant) XXX_Marshal ¶
func (m *Grant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Grant) XXX_Unmarshal ¶
func (m *Grant) XXX_Unmarshal(b []byte) error
type MsgClient ¶
type MsgClient interface {
// GrantAllowance grants fee allowance to the grantee on the granter's
// account with the provided expiration time.
GrantAllowance(ctx context.Context, in *MsgGrantAllowance, opts ...grpc.CallOption) (*MsgGrantAllowanceResponse, error)
// RevokeAllowance revokes any fee allowance of granter's account that
// has been granted to the grantee.
RevokeAllowance(ctx context.Context, in *MsgRevokeAllowance, opts ...grpc.CallOption) (*MsgRevokeAllowanceResponse, error)
}
MsgClient is the client API for Msg service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewMsgClient ¶
func NewMsgClient(cc grpc1.ClientConn) MsgClient
type MsgGrantAllowance ¶
type MsgGrantAllowance struct {
// granter is the address of the user granting an allowance of their funds.
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
// grantee is the address of the user being granted an allowance of another user's funds.
Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
// allowance can be any of basic, periodic, allowed fee allowance.
Allowance *types.Any `protobuf:"bytes,3,opt,name=allowance,proto3" json:"allowance,omitempty"`
}
MsgGrantAllowance adds permission for Grantee to spend up to Allowance of fees from the account of Granter.
func NewMsgGrantAllowance ¶
func NewMsgGrantAllowance(feeAllowance FeeAllowanceI, granter, grantee sdk.AccAddress) (*MsgGrantAllowance, error)
NewMsgGrantAllowance creates a new MsgGrantAllowance.
func (*MsgGrantAllowance) Descriptor ¶
func (*MsgGrantAllowance) Descriptor() ([]byte, []int)
func (*MsgGrantAllowance) GetAllowance ¶
func (m *MsgGrantAllowance) GetAllowance() *types.Any
func (MsgGrantAllowance) GetFeeAllowanceI ¶
func (msg MsgGrantAllowance) GetFeeAllowanceI() (FeeAllowanceI, error)
GetFeeAllowanceI returns unpacked FeeAllowance
func (*MsgGrantAllowance) GetGrantee ¶
func (m *MsgGrantAllowance) GetGrantee() string
func (*MsgGrantAllowance) GetGranter ¶
func (m *MsgGrantAllowance) GetGranter() string
func (MsgGrantAllowance) GetSignBytes ¶
func (msg MsgGrantAllowance) GetSignBytes() []byte
GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (MsgGrantAllowance) GetSigners ¶
func (msg MsgGrantAllowance) GetSigners() []sdk.AccAddress
GetSigners gets the granter account associated with an allowance
func (*MsgGrantAllowance) MarshalTo ¶
func (m *MsgGrantAllowance) MarshalTo(dAtA []byte) (int, error)
func (*MsgGrantAllowance) MarshalToSizedBuffer ¶
func (m *MsgGrantAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgGrantAllowance) ProtoMessage ¶
func (*MsgGrantAllowance) ProtoMessage()
func (MsgGrantAllowance) Route ¶
func (msg MsgGrantAllowance) Route() string
Route implements the LegacyMsg.Route method.
func (MsgGrantAllowance) Type ¶
func (msg MsgGrantAllowance) Type() string
Type implements the LegacyMsg.Type method.
func (MsgGrantAllowance) UnpackInterfaces ¶
func (msg MsgGrantAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error
UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (MsgGrantAllowance) ValidateBasic ¶
func (msg MsgGrantAllowance) ValidateBasic() error
ValidateBasic implements the sdk.Msg interface.
func (*MsgGrantAllowance) XXX_DiscardUnknown ¶
func (m *MsgGrantAllowance) XXX_DiscardUnknown()
func (*MsgGrantAllowance) XXX_Marshal ¶
func (m *MsgGrantAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgGrantAllowance) XXX_Unmarshal ¶
func (m *MsgGrantAllowance) XXX_Unmarshal(b []byte) error
type MsgGrantAllowanceResponse ¶
type MsgGrantAllowanceResponse struct {
}
MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type.
func (*MsgGrantAllowanceResponse) Descriptor ¶
func (*MsgGrantAllowanceResponse) Descriptor() ([]byte, []int)
func (*MsgGrantAllowanceResponse) Marshal ¶
func (m *MsgGrantAllowanceResponse) Marshal() (dAtA []byte, err error)
func (*MsgGrantAllowanceResponse) MarshalTo ¶
func (m *MsgGrantAllowanceResponse) MarshalTo(dAtA []byte) (int, error)
func (*MsgGrantAllowanceResponse) MarshalToSizedBuffer ¶
func (m *MsgGrantAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgGrantAllowanceResponse) ProtoMessage ¶
func (*MsgGrantAllowanceResponse) ProtoMessage()
func (*MsgGrantAllowanceResponse) Unmarshal ¶
func (m *MsgGrantAllowanceResponse) Unmarshal(dAtA []byte) error
func (*MsgGrantAllowanceResponse) XXX_DiscardUnknown ¶
func (m *MsgGrantAllowanceResponse) XXX_DiscardUnknown()
func (*MsgGrantAllowanceResponse) XXX_Marshal ¶
func (m *MsgGrantAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgGrantAllowanceResponse) XXX_Merge ¶
func (m *MsgGrantAllowanceResponse) XXX_Merge(src proto.Message)
func (*MsgGrantAllowanceResponse) XXX_Unmarshal ¶
func (m *MsgGrantAllowanceResponse) XXX_Unmarshal(b []byte) error
type MsgRevokeAllowance ¶
type MsgRevokeAllowance struct {
// granter is the address of the user granting an allowance of their funds.
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
// grantee is the address of the user being granted an allowance of another user's funds.
Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
}
MsgRevokeAllowance removes any existing Allowance from Granter to Grantee.
func NewMsgRevokeAllowance ¶
func NewMsgRevokeAllowance(granter sdk.AccAddress, grantee sdk.AccAddress) MsgRevokeAllowance
NewMsgRevokeAllowance returns a message to revoke a fee allowance for a given granter and grantee
func (*MsgRevokeAllowance) Descriptor ¶
func (*MsgRevokeAllowance) Descriptor() ([]byte, []int)
func (*MsgRevokeAllowance) GetGrantee ¶
func (m *MsgRevokeAllowance) GetGrantee() string
func (*MsgRevokeAllowance) GetGranter ¶
func (m *MsgRevokeAllowance) GetGranter() string
func (MsgRevokeAllowance) GetSignBytes ¶
func (msg MsgRevokeAllowance) GetSignBytes() []byte
GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (MsgRevokeAllowance) GetSigners ¶
func (msg MsgRevokeAllowance) GetSigners() []sdk.AccAddress
GetSigners gets the granter address associated with an Allowance to revoke.
func (*MsgRevokeAllowance) Marshal ¶
func (m *MsgRevokeAllowance) Marshal() (dAtA []byte, err error)
func (*MsgRevokeAllowance) MarshalTo ¶
func (m *MsgRevokeAllowance) MarshalTo(dAtA []byte) (int, error)
func (*MsgRevokeAllowance) MarshalToSizedBuffer ¶
func (m *MsgRevokeAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgRevokeAllowance) ProtoMessage ¶
func (*MsgRevokeAllowance) ProtoMessage()
func (MsgRevokeAllowance) Route ¶
func (msg MsgRevokeAllowance) Route() string
Route implements the LegacyMsg.Route method.
func (MsgRevokeAllowance) Type ¶
func (msg MsgRevokeAllowance) Type() string
Type implements the LegacyMsg.Type method.
func (MsgRevokeAllowance) ValidateBasic ¶
func (msg MsgRevokeAllowance) ValidateBasic() error
ValidateBasic implements the sdk.Msg interface.
func (*MsgRevokeAllowance) XXX_DiscardUnknown ¶
func (m *MsgRevokeAllowance) XXX_DiscardUnknown()
func (*MsgRevokeAllowance) XXX_Marshal ¶
func (m *MsgRevokeAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgRevokeAllowance) XXX_Unmarshal ¶
func (m *MsgRevokeAllowance) XXX_Unmarshal(b []byte) error
type MsgRevokeAllowanceResponse ¶
type MsgRevokeAllowanceResponse struct {
}
MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type.
func (*MsgRevokeAllowanceResponse) Descriptor ¶
func (*MsgRevokeAllowanceResponse) Descriptor() ([]byte, []int)
func (*MsgRevokeAllowanceResponse) Marshal ¶
func (m *MsgRevokeAllowanceResponse) Marshal() (dAtA []byte, err error)
func (*MsgRevokeAllowanceResponse) MarshalTo ¶
func (m *MsgRevokeAllowanceResponse) MarshalTo(dAtA []byte) (int, error)
func (*MsgRevokeAllowanceResponse) MarshalToSizedBuffer ¶
func (m *MsgRevokeAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgRevokeAllowanceResponse) ProtoMessage ¶
func (*MsgRevokeAllowanceResponse) ProtoMessage()
func (*MsgRevokeAllowanceResponse) Unmarshal ¶
func (m *MsgRevokeAllowanceResponse) Unmarshal(dAtA []byte) error
func (*MsgRevokeAllowanceResponse) XXX_DiscardUnknown ¶
func (m *MsgRevokeAllowanceResponse) XXX_DiscardUnknown()
func (*MsgRevokeAllowanceResponse) XXX_Marshal ¶
func (m *MsgRevokeAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*MsgRevokeAllowanceResponse) XXX_Merge ¶
func (m *MsgRevokeAllowanceResponse) XXX_Merge(src proto.Message)
func (*MsgRevokeAllowanceResponse) XXX_Unmarshal ¶
func (m *MsgRevokeAllowanceResponse) XXX_Unmarshal(b []byte) error
type MsgServer ¶
type MsgServer interface {
// GrantAllowance grants fee allowance to the grantee on the granter's
// account with the provided expiration time.
GrantAllowance(context.Context, *MsgGrantAllowance) (*MsgGrantAllowanceResponse, error)
// RevokeAllowance revokes any fee allowance of granter's account that
// has been granted to the grantee.
RevokeAllowance(context.Context, *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error)
}
MsgServer is the server API for Msg service.
type PeriodicAllowance ¶
type PeriodicAllowance struct {
// basic specifies a struct of `BasicAllowance`
Basic BasicAllowance `protobuf:"bytes,1,opt,name=basic,proto3" json:"basic"`
// period specifies the time duration in which period_spend_limit coins can
// be spent before that allowance is reset
Period time.Duration `protobuf:"bytes,2,opt,name=period,proto3,stdduration" json:"period"`
// period_spend_limit specifies the maximum number of coins that can be spent
// in the period
PeriodSpendLimit github_com_cosmos_cosmos_sdk_types.Coins `` /* 155-byte string literal not displayed */
// period_can_spend is the number of coins left to be spent before the period_reset time
PeriodCanSpend github_com_cosmos_cosmos_sdk_types.Coins `` /* 149-byte string literal not displayed */
// period_reset is the time at which this period resets and a new one begins,
// it is calculated from the start time of the first transaction after the
// last period ended
PeriodReset time.Time `protobuf:"bytes,5,opt,name=period_reset,json=periodReset,proto3,stdtime" json:"period_reset"`
}
PeriodicAllowance extends Allowance to allow for both a maximum cap, as well as a limit per time period.
func (*PeriodicAllowance) Accept ¶
func (a *PeriodicAllowance) Accept(ctx sdk.Context, fee sdk.Coins, _ []sdk.Msg) (bool, error)
Accept can use fee payment requested as well as timestamp of the current block to determine whether or not to process this. This is checked in Keeper.UseGrantedFees and the return values should match how it is handled there.
If it returns an error, the fee payment is rejected, otherwise it is accepted. The FeeAllowance implementation is expected to update it's internal state and will be saved again after an acceptance.
If remove is true (regardless of the error), the FeeAllowance will be deleted from storage (eg. when it is used up). (See call to RevokeAllowance in Keeper.UseGrantedFees)
func (*PeriodicAllowance) Descriptor ¶
func (*PeriodicAllowance) Descriptor() ([]byte, []int)
func (PeriodicAllowance) ExpiresAt ¶ added in v0.46.0
func (a PeriodicAllowance) ExpiresAt() (*time.Time, error)
func (*PeriodicAllowance) GetPeriodCanSpend ¶
func (m *PeriodicAllowance) GetPeriodCanSpend() github_com_cosmos_cosmos_sdk_types.Coins
func (*PeriodicAllowance) GetPeriodReset ¶
func (m *PeriodicAllowance) GetPeriodReset() time.Time
func (*PeriodicAllowance) GetPeriodSpendLimit ¶
func (m *PeriodicAllowance) GetPeriodSpendLimit() github_com_cosmos_cosmos_sdk_types.Coins
func (*PeriodicAllowance) MarshalTo ¶
func (m *PeriodicAllowance) MarshalTo(dAtA []byte) (int, error)
func (*PeriodicAllowance) MarshalToSizedBuffer ¶
func (m *PeriodicAllowance) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*PeriodicAllowance) ProtoMessage ¶
func (*PeriodicAllowance) ProtoMessage()
func (PeriodicAllowance) ValidateBasic ¶
func (a PeriodicAllowance) ValidateBasic() error
ValidateBasic implements FeeAllowance and enforces basic sanity checks
func (*PeriodicAllowance) XXX_DiscardUnknown ¶
func (m *PeriodicAllowance) XXX_DiscardUnknown()
func (*PeriodicAllowance) XXX_Marshal ¶
func (m *PeriodicAllowance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PeriodicAllowance) XXX_Unmarshal ¶
func (m *PeriodicAllowance) XXX_Unmarshal(b []byte) error
type QueryAllowanceRequest ¶
type QueryAllowanceRequest struct {
// granter is the address of the user granting an allowance of their funds.
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
// grantee is the address of the user being granted an allowance of another user's funds.
Grantee string `protobuf:"bytes,2,opt,name=grantee,proto3" json:"grantee,omitempty"`
}
QueryAllowanceRequest is the request type for the Query/Allowance RPC method.
func (*QueryAllowanceRequest) Descriptor ¶
func (*QueryAllowanceRequest) Descriptor() ([]byte, []int)
func (*QueryAllowanceRequest) GetGrantee ¶
func (m *QueryAllowanceRequest) GetGrantee() string
func (*QueryAllowanceRequest) GetGranter ¶
func (m *QueryAllowanceRequest) GetGranter() string
func (*QueryAllowanceRequest) Marshal ¶
func (m *QueryAllowanceRequest) Marshal() (dAtA []byte, err error)
func (*QueryAllowanceRequest) MarshalTo ¶
func (m *QueryAllowanceRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryAllowanceRequest) MarshalToSizedBuffer ¶
func (m *QueryAllowanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAllowanceRequest) ProtoMessage ¶
func (*QueryAllowanceRequest) ProtoMessage()
func (*QueryAllowanceRequest) Unmarshal ¶
func (m *QueryAllowanceRequest) Unmarshal(dAtA []byte) error
func (*QueryAllowanceRequest) XXX_DiscardUnknown ¶
func (m *QueryAllowanceRequest) XXX_DiscardUnknown()
func (*QueryAllowanceRequest) XXX_Marshal ¶
func (m *QueryAllowanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryAllowanceRequest) XXX_Merge ¶
func (m *QueryAllowanceRequest) XXX_Merge(src proto.Message)
func (*QueryAllowanceRequest) XXX_Unmarshal ¶
func (m *QueryAllowanceRequest) XXX_Unmarshal(b []byte) error
type QueryAllowanceResponse ¶
type QueryAllowanceResponse struct {
// allowance is a allowance granted for grantee by granter.
Allowance *Grant `protobuf:"bytes,1,opt,name=allowance,proto3" json:"allowance,omitempty"`
}
QueryAllowanceResponse is the response type for the Query/Allowance RPC method.
func (*QueryAllowanceResponse) Descriptor ¶
func (*QueryAllowanceResponse) Descriptor() ([]byte, []int)
func (*QueryAllowanceResponse) GetAllowance ¶
func (m *QueryAllowanceResponse) GetAllowance() *Grant
func (*QueryAllowanceResponse) Marshal ¶
func (m *QueryAllowanceResponse) Marshal() (dAtA []byte, err error)
func (*QueryAllowanceResponse) MarshalTo ¶
func (m *QueryAllowanceResponse) MarshalTo(dAtA []byte) (int, error)
func (*QueryAllowanceResponse) MarshalToSizedBuffer ¶
func (m *QueryAllowanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAllowanceResponse) ProtoMessage ¶
func (*QueryAllowanceResponse) ProtoMessage()
func (*QueryAllowanceResponse) Unmarshal ¶
func (m *QueryAllowanceResponse) Unmarshal(dAtA []byte) error
func (*QueryAllowanceResponse) XXX_DiscardUnknown ¶
func (m *QueryAllowanceResponse) XXX_DiscardUnknown()
func (*QueryAllowanceResponse) XXX_Marshal ¶
func (m *QueryAllowanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryAllowanceResponse) XXX_Merge ¶
func (m *QueryAllowanceResponse) XXX_Merge(src proto.Message)
func (*QueryAllowanceResponse) XXX_Unmarshal ¶
func (m *QueryAllowanceResponse) XXX_Unmarshal(b []byte) error
type QueryAllowancesByGranterRequest ¶ added in v0.45.5
type QueryAllowancesByGranterRequest struct {
Granter string `protobuf:"bytes,1,opt,name=granter,proto3" json:"granter,omitempty"`
// pagination defines an pagination for the request.
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method.
Since: cosmos-sdk 0.46
func (*QueryAllowancesByGranterRequest) Descriptor ¶ added in v0.45.5
func (*QueryAllowancesByGranterRequest) Descriptor() ([]byte, []int)
func (*QueryAllowancesByGranterRequest) GetGranter ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) GetGranter() string
func (*QueryAllowancesByGranterRequest) GetPagination ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) GetPagination() *query.PageRequest
func (*QueryAllowancesByGranterRequest) Marshal ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) Marshal() (dAtA []byte, err error)
func (*QueryAllowancesByGranterRequest) MarshalTo ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryAllowancesByGranterRequest) MarshalToSizedBuffer ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAllowancesByGranterRequest) ProtoMessage ¶ added in v0.45.5
func (*QueryAllowancesByGranterRequest) ProtoMessage()
func (*QueryAllowancesByGranterRequest) Reset ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) Reset()
func (*QueryAllowancesByGranterRequest) Size ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) Size() (n int)
func (*QueryAllowancesByGranterRequest) String ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) String() string
func (*QueryAllowancesByGranterRequest) Unmarshal ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) Unmarshal(dAtA []byte) error
func (*QueryAllowancesByGranterRequest) XXX_DiscardUnknown ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) XXX_DiscardUnknown()
func (*QueryAllowancesByGranterRequest) XXX_Marshal ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryAllowancesByGranterRequest) XXX_Merge ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) XXX_Merge(src proto.Message)
func (*QueryAllowancesByGranterRequest) XXX_Size ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) XXX_Size() int
func (*QueryAllowancesByGranterRequest) XXX_Unmarshal ¶ added in v0.45.5
func (m *QueryAllowancesByGranterRequest) XXX_Unmarshal(b []byte) error
type QueryAllowancesByGranterResponse ¶ added in v0.45.5
type QueryAllowancesByGranterResponse struct {
// allowances that have been issued by the granter.
Allowances []*Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances,omitempty"`
// pagination defines an pagination for the response.
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.
Since: cosmos-sdk 0.46
func (*QueryAllowancesByGranterResponse) Descriptor ¶ added in v0.45.5
func (*QueryAllowancesByGranterResponse) Descriptor() ([]byte, []int)
func (*QueryAllowancesByGranterResponse) GetAllowances ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) GetAllowances() []*Grant
func (*QueryAllowancesByGranterResponse) GetPagination ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) GetPagination() *query.PageResponse
func (*QueryAllowancesByGranterResponse) Marshal ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) Marshal() (dAtA []byte, err error)
func (*QueryAllowancesByGranterResponse) MarshalTo ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) MarshalTo(dAtA []byte) (int, error)
func (*QueryAllowancesByGranterResponse) MarshalToSizedBuffer ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAllowancesByGranterResponse) ProtoMessage ¶ added in v0.45.5
func (*QueryAllowancesByGranterResponse) ProtoMessage()
func (*QueryAllowancesByGranterResponse) Reset ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) Reset()
func (*QueryAllowancesByGranterResponse) Size ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) Size() (n int)
func (*QueryAllowancesByGranterResponse) String ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) String() string
func (*QueryAllowancesByGranterResponse) Unmarshal ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) Unmarshal(dAtA []byte) error
func (*QueryAllowancesByGranterResponse) XXX_DiscardUnknown ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) XXX_DiscardUnknown()
func (*QueryAllowancesByGranterResponse) XXX_Marshal ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryAllowancesByGranterResponse) XXX_Merge ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) XXX_Merge(src proto.Message)
func (*QueryAllowancesByGranterResponse) XXX_Size ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) XXX_Size() int
func (*QueryAllowancesByGranterResponse) XXX_Unmarshal ¶ added in v0.45.5
func (m *QueryAllowancesByGranterResponse) XXX_Unmarshal(b []byte) error
type QueryAllowancesRequest ¶
type QueryAllowancesRequest struct {
Grantee string `protobuf:"bytes,1,opt,name=grantee,proto3" json:"grantee,omitempty"`
// pagination defines an pagination for the request.
Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
QueryAllowancesRequest is the request type for the Query/Allowances RPC method.
func (*QueryAllowancesRequest) Descriptor ¶
func (*QueryAllowancesRequest) Descriptor() ([]byte, []int)
func (*QueryAllowancesRequest) GetGrantee ¶
func (m *QueryAllowancesRequest) GetGrantee() string
func (*QueryAllowancesRequest) GetPagination ¶
func (m *QueryAllowancesRequest) GetPagination() *query.PageRequest
func (*QueryAllowancesRequest) Marshal ¶
func (m *QueryAllowancesRequest) Marshal() (dAtA []byte, err error)
func (*QueryAllowancesRequest) MarshalTo ¶
func (m *QueryAllowancesRequest) MarshalTo(dAtA []byte) (int, error)
func (*QueryAllowancesRequest) MarshalToSizedBuffer ¶
func (m *QueryAllowancesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAllowancesRequest) ProtoMessage ¶
func (*QueryAllowancesRequest) ProtoMessage()
func (*QueryAllowancesRequest) Unmarshal ¶
func (m *QueryAllowancesRequest) Unmarshal(dAtA []byte) error
func (*QueryAllowancesRequest) XXX_DiscardUnknown ¶
func (m *QueryAllowancesRequest) XXX_DiscardUnknown()
func (*QueryAllowancesRequest) XXX_Marshal ¶
func (m *QueryAllowancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryAllowancesRequest) XXX_Merge ¶
func (m *QueryAllowancesRequest) XXX_Merge(src proto.Message)
func (*QueryAllowancesRequest) XXX_Unmarshal ¶
func (m *QueryAllowancesRequest) XXX_Unmarshal(b []byte) error
type QueryAllowancesResponse ¶
type QueryAllowancesResponse struct {
// allowances are allowance's granted for grantee by granter.
Allowances []*Grant `protobuf:"bytes,1,rep,name=allowances,proto3" json:"allowances,omitempty"`
// pagination defines an pagination for the response.
Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
}
QueryAllowancesResponse is the response type for the Query/Allowances RPC method.
func (*QueryAllowancesResponse) Descriptor ¶
func (*QueryAllowancesResponse) Descriptor() ([]byte, []int)
func (*QueryAllowancesResponse) GetAllowances ¶
func (m *QueryAllowancesResponse) GetAllowances() []*Grant
func (*QueryAllowancesResponse) GetPagination ¶
func (m *QueryAllowancesResponse) GetPagination() *query.PageResponse
func (*QueryAllowancesResponse) Marshal ¶
func (m *QueryAllowancesResponse) Marshal() (dAtA []byte, err error)
func (*QueryAllowancesResponse) MarshalTo ¶
func (m *QueryAllowancesResponse) MarshalTo(dAtA []byte) (int, error)
func (*QueryAllowancesResponse) MarshalToSizedBuffer ¶
func (m *QueryAllowancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAllowancesResponse) ProtoMessage ¶
func (*QueryAllowancesResponse) ProtoMessage()
func (*QueryAllowancesResponse) Unmarshal ¶
func (m *QueryAllowancesResponse) Unmarshal(dAtA []byte) error
func (*QueryAllowancesResponse) XXX_DiscardUnknown ¶
func (m *QueryAllowancesResponse) XXX_DiscardUnknown()
func (*QueryAllowancesResponse) XXX_Marshal ¶
func (m *QueryAllowancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryAllowancesResponse) XXX_Merge ¶
func (m *QueryAllowancesResponse) XXX_Merge(src proto.Message)
func (*QueryAllowancesResponse) XXX_Unmarshal ¶
func (m *QueryAllowancesResponse) XXX_Unmarshal(b []byte) error
type QueryClient ¶
type QueryClient interface {
// Allowance returns fee granted to the grantee by the granter.
Allowance(ctx context.Context, in *QueryAllowanceRequest, opts ...grpc.CallOption) (*QueryAllowanceResponse, error)
// Allowances returns all the grants for address.
Allowances(ctx context.Context, in *QueryAllowancesRequest, opts ...grpc.CallOption) (*QueryAllowancesResponse, error)
// AllowancesByGranter returns all the grants given by an address
//
// Since: cosmos-sdk 0.46
AllowancesByGranter(ctx context.Context, in *QueryAllowancesByGranterRequest, opts ...grpc.CallOption) (*QueryAllowancesByGranterResponse, error)
}
QueryClient is the client API for Query service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewQueryClient ¶
func NewQueryClient(cc grpc1.ClientConn) QueryClient
type QueryServer ¶
type QueryServer interface {
// Allowance returns fee granted to the grantee by the granter.
Allowance(context.Context, *QueryAllowanceRequest) (*QueryAllowanceResponse, error)
// Allowances returns all the grants for address.
Allowances(context.Context, *QueryAllowancesRequest) (*QueryAllowancesResponse, error)
// AllowancesByGranter returns all the grants given by an address
//
// Since: cosmos-sdk 0.46
AllowancesByGranter(context.Context, *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error)
}
QueryServer is the server API for Query service.
type UnimplementedMsgServer ¶
type UnimplementedMsgServer struct {
}
UnimplementedMsgServer can be embedded to have forward compatible implementations.
func (*UnimplementedMsgServer) GrantAllowance ¶
func (*UnimplementedMsgServer) GrantAllowance(ctx context.Context, req *MsgGrantAllowance) (*MsgGrantAllowanceResponse, error)
func (*UnimplementedMsgServer) RevokeAllowance ¶
func (*UnimplementedMsgServer) RevokeAllowance(ctx context.Context, req *MsgRevokeAllowance) (*MsgRevokeAllowanceResponse, error)
type UnimplementedQueryServer ¶
type UnimplementedQueryServer struct {
}
UnimplementedQueryServer can be embedded to have forward compatible implementations.
func (*UnimplementedQueryServer) Allowance ¶
func (*UnimplementedQueryServer) Allowance(ctx context.Context, req *QueryAllowanceRequest) (*QueryAllowanceResponse, error)
func (*UnimplementedQueryServer) Allowances ¶
func (*UnimplementedQueryServer) Allowances(ctx context.Context, req *QueryAllowancesRequest) (*QueryAllowancesResponse, error)
func (*UnimplementedQueryServer) AllowancesByGranter ¶ added in v0.45.5
func (*UnimplementedQueryServer) AllowancesByGranter(ctx context.Context, req *QueryAllowancesByGranterRequest) (*QueryAllowancesByGranterResponse, error)