-
Notifications
You must be signed in to change notification settings - Fork 8
/
run-connector.js
57 lines (50 loc) · 1.66 KB
/
run-connector.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict'
const util = require('./util')
const bitcoin1 = process.env.BITCOIN_LND_1 || 'localhost:11009'
const bitcoin2 = process.env.BITCOIN_LND_2 || 'localhost:12009'
const litecoin1 = process.env.LITECOIN_LND_1 || 'localhost:11010'
const litecoin2 = process.env.LITECOIN_LND_2 || 'localhost:12010'
async function main () {
console.log('Getting configuration details from lnds')
const pubkeys = await util.getPubkeys([bitcoin1, litecoin1])
// Plugin configuration
process.env.CONNECTOR_LEDGERS=`
{
"g.bitcoin.lightning.": {
"currency": "BTC",
"plugin": "ilp-plugin-lightning",
"store": true,
"options": {
"peerPublicKey": "${pubkeys[0]}",
"lndUri": "${bitcoin2}",
"rpcUri": "http://localhost:9001/rpc",
"maxUnsecured": "1000",
"maxBalance": "10000000",
"authToken": "token"
}
},
"test.litecoin.lightning.": {
"currency": "LTC",
"plugin": "ilp-plugin-lightning",
"store": true,
"options": {
"peerPublicKey": "${pubkeys[1]}",
"lndUri": "${litecoin2}",
"rpcUri": "http://localhost:9002/rpc",
"maxUnsecured": "1000",
"maxBalance": "10000000",
"authToken": "token"
}
}
}`
// Set up environment variables
process.env.CONNECTOR_PORT='9000'
process.env.CONNECTOR_MAX_HOLD_TIME='1000'
process.env.CONNECTOR_BACKEND='fixerio-plus-coinmarketcap'
process.env.CONNECTOR_FX_SPREAD='0'
process.env.DB_URI='sqlite://:memory:'
// Runs the connector using the lightning plugins
console.log('Running connector using lightning plugins...')
require('connector-rpc')
}
main().catch(err => console.log(err))