Skip to content

Commit 5e61fcc

Browse files
Merge branch 'develop' into clean-tests-output
2 parents 2147f84 + 8cffa32 commit 5e61fcc

File tree

178 files changed

+1905
-1024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+1905
-1024
lines changed

.github/pull_request_template.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## **Summary of Changes**
2+
3+
Fixes # _(if applicable - add the number of issue this PR addresses)_
4+
5+
## **Test Data or Screenshots**
6+
7+
###### _By submitting this pull request, you are confirming the following:_
8+
9+
- I have reviewed the [Contribution Guidelines](https://github.com/web3swift-team/web3swift/blob/develop/CONTRIBUTION.md).
10+
- I have performed a self-review of my own code.
11+
- I have updated my repository to match the `develop` branch.
12+
- I have included test data or screenshots that prove my fix is effective or that my feature works.
13+
- I have checked that all tests work and swiftlint is not throwing any errors/warnings.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ let package = Package(
1818
targets: [
1919
.target(name: "secp256k1"),
2020
.target(
21-
name: "Core",
21+
name: "Web3Core",
2222
dependencies: ["BigInt", "secp256k1", "CryptoSwift"]
2323
),
2424
.target(
2525
name: "web3swift",
26-
dependencies: ["Core", "BigInt", "secp256k1"],
26+
dependencies: ["Web3Core", "BigInt", "secp256k1"],
2727
resources: [
2828
.copy("./Browser/browser.js"),
2929
.copy("./Browser/browser.min.js"),

README.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
## Social medias
55
[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

7-
![matter-github-swift](https://github.com/skywinder/web3swift/blob/develop/web3swift-logo.png)
8-
[![Web3swift CI](https://github.com/skywinder/web3swift/actions/workflows/ci.yml/badge.svg)](https://github.com/skywinder/web3swift/actions/workflows/ci.yml)
7+
![matter-github-swift](https://github.com/web3swift-team/web3swift/blob/develop/web3swift-logo.png)
8+
[![Web3swift CI](https://github.com/web3swift-team/web3swift/actions/workflows/macOS-12.yml/badge.svg)](https://github.com/web3swift-team/web3swift/actions/workflows/macOS-12.yml)
99
[![Swift](https://img.shields.io/badge/Swift-5.4-orange.svg?style=flat)](https://developer.apple.com/swift/)
10-
[![Platform](https://img.shields.io/cocoapods/p/web3swift.svg?style=flat)](http://cocoapods.org/pods/web3.swift.pod)
11-
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/web3.swift.pod.svg?style=flat)](http://cocoapods.org/pods/web3.swift.pod)
12-
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
13-
[![License](https://img.shields.io/cocoapods/l/web3swift.svg?style=flat)](http://cocoapods.org/pods/web3.swift.pod)
10+
[![Platform](https://img.shields.io/cocoapods/p/web3swift?style=flat)](http://cocoapods.org/pods/web3swift)
11+
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/web3swift?style=flat)](http://cocoapods.org/pods/web3swift)
12+
[![License](https://img.shields.io/cocoapods/l/web3swift.svg?style=flat)](https://github.com/web3swift-team/web3swift/blob/master/LICENSE.md)
1413
[![support](https://brianmacdonald.github.io/Ethonate/svg/eth-support-blue.svg)](https://brianmacdonald.github.io/Ethonate/address#0xe22b8979739d724343bd002f9f432f5990879901)
1514
[![Stackoverflow](https://img.shields.io/badge/stackoverflow-ask-blue.svg)](https://stackoverflow.com/questions/tagged/web3swift)
1615

@@ -59,7 +58,7 @@
5958
- [x]**Literally following the standards** (BIP, EIP, etc):
6059
- [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)**
6160
- [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)
62-
- [x] **And many others** *(For details about this EIP's look at [Documentation page](https://github.com/skywinder/web3swift/blob/master/Documentation/))*: EIP-681, EIP-721, EIP-165, EIP-777, EIP-820, EIP-888, EIP-1400, EIP-1410, EIP-1594, EIP-1643, EIP-1644, EIP-1633, EIP-721, EIP-1155, EIP-1376, ST-20
61+
- [x] **And many others** *(For details about this EIP's look at [Documentation page](https://github.com/web3swift-team/web3swift/blob/master/Documentation/))*: EIP-681, EIP-721, EIP-165, EIP-777, EIP-820, EIP-888, EIP-1400, EIP-1410, EIP-1594, EIP-1643, EIP-1644, EIP-1633, EIP-721, EIP-1155, EIP-1376, ST-20
6362
- [x] **RLP encoding**
6463
- [x] Base58 encoding scheme
6564
- [x] Formatting to and from Ethereum Units
@@ -98,7 +97,7 @@ The [Swift Package Manager](https://swift.org/package-manager/ "") is a tool for
9897
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
9998
```swift
10099
dependencies: [
101-
.package(url: "https://github.com/skywinder/web3swift.git", .upToNextMajor(from: "3.0.0"))
100+
.package(url: "https://github.com/web3swift-team/web3swift.git", .upToNextMajor(from: "3.0.0"))
102101
]
103102
```
104103

@@ -107,7 +106,7 @@ In the imports section:
107106

108107
```swift
109108
import web3swift
110-
import Core
109+
import Web3Core
111110
```
112111

113112
### Send Ether
@@ -151,7 +150,7 @@ func feeHistory(blockCount: UInt, block: BlockNumber, percentiles:[Double]) asyn
151150
## Build from source
152151
### SPM
153152
```bash
154-
git clone https://github.com/skywinder/web3swift.git
153+
git clone https://github.com/web3swift-team/web3swift.git
155154
cd web3swift
156155
swift build
157156
```
@@ -165,15 +164,15 @@ swift build
165164
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.
166165

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

170169
## Support
171170

172171
**[Join our discord](https://discord.gg/8bHCNmhS7x) and [Telegram](https://t.me/web3swift) if you need support or want to contribute to web3swift development!**
173172

174-
- 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).
175-
- If you'd like to **see web3swift best practices**, check [Projects that using web3swift](https://github.com/skywinder/web3swift/wiki/Our-Customers).
176-
- If you **found a bug**, [open an issue](https://github.com/skywinder/web3swift/issues).
173+
- If you **need help**, please take a look at our [FAQ](https://github.com/web3swift-team/web3swift/wiki/FAQ "") or [open an issue](https://github.com/web3swift-team/web3swift/issues).
174+
- If you'd like to **see web3swift best practices**, check [Projects that using web3swift](https://github.com/web3swift-team/web3swift/wiki/Our-Customers).
175+
- If you **found a bug**, [open an issue](https://github.com/web3swift-team/web3swift/issues).
177176

178177
## Development
179178
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.
@@ -193,15 +192,15 @@ Make sure that `ganache` is running on its default port `8546`. To change the po
193192
Want to improve? It's awesome:
194193
Then good news for you: **We are ready to pay for your contribution via [@gitcoin bot](https://gitcoin.co/grants/358/web3swift)!**
195194

196-
- If you **have a feature request**, [open an issue](https://github.com/skywinder/web3swift/issues).
197-
- If you **want to contribute**, [submit a pull request](https://github.com/skywinder/web3swift/pulls).
195+
- If you **have a feature request**, [open an issue](https://github.com/web3swift-team/web3swift/issues).
196+
- If you **want to contribute**, [submit a pull request](https://github.com/web3swift-team/web3swift/pulls).
198197

199198
### Contribution
200199
1. You are more than welcome to participate and get bounty by contributing! **Your contribution will be paid via [@gitcoin Grant program](https://gitcoin.co/grants/358/web3swift).**
201-
2. Find or create an [issue](https://github.com/skywinder/web3swift/issues)
200+
2. Find or create an [issue](https://github.com/web3swift-team/web3swift/issues)
202201
3. You can find open bounties in [Gitcoin Bounties](https://gitcoin.co/explorer?applicants=ALL&keywords=web3swift&order_by=-web3_created) list
203202
4. Commita fix or a new feature in branch, push your changes
204-
5. [Submit a pull request to **develop** branch](https://github.com/skywinder/web3swift/pulls)
203+
5. [Submit a pull request to **develop** branch](https://github.com/web3swift-team/web3swift/pulls)
205204
1. Please, provide detailed description to it to help us proceed it faster.
206205

207206
[@skywinder](https://github.com/skywinder) are charged with open-sourсe and do not require money for using web3swift library.
@@ -218,12 +217,12 @@ We want to continue to do everything we can to move the needle forward.
218217
- Petr Korolev, [@skywinder](https://github.com/skywinder) - bootstrap and continuous support
219218
- Anton Grigorev, [@baldyash](https://github.com/BaldyAsh) - core contributor, who use it and making a lot of improvements
220219
- Yaroslav Yashin [@yaroslavyaroslav](https://github.com/yaroslavyaroslav) - core contributor of 3.0.0 and later releases.
221-
- Thanks to [web3swift's growing list of contributors](https://github.com/skywinder/web3swift/graphs/contributors).
220+
- Thanks to [web3swift's growing list of contributors](https://github.com/web3swift-team/web3swift/graphs/contributors).
222221

223222
## Security Disclosure
224223

225224
If you believe you have identified a security vulnerability with web3swift, you should report it as soon as possible via email to [[email protected]](mailto:[email protected]). Please do not post it to a public issue tracker.
226225

227226
## License
228227

229-
web3swift is available under the Apache License 2.0 license. See the [LICENSE](https://github.com/skywinder/web3swift/blob/master/LICENSE) for details.
228+
web3swift is available under the Apache License 2.0 license. See the [LICENSE](https://github.com/web3swift-team/web3swift/blob/master/LICENSE.md) for details.

Sources/Core/Contract/ContractProtocol.swift renamed to Sources/Web3Core/Contract/ContractProtocol.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ public protocol ContractProtocol {
173173
/// - Returns: `true` if event is possibly present, `false` if definitely not present and `nil` if event with given name
174174
/// is not part of the ``EthereumContract/abi``.
175175
func testBloomForEventPresence(eventName: String, bloom: EthereumBloomFilter) -> Bool?
176+
177+
/// Given the transaction data searches for a match in ``ContractProtocol/methods``.
178+
/// - Parameter data: encoded function call used in transaction data field. Must be at least 4 bytes long.
179+
/// - Returns: function decoded from the ABI of this contract or `nil` if nothing was found.
180+
func getFunctionCalled(_ data: Data) -> ABI.Element.Function?
176181
}
177182

178183
// MARK: - Overloaded ContractProtocol's functions
@@ -333,4 +338,9 @@ extension DefaultContractProtocol {
333338
guard let function = methods[methodSignature]?.first else { return nil }
334339
return function.decodeInputData(Data(data[4 ..< data.count]))
335340
}
341+
342+
public func getFunctionCalled(_ data: Data) -> ABI.Element.Function? {
343+
guard data.count >= 4 else { return nil }
344+
return methods[data[0..<4].toHexString().addHexPrefix()]?.first
345+
}
336346
}

0 commit comments

Comments
 (0)