client

package
v0.0.0-...-2aaabe7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	PubKey                     string
	RoundLifetime              int64
	UnilateralExitDelay        int64
	RoundInterval              int64
	Network                    string
	Dust                       uint64
	BoardingDescriptorTemplate string
	ForfeitAddress             string
}

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

type Output

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

type OwnershipProof

type OwnershipProof struct {
	ControlBlock string
	Script       string
	Signature    string
}

type RedeemTransaction

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

type Round

type Round struct {
	ID         string
	StartedAt  *time.Time
	EndedAt    *time.Time
	Tx         string
	Tree       tree.VtxoTree
	ForfeitTxs []string
	Connectors []string
	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.VtxoTree
	Connectors      []string
	MinRelayFeeRate chainfee.SatPerKVByte
}

type RoundFinalizedEvent

type RoundFinalizedEvent struct {
	ID   string
	Txid string
}

type RoundSigningNoncesGeneratedEvent

type RoundSigningNoncesGeneratedEvent struct {
	ID     string
	Nonces bitcointree.TreeNonces
}

type RoundSigningStartedEvent

type RoundSigningStartedEvent struct {
	ID               string
	UnsignedTree     tree.VtxoTree
	CosignersPubKeys []*secp256k1.PublicKey
	UnsignedRoundTx  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           []Outpoint
	SpendableVtxos       []Vtxo
	ClaimedBoardingUtxos []Outpoint
}

type SignedVtxoOutpoint

type SignedVtxoOutpoint struct {
	Outpoint
	Proof OwnershipProof
}

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, ephemeralKey string,
	) (string, error)
	RegisterNotesForNextRound(
		ctx context.Context, notes []string, ephemeralKey string,
	) (string, error)
	RegisterOutputsForNextRound(
		ctx context.Context, requestID string, outputs []Output,
	) error
	SubmitTreeNonces(
		ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
	) error
	SubmitTreeSignatures(
		ctx context.Context, roundID, cosignerPubkey string, signatures bitcointree.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, signedRedeemTx string,
	) (string, 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)
	SetNostrRecipient(ctx context.Context, nostrRecipient string, vtxos []SignedVtxoOutpoint) error
	DeleteNostrRecipient(ctx context.Context, vtxos []SignedVtxoOutpoint) 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
}

func (Vtxo) Address

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

Jump to

Keyboard shortcuts

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