-
Notifications
You must be signed in to change notification settings - Fork 34
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
🧪 mock get transaction receipt #231
🧪 mock get transaction receipt #231
Conversation
effectiveGasPrice: tinyBig(mockReceiptResponse.effectiveGasPrice), | ||
gasUsed: tinyBig(mockReceiptResponse.gasUsed), | ||
status: Number(hexToDecimal(mockReceiptResponse.status)), | ||
logs: mockReceiptResponse.logs.map(({ removed, ...log }) => ({ |
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.
Sleek and interesting, but I have no idea what this does.
Probably too tricky to throw into a JSON object like this. Perhaps we can name this a helpful const
like "mockLogsWithoutWhatever
" above the mockReceipt
initialization then use it inside here?
My main misunderstanding is why we need to remove anything from the logs
using this restructuring and a well-named variable above might be helpful
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 was trying to clean the log without using the cleanLog
function, but I see how this confusing. I will just use the helper and add cleanLog to the list of helpers to test #228.
(log) => omit(log, ['id', 'removed'] as any) as any, | ||
); | ||
const mockBlocksBetween = 10; | ||
const mockReceiptResponse = { |
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.
WOW, this will be so helpful to get merged. Big objects 🙌
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.
👍👍👍
@dawsbot Here is another one.
I used destructuring here to remove an element from the copy which I thought was pretty sick 🧼
https://github.com/jtfirek/essential-eth/blob/5840d0255a5383f2d69a29131f6d2a25e3b34d15/src/providers/test/json-rpc-provider/get-transaction-receipt.test.ts#L64