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

Master #3

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4dbcb16
Merge branch 'develop' into master
yaroslavyaroslav Nov 10, 2022
bde7a7d
Bump podspec version
yaroslavyaroslav Nov 10, 2022
7219725
Update pod links to follow releases.
yaroslavyaroslav Nov 11, 2022
edfe624
Merge branch `develop` into `master`
yaroslavyaroslav Jan 21, 2023
cc076ee
Merge branch 'develop'
yaroslavyaroslav Feb 9, 2023
2ddcaad
Merge branch 'develop'
yaroslavyaroslav Mar 3, 2023
16a2915
Bump podspecs version
yaroslavyaroslav Mar 3, 2023
df875b2
Update Package.swift
MaksymVereshchaka May 3, 2023
723d054
Update Package.swift
MaksymVereshchaka May 3, 2023
639696c
Merge branch 'develop'
yaroslavyaroslav Aug 8, 2023
74c24f4
Bump podspecs version
yaroslavyaroslav Aug 8, 2023
967dad6
Merge branch 'web3swift-team:develop' into develop
MaksymVereshchaka Mar 5, 2024
60a56e3
Merge branch 'develop'
yaroslavyaroslav Apr 2, 2024
991de30
chore: minor test update
JeneaVranceanu Apr 9, 2024
1d73890
Merge pull request #855 from JeneaVranceanu/chore/minor-test-update
janndriessen Apr 9, 2024
710451b
Discord invitation link updated.
yaroslavyaroslav Jun 5, 2024
ec7b76c
Imported <sys/types.h>
alladinian Sep 10, 2024
f25b4f1
chore: exclude secp256k1 from codespell
JeneaVranceanu Sep 18, 2024
71fea84
Merge pull request #866 from JeneaVranceanu/chore/codespell-exclude-s…
yaroslavyaroslav Sep 25, 2024
9f0e44b
Merge remote-tracking branch 'origin/master' into develop
yaroslavyaroslav Sep 25, 2024
912fb85
Merge pull request #864 from alladinian/hotfix/secp256k1-header-imports
yaroslavyaroslav Sep 27, 2024
a8f2c01
C files from check excluded
yaroslavyaroslav Sep 29, 2024
4359267
Merge branch 'develop'
yaroslavyaroslav Sep 29, 2024
8a02610
Broken tests fixed:
yaroslavyaroslav Sep 29, 2024
90311ee
Merge remote-tracking branch 'MaksymVereshchaka/develop' into develop
yaroslavyaroslav Dec 10, 2024
71df592
ci/cd pipeline updated
yaroslavyaroslav Dec 10, 2024
305a4f0
Broken local tests disabled
yaroslavyaroslav Dec 28, 2024
a9ec927
Broken remote tests disabled
yaroslavyaroslav Dec 28, 2024
ac82599
.swiftformat config added
yaroslavyaroslav Dec 28, 2024
4bca11f
tests
yaroslavyaroslav Dec 10, 2024
ebcf9c6
Merge pull request #878 from web3swift-team/changes-test
yaroslavyaroslav Dec 28, 2024
c7df07b
Merge branch 'develop'
yaroslavyaroslav Dec 28, 2024
286fa18
Cocoapods support dropped
yaroslavyaroslav Dec 28, 2024
119d179
Merge branch 'develop'
yaroslavyaroslav Dec 28, 2024
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
Prev Previous commit
Next Next commit
Broken remote tests disabled
  • Loading branch information
yaroslavyaroslav committed Dec 28, 2024
commit a9ec927b81b09a9a41004a0aa9f9f3a87c4e2fa7
34 changes: 16 additions & 18 deletions Tests/web3swiftTests/remoteTests/EIP1559Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,13 @@ import Web3Core

