Skip to content

Commit

Permalink
add fix for non fee empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Nov 6, 2023
1 parent 5c70196 commit b3d4962
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,24 @@ fun Abci.TxResponse.getSuccessTotalBaseFee(msgFeeClient: MsgFeeGrpcClient, heigh
this.eventsList
.firstOrNull { it.type == "tx" && it.attributesList.map { attr -> attr.key.toStringUtf8() }.contains("basefee") }
?.attributesList?.first { it.key.toStringUtf8() == "basefee" }
?.value?.toStringUtf8()?.denomAmountToPair()?.first?.toBigDecimal()
?.value?.toStringUtf8()?.denomAmountToPair()?.first?.let {
try {
it.toBigDecimal()
} catch (e: NumberFormatException) {
return BigDecimal.ZERO
}
}
?: (
this.eventsList
.firstOrNull { it.type == "tx" && it.attributesList.map { attr -> attr.key.toStringUtf8() }.contains("fee") }
?.attributesList?.first { it.key.toStringUtf8() == "fee" }
?.value?.toStringUtf8()?.denomAmountToPair()?.first?.toBigDecimal()
?.value?.toStringUtf8()?.denomAmountToPair()?.first?.let {
try {
it.toBigDecimal()
} catch (e: NumberFormatException) {
return BigDecimal.ZERO
}
}
?: this.getFeeTotalPaid()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class AsyncCachingV2(
val txUpdate = TxUpdate(tx)
val txInfo = TxData(proposerRec.blockHeight, null, res.txResponse.txhash, blockTime)
saveMessages(txInfo, res, txUpdate)
// saveTxFees(res, txInfo, txUpdate, proposerRec)
saveTxFees(res, txInfo, txUpdate, proposerRec)
val addrs = saveAddresses(txInfo, res, txUpdate)
val markers = saveMarkers(txInfo, res, txUpdate)
saveNftData(txInfo, res, txUpdate)
Expand Down

0 comments on commit b3d4962

Please sign in to comment.