pkg

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateP2pkhAddressFromPrivateKey added in v0.0.10

func CreateP2pkhAddressFromPrivateKey(base58PrivateKey string) (string, error)

Create public address from an HD private key.

func DecodeBech32

func DecodeBech32(encoded string) (string, []byte, error)

DecodeBech32 decodes the given Bech32 encoded string and returns the decoded data and human-readable part.

func EncodeBech32

func EncodeBech32(hrp string, data []byte) (string, error)

EncodeBech32 encodes the given data using the Bech32 encoding with the specified human-readable part.

func GenerateHDPrivateKey added in v0.0.9

func GenerateHDPrivateKey() (string, error)

GenerateHDPrivateKey generates a new HD private key.

func GetLastBlock added in v0.0.9

func GetLastBlock() (string, error)

GetLastBlock retrieves the latest block height from the mempool.space API.

Types

type CurrentHashrate added in v0.0.11

type CurrentHashrate struct {
	CurrentHashrate   float64 `json:"currentHashrate"`
	CurrentDifficulty float64 `json:"currentDifficulty"`
}

CurrentHashrate represents the DTO (Data Transfer Object) for current hashrate data.

func GetCurrentHashrate added in v0.0.11

func GetCurrentHashrate() (CurrentHashrate, error)

GetCurrentHashrate retrieves current hashrate data from the mempool.space API.

type DecodedTransaction

type DecodedTransaction struct {
	TxID    string
	Inputs  []*wire.TxIn
	Outputs []*wire.TxOut
}

DecodedTransaction represents the decoded Bitcoin transaction.

func DecodeRawTransaction

func DecodeRawTransaction(rawTx string) (*DecodedTransaction, error)

DecodeRawTransaction decodes a raw Bitcoin transaction and returns the decoded transaction information.

type Fees added in v0.0.9

type Fees struct {
	FastestFee  int64 `json:"fastestFee"`
	HalfHourFee int64 `json:"halfHourFee"`
	HourFee     int64 `json:"hourFee"`
	EconomyFee  int64 `json:"economyFee"`
	MinimumFee  int64 `json:"minimumFee"`
}

Fees represents information about recommended transaction fees.

func GetFees added in v0.0.9

func GetFees() (Fees, error)

GetFees retrieves the recommended transaction fees from the mempool.space API.

type LightningInfo added in v0.0.9

type LightningInfo struct {
	ChannelCount       int   `json:"channel_count"`
	NodeCount          int   `json:"node_count"`
	TotalCapacity      int64 `json:"total_capacity"`
	TorNodes           int   `json:"tor_nodes"`
	ClearnetNodes      int   `json:"clearnet_nodes"`
	UnannouncedNodes   int   `json:"unannounced_nodes"`
	AverageCapacity    int64 `json:"avg_capacity"`
	AverageFeeRate     int   `json:"avg_fee_rate"`
	AverageBaseFeeMtok int   `json:"avg_base_fee_mtokens"`
	MedianCapacity     int64 `json:"med_capacity"`
	MedianFeeRate      int   `json:"med_fee_rate"`
	MedianBaseFeeMtok  int   `json:"med_base_fee_mtokens"`
	ClearnetTorNodes   int   `json:"clearnet_tor_nodes"`
}

LightningInfo represents information about lightning network statistics.

type LightningNode added in v0.0.9

type LightningNode struct {
	PublicKey string `json:"publicKey"`
	Alias     string `json:"alias"`
	Capacity  int64  `json:"capacity,omitempty"`
	Channels  int    `json:"channels,omitempty"`
}

LightningNode represents information about a lightning network node.

type LightningStatistics added in v0.0.9

type LightningStatistics struct {
	Latest   LightningInfo `json:"latest"`
	Previous LightningInfo `json:"previous"`
}

LightningStatistics represents the latest lightning network statistics.

func GetLightningStatistics added in v0.0.9

func GetLightningStatistics() (LightningStatistics, error)

GetLightningStatistics retrieves the latest lightning network statistics from the mempool.space API.

type LightningTopNodes added in v0.0.9

type LightningTopNodes struct {
	TopByCapacity []LightningNode `json:"topByCapacity"`
	TopByChannels []LightningNode `json:"topByChannels"`
}

LightningTopNodes represents the top nodes by liquidity and connectivity.

func GetLightningTopNodes added in v0.0.9

func GetLightningTopNodes() (LightningTopNodes, error)

GetLightningTopNodes retrieves the top nodes by liquidity and connectivity from the mempool.space API.

func (LightningTopNodes) ByCapacityString added in v0.0.9

func (tn LightningTopNodes) ByCapacityString() string

ByCapacityString returns a string representation of top nodes sorted by capacity.

func (LightningTopNodes) ByChannelsString added in v0.0.9

func (tn LightningTopNodes) ByChannelsString() string

ByChannelsString returns a string representation of top nodes sorted by channels.

type MempoolStatus added in v0.0.11

type MempoolStatus struct {
	Count    int `json:"count"`
	VSize    int `json:"vsize"`
	TotalFee int `json:"total_fee"`
}

MempoolStatus represents the DTO (Data Transfer Object) for mempool status.

func GetMempoolStatus added in v0.0.11

func GetMempoolStatus() (MempoolStatus, error)

GetMempoolStatus retrieves mempool status from the mempool.space API.

type Price added in v0.0.9

type Price struct {
	//Time int64 `json:"time"`
	USD int64 `json:"USD"`
	EUR int64 `json:"EUR"`
	GBP int64 `json:"GBP"`
	CAD int64 `json:"CAD"`
	CHF int64 `json:"CHF"`
	AUD int64 `json:"AUD"`
	JPY int64 `json:"JPY"`
}

Transaction represents information about a single transaction.

func GetPrices added in v0.0.9

func GetPrices() (Price, error)

GetPrices retrieves the current prices from the mempool.space API.

type Transaction

type Transaction struct {
	TxID   string `json:"txid"`
	Amount int64  `json:"fee"`
}

Transaction represents information about a single transaction.

func GetTransactionHistory

func GetTransactionHistory(address string) ([]Transaction, error)

GetTransactionHistory retrieves the transaction history of a Bitcoin address from mempool.space API.

Jump to

Keyboard shortcuts

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