btc

package
v0.0.0-...-313251d Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const COMPONENT_NAME = "BtcClient"

Variables

View Source
var DecodeExecuteData = evm.DecodeExecuteData

Functions

func CreateRawTx

func CreateRawTx(tx *wire.MsgTx) (string, error)

func CreateRawTxs

func CreateRawTxs(txns []*wire.MsgTx) ([]string, error)

func GetMempoolTx

func GetMempoolTx(txID string, network string) (*btcjson.GetTransactionResult, error)

func ParseExecuteParams

func ParseExecuteParams(params []byte) (*types.ExecuteParams, error)

Types

type BitcoinTransaction

type BitcoinTransaction struct {
	TxID string `json:"txid"`
	Vout []struct {
		Value float64 `json:"value"`
	} `json:"vout"`
	Status struct {
		BlockHeight int64 `json:"block_height"`
	} `json:"status"`
}

type BtcClient

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

func NewBtcClients

func NewBtcClients(globalConfig *config.Config, dbAdapter *db.DatabaseAdapter, eventBus *events.EventBus) ([]*BtcClient, error)

func (*BtcClient) BroadcastRawTx

func (c *BtcClient) BroadcastRawTx(signedPsbtHex string) (*chainhash.Hash, error)

func (*BtcClient) BroadcastTx

func (c *BtcClient) BroadcastTx(tx *wire.MsgTx, maxFeeRate *float64) (*chainhash.Hash, error)

func (*BtcClient) Config

func (c *BtcClient) Config() *BtcNetworkConfig

func (*BtcClient) Start

func (c *BtcClient) Start(ctx context.Context) error

func (*BtcClient) TestMempoolAccept

func (c *BtcClient) TestMempoolAccept(txs []*wire.MsgTx, maxFeeRatePerKb float64) ([]*btcjson.TestMempoolAcceptResult, error)

type BtcClientInterface

type BtcClientInterface interface {
	SendTx(tx *wire.MsgTx, maxFeeRate *float64) (*chainhash.Hash, error)
	TestMempoolAccept(txs []*wire.MsgTx, maxFeeRatePerKb float64) ([]*btcjson.TestMempoolAcceptResult, error)
}

type BtcNetworkConfig

type BtcNetworkConfig struct {
	Network    string  `mapstructure:"network"`
	ID         string  `mapstructure:"id"`
	ChainID    uint64  `mapstructure:"chain_id"`
	Name       string  `mapstructure:"name"`
	Type       string  `mapstructure:"type"`
	Host       string  `mapstructure:"host"`
	Port       int     `mapstructure:"port"`
	User       string  `mapstructure:"user"`
	Password   string  `mapstructure:"password"`
	SSL        *bool   `mapstructure:"ssl,omitempty"`
	PrivateKey string  `mapstructure:"private_key,omitempty"`
	Address    *string `mapstructure:"address,omitempty"`
	MaxFeeRate float64 `mapstructure:"max_fee_rate,omitempty"`
}

func (*BtcNetworkConfig) GetChainId

func (c *BtcNetworkConfig) GetChainId() uint64

func (*BtcNetworkConfig) GetFamily

func (c *BtcNetworkConfig) GetFamily() string

func (*BtcNetworkConfig) GetId

func (c *BtcNetworkConfig) GetId() string

func (*BtcNetworkConfig) GetName

func (c *BtcNetworkConfig) GetName() string

type DecodedExecuteData

type DecodedExecuteData = evm.DecodedExecuteData

Todo: When xchains core user separated module for handling btc execution data, we need to define new types here

type SigningType

type SigningType int
const (
	CUSTODIAL_ONLY SigningType = iota
	USER_PROTOCOL
	USER_CUSTODIAL
	PROTOCOL_CUSTODIAL
)

Jump to

Keyboard shortcuts

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