-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat: useTransfers hook [OTE-853] #1137
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
223ceca
to
3f05f3d
Compare
8f319ae
to
3f4510e
Compare
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.
nice work jeremy!
src/constants/transfers.ts
Outdated
const defaultTokenDenom = cctpToken?.denom ?? nativeChainToken?.denom ?? assets[0]?.denom; | ||
return defaultTokenDenom; |
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.
const defaultTokenDenom = cctpToken?.denom ?? nativeChainToken?.denom ?? assets[0]?.denom; | |
return defaultTokenDenom; | |
return cctpToken?.denom ?? nativeChainToken?.denom ?? assets[0]?.denom; |
maybe leave a comment about why assets[0] would be valid 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.
oh forgot to add a response here:
- added the comment!
- personally prefer to keep declaration and return value separate for code that's in development, makes things slightly more convenient to debug. down to roll into a capstone PR and add a comment though
e87f259
to
5424002
Compare
5424002
to
fd49261
Compare
fd49261
to
161146b
Compare
2709192
to
43b39a9
Compare
3271240
to
2202ef9
Compare
remcve skip core limit memory usememo address comments
cleanup add tests use skip client hook instead of lib
2202ef9
to
2cd87e1
Compare
src/hooks/transfers/useTransfers.tsx
Outdated
if (isTokenCctp(fromToken)) { | ||
// CCTP Deposits | ||
return skipClient.msgsDirect({ | ||
...(baseParams as MsgsDirectRequest), |
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.
[fix] this doesn't need to be here
src/hooks/transfers/useTransfers.tsx
Outdated
queryFn: async () => { | ||
// this should never happen, this is just to satisfy typescript | ||
// react queries should never return null. | ||
if (!hasAllParams || !fromToken.decimals) return null; |
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.
[fix] i should probably actually be throwing an error here
}), | ||
skipClientId: crypto.randomUUID(), |
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.
👀 what is this clientId supposed to represent? can you leave a comment?
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.
ooo good point! will do :)
src/hooks/transfers/useTransfers.tsx
Outdated
allowUnsafe: true, | ||
slippageTolerancePercent: '1', | ||
smartRelay: true, | ||
// TODO [onboarding-rewrite]: talk to skip about this, why are decimals optional? when would that happen? |
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.
move TODO to line 170?
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.
oh actually good point, we actually know why this happens now i'll update this comment
src/App.tsx
Outdated
queryKey: ['transferEligibleAssets', skipClientId], | ||
queryFn: () => assetsQueryFn(skipClient), | ||
}); | ||
}, [skipClient]); |
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.
wont hurt to also just add in skipClientId here to get rid of the lint warning
src/App.tsx
Outdated
@@ -100,6 +104,17 @@ const Content = () => { | |||
} | |||
}, [dispatch]); | |||
|
|||
useEffect(() => { |
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.
can you move this to a separate hook, or its own React component called <PreloadedQueries />
or something?
b953249
to
e943b6e
Compare
e943b6e
to
aa5a089
Compare
Adds usetransfers hook that takes the place of abacus state.
Some cleanup around the native chain address variable.
The native chain address can be represented as either
{chain_name}_native
(skip API response + requests) and0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
(cosmJS + wagmi response/requests). We need to account for both now