2024-05-06 14:19:07 +02:00
|
|
|
package withdraw
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/btcsuite/btcd/wire"
|
|
|
|
|
"github.com/lightninglabs/loop/fsm"
|
|
|
|
|
"github.com/lightninglabs/loop/staticaddr/deposit"
|
|
|
|
|
"github.com/lightninglabs/loop/staticaddr/script"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// AddressManager handles fetching of address parameters.
|
|
|
|
|
type AddressManager interface {
|
|
|
|
|
// GetStaticAddressParameters returns the static address parameters.
|
2026-05-01 15:54:37 +05:30
|
|
|
GetStaticAddressParameters(ctx context.Context) (*script.Parameters,
|
2024-05-06 14:19:07 +02:00
|
|
|
error)
|
|
|
|
|
|
|
|
|
|
// GetStaticAddress returns the deposit address for the given
|
|
|
|
|
// client and server public keys.
|
|
|
|
|
GetStaticAddress(ctx context.Context) (*script.StaticAddress, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DepositManager interface {
|
2026-07-08 13:55:04 +02:00
|
|
|
// EnsureDepositsFresh reconciles active deposits with the wallet view.
|
|
|
|
|
EnsureDepositsFresh(ctx context.Context) error
|
|
|
|
|
|
|
|
|
|
// GetActiveDepositsInState returns all active deposits in the given
|
|
|
|
|
// state.
|
2024-05-06 14:19:07 +02:00
|
|
|
GetActiveDepositsInState(stateFilter fsm.StateType) ([]*deposit.Deposit,
|
|
|
|
|
error)
|
|
|
|
|
|
2026-07-08 13:55:04 +02:00
|
|
|
// AllOutpointsActiveDeposits returns all active deposits referenced by
|
|
|
|
|
// the outpoints if every deposit is active and in the given state.
|
2024-05-06 14:19:07 +02:00
|
|
|
AllOutpointsActiveDeposits(outpoints []wire.OutPoint,
|
|
|
|
|
stateFilter fsm.StateType) ([]*deposit.Deposit, bool)
|
|
|
|
|
|
2026-07-08 13:55:04 +02:00
|
|
|
// TransitionDeposits transitions the deposits with the given event and
|
|
|
|
|
// waits until they reach the expected final state.
|
2024-05-06 14:19:07 +02:00
|
|
|
TransitionDeposits(ctx context.Context, deposits []*deposit.Deposit,
|
|
|
|
|
event fsm.EventType, expectedFinalState fsm.StateType) error
|
|
|
|
|
|
2026-07-08 13:55:04 +02:00
|
|
|
// UpdateDeposit persists the current deposit fields.
|
2024-05-06 14:19:07 +02:00
|
|
|
UpdateDeposit(ctx context.Context, d *deposit.Deposit) error
|
|
|
|
|
}
|