|
| 1 | +package withdraw |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + |
| 6 | + "github.com/btcsuite/btcd/wire" |
| 7 | + "github.com/lightninglabs/loop/fsm" |
| 8 | + "github.com/lightninglabs/loop/staticaddr/address" |
| 9 | + "github.com/lightninglabs/loop/staticaddr/deposit" |
| 10 | + "github.com/lightninglabs/loop/staticaddr/script" |
| 11 | + "github.com/lightningnetwork/lnd/lnwallet" |
| 12 | +) |
| 13 | + |
| 14 | +const ( |
| 15 | + IdLength = 32 |
| 16 | +) |
| 17 | + |
| 18 | +// AddressManager handles fetching of address parameters. |
| 19 | +type AddressManager interface { |
| 20 | + // GetStaticAddressParameters returns the static address parameters. |
| 21 | + GetStaticAddressParameters(ctx context.Context) (*address.Parameters, |
| 22 | + error) |
| 23 | + |
| 24 | + // GetStaticAddress returns the deposit address for the given |
| 25 | + // client and server public keys. |
| 26 | + GetStaticAddress(ctx context.Context) (*script.StaticAddress, error) |
| 27 | + |
| 28 | + // ListUnspent returns a list of utxos at the static address. |
| 29 | + ListUnspent(ctx context.Context, minConfs, |
| 30 | + maxConfs int32) ([]*lnwallet.Utxo, error) |
| 31 | +} |
| 32 | + |
| 33 | +type DepositManager interface { |
| 34 | + GetActiveOutpoints() ([]wire.OutPoint, error) |
| 35 | + |
| 36 | + AllDepositsActive(outpoints []wire.OutPoint) ([]*deposit.Deposit, bool) |
| 37 | + |
| 38 | + TransitionDeposits(outpoints []wire.OutPoint, event fsm.EventType, |
| 39 | + expectedFinalState fsm.StateType) error |
| 40 | +} |
0 commit comments