common

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrencyInfoSubject         = chanPrefix + "Currency.Info"
	CurrencyCreateSubject       = chanPrefix + "Currency.Create"
	CurrencyListSubject         = chanPrefix + "Currency.List"
	CurrencySetAvailableSubject = chanPrefix + "Currency.SetAvailable"

	AccountCreateSubject    = chanPrefix + "Account.Create"
	AccountInfoSubject      = chanPrefix + "Account.Info"
	AccountListSubject      = chanPrefix + "Account.List"
	AccountHistorySubject   = chanPrefix + "Account.History"
	AccountSetStatusSubject = chanPrefix + "Account.SetStatus"
	AccountOperationSubject = chanPrefix + "Account.Operation"
	AccountTransferSubject  = chanPrefix + "Account.Transfer"

	AccountTransferWithdrawSubject = chanPrefix + "Account.TransferWithdraw"

	BatchWithdrawListSubject   = chanPrefix + "BatchWithdraw.List"
	BatchWithdrawUpdateSubject = chanPrefix + "BatchWithdraw.Update"

	UserWithdrawListSubject = chanPrefix + "User.Withdraw.List"

	CancelWithdrawSubject = chanPrefix + "Withdraw.Cancel"
)
View Source
const (
	BankUserKey = "Accounting.BankUser"
)

Variables

This section is empty.

Functions

func BankUserContext added in v0.0.5

func BankUserContext(ctx context.Context, bankUser model.User) context.Context

func BankUserFromContext added in v0.0.5

func BankUserFromContext(ctx context.Context) model.User

func ConvertEntryToOperation added in v0.0.5

func ConvertEntryToOperation(entry AccountEntry) model.AccountOperation

Types

type AccountCreation

type AccountCreation struct {
	UserID uint64
	Info   AccountInfo
}

func (*AccountCreation) Decode

func (p *AccountCreation) Decode(data []byte) error

func (*AccountCreation) Encode

func (p *AccountCreation) Encode() ([]byte, error)

type AccountEntry

type AccountEntry struct {
	OperationID     uint64
	OperationPrevID uint64

	AccountID        uint64
	Currency         string
	ReferenceID      uint64
	OperationType    string
	SynchroneousType string

	Timestamp time.Time
	Label     string
	Amount    float64
	Balance   float64

	LockAmount  float64
	TotalLocked float64
}

func ConvertOperationToEntry added in v0.0.5

func ConvertOperationToEntry(op model.AccountOperation, label string) AccountEntry

func (*AccountEntry) Decode

func (p *AccountEntry) Decode(data []byte) error

func (*AccountEntry) Encode

func (p *AccountEntry) Encode() ([]byte, error)

type AccountHistory

type AccountHistory struct {
	AccountID   uint64
	DisplayName string
	Ticker      string
	From        time.Time
	To          time.Time

	Entries []AccountEntry
}

func (*AccountHistory) Decode

func (p *AccountHistory) Decode(data []byte) error

func (*AccountHistory) Encode

func (p *AccountHistory) Encode() ([]byte, error)

type AccountInfo

type AccountInfo struct {
	Timestamp   time.Time
	AccountID   uint64
	UserID      uint64
	Currency    CurrencyInfo
	Name        string
	Status      string
	Balance     float64
	TotalLocked float64
}

func (*AccountInfo) Decode

func (p *AccountInfo) Decode(data []byte) error

func (*AccountInfo) Encode

func (p *AccountInfo) Encode() ([]byte, error)

type AccountTransfer added in v0.0.5

type AccountTransfer struct {
	Source      AccountEntry
	Destination AccountEntry
}

func (*AccountTransfer) Decode added in v0.0.5

func (p *AccountTransfer) Decode(data []byte) error

func (*AccountTransfer) Encode added in v0.0.5

func (p *AccountTransfer) Encode() ([]byte, error)

type AccountTransferWithdraw added in v0.0.5

type AccountTransferWithdraw struct {
	BatchMode string
	Source    AccountEntry
	Crypto    CryptoTransfert
}

