You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the Axelar bridge integration, while a user is depositing, changing the account in MetaMask causes no issues since generating a deposit address only takes in the destination address (on Osmosis in this case). So, it doesn't matter which account funds are sent from. However, when withdrawing, switching the account in MetaMask (the destination address) causes the generated deposit address to no longer be valid. Sending funds to it would transfer the funds to the address selected while the modal was first opened.
Proposed Solution
Instead, we should handle this by regenerating the account address every time and only when address in the snippet below changes, causing this useEffect hook to re-run and invoke the Axelar SDK deposit address API. I faintly remember having this enabled before, but I added the last check (!depositAddress) to prevent the doGen from being run when other deps besides just address is changed. AKA instead of getting the right deps arrays in this and subsequent memo hooks right, I added this check and introduced this bug. Perhaps an additional if statement should be added to just handle the address changing, rather than the component mounting which is already in the snippet.
Alternative/fallback solution if nothing else works. Keep track of the address the Axelar deposit address was generated for, and if the MetaMask account is different, display an error and disable button.
Edit, perhaps for some number of re-queries, we could rerun the address generation if the current address is changed from the recently generated-for destination address.
Problem
With the Axelar bridge integration, while a user is depositing, changing the account in MetaMask causes no issues since generating a deposit address only takes in the destination address (on Osmosis in this case). So, it doesn't matter which account funds are sent from. However, when withdrawing, switching the account in MetaMask (the destination address) causes the generated deposit address to no longer be valid. Sending funds to it would transfer the funds to the address selected while the modal was first opened.
Proposed Solution
Instead, we should handle this by regenerating the account address every time and only when
address
in the snippet below changes, causing thisuseEffect
hook to re-run and invoke the Axelar SDK deposit address API. I faintly remember having this enabled before, but I added the last check (!depositAddress
) to prevent thedoGen
from being run when other deps besides justaddress
is changed. AKA instead of getting the right deps arrays in this and subsequent memo hooks right, I added this check and introduced this bug. Perhaps an additional if statement should be added to just handle the address changing, rather than the component mounting which is already in the snippet.osmosis-frontend/packages/web/integrations/axelar/hooks/use-deposit-address.ts
Lines 60 to 64 in 7ae91cb
The text was updated successfully, but these errors were encountered: