btc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BtcToSatoshi

func BtcToSatoshi(v float64) int64

func DecodeAddress

func DecodeAddress(addr string, chainParams *chaincfg.Params) (btcutil.Address, error)

func DecodeMsgTx

func DecodeMsgTx(mtx *wire.MsgTx, chainParams *chaincfg.Params) *btcjson.TxRawDecodeResult

func EstimateFee

func EstimateFee(numP2PKHIns, numP2WPKHIns, numNestedP2WPKHIns int,
	outputs []BtcOutput, feePerKb int64, changeScriptSize int, chainCfg *chaincfg.Params) (int64, int64, error)

func HexToHash

func HexToHash(s string) (*chainhash.Hash, error)

func SatoshiToBtc

func SatoshiToBtc(v int64) float64

Types

type BtcClient

type BtcClient struct {
	RpcClient *rpcclient.Client
}

func NewBtcClient

func NewBtcClient(URL string, user string, pass string, chainId int) (*BtcClient, error)

func (*BtcClient) EstimateFeePerKb

func (this *BtcClient) EstimateFeePerKb() (int64, error)

func (*BtcClient) SendRawTransaction

func (this *BtcClient) SendRawTransaction(signedHex string, allowHighFees bool) (string, error)

https://bitcoincore.org/en/doc/0.21.0/rpc/rawtransactions/sendrawtransaction/

type BtcOutput

type BtcOutput struct {
	Address btcutil.Address `json:"address"`
	Amount  int64           `json:"amount"`
}

type BtcTransaction

type BtcTransaction struct {
	txauthor.AuthoredTx
	// contains filtered or unexported fields
}

func NewBtcTransaction

func NewBtcTransaction(unspents []BtcUnspent, outputs []BtcOutput,
	changeAddress btcutil.Address, feePerKb int64, chainCfg *chaincfg.Params) (*BtcTransaction, error)

func (*BtcTransaction) Decode

func (*BtcTransaction) GetFee

func (t *BtcTransaction) GetFee() int64

func (*BtcTransaction) GetFeePerKb

func (t *BtcTransaction) GetFeePerKb() int64

func (*BtcTransaction) GetTxid

func (t *BtcTransaction) GetTxid() string

func (*BtcTransaction) HasChange

func (t *BtcTransaction) HasChange() bool

func (*BtcTransaction) Send

func (t *BtcTransaction) Send(client *rpcclient.Client, allowHighFees bool) (*chainhash.Hash, error)

func (*BtcTransaction) Serialize

func (t *BtcTransaction) Serialize() (string, error)

func (*BtcTransaction) Sign

func (t *BtcTransaction) Sign(wallet *wallet.BtcWallet) error

func (*BtcTransaction) SignWithSecretsSource

func (t *BtcTransaction) SignWithSecretsSource(secretsSource txauthor.SecretsSource) error

type BtcUnspent

type BtcUnspent struct {
	TxID         string  `json:"txid"`
	Vout         uint32  `json:"vout"`
	ScriptPubKey string  `json:"scriptPubKey"`
	RedeemScript string  `json:"redeemScript,omitempty"`
	Amount       float64 `json:"amount"`
}

Jump to

Keyboard shortcuts

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