From 265c9d2b8e2b8e0b6e32bcbaf15e568b743d3aba Mon Sep 17 00:00:00 2001 From: Alex Vlasov Date: Thu, 31 May 2018 15:24:33 +0300 Subject: [PATCH] fix gas limit estimation --- Podfile | 8 +- Podfile.lock | 14 ++-- Pods/Alamofire/README.md | 13 ++- Pods/Alamofire/Source/SessionDelegate.swift | 2 +- Pods/Alamofire/Source/SessionManager.swift | 4 + Pods/Manifest.lock | 14 ++-- Pods/SipHash/README.md | 42 +++++----- Pods/SipHash/SipHash/RandomUInt64.swift | 21 ++++- .../Alamofire-iOS/Info.plist | 2 +- .../Alamofire-macOS/Info.plist | 2 +- .../Pods-web3swift-iOS-resources.sh | 2 +- .../Pods-web3swift-iOS_Tests-resources.sh | 2 +- .../Pods-web3swift-macOS-resources.sh | 2 +- .../Pods-web3swift-macOS_Tests-resources.sh | 2 +- .../SipHash-iOS/Info.plist | 2 +- .../SipHash-macOS/Info.plist | 2 +- .../secp256k1_ios/src/secp256k1.c | 2 +- web3swift.podspec | 7 +- web3swift.xcodeproj/project.pbxproj | 82 ++++++++++--------- .../xcschemes/web3swift-iOS.xcscheme | 2 +- .../xcschemes/web3swift-macOS.xcscheme | 6 +- .../xcschemes/web3swift_Tests.xcscheme | 2 +- .../xcschemes/web3swift_local_Tests.xcscheme | 2 +- web3swift/ABI/Classes/ABITypes.swift | 2 +- .../ABIv2/Classes/ABIv2ParameterTypes.swift | 2 +- .../Classes/Web3+EthOperations.swift | 20 +++-- .../Classes/Web3+TransactionOperations.swift | 45 +++++----- .../Convenience/Classes/Data+Extension.swift | 5 +- .../Classes/EthereumTransaction.swift | 19 ++++- web3swift/Web3/Classes/Web3+Eth.swift | 7 ++ web3swift/Web3/Classes/Web3+Options.swift | 17 ++++ web3swiftTests/web3swiftTests.swift | 30 +++++++ 32 files changed, 239 insertions(+), 145 deletions(-) diff --git a/Podfile b/Podfile index 356f08d6..f8000cd7 100644 --- a/Podfile +++ b/Podfile @@ -4,14 +4,14 @@ def import_pods pod 'BigInt', '~> 3.0.1' pod 'CryptoSwift' pod 'Result', '~> 3.0.0' - pod 'libsodium' - pod 'secp256k1_ios', :git => 'https://github.com/shamatar/secp256k1_ios.git' + pod 'libsodium', :modular_headers => true + pod 'secp256k1_ios', :git => 'https://github.com/shamatar/secp256k1_ios.git', :modular_headers => true end target 'web3swift-macOS' do platform :osx, '10.13' use_frameworks! - +# use_modular_headers! import_pods target 'web3swift-macOS_Tests' do @@ -22,7 +22,7 @@ end target 'web3swift-iOS' do platform :ios, '9.0' use_frameworks! - +# use_modular_headers! import_pods target 'web3swift-iOS_Tests' do diff --git a/Podfile.lock b/Podfile.lock index 20f9d5b0..0e207177 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - Alamofire (4.7.1) + - Alamofire (4.7.2) - Alamofire-Synchronous (4.0.0): - Alamofire (~> 4.0) - BigInt (3.0.1): @@ -8,7 +8,7 @@ PODS: - libsodium (1.0.12) - Result (3.0.0) - secp256k1_ios (0.1.3) - - SipHash (1.2.0) + - SipHash (1.2.1) DEPENDENCIES: - Alamofire (~> 4.7) @@ -20,7 +20,7 @@ DEPENDENCIES: - secp256k1_ios (from `https://github.com/shamatar/secp256k1_ios.git`) SPEC REPOS: - https://github.com/CocoaPods/Specs.git: + https://github.com/cocoapods/specs.git: - Alamofire - Alamofire-Synchronous - BigInt @@ -39,15 +39,15 @@ CHECKOUT OPTIONS: :git: https://github.com/shamatar/secp256k1_ios.git SPEC CHECKSUMS: - Alamofire: 68d7d521118d49c615a8d2214d87cdf525599d30 + Alamofire: e4fa87002c137ba2d8d634d2c51fabcda0d5c223 Alamofire-Synchronous: eedf1e6e961c3795a63c74990b3f7d9fbfac7e50 BigInt: 8e8a52161c745cd3ab78e3dc346a9fbee51e6cf6 CryptoSwift: bca8c5b653dcc2d9734409242a070ff53bafac86 libsodium: 9a8faa5ef2fa0d2d57bd7f7d79bf8fb7c1a9f0ea Result: 1b3e431f37cbcd3ad89c6aa9ab0ae55515fae3b6 secp256k1_ios: ac9ef04e761f43c58012b28548afa91493761f17 - SipHash: c6e9e43e9c531b5bc6602545130c26194a6d31ce + SipHash: b26918dbe6925368d4322374371437c62c9038e2 -PODFILE CHECKSUM: 51415aa233dc66b3af6a71d098467d77a2d23a80 +PODFILE CHECKSUM: e13ad9f4ec7273a5a0d11848b959afdd2efcf396 -COCOAPODS: 1.5.0 +COCOAPODS: 1.5.2 diff --git a/Pods/Alamofire/README.md b/Pods/Alamofire/README.md index 3b04d712..f29cfce2 100644 --- a/Pods/Alamofire/README.md +++ b/Pods/Alamofire/README.md @@ -220,15 +220,22 @@ If you believe you have identified a security vulnerability with Alamofire, you ## Donations -The [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially register as a federal non-profit organization. Registering will allow us members to gain some legal protections and also allow us to put donations to use, tax free. Donating to the ASF will enable us to: +The [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially stay registered as a federal non-profit organization. +Registering will allow us members to gain some legal protections and also allow us to put donations to use, tax free. +Donating to the ASF will enable us to: -- Pay our legal fees to register as a federal non-profit organization - Pay our yearly legal fees to keep the non-profit in good status - Pay for our mail servers to help us stay on top of all questions and security issues - Potentially fund test servers to make it easier for us to test the edge cases - Potentially fund developers to work on one of our projects full-time -The community adoption of the ASF libraries has been amazing. We are greatly humbled by your enthusiasm around the projects, and want to continue to do everything we can to move the needle forward. With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. If you use any of our libraries for work, see if your employers would be interested in donating. Our initial goal is to raise $1000 to get all our legal ducks in a row and kickstart this campaign. Any amount you can donate today to help us reach our goal would be greatly appreciated. +The community adoption of the ASF libraries has been amazing. +We are greatly humbled by your enthusiasm around the projects, and want to continue to do everything we can to move the needle forward. +With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. +If you use any of our libraries for work, see if your employers would be interested in donating. +Any amount you can donate today to help us reach our goal would be greatly appreciated. + +[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W34WPEE74APJQ) ## License diff --git a/Pods/Alamofire/Source/SessionDelegate.swift b/Pods/Alamofire/Source/SessionDelegate.swift index 7e06b0eb..03bcb7ce 100644 --- a/Pods/Alamofire/Source/SessionDelegate.swift +++ b/Pods/Alamofire/Source/SessionDelegate.swift @@ -163,7 +163,7 @@ open class SessionDelegate: NSObject { var retrier: RequestRetrier? weak var sessionManager: SessionManager? - private var requests: [Int: Request] = [:] + var requests: [Int: Request] = [:] private let lock = NSLock() /// Access the task delegate for the specified task in a thread-safe manner. diff --git a/Pods/Alamofire/Source/SessionManager.swift b/Pods/Alamofire/Source/SessionManager.swift index 321672ff..a9d0ae68 100644 --- a/Pods/Alamofire/Source/SessionManager.swift +++ b/Pods/Alamofire/Source/SessionManager.swift @@ -848,6 +848,10 @@ open class SessionManager { do { let task = try originalTask.task(session: session, adapter: adapter, queue: queue) + if let originalTask = request.task { + delegate[originalTask] = nil // removes the old request to avoid endless growth + } + request.delegate.task = task // resets all task delegate data request.retryCount += 1 diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock index 20f9d5b0..0e207177 100644 --- a/Pods/Manifest.lock +++ b/Pods/Manifest.lock @@ -1,5 +1,5 @@ PODS: - - Alamofire (4.7.1) + - Alamofire (4.7.2) - Alamofire-Synchronous (4.0.0): - Alamofire (~> 4.0) - BigInt (3.0.1): @@ -8,7 +8,7 @@ PODS: - libsodium (1.0.12) - Result (3.0.0) - secp256k1_ios (0.1.3) - - SipHash (1.2.0) + - SipHash (1.2.1) DEPENDENCIES: - Alamofire (~> 4.7) @@ -20,7 +20,7 @@ DEPENDENCIES: - secp256k1_ios (from `https://github.com/shamatar/secp256k1_ios.git`) SPEC REPOS: - https://github.com/CocoaPods/Specs.git: + https://github.com/cocoapods/specs.git: - Alamofire - Alamofire-Synchronous - BigInt @@ -39,15 +39,15 @@ CHECKOUT OPTIONS: :git: https://github.com/shamatar/secp256k1_ios.git SPEC CHECKSUMS: - Alamofire: 68d7d521118d49c615a8d2214d87cdf525599d30 + Alamofire: e4fa87002c137ba2d8d634d2c51fabcda0d5c223 Alamofire-Synchronous: eedf1e6e961c3795a63c74990b3f7d9fbfac7e50 BigInt: 8e8a52161c745cd3ab78e3dc346a9fbee51e6cf6 CryptoSwift: bca8c5b653dcc2d9734409242a070ff53bafac86 libsodium: 9a8faa5ef2fa0d2d57bd7f7d79bf8fb7c1a9f0ea Result: 1b3e431f37cbcd3ad89c6aa9ab0ae55515fae3b6 secp256k1_ios: ac9ef04e761f43c58012b28548afa91493761f17 - SipHash: c6e9e43e9c531b5bc6602545130c26194a6d31ce + SipHash: b26918dbe6925368d4322374371437c62c9038e2 -PODFILE CHECKSUM: 51415aa233dc66b3af6a71d098467d77a2d23a80 +PODFILE CHECKSUM: e13ad9f4ec7273a5a0d11848b959afdd2efcf396 -COCOAPODS: 1.5.0 +COCOAPODS: 1.5.2 diff --git a/Pods/SipHash/README.md b/Pods/SipHash/README.md index a9c69297..49fe93e0 100644 --- a/Pods/SipHash/README.md +++ b/Pods/SipHash/README.md @@ -6,19 +6,18 @@ [![Build Status](https://travis-ci.org/attaswift/SipHash.svg?branch=master)](https://travis-ci.org/attaswift/SipHash) [![Code Coverage](https://codecov.io/github/attaswift/SipHash/coverage.svg?branch=master)](https://codecov.io/github/attaswift/SipHash?branch=master) -[![Documented](https://img.shields.io/cocoapods/metrics/doc-percent/SipHash.svg)](http://attaswift.github.io/SipHash) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage) [![CocoaPod Version](https://img.shields.io/cocoapods/v/SipHash.svg)](http://cocoapods.org/pods/SipHash) -`SipHash` is a pure Swift implementation of the [SipHash] hashing algorithm designed by +`SipHash` is a pure Swift implementation of the [SipHash] hashing algorithm designed by Jean-Philippe Aumasson and Daniel J. Bernstein in 2012: [SipHash]: https://131002.net/siphash -> SipHash is a family of pseudorandom functions (a.k.a. keyed hash functions) optimized for speed on short messages. +> SipHash is a family of pseudorandom functions (a.k.a. keyed hash functions) optimized for speed on short messages. > -> Target applications include network traffic authentication and defense against hash-flooding DoS attacks. +> Target applications include network traffic authentication and defense against hash-flooding DoS attacks. > > SipHash is secure, fast, and simple (for real): > - SipHash is simpler and faster than previous cryptographic algorithms (e.g. MACs based on universal hashing) @@ -36,7 +35,7 @@ independent implementation that's available for use in third-party code. The current release of SipHash requires Swift 4. -## Sample Code +## Sample Code ```swift import SipHash @@ -46,7 +45,7 @@ struct Book: SipHashable { let title: String let pageCount: Int - // You need to implement this method instead of `hashValue`. + // You need to implement this method instead of `hashValue`. func appendHashes(to hasher: inout SipHasher) { // Simply append the fields you want to include in the hash. hasher.append(title) @@ -68,7 +67,7 @@ var hasher = SipHasher() hasher.add(book) hasher.add(42) // Finalizing the hasher extracts the hash value and invalidates it. -let hash = hasher.finalize() +let hash = hasher.finalize() ``` ## Why Would I Use SipHash? @@ -76,31 +75,31 @@ let hash = hasher.finalize() Writing a good implementation of `hashValue` is hard, even if we just need to combine the values of a couple of fields. We need to come up with a deterministic function that blends the field values well, producing a fixed-width result without too many collisions on typical inputs. But how many collisions are "too many"? Do we even know what -our "typical inputs" look like? For me, the answer to both of these questions is usually "I have absolutely no idea", +our "typical inputs" look like? For me, the answer to both of these questions is usually "I have absolutely no idea", and I bet you have the same problem. Thus, verifying that our `hashValue` implementations work well is an exercise in frustration. We need to somehow check the properties of the hash function by looking at its behavior given various inputs. -It is easy enough to write tests for the requirement that equal values have equal `hashValues`. -But verifying that the hash has few collisions requires making some assumptions on the +It is easy enough to write tests for the requirement that equal values have equal `hashValues`. +But verifying that the hash has few collisions requires making some assumptions on the statistical properties of "typical" inputs -- and even if we'd be somehow confident enough to do that, writing the code to do it is way too complicated. -Instead of rolling your own ad-hoc hash function, why not just use an algorithm designed specifically to blend data -into a hash? Using a standardized algorithm means we don't need to worry about collision behavior any more: if the +Instead of rolling your own ad-hoc hash function, why not just use an algorithm designed specifically to blend data +into a hash? Using a standardized algorithm means we don't need to worry about collision behavior any more: if the algorithm was designed well, we'll always have good results. -The SipHash algorithm is a particularly good choice for hashing. It implements a 64-bit cryptographic -message-authentication code (MAC) with a 256-bit internal state initialized from a 128-bit secret key that's (typically) -randomly generated for each execution of the binary. +The SipHash algorithm is a particularly good choice for hashing. It implements a 64-bit cryptographic +message-authentication code (MAC) with a 256-bit internal state initialized from a 128-bit secret key that's (typically) +randomly generated for each execution of the binary. SipHash is designed to protect against hash collision attacks, while remaining simple to use and fast. -It is already used by Perl, Python, Ruby, Rust, and even Swift itself -- which is why the documentation of `Hashable` +It is already used by Perl, Python, Ruby, Rust, and even Swift itself -- which is why the documentation of `Hashable` explicitly warns that the value returned by `hashValue` may be different across executions. -The standard library already implements SipHash, but the implementation is private. (It is technically available +The standard library already implements SipHash, but the implementation is private. (It is technically available for use, but it is not formally part of the stdlib API, and it is subject to change/removal across even point releases.) -I expect a refactored version of stdlib's SipHash will become available as public API in a future Swift release. +I expect a refactored version of stdlib's SipHash will become available as public API in a future Swift release. But while we're waiting for that, this package provides an alternative implementation that is available today. ## Is this code full of bugs? @@ -109,8 +108,8 @@ Indubitably. Please report all bugs you find! The package has 100% unit test coverage. Unfortunately this doesn't tell you much about its reliability in practice. -The test suite verifies that the package generates values that match the test vectors supplied by SipHash's original -authors, which makes me reasonably confident that this package implements SipHash correctly. +The test suite verifies that the package generates values that match the test vectors supplied by SipHash's original +authors, which makes me reasonably confident that this package implements SipHash correctly. Obviously, your mileage may vary. ## Reference docs @@ -148,7 +147,7 @@ import PackageDescription let package = Package( name: "MyPackage", dependencies: [ - .Package(url: "https://github.com/attaswift/SipHash.git", from: "1.2.0") + .Package(url: "https://github.com/attaswift/SipHash.git", from: "1.2.1") ] ) ``` @@ -160,4 +159,3 @@ If you don't use a dependency manager, you need to clone this repo somewhere nea To link your application binary with SipHash, just add `SipHash.framework` from the SipHash project to the Embedded Binaries section of your app target's General page in Xcode. As long as the SipHash project file is referenced in your workspace, this framework will be listed in the "Choose items to add" sheet that opens when you click on the "+" button of your target's Embedded Binaries list. There is no need to do any additional setup beyond adding the framework targets to Embedded Binaries. - diff --git a/Pods/SipHash/SipHash/RandomUInt64.swift b/Pods/SipHash/SipHash/RandomUInt64.swift index 1e0c03f8..d55eb0bd 100644 --- a/Pods/SipHash/SipHash/RandomUInt64.swift +++ b/Pods/SipHash/SipHash/RandomUInt64.swift @@ -12,15 +12,28 @@ func randomUInt64() -> UInt64 { return UInt64(arc4random()) << 32 | UInt64(arc4random()) } -#elseif os(Linux) - import SwiftShims +#elseif os(Linux) || os(FreeBSD) + import Glibc func randomUInt64() -> UInt64 { - return UInt64(_swift_stdlib_cxx11_mt19937()) << 32 | UInt64(_swift_stdlib_cxx11_mt19937()) + var randomArray = [UInt8](repeating: 0, count: 8) + + let fd = open("/dev/urandom", O_RDONLY) + defer { + close(fd) + } + + let _ = read(fd, &randomArray, MemoryLayout.size * 8) + + var randomInt: UInt64 = 0 + for i in 0.. UInt64 { fatalError("Unsupported platform") } #endif - diff --git a/Pods/Target Support Files/Alamofire-iOS/Info.plist b/Pods/Target Support Files/Alamofire-iOS/Info.plist index 8ab9b68d..34125306 100644 --- a/Pods/Target Support Files/Alamofire-iOS/Info.plist +++ b/Pods/Target Support Files/Alamofire-iOS/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.7.1 + 4.7.2 CFBundleSignature ???? CFBundleVersion diff --git a/Pods/Target Support Files/Alamofire-macOS/Info.plist b/Pods/Target Support Files/Alamofire-macOS/Info.plist index 8ab9b68d..34125306 100644 --- a/Pods/Target Support Files/Alamofire-macOS/Info.plist +++ b/Pods/Target Support Files/Alamofire-macOS/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.7.1 + 4.7.2 CFBundleSignature ???? CFBundleVersion diff --git a/Pods/Target Support Files/Pods-web3swift-iOS/Pods-web3swift-iOS-resources.sh b/Pods/Target Support Files/Pods-web3swift-iOS/Pods-web3swift-iOS-resources.sh index fe3f9c72..345301f2 100755 --- a/Pods/Target Support Files/Pods-web3swift-iOS/Pods-web3swift-iOS-resources.sh +++ b/Pods/Target Support Files/Pods-web3swift-iOS/Pods-web3swift-iOS-resources.sh @@ -113,6 +113,6 @@ then if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" else - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_BUILD_DIR}/assetcatalog_generated_info.plist" + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" fi fi diff --git a/Pods/Target Support Files/Pods-web3swift-iOS_Tests/Pods-web3swift-iOS_Tests-resources.sh b/Pods/Target Support Files/Pods-web3swift-iOS_Tests/Pods-web3swift-iOS_Tests-resources.sh index fe3f9c72..345301f2 100755 --- a/Pods/Target Support Files/Pods-web3swift-iOS_Tests/Pods-web3swift-iOS_Tests-resources.sh +++ b/Pods/Target Support Files/Pods-web3swift-iOS_Tests/Pods-web3swift-iOS_Tests-resources.sh @@ -113,6 +113,6 @@ then if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" else - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_BUILD_DIR}/assetcatalog_generated_info.plist" + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" fi fi diff --git a/Pods/Target Support Files/Pods-web3swift-macOS/Pods-web3swift-macOS-resources.sh b/Pods/Target Support Files/Pods-web3swift-macOS/Pods-web3swift-macOS-resources.sh index fe3f9c72..345301f2 100755 --- a/Pods/Target Support Files/Pods-web3swift-macOS/Pods-web3swift-macOS-resources.sh +++ b/Pods/Target Support Files/Pods-web3swift-macOS/Pods-web3swift-macOS-resources.sh @@ -113,6 +113,6 @@ then if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" else - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_BUILD_DIR}/assetcatalog_generated_info.plist" + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" fi fi diff --git a/Pods/Target Support Files/Pods-web3swift-macOS_Tests/Pods-web3swift-macOS_Tests-resources.sh b/Pods/Target Support Files/Pods-web3swift-macOS_Tests/Pods-web3swift-macOS_Tests-resources.sh index fe3f9c72..345301f2 100755 --- a/Pods/Target Support Files/Pods-web3swift-macOS_Tests/Pods-web3swift-macOS_Tests-resources.sh +++ b/Pods/Target Support Files/Pods-web3swift-macOS_Tests/Pods-web3swift-macOS_Tests-resources.sh @@ -113,6 +113,6 @@ then if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" else - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_BUILD_DIR}/assetcatalog_generated_info.plist" + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" fi fi diff --git a/Pods/Target Support Files/SipHash-iOS/Info.plist b/Pods/Target Support Files/SipHash-iOS/Info.plist index 2a9158a0..19f73eae 100644 --- a/Pods/Target Support Files/SipHash-iOS/Info.plist +++ b/Pods/Target Support Files/SipHash-iOS/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.2.0 + 1.2.1 CFBundleSignature ???? CFBundleVersion diff --git a/Pods/Target Support Files/SipHash-macOS/Info.plist b/Pods/Target Support Files/SipHash-macOS/Info.plist index 2a9158a0..19f73eae 100644 --- a/Pods/Target Support Files/SipHash-macOS/Info.plist +++ b/Pods/Target Support Files/SipHash-macOS/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.2.0 + 1.2.1 CFBundleSignature ???? CFBundleVersion diff --git a/Pods/secp256k1_ios/secp256k1_ios/src/secp256k1.c b/Pods/secp256k1_ios/secp256k1_ios/src/secp256k1.c index 4efb02dc..5262e121 100644 --- a/Pods/secp256k1_ios/secp256k1_ios/src/secp256k1.c +++ b/Pods/secp256k1_ios/secp256k1_ios/src/secp256k1.c @@ -345,7 +345,7 @@ static int nonce_function_rfc6979(unsigned char *nonce32, const unsigned char *m } secp256k1_rfc6979_hmac_sha256_initialize(&rng, keydata, offset); memset(keydata, 0, sizeof(keydata)); - for (i = 0; i <= counter; i++) { + for (i = 0; i <= counter; i++) { secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); } secp256k1_rfc6979_hmac_sha256_finalize(&rng); diff --git a/web3swift.podspec b/web3swift.podspec index 8f9367ce..68e59ce4 100644 --- a/web3swift.podspec +++ b/web3swift.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "web3swift" -s.version = "0.7.0" +s.version = "0.8.0" s.summary = "Web3 implementation in vanilla Swift for iOS ans macOS" s.description = <<-DESC @@ -13,10 +13,7 @@ s.author = { "Alex Vlasov" => "av@bankexfoundation.org" } s.source = { :git => 'https://github.com/bankex/web3swift.git', :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/shamatar' -s.pod_target_xcconfig = { - 'SWIFT_VERSION' => '4.1' -} - +s.swift_version = '4.1' s.module_name = 'web3swift' s.ios.deployment_target = "9.0" s.osx.deployment_target = "10.13" diff --git a/web3swift.xcodeproj/project.pbxproj b/web3swift.xcodeproj/project.pbxproj index 091db397..464c8616 100644 --- a/web3swift.xcodeproj/project.pbxproj +++ b/web3swift.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 009F378CB2AD8019FFC5F79C /* Pods_web3swift_macOS_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6ED5D0DA182AFA403359DDB4 /* Pods_web3swift_macOS_Tests.framework */; }; 1CD91B321FD769A6007BFB45 /* web3swiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CD91B311FD769A6007BFB45 /* web3swiftTests.swift */; }; 1CD91B341FD769A6007BFB45 /* web3swift_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CD91AFC1FD76910007BFB45 /* web3swift_iOS.framework */; }; 4194811B203630530065A83B /* Web3+HttpProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 817EBB142004FE4200E02EAA /* Web3+HttpProvider.swift */; }; @@ -44,7 +45,6 @@ 4194813F203630530065A83B /* Dictionary+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8123E1C6200CBAC200B6D3AB /* Dictionary+Extension.swift */; }; 41948140203630530065A83B /* Array+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8123E1CA200CBB2200B6D3AB /* Array+Extension.swift */; }; 41948141203630530065A83B /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8113D2FF1FD7F30F0074282C /* String+Extension.swift */; }; - 472BBA099A26DFD47F33C2E0 /* Pods_web3swift_macOS_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 010A8466DD6C993827C11A71 /* Pods_web3swift_macOS_Tests.framework */; }; 4EFFCB6E208552F2008165FE /* web3swift_local_node_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EFFCB6D208552F2008165FE /* web3swift_local_node_Tests.swift */; }; 4EFFCB70208554EB008165FE /* web3swift_remote_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EFFCB6F208554EB008165FE /* web3swift_remote_Tests.swift */; }; 8103BBB72076391F00499769 /* Web3+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8103BBB62076391F00499769 /* Web3+Concurrency.swift */; }; @@ -111,6 +111,7 @@ 818D16D0204D42940084D2A4 /* Web3+EventParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818D16CE204D42910084D2A4 /* Web3+EventParser.swift */; }; 818D810E1FDC1A2000663CE3 /* RLP.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818D810D1FDC1A2000663CE3 /* RLP.swift */; }; 818EABDA1FDC9A5C00E013FC /* Contract.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818EABD91FDC9A5C00E013FC /* Contract.swift */; }; + 81A0FA0320BFEF2B00417C64 /* key.json in Resources */ = {isa = PBXBuildFile; fileRef = 81A0FA0220BFEF2700417C64 /* key.json */; }; 81BEDE1D20852F75002CD87D /* Web3+PersonalOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81BEDE1C20852F75002CD87D /* Web3+PersonalOperations.swift */; }; 81BEDE1E20852F75002CD87D /* Web3+PersonalOperations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81BEDE1C20852F75002CD87D /* Web3+PersonalOperations.swift */; }; 81C0FCF220440EB500D82FAF /* Web3+Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C0FCF120440EB500D82FAF /* Web3+Protocols.swift */; }; @@ -121,8 +122,6 @@ 81C0FD042044A8A700D82FAF /* Web3+Options.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C0FCF320440F0900D82FAF /* Web3+Options.swift */; }; 81C0FD052044A8AE00D82FAF /* Web3+Protocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C0FCF120440EB500D82FAF /* Web3+Protocols.swift */; }; 81C0FD062044A8D100D82FAF /* TransactionSigner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C0FCF520440F9900D82FAF /* TransactionSigner.swift */; }; - 81C0FD082044AB2400D82FAF /* Pods_web3swift_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81C0FD092044AB2400D82FAF /* Pods_web3swift_iOS.framework */; }; - 81C0FD0A2044AB4600D82FAF /* Pods_web3swift_iOS_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81C0FD0B2044AB4600D82FAF /* Pods_web3swift_iOS_Tests.framework */; }; 81C146F71FF274B200AA943E /* Web3+Structures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C146F61FF274B200AA943E /* Web3+Structures.swift */; }; 81C5DA0E207254D000424CD6 /* ABIv2Elements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C5DA0D207254D000424CD6 /* ABIv2Elements.swift */; }; 81C5DA0F207254D000424CD6 /* ABIv2Elements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C5DA0D207254D000424CD6 /* ABIv2Elements.swift */; }; @@ -169,7 +168,9 @@ 81FB2203207BC6DB007F9A83 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81FB2202207BC6DB007F9A83 /* ImageIO.framework */; }; 81FB2207207BCFF9007F9A83 /* bankex-foundation-logo-coin.png in Resources */ = {isa = PBXBuildFile; fileRef = 81FB2206207BCFF9007F9A83 /* bankex-foundation-logo-coin.png */; }; 81FB2208207BCFF9007F9A83 /* bankex-foundation-logo-coin.png in Resources */ = {isa = PBXBuildFile; fileRef = 81FB2206207BCFF9007F9A83 /* bankex-foundation-logo-coin.png */; }; - A4733E6E22E6216A90CCEA33 /* Pods_web3swift_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC4A49B538D672F4DA112A11 /* Pods_web3swift_macOS.framework */; }; + D0818DC94EF7AD04C6E54357 /* Pods_web3swift_iOS_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 613A9CE29320FF136EC8903D /* Pods_web3swift_iOS_Tests.framework */; }; + DCD817DC229708DD4366AF1B /* Pods_web3swift_macOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3399531092AAA08F12D3CAFD /* Pods_web3swift_macOS.framework */; }; + F311F6C7ADAB81B6CCCCBB1F /* Pods_web3swift_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62152503789B635C0B08D841 /* Pods_web3swift_iOS.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -190,7 +191,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 010A8466DD6C993827C11A71 /* Pods_web3swift_macOS_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_macOS_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 08BD06D432296DA533D07D20 /* Pods_Web3Swift_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Web3Swift_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 0F133EC83594B17BA8C71784 /* Pods_web3swift_ios_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_ios_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 10C02100CDF7C2D5C79A52B9 /* Pods_web3Swift_Demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3Swift_Demo.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -203,6 +203,7 @@ 1CD91B331FD769A6007BFB45 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1E62EF5F091ED9F7B80CA8EE /* Pods-web3swift-macOS_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-web3swift-macOS_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-web3swift-macOS_Tests/Pods-web3swift-macOS_Tests.release.xcconfig"; sourceTree = ""; }; 2B8FEFF3962166E1BEADC886 /* Pods_web3swift_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3399531092AAA08F12D3CAFD /* Pods_web3swift_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 342700493511FEB189700D13 /* Pods-web3swift-iOS_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-web3swift-iOS_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-web3swift-iOS_Tests/Pods-web3swift-iOS_Tests.debug.xcconfig"; sourceTree = ""; }; 391A0D2EF42488E5C8AB2F71 /* Pods_web3swift_osx_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_osx_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 417715D420362916005C3E16 /* web3swift_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = web3swift_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -214,6 +215,7 @@ 613A9CE29320FF136EC8903D /* Pods_web3swift_iOS_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_iOS_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 62152503789B635C0B08D841 /* Pods_web3swift_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 68360683136B1FE2C57D65D9 /* Pods_Web3Swift_ios_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Web3Swift_ios_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6ED5D0DA182AFA403359DDB4 /* Pods_web3swift_macOS_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_macOS_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 740EB523E2A6AEE0C6916C71 /* Pods_Web3Swift_osx_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Web3Swift_osx_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8103BBB62076391F00499769 /* Web3+Concurrency.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+Concurrency.swift"; sourceTree = ""; }; 8103BBB920764A6900499769 /* Web3+DataFetchOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+DataFetchOperation.swift"; sourceTree = ""; }; @@ -264,6 +266,7 @@ 818D16CE204D42910084D2A4 /* Web3+EventParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+EventParser.swift"; sourceTree = ""; }; 818D810D1FDC1A2000663CE3 /* RLP.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RLP.swift; sourceTree = ""; }; 818EABD91FDC9A5C00E013FC /* Contract.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contract.swift; sourceTree = ""; }; + 81A0FA0220BFEF2700417C64 /* key.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = key.json; sourceTree = ""; }; 81BEDE1C20852F75002CD87D /* Web3+PersonalOperations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+PersonalOperations.swift"; sourceTree = ""; }; 81C0FCEF20440C3600D82FAF /* Web3+Wallet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Web3+Wallet.swift"; sourceTree = ""; }; 81C0FCF120440EB500D82FAF /* Web3+Protocols.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+Protocols.swift"; sourceTree = ""; }; @@ -271,8 +274,6 @@ 81C0FCF520440F9900D82FAF /* TransactionSigner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionSigner.swift; sourceTree = ""; }; 81C0FCF8204456E600D82FAF /* Web3+BrowserFunctions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+BrowserFunctions.swift"; sourceTree = ""; }; 81C0FCFC20449D1400D82FAF /* Web3+TransactionIntermediate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+TransactionIntermediate.swift"; sourceTree = ""; }; - 81C0FD092044AB2400D82FAF /* Pods_web3swift_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_web3swift_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 81C0FD0B2044AB4600D82FAF /* Pods_web3swift_iOS_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Pods_web3swift_iOS_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 81C146F61FF274B200AA943E /* Web3+Structures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Web3+Structures.swift"; sourceTree = ""; }; 81C5DA0A2072548900424CD6 /* ABIv2Parsing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ABIv2Parsing.swift; sourceTree = ""; }; 81C5DA0D207254D000424CD6 /* ABIv2Elements.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ABIv2Elements.swift; sourceTree = ""; }; @@ -306,7 +307,6 @@ CDCB852B5E2E84636B80BB99 /* Pods-web3swift-iOS_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-web3swift-iOS_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-web3swift-iOS_Tests/Pods-web3swift-iOS_Tests.release.xcconfig"; sourceTree = ""; }; FB43EC035C593F9E5A3644B6 /* Pods-web3swift-macOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-web3swift-macOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-web3swift-macOS/Pods-web3swift-macOS.debug.xcconfig"; sourceTree = ""; }; FC1E6C115639177F2629E42A /* Pods_web3swift_osx.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_osx.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FC4A49B538D672F4DA112A11 /* Pods_web3swift_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_web3swift_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -316,7 +316,7 @@ files = ( 81FB2203207BC6DB007F9A83 /* ImageIO.framework in Frameworks */, 81FB2201207BC58C007F9A83 /* CoreImage.framework in Frameworks */, - 81C0FD082044AB2400D82FAF /* Pods_web3swift_iOS.framework in Frameworks */, + F311F6C7ADAB81B6CCCCBB1F /* Pods_web3swift_iOS.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -324,8 +324,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 81C0FD0A2044AB4600D82FAF /* Pods_web3swift_iOS_Tests.framework in Frameworks */, 1CD91B341FD769A6007BFB45 /* web3swift_iOS.framework in Frameworks */, + D0818DC94EF7AD04C6E54357 /* Pods_web3swift_iOS_Tests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -333,7 +333,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A4733E6E22E6216A90CCEA33 /* Pods_web3swift_macOS.framework in Frameworks */, + DCD817DC229708DD4366AF1B /* Pods_web3swift_macOS.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -342,7 +342,7 @@ buildActionMask = 2147483647; files = ( 81FA43F82044097100EE14D5 /* web3swift_macOS.framework in Frameworks */, - 472BBA099A26DFD47F33C2E0 /* Pods_web3swift_macOS_Tests.framework in Frameworks */, + 009F378CB2AD8019FFC5F79C /* Pods_web3swift_macOS_Tests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -395,6 +395,7 @@ 1CD91B301FD769A6007BFB45 /* web3swiftTests */ = { isa = PBXGroup; children = ( + 81A0FA0220BFEF2700417C64 /* key.json */, 81531AA31FE7CD74002192CC /* ERC20abi.json */, 1CD91B311FD769A6007BFB45 /* web3swiftTests.swift */, 4EFFCB6F208554EB008165FE /* web3swift_remote_Tests.swift */, @@ -409,8 +410,6 @@ children = ( 81FB2202207BC6DB007F9A83 /* ImageIO.framework */, 81FB2200207BC58B007F9A83 /* CoreImage.framework */, - 81C0FD0B2044AB4600D82FAF /* Pods_web3swift_iOS_Tests.framework */, - 81C0FD092044AB2400D82FAF /* Pods_web3swift_iOS.framework */, 419481432036338A0065A83B /* Pods_web3swift_osx.framework */, 815630052008A64C00A0EC2F /* Security.framework */, 18E81592D2802B9F4E200823 /* Pods_web3swift.framework */, @@ -426,8 +425,8 @@ 391A0D2EF42488E5C8AB2F71 /* Pods_web3swift_osx_Tests.framework */, 62152503789B635C0B08D841 /* Pods_web3swift_iOS.framework */, 613A9CE29320FF136EC8903D /* Pods_web3swift_iOS_Tests.framework */, - FC4A49B538D672F4DA112A11 /* Pods_web3swift_macOS.framework */, - 010A8466DD6C993827C11A71 /* Pods_web3swift_macOS_Tests.framework */, + 3399531092AAA08F12D3CAFD /* Pods_web3swift_macOS.framework */, + 6ED5D0DA182AFA403359DDB4 /* Pods_web3swift_macOS_Tests.framework */, ); name = Frameworks; sourceTree = ""; @@ -743,7 +742,7 @@ 1CD91B2B1FD769A6007BFB45 /* Sources */, 1CD91B2C1FD769A6007BFB45 /* Frameworks */, 1CD91B2D1FD769A6007BFB45 /* Resources */, - 48322606683D458C51615DF4 /* [CP] Embed Pods Frameworks */, + 64E03376C863E68D3A9DE941 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -782,7 +781,7 @@ 81FA43EF2044097000EE14D5 /* Sources */, 81FA43F02044097000EE14D5 /* Frameworks */, 81FA43F12044097000EE14D5 /* Resources */, - 4272A8167B31CAB015D9817A /* [CP] Embed Pods Frameworks */, + 020D97732370BACD10654AEC /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -801,7 +800,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Bankex Foundation"; TargetAttributes = { 1CD91AFB1FD76910007BFB45 = { @@ -858,6 +857,7 @@ buildActionMask = 2147483647; files = ( 81531AA71FE7D8DB002192CC /* ERC20abi.json in Resources */, + 81A0FA0320BFEF2B00417C64 /* key.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -879,25 +879,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 05D1E0064C0452760CDB6A59 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-web3swift-iOS-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 4272A8167B31CAB015D9817A /* [CP] Embed Pods Frameworks */ = { + 020D97732370BACD10654AEC /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -929,7 +911,25 @@ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-web3swift-macOS_Tests/Pods-web3swift-macOS_Tests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 48322606683D458C51615DF4 /* [CP] Embed Pods Frameworks */ = { + 05D1E0064C0452760CDB6A59 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-web3swift-iOS-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 64E03376C863E68D3A9DE941 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -1229,6 +1229,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -1236,6 +1237,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -1291,6 +1293,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -1298,6 +1301,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; diff --git a/web3swift.xcodeproj/xcshareddata/xcschemes/web3swift-iOS.xcscheme b/web3swift.xcodeproj/xcshareddata/xcschemes/web3swift-iOS.xcscheme index 7ebe425f..5195f088 100644 --- a/web3swift.xcodeproj/xcshareddata/xcschemes/web3swift-iOS.xcscheme +++ b/web3swift.xcodeproj/xcshareddata/xcschemes/web3swift-iOS.xcscheme @@ -1,6 +1,6 @@ @@ -56,7 +55,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/web3swift.xcodeproj/xcshareddata/xcschemes/web3swift_Tests.xcscheme b/web3swift.xcodeproj/xcshareddata/xcschemes/web3swift_Tests.xcscheme index 88ece48b..05b9dd51 100644 --- a/web3swift.xcodeproj/xcshareddata/xcschemes/web3swift_Tests.xcscheme +++ b/web3swift.xcodeproj/xcshareddata/xcschemes/web3swift_Tests.xcscheme @@ -1,6 +1,6 @@ ) -> () in switch res { @@ -173,19 +173,14 @@ final class ContractSendOperation: Web3Operation { guard let gasEstimate = result as? BigUInt else { return self.processError(Web3Error.dataError) } - if mergedOptions.gasLimit == nil { - mergedOptions.gasLimit = gasEstimate - } else { - if (mergedOptions.gasLimit! < gasEstimate) { - if (options?.gasLimit != nil && options!.gasLimit != nil && options!.gasLimit! >= gasEstimate) { - mergedOptions.gasLimit = options!.gasLimit! - } else { - return self.processError(Web3Error.inputError("Estimated gas is larger than the gas limit")) - } - } + guard let gasEstimateMerged = Web3Options.smartMergeGasLimit(originalOptions: intermediate.options, extraOptions: options, gasEstimage: gasEstimate) else { + return self.processError(Web3Error.inputError("Estimated gas is larger than the gas limit")) } - intermediate.transaction = transaction + mergedOptions.gasLimit = gasEstimateMerged + let transaction = intermediate.transaction + intermediate.transaction = transaction.mergedWithOptions(mergedOptions) intermediate.options = mergedOptions + let sendOp = SendTransactionOperation.init(self.web3, queue: self.expectedQueue, transactionIntermediate: intermediate, password: password) sendOp.next = completion self.expectedQueue.addOperation(sendOp) @@ -201,6 +196,7 @@ final class ContractSendOperation: Web3Operation { guard let nonce = result as? BigUInt else { return self.processError(Web3Error.dataError) } + var transaction = intermediate.transaction if self.web3.provider.network != nil { transaction.chainID = self.web3.provider.network?.chainID } @@ -224,7 +220,8 @@ final class ContractSendOperation: Web3Operation { if mergedOptions.gasPrice == nil { mergedOptions.gasPrice = gasPrice } - intermediate.transaction = transaction + let transaction = intermediate.transaction + intermediate.transaction = transaction.mergedWithOptions(mergedOptions) intermediate.options = mergedOptions let nonceOp = GetTransactionCountOperation.init(self.web3, queue: self.expectedQueue, address: from, onBlock: onBlock) diff --git a/web3swift/Convenience/Classes/Data+Extension.swift b/web3swift/Convenience/Classes/Data+Extension.swift index 22155640..aaff52de 100644 --- a/web3swift/Convenience/Classes/Data+Extension.swift +++ b/web3swift/Convenience/Classes/Data+Extension.swift @@ -41,10 +41,11 @@ public extension Data { } } public static func randomBytes(length: Int) -> Data? { - var data = Data(count: length) for _ in 0...1024 { + var data = Data(repeating: 0, count: length) let result = data.withUnsafeMutableBytes { - SecRandomCopyBytes(kSecRandomDefault, data.count, $0) + (mutableBytes: UnsafeMutablePointer) -> Int32 in + SecRandomCopyBytes(kSecRandomDefault, 32, mutableBytes) } if result == errSecSuccess { return data diff --git a/web3swift/Transaction/Classes/EthereumTransaction.swift b/web3swift/Transaction/Classes/EthereumTransaction.swift index ab3052f1..88594b5c 100644 --- a/web3swift/Transaction/Classes/EthereumTransaction.swift +++ b/web3swift/Transaction/Classes/EthereumTransaction.swift @@ -90,6 +90,23 @@ public struct EthereumTransaction: CustomStringConvertible { self.s = s } + public func mergedWithOptions(_ options: Web3Options) -> EthereumTransaction { + var tx = self; + if options.gasPrice != nil { + tx.gasPrice = options.gasPrice! + } + if options.gasLimit != nil { + tx.gasLimit = options.gasLimit! + } + if options.value != nil { + tx.value = options.value! + } + if options.to != nil { + tx.to = options.to! + } + return tx + } + public var description: String { get { var toReturn = "" @@ -320,7 +337,7 @@ public struct EthereumTransaction: CustomStringConvertible { request.method = method guard let from = options?.from else {return nil} guard var txParams = transaction.encodeAsDictionary(from: from) else {return nil} - if options?.gasLimit == nil { + if method == .estimateGas || options?.gasLimit == nil { txParams.gas = nil } var params = [txParams] as Array diff --git a/web3swift/Web3/Classes/Web3+Eth.swift b/web3swift/Web3/Classes/Web3+Eth.swift index 069741a3..4fc45746 100644 --- a/web3swift/Web3/Classes/Web3+Eth.swift +++ b/web3swift/Web3/Classes/Web3+Eth.swift @@ -707,6 +707,13 @@ extension web3.Eth { return sendETH(to: to, amount: value, extraData: extraData, options: options) } + public func sendETH(from: EthereumAddress, to: EthereumAddress, amount: String, units: Web3.Utils.Units = .eth, extraData: Data = Data(), options: Web3Options? = nil) -> TransactionIntermediate? { + guard let value = Web3.Utils.parseToBigUInt(amount, units: .eth) else {return nil} + guard var mergedOptions = Web3Options.merge(self.options, with: options) else {return nil} + mergedOptions.from = from + return sendETH(to: to, amount: value, extraData: extraData, options: mergedOptions) + } + public func sendERC20tokensWithKnownDecimals(tokenAddress: EthereumAddress, from: EthereumAddress, to: EthereumAddress, amount: BigUInt, options: Web3Options? = nil) -> TransactionIntermediate? { let contract = self.web3.contract(Web3.Utils.erc20ABI, at: tokenAddress, abiVersion: 2) guard var mergedOptions = Web3Options.merge(self.options, with: options) else {return nil} diff --git a/web3swift/Web3/Classes/Web3+Options.swift b/web3swift/Web3/Classes/Web3+Options.swift index 89412064..5dddfdfc 100644 --- a/web3swift/Web3/Classes/Web3+Options.swift +++ b/web3swift/Web3/Classes/Web3+Options.swift @@ -81,4 +81,21 @@ public struct Web3Options { } return newOptions } + + public static func smartMergeGasLimit(originalOptions: Web3Options?, extraOptions: Web3Options?, gasEstimage: BigUInt) -> BigUInt? { + guard let mergedOptions = Web3Options.merge(originalOptions, with: extraOptions) else {return nil} //just require any non-nils + if mergedOptions.gasLimit == nil { + return nil // there is no opinion from user, so we can not proceed + } else { + if originalOptions != nil, originalOptions!.gasLimit != nil, originalOptions!.gasLimit! < gasEstimage { // original gas estimate was less than what's required, so we check extra options + if extraOptions != nil, extraOptions!.gasLimit != nil, extraOptions!.gasLimit! >= gasEstimage { + return extraOptions!.gasLimit! + } else { + return nil + } + } else { + return gasEstimage + } + } + } } diff --git a/web3swiftTests/web3swiftTests.swift b/web3swiftTests/web3swiftTests.swift index 2a057e3d..c83bdc5d 100644 --- a/web3swiftTests/web3swiftTests.swift +++ b/web3swiftTests/web3swiftTests.swift @@ -2376,6 +2376,36 @@ class web3swiftTests: XCTestCase { XCTAssert(ibn == "XE83FUTTUNPK7WZJSGGCWVEBARQWQ8YML4") } + func testSendETH() { + guard let keystoreData = getKeystoreData() else {return} + guard let keystoreV3 = EthereumKeystoreV3.init(keystoreData) else {return XCTFail()} + let web3Rinkeby = Web3.InfuraRinkebyWeb3() + let keystoreManager = KeystoreManager.init([keystoreV3]) + web3Rinkeby.addKeystoreManager(keystoreManager) + guard case .success(let gasPriceRinkeby) = web3Rinkeby.eth.getGasPrice() else {return} + let sendToAddress = EthereumAddress("0x6394b37Cf80A7358b38068f0CA4760ad49983a1B")! + guard let intermediate = web3Rinkeby.eth.sendETH(to: sendToAddress, amount: "0.001") else {return XCTFail()} + var options = Web3Options.defaultOptions() + options.from = keystoreV3.addresses?.first + options.gasPrice = gasPriceRinkeby + let result = intermediate.send(password: "BANKEXFOUNDATION", options: options) + switch result { + case .success(let res): + print(res) + case .failure(let error): + print(error) + XCTFail() + } + } + + + func getKeystoreData() -> Data? { + let bundle = Bundle(for: type(of: self)) + guard let path = bundle.path(forResource: "key", ofType: "json") else {return nil} + guard let data = NSData(contentsOfFile: path) else {return nil} + return data as Data + } + func testPerformanceExample() { // This is an example of a performance test case. self.measure {