Skip to content

Commit

Permalink
Version 0.0.1. Tests are broken due to refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Vlasov committed Dec 19, 2017
1 parent d3c8b39 commit c1429ca
Show file tree
Hide file tree
Showing 34 changed files with 2,852 additions and 1,906 deletions.
4 changes: 4 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ target 'web3swift' do
target 'web3swiftTests' do
inherit! :search_paths
end
target 'web3Swift-Demo' do
inherit! :search_paths
end

end
6 changes: 3 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PODS:
- PromiseKit/UIKit (4.5.0):
- PromiseKit/CorePromise
- SipHash (1.2.0)
- Sodium (0.5)
- Sodium (0.6)

DEPENDENCIES:
- Alamofire (~> 4.5)
Expand All @@ -41,8 +41,8 @@ SPEC CHECKSUMS:
libsodium: 9a8faa5ef2fa0d2d57bd7f7d79bf8fb7c1a9f0ea
PromiseKit: 9c1d9f6d7b65e3951a90bea7f407c56972be5d8e
SipHash: c6e9e43e9c531b5bc6602545130c26194a6d31ce
Sodium: a3a17f2ba2dc1b83547e13db0075e7c5d426fc55
Sodium: bf524b0a3d5ad6870dcf343205cca7e659c15ad5

PODFILE CHECKSUM: a78a0d9b5ec45a3b7151a0111b104aa26a516891
PODFILE CHECKSUM: 646d35c61c427c6244540da82e9a244e99954006

COCOAPODS: 1.3.1
6 changes: 3 additions & 3 deletions Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3,783 changes: 2,030 additions & 1,753 deletions Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Pods/Sodium/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Pods/Sodium/Sodium/Utils.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Pods/Sodium/Sodium/libsodium/crypto_scalarmult.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Pods/Sodium/Sodium/libsodium/crypto_scalarmult_curve25519.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Pods/Sodium/Sodium/libsodium/libsodium-ios.a
Binary file not shown.
3 changes: 3 additions & 0 deletions Pods/Sodium/Sodium/libsodium/runtime.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Pods/Sodium/Sodium/libsodium/sodium_lib.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Pods/Sodium/Sodium/libsodium/utils.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Pods/Target Support Files/Sodium/Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Pods/Target Support Files/libsodium/libsodium.modulemap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion web3Swift-Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
//

import UIKit
import Sodium
import CryptoSwift
import BigInt
import AwaitKit
import PromiseKit
import web3swift

@UIApplicationMain
Expand All @@ -15,7 +20,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
return true
}

Expand Down
26 changes: 25 additions & 1 deletion web3Swift-Demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
//

import UIKit
import Sodium
import CryptoSwift
import BigInt
import AwaitKit
import PromiseKit
import web3swift
import Foundation
//import web3swift

class ViewController: UIViewController {

Expand All @@ -26,6 +31,25 @@ class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
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\"},]"
async {
do {
let constractAddress = EthereumAddress("0x45245bc59219eeaaf6cd3f382e078a461ff9de7b")
var options = Web3Options()
options.gas = BigUInt(250000)
options.gasPrice = BigUInt(0)
options.from = EthereumAddress("0xE6877A4d8806e9A9F12eB2e8561EA6c1db19978d")
let parameters = [] as [AnyObject]
guard let web3 = Web3.newWeb3() else {return}
let contract = web3.contract(jsonString, at: constractAddress)
let intermediate = contract?.method("name", parameters:parameters, options: options)
let result = try await((intermediate?.call(options: options))!)
print(result)
}
catch{
print(error)
}
}
// Do any additional setup after loading the view, typically from a nib.
}

Expand Down
Loading

0 comments on commit c1429ca

Please sign in to comment.