Documentation ¶
Index ¶
- func CalculateRemaining(asset string, remainingValue float64, scale string) gold.Amount
- func FindScaleForPercentage(value float64, scale string, share gold.Share) (gold.Amount, float64)
- func OperateAmounts(amount gold.Amount, balance *a.Balance, operation string) (o.Amount, o.Balance, error)
- func Scale(v, s float64) float64
- func UndoScale(value, scale float64) float64
- func UpdateAccounts(operation string, fromTo map[string]gold.Amount, accounts []*a.Account, ...)
- func ValidateAccounts(validate Responses, accounts []*a.Account) error
- func ValidateFromToOperation(ft gold.FromTo, validate Responses, acc *a.Account) (o.Amount, o.Balance, error)
- type Repository
- type Response
- type Responses
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateRemaining ¶ added in v1.21.0
CalculateRemaining Function to calculate the remaining value when previous values are known
func FindScaleForPercentage ¶ added in v1.15.0
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 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
ValidateAccounts function with some validates in accounts and DSL operations
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, accounts []*proto.Account) (*proto.AccountsResponse, error) }
Repository provides an interface for gRPC operations related to account in the Ledger.
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
Click to show internal directories.
Click to hide internal directories.