Skip to content

Commit

Permalink
fix: erc20 image issue & tokenId loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
micwallace committed Nov 11, 2024
1 parent fd13839 commit c7b3430
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion javascript/engine-js/src/AbstractTokenScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export abstract class AbstractTokenScript implements ITokenScript {

const balance = tokenContext.balance ? tokenContext.balance.toString() : "0"; // bigint can't be json serialized, so it must always be string

const image = this.getMetadata().imageUrl ?? tokenDetails?.image ?? this.getMetadata().iconUrl;
const image = this.getMetadata().imageUrl ?? tokenDetails?.image ?? tokenContext.image ?? this.getMetadata().iconUrl;

data = {
name: tokenDetails?.name ?? tokenContext.name,
Expand All @@ -304,6 +304,7 @@ export abstract class AbstractTokenScript implements ITokenScript {
tokenId: tokenContext.selectedTokenId,
ownerAddress: tokenContext.tokenType === "erc20" ? await this.getCurrentWalletAddress() : ZeroAddress,
image_preview_url: image,
image
};

if (tokenDetails) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ export class TokensGrid {

if (walletConnection){
this.currentWalletAddress = walletConnection.address.toLowerCase();
this.tokenScript.getTokenMetadata(true);
} else {
this.currentWalletAddress = ZeroAddress;
this.tokenScript.setTokenMetadata([]);
}
await this.tokenScript.getTokenMetadata(true);
});

if (Web3WalletProvider.isWalletConnected())
Expand Down

0 comments on commit c7b3430

Please sign in to comment.