-
Notifications
You must be signed in to change notification settings - Fork 459
feat: remote tests mocking #701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6a5ce15
b9ac465
60c9ca7
d08a2de
97ba8e9
ff0778b
29fff74
e2b0f5d
bd2188a
3707ca4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,11 @@ public protocol ContractProtocol { | |
/// - Returns: `true` if event is possibly present, `false` if definitely not present and `nil` if event with given name | ||
/// is not part of the ``EthereumContract/abi``. | ||
func testBloomForEventPresence(eventName: String, bloom: EthereumBloomFilter) -> Bool? | ||
|
||
/// Given the transaction data searches for a match in ``ContractProtocol/methods``. | ||
/// - Parameter data: encoded function call used in transaction data field. Must be at least 4 bytes long. | ||
/// - Returns: function decoded from the ABI of this contract or `nil` if nothing was found. | ||
func getFunctionCalled(_ data: Data) -> ABI.Element.Function? | ||
} | ||
|
||
// MARK: - Overloaded ContractProtocol's functions | ||
|
@@ -333,4 +338,9 @@ extension DefaultContractProtocol { | |
guard let function = methods[methodSignature]?.first else { return nil } | ||
return function.decodeInputData(Data(data[4 ..< data.count])) | ||
} | ||
|
||
public func getFunctionCalled(_ data: Data) -> ABI.Element.Function? { | ||
guard data.count >= 4 else { return nil } | ||
return methods[data[0..<4].toHexString().addHexPrefix()]?.first | ||
} | ||
Comment on lines
+342
to
+345
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see your dirty hack here. This is somewhat that I'd like to be implemented as a protocol. But again this is dream not even about current century. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not that dirty I'd say. |
||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My dream for 4.0.0 is to create a set of Ethereum only data types that will be accounts all that special cases.
Because while we're using some advantages of swift strong typed system in 3.0.0 we're still missing a lot of them, treating those Ethereum rules in a python way, by leaving notes to our future selves.
Nothing to say about rewriting ABI module to generics as well.