Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslavyaroslav committed Nov 10, 2022
2 parents cf0855b + 173a3ba commit 4dbcb16
Show file tree
Hide file tree
Showing 31 changed files with 372 additions and 283 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/macOS-11.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/macOS-12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ on:
- unstable

env:
DEVELOPER_DIR: /Applications/Xcode_13.3.1.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer

jobs:
spm:
name: Swift Package Manager 5.5
name: Swift Package Manager 5.7
runs-on: macOS-12
concurrency:
group: spm-${{ github.run_id }}
Expand Down
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
**web3swift** is an iOS toolbelt for interaction with the Ethereum network.

## Social medias
[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!
[Join our discord](https://discord.gg/8bHCNmhS7x) or [Telegram](https://t.me/web3swift) if you need support or want to contribute to web3swift development!

![matter-github-swift](https://github.com/skywinder/web3swift/blob/develop/web3swift-logo.png)
[![Web3swift CI](https://github.com/skywinder/web3swift/actions/workflows/ci.yml/badge.svg)](https://github.com/skywinder/web3swift/actions/workflows/ci.yml)
Expand Down Expand Up @@ -49,13 +49,13 @@
- [x] :thought_balloon: Interaction with remote node via **JSON RPC**
- [x] 🔐 Local **keystore management** (`geth` compatible)
- [x] 🤖 Smart-contract **ABI parsing**
- [x] 🔓**ABI deconding** (V2 is supported with return of structures from public functions. Part of 0.4.22 Solidity compiler)
- [x] 🔓**ABI decoding** (V2 is supported with return of structures from public functions. Part of 0.4.22 Solidity compiler)
- [x] 🕸Ethereum Name Service **(ENS) support** - a secure & decentralised way to address resources both on and off the blockchain using simple, human-readable names
- [x] :arrows_counterclockwise: **Smart contracts interactions** (read/write)
- [x]**Infura support**
- [x]**Parsing TxPool** content into native values (ethereum addresses and transactions) - easy to get pending transactions
- [x] 🖇 **Event loops** functionality
- [x] 🕵️‍♂️ Possibility to **add or remove "middleware" that intercepts**, modifies and even **cancel transaction** workflow on stages "before assembly", "after assembly"and "before submission"
- [x] 🕵️‍♂️ Possibility to **add or remove "middleware" that intercepts**, modifies and even **cancel transaction** workflow on stages "before assembly", "after assembly" and "before submission"
- [x]**Literally following the standards** (BIP, EIP, etc):
- [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)**
- [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)
Expand Down Expand Up @@ -85,7 +85,6 @@ target '<Your Target Name>' do
use_frameworks!
pod 'web3swift'
end

```

Then, run the following command:
Expand Down Expand Up @@ -114,7 +113,7 @@ import Core
### Send Ether
```swift
let transaction: CodableTransaction = .emptyTransaction
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
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
transaction.value = value
transaction.gasLimitPolicy = .manual(78423)
transaction.gasPricePolicy = .manual(20000000000)
Expand Down Expand Up @@ -166,16 +165,30 @@ swift build
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.

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

## Support

**[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!**
**[Join our discord](https://discord.gg/8bHCNmhS7x) and [Telegram](https://t.me/web3swift) if you need support or want to contribute to web3swift development!**

- 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).
- If you'd like to **see web3swift best practices**, check [Projects that using web3swift](https://github.com/skywinder/web3swift/wiki/Our-Customers).
- If you **found a bug**, [open an issue](https://github.com/skywinder/web3swift/issues).

## Development
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.

```cli
// To install
$ npm install ganache --global
// To run
$ ganache
```

This will create a local blockchain and also some test accounts that are used throughout our tests.
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.

## Contribute
Want to improve? It's awesome:
Then good news for you: **We are ready to pay for your contribution via [@gitcoin bot](https://gitcoin.co/grants/358/web3swift)!**
Expand All @@ -202,8 +215,8 @@ We want to continue to do everything we can to move the needle forward.
## Credits

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

Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/EthereumABI/ABIDecoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ extension ABIDecoder {
let length = UInt64(BigUInt(dataSlice))
guard elementItself.count >= 32+length else {break}
dataSlice = elementItself[32 ..< 32 + length]
return (dataSlice as AnyObject, type.memoryUsage)
return (dataSlice as AnyObject, nextElementPointer)
case .array(type: let subType, length: let length):
switch type.arraySize {
case .dynamicSize:
Expand Down
15 changes: 0 additions & 15 deletions Sources/Core/Structure/Block/BlockNumber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,3 @@ extension BlockNumber: APIRequestParameterType {
try container.encode(description)
}
}

extension BlockNumber: Policyable {
public func resolve(provider: Web3Provider, transaction: CodableTransaction?) async throws -> BigUInt {
guard let transaction = transaction else { throw Web3Error.valueError }
switch self {
case .pending, .latest, .earliest:
guard let address = transaction.from ?? transaction.sender else { throw Web3Error.valueError }
let request: APIRequest = .getTransactionCount(address.address, transaction.callOnBlock ?? .latest)
let response: APIResponse<BigUInt> = try await APIRequest.sendRequest(with: provider, for: request)
return response.result
case .exact(let value):
return value
}
}
}
1 change: 1 addition & 0 deletions Sources/Core/Structure/Web3ProviderProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
public protocol Web3Provider {
var network: Networks? {get set}
var attachedKeystoreManager: KeystoreManager? {get set}
var policies: Policies {get set}
var url: URL {get}
var session: URLSession {get}
}
Loading

0 comments on commit 4dbcb16

Please sign in to comment.