Skip to content

Commit

Permalink
Patch staking.ReclaimEscrow method
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Oct 30, 2024
1 parent c4c3a1f commit f8ee5ed
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/vendors/nexus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f8ee5ed

Please sign in to comment.