-
Notifications
You must be signed in to change notification settings - Fork 4.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
Fix getTransactions web3.js method #26099
Fix getTransactions web3.js method #26099
Conversation
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.
We are so early, still.
Thank you for this fix!
@@ -3566,7 +3566,16 @@ export class Connection { | |||
if ('error' in res) { | |||
throw new Error('failed to get transactions: ' + res.error.message); | |||
} | |||
return res.result; |
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.
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.
Found out the root cause of this. #26102
return { | ||
...result, | ||
transaction: { | ||
...result.transaction, | ||
message: new Message(result.transaction.message), | ||
}, | ||
}; |
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.
Slight preference for pulling this out into a method (getTransactionResponseFromGetTransactionsResult()so that
getTransactionand
getTransactions` can share it, but no big deal – what you've done here is more readable.
web3.js/test/connection.test.ts
Outdated
@@ -2197,6 +2197,138 @@ describe('Connection', function () { | |||
expect(nullResponse).to.be.null; | |||
}); | |||
|
|||
it('get transactions', async () => { |
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.
<3
64d5ae5
to
5848e7b
Compare
Pull request has been modified.
Codecov Report
@@ Coverage Diff @@
## master #26099 +/- ##
===========================================
- Coverage 82.1% 75.7% -6.4%
===========================================
Files 628 40 -588
Lines 171471 2348 -169123
Branches 0 339 +339
===========================================
- Hits 140878 1779 -139099
+ Misses 30593 450 -30143
- Partials 0 119 +119 |
Problem
getTransactions
parses the transaction response differently fromgetTransaction
, but they return the same type. Specifically,transaction.message
is not of the typeMessage
.Summary of Changes
Pulls out the correct
message
type for each transaction ingetTransactions
callcc @joncinque would you be able to review this for me? thanks!