Web3.swift
Web3.swift copied to clipboard
Add Type Safety to "chainId"
Overview
This PR adds an enum
, EthereumChain
, that is a type-safe wrapper for the chainId
, as described in EIP155.
Detailed
This PR also makes the chainId parameters mandatory, instead of providing a default value (which was originally 0
), review the documentation and update the README file accordingly.
Note
Pardon the extra verbosity on the enum
declaration, but in order to implement the .custom
case with an associated value, the enum
could not inherit directly from Int
as those don't allow values to be associated with them. So I had to implement the enum
, manually conforming to RawRepresentable
.
I'm not too fussed if you guys decide to drop support for the lesser known networks in order to keep the API clean, I just threw in all the chainId
s I found browsing Stack Overflow π
Resolves https://github.com/Boilertalk/Web3.swift/issues/53
@pixelmatrix @Ybrin, I just implemented the requested changes π
Looks good to me. Have you looked into the failing tests?
I'll take a look at those issues soon, sorry for the wait guys.
@rogerluan Have you had a chance to look into these issues yet?
@Ybrin Sorry, not yet. I definitely didn't forget it! π If anyone else wanna address the changes, by all means! Otherwise I'll be checking this later π Sorry for the wait π
I apologize for the really long wait, but I finally took some time to look into the failing tests π Let me know if there are any other pending issues here @Ybrin @pixelmatrix ! π
Codecov Report
Merging #62 into master will increase coverage by
0.23%
. The diff coverage is55.26%
.
@@ Coverage Diff @@
## master #62 +/- ##
==========================================
+ Coverage 75.14% 75.38% +0.23%
==========================================
Files 64 64
Lines 4152 4164 +12
==========================================
+ Hits 3120 3139 +19
+ Misses 1032 1025 -7
Impacted Files | Coverage Ξ | |
---|---|---|
...Classes/Core/Transaction/EthereumTransaction.swift | 73.46% <55.26%> (+5.53%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Ξ = absolute <relative> (impact)
,ΓΈ = not affected
,? = missing data
Powered by Codecov. Last update 229c67c...b626e78. Read the comment docs.
@rogerluan Thanks. Looks good now. Gonna merge it soon for the next version jump.