Skip to content

Commit

Permalink
feat: BREAKING: NFTDetails parameter contract_address has been rename…
Browse files Browse the repository at this point in the history
…d to collection ( to make it more unified with different chain namings going forward)
  • Loading branch information
saszer committed Sep 18, 2022
1 parent 81868b3 commit 3073b98
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Runtime/NFT_Details.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System.Collections;
using Newtonsoft.Json;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Serialization;

namespace NFTPort
{ using Internal;
Expand Down Expand Up @@ -31,9 +33,10 @@ public enum Chains
[SerializeField]
private Chains chain = Chains.ethereum;

[SerializeField]
[FormerlySerializedAs("_contract_address")]
[SerializeField][Header("Contract/Collection Address")]
[DrawIf("chain", Chains.solana , DrawIfAttribute.DisablingType.DontDrawInverse)]
private string _contract_address = "Input Contract Address of the NFT collection";
private string _collection = "Input Contract Address of the NFT collection";

[SerializeField]
[DrawIf("chain", Chains.solana , DrawIfAttribute.DisablingType.DontDrawInverse)]
Expand Down Expand Up @@ -113,11 +116,11 @@ public static NFT_Details Initialize(bool destroyAtEnd = true)
/// <param name="token_id"> as int - EVM.</param>
/// <param name="mint_address"> mint_address - Solana.</param>
/// <param name="refresh_metadata"> Queues and refreshes the metadata of the token if it has changed since the updated_date. Useful for example, when NFT collections are revealed or upgraded</param>
public NFT_Details SetParameters(string collection = null, string token_id = "0", string mint_address = null, bool refresh_metadata = false)
public NFT_Details SetParameters(string collection = null, string token_id = null, string mint_address = null, bool refresh_metadata = false)
{
if(collection!=null)
this._contract_address = collection;
if (token_id != -1)
this._collection = collection;
if (token_id != null)
_token_id = token_id;
if (mint_address != null)
_mint_address = mint_address;
Expand Down Expand Up @@ -183,9 +186,9 @@ string BuildUrl()
}
else
{
WEB_URL = RequestUriInit + _contract_address + "/" + _token_id.ToString() + "?chain=" + chain.ToString().ToLower() + "&refresh_metadata=" + _refresh_metadata.ToString();
WEB_URL = RequestUriInit + _collection + "/" + _token_id.ToString() + "?chain=" + chain.ToString().ToLower() + "&refresh_metadata=" + _refresh_metadata.ToString();
if(debugErrorLog)
Debug.Log("Querying Details of NFT: " + _contract_address + " token ID " + _token_id + " on " + chain);
Debug.Log("Querying Details of NFT: " + _collection + " token ID " + _token_id + " on " + chain);
}
return WEB_URL;
}
Expand Down

0 comments on commit 3073b98

Please sign in to comment.