add support for funding
This commit is contained in:
parent
8440fa3b1d
commit
bf0dc3f7f3
15 changed files with 731 additions and 356 deletions
|
|
@ -27,6 +27,7 @@ const login = require('./login')
|
|||
const pairing = require('./pairing')
|
||||
const server = require('./server')
|
||||
const transactions = require('./transactions')
|
||||
const funding = require('./funding')
|
||||
|
||||
const NEVER = new Date(Date.now() + 100 * T.years)
|
||||
const REAUTHENTICATE_INTERVAL = T.minute
|
||||
|
|
@ -122,6 +123,18 @@ app.post('/api/machines', (req, res) => {
|
|||
.then(() => dbNotify())
|
||||
})
|
||||
|
||||
app.get('/api/funding', (req, res) => {
|
||||
return funding.getFunding()
|
||||
.then(r => res.json(r))
|
||||
})
|
||||
|
||||
app.get('/api/funding/:cryptoCode', (req, res) => {
|
||||
const cryptoCode = req.params.cryptoCode
|
||||
|
||||
return funding.getFunding(cryptoCode)
|
||||
.then(r => res.json(r))
|
||||
})
|
||||
|
||||
app.get('/api/status', (req, res, next) => {
|
||||
return Promise.all([server.status(), config.validateCurrentConfig()])
|
||||
.then(([serverStatus, invalidConfigGroups]) => res.send({
|
||||
|
|
|
|||
61
lib/admin/funding.js
Normal file
61
lib/admin/funding.js
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
const BN = require('../bn')
|
||||
const settingsLoader = require('../settings-loader')
|
||||
const configManager = require('../config-manager')
|
||||
const wallet = require('../wallet')
|
||||
const ticker = require('../ticker')
|
||||
const coinUtils = require('../coin-utils')
|
||||
|
||||
module.exports = {getFunding}
|
||||
|
||||
function computeCrypto (cryptoCode, _balance) {
|
||||
const unitScale = coinUtils.coins[cryptoCode].unitScale
|
||||
|
||||
return BN(_balance).shift(-unitScale).round(5)
|
||||
}
|
||||
|
||||
function computeFiat (rate, cryptoCode, _balance) {
|
||||
const unitScale = coinUtils.coins[cryptoCode].unitScale
|
||||
|
||||
return BN(_balance).shift(-unitScale).mul(rate).round(5)
|
||||
}
|
||||
|
||||
function getFunding (cryptoCode) {
|
||||
cryptoCode = cryptoCode || 'BTC'
|
||||
const cryptoDisplays = coinUtils.cryptoDisplays
|
||||
|
||||
if (!coinUtils.coins[cryptoCode]) throw new Error(`Unsupported coin: ${cryptoCode}`)
|
||||
return settingsLoader.loadLatest()
|
||||
.then(settings => {
|
||||
const config = configManager.unscoped(settings.config)
|
||||
const fiatCode = config.fiatCurrency
|
||||
|
||||
const promises = [
|
||||
wallet.newFunding(settings, cryptoCode),
|
||||
ticker.getRates(settings, fiatCode, cryptoCode)
|
||||
]
|
||||
|
||||
return Promise.all(promises)
|
||||
.then(([fundingRec, ratesRec]) => {
|
||||
const rates = ratesRec.rates
|
||||
const rate = (rates.ask.add(rates.bid)).div(2)
|
||||
const fundingConfirmedBalance = fundingRec.fundingConfirmedBalance
|
||||
const fiatConfirmedBalance = computeFiat(rate, cryptoCode, fundingConfirmedBalance)
|
||||
const pending = fundingRec.fundingPendingBalance.sub(fundingConfirmedBalance)
|
||||
const fiatPending = computeFiat(rate, cryptoCode, pending)
|
||||
const fundingAddress = fundingRec.fundingAddress
|
||||
const fundingAddressUrl = coinUtils.buildUrl(cryptoCode, fundingAddress)
|
||||
|
||||
return {
|
||||
cryptoCode,
|
||||
cryptoDisplays,
|
||||
fundingAddress,
|
||||
fundingAddressUrl,
|
||||
confirmedBalance: computeCrypto(cryptoCode, fundingConfirmedBalance).toFormat(5),
|
||||
pending: computeCrypto(cryptoCode, pending).toFormat(5),
|
||||
fiatConfirmedBalance: fiatConfirmedBalance.toFormat(2),
|
||||
fiatPending: fiatPending.toFormat(2),
|
||||
fiatCode
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
19
lib/coin-utils.js
Normal file
19
lib/coin-utils.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
const coins = {
|
||||
BTC: {unitScale: 8},
|
||||
ETH: {unitScale: 18}
|
||||
}
|
||||
|
||||
const cryptoDisplays = [
|
||||
{cryptoCode: 'BTC', display: 'Bitcoin'},
|
||||
{cryptoCode: 'ETH', display: 'Ethereum'}
|
||||
]
|
||||
|
||||
module.exports = {coins, cryptoDisplays, buildUrl}
|
||||
|
||||
function buildUrl (cryptoCode, address) {
|
||||
switch (cryptoCode) {
|
||||
case 'BTC': return `bitcoin:${address}`
|
||||
case 'ETH': return `ethereum:${address}`
|
||||
default: throw new Error(`Unsupported crypto: ${cryptoCode}`)
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,8 @@ function load (type, pluginCode) {
|
|||
throw new Error(`Unallowed plugin type: ${type}`)
|
||||
}
|
||||
|
||||
if (!pluginCode) throw new Error(`No plugin defined for ${type}`)
|
||||
|
||||
if (pluginCode.search(/[a-z0-9\-]/) === -1) {
|
||||
throw new Error(`Unallowed plugin name: ${pluginCode}`)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const sms = require('./sms')
|
|||
const email = require('./email')
|
||||
const cashOutHelper = require('./cash-out-helper')
|
||||
const machineLoader = require('./machine-loader')
|
||||
const coinUtils = require('./coin-utils')
|
||||
|
||||
const mapValuesWithKey = _.mapValues.convert({cap: false})
|
||||
|
||||
|
|
@ -26,10 +27,7 @@ const STALE_BALANCE = 3 * T.minutes
|
|||
const PONG_TTL = '1 week'
|
||||
const tradesQueues = {}
|
||||
|
||||
const coins = {
|
||||
BTC: {unitScale: 8},
|
||||
ETH: {unitScale: 18}
|
||||
}
|
||||
const coins = coinUtils.coins
|
||||
|
||||
function plugins (settings, deviceId) {
|
||||
function buildRates (tickers) {
|
||||
|
|
|
|||
|
|
@ -50,25 +50,30 @@ function parseConf (confPath) {
|
|||
}
|
||||
|
||||
function checkCryptoCode (cryptoCode) {
|
||||
if (cryptoCode !== 'BTC') throw new Error('Unsupported crypto: ' + cryptoCode)
|
||||
if (cryptoCode !== 'BTC') return Promise.reject(new Error('Unsupported crypto: ' + cryptoCode))
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
function accountBalance (account, cryptoCode, confirmations) {
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => {
|
||||
const rpc = initRpc()
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
rpc.getBalance(pluginConfig.account, confirmations, (err, result) => {
|
||||
if (err) return reject(err)
|
||||
if (result.error) reject(new Error(err))
|
||||
|
||||
return resolve(BN(result.result).shift(SATOSHI_SHIFT).round())
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// We want a balance that includes all spends (0 conf) but only deposits that
|
||||
// have at least 1 confirmation. getbalance does this for us automatically.
|
||||
function balance (account, cryptoCode) {
|
||||
return new Promise((resolve, reject) => {
|
||||
checkCryptoCode(cryptoCode)
|
||||
const rpc = initRpc()
|
||||
rpc.getBalance(pluginConfig.account, 1, (err, result) => {
|
||||
if (err) return reject(err)
|
||||
|
||||
if (result.error) {
|
||||
return reject(err)
|
||||
}
|
||||
|
||||
resolve(BN(result.result).shift(SATOSHI_SHIFT).round())
|
||||
})
|
||||
})
|
||||
return accountBalance(account, cryptoCode, 1)
|
||||
}
|
||||
|
||||
function sendCoins (account, address, cryptoAtoms, cryptoCode) {
|
||||
|
|
@ -76,26 +81,30 @@ function sendCoins (account, address, cryptoAtoms, cryptoCode) {
|
|||
const confirmations = 1
|
||||
const bitcoins = cryptoAtoms.shift(-SATOSHI_SHIFT).toFixed(8)
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
checkCryptoCode(cryptoCode)
|
||||
rpc.sendFrom(pluginConfig.account, address, bitcoins, confirmations, (err, result) => {
|
||||
if (err) {
|
||||
if (err.code === -6) return reject(new E.InsufficientFundsError())
|
||||
return reject(err)
|
||||
}
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
rpc.sendFrom(pluginConfig.account, address, bitcoins, confirmations, (err, result) => {
|
||||
if (err) {
|
||||
if (err.code === -6) return reject(new E.InsufficientFundsError())
|
||||
return reject(err)
|
||||
}
|
||||
|
||||
resolve(result.result)
|
||||
resolve(result.result)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function newAddress (account, info) {
|
||||
return new Promise((resolve, reject) => {
|
||||
checkCryptoCode(info.cryptoCode)
|
||||
const rpc = initRpc()
|
||||
rpc.getNewAddress((err, result) => {
|
||||
if (err) return reject(err)
|
||||
resolve(result.result)
|
||||
return checkCryptoCode(info.cryptoCode)
|
||||
.then(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const rpc = initRpc()
|
||||
rpc.getNewAddress((err, result) => {
|
||||
if (err) return reject(err)
|
||||
resolve(result.result)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -106,17 +115,23 @@ function addressBalance (address, confs) {
|
|||
.then(r => BN(r.result).shift(SATOSHI_SHIFT).round())
|
||||
}
|
||||
|
||||
const confirmedBalance = address => addressBalance(address, 1)
|
||||
const pendingBalance = address => addressBalance(address, 0)
|
||||
function confirmedBalance (address, cryptoCode) {
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => addressBalance(address, 1))
|
||||
}
|
||||
|
||||
function pendingBalance (address, cryptoCode) {
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => addressBalance(address, 0))
|
||||
}
|
||||
|
||||
function getStatus (account, toAddress, requested, cryptoCode) {
|
||||
return Promise.resolve()
|
||||
.then(() => checkCryptoCode(cryptoCode))
|
||||
.then(() => confirmedBalance(toAddress))
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => confirmedBalance(toAddress, cryptoCode))
|
||||
.then(confirmed => {
|
||||
if (confirmed.gte(requested)) return {status: 'confirmed'}
|
||||
|
||||
return pendingBalance(toAddress)
|
||||
return pendingBalance(toAddress, cryptoCode)
|
||||
.then(pending => {
|
||||
if (pending.gte(requested)) return {status: 'authorized'}
|
||||
if (pending.gt(0)) return {status: 'insufficientFunds'}
|
||||
|
|
@ -125,10 +140,31 @@ function getStatus (account, toAddress, requested, cryptoCode) {
|
|||
})
|
||||
}
|
||||
|
||||
function newFunding (account, cryptoCode) {
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => {
|
||||
const promises = [
|
||||
accountBalance(account, cryptoCode, 0),
|
||||
accountBalance(account, cryptoCode, 1),
|
||||
newAddress(account, {cryptoCode})
|
||||
]
|
||||
|
||||
return Promise.all(promises)
|
||||
})
|
||||
.then(([fundingPendingBalance, fundingConfirmedBalance, fundingAddress]) => ({
|
||||
fundingPendingBalance,
|
||||
fundingConfirmedBalance,
|
||||
fundingAddress
|
||||
}))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
balance,
|
||||
pendingBalance,
|
||||
confirmedBalance,
|
||||
sendCoins,
|
||||
newAddress,
|
||||
getStatus
|
||||
getStatus,
|
||||
newFunding
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,10 +84,30 @@ function getStatus (account, toAddress, requested, cryptoCode) {
|
|||
})
|
||||
}
|
||||
|
||||
function newFunding (account, cryptoCode) {
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => {
|
||||
return getWallet(account)
|
||||
.then(wallet => {
|
||||
return wallet.createAddress()
|
||||
.then(result => {
|
||||
const fundingAddress = result.address
|
||||
return wallet.setLabel({address: fundingAddress, label: 'Funding Address'})
|
||||
.then(() => ({
|
||||
fundingPendingBalance: BN(wallet.wallet.balance),
|
||||
fundingConfirmedBalance: BN(wallet.wallet.confirmedBalance),
|
||||
fundingAddress
|
||||
}))
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
balance,
|
||||
sendCoins,
|
||||
newAddress,
|
||||
getStatus
|
||||
getStatus,
|
||||
newFunding
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ module.exports = {
|
|||
getStatus,
|
||||
sweep,
|
||||
defaultAddress,
|
||||
supportsHd: true
|
||||
supportsHd: true,
|
||||
newFunding
|
||||
}
|
||||
|
||||
if (!web3.isConnected()) {
|
||||
|
|
@ -36,13 +37,13 @@ function sendCoins (account, toAddress, cryptoAtoms, cryptoCode) {
|
|||
.then(pify(web3.eth.sendRawTransaction))
|
||||
}
|
||||
|
||||
function validateCrypto (cryptoCode) {
|
||||
function checkCryptoCode (cryptoCode) {
|
||||
if (cryptoCode === 'ETH') return Promise.resolve()
|
||||
return Promise.reject(new Error('cryptoCode must be ETH'))
|
||||
}
|
||||
|
||||
function balance (account, cryptoCode) {
|
||||
return validateCrypto(cryptoCode)
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => pendingBalance(defaultAddress(account)))
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +137,7 @@ function newAddress (account, info) {
|
|||
}
|
||||
|
||||
function getStatus (account, toAddress, cryptoAtoms, cryptoCode) {
|
||||
return validateCrypto(cryptoCode)
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => confirmedBalance(toAddress))
|
||||
.then(confirmed => {
|
||||
if (confirmed.gte(cryptoAtoms)) return {status: 'confirmed'}
|
||||
|
|
@ -164,3 +165,22 @@ function defaultHdNode (account) {
|
|||
const key = hdkey.fromMasterSeed(masterSeed)
|
||||
return key.derivePath(defaultPrefixPath)
|
||||
}
|
||||
|
||||
function newFunding (account, cryptoCode) {
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => {
|
||||
const fundingAddress = defaultAddress(account)
|
||||
|
||||
const promises = [
|
||||
pendingBalance(fundingAddress),
|
||||
confirmedBalance(fundingAddress)
|
||||
]
|
||||
|
||||
return Promise.all(promises)
|
||||
.then(([fundingPendingBalance, fundingConfirmedBalance]) => ({
|
||||
fundingPendingBalance,
|
||||
fundingConfirmedBalance,
|
||||
fundingAddress
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,24 @@ function balance (account, cryptoCode) {
|
|||
})
|
||||
}
|
||||
|
||||
function pendingBalance (account, cryptoCode) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
if (cryptoCode === 'BTC') return BN(1e8 * 10.1)
|
||||
if (cryptoCode === 'ETH') return BN(1e18 * 10.1)
|
||||
throw new Error('Unsupported crypto: ' + cryptoCode)
|
||||
})
|
||||
}
|
||||
|
||||
function confirmedBalance (account, cryptoCode) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
if (cryptoCode === 'BTC') return BN(1e8 * 10)
|
||||
if (cryptoCode === 'ETH') return BN(1e18 * 10)
|
||||
throw new Error('Unsupported crypto: ' + cryptoCode)
|
||||
})
|
||||
}
|
||||
|
||||
// Note: This makes it easier to test insufficient funds errors
|
||||
let sendCount = 0
|
||||
|
||||
|
|
@ -50,6 +68,21 @@ function newAddress () {
|
|||
return Promise.resolve('<Fake address, don\'t send>')
|
||||
}
|
||||
|
||||
function newFunding (account, cryptoCode) {
|
||||
const promises = [
|
||||
pendingBalance(account, cryptoCode),
|
||||
confirmedBalance(account, cryptoCode),
|
||||
newAddress(account, {cryptoCode})
|
||||
]
|
||||
|
||||
return Promise.all(promises)
|
||||
.then(([fundingPendingBalance, fundingConfirmedBalance, fundingAddress]) => ({
|
||||
fundingPendingBalance,
|
||||
fundingConfirmedBalance,
|
||||
fundingAddress
|
||||
}))
|
||||
}
|
||||
|
||||
function getStatus (account, toAddress, cryptoAtoms, cryptoCode) {
|
||||
const elapsed = Date.now() - t0
|
||||
|
||||
|
|
@ -66,5 +99,6 @@ module.exports = {
|
|||
balance,
|
||||
sendCoins,
|
||||
newAddress,
|
||||
getStatus
|
||||
getStatus,
|
||||
newFunding
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,16 @@ function newAddress (settings, info) {
|
|||
.then(r => r.wallet.newAddress(r.account, info))
|
||||
}
|
||||
|
||||
function newFunding (settings, cryptoCode, address) {
|
||||
return fetchWallet(settings, cryptoCode)
|
||||
.then(r => {
|
||||
const wallet = r.wallet
|
||||
const account = r.account
|
||||
|
||||
return wallet.newFunding(account, cryptoCode)
|
||||
})
|
||||
}
|
||||
|
||||
function getWalletStatus (settings, tx) {
|
||||
return fetchWallet(settings, tx.cryptoCode)
|
||||
.then(r => r.wallet.getStatus(r.account, tx.toAddress, tx.cryptoAtoms, tx.cryptoCode))
|
||||
|
|
@ -135,5 +145,6 @@ module.exports = {
|
|||
newAddress,
|
||||
getStatus,
|
||||
sweep,
|
||||
isHd
|
||||
isHd,
|
||||
newFunding
|
||||
}
|
||||
|
|
|
|||
139
package-lock.json
generated
139
package-lock.json
generated
|
|
@ -479,6 +479,11 @@
|
|||
"integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=",
|
||||
"dev": true
|
||||
},
|
||||
"bignumber.js": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.0.2.tgz",
|
||||
"integrity": "sha1-LR3DfuWWiGfs6pC22k0W5oYI0h0="
|
||||
},
|
||||
"binary-extensions": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.8.0.tgz",
|
||||
|
|
@ -595,12 +600,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"capture-stack-trace": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz",
|
||||
"integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
|
||||
|
|
@ -709,18 +708,6 @@
|
|||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
|
||||
"dev": true
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "1.9.0",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz",
|
||||
"integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=",
|
||||
"dev": true
|
||||
},
|
||||
"color-name": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.2.tgz",
|
||||
"integrity": "sha1-XIq3K2S9IhXWF66VWeuxSEdc+Y0=",
|
||||
"dev": true
|
||||
},
|
||||
"common-path-prefix": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-1.0.0.tgz",
|
||||
|
|
@ -775,12 +762,6 @@
|
|||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||
"dev": true
|
||||
},
|
||||
"create-error-class": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz",
|
||||
"integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=",
|
||||
"dev": true
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz",
|
||||
|
|
@ -795,20 +776,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"cross-spawn-async": {
|
||||
"version": "2.2.5",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn-async/-/cross-spawn-async-2.2.5.tgz",
|
||||
"integrity": "sha1-hF/wwINKPe2dFg2sptOQkGuyiMw=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"lru-cache": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.0.tgz",
|
||||
"integrity": "sha512-aHGs865JXz6bkB4AHL+3AhyvTFKL3iZamKVWjIUKnXOXyasJvqPK8WAjOnAQKQZVpeXDVz19u1DD0r/12bWAdQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"crypto-random-string": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz",
|
||||
|
|
@ -875,12 +842,6 @@
|
|||
"integrity": "sha1-qEk/C3te7sglJbXHWH+n3nyoWcE=",
|
||||
"dev": true
|
||||
},
|
||||
"duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
|
||||
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
|
||||
"dev": true
|
||||
},
|
||||
"empower-core": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/empower-core/-/empower-core-0.6.2.tgz",
|
||||
|
|
@ -1015,12 +976,6 @@
|
|||
"integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=",
|
||||
"dev": true
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"fsevents": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.1.tgz",
|
||||
|
|
@ -1784,12 +1739,6 @@
|
|||
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
|
||||
"dev": true
|
||||
},
|
||||
"has-color": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz",
|
||||
"integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=",
|
||||
"dev": true
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
|
||||
|
|
@ -1852,12 +1801,6 @@
|
|||
"integrity": "sha1-CP9DNGAziDmbMp5rlTjcejz13n0=",
|
||||
"dev": true
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
||||
|
|
@ -2014,18 +1957,6 @@
|
|||
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=",
|
||||
"dev": true
|
||||
},
|
||||
"is-redirect": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz",
|
||||
"integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=",
|
||||
"dev": true
|
||||
},
|
||||
"is-retry-allowed": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz",
|
||||
"integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=",
|
||||
"dev": true
|
||||
},
|
||||
"is-stream": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
|
||||
|
|
@ -2246,12 +2177,6 @@
|
|||
"integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=",
|
||||
"dev": true
|
||||
},
|
||||
"lowercase-keys": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz",
|
||||
"integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=",
|
||||
"dev": true
|
||||
},
|
||||
"make-dir": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.0.0.tgz",
|
||||
|
|
@ -2459,12 +2384,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true
|
||||
},
|
||||
"onetime": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
|
||||
|
|
@ -2557,12 +2476,6 @@
|
|||
"integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
|
||||
"dev": true
|
||||
},
|
||||
"parse-ms": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-1.0.1.tgz",
|
||||
"integrity": "sha1-VjRtR0nXjyNDDKDHE4UK75GqNh0=",
|
||||
"dev": true
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||
|
|
@ -2639,12 +2552,6 @@
|
|||
"integrity": "sha1-dIJFLBoPUI4+NE6uwxLJHCncZVo=",
|
||||
"dev": true
|
||||
},
|
||||
"prepend-http": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz",
|
||||
"integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=",
|
||||
"dev": true
|
||||
},
|
||||
"preserve": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz",
|
||||
|
|
@ -2677,12 +2584,6 @@
|
|||
"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
|
||||
"dev": true
|
||||
},
|
||||
"pseudomap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
|
||||
"dev": true
|
||||
},
|
||||
"randomatic": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz",
|
||||
|
|
@ -2961,12 +2862,6 @@
|
|||
"integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=",
|
||||
"dev": true
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
||||
"dev": true
|
||||
},
|
||||
"stack-utils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-1.0.1.tgz",
|
||||
|
|
@ -3125,12 +3020,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"timed-out": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
|
||||
"integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=",
|
||||
"dev": true
|
||||
},
|
||||
"to-fast-properties": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
|
||||
|
|
@ -3173,12 +3062,6 @@
|
|||
"integrity": "sha1-G1g3z5DAc22IYncytmHBOPht5y8=",
|
||||
"dev": true
|
||||
},
|
||||
"url-parse-lax": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz",
|
||||
"integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=",
|
||||
"dev": true
|
||||
},
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
|
|
@ -3203,12 +3086,6 @@
|
|||
"integrity": "sha1-DAnIXCqUaD0Nfq+O4JfVZL8OEFw=",
|
||||
"dev": true
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
},
|
||||
"write-file-atomic": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.1.0.tgz",
|
||||
|
|
@ -3252,12 +3129,6 @@
|
|||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
|
||||
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=",
|
||||
"dev": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
|
||||
"integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
"@fczbkk/uuid4": "^3.0.0",
|
||||
"axios": "^0.16.1",
|
||||
"base-x": "^3.0.2",
|
||||
"bignumber.js": "^4.0.1",
|
||||
"bignumber.js": "^4.0.2",
|
||||
"bip39": "^2.3.1",
|
||||
"bitcoind-rpc": "^0.7.0",
|
||||
"bitgo": "^3.3.6",
|
||||
|
|
|
|||
583
public/elm.js
583
public/elm.js
File diff suppressed because one or more lines are too long
|
|
@ -117,36 +117,57 @@ p {
|
|||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.lamassuAdminContainer {
|
||||
padding: 30px;
|
||||
background-color: #f6f6f4;
|
||||
border-radius: 0px 5px 5px 5px;
|
||||
width: 30em;
|
||||
}
|
||||
|
||||
.lamassuAdminCryptoAddress {
|
||||
font-family: Inconsolata, monospace;
|
||||
}
|
||||
|
||||
.lamassuAdminBalanceSection {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.lamassuAdminBalanceSection h2 {
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 0.2em;
|
||||
}
|
||||
|
||||
.lamassuAdminCryptoTabs {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.lamassuAdminCryptoTabs > div {
|
||||
.lamassuAdminCryptoTabs > .lamassuAdminCryptoTab {
|
||||
padding: 10px 15px;
|
||||
color: #5f5f56;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
background-color: #E6E6E3;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.lamassuAdminCryptoTabs > div:hover {
|
||||
.lamassuAdminCryptoTabs > .lamassuAdminCryptoTab:hover {
|
||||
background-color: #fcfcfa;
|
||||
}
|
||||
|
||||
.lamassuAdminCryptoTabs > div:active {
|
||||
.lamassuAdminCryptoTabs > .lamassuAdminCryptoTab:active {
|
||||
color: #5f5f56;
|
||||
}
|
||||
|
||||
.lamassuAdminCryptoTabs > div.lamassuAdminActive {
|
||||
.lamassuAdminCryptoTabs > .lamassuAdminCryptoTab.lamassuAdminActive {
|
||||
color: #5f5f56;
|
||||
background-color: #f6f6f4;
|
||||
}
|
||||
|
||||
.lamassuAdminCryptoTabs > div:first-child {
|
||||
.lamassuAdminCryptoTabs > .lamassuAdminCryptoTab:first-child {
|
||||
border-radius: 5px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.lamassuAdminCryptoTabs > div:last-child {
|
||||
.lamassuAdminCryptoTabs > .lamassuAdminCryptoTab:last-child {
|
||||
border-radius: 0px 5px 0px 0px;
|
||||
}
|
||||
|
||||
|
|
|
|||
24
yarn.lock
24
yarn.lock
|
|
@ -916,7 +916,7 @@ bignumber.js@^2.0.3, "bignumber.js@git+https://github.com/debris/bignumber.js.gi
|
|||
version "2.0.7"
|
||||
resolved "git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2"
|
||||
|
||||
bignumber.js@^4.0.0, bignumber.js@^4.0.1, bignumber.js@~4.0.2:
|
||||
bignumber.js@^4.0.0, bignumber.js@^4.0.2, bignumber.js@~4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-4.0.2.tgz#2d1dc37ee5968867ecea90b6da4d16e68608d21d"
|
||||
|
||||
|
|
@ -2004,9 +2004,9 @@ ethereumjs-tx@^1.3.0:
|
|||
ethereum-common "^0.0.18"
|
||||
ethereumjs-util "^5.0.0"
|
||||
|
||||
ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz#3e9428b317eebda3d7260d854fddda954b1f1bc6"
|
||||
ethereumjs-util@^4.3.0, ethereumjs-util@^4.4.0, ethereumjs-util@~4.4.1:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.4.1.tgz#6316bfbc8a01c8767a78620928ed79ef424c3f92"
|
||||
dependencies:
|
||||
bn.js "^4.8.0"
|
||||
create-hash "^1.1.2"
|
||||
|
|
@ -2027,16 +2027,6 @@ ethereumjs-util@^5.0.0:
|
|||
rlp "^2.0.0"
|
||||
secp256k1 "^3.0.1"
|
||||
|
||||
ethereumjs-util@~4.4.1:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-4.4.1.tgz#6316bfbc8a01c8767a78620928ed79ef424c3f92"
|
||||
dependencies:
|
||||
bn.js "^4.8.0"
|
||||
create-hash "^1.1.2"
|
||||
keccakjs "^0.2.0"
|
||||
rlp "^2.0.0"
|
||||
secp256k1 "^3.0.1"
|
||||
|
||||
ethereumjs-wallet@^0.6.0:
|
||||
version "0.6.0"
|
||||
resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb"
|
||||
|
|
@ -2277,11 +2267,7 @@ form-data@^2.1.1, form-data@~2.1.1:
|
|||
combined-stream "^1.0.5"
|
||||
mime-types "^2.1.12"
|
||||
|
||||
formidable@^1.0.17:
|
||||
version "1.0.17"
|
||||
resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.0.17.tgz#ef5491490f9433b705faa77249c99029ae348559"
|
||||
|
||||
formidable@^1.1.1:
|
||||
formidable@^1.0.17, formidable@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.1.1.tgz#96b8886f7c3c3508b932d6bd70c4d3a88f35f1a9"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue