Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,6 @@ dotnet_diagnostic.JSON002.severity = silent

# CS8981: The type name only contains lower-cased ascii characters. Such names may become reserved for the language.
dotnet_diagnostic.CS8981.severity = suggestion

# IDE0055: Fix formatting
dotnet_diagnostic.IDE0055.severity = silent
50 changes: 25 additions & 25 deletions Assets/Plugins/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thirdweb.unity"
xmlns:tools="http://schemas.android.com/tools">

<application>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Set your bundle id here -->
<!-- Replace 'com.thirdweb.unitysdk' with your desired scheme -->
<data android:scheme="com.thirdweb.unitysdk" />
</intent-filter>

<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thirdweb.unity"
xmlns:tools="http://schemas.android.com/tools"
>
<application>
<activity
android:name="com.unity3d.player.UnityPlayerActivity"
android:theme="@style/UnityThemeSelector"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Set your bundle id here -->
<!-- Replace 'com.thirdweb.unitysdk' with your desired scheme -->
<data android:scheme="com.thirdweb.unitysdk" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>
12 changes: 8 additions & 4 deletions Assets/Thirdweb/Editor/Postprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ public class Postprocessor
[PostProcessBuild(1)]
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
if (target != BuildTarget.WebGL) return;
if (!supportedPostprocessor) return;
if (!IsEnable) return;
if (target != BuildTarget.WebGL)
return;
if (!supportedPostprocessor)
return;
if (!IsEnable)
return;

var path = Path.Combine(pathToBuiltProject, "index.html");
if (!File.Exists(path)) return;
if (!File.Exists(path))
return;

var html = File.ReadAllText(path);

Expand Down
8 changes: 4 additions & 4 deletions Assets/Thirdweb/Editor/ThirdwebDependencies.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<dependencies>
<androidPackages>
<androidPackage spec="androidx.browser:browser:1.4.0" />
</androidPackages>
</dependencies>
<androidPackages>
<androidPackage spec="androidx.browser:browser:1.4.0" />
</androidPackages>
</dependencies>
17 changes: 5 additions & 12 deletions Assets/Thirdweb/Editor/ThirdwebManagerEditor.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEngine;
using UnityEditor;
using Thirdweb.Unity;
using System.Reflection;
using Thirdweb.Unity;
using UnityEditor;
using UnityEngine;

namespace Thirdweb.Editor
{
Expand All @@ -11,8 +11,6 @@ public abstract class ThirdwebManagerBaseEditor<T> : UnityEditor.Editor
protected SerializedProperty initializeOnAwakeProp;
protected SerializedProperty showDebugLogsProp;
protected SerializedProperty autoConnectLastWalletProp;
protected SerializedProperty supportedChainsProp;
protected SerializedProperty includedWalletIdsProp;
protected SerializedProperty redirectPageHtmlOverrideProp;
protected SerializedProperty rpcOverridesProp;

Expand All @@ -27,8 +25,6 @@ protected virtual void OnEnable()
initializeOnAwakeProp = FindProp("InitializeOnAwake");
showDebugLogsProp = FindProp("ShowDebugLogs");
autoConnectLastWalletProp = FindProp("AutoConnectLastWallet");
supportedChainsProp = FindProp("SupportedChains");
includedWalletIdsProp = FindProp("IncludedWalletIds");
redirectPageHtmlOverrideProp = FindProp("RedirectPageHtmlOverride");
rpcOverridesProp = FindProp("RpcOverrides");

Expand Down Expand Up @@ -90,10 +86,7 @@ protected virtual void DrawMiscTab()
DrawProperty(rpcOverridesProp, "RPC Overrides");
GUILayout.Space(10);
EditorGUILayout.LabelField("OAuth Redirect Page HTML Override", EditorStyles.boldLabel);
redirectPageHtmlOverrideProp.stringValue = EditorGUILayout.TextArea(redirectPageHtmlOverrideProp.stringValue, GUILayout.MinHeight(75));
GUILayout.Space(10);
DrawProperty(supportedChainsProp, "WalletConnect Supported Chains");
DrawProperty(includedWalletIdsProp, "WalletConnect Included Wallet IDs");
redirectPageHtmlOverrideProp.stringValue = EditorGUILayout.TextArea(redirectPageHtmlOverrideProp.stringValue, GUILayout.MinHeight(150));
}

protected virtual void DrawDebugTab()
Expand Down Expand Up @@ -170,7 +163,7 @@ protected void InitializeStyles()
{
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleLeft,
padding = new RectOffset(10, 10, 10, 10)
padding = new RectOffset(10, 10, 10, 10),
};
}

