auth

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2023 License: MPL-2.0 Imports: 12 Imported by: 21

Documentation

Index

Constants

View Source
const (
	DefaultSource = 0
)

Variables

This section is empty.

Functions

func AddressStoreKey

func AddressStoreKey(addr sdk.AccAddress) []byte

Turn an address to key used to get it from the account store

func DefaultTxDecoder

func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder

logic for standard transaction decoding

func GetSigners

func GetSigners(ctx types.Context) []types.Account

get the signers from the context

func NewAccountCache

func NewAccountCache(parent sdk.AccountStoreCache) sdk.AccountCache

func NewAccountStoreCache

func NewAccountStoreCache(cdc *codec.Codec, store sdk.KVStore, cap int) sdk.AccountStoreCache

func NewAnteHandler

func NewAnteHandler(am AccountKeeper) sdk.AnteHandler

NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers

func ProtoBaseAccount

func ProtoBaseAccount() sdk.Account

Prototype function for BaseAccount

func RegisterBaseAccount

func RegisterBaseAccount(cdc *codec.Codec)

Most users shouldn't use this, but this comes in handy for tests.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec for default AppAccount

func StdSignBytes

func StdSignBytes(chainID string, accnum int64, sequence int64, msgs []sdk.Msg, memo string, source int64, data []byte) []byte

StdSignBytes returns the bytes to sign for a transaction.

func WithSigners

func WithSigners(ctx types.Context, accounts []types.Account) types.Context

add the signers to the context

Types

type AccountDecoder

type AccountDecoder func(accountBytes []byte) (sdk.Account, error)

AccountDecoder unmarshals account bytes

type AccountKeeper

type AccountKeeper struct {
	// contains filtered or unexported fields
}

This AccountKeeper encodes/decodes accounts using the go-amino (binary) encoding/decoding library.

func NewAccountKeeper

func NewAccountKeeper(cdc *codec.Codec, key sdk.StoreKey, proto func() sdk.Account) AccountKeeper

NewAccountKeeper returns a new sdk.AccountKeeper that uses go-amino to (binary) encode and decode concrete sdk.Accounts. nolint

func (AccountKeeper) GetAccount

func (am AccountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) sdk.Account

Implements sdk.AccountKeeper.

func (AccountKeeper) GetNextAccountNumber

func (am AccountKeeper) GetNextAccountNumber(ctx sdk.Context) int64

Returns and increments the global account number counter

func (AccountKeeper) GetPubKey

func (am AccountKeeper) GetPubKey(ctx sdk.Context, addr sdk.AccAddress) (crypto.PubKey, sdk.Error)

Returns the PubKey of the account at address

func (AccountKeeper) GetSequence

func (am AccountKeeper) GetSequence(ctx sdk.Context, addr sdk.AccAddress) (int64, sdk.Error)

Returns the Sequence of the account at address

func (AccountKeeper) IterateAccounts

func (am AccountKeeper) IterateAccounts(ctx sdk.Context, process func(sdk.Account) (stop bool))

Implements sdk.AccountKeeper.

func (AccountKeeper) NewAccount

func (am AccountKeeper) NewAccount(ctx sdk.Context, acc sdk.Account) sdk.Account

New Account

func (AccountKeeper) NewAccountWithAddress

func (am AccountKeeper) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) sdk.Account

Implaements sdk.AccountKeeper.

func (AccountKeeper) RemoveAccount

func (am AccountKeeper) RemoveAccount(ctx sdk.Context, acc sdk.Account)

RemoveAccount removes an account for the account mapper store.

func (AccountKeeper) SetAccount

func (am AccountKeeper) SetAccount(ctx sdk.Context, acc sdk.Account)

Implements sdk.AccountKeeper.

type BaseAccount

type BaseAccount struct {
	Address       sdk.AccAddress `json:"address"`
	Coins         sdk.Coins      `json:"coins"`
	PubKey        crypto.PubKey  `json:"public_key"`
	AccountNumber int64          `json:"account_number"`
	Sequence      int64          `json:"sequence"`
}

BaseAccount - a base account structure. This can be extended by embedding within in your AppAccount. There are examples of this in: examples/basecoin/types/account.go. However one doesn't have to use BaseAccount as long as your struct implements Account.

func NewBaseAccountWithAddress

func NewBaseAccountWithAddress(addr sdk.AccAddress) BaseAccount

func (*BaseAccount) Clone

func (acc *BaseAccount) Clone() sdk.Account

Implements sdk.Account.

func (*BaseAccount) GetAccountNumber

func (acc *BaseAccount) GetAccountNumber() int64

