account

package
v1.15.0-beta.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateRemainingFromSend added in v1.15.0

func CalculateRemainingFromSend(asset string, remainingValue float64) gold.Amount

CalculateRemainingFromSend Function to calculate the remaining value when previous values are known

func FindScaleForPercentage added in v1.15.0

func FindScaleForPercentage(value float64, share gold.Share) (gold.Amount, float64)

FindScaleForPercentage Function to find the scale for a percentage of a value

func OperateAmounts added in v1.15.0

func OperateAmounts(amount gold.Amount, balance *a.Balance, operation string) (o.Amount, 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, s float64) float64

Scale func scale: (V * 10^-S)

func TranslateScale added in v1.15.0

func TranslateScale(value, scale string) (float64, error)

TranslateScale Function that translate string values to use scale

func UndoScale added in v1.15.0

func UndoScale(v, s float64) float64

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, ids []string) (*proto.AccountsResponse, error)
	GetAccountsByAlias(ctx context.Context, aliases []string) (*proto.AccountsResponse, error)
	UpdateAccounts(ctx context.Context, 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  float64
	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        float64
	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