Skip to content

Commit 515f80e

Browse files
committed
update grammar & typos
1 parent ca224b9 commit 515f80e

File tree

2 files changed

+120
-120
lines changed

2 files changed

+120
-120
lines changed

Documentation/Usage.md

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -7,71 +7,71 @@
77
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
88
- [About source and GitHub repositories](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#about-source-and-github-repositories)
99

10-
- [Introduction](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#introduction)
11-
- [Preffered models](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#preffered-models)
12-
- [Preffered keys Wallet Model (Account)](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#preffered-keys-wallet-model-account)
13-
- [Preffered ERC-20 Model](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#preffered-erc-20-model)
14-
- [Account Management](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#account-management)
15-
- [Create Account](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#create-account)
16-
- [With Private Key](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#with-private-key)
17-
- [With Mnemonics Phrase](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#with-mnemonics-phrase)
18-
- [Import Account](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#import-account)
19-
- [With Private Key](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#with-private-key-1)
20-
- [With Mnemonics Phrase](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#with-mnemonics-phrase-1)
21-
- [Get Keystore Manager from wallet data](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#get-keystore-manager-from-wallet-data)
22-
- [Get wallet private key](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#get-wallet-private-key)
23-
- [Ethereum Endpoints interaction](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#ethereum-endpoints-interaction)
24-
- [web3 instance](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#web3-instance)
25-
- [Ethereum Address](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#ethereum-address)
26-
- [Initializing](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#initializing)
27-
- [Get Balance](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#get-balance)
28-
- [Get ETH balance](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#get-eth-balance)
29-
- [Get ERC20 token balance](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#get-erc20-token-balance)
30-
- [Transactions Operations](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#transactions-operations)
31-
- [Prepare Transaction](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#prepare-transaction)
32-
- [Send Ether](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#send-ether)
33-
- [Send ERC-20 Token](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#send-erc-20-token)
34-
- [Write Transaction and call smart contract method](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#write-transaction-and-call-smart-contract-method)
35-
- [Read Transaction to call smart contract method](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#read-transaction-to-call-smart-contract-method)
36-
- [Send Transaction](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#send-transaction)
37-
- [Write](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#write)
38-
- [Read](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#read)
39-
- [Chain state](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#chain-state)
40-
- [Get Block number](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#get-block-number)
41-
- [Websockets](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#websockets)
42-
- [Web3socketDelegate](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#web3socketdelegate)
43-
- [Custom Websocket Provider](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#custom-websocket-provider)
44-
- [Connect to custom endpoint](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#connect-to-custom-endpoint)
45-
- [Send message](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#send-message)
46-
- [Infura Websocket interactions](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#infura-websocket-interactions)
47-
- [Connect to Infura endpoint](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#connect-to-infura-endpoint)
48-
- [Connect to custom Infura-like endpoint](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#connect-to-custom-infura-like-endpoint)
49-
- [Create a filter in the node to notify when something happened](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#create-a-filter-in-the-node-to-notify-when-something-happened)
50-
- [Get new pending transactions](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#get-new-pending-transactions)
51-
- [Create a new subscription over particular events](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#create-a-new-subscription-over-particular-events)
52-
- [Subscribe on new pending transactions](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#subscribe-on-new-pending-transactions)
53-
- [ENS](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#ens)
54-
- [Registry](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#registry)
55-
- [Resolver](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#resolver)
56-
- [BaseRegistrar](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#baseregistrar)
57-
- [RegistrarController](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#registrarcontroller)
58-
- [ReverseRegistrar](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#reverseregistrar)
10+
- [Introduction](#introduction)
11+
- [Preffered models](#preffered-models)
12+
- [Preferred keys Wallet Model (Account)](#preferred-keys-wallet-model-account)
13+
- [Preffered ERC-20 Model](#preffered-erc-20-model)
14+
- [Account Management](#account-management)
15+
- [Create Account](#create-account)
16+
- [With Private Key](#with-private-key)
17+
- [With Mnemonics Phrase](#with-mnemonics-phrase)
18+
- [Import Account](#import-account)
19+
- [With Private Key](#with-private-key-1)
20+
- [With Mnemonics Phrase](#with-mnemonics-phrase-1)
21+
- [Get Keystore Manager from wallet data](#get-keystore-manager-from-wallet-data)
22+
- [Get private key](#get-private-key)
23+
- [Ethereum Endpoints interaction](#ethereum-endpoints-interaction)
24+
- [web3 instance](#web3-instance)
25+
- [Ethereum Address](#ethereum-address)
26+
- [Initializing](#initializing)
27+
- [Get Balance](#get-balance)
28+
- [Get ETH balance](#get-eth-balance)
29+
- [Get ERC20 token balance](#get-erc20-token-balance)
30+
- [Transactions Operations](#transactions-operations)
31+
- [Prepare Transaction](#prepare-transaction)
32+
- [Send Ether](#send-ether)
33+
- [Send ERC-20 Token](#send-erc-20-token)
34+
- [Write Transaction and call smart contract method](#write-transaction-and-call-smart-contract-method)
35+
- [Read Transaction to call smart contract method](#read-transaction-to-call-smart-contract-method)
36+
- [Send Transaction](#send-transaction)
37+
- [Write](#write)
38+
- [Read](#read)
39+
- [Chain state](#chain-state)
40+
- [Get Block number](#get-block-number)
41+
- [Websockets](#websockets)
42+
- [Web3socketDelegate](#web3socketdelegate)
43+
- [Custom Websocket Provider](#custom-websocket-provider)
44+
- [Connect to custom endpoint](#connect-to-custom-endpoint)
45+
- [Send message](#send-message)
46+
- [Infura Websocket interactions](#infura-websocket-interactions)
47+
- [Connect to Infura endpoint](#connect-to-infura-endpoint)
48+
- [Connect to custom Infura-like endpoint](#connect-to-custom-infura-like-endpoint)
49+
- [Create a filter in the node to notify when something happened](#create-a-filter-in-the-node-to-notify-when-something-happened)
50+
- [Get new pending transactions](#get-new-pending-transactions)
51+
- [Create a new subscription over particular events](#create-a-new-subscription-over-particular-events)
52+
- [Subscribe on new pending transactions](#subscribe-on-new-pending-transactions)
53+
- [ENS](#ens)
54+
- [Registry](#registry)
55+
- [Resolver](#resolver)
56+
- [BaseRegistrar](#baseregistrar)
57+
- [RegistrarController](#registrarcontroller)
58+
- [ReverseRegistrar](#reverseregistrar)
5959

6060
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
6161

6262
## Introduction
6363

64-
To work with platforms based on blockchain technology, in particular with Ethereum-like blockchains, developer must be fluent in concepts such as a crypto wallet, private and public key, smart contract, token and others. We will use these concepts without explaining their meanings. For more information about Ethereum, we recommend reading the book [Mastering Ethereum](https://github.com/ethereumbook/ethereumbook), by Andreas M. Antonopoulos and Gavin Wood.
64+
To work with platforms based on blockchain technology, in particular with Ethereum-like blockchains, a developer must be fluent in concepts such as a crypto wallet, private and public key, smart contract, token and others. We will use these concepts without explaining their meanings. For more information about Ethereum, we recommend reading the book [Mastering Ethereum](https://github.com/ethereumbook/ethereumbook), by Andreas M. Antonopoulos and Gavin Wood.
6565

66-
**To create keystore we forced our users to use some password, which will be used in some operations, like transactions sending. We believe that security is important for such operations and this increases its level. You are free to use a pre-compiled password in your code, that is not set by the keystore user, at your own risk.**
66+
**To create keystore we forced our users to use some password, which will be used in some operations, like transactions sending. We believe that security is essential for such, and this increases its level. You are free to use a pre-compiled password in your code, that is not set by the keystore user, at your own risk.**
6767

6868
*In code examples we used force-unwrapped Swift optionals for better readability of example code. We recommend that you do not use this method to get rid of optional values.*
6969

7070
### Preffered models
7171

72-
To describe the library's capabilities, we will use the models described below, however you can use the models that are convenient for you.
72+
To describe the library's capabilities, we will use the models described below. However, you can use the models that are convenient for you.
7373

74-
#### Preffered keys Wallet Model (Account)
74+
#### Preferred keys Wallet Model (Account)
7575

7676
```swift
7777
struct Wallet {
@@ -120,10 +120,10 @@ let password = "web3swift"
120120
let bitsOfEntropy: Int = 128 // Entropy is a measure of password strength. Usually used 128 or 256 bits.
121121
let mnemonics = try! BIP39.generateMnemonics(bitsOfEntropy: bitsOfEntropy)!
122122
let keystore = try! BIP32Keystore(
123-
mnemonics: mnemonics,
124-
password: password,
125-
mnemonicsPassword: "",
126-
language: .english)!
123+
mnemonics: mnemonics,
124+
password: password,
125+
mnemonicsPassword: "",
126+
language: .english)!
127127
let name = "New HD Wallet"
128128
let keyData = try! JSONEncoder().encode(keystore.keystoreParams)
129129
let address = keystore.addresses!.first!.address
@@ -152,10 +152,10 @@ let wallet = Wallet(address: address, data: keyData, name: name, isHD: false)
152152
let password = "web3swift"
153153
let mnemonics = "fine have legal roof fury bread egg knee wrong idea must edit" // Some mnemonic phrase
154154
let keystore = try! BIP32Keystore(
155-
mnemonics: mnemonics,
156-
password: password,
157-
mnemonicsPassword: "",
158-
language: .english)!
155+
mnemonics: mnemonics,
156+
password: password,
157+
mnemonicsPassword: "",
158+
language: .english)!
159159
let name = "New HD Wallet"
160160
let keyData = try! JSONEncoder().encode(keystore.keystoreParams)
161161
let address = keystore.addresses!.first!.address
@@ -168,15 +168,15 @@ let wallet = Wallet(address: address, data: keyData, name: name, isHD: true)
168168
let data = wallet.data
169169
let keystoreManager: KeystoreManager
170170
if wallet.isHD {
171-
let keystore = BIP32Keystore(data)!
172-
keystoreManager = KeystoreManager([keystore])
171+
let keystore = BIP32Keystore(data)!
172+
keystoreManager = KeystoreManager([keystore])
173173
} else {
174-
let keystore = EthereumKeystoreV3(data)!
175-
keystoreManager = KeystoreManager([keystore])
174+
let keystore = EthereumKeystoreV3(data)!
175+
keystoreManager = KeystoreManager([keystore])
176176
}
177177
```
178178

179-
### Get wallet private key
179+
### Get private key
180180

181181
```swift
182182
let password = "web3swift"
@@ -237,10 +237,10 @@ options.gasPrice = .automatic
237237
options.gasLimit = .automatic
238238
let method = "balanceOf"
239239
let tx = contract.read(
240-
method,
241-
parameters: [exploredAddress] as [AnyObject],
242-
extraData: Data(),
243-
transactionOptions: options)!
240+
method,
241+
parameters: [exploredAddress] as [AnyObject],
242+
extraData: Data(),
243+
transactionOptions: options)!
244244
let tokenBalance = try! tx.call()
245245
let balanceBigUInt = tokenBalance["0"] as! BigUInt
246246
let balanceString = Web3.Utils.formatToEthereumUnits(balanceResult, toUnits: .eth, decimals: 3)!
@@ -264,10 +264,10 @@ options.from = walletAddress
264264
options.gasPrice = .automatic
265265
options.gasLimit = .automatic
266266
let tx = contract.write(
267-
"fallback",
268-
parameters: [AnyObject](),
269-
extraData: Data(),
270-
transactionOptions: options)!
267+
"fallback",
268+
parameters: [AnyObject](),
269+
extraData: Data(),
270+
transactionOptions: options)!
271271
```
272272

273273
##### Send ERC-20 Token
@@ -286,10 +286,10 @@ options.gasPrice = .automatic
286286
options.gasLimit = .automatic
287287
let method = "transfer"
288288
let tx = contract.write(
289-
method,
290-
parameters: [toAddress, amount] as [AnyObject],
291-
extraData: Data(),
292-
transactionOptions: options)!
289+
method,
290+
parameters: [toAddress, amount] as [AnyObject],
291+
extraData: Data(),
292+
transactionOptions: options)!
293293
```
294294

295295
##### Write Transaction and call smart contract method
@@ -311,10 +311,10 @@ options.from = walletAddress
311311
options.gasPrice = .automatic
312312
options.gasLimit = .automatic
313313
let tx = contract.write(
314-
contractMethod,
315-
parameters: parameters,
316-
extraData: extraData,
317-
transactionOptions: options)!
314+
contractMethod,
315+
parameters: parameters,
316+
extraData: extraData,
317+
transactionOptions: options)!
318318
```
319319

320320
##### Read Transaction to call smart contract method
@@ -333,10 +333,10 @@ options.from = walletAddress
333333
options.gasPrice = .automatic
334334
options.gasLimit = .automatic
335335
let tx = contract.read(
336-
contractMethod,
337-
parameters: parameters,
338-
extraData: extraData,
339-
transactionOptions: options)!
336+
contractMethod,
337+
parameters: parameters,
338+
extraData: extraData,
339+
transactionOptions: options)!
340340
```
341341

342342
#### Send Transaction
@@ -366,17 +366,17 @@ let blockNumber = try! web3.eth.getBlockNumber()
366366

367367
### Web3socketDelegate
368368

369-
To receive messages from endpoint you need to create a class that adopt to Web3SocketDelegate protocol.
370-
Later, in order to open a connection to WebSocket server, you will use socket provider (WebsocketProvider or InfuraWebsocketProvider). And we recommend you to make it a property, so it doesn't get deallocated right after being setup.
369+
To receive messages from endpoint you need to create a class that adopts to Web3SocketDelegate protocol.
370+
Later, to open a connection to WebSocket server, you will use socket provider (`WebsocketProvider` or `InfuraWebsocketProvider`). And we recommend you to make it a property, so it doesn't get deallocated right after being setup.
371371
```swift
372372
class DelegateClass: Web3SocketDelegate {
373-
var socketProvider: WebsocketProvider? = nil // WebSocket Provider
374-
var socketProvider: InfuraWebsocketProvider? = nil // Infura WebSocket Provider
373+
var socketProvider: WebsocketProvider? = nil // WebSocket Provider
374+
var socketProvider: InfuraWebsocketProvider? = nil // Infura WebSocket Provider
375375

376-
// Protocol method, here will be messages, received from WebSocket server
377-
func received(message: Any) {
378-
// Make something with message
379-
}
376+
// Protocol method, here will be messages, received from WebSocket server
377+
func received(message: Any) {
378+
// Make something with message
379+
}
380380
}
381381
```
382382

0 commit comments

Comments
 (0)