Documentation ¶
Index ¶
- Constants
- type MongoDAO
- func (dao *MongoDAO) AddAddressInfo(AddressInfo *insightjson.AddressInfo) error
- func (dao *MongoDAO) AddBlock(Block *insightjson.BlockResult) error
- func (dao *MongoDAO) AddTransaction(transaction *insightjson.Tx) error
- func (dao *MongoDAO) Connect()
- func (dao *MongoDAO) DropDatabase() error
- func (dao *MongoDAO) GetAddressInfo(address string) (insightjson.AddressInfo, error)
- func (dao *MongoDAO) GetAddressUTXO(address string) []insightjson.UnpsentOutput
- func (dao *MongoDAO) GetBlock(hash *chainhash.Hash) (*insightjson.BlockResult, error)
- func (dao *MongoDAO) GetLastBlock() (insightjson.BlockResult, error)
- func (dao *MongoDAO) GetTransaction(txid string) (insightjson.Tx, error)
- func (dao *MongoDAO) RollbackAddressInfoReceived(AddressInfo *insightjson.AddressInfo, receivedSat int64, confirmed bool, ...) error
- func (dao *MongoDAO) RollbackAddressInfoSent(AddressInfo *insightjson.AddressInfo, sentSat int64, confirmed bool, ...) error
- func (dao *MongoDAO) UpdateAddressInfoReceived(AddressInfo *insightjson.AddressInfo, receivedSat int64, confirmed bool, ...) error
- func (dao *MongoDAO) UpdateAddressInfoSent(AddressInfo *insightjson.AddressInfo, sentSat int64, confirmed bool, ...) error
- func (dao *MongoDAO) UpdateTransaction(tx *insightjson.Tx) error
Constants ¶
const ( // Coin <~> Database VIA dbName = "viacoin" BTC dbName = "bitcoin" LTC dbName = "litecoin" TEST dbName = "explorer-test" // Collection names TRANSACTIONS = "Transactions" BLOCKS = "Blocks" ADDRESSINFO = "AddressInfo" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoDAO ¶
func (*MongoDAO) AddAddressInfo ¶
func (dao *MongoDAO) AddAddressInfo(AddressInfo *insightjson.AddressInfo) error
add addressInfo to the database
func (*MongoDAO) AddBlock ¶
func (dao *MongoDAO) AddBlock(Block *insightjson.BlockResult) error
func (*MongoDAO) AddTransaction ¶
func (dao *MongoDAO) AddTransaction(transaction *insightjson.Tx) error
add transaction to the database. Make sure the txid is unique.
func (*MongoDAO) DropDatabase ¶
delete the database. Only use for testing
func (*MongoDAO) GetAddressInfo ¶
func (dao *MongoDAO) GetAddressInfo(address string) (insightjson.AddressInfo, error)
func (*MongoDAO) GetAddressUTXO ¶
func (dao *MongoDAO) GetAddressUTXO(address string) []insightjson.UnpsentOutput
Get the unspent outs of an address by getting the addressInfo of an address and aggregate over all transaction id's from the past get the tx info from the database and check for the vouts example: https://explorer.viacoin.org/api/addr/VmkyKgGBWDpcnFCtw8rvcYqg8xr7U4Ubzx/utxo
func (*MongoDAO) GetBlock ¶
func (dao *MongoDAO) GetBlock(hash *chainhash.Hash) (*insightjson.BlockResult, error)
func (*MongoDAO) GetLastBlock ¶
func (dao *MongoDAO) GetLastBlock() (insightjson.BlockResult, error)
get the latest block and return it in insightjson format
func (*MongoDAO) GetTransaction ¶
func (dao *MongoDAO) GetTransaction(txid string) (insightjson.Tx, error)
Find transactions by txid in the database
func (*MongoDAO) RollbackAddressInfoReceived ¶
func (dao *MongoDAO) RollbackAddressInfoReceived(AddressInfo *insightjson.AddressInfo, receivedSat int64, confirmed bool, txid string) error
Update addressInfo by searching with the address string
func (*MongoDAO) RollbackAddressInfoSent ¶
func (dao *MongoDAO) RollbackAddressInfoSent(AddressInfo *insightjson.AddressInfo, sentSat int64, confirmed bool, txid string) error
Rollback address info sent. This is part of a chain rollback.
func (*MongoDAO) UpdateAddressInfoReceived ¶
func (dao *MongoDAO) UpdateAddressInfoReceived(AddressInfo *insightjson.AddressInfo, receivedSat int64, confirmed bool, txid string) error
Update addressInfo by searching with the address string
func (*MongoDAO) UpdateAddressInfoSent ¶
func (dao *MongoDAO) UpdateAddressInfoSent(AddressInfo *insightjson.AddressInfo, sentSat int64, confirmed bool, txid string) error
func (*MongoDAO) UpdateTransaction ¶
func (dao *MongoDAO) UpdateTransaction(tx *insightjson.Tx) error
Update Transaction by txid