import "github.com/cosmos/cosmos-sdk/x/auth/types"
Package types is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
account.go account_retriever.go auth.pb.go codec.go expected_keepers.go genesis.go genesis.pb.go keys.go params.go permissions.go querier.go query.go query.pb.go query.pb.gw.go
const ( // module name ModuleName = "auth" // StoreKey is string representation of the store key for auth StoreKey = "acc" // FeeCollectorName the root string for the fee collector account address FeeCollectorName = "fee_collector" // QuerierRoute is the querier route for auth QuerierRoute = ModuleName )
const ( DefaultMaxMemoCharacters uint64 = 256 DefaultTxSigLimit uint64 = 7 DefaultTxSizeCostPerByte uint64 = 10 DefaultSigVerifyCostED25519 uint64 = 590 DefaultSigVerifyCostSecp256k1 uint64 = 1000 )
Default parameter values
const ( Minter = "minter" Burner = "burner" Staking = "staking" )
permissions
const ( QueryAccount = "account" QueryParams = "params" )
query endpoints supported by the auth Querier
var ( ErrInvalidLengthAuth = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowAuth = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupAuth = 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 ( // AddressStoreKeyPrefix prefix for account-by-address store AddressStoreKeyPrefix = []byte{0x01} // param key for global account number GlobalAccountNumberKey = []byte("globalAccountNumber") )
var ( KeyMaxMemoCharacters = []byte("MaxMemoCharacters") KeyTxSigLimit = []byte("TxSigLimit") KeyTxSizeCostPerByte = []byte("TxSizeCostPerByte") KeySigVerifyCostED25519 = []byte("SigVerifyCostED25519") KeySigVerifyCostSecp256k1 = []byte("SigVerifyCostSecp256k1") )
Parameter keys
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 ( ModuleCdc = codec.NewAminoCodec(amino) )
func AddressStoreKey(addr sdk.AccAddress) []byte
AddressStoreKey turn an address to key used to get it from the account store
func NewModuleAddress(name string) sdk.AccAddress
NewModuleAddress creates an AccAddress from the hash of the module's name
func PackAccounts(accounts GenesisAccounts) ([]*types.Any, error)
PackAccounts converts GenesisAccounts to Any slice
func ParamKeyTable() paramtypes.KeyTable
ParamKeyTable for auth module
func RegisterInterfaces(registry types.InterfaceRegistry)
RegisterInterfaces associates protoName with AccountI interface and creates a registry of it's concrete implementations
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterLegacyAminoCodec registers the account interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization
RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".
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(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(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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.
func RegisterQueryServer(s grpc1.Server, srv QueryServer)
func ValidateGenAccounts(accounts GenesisAccounts) error
ValidateGenAccounts validates an array of GenesisAccounts and checks for duplicates
func ValidateGenesis(data GenesisState) error
ValidateGenesis performs basic validation of auth genesis data returning an error for any failed validation criteria.
type AccountI interface { proto.Message GetAddress() sdk.AccAddress SetAddress(sdk.AccAddress) error // errors if already set. GetPubKey() cryptotypes.PubKey // can return nil. SetPubKey(cryptotypes.PubKey) error GetAccountNumber() uint64 SetAccountNumber(uint64) error GetSequence() uint64 SetSequence(uint64) error // Ensure that account implements stringer String() string }
AccountI is an interface used to store coins at a given address within state. It presumes a notion of sequence numbers for replay protection, a notion of account numbers for replay protection for previously pruned accounts, and a pubkey for authentication purposes.
Many complex conditions can be used in the concrete struct which implements AccountI.
ProtoBaseAccount - a prototype function for BaseAccount
type AccountRetriever struct{}
AccountRetriever defines the properties of a type that can be used to retrieve accounts.
func (ar AccountRetriever) EnsureExists(clientCtx client.Context, addr sdk.AccAddress) error
EnsureExists returns an error if no account exists for the given address else nil.
func (ar AccountRetriever) GetAccount(clientCtx client.Context, addr sdk.AccAddress) (client.Account, error)
GetAccount queries for an account given an address and a block height. An error is returned if the query or decoding fails.
func (ar AccountRetriever) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error)
GetAccountNumberSequence returns sequence and account number for the given address. It returns an error if the account couldn't be retrieved from the state.
func (ar AccountRetriever) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error)
GetAccountWithHeight queries for an account given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.
type BankKeeper interface { SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error }
BankKeeper defines the contract needed for supply related APIs (noalias)
type BaseAccount struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` PubKey *types.Any `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"` AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` }
BaseAccount defines a base account type. It contains all the necessary fields for basic account functionality. Any custom account type should extend this type for additional functionality (e.g. vesting).
func NewBaseAccount(address sdk.AccAddress, pubKey cryptotypes.PubKey, accountNumber, sequence uint64) *BaseAccount
NewBaseAccount creates a new BaseAccount object
func NewBaseAccountWithAddress(addr sdk.AccAddress) *BaseAccount
NewBaseAccountWithAddress - returns a new base account with a given address
func (*BaseAccount) Descriptor() ([]byte, []int)
func (acc BaseAccount) GetAccountNumber() uint64
GetAccountNumber - Implements AccountI
func (acc BaseAccount) GetAddress() sdk.AccAddress
GetAddress - Implements sdk.AccountI.
func (acc BaseAccount) GetPubKey() (pk cryptotypes.PubKey)
GetPubKey - Implements sdk.AccountI.
func (acc BaseAccount) GetSequence() uint64
GetSequence - Implements sdk.AccountI.
func (m *BaseAccount) Marshal() (dAtA []byte, err error)
func (m *BaseAccount) MarshalTo(dAtA []byte) (int, error)
func (m *BaseAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (acc BaseAccount) MarshalYAML() (interface{}, error)
MarshalYAML returns the YAML representation of an account.
func (*BaseAccount) ProtoMessage()
func (m *BaseAccount) Reset()
func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error
SetAccountNumber - Implements AccountI
func (acc *BaseAccount) SetAddress(addr sdk.AccAddress) error
SetAddress - Implements sdk.AccountI.
func (acc *BaseAccount) SetPubKey(pubKey cryptotypes.PubKey) error
SetPubKey - Implements sdk.AccountI.
func (acc *BaseAccount) SetSequence(seq uint64) error
SetSequence - Implements sdk.AccountI.
func (m *BaseAccount) Size() (n int)
func (acc BaseAccount) String() string
func (m *BaseAccount) Unmarshal(dAtA []byte) error
func (acc BaseAccount) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (acc BaseAccount) Validate() error
Validate checks for errors on the account fields
func (m *BaseAccount) XXX_DiscardUnknown()
func (m *BaseAccount) XXX_Merge(src proto.Message)
func (m *BaseAccount) XXX_Size() int
func (m *BaseAccount) XXX_Unmarshal(b []byte) error
GenesisAccount defines a genesis account that embeds an AccountI with validation capabilities.
type GenesisAccountIterator struct{}
GenesisAccountIterator implements genesis account iteration.
func (GenesisAccountIterator) IterateGenesisAccounts( cdc codec.Marshaler, appGenesis map[string]json.RawMessage, cb func(AccountI) (stop bool), )
IterateGenesisAccounts iterates over all the genesis accounts found in appGenesis and invokes a callback on each genesis account. If any call returns true, iteration stops.
type GenesisAccounts []GenesisAccount
GenesisAccounts defines a slice of GenesisAccount objects
func SanitizeGenesisAccounts(genAccs GenesisAccounts) GenesisAccounts
SanitizeGenesisAccounts sorts accounts and coin sets.
func UnpackAccounts(accountsAny []*types.Any) (GenesisAccounts, error)
UnpackAccounts converts Any slice to GenesisAccounts
func (ga GenesisAccounts) Contains(addr sdk.Address) bool
Contains returns true if the given address exists in a slice of GenesisAccount objects.
type GenesisState struct { // params defines all the paramaters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` // accounts are the accounts present at genesis. Accounts []*types.Any `protobuf:"bytes,2,rep,name=accounts,proto3" json:"accounts,omitempty"` }
GenesisState defines the auth module's genesis state.
func DefaultGenesisState() *GenesisState
DefaultGenesisState - Return a default genesis state
func GetGenesisStateFromAppState(cdc codec.Marshaler, appState map[string]json.RawMessage) GenesisState
GetGenesisStateFromAppState returns x/auth GenesisState given raw application genesis state.
func NewGenesisState(params Params, accounts GenesisAccounts) *GenesisState
NewGenesisState - Create a new genesis state
func (*GenesisState) Descriptor() ([]byte, []int)
func (m *GenesisState) GetAccounts() []*types.Any
func (m *GenesisState) GetParams() Params
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 (g GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error
UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
func (m *GenesisState) XXX_DiscardUnknown()
func (m *GenesisState) XXX_Merge(src proto.Message)
func (m *GenesisState) XXX_Size() int
func (m *GenesisState) XXX_Unmarshal(b []byte) error
type ModuleAccount struct { *BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty" yaml:"base_account"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Permissions []string `protobuf:"bytes,3,rep,name=permissions,proto3" json:"permissions,omitempty"` }
ModuleAccount defines an account for modules that holds coins on a pool.
func NewEmptyModuleAccount(name string, permissions ...string) *ModuleAccount
NewEmptyModuleAccount creates a empty ModuleAccount from a string
func NewModuleAccount(ba *BaseAccount, name string, permissions ...string) *ModuleAccount
NewModuleAccount creates a new ModuleAccount instance
func (*ModuleAccount) Descriptor() ([]byte, []int)
func (ma ModuleAccount) GetName() string
GetName returns the the name of the holder's module
func (ma ModuleAccount) GetPermissions() []string
GetPermissions returns permissions granted to the module account
func (ma ModuleAccount) HasPermission(permission string) bool
HasPermission returns whether or not the module account has permission.
func (m *ModuleAccount) Marshal() (dAtA []byte, err error)
func (ma ModuleAccount) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON representation of a ModuleAccount.
func (m *ModuleAccount) MarshalTo(dAtA []byte) (int, error)
func (m *ModuleAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (ma ModuleAccount) MarshalYAML() (interface{}, error)
MarshalYAML returns the YAML representation of a ModuleAccount.
func (*ModuleAccount) ProtoMessage()
func (m *ModuleAccount) Reset()
func (ma ModuleAccount) SetPubKey(pubKey cryptotypes.PubKey) error
SetPubKey - Implements AccountI
func (ma ModuleAccount) SetSequence(seq uint64) error
SetSequence - Implements AccountI
func (m *ModuleAccount) Size() (n int)
func (ma ModuleAccount) String() string
func (m *ModuleAccount) Unmarshal(dAtA []byte) error
func (ma *ModuleAccount) UnmarshalJSON(bz []byte) error
UnmarshalJSON unmarshals raw JSON bytes into a ModuleAccount.
func (ma ModuleAccount) Validate() error
Validate checks for errors on the account fields
func (m *ModuleAccount) XXX_DiscardUnknown()
func (m *ModuleAccount) XXX_Merge(src proto.Message)
func (m *ModuleAccount) XXX_Size() int
func (m *ModuleAccount) XXX_Unmarshal(b []byte) error
type ModuleAccountI interface { AccountI GetName() string GetPermissions() []string HasPermission(string) bool }
ModuleAccountI defines an account interface for modules that hold tokens in an escrow.
type Params struct { MaxMemoCharacters uint64 `protobuf:"varint,1,opt,name=max_memo_characters,json=maxMemoCharacters,proto3" json:"max_memo_characters,omitempty" yaml:"max_memo_characters"` TxSigLimit uint64 `protobuf:"varint,2,opt,name=tx_sig_limit,json=txSigLimit,proto3" json:"tx_sig_limit,omitempty" yaml:"tx_sig_limit"` TxSizeCostPerByte uint64 `protobuf:"varint,3,opt,name=tx_size_cost_per_byte,json=txSizeCostPerByte,proto3" json:"tx_size_cost_per_byte,omitempty" yaml:"tx_size_cost_per_byte"` SigVerifyCostED25519 uint64 `protobuf:"varint,4,opt,name=sig_verify_cost_ed25519,json=sigVerifyCostEd25519,proto3" json:"sig_verify_cost_ed25519,omitempty" yaml:"sig_verify_cost_ed25519"` SigVerifyCostSecp256k1 uint64 `protobuf:"varint,5,opt,name=sig_verify_cost_secp256k1,json=sigVerifyCostSecp256k1,proto3" json:"sig_verify_cost_secp256k1,omitempty" yaml:"sig_verify_cost_secp256k1"` }
Params defines the parameters for the auth module.
DefaultParams returns a default set of parameters.
func NewParams( maxMemoCharacters, txSigLimit, txSizeCostPerByte, sigVerifyCostED25519, sigVerifyCostSecp256k1 uint64, ) Params
NewParams creates a new Params object
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs
ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of auth module's parameters. nolint
String implements the stringer interface.
Validate checks that the parameters have valid values.
type PermissionsForAddress struct {
// contains filtered or unexported fields
}
PermissionsForAddress defines all the registered permissions for an address
func NewPermissionsForAddress(name string, permissions []string) PermissionsForAddress
NewPermissionsForAddress creates a new PermissionsForAddress object
func (pa PermissionsForAddress) GetAddress() sdk.AccAddress
GetAddress returns the address of the PermissionsForAddress object
func (pa PermissionsForAddress) GetPermissions() []string
GetPermissions returns the permissions granted to the address
func (pa PermissionsForAddress) HasPermission(permission string) bool
HasPermission returns whether the PermissionsForAddress contains permission.
type QueryAccountRequest struct { // address defines the address to query for. Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` }
QueryAccountRequest is the request type for the Query/Account RPC method.
func (*QueryAccountRequest) Descriptor() ([]byte, []int)
func (m *QueryAccountRequest) Marshal() (dAtA []byte, err error)
func (m *QueryAccountRequest) MarshalTo(dAtA []byte) (int, error)
func (m *QueryAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAccountRequest) ProtoMessage()
func (m *QueryAccountRequest) Reset()
func (m *QueryAccountRequest) Size() (n int)
func (m *QueryAccountRequest) String() string
func (m *QueryAccountRequest) Unmarshal(dAtA []byte) error
func (m *QueryAccountRequest) XXX_DiscardUnknown()
func (m *QueryAccountRequest) XXX_Merge(src proto.Message)
func (m *QueryAccountRequest) XXX_Size() int
func (m *QueryAccountRequest) XXX_Unmarshal(b []byte) error
type QueryAccountResponse struct { // account defines the account of the corresponding address. Account *types.Any `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` }
QueryAccountResponse is the response type for the Query/Account RPC method.
func (*QueryAccountResponse) Descriptor() ([]byte, []int)
func (m *QueryAccountResponse) GetAccount() *types.Any
func (m *QueryAccountResponse) Marshal() (dAtA []byte, err error)
func (m *QueryAccountResponse) MarshalTo(dAtA []byte) (int, error)
func (m *QueryAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryAccountResponse) ProtoMessage()
func (m *QueryAccountResponse) Reset()
func (m *QueryAccountResponse) Size() (n int)
func (m *QueryAccountResponse) String() string
func (m *QueryAccountResponse) Unmarshal(dAtA []byte) error
func (m *QueryAccountResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
func (m *QueryAccountResponse) XXX_DiscardUnknown()
func (m *QueryAccountResponse) XXX_Merge(src proto.Message)
func (m *QueryAccountResponse) XXX_Size() int
func (m *QueryAccountResponse) XXX_Unmarshal(b []byte) error
type QueryClient interface { // Account returns account details based on address. Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) // Params queries all parameters. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, 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(cc grpc1.ClientConn) QueryClient
type QueryParamsRequest struct { }
QueryParamsRequest is the request type for the Query/Params RPC method.
func (*QueryParamsRequest) Descriptor() ([]byte, []int)
func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error)
func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error)
func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryParamsRequest) ProtoMessage()
func (m *QueryParamsRequest) Reset()
func (m *QueryParamsRequest) Size() (n int)
func (m *QueryParamsRequest) String() string
func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error
func (m *QueryParamsRequest) XXX_DiscardUnknown()
func (m *QueryParamsRequest) XXX_Merge(src proto.Message)
func (m *QueryParamsRequest) XXX_Size() int
func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error
type QueryParamsResponse struct { // params defines the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` }
QueryParamsResponse is the response type for the Query/Params RPC method.
func (*QueryParamsResponse) Descriptor() ([]byte, []int)
func (m *QueryParamsResponse) GetParams() Params
func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error)
func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error)
func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*QueryParamsResponse) ProtoMessage()
func (m *QueryParamsResponse) Reset()
func (m *QueryParamsResponse) Size() (n int)
func (m *QueryParamsResponse) String() string
func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error
func (m *QueryParamsResponse) XXX_DiscardUnknown()
func (m *QueryParamsResponse) XXX_Merge(src proto.Message)
func (m *QueryParamsResponse) XXX_Size() int
func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error
type QueryServer interface { // Account returns account details based on address. Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error) // Params queries all parameters. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) }
QueryServer is the server API for Query service.
type RandomGenesisAccountsFn func(simState *module.SimulationState) GenesisAccounts
RandomGenesisAccountsFn defines the function required to generate custom account types
type UnimplementedQueryServer struct { }
UnimplementedQueryServer can be embedded to have forward compatible implementations.
func (*UnimplementedQueryServer) Account(ctx context.Context, req *QueryAccountRequest) (*QueryAccountResponse, error)
func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error)
Package types imports 38 packages (graph) and is imported by 148 packages. Updated 2021-01-25. Refresh now. Tools for package owners.