Skip to content

Commit

Permalink
IOS-7999 [Staking] Fix tron fee display (#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
fedorov-d authored Sep 18, 2024
1 parent 6a97624 commit a2f7222
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion BlockchainSdk/Blockchains/Tron/TronNetworkModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct TronGetAccountResponse: Decodable {
struct TronGetAccountResourceResponse: Decodable {
let freeNetUsed: Int?
let freeNetLimit: Int
let energyLimit: Decimal
let energyLimit: Decimal?
let energyUsed: Decimal?

enum CodingKeys: String, CodingKey {
Expand Down
2 changes: 1 addition & 1 deletion BlockchainSdk/Blockchains/Tron/TronWalletManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class TronWalletManager: BaseManager, WalletManager {
consumedBandwidthFee = transactionSizeFee * sunPerBandwidthPoint
}

let remainingEnergy = resources.energyLimit - (resources.energyUsed ?? 0)
let remainingEnergy = (resources.energyLimit ?? .zero) - (resources.energyUsed ?? .zero)
let consumedEnergyFee = max(
.zero,
Decimal(energyFeeParameters.energyFee) - remainingEnergy
Expand Down

0 comments on commit a2f7222

Please sign in to comment.