Extending bindgen (wip dont merge) - #66
Open
elliots wants to merge 8 commits into
Open
Conversation
wip use go types in calls, bunch of ugly temp logging wip, very wip handle bytes and bytes32
Author
|
Events are in... needs a bit of a cleanup (and filtering by indexed props) but it is usable. Generating from event SomethingHappened(uint16 uint16Val, address addressVal, string stringVal, bytes bytesVal);
function sendTestEvent(uint16 uint16Val, string stringVal, bytes bytesVal) public {
emit SomethingHappened(uint16Val, msg.sender, stringVal, bytesVal);
}Gives type SomethingHappenedEvent struct {
Log *seth.Log
Uint16Val uint16
AddressVal seth.Address
StringVal string
BytesVal []byte
}
func (c *Test) FilterSomethingHappenedEvent(start, end int64) (outChan chan *SomethingHappenedEvent, close func(), errChan chan error) {
<SNIP>
}You can use it like msgCh, _, errCh := cc.FilterSomethingHappenedEvent(0, -1)
for {
select {
case err := <-errCh:
panic(err)
case msg := <-msgCh:
if msg == nil {
break
}
spew.Dump("message", msg)
}
}To get (*main.SomethingHappenedEvent)(0xc0000b84b0)({
Log: (*seth.Log)(0xc0000ca258)(<SNIP>),
Uint16Val: (uint16) 321,
AddressVal: (seth.Address) (len=20 cap=20) 0x84ede7c61cbff3056d6deb24ff774b79c1d2c4e4,
StringVal: (string) (len=14) "something else",
BytesVal: ([]uint8) (len=7 cap=7) {
00000000 67 6f 6f 64 62 79 65 |goodbye|
}
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've started work extending bindgen.
What I'm aiming for:
Not near complete, just adding a PR so other people can keep track/help/suggest things :)
Btw, project is excellent Cheers :)