@@ -97,6 +97,8 @@ public class Prefab_ConnectWallet : MonoBehaviour
97
97
private WalletProvider _walletProvider ;
98
98
private WalletProvider _personalWalletProvider ;
99
99
private string _address ;
100
+ private string _email ;
101
+ private string _password ;
100
102
101
103
private void Start ( )
102
104
{
@@ -134,6 +136,9 @@ private void Start()
134
136
OrGameObject . SetActive ( usingEmailWallet && usingNormalWallet ) ;
135
137
136
138
_currentChainData = ThirdwebManager . Instance . supportedChains . Find ( x => x . identifier == ThirdwebManager . Instance . chain ) ;
139
+ _address = null ;
140
+ _email = null ;
141
+ _password = null ;
137
142
}
138
143
139
144
public void ToggleConnectPanel ( bool active )
@@ -147,8 +152,6 @@ private void ValidateConnection(WalletProvider walletProvider)
147
152
148
153
ConnectPanel . SetActive ( false ) ;
149
154
150
- string email = null ;
151
- string password = null ;
152
155
WalletProvider personalWallet = WalletProvider . LocalWallet ;
153
156
154
157
switch ( walletProvider )
@@ -163,7 +166,7 @@ private void ValidateConnection(WalletProvider walletProvider)
163
166
}
164
167
else
165
168
{
166
- email = SupportedWalletsUI [ walletProvider ] . emailInput . text ;
169
+ _email = SupportedWalletsUI [ walletProvider ] . emailInput . text ;
167
170
break ;
168
171
}
169
172
case WalletProvider . LocalWallet :
@@ -174,7 +177,7 @@ private void ValidateConnection(WalletProvider walletProvider)
174
177
return ;
175
178
}
176
179
177
- ConnectWallet ( walletProvider , password , email , personalWallet ) ;
180
+ ConnectWallet ( walletProvider , _password , _email , personalWallet ) ;
178
181
}
179
182
180
183
public void ToggleLocalWalletUISaved ( bool active )
@@ -183,17 +186,17 @@ public void ToggleLocalWalletUISaved(bool active)
183
186
LocalWalletSavedConnectButton . onClick . RemoveAllListeners ( ) ;
184
187
LocalWalletSavedConnectButton . onClick . AddListener ( ( ) =>
185
188
{
186
- string password = string . IsNullOrEmpty ( LocalWalletSavedPasswordInput . text ) ? null : LocalWalletSavedPasswordInput . text ;
189
+ _password = string . IsNullOrEmpty ( LocalWalletSavedPasswordInput . text ) ? null : LocalWalletSavedPasswordInput . text ;
187
190
try
188
191
{
189
- Utils . UnlockOrGenerateLocalAccount ( BigInteger . Parse ( _currentChainData . chainId ) , password ) ;
192
+ Utils . UnlockOrGenerateLocalAccount ( BigInteger . Parse ( _currentChainData . chainId ) , _password ) ;
190
193
}
191
194
catch ( UnityException )
192
195
{
193
196
LocalWalletSavedPasswordWrong . SetActive ( true ) ;
194
197
return ;
195
198
}
196
- ConnectWallet ( WalletProvider . LocalWallet , password , null , WalletProvider . LocalWallet ) ;
199
+ ConnectWallet ( WalletProvider . LocalWallet , _password , null , WalletProvider . LocalWallet ) ;
197
200
LocalWalletUISaved . SetActive ( false ) ;
198
201
} ) ;
199
202
@@ -216,8 +219,8 @@ public void ToggleLocalWalletUINew(bool active)
216
219
if ( ! Utils . IsWebGLBuild ( ) && Utils . HasStoredAccount ( ) )
217
220
Utils . DeleteLocalAccount ( ) ;
218
221
219
- string password = string . IsNullOrEmpty ( LocalWalletNewPasswordInput . text ) ? null : LocalWalletNewPasswordInput . text ;
220
- ConnectWallet ( WalletProvider . LocalWallet , password , null , WalletProvider . LocalWallet ) ;
222
+ _password = string . IsNullOrEmpty ( LocalWalletNewPasswordInput . text ) ? null : LocalWalletNewPasswordInput . text ;
223
+ ConnectWallet ( WalletProvider . LocalWallet , _password , null , WalletProvider . LocalWallet ) ;
221
224
LocalWalletUINew . SetActive ( false ) ;
222
225
} ) ;
223
226
@@ -372,7 +375,7 @@ private async void DisconnectWallet()
372
375
private async void ExportWallet ( )
373
376
{
374
377
Debug . Log ( "Exporting wallet..." ) ;
375
- string json = await ThirdwebManager . Instance . SDK . wallet . Export ( null ) ;
378
+ string json = await ThirdwebManager . Instance . SDK . wallet . Export ( _password ) ;
376
379
GUIUtility . systemCopyBuffer = json ;
377
380
Debug . Log ( $ "Copied wallet to clipboard: { json } ") ;
378
381
}
0 commit comments