Skip to content

Commit b8d54f6

Browse files
Merge pull request #587 from JeneaVranceanu/fix/abi-overloading-methods-support
2 parents b526296 + 7c8b53c commit b8d54f6

39 files changed

+1079
-737
lines changed

README.md

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ let tx = contract.write(
217217

218218
#### Write Transaction with your custom contract ABI
219219
#### Requirement : Your custom contract ABI string
220-
```Code
220+
```swift
221221
func contractTransactionMethod(){
222222
let yourCoin = self.yourbalance.text ?? "0.0" //Get token for sending
223223
let userDir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] //get user directory for keystore
@@ -299,19 +299,19 @@ open ./web3swiftBrowser.xcworkspace
299299
### Default web3swift build
300300

301301
1. Install carthage:
302-
```
302+
```bash
303303
brew install carthage
304304
```
305305
2. Run carthage update:
306-
```
306+
```bash
307307
# Available platforms: `iOS, macOS`
308308
carthage update --platform iOS --use-xcframeworks
309309
```
310310
3. Build project in XCode:
311311
`Command + B`
312312

313313
### Build web3swift into .framework:
314-
```
314+
```bash
315315
carthage build --no-skip-current --platform iOS
316316
```
317317

@@ -346,49 +346,24 @@ Here are quick references for essential features:
346346
- [ENS](https://github.com/skywinder/web3swift/blob/master/Documentation/Usage.md#ens)
347347

348348
## Projects that are using web3swift
349-
350-
If you are using this library in your project, please [add a link](https://github.com/skywinder/web3swift/edit/develop/README.md) to this repo.
351-
352-
* [MyEtherWallet/MEWconnect-iOS](https://github.com/MyEtherWallet/MEWconnect-iOS)
353-
* [Peepeth iOS client](https://github.com/matterinc/PeepethClient)
354-
* [Ethereum & ERC20Tokens Wallet](https://itunes.apple.com/us/app/ethereum-erc20tokens-wallet/id1386738877?ls=1&mt=8)
355-
* [Pay-iOS](https://github.com/BANKEX/Pay-iOS)
356-
* [GeoChain](https://github.com/awallish/GeoChain)
357-
* [NewHorizonLabs/TRX-Wallet](https://github.com/NewHorizonLabs/TRX-Wallet)
358-
* [SteadyAction/EtherWalletKit](https://github.com/SteadyAction/EtherWalletKit)
359-
* [UP Wallet/loopr-ios](https://github.com/Loopring/loopr-ios)
360-
* [MyENS Wallet](https://github.com/barrasso/enswallet)
361-
* [LoanStar](https://github.com/barrasso/loan-star)
362-
* [AlphaWallet](https://github.com/AlphaWallet/alpha-wallet-ios)
363-
* [Follow_iOS](https://github.com/FollowInc/Follow_iOS)
364-
* [Biomedical Data Sharing dApp - Geolocation](https://github.com/HD2i/Geolocation-iOS)
365-
* [Alice Wallet](https://github.com/alicedapp/AliceX)
366-
* [web3-react-native](https://github.com/cawfree/web3-react-native)
367-
* [ProLabArt](https://prolabart.com)
368-
<!-- Add your project below -->
369-
<!-- * [Project Name](link to projext) -->
370-
* [YOUR APP CAN BE THERE (click me)](https://github.com/skywinder/web3swift/edit/develop/README.md) :wink:
371-
372-
*Nothing makes developers happier than seeing someone else use our work and go wild with it.*
349+
Please take a look at [Our costumers](https://github.com/skywinder/web3swift/wiki/Our-Customers) wiki page.
373350

374351
## Support
375352

376-
**[Join our discord](https://discord.gg/8bHCNmhS7x) if you need a support or want to contribute to web3swift development!**
353+
**[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!**
377354

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

382359

383360
## Contribute
384-
385361
Want to improve? It's awesome:
386362

387363
Then good news for you: **We are ready to pay for your contribution via [@gitcoin bot](https://gitcoin.co/grants/358/web3swift)!**
388364

389365
- If you **have a feature request**, [open an issue](https://github.com/skywinder/web3swift/issues).
390-
391-
If you **want to contribute**, [submit a pull request](https://github.com/skywinder/web3swift/pulls).
366+
- If you **want to contribute**, [submit a pull request](https://github.com/skywinder/web3swift/pulls).
392367

393368
#### Contribution
394369
0. 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).**
@@ -415,6 +390,7 @@ We want to continue to do everything we can to move the needle forward.
415390
- Alex Vlasov, [@shamatar](https://github.com/shamatar) - for the initial implementation
416391
- Petr Korolev, [@skywinder](https://github.com/skywinder) - botstrap and continous support
417392
- Anton Grigorev, [@baldyash](https://github.com/BaldyAsh) - core contributor, who use it and making a lot of ipmprovments
393+
- Yaroslav Yashin [@yaroslavyaroslav](https://github.com/yaroslavyaroslav) - core contributor of 3.0.0 and later releases.
418394
- Thanks to [web3swift's growing list of contributors](https://github.com/skywinder/web3swift/graphs/contributors).
419395

420396
## Security Disclosure

Sources/Core/EthereumAddress/EthereumAddress.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public struct EthereumAddress: Equatable {
3232
return lhs.addressData == rhs.addressData && lhs.type == rhs.type
3333
}
3434

35+
/// Raw representation of the address.
36+
/// If the ``type`` is ``EthereumAddress/AddressType/contractDeployment`` an empty `Data` object is returned.
3537
public var addressData: Data {
3638
get {
3739
switch self.type {
@@ -43,6 +45,9 @@ public struct EthereumAddress: Equatable {
4345
}
4446
}
4547
}
48+
49+
/// Checksummed address with `0x` HEX prefix.
50+
/// If the ``type`` is ``EthereumAddress/AddressType/contractDeployment`` only `0x` prefix is returned.
4651
public var address: String {
4752
switch self.type {
4853
case .normal:
@@ -52,6 +57,11 @@ public struct EthereumAddress: Equatable {
5257
}
5358
}
5459

60+
/// Validates and checksumms given `addr`.
61+
/// If given string is not an address, incomplete address or is invalid validation will fail and `nil` will be returned.
62+
/// - Parameter addr: address in string format, case insensitive, `0x` prefix is not required.
63+
/// - Returns: validates and checksumms the address. Returns `nil` if checksumm has failed or given string cannot be
64+
/// represented as `ASCII` data. Otherwise, checksummed address is returned with `0x` prefix.
5565
public static func toChecksumAddress(_ addr: String) -> String? {
5666
let address = addr.lowercased().stripHexPrefix()
5767
guard let hash = address.data(using: .ascii)?.sha3(.keccak256).toHexString().stripHexPrefix() else {return nil}
@@ -72,15 +82,19 @@ public struct EthereumAddress: Equatable {
7282
return ret
7383
}
7484

85+
/// Creates a special ``EthereumAddress`` that serves the purpose of the receiver, or `to` address of a transaction if it is a
86+
/// smart contract deployment.
87+
/// - Returns: special instance with type ``EthereumAddress/AddressType/contractDeployment`` and
88+
/// empty ``EthereumAddress/address``.
7589
public static func contractDeploymentAddress() -> EthereumAddress {
76-
return EthereumAddress("0x", type: .contractDeployment)!
90+
EthereumAddress("0x", type: .contractDeployment)!
7791
}
7892
}
7993

8094
/// In swift structs it's better to implement initializers in extension
8195
/// Since it's make available syntetized initializer then for free.
8296
extension EthereumAddress {
83-
public init?(_ addressString:String, type: AddressType = .normal, ignoreChecksum: Bool = false) {
97+
public init?(_ addressString: String, type: AddressType = .normal, ignoreChecksum: Bool = false) {
8498
switch type {
8599
case .normal:
86100
guard let data = Data.fromHex(addressString) else {return nil}

Sources/Core/Utility/Data+Extension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public extension Data {
5959
}
6060
return nil
6161
}
62-
62+
6363
func bitsInRange(_ startingBit: Int, _ length: Int) -> UInt64? { // return max of 8 bytes for simplicity, non-public
6464
if startingBit + length / 8 > self.count, length > 64, startingBit > 0, length >= 1 {return nil}
6565
let bytes = self[(startingBit/8) ..< (startingBit+length+7)/8]

0 commit comments

Comments
 (0)