File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Sources/web3swift/Utils/EIP Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,12 @@ extension Web3 {
238
238
return await parse ( string)
239
239
}
240
240
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.
241
247
public static func parse( _ string: String ) async -> EIP681Code ? {
242
248
guard string. hasPrefix ( " ethereum: " ) else { return nil }
243
249
let striped = string. components ( separatedBy: " ethereum: " )
@@ -366,7 +372,7 @@ extension Web3 {
366
372
let address = try await ensModel? . getAddress ( forNode: ens)
367
373
nativeValue = address
368
374
} catch {
369
- NSLog ( error. localizedDescription)
375
+ NSLog ( " Failed to resolve ENS address (parameter nr \( inputNumber ) ). Error: \( error. localizedDescription) " )
370
376
return nil
371
377
}
372
378
}
You can’t perform that action at this time.
0 commit comments