Skip to content

Commit 7b3bbaa

Browse files
committed
asset store compat
1 parent 7e108aa commit 7b3bbaa

File tree

15 files changed

+600
-7398
lines changed

15 files changed

+600
-7398
lines changed

Assets/Thirdweb/Editor/ThirdwebSDKInstallerPopup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class ThirdwebSDKInstallerPopup : EditorWindow
1616

1717
#region Editor Window Setup
1818

19-
[MenuItem("Thirdweb/Thirdweb Unity SDK Setup")]
19+
[MenuItem("Tools/Thirdweb/Thirdweb Unity SDK Setup")]
2020
public static void ShowWindow()
2121
{
2222
EditorWindow.GetWindow<ThirdwebSDKInstallerPopup>("Thirdweb Unity SDK Setup").minSize = new Vector2(450, 600);

Assets/Thirdweb/Plugins/MetaMask/Plugins/Libraries/evm.net/Editor/ContractGeneratorEditor.cs

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -5,97 +5,97 @@
55
using UnityEditor;
66
using UnityEngine;
77

8-
public class ContractGeneratorEditor : EditorWindow
8+
namespace MetaMask
99
{
10-
private static ContractGeneratorEditor instance;
11-
12-
private Vector2 AbiScrollPos;
13-
private string AbiJson = "[\n\t{ }\n]";
14-
private string rootNamespace = "Contracts";
15-
16-
[MenuItem("Tools/MetaMask/Contract ABI Converter")]
17-
public static void Initialize()
18-
{
19-
instance = GetWindow<ContractGeneratorEditor>();
20-
instance.titleContent = new GUIContent("Contract ABI -> Code Generator");
21-
instance.minSize = new Vector2(440, 292);
22-
instance.Show();
23-
}
24-
25-
private void OnEnable()
10+
public class ContractGeneratorEditor : EditorWindow
2611
{
27-
EditorApplication.update += EditorUpdate;
28-
}
12+
private static ContractGeneratorEditor instance;
2913

30-
private void OnDisable()
31-
{
32-
EditorApplication.update -= EditorUpdate;
33-
}
14+
private Vector2 AbiScrollPos;
15+
private string AbiJson = "[\n\t{ }\n]";
16+
private string rootNamespace = "Contracts";
3417

35-
private void EditorUpdate()
36-
{
37-
38-
}
39-
40-
private void OnGUI()
41-
{
42-
if (instance == null)
18+
[MenuItem("Tools/MetaMask/Contract ABI Converter")]
19+
public static void Initialize()
4320
{
44-
Initialize();
21+
instance = GetWindow<ContractGeneratorEditor>();
22+
instance.titleContent = new GUIContent("Contract ABI -> Code Generator");
23+
instance.minSize = new Vector2(440, 292);
24+
instance.Show();
4525
}
4626

47-
EditorGUILayout.LabelField("Contract ABI Json", EditorStyles.boldLabel);
48-
EditorGUILayout.HelpBox("Copy and paste your Contract ABI JSON to the text box below, then click Convert. You may optionally set options to customize the generated C# code.", MessageType.Info);
49-
50-
AbiScrollPos = EditorGUILayout.BeginScrollView(AbiScrollPos);
51-
AbiJson = EditorGUILayout.TextArea(AbiJson, GUILayout.ExpandHeight(true));
52-
EditorGUILayout.EndScrollView();
53-
54-
GUILayout.Space(15f);
55-
56-
EditorGUILayout.LabelField("Contract Code Settings", EditorStyles.boldLabel);
27+
private void OnEnable()
28+
{
29+
EditorApplication.update += EditorUpdate;
30+
}
5731

58-
rootNamespace = EditorGUILayout.TextField("Root Namespace", rootNamespace);
32+
private void OnDisable()
33+
{
34+
EditorApplication.update -= EditorUpdate;
35+
}
5936

60-
GUILayout.Space(15f);
37+
private void EditorUpdate() { }
6138

62-
63-
if (GUILayout.Button("Convert"))
39+
private void OnGUI()
6440
{
65-
string contractName;
66-
string bytecode = null;
67-
ContractABI abi;
68-
try
69-
{
70-
var contractArtifact = JsonConvert.DeserializeObject<ContractArtifact>(AbiJson);
71-
contractName = contractArtifact.ContractName;
72-
bytecode = contractArtifact.Bytecode;
73-
abi = contractArtifact.ABI;
74-
}
75-
catch (JsonSerializationException)
41+
if (instance == null)
7642
{
77-
// Try just ContractABI
78-
abi = JsonConvert.DeserializeObject<ContractABI>(AbiJson);
79-
contractName = rootNamespace.Split(".")[0];
43+
Initialize();
8044
}
81-
82-
// Choose save directory
83-
string path = EditorUtility.SaveFolderPanel("Choose folder to save scripts", "Assets", contractName);
8445

85-
ContractInterfaceGenerator generator = new ContractInterfaceGenerator(rootNamespace, contractName, bytecode, abi);
86-
var items = generator.GenerateAll();
46+
EditorGUILayout.LabelField("Contract ABI Json", EditorStyles.boldLabel);
47+
EditorGUILayout.HelpBox(
48+
"Copy and paste your Contract ABI JSON to the text box below, then click Convert. You may optionally set options to customize the generated C# code.",
49+
MessageType.Info
50+
);
51+
52+
AbiScrollPos = EditorGUILayout.BeginScrollView(AbiScrollPos);
53+
AbiJson = EditorGUILayout.TextArea(AbiJson, GUILayout.ExpandHeight(true));
54+
EditorGUILayout.EndScrollView();
55+
56+
GUILayout.Space(15f);
57+
58+
EditorGUILayout.LabelField("Contract Code Settings", EditorStyles.boldLabel);
59+
60+
rootNamespace = EditorGUILayout.TextField("Root Namespace", rootNamespace);
8761

88-
foreach (var item in items.Keys)
62+
GUILayout.Space(15f);
63+
64+
if (GUILayout.Button("Convert"))
8965
{
90-
var filepath = path + "/" + item + ".cs";
91-
var text = items[item];
92-
93-
File.WriteAllText(filepath, text);
94-
}
66+
string contractName;
67+
string bytecode = null;
68+
ContractABI abi;
69+
try
70+
{
71+
var contractArtifact = JsonConvert.DeserializeObject<ContractArtifact>(AbiJson);
72+
contractName = contractArtifact.ContractName;
73+
bytecode = contractArtifact.Bytecode;
74+
abi = contractArtifact.ABI;
75+
}
76+
catch (JsonSerializationException)
77+
{
78+
// Try just ContractABI
79+
abi = JsonConvert.DeserializeObject<ContractABI>(AbiJson);
80+
contractName = rootNamespace.Split(".")[0];
81+
}
82+
83+
// Choose save directory
84+
string path = EditorUtility.SaveFolderPanel("Choose folder to save scripts", "Assets", contractName);
85+
86+
ContractInterfaceGenerator generator = new ContractInterfaceGenerator(rootNamespace, contractName, bytecode, abi);
87+
var items = generator.GenerateAll();
9588

96-
AssetDatabase.Refresh();
89+
foreach (var item in items.Keys)
90+
{
91+
var filepath = path + "/" + item + ".cs";
92+
var text = items[item];
93+
94+
File.WriteAllText(filepath, text);
95+
}
96+
97+
AssetDatabase.Refresh();
98+
}
9799
}
98100
}
99-
100-
101101
}
Loading

Assets/Thirdweb/Plugins/MetaMask/Resources/MetaMask/EditorImages/Metamask_Stacked_Logo.png.meta

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)