Implements Account

func (BaseAccount) GetAddress

func (acc BaseAccount) GetAddress() sdk.AccAddress

Implements sdk.Account.

func (*BaseAccount) GetCoins

func (acc *BaseAccount) GetCoins() sdk.Coins

Implements sdk.Account.

func (BaseAccount) GetPubKey

func (acc BaseAccount) GetPubKey() crypto.PubKey

Implements sdk.Account.

func (*BaseAccount) GetSequence

func (acc *BaseAccount) GetSequence() int64

Implements sdk.Account.

func (*BaseAccount) SetAccountNumber

func (acc *BaseAccount) SetAccountNumber(accNumber int64) error

Implements Account

func (*BaseAccount) SetAddress

func (acc *BaseAccount) SetAddress(addr sdk.AccAddress) error

Implements sdk.Account.

func (*BaseAccount) SetCoins

func (acc *BaseAccount) SetCoins(coins sdk.Coins) error

Implements sdk.Account.

func (*BaseAccount) SetPubKey

func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error

Implements sdk.Account.

func (*BaseAccount) SetSequence

func (acc *BaseAccount) SetSequence(seq int64) error

Implements sdk.Account.

type FeeCollectionKeeper

type FeeCollectionKeeper struct {
	// contains filtered or unexported fields
}

This FeeCollectionKeeper handles collection of fees in the anteHandler and setting of MinFees for different fee tokens

func NewFeeCollectionKeeper

func NewFeeCollectionKeeper(cdc *codec.Codec, key sdk.StoreKey) FeeCollectionKeeper

func (FeeCollectionKeeper) AddCollectedFees

func (fck FeeCollectionKeeper) AddCollectedFees(ctx sdk.Context, coins sdk.Coins) sdk.Coins

add to the fee pool

func (FeeCollectionKeeper) ClearCollectedFees

func (fck FeeCollectionKeeper) ClearCollectedFees(ctx sdk.Context)

clear the fee pool

func (FeeCollectionKeeper) GetCollectedFees

func (fck FeeCollectionKeeper) GetCollectedFees(ctx sdk.Context) sdk.Coins

retrieves the collected fee pool

type StdSignDoc

type StdSignDoc struct {
	AccountNumber int64             `json:"account_number"`
	ChainID       string            `json:"chain_id"`
	Memo          string            `json:"memo"`
	Msgs          []json.RawMessage `json:"msgs"`
	Sequence      int64             `json:"sequence"`
	Source        int64             `json:"source"`
	Data          []byte            `json:"data"`
}

StdSignDoc is replay-prevention structure. It includes the result of msg.GetSignBytes(), as well as the ChainID (prevent cross chain replay) and the Sequence numbers for each signature (prevent inchain replay and enforce tx ordering per account).

type StdSignature

type StdSignature struct {
	crypto.PubKey `json:"pub_key"` // optional
	Signature     []byte           `json:"signature"`
	AccountNumber int64            `json:"account_number"`
	Sequence      int64            `json:"sequence"`
}

Standard Signature

type StdTx

type StdTx struct {
	Msgs       []sdk.Msg      `json:"msg"`
	Signatures []StdSignature `json:"signatures"`
	Memo       string         `json:"memo"`
	Source     int64          `json:"source"`
	Data       []byte         `json:"data"`
}

StdTx is a standard way to wrap a Msg with Signatures.

func NewStdTx

func NewStdTx(msgs []sdk.Msg, sigs []StdSignature, memo string, source int64, data []byte) StdTx

func (StdTx) GetData

func (tx StdTx) GetData() []byte

nolint

func (StdTx) GetMemo

func (tx StdTx) GetMemo() string

nolint

func (StdTx) GetMsgs

func (tx StdTx) GetMsgs() []sdk.Msg

nolint

func (StdTx) GetSignatures

func (tx StdTx) GetSignatures() []StdSignature

Signatures returns the signature of signers who signed the Msg. GetSignatures returns the signature of signers who signed the Msg. CONTRACT: Length returned is same as length of pubkeys returned from MsgKeySigners, and the order matches. CONTRACT: If the signature is missing (ie the Msg is invalid), then the corresponding signature is .Empty().

func (StdTx) GetSigners

func (tx StdTx) GetSigners() []sdk.AccAddress

GetSigners returns the addresses that must sign the transaction. Addresses are returned in a determistic order. They are accumulated from the GetSigners method for each Msg in the order they appear in tx.GetMsgs(). Duplicate addresses will be omitted.

func (StdTx) GetSource

func (tx StdTx) GetSource() int64

nolint

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL