Skip to content
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

chore(viem-fees): get fee estimates for case where token supports comments #4439

Merged
merged 3 commits into from
Nov 7, 2023

Conversation

cajubelt
Copy link
Contributor

@cajubelt cajubelt commented Nov 6, 2023

Description

Get fee estimates for c-stables transferWithComment method in select amount screen.

Note that since DEK registration does not actually take place before the send transaction, even if the DEK is not registered on-chain yet, DEK registration fees are not included. More context on DEK's here

Test plan

jest tests

tested manually, looks like this:
simulator_screenshot_F4C3AAF7-9E4C-4431-8DEF-E79FEBA1A01C

Related issues

cc https://linear.app/valora/issue/ACT-955/lazy-viem-fees-for-send-celo-only

Backwards compatibility

na

Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #4439 (98c1669) into main (471c876) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4439      +/-   ##
==========================================
+ Coverage   85.06%   85.08%   +0.02%     
==========================================
  Files         710      710              
  Lines       26349    26361      +12     
  Branches     3576     3576              
==========================================
+ Hits        22413    22429      +16     
+ Misses       3873     3869       -4     
  Partials       63       63              
Files Coverage Δ
src/send/SendEnterAmount.tsx 93.75% <100.00%> (-0.05%) ⬇️
src/send/usePrepareSendTransactions.ts 86.20% <100.00%> (ø)
src/viem/prepareTransactions.ts 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 471c876...98c1669. Read the comment docs.

feeCurrencies,
}
if (tokenSupportsComments(token)) {
return prepareTransferWithCommentTransaction(transactionParams)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't include comments because we only request it on the next screen right? Can fees change based on the length of the comment?

Copy link
Contributor Author

@cajubelt cajubelt Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah they can... I'd like to follow up on that in a separate PR since I think this one has reasonable behavior for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a good point though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thing we could do is set a maximum length on comments on the next screen, and on this screen use a dummy comment that is of the max length, which is the most pessimistic scenario for gas fee estimation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a little tricky because we then encrypt the comment, so we can't just use the same constant in both places

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes setting a MAX_COMMENT_LENGTH is what the contractkit code did to estimate it:

export const MAX_COMMENT_LENGTH = 70

I haven't followed the latest send UI changes, but should we maybe tweak the UI flow so this isn't too much of a problem with prepared transactions?

@cajubelt cajubelt enabled auto-merge (squash) November 7, 2023 04:05
@cajubelt cajubelt merged commit 938693c into main Nov 7, 2023
15 checks passed
@cajubelt cajubelt deleted the cajubelt/transfer-with-comments-fee-previews branch November 7, 2023 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants