Skip to content

Commit

Permalink
Merge pull request #679 from oasisprotocol/csillag/fix-erc271-tokens
Browse files Browse the repository at this point in the history
Begin to fix ERC-271 tokens
  • Loading branch information
csillag authored Jul 6, 2023
2 parents bdadcfb + 972e623 commit da99414
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions .changelog/679.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't die on ERC-721 tokens
2 changes: 2 additions & 0 deletions src/app/pages/TokenDashboardPage/TokenTypeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const getTokenTypeName = (t: TFunction, type: EvmTokenType): string => {
switch (type) {
case 'ERC20':
return t('account.ERC20')
case 'ERC721':
return t('account.ERC721')
default:
exhaustedTypeWarning('Unknown token type', type)
return type
Expand Down
1 change: 1 addition & 0 deletions src/app/utils/route-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export abstract class RouteUtils {
) => {
const map: Record<EvmTokenType, string | undefined> = {
ERC20: `${this.getAccountRoute(scope, account)}/tokens/erc-20`,
ERC721: `${this.getAccountRoute(scope, account)}/tokens/erc-721`,
}
const tokenRoutes = map[tokenType]
if (!tokenRoutes) throw new Error('Unexpected token type')
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"emptyTransactionList": "There are no transactions on record for this account.",
"emptyTokenTransferList": "There are no token transfers on record for this account.",
"ERC20": "ERC-20",
"ERC721": "ERC-721",
"noTokens": "This account holds no tokens",
"showMore": "+ {{counter}} more",
"title": "Account",
Expand Down
1 change: 1 addition & 0 deletions src/oasis-nexus/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const isAccountNonEmpty = (account: RuntimeAccount) => !isAccountEmpty(ac
export const groupAccountTokenBalances = (account: Omit<RuntimeAccount, 'tokenBalances'>): RuntimeAccount => {
const tokenBalances: Record<generated.EvmTokenType, generated.RuntimeEvmBalance[]> = {
ERC20: [],
ERC721: [],
}
account.evm_balances.forEach(balance => {
if (balance.token_type) tokenBalances[balance.token_type].push(balance)
Expand Down
13 changes: 11 additions & 2 deletions src/oasis-nexus/generated/api.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit da99414

Please sign in to comment.