signer

package
v0.0.0-...-1929ff6 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package signer implements the ChainSigner interface for BTC

Index

Constants

View Source
const (
	// the maximum number of inputs per outbound
	MaxNoOfInputsPerTx = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

type Signer struct {
	*base.Signer
	// contains filtered or unexported fields
}

Signer deals with signing BTC transactions and implements the ChainSigner interface

func NewSigner

func NewSigner(
	chain chains.Chain,
	tss interfaces.TSSSigner,
	ts *metrics.TelemetryServer,
	logger base.Logger,
	cfg config.BTCConfig,
) (*Signer, error)

NewSigner creates a new Bitcoin signer

func (*Signer) AddWithdrawTxOutputs

func (signer *Signer) AddWithdrawTxOutputs(
	tx *wire.MsgTx,
	to btcutil.Address,
	total float64,
	amount float64,
	nonceMark int64,
	fees *big.Int,
	cancelTx bool,
) error

AddWithdrawTxOutputs adds the 3 outputs to the withdraw tx 1st output: the nonce-mark btc to TSS itself 2nd output: the payment to the recipient 3rd output: the remaining btc to TSS itself

func (*Signer) Broadcast

func (signer *Signer) Broadcast(signedTx *wire.MsgTx) error

Broadcast sends the signed transaction to the network

func (*Signer) GetERC20CustodyAddress

func (signer *Signer) GetERC20CustodyAddress() ethcommon.Address

GetERC20CustodyAddress returns dummy address

func (*Signer) GetGatewayAddress

func (signer *Signer) GetGatewayAddress() string

GetGatewayAddress returns empty address Note: same as SetGatewayAddress

func (*Signer) GetZetaConnectorAddress

func (signer *Signer) GetZetaConnectorAddress() ethcommon.Address

GetZetaConnectorAddress returns dummy address

func (*Signer) SetERC20CustodyAddress

func (signer *Signer) SetERC20CustodyAddress(_ ethcommon.Address)

SetERC20CustodyAddress does nothing for BTC

func (*Signer) SetGatewayAddress

func (signer *Signer) SetGatewayAddress(_ string)

SetGatewayAddress does nothing for BTC Note: TSS address will be used as gateway address for Bitcoin

func (*Signer) SetZetaConnectorAddress

func (signer *Signer) SetZetaConnectorAddress(_ ethcommon.Address)

TODO: get rid of below four get/set functions for Bitcoin, as they are not needed in future https://github.com/zeta-chain/node/issues/2532 SetZetaConnectorAddress does nothing for BTC

func (*Signer) SignWithdrawTx

func (signer *Signer) SignWithdrawTx(
	ctx context.Context,
	to btcutil.Address,
	amount float64,
	gasPrice *big.Int,
	sizeLimit uint64,
	observer *observer.Observer,
	height uint64,
	nonce uint64,
	chain chains.Chain,
	cancelTx bool,
) (*wire.MsgTx, error)

SignWithdrawTx receives utxos sorted by value, amount in BTC, feeRate in BTC per Kb TODO(revamp): simplify the function

func (*Signer) TryProcessOutbound

func (signer *Signer) TryProcessOutbound(
	ctx context.Context,
	cctx *types.CrossChainTx,
	outboundProcessor *outboundprocessor.Processor,
	outboundID string,
	chainObserver interfaces.ChainObserver,
	zetacoreClient interfaces.ZetacoreClient,
	height uint64,
)

TryProcessOutbound signs and broadcasts a BTC transaction from a new outbound TODO(revamp): simplify the function

Jump to

Keyboard shortcuts

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