Skip to content

Commit

Permalink
feat: update nft endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
nattb8 committed Nov 3, 2024
1 parent 263875c commit 6eaddf9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class InventoryAssetDetailsView : View
[SerializeField] private GameObject m_Progress;
[SerializeField] private CustomDialog m_CustomDialog;

private StacksApi m_StacksApi = new(new Configuration { BasePath = Config.BASE_URL });
private MetadataSearchApi m_MetadataSearchApi = new(new Configuration { BasePath = Config.BASE_URL });
private readonly List<AttributeView> m_Attributes = new();
private NFTBundle? m_Asset;
private string? m_ListingId;
Expand Down Expand Up @@ -167,7 +167,7 @@ private async UniTask LoadAssetImage() =>

try
{
var result = await m_StacksApi.SearchNFTsAsync(
var result = await m_MetadataSearchApi.SearchNFTsAsync(
chainName: Config.CHAIN_NAME,
contractAddress: new List<string> { m_Asset.NftWithStack.ContractAddress },
accountAddress: SaveManager.Instance.WalletAddress,
Expand Down
4 changes: 2 additions & 2 deletions Assets/Shared/Scripts/UI/Inventory/InventoryScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum AssetType { Skin, Powerups }
[SerializeField] private InfiniteScrollGridView m_ScrollView;
[SerializeField] private AddFunds m_AddFunds;

private StacksApi m_StacksApi = new(new Configuration { BasePath = Config.BASE_URL });
private MetadataSearchApi m_MetadataSearchApi = new(new Configuration { BasePath = Config.BASE_URL });
private AssetType m_Type = AssetType.Skin;
private readonly List<NFTBundle> m_Assets = new();
private bool m_IsLoadingMore;
Expand Down Expand Up @@ -134,7 +134,7 @@ private async UniTask<List<NFTBundle>> GetAssets()

var contractAddress = m_Type == AssetType.Skin ? Contract.SKIN : Contract.PACK;

var result = await m_StacksApi.SearchNFTsAsync(
var result = await m_MetadataSearchApi.SearchNFTsAsync(
Config.CHAIN_NAME,
new List<string> { contractAddress },
SaveManager.Instance.WalletAddress,
Expand Down
6 changes: 3 additions & 3 deletions Assets/Shared/Scripts/UI/Marketplace/MarketplaceScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class MarketplaceScreen : View
[SerializeField] private AddFunds m_AddFunds;
[SerializeField] private CustomDialog m_CustomDialog;

private StacksApi m_StacksApi = new(new Configuration { BasePath = Config.BASE_URL });
private MetadataSearchApi m_MetadataSearchApi = new(new Configuration { BasePath = Config.BASE_URL });
private readonly List<StackBundle> m_Stacks = new();
private List<string> m_Colours = new();
private List<string> m_Speeds = new();
Expand Down Expand Up @@ -79,7 +79,7 @@ private async void OnEnable()
/// </summary>
private async void ConfigureFilters()
{
var filtersResponse = await m_StacksApi.ListFiltersAsync(
var filtersResponse = await m_MetadataSearchApi.ListFiltersAsync(
chainName: Config.CHAIN_NAME,
contractAddress: Contract.SKIN);
var filters = filtersResponse.Result.Filters;
Expand Down Expand Up @@ -198,7 +198,7 @@ private async UniTask<List<StackBundle>> GetStacks()
var trait = filters.Count > 0 ? JsonConvert.SerializeObject(filters) : null;

// Fetch stacks from the API
var result = await m_StacksApi.SearchStacksAsync(
var result = await m_MetadataSearchApi.SearchStacksAsync(
Config.CHAIN_NAME,
new List<string> { Contract.SKIN },
traits: trait,
Expand Down
8 changes: 3 additions & 5 deletions Assets/Shared/Scripts/UI/Shop/ShopScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@ private void OnCreateItemView(int index, GameObject item)
private async void LoadPacks()
{
var packs = await GetPacks();
if (packs != null && packs.Count > 0)
{
m_Packs.AddRange(packs);
m_ScrollView.TotalItemCount = m_Packs.Count;
}
if (packs == null || packs.Count <= 0) return;
m_Packs.AddRange(packs);
m_ScrollView.TotalItemCount = m_Packs.Count;
}

private async UniTask<List<Pack>> GetPacks()
Expand Down
2 changes: 0 additions & 2 deletions Assets/Shared/Services/ApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static async UniTask<bool> MintCoins(string to, string quantity)
{
var success = false;
var url = $"{Config.SERVER_URL}/mint/token";
Debug.Log($"MintCoins url: {url}");
#if UNITY_WEBGL
var form = new WWWForm();
form.AddField("to", to);
Expand Down Expand Up @@ -43,7 +42,6 @@ public static async UniTask<bool> MintCoins(string to, string quantity)
public static async UniTask<bool> MintFox(string to)
{
var url = $"{Config.SERVER_URL}/mint/fox";
Debug.Log($"MintFox url: {url}");
#if UNITY_WEBGL
var form = new WWWForm();
form.AddField("to", to);
Expand Down
2 changes: 1 addition & 1 deletion Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"com.unity.nuget.newtonsoft-json": "3.0.2"
},
"hash": "493055b6a6791a35b3ae53becea94f12420f1703"
"hash": "daf0a1b029979053349efec7c382ef3e0dea27a4"
},
"com.immutable.marketplace": {
"version": "https://github.com/immutable/unity-immutable-sdk.git?path=/src/Packages/Marketplace",
Expand Down

0 comments on commit 6eaddf9

Please sign in to comment.