account

package
v0.0.0-...-b4b7c53 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountKey

func AccountKey(address string) []byte

func HeightKey

func HeightKey() []byte

func MyAccountKey

func MyAccountKey() []byte

func UpdateBalance

func UpdateBalance(txn *badger.Txn, address string, amount uint64, add bool) error

func UpdateBalanceFn

func UpdateBalanceFn(address string, amount uint64, add bool) func(*badger.Txn) error

Types

type Account

type Account struct {
	PubKey        crypto.PubKey
	Balance       uint64 // balance in utia
	AccountNumber uint64
}

func NewAccount

func NewAccount(pubKey crypto.PubKey, balance, accountNumber uint64) *Account

func NewAccountFromBytes

func NewAccountFromBytes(bz []byte) (*Account, error)

func (*Account) Bytes

func (a *Account) Bytes() ([]byte, error)

func (*Account) IsSet

func (a *Account) IsSet() bool

type Querier

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

func NewQuerier

func NewQuerier(conn *grpc.ClientConn) *Querier

func (*Querier) GetAccount

func (q *Querier) GetAccount(ctx context.Context, address string) (cryptotypes.PubKey, uint64, error)

type Store

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

func NewStore

func NewStore(db *badger.DB, accountPubKey crypto.PubKey) (*Store, error)

func (*Store) GetAccount

func (s *Store) GetAccount(address string) (*Account, error)

func (*Store) GetHeight

func (s *Store) GetHeight() uint64

func (*Store) GetOwnerPubKey

func (s *Store) GetOwnerPubKey() (crypto.PubKey, error)

func (*Store) NewTx

func (s *Store) NewTx(update bool) *badger.Txn

func (*Store) ProcessDeposits

func (s *Store) ProcessDeposits(txn *badger.Txn, deposits map[string]uint64) error

func (*Store) SetAccount

func (s *Store) SetAccount(address string, account *Account) error

func (*Store) SetHeight

func (s *Store) SetHeight(txn *badger.Txn, newHeight uint64) error

func (*Store) UpdateBalance

func (s *Store) UpdateBalance(address string, amount uint64, add bool) error

Jump to

Keyboard shortcuts

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