add support for funding

This commit is contained in:
Josh Harvey 2017-06-17 01:38:51 +03:00
parent 8440fa3b1d
commit bf0dc3f7f3
15 changed files with 731 additions and 356 deletions

19
lib/coin-utils.js Normal file
View 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}`)
}
}