You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 13, 2024. It is now read-only.
Updated KeystoreManager and fixed Carthage iOS version
Web3 KeystoreManager is not nullable anymore
You can also use `Web3.keystoreManager.append(keystore)`
Added AGuide class where you can check some guides
Fixed carthage iOS version #262
Copy file name to clipboardExpand all lines: README.md
+13-77Lines changed: 13 additions & 77 deletions
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,17 @@ Don't forget to set the iOS version in a Podfile, otherwise you get an error if
73
73
```
74
74
75
75
76
+
## Documentation
77
+
78
+
> Hi. We spend a lot of time working on documentation. If you have some questions after reading it just [open an issue](https://github.com/bankex/web3swift/issues) or ask in our [discord channel](https://discord.gg/3ETv2ST). We would be happy to answer you.
79
+
80
+
Most of the classes are documented and have some examples on how to use it.
81
+
82
+
### [Read documentation in using Xcode](Documentation/Read Documentation Using Xcode.md)
#### We would appreciate it if you translate our documentation into another language, and will be happy to provide you with all the necessary information on how to do this. We will compensate you for translations that will be included in the master branch.
86
+
76
87
## Check this out
77
88
- Private key and transaction were created directly on an iOS device and sent directly to [Infura](https://infura.io) node
78
89
- Native API
@@ -112,11 +123,12 @@ On Rinkeby TXid = 0xc6eca60ecac004a1501a4323a10edb7fa4cd1a0896675f6b51704c84deda
112
123
113
124
## Example
114
125
You can try it yourself by running the example project:
126
+
115
127
- Clone the repo
116
128
- `cd Example/web3swiftExample`
117
129
- run `pod install` from the `Example/web3swiftExample` directory.
118
130
- `open./web3swiftExample.xcworkspace`
119
-
-
131
+
120
132
## Communication
121
133
-if you ****need help****, use [Stack Overflow](https://stackoverflow.com/questions/tagged/web3swift) (tag 'web3swift')
122
134
- If you'd like to ****ask a general question****, use [Stack Overflow](https://stackoverflow.com/questions/tagged/web3swift).
@@ -136,82 +148,6 @@ You can try it yourself by running the example project:
136
148
- [x] Manage user's private keys through encrypted keystore abstractions
137
149
- [x] Batched requests in concurrent mode, checks balances of 580tokens (from the latest MyEtherWallet repo) over 3 seconds
138
150
139
-
## Usage
140
-
141
-
Here's a few use cases of our library
142
-
143
-
### Initializing Ethereum address
144
-
145
-
```bash
146
-
let coldWalletAddress: Address ="0x6394b37Cf80A7358b38068f0CA4760ad49983a1B"
147
-
let constractAddress: Address ="0x45245bc59219eeaaf6cd3f382e078a461ff9de7b"
148
-
```
149
-
Ethereum addresses are checksum checked if they are not lowercased and always length checked
150
-
151
-
### Setting options
152
-
153
-
```bash
154
-
var options = Web3Options.default
155
-
// public var to: Address? = nil - to what address transaction is aimed
156
-
// public var from: Address? = nil - form what address it should be sent (either signed locally or on the node)
157
-
// public var gasLimit: BigUInt? = BigUInt(90000) - default gas limit
158
-
// public var gasPrice: BigUInt? = BigUInt(5000000000) - default gas price, quite small
159
-
// public var value: BigUInt? = BigUInt(0) - amount of WEI sent along the transaction
let address: Address ="0xE6877A4d8806e9A9F12eB2e8561EA6c1db19978d"
169
-
let web3Main =Web3(infura: .mainnet)
170
-
let balance: BigUInt =try web3Main.eth.getBalance(address)
171
-
```
172
-
173
-
### Getting gas price
174
-
175
-
```bash
176
-
let web3Main =Web3(infura: .mainnet)
177
-
let gasPrice: BigUInt =try web3Main.eth.getGasPrice()
178
-
```
179
-
180
-
### Getting ERC20 token balance
181
-
182
-
```bash
183
-
let contractAddress: Address ="0x45245bc59219eeaaf6cd3f382e078a461ff9de7b"// BKX token on Ethereum mainnet
184
-
let balance =tryERC20(contractAddress).balance(of: "0x6394b37Cf80A7358b38068f0CA4760ad49983a1B")
185
-
print("BKX token balance = "+String(bal))
186
-
```
187
-
188
-
189
-
190
-
### Sending ETH
191
-
192
-
```bash
193
-
let mnemonics =Mnemonics()
194
-
let keystore =tryBIP32Keystore(mnemonics: mnemonics)
195
-
let keystoreManager =KeystoreManager([keystore])
196
-
let web3Rinkeby =Web3(infura: .rinkeby)
197
-
web3Rinkeby.addKeystoreManager(keystoreManager) // attach a keystore if you want to sign locally. Otherwise unsigned request will be sent to remote node
198
-
var options = Web3Options.default
199
-
options.from = keystore.addresses.first!// specify from what address you want to send it
200
-
let intermediateSend =try web3Rinkeby.contract(Web3Utils.coldWalletABI, at: coldWalletAddress).method(options: options) // an address with a private key attached in not different from any other address, just has very simple ABI
201
-
let sendResultBip32 =try intermediateSend.send(password: "BANKEXFOUNDATION")
202
-
```
203
-
204
-
205
-
206
-
### Sending ERC20
207
-
208
-
```bash
209
-
let web3 =Web3(infura: .rinkeby)
210
-
let erc20 =ERC20("0xa407dd0cbc9f9d20cdbd557686625e586c85b20a", from: yourAddress)
211
-
let result =try erc20.transfer(to: "0x6394b37Cf80A7358b38068f0CA4760ad49983a1B", amount: NaturalUnits("0.0001"))
0 commit comments