Experimental Script to Generate StaticContract Class using Solidity Json output #117
stevealexrs
started this conversation in
Show and tell
Replies: 1 comment
-
The codegen will also attempt to cast the output to struct using this additional struct. I have tried using JSONDecoder but it cannot convert dictionary of any to struct so it need to be done manually. public struct SolidityTypedInvocation<T> {
public var invocation: SolidityInvocation
private var cast: ([String: Any]) -> T
public init(invocation: SolidityInvocation, _ cast: @escaping ([String: Any]) -> T) {
self.cast = cast
self.invocation = invocation
}
// Call function here that convert dictionary to struct
// additional functions that map to solidity invocation functions
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is an experimental cli tool. It generates StaticContract class with all the functions, events and constructor. The output syntax is fine but I have not tested whether it works.
Here is the link: SwiftSolidityBinding.
Right now, this only makes the input parameter strongly typed. The output is returned as dictionary of any.
Beta Was this translation helpful? Give feedback.
All reactions