feat: wallet plugin structure
This commit is contained in:
parent
4697c89064
commit
fa0838b303
4 changed files with 70 additions and 8 deletions
|
|
@ -177,11 +177,11 @@ function fetchData () {
|
||||||
languages: languages,
|
languages: languages,
|
||||||
countries,
|
countries,
|
||||||
accounts: [
|
accounts: [
|
||||||
{ code: 'bitpay', display: 'Bitpay', class: 'ticker', cryptos: ['BTC', 'BCH'] },
|
{ code: 'bitpay', display: 'Bitpay', class: 'ticker', cryptos: ['BTC', 'BCH', 'LN'] },
|
||||||
{ code: 'kraken', display: 'Kraken', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH'] },
|
{ code: 'kraken', display: 'Kraken', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH', 'LN'] },
|
||||||
{ code: 'bitstamp', display: 'Bitstamp', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH'] },
|
{ code: 'bitstamp', display: 'Bitstamp', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'LN'] },
|
||||||
{ code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC', 'DASH'] },
|
{ code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'ZEC', 'DASH', 'LN'] },
|
||||||
{ code: 'itbit', display: 'itBit', class: 'ticker', cryptos: ['BTC', 'ETH'] },
|
{ code: 'itbit', display: 'itBit', class: 'ticker', cryptos: ['BTC', 'ETH', 'LN'] },
|
||||||
{ code: 'mock-ticker', display: 'Mock (Caution!)', class: 'ticker', cryptos: ALL_CRYPTOS },
|
{ code: 'mock-ticker', display: 'Mock (Caution!)', class: 'ticker', cryptos: ALL_CRYPTOS },
|
||||||
{ code: 'bitcoind', display: 'bitcoind', class: 'wallet', cryptos: ['BTC'] },
|
{ code: 'bitcoind', display: 'bitcoind', class: 'wallet', cryptos: ['BTC'] },
|
||||||
{ code: 'no-layer2', display: 'No Layer 2', class: 'layer2', cryptos: ALL_CRYPTOS },
|
{ code: 'no-layer2', display: 'No Layer 2', class: 'layer2', cryptos: ALL_CRYPTOS },
|
||||||
|
|
@ -192,9 +192,10 @@ function fetchData () {
|
||||||
{ code: 'dashd', display: 'dashd', class: 'wallet', cryptos: ['DASH'] },
|
{ code: 'dashd', display: 'dashd', class: 'wallet', cryptos: ['DASH'] },
|
||||||
{ 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: 'bitstamp', display: 'Bitstamp', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'BCH'] },
|
{ code: 'galoy', display: 'Galoy', class: 'wallet', cryptos: ['LN'] },
|
||||||
{ code: 'itbit', display: 'itBit', class: 'exchange', cryptos: ['BTC', 'ETH'] },
|
{ code: 'bitstamp', display: 'Bitstamp', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'BCH', 'LN'] },
|
||||||
{ code: 'kraken', display: 'Kraken', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH'] },
|
{ code: 'itbit', display: 'itBit', class: 'exchange', cryptos: ['BTC', 'ETH', 'LN'] },
|
||||||
|
{ code: 'kraken', display: 'Kraken', class: 'exchange', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC', 'BCH', 'LN'] },
|
||||||
{ code: 'mock-wallet', display: 'Mock (Caution!)', class: 'wallet', cryptos: ALL_CRYPTOS },
|
{ code: 'mock-wallet', display: 'Mock (Caution!)', class: 'wallet', cryptos: ALL_CRYPTOS },
|
||||||
{ code: 'no-exchange', display: 'No exchange', class: 'exchange', cryptos: ALL_CRYPTOS },
|
{ code: 'no-exchange', display: 'No exchange', class: 'exchange', cryptos: ALL_CRYPTOS },
|
||||||
{ code: 'mock-exchange', display: 'Mock exchange', class: 'exchange', cryptos: ALL_CRYPTOS },
|
{ code: 'mock-exchange', display: 'Mock exchange', class: 'exchange', cryptos: ALL_CRYPTOS },
|
||||||
|
|
|
||||||
61
lib/plugins/wallet/lightning/galoy.js
Normal file
61
lib/plugins/wallet/lightning/galoy.js
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
const BN = require('../../../bn')
|
||||||
|
|
||||||
|
const NAME = 'LN'
|
||||||
|
const SUPPORTED_COINS = ['BTC']
|
||||||
|
|
||||||
|
function checkCryptoCode (cryptoCode) {
|
||||||
|
if (!SUPPORTED_COINS.includes(cryptoCode)) {
|
||||||
|
return Promise.reject(new Error('Unsupported crypto: ' + cryptoCode))
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWallet () {
|
||||||
|
// Create wallet instance
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendCoins (account, tx, settings, operatorId) {
|
||||||
|
// const { toAddress, cryptoAtoms, cryptoCode } = tx
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
function balance (account, cryptoCode, settings, operatorId) {
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
.then(() => getWallet(account, cryptoCode))
|
||||||
|
.then(wallet => new BN(wallet._wallet.spendableBalanceString))
|
||||||
|
}
|
||||||
|
|
||||||
|
function newAddress (account, info, tx, settings, operatorId) {
|
||||||
|
return checkCryptoCode(info.cryptoCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStatus (account, tx, requested, settings, operatorId) {
|
||||||
|
const { cryptoCode } = tx
|
||||||
|
return checkCryptoCode(cryptoCode).then(() => {})
|
||||||
|
}
|
||||||
|
|
||||||
|
function newFunding (account, cryptoCode, settings, operatorId) {
|
||||||
|
return checkCryptoCode(cryptoCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue