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
-[Connect to Infura endpoint](#connect-to-infura-endpoint)
48
48
-[Connect to custom Infura-like endpoint](#connect-to-custom-infura-like-endpoint)
49
49
-[Set a filter in the node to notify when something happened](#set-a-filter-in-the-node-to-notify-when-something-happened)
50
-
-[Get new pending transactions](#get-new-pending-transactions)
50
+
-[New filter](#new-filter)
51
+
-[Get filter changes](#get-filter-changes)
52
+
-[Get filter logs](#get-filter-logs)
53
+
-[Uninstall filter](#uninstall-filter)
51
54
-[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
-
- [Subscribe on logs](https://github.com/matter-labs/web3swift/blob/develop/Documentation/Usage.md#subscribe-on-logs)
54
-
- [Subscribe on new heads](https://github.com/matter-labs/web3swift/blob/develop/Documentation/Usage.md#subscribe-on-new-heads)
55
+
-[Subscribe on new pending transactions](#subscribe-on-new-pending-transactions)
56
+
-[Subscribe on logs](#subscribe-on-logs)
57
+
-[Subscribe on new heads](#subscribe-on-new-heads)
58
+
-[Subscribe on syncing](#subscribe-on-syncing)
59
+
-[Unsubscribe](#unsubscribe)
55
60
-[ENS](#ens)
56
61
-[Registry](#registry)
57
62
-[Resolver](#resolver)
@@ -402,17 +407,17 @@ let blockNumber = try! web3.eth.getBlockNumber()
402
407
403
408
### Web3socketDelegate
404
409
405
-
To receive messages from endpoint you need to create a class that adopts to Web3SocketDelegate protocol.
410
+
You can create a class that adopts to Web3SocketDelegate protocol in order to receive notifications about connection state or errors.
406
411
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.
407
412
```swift
408
-
classDelegateClass: Web3SocketDelegate {
409
-
var socketProvider: WebsocketProvider?=nil// WebSocket Provider
410
-
var socketProvider: InfuraWebsocketProvider?=nil//Infura WebSocket Provider
411
-
412
-
// Protocol method, here will be messages, received from WebSocket server
eth.getFilterLogsPromise(filterID: filterID).map { filterLogs in
509
+
// Use filterLogs
510
+
}
511
+
}
512
+
```
513
+
514
+
##### Uninstall filter
515
+
516
+
```swift
517
+
filterPromise.map { filterID in
518
+
eth.uninstallFilterPromise(filterID: filterID).map { isUninstalled in
519
+
// Use isUninstalled
520
+
}
521
+
}
482
522
```
483
523
484
524
#### Create a new subscription over particular events
485
525
486
-
To study possible subscriptions read [Infura WSS subscriptions documentation](https://infura.io/docs/ethereum/wss/eth_subscribe)
526
+
To study possible subscriptions read [Infura WSS subscriptions documentation](https://docs.infura.io/infura/networks/ethereum/json-rpc-methods/subscription-methods)
0 commit comments