From d68e0958708f2f0181aea79c587890535ce2b112 Mon Sep 17 00:00:00 2001 From: Alec Ananian <1013230+alecananian@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:21:53 -0500 Subject: [PATCH 1/4] add imageAlt field to inventory tokens (#31) --- Assets/Treasure/TDK/Runtime/Common/Token.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Treasure/TDK/Runtime/Common/Token.cs b/Assets/Treasure/TDK/Runtime/Common/Token.cs index 68f6006e..9af7ba40 100644 --- a/Assets/Treasure/TDK/Runtime/Common/Token.cs +++ b/Assets/Treasure/TDK/Runtime/Common/Token.cs @@ -16,6 +16,7 @@ public struct Attribute public int tokenId; public string name; public string image; + public string imageAlt; public List attributes; } From 10a4218376509280521c70c9e9de9ee6ba24d20d Mon Sep 17 00:00:00 2001 From: Alec Ananian <1013230+alecananian@users.noreply.github.com> Date: Thu, 11 Apr 2024 22:21:17 -0400 Subject: [PATCH 2/4] add legions and corruption removal approvals fields to harvester repsonses (#32) --- Assets/Treasure/TDK/Runtime/API/Corruption.cs | 1 + Assets/Treasure/TDK/Runtime/API/Harvester.cs | 6 ++++++ Assets/Treasure/TDK/Runtime/Common/Approval.cs | 13 +++++++++++++ Assets/Treasure/TDK/Runtime/Common/Approval.cs.meta | 11 +++++++++++ 4 files changed, 31 insertions(+) create mode 100644 Assets/Treasure/TDK/Runtime/Common/Approval.cs create mode 100644 Assets/Treasure/TDK/Runtime/Common/Approval.cs.meta diff --git a/Assets/Treasure/TDK/Runtime/API/Corruption.cs b/Assets/Treasure/TDK/Runtime/API/Corruption.cs index bfa40a5e..4fa9241b 100644 --- a/Assets/Treasure/TDK/Runtime/API/Corruption.cs +++ b/Assets/Treasure/TDK/Runtime/API/Corruption.cs @@ -40,6 +40,7 @@ public struct HarvesterCorruptionRemoval { public List corruptionRemovalRecipes; public List userInventoryCorruptionRemovalRecipeItems; + public List> userApprovalsCorruptionRemovalRecipeItems; public List userCorruptionRemovals; } diff --git a/Assets/Treasure/TDK/Runtime/API/Harvester.cs b/Assets/Treasure/TDK/Runtime/API/Harvester.cs index 71b195ea..bff335d3 100644 --- a/Assets/Treasure/TDK/Runtime/API/Harvester.cs +++ b/Assets/Treasure/TDK/Runtime/API/Harvester.cs @@ -53,6 +53,12 @@ public struct Booster public int userCharactersStaked; public double userCharactersMaxBoost; public double userCharactersBoost; + public List userInventoryLegions; + public List userStakedLegions; + public bool userLegionsApproved; + public int userLegionsMaxWeightStakeable; + public int userLegionsWeightStaked; + public double userLegionsBoost; public BigInteger userMagicMaxStakeable; public BigInteger userMagicStaked; public BigInteger userMagicRewardsClaimable; diff --git a/Assets/Treasure/TDK/Runtime/Common/Approval.cs b/Assets/Treasure/TDK/Runtime/Common/Approval.cs new file mode 100644 index 00000000..0ad4896c --- /dev/null +++ b/Assets/Treasure/TDK/Runtime/Common/Approval.cs @@ -0,0 +1,13 @@ +using System; +using Newtonsoft.Json; + +namespace Treasure +{ + [Serializable] + public class Approval + { + [JsonProperty("operator")] + public string operatorAddress; + public bool approved; + } +} diff --git a/Assets/Treasure/TDK/Runtime/Common/Approval.cs.meta b/Assets/Treasure/TDK/Runtime/Common/Approval.cs.meta new file mode 100644 index 00000000..17d6a00c --- /dev/null +++ b/Assets/Treasure/TDK/Runtime/Common/Approval.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d17a2c2f73084ec28fcc994e0eea2a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From d33c6be679dfa6767934b20c258661fb2391e3de Mon Sep 17 00:00:00 2001 From: Alec Ananian <1013230+alecananian@users.noreply.github.com> Date: Thu, 11 Apr 2024 22:27:35 -0400 Subject: [PATCH 3/4] add auth helper for fetching current user details (#33) --- Assets/Treasure/TDK/Runtime/API/Auth.cs | 14 ++++++++++++++ .../TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Assets/Treasure/TDK/Runtime/API/Auth.cs b/Assets/Treasure/TDK/Runtime/API/Auth.cs index 05e6c295..9b83d482 100644 --- a/Assets/Treasure/TDK/Runtime/API/Auth.cs +++ b/Assets/Treasure/TDK/Runtime/API/Auth.cs @@ -56,6 +56,14 @@ public struct LogInResponse public string token; } + [Serializable] + public struct User + { + public string id; + public string smartAccountAddress; + public string email; + } + public partial class API { public async Task GetAuthPayload(string address, string chainId) @@ -80,5 +88,11 @@ public async Task LogIn(AuthPayload payload, string signature) })); return JsonConvert.DeserializeObject(response).token; } + + public async Task GetCurrentUser() + { + var response = await Get("/users/me"); + return JsonConvert.DeserializeObject(response); + } } } diff --git a/Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs b/Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs index ed56af63..76527f4e 100644 --- a/Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs +++ b/Assets/Treasure/TDK/Runtime/Connect/UI/TDKEmbeddedWalletUI.cs @@ -37,14 +37,14 @@ public override async Task LoginWithOTP() { SubmitButton.GetComponent().SetLoading(true); OnSubmitOTP(); - } + } }); await OnSendOTP(); TDKConnectUIManager.Instance.ShowConfirmLoginModal(); } - public override async Task Connect(EmbeddedWallet embeddedWallet, string email, AuthOptions authOptions) + public override async Task Connect(EmbeddedWallet embeddedWallet, string email, AuthOptions authOptions) { var config = Resources.Load("ThirdwebConfig"); _customScheme = config != null ? config.customScheme : null; From 50cb302d6bac107fd129664dbcd667e775ebcb37 Mon Sep 17 00:00:00 2001 From: Alec Ananian <1013230+alecananian@users.noreply.github.com> Date: Thu, 11 Apr 2024 22:28:37 -0400 Subject: [PATCH 4/4] v0.2.5 --- Assets/Treasure/TDK/Runtime/TDKVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Treasure/TDK/Runtime/TDKVersion.cs b/Assets/Treasure/TDK/Runtime/TDKVersion.cs index 63892cd7..4275faf0 100644 --- a/Assets/Treasure/TDK/Runtime/TDKVersion.cs +++ b/Assets/Treasure/TDK/Runtime/TDKVersion.cs @@ -3,6 +3,6 @@ public static class TDKVersion { public static string name = "tdk-unity"; - public static string version = "0.2.4"; + public static string version = "0.2.5"; } }