loop+cmd: extract types into swap module

This commit is contained in:
Oliver Gugger 2019-10-09 12:36:16 +02:00
parent 7a1680d7d6
commit 69f2af9fdc
No known key found for this signature in database
GPG key ID: 8E4256593F177720
13 changed files with 104 additions and 89 deletions

View file

@ -5,6 +5,7 @@ import (
"github.com/btcsuite/btcutil"
"github.com/lightninglabs/loop/loopdb"
"github.com/lightninglabs/loop/swap"
"github.com/lightningnetwork/lnd/lntypes"
)
@ -235,28 +236,6 @@ type SwapInfoKit struct {
LastUpdateTime time.Time
}
// Type indicates the type of swap.
type Type uint8
const (
// TypeIn is a loop in swap.
TypeIn Type = iota
// TypeOut is a loop out swap.
TypeOut
)
func (t Type) String() string {
switch t {
case TypeIn:
return "In"
case TypeOut:
return "Out"
default:
return "Unknown"
}
}
// SwapInfo exposes common info fields for loop in and loop out swaps.
type SwapInfo struct {
loopdb.SwapStateData
@ -265,7 +244,7 @@ type SwapInfo struct {
SwapHash lntypes.Hash
SwapType Type
SwapType swap.Type
loopdb.SwapContract