Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 62 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,70 @@
# Changelog

## [Unreleased](https://github.com/skywinder/web3swift/tree/HEAD)
## [2.6.5](https://github.com/skywinder/web3swift/tree/2.6.5) (2022-05-26)

[Full Changelog](https://github.com/skywinder/web3swift/compare/2.5.0...HEAD)
- correct the decoding key for from in transactionOptions by @mloit in #570

**Merged pull requests:**
## [2.6.4](https://github.com/skywinder/web3swift/tree/2.6.4) (2022-05-06)

- Fix ERC-1155 ABI by @mloit in #557
- Fix access level for EIP-712 related objects by @mloit in #555
- Restore public API fromJSON() functions by @mloit in #558

## [2.6.3](https://github.com/skywinder/web3swift/tree/2.6.3) (2022-04-27)

- Feature/automatic gas 1559 by @mloit in #547
- Oracle.suggestGasFeeLegacy method fixup by @yaroslavyaroslav in #551

## [2.6.2](https://github.com/skywinder/web3swift/tree/2.6.2) (2022-04-25)

- Fix #540 by freezing CryptoSwift dependency to last working version (1.4.3) by @yaroslavyaroslav

## [2.6.1](https://github.com/skywinder/web3swift/tree/2.6.1) (2022-04-19)

- Update documentation for EIP-1559 support by @mloit in #530
- Feature/transaction metadata by @mloit in #523

## [2.6.0](https://github.com/skywinder/web3swift/tree/2.6.0) (2022-04-15)

### Features

- Add full EIP-1559 transaction support see
- Add gas prediction support see

### What's Changed

- Remove BrowserViewController if building for anything other than iOS by @mloit in #503
- Feature/pre swiftlint cleanup by @mloit in #495
- Feature/late lint fixups by @mloit in #508
- Fix Base58 Decoding by @mloit in #504
- Swiftlint by @mloit in #499
- ERC1155: Change access control for Interfece-based methods. by @mrklos in #494
- feat: solidity sha3 implementation added by @JeneaVranceanu in #506
- add indentation check [default is 4 spaces per tab-stop] by @mloit in #512
- EIP-1559 support release by @yaroslavyaroslav in #510
- EIP-1559 Gas prediction implementation by @yaroslavyaroslav in #513
- feat: decoding ABI with solidity error types by @JeneaVranceanu in #455
- Gas prediction implementation by @yaroslavyaroslav in #514
- Bug fix/transaction index by @mloit in #521
- EIP-1559 transaction support by @mloit in #509
- Full Changelog: 2.5.1...2.6.0

## [2.5.1](https://github.com/skywinder/web3swift/tree/2.5.1) (2022-03-23)

- Syncing with master [\#428](https://github.com/skywinder/web3swift/pull/428) ([yaroslavyaroslav](https://github.com/yaroslavyaroslav))
- Drop Carthage cache files by yaroslavyaroslav
- Drop examples cocoapods cache files by yaroslavyaroslav
- Improve ci/cd pipeline by adding localTests job by yaroslavyaroslav
- Rename tests in swift style name convention (CamelCase) by yaroslavyaroslav
- Enable run ganache util in ci/cd pipeline (required for local tests) by yaroslavyaroslav
- Clear lib warnings on build #437 by Valter4578 & mliot
- Change UINT64_MAX to UInt64.max by mloit
- Update CHANGELOG.md by ZeroCode999
- Fix tokenURI method name for ERC721 and ERC721x tokens #419 by Sarquella
- Provide basic tolerance to EIP-1559 data by mloit
- Fix for buffer overflow in [Data|SECP256K1].randomBytes() #470 by mloit
- Arbitrary clean project code by mloit
- Fix github actions config issue that occasionally cancels running jobs by yaroslavyaroslav
- mini-rollup of several issues by mloit

## [2.5.0](https://github.com/skywinder/web3swift/tree/2.5.0) (2021-12-23)

Expand Down
10 changes: 5 additions & 5 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github "attaswift/BigInt" == 5.3.0
github "attaswift/SipHash" == 1.2.2
github "daltoniam/Starscream" == 4.0.4
github "krzyzanowskim/CryptoSwift" == 1.5.1
github "mxcl/PromiseKit" == 6.16.2
github "attaswift/BigInt" ~> 5.3.0
github "attaswift/SipHash" ~> 1.2.2
github "daltoniam/Starscream" ~> 4.0.4
github "krzyzanowskim/CryptoSwift" ~> 1.5.1
github "mxcl/PromiseKit" ~> 6.16.2
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ let package = Package(
],

dependencies: [
.package(url: "https://github.com/attaswift/BigInt.git", .upToNextMinor(from: "5.3.0")),
.package(url: "https://github.com/mxcl/PromiseKit.git", .upToNextMinor(from: "6.16.2")),
.package(url: "https://github.com/daltoniam/Starscream.git", .upToNextMinor(from: "4.0.4")),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMinor(from: "1.5.1"))
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.3.0"),
.package(url: "https://github.com/mxcl/PromiseKit.git", from: "6.16.2"),
.package(url: "https://github.com/daltoniam/Starscream.git", from: "4.0.4"),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.5.1")
],
targets: [
.target(name: "secp256k1"),
Expand Down
44 changes: 10 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ let tx = contract.write(

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

1. Install carthage:
```
```bash
brew install carthage
```
2. Run carthage update:
```
```bash
# Available platforms: `iOS, macOS`
carthage update --platform iOS --use-xcframeworks
```
3. Build project in XCode:
`Command + B`

### Build web3swift into .framework:
```
```bash
carthage build --no-skip-current --platform iOS
```

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

## Projects that are using web3swift

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.

* [MyEtherWallet/MEWconnect-iOS](https://github.com/MyEtherWallet/MEWconnect-iOS)
* [Peepeth iOS client](https://github.com/matterinc/PeepethClient)
* [Ethereum & ERC20Tokens Wallet](https://itunes.apple.com/us/app/ethereum-erc20tokens-wallet/id1386738877?ls=1&mt=8)
* [Pay-iOS](https://github.com/BANKEX/Pay-iOS)
* [GeoChain](https://github.com/awallish/GeoChain)
* [NewHorizonLabs/TRX-Wallet](https://github.com/NewHorizonLabs/TRX-Wallet)
* [SteadyAction/EtherWalletKit](https://github.com/SteadyAction/EtherWalletKit)
* [UP Wallet/loopr-ios](https://github.com/Loopring/loopr-ios)
* [MyENS Wallet](https://github.com/barrasso/enswallet)
* [LoanStar](https://github.com/barrasso/loan-star)
* [AlphaWallet](https://github.com/AlphaWallet/alpha-wallet-ios)
* [Follow_iOS](https://github.com/FollowInc/Follow_iOS)
* [Biomedical Data Sharing dApp - Geolocation](https://github.com/HD2i/Geolocation-iOS)
* [Alice Wallet](https://github.com/alicedapp/AliceX)
* [web3-react-native](https://github.com/cawfree/web3-react-native)
* [ProLabArt](https://prolabart.com)
<!-- Add your project below -->
<!-- * [Project Name](link to projext) -->
* [YOUR APP CAN BE THERE (click me)](https://github.com/skywinder/web3swift/edit/develop/README.md) :wink:

*Nothing makes developers happier than seeing someone else use our work and go wild with it.*
Please take a look at [Our costumers](https://github.com/skywinder/web3swift/wiki/Our-Customers) wiki page.

## Support

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

- If you **need help**, [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#projects-that-using-web3swift).
- 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).


## 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)!**

- If you **have a feature request**, [open an issue](https://github.com/skywinder/web3swift/issues).

If you **want to contribute**, [submit a pull request](https://github.com/skywinder/web3swift/pulls).
- If you **want to contribute**, [submit a pull request](https://github.com/skywinder/web3swift/pulls).

#### Contribution
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).**
Expand All @@ -415,6 +390,7 @@ We want to continue to do everything we can to move the needle forward.
- 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
- 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).

## Security Disclosure
Expand Down
5 changes: 2 additions & 3 deletions Sources/web3swift/Contract/ContractProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ public struct EventFilter {
}
}

public init() { }

public init(fromBlock: Block?, toBlock: Block?,
public init(fromBlock: Block? = nil,
toBlock: Block? = nil,
addresses: [EthereumAddress]? = nil,
parameterFilters: [[EventFilterable]?]? = nil) {
self.fromBlock = fromBlock
Expand Down
6 changes: 6 additions & 0 deletions Sources/web3swift/KeystoreManager/IBAN.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ public struct ICAP {
public var asset: String
public var institution: String
public var client: String

public init(asset: String, institution: String, client: String) {
self.asset = asset
self.institution = institution
self.client = client
}
}

public struct IBAN {
Expand Down
10 changes: 5 additions & 5 deletions Sources/web3swift/Tokens/ERC1376/Web3+ERC1376.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public enum IERC1376DelegateMode: UInt {
}

public struct DirectDebitInfo {
let amount: BigUInt
let startTime: BigUInt
let interval: BigUInt
public let amount: BigUInt
public let startTime: BigUInt
public let interval: BigUInt
}

public struct DirectDebit {
let info: DirectDebitInfo
let epoch: BigUInt
public let info: DirectDebitInfo
public let epoch: BigUInt
}

extension DirectDebit: Hashable {
Expand Down
24 changes: 24 additions & 0 deletions Sources/web3swift/Transaction/EthereumParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,30 @@ public struct EthereumParameters {

/// access list for contract execution (EIP-2930 and EIP-1559 only)
public var accessList: [AccessListEntry]?

public init(type: TransactionType? = nil,
to: EthereumAddress? = nil,
nonce: BigUInt? = nil,
chainID: BigUInt? = nil,
value: BigUInt? = nil,
data: Data? = nil,
gasLimit: BigUInt? = nil,
gasPrice: BigUInt? = nil,
maxFeePerGas: BigUInt? = nil,
maxPriorityFeePerGas: BigUInt? = nil,
accessList: [AccessListEntry]? = nil) {
self.type = type
self.to = to
self.nonce = nonce
self.chainID = chainID
self.value = value
self.data = data
self.gasLimit = gasLimit
self.gasPrice = gasPrice
self.maxFeePerGas = maxFeePerGas
self.maxPriorityFeePerGas = maxPriorityFeePerGas
self.accessList = accessList
}
}

public extension EthereumParameters {
Expand Down
26 changes: 26 additions & 0 deletions Sources/web3swift/Web3/Web3+Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,32 @@ public struct TransactionOptions {

public var accessList: [AccessListEntry]?

public init(type: TransactionType? = nil,
to: EthereumAddress? = nil,
from: EthereumAddress? = nil,
chainID: BigUInt? = nil,
gasLimit: TransactionOptions.GasLimitPolicy? = nil,
gasPrice: TransactionOptions.GasPricePolicy? = nil,
maxFeePerGas: TransactionOptions.FeePerGasPolicy? = nil,
maxPriorityFeePerGas: TransactionOptions.FeePerGasPolicy? = nil,
value: BigUInt? = nil,
nonce: TransactionOptions.NoncePolicy? = nil,
callOnBlock: TransactionOptions.CallingBlockPolicy? = nil,
accessList: [AccessListEntry]? = nil) {
self.type = type
self.to = to
self.from = from
self.chainID = chainID
self.gasLimit = gasLimit
self.gasPrice = gasPrice
self.maxFeePerGas = maxFeePerGas
self.maxPriorityFeePerGas = maxPriorityFeePerGas
self.value = value
self.nonce = nonce
self.callOnBlock = callOnBlock
self.accessList = accessList
}

public static var defaultOptions: TransactionOptions {
var opts = TransactionOptions()
opts.type = .legacy
Expand Down
8 changes: 4 additions & 4 deletions Tests/web3swiftTests/remoteTests/ENSTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ class ENSTests: XCTestCase {
let domain = "somename.eth"
let address = try ens?.registry.getResolver(forDomain: domain).resolverContractAddress
print(address as Any)
XCTAssertEqual(address?.address.lowercased(), "0x5ffc014343cd971b7eb70732021e26c35b744cc4")
XCTAssertEqual(address?.address.lowercased(), "0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41")
}

func testResolver() throws {
let web3 = Web3.InfuraMainnetWeb3(accessToken: Constants.infuraToken)
let ens = ENS(web3: web3)
let domain = "somename.eth"
let address = try ens?.getAddress(forNode: domain)
XCTAssertEqual(address?.address.lowercased(), "0x3487acfb1479ad1df6c0eb56ae743d34897798ac")
XCTAssertEqual(address?.address.lowercased(), "0xc1ccfb5fc589b83b9e849c6f9b26efc71419898d")
}

func testSupportsInterface() throws {
Expand Down Expand Up @@ -74,7 +74,7 @@ class ENSTests: XCTestCase {
let ens = ENS(web3: web3)
let domain = "somename.eth"
let owner = try ens?.registry.getOwner(node: domain)
XCTAssertEqual("0xc67247454e720328714c4e17bec7640572657bee", owner?.address.lowercased())
XCTAssertEqual("0xc1ccfb5fc589b83b9e849c6f9b26efc71419898d", owner?.address.lowercased())
}

func testTTL() throws {
Expand All @@ -91,7 +91,7 @@ class ENSTests: XCTestCase {
let domain = "somename.eth"
let resolver = try ens?.registry.getResolver(forDomain: domain)
let address = try resolver?.getAddress(forNode: domain)
XCTAssertEqual(address?.address.lowercased(), "0x3487acfb1479ad1df6c0eb56ae743d34897798ac")
XCTAssertEqual(address?.address.lowercased(), "0xc1ccfb5fc589b83b9e849c6f9b26efc71419898d")
}

func testGetPubkey() throws {
Expand Down
8 changes: 4 additions & 4 deletions web3swift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Pod::Spec.new do |spec|
spec.resource_bundle = { "Browser" => "Sources/web3swift/Browser/*.js" }
spec.swift_version = '5.0'
spec.frameworks = 'CoreImage'
spec.dependency 'BigInt', '5.2.0'
spec.dependency 'Starscream', '4.0.4'
spec.dependency 'CryptoSwift', '1.4.3'
spec.dependency 'BigInt', '~> 5.2.0'
spec.dependency 'Starscream', '~> 4.0.4'
spec.dependency 'CryptoSwift', '~> 1.5.1'
spec.dependency 'secp256k1.c', '~> 0.1'
spec.dependency 'PromiseKit', '6.15.3'
spec.dependency 'PromiseKit', '~> 6.15.3'
end