Skip to content

Commit be6c585

Browse files
chore: EIP681 docs + more descriptive log message
1 parent f6c1805 commit be6c585

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/web3swift/Utils/EIP/EIP681.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ extension Web3 {
238238
return await parse(string)
239239
}
240240

241+
// TODO: throws errors instead of returning `nil`
242+
/// Attempts to parse given string as EIP681 code.
243+
/// Note: that ENS addresses as paramteres will be attempted to be resolved into Ethereum addresses.
244+
/// Thus, make sure that given raw EIP681 code has chain ID set or default Ethereum Mainnet chan ID will be used instead.
245+
/// - Parameter string: raw, encoded EIP681 code.
246+
/// - Returns: parsed EIP681 code or `nil` is something has failed.
241247
public static func parse(_ string: String) async -> EIP681Code? {
242248
guard string.hasPrefix("ethereum:") else { return nil }
243249
let striped = string.components(separatedBy: "ethereum:")
@@ -366,7 +372,7 @@ extension Web3 {
366372
let address = try await ensModel?.getAddress(forNode: ens)
367373
nativeValue = address
368374
} catch {
369-
NSLog(error.localizedDescription)
375+
NSLog("Failed to resolve ENS address (parameter nr \(inputNumber)). Error: \(error.localizedDescription)")
370376
return nil
371377
}
372378
}

0 commit comments

Comments
 (0)