-
Notifications
You must be signed in to change notification settings - Fork 200
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: fetch correct cctp history for contract wallets #2058
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
tested claiming on Sepolia using an SCW, it works well
export const useCCTPDeposits = ({ | ||
walletAddress, | ||
l1ChainId, | ||
pageNumber, | ||
pageSize, | ||
enabled | ||
}: fetchCctpParams) => { | ||
const { isSmartContractWallet } = useAccountType() | ||
const chainId = useChainId() |
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 think we want to avoid using useChainId()
because it returns Ethereum for chains not in wagmi config?
Closes FS-969
Issue
User withdraws USDC via CCTP from L2 Safe to L1. Then they connect to the destination account and don't see the transaction in the history.
Current setup and why it doesn't work:
Currently we use
cctpTypeToFetch
to determine what type of transfers we fetch:deposits
,withdrawals
orall
. In case of EOA we fetch all (and it's fine because EOA's address is the same on L1 and L2). However, when using SCW we fetch eitherdeposits
orwithdrawals
. The current flow for SCW is as follows:Now if user is connected to the parent chain, we only fetch deposits. Which means they won't see withdrawals to their account and won't be able to claim from this account.
Solution
To fix this, we need to fetch
all
CCTP transfers for SCW as well, but we need to keep in mind that L1 and L2 addresses may not be the same. To cover this we filter out transactions that aren't user's transactions. We use the following logic for this:I. Fetching deposits
Show if sender === walletAddress
Show if receiver === walletAddress
II. Fetching withdrawals