api

package
v0.0.0-...-fae8f5a Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AddressFilterVoutOff disables filtering of transactions by vout
	AddressFilterVoutOff = -1
	// AddressFilterVoutInputs specifies that only txs where the address is as input are returned
	AddressFilterVoutInputs = -2
	// AddressFilterVoutOutputs specifies that only txs where the address is as output are returned
	AddressFilterVoutOutputs = -3
	// AddressFilterVoutQueryNotNecessary signals that query for transactions is not necessary as there are no transactions for specified contract filter
	AddressFilterVoutQueryNotNecessary = -4

	// TokensToReturnNonzeroBalance - return only tokens with nonzero balance
	TokensToReturnNonzeroBalance TokensToReturn = 0
	// TokensToReturnUsed - return tokens with some transfers (even if they have zero balance now)
	TokensToReturnUsed TokensToReturn = 1
	// TokensToReturnDerived - return all derived tokens
	TokensToReturnDerived TokensToReturn = 2
)

Variables

View Source
var ErrUnsupportedXpub = errors.New("XPUB not supported")

ErrUnsupportedXpub is returned when coin type does not support xpub address derivation or provided string is not an xpub

View Source
var Text struct {
	BlockbookAbout, TOSLink string
}

Text contains static overridable texts used in explorer

Functions

func GetUniqueTxids

func GetUniqueTxids(txids []string) []string

GetUniqueTxids removes duplicate transactions

func IsZeroBigInt

func IsZeroBigInt(b *big.Int) bool

IsZeroBigInt if big int has zero value

func NewAPIError

func NewAPIError(s string, public bool) error

NewAPIError creates ApiError

Types

type APIError

type APIError struct {
	Text   string
	Public bool
}

APIError extends error by information if the error details should be returned to the end user

func (*APIError) Error

func (e *APIError) Error() string

type AccountDetails

type AccountDetails int

AccountDetails specifies what data returns GetAddress and GetXpub calls

const (
	// AccountDetailsBasic - only that address is indexed and some basic info
	AccountDetailsBasic AccountDetails = iota
	// AccountDetailsTokens - basic info + tokens
	AccountDetailsTokens
	// AccountDetailsTokenBalances - basic info + token with balance
	AccountDetailsTokenBalances
	// AccountDetailsTxidHistory - basic + token balances + txids, subject to paging
	AccountDetailsTxidHistory
	// AccountDetailsTxHistoryLight - basic + tokens + easily obtained tx data (not requiring requests to backend), subject to paging
	AccountDetailsTxHistoryLight
	// AccountDetailsTxHistory - basic + tokens + full tx data, subject to paging
	AccountDetailsTxHistory
)

type Address

type Address struct {
	Paging
	AddrStr               string               `json:"address"`
	BalanceSat            *Amount              `json:"balance"`
	TotalReceivedSat      *Amount              `json:"totalReceived,omitempty"`
	TotalSentSat          *Amount              `json:"totalSent,omitempty"`
	UnconfirmedBalanceSat *Amount              `json:"unconfirmedBalance"`
	UnconfirmedTxs        int                  `json:"unconfirmedTxs"`
	Txs                   int                  `json:"txs"`
	AddrTxCount           int                  `json:"addrTxCount,omitempty"`
	NonTokenTxs           int                  `json:"nonTokenTxs,omitempty"`
	InternalTxs           int                  `json:"internalTxs,omitempty"`
	Transactions          []*Tx                `json:"transactions,omitempty"`
	Txids                 []string             `json:"txids,omitempty"`
	Nonce                 string               `json:"nonce,omitempty"`
	UsedTokens            int                  `json:"usedTokens,omitempty"`
	Tokens                Tokens               `json:"tokens,omitempty"`
	SecondaryValue        float64              `json:"secondaryValue,omitempty"` // address value in secondary currency
	TokensBaseValue       float64              `json:"tokensBaseValue,omitempty"`
	TokensSecondaryValue  float64              `json:"tokensSecondaryValue,omitempty"`
	TotalBaseValue        float64              `json:"totalBaseValue,omitempty"`      // value including tokens in base currency
	TotalSecondaryValue   float64              `json:"totalSecondaryValue,omitempty"` // value including tokens in secondary currency
	ContractInfo          *bchain.ContractInfo `json:"contractInfo,omitempty"`
	Erc20Contract         *bchain.ContractInfo `json:"erc20Contract,omitempty"` // deprecated
	AddressAliases        AddressAliasesMap    `json:"addressAliases,omitempty"`
	// helpers for explorer
	Filter        string              `json:"-"`
	XPubAddresses map[string]struct{} `json:"-"`
}

