accounting

package
v0.0.0-...-fe11d6f Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountAlreadyExistsError

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

func (*AccountAlreadyExistsError) Error

func (e *AccountAlreadyExistsError) Error() string

func (*AccountAlreadyExistsError) HTTPCode

func (e *AccountAlreadyExistsError) HTTPCode() int

type AccountNotFoundError

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

func (*AccountNotFoundError) Error

func (e *AccountNotFoundError) Error() string

func (*AccountNotFoundError) HTTPCode

func (e *AccountNotFoundError) HTTPCode() int

type AccountUnderFundedError

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

func (*AccountUnderFundedError) Error

func (e *AccountUnderFundedError) Error() string

func (*AccountUnderFundedError) HTTPCode

func (e *AccountUnderFundedError) HTTPCode() int

type Accounts

type Accounts struct {
	// Stores the total balance of each account.
	Accounts map[string]float64 `json:"accounts"`
}

func NewAccounts

func NewAccounts() *Accounts

func (*Accounts) BalanceOf

func (a *Accounts) BalanceOf(signer string) (float64, error)

func (*Accounts) CreateAccount

func (a *Accounts) CreateAccount(signer string) error

func (*Accounts) Deposit

func (a *Accounts) Deposit(signer string, amount float64) *Tx

func (*Accounts) Send

func (a *Accounts) Send(sender string, recipient string, amount float64) ([]*Tx, error)

func (*Accounts) Withdraw

func (a *Accounts) Withdraw(signer string, amount float64) (*Tx, error)

type Tx

type Tx struct {
	Action TxAction `json:"action"`
	Signer string   `json:"signer"`
	Amount float64  `json:"amount"`
}

type TxAction

type TxAction string
const (
	Deposit  TxAction = "deposit"
	Withdraw TxAction = "withdraw"
)

Jump to

Keyboard shortcuts

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