diff --git a/Editor/FeatureSpawner.cs b/Editor/FeatureSpawner.cs index 32e1496d..ad220e67 100644 --- a/Editor/FeatureSpawner.cs +++ b/Editor/FeatureSpawner.cs @@ -61,7 +61,7 @@ static void Spawn_Txn_Account() [MenuItem(GameObjMenu + AlturaConstants.FeatureName_Txn_NFT)] static void Spawn_Txn_NFT() { - Selection.activeGameObject= new GameObject(AlturaConstants.FeatureName_Txn_NFT).AddComponent().gameObject; + Selection.activeGameObject= new GameObject(AlturaConstants.FeatureName_Txn_NFT).AddComponent().gameObject; } [MenuItem(AlturaConstants.BaseFeatureSpawnerMenu + AlturaConstants.FeatureName_Txn_Collection)] diff --git a/Editor/Txn_NFT_Editor.cs b/Editor/GetItems_Editor.cs similarity index 85% rename from Editor/Txn_NFT_Editor.cs rename to Editor/GetItems_Editor.cs index e2cbd6aa..a6838d2e 100644 --- a/Editor/Txn_NFT_Editor.cs +++ b/Editor/GetItems_Editor.cs @@ -5,13 +5,13 @@ namespace AlturaNFT.Editor using UnityEditor; using Internal; - [CustomEditor(typeof(Txn_NFT))] - public class Txn_NFT_Editor : Editor + [CustomEditor(typeof(GetItems))] + public class GetItems_Editor : Editor { public override void OnInspectorGUI() { - Txn_NFT myScript = (Txn_NFT)target; + GetItems myScript = (GetItems)target; Texture banner = Resources.Load("c_nftdata_details"); diff --git a/Editor/Txn_NFT_Editor.cs.meta b/Editor/GetItems_Editor.cs.meta similarity index 100% rename from Editor/Txn_NFT_Editor.cs.meta rename to Editor/GetItems_Editor.cs.meta diff --git a/Runtime/Txn_NFT.cs b/Runtime/GetItems.cs similarity index 89% rename from Runtime/Txn_NFT.cs rename to Runtime/GetItems.cs index f35e512c..241d1400 100644 --- a/Runtime/Txn_NFT.cs +++ b/Runtime/GetItems.cs @@ -13,7 +13,7 @@ namespace AlturaNFT [AddComponentMenu(AlturaConstants.BaseComponentMenu+AlturaConstants.FeatureName_Txn_NFT)] [ExecuteAlways] [HelpURL(AlturaConstants.Docs_Txns_NFT)] - public class Txn_NFT : MonoBehaviour + public class GetItems : MonoBehaviour { /// /// Currently Supported chains for this endpoint. @@ -99,9 +99,9 @@ private void OnEnable() /// Initialize creates a gameobject and assings this script as a component. This must be called if you are not refrencing the script any other way and it doesn't already exists in the scene. /// /// Optional bool parameter can set to false to avoid Spawned GameObject being destroyed after the Api process is complete. - public static Txn_NFT Initialize(bool destroyAtEnd = true) + public static GetItems Initialize(bool destroyAtEnd = true) { - var _this = new GameObject(AlturaConstants.FeatureName_Txn_NFT).AddComponent(); + var _this = new GameObject(AlturaConstants.FeatureName_Txn_NFT).AddComponent(); _this.destroyAtEnd = destroyAtEnd; _this.onEnable = false; _this.debugErrorLog = false; @@ -112,7 +112,7 @@ public static Txn_NFT Initialize(bool destroyAtEnd = true) /// Set Filter by to return NFTs only from the given contract address/collection. /// /// as string. - public Txn_NFT AlturaOptions(string collection_address) + public GetItems AlturaOptions(string collection_address) { this.collection_address = collection_address; return this; @@ -126,7 +126,7 @@ public Txn_NFT AlturaOptions(string collection_address) /// sort by field /// sort direction /// bool - public Txn_NFT SetParameters(string perPage = "20", string page = "1", string sortBy = "name", string sortDir = "asc", string slim = "true") + public GetItems SetParameters(string perPage = "20", string page = "1", string sortBy = "name", string sortDir = "asc", string slim = "true") { if(perPage!=null) this._perPage = perPage; @@ -148,7 +148,7 @@ public Txn_NFT SetParameters(string perPage = "20", string page = "1", string so /// Blockchain from which to query NFTs. /// /// Choose from available 'Chains' enum - public Txn_NFT SetChain(Chains chain) + public GetItems SetChain(Chains chain) { this.chain = chain; return this; @@ -156,9 +156,7 @@ public Txn_NFT SetChain(Chains chain) /// /// - /// Use: .OnComplete(Txns=> txns = Txns) , where txns is of type Items_model; - /// NFTs_OwnedByAnAccount_model.Root - public Txn_NFT OnComplete(UnityAction action) + public GetItems OnComplete(UnityAction action) { this.OnCompleteAction = action; return this; @@ -168,7 +166,7 @@ public Txn_NFT OnComplete(UnityAction action) /// /// string. /// Information on Error as string text. - public Txn_NFT OnError(UnityAction action) + public GetItems OnError(UnityAction action) { this.OnErrorAction = action; return this; @@ -229,9 +227,9 @@ IEnumerator CallAPIProcess() if (request.error != null) { if(OnErrorAction!=null) - OnErrorAction($"Null data. Response code: {request.responseCode}. Result {jsonResult}"); + OnErrorAction($"Null data {request.responseCode}. Result {jsonResult}"); if(debugErrorLog) - Debug.Log($"(;•͈́༚•͈̀)(•͈́༚•͈̀;)՞༘՞༘՞ Null data. Response code: {request.responseCode}. Result {jsonResult}"); + Debug.Log($"(Null data: {request.responseCode}. Result {jsonResult}"); if(afterError!=null) afterError.Invoke(); @@ -240,7 +238,6 @@ IEnumerator CallAPIProcess() } else { - //Fill Data Model from recieved class item = JsonConvert.DeserializeObject( jsonResult, new JsonSerializerSettings diff --git a/Runtime/Txn_NFT.cs.meta b/Runtime/GetItems.cs.meta similarity index 100% rename from Runtime/Txn_NFT.cs.meta rename to Runtime/GetItems.cs.meta diff --git a/Runtime/Users_Details.cs b/Runtime/Users_Details.cs index 75a34f4e..a0aff2c0 100644 --- a/Runtime/Users_Details.cs +++ b/Runtime/Users_Details.cs @@ -127,6 +127,7 @@ public Users_Details SetParameters(string perPage = "20", string page = "1", str this._sortBy = sortBy; if(sortDir!=null) this._sortDir = sortDir; + return this; diff --git a/Scenes/Scripts/Test.cs b/Scenes/Scripts/Test.cs index 9017a3b5..2c06318c 100644 --- a/Scenes/Scripts/Test.cs +++ b/Scenes/Scripts/Test.cs @@ -7,22 +7,19 @@ public class Test : MonoBehaviour { void Start() { - NFT_Details + GetItems .Initialize(destroyAtEnd:true) - .SetChain(NFT_Details.Chains.bsctest) - .SetParameters( + .SetChain(GetItems.Chains.bsctest) + .SetParameters(perPage:"29", page: "4", sortBy: "name", sortDir: "desc", slim: "false") - //for ethereum- EVM chains - collection_address:"0xb260b4b5e3357b3942ba71cfa0a7bdd32763f8ae", - token_id:1 - - //for solana: - //mint_address: "EH8AaTF9vNiW2poTKoQZKf6yqExYSrnoTxAd62TEfaWn", - - ) .OnError(error=>Debug.Log(error)) .Run(); + Users_Details + .Initialize(destroyAtEnd:true) + .SetParameters(perPage:"29", page: "4", sortBy: "name", sortDir: "desc") + .Run(); + } public Items_model NFTOfUser = new Items_model();