utils

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int32FromBytes added in v0.0.6

func Int32FromBytes(bz []byte) int32

Int32FromBytes converts some fixed length bytes back into a int32.

func Int32ToBytes added in v0.0.6

func Int32ToBytes(id int32) []byte

Int32ToBytes converts a int32 into fixed length bytes for use in store keys.

func Int64FromBytes added in v0.0.5

func Int64FromBytes(bz []byte) int64

Int64FromBytes converts some fixed length bytes back into a int64.

func Int64ToBytes added in v0.0.5

func Int64ToBytes(id int64) []byte

Int64ToBytes converts a int64 into fixed length bytes for use in store keys.

func IsValidUID

func IsValidUID(uid string) bool

IsValidUID validates if a uid is in correct format

func NewPubKeyMemory added in v0.0.5

func NewPubKeyMemory(bs []byte) []byte

func PopStrAtIndex added in v0.0.6

func PopStrAtIndex(s []string, i uint32) ([]string, string)

PopStrAtIndex pops an string item from string slice by index.

func RemoveDuplicateStrs added in v0.0.4

func RemoveDuplicateStrs(strSlice []string) (list []string)

RemoveDuplicateStrs returns input array without duplicates

func RemoveStr added in v0.0.5

func RemoveStr(s []string, r string) []string

RemoveStr removes an item from string slice.

func StrBytes

func StrBytes(p string) []byte

StrBytes returns []byte form of its input string

func Uint64FromBytes

func Uint64FromBytes(bz []byte) uint64

Uint64FromBytes converts some fixed length bytes back into a uint64.

func Uint64ToBytes

func Uint64ToBytes(id uint64) []byte

Uint64ToBytes converts a uint64 into fixed length bytes for use in store keys.

func ValidateMsgAuthorization added in v1.3.0

func ValidateMsgAuthorization(
	authzKeeper AuthzKeeper,
	ctx sdk.Context,
	creator, depositor string,
	msg sdk.Msg,
	errAuthorizationNotFound, errAuthorizationNotAccepted error,
) error

Types

type AccountKeeper added in v1.3.0

type AccountKeeper interface {
	GetModuleAddress(moduleName string) sdk.AccAddress
}

AccountKeeper defines the expected account keeper methods.

type AuthzKeeper added in v1.3.0

type AuthzKeeper interface {
	GetAuthorization(
		ctx sdk.Context,
		grantee sdk.AccAddress,
		granter sdk.AccAddress,
		msgType string,
	) (authz.Authorization, *time.Time)
	SaveGrant(
		ctx sdk.Context,
		grantee, granter sdk.AccAddress,
		authorization authz.Authorization,
		expiration *time.Time,
	) error
	DeleteGrant(
		ctx sdk.Context,
		grantee, granter sdk.AccAddress,
		msgType string,
	) error
}

AuthzKeeper defines the expected authz keeper.

type BankKeeper added in v1.3.0

type BankKeeper interface {
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, ecipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
}

BankKeeper defines the expected bank keeper methods.

type EventEmitter added in v0.0.8

type EventEmitter struct {
	Events []sdk.Event
	// contains filtered or unexported fields
}

func NewEventEmitter added in v0.0.8

func NewEventEmitter(ctx *sdk.Context, category string) EventEmitter

func (*EventEmitter) AddEvent added in v0.0.9

func (em *EventEmitter) AddEvent(ty string, attrs ...sdk.Attribute)

func (*EventEmitter) AddMsg added in v0.0.8

func (em *EventEmitter) AddMsg(msgType, sender string, attrs ...sdk.Attribute)

func (EventEmitter) Emit added in v0.0.8

func (em EventEmitter) Emit()

type IModuleFunder added in v1.3.0

type IModuleFunder interface {
	GetModuleAcc() string
}

type ModuleAccFunder added in v1.3.0

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

func NewModuleAccFunder added in v1.3.0

func NewModuleAccFunder(bk BankKeeper, ak AccountKeeper, bankError error) *ModuleAccFunder

func (*ModuleAccFunder) Fund added in v1.3.0

func (f *ModuleAccFunder) Fund(
	mf IModuleFunder,
	ctx sdk.Context,
	senderAcc sdk.AccAddress,
	amount sdkmath.Int,
) error

Fund transfers the input amount from sender to the module account.

func (*ModuleAccFunder) Refund added in v1.3.0

func (f *ModuleAccFunder) Refund(
	mf IModuleFunder,
	ctx sdk.Context,
	receiverAcc sdk.AccAddress,
	amount sdkmath.Int,
) error

Refund transfers the input amount from the module account to the receiver account.

Jump to

Keyboard shortcuts

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