@@ -76,12 +76,12 @@ class ViewController: UIViewController {
76
76
let encoding = eip67Data. toImage ( scale: 10.0 )
77
77
self . imageView. image = UIImage ( ciImage: encoding)
78
78
self . imageView. contentMode = . scaleAspectFit
79
- //Send on Rinkeby
79
+
80
+ //Send on Rinkeby using normal keystore
80
81
81
82
let web3Rinkeby = Web3 . InfuraRinkebyWeb3 ( )
82
83
web3Rinkeby. addKeystoreManager ( keystoreManager)
83
84
let coldWalletABI = " [{ \" payable \" :true, \" type \" : \" fallback \" }] "
84
-
85
85
options = Web3Options . defaultOptions ( )
86
86
options. gasLimit = BigUInt ( 21000 )
87
87
options. from = ks? . addresses? . first!
@@ -101,13 +101,24 @@ class ViewController: UIViewController {
101
101
guard case . success( let sendingResult) = sendResult else { return }
102
102
let txid = sendingResult [ " txhash " ] as? String
103
103
print ( " On Rinkeby TXid = " + txid!)
104
-
104
+
105
+ //Send ETH on Rinkeby using BIP32 keystore. Should fail due to insufficient balance
106
+ web3Rinkeby. addKeystoreManager ( bip32keystoreManager)
107
+ options. from = bip32ks? . addresses? . first!
108
+ intermediateSend = web3Rinkeby. contract ( coldWalletABI, at: coldWalletAddress, abiVersion: 2 ) !. method ( options: options) !
109
+ let sendResultBip32 = intermediateSend. send ( password: " BANKEXFOUNDATION " )
110
+ switch sendResultBip32 {
111
+ case . success( let r) :
112
+ print ( r)
113
+ case . failure( let err) :
114
+ print ( err)
115
+ }
116
+
105
117
//Balance on Rinkeby
106
118
let balanceResult = web3Rinkeby. eth. getBalance ( address: coldWalletAddress)
107
119
guard case . success( let balance) = balanceResult else { return }
108
120
print ( " Balance of " + coldWalletAddress. address + " = " + String( balance) )
109
-
110
-
121
+
111
122
// Send mutating transaction taking parameters
112
123
let testABIonRinkeby = " [{ \" constant \" :true, \" inputs \" :[], \" name \" : \" counter \" , \" outputs \" :[{ \" name \" : \" \" , \" type \" : \" uint8 \" }], \" payable \" :false, \" stateMutability \" : \" view \" , \" type \" : \" function \" },{ \" constant \" :false, \" inputs \" :[{ \" name \" : \" _value \" , \" type \" : \" uint8 \" }], \" name \" : \" increaseCounter \" , \" outputs \" :[], \" payable \" :false, \" stateMutability \" : \" nonpayable \" , \" type \" : \" function \" },{ \" inputs \" :[], \" payable \" :false, \" stateMutability \" : \" nonpayable \" , \" type \" : \" constructor \" }] "
113
124
let deployedTestAddress = EthereumAddress ( " 0x1e528b190b6acf2d7c044141df775c7a79d68eba " )
0 commit comments