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
Copy file name to clipboardExpand all lines: Documentation/Usage.md
+94-94Lines changed: 94 additions & 94 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,71 +7,71 @@
7
7
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
8
8
-[About source and GitHub repositories](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#about-source-and-github-repositories)
-[Preffered keys Wallet Model (Account)](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#preffered-keys-wallet-model-account)
-[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)
-[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)
59
59
60
60
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
61
61
62
62
## Introduction
63
63
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.
65
65
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.**
67
67
68
68
*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.*
69
69
70
70
### Preffered models
71
71
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.
73
73
74
-
#### Preffered keys Wallet Model (Account)
74
+
#### Preferred keys Wallet Model (Account)
75
75
76
76
```swift
77
77
structWallet {
@@ -120,10 +120,10 @@ let password = "web3swift"
120
120
let bitsOfEntropy: Int=128// Entropy is a measure of password strength. Usually used 128 or 256 bits.
121
121
let mnemonics =try! BIP39.generateMnemonics(bitsOfEntropy: bitsOfEntropy)!
122
122
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)!
127
127
let name ="New HD Wallet"
128
128
let keyData =try!JSONEncoder().encode(keystore.keystoreParams)
@@ -366,17 +366,17 @@ let blockNumber = try! web3.eth.getBlockNumber()
366
366
367
367
### Web3socketDelegate
368
368
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.
371
371
```swift
372
372
classDelegateClass: 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
375
375
376
-
// Protocol method, here will be messages, received from WebSocket server
377
-
funcreceived(message: Any) {
378
-
// Make something with message
379
-
}
376
+
// Protocol method, here will be messages, received from WebSocket server
0 commit comments