Skip to content

Commit a0ac7bd

Browse files
committed
Expose RPC Overrides in ThirdwebManager
1 parent 082b7ec commit a0ac7bd

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

Assets/Thirdweb/Editor/ThirdwebManagerEditor.cs

+9-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class ThirdwebManagerEditor : UnityEditor.Editor
1515
private SerializedProperty optOutUsageAnalyticsProp;
1616
private SerializedProperty supportedChainsProp;
1717
private SerializedProperty redirectPageHtmlOverrideProp;
18+
private SerializedProperty rpcOverridesProp;
1819

1920
private int selectedTab = 0;
2021
private readonly string[] tabTitles = { "Client", "Preferences", "Misc", "Debug" };
@@ -33,6 +34,7 @@ private void OnEnable()
3334
optOutUsageAnalyticsProp = FindProperty("OptOutUsageAnalytics");
3435
supportedChainsProp = FindProperty("SupportedChains");
3536
redirectPageHtmlOverrideProp = FindProperty("RedirectPageHtmlOverride");
37+
rpcOverridesProp = FindProperty("RpcOverrides");
3638

3739
bannerImage = Resources.Load<Texture2D>("EditorBanner");
3840
}
@@ -161,15 +163,18 @@ private void DrawMiscTab()
161163
EditorGUILayout.HelpBox("Configure other settings here.", MessageType.Info);
162164

163165
// Wallet Connect Settings
164-
GUILayout.Label("Wallet Connect Settings", EditorStyles.boldLabel);
165-
DrawProperty(supportedChainsProp, "Supported Chains");
166+
DrawProperty(supportedChainsProp, "WalletConnect Supported Chains");
166167

167168
GUILayout.Space(10);
168169

169170
// Desktop OAuth Settings
170-
GUILayout.Label("Desktop OAuth Settings", EditorStyles.boldLabel);
171-
EditorGUILayout.LabelField("Redirect Page HTML Override", EditorStyles.boldLabel);
171+
EditorGUILayout.LabelField("OAuth Redirect Page HTML Override", EditorStyles.boldLabel);
172172
redirectPageHtmlOverrideProp.stringValue = EditorGUILayout.TextArea(redirectPageHtmlOverrideProp.stringValue, GUILayout.MinHeight(75));
173+
174+
GUILayout.Space(10);
175+
176+
// RPC Overrides
177+
DrawProperty(rpcOverridesProp, "RPC Overrides");
173178
}
174179

175180
private void DrawDebugTab()

Assets/Thirdweb/Runtime/Unity/ThirdwebManager.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ public WalletOptions(
129129
}
130130
}
131131

132+
[Serializable]
133+
public struct RpcOverride
134+
{
135+
public ulong ChainId;
136+
public string RpcUrl;
137+
}
138+
132139
[HelpURL("http://portal.thirdweb.com/unity/v5/thirdwebmanager")]
133140
public class ThirdwebManager : MonoBehaviour
134141
{
@@ -153,6 +160,9 @@ public class ThirdwebManager : MonoBehaviour
153160
[field: SerializeField]
154161
private string RedirectPageHtmlOverride { get; set; } = null;
155162

163+
[field: SerializeField]
164+
private List<RpcOverride> RpcOverrides { get; set; } = null;
165+
156166
public ThirdwebClient Client { get; private set; }
157167

158168
public IThirdwebWallet ActiveWallet { get; private set; }
@@ -208,7 +218,8 @@ public void Initialize()
208218
sdkName: Application.platform == RuntimePlatform.WebGLPlayer ? "UnitySDK_WebGL" : "UnitySDK",
209219
sdkOs: Application.platform.ToString(),
210220
sdkPlatform: "unity",
211-
sdkVersion: THIRDWEB_UNITY_SDK_VERSION
221+
sdkVersion: THIRDWEB_UNITY_SDK_VERSION,
222+
rpcOverrides: RpcOverrides == null || RpcOverrides.Count == 0 ? null : RpcOverrides.ToDictionary(rpcOverride => new BigInteger(rpcOverride.ChainId), rpcOverride => rpcOverride.RpcUrl)
212223
);
213224

214225
ThirdwebDebug.Log("ThirdwebManager initialized.");

0 commit comments

Comments
 (0)