Skip to content

Commit 4dbcb16

Browse files
Merge branch 'develop' into master
2 parents cf0855b + 173a3ba commit 4dbcb16

31 files changed

+372
-283
lines changed

.github/workflows/macOS-11.yml

-33
This file was deleted.

.github/workflows/macOS-12.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ on:
2222
- unstable
2323

2424
env:
25-
DEVELOPER_DIR: /Applications/Xcode_13.3.1.app/Contents/Developer
25+
DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
2626

2727
jobs:
2828
spm:
29-
name: Swift Package Manager 5.5
29+
name: Swift Package Manager 5.7
3030
runs-on: macOS-12
3131
concurrency:
3232
group: spm-${{ github.run_id }}

README.md

+22-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
**web3swift** is an iOS toolbelt for interaction with the Ethereum network.
33

44
## Social medias
5-
[Join our discord](https://discord.gg/8bHCNmhS7x) or [Telegram](https://t.me/web3swift) if you need a support or want to contribute to web3swift development!
5+
[Join our discord](https://discord.gg/8bHCNmhS7x) or [Telegram](https://t.me/web3swift) if you need support or want to contribute to web3swift development!
66

77
![matter-github-swift](https://github.com/skywinder/web3swift/blob/develop/web3swift-logo.png)
88
[![Web3swift CI](https://github.com/skywinder/web3swift/actions/workflows/ci.yml/badge.svg)](https://github.com/skywinder/web3swift/actions/workflows/ci.yml)
@@ -49,13 +49,13 @@
4949
- [x] :thought_balloon: Interaction with remote node via **JSON RPC**
5050
- [x] 🔐 Local **keystore management** (`geth` compatible)
5151
- [x] 🤖 Smart-contract **ABI parsing**
52-
- [x] 🔓**ABI deconding** (V2 is supported with return of structures from public functions. Part of 0.4.22 Solidity compiler)
52+
- [x] 🔓**ABI decoding** (V2 is supported with return of structures from public functions. Part of 0.4.22 Solidity compiler)
5353
- [x] 🕸Ethereum Name Service **(ENS) support** - a secure & decentralised way to address resources both on and off the blockchain using simple, human-readable names
5454
- [x] :arrows_counterclockwise: **Smart contracts interactions** (read/write)
5555
- [x]**Infura support**
5656
- [x]**Parsing TxPool** content into native values (ethereum addresses and transactions) - easy to get pending transactions
5757
- [x] 🖇 **Event loops** functionality
58-
- [x] 🕵️‍♂️ Possibility to **add or remove "middleware" that intercepts**, modifies and even **cancel transaction** workflow on stages "before assembly", "after assembly"and "before submission"
58+
- [x] 🕵️‍♂️ Possibility to **add or remove "middleware" that intercepts**, modifies and even **cancel transaction** workflow on stages "before assembly", "after assembly" and "before submission"
5959
- [x]**Literally following the standards** (BIP, EIP, etc):
6060
- [x] **[BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) (HD Wallets), [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) (Seed phrases), [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) (Key generation prefixes)**
6161
- [x] **[EIP-20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md)** (Standart interface for tokens - ERC-20), **[EIP-67](https://github.com/ethereum/EIPs/issues/67)** (Standard URI scheme), **[EIP-155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md)** (Replay attacks protection), **[EIP-2718](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2718.md)** (Typed Transaction Envelope), **[EIP-1559](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md)** (Gas Fee market change)
@@ -85,7 +85,6 @@ target '<Your Target Name>' do
8585
use_frameworks!
8686
pod 'web3swift'
8787
end
88-
8988
```
9089

9190
Then, run the following command:
@@ -114,7 +113,7 @@ import Core
114113
### Send Ether
115114
```swift
116115
let transaction: CodableTransaction = .emptyTransaction
117-
transaction.from = from ?? transaction.sender // `sender` one is if you have private key of your wallet address, so public key e.g. your wallet address could be infereted
116+
transaction.from = from ?? transaction.sender // `sender` one is if you have private key of your wallet address, so public key e.g. your wallet address could be interpreted
118117
transaction.value = value
119118
transaction.gasLimitPolicy = .manual(78423)
120119
transaction.gasPricePolicy = .manual(20000000000)
@@ -166,16 +165,30 @@ swift build
166165
Documentation is under construction👷🏻👷🏼‍♀️. We’re trying our best to comment all public API as detailed as we can, but the end it still far to come. But in one of the nearest minor updates we’ll bring DocC support of already done amount of docs. And your PR in such are more than welcome.
167166

168167
## Projects that are using web3swift
169-
Please take a look at [Our costumers](https://github.com/skywinder/web3swift/wiki/Our-Customers) wiki page.
168+
Please take a look at [Our customers](https://github.com/skywinder/web3swift/wiki/Our-Customers) wiki page.
170169

171170
## Support
172171

173-
**[Join our discord](https://discord.gg/8bHCNmhS7x) and [Telegram](https://t.me/web3swift) if you need a support or want to contribute to web3swift development!**
172+
**[Join our discord](https://discord.gg/8bHCNmhS7x) and [Telegram](https://t.me/web3swift) if you need support or want to contribute to web3swift development!**
174173

175174
- If you **need help**, please take a look at our [FAQ](https://github.com/skywinder/web3swift/wiki/FAQ "") or [open an issue](https://github.com/skywinder/web3swift/issues).
176175
- If you'd like to **see web3swift best practices**, check [Projects that using web3swift](https://github.com/skywinder/web3swift/wiki/Our-Customers).
177176
- If you **found a bug**, [open an issue](https://github.com/skywinder/web3swift/issues).
178177

178+
## Development
179+
To do local development and run the local tests, we recommend to use [ganache](https://github.com/trufflesuite/ganache) which is also used by CI when running github actions.
180+
181+
```cli
182+
// To install
183+
$ npm install ganache --global
184+
185+
// To run
186+
$ ganache
187+
```
188+
189+
This will create a local blockchain and also some test accounts that are used throughout our tests.
190+
Make sure that `ganache` is running on its default port `8546`. To change the port in test cases locate `LocalTestCase.swift` and modify the static `url` variable.
191+
179192
## Contribute
180193
Want to improve? It's awesome:
181194
Then good news for you: **We are ready to pay for your contribution via [@gitcoin bot](https://gitcoin.co/grants/358/web3swift)!**
@@ -202,8 +215,8 @@ We want to continue to do everything we can to move the needle forward.
202215
## Credits
203216

204217
- Alex Vlasov, [@shamatar](https://github.com/shamatar) - for the initial implementation
205-
- Petr Korolev, [@skywinder](https://github.com/skywinder) - botstrap and continous support
206-
- Anton Grigorev, [@baldyash](https://github.com/BaldyAsh) - core contributor, who use it and making a lot of ipmprovments
218+
- Petr Korolev, [@skywinder](https://github.com/skywinder) - bootstrap and continuous support
219+
- Anton Grigorev, [@baldyash](https://github.com/BaldyAsh) - core contributor, who use it and making a lot of improvements
207220
- Yaroslav Yashin [@yaroslavyaroslav](https://github.com/yaroslavyaroslav) - core contributor of 3.0.0 and later releases.
208221
- Thanks to [web3swift's growing list of contributors](https://github.com/skywinder/web3swift/graphs/contributors).
209222

Sources/Core/EthereumABI/ABIDecoding.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ extension ABIDecoder {
8585
let length = UInt64(BigUInt(dataSlice))
8686
guard elementItself.count >= 32+length else {break}
8787
dataSlice = elementItself[32 ..< 32 + length]
88-
return (dataSlice as AnyObject, type.memoryUsage)
88+
return (dataSlice as AnyObject, nextElementPointer)
8989
case .array(type: let subType, length: let length):
9090
switch type.arraySize {
9191
case .dynamicSize:

Sources/Core/Structure/Block/BlockNumber.swift

-15
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,3 @@ extension BlockNumber: APIRequestParameterType {
3939
try container.encode(description)
4040
}
4141
}
42-
43-
extension BlockNumber: Policyable {
44-
public func resolve(provider: Web3Provider, transaction: CodableTransaction?) async throws -> BigUInt {
45-
guard let transaction = transaction else { throw Web3Error.valueError }
46-
switch self {
47-
case .pending, .latest, .earliest:
48-
guard let address = transaction.from ?? transaction.sender else { throw Web3Error.valueError }
49-
let request: APIRequest = .getTransactionCount(address.address, transaction.callOnBlock ?? .latest)
50-
let response: APIResponse<BigUInt> = try await APIRequest.sendRequest(with: provider, for: request)
51-
return response.result
52-
case .exact(let value):
53-
return value
54-
}
55-
}
56-
}

Sources/Core/Structure/Web3ProviderProtocol.swift

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Foundation
1010
public protocol Web3Provider {
1111
var network: Networks? {get set}
1212
var attachedKeystoreManager: KeystoreManager? {get set}
13+
var policies: Policies {get set}
1314
var url: URL {get}
1415
var session: URLSession {get}
1516
}

0 commit comments

Comments
 (0)