Skip to content

Commit 2d21538

Browse files
chore: added some TODOs on replacing this code using JSONDecoder with RawRepresentable
1 parent 4a37b0c commit 2d21538

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/web3swift/Utils/EIP/EIP681.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ extension Web3 {
461461
/// Dropping first and last square brackets.
462462
/// That modifies the upper bound value of the first match of `squareBracketRegex`.
463463
let rawValue = String(rawValue.dropFirst().dropLast())
464-
464+
465+
// TODO: try replacing this manual parsing with JSONDecoder and RawRepresentable
466+
465467
let squareBracketRegex = try! NSRegularExpression(pattern: "(\\[*)")
466468
let match = squareBracketRegex.firstMatch(in: rawValue, range: rawValue.fullNSRange)
467469

@@ -504,7 +506,9 @@ extension Web3 {
504506
private static func splitArrayOfStrings(_ rawValue: String) -> [String]? {
505507
/// Dropping first and last square brackets to exclude them from the first and the last separated element.
506508
let rawValue = String(rawValue.dropFirst().dropLast())
507-
509+
510+
// TODO: try replacing this manual parsing with JSONDecoder and RawRepresentable
511+
508512
let elementsBoundary = try! NSRegularExpression(pattern: "\",\"")
509513
var indices = Array(elementsBoundary
510514
.matches(in: rawValue, range: rawValue.fullNSRange)

0 commit comments

Comments
 (0)