add sendConfirmed

This commit is contained in:
Josh Harvey 2017-04-19 02:25:08 +03:00
parent 9495aa8424
commit d5aab9dfd0
5 changed files with 39 additions and 14 deletions

View file

@ -3,9 +3,9 @@ const BN = require('../../../bn')
const NAME = 'FakeWallet'
const SECONDS = 1000
const UNSEEN_TIME = 6 * SECONDS
const PUBLISH_TIME = 12 * SECONDS
const AUTHORIZE_TIME = 60 * SECONDS
const PUBLISH_TIME = 3 * SECONDS
const AUTHORIZE_TIME = 8 * SECONDS
const CONFIRM_TIME = 60 * SECONDS
let t0
@ -36,9 +36,9 @@ function newAddress () {
function getStatus (account, toAddress, cryptoAtoms, cryptoCode) {
const elapsed = Date.now() - t0
if (elapsed < UNSEEN_TIME) return Promise.resolve({status: 'notSeen'})
if (elapsed < PUBLISH_TIME) return Promise.resolve({status: 'published'})
if (elapsed < AUTHORIZE_TIME) return Promise.resolve({status: 'authorized'})
if (elapsed < PUBLISH_TIME) return Promise.resolve({status: 'notSeen'})
if (elapsed < AUTHORIZE_TIME) return Promise.resolve({status: 'published'})
if (elapsed < CONFIRM_TIME) return Promise.resolve({status: 'authorized'})
console.log('[%s] DEBUG: Mock wallet has confirmed transaction', cryptoCode)
return Promise.resolve({status: 'confirmed'})