Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ttios #885

Closed
wants to merge 3 commits into from
Closed

Ttios #885

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@ extension APIRequest {
public static func send(uRLRequest: URLRequest, with session: URLSession) async throws -> Data {
let (data, response) = try await session.data(for: uRLRequest)

guard 200 ..< 400 ~= response.statusCode else {
if 400 ..< 500 ~= response.statusCode {
throw Web3Error.clientError(code: response.statusCode)
guard let httpResponse = response as? HTTPURLResponse else {
throw Web3Error.unknownError
}

guard 200 ..< 400 ~= httpResponse.statusCode else {
if 400 ..< 500 ~= httpResponse.statusCode {
throw Web3Error.clientError(code: httpResponse.statusCode)
} else {
throw Web3Error.serverError(code: response.statusCode)
throw Web3Error.serverError(code: httpResponse.statusCode)
}
}

Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions Sources/web3swift/Transaction/TransactionPollingTask.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import Web3Core
final public class TransactionPollingTask {

private enum DelayUnit: UInt64 {
case shortest = 1
case medium = 5
case longest = 60
case shortest = 1_500_000_000
case medium = 2_500_000_000
case longest = 9_000_000_000

func shouldIncreaseDelay(_ startTime: Date) -> Bool {
let timePassed = Date().timeIntervalSince1970 - startTime.timeIntervalSince1970
Expand Down