-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(permit): with token name (#312)
* feat: update schema * chore: update unit tests to match new schema * refactor: rename getTokens to getTokensFromTokenList * feat: update all permits to new format * feat: add option to recheck unsupported tokens * chore: do not use name from token list * refactor: simplify conditional * feat: update sort fn * chore: make name and symbol optional * chore: fix conditional * refactor: move getUnsupportedTokensFromPermitInfo to utils fn * chore: use p-throttle for limiting how often the permit check is done and avoid rpc failures * chore: remove unnecessary optional operators * chore: update to latest permit-utils, which doesn't work as it's not published yet * chore: 4 more permittable tokens found... * chore: 2 more tokens... * chore: add p-retry for retrying :) * chore: retry on exceptions and connection errors * chore: also retry on rpc connection failures * feat: use published version of @cowprotocol/permit-utils * chore: ran against https://tokens.honeyswap.org list * Set the original name of the contracts: result from running the script --------- Co-authored-by: Anxo Rodriguez <[email protected]>
- Loading branch information
1 parent
4779ac4
commit 8f10869
Showing
12 changed files
with
5,815 additions
and
1,290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export type Token = { | ||
address: string | ||
name: string | ||
chainId: number | ||
symbol: string | ||
name?: string | ||
symbol?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/permitInfo/utils/getUnsupportedTokensFromPermitInfo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { isSupportedPermitInfo, PermitInfo } from '@cowprotocol/permit-utils' | ||
import { Token } from '../types.js' | ||
|
||
export function getUnsupportedTokensFromPermitInfo( | ||
chainId: number, | ||
allPermitInfo: Record<string, PermitInfo>, | ||
): Token[] { | ||
const tokens = [] | ||
|
||
for (const [k, v] of Object.entries(allPermitInfo)) { | ||
if (!isSupportedPermitInfo(v)) { | ||
tokens.push({ address: k, name: v?.name, chainId }) | ||
} | ||
} | ||
|
||
return tokens | ||
} |
Oops, something went wrong.