Skip to content

Commit

Permalink
prepare for pod release
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Vlasov committed Dec 21, 2017
1 parent 1263d70 commit 8508c68
Show file tree
Hide file tree
Showing 20 changed files with 340 additions and 337 deletions.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2017 shamatar <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# web3swift

[![Version](https://img.shields.io/cocoapods/v/web3swift.svg?style=flat)](http://cocoapods.org/pods/web3swift)
[![License](https://img.shields.io/cocoapods/l/web3swift.svg?style=flat)](http://cocoapods.org/pods/web3swift)
[![Platform](https://img.shields.io/cocoapods/p/web3swift.svg?style=flat)](http://cocoapods.org/pods/web3swift)

## Example

To run the example project, clone the repo, and run `pod install` from the web3swift_Demo directory first.

## Requirements

## Installation

web3swift is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'web3swift'
```

## Author

Alex Vlasov, @shamatar, [email protected]

## License

web3swift is available under the MIT license. See the LICENSE file for more info.
18 changes: 9 additions & 9 deletions web3Swift-Demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class ViewController: UIViewController {
options.gasPrice = BigUInt(25000000000)
options.from = EthereumAddress("0xE6877A4d8806e9A9F12eB2e8561EA6c1db19978d")
let parameters = [] as [AnyObject]
guard let web3 = Web3.newWeb3() else {return}
let contract = web3.contract(jsonString, at: constractAddress)
let web3main = Web3.InfuraMainnetWeb3()
let contract = web3main.contract(jsonString, at: constractAddress)
let intermediate = contract?.method("name", parameters:parameters, options: options)
let result = try await((intermediate?.call(options: options, network: .Mainnet))!)
let result = try await((intermediate?.call(options: options))!)
print(result)
let userDir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let keystoreManager = try KeystoreManagerV3(userDir + "/keystore")
Expand Down Expand Up @@ -79,26 +79,26 @@ class ViewController: UIViewController {
// }
// let res = try await((intermediateSend?.send(network: .Rinkeby))!)
// print(res)

let web3 = Web3.InfuraRinkebyWeb3()
let coldWalletABI = "[{\"payable\":true,\"type\":\"fallback\"}]"
let coldWalletAddress = EthereumAddress("0x6394b37Cf80A7358b38068f0CA4760ad49983a1B")
options = Web3Options.defaultOptions()
options.gas = BigUInt(21000)
options.from = ks?.address!
options.value = BigUInt(1000000000000000)
let gasPrice = try await((web3.contract(coldWalletABI, at: coldWalletAddress)?.method(options: options)?.estimateGas(options: nil, network: .Rinkeby))!)
let nonce = try await(web3.getNonce(sender, network: .Rinkeby))
let gasPrice = try await((web3.contract(coldWalletABI, at: coldWalletAddress)?.method(options: options)?.estimateGas(options: nil))!)
let nonce = try await(web3.eth.getTransactionCount(address: sender))
var intermediateSend = web3.contract(coldWalletABI, at: coldWalletAddress)?.method(options: options)
try intermediateSend?.setNonce(nonce!, network: .Rinkeby)
intermediateSend = try ks!.signIntermediate(intermediate: intermediateSend!, password: "BANKEXFOUNDATION", network: .Rinkeby)
try intermediateSend?.setNonce(nonce!)
intermediateSend = try ks!.signIntermediate(intermediate: intermediateSend!, password: "BANKEXFOUNDATION")
let derivedSender = intermediateSend?.transaction.sender
if (derivedSender?.address != sender.address) {
print(derivedSender!.address)
print(sender.address)
print("Address mismatch")
// return
}
let res = try await((intermediateSend?.send(network: .Rinkeby))!)
let res = try await((intermediateSend?.send())!)
print(res)
}
catch{
Expand Down
190 changes: 0 additions & 190 deletions web3swift.framework/Headers/web3swift-Swift.h

This file was deleted.

Binary file removed web3swift.framework/Info.plist
Binary file not shown.
4 changes: 0 additions & 4 deletions web3swift.framework/Modules/module.modulemap

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file removed web3swift.framework/web3swift
Binary file not shown.
28 changes: 28 additions & 0 deletions web3swift.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Pod::Spec.new do |s|
s.name = "secp256k1_ios"
s.version = "0.0.5"
s.summary = "Reference sepc256k1 implementation as pod"

s.description = <<-DESC
secp256k1 libraty portable pod
DESC

s.homepage = "https://github.com/shamatar/secp256k1_ios"
s.license = 'MIT'
s.author = { "Alex Vlasov" => "[email protected]" }
s.source = { :git => 'https://github.com/shamatar/secp256k1_ios.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/shamatar'

s.module_name = 'secp256k1_ios'
s.ios.deployment_target = "9.0"
s.osx.deployment_target = "10.10"
s.pod_target_xcconfig = {
'OTHER_CFLAGS' => '-DHAVE_CONFIG_H=1',
'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/secp256k1_ios/secp256k1_ios/"'
}
s.source_files = "secp256k1_ios/**/*.{h,c}",
s.private_header_files = "secp256k1_ios/*.h", "secp256k1_ios/**/*.h"
s.public_header_files = "secp256k1_ios/include/secp256k1.h", "secp256k1_ios/include/secp256k1_recovery.h", "secp256k1_ios/include/secp256k1_ecdh.h"


end
12 changes: 12 additions & 0 deletions web3swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
1CE976C21FDDF9F40005D4B0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1CE976C01FDDF9F40005D4B0 /* LaunchScreen.storyboard */; };
596FE0DC120FD38AFF91C915 /* Pods_web3swift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 18E81592D2802B9F4E200823 /* Pods_web3swift.framework */; };
8104E2281FE82BDC00F952CB /* Web3+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8104E2271FE82BDC00F952CB /* Web3+Utils.swift */; };
810B0F9A1FEC446B00CF0DA2 /* Web3+JSONRPC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 810B0F991FEC446B00CF0DA2 /* Web3+JSONRPC.swift */; };
810B0F9C1FEC520500CF0DA2 /* Web3+Methods.swift in Sources */ = {isa = PBXBuildFile; fileRef = 810B0F9B1FEC520500CF0DA2 /* Web3+Methods.swift */; };
810B0F9E1FEC5B9C00CF0DA2 /* Web3+Eth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 810B0F9D1FEC5B9C00CF0DA2 /* Web3+Eth.swift */; };
8113D2C41FD7E1590074282C /* SodiumExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8113D2B01FD7E1590074282C /* SodiumExtensions.swift */; };
8113D2C61FD7E1590074282C /* LibSecp256k1Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8113D2B21FD7E1590074282C /* LibSecp256k1Extension.swift */; };
8113D2C71FD7E1590074282C /* DictionaryLiteralJSONSerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8113D2B31FD7E1590074282C /* DictionaryLiteralJSONSerializer.swift */; };
Expand Down Expand Up @@ -97,6 +100,9 @@
45EF5FB62CEF5D014C559D8E /* Pods-web3Swift-Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-web3Swift-Demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-web3Swift-Demo/Pods-web3Swift-Demo.release.xcconfig"; sourceTree = "<group>"; };
5EF0EBFF98DF0E56B960D7FF /* Pods-web3Swift-Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-web3Swift-Demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-web3Swift-Demo/Pods-web3Swift-Demo.debug.xcconfig"; sourceTree = "<group>"; };
8104E2271FE82BDC00F952CB /* Web3+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+Utils.swift"; sourceTree = "<group>"; };
810B0F991FEC446B00CF0DA2 /* Web3+JSONRPC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+JSONRPC.swift"; sourceTree = "<group>"; };
810B0F9B1FEC520500CF0DA2 /* Web3+Methods.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+Methods.swift"; sourceTree = "<group>"; };
810B0F9D1FEC5B9C00CF0DA2 /* Web3+Eth.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Web3+Eth.swift"; sourceTree = "<group>"; };
8113D2B01FD7E1590074282C /* SodiumExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SodiumExtensions.swift; sourceTree = "<group>"; };
8113D2B21FD7E1590074282C /* LibSecp256k1Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibSecp256k1Extension.swift; sourceTree = "<group>"; };
8113D2B31FD7E1590074282C /* DictionaryLiteralJSONSerializer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DictionaryLiteralJSONSerializer.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -315,6 +321,9 @@
818ABD5C1FE95FC9002657BB /* Web3+Contract.swift */,
8104E2271FE82BDC00F952CB /* Web3+Utils.swift */,
818ABD581FE95558002657BB /* Web3+Infura.swift */,
810B0F991FEC446B00CF0DA2 /* Web3+JSONRPC.swift */,
810B0F9B1FEC520500CF0DA2 /* Web3+Methods.swift */,
810B0F9D1FEC5B9C00CF0DA2 /* Web3+Eth.swift */,
);
path = Classes;
sourceTree = "<group>";
Expand Down Expand Up @@ -664,12 +673,15 @@
8113D2CB1FD7E1590074282C /* ABIEncoder.swift in Sources */,
818EABDA1FDC9A5C00E013FC /* Contract.swift in Sources */,
818ABD591FE95558002657BB /* Web3+Infura.swift in Sources */,
810B0F9A1FEC446B00CF0DA2 /* Web3+JSONRPC.swift in Sources */,
8113D2C61FD7E1590074282C /* LibSecp256k1Extension.swift in Sources */,
8113D2C41FD7E1590074282C /* SodiumExtensions.swift in Sources */,
818ABD5B1FE95F8F002657BB /* Web3+Instance.swift in Sources */,
8113D2CC1FD7E1590074282C /* ABIDecoder.swift in Sources */,
810B0F9C1FEC520500CF0DA2 /* Web3+Methods.swift in Sources */,
8113DE7C1FD8514400CD8DF1 /* NSRegularExpressionExtension.swift in Sources */,
8104E2281FE82BDC00F952CB /* Web3+Utils.swift in Sources */,
810B0F9E1FEC5B9C00CF0DA2 /* Web3+Eth.swift in Sources */,
818D810E1FDC1A2000663CE3 /* RLP.swift in Sources */,
81531AA01FE7C07A002192CC /* EthereumKeystoreV3.swift in Sources */,
81DDECCF1FDF004E0063684A /* Web3.swift in Sources */,
Expand Down
3 changes: 0 additions & 3 deletions web3swift/Contract/Classes/Contract.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,4 @@ public struct Contract {
let transaction = EthereumTransaction(nonce: nonce, gasPrice: gasPrice, gasLimit: gas, to: to, value: value, data: encodedData, v: chainID, r: BigUInt(0), s: BigUInt(0))
return transaction
}



}
Loading

0 comments on commit 8508c68

Please sign in to comment.