chore: small improvement to dependencies

This commit is contained in:
Taranto 2022-12-15 18:28:29 +00:00
parent a23ad99436
commit 008f3c9049
4 changed files with 8758 additions and 4966 deletions

View file

@ -1,12 +0,0 @@
const lnd = require('lnd-async')
const path = require('path')
async function getInfo () {
let client = await lnd.connect({
certPath: path.resolve(__dirname, '../scratch/lnd/tls.cert'),
macaroonPath: path.resolve(__dirname, '../scratch/lnd/admin.macaroon')
})
return client.getInfo({})
}
getInfo().then(console.log)

View file

@ -1,87 +0,0 @@
const lnd = require('lnd-async')
const BN = require('../../../bn')
const E = require('../../../error')
const { utils: coinUtils } = require('@lamassu/coins')
const _ = require('lodash/fp')
const cryptoRec = coinUtils.getCryptoCurrency('BTC')
const unitScale = cryptoRec.unitScale
const LND = process.env.LIGHTNING_NETWORK_DAEMON
module.exports = {
balance,
sendCoins,
newAddress,
getStatus,
newFunding,
cryptoNetwork
}
function connect () {
return lnd.connect(LND || {})
}
function cryptoNetwork (account, cryptoCode, settings, operatorId) {
return Promise.resolve('main')
}
function checkCryptoCode (cryptoCode) {
if (cryptoCode !== 'BTC') return Promise.reject(new Error('Unsupported crypto: ' + cryptoCode))
return Promise.resolve()
}
function balance (acount, cryptoCode, settings, operatorId) {
return checkCryptoCode(cryptoCode)
.then(connect)
.then(c => c.channelBalance({}))
.then(_.get('balance'))
.then(BN)
.then(r => r.shiftedBy(unitScale).decimalPlaces(0))
}
function sendCoins (account, tx, settings, operatorId) {
// const { toAddress, cryptoAtoms, cryptoCode } = tx
// Not implemented yet
return Promise.reject(new E.NotImplementedError())
}
function newFunding (account, cryptoCode, settings, operatorId) {
// Not implemented yet
return Promise.reject(new E.NotImplementedError())
}
function newAddress (account, info, tx, settings, operatorId) {
return checkCryptoCode(info.cryptoCode)
.then(connect)
.then(c => {
if (info.isLightning) {
return c.addInvoice({memo: 'Lamassu cryptomat deposit', value: info.cryptoAtoms.toNumber()})
.then(r => `${r.r_hash.toString('hex')}:${r.payment_request}`)
}
return c.newAddress({type: 2})
.then(_.get('address'))
})
}
function getStatus (account, tx, requested, settings, operatorId) {
const { toAddress, cryptoCode } = tx
return checkCryptoCode(cryptoCode)
.then(() => {
const parts = _.split(':', toAddress)
const isLightning = _.size(parts) === 2
const rHashStr = isLightning && _.head(parts)
return connect()
.then(c => {
return c.lookupInvoice({ r_hash_str: rHashStr })
.then(r => {
if (r.settled) return { status: 'confirmed' }
return { status: 'notSeen' }
})
})
})
}

13620
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@
"dependencies": {
"@ethereumjs/common": "^2.6.4",
"@ethereumjs/tx": "^3.5.1",
"@graphql-tools/merge": "^6.2.5",
"@lamassu/coins": "1.3.0",
"@simplewebauthn/server": "^3.0.0",
"apollo-server-express": "2.25.1",
@ -20,7 +21,7 @@
"bignumber.js": "9.0.1",
"bip39": "^2.3.1",
"bitcoind-rpc": "^0.7.0",
"bitgo": "11.15.0",
"bitgo": "11.18.0",
"ccxt": "1.82.31",
"compression": "^1.7.4",
"connect-pg-simple": "^6.2.1",
@ -43,14 +44,12 @@
"got": "^7.1.0",
"graphql": "^15.5.0",
"graphql-iso-date": "^3.6.1",
"graphql-tools": "^7.0.2",
"graphql-type-json": "^0.3.1",
"graphql-upload": "12.0.0",
"helmet": "^3.8.1",
"inquirer": "^5.2.0",
"json2csv": "^5.0.3",
"libphonenumber-js": "^1.7.38",
"lnd-async": "^1.8.0",
"lodash": "^4.17.10",
"mailgun-js": "^0.21.0",
"make-dir": "^1.0.0",