@@ -16,6 +16,7 @@ public class PlaygroundManager : MonoBehaviour
1616 {
1717 #region Inspector
1818
19+ public bool AlwaysUpgradeToSmartWallet ;
1920 public ulong ChainId ;
2021 public string Email ;
2122 public string Phone ;
@@ -111,7 +112,7 @@ private async void Wallet_Guest()
111112 ) ;
112113
113114 var smartWalletAddress = await smartWallet . GetAddress ( ) ;
114- this . LogPlayground ( $ "[Guest] Connected to smart wallet (sponsored gas):\n { smartWalletAddress } ") ;
115+ this . LogPlayground ( $ "[Guest] Connected to wallet (sponsored gas):\n { smartWalletAddress } ") ;
115116
116117 // // --Smart wallets have special functionality other than just gas sponsorship
117118 // var sessionKeyReceipt = await smartWallet.CreateSessionKey(
@@ -131,6 +132,10 @@ private async void Wallet_Social()
131132 {
132133 var walletOptions = new WalletOptions ( provider : WalletProvider . InAppWallet , chainId : this . ChainId , new InAppWalletOptions ( authprovider : AuthProvider . Github ) ) ;
133134 var wallet = await ThirdwebManager . Instance . ConnectWallet ( walletOptions ) ;
135+ if ( this . AlwaysUpgradeToSmartWallet )
136+ {
137+ wallet = await ThirdwebManager . Instance . UpgradeToSmartWallet ( wallet , chainId : this . ChainId , smartWalletOptions : new SmartWalletOptions ( sponsorGas : true ) ) ;
138+ }
134139 var address = await wallet . GetAddress ( ) ;
135140 this . LogPlayground ( $ "[Social] Connected to wallet:\n { address } ") ;
136141 }
@@ -145,6 +150,10 @@ private async void Wallet_Email()
145150
146151 var walletOptions = new WalletOptions ( provider : WalletProvider . InAppWallet , chainId : this . ChainId , new InAppWalletOptions ( email : this . Email ) ) ;
147152 var wallet = await ThirdwebManager . Instance . ConnectWallet ( walletOptions ) ;
153+ if ( this . AlwaysUpgradeToSmartWallet )
154+ {
155+ wallet = await ThirdwebManager . Instance . UpgradeToSmartWallet ( wallet , chainId : this . ChainId , smartWalletOptions : new SmartWalletOptions ( sponsorGas : true ) ) ;
156+ }
148157 var address = await wallet . GetAddress ( ) ;
149158 this . LogPlayground ( $ "[Email] Connected to wallet:\n { address } ") ;
150159 }
@@ -159,6 +168,10 @@ private async void Wallet_Phone()
159168
160169 var walletOptions = new WalletOptions ( provider : WalletProvider . InAppWallet , chainId : this . ChainId , new InAppWalletOptions ( phoneNumber : this . Phone ) ) ;
161170 var wallet = await ThirdwebManager . Instance . ConnectWallet ( walletOptions ) ;
171+ if ( this . AlwaysUpgradeToSmartWallet )
172+ {
173+ wallet = await ThirdwebManager . Instance . UpgradeToSmartWallet ( wallet , chainId : this . ChainId , smartWalletOptions : new SmartWalletOptions ( sponsorGas : true ) ) ;
174+ }
162175 var address = await wallet . GetAddress ( ) ;
163176 this . LogPlayground ( $ "[Phone] Connected to wallet:\n { address } ") ;
164177 }
@@ -171,6 +184,10 @@ private async void Wallet_External()
171184 reownOptions : new ReownOptions ( projectId : null , name : null , description : null , url : null , iconUrl : null , includedWalletIds : null , excludedWalletIds : null )
172185 ) ;
173186 var wallet = await ThirdwebManager . Instance . ConnectWallet ( walletOptions ) ;
187+ if ( this . AlwaysUpgradeToSmartWallet )
188+ {
189+ wallet = await ThirdwebManager . Instance . UpgradeToSmartWallet ( wallet , chainId : this . ChainId , smartWalletOptions : new SmartWalletOptions ( sponsorGas : true ) ) ;
190+ }
174191 var address = await wallet . GetAddress ( ) ;
175192 this . LogPlayground ( $ "[SIWE] Connected to wallet:\n { address } ") ;
176193 }
0 commit comments