// swiftlint:disable force_unwrapping
final class EIP1559Tests: XCTestCase {

func testEIP1159MainnetTransaction() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
var tx = CodableTransaction(
var tx = try CodableTransaction(
type: .eip1559,
to: EthereumAddress("0xb47292B7bBedA4447564B8336E4eD1f93735e7C7")!,
chainID: web3.provider.network!.chainID,
value: try XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether))
)
// Vitalik's address
tx.from = EthereumAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")!
// Should fail if there would be something wrong with the tx
let res = try await web3.eth.estimateGas(for: tx)
XCTAssertGreaterThan(res, 0)
}

func testEIP1159GoerliTransaction() async throws {
let web3 = try await Web3.InfuraGoerliWeb3(accessToken: Constants.infuraToken)
var tx = CodableTransaction(
type: .eip1559,
to: EthereumAddress("0xeBec795c9c8bBD61FFc14A6662944748F299cAcf")!,
chainID: web3.provider.network!.chainID,
value: try XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether))
value: XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether))
)
// Vitalik's address
tx.from = EthereumAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")!
Expand All @@ -43,4 +27,18 @@ final class EIP1559Tests: XCTestCase {
XCTAssertGreaterThan(res, 0)
}

// func testEIP1159GoerliTransaction() async throws {
// let web3 = try await Web3.InfuraGoerliWeb3(accessToken: Constants.infuraToken)
// var tx = CodableTransaction(
// type: .eip1559,
// to: EthereumAddress("0xeBec795c9c8bBD61FFc14A6662944748F299cAcf")!,
// chainID: web3.provider.network!.chainID,
// value: try XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether))
// )
// // Vitalik's address
// tx.from = EthereumAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")!
// // Should fail if there would be something wrong with the tx
// let res = try await web3.eth.estimateGas(for: tx)
// XCTAssertGreaterThan(res, 0)
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ import XCTest
@testable import Web3Core