Expand Down
26 changes: 23 additions & 3 deletions Assets/Thirdweb/Examples/Scenes/Scene_Playground.unity
Original file line number Diff line number Diff line change
Expand Up @@ -2887,8 +2887,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d2b449f3a04d6c94eb686cd39ae75785, type: 3}
m_Name:
m_EditorClassIdentifier:
ActiveChainId: 421614
WebglForceMetamaskExtension: 1
ActiveChainId: 84532
WebglForceMetamaskExtension: 0
ConnectWalletPanel: {fileID: 974997944}
PrivateKeyWalletButton: {fileID: 736464798}
EcosystemWalletButton: {fileID: 1496910716}
Expand All @@ -2904,7 +2904,7 @@ MonoBehaviour:
LogText: {fileID: 2031826890}
InputField: {fileID: 0}
InputFieldSubmitButton: {fileID: 0}
- Identifier: WalletConnectWallet
- Identifier: ReownWallet
Panel: {fileID: 1922056857}
Action1Button: {fileID: 1632196339}
Action2Button: {fileID: 1340124642}
Expand Down Expand Up @@ -4230,6 +4230,26 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 753652708382381279, guid: f1f7a02a8c5efe54c95062bd90592227, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 753652708382381279, guid: f1f7a02a8c5efe54c95062bd90592227, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 753652708382381279, guid: f1f7a02a8c5efe54c95062bd90592227, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 753652708382381279, guid: f1f7a02a8c5efe54c95062bd90592227, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 753652708382381279, guid: f1f7a02a8c5efe54c95062bd90592227, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1288923049808236541, guid: f1f7a02a8c5efe54c95062bd90592227, type: 3}
propertyPath: <BundleId>k__BackingField
value: com.thirdweb.unitysdk
Expand Down
27 changes: 16 additions & 11 deletions Assets/Thirdweb/Examples/Scripts/PlaygroundManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
Expand All @@ -24,7 +25,7 @@ public class WalletPanelUI
public class PlaygroundManager : MonoBehaviour
{
[field: SerializeField, Header("Wallet Options")]
private ulong ActiveChainId = 421614;
private ulong ActiveChainId = 84532;

[field: SerializeField]
private bool WebglForceMetamaskExtension = false;
Expand Down Expand Up @@ -65,8 +66,8 @@ private async void Start()
{
Decimals = 18,
Name = "ETH",
Symbol = "ETH"
}
Symbol = "ETH",
},
};
}
}
Expand All @@ -77,6 +78,11 @@ private void InitializePanels()

ConnectWalletPanel.SetActive(true);

if (ThirdwebManager.Instance != null && ThirdwebManager.Instance.ActiveWallet != null)
{
ThirdwebManager.Instance.ActiveWallet.Disconnect();
}

