diff --git a/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs b/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs index 3c305004..6eb21066 100644 --- a/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs @@ -143,6 +143,8 @@ public Task RecoverAddressFromTypedDataV4(T data, TypedData< /// The chain ID if linking an external wallet (SIWE). /// The JWT token if linking custom JWT auth. /// The login payload if linking custom AuthEndpoint auth. + /// The default session ID override if linking Guest auth. + /// The wallet IDs to force display if linking using SiweExternal auth. /// A list of objects. public Task> LinkAccount( IThirdwebWallet walletToLink, @@ -153,7 +155,9 @@ public Task> LinkAccount( IThirdwebBrowser browser = null, BigInteger? chainId = null, string jwt = null, - string payload = null + string payload = null, + string defaultSessionIdOverride = null, + List forceWalletIds = null ); /// diff --git a/Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs index 4290f9c2..a1590e32 100644 --- a/Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs @@ -427,7 +427,9 @@ public async Task> LinkAccount( IThirdwebBrowser browser = null, BigInteger? chainId = null, string jwt = null, - string payload = null + string payload = null, + string defaultSessionIdOverride = null, + List forceWalletIds = null ) { if (!await this.IsConnected().ConfigureAwait(false)) @@ -496,11 +498,10 @@ public async Task> LinkAccount( serverRes = await ecosystemWallet.PreAuth_AuthEndpoint(payload).ConfigureAwait(false); break; case "Guest": - serverRes = await ecosystemWallet.PreAuth_Guest().ConfigureAwait(false); + serverRes = await ecosystemWallet.PreAuth_Guest(defaultSessionIdOverride).ConfigureAwait(false); break; case "SiweExternal": - // TODO: Allow enforcing wallet ids in linking flow? - serverRes = await ecosystemWallet.PreAuth_SiweExternal(isMobile ?? false, browserOpenAction, null, mobileRedirectScheme, browser).ConfigureAwait(false); + serverRes = await ecosystemWallet.PreAuth_SiweExternal(isMobile ?? false, browserOpenAction, forceWalletIds, mobileRedirectScheme, browser).ConfigureAwait(false); break; case "Google": case "Apple": @@ -827,7 +828,7 @@ public async Task LoginWithBackend() #region Guest - private async Task PreAuth_Guest() + private async Task PreAuth_Guest(string defaultSessionIdOverride = null) { var sessionData = this.EmbeddedWallet.GetSessionData(); string sessionId; @@ -837,15 +838,15 @@ public async Task LoginWithBackend() } else { - sessionId = Guid.NewGuid().ToString(); + sessionId = defaultSessionIdOverride ?? Guid.NewGuid().ToString(); } var serverRes = await this.EmbeddedWallet.SignInWithGuestAsync(sessionId).ConfigureAwait(false); return serverRes; } - public async Task LoginWithGuest() + public async Task LoginWithGuest(string defaultSessionIdOverride = null) { - var serverRes = await this.PreAuth_Guest().ConfigureAwait(false); + var serverRes = await this.PreAuth_Guest(defaultSessionIdOverride).ConfigureAwait(false); return await this.PostAuth(serverRes).ConfigureAwait(false); } diff --git a/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs b/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs index ebfd8615..5ed2b8e3 100644 --- a/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs @@ -431,7 +431,9 @@ public virtual Task> LinkAccount( IThirdwebBrowser browser = null, BigInteger? chainId = null, string jwt = null, - string payload = null + string payload = null, + string defaultSessionIdOverride = null, + List forceWalletIds = null ) { throw new InvalidOperationException("LinkAccount is not supported for private key wallets."); diff --git a/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs index 736bb8f4..cb62dbf8 100644 --- a/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs +++ b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs @@ -1158,7 +1158,9 @@ public async Task> LinkAccount( IThirdwebBrowser browser = null, BigInteger? chainId = null, string jwt = null, - string payload = null + string payload = null, + string defaultSessionIdOverride = null, + List forceWalletIds = null ) { var personalWallet = await this.GetPersonalWallet().ConfigureAwait(false); @@ -1180,7 +1182,9 @@ public async Task> LinkAccount( } else { - return await personalWallet.LinkAccount(walletToLink, otp, isMobile, browserOpenAction, mobileRedirectScheme, browser, chainId, jwt, payload).ConfigureAwait(false); + return await personalWallet + .LinkAccount(walletToLink, otp, isMobile, browserOpenAction, mobileRedirectScheme, browser, chainId, jwt, payload, defaultSessionIdOverride, forceWalletIds) + .ConfigureAwait(false); } }