Merge remote-tracking branch 'origin/release-8.1' into chore/merge-8.1-into-8.6-2023-10-22
This commit is contained in:
commit
416744baf3
31 changed files with 3327 additions and 2533 deletions
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
const adminServer = require('../lib/admin/admin-server')
|
|
||||||
|
|
||||||
adminServer.run()
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
require('../lib/environment-helper')
|
|
||||||
const login = require('../lib/admin/login')
|
|
||||||
|
|
||||||
const name = process.argv[2]
|
|
||||||
const domain = process.env.HOSTNAME
|
|
||||||
|
|
||||||
if (!domain) {
|
|
||||||
console.error('No hostname configured in the environment')
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
console.log('Usage: lamassu-register <username>')
|
|
||||||
process.exit(2)
|
|
||||||
}
|
|
||||||
|
|
||||||
login.generateOTP(name)
|
|
||||||
.then(otp => {
|
|
||||||
if (domain === 'localhost') {
|
|
||||||
console.log(`https://${domain}:8070?otp=${otp}`)
|
|
||||||
} else {
|
|
||||||
console.log(`https://${domain}?otp=${otp}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
process.exit(0)
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
console.log('Error: %s', err)
|
|
||||||
process.exit(3)
|
|
||||||
})
|
|
||||||
|
|
@ -11,9 +11,9 @@ const argv = require('minimist')(process.argv.slice(2))
|
||||||
const got = require('got')
|
const got = require('got')
|
||||||
const morgan = require('morgan')
|
const morgan = require('morgan')
|
||||||
const helmet = require('helmet')
|
const helmet = require('helmet')
|
||||||
const WebSocket = require('ws')
|
// const WebSocket = require('ws')
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const SocketIo = require('socket.io')
|
// const SocketIo = require('socket.io')
|
||||||
const makeDir = require('make-dir')
|
const makeDir = require('make-dir')
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ const pgp = require('pg-promise')()
|
||||||
|
|
||||||
const db = require('../db')
|
const db = require('../db')
|
||||||
const E = require('../error')
|
const E = require('../error')
|
||||||
const socket = require('../socket-client')
|
|
||||||
const logger = require('../logger')
|
const logger = require('../logger')
|
||||||
|
|
||||||
const helper = require('./cash-out-helper')
|
const helper = require('./cash-out-helper')
|
||||||
|
|
@ -81,7 +80,7 @@ function preProcess (t, oldTx, newTx, pi) {
|
||||||
|
|
||||||
if (hasError || hasDispenseOccurred) {
|
if (hasError || hasDispenseOccurred) {
|
||||||
return cashOutActions.logDispense(t, updatedTx)
|
return cashOutActions.logDispense(t, updatedTx)
|
||||||
.then(updateCassettes(t, updatedTx))
|
.then(it => updateCassettes(t, updatedTx).then(() => it) )
|
||||||
.then((t) => {
|
.then((t) => {
|
||||||
pi.notifyOperator(updatedTx, { isRedemption: true })
|
pi.notifyOperator(updatedTx, { isRedemption: true })
|
||||||
.catch((err) => logger.error('Failure sending transaction notification', err))
|
.catch((err) => logger.error('Failure sending transaction notification', err))
|
||||||
|
|
@ -125,7 +124,6 @@ function updateCassettes (t, tx) {
|
||||||
values.push(tx.deviceId)
|
values.push(tx.deviceId)
|
||||||
|
|
||||||
return t.one(sql, values)
|
return t.one(sql, values)
|
||||||
.then(r => socket.emit(_.assign(r, {op: 'cassetteUpdate', deviceId: tx.deviceId})))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function wasJustAuthorized (oldTx, newTx, isZeroConf) {
|
function wasJustAuthorized (oldTx, newTx, isZeroConf) {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const _ = require('lodash/fp')
|
||||||
|
|
||||||
const { ALL } = require('../../plugins/common/ccxt')
|
const { ALL } = require('../../plugins/common/ccxt')
|
||||||
|
|
||||||
const { BTC, BCH, DASH, ETH, LTC, USDT, ZEC, XMR, TRX, USDT_TRON } = COINS
|
const { BTC, BCH, DASH, ETH, LTC, USDT, ZEC, XMR, LN, TRX, USDT_TRON } = COINS
|
||||||
const { bitpay, coinbase, itbit, bitstamp, kraken, binanceus, cex, binance } = ALL
|
const { bitpay, coinbase, itbit, bitstamp, kraken, binanceus, cex, binance } = ALL
|
||||||
|
|
||||||
const TICKER = 'ticker'
|
const TICKER = 'ticker'
|
||||||
|
|
@ -37,6 +37,7 @@ const ALL_ACCOUNTS = [
|
||||||
{ code: 'monerod', display: 'monerod', class: WALLET, cryptos: [XMR] },
|
{ code: 'monerod', display: 'monerod', class: WALLET, cryptos: [XMR] },
|
||||||
{ code: 'bitcoincashd', display: 'bitcoincashd', class: WALLET, cryptos: [BCH] },
|
{ code: 'bitcoincashd', display: 'bitcoincashd', class: WALLET, cryptos: [BCH] },
|
||||||
{ code: 'bitgo', display: 'BitGo', class: WALLET, cryptos: [BTC, ZEC, LTC, BCH, DASH] },
|
{ code: 'bitgo', display: 'BitGo', class: WALLET, cryptos: [BTC, ZEC, LTC, BCH, DASH] },
|
||||||
|
{ code: 'galoy', display: 'Galoy', class: WALLET, cryptos: [LN] },
|
||||||
{ code: 'bitstamp', display: 'Bitstamp', class: EXCHANGE, cryptos: bitstamp.CRYPTO },
|
{ code: 'bitstamp', display: 'Bitstamp', class: EXCHANGE, cryptos: bitstamp.CRYPTO },
|
||||||
{ code: 'itbit', display: 'itBit', class: EXCHANGE, cryptos: itbit.CRYPTO },
|
{ code: 'itbit', display: 'itBit', class: EXCHANGE, cryptos: itbit.CRYPTO },
|
||||||
{ code: 'kraken', display: 'Kraken', class: EXCHANGE, cryptos: kraken.CRYPTO },
|
{ code: 'kraken', display: 'Kraken', class: EXCHANGE, cryptos: kraken.CRYPTO },
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ const SECRET_FIELDS = [
|
||||||
'binance.privateKey',
|
'binance.privateKey',
|
||||||
'twilio.authToken',
|
'twilio.authToken',
|
||||||
'telnyx.apiKey',
|
'telnyx.apiKey',
|
||||||
'vonage.apiSecret'
|
'vonage.apiSecret',
|
||||||
|
'galoy.walletId'
|
||||||
]
|
]
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const { utils: coinUtils } = require('@lamassu/coins')
|
const { utils: coinUtils } = require('@lamassu/coins')
|
||||||
const numeral = require('numeral')
|
|
||||||
const prettyMs = require('pretty-ms')
|
const prettyMs = require('pretty-ms')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
@ -140,8 +139,9 @@ const buildTransactionMessage = (tx, rec, highValueTx, machineName, customer) =>
|
||||||
}, highValueTx]
|
}, highValueTx]
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatCurrency (num, code) {
|
function formatCurrency (num = 0, code) {
|
||||||
return numeral(num).format('0,0.00') + ' ' + code
|
const formattedNumber = Number(num).toLocaleString(undefined, {maximumFractionDigits:2, minimumFractionDigits:2})
|
||||||
|
return `${formattedNumber} ${code}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatAge (age, settings) {
|
function formatAge (age, settings) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const crypto = require('crypto')
|
const crypto = require('crypto')
|
||||||
const pgp = require('pg-promise')()
|
const pgp = require('pg-promise')()
|
||||||
const dateFormat = require('dateformat')
|
|
||||||
const { getTimezoneOffset } = require('date-fns-tz')
|
const { getTimezoneOffset } = require('date-fns-tz')
|
||||||
const { millisecondsToMinutes } = require('date-fns/fp')
|
const { millisecondsToMinutes } = require('date-fns/fp')
|
||||||
|
|
||||||
|
|
@ -471,7 +470,8 @@ function plugins (settings, deviceId) {
|
||||||
logger.debug('notifyConfirmation')
|
logger.debug('notifyConfirmation')
|
||||||
|
|
||||||
const phone = tx.phone
|
const phone = tx.phone
|
||||||
const timestamp = dateFormat(new Date(), 'UTC:HH:MM Z')
|
|
||||||
|
const timestamp = `${(new Date()).toISOString().substring(11, 19)} UTC`
|
||||||
return sms.getSms(CASH_OUT_DISPENSE_READY, phone, { timestamp })
|
return sms.getSms(CASH_OUT_DISPENSE_READY, phone, { timestamp })
|
||||||
.then(smsObj => {
|
.then(smsObj => {
|
||||||
const rec = {
|
const rec = {
|
||||||
|
|
@ -961,13 +961,13 @@ function plugins (settings, deviceId) {
|
||||||
? '123'
|
? '123'
|
||||||
: randomCode()
|
: randomCode()
|
||||||
|
|
||||||
const timestamp = dateFormat(new Date(), 'UTC:HH:MM Z')
|
const timestamp = `${(new Date()).toISOString().substring(11, 19)} UTC`
|
||||||
return sms.getSms(CONFIRMATION_CODE, phone, { code, timestamp })
|
return sms.getSms(CONFIRMATION_CODE, phone, { code, timestamp })
|
||||||
.then(smsObj => {
|
.then(smsObj => {
|
||||||
const rec = {
|
const rec = {
|
||||||
sms: smsObj
|
sms: smsObj
|
||||||
}
|
}
|
||||||
|
|
||||||
return sms.sendMessage(settings, rec)
|
return sms.sendMessage(settings, rec)
|
||||||
.then(() => code)
|
.then(() => code)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
const { COINS } = require('@lamassu/coins')
|
const { COINS } = require('@lamassu/coins')
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
|
const { utils: coinUtils } = require('@lamassu/coins')
|
||||||
|
|
||||||
const kraken = require('../exchange/kraken')
|
const kraken = require('../exchange/kraken')
|
||||||
const bitstamp = require('../exchange/bitstamp')
|
const bitstamp = require('../exchange/bitstamp')
|
||||||
|
|
@ -10,7 +11,7 @@ const bitpay = require('../ticker/bitpay')
|
||||||
const binance = require('../exchange/binance')
|
const binance = require('../exchange/binance')
|
||||||
const logger = require('../../logger')
|
const logger = require('../../logger')
|
||||||
|
|
||||||
const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT, TRX, USDT_TRON } = COINS
|
const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT, TRX, USDT_TRON, LN } = COINS
|
||||||
|
|
||||||
const ALL = {
|
const ALL = {
|
||||||
cex: cex,
|
cex: cex,
|
||||||
|
|
@ -20,7 +21,7 @@ const ALL = {
|
||||||
itbit: itbit,
|
itbit: itbit,
|
||||||
bitpay: bitpay,
|
bitpay: bitpay,
|
||||||
coinbase: {
|
coinbase: {
|
||||||
CRYPTO: [BTC, ETH, LTC, DASH, ZEC, BCH, USDT, USDT_TRON, TRX],
|
CRYPTO: [BTC, ETH, LTC, DASH, ZEC, BCH, USDT, USDT_TRON, TRX, LN],
|
||||||
FIAT: 'ALL_CURRENCIES'
|
FIAT: 'ALL_CURRENCIES'
|
||||||
},
|
},
|
||||||
binance: binance
|
binance: binance
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ const _ = require('lodash/fp')
|
||||||
const { ORDER_TYPES } = require('./consts')
|
const { ORDER_TYPES } = require('./consts')
|
||||||
|
|
||||||
const ORDER_TYPE = ORDER_TYPES.MARKET
|
const ORDER_TYPE = ORDER_TYPES.MARKET
|
||||||
const { BTC, BCH, XMR, ETH, LTC, ZEC } = COINS
|
const { BTC, BCH, XMR, ETH, LTC, ZEC, LN } = COINS
|
||||||
const CRYPTO = [BTC, ETH, LTC, ZEC, BCH, XMR]
|
const CRYPTO = [BTC, ETH, LTC, ZEC, BCH, XMR, LN]
|
||||||
const FIAT = ['USD', 'EUR']
|
const FIAT = ['USD', 'EUR']
|
||||||
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ const _ = require('lodash/fp')
|
||||||
const { ORDER_TYPES } = require('./consts')
|
const { ORDER_TYPES } = require('./consts')
|
||||||
|
|
||||||
const ORDER_TYPE = ORDER_TYPES.MARKET
|
const ORDER_TYPE = ORDER_TYPES.MARKET
|
||||||
const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT, USDT_TRON } = COINS
|
const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT, USDT_TRON, LN } = COINS
|
||||||
const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH, USDT, USDT_TRON]
|
const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH, USDT, USDT_TRON, LN]
|
||||||
const FIAT = ['USD']
|
const FIAT = ['USD']
|
||||||
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ const _ = require('lodash/fp')
|
||||||
const { ORDER_TYPES } = require('./consts')
|
const { ORDER_TYPES } = require('./consts')
|
||||||
|
|
||||||
const ORDER_TYPE = ORDER_TYPES.MARKET
|
const ORDER_TYPE = ORDER_TYPES.MARKET
|
||||||
const { BTC, ETH, LTC, BCH, USDT } = COINS
|
const { BTC, ETH, LTC, BCH, USDT, LN } = COINS
|
||||||
const CRYPTO = [BTC, ETH, LTC, BCH, USDT ]
|
const CRYPTO = [BTC, ETH, LTC, BCH, USDT, LN]
|
||||||
const FIAT = ['USD', 'EUR']
|
const FIAT = ['USD', 'EUR']
|
||||||
const AMOUNT_PRECISION = 8
|
const AMOUNT_PRECISION = 8
|
||||||
const REQUIRED_CONFIG_FIELDS = ['key', 'secret', 'clientId']
|
const REQUIRED_CONFIG_FIELDS = ['key', 'secret', 'clientId']
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ const _ = require('lodash/fp')
|
||||||
const { ORDER_TYPES } = require('./consts')
|
const { ORDER_TYPES } = require('./consts')
|
||||||
|
|
||||||
const ORDER_TYPE = ORDER_TYPES.MARKET
|
const ORDER_TYPE = ORDER_TYPES.MARKET
|
||||||
const { BTC, BCH, DASH, ETH, LTC, USDT, TRX, USDT_TRON } = COINS
|
const { BTC, BCH, DASH, ETH, LTC, USDT, TRX, USDT_TRON, LN } = COINS
|
||||||
const CRYPTO = [BTC, ETH, LTC, DASH, BCH, USDT, TRX, USDT_TRON]
|
const CRYPTO = [BTC, ETH, LTC, DASH, BCH, USDT, TRX, USDT_TRON, LN]
|
||||||
const FIAT = ['USD', 'EUR']
|
const FIAT = ['USD', 'EUR']
|
||||||
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ const { ORDER_TYPES } = require('./consts')
|
||||||
const { COINS } = require('@lamassu/coins')
|
const { COINS } = require('@lamassu/coins')
|
||||||
|
|
||||||
const ORDER_TYPE = ORDER_TYPES.LIMIT
|
const ORDER_TYPE = ORDER_TYPES.LIMIT
|
||||||
const { BTC, ETH, USDT } = COINS
|
const { BTC, ETH, USDT, LN } = COINS
|
||||||
const CRYPTO = [BTC, ETH, USDT]
|
const CRYPTO = [BTC, ETH, USDT, LN]
|
||||||
const FIAT = ['USD']
|
const FIAT = ['USD']
|
||||||
const AMOUNT_PRECISION = 4
|
const AMOUNT_PRECISION = 4
|
||||||
const REQUIRED_CONFIG_FIELDS = ['clientKey', 'clientSecret', 'userId', 'walletId']
|
const REQUIRED_CONFIG_FIELDS = ['clientKey', 'clientSecret', 'userId', 'walletId']
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ const { ORDER_TYPES } = require('./consts')
|
||||||
const { COINS } = require('@lamassu/coins')
|
const { COINS } = require('@lamassu/coins')
|
||||||
|
|
||||||
const ORDER_TYPE = ORDER_TYPES.MARKET
|
const ORDER_TYPE = ORDER_TYPES.MARKET
|
||||||
const { BTC, BCH, DASH, ETH, LTC, ZEC, XMR, USDT, TRX, USDT_TRON } = COINS
|
const { BTC, BCH, DASH, ETH, LTC, ZEC, XMR, USDT, TRX, USDT_TRON, LN } = COINS
|
||||||
const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH, XMR, USDT, TRX, USDT_TRON]
|
const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH, XMR, USDT, TRX, USDT_TRON, LN]
|
||||||
const FIAT = ['USD', 'EUR']
|
const FIAT = ['USD', 'EUR']
|
||||||
const AMOUNT_PRECISION = 6
|
const AMOUNT_PRECISION = 6
|
||||||
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@ const axios = require('axios')
|
||||||
const { COINS } = require('@lamassu/coins')
|
const { COINS } = require('@lamassu/coins')
|
||||||
|
|
||||||
const BN = require('../../bn')
|
const BN = require('../../bn')
|
||||||
const { BTC, BCH } = COINS
|
const { BTC, BCH, LN } = COINS
|
||||||
|
|
||||||
const CRYPTO = [BTC, BCH]
|
const CRYPTO = [BTC, BCH, LN]
|
||||||
const FIAT = 'ALL_CURRENCIES'
|
const FIAT = 'ALL_CURRENCIES'
|
||||||
|
|
||||||
function ticker (fiatCode, cryptoCode) {
|
function ticker (fiatCode, cryptoCode) {
|
||||||
|
|
|
||||||
331
lib/plugins/wallet/galoy/galoy.js
Normal file
331
lib/plugins/wallet/galoy/galoy.js
Normal file
|
|
@ -0,0 +1,331 @@
|
||||||
|
const _ = require('lodash/fp')
|
||||||
|
const invoice = require('@node-lightning/invoice')
|
||||||
|
const axios = require('axios')
|
||||||
|
const { utils: coinUtils } = require('@lamassu/coins')
|
||||||
|
|
||||||
|
const NAME = 'LN'
|
||||||
|
const SUPPORTED_COINS = ['LN', 'BTC']
|
||||||
|
const TX_PENDING = 'PENDING'
|
||||||
|
const TX_SUCCESS = 'SUCCESS'
|
||||||
|
|
||||||
|
const URI = 'https://api.staging.galoy.io/graphql'
|
||||||
|
|
||||||
|
const BN = require('../../../bn')
|
||||||
|
|
||||||
|
function request (graphqlQuery, token) {
|
||||||
|
const headers = {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
|
}
|
||||||
|
return axios({
|
||||||
|
method: 'post',
|
||||||
|
url: URI,
|
||||||
|
headers: headers,
|
||||||
|
data: graphqlQuery
|
||||||
|
})
|
||||||
|
.then(r => {
|
||||||
|
if (r.error) throw r.error
|
||||||
|
return r.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkCryptoCode (cryptoCode) {
|
||||||
|
if (!SUPPORTED_COINS.includes(cryptoCode)) {
|
||||||
|
return Promise.reject(new Error('Unsupported crypto: ' + cryptoCode))
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGaloyAccount (token) {
|
||||||
|
const accountInfo = {
|
||||||
|
'operationName': 'me',
|
||||||
|
'query': `query me {
|
||||||
|
me {
|
||||||
|
defaultAccount {
|
||||||
|
defaultWalletId
|
||||||
|
wallets {
|
||||||
|
id
|
||||||
|
walletCurrency
|
||||||
|
balance
|
||||||
|
transactions {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
direction
|
||||||
|
id
|
||||||
|
settlementAmount
|
||||||
|
settlementFee
|
||||||
|
status
|
||||||
|
initiationVia {
|
||||||
|
... on InitiationViaIntraLedger {
|
||||||
|
counterPartyUsername
|
||||||
|
counterPartyWalletId
|
||||||
|
}
|
||||||
|
... on InitiationViaLn {
|
||||||
|
paymentHash
|
||||||
|
}
|
||||||
|
... on InitiationViaOnChain {
|
||||||
|
address
|
||||||
|
}
|
||||||
|
}
|
||||||
|
settlementVia {
|
||||||
|
... on SettlementViaIntraLedger {
|
||||||
|
counterPartyUsername
|
||||||
|
counterPartyWalletId
|
||||||
|
}
|
||||||
|
... on SettlementViaLn {
|
||||||
|
preImage
|
||||||
|
}
|
||||||
|
... on SettlementViaOnChain {
|
||||||
|
transactionHash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
'variables': {}
|
||||||
|
}
|
||||||
|
return request(accountInfo, token)
|
||||||
|
.then(r => {
|
||||||
|
return r.data.me.defaultAccount
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLightning (address) {
|
||||||
|
return address.substr(0, 2) === 'ln'
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendFundsOnChain (walletId, address, cryptoAtoms, token) {
|
||||||
|
const sendOnChain = {
|
||||||
|
'operationName': 'onChainPaymentSend',
|
||||||
|
'query': `mutation onChainPaymentSend($input: OnChainPaymentSendInput!) {
|
||||||
|
onChainPaymentSend(input: $input) {
|
||||||
|
errors {
|
||||||
|
message
|
||||||
|
path
|
||||||
|
}
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
'variables': { 'input': { 'address': `${address}`, 'amount': `${cryptoAtoms}`, 'walletId': `${walletId}` } }
|
||||||
|
}
|
||||||
|
return request(sendOnChain, token)
|
||||||
|
.then(result => {
|
||||||
|
return result.data.onChainPaymentSend
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendFundsLN (walletId, invoice, token) {
|
||||||
|
const sendLN = {
|
||||||
|
'operationName': 'lnInvoicePaymentSend',
|
||||||
|
'query': `mutation lnInvoicePaymentSend($input: LnInvoicePaymentInput!) {
|
||||||
|
lnInvoicePaymentSend(input: $input) {
|
||||||
|
errors {
|
||||||
|
message
|
||||||
|
path
|
||||||
|
}
|
||||||
|
status
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
'variables': { 'input': { 'paymentRequest': `${invoice}`, 'walletId': `${walletId}` } }
|
||||||
|
}
|
||||||
|
return request(sendLN, token)
|
||||||
|
.then(result => {
|
||||||
|
return result.data.lnInvoicePaymentSend
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendCoins (account, tx, settings, operatorId) {
|
||||||
|
const { toAddress, cryptoAtoms, cryptoCode } = tx
|
||||||
|
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
.then(() => getGaloyAccount(account.apiKey))
|
||||||
|
.then(galoyAccount => {
|
||||||
|
const wallet = _.head(
|
||||||
|
_.filter(wallet => wallet.walletCurrency === externalCryptoCode &&
|
||||||
|
wallet.id === galoyAccount.defaultWalletId &&
|
||||||
|
wallet.id === account.walletId)(galoyAccount.wallets)
|
||||||
|
)
|
||||||
|
if (isLightning(toAddress)) {
|
||||||
|
return sendFundsLN(wallet.id, toAddress, account.apiKey)
|
||||||
|
}
|
||||||
|
return sendFundsOnChain(wallet.id, toAddress, cryptoAtoms, account.apiKey)
|
||||||
|
})
|
||||||
|
.then(result => {
|
||||||
|
switch (result.status) {
|
||||||
|
case 'ALREADY_PAID':
|
||||||
|
throw new Error('Transaction already exists!')
|
||||||
|
case 'FAILURE':
|
||||||
|
throw new Error('Transaction failed!')
|
||||||
|
case 'SUCCESS':
|
||||||
|
return '<galoy transaction>'
|
||||||
|
case 'PENDING':
|
||||||
|
return '<galoy transaction>'
|
||||||
|
default:
|
||||||
|
throw new Error(`Transaction failed: ${_.head(result.errors).message}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function newOnChainAddress (walletId, token) {
|
||||||
|
const createOnChainAddress = {
|
||||||
|
'operationName': 'onChainAddressCreate',
|
||||||
|
'query': `mutation onChainAddressCreate($input: OnChainAddressCreateInput!) {
|
||||||
|
onChainAddressCreate(input: $input) {
|
||||||
|
address
|
||||||
|
errors {
|
||||||
|
message
|
||||||
|
path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
'variables': { 'input': { 'walletId': `${walletId}` } }
|
||||||
|
}
|
||||||
|
return request(createOnChainAddress, token)
|
||||||
|
.then(result => {
|
||||||
|
return result.data.onChainAddressCreate.address
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function newInvoice (walletId, cryptoAtoms, token) {
|
||||||
|
const createInvoice = {
|
||||||
|
'operationName': 'lnInvoiceCreate',
|
||||||
|
'query': `mutation lnInvoiceCreate($input: LnInvoiceCreateInput!) {
|
||||||
|
lnInvoiceCreate(input: $input) {
|
||||||
|
errors {
|
||||||
|
message
|
||||||
|
path
|
||||||
|
}
|
||||||
|
invoice {
|
||||||
|
paymentRequest
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`,
|
||||||
|
'variables': { 'input': { 'walletId': `${walletId}`, 'amount': `${cryptoAtoms}` } }
|
||||||
|
}
|
||||||
|
return request(createInvoice, token)
|
||||||
|
.then(result => {
|
||||||
|
return result.data.lnInvoiceCreate.invoice.paymentRequest
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function balance (account, cryptoCode, settings, operatorId) {
|
||||||
|
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
.then(() => getGaloyAccount(account.apiKey))
|
||||||
|
.then(galoyAccount => {
|
||||||
|
// account has a list of wallets, should we consider the balance of each one?
|
||||||
|
// for now we'll get the first BTC wallet that matches the defaultWalletId
|
||||||
|
const wallet = _.head(
|
||||||
|
_.filter(
|
||||||
|
wallet => wallet.walletCurrency === externalCryptoCode &&
|
||||||
|
wallet.id === account.walletId)(galoyAccount.wallets)
|
||||||
|
)
|
||||||
|
return new BN(wallet.balance || 0)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function newAddress (account, info, tx, settings, operatorId) {
|
||||||
|
const { cryptoAtoms, cryptoCode } = tx
|
||||||
|
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
.then(() => getGaloyAccount(account.apiKey))
|
||||||
|
.then(galoyAccount => {
|
||||||
|
const wallet = _.head(
|
||||||
|
_.filter(wallet => wallet.walletCurrency === externalCryptoCode &&
|
||||||
|
wallet.id === galoyAccount.defaultWalletId &&
|
||||||
|
wallet.id === account.walletId)(galoyAccount.wallets)
|
||||||
|
)
|
||||||
|
const promises = [
|
||||||
|
newOnChainAddress(wallet.id, account.apiKey),
|
||||||
|
newInvoice(wallet.id, cryptoAtoms, account.apiKey)
|
||||||
|
]
|
||||||
|
return Promise.all(promises)
|
||||||
|
})
|
||||||
|
.then(([onChainAddress, invoice]) => {
|
||||||
|
return `bitcoin:${onChainAddress}?amount=${cryptoAtoms}&lightning=${invoice}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStatus (account, tx, requested, settings, operatorId) {
|
||||||
|
const { toAddress, cryptoAtoms, cryptoCode } = tx
|
||||||
|
const mapStatus = tx => {
|
||||||
|
if (!tx) return 'notSeen'
|
||||||
|
if (tx.node.status === TX_PENDING) return 'authorized'
|
||||||
|
if (tx.node.status === TX_SUCCESS) return 'confirmed'
|
||||||
|
return 'notSeen'
|
||||||
|
}
|
||||||
|
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
|
||||||
|
const address = coinUtils.parseUrl(toAddress)
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
.then(() => getGaloyAccount(account.apiKey))
|
||||||
|
.then(galoyAccount => {
|
||||||
|
const wallet = _.head(
|
||||||
|
_.filter(wallet => wallet.walletCurrency === externalCryptoCode &&
|
||||||
|
wallet.id === galoyAccount.defaultWalletId &&
|
||||||
|
wallet.id === account.walletId)(galoyAccount.wallets)
|
||||||
|
)
|
||||||
|
const transactions = wallet.transactions.edges
|
||||||
|
if (isLightning(address)) {
|
||||||
|
const paymentHash = invoice.decode(address).paymentHash.toString('hex')
|
||||||
|
const transaction = _.head(_.filter(tx => tx.node.initiationVia.paymentHash === paymentHash && tx.node.direction === 'RECEIVE')(transactions))
|
||||||
|
return { receivedCryptoAtoms: cryptoAtoms, status: mapStatus(transaction) }
|
||||||
|
}
|
||||||
|
// On-chain tx
|
||||||
|
const transaction = _.head(_.filter(tx => tx.node.initiationVia.address === address)(transactions))
|
||||||
|
return { receivedCryptoAtoms: cryptoAtoms, status: mapStatus(transaction) }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function newFunding (account, cryptoCode, settings, operatorId) {
|
||||||
|
const externalCryptoCode = coinUtils.getEquivalentCode(cryptoCode)
|
||||||
|
// Regular BTC address
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
.then(() => getGaloyAccount(account.apiKey))
|
||||||
|
.then(galoyAccount => {
|
||||||
|
const wallet = _.head(
|
||||||
|
_.filter(wallet => wallet.walletCurrency === externalCryptoCode &&
|
||||||
|
wallet.id === galoyAccount.defaultWalletId &&
|
||||||
|
wallet.id === account.walletId)(galoyAccount.wallets)
|
||||||
|
)
|
||||||
|
const pendingBalance = _.sumBy(tx => {
|
||||||
|
if (tx.node.status === TX_PENDING) return tx.node.settlementAmount
|
||||||
|
return 0
|
||||||
|
})(wallet.transactions.edges)
|
||||||
|
return newOnChainAddress(wallet.id, account.apiKey)
|
||||||
|
.then(onChainAddress => [onChainAddress, wallet.balance, pendingBalance])
|
||||||
|
})
|
||||||
|
.then(([onChainAddress, balance, pendingBalance]) => {
|
||||||
|
return {
|
||||||
|
fundingPendingBalance: new BN(pendingBalance),
|
||||||
|
fundingConfirmedBalance: new BN(balance),
|
||||||
|
fundingAddress: onChainAddress
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function cryptoNetwork (account, cryptoCode, settings, operatorId) {
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
.then(() => account.environment === 'test' ? 'test' : 'main')
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkBlockchainStatus (cryptoCode) {
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
.then(() => Promise.resolve('ready'))
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
NAME,
|
||||||
|
balance,
|
||||||
|
sendCoins,
|
||||||
|
newAddress,
|
||||||
|
getStatus,
|
||||||
|
newFunding,
|
||||||
|
cryptoNetwork,
|
||||||
|
checkBlockchainStatus
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
const dateFormat = require('dateformat')
|
|
||||||
|
|
||||||
const ph = require('./plugin-helper')
|
const ph = require('./plugin-helper')
|
||||||
const { utils: coinUtils } = require('@lamassu/coins')
|
const { utils: coinUtils } = require('@lamassu/coins')
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
|
|
@ -104,7 +101,8 @@ function formatSmsReceipt (data, options) {
|
||||||
message = message.concat(`Address: ${data.address}\n`)
|
message = message.concat(`Address: ${data.address}\n`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const timestamp = dateFormat(new Date(), 'UTC:HH:MM Z')
|
const timestamp = `${(new Date()).toISOString().substring(11, 19)} UTC`
|
||||||
|
|
||||||
const postReceiptSmsPromise = getSms(RECEIPT, data.customerPhone, { timestamp })
|
const postReceiptSmsPromise = getSms(RECEIPT, data.customerPhone, { timestamp })
|
||||||
|
|
||||||
return Promise.all([smsNotices.getSMSNotice(RECEIPT), postReceiptSmsPromise])
|
return Promise.all([smsNotices.getSMSNotice(RECEIPT), postReceiptSmsPromise])
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
const io = require('socket.io-client')
|
|
||||||
|
|
||||||
const socket = io('http://localhost:3060')
|
|
||||||
|
|
||||||
module.exports = {emit}
|
|
||||||
|
|
||||||
function emit (msg) {
|
|
||||||
socket.emit('message', msg)
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const { utils: coinUtils } = require('@lamassu/coins')
|
const { utils: coinUtils } = require('@lamassu/coins')
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const mem = require('mem')
|
const mem = require('mem')
|
||||||
|
|
||||||
const configManager = require('./new-config-manager')
|
const configManager = require('./new-config-manager')
|
||||||
const logger = require('./logger')
|
const logger = require('./logger')
|
||||||
const lastRate = {}
|
const lastRate = {}
|
||||||
|
|
@ -36,16 +37,15 @@ function _getRates (settings, fiatCode, cryptoCode) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildTicker (fiatCode, _cryptoCode, tickerName) {
|
function buildTicker (fiatCode, cryptoCode, tickerName) {
|
||||||
const fiatPeggedEquivalent = _.includes(fiatCode, _.keys(PEGGED_FIAT_CURRENCIES))
|
fiatCode = _.includes(fiatCode, _.keys(PEGGED_FIAT_CURRENCIES))
|
||||||
? PEGGED_FIAT_CURRENCIES[fiatCode]
|
? PEGGED_FIAT_CURRENCIES[fiatCode]
|
||||||
: fiatCode
|
: fiatCode
|
||||||
|
cryptoCode = coinUtils.getEquivalentCode(cryptoCode)
|
||||||
|
|
||||||
const cryptoCode = coinUtils.getEquivalentCode(_cryptoCode)
|
if (tickerName === 'bitpay') return bitpay.ticker(fiatCode, cryptoCode)
|
||||||
|
if (tickerName === 'mock-ticker') return mockTicker.ticker(fiatCode, cryptoCode)
|
||||||
if (tickerName === 'bitpay') return bitpay.ticker(fiatPeggedEquivalent, cryptoCode)
|
return ccxt.ticker(fiatCode, cryptoCode, tickerName)
|
||||||
if (tickerName === 'mock-ticker') return mockTicker.ticker(fiatPeggedEquivalent, cryptoCode)
|
|
||||||
return ccxt.ticker(fiatPeggedEquivalent, cryptoCode, tickerName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getRates = mem(_getRates, {
|
const getRates = mem(_getRates, {
|
||||||
|
|
|
||||||
29
new-lamassu-admin/package-lock.json
generated
29
new-lamassu-admin/package-lock.json
generated
|
|
@ -4393,11 +4393,32 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@lamassu/coins": {
|
"@lamassu/bolt11": {
|
||||||
"version": "1.3.3",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@lamassu/coins/-/coins-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/@lamassu/bolt11/-/bolt11-1.5.0.tgz",
|
||||||
"integrity": "sha512-BduHgzPMlwf9PrTNgnhXmuzTiO5hjlV19Y64SfMb4Ng8AGkI5YXzNpmOE4VhSunJMB8fl0rNC89zVMRuunIzQg==",
|
"integrity": "sha512-zvPbYuWuTJmvlU4nUjYBY/OtLFczHm5v/yNS9PTvFQJGSIQ2/7K3OEwl8FtTnV9KhIojoR7ue6NMSK2VHHqACA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"bech32": "^1.1.2",
|
||||||
|
"bitcoinjs-lib": "4.0.3",
|
||||||
|
"bn.js": "^4.11.8",
|
||||||
|
"create-hash": "^1.2.0",
|
||||||
|
"lodash": "^4.17.11",
|
||||||
|
"safe-buffer": "^5.1.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"bech32": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@lamassu/coins": {
|
||||||
|
"version": "1.4.0-beta.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lamassu/coins/-/coins-1.4.0-beta.4.tgz",
|
||||||
|
"integrity": "sha512-Tjy3g1FwMJWGNe8pSxSG6ZeETF70ekzTSmNQX/v5BE3l5vsCcmIyug65KU265eyHQT6/IwzUNL8p7NE6VAKakQ==",
|
||||||
|
"requires": {
|
||||||
|
"@lamassu/bolt11": "1.5.0",
|
||||||
"bech32": "2.0.0",
|
"bech32": "2.0.0",
|
||||||
"big-integer": "^1.6.48",
|
"big-integer": "^1.6.48",
|
||||||
"bignumber.js": "^9.0.0",
|
"bignumber.js": "^9.0.0",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"license": "../LICENSE",
|
"license": "../LICENSE",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/react-hooks": "^3.1.3",
|
"@apollo/react-hooks": "^3.1.3",
|
||||||
"@lamassu/coins": "v1.3.3",
|
"@lamassu/coins": "v1.4.0-beta.4",
|
||||||
"@material-ui/core": "4.11.0",
|
"@material-ui/core": "4.11.0",
|
||||||
"@material-ui/icons": "4.9.1",
|
"@material-ui/icons": "4.9.1",
|
||||||
"@material-ui/lab": "^4.0.0-alpha.56",
|
"@material-ui/lab": "^4.0.0-alpha.56",
|
||||||
|
|
|
||||||
|
|
@ -142,8 +142,9 @@ const Blacklist = () => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const blacklistData = R.path(['blacklist'])(blacklistResponse) ?? []
|
const blacklistData = R.path(['blacklist'])(blacklistResponse) ?? []
|
||||||
const availableCurrencies =
|
const availableCurrencies = R.filter(
|
||||||
R.path(['cryptoCurrencies'], blacklistResponse) ?? []
|
coin => coinUtils.getEquivalentCode(coin.code) === coin.code
|
||||||
|
)(R.path(['cryptoCurrencies'], blacklistResponse) ?? [])
|
||||||
|
|
||||||
const formattedData = groupByCode(blacklistData)
|
const formattedData = groupByCode(blacklistData)
|
||||||
|
|
||||||
|
|
|
||||||
36
new-lamassu-admin/src/pages/Services/schemas/galoy.js
Normal file
36
new-lamassu-admin/src/pages/Services/schemas/galoy.js
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
|
import SecretInputFormik from 'src/components/inputs/formik/SecretInput'
|
||||||
|
import TextInputFormik from 'src/components/inputs/formik/TextInput'
|
||||||
|
|
||||||
|
import { secretTest } from './helper'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
code: 'galoy',
|
||||||
|
name: 'Galoy',
|
||||||
|
title: 'Galoy (Wallet)',
|
||||||
|
elements: [
|
||||||
|
{
|
||||||
|
code: 'apiKey',
|
||||||
|
display: 'API Key',
|
||||||
|
component: TextInputFormik,
|
||||||
|
face: true,
|
||||||
|
long: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'walletId',
|
||||||
|
display: 'Wallet ID',
|
||||||
|
component: SecretInputFormik
|
||||||
|
}
|
||||||
|
],
|
||||||
|
getValidationSchema: account => {
|
||||||
|
return Yup.object().shape({
|
||||||
|
apiKey: Yup.string('The API key must be a string')
|
||||||
|
.max(200, 'The API key is too long')
|
||||||
|
.required('The API key is required'),
|
||||||
|
walletId: Yup.string('The wallet id must be a string')
|
||||||
|
.max(100, 'The wallet id is too long')
|
||||||
|
.test(secretTest(account?.walletId))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import bitstamp from './bitstamp'
|
||||||
import blockcypher from './blockcypher'
|
import blockcypher from './blockcypher'
|
||||||
import cex from './cex'
|
import cex from './cex'
|
||||||
import ciphertrace from './ciphertrace'
|
import ciphertrace from './ciphertrace'
|
||||||
|
import galoy from './galoy'
|
||||||
import infura from './infura'
|
import infura from './infura'
|
||||||
import itbit from './itbit'
|
import itbit from './itbit'
|
||||||
import kraken from './kraken'
|
import kraken from './kraken'
|
||||||
|
|
@ -16,6 +17,7 @@ import vonage from './vonage'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
[bitgo.code]: bitgo,
|
[bitgo.code]: bitgo,
|
||||||
|
[galoy.code]: galoy,
|
||||||
[bitstamp.code]: bitstamp,
|
[bitstamp.code]: bitstamp,
|
||||||
[blockcypher.code]: blockcypher,
|
[blockcypher.code]: blockcypher,
|
||||||
[infura.code]: infura,
|
[infura.code]: infura,
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ const getLogo = code => {
|
||||||
return MoneroLogo
|
return MoneroLogo
|
||||||
case 'TRX':
|
case 'TRX':
|
||||||
return TronLogo
|
return TronLogo
|
||||||
|
case 'LN':
|
||||||
|
return BitcoinLogo
|
||||||
default:
|
default:
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { useQuery, useMutation } from '@apollo/react-hooks'
|
import { useQuery, useMutation } from '@apollo/react-hooks'
|
||||||
|
import { utils as coinUtils } from '@lamassu/coins'
|
||||||
import { makeStyles } from '@material-ui/core'
|
import { makeStyles } from '@material-ui/core'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
|
|
@ -54,7 +55,7 @@ const ChooseExchange = ({ data: currentData, addData }) => {
|
||||||
const accounts = data?.accounts ?? []
|
const accounts = data?.accounts ?? []
|
||||||
const accountsConfig = data?.accountsConfig ?? []
|
const accountsConfig = data?.accountsConfig ?? []
|
||||||
|
|
||||||
const coin = currentData.coin
|
const coin = coinUtils.getEquivalentCode(currentData.coin)
|
||||||
const exchanges = getItems(accountsConfig, accounts, 'exchange', coin)
|
const exchanges = getItems(accountsConfig, accounts, 'exchange', coin)
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { useQuery } from '@apollo/react-hooks'
|
import { useQuery } from '@apollo/react-hooks'
|
||||||
|
import { utils as coinUtils } from '@lamassu/coins'
|
||||||
import { makeStyles } from '@material-ui/core'
|
import { makeStyles } from '@material-ui/core'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import * as R from 'ramda'
|
import * as R from 'ramda'
|
||||||
|
|
@ -34,7 +35,7 @@ const ChooseTicker = ({ data: currentData, addData }) => {
|
||||||
const accounts = data?.accounts ?? []
|
const accounts = data?.accounts ?? []
|
||||||
const accountsConfig = data?.accountsConfig ?? []
|
const accountsConfig = data?.accountsConfig ?? []
|
||||||
|
|
||||||
const coin = currentData.coin
|
const coin = coinUtils.getEquivalentCode(currentData.coin)
|
||||||
const tickers = getItems(accountsConfig, accounts, 'ticker', coin)
|
const tickers = getItems(accountsConfig, accounts, 'ticker', coin)
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,8 @@ const SAVE_ACCOUNTS = gql`
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const isConfigurable = it => R.contains(it)(['infura', 'bitgo', 'trongrid'])
|
const isConfigurable = it =>
|
||||||
|
R.contains(it)(['infura', 'bitgo', 'trongrid', 'galoy'])
|
||||||
|
|
||||||
const isLocalHosted = it =>
|
const isLocalHosted = it =>
|
||||||
R.contains(it)([
|
R.contains(it)([
|
||||||
|
|
@ -167,6 +168,19 @@ const ChooseWallet = ({ data: currentData, addData }) => {
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{selected === 'galoy' && (
|
||||||
|
<>
|
||||||
|
<H4 noMargin>Enter wallet information</H4>
|
||||||
|
<FormRenderer
|
||||||
|
value={accounts.galoy}
|
||||||
|
save={saveWallet(selected)}
|
||||||
|
elements={schema.galoy.elements}
|
||||||
|
validationSchema={schema.galoy.getValidationSchema(accounts.galoy)}
|
||||||
|
buttonLabel={'Continue'}
|
||||||
|
buttonClass={classes.formButton}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5291
package-lock.json
generated
5291
package-lock.json
generated
File diff suppressed because it is too large
Load diff
13
package.json
13
package.json
|
|
@ -10,7 +10,8 @@
|
||||||
"@ethereumjs/tx": "^3.5.1",
|
"@ethereumjs/tx": "^3.5.1",
|
||||||
"@graphql-tools/merge": "^6.2.5",
|
"@graphql-tools/merge": "^6.2.5",
|
||||||
"@haensl/subset-sum": "^3.0.5",
|
"@haensl/subset-sum": "^3.0.5",
|
||||||
"@lamassu/coins": "v1.3.3",
|
"@lamassu/coins": "v1.4.0-beta.4",
|
||||||
|
"@node-lightning/invoice": "0.28.0",
|
||||||
"@simplewebauthn/server": "^3.0.0",
|
"@simplewebauthn/server": "^3.0.0",
|
||||||
"@vonage/auth": "^1.5.0",
|
"@vonage/auth": "^1.5.0",
|
||||||
"@vonage/sms": "^1.7.0",
|
"@vonage/sms": "^1.7.0",
|
||||||
|
|
@ -23,7 +24,6 @@
|
||||||
"bchaddrjs": "^0.3.0",
|
"bchaddrjs": "^0.3.0",
|
||||||
"bignumber.js": "9.0.1",
|
"bignumber.js": "9.0.1",
|
||||||
"bip39": "^2.3.1",
|
"bip39": "^2.3.1",
|
||||||
"bitcoind-rpc": "^0.7.0",
|
|
||||||
"@bitgo/sdk-api": "1.21.0",
|
"@bitgo/sdk-api": "1.21.0",
|
||||||
"@bitgo/sdk-coin-bch": "1.5.10",
|
"@bitgo/sdk-coin-bch": "1.5.10",
|
||||||
"@bitgo/sdk-coin-btc": "1.7.10",
|
"@bitgo/sdk-coin-btc": "1.7.10",
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
"@bitgo/sdk-coin-ltc": "2.2.10",
|
"@bitgo/sdk-coin-ltc": "2.2.10",
|
||||||
"@bitgo/sdk-coin-zec": "1.5.10",
|
"@bitgo/sdk-coin-zec": "1.5.10",
|
||||||
"@bitgo/utxo-lib": "9.13.0",
|
"@bitgo/utxo-lib": "9.13.0",
|
||||||
"ccxt": "lamassu/ccxt#1.82.31",
|
"ccxt": "2.9.16",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.4",
|
||||||
"connect-pg-simple": "^6.2.1",
|
"connect-pg-simple": "^6.2.1",
|
||||||
"console-log-level": "^1.4.0",
|
"console-log-level": "^1.4.0",
|
||||||
|
|
@ -45,10 +45,7 @@
|
||||||
"ethereumjs-util": "^5.2.0",
|
"ethereumjs-util": "^5.2.0",
|
||||||
"ethereumjs-wallet": "^0.6.3",
|
"ethereumjs-wallet": "^0.6.3",
|
||||||
"express": "4.17.1",
|
"express": "4.17.1",
|
||||||
"express-limiter": "^1.6.0",
|
|
||||||
"express-rate-limit": "^2.9.0",
|
|
||||||
"express-session": "^1.17.1",
|
"express-session": "^1.17.1",
|
||||||
"express-ws": "^3.0.0",
|
|
||||||
"futoin-hkdf": "^1.0.2",
|
"futoin-hkdf": "^1.0.2",
|
||||||
"got": "^7.1.0",
|
"got": "^7.1.0",
|
||||||
"graphql": "^15.5.0",
|
"graphql": "^15.5.0",
|
||||||
|
|
@ -71,7 +68,6 @@
|
||||||
"ndjson": "^1.5.0",
|
"ndjson": "^1.5.0",
|
||||||
"nocache": "^2.1.0",
|
"nocache": "^2.1.0",
|
||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"numeral": "^2.0.3",
|
|
||||||
"otplib": "^12.0.1",
|
"otplib": "^12.0.1",
|
||||||
"p-each-series": "^1.0.0",
|
"p-each-series": "^1.0.0",
|
||||||
"p-queue": "^6.6.2",
|
"p-queue": "^6.6.2",
|
||||||
|
|
@ -85,8 +81,6 @@
|
||||||
"request-promise": "^4.2.6",
|
"request-promise": "^4.2.6",
|
||||||
"semver": "^7.1.3",
|
"semver": "^7.1.3",
|
||||||
"serve-static": "^1.12.4",
|
"serve-static": "^1.12.4",
|
||||||
"socket.io": "^2.0.3",
|
|
||||||
"socket.io-client": "^2.0.3",
|
|
||||||
"talisman": "^0.20.0",
|
"talisman": "^0.20.0",
|
||||||
"telnyx": "^1.25.5",
|
"telnyx": "^1.25.5",
|
||||||
"tronweb": "^5.3.0",
|
"tronweb": "^5.3.0",
|
||||||
|
|
@ -95,7 +89,6 @@
|
||||||
"web3": "1.7.1",
|
"web3": "1.7.1",
|
||||||
"winston": "^2.4.2",
|
"winston": "^2.4.2",
|
||||||
"winston-transport": "^4.3.0",
|
"winston-transport": "^4.3.0",
|
||||||
"ws": "^3.1.0",
|
|
||||||
"xml-stream": "^0.4.5",
|
"xml-stream": "^0.4.5",
|
||||||
"xmlrpc": "^1.3.2",
|
"xmlrpc": "^1.3.2",
|
||||||
"yup": "^0.31.1"
|
"yup": "^0.31.1"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue