account

package
v1.26.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindScale added in v1.25.0

func FindScale(asset string, v float64, s int) gold.Amount

FindScale Function to find the scale for any value of a value

func OperateAmounts added in v1.15.0

func OperateAmounts(amount gold.Amount, balance *a.Balance, operation string) (o.Balance, error)

OperateAmounts Function to sum or sub two amounts and normalize the scale

func Scale added in v1.15.0

func Scale(v, s0, s1 int) float64

Scale func scale: (V * 10^ (S0-S1))

func UndoScale added in v1.15.0

func UndoScale(v float64, s int) int

UndoScale Function to undo the scale calculation

func UpdateAccounts added in v1.15.0

func UpdateAccounts(operation string, fromTo map[string]gold.Amount, accounts []*a.Account, result chan []*a.Account, e chan error)

UpdateAccounts function with some updates values in accounts and

func ValidateAccounts added in v1.15.0

func ValidateAccounts(validate Responses, accounts []*a.Account) error

ValidateAccounts function with some validates in accounts and DSL operations

func ValidateFromToOperation added in v1.15.0

func ValidateFromToOperation(ft gold.FromTo, validate Responses, acc *a.Account) (o.Amount, o.Balance, error)

ValidateFromToOperation func that validate operate balance amount

Types

type Repository

type Repository interface {
	GetAccountsByIds(ctx context.Context, token string, organizationID, ledgerID uuid.UUID, ids []string) (*proto.AccountsResponse, error)
	GetAccountsByAlias(ctx context.Context, token string, organizationID, ledgerID uuid.UUID, aliases []string) (*proto.AccountsResponse, error)
	UpdateAccounts(ctx context.Context, token string, organizationID, ledgerID uuid.UUID, accounts []*proto.Account) (*proto.AccountsResponse, error)
}

Repository provides an interface for gRPC operations related to account in the Ledger.

type Response added in v1.15.0

type Response struct {
	Total  int
	SD     []string
	FromTo map[string]gold.Amount
}

Response return struct with total and per-account amounts

type Responses added in v1.15.0

type Responses struct {
	Total        int
	From         map[string]gold.Amount
	To           map[string]gold.Amount
	Sources      []string
	Destinations []string
	Aliases      []string
}

Responses return struct with total send and per-accounts

func ValidateSendSourceAndDistribute added in v1.15.0

func ValidateSendSourceAndDistribute(transaction gold.Transaction) (*Responses, error)

ValidateSendSourceAndDistribute Validate send and distribute totals

Jump to

Keyboard shortcuts

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