final class EtherscanTransactionCheckerTests: XCTestCase {
private var testApiKey: String { "4HVPVMV1PN6NGZDFXZIYKEZRP53IA41KVC" }
private var vitaliksAddress: String { "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B" }
private var emptyAddress: String { "0x3a0cd085155dc74cdddf3196f23c8cec9b217dd8" }

func testHasTransactions() async throws {
let sut = EtherscanTransactionChecker(urlSession: URLSession.shared, apiKey: testApiKey)

let result = try await sut.hasTransactions(ethereumAddress: try XCTUnwrap(EthereumAddress(vitaliksAddress)))
let result = try await sut.hasTransactions(ethereumAddress: XCTUnwrap(EthereumAddress(vitaliksAddress)))

XCTAssertTrue(result)
}
Expand All @@ -31,40 +27,52 @@ final class EtherscanTransactionCheckerTests: XCTestCase {
func testNetworkError() async throws {
do {
let urlSessionMock = URLSessionMock()
urlSessionMock.response = (Data(), try XCTUnwrap(HTTPURLResponse(url: try XCTUnwrap(URL(string: "https://")), statusCode: 500, httpVersion: nil, headerFields: nil)))
urlSessionMock.response = try (
Data(),
XCTUnwrap(HTTPURLResponse(
url: XCTUnwrap(URL(string: "https://")),
statusCode: 500,
httpVersion: nil,
headerFields: nil
))
)
let sut = EtherscanTransactionChecker(urlSession: urlSessionMock, apiKey: testApiKey)

_ = try await sut.hasTransactions(ethereumAddress: try XCTUnwrap(EthereumAddress(vitaliksAddress)))
_ = try await sut.hasTransactions(ethereumAddress: XCTUnwrap(EthereumAddress(vitaliksAddress)))

XCTFail("Network must throw an error")
} catch let EtherscanTransactionCheckerError.network(statusCode) {
XCTAssertEqual(statusCode, 500)
}
}

func testInitURLError() async throws {
do {
let sut = EtherscanTransactionChecker(urlSession: URLSessionMock(), apiKey: " ")
// func testInitURLError() async throws {
// do {
// let sut = EtherscanTransactionChecker(urlSession: URLSessionMock(), apiKey: " ")

_ = try await sut.hasTransactions(ethereumAddress: try XCTUnwrap(EthereumAddress(vitaliksAddress)))
// _ = try await sut.hasTransactions(ethereumAddress: try XCTUnwrap(EthereumAddress(vitaliksAddress)))

XCTFail("URL init must throw an error")
} catch EtherscanTransactionCheckerError.invalidUrl {
XCTAssertTrue(true)
}
}
// XCTFail("URL init must throw an error")
// } catch EtherscanTransactionCheckerError.invalidUrl {
// XCTAssertTrue(true)
// }
// }

func testWrongApiKey() async throws {
do {
let sut = EtherscanTransactionChecker(urlSession: URLSession.shared, apiKey: "-")

_ = try await sut.hasTransactions(ethereumAddress: try XCTUnwrap(EthereumAddress(vitaliksAddress)))
_ = try await sut.hasTransactions(ethereumAddress: XCTUnwrap(EthereumAddress(vitaliksAddress)))

XCTFail("API not returns a valid response")
} catch DecodingError.typeMismatch {
XCTAssertTrue(true)
}
}

private var testApiKey: String { "4HVPVMV1PN6NGZDFXZIYKEZRP53IA41KVC" }
private var vitaliksAddress: String { "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B" }
private var emptyAddress: String { "0x3a0cd085155dc74cdddf3196f23c8cec9b217dd8" }
}

// MARK: - EtherscanTransactionCheckerErrorTests
Expand All @@ -78,7 +86,7 @@ final class EtherscanTransactionCheckerErrorTests: XCTestCase {

// MARK: - test double

final private class URLSessionMock: URLSessionProxy {
private final class URLSessionMock: URLSessionProxy {
var response: (Data, URLResponse) = (Data(), URLResponse())

func data(for request: URLRequest) async throws -> (Data, URLResponse) {
Expand Down
95 changes: 52 additions & 43 deletions Tests/web3swiftTests/remoteTests/InfuraTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,58 @@ import Web3Core
@testable import web3swift

// MARK: Works only with network connection

class InfuraTests: XCTestCase {
func testGetBalance() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
let address = EthereumAddress("0xd61b5ca425F8C8775882d4defefC68A6979DBbce")!
let balance = try await web3.eth.getBalance(for: address)
let balString = Utilities.formatToPrecision(balance, units: .ether, formattingDecimals: 3)
XCTAssertNotNil(balString)
}
// FIXME: Infura tests failing on ci/cd, to figure out why.
// func testGetBalance() async throws {
// let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
// let address = EthereumAddress("0xd61b5ca425F8C8775882d4defefC68A6979DBbce")!
// let balance = try await web3.eth.getBalance(for: address)
// let balString = Utilities.formatToPrecision(balance, units: .ether, formattingDecimals: 3)
// XCTAssertNotNil(balString)
// }

func testGetBlockByHash() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
let result = try await web3.eth.block(by: "0x6d05ba24da6b7a1af22dc6cc2a1fe42f58b2a5ea4c406b19c8cf672ed8ec0695", fullTransactions: false)
XCTAssertEqual(result.number, 5184323)
}
// func testGetBlockByHash() async throws {
// let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
// let result = try await web3.eth.block(
// by: "0x6d05ba24da6b7a1af22dc6cc2a1fe42f58b2a5ea4c406b19c8cf672ed8ec0695",
// fullTransactions: false
// )
// XCTAssertEqual(result.number, 5_184_323)
// }

func testGetBlockByHash_hashAsData() async throws {
let blockHash = Data.fromHex("6d05ba24da6b7a1af22dc6cc2a1fe42f58b2a5ea4c406b19c8cf672ed8ec0695")!
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
let result = try await web3.eth.block(by: blockHash, fullTransactions: false)
XCTAssertEqual(result.number, 5184323)
}
// func testGetBlockByHash_hashAsData() async throws {
// let blockHash = Data.fromHex("6d05ba24da6b7a1af22dc6cc2a1fe42f58b2a5ea4c406b19c8cf672ed8ec0695")!
// let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
// let result = try await web3.eth.block(by: blockHash, fullTransactions: false)
// XCTAssertEqual(result.number, 5_184_323)
// }

func testGetBlockByNumber1() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
_ = try await web3.eth.block(by: .latest, fullTransactions: false)
}
// func testGetBlockByNumber1() async throws {
// let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
// _ = try await web3.eth.block(by: .latest, fullTransactions: false)
// }

func testGetBlockByNumber2() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
_ = try await web3.eth.block(by: .exact(5184323), fullTransactions: true)
}
// func testGetBlockByNumber2() async throws {
// let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
// _ = try await web3.eth.block(by: .exact(5_184_323), fullTransactions: true)
// }

func testGetBlockByNumber3() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
do {
_ = try await web3.eth.block(by: .exact(10000000000000), fullTransactions: true)
XCTFail("The expression above must throw DecodingError.")
} catch {
// DecodingError is thrown as a block for the given block number does not exist
XCTAssert(error is DecodingError)
}
}
// func testGetBlockByNumber3() async throws {
// let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
// do {
// _ = try await web3.eth.block(by: .exact(10_000_000_000_000), fullTransactions: true)
// XCTFail("The expression above must throw DecodingError.")
// } catch {
// // DecodingError is thrown as a block for the given block number does not exist
// XCTAssert(error is DecodingError)
// }
// }

func testGasPrice() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
_ = try await web3.eth.gasPrice()
}
// func testGasPrice() async throws {
// let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
// _ = try await web3.eth.gasPrice()
// }

