From f8ee5eda0e11c6ecce049be55041315c05994344 Mon Sep 17 00:00:00 2001 From: Michal Zielenkiewicz Date: Wed, 30 Oct 2024 09:48:18 +0100 Subject: [PATCH] Patch staking.ReclaimEscrow method --- src/vendors/nexus.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/vendors/nexus.ts b/src/vendors/nexus.ts index 20e1fab604..35aa699602 100644 --- a/src/vendors/nexus.ts +++ b/src/vendors/nexus.ts @@ -11,6 +11,7 @@ import { ConsensusTxMethod, Runtime, RuntimeTransaction, + ConsensusEventType, } from 'vendors/nexus/index' import { Account } from 'app/state/account/types' import { Transaction, TransactionStatus, TransactionType } from 'app/state/transaction/types' @@ -159,6 +160,26 @@ export function getNexusAPIs(url: string | 'https://nexus.oasis.io/v1/') { extendedEmeraldResponse, ) + // Temporary workaround for missing amount in staking.ReclaimEscrow + await Promise.all( + mergedTransactions.map(async transaction => { + if (transaction.method === ConsensusTxMethod.StakingReclaimEscrow) { + const eventsResponse = await api.consensusEventsGet({ + limit: 1, + txHash: transaction.hash, + type: ConsensusEventType.StakingEscrowDebondingStart, + }) + const amount = (eventsResponse.events[0].body as { amount?: number })?.amount + if (transaction.body) { + ;(transaction.body as { amount?: typeof amount }).amount = amount + } + return transaction + } + + return transaction + }), + ) + const list = await Promise.all( mergedTransactions.map(async tx => { if ('round' in tx) {