Skip to content

Commit 46a02f6

Browse files
fix: get chain_id with hex strip
1 parent d8cfafe commit 46a02f6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/web3swift/Web3/Web3+HttpProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class Web3HttpProvider: Web3Provider {
3737
let response: String = try await APIRequest.send(APIRequest.getNetwork.call, parameters: [], with: self).result
3838
let result: UInt
3939
if response.hasHexPrefix() {
40-
guard let num = BigUInt(response, radix: 16) else {
40+
guard let num = BigUInt(response.stripHexPrefix(), radix: 16) else {
4141
throw Web3Error.processingError(desc: "Get network succeeded but can't be parsed to a valid chain id.")
4242
}
4343
result = UInt(num)

0 commit comments

Comments
 (0)