use on()
This commit is contained in:
parent
ad61133efe
commit
7ddf7c82f3
1 changed files with 12 additions and 12 deletions
|
|
@ -958,19 +958,19 @@ const sendPayment = async (to, amount, memo) => {
|
|||
let timeoutID
|
||||
|
||||
const invoice = await Promise.race([
|
||||
Utils.tryAndWait(
|
||||
gun =>
|
||||
gun
|
||||
new Promise(res => {
|
||||
require('../Mediator')
|
||||
.getGun()
|
||||
.user(to)
|
||||
.get(Key.ORDER_TO_RESPONSE)
|
||||
.get(orderID)
|
||||
.then()
|
||||
.then(v => {
|
||||
.on(inv => {
|
||||
if (typeof inv === 'string') {
|
||||
clearTimeout(timeoutID)
|
||||
return v
|
||||
res(inv)
|
||||
}
|
||||
})
|
||||
}),
|
||||
v => typeof v !== 'string'
|
||||
),
|
||||
new Promise((_, rej) => {
|
||||
setTimeout(() => {
|
||||
rej(new Error(ErrorCode.ORDER_NOT_ANSWERED_IN_TIME))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue