From 4e81cd6d04146abb884afa63f352e21a11d59d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Vitor=20de=20Lima=20Matos?= Date: Wed, 24 Mar 2021 15:35:03 -0300 Subject: [PATCH] dapp: adapt dapp to new async udcWithdraw events --- raiden-dapp/src/services/raiden-service.ts | 8 ++++---- raiden-dapp/tests/unit/raiden-service.spec.ts | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/raiden-dapp/src/services/raiden-service.ts b/raiden-dapp/src/services/raiden-service.ts index e573d5142a..8889e8508a 100644 --- a/raiden-dapp/src/services/raiden-service.ts +++ b/raiden-dapp/src/services/raiden-service.ts @@ -217,12 +217,12 @@ export default class RaidenService { value.payload.reward, value.payload.txHash, ); - } else if (value.type === 'udc/withdrawn') { + } else if (value.type === 'udc/withdraw/success') { if (!value.payload.confirmed) { return; } await this.notifyWithdrawal(value.meta.amount, value.payload.withdrawal); - } else if (value.type === 'udc/withdraw/failure') { + } else if (value.type === 'udc/withdraw/plan/failure') { await this.notifyWithdrawalFailure( value.payload?.code, value.meta.amount, @@ -481,7 +481,7 @@ export default class RaidenService { } private async updatePlannedUserDepositWithdrawals(event: ObservedValueOf) { - if (event.type === 'udc/withdraw/success') { + if (event.type === 'udc/withdraw/plan/success') { if (event.payload.confirmed === false) { this.store.commit('userDepositContract/clearPlannedWithdrawal'); } else { @@ -493,7 +493,7 @@ export default class RaidenService { confirmed: event.payload.confirmed, }); } - } else if (event.type === 'udc/withdrawn' && event.payload.confirmed) { + } else if (event.type === 'udc/withdraw/success' && event.payload.confirmed) { this.store.commit('userDepositContract/clearPlannedWithdrawal'); } } diff --git a/raiden-dapp/tests/unit/raiden-service.spec.ts b/raiden-dapp/tests/unit/raiden-service.spec.ts index ca7d3941d9..6a068b0c27 100644 --- a/raiden-dapp/tests/unit/raiden-service.spec.ts +++ b/raiden-dapp/tests/unit/raiden-service.spec.ts @@ -731,7 +731,7 @@ describe('RaidenService', () => { await setupSDK(); subject.next({ - type: 'udc/withdrawn', + type: 'udc/withdraw/success', payload: { withdrawal: utils.parseEther('5'), confirmed: true, @@ -760,7 +760,7 @@ describe('RaidenService', () => { await setupSDK({ subkey: true }); subject.next({ - type: 'udc/withdrawn', + type: 'udc/withdraw/success', payload: { withdrawal: utils.parseEther('5'), confirmed: true, @@ -787,7 +787,7 @@ describe('RaidenService', () => { (raiden as any).events$ = subject; await setupSDK(); subject.next({ - type: 'udc/withdraw/failure', + type: 'udc/withdraw/plan/failure', payload: { code: 'UDC_PLAN_WITHDRAW_EXCEEDS_AVAILABLE', }, @@ -808,7 +808,7 @@ describe('RaidenService', () => { (raiden as any).events$ = subject; await setupSDK(); subject.next({ - type: 'udc/withdraw/failure', + type: 'udc/withdraw/plan/failure', payload: { code: -3200, message: 'gas', @@ -1060,7 +1060,7 @@ describe('RaidenService', () => { (raiden as any).events$ = subject; await setupSDK(); subject.next({ - type: 'udc/withdraw/success', + type: 'udc/withdraw/plan/success', payload: { block: 5, txHash: '0xTxHash', @@ -1084,7 +1084,7 @@ describe('RaidenService', () => { (raiden as any).events$ = subject; await setupSDK(); subject.next({ - type: 'udc/withdraw/success', + type: 'udc/withdraw/plan/success', payload: { block: 5, txHash: '0xTxHash', @@ -1105,7 +1105,7 @@ describe('RaidenService', () => { (raiden as any).events$ = subject; await setupSDK(); subject.next({ - type: 'udc/withdrawn', + type: 'udc/withdraw/success', payload: { confirmed: true, withdrawal: constants.One,