Skip to content

Commit

Permalink
Add old style parsing address for tron in restore files
Browse files Browse the repository at this point in the history
  • Loading branch information
ant013 committed Apr 17, 2024
1 parent 514f609 commit bfe3867
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion UnstoppableWallet/UnstoppableWallet/Models/AccountType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,16 @@ extension AccountType {
case .evmAddress:
return (try? EvmKit.Address(hex: string)).map { AccountType.evmAddress(address: $0) }
case .tronAddress:
return (try? TronKit.Address(raw: Data(hex: string))).map { AccountType.tronAddress(address: $0) }
let hexData = Data(hex: string)

let address: TronKit.Address?
if !hexData.isEmpty { // android convention address
address = try? TronKit.Address(raw: hexData)
} else { // old ios style
address = try? TronKit.Address(address: string)
}

return address.map { AccountType.tronAddress(address: $0) }
case .tonAddress:
return AccountType.tonAddress(address: string)
case .cex:
Expand Down

0 comments on commit bfe3867

Please sign in to comment.