Address holds information about address and its transactions

type AddressAlias

type AddressAlias struct {
	Type  string
	Alias string
}

type AddressAliasesMap

type AddressAliasesMap map[string]AddressAlias

type AddressFilter

type AddressFilter struct {
	Vout           int
	Contract       string
	FromHeight     uint32
	ToHeight       uint32
	TokensToReturn TokensToReturn
	// OnlyConfirmed set to true will ignore mempool transactions; mempool is also ignored if FromHeight/ToHeight filter is specified
	OnlyConfirmed bool
}

AddressFilter is used to filter data returned from GetAddress api method

type AddressUtxoV1

type AddressUtxoV1 struct {
	Txid          string  `json:"txid"`
	Vout          uint32  `json:"vout"`
	Amount        string  `json:"amount"`
	AmountSat     big.Int `json:"satoshis"`
	Height        int     `json:"height,omitempty"`
	Confirmations int     `json:"confirmations"`
}

AddressUtxoV1 is used for legacy api v1

type AddressV1

type AddressV1 struct {
	Paging
	AddrStr                 string   `json:"addrStr"`
	Balance                 string   `json:"balance"`
	TotalReceived           string   `json:"totalReceived"`
	TotalSent               string   `json:"totalSent"`
	UnconfirmedBalance      string   `json:"unconfirmedBalance"`
	UnconfirmedTxApperances int      `json:"unconfirmedTxApperances"`
	TxApperances            int      `json:"txApperances"`
	Transactions            []*TxV1  `json:"txs,omitempty"`
	Txids                   []string `json:"transactions,omitempty"`
}

AddressV1 is used for legacy api v1

type Amount

type Amount big.Int

Amount is datatype holding amounts

func (*Amount) AsBigInt

func (a *Amount) AsBigInt() big.Int

AsBigInt returns big.Int type for the Amount (empty if Amount is nil)

func (*Amount) AsInt64

func (a *Amount) AsInt64() int64

AsInt64 returns Amount as int64 (0 if Amount is nil). It is used only for legacy interfaces (socket.io) and generally not recommended to use for possible loss of precision.

func (*Amount) Compare

func (a *Amount) Compare(b *Amount) int

Compare returns an integer comparing two Amounts. The result will be 0 if a == b, -1 if a < b, and +1 if a > b. Nil Amount is always less then non nil amount, two nil Amounts are equal

func (*Amount) DecimalString

func (a *Amount) DecimalString(d int) string

DecimalString returns amount with decimal point placed according to parameter d

func (*Amount) MarshalJSON

func (a *Amount) MarshalJSON() (out []byte, err error)

MarshalJSON Amount serialization

func (*Amount) String

func (a *Amount) String() string

type AvailableVsCurrencies

type AvailableVsCurrencies struct {
	Timestamp int64    `json:"ts,omitempty"`
	Tickers   []string `json:"available_currencies"`
	Error     string   `json:"error,omitempty"`
}

AvailableVsCurrencies contains formatted data about available versus currencies for exchange rates

type BalanceHistories

type BalanceHistories []BalanceHistory

BalanceHistories is array of BalanceHistory

func (BalanceHistories) Len

func (a BalanceHistories) Len() int

func (BalanceHistories) Less

func (a BalanceHistories) Less(i, j int) bool

func (BalanceHistories) SortAndAggregate

func (a BalanceHistories) SortAndAggregate(groupByTime uint32) BalanceHistories

SortAndAggregate sums BalanceHistories to groups defined by parameter groupByTime

func (BalanceHistories) Swap

func (a BalanceHistories) Swap(i, j int)

type BalanceHistory

type BalanceHistory struct {
	Time          uint32             `json:"time"`
	Txs           uint32             `json:"txs"`
	ReceivedSat   *Amount            `json:"received"`
	SentSat       *Amount            `json:"sent"`
	SentToSelfSat *Amount            `json:"sentToSelf"`
	FiatRates     map[string]float32 `json:"rates,omitempty"`
	Txid          string             `json:"txid,omitempty"`
}

