account

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccountInfoNotFound = errors.New("account info not found")
	ErrAccountInfoExists   = errors.New("account info already exists")
	ErrInvalidAccountInfo  = errors.New("invalid account info")
)

Functions

This section is empty.

Types

type Record

type Record struct {
	Id uint64

	OwnerAccount     string
	AuthorityAccount string
	TokenAccount     string
	MintAccount      string

	AccountType    commonpb.AccountType
	Index          uint64
	RelationshipTo *string

	RequiresDepositSync  bool
	DepositsLastSyncedAt time.Time

	RequiresAutoReturnCheck bool

	CreatedAt time.Time
}

func (*Record) Clone

func (r *Record) Clone() Record

func (*Record) CopyTo

func (r *Record) CopyTo(dst *Record)

func (*Record) IsBucket

func (r *Record) IsBucket() bool

func (*Record) IsTimelock added in v1.3.0

func (r *Record) IsTimelock() bool

func (*Record) Validate

func (r *Record) Validate() error

type Store

type Store interface {
	// Put creates a new account info object
	Put(ctx context.Context, record *Record) error

	// Update updates an account info object
	Update(ctx context.Context, record *Record) error

	// GetByTokenAddress finds the record for a given token account address
	GetByTokenAddress(ctx context.Context, address string) (*Record, error)

	// GetByAuthorityAddress finds the record for a given authority account address
	GetByAuthorityAddress(ctx context.Context, address string) (*Record, error)

	// GetLatestByOwnerAddress gets the latest accounts for an owner
	GetLatestByOwnerAddress(ctx context.Context, address string) (map[commonpb.AccountType][]*Record, error)

	// GetLatestByOwnerAddressAndType gets the latest account for an owner and account type
	GetLatestByOwnerAddressAndType(ctx context.Context, address string, accountType commonpb.AccountType) (*Record, error)

	// GetRelationshipByOwnerAddress gets a relationship account for a given owner.
	//
	// Note: Index is always zero, so there's no concept of a "latest"
	GetRelationshipByOwnerAddress(ctx context.Context, address, relationshipTo string) (*Record, error)

	// GetPrioritizedRequiringDepositSync gets a set of account info objects where
	// RequiresDepositSync is true that's prioritized by DepositsLastSyncedAt
	GetPrioritizedRequiringDepositSync(ctx context.Context, limit uint64) ([]*Record, error)

	// CountRequiringDepositSync counts the number of account info objects where
	// RequiresDepositSync is true
	CountRequiringDepositSync(ctx context.Context) (uint64, error)

	// GetPrioritizedRequiringAutoReturnCheck gets a set of account info objects where
	// RequiresAutoReturnCheck is true and older than minAge that's prioritized by CreatedAt
	GetPrioritizedRequiringAutoReturnCheck(ctx context.Context, minAge time.Duration, limit uint64) ([]*Record, error)

	// CountRequiringAutoReturnCheck counts the number of account info objects where
	// RequiresAutoReturnCheck is true
	CountRequiringAutoReturnCheck(ctx context.Context) (uint64, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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