Skip to content

Commit

Permalink
Merge pull request #78 from skalenetwork/add-erc721-tokens-support
Browse files Browse the repository at this point in the history
Add erc721 tokens support
  • Loading branch information
dmytrotkk authored Nov 14, 2022
2 parents 75377f8 + a373240 commit fa516a3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/TokenList/TokenList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import TokenBalance from './TokenBalance';

import styles from "../WidgetUI/WidgetUI.scss";
import localStyles from "./TokenList.scss";
import { getIconSrc, iconPath } from "./iconsHelper";
import { getIconSrc, iconPath, getTokenName } from "./helper";


export default function TokenList(props) {
Expand Down Expand Up @@ -63,7 +63,7 @@ export default function TokenList(props) {
styles.mp__flexGrow,
styles.mp__margRi10
)}>
{props.token.unwrappedSymbol ? props.token.unwrappedSymbol : props.token.name}
{getTokenName(props.token)}
</p>
<TokenBalance token={props.token} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,25 @@
*/

/**
* @file iconsHelper.ts
* @file helper.ts
* @copyright SKALE Labs 2022-Present
*/

import TokenData from '../../core/dataclasses/TokenData';


export function getTokenSymbol(token: TokenData): string {
let symbol = token.unwrappedSymbol ? token.unwrappedSymbol : token.symbol;
if (token.clone) symbol = token.cloneSymbol ? token.cloneSymbol : symbol;
return symbol;
}


export function getTokenName(token: TokenData): string {
return token.name ? token.name : getTokenSymbol(token);
}


function importAll(r) {
const images = {};
r.keys().map((item, index) => { images[item.replace('./', '')] = r(item); });
Expand Down
4 changes: 2 additions & 2 deletions src/components/TokenListSection/TokenListSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TokenBalance from '../TokenList/TokenBalance';

import styles from "../WidgetUI/WidgetUI.scss";
import localStyles from "./TokenListSection.scss";
import { getIconSrc } from "../TokenList/iconsHelper";
import { getIconSrc, getTokenName } from "../TokenList/helper";


export default function TokenListSection(props) {
Expand Down Expand Up @@ -49,7 +49,7 @@ export default function TokenListSection(props) {
styles.mp__flexGrow,
styles.mp__margRi10
)}>
{props.tokens[key].unwrappedSymbol ? props.tokens[key].unwrappedSymbol : props.tokens[key].name}
{getTokenName(props.tokens[key])}
</p>
<TokenBalance token={props.tokens[key]} />
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/WidgetBody/WidgetBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ export default function WidgetBody(props) {
</Collapse>
<Collapse in={
props.operationType !== OperationType.unwrap &&
!props.expandedFrom &&
!props.expandedTo &&
!props.expandedTokens &&
!expandedFrom &&
!expandedTo &&
!expandedTokens &&
!wrapTransferAction
}>
<WrappedTokensWarning
Expand Down

0 comments on commit fa516a3

Please sign in to comment.