BalanceHistory contains info about one point in time of balance history

type Block

type Block struct {
	Paging
	BlockInfo
	TxCount        int               `json:"txCount"`
	Transactions   []*Tx             `json:"txs,omitempty"`
	AddressAliases AddressAliasesMap `json:"addressAliases,omitempty"`
}

Block contains information about block

type BlockInfo

type BlockInfo struct {
	Hash          string            `json:"hash"`
	Prev          string            `json:"previousBlockHash,omitempty"`
	Next          string            `json:"nextBlockHash,omitempty"`
	Height        uint32            `json:"height"`
	Confirmations int               `json:"confirmations"`
	Size          int               `json:"size"`
	Time          int64             `json:"time,omitempty"`
	Version       common.JSONNumber `json:"version"`
	MerkleRoot    string            `json:"merkleRoot"`
	Nonce         string            `json:"nonce"`
	Bits          string            `json:"bits"`
	Difficulty    string            `json:"difficulty"`
	Txids         []string          `json:"tx,omitempty"`
}

BlockInfo contains extended block header data and a list of block txids

type BlockRaw

type BlockRaw struct {
	Hex string `json:"hex"`
}

BlockRaw contains raw block in hex

type BlockV1

type BlockV1 struct {
	Paging
	BlockInfo
	TxCount      int     `json:"txCount"`
	Transactions []*TxV1 `json:"txs,omitempty"`
}

BlockV1 contains information about block

type BlockbookInfo

type BlockbookInfo struct {
	Coin                         string                       `json:"coin"`
	Host                         string                       `json:"host"`
	Version                      string                       `json:"version"`
	GitCommit                    string                       `json:"gitCommit"`
	BuildTime                    string                       `json:"buildTime"`
	SyncMode                     bool                         `json:"syncMode"`
	InitialSync                  bool                         `json:"initialSync"`
	InSync                       bool                         `json:"inSync"`
	BestHeight                   uint32                       `json:"bestHeight"`
	LastBlockTime                time.Time                    `json:"lastBlockTime"`
	InSyncMempool                bool                         `json:"inSyncMempool"`
	LastMempoolTime              time.Time                    `json:"lastMempoolTime"`
	MempoolSize                  int                          `json:"mempoolSize"`
	Decimals                     int                          `json:"decimals"`
	DbSize                       int64                        `json:"dbSize"`
	HasFiatRates                 bool                         `json:"hasFiatRates,omitempty"`
	HasTokenFiatRates            bool                         `json:"hasTokenFiatRates,omitempty"`
	CurrentFiatRatesTime         *time.Time                   `json:"currentFiatRatesTime,omitempty"`
	HistoricalFiatRatesTime      *time.Time                   `json:"historicalFiatRatesTime,omitempty"`
	HistoricalTokenFiatRatesTime *time.Time                   `json:"historicalTokenFiatRatesTime,omitempty"`
	DbSizeFromColumns            int64                        `json:"dbSizeFromColumns,omitempty"`
	DbColumns                    []common.InternalStateColumn `json:"dbColumns,omitempty"`
	About                        string                       `json:"about"`
}

BlockbookInfo contains information about the running blockbook instance

type Blocks

type Blocks struct {
	Paging
	Blocks []db.BlockInfo `json:"blocks"`
}

Blocks is list of blocks with paging information

type EthereumInternalTransfer

type EthereumInternalTransfer struct {
	Type  bchain.EthereumInternalTransactionType `json:"type"`
	From  string                                 `json:"from"`
	To    string                                 `json:"to"`
	Value *Amount                                `json:"value"`
}

type EthereumSpecific

type EthereumSpecific struct {
	Type              bchain.EthereumInternalTransactionType `json:"type,omitempty"`
	CreatedContract   string                                 `json:"createdContract,omitempty"`
	Status            eth.TxStatus                           `json:"status"` // 1 OK, 0 Fail, -1 pending
	Error             string                                 `json:"error,omitempty"`
	Nonce             uint64                                 `json:"nonce"`
	GasLimit          *big.Int                               `json:"gasLimit"`
	GasUsed           *big.Int                               `json:"gasUsed,omitempty"`
	GasPrice          *Amount                                `json:"gasPrice"`
	Data              string                                 `json:"data,omitempty"`
	ParsedData        *bchain.EthereumParsedInputData        `json:"parsedData,omitempty"`
	InternalTransfers []EthereumInternalTransfer             `json:"internalTransfers,omitempty"`
}

EthereumSpecific contains ethereum specific transaction data

type FeeStats

type FeeStats struct {
	TxCount         int       `json:"txCount"`
	TotalFeesSat    *Amount   `json:"totalFeesSat"`
	AverageFeePerKb int64     `json:"averageFeePerKb"`
	DecilesFeePerKb [11]int64 `json:"decilesFeePerKb"`
}

FeeStats contains detailed block fee statistics

type FiatTicker

type FiatTicker struct {
	Timestamp int64              `json:"ts,omitempty"`
	Rates     map[string]float32 `json:"rates"`
	Error     string             `json:"error,omitempty"`
}

FiatTicker contains formatted CurrencyRatesTicker data

type FiatTickers

type FiatTickers struct {
	Tickers []FiatTicker `json:"tickers"`
}

FiatTickers contains a formatted CurrencyRatesTicker list

type MempoolTxid

type MempoolTxid struct {
	Time int64  `json:"time"`
	Txid string `json:"txid"`
}

MempoolTxid contains information about a transaction in mempool

type MempoolTxids

type MempoolTxids struct {
	Paging
	Mempool     []MempoolTxid `json:"mempool"`
	MempoolSize int           `json:"mempoolSize"`
}

MempoolTxids contains a list of mempool txids with paging information

type MultiTokenValue

type MultiTokenValue struct {
	Id    *Amount `json:"id,omitempty"`
	Value *Amount `json:"value,omitempty"`
}

MultiTokenValue contains values for contract with id and value (like ERC1155)

type Paging

type Paging struct {
	Page        int `json:"page,omitempty"`
	TotalPages  int `json:"totalPages,omitempty"`
	ItemsOnPage int `json:"itemsOnPage,omitempty"`
}

Paging contains information about paging for address, blocks and block

type ScriptPubKeyV1

type ScriptPubKeyV1 struct {
	Hex       string                   `json:"hex,omitempty"`
	Asm       string                   `json:"asm,omitempty"`
	AddrDesc  bchain.AddressDescriptor `json:"-"`
	Addresses []string                 `json:"addresses"`
	IsAddress bool                     `json:"-"`
	Type      string                   `json:"type,omitempty"`
}

ScriptPubKeyV1 is used for legacy api v1

type ScriptSigV1

type ScriptSigV1 struct {
	Hex string `json:"hex,omitempty"`
	Asm string `json:"asm,omitempty"`
}

ScriptSigV1 is used for legacy api v1

type SystemInfo

type SystemInfo struct {
	Blockbook *BlockbookInfo      `json:"blockbook"`
	Backend   *common.BackendInfo `json:"backend"`
}

SystemInfo contains information about the running blockbook and backend instance

type Token

type Token struct {
	Type             bchain.TokenTypeName `json:"type" ts_type:"'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155'"`
	Name             string               `json:"name"`
	Path             string               `json:"path,omitempty"`
	Contract         string               `json:"contract,omitempty"`
	Transfers        int                  `json:"transfers"`
	Symbol           string               `json:"symbol,omitempty"`
	Decimals         int                  `json:"decimals,omitempty"`
	BalanceSat       *Amount              `json:"balance,omitempty"`
	BaseValue        float64              `json:"baseValue,omitempty"`        // value in the base currency (ETH for Ethereum)
	SecondaryValue   float64              `json:"secondaryValue,omitempty"`   // value in secondary (fiat) currency, if specified
	Ids              []Amount             `json:"ids,omitempty"`              // multiple ERC721 tokens
	MultiTokenValues []MultiTokenValue    `json:"multiTokenValues,omitempty"` // multiple ERC1155 tokens
	TotalReceivedSat *Amount              `json:"totalReceived,omitempty"`
	TotalSentSat     *Amount              `json:"totalSent,omitempty"`
	ContractIndex    string               `json:"-"`
}

Token contains info about tokens held by an address

type TokenTransfer

type TokenTransfer struct {
	Type             bchain.TokenTypeName `json:"type"`
	From             string               `json:"from"`
	To               string               `json:"to"`
	Contract         string               `json:"contract"`
	Name             string               `json:"name"`
	Symbol           string               `json:"symbol"`
	Decimals         int                  `json:"decimals"`
	Value            *Amount              `json:"value,omitempty"`
	MultiTokenValues []MultiTokenValue    `json:"multiTokenValues,omitempty"`
}

TokenTransfer contains info about a token transfer done in a transaction

type Tokens

type Tokens []Token

Tokens is array of Token

func (Tokens) Len

func (a Tokens) Len() int

func (Tokens) Less

func (a Tokens) Less(i, j int) bool

func (Tokens) Swap

func (a Tokens) Swap(i, j int)

type TokensToReturn

type TokensToReturn int

TokensToReturn specifies what tokens are returned by GetAddress and GetXpubAddress

type Tx

type Tx struct {
	Txid                   string            `json:"txid"`
	Version                int32             `json:"version,omitempty"`
	Locktime               uint32            `json:"lockTime,omitempty"`
	Vin                    []Vin             `json:"vin"`
	Vout                   []Vout            `json:"vout"`
	Blockhash              string            `json:"blockHash,omitempty"`
	Blockheight            int               `json:"blockHeight"`
	Confirmations          uint32            `json:"confirmations"`
	ConfirmationETABlocks  uint32            `json:"confirmationETABlocks,omitempty"`
	ConfirmationETASeconds int64             `json:"confirmationETASeconds,omitempty"`
	Blocktime              int64             `json:"blockTime"`
	Size                   int               `json:"size,omitempty"`
	VSize                  int               `json:"vsize,omitempty"`
	ValueOutSat            *Amount           `json:"value"`
	ValueInSat             *Amount           `json:"valueIn,omitempty"`
	FeesSat                *Amount           `json:"fees,omitempty"`
	Hex                    string            `json:"hex,omitempty"`
	Rbf                    bool              `json:"rbf,omitempty"`
	CoinSpecificData       json.RawMessage   `json:"coinSpecificData,omitempty" ts_type:"any"`
	TokenTransfers         []TokenTransfer   `json:"tokenTransfers,omitempty"`
	EthereumSpecific       *EthereumSpecific `json:"ethereumSpecific,omitempty"`
	AddressAliases         AddressAliasesMap `json:"addressAliases,omitempty"`
}

Tx holds information about a transaction

type TxV1

type TxV1 struct {
	Txid          string   `json:"txid"`
	Version       int32    `json:"version,omitempty"`
	Locktime      uint32   `json:"locktime,omitempty"`
	Vin           []VinV1  `json:"vin"`
	Vout          []VoutV1 `json:"vout"`
	Blockhash     string   `json:"blockhash,omitempty"`
	Blockheight   int      `json:"blockheight"`
	Confirmations uint32   `json:"confirmations"`
	Time          int64    `json:"time,omitempty"`
	Blocktime     int64    `json:"blocktime"`
	ValueOut      string   `json:"valueOut"`
	ValueOutSat   big.Int  `json:"-"`
	Size          int      `json:"size,omitempty"`
	ValueIn       string   `json:"valueIn"`
	ValueInSat    big.Int  `json:"-"`
	Fees          string   `json:"fees"`
	FeesSat       big.Int  `json:"-"`
	Hex           string   `json:"hex"`
}

TxV1 is used for legacy api v1

type Utxo

type Utxo struct {
	Txid          string  `json:"txid"`
	Vout          int32   `json:"vout"`
	AmountSat     *Amount `json:"value"`
	Height        int     `json:"height,omitempty"`
	Confirmations int     `json:"confirmations"`
	Address       string  `json:"address,omitempty"`
	Path          string  `json:"path,omitempty"`
	Locktime      uint32  `json:"lockTime,omitempty"`
	Coinbase      bool    `json:"coinbase,omitempty"`
}

Utxo is one unspent transaction output

type Utxos

type Utxos []Utxo

Utxos is array of Utxo

func (Utxos) Len

func (a Utxos) Len() int

func (Utxos) Less

func (a Utxos) Less(i, j int) bool

func (Utxos) Swap

func (a Utxos) Swap(i, j int)

type Vin

type Vin struct {
	Txid      string                   `json:"txid,omitempty"`
	Vout      uint32                   `json:"vout,omitempty"`
	Sequence  int64                    `json:"sequence,omitempty"`
	N         int                      `json:"n"`
	AddrDesc  bchain.AddressDescriptor `json:"-"`
	Addresses []string                 `json:"addresses,omitempty"`
	IsAddress bool                     `json:"isAddress"`
	IsOwn     bool                     `json:"isOwn,omitempty"`
	ValueSat  *Amount                  `json:"value,omitempty"`
	Hex       string                   `json:"hex,omitempty"`
	Asm       string                   `json:"asm,omitempty"`
	Coinbase  string                   `json:"coinbase,omitempty"`
}

Vin contains information about single transaction input

type VinV1

type VinV1 struct {
	Txid      string                   `json:"txid"`
	Vout      uint32                   `json:"vout"`
	Sequence  int64                    `json:"sequence,omitempty"`
	N         int                      `json:"n"`
	ScriptSig ScriptSigV1              `json:"scriptSig"`
	AddrDesc  bchain.AddressDescriptor `json:"-"`
	Addresses []string                 `json:"addresses"`
	IsAddress bool                     `json:"-"`
	Value     string                   `json:"value"`
	ValueSat  big.Int                  `json:"-"`
}

VinV1 is used for legacy api v1

type Vout

type Vout struct {
	ValueSat    *Amount                  `json:"value,omitempty"`
	N           int                      `json:"n"`
	Spent       bool                     `json:"spent,omitempty"`
	SpentTxID   string                   `json:"spentTxId,omitempty"`
	SpentIndex  int                      `json:"spentIndex,omitempty"`
	SpentHeight int                      `json:"spentHeight,omitempty"`
	Hex         string                   `json:"hex,omitempty"`
	Asm         string                   `json:"asm,omitempty"`
	AddrDesc    bchain.AddressDescriptor `json:"-"`
	Addresses   []string                 `json:"addresses"`
	IsAddress   bool                     `json:"isAddress"`
	IsOwn       bool                     `json:"isOwn,omitempty"`
	Type        string                   `json:"type,omitempty"`
}

Vout contains information about single transaction output

type VoutV1

type VoutV1 struct {
	Value        string         `json:"value"`
	ValueSat     big.Int        `json:"-"`
	N            int            `json:"n"`
	ScriptPubKey ScriptPubKeyV1 `json:"scriptPubKey"`
	Spent        bool           `json:"spent"`
	SpentTxID    string         `json:"spentTxId,omitempty"`
	SpentIndex   int            `json:"spentIndex,omitempty"`
	SpentHeight  int            `json:"spentHeight,omitempty"`
}

VoutV1 is used for legacy api v1

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker is handle to api worker

func NewWorker

func NewWorker(db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState, fiatRates *fiat.FiatRates) (*Worker, error)

NewWorker creates new api worker

func (*Worker) AddressToV1

func (w *Worker) AddressToV1(a *Address) *AddressV1

AddressToV1 converts Address to AddressV1

func (*Worker) AddressUtxoToV1

func (w *Worker) AddressUtxoToV1(au Utxos) []AddressUtxoV1

AddressUtxoToV1 converts []AddressUtxo to []AddressUtxoV1

func (*Worker) BlockToV1

func (w *Worker) BlockToV1(b *Block) *BlockV1

BlockToV1 converts Address to Address1

func (*Worker) ComputeFeeStats

func (w *Worker) ComputeFeeStats(blockFrom, blockTo int, stopCompute chan os.Signal) error

ComputeFeeStats computes fee distribution in defined blocks and logs them to log

func (*Worker) EstimateFee

func (w *Worker) EstimateFee(blocks int, conservative bool) (big.Int, error)

EstimateFee returns a fee estimation for given number of blocks it uses 10 second cache to reduce calls to the backend

func (*Worker) GetAddress

func (w *Worker) GetAddress(address string, page int, txsOnPage int, option AccountDetails, filter *AddressFilter, secondaryCoin string) (*Address, error)

GetAddress computes address value and gets transactions for given address

func (*Worker) GetAddressUtxo

func (w *Worker) GetAddressUtxo(address string, onlyConfirmed bool) (Utxos, error)

GetAddressUtxo returns unspent outputs for given address

func (*Worker) GetAvailableVsCurrencies

