Skip to content

Commit

Permalink
fix: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sahar-fehri committed Jun 5, 2024
1 parent 264df7e commit abc8312
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions packages/assets-controllers/src/NftController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,6 @@ export const getDefaultNftControllerState = (): NftControllerState => ({
ignoredNfts: [],
});

const RATE_LIMIT_NFT_UPDATE_DELAY = 600; // 10 mins
export const RATE_LIMIT_NFT_INTERVAL = RATE_LIMIT_NFT_UPDATE_DELAY * 1000;

/**
* Controller that stores assets and exposes convenience methods
*/
Expand Down Expand Up @@ -294,8 +291,6 @@ export class NftController extends BaseController<
source: Source;
}) => void;

#lastNftRefreshTime = 0;

/**
* Creates an NftController instance.
*
Expand Down Expand Up @@ -423,10 +418,6 @@ export class NftController extends BaseController<
openSeaEnabled,
isIpfsGatewayEnabled,
}: PreferencesState) {
if (selectedAddress !== this.#selectedAddress) {
this.#lastNftRefreshTime = 0;
}

this.#selectedAddress = selectedAddress;
this.#ipfsGateway = ipfsGateway;
this.#openSeaEnabled = openSeaEnabled;
Expand Down Expand Up @@ -1462,13 +1453,6 @@ export class NftController extends BaseController<
const releaseLock = await this.#mutex.acquire();

try {
const time = Date.now();
const timeSinceLastNftUpdateRequest = time - this.#lastNftRefreshTime;

if (timeSinceLastNftUpdateRequest < RATE_LIMIT_NFT_INTERVAL) {
return;
}

const chainId = this.#getCorrectChainId({ networkClientId });

const nftsWithChecksumAdr = nfts.map((nft) => {
Expand All @@ -1490,7 +1474,6 @@ export class NftController extends BaseController<
};
}),
);
this.#lastNftRefreshTime = Date.now();

// We want to avoid updating the state if the state and fetched nft info are the same
const nftsWithDifferentMetadata: NftUpdate[] = [];
Expand Down

0 comments on commit abc8312

Please sign in to comment.