mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Include https://github.com/lightninglabs/lndclient/pull/280 multi: migrate to btcd v2 modules + add WalletKit.SubmitPackage Migrate Loop imports and update Aperture and Taproot Assets to compatible revisions so this commit remains green on its own.
53 lines
1.7 KiB
Go
53 lines
1.7 KiB
Go
package deposit
|
|
|
|
import (
|
|
"context"
|
|
|
|
btcaddr "github.com/btcsuite/btcd/address/v2"
|
|
"github.com/btcsuite/btcd/btcec/v2"
|
|
"github.com/lightninglabs/loop/staticaddr/script"
|
|
"github.com/lightningnetwork/lnd/lnwallet"
|
|
)
|
|
|
|
const (
|
|
IdLength = 32
|
|
)
|
|
|
|
// Store is the database interface that is used to store and retrieve
|
|
// static address deposits.
|
|
type Store interface {
|
|
// CreateDeposit inserts a new deposit into the store.
|
|
CreateDeposit(ctx context.Context, deposit *Deposit) error
|
|
|
|
// UpdateDeposit updates the deposit in the database.
|
|
UpdateDeposit(ctx context.Context, deposit *Deposit) error
|
|
|
|
// GetDeposit retrieves a deposit with depositID from the database.
|
|
GetDeposit(ctx context.Context, depositID ID) (*Deposit, error)
|
|
|
|
// DepositForOutpoint retrieves the deposit with the given outpoint.
|
|
DepositForOutpoint(ctx context.Context, outpoint string) (*Deposit,
|
|
error)
|
|
|
|
// AllDeposits retrieves all deposits from the store.
|
|
AllDeposits(ctx context.Context) ([]*Deposit, error)
|
|
}
|
|
|
|
// AddressManager handles fetching of address parameters.
|
|
type AddressManager interface {
|
|
// GetStaticAddressParameters returns the static address parameters.
|
|
GetStaticAddressParameters(ctx context.Context) (*script.Parameters,
|
|
error)
|
|
|
|
// GetStaticAddress returns the deposit address for the given
|
|
// client and server public keys.
|
|
GetStaticAddress(ctx context.Context) (*script.StaticAddress, error)
|
|
|
|
// ListUnspent returns a list of utxos at the static address.
|
|
ListUnspent(ctx context.Context, minConfs,
|
|
maxConfs int32) ([]*lnwallet.Utxo, error)
|
|
|
|
// GetTaprootAddress returns a taproot address.
|
|
GetTaprootAddress(clientPubkey, serverPubkey *btcec.PublicKey,
|
|
expiry int64) (*btcaddr.AddressTaproot, error)
|
|
}
|