PrivateKeyWalletButton.onClick.RemoveAllListeners();
PrivateKeyWalletButton.onClick.AddListener(() =>
{
Expand All @@ -90,7 +96,7 @@ private void InitializePanels()
WalletConnectButton.onClick.RemoveAllListeners();
WalletConnectButton.onClick.AddListener(() =>
{
var options = GetWalletOptions(WalletProvider.WalletConnectWallet);
var options = GetWalletOptions(WalletProvider.ReownWallet);
ConnectWallet(options);
});
}
Expand All @@ -99,7 +105,7 @@ private async void ConnectWallet(WalletOptions options)
{
// Connect the wallet

var internalWalletProvider = options.Provider == WalletProvider.MetaMaskWallet ? WalletProvider.WalletConnectWallet : options.Provider;
var internalWalletProvider = options.Provider == WalletProvider.MetaMaskWallet ? WalletProvider.ReownWallet : options.Provider;
var currentPanel = WalletPanels.Find(panel => panel.Identifier == internalWalletProvider.ToString());

Log(currentPanel.LogText, $"Connecting...");
Expand Down Expand Up @@ -156,9 +162,8 @@ private WalletOptions GetWalletOptions(WalletProvider provider)
case WalletProvider.EcosystemWallet:
var ecosystemWalletOptions = new EcosystemWalletOptions(ecosystemId: "ecosystem.the-bonfire", authprovider: AuthProvider.Google);
return new WalletOptions(provider: WalletProvider.EcosystemWallet, chainId: ActiveChainId, ecosystemWalletOptions: ecosystemWalletOptions);
case WalletProvider.WalletConnectWallet:
var externalWalletProvider =
Application.platform == RuntimePlatform.WebGLPlayer && WebglForceMetamaskExtension ? WalletProvider.MetaMaskWallet : WalletProvider.WalletConnectWallet;
case WalletProvider.ReownWallet:
var externalWalletProvider = Application.platform == RuntimePlatform.WebGLPlayer && WebglForceMetamaskExtension ? WalletProvider.MetaMaskWallet : WalletProvider.ReownWallet;
return new WalletOptions(provider: externalWalletProvider, chainId: ActiveChainId);
default:
throw new System.NotImplementedException("Wallet provider not implemented for this example.");
Expand Down Expand Up @@ -342,7 +347,7 @@ private void InitializeContractsPanel()
try
{
LoadingLog(panel.LogText);
var dropErc1155Contract = await ThirdwebManager.Instance.GetContract(address: "0x94894F65d93eb124839C667Fc04F97723e5C4544", chainId: ActiveChainId);
var dropErc1155Contract = await ThirdwebManager.Instance.GetContract(address: "0x8F0a4dde7791fa9B6C62E0B099a1a3ff6dd1cF29", chainId: ActiveChainId);
var nft = await dropErc1155Contract.ERC1155_GetNFT(tokenId: 1);
Log(panel.LogText, $"NFT: {JsonConvert.SerializeObject(nft.Metadata)}");
var sprite = await nft.GetNFTSprite(client: ThirdwebManager.Instance.Client);
Expand All @@ -365,7 +370,7 @@ private void InitializeContractsPanel()
try
{
LoadingLog(panel.LogText);
var contract = await ThirdwebManager.Instance.GetContract(address: "0x6A7a26c9a595E6893C255C9dF0b593e77518e0c3", chainId: ActiveChainId);
var contract = await ThirdwebManager.Instance.GetContract(address: "0x8F0a4dde7791fa9B6C62E0B099a1a3ff6dd1cF29", chainId: ActiveChainId);
var result = await contract.ERC1155_URI(tokenId: 1);
Log(panel.LogText, $"Result (uri): {result}");
}
Expand All @@ -382,7 +387,7 @@ private void InitializeContractsPanel()
try
{
LoadingLog(panel.LogText);
var dropErc20Contract = await ThirdwebManager.Instance.GetContract(address: "0xEBB8a39D865465F289fa349A67B3391d8f910da9", chainId: ActiveChainId);
var dropErc20Contract = await ThirdwebManager.Instance.GetContract(address: "0x28C1209fa6e7f1B258Ef65527C94129c6F82995f", chainId: ActiveChainId);
var symbol = await dropErc20Contract.ERC20_Symbol();
var balance = await dropErc20Contract.ERC20_BalanceOf(ownerAddress: await ThirdwebManager.Instance.GetActiveWallet().GetAddress());
var balanceEth = Utils.ToEth(wei: balance.ToString(), decimalsToDisplay: 0, addCommas: false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Mono.Cecil;
using Mono.Cecil.Cil;
using System.IO;
using System.Linq;
using Mono.Cecil;
using Mono.Cecil.Cil;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
Expand Down Expand Up @@ -805,7 +805,7 @@ private static TypeDefinition AddMonoPInvokeCallbackAttribute(ModuleDefinition m
{
var type = new TypeDefinition("AOT", "MonoPInvokeCallbackAttribute", TypeAttributes.AnsiClass | TypeAttributes.AutoClass | TypeAttributes.BeforeFieldInit | TypeAttributes.Public)
{
BaseType = moduleDefinition.ImportReference(moduleDefinition.Types.First(t => t.FullName == "System.Attribute"))
BaseType = moduleDefinition.ImportReference(moduleDefinition.Types.First(t => t.FullName == "System.Attribute")),
};
var ctor = new MethodDefinition(
".ctor",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ private void Awake()
var scheduler = timer.GetNestedType("Scheduler", BindingFlags.NonPublic);

var timerSchedulerInstance = scheduler.GetProperty("Instance").GetValue(null);
_timerSchedulerLoop = (Func<int>)scheduler.GetMethod("RunSchedulerLoop", BindingFlags.Instance | BindingFlags.NonPublic)
.CreateDelegate(typeof(Func<int>), timerSchedulerInstance);
_timerSchedulerLoop = (Func<int>)scheduler.GetMethod("RunSchedulerLoop", BindingFlags.Instance | BindingFlags.NonPublic).CreateDelegate(typeof(Func<int>), timerSchedulerInstance);
}

[Preserve]
Expand Down Expand Up @@ -59,4 +58,4 @@ private IEnumerator TimerUpdateCoroutine()
#pragma warning restore CS0162 // Unreachable code detected
}
}
}
}
8 changes: 0 additions & 8 deletions Assets/Thirdweb/Plugins/WalletConnectUnity.meta

This file was deleted.

8 changes: 0 additions & 8 deletions Assets/Thirdweb/Plugins/WalletConnectUnity/Resources.meta

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading