types

package
v0.0.0-...-ae82b82 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScriptPubKeyDisplay

func ScriptPubKeyDisplay(scriptPubKey ScriptPubKey) string

Types

type BTCString

type BTCString string

func (*BTCString) MarshalJSON

func (b *BTCString) MarshalJSON() ([]byte, error)

func (*BTCString) NonZero

func (b *BTCString) NonZero() bool

func (BTCString) String

func (b BTCString) String() string

func (*BTCString) UnmarshalJSON

func (b *BTCString) UnmarshalJSON(data []byte) error

type BigInt

type BigInt struct {
	big.Int
}

TODO: Fix pointer/non-pointer issues

func FromBTCString

func FromBTCString(btc BTCString) *BigInt

func FromMathBigInt

func FromMathBigInt(i *big.Int) *BigInt

func ValueToBigInt

func ValueToBigInt(value BTCString) *BigInt

func (*BigInt) BigFloat

func (b *BigInt) BigFloat() *big.Float

func (*BigInt) BigInt

func (b *BigInt) BigInt() *big.Int

func (*BigInt) MarshalJSON

func (b *BigInt) MarshalJSON() ([]byte, error)

func (*BigInt) Positive

func (b *BigInt) Positive() bool

func (*BigInt) SatoshisToBTC

func (b *BigInt) SatoshisToBTC(strip bool) string

func (*BigInt) Scan

func (b *BigInt) Scan(src interface{}) error

func (*BigInt) UnmarshalJSON

func (b *BigInt) UnmarshalJSON(data []byte) error

func (BigInt) Value

func (b BigInt) Value() (driver.Value, error)

type Block

type Block struct {
	ID              int
	BlockHeight     int64
	BlockHash       string
	BlockTimestamp  time.Time
	ParentBlockHash string
	NumTransactions int
	CreatedAt       time.Time
}

func FromRPCBlock

func FromRPCBlock(block btypes.Block) Block

func (Block) IsFutureBlock

func (b Block) IsFutureBlock() bool

type BlockLossSummary

type BlockLossSummary struct {
	BlockHeight    int64
	BlockHash      string
	LossOutputs    int
	TotalLost      *BigInt
	BlockTimestamp time.Time
}

type BurnScript

type BurnScript struct {
	ID              int       `json:"id"`
	Script          string    `json:"script"`
	ConfidenceLevel string    `json:"confidence_level"`
	Provenance      string    `json:"provenance"`
	CreatedAt       time.Time `json:"created_at"`
	ScriptGroup     string    `json:"script_group"`
	DecodeScript    string    `json:"decodescript"`
}

func (BurnScript) ParseDecodeScript

func (bs BurnScript) ParseDecodeScript() (DecodeScript, error)

type BurnScriptSummary

type BurnScriptSummary struct {
	Script          string
	ConfidenceLevel string
	Provenance      string
	Group           string
	DecodeScript    string
	Transactions    int
	TotalLoss       *BigInt
}

func (BurnScriptSummary) ParseDecodeScript

func (bss BurnScriptSummary) ParseDecodeScript() (DecodeScript, error)

type DecodeScript

type DecodeScript struct {
	Script  string `json:"script"`
	Asm     string `json:"asm"`
	Desc    string `json:"desc"`
	Type    string `json:"type"`
	Address string `json:"address"`
	P2SH    string `json:"p2sh"`
	Segwit  Segwit `json:"segwit"`
}

func ParseDecodeScriptJSON

func ParseDecodeScriptJSON(jsonString string) (DecodeScript, error)

func (DecodeScript) DisplayAddress

func (ds DecodeScript) DisplayAddress(fallback string) string

type HeightLossSummary

type HeightLossSummary struct {
	BlockHeight int64   `json:"block_height"`
	TotalLoss   *BigInt `json:"total_loss"`
}

type IndexRollupStatistics

type IndexRollupStatistics struct {
	TotalLosses *BigInt `json:"total_losses"`
	BurnOutputs int64   `json:"burn_outputs"`
}

type IndexStatistics

type IndexStatistics struct {
	PlannedSupply     *BigInt   `json:"planned_supply"`
	CirculatingSupply *BigInt   `json:"circulating_supply"`
	BurnedSupply      *BigInt   `json:"burned_supply"`
	LastBlockHeight   int64     `json:"last_block_height"`
	LastBlockTime     time.Time `json:"last_block_time"`
	BurnOutputCount   int64     `json:"burned_output_count"`
	BurnScriptsCount  int64     `json:"burned_scripts_count"`
	CurrentPrice      float64   `json:"current_price"`
	AdjustedPrice     float64   `json:"adjusted_price"`
	PriceChange       float64   `json:"price_change"`
}

type Loss

type Loss struct {
	ID          int
	TxID        string
	BlockHash   string
	BlockHeight int64
	Vout        int
	Amount      *BigInt
	CreatedAt   time.Time
	BurnScript  string
}

type OpReturnSummary

type OpReturnSummary struct {
	Script       string `json:"script"`
	Transactions int
	TotalLoss    *BigInt
}

type Prevout

type Prevout struct {
	Generated    bool         `json:"generated"`
	Height       int          `json:"height"`
	Value        BTCString    `json:"value"`
	ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
}

