-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: Parse Logs and LogData #517
Conversation
@@ -234,20 +234,23 @@ describe('Coverage Contract', () => { | |||
}); | |||
|
|||
it('should test u8 vector input', async () => { | |||
const { value, transactionResult } = await contractInstance.functions |
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.
Update the test to read the logs
Coverage report
Show files with reduced coverage 🔻
Test suite run success503 tests passing in 44 suites. Report generated by 🧪jest coverage report action from de884eb |
ce2a493
to
de884eb
Compare
this.fragments = coerceFragments(ABI.unflatten(jsonAbi)); | ||
|
||
this.types = this.abi ? this.abi.types : []; |
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.
this isn't used, but my ocd kicked in and I added it. It can be removed
parseLoggedType(loggedType: JsonFlatAbiFragmentLoggedType): JsonAbiFragmentType { | ||
return ParamType.fromObject(this.parseInput(loggedType.loggedType) as JsonFragmentType); |
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.
It was much easier to reuse the current logic - but this should be cleaned up asap
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.
Looks good, just parking as requesting changes per the flat abi question
@@ -234,20 +234,23 @@ describe('Coverage Contract', () => { | |||
}); | |||
|
|||
it('should test u8 vector input', async () => { | |||
const { value, transactionResult } = await contractInstance.functions | |||
const { value, logs } = await contractInstance.functions |
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.
🎉
return this.loggedTypes.map((loggedType) => ({ | ||
...loggedType, | ||
abiFragmentType: [this.parseLoggedType(loggedType)], | ||
})); |
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.
I thought the non-flat ABI is no more? @luizstacio maybe I misunderstood
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.
This is correct. My understanding is that we unflatten
it to make it work with the code. We really need to refactor the how the coders and ABI interact because this is where the tech debt is
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.
The idea behind keeping the nonthe flat abi, was to keep possible partial definition of functions using objects. But once logs and other things are going to require types. We should remove it.
Closes #491
First, pass on log and log data.
I tried to refactor the logic to decode these values, but it quickly grew out of scope. I think the good place to start refactors are on the
ABI
,Interface
andInvocationResults
.WIP - More tests while getting this into review