diff --git a/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/BoilerplateFactory.cs b/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/BoilerplateFactory.cs
index 0c3eadfc..da550e26 100644
--- a/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/BoilerplateFactory.cs
+++ b/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/BoilerplateFactory.cs
@@ -32,12 +32,13 @@ public static void CleanUp()
/// Open the Login UI Boilerplate from a Prefab inside the Resources folder.
///
/// Transform inside of a Canvas object.
+ /// Wallet to use for account federation.
/// (Optional) Callback when the user closes this window or when an account was successfully federated.
///
- public static SequenceLoginWindow OpenSequenceLoginWindow(Transform parent, Action onClose = null)
+ public static SequenceLoginWindow OpenSequenceLoginWindow(Transform parent, IWallet wallet = null, Action onClose = null)
{
return GetOrSpawnBoilerplate("Login/SequenceLoginWindow", parent,
- b => b.Show(onClose));
+ b => b.Show(wallet, onClose));
}
///
diff --git a/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/Login/SequenceLoginWindow.cs b/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/Login/SequenceLoginWindow.cs
index 4d73bf5b..040431a1 100644
--- a/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/Login/SequenceLoginWindow.cs
+++ b/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/Login/SequenceLoginWindow.cs
@@ -25,6 +25,7 @@ public class SequenceLoginWindow : MonoBehaviour
[SerializeField] private MessagePopup _messagePopup;
[SerializeField] private GameObject[] _socialTexts;
+ private IWallet _wallet;
private Action _onClose;
private SequenceLogin _loginHandler;
private string _curEmail;
@@ -65,8 +66,9 @@ public void Hide()
///
/// Required function to configure this Boilerplate.
///
- public void Show(Action onClose = null)
+ public void Show(IWallet wallet = null, Action onClose = null)
{
+ _wallet = wallet;
_onClose = onClose;
if (_loginHandler == null)
{
@@ -75,8 +77,11 @@ public void Show(Action onClose = null)
_loginHandler.OnLoginFailed += LoginHandlerOnOnLoginFailed;
_loginHandler.OnMFAEmailSent += LoginHandlerOnOnMFAEmailSent;
}
+
+ if (wallet != null)
+ _loginHandler.SetConnectedWalletAddress(wallet.GetWalletAddress());
- var isFederating = _loginHandler.HasConnectedWalletAddress();
+ var isFederating = _wallet != null;
_closeButton.gameObject.SetActive(isFederating);
_guestLoginButton.gameObject.SetActive(!isFederating);
diff --git a/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/PlayerProfile/SequencePlayerProfile.cs b/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/PlayerProfile/SequencePlayerProfile.cs
index a2bc8858..fecd76da 100644
--- a/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/PlayerProfile/SequencePlayerProfile.cs
+++ b/Packages/Sequence-Unity/Sequence/SequenceFrontend/Scripts/UI/Boilerplates/PlayerProfile/SequencePlayerProfile.cs
@@ -80,7 +80,7 @@ public async void SignOut()
public void OpenLoginWindowForFederation()
{
gameObject.SetActive(false);
- BoilerplateFactory.OpenSequenceLoginWindow(transform.parent,
+ BoilerplateFactory.OpenSequenceLoginWindow(transform.parent, _wallet,
() => gameObject.SetActive(true));
}
diff --git a/Packages/Sequence-Unity/Sequence/SequenceSDK/EmbeddedWallet/SequenceLogin.cs b/Packages/Sequence-Unity/Sequence/SequenceSDK/EmbeddedWallet/SequenceLogin.cs
index 1cca010d..5293202e 100644
--- a/Packages/Sequence-Unity/Sequence/SequenceSDK/EmbeddedWallet/SequenceLogin.cs
+++ b/Packages/Sequence-Unity/Sequence/SequenceSDK/EmbeddedWallet/SequenceLogin.cs
@@ -75,11 +75,6 @@ public void SetConnectedWalletAddress(Address connectedWalletAddress)
_connectedWalletAddress = connectedWalletAddress;
}
- public bool HasConnectedWalletAddress()
- {
- return _connectedWalletAddress != null;
- }
-
[Obsolete("Use GetInstance() instead.")]
public SequenceLogin(IValidator validator = null, IAuthenticator authenticator = null, IWaaSConnector connector = null, bool automaticallyFederateAccountsWhenPossible = true, Address connectedWalletAddress = null)
{
@@ -134,7 +129,7 @@ public void ResetLoginAfterTest()
public void SetupAuthenticator(IValidator validator = null, IAuthenticator authenticator = null)
{
ConfigJwt configJwt = SequenceConfig.GetConfigJwt(SequenceConfig.GetConfig(SequenceService.WaaS));
- if (_connectedWalletAddress == null || _sessionWallet == null)
+ if (_sessionWallet == null)
{
_sessionWallet = new EOAWallet();
}
@@ -241,7 +236,6 @@ private void TryToLoginWithStoredSessionWallet()
_sessionWallet = walletInfo.Item1;
_sessionId = IntentDataOpenSession.CreateSessionId(_sessionWallet.GetAddress());
- SetConnectedWalletAddress(new Address(walletInfo.Item2));
SequenceWallet wallet = new SequenceWallet(new Address(walletInfo.Item2), _sessionId, new IntentSender(new HttpClient(WaaSWithAuthUrl), walletInfo.Item1, _sessionId, _waasProjectId, _waasVersion), walletInfo.Item3);
@@ -251,7 +245,6 @@ private void TryToLoginWithStoredSessionWallet()
private void FailedLoginWithStoredSessionWallet(string error)
{
CreateWallet();
- SetConnectedWalletAddress(null);
SequenceWallet.OnFailedToRecoverSession?.Invoke(error);
}
@@ -389,7 +382,6 @@ public async Task ConnectToWaaS(IntentDataOpenSession loginIntent, LoginMethod m
string sessionId = registerSessionResponse.sessionId;
walletAddress = registerSessionResponse.wallet;
OnLoginSuccess?.Invoke(sessionId, walletAddress);
- SetConnectedWalletAddress(new Address(walletAddress));
SequenceWallet wallet = new SequenceWallet(new Address(walletAddress), sessionId, new IntentSender(new HttpClient(SequenceLogin.WaaSWithAuthUrl), _sessionWallet, sessionId, _waasProjectId, _waasVersion), email);
PlayerPrefs.SetInt(WaaSLoginMethod, (int)method);
PlayerPrefs.SetString(OpenIdAuthenticator.LoginEmail, email);