model

package
v0.0.0-...-13d5c5d Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BalancePrefix = "balance:"

	// WARNING: the maintained address set only supports bash32 encoded address
	AddressSetKey = "address:set"

	// channels
	// update block tip
	UpdateBlockTip = "block:tip"
	MempoolTxTip   = "transaction:tip"
	FeeRateKey     = "transaction:feeRate"
	// notify balance for wormhole
	BalanceUpdated = "balance:wormhole:updated"

	// Redis will persist the balance information for 20 minute unless the program
	// refresh it or timeout.
	BalanceExpire = 1200
)

Variables

This section is empty.

Functions

func Begin

func Begin() *gorm.DB

func ConnRedis

func ConnRedis() error

func CreateSession

func CreateSession(session *common.Session) error

func CreateWallet

func CreateWallet(model *common.Wallet) error

func GetAllActiveCrowdSaleCount

func GetAllActiveCrowdSaleCount(keyword string) (int, error)

func GetBalanceForAddress

func GetBalanceForAddress(addresses []string) (map[string][]model.BalanceForAddress, error)

func GetBalanceForAddresses

func GetBalanceForAddresses(addrs []string) (map[string][]model.BalanceForAddress, error)

func GetFeeRate

func GetFeeRate() (*view.FeeRate, error)

func GetHistoryDetail

func GetHistoryDetail(tx_hash string) (string, error)

func GetHistoryListCount

func GetHistoryListCount(addrs []string, pid int) (int, error)

func GetHistorySpDetail

func GetHistorySpDetail(tx_hash string) (string, error)

func GetLastBlock

func GetLastBlock() *common.Block

func GetNewestVersionFroDevice

func GetNewestVersionFroDevice(device string) (*model.Version, error)

func GetNotificationItem

func GetNotificationItem(address string, pid int64, txID int) (*model.AddressesInTx, error)

func GetPropertiesNumberByAddresses

func GetPropertiesNumberByAddresses(addresses []string) (int, error)

func GetPropertyById

func GetPropertyById(pid uint64) (string, error)

func GetPropertyByKeyword

func GetPropertyByKeyword(keyword string) ([]string, error)

support query via property name or property id input

func GetPropertyByName

func GetPropertyByName(name string) ([]string, error)

func GetPropertyName

func GetPropertyName(pid uint64) (string, error)

func GetPurchasedCrowdsaleNumber

func GetPurchasedCrowdsaleNumber(pid uint64) (int, error)

func GetSessionById

func GetSessionById(id string) (*common.Session, bool)

func GetWalletById

func GetWalletById(id string) (*common.Wallet, bool)

func InsertAddressesInTx

func InsertAddressesInTx(addrInTx *common.AddressesInTx, dbtx *gorm.DB) error

func InsertTx

func InsertTx(tx *common.Tx, dbtx *gorm.DB) (int, error)

func InsertTxJson

func InsertTxJson(txJson *common.TxJson, dbtx *gorm.DB) error

func IsExistTx

func IsExistTx(txid string, protocol common.Protocol) bool

func ListOwners

func ListOwners(pageSize int, pageNo int, propertyId int) ([]view.AddressBalance, error)

func ListOwnersCount

func ListOwnersCount(propertyId int) (int64, error)

func PropertyListCount

func PropertyListCount(keyword string) (int, error)

func Publish

func Publish(channel string, msg string) error

func QueryTotal

func QueryTotal(property_id int64, address string) (int64, error)

func QueryTransactions

func QueryTransactions(property_id int64, address string, start, count int64) ([]string, error)

func StoreBalanceForAddress

func StoreBalanceForAddress(bals map[string][]model.BalanceForAddress) error

func StoreFeeRate

func StoreFeeRate(fee *view.FeeRate) error

func StoreNotification

func StoreNotification(addr string, item *model.AddressesInTx) error

func Subscribe

func Subscribe(ctx context.Context, channel string, ret chan<- []byte) error

func UpdateSessionById

func UpdateSessionById(session *common.Session) error

func UpdateWallet

func UpdateWallet(wallet *common.Wallet) error

func VerifyWalletByEmail

func VerifyWalletByEmail(email string) bool

Types

type APINotify

type APINotify struct {
	Address                     string            `json:"address"`
	PropertyID                  int64             `json:"property_id"`
	PropertyName                string            `json:"property_name"`
	Protocol                    model.Protocol    `json:"protocol"`
	AddressRole                 model.AddressRole `json:"address_role"`
	BalanceAvailableCreditDebit *decimal.Decimal  `json:"balance_available_credit_debit"`
	BalanceReservedCreditDebit  *decimal.Decimal  `json:"balance_reserved_credit_debit"`
	BalanceAcceptedCreditDebit  *decimal.Decimal  `json:"balance_accepted_credit_debit"`
	BalanceFrozenCreditDebit    *decimal.Decimal  `json:"balance_frozen_credit_debit"`
	Timestamp                   int64             `json:"block_time"`
	TxTypeName                  string            `json:"tx_type_name"`
}

