client

package
v0.0.0-...-241d3e1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GrpcClient = "grpc"
	RestClient = "rest"
)

Variables

View Source
var (
	ErrConnectionClosedByServer = fmt.Errorf("connection closed by server")
)

Functions

This section is empty.

Types

type AddressEvent

type AddressEvent struct {
	NewVtxos   []Vtxo
	SpentVtxos []Vtxo
	Err        error
}

type Info

type Info struct {
	Version                    string
	PubKey                     string
	VtxoTreeExpiry             int64
	UnilateralExitDelay        int64
	RoundInterval              int64
	Network                    string
	Dust                       uint64
	BoardingExitDelay          int64
	BoardingDescriptorTemplate string
	ForfeitAddress             string
	MarketHourStartTime        int64
	MarketHourEndTime          int64
	MarketHourPeriod           int64
	MarketHourRoundInterval    int64
	UtxoMinAmount              int64
	UtxoMaxAmount              int64
	VtxoMinAmount              int64
	VtxoMaxAmount              int64
}

type Input

type Input struct {
	Outpoint
	Tapscripts []string
}

type Outpoint

type Outpoint struct {
	Txid string
	VOut uint32
}

func (Outpoint) Equals

func (o Outpoint) Equals(other Outpoint) bool

func (Outpoint) String

func (o Outpoint) String() string

type Output

type Output struct {
	Address string // onchain or offchain address
	Amount  uint64
}

func (Output) ToTxOut

func (o Output) ToTxOut() (*wire.TxOut, bool, error)

type RedeemTransaction

type RedeemTransaction struct {
	Txid           string
	SpentVtxos     []Vtxo
	SpendableVtxos []Vtxo
	Hex            string
}

type Round

type Round struct {
	ID         string
	StartedAt  *time.Time
	EndedAt    *time.Time
	Tx         string
	Tree       tree.TxTree
	ForfeitTxs []string
	Connectors tree.TxTree
	Stage      RoundStage
}

type RoundEvent

type RoundEvent interface {
	// contains filtered or unexported methods
}

type RoundEventChannel

type RoundEventChannel struct {
	Event RoundEvent
	Err   error
}

type RoundFailedEvent

type RoundFailedEvent struct {
	ID     string
	Reason string
}

type RoundFinalizationEvent

type RoundFinalizationEvent struct {
	ID              string
	Tx              string
	Tree            tree.TxTree
	Connectors      tree.TxTree
	MinRelayFeeRate chainfee.SatPerKVByte
	ConnectorsIndex map[string]Outpoint // <txid:vout> -> outpoint
}

type RoundFinalizedEvent

type RoundFinalizedEvent struct {
	ID   string
	Txid string
}

type RoundSigningNoncesGeneratedEvent

type RoundSigningNoncesGeneratedEvent struct {
	ID     string
	Nonces tree.TreeNonces
}

type RoundSigningStartedEvent

type RoundSigningStartedEvent struct {
	ID               string
	UnsignedTree     tree.TxTree
	UnsignedRoundTx  string
	CosignersPubkeys []string
}

type RoundStage

type RoundStage int
const (
	RoundStageUndefined RoundStage = iota
	RoundStageRegistration
	RoundStageFinalization
	RoundStageFinalized
	RoundStageFailed
)

func (RoundStage) String

func (s RoundStage) String() string

type RoundTransaction

type RoundTransaction struct {
	Txid                 string
	SpentVtxos           []Vtxo
	SpendableVtxos       []Vtxo
	ClaimedBoardingUtxos []Outpoint
	Hex                  string
}

type TapscriptsVtxo

type TapscriptsVtxo struct {
	Vtxo
	Tapscripts []string
}

type TransactionEvent

type TransactionEvent struct {
	Round  *RoundTransaction
	Redeem *RedeemTransaction
	Err    error
}

type TransportClient

type TransportClient interface {
	GetInfo(ctx context.Context) (*Info, error)
	RegisterInputsForNextRound(
		ctx context.Context, inputs []Input,
	) (string, error)
	RegisterIntent(
		ctx context.Context, signature, message string,
	) (string, error)
	RegisterNotesForNextRound(
		ctx context.Context, notes []string,
	) (string, error)
	RegisterOutputsForNextRound(
		ctx context.Context, requestID string, outputs []Output, musig2 *tree.Musig2,
	) error
	SubmitTreeNonces(
		ctx context.Context, roundID, cosignerPubkey string, nonces tree.TreeNonces,
	) error
	SubmitTreeSignatures(
		ctx context.Context, roundID, cosignerPubkey string, signatures tree.TreePartialSigs,
	) error
	SubmitSignedForfeitTxs(
		ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
	) error
	GetEventStream(
		ctx context.Context, requestID string,
	) (<-chan RoundEventChannel, func(), error)
	Ping(ctx context.Context, requestID string) error
	SubmitRedeemTx(
		ctx context.Context, partialSignedRedeemTx string,
	) (signedRedeemTx, redeemTxid string, err error)
	ListVtxos(ctx context.Context, addr string) ([]Vtxo, []Vtxo, error)
	GetRound(ctx context.Context, txID string) (*Round, error)
	GetRoundByID(ctx context.Context, roundID string) (*Round, error)
	Close()
	GetTransactionsStream(ctx context.Context) (<-chan TransactionEvent, func(), error)
	SubscribeForAddress(ctx context.Context, address string) (<-chan AddressEvent, func(), error)
}

type Vtxo

type Vtxo struct {
	Outpoint
	PubKey    string
	Amount    uint64
	RoundTxid string
	ExpiresAt time.Time
	CreatedAt time.Time
	RedeemTx  string
	IsPending bool
	SpentBy   string
	Swept     bool
	Spent     bool
}

func (Vtxo) Address

func (v Vtxo) Address(server *secp256k1.PublicKey, net common.Network) (string, error)

func (Vtxo) IsRecoverable

func (v Vtxo) IsRecoverable() bool

Jump to

Keyboard shortcuts

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