Skip to content

Commit edfe624

Browse files
Merge branch develop into master
2 parents 7219725 + 50d0d83 commit edfe624

File tree

194 files changed

+3547
-2676
lines changed

Some content is hidden

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

194 files changed

+3547
-2676
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+16
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,19 @@ body:
4949
placeholder: Sources/Core/Transaction/CodableTransaction.swift:129 func recoverPublicKey()
5050
validations:
5151
required: true
52+
- type: textarea
53+
id: os-version
54+
attributes:
55+
label: OS version
56+
description: Please specify what platform and os version you are using?
57+
placeholder: macOS 13.0.1 (22A400)
58+
validations:
59+
required: true
60+
- type: textarea
61+
id: lib-version
62+
attributes:
63+
label: Library version
64+
description: Please specify what library version you are using?
65+
placeholder: 3.0.6 or "ef06fbfc735ab687ebf89c937a9d1ffe6d81d37f" commit.
66+
validations:
67+
required: true

.github/ISSUE_TEMPLATE/documentation-request.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ body:
99
- type: textarea
1010
id: area
1111
attributes:
12-
label: What area of the framework would you like to have improved the documentation for?
13-
description: Please be very specific and link to the relevant page in the documentation if possible.
14-
placeholder: I would like the documentation for...
12+
label: What piece of the framework are having the lack of docs?
13+
description: Bring the link, either type, either method name that is having the lack of docs
14+
placeholder: "`Sources/Core/EthereumABI.swift:ABIElementPropertiesProtocol` or `ABIElementPropertiesProtocol`"
1515
validations:
1616
required: true
1717
- type: textarea
1818
id: reason
1919
attributes:
20-
label: Why is the current documentation for this area not sufficient?
20+
label: What bit of docs would you like to have?
2121
description: A clear and concise description of why this documentation needs to be improved.
22-
placeholder: The documentation needs to be improved because...
22+
placeholder: There's a lack of docs that covers both the intent of this type and the way how it should be used within client code.
2323
validations:
2424
required: true
+7-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Feature Request
22
description: Suggest an idea for this project
3-
labels: ['feature']
3+
labels: ['enhancement']
44
body:
55
- type: markdown
66
attributes:
@@ -9,29 +9,22 @@ body:
99
- type: textarea
1010
id: problem
1111
attributes:
12-
label: Is your feature request related to a problem?
13-
description: A clear and concise description of what the problem is.
14-
placeholder: Yes, the problem is that...
12+
label: What context is your feature request related to?
13+
description: Short context name, please do not overcomplicate neither over fractionize it.
14+
placeholder: Transaction pipeline enhancement, supported platform list extending, etc.
1515
validations:
1616
required: true
1717
- type: textarea
1818
id: solution
1919
attributes:
2020
label: What solution would you like?
2121
description: A clear and concise description of what you want to happen.
22-
placeholder: I would like that...
23-
validations:
24-
required: true
25-
- type: textarea
26-
id: alternatives
27-
attributes:
28-
label: What alternatives have you considered?
29-
description: A clear and concise description of any alternative solutions or features you've considered.
30-
placeholder: I have considered to...
22+
placeholder: I would like that your lib has a magic "give me money" button, that provides me to just to build it, be uploaded to the AppStore and to get rich.
3123
validations:
3224
required: true
3325
- type: textarea
3426
id: context
3527
attributes:
3628
label: Any additional context?
37-
description: Add any other context or screenshots about the feature request here.
29+
description: If there's some specs either standard for such feature invented already here's the good place to provide those.
30+
placeholder: Here's the pictures of house that i'd wanted to be able to bough after i've got rich and the my future cars list as well.

.github/pull_request_template.md

+13
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.

Example/myWeb3Wallet/Podfile

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment the next line to define a global platform for your project
2-
# platform :ios, '9.0'
2+
platform :ios, '15.0'
33

44
target 'myWeb3Wallet' do
55
# Comment the next line if you don't want to use dynamic frameworks
@@ -19,3 +19,12 @@ pod 'web3swift', :git => 'https://github.com/veerChauhan/web3swift.git', :branch
1919
end
2020

2121
end
22+
23+
# set iOS deployment target for every pod to avoid warnings
24+
post_install do |installer|
25+
installer.pods_project.targets.each do |target|
26+
target.build_configurations.each do |config|
27+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
28+
end
29+
end
30+
end

Example/myWeb3Wallet/myWeb3Wallet.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@
754754
isa = XCBuildConfiguration;
755755
baseConfigurationReference = D6018FABA256C0117F85A829 /* Pods-myWeb3Wallet-myWeb3WalletUITests.debug.xcconfig */;
756756
buildSettings = {
757-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
757+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
758758
CODE_SIGN_STYLE = Automatic;
759759
CURRENT_PROJECT_VERSION = 1;
760760
DEVELOPMENT_TEAM = VPS9LBWQ55;
@@ -778,7 +778,7 @@
778778
isa = XCBuildConfiguration;
779779
baseConfigurationReference = 7574A738941D92CC94F93A9E /* Pods-myWeb3Wallet-myWeb3WalletUITests.release.xcconfig */;
780780
buildSettings = {
781-
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
781+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
782782
CODE_SIGN_STYLE = Automatic;
783783
CURRENT_PROJECT_VERSION = 1;
784784
DEVELOPMENT_TEAM = VPS9LBWQ55;

Package.swift

+2-11
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33

44
import PackageDescription
55

6-
#if os(macOS)
7-
let excludeFiles = [
8-
"./Browser/BrowserViewController.swift" // Because of inheriting iOS only class failed to build on macOS.
9-
]
10-
#elseif os(iOS)
11-
let excludeFiles: String = []
12-
#endif
13-
146
let package = Package(
157
name: "Web3swift",
168
platforms: [
@@ -26,13 +18,12 @@ let package = Package(
2618
targets: [
2719
.target(name: "secp256k1"),
2820
.target(
29-
name: "Core",
21+
name: "Web3Core",
3022
dependencies: ["BigInt", "secp256k1", "CryptoSwift"]
3123
),
3224
.target(
3325
name: "web3swift",
34-
dependencies: ["Core", "BigInt", "secp256k1"],
35-
exclude: excludeFiles,
26+
dependencies: ["Web3Core", "BigInt", "secp256k1"],
3627
resources: [
3728
.copy("./Browser/browser.js"),
3829
.copy("./Browser/browser.min.js"),

README.md

+19-20
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/EthereumABI/ABIElements.swift

-2
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ extension ABI.Element.Function {
278278

279279
let message = String(bytes: data.bytes[68..<(68+len)], encoding: .utf8)!
280280

281-
print("read function aborted by require statement: \(message)")
282-
283281
var returnArray = [String: Any]()
284282

285283
// set infomation

Sources/Core/Transaction/Policies.swift

-65
This file was deleted.

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

+11-1
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
@@ -263,7 +268,7 @@ extension DefaultContractProtocol {
263268
let method = Data.fromHex(method) == nil ? method : method.addHexPrefix().lowercased()
264269

265270
// MARK: - Encoding ABI Data flow
266-
guard let abiMethod = methods[method]?.first,
271+
guard let abiMethod = methods[method]?.first(where: { $0.inputs.count == parameters.count }),
267272
var encodedData = abiMethod.encodeParameters(parameters) else { return nil }
268273

269274
// Extra data just appends in the end of parameters data
@@ -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
}
File renamed without changes.

0 commit comments

Comments
 (0)