Documentation
¶
Index ¶
Constants ¶
View Source
const ( MainNet = `main` TestNet = `test` )
View Source
const ( Rub FiatCurrency = `RUB` Btc CryptoCurrency = `btc` )
View Source
const (
MinorDiv = 100000000
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressGeneratorContext ¶
type AddressGeneratorContext struct { Currency CryptoCurrency UserId uint32 }
type CacheResponse ¶
type Crypto ¶
type Crypto struct { Currency CryptoCurrency `pg:",pk"` Address string `pg:",pk"` UserId uint32 `sql:",fk"` Balance float64 UpdatedAt time.Time Fiat float64 User *domain.User }
Crypto represents the last state of user`s balance
type CryptoAddressGenerator ¶
type CryptoAddressGenerator interface {
Generate(context *AddressGeneratorContext) (Address, error)
}
type CryptoRepository ¶
type CryptoRepository interface { // AssignAddress inserts crypto address to user AssignAddress(*Crypto, Address) error // Get fetches convenient entity Get(user *domain.User, currency CryptoCurrency) *Crypto // UpdateBalance updates balance and fiat fields only UpdateBalance(user *Crypto) error // FindOutdated looking for outdated rows FindOutdated(date time.Time, limit int) ([]*Crypto, error) }
CryptoRepository keeps crypto user`s addresses
type ExchangeRateConverter ¶
type ExchangeRateConverter interface {
Convert(*Wallet, FiatCurrency) (float64, error)
}
ExchangeRateConverter converts wallet's balance to fiat currency
type Rate ¶
type Rate struct { M float64 `json:"15m"` Last float64 `json:"last"` Buy float64 `json:"buy"` Sell float64 `json:"sell"` Symbol string `json:"symbol"` }
Rate contains exchange rate for some fiat currency
type Rates ¶
type Rates map[FiatCurrency]*Rate
Rates is a map of Rate where key is a fiat currency name
type TextHandler ¶
type TextHandler interface {
Handle(request TextRequest) error
}
type TextRequest ¶
type TextRequest struct { CryptoCurrency CryptoCurrency FiatCurrency FiatCurrency // contains filtered or unexported fields }
func NewTextRequest ¶
func NewTextRequest(peerId int, msg string) TextRequest
NewTextRequest handles variety texts
func (*TextRequest) GetMessage ¶
func (r *TextRequest) GetMessage() string
func (*TextRequest) GetPeerId ¶
func (r *TextRequest) GetPeerId() int
type Wallet ¶
type Wallet struct { Hash160 string `json:"hash160"` Address string `json:"address"` NTx int `json:"n_tx"` NUnredeemed int `json:"n_unredeemed"` TotalReceived int `json:"total_received"` TotalSent int `json:"total_sent"` FinalBalance float64 `json:"final_balance"` }
func (*Wallet) BalanceToBTC ¶
func (*Wallet) MarshalBinary ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.