Skip to content

Commit f5f85ac

Browse files
committed
Expose WC Included Wallet IDs in ThirdwebManager
Also add tooltips
1 parent a0ac7bd commit f5f85ac

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

Assets/Thirdweb/Editor/ThirdwebManagerEditor.cs

+27-12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class ThirdwebManagerEditor : UnityEditor.Editor
1414
private SerializedProperty showDebugLogsProp;
1515
private SerializedProperty optOutUsageAnalyticsProp;
1616
private SerializedProperty supportedChainsProp;
17+
private SerializedProperty includedWalletIdsProp;
1718
private SerializedProperty redirectPageHtmlOverrideProp;
1819
private SerializedProperty rpcOverridesProp;
1920

@@ -33,6 +34,7 @@ private void OnEnable()
3334
showDebugLogsProp = FindProperty("ShowDebugLogs");
3435
optOutUsageAnalyticsProp = FindProperty("OptOutUsageAnalytics");
3536
supportedChainsProp = FindProperty("SupportedChains");
37+
includedWalletIdsProp = FindProperty("IncludedWalletIds");
3638
redirectPageHtmlOverrideProp = FindProperty("RedirectPageHtmlOverride");
3739
rpcOverridesProp = FindProperty("RpcOverrides");
3840

@@ -139,8 +141,8 @@ private void DrawSelectedTabContent()
139141
private void DrawClientTab()
140142
{
141143
EditorGUILayout.HelpBox("Configure your client settings here.", MessageType.Info);
142-
DrawProperty(clientIdProp, "Client ID");
143-
DrawProperty(bundleIdProp, "Bundle ID");
144+
DrawProperty(clientIdProp, "Client ID", "Your Thirdweb Client ID. You can find this in the Thirdweb Dashboard by creating a project.");
145+
DrawProperty(bundleIdProp, "Bundle ID", "You may allowlist a bundle ID in the Thirdweb Dashboard to allow native apps to access our services, eg com.mycompany.myapp");
144146
DrawButton(
145147
"Create API Key",
146148
() =>
@@ -153,28 +155,41 @@ private void DrawClientTab()
153155
private void DrawPreferencesTab()
154156
{
155157
EditorGUILayout.HelpBox("Set your preferences and initialization options here.", MessageType.Info);
156-
DrawProperty(initializeOnAwakeProp, "Initialize On Awake");
157-
DrawProperty(showDebugLogsProp, "Show Debug Logs");
158-
DrawProperty(optOutUsageAnalyticsProp, "Opt-Out of Usage Analytics");
158+
DrawProperty(initializeOnAwakeProp, "Initialize On Awake", "If enabled, Thirdweb will initialize on Awake. If disabled, you must call ThirdwebManager.Instance.Initialize() manually.");
159+
DrawProperty(showDebugLogsProp, "Show Debug Logs", "If enabled, Thirdweb will log debug messages to the console.");
160+
DrawProperty(optOutUsageAnalyticsProp, "Opt-Out of Usage Analytics", "If enabled, you may see inconsistent stats in your Thirdweb Dashboard.");
159161
}
160162

161163
private void DrawMiscTab()
162164
{
163165
EditorGUILayout.HelpBox("Configure other settings here.", MessageType.Info);
164166

165-
// Wallet Connect Settings
166-
DrawProperty(supportedChainsProp, "WalletConnect Supported Chains");
167+
// RPC Overrides
168+
DrawProperty(rpcOverridesProp, "RPC Overrides", "We recommend using our default RPC, but if you encounter issues you may override them by chain id here.");
167169

168170
GUILayout.Space(10);
169171

170172
// Desktop OAuth Settings
171-
EditorGUILayout.LabelField("OAuth Redirect Page HTML Override", EditorStyles.boldLabel);
173+
EditorGUILayout.LabelField(
174+
new GUIContent("OAuth Redirect Page HTML Override", "The HTML displayed after Social Login on Desktop, you may override it to match your branding."),
175+
EditorStyles.boldLabel
176+
);
172177
redirectPageHtmlOverrideProp.stringValue = EditorGUILayout.TextArea(redirectPageHtmlOverrideProp.stringValue, GUILayout.MinHeight(75));
173178

174179
GUILayout.Space(10);
175180

176-
// RPC Overrides
177-
DrawProperty(rpcOverridesProp, "RPC Overrides");
181+
// Wallet Connect Settings
182+
DrawProperty(
183+
supportedChainsProp,
184+
"WalletConnect Supported Chains",
185+
"You technically connect to multiple chains at once with WC, so try to include all chain ids your app wants to support."
186+
);
187+
188+
DrawProperty(
189+
includedWalletIdsProp,
190+
"WalletConnect Included Wallet IDs",
191+
"If displaying less than 3 wallets look for ConnectView script in your hierarchy and edit WC Modal wallet count and other settings there."
192+
);
178193
}
179194

180195
private void DrawDebugTab()
@@ -213,11 +228,11 @@ private void DrawDebugTab()
213228
);
214229
}
215230

216-
private void DrawProperty(SerializedProperty property, string label)
231+
private void DrawProperty(SerializedProperty property, string label, string tooltip = null)
217232
{
218233
if (property != null)
219234
{
220-
EditorGUILayout.PropertyField(property, new GUIContent(label));
235+
EditorGUILayout.PropertyField(property, new GUIContent(label, tooltip));
221236
}
222237
else
223238
{

Assets/Thirdweb/Runtime/Unity/Prefabs/ThirdwebManager.prefab

+2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ MonoBehaviour:
5252
<ShowDebugLogs>k__BackingField: 1
5353
<OptOutUsageAnalytics>k__BackingField: 0
5454
<SupportedChains>k__BackingField: ee6e060000000000
55+
<IncludedWalletIds>k__BackingField: []
5556
<RedirectPageHtmlOverride>k__BackingField:
57+
<RpcOverrides>k__BackingField: []
5658
--- !u!1001 &5352000285921552497
5759
PrefabInstance:
5860
m_ObjectHideFlags: 0

Assets/Thirdweb/Runtime/Unity/ThirdwebManager.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ public class ThirdwebManager : MonoBehaviour
157157
[field: SerializeField]
158158
private ulong[] SupportedChains { get; set; } = new ulong[] { 421614 };
159159

160+
[field: SerializeField]
161+
private string[] IncludedWalletIds { get; set; } = null;
162+
160163
[field: SerializeField]
161164
private string RedirectPageHtmlOverride { get; set; } = null;
162165

@@ -332,7 +335,8 @@ public async Task<IThirdwebWallet> ConnectWallet(WalletOptions walletOptions)
332335
break;
333336
case WalletProvider.WalletConnectWallet:
334337
var supportedChains = SupportedChains.Select(chain => new BigInteger(chain)).ToArray();
335-
wallet = await WalletConnectWallet.Create(client: Client, initialChainId: walletOptions.ChainId, supportedChains: supportedChains);
338+
var includedWalletIds = IncludedWalletIds == null || IncludedWalletIds.Length == 0 ? null : IncludedWalletIds;
339+
wallet = await WalletConnectWallet.Create(client: Client, initialChainId: walletOptions.ChainId, supportedChains: supportedChains, includedWalletIds: includedWalletIds);
336340
break;
337341
case WalletProvider.MetaMaskWallet:
338342
wallet = await MetaMaskWallet.Create(client: Client, activeChainId: walletOptions.ChainId);

Assets/Thirdweb/Runtime/Unity/Wallets/Core/WalletConnectWallet.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected WalletConnectWallet(ThirdwebClient client)
3535
_client = client;
3636
}
3737

38-
public async static Task<WalletConnectWallet> Create(ThirdwebClient client, BigInteger initialChainId, BigInteger[] supportedChains)
38+
public async static Task<WalletConnectWallet> Create(ThirdwebClient client, BigInteger initialChainId, BigInteger[] supportedChains, string[] includedWalletIds)
3939
{
4040
var eip155ChainsSupported = new string[] { };
4141
if (supportedChains != null)
@@ -44,6 +44,7 @@ public async static Task<WalletConnectWallet> Create(ThirdwebClient client, BigI
4444
_exception = null;
4545
_isConnected = false;
4646
_supportedChains = eip155ChainsSupported;
47+
_includedWalletIds = includedWalletIds;
4748

4849
if (WalletConnect.Instance != null && WalletConnect.Instance.IsConnected)
4950
{

0 commit comments

Comments
 (0)