Add layer2 address separately
This commit is contained in:
parent
d9aaf2437f
commit
d1712ce1ce
7 changed files with 85 additions and 31 deletions
|
|
@ -3,6 +3,8 @@ const ph = require('./plugin-helper')
|
|||
|
||||
function fetch (settings, cryptoCode) {
|
||||
const plugin = configManager.cryptoScoped(cryptoCode, settings.config).layer2
|
||||
if (plugin === 'no-layer2') return Promise.resolve()
|
||||
|
||||
const layer2 = ph.load(ph.LAYER2, plugin)
|
||||
const account = settings.accounts[plugin]
|
||||
|
||||
|
|
@ -11,12 +13,21 @@ function fetch (settings, cryptoCode) {
|
|||
|
||||
function newAddress (settings, info) {
|
||||
return fetch(settings, info.cryptoCode)
|
||||
.then(r => r.layer2.newAddress(r.account, info))
|
||||
.then(r => {
|
||||
if (!r) return
|
||||
return r.layer2.newAddress(r.account, info)
|
||||
})
|
||||
}
|
||||
|
||||
function getStatus (settings, tx) {
|
||||
const toAddress = tx.layer2Address
|
||||
if (!toAddress) return Promise.resolve({status: 'notSeen'})
|
||||
|
||||
return fetch(settings, tx.cryptoCode)
|
||||
.then(r => r.layer2.getStatus(r.account, tx.toAddress, tx.cryptoAtoms, tx.cryptoCode))
|
||||
.then(r => {
|
||||
if (!r) return {status: 'notSeen'}
|
||||
return r.layer2.getStatus(r.account, toAddress, tx.cryptoAtoms, tx.cryptoCode)
|
||||
})
|
||||
}
|
||||
|
||||
function cryptoNetwork (settings, cryptoCode) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue