client

package
v0.0.0-...-877b7d3 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 6 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 ASPClient

type ASPClient interface {
	GetInfo(ctx context.Context) (*Info, 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)
	RegisterPayment(
		ctx context.Context, inputs []Input, ephemeralKey string,
	) (string, error)
	ClaimPayment(
		ctx context.Context, paymentID string, outputs []Output,
	) error
	GetEventStream(
		ctx context.Context, paymentID string,
	) (<-chan RoundEventChannel, func(), error)
	Ping(ctx context.Context, paymentID string) (RoundEvent, error)
	FinalizePayment(
		ctx context.Context, signedForfeitTxs []string, signedRoundTx string,
	) error
	CreatePayment(
		ctx context.Context, inputs []Input, outputs []Output,
	) (string, []string, error)
	CompletePayment(
		ctx context.Context, signedRedeemTx string, signedUnconditionalForfeitTxs []string,
	) error
	GetBoardingAddress(ctx context.Context, userPubkey string) (string, error)
	SendTreeNonces(
		ctx context.Context, roundID, cosignerPubkey string, nonces bitcointree.TreeNonces,
	) error
	SendTreeSignatures(
		ctx context.Context, roundID, cosignerPubkey string, signatures bitcointree.TreePartialSigs,
	) error
	Close()
}

type Info

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

type Input

type Input struct {
	Outpoint
	Descriptor string
}

type Outpoint

type Outpoint struct {
	Txid string
	VOut uint32
}

type Output

type Output struct {
	Address    string // onchain output address
	Descriptor string // offchain vtxo descriptor
	Amount     uint64
}

type Round

type Round struct {
	ID         string
	StartedAt  *time.Time
	EndedAt    *time.Time
	Tx         string
	Tree       tree.CongestionTree
	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.CongestionTree
	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.CongestionTree
	CosignersPublicKeys []*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 Vtxo

type Vtxo struct {
	Outpoint
	Descriptor              string
	Amount                  uint64
	RoundTxid               string
	ExpiresAt               *time.Time
	RedeemTx                string
	UnconditionalForfeitTxs []string
	Pending                 bool
	PendingChange           bool
	SpentBy                 string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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