store

package
v0.0.0-...-a3e8eeb Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package store provides interface to interact with herdius blockchain transaction without connect to herdius blockchain server.

Index

Constants

View Source
const StatusPending = "pending"

StatusPending indicates a TX is in pending state

Variables

This section is empty.

Functions

func SyncPendingTxs

func SyncPendingTxs(s Storer, net *network.Network, env string) error

SyncPendingTxs syncs pending status with core

Types

type Storer

type Storer interface {
	Save(*Tx) error
	Update(*Tx) error
	Get(id string) (*Tx, error)
	GetBySender(address string) ([]*Tx, error)
	GetByAssetAndSender(asset, address string) ([]*Tx, error)
	GetByStatus(status string) ([]*Tx, error)
	GetTxByTypeBlockHeight(txType string, height uint64) ([]*Tx, error)
	GetLatestBlockID() (uint64, error)
	GetLastSyncBlockID() uint64
	SaveLastSyncBlockID(blockID uint64) error
}

Storer is the interface to manipulate blockchain transaction.

type Tx

type Tx struct {
	ID              string    `db:"id"`
	SenderAddress   string    `db:"sender_address"`
	SenderPubKey    string    `db:"sender_pubkey"`
	ReceiverAddress string    `db:"receiver_address"`
	Category        string    `db:"category"`
	Symbol          string    `db:"symbol"`
	Network         string    `db:"network"`
	Value           uint64    `db:"value"`
	LockedAmount    uint64    `db:"locked_amount"`
	Nonce           uint64    `db:"nonce"`
	Message         string    `db:"message"`
	Sign            string    `db:"sign"`
	Status          string    `db:"status"`
	BlockID         uint64    `db:"block_id"`
	CreationDT      time.Time `db:"created_date"`
	Type            string    `db:"type"`
	Data            string    `db:"data"`
	EthAddress      string    `db:"eth_address"`
	BtcAddress      string    `db:"btc_address"`
	LtcAddress      string    `db:"ltc_address"`
	XtzAddress      string    `db:"xtz_address"`
	BnbAddress      string    `db:"bnb_address"`
}

Tx ...

func FromTxDetailResponse

func FromTxDetailResponse(txDetail *protobuf.TxDetailResponse) *Tx

FromTxDetailResponse creates a Tx from TxDetailResponse

func (*Tx) ToTxDetailResponse

func (tx *Tx) ToTxDetailResponse() *protobuf.TxDetailResponse

ToTxDetailResponse converts a Tx to TxDetailResponse.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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