-
Notifications
You must be signed in to change notification settings - Fork 6
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
US-996 RIF Wallet libs - Sending a transaction should check if the user has the funds + fee before sending (RIF RELAY) #739
Conversation
@TravellerOnTheRun I attempted to test this PR but received the following error message: 20230912_123925.mp4 |
if (tokenToBoolMap.get(symbol as TokenSymbol)) { | ||
insufficientFunds = | ||
Number(value) + Number(feeValue) > | ||
Number(balances[RIF_TOKEN_ADDRESS_TESTNET].balance) |
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 RIF TOKEN ADDRESS TESTNET should be dynamic in terms of which chainId the app currently has defined in settingsSlice because when we switch to mainnet it'll not. be testnet anymore
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 since you're handling TESTNET
to MAINNET
, you can do that as well.
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.
Remember what I said in a daily that we must always use the chainId since I changed all the references to use the one we have in Redux and not a hardcoded one, it's as easy as getting the chainId from redux and using it there
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 shouldn't be needed in general, you can use feeSymbol
from line 80 and then feeContract
on line 81 to get the address of the fee payment. From there, you should be able to check the balances.
We also need to check if the user is trying to send a different token, like RDOC, and doesn't have enough RIF to pay the fee. I'm not sure if that is being covered here.
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.
@jessgusclark That is being covered, I check if the symbol is not being found(means not RIF), I check that there's enough balance only for fee
I just tested the following test cases:
all of them worked as expected |
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.
Code looks good.
Functional tested OK.
…er has the funds + fee before sending (RIF RELAY) (#739) * feat: handle insuffient funds * refactor: use feeContract as address to search balances
Simulator.Screen.Recording.-.iPhone.13.-.2023-09-12.at.13.15.03.mp4