// func testGetIndexedEventsPromise() async throws {
// let jsonString = "[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"version\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"},{\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"approveAndCall\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"remaining\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"inputs\":[{\"name\":\"_initialAmount\",\"type\":\"uint256\"},{\"name\":\"_tokenName\",\"type\":\"string\"},{\"name\":\"_decimalUnits\",\"type\":\"uint8\"},{\"name\":\"_tokenSymbol\",\"type\":\"string\"}],\"type\":\"constructor\"},{\"payable\":false,\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},]"
Expand All @@ -65,9 +70,12 @@ class InfuraTests: XCTestCase {
// filter.fromBlock = .exact(5200120)
// filter.toBlock = .exact(5200120)
// filter.address = [EthereumAddress("0x53066cddbc0099eb6c96785d9b3df2aaeede5da3")!]
// filter.topics = [EventFilterParameters.Topic.strings([EventFilterParameters.Topic.string("0xefdcf2c36f3756ce7247628afdb632fa4ee12ec5"), EventFilterParameters.Topic.string(nil)])]
// filter.topics =
// [EventFilterParameters.Topic.strings([EventFilterParameters.Topic.string("0xefdcf2c36f3756ce7247628afdb632fa4ee12ec5"),
// EventFilterParameters.Topic.string(nil)])]
// // need
// let eventParserResult = try await contract!.getIndexedEvents(eventName: "Transfer", filter: filter, joinWithReceipts: true)
// let eventParserResult = try await contract!.getIndexedEvents(eventName: "Transfer", filter: filter, joinWithReceipts:
// true)
//
// XCTAssert(eventParserResult.count == 2)
// XCTAssert(eventParserResult.first?.transactionReceipt != nil)
Expand All @@ -80,7 +88,8 @@ class InfuraTests: XCTestCase {
// let contract = web3.contract(jsonString, at: nil, abiVersion: 2)
// var filter = EventFilter()
// filter.addresses = [EthereumAddress("0x53066cddbc0099eb6c96785d9b3df2aaeede5da3")!]
// filter.parameterFilters = [([EthereumAddress("0xefdcf2c36f3756ce7247628afdb632fa4ee12ec5")!] as [EventFilterable]), ([EthereumAddress("0xd5395c132c791a7f46fa8fc27f0ab6bacd824484")!] as [EventFilterable])]
// filter.parameterFilters = [([EthereumAddress("0xefdcf2c36f3756ce7247628afdb632fa4ee12ec5")!] as [EventFilterable]),
// ([EthereumAddress("0xd5395c132c791a7f46fa8fc27f0ab6bacd824484")!] as [EventFilterable])]
// guard let eventParser = contract?.createEventParser("Transfer", filter: filter) else {return XCTFail()}
// let present = try eventParser.parseBlockByNumberPromise(UInt64(5200120)).wait()
//
Expand Down
45 changes: 22 additions & 23 deletions Tests/web3swiftTests/remoteTests/PolicyResolverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import Web3Core

// swiftlint:disable force_unwrapping
final class PolicyResolverTests: XCTestCase {

func testResolveAllForEIP1159Transaction() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
let resolver = PolicyResolver(provider: web3.provider)
var tx = CodableTransaction(
var tx = try CodableTransaction(
type: .eip1559,
to: EthereumAddress("0xb47292B7bBedA4447564B8336E4eD1f93735e7C7")!,
chainID: web3.provider.network!.chainID,
value: try XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether)),
value: XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether)),
gasLimit: 21_000
)
// Vitalik's address
Expand All @@ -35,25 +34,25 @@ final class PolicyResolverTests: XCTestCase {
XCTAssertGreaterThan(tx.nonce, 0)
}