func (w *Worker) GetAvailableVsCurrencies(timestamp int64, token string) (*AvailableVsCurrencies, error)

GetAvailableVsCurrencies returns the list of available versus currencies for exchange rates

func (*Worker) GetBalanceHistory

func (w *Worker) GetBalanceHistory(address string, fromTimestamp, toTimestamp int64, currencies []string, groupBy uint32) (BalanceHistories, error)

GetBalanceHistory returns history of balance for given address

func (*Worker) GetBlock

func (w *Worker) GetBlock(bid string, page int, txsOnPage int) (*Block, error)

GetBlock returns paged data about block

func (*Worker) GetBlockRaw

func (w *Worker) GetBlockRaw(bid string) (*BlockRaw, error)

GetBlock returns paged data about block

func (*Worker) GetBlocks

func (w *Worker) GetBlocks(page int, blocksOnPage int) (*Blocks, error)

GetBlocks returns BlockInfo for blocks on given page

func (*Worker) GetContractBaseRate

func (w *Worker) GetContractBaseRate(ticker *common.CurrencyRatesTicker, token string, timestamp int64) (float64, bool)

GetContractBaseRate returns contract rate in base coin from the ticker or DB at the timestamp. Zero timestamp means now.

func (*Worker) GetCurrentFiatRates

func (w *Worker) GetCurrentFiatRates(currencies []string, token string) (*FiatTicker, error)

GetCurrentFiatRates returns last available fiat rates

func (*Worker) GetEthereumTokenURI

func (w *Worker) GetEthereumTokenURI(contract string, id string) (string, *bchain.ContractInfo, error)

func (*Worker) GetFeeStats

func (w *Worker) GetFeeStats(bid string) (*FeeStats, error)

GetFeeStats returns statistics about block fees

func (*Worker) GetFiatRatesForBlockID

func (w *Worker) GetFiatRatesForBlockID(blockID string, currencies []string, token string) (*FiatTicker, error)

GetFiatRatesForBlockID returns fiat rates for block height or block hash

func (*Worker) GetFiatRatesForTimestamps

func (w *Worker) GetFiatRatesForTimestamps(timestamps []int64, currencies []string, token string) (*FiatTickers, error)

GetFiatRatesForTimestamps returns fiat rates for each of the provided dates

func (*Worker) GetMempool

func (w *Worker) GetMempool(page int, itemsOnPage int) (*MempoolTxids, error)

GetMempool returns a page of mempool txids

func (*Worker) GetSpendingTxid

func (w *Worker) GetSpendingTxid(txid string, n int) (string, error)

GetSpendingTxid returns transaction id of transaction that spent given output

func (*Worker) GetSystemInfo

func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error)

GetSystemInfo returns information about system

func (*Worker) GetTransaction

func (w *Worker) GetTransaction(txid string, spendingTxs bool, specificJSON bool) (*Tx, error)

GetTransaction reads transaction data from txid

func (*Worker) GetTransactionFromMempoolTx

func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx, error)

GetTransactionFromMempoolTx converts bchain.MempoolTx to Tx, with limited amount of data it is not doing any request to backend or to db

func (*Worker) GetXpubAddress

func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option AccountDetails, filter *AddressFilter, gap int, secondaryCoin string) (*Address, error)

GetXpubAddress computes address value and gets transactions for given address

func (*Worker) GetXpubBalanceHistory

func (w *Worker) GetXpubBalanceHistory(xpub string, fromTimestamp, toTimestamp int64, currencies []string, gap int, groupBy uint32) (BalanceHistories, error)

GetXpubBalanceHistory returns history of balance for given xpub

func (*Worker) GetXpubUtxo

func (w *Worker) GetXpubUtxo(xpub string, onlyConfirmed bool, gap int) (Utxos, error)

GetXpubUtxo returns unspent outputs for given xpub

func (*Worker) IsRefetchingInternalData

func (w *Worker) IsRefetchingInternalData() bool

func (*Worker) RefetchInternalData

func (w *Worker) RefetchInternalData() error

func (*Worker) RefetchInternalDataRoutine

func (w *Worker) RefetchInternalDataRoutine()

func (*Worker) TxToV1

func (w *Worker) TxToV1(tx *Tx) *TxV1

TxToV1 converts Tx to TxV1

Jump to

Keyboard shortcuts

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