func FilterNotification

func FilterNotification(addresses []string, from int64, to int64) ([]APINotify, error)

type AddressPropertyListWithBalance

type AddressPropertyListWithBalance struct {
	Balance  float64     `json:"balance"`
	Property interface{} `json:"property"`
}

func GetPropertyListByAddress

func GetPropertyListByAddress(addr string) ([]AddressPropertyListWithBalance, error)

type AddressesInTxInherit

type AddressesInTxInherit struct {
	TxTypeName   string
	PropertyName string
	BlockTime    int64
	model.AddressesInTx
}

type CrowdSaleList

type CrowdSaleList struct {
	PropertyData string `json:"property_data"`
	BlockTime    int64  `json:"block_time"`
}

func GetAllActiveCrowdSale

func GetAllActiveCrowdSale(keyword string, pagesize int, pageno int) ([]CrowdSaleList, error)

type HistoryList

type HistoryList struct {
	TxHash                      string          `json:"tx_hash" gorm:"column:tx_hash"`
	TxType                      int32           `json:"tx_type" gorm:"column:tx_type"`
	TxState                     string          `json:"tx_state" gorm:"column:tx_state"`
	Address                     string          `json:"address"`
	AddressRole                 string          `json:"address_role" gorm:"column:address_role"`
	BalanceAvailableCreditDebit decimal.Decimal `json:"balance_available_credit_debit" gorm:"column:balance_available_credit_debit"`
	BlockTime                   int64           `json:"block_time" gorm:"column:block_time"`
	PropertyName                string          `json:"property_name" gorm:"column:property_name"`
	PropertyID                  uint64          `json:"property_id" gorm:"column:property_id"`
}

func GetHistoryList

func GetHistoryList(addrs []string, pid, pageSize, pageNo int) ([]HistoryList, error)

type PropertiesByAddresses

type PropertiesByAddresses struct {
	TxData       string `json:"tx_data"`
	PropertyData string `json:"property_data"`
}

func GetPropertiesByAddresses

func GetPropertiesByAddresses(addresses []string, pageSize, pageNo int) ([]PropertiesByAddresses, error)

type PropertyWithTime

type PropertyWithTime struct {
	PropertyData string `json:"property_data"`
	BlockTime    int64  `json:"block_time"`
}

func ListAllProperties

func ListAllProperties(keyword string, pageSize, pageNo int) ([]PropertyWithTime, error)

type PurchaseCrowdSaleRecode

type PurchaseCrowdSaleRecode struct {
	Fee                        string      `json:"fee"`
	Txid                       string      `json:"txid"`
	Type                       string      `json:"type"`
	Block                      int         `json:"block"`
	Valid                      bool        `json:"valid"`
	Amount                     string      `json:"amount"`
	Ismine                     bool        `json:"ismine"`
	Version                    int         `json:"version"`
	Subsends                   interface{} `json:"subsends"`
	TypeInt                    int         `json:"type_int"`
	Blockhash                  string      `json:"blockhash"`
	Blocktime                  int         `json:"blocktime"`
	Precision                  string      `json:"precision"`
	Propertyid                 int         `json:"propertyid"`
	Issuertokens               string      `json:"issuertokens"`
	Confirmations              int         `json:"confirmations"`
	Actualinvested             string      `json:"actualinvested"`
	Sendingaddress             string      `json:"sendingaddress"`
	Purchasedtokens            string      `json:"purchasedtokens"`
	Referenceaddress           string      `json:"referenceaddress"`
	Purchasedpropertyid        int         `json:"purchasedpropertyid"`
	Purchasedpropertyname      string      `json:"purchasedpropertyname"`
	Purchasedpropertyprecision string      `json:"purchasedpropertyprecision"`
}

func ListPurchaseCrowdsaleTxes

func ListPurchaseCrowdsaleTxes(pid uint64, pageSize, pageNo int) ([]PurchaseCrowdSaleRecode, error)

type QuestionAnswer

type QuestionAnswer struct {
	Question string `json:"question"`
	Answer   string `json:"answer"`
}

type Secret

type Secret struct {
	Value    string    `json:"Value"`
	CreateAt time.Time `json:"create_at"`
	UpdateAt time.Time `json:"update_at"`
}

type WalletSetting

type WalletSetting struct {
	MfaSecret Secret `json:"mfa_secret"`
	Asq       Secret `json:"asq"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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