Skip to content

Commit 84f1ed0

Browse files
fix: bytes(length: ...) ABI type encoding fixed
1 parent 295e137 commit 84f1ed0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Sources/web3swift/Utils/EIP/EIP681.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ extension Web3 {
107107
if let ethAddress = EthereumAddress(string) {
108108
return ethAddress.address
109109
}
110-
if let url = URL(string: string) {
110+
if URL(string: string) != nil {
111111
return string
112112
}
113113
}
@@ -163,7 +163,7 @@ extension Web3 {
163163
return Data(bytes).toHexString().addHexPrefix()
164164
} else if let string = rawValue as? String {
165165
if let bytes = Data.fromHex(string) {
166-
return string.addHexPrefix()
166+
return bytes.toHexString().addHexPrefix()
167167
}
168168
return string.data(using: .utf8)?.toHexString().addHexPrefix()
169169
}
@@ -177,8 +177,9 @@ extension Web3 {
177177
} else if let string = rawValue as? String {
178178
if let bytes = Data.fromHex(string) {
179179
data = bytes
180+
} else {
181+
data = string.data(using: .utf8)
180182
}
181-
data = string.data(using: .utf8)
182183
}
183184

184185
if let data = data,

0 commit comments

Comments
 (0)