Skip to content

Commit b849640

Browse files
committed
⚡ Add configurable NftLoading delay
1 parent b3b779f commit b849640

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Runtime/codebase/Web3.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public static event BalanceChange OnBalanceChange
9999

100100
private static List<Nft.Nft> _nfts = new();
101101
private static bool _isLoadingNfts;
102+
public static int NftLoadingRequestsDelay { get; set; } = 0;
102103

103104
public delegate void NFTsUpdate(List<Nft.Nft> nfts, int total);
104105
private static event NFTsUpdate OnNFTsUpdateInternal;
@@ -372,7 +373,7 @@ public static async UniTask UpdateNFTs(Commitment commitment = Commitment.Confir
372373
if (Application.platform == RuntimePlatform.WebGLPlayer)
373374
{
374375
// If we are on WebGL, we need to add a min delay between requests
375-
requestsMillisecondsDelay = Mathf.Max(requestsMillisecondsDelay, 100);
376+
requestsMillisecondsDelay = Mathf.Max(requestsMillisecondsDelay, 100, NftLoadingRequestsDelay);
376377
}
377378
if (requestsMillisecondsDelay > 0) await UniTask.Delay(requestsMillisecondsDelay);
378379

@@ -395,7 +396,7 @@ public static async UniTask UpdateNFTs(Commitment commitment = Commitment.Confir
395396
_nfts = nfts;
396397
return nfts;
397398
}
398-
399+
399400
private static async UniTask SubscribeToWalletEvents(Commitment commitment = Commitment.Confirmed)
400401
{
401402
if(WsRpc == null) return;

0 commit comments

Comments
 (0)