Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit 9909ee6

Browse files
committed
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
1 parent 9928577 commit 9909ee6

20 files changed

+621
-199
lines changed

README.md

Lines changed: 13 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ Don't forget to set the iOS version in a Podfile, otherwise you get an error if
7373
```
7474

7575

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)
83+
### [Github Pages](https://bankex.github.io/web3swift)
84+
85+
#### 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+
7687
## Check this out
7788
- Private key and transaction were created directly on an iOS device and sent directly to [Infura](https://infura.io) node
7889
- Native API
@@ -112,11 +123,12 @@ On Rinkeby TXid = 0xc6eca60ecac004a1501a4323a10edb7fa4cd1a0896675f6b51704c84deda
112123

113124
## Example
114125
You can try it yourself by running the example project:
126+
115127
- Clone the repo
116128
- `cd Example/web3swiftExample`
117129
- run `pod install` from the `Example/web3swiftExample` directory.
118130
- `open ./web3swiftExample.xcworkspace`
119-
-
131+
120132
## Communication
121133
- if you ****need help****, use [Stack Overflow](https://stackoverflow.com/questions/tagged/web3swift) (tag 'web3swift')
122134
- 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:
136148
- [x] Manage user's private keys through encrypted keystore abstractions
137149
- [x] Batched requests in concurrent mode, checks balances of 580 tokens (from the latest MyEtherWallet repo) over 3 seconds
138150

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
160-
options.gasPrice = gasPrice
161-
options.gasLimit = gasLimit
162-
options.from = "0xE6877A4d8806e9A9F12eB2e8561EA6c1db19978d"
163-
```
164-
165-
### Getting ETH balance
166-
167-
```bash
168-
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 = try ERC20(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 = try BIP32Keystore(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"))
212-
}
213-
```
214-
215151
## Global plans
216152
- Full reference `web3js` functionality
217153
- Light Ethereum subprotocol (LES) integration

Sources/ABIv2/SolidityTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ To:
313313

314314

315315
Automatically converts uint to uint256.
316-
So return the same hash for
316+
So it will return the same hash for
317317
```
318318
"transfer(address,address,uint256)"
319319
```

0 commit comments

Comments
 (0)