Skip to content

Commit

Permalink
Merge pull request #210 from matter-labs/develop
Browse files Browse the repository at this point in the history
2.2.1
  • Loading branch information
BaldyAsh authored Jun 24, 2019
2 parents d726437 + e94f2e1 commit 2e30580
Show file tree
Hide file tree
Showing 25 changed files with 1,385 additions and 193 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Change Log

## [Unreleased](https://github.com/matter-labs/web3swift/tree/HEAD)

[Full Changelog](https://github.com/matter-labs/web3swift/compare/2.2.0...HEAD)

**Closed issues:**

- EIP67Code missing in web3swift 2.1.6 [\#176](https://github.com/matter-labs/web3swift/issues/176)
- ENS initializer is inaccessible due to `internal` protection level [\#171](https://github.com/matter-labs/web3swift/issues/171)

**Merged pull requests:**

- Update ETHRegistrarController.swift [\#183](https://github.com/matter-labs/web3swift/pull/183) ([barrasso](https://github.com/barrasso))
- Fix typo in Usage [\#182](https://github.com/matter-labs/web3swift/pull/182) ([sweepty](https://github.com/sweepty))
- Expose errorDescription. [\#181](https://github.com/matter-labs/web3swift/pull/181) ([andresousa](https://github.com/andresousa))
- Update ENS Resolver [\#180](https://github.com/matter-labs/web3swift/pull/180) ([barrasso](https://github.com/barrasso))

## [2.2.0](https://github.com/matter-labs/web3swift/tree/2.2.0) (2019-04-30)
[Full Changelog](https://github.com/matter-labs/web3swift/compare/2.1.6...2.2.0)

**Closed issues:**

- Failed to fetch gas estimate [\#178](https://github.com/matter-labs/web3swift/issues/178)

**Merged pull requests:**

- 2.2.0 [\#179](https://github.com/matter-labs/web3swift/pull/179) ([BaldyAsh](https://github.com/BaldyAsh))

## [2.1.6](https://github.com/matter-labs/web3swift/tree/2.1.6) (2019-04-26)
[Full Changelog](https://github.com/matter-labs/web3swift/compare/2.1.5...2.1.6)

**Merged pull requests:**

- 2.1.6 [\#175](https://github.com/matter-labs/web3swift/pull/175) ([BaldyAsh](https://github.com/BaldyAsh))
- Quickfix ens [\#174](https://github.com/matter-labs/web3swift/pull/174) ([BaldyAsh](https://github.com/BaldyAsh))

## [2.1.5](https://github.com/matter-labs/web3swift/tree/2.1.5) (2019-04-24)
[Full Changelog](https://github.com/matter-labs/web3swift/compare/2.1.4...2.1.5)

Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "mxcl/PromiseKit" ~> 6.8.4
github "attaswift/BigInt" ~> 3.1
github "attaswift/BigInt" ~> 4.0
github "daltoniam/Starscream" ~> 3.1.0
github "krzyzanowskim/CryptoSwift" ~> 1.0.0
34 changes: 29 additions & 5 deletions Documentation/Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
- [Infura Websocket interactions](#infura-websocket-interactions)
- [Connect to Infura endpoint](#connect-to-infura-endpoint)
- [Connect to custom Infura-like endpoint](#connect-to-custom-infura-like-endpoint)
- [Create a filter in the node to notify when something happened](#create-a-filter-in-the-node-to-notify-when-something-happened)
- [Set a filter in the node to notify when something happened](#set-a-filter-in-the-node-to-notify-when-something-happened)
- [Get new pending transactions](#get-new-pending-transactions)
- [Create a new subscription over particular events](#create-a-new-subscription-over-particular-events)
- [Subscribe on new pending transactions](#subscribe-on-new-pending-transactions)
- [Subscribe on logs](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#subscribe-on-logs)
- [Subscribe on new heads](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#subscribe-on-new-heads)
- [ENS](#ens)
- [Registry](#registry)
- [Resolver](#resolver)
Expand Down Expand Up @@ -181,7 +183,7 @@ if wallet.isHD {
```swift
let password = "web3swift"
let ethereumAddress = EthereumAddress(wallet.address)!
let pkData = try! keysoreManager.UNSAFE_getPrivateKeyData(password: password, account: ethereumAddress).toHexString()
let pkData = try! keystoreManager.UNSAFE_getPrivateKeyData(password: password, account: ethereumAddress).toHexString()
```

## Ethereum Endpoints interaction
Expand Down Expand Up @@ -421,18 +423,28 @@ socketProvider = InfuraWebsocketProvider.connectToInfuraSocket(.Mainnet, delegat
socketProvider = InfuraWebsocketProvider.connectToSocket("ws://your.endpoint", delegate: delegate)
```

#### Create a filter in the node to notify when something happened
#### Set a filter in the node to notify when something happened

To study possible filters read [Infura WSS filters documentation](https://infura.io/docs/ethereum/wss/introduction)

```swift
try! socketProvider.filter(method: <InfuraWebsocketMethod>, params: <[Encodable]?>)
// Getting logs
try! socketProvider.setFilterAndGetLogs(method: <InfuraWebsocketMethod>, params: <[Encodable]?>)
// Getting changes
try! socketProvider.setFilterAndGetChanges(method: <InfuraWebsocketMethod>, params: <[Encodable]?>)
```
Or you can provide parameters in more convenient way:
```swift
// Getting logs
try! socketProvider.setFilterAndGetLogs(method: <InfuraWebsocketMethod>, address: <EthereumAddress?>, fromBlock: <BlockNumber?>, toBlock: <BlockNumber?>, topics: <[String]?>)
// Getting changes
try! socketProvider.setFilterAndGetChanges(method: <InfuraWebsocketMethod>, address: <EthereumAddress?>, fromBlock: <BlockNumber?>, toBlock: <BlockNumber?>, topics: <[String]?>)
```

#### Get new pending transactions

```swift
try! socketProvider.filter(method: .newPendingTransactionFilter)
try! socketProvider.setFilterAndGetLogs(method: .newPendingTransactionFilter)
```

#### Create a new subscription over particular events
Expand All @@ -449,6 +461,18 @@ try! socketProvider.subscribe(params: <[Encodable]>)
try! socketProvider.subscribeOnNewPendingTransactions()
```

#### Subscribe on logs

```swift
try! socketProvider.subscribeOnLogs(addresses: <[EthereumAddress]?>, topics: <[String]?>)
```

#### Subscribe on new heads

```swift
try! socketProvider.subscribeOnNewHeads()
```

## ENS

You need ENS instance for future actions:
Expand Down
Loading

0 comments on commit 2e30580

Please sign in to comment.