trade

package
v1.0.53 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FEE_URL string = "https://mempool.space/api/v1/fees/recommended"
)

Variables

This section is empty.

Functions

func A2BTrade

func A2BTrade(wif string, receiver *Target, netParams *chaincfg.Params) (txid string, err error)

common transaction 1: common transfer

func AS2BSTrade

func AS2BSTrade(wif string, receivers []*Target, netParams *chaincfg.Params) (txid string, err error)

3: pay for salary

func AS2BTrade

func AS2BTrade(wif string, receiver btcutil.Address, netParams *chaincfg.Params) (txid string, err error)

2: found collect

func BtcWif2Address

func BtcWif2Address(wif string, netParams *chaincfg.Params) (address btcutil.Address)

func BuildMultiSigP2SHAddr

func BuildMultiSigP2SHAddr(pubs []*btcutil.AddressPubKey, required int, p *chaincfg.Params) (multiSigAddr string, pkScript []byte, err error)

func BuildMultiSigScript

func BuildMultiSigScript(pubs []*btcutil.AddressPubKey, required int) (pkScript []byte, err error)

func DisAsembleScript

func DisAsembleScript(lockingScript string) (string, error)

func GetBalance

func GetBalance(outputs []*btcapi.UnspentOutput) (amount int64)

func GetClientUnspent

func GetClientUnspent(wif string, netParams *chaincfg.Params) (client *txpool.TxpoolClient, outputs []*btcapi.UnspentOutput, from btcutil.Address, err error)

func GetTxFee

func GetTxFee(tx *wire.MsgTx, l feelevel) int64

func MakeOrder

func MakeOrder()

func MakeSignedTxAndBroastcast

func MakeSignedTxAndBroastcast(t tx_type, client *txpool.TxpoolClient, receivers []*Target, wif string, from btcutil.Address, outputs []*btcapi.UnspentOutput) (txid string, err error)

func SignMultiSigTxin

func SignMultiSigTxin(wif string, redeemTx *wire.MsgTx, index int, redeemScript []byte) ([]byte, error)

func SignTx

func SignTx(privKey string, pkScripts []string, redeemTx *wire.MsgTx) (*wire.MsgTx, error)

func SpendMultiSig

func SpendMultiSig(sigs [][]byte, required int, receivers []*Receiver, outputs []*btcapi.UnspentOutput, redeemScript []byte) (*wire.MsgTx, error)

Types

type BTCFee

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

func GetBtcFee

func GetBtcFee() *BTCFee

func InitBtcFee

func InitBtcFee() *BTCFee

func (*BTCFee) Close

func (bf *BTCFee) Close()

func (*BTCFee) GetFeeRate

func (bf *BTCFee) GetFeeRate(level feelevel) int64

type FeeRate

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

type Receiver

type Receiver struct {
	Addr  btcutil.Address
	Ratio int
}

type Target

type Target struct {
	Addr   btcutil.Address
	Amount int64
}

Jump to

Keyboard shortcuts

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