Skip to content

Commit

Permalink
alpha test
Browse files Browse the repository at this point in the history
  • Loading branch information
brohamgoham committed Sep 5, 2022
1 parent 46b29ae commit 256a434
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Editor/FeatureSpawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Txn_NFT>().gameObject;
Selection.activeGameObject= new GameObject(AlturaConstants.FeatureName_Txn_NFT).AddComponent<GetItems>().gameObject;
}

[MenuItem(AlturaConstants.BaseFeatureSpawnerMenu + AlturaConstants.FeatureName_Txn_Collection)]
Expand Down
6 changes: 3 additions & 3 deletions Editor/Txn_NFT_Editor.cs → Editor/GetItems_Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Texture>("c_nftdata_details");
Expand Down
File renamed without changes.
23 changes: 10 additions & 13 deletions Runtime/Txn_NFT.cs → Runtime/GetItems.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>
/// Currently Supported chains for this endpoint.
Expand Down Expand Up @@ -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.
/// </summary>
/// <param name="destroyAtEnd"> Optional bool parameter can set to false to avoid Spawned GameObject being destroyed after the Api process is complete. </param>
public static Txn_NFT Initialize(bool destroyAtEnd = true)
public static GetItems Initialize(bool destroyAtEnd = true)
{
var _this = new GameObject(AlturaConstants.FeatureName_Txn_NFT).AddComponent<Txn_NFT>();
var _this = new GameObject(AlturaConstants.FeatureName_Txn_NFT).AddComponent<GetItems>();
_this.destroyAtEnd = destroyAtEnd;
_this.onEnable = false;
_this.debugErrorLog = false;
Expand All @@ -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.
/// </summary>
///<param name="collection_address"> as string.</param>
public Txn_NFT AlturaOptions(string collection_address)
public GetItems AlturaOptions(string collection_address)
{
this.collection_address = collection_address;
return this;
Expand All @@ -126,7 +126,7 @@ public Txn_NFT AlturaOptions(string collection_address)
/// <param name="sortBy"> sort by field</param>
/// <param name="sortDir"> sort direction</param>
/// <param name="slim"> bool</param>
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;
Expand All @@ -148,17 +148,15 @@ public Txn_NFT SetParameters(string perPage = "20", string page = "1", string so
/// Blockchain from which to query NFTs.
/// </summary>
/// <param name="chain"> Choose from available 'Chains' enum</param>
public Txn_NFT SetChain(Chains chain)
public GetItems SetChain(Chains chain)
{
this.chain = chain;
return this;
}

/// <summary>
/// </summary>
/// <param name="Items_model"> Use: .OnComplete(Txns=> txns = Txns) , where txns is of type Items_model;</param>
/// <returns> NFTs_OwnedByAnAccount_model.Root </returns>
public Txn_NFT OnComplete(UnityAction<Items_model> action)
public GetItems OnComplete(UnityAction<Items_model> action)
{
this.OnCompleteAction = action;
return this;
Expand All @@ -168,7 +166,7 @@ public Txn_NFT OnComplete(UnityAction<Items_model> action)
/// </summary>
/// <param name="UnityAction action"> string.</param>
/// <returns> Information on Error as string text.</returns>
public Txn_NFT OnError(UnityAction<string> action)
public GetItems OnError(UnityAction<string> action)
{
this.OnErrorAction = action;
return this;
Expand Down Expand Up @@ -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();

Expand All @@ -240,7 +238,6 @@ IEnumerator CallAPIProcess()
}
else
{
//Fill Data Model from recieved class
item = JsonConvert.DeserializeObject<Items_model>(
jsonResult,
new JsonSerializerSettings
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions Runtime/Users_Details.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 8 additions & 11 deletions Scenes/Scripts/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 256a434

Please sign in to comment.