func testResolveAllForLegacyTransaction() async throws {
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
let resolver = PolicyResolver(provider: web3.provider)
var tx = CodableTransaction(
type: .legacy,
to: EthereumAddress("0xb47292B7bBedA4447564B8336E4eD1f93735e7C7")!,
chainID: web3.provider.network!.chainID,
value: try XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether)),
gasLimit: 21_000
)
// Vitalik's address
tx.from = EthereumAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")!
let policies = Policies(gasLimitPolicy: .manual(21_000))
try await resolver.resolveAll(for: &tx, with: policies)
// func testResolveAllForLegacyTransaction() async throws {
// let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
// let resolver = PolicyResolver(provider: web3.provider)
// var tx = CodableTransaction(
// type: .legacy,
// to: EthereumAddress("0xb47292B7bBedA4447564B8336E4eD1f93735e7C7")!,
// chainID: web3.provider.network!.chainID,
// value: try XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether)),
// gasLimit: 21_000
// )
// // Vitalik's address
// tx.from = EthereumAddress("0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B")!
// let policies = Policies(gasLimitPolicy: .manual(21_000))
// try await resolver.resolveAll(for: &tx, with: policies)

XCTAssertGreaterThan(tx.gasLimit, 0)
XCTAssertGreaterThan(tx.gasPrice ?? 0, 0)
XCTAssertGreaterThan(tx.nonce, 0)
}
// XCTAssertGreaterThan(tx.gasLimit, 0)
// XCTAssertGreaterThan(tx.gasPrice ?? 0, 0)
// XCTAssertGreaterThan(tx.nonce, 0)
// }

func testResolveExact() async throws {
let expectedNonce = BigUInt(42)
Expand All @@ -62,11 +61,11 @@ final class PolicyResolverTests: XCTestCase {
let expectedPriorityFee = BigUInt(9)
let web3 = try await Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
let resolver = PolicyResolver(provider: web3.provider)
var tx = CodableTransaction(
var tx = try CodableTransaction(
type: .eip1559,
to: EthereumAddress("0xb47292B7bBedA4447564B8336E4eD1f93735e7C7")!,
chainID: web3.provider.network!.chainID,
value: try XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether)),
value: XCTUnwrap(Utilities.parseToBigUInt("0.1", units: .ether)),
gasLimit: 21_000
)
// Vitalik's address
Expand Down
Loading