Skip to content

Commit 0f10ab3

Browse files
committed
.NET 2.16.0 // SiweExternal Auth & Guest SessionID
1 parent e620559 commit 0f10ab3

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed
4 KB
Binary file not shown.

Assets/Thirdweb/Runtime/Unity/ThirdwebManagerBase.cs

+35-2
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ public abstract class ThirdwebManagerBase : MonoBehaviour
215215
[field: SerializeField]
216216
protected List<RpcOverride> RpcOverrides { get; set; } = null;
217217

218+
[field: SerializeField]
219+
protected List<string> SiweExternalForcedWalletIds { get; set; } = null;
220+
218221
public ThirdwebClient Client { get; protected set; }
219222
public IThirdwebWallet ActiveWallet { get; protected set; }
220223
public bool Initialized { get; protected set; }
@@ -286,6 +289,10 @@ public virtual async void Initialize()
286289
Initialized = true;
287290
}
288291

292+
// ------------------------------------------------------
293+
// Contract Methods
294+
// ------------------------------------------------------
295+
289296
public virtual async Task<ThirdwebContract> GetContract(string address, BigInteger chainId, string abi = null)
290297
{
291298
if (!Initialized)
@@ -296,6 +303,10 @@ public virtual async Task<ThirdwebContract> GetContract(string address, BigInteg
296303
return await ThirdwebContract.Create(Client, address, chainId, abi);
297304
}
298305

306+
// ------------------------------------------------------
307+
// Active Wallet Methods
308+
// ------------------------------------------------------
309+
299310
public virtual IThirdwebWallet GetActiveWallet()
300311
{
301312
return ActiveWallet;
@@ -331,6 +342,10 @@ public virtual void RemoveWallet(string address)
331342
}
332343
}
333344

345+
// ------------------------------------------------------
346+
// Connection Methods
347+
// ------------------------------------------------------
348+
334349
public virtual async Task<IThirdwebWallet> ConnectWallet(WalletOptions walletOptions)
335350
{
336351
if (walletOptions == null)
@@ -420,11 +435,20 @@ public virtual async Task<IThirdwebWallet> ConnectWallet(WalletOptions walletOpt
420435
_ = await inAppWallet.LoginWithAuthEndpoint(walletOptions.InAppWalletOptions.JwtOrPayload);
421436
break;
422437
case AuthProvider.Guest:
423-
_ = await inAppWallet.LoginWithGuest();
438+
_ = await inAppWallet.LoginWithGuest(SystemInfo.deviceUniqueIdentifier);
424439
break;
425440
case AuthProvider.Backend:
426441
_ = await inAppWallet.LoginWithBackend();
427442
break;
443+
case AuthProvider.SiweExternal:
444+
_ = await inAppWallet.LoginWithSiweExternal(
445+
isMobile: Application.isMobilePlatform,
446+
browserOpenAction: (url) => Application.OpenURL(url),
447+
forceWalletIds: SiweExternalForcedWalletIds == null || SiweExternalForcedWalletIds.Count == 0 ? null : SiweExternalForcedWalletIds,
448+
mobileRedirectScheme: MobileRedirectScheme,
449+
browser: new CrossPlatformUnityBrowser(RedirectPageHtmlOverride)
450+
);
451+
break;
428452
default:
429453
_ = await inAppWallet.LoginWithOauth(
430454
isMobile: Application.isMobilePlatform,
@@ -458,11 +482,20 @@ public virtual async Task<IThirdwebWallet> ConnectWallet(WalletOptions walletOpt
458482
_ = await ecosystemWallet.LoginWithAuthEndpoint(walletOptions.EcosystemWalletOptions.JwtOrPayload);
459483
break;
460484
case AuthProvider.Guest:
461-
_ = await ecosystemWallet.LoginWithGuest();
485+
_ = await ecosystemWallet.LoginWithGuest(SystemInfo.deviceUniqueIdentifier);
462486
break;
463487
case AuthProvider.Backend:
464488
_ = await ecosystemWallet.LoginWithBackend();
465489
break;
490+
case AuthProvider.SiweExternal:
491+
_ = await ecosystemWallet.LoginWithSiweExternal(
492+
isMobile: Application.isMobilePlatform,
493+
browserOpenAction: (url) => Application.OpenURL(url),
494+
forceWalletIds: SiweExternalForcedWalletIds == null || SiweExternalForcedWalletIds.Count == 0 ? null : SiweExternalForcedWalletIds,
495+
mobileRedirectScheme: MobileRedirectScheme,
496+
browser: new CrossPlatformUnityBrowser(RedirectPageHtmlOverride)
497+
);
498+
break;
466499
default:
467500
_ = await ecosystemWallet.LoginWithOauth(
468501
isMobile: Application.isMobilePlatform,

Assets/Thirdweb/Runtime/Unity/Wallets/Core/MetaMaskWallet.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ public Task<List<LinkedAccount>> LinkAccount(
206206
IThirdwebBrowser browser = null,
207207
BigInteger? chainId = null,
208208
string jwt = null,
209-
string payload = null
209+
string payload = null,
210+
string defaultSessionIdOverride = null,
211+
List<string> forceWalletIds = null
210212
)
211213
{
212214
throw new InvalidOperationException("LinkAccount is not supported by external wallets.");

Assets/Thirdweb/Runtime/Unity/Wallets/Core/WalletConnectWallet.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ public Task<List<LinkedAccount>> LinkAccount(
271271
IThirdwebBrowser browser = null,
272272
BigInteger? chainId = null,
273273
string jwt = null,
274-
string payload = null
274+
string payload = null,
275+
string defaultSessionIdOverride = null,
276+
List<string> forceWalletIds = null
275277
)
276278
{
277279
throw new InvalidOperationException("LinkAccount is not supported by external wallets.");

0 commit comments

Comments
 (0)