-
Notifications
You must be signed in to change notification settings - Fork 97
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(permit): fetch token name from chain #3374
Changes from all commits
3c1144b
631e5d1
0652a48
540c102
3656709
737fe59
dee9e97
4c8c262
4a60c99
b7e7674
c78b001
7c76c95
227016a
4e80ac9
629fac9
4d2d666
39db8a6
ec82c5f
d3bf9a2
d70baf1
7dfb0cd
72f95b7
f79e97f
4b25698
77471bf
d8ed59f
35fbc52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { isSupportedPermitInfo } from '@cowprotocol/permit-utils' | ||
import { Currency } from '@uniswap/sdk-core' | ||
|
||
import { Nullish } from 'types' | ||
|
||
import { TradeType } from 'modules/trade' | ||
|
||
import { usePermitInfo } from './usePermitInfo' | ||
|
||
/** | ||
* Whether the token supports permit for given trade type | ||
* | ||
* @param token | ||
* @param tradeType | ||
*/ | ||
export function useTokenSupportsPermit(token: Nullish<Currency>, tradeType: Nullish<TradeType>): boolean { | ||
const permitInfo = usePermitInfo(token, tradeType) | ||
|
||
return isSupportedPermitInfo(permitInfo) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
export * from './hooks/useAccountAgnosticPermitHookData' | ||
export * from './hooks/useGeneratePermitHook' | ||
export * from './hooks/useIsTokenPermittable' | ||
export * from './hooks/usePermitInfo' | ||
export * from './hooks/useOrdersPermitStatus' | ||
export * from './hooks/usePermitCompatibleTokens' | ||
export * from './hooks/useTokenSupportsPermit' | ||
export * from './types' | ||
export * from './updaters/PendingPermitUpdater' | ||
export * from './utils/handlePermit' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,9 @@ import { AddPermitTokenParams, PermittableTokens } from '../types' | |
* Atom that stores the permittable tokens info for each chain on localStorage. | ||
* It's meant to be shared across different tabs, thus no special storage handling. | ||
* | ||
* Contains either the permit info with `type` and `gasLimit` when supported or | ||
* `false` when not supported | ||
* Contains either the permit info for every token checked locally | ||
*/ | ||
export const permittableTokensAtom = atomWithStorage<PermittableTokens>('permittableTokens:v1', { | ||
export const permittableTokensAtom = atomWithStorage<PermittableTokens>('permittableTokens:v2', { | ||
Comment on lines
-15
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bumping the version to not use the old formats anymore |
||
[SupportedChainId.MAINNET]: {}, | ||
[SupportedChainId.GOERLI]: {}, | ||
[SupportedChainId.GNOSIS_CHAIN]: {}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[ | ||
{ | ||
"constant": true, | ||
"inputs": [], | ||
"name": "name", | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "string" | ||
} | ||
], | ||
"payable": false, | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] | ||
Comment on lines
+1
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a duplication, I know, but I want to have just the minimal ABI possible. |
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 should only be needed until this hits prod and the token-lists preGenerated version is not updated.