Documentation ¶
Index ¶
- Variables
- func CoinToNumberInString(value *big.Int, decimal int, number_precision int) string
- func ConvertHexStringToBigInt(str string) (*big.Int, error)
- func ConvertInputValueWithDecimal(valStr string, decimals int8) string
- func NewBlockHashHandler(e *Engine, hash string) blockHashHandler
- func NewTxHashHandler(e *Engine, hash string) txHashHandler
- type Block
- type CacheData
- type Engine
- func (e *Engine) OnAfterSendMessage(hdl func(*Transaction, WalletSubscriber, PushMessage))
- func (e *Engine) OnBeforeSendMessage(hdl func(*Transaction, WalletSubscriber, PushMessage))
- func (e *Engine) SetAllowSendMessage(hdl func(*Transaction, WalletSubscriber, PushMessage) bool)
- func (e *Engine) SetDataSource(ds EngineDataSource)
- func (e *Engine) SetEngineCache(ec EngineCache)
- func (e *Engine) SetMessagePayload(hdl func(*Transaction, WalletSubscriber) map[string]interface{})
- func (e *Engine) SetMessageTitle(hdl func(*Transaction, WalletSubscriber) string)
- func (e *Engine) SetTokenDataSource(etds EngineTokenDataSource)
- func (e *Engine) Start()
- func (e *Engine) Stop()
- func (e *Engine) SubscribeWallet(walletName, address, deviceToken string)
- func (e *Engine) UnsubscribeWallet(address string)
- type EngineCache
- type EngineConfig
- type EngineDataSource
- type EngineTokenDataSource
- type InputData
- type Log
- type MessageHook
- type MethodID
- type PushMessage
- type PushResult
- type TokenContract
- type Transaction
- type TransactionReceipt
- type TxStatus
- type Wallet
- type WalletPush
- type WalletSubscriber
- type WalletSubscriberResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTransactionNotFound = errors.New("Transaction not found") ErrBlockNotFound = errors.New("Block not found") )
Functions ¶
func NewBlockHashHandler ¶
func NewTxHashHandler ¶
Types ¶
type Block ¶
type Block struct { Hash string `json:"hash"` Number string `json:"number"` Transactions []Transaction `json:"transactions"` }
type CacheData ¶
type CacheData struct { Transaction Transaction WalletSubscribers []WalletSubscriber }
type Engine ¶
type Engine struct { ChainName string // contains filtered or unexported fields }
func NewEngine ¶
func NewEngine(config EngineConfig) Engine
func (*Engine) OnAfterSendMessage ¶
func (e *Engine) OnAfterSendMessage(hdl func(*Transaction, WalletSubscriber, PushMessage))
func (*Engine) OnBeforeSendMessage ¶
func (e *Engine) OnBeforeSendMessage(hdl func(*Transaction, WalletSubscriber, PushMessage))
Hook
func (*Engine) SetAllowSendMessage ¶
func (e *Engine) SetAllowSendMessage(hdl func(*Transaction, WalletSubscriber, PushMessage) bool)
func (*Engine) SetDataSource ¶
func (e *Engine) SetDataSource(ds EngineDataSource)
func (*Engine) SetEngineCache ¶
func (e *Engine) SetEngineCache(ec EngineCache)
func (*Engine) SetMessagePayload ¶
func (e *Engine) SetMessagePayload(hdl func(*Transaction, WalletSubscriber) map[string]interface{})
func (*Engine) SetMessageTitle ¶
func (e *Engine) SetMessageTitle(hdl func(*Transaction, WalletSubscriber) string)
func (*Engine) SetTokenDataSource ¶
func (e *Engine) SetTokenDataSource(etds EngineTokenDataSource)
func (*Engine) SubscribeWallet ¶
func (*Engine) UnsubscribeWallet ¶
type EngineCache ¶
type EngineCache interface { Get(txHash string) (CacheData, error) Set(txHash string, ws []WalletSubscriber, txInfo Transaction) Remove(txHash string) }
type EngineConfig ¶
type EngineDataSource ¶
type EngineDataSource interface { FindWalletSubscribers(transactions []Transaction) []WalletSubscriberResult SubscribeWallet(walletName, walletAddress, deviceToken string) UnsubscribeWallet(walletAddress, deviceToken string) UnsubscribeWalletAllDevice(walletAddress string) }
type EngineTokenDataSource ¶
type EngineTokenDataSource interface {
FindTokens(tokenAddress []string) []TokenContract
}
type InputData ¶
type InputData struct { MethodID string `json:"method_id" bson:"method_id"` ToAddress string `json:"to_address" bson:"to_address"` Value string `json:"value" bson:"value"` ValueWithDecimals string `json:"value_with_dcms" bson:"value_with_dcms"` }
func ParseInputTx ¶
type Log ¶
type Log struct { Address string `json:"address" bson:"address"` Topics []string `json:"topics" bson:"topics"` Data string `json:"data" bson:"data"` BlockNumber string `json:"blockNumber" bson:"blockNumber"` TransactionHash string `json:"transactionHash" bson:"transactionHash"` TransactionIndex string `json:"transactionIndex" bson:"transactionIndex"` BlockHash string `json:"blockHash" bson:"blockHash"` LogIndex string `json:"logIndex" bson:"logIndex"` Removed bool `json:"removed" bson:"removed"` }
type MessageHook ¶
type MessageHook struct { MessageTitle func(*Transaction, WalletSubscriber) string MessagePayload func(*Transaction, WalletSubscriber) map[string]interface{} BeforeSend func(*Transaction, WalletSubscriber, PushMessage) AllowSend func(*Transaction, WalletSubscriber, PushMessage) bool AfterSend func(*Transaction, WalletSubscriber, PushMessage) }
type PushMessage ¶
type PushMessage struct { Title string `json:"title" bson:"title"` Sound string `json:"sound" bson:"sound"` Content string `json:"content" bson:"content"` Badge string `json:"badge" bson:"badge"` DeviceTokens []string `json:"device_tokens" bson:"device_tokens"` Payload map[string]interface{} `json:"payload" bson:"payload"` Responses []PushResult `json:"results,omitempty" bson:"results,omitempty"` }
type PushResult ¶
type TokenContract ¶
type TokenContract struct { Name string `json:"name" bson:"name"` Symbol string `json:"symbol" bson:"symbol"` TotalSupply string `json:"total_supply" bson:"total_supply"` Decimals int8 `json:"decimals" bson:"decimals"` ContractAddress string `json:"contract_address" bson:"contract_address"` ContractCreator string `json:"contract_creator" bson:"contract_creator"` }
type Transaction ¶
type Transaction struct { BlockHash string `json:"blockHash" bson:"block_hash"` BlockNumber string `json:"blockNumber" bson:"block_number"` From string `json:"from" bson:"from"` To string `json:"to" bson:"to"` Value string `json:"value" bson:"value"` Gas string `json:"gas" bson:"gas"` GasPrice string `json:"gasPrice" bson:"gas_price"` Hash string `json:"hash" bson:"hash"` Input string `json:"input" bson:"input"` TransactionIndex string `json:"transactionIndex" bson:"tx_index"` TimeStamp string `json:"timeStamp" bson:"time_stamp"` ContractAddress string `json:"contractAddress" bson:"contract_address"` TokenName string `json:"tokenName" bson:"token_name"` TokenSymbol string `json:"tokenSymbol" bson:"token_symbol"` TokenDecimal int `json:"tokenDecimal" bson:"token_decimal"` Status TxStatus `json:"-" bson:"status"` IsSeft bool `json:"isSeft"` ChainName string `json:"chainName"` Receipt TransactionReceipt }
func (*Transaction) IsNormalTx ¶
func (t *Transaction) IsNormalTx() bool
type TransactionReceipt ¶
type TransactionReceipt struct { ContractAddress string `json:"contractAddress" bson:"contract_address"` CumulativeGasUsed string `json:"cumulativeGasUsed" bson:"cumulativeGasUsed"` From string `json:"from" bson:"from"` To string `json:"to" bson:"to"` GasUsed string `json:"gasUsed" bson:"gasUsed"` Logs []Log `json:"logs" bson:"logs"` LogsBloom string `json:"logsBloom" bson:"logsBloom"` Status string `json:"status" bson:"status"` }
type WalletPush ¶
type WalletSubscriber ¶
type WalletSubscriberResult ¶
type WalletSubscriberResult struct { Transaction *Transaction Subscribers []WalletSubscriber }
Click to show internal directories.
Click to hide internal directories.