2020-01-03 13:01:31 +00:00
|
|
|
package loopd
|
2019-03-06 20:13:50 +00:00
|
|
|
|
|
|
|
import (
|
2020-01-10 11:13:39 +00:00
|
|
|
"github.com/btcsuite/btcutil"
|
2020-06-17 20:25:57 +00:00
|
|
|
"github.com/lightninglabs/lndclient"
|
2019-03-07 04:32:24 +00:00
|
|
|
"github.com/lightninglabs/loop"
|
2019-03-06 20:13:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// getClient returns an instance of the swap client.
|
2020-05-15 10:17:57 +00:00
|
|
|
func getClient(config *Config, lnd *lndclient.LndServices) (*loop.Client,
|
2020-01-10 11:13:39 +00:00
|
|
|
func(), error) {
|
2019-03-07 04:32:24 +00:00
|
|
|
|
2020-04-27 12:03:23 +00:00
|
|
|
clientConfig := &loop.ClientConfig{
|
2020-06-15 09:04:37 +00:00
|
|
|
ServerAddress: config.Server.Host,
|
|
|
|
ProxyAddress: config.Server.Proxy,
|
|
|
|
SwapServerNoTLS: config.Server.NoTLS,
|
|
|
|
TLSPathServer: config.Server.TLSPath,
|
2020-05-12 07:31:50 +00:00
|
|
|
Lnd: lnd,
|
|
|
|
MaxLsatCost: btcutil.Amount(config.MaxLSATCost),
|
|
|
|
MaxLsatFee: btcutil.Amount(config.MaxLSATFee),
|
|
|
|
LoopOutMaxParts: config.LoopOutMaxParts,
|
2020-04-27 12:03:23 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 14:28:11 +00:00
|
|
|
swapClient, cleanUp, err := loop.NewClient(config.DataDir, clientConfig)
|
2019-03-06 20:13:50 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return swapClient, cleanUp, nil
|
|
|
|
}
|