type ScriptGroup

type ScriptGroup struct {
	ScriptGroup string `json:"script_group"`
}

type ScriptGroupSummary

type ScriptGroupSummary struct {
	ScriptGroup  string
	TotalLoss    *BigInt
	Scripts      int
	Transactions int
}

type ScriptPubKey

type ScriptPubKey struct {
	Asm     string `json:"asm"`
	Desc    string `json:"desc"`
	Hex     string `json:"hex"`
	Address string `json:"address,omitempty"`
	Type    string `json:"type"`
}

type ScriptQueue

type ScriptQueue struct {
	ID        int       `json:"id"`
	Script    string    `json:"script"`
	TryCount  int       `json:"try_count"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type ScriptSig

type ScriptSig struct {
	Asm string `json:"asm"`
	Hex string `json:"hex"`
}

type Segwit

type Segwit struct {
	Asm        string `json:"asm"`
	Hex        string `json:"hex"`
	Type       string `json:"type"`
	Address    string `json:"address"`
	Desc       string `json:"desc"`
	P2SHSegwit string `json:"p2sh-segwit"`
}

type Transaction

type Transaction struct {
	TxID               string
	TransactionDetails string
	BlockHeight        int64
	BlockHash          string
}

func (Transaction) TransactionDetail

func (t Transaction) TransactionDetail() (TransactionDetail, error)

We store TransactionDetails in sqlite as a raw JSON to avoid having to handle various edge cases with variance in the transaction information, while still being able to support showing the full raw RPC response in the UI.

This method will return the TransactionDetail struct from the raw JSON.

type TransactionDetail

type TransactionDetail struct {
	Txid      string    `json:"txid"`
	Hash      string    `json:"hash"`
	Version   int       `json:"version"`
	Size      int       `json:"size"`
	Vsize     int       `json:"vsize"`
	Weight    int       `json:"weight"`
	Locktime  int       `json:"locktime"`
	Vin       []Vin     `json:"vin"`
	Vout      []Vout    `json:"vout"`
	Fee       BTCString `json:"fee"`
	Hex       string    `json:"hex"`
	Blockhash string    `json:"blockhash,omitempty"`
	Time      int       `json:"time,omitempty"`
	Blocktime int       `json:"blocktime,omitempty"`
}

func (*TransactionDetail) NotePointers

func (t *TransactionDetail) NotePointers() ([]notes.NotePointer, bool, []string)

type TransactionLossSummary

type TransactionLossSummary struct {
	Txid        string  `json:"tx_id"`
	Vout        int     `json:"vout"`
	TotalLoss   *BigInt `json:"total_loss"`
	BlockHeight int64   `json:"block_height"`
	BlockHash   string  `json:"block_hash"`
}

type TransactionQueue

type TransactionQueue struct {
	ID          int64     `json:"id"`
	Txid        string    `json:"txid"`
	BlockHeight int64     `json:"block_height"`
	CreatedAt   time.Time `json:"created_at"`
}

type TransactionSummary

type TransactionSummary struct {
	Txid           string    `json:"tx_id"`
	Coinbase       bool      `json:"coinbase"`
	TotalLoss      *BigInt   `json:"total_loss"`
	BlockHeight    int64     `json:"block_height"`
	BlockHash      string    `json:"block_hash"`
	BlockTimestamp time.Time `json:"block_timestamp"`
}

type TxOutSetInfo

type TxOutSetInfo struct {
	ID                     int       `json:"id"`
	Height                 int64     `json:"height"`
	Bestblock              string    `json:"bestblock"`
	Txouts                 int       `json:"txouts"`
	Bogosize               int64     `json:"bogosize"`
	Muhash                 string    `json:"muhash"`
	TotalAmount            *BigInt   `json:"total_amount"`
	TotalUnspendableAmount *BigInt   `json:"total_unspendable_amount"`
	GenesisBlock           *BigInt   `json:"genesis_block"`
	Bip30                  *BigInt   `json:"bip30"`
	Scripts                *BigInt   `json:"scripts"`
	UnclaimedRewards       *BigInt   `json:"unclaimed_rewards"`
	PrevoutSpent           *BigInt   `json:"prevout_spent"`
	Coinbase               *BigInt   `json:"coinbase"`
	NewOutputsExCoinbase   *BigInt   `json:"new_outputs_ex_coinbase"`
	Unspendable            *BigInt   `json:"unspendable"`
	CreatedAt              time.Time `json:"created_at"`
}

func FromRPCTxOutSetInfo

func FromRPCTxOutSetInfo(info btypes.TxOutSetInfo) TxOutSetInfo

type Vin

type Vin struct {
	Txid        string    `json:"txid"`
	Vout        int       `json:"vout"`
	ScriptSig   ScriptSig `json:"scriptSig"`
	Txinwitness []string  `json:"txinwitness,omitempty"`
	Prevout     Prevout   `json:"prevout"`
	Coinbase    string    `json:"coinbase,omitempty"`
	Sequence    int64     `json:"sequence"`
}

type Vout

type Vout struct {
	Value        BTCString    `json:"value"`
	N            int          `json:"n"`
	ScriptPubKey ScriptPubKey `json:"scriptPubKey"`
}

Jump to

Keyboard shortcuts

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