@@ -90,14 +90,19 @@ public struct TransactionHistoryRecord: Decodable {
90
90
hash = hashData
91
91
let intBlock = try container. decode ( UInt64 . self, forKey: CodingKeys . block)
92
92
block = BigUInt . init ( integerLiteral: intBlock)
93
- let stringAddressFrom = try container. decode ( String . self, forKey: CodingKeys . addressFrom)
94
- guard let nativeAddressFrom = EthereumAddress ( stringAddressFrom, type: . normal, ignoreChecksum: true ) else {
93
+ var stringAddressFrom = try container. decode ( String . self, forKey: CodingKeys . addressFrom)
94
+ if !stringAddressFrom. hasHexPrefix ( ) {
95
+ stringAddressFrom = stringAddressFrom. addHexPrefix ( )
96
+ }
97
+ guard let nativeAddressFrom = EthereumAddress ( stringAddressFrom) else {
95
98
throw Web3Error . transactionSerializationError
96
99
}
97
100
addressFrom = nativeAddressFrom
98
- let stringAddressTo = try container. decode ( String . self, forKey: CodingKeys . addressTo)
99
-
100
- guard let nativeAddressTo = EthereumAddress ( stringAddressTo, type: . normal, ignoreChecksum: true ) else {
101
+ var stringAddressTo = try container. decode ( String . self, forKey: CodingKeys . addressTo)
102
+ if !stringAddressTo. hasHexPrefix ( ) {
103
+ stringAddressTo = stringAddressTo. addHexPrefix ( )
104
+ }
105
+ guard let nativeAddressTo = EthereumAddress ( stringAddressTo) else {
101
106
throw Web3Error . transactionSerializationError
102
107
}
103
108
addressTo = nativeAddressTo
0 commit comments