Add layer2 address separately

This commit is contained in:
Josh Harvey 2018-06-03 12:34:26 +03:00
parent d9aaf2437f
commit d1712ce1ce
7 changed files with 85 additions and 31 deletions

View file

@ -1,12 +1,16 @@
const axios = require('axios')
const _ = require('lodash/fp')
const options = require('../../../options')
module.exports = {
newAddress,
getStatus,
cryptoNetwork
}
axios.defaults.baseURL = options.strike.baseUrl
function cryptoNetwork (account, cryptoCode) {
return Promise.resolve('test')
}
@ -19,7 +23,7 @@ function checkCryptoCode (cryptoCode) {
function getCharge (account, chargeId) {
return axios({
method: 'get',
url: `https://api.strike.acinq.co/api/v1/charges/${chargeId}`,
url: `v1/charges/${chargeId}`,
auth: {username: account.token, password: ''}
}).then(_.get('data'))
}
@ -33,7 +37,7 @@ function createCharge (account, info) {
return axios({
method: 'post',
url: 'https://api.strike.acinq.co/api/v1/charges',
url: 'v1/charges',
auth: {username: account.token, password: ''},
data
}).then(_.get('data'))

View file

@ -74,16 +74,11 @@ function getStatus (account, toAddress, requested, cryptoCode) {
return connect()
.then(c => {
if (isLightning) {
return c.lookupInvoice({r_hash_str: rHashStr})
.then(r => {
if (r.settled) return {status: 'confirmed'}
return {status: 'notSeen'}
})
}
// Note: this must be handled outside of lnd
return {status: 'notSeen'}
return c.lookupInvoice({r_hash_str: rHashStr})
.then(r => {
if (r.settled) return {status: 'confirmed'}
return {status: 'notSeen'}
})
})
})
}

View file

@ -5,8 +5,8 @@ const coinUtils = require('../../../coin-utils')
const NAME = 'FakeWallet'
const SECONDS = 1000
const PUBLISH_TIME = 1 * SECONDS
const AUTHORIZE_TIME = PUBLISH_TIME + 1 * SECONDS
const PUBLISH_TIME = 3 * SECONDS
const AUTHORIZE_TIME = PUBLISH_TIME + 5 * SECONDS
const CONFIRM_TIME = AUTHORIZE_TIME + 120 * SECONDS
let t0