Documentation ¶
Index ¶
- func CalculateRemainingFromSend(asset string, remainingValue float64) gold.Amount
- func FindScaleForPercentage(value float64, 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 TranslateScale(value, scale string) (float64, error)
- func UndoScale(v, s 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 CalculateRemainingFromSend ¶ added in v1.15.0
CalculateRemainingFromSend 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 TranslateScale ¶ added in v1.15.0
TranslateScale Function that translate string values to use 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, ids []string) (*proto.AccountsResponse, error) GetAccountsByAlias(ctx context.Context, token string, 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