Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Packages/Solana.Unity.Metaplex.dll
Binary file not shown.
Binary file modified Packages/Solana.Unity.Rpc.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions Runtime/codebase/WalletBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ private IRpcClient StartConnection()
{
if (_activeRpcClient == null && CustomRpcUri.IsNullOrEmpty())
{
_activeRpcClient = ClientFactory.GetClient(_rpcClusterMap[(int)RpcCluster], logger: true);
_activeRpcClient = ClientFactory.GetClient(_rpcClusterMap[(int)RpcCluster]);
}
if (_activeRpcClient == null && !CustomRpcUri.IsNullOrEmpty())
{
_activeRpcClient = ClientFactory.GetClient(CustomRpcUri, logger: true);
_activeRpcClient = ClientFactory.GetClient(CustomRpcUri);
}

return _activeRpcClient;
Expand All @@ -349,7 +349,7 @@ private IStreamingRpcClient StartStreamingConnection()
if (CustomStreamingRpcUri != null)
{
_webSocketConnection = new TaskCompletionSource<object>();
_activeStreamingRpcClient = ClientFactory.GetStreamingClient(CustomStreamingRpcUri, true);
_activeStreamingRpcClient = ClientFactory.GetStreamingClient(CustomStreamingRpcUri);
_activeStreamingRpcClient
.ConnectAsync()
.AsUniTask()
Expand Down
10 changes: 7 additions & 3 deletions Runtime/codebase/Web3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,24 +348,27 @@ public static async UniTask UpdateNFTs(Commitment commitment = Commitment.Confir
.Select(x => x.First())
.ToList()
.FindAll(x => x.metaplexData.data.offchainData != null);

// Fetch nfts
List<UniTask> loadingTasks = new List<UniTask>();
List<Nft.Nft> nfts = new List<Nft.Nft>(_nfts);

var total = 0;
if (tokens is {Count: > 0})
{
var toFetch = tokens
.Where(item => item.Account.Data.Parsed.Info.TokenAmount.AmountUlong == 1)
.Where(item => nfts
.All(t => t.metaplexData.data.mint!= item.Account.Data.Parsed.Info.Mint)).ToArray();
var total = nfts.Count + toFetch.Length;
total = nfts.Count + toFetch.Length;

foreach (var item in toFetch)
{
var tNft = Nft.Nft.TryGetNftData(item.Account.Data.Parsed.Info.Mint, Rpc, loadTexture: loadTexture).AsUniTask();
loadingTasks.Add(tNft);
tNft.ContinueWith(nft =>
{
if(nft == null) {
if(tNft.AsTask().Exception != null || nft == null) {
total--;
return;
}
Expand All @@ -376,6 +379,7 @@ public static async UniTask UpdateNFTs(Commitment commitment = Commitment.Confir
}
}
await UniTask.WhenAll(loadingTasks);
if(total == 0) OnNFTsUpdateInternal?.Invoke(nfts, total);
_nfts = nfts;
return nfts;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.solana.unity_sdk",
"version": "0.1.4",
"version": "0.1.5",
"unity": "2019.4",
"displayName": "Solana SDK",
"description": "Open-Source Unity-Solana SDK with Full RPC coverage, NFT support and more",
Expand Down