Skip to content

Commit ab2c796

Browse files
committed
.NET 2.0.0 // Ecosystem Wallets
1 parent f2d6762 commit ab2c796

File tree

8 files changed

+36
-6611
lines changed

8 files changed

+36
-6611
lines changed

Assets/Thirdweb/Examples/Scenes/Scene_EcosystemWallet.unity

Lines changed: 0 additions & 6434 deletions
This file was deleted.

Assets/Thirdweb/Examples/Scenes/Scene_EcosystemWallet.unity.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

Assets/Thirdweb/Examples/Scripts/EcosystemWalletManager.cs

Lines changed: 0 additions & 148 deletions
This file was deleted.

Assets/Thirdweb/Examples/Scripts/EcosystemWalletManager.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Assets/Thirdweb/Examples/Scripts/PlaygroundManager.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,22 @@ private void Awake()
5353

5454
private async void Start()
5555
{
56-
_chainDetails = await Utils.GetChainMetadata(client: ThirdwebManager.Instance.Client, chainId: ActiveChainId);
56+
try
57+
{
58+
_chainDetails = await Utils.GetChainMetadata(client: ThirdwebManager.Instance.Client, chainId: ActiveChainId);
59+
}
60+
catch
61+
{
62+
_chainDetails = new ThirdwebChainData()
63+
{
64+
NativeCurrency = new ThirdwebChainNativeCurrency()
65+
{
66+
Decimals = 18,
67+
Name = "ETH",
68+
Symbol = "ETH"
69+
}
70+
};
71+
}
5772
}
5873

5974
private void InitializePanels()
-67.5 KB
Binary file not shown.

Assets/Thirdweb/Runtime/Unity/ThirdwebManager.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public class EcosystemWalletOptions
5555
public string PhoneNumber;
5656
public AuthProvider AuthProvider;
5757
public string JwtOrPayload;
58-
public string EncryptionKey;
5958
public string StorageDirectoryPath;
6059
public IThirdwebWallet SiweSigner;
6160

@@ -66,7 +65,6 @@ public EcosystemWalletOptions(
6665
string phoneNumber = null,
6766
AuthProvider authprovider = AuthProvider.Default,
6867
string jwtOrPayload = null,
69-
string encryptionKey = null,
7068
string storageDirectoryPath = null,
7169
IThirdwebWallet siweSigner = null
7270
)
@@ -77,7 +75,6 @@ public EcosystemWalletOptions(
7775
PhoneNumber = phoneNumber;
7876
AuthProvider = authprovider;
7977
JwtOrPayload = jwtOrPayload;
80-
EncryptionKey = encryptionKey;
8178
StorageDirectoryPath = storageDirectoryPath ?? Path.Combine(Application.persistentDataPath, "Thirdweb", "EcosystemWallet");
8279
SiweSigner = siweSigner;
8380
}
@@ -154,7 +151,7 @@ public class ThirdwebManager : MonoBehaviour
154151
[field: SerializeField]
155152
private bool OptOutUsageAnalytics { get; set; } = false;
156153

157-
[field: SerializeField, Header("Wallet Settings")]
154+
[field: SerializeField, Header("WalletConnect Settings")]
158155
private ulong[] SupportedChains { get; set; } = new ulong[] { 421614 };
159156

160157
public ThirdwebClient Client { get; private set; }
@@ -305,9 +302,9 @@ public async Task<IThirdwebWallet> ConnectWallet(WalletOptions walletOptions)
305302
{
306303
throw new ArgumentException("EcosystemWalletOptions must be provided for EcosystemWallet provider.");
307304
}
308-
if (string.IsNullOrEmpty(walletOptions.EcosystemWalletOptions.EcosystemId) || string.IsNullOrEmpty(walletOptions.EcosystemWalletOptions.EcosystemPartnerId))
305+
if (string.IsNullOrEmpty(walletOptions.EcosystemWalletOptions.EcosystemId))
309306
{
310-
throw new ArgumentException("EcosystemId and EcosystemPartnerId must be provided for EcosystemWallet provider.");
307+
throw new ArgumentException("EcosystemId must be provided for EcosystemWallet provider.");
311308
}
312309
wallet = await EcosystemWallet.Create(
313310
client: Client,
@@ -343,6 +340,14 @@ public async Task<IThirdwebWallet> ConnectWallet(WalletOptions walletOptions)
343340
{
344341
_ = await inAppWallet.LoginWithSiwe(walletOptions.ChainId);
345342
}
343+
else if (walletOptions.InAppWalletOptions.AuthProvider == AuthProvider.JWT)
344+
{
345+
_ = await inAppWallet.LoginWithJWT(walletOptions.InAppWalletOptions.JwtOrPayload, walletOptions.InAppWalletOptions.EncryptionKey);
346+
}
347+
else if (walletOptions.InAppWalletOptions.AuthProvider == AuthProvider.AuthEndpoint)
348+
{
349+
_ = await inAppWallet.LoginWithAuthEndpoint(walletOptions.InAppWalletOptions.JwtOrPayload, walletOptions.InAppWalletOptions.EncryptionKey);
350+
}
346351
else
347352
{
348353
_ = await inAppWallet.LoginWithOauth(
@@ -369,6 +374,14 @@ public async Task<IThirdwebWallet> ConnectWallet(WalletOptions walletOptions)
369374
{
370375
_ = await ecosystemWallet.LoginWithSiwe(walletOptions.ChainId);
371376
}
377+
else if (walletOptions.EcosystemWalletOptions.AuthProvider == AuthProvider.JWT)
378+
{
379+
_ = await ecosystemWallet.LoginWithJWT(walletOptions.EcosystemWalletOptions.JwtOrPayload);
380+
}
381+
else if (walletOptions.EcosystemWalletOptions.AuthProvider == AuthProvider.AuthEndpoint)
382+
{
383+
_ = await ecosystemWallet.LoginWithAuthEndpoint(walletOptions.EcosystemWalletOptions.JwtOrPayload);
384+
}
372385
else
373386
{
374387
_ = await ecosystemWallet.LoginWithOauth(

ProjectSettings/EditorBuildSettings.asset

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ EditorBuildSettings:
55
m_ObjectHideFlags: 0
66
serializedVersion: 2
77
m_Scenes:
8-
- enabled: 0
8+
- enabled: 1
99
path: Assets/Thirdweb/Examples/Scenes/Scene_Playground.unity
1010
guid: 73a8efadf4c9a9b4cb1dd2dfdbe39c29
11-
- enabled: 1
12-
path: Assets/Thirdweb/Examples/Scenes/Scene_EcosystemWallet.unity
13-
guid: 619330a535fe3d749bf09766a427be21
1411
m_configObjects: {}

0 commit comments

Comments
 (0)