func (*AccountTransferWithdraw) Decode added in v0.0.5

func (p *AccountTransferWithdraw) Decode(data []byte) error

func (*AccountTransferWithdraw) Encode added in v0.0.5

func (p *AccountTransferWithdraw) Encode() ([]byte, error)

type BatchStatus added in v0.0.5

type BatchStatus struct {
	BatchID uint64
	Status  string
}

func (*BatchStatus) Decode added in v0.0.5

func (p *BatchStatus) Decode(data []byte) error

func (*BatchStatus) Encode added in v0.0.5

func (p *BatchStatus) Encode() ([]byte, error)

type BatchUpdate added in v0.0.5

type BatchUpdate struct {
	BatchStatus
	TxID   string
	Height int
}

func (*BatchUpdate) Decode added in v0.0.5

func (p *BatchUpdate) Decode(data []byte) error

func (*BatchUpdate) Encode added in v0.0.5

func (p *BatchUpdate) Encode() ([]byte, error)

type BatchWithdraw added in v0.0.5

type BatchWithdraw struct {
	BatchID       uint64
	BankAccountID uint64
	Network       string
	Status        string
	TxID          string
	Withdraws     []WithdrawInfo
}

func (*BatchWithdraw) Decode added in v0.0.5

func (p *BatchWithdraw) Decode(data []byte) error

func (*BatchWithdraw) Encode added in v0.0.5

func (p *BatchWithdraw) Encode() ([]byte, error)

type BatchWithdraws added in v0.0.5

type BatchWithdraws struct {
	Network string
	Batches []BatchWithdraw
}

func (*BatchWithdraws) Decode added in v0.0.5

func (p *BatchWithdraws) Decode(data []byte) error

func (*BatchWithdraws) Encode added in v0.0.5

func (p *BatchWithdraws) Encode() ([]byte, error)

type CryptoTransfert added in v0.0.5

type CryptoTransfert struct {
	Chain     string
	PublicKey string
}

type CurrencyInfo

type CurrencyInfo struct {
	Name             string
	DisplayName      string
	DatabaseName     string
	Available        bool
	AutoCreate       bool
	Crypto           bool
	Type             CurrencyType
	Asset            bool
	DisplayPrecision uint
}

func (*CurrencyInfo) Decode

func (p *CurrencyInfo) Decode(data []byte) error

func (*CurrencyInfo) Encode

func (p *CurrencyInfo) Encode() ([]byte, error)

type CurrencyList

type CurrencyList struct {
	Currencies []CurrencyInfo
}

func (*CurrencyList) Decode

func (p *CurrencyList) Decode(data []byte) error

func (*CurrencyList) Encode

func (p *CurrencyList) Encode() ([]byte, error)

type CurrencyType added in v0.0.3

type CurrencyType int

type UserAccounts

type UserAccounts struct {
	UserID uint64

	Accounts []AccountInfo
}

func (*UserAccounts) Decode

func (p *UserAccounts) Decode(data []byte) error

func (*UserAccounts) Encode

func (p *UserAccounts) Encode() ([]byte, error)

type UserWithdraws added in v0.0.5

type UserWithdraws struct {
	UserID    uint64
	Withdraws []WithdrawInfo
}

func (*UserWithdraws) Decode added in v0.0.5

func (p *UserWithdraws) Decode(data []byte) error

func (*UserWithdraws) Encode added in v0.0.5

func (p *UserWithdraws) Encode() ([]byte, error)

type WithdrawInfo added in v0.0.5

type WithdrawInfo struct {
	WithdrawID uint64
	Timestamp  time.Time
	AccountID  uint64
	Amount     float64
	Chain      string
	PublicKey  string
	Status     string
}

func (*WithdrawInfo) Decode added in v0.0.5

func (p *WithdrawInfo) Decode(data []byte) error

func (*WithdrawInfo) Encode added in v0.0.5

func (p *WithdrawInfo) Encode() ([]byte, error)

Jump to

Keyboard shortcuts

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