Fix: broken wildcard ENS ENSIP-10 offchain resolution

pull/6912/head
Hwee-Boon Yar 1 year ago
parent c68c777ab4
commit 56f43edd12
  1. 14
      modules/AlphaWalletWeb3/AlphaWalletWeb3/Promises/Promise+Batching.swift
  2. 6
      modules/AlphaWalletWeb3/AlphaWalletWeb3/Web3/Web3+HttpProvider.swift

@ -60,7 +60,7 @@ public class JSONRPCrequestDispatcher {
guard request.id != nil else {
return provider.sendAsync(request, queue: queue)
}
do {
let batch = try getBatch()
return try batch.add(request, maxWaitTime: MAX_WAIT_TIME)
@ -139,18 +139,6 @@ extension JSONRPCrequestDispatcher: BatchDelegate {
provider
.sendAsync(requestsBatch, queue: queue)
.done(on: queue, { [weak batches] batchResponse in
if let error = batchResponse.responses.last?.error, batchResponse.responses.count == 1 {
guard let keys = batch.promises.keys() else { return }
for key in keys {
guard let value = batch.promises[key] else { continue }
value.seal.reject(Web3Error.nodeError(error.message))
}
batches?.removeAll(batch)
return
}
for response in batchResponse.responses {
guard let id = response.id else { continue }
guard let value = batch.promises[UInt64(id)] else {

@ -97,9 +97,6 @@ public class Web3HttpProvider: Web3RequestProvider {
case .success(let data):
do {
let parsedResponse = try JSONDecoder().decode(JSONRPCresponse.self, from: data)
if let message = parsedResponse.error {
throw Web3Error.nodeError("Received an error message from node\n" + String(describing: message))
}
return parsedResponse
} catch {
throw Web3Error.responseError(error)
@ -121,9 +118,6 @@ public class Web3HttpProvider: Web3RequestProvider {
} catch {
do {
let parsedResponse = try JSONDecoder().decode(JSONRPCresponse.self, from: data)
if let message = parsedResponse.error {
throw Web3Error.nodeError(message.message)
}
return JSONRPCresponseBatch(responses: [parsedResponse])
} catch {
throw Web3Error.responseError(error)

Loading…
Cancel
Save