Skip to content

Commit 1235c8b

Browse files
authored
EmbeddedWallet -> InAppWallet - Scripts, Prefabs, Files (#175)
1 parent b1f9d4c commit 1235c8b

31 files changed

+356957
-293
lines changed

Assets/Thirdweb/Core/Prefabs/ThirdwebManager.prefab

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,19 @@ MonoBehaviour:
9797
forwarderDomainOverride:
9898
forwaderVersionOverride:
9999
walletConnectProjectId:
100+
walletConnectEnableExplorer: 0
100101
walletConnectExplorerRecommendedWalletIds: []
102+
walletConnectWalletImages: []
103+
walletConnectDesktopWallets: []
104+
walletConnectMobileWallets: []
105+
walletConnectThemeMode:
101106
factoryAddress:
102107
gasless: 0
103-
deployOnSign: 0
108+
erc20PaymasterAddress:
109+
erc20TokenAddress:
104110
bundlerUrl:
105111
paymasterUrl:
106112
entryPointAddress:
107113
WalletConnectPrefab: {fileID: 3202619366221042887, guid: c8c0099339b6ef54f87b1f049c5eb74f, type: 3}
108114
MetamaskPrefab: {fileID: 3503421935870801903, guid: f09c6d17b08bed346bec9906a7f17092, type: 3}
109-
EmbeddedWalletPrefab: {fileID: 3202619366221042887, guid: bef3cf6334b95f14883fb1b8095a0960, type: 3}
115+
InAppWalletPrefab: {fileID: 3202619366221042887, guid: bef3cf6334b95f14883fb1b8095a0960, type: 3}

Assets/Thirdweb/Core/Prefabs/WalletProvider_EmbeddedWallet.prefab renamed to Assets/Thirdweb/Core/Prefabs/WalletProvider_InAppWallet.prefab

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ GameObject:
12691269
- component: {fileID: 5}
12701270
- component: {fileID: 6}
12711271
m_Layer: 5
1272-
m_Name: Canvas_EWS
1272+
m_Name: Canvas_InAppWallet
12731273
m_TagString: Untagged
12741274
m_Icon: {fileID: 0}
12751275
m_NavMeshLayer: 0
@@ -1605,7 +1605,7 @@ GameObject:
16051605
- component: {fileID: 3202619366221042882}
16061606
- component: {fileID: 7585343039585244319}
16071607
m_Layer: 0
1608-
m_Name: WalletProvider_EmbeddedWallet
1608+
m_Name: WalletProvider_InAppWallet
16091609
m_TagString: Untagged
16101610
m_Icon: {fileID: 0}
16111611
m_NavMeshLayer: 0
@@ -1640,14 +1640,14 @@ MonoBehaviour:
16401640
m_Script: {fileID: 11500000, guid: e763a7f1e5865f44a89d3aa169a46691, type: 3}
16411641
m_Name:
16421642
m_EditorClassIdentifier:
1643-
EmbeddedWalletCanvas: {fileID: 3040857394524813045}
1643+
InAppWalletCanvas: {fileID: 3040857394524813045}
16441644
OTPInput: {fileID: 8918216154903914298}
16451645
RecoveryInput: {fileID: 1061075594562819070}
16461646
SubmitButton: {fileID: 1670754136118778672}
16471647
RecoveryCodesCanvas: {fileID: 3065337689055971296}
16481648
RecoveryCodesText: {fileID: 4840930599477263590}
16491649
RecoveryCodesCopy: {fileID: 7908066674043299061}
1650-
OnEmailOTPVerificationFailed:
1650+
OnOTPVerificationFailed:
16511651
m_PersistentCalls:
16521652
m_Calls: []
16531653
--- !u!1 &3462065987877024667

Assets/Thirdweb/Core/Scripts/ThirdwebInterceptor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public override async Task<object> InterceptSendRequestAsync<T>(Func<RpcRequest,
5353
var personalSign = new PersonalSign(msg, acc);
5454
return await WalletConnect.Instance.RequestAsync<PersonalSign, string>(personalSign);
5555
case WalletProvider.LocalWallet:
56-
case WalletProvider.EmbeddedWallet:
56+
case WalletProvider.InAppWallet:
5757
var message = request.RawParameters[0].ToString();
5858
return new EthereumMessageSigner().EncodeUTF8AndSign(message, new EthECKey(_thirdwebWallet.GetLocalAccount().PrivateKey));
5959
case WalletProvider.SmartWallet:
@@ -74,7 +74,7 @@ public override async Task<object> InterceptSendRequestAsync<T>(Func<RpcRequest,
7474
var ethSignTypedDataV4 = new EthSignTypedDataV4(account, data);
7575
return await WalletConnect.Instance.RequestAsync<EthSignTypedDataV4, string>(ethSignTypedDataV4);
7676
case WalletProvider.LocalWallet:
77-
case WalletProvider.EmbeddedWallet:
77+
case WalletProvider.InAppWallet:
7878
throw new Exception("Please use Wallet.SignTypedDataV4 instead.");
7979
case WalletProvider.SmartWallet:
8080
return await signerWeb3.Client.SendRequestAsync<T>("eth_signTypedData_v4", null, request.RawParameters);
@@ -146,7 +146,7 @@ params object[] paramList
146146
var personalSign = new PersonalSign(msg, acc);
147147
return await WalletConnect.Instance.RequestAsync<PersonalSign, string>(personalSign);
148148
case WalletProvider.LocalWallet:
149-
case WalletProvider.EmbeddedWallet:
149+
case WalletProvider.InAppWallet:
150150
var message = paramList[0].ToString();
151151
return new EthereumMessageSigner().EncodeUTF8AndSign(message, new EthECKey(_thirdwebWallet.GetLocalAccount().PrivateKey));
152152
case WalletProvider.SmartWallet:
@@ -167,7 +167,7 @@ params object[] paramList
167167
var ethSignTypedDataV4 = new EthSignTypedDataV4(acc, msg);
168168
return await WalletConnect.Instance.RequestAsync<EthSignTypedDataV4, string>(ethSignTypedDataV4);
169169
case WalletProvider.LocalWallet:
170-
case WalletProvider.EmbeddedWallet:
170+
case WalletProvider.InAppWallet:
171171
throw new Exception("Please use Wallet.SignTypedDataV4 instead.");
172172
case WalletProvider.SmartWallet:
173173
return await signerWeb3.Client.SendRequestAsync<T>("eth_signTypedData_v4", null, paramList);

Assets/Thirdweb/Core/Scripts/ThirdwebManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ public class ThirdwebManager : MonoBehaviour
117117
[Tooltip("Instantiates the Metamask SDK for Native platforms.")]
118118
public GameObject MetamaskPrefab;
119119

120-
[Tooltip("Instantiates the EmbeddedWallet SDK for Native platforms.")]
121-
public GameObject EmbeddedWalletPrefab;
120+
[Tooltip("Instantiates the InAppWallet SDK for Native platforms.")]
121+
public GameObject InAppWalletPrefab;
122122

123123
public ThirdwebSDK SDK;
124124

Assets/Thirdweb/Core/Scripts/ThirdwebSession.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ await Connect(
9494
case WalletProvider.Hyperplay:
9595
ActiveWallet = new ThirdwebHyperplay(ChainId.ToString());
9696
break;
97-
case WalletProvider.EmbeddedWallet:
97+
case WalletProvider.InAppWallet:
9898
if (string.IsNullOrEmpty(Options.clientId))
99-
throw new UnityException("thirdweb client id is required for EmbeddedWallet connection method!");
100-
ActiveWallet = new ThirdwebEmbeddedWallet(Options.clientId, Options.bundleId);
99+
throw new UnityException("thirdweb client id is required for InAppWallet connection method!");
100+
ActiveWallet = new ThirdwebInAppWallet(Options.clientId, Options.bundleId);
101101
break;
102102
default:
103103
throw new UnityException("This wallet connection method is not supported on this platform!");

Assets/Thirdweb/Core/Scripts/Wallet.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public async Task<string> GetAddress()
290290
}
291291

292292
/// <summary>
293-
/// Gets the connected embedded wallet email if any.
293+
/// Gets the connected In App Wallet email if any.
294294
/// </summary>
295295
public async Task<string> GetEmail()
296296
{
@@ -985,7 +985,7 @@ public class WalletConnection
985985
/// <param name="password">Optional wallet encryption password</param>
986986
/// <param name="email">The email to login with if using email based providers.</param>
987987
/// <param name="personalWallet">The personal wallet provider if using smart wallets.</param>
988-
/// <param name="authOptions">The authentication options if using embedded wallets.</param>
988+
/// <param name="authOptions">The authentication options if using in app wallets.</param>
989989
/// <param name="smartWalletAccountOverride">Optionally choose to connect to a smart account the personal wallet is not an admin of.</param>
990990
/// <returns>A new instance of the <see cref="WalletConnection"/> class.</returns>
991991
public WalletConnection(
@@ -1011,7 +1011,7 @@ public WalletConnection(
10111011
}
10121012

10131013
/// <summary>
1014-
/// Embedded Wallet Authentication Options.
1014+
/// In App Wallet Authentication Options.
10151015
/// </summary>
10161016
[System.Serializable]
10171017
public class AuthOptions
@@ -1048,11 +1048,11 @@ public enum WalletProvider
10481048
LocalWallet,
10491049
SmartWallet,
10501050
Hyperplay,
1051-
EmbeddedWallet
1051+
InAppWallet
10521052
}
10531053

10541054
/// <summary>
1055-
/// Represents the available auth providers for Embedded Wallet.
1055+
/// Represents the available auth providers for In App Wallet.
10561056
/// </summary>
10571057
[System.Serializable]
10581058
public enum AuthProvider

Assets/Thirdweb/Core/Scripts/Wallets/ThirdwebEmbeddedWallet.cs renamed to Assets/Thirdweb/Core/Scripts/Wallets/ThirdwebInAppWallet.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Thirdweb.Wallets
99
{
10-
public class ThirdwebEmbeddedWallet : IThirdwebWallet
10+
public class ThirdwebInAppWallet : IThirdwebWallet
1111
{
1212
private Web3 _web3;
1313
private readonly WalletProvider _provider;
@@ -16,10 +16,10 @@ public class ThirdwebEmbeddedWallet : IThirdwebWallet
1616
private Account _account;
1717
private string _email;
1818

19-
public ThirdwebEmbeddedWallet(string clientId, string bundleId)
19+
public ThirdwebInAppWallet(string clientId, string bundleId)
2020
{
2121
_web3 = null;
22-
_provider = WalletProvider.EmbeddedWallet;
22+
_provider = WalletProvider.InAppWallet;
2323
_signerProvider = WalletProvider.LocalWallet;
2424
_embeddedWallet = new EmbeddedWallet(clientId, bundleId, "unity", ThirdwebSDK.version);
2525
}
@@ -28,12 +28,12 @@ public async Task<string> Connect(WalletConnection walletConnection, string rpc)
2828
{
2929
await _embeddedWallet.VerifyThirdwebClientIdAsync("");
3030

31-
if (EmbeddedWalletUI.Instance == null)
31+
if (InAppWalletUI.Instance == null)
3232
{
33-
GameObject.Instantiate(ThirdwebManager.Instance.EmbeddedWalletPrefab);
33+
GameObject.Instantiate(ThirdwebManager.Instance.InAppWalletPrefab);
3434
}
3535

36-
var user = await EmbeddedWalletUI.Instance.Connect(_embeddedWallet, walletConnection.email, walletConnection.phoneNumber, walletConnection.authOptions);
36+
var user = await InAppWalletUI.Instance.Connect(_embeddedWallet, walletConnection.email, walletConnection.phoneNumber, walletConnection.authOptions);
3737
_account = user.Account;
3838
_email = user.EmailAddress;
3939
_web3 = new Web3(_account, rpc);

Assets/Thirdweb/Core/Scripts/WalletsUI/EmbeddedWalletUI.cs renamed to Assets/Thirdweb/Core/Scripts/WalletsUI/InAppWalletUI.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
namespace Thirdweb.Wallets
1717
{
18-
public class EmbeddedWalletUI : MonoBehaviour
18+
public class InAppWalletUI : MonoBehaviour
1919
{
2020
#region Variables
2121

22-
public GameObject EmbeddedWalletCanvas;
22+
public GameObject InAppWalletCanvas;
2323
public TMP_InputField OTPInput;
2424
public TMP_InputField RecoveryInput;
2525
public Button SubmitButton;
@@ -42,7 +42,7 @@ public class EmbeddedWalletUI : MonoBehaviour
4242

4343
#region Initialization
4444

45-
public static EmbeddedWalletUI Instance { get; private set; }
45+
public static InAppWalletUI Instance { get; private set; }
4646

4747
private void Awake()
4848
{
@@ -78,7 +78,7 @@ public virtual async Task<User> Connect(EmbeddedWallet embeddedWallet, string em
7878
RecoveryInput.gameObject.SetActive(false);
7979
SubmitButton.onClick.RemoveAllListeners();
8080
RecoveryCodesCopy.onClick.RemoveAllListeners();
81-
EmbeddedWalletCanvas.SetActive(false);
81+
InAppWalletCanvas.SetActive(false);
8282
RecoveryCodesCanvas.SetActive(false);
8383

8484
try
@@ -135,7 +135,7 @@ public virtual async Task<User> Connect(EmbeddedWallet embeddedWallet, string em
135135
}
136136

137137
await new WaitUntil(() => _user != null || _exception != null);
138-
EmbeddedWalletCanvas.SetActive(false);
138+
InAppWalletCanvas.SetActive(false);
139139
if (_exception != null)
140140
throw _exception;
141141
return _user;
@@ -157,7 +157,7 @@ public virtual async Task LoginWithOTP()
157157

158158
SubmitButton.onClick.AddListener(OnSubmitOTP);
159159
await OnSendOTP();
160-
EmbeddedWalletCanvas.SetActive(true);
160+
InAppWalletCanvas.SetActive(true);
161161
}
162162

163163
public virtual async Task OnSendOTP()
@@ -220,7 +220,7 @@ public virtual async Task LoginWithPhoneNumber()
220220

221221
SubmitButton.onClick.AddListener(OnSubmitPhoneOTP);
222222
await OnSendPhoneOTP();
223-
EmbeddedWalletCanvas.SetActive(true);
223+
InAppWalletCanvas.SetActive(true);
224224
}
225225

226226
public virtual async Task OnSendPhoneOTP()
@@ -385,7 +385,7 @@ public virtual void DisplayRecoveryInput(bool hideOtpInput)
385385
if (hideOtpInput)
386386
OTPInput.gameObject.SetActive(false);
387387
RecoveryInput.gameObject.SetActive(true);
388-
EmbeddedWalletCanvas.SetActive(true);
388+
InAppWalletCanvas.SetActive(true);
389389
}
390390

391391
public virtual void ShowRecoveryCodes(EmbeddedWallet.VerifyResult res)

Assets/Thirdweb/Editor/ThirdwebManagerEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class ThirdwebManagerEditor : Editor
3939
private SerializedProperty entryPointAddressProperty;
4040
private SerializedProperty WalletConnectPrefabProperty;
4141
private SerializedProperty MetamaskPrefabProperty;
42-
private SerializedProperty EmbeddedWalletPrefabProperty;
42+
private SerializedProperty InAppWalletPrefabProperty;
4343

4444
private ReorderableList supportedChainsList;
4545
private bool[] sectionExpanded;
@@ -87,7 +87,7 @@ private void OnEnable()
8787
entryPointAddressProperty = serializedObject.FindProperty("entryPointAddress");
8888
WalletConnectPrefabProperty = serializedObject.FindProperty("WalletConnectPrefab");
8989
MetamaskPrefabProperty = serializedObject.FindProperty("MetamaskPrefab");
90-
EmbeddedWalletPrefabProperty = serializedObject.FindProperty("EmbeddedWalletPrefab");
90+
InAppWalletPrefabProperty = serializedObject.FindProperty("InAppWalletPrefab");
9191

9292
supportedChainsList = new ReorderableList(serializedObject, supportedChainsProperty, true, true, true, true);
9393
supportedChainsList.drawHeaderCallback = rect =>
@@ -374,7 +374,7 @@ public override void OnInspectorGUI()
374374
{
375375
EditorGUILayout.PropertyField(WalletConnectPrefabProperty);
376376
EditorGUILayout.PropertyField(MetamaskPrefabProperty);
377-
EditorGUILayout.PropertyField(EmbeddedWalletPrefabProperty);
377+
EditorGUILayout.PropertyField(InAppWalletPrefabProperty);
378378
}
379379

380380
EditorGUILayout.EndVertical();

Assets/Thirdweb/Examples/Scripts/Prefabs/Prefab_ConnectWallet.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class WalletIcon
3131
public class WalletProviderUIDictionary : SerializableDictionaryBase<WalletProvider, GameObject> { }
3232

3333
[Header("Enabled Wallet Providers. Press Play to see changes.")]
34-
public List<WalletProvider> enabledWalletProviders = new List<WalletProvider> { WalletProvider.LocalWallet, WalletProvider.EmbeddedWallet, WalletProvider.SmartWallet };
34+
public List<WalletProvider> enabledWalletProviders = new List<WalletProvider> { WalletProvider.LocalWallet, WalletProvider.InAppWallet, WalletProvider.SmartWallet };
3535

3636
[Header("Use ERC-4337 (Account Abstraction) compatible smart wallets.\nEnabling this will connect user to the associated smart wallet as per your ThirwebManager settings.")]
3737
public bool useSmartWallets = false;
@@ -96,10 +96,10 @@ public void ConnectOauth(string authProviderStr)
9696
provider: WalletProvider.SmartWallet,
9797
chainId: BigInteger.Parse(_currentChainData.chainId),
9898
authOptions: new AuthOptions(Enum.Parse<AuthProvider>(authProviderStr)),
99-
personalWallet: WalletProvider.EmbeddedWallet
99+
personalWallet: WalletProvider.InAppWallet
100100
)
101101
: new WalletConnection(
102-
provider: WalletProvider.EmbeddedWallet,
102+
provider: WalletProvider.InAppWallet,
103103
chainId: BigInteger.Parse(_currentChainData.chainId),
104104
authOptions: new AuthOptions(Enum.Parse<AuthProvider>(authProviderStr))
105105
);
@@ -120,10 +120,10 @@ public void ConnectEmail()
120120
chainId: BigInteger.Parse(_currentChainData.chainId),
121121
email: emailInput.text,
122122
authOptions: new AuthOptions(AuthProvider.EmailOTP),
123-
personalWallet: WalletProvider.EmbeddedWallet
123+
personalWallet: WalletProvider.InAppWallet
124124
)
125125
: new WalletConnection(
126-
provider: WalletProvider.EmbeddedWallet,
126+
provider: WalletProvider.InAppWallet,
127127
chainId: BigInteger.Parse(_currentChainData.chainId),
128128
email: emailInput.text,
129129
authOptions: new AuthOptions(AuthProvider.EmailOTP)
@@ -137,10 +137,10 @@ public void ConnectEmail()
137137
chainId: BigInteger.Parse(_currentChainData.chainId),
138138
phoneNumber: input,
139139
authOptions: new AuthOptions(AuthProvider.PhoneOTP),
140-
personalWallet: WalletProvider.EmbeddedWallet
140+
personalWallet: WalletProvider.InAppWallet
141141
)
142142
: new WalletConnection(
143-
provider: WalletProvider.EmbeddedWallet,
143+
provider: WalletProvider.InAppWallet,
144144
chainId: BigInteger.Parse(_currentChainData.chainId),
145145
phoneNumber: input,
146146
authOptions: new AuthOptions(AuthProvider.PhoneOTP)

Assets/WebGLTemplates/Thirdweb/lib/thirdweb-unity-bridge.js

Lines changed: 356907 additions & 249 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)