Skip to content

Commit e64465d

Browse files
authored
3.0.0 Official Release (#109)
1 parent 96ed963 commit e64465d

File tree

482 files changed

+517
-81428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

482 files changed

+517
-81428
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ sysinfo.txt
5959

6060
# Builds
6161
*.apk
62-
*.unitypackage
6362

6463
Assets/StreamingAssets/
6564

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"visualstudiotoolsforunity.vstuc"
4+
]
5+
}

.vscode/launch.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Attach to Unity",
6+
"type": "vstuc",
7+
"request": "attach",
8+
}
9+
]
10+
}

Assets/Plugins/Android.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/Android/com.squareup.okhttp3.okhttp-4.10.0.jar.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/Android/com.squareup.okio.okio-jvm-3.0.0.jar.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/Android/org.jetbrains.annotations-13.0.jar.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/Android/org.jetbrains.kotlin.kotlin-stdlib-1.6.20.jar.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/Android/org.jetbrains.kotlin.kotlin-stdlib-common-1.6.20.jar.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/Android/org.jetbrains.kotlin.kotlin-stdlib-jdk7-1.5.31.jar.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Plugins/Android/org.jetbrains.kotlin.kotlin-stdlib-jdk8-1.5.31.jar.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Thirdweb/Core/Scripts/AccountAbstraction/Core/BundlerClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static async Task<PMSponsorOperationResponse> PMSponsorUserOperation(stri
4141
private static async Task<RpcResponseMessage> BundlerRequest(string url, string apiKey, object requestId, string method, params object[] args)
4242
{
4343
using HttpClient client = new HttpClient();
44-
// UnityEngine.Debug.Log($"Bundler Request: {method}({string.Join(", ", args)})");
44+
ThirdwebDebug.Log($"Bundler Request: {method}({string.Join(", ", args)})");
4545
var requestMessage = new RpcRequestMessage(requestId, method, args);
4646
string requestMessageJson = JsonConvert.SerializeObject(requestMessage);
4747

@@ -59,7 +59,7 @@ private static async Task<RpcResponseMessage> BundlerRequest(string url, string
5959
throw new Exception($"Bundler Request Failed. Error: {httpResponse.StatusCode} - {httpResponse.ReasonPhrase} - {await httpResponse.Content.ReadAsStringAsync()}");
6060

6161
var httpResponseJson = await httpResponse.Content.ReadAsStringAsync();
62-
// UnityEngine.Debug.Log($"Bundler Response: {httpResponseJson}");
62+
ThirdwebDebug.Log($"Bundler Response: {httpResponseJson}");
6363

6464
var response = JsonConvert.DeserializeObject<RpcResponseMessage>(httpResponseJson);
6565
if (response.Error != null)

Assets/Thirdweb/Core/Scripts/AccountAbstraction/Core/SmartWallet.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ internal async Task Initialize()
9494

9595
_initialized = true;
9696

97-
Debug.Log($"Initialized with Factory: {Config.factoryAddress}, AdminSigner: {PersonalAddress}, Predicted Account: {Accounts[0]}, Deployed: {_deployed}");
97+
ThirdwebDebug.Log($"Initialized with Factory: {Config.factoryAddress}, AdminSigner: {PersonalAddress}, Predicted Account: {Accounts[0]}, Deployed: {_deployed}");
9898
}
9999

100100
internal async Task UpdateDeploymentStatus()
@@ -139,7 +139,7 @@ internal async Task<bool> VerifySignature(byte[] hash, byte[] signature)
139139

140140
internal async Task<RpcResponseMessage> Request(RpcRequestMessage requestMessage)
141141
{
142-
Debug.Log("Requesting: " + requestMessage.Method + "...");
142+
ThirdwebDebug.Log("Requesting: " + requestMessage.Method + "...");
143143

144144
if (requestMessage.Method == "eth_chainId")
145145
{
@@ -211,10 +211,10 @@ private async Task<RpcResponseMessage> CreateUserOpAndSend(RpcRequestMessage req
211211

212212
// Send the user operation
213213

214-
Debug.Log("Valid UserOp: " + JsonConvert.SerializeObject(partialUserOp));
215-
Debug.Log("Valid Encoded UserOp: " + JsonConvert.SerializeObject(partialUserOpHexified));
214+
ThirdwebDebug.Log("Valid UserOp: " + JsonConvert.SerializeObject(partialUserOp));
215+
ThirdwebDebug.Log("Valid Encoded UserOp: " + JsonConvert.SerializeObject(partialUserOpHexified));
216216
var userOpHash = await BundlerClient.EthSendUserOperation(Config.bundlerUrl, apiKey, requestMessage.Id, partialUserOpHexified, Config.entryPointAddress);
217-
Debug.Log("UserOp Hash: " + userOpHash);
217+
ThirdwebDebug.Log("UserOp Hash: " + userOpHash);
218218

219219
// Wait for the transaction to be mined
220220

@@ -225,21 +225,21 @@ private async Task<RpcResponseMessage> CreateUserOpAndSend(RpcRequestMessage req
225225
txHash = getUserOpResponse?.transactionHash;
226226
await new WaitForSecondsRealtime(5f);
227227
}
228-
Debug.Log("Tx Hash: " + txHash);
228+
ThirdwebDebug.Log("Tx Hash: " + txHash);
229229

230230
// Check if successful
231231

232232
var receipt = await new Web3(ThirdwebManager.Instance.SDK.session.RPC).Eth.Transactions.GetTransactionReceipt.SendRequestAsync(txHash);
233233
var decodedEvents = receipt.DecodeAllEvents<EntryPointContract.UserOperationEventEventDTO>();
234234
if (decodedEvents[0].Event.Success == false)
235235
{
236-
Debug.Log("Transaction not successful, checking reason...");
236+
ThirdwebDebug.Log("Transaction not successful, checking reason...");
237237
var reason = await new Web3(ThirdwebManager.Instance.SDK.session.RPC).Eth.GetContractTransactionErrorReason.SendRequestAsync(txHash);
238238
throw new Exception($"Transaction {txHash} reverted with reason: {reason}");
239239
}
240240
else
241241
{
242-
Debug.Log("Transaction successful");
242+
ThirdwebDebug.Log("Transaction successful");
243243
_deployed = true;
244244
}
245245

Assets/Thirdweb/Core/Scripts/Bridge.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static void Initialize(string chainOrRPC, ThirdwebSDK.Options options)
7272
{
7373
if (!Utils.IsWebGLBuild())
7474
{
75-
Debug.LogWarning("Initializing the thirdweb SDK is not fully supported in the editor.");
75+
ThirdwebDebug.LogWarning("Initializing the thirdweb SDK is not fully supported in the editor.");
7676
return;
7777
}
7878
#if UNITY_WEBGL
@@ -84,7 +84,7 @@ public static async Task<string> Connect(WalletConnection walletConnection)
8484
{
8585
if (!Utils.IsWebGLBuild())
8686
{
87-
Debug.LogWarning("Connecting wallets is not fully supported in the editor.");
87+
ThirdwebDebug.LogWarning("Connecting wallets is not fully supported in the editor.");
8888
return Utils.AddressZero;
8989
}
9090
var task = new TaskCompletionSource<string>();
@@ -109,7 +109,7 @@ public static async Task Disconnect()
109109
{
110110
if (!Utils.IsWebGLBuild())
111111
{
112-
Debug.LogWarning("Disconnecting wallets is not fully supported in the editor.");
112+
ThirdwebDebug.LogWarning("Disconnecting wallets is not fully supported in the editor.");
113113
return;
114114
}
115115
var task = new TaskCompletionSource<string>();
@@ -125,7 +125,7 @@ public static async Task SwitchNetwork(string chainId)
125125
{
126126
if (!Utils.IsWebGLBuild())
127127
{
128-
Debug.LogWarning("Switching networks is not fully supported in the editor.");
128+
ThirdwebDebug.LogWarning("Switching networks is not fully supported in the editor.");
129129
return;
130130
}
131131
var task = new TaskCompletionSource<string>();
@@ -141,7 +141,7 @@ public static async Task<T> InvokeRoute<T>(string route, string[] body)
141141
{
142142
if (!Utils.IsWebGLBuild())
143143
{
144-
Debug.LogWarning("Interacting with the thirdweb SDK is not fully supported in the editor.");
144+
ThirdwebDebug.LogWarning("Interacting with the thirdweb SDK is not fully supported in the editor.");
145145
return default;
146146
}
147147
var msg = Utils.ToJson(new RequestMessageBody(body));
@@ -152,15 +152,15 @@ public static async Task<T> InvokeRoute<T>(string route, string[] body)
152152
ThirdwebInvoke(taskId, route, msg, jsCallback);
153153
#endif
154154
string result = await task.Task;
155-
// Debug.Log($"InvokeRoute Result: {result}");
155+
ThirdwebDebug.Log($"InvokeRoute Result: {result}");
156156
return JsonConvert.DeserializeObject<Result<T>>(result).result;
157157
}
158158

159159
public static string InvokeListener<T>(string route, string[] body, Action<T> action)
160160
{
161161
if (!Utils.IsWebGLBuild())
162162
{
163-
Debug.LogWarning("Interacting with the thirdweb SDK is not fully supported in the editor.");
163+
ThirdwebDebug.LogWarning("Interacting with the thirdweb SDK is not fully supported in the editor.");
164164
return null;
165165
}
166166

@@ -177,7 +177,7 @@ public static async Task FundWallet(FundWalletOptions payload)
177177
{
178178
if (!Utils.IsWebGLBuild())
179179
{
180-
Debug.LogWarning("Interacting with the thirdweb SDK is not fully supported in the editor.");
180+
ThirdwebDebug.LogWarning("Interacting with the thirdweb SDK is not fully supported in the editor.");
181181
return;
182182
}
183183
var msg = Utils.ToJson(payload);
@@ -194,7 +194,7 @@ public static async Task<string> ExportWallet(string password)
194194
{
195195
if (!Utils.IsWebGLBuild())
196196
{
197-
Debug.LogWarning("Interacting with the thirdweb SDK is not fully supported in the editor.");
197+
ThirdwebDebug.LogWarning("Interacting with the thirdweb SDK is not fully supported in the editor.");
198198
return null;
199199
}
200200
string taskId = Guid.NewGuid().ToString();

Assets/Thirdweb/Core/Scripts/Contract.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public async Task<T> Read<T>(string functionName, params object[] args)
244244
else
245245
rawResults.AddRange(result.Select(item => item.Result));
246246

247-
Debug.Log("Raw Result: " + JsonConvert.SerializeObject(rawResults));
247+
ThirdwebDebug.Log("Raw Result: " + JsonConvert.SerializeObject(rawResults));
248248

249249
// Single
250250
if (rawResults.Count == 1)

Assets/Thirdweb/Core/Scripts/ERC1155.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ public async Task<ClaimConditions> GetActive(string tokenId)
469469
}
470470
catch
471471
{
472-
Debug.Log("Could not fetch currency metadata, proceeding without it.");
472+
ThirdwebDebug.Log("Could not fetch currency metadata, proceeding without it.");
473473
}
474474

475475
return new ClaimConditions()

Assets/Thirdweb/Core/Scripts/ERC20.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public async Task<TransactionResult> SetAllowance(string spender, string amount)
171171
var result = new TransactionResult();
172172
if (diff == 0)
173173
{
174-
Debug.LogWarning($"Allowance is already of amount {amount} - Skipping request...");
174+
ThirdwebDebug.LogWarning($"Allowance is already of amount {amount} - Skipping request...");
175175
result = null;
176176
}
177177
else if (diff < 0)
@@ -392,7 +392,7 @@ public async Task<ClaimConditions> GetActive()
392392
}
393393
catch
394394
{
395-
Debug.Log("Could not fetch currency metadata, proceeding without it.");
395+
ThirdwebDebug.Log("Could not fetch currency metadata, proceeding without it.");
396396
}
397397

398398
return new ClaimConditions()

Assets/Thirdweb/Core/Scripts/ERC721.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public async Task<string> OwnerOf(string tokenId)
190190
}
191191
catch (System.Exception)
192192
{
193-
Debug.LogWarning($"Unable to find owner of {tokenId}, return address(0)");
193+
ThirdwebDebug.LogWarning($"Unable to find owner of {tokenId}, return address(0)");
194194
return "0x0000000000000000000000000000000000000000";
195195
}
196196
}
@@ -506,7 +506,7 @@ public async Task<ClaimConditions> GetActive()
506506
}
507507
catch
508508
{
509-
Debug.Log("Could not fetch currency metadata, proceeding without it.");
509+
ThirdwebDebug.Log("Could not fetch currency metadata, proceeding without it.");
510510
}
511511

512512
return new ClaimConditions()

Assets/Thirdweb/Core/Scripts/Hyperplay/Hyperplay.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ internal async Task<RpcResponseMessage> Request(RpcRequestMessage message)
3535
await request.SendWebRequest();
3636
if (request.result != UnityWebRequest.Result.Success)
3737
{
38-
Debug.LogError(request.error);
38+
ThirdwebDebug.LogError(request.error);
3939
throw new UnityException("RPC request failed: " + request.error);
4040
}
4141
var hyperplayResult = JsonConvert.DeserializeObject<HyperplayResult>(request.downloadHandler.text);

Assets/Thirdweb/Core/Scripts/Storage/StorageDownloader.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public async Task<T> DownloadText<T>(string textURI)
1212
{
1313
if (string.IsNullOrEmpty(textURI))
1414
{
15-
Debug.LogWarning($"Unable to download text from empty uri!");
15+
ThirdwebDebug.LogWarning($"Unable to download text from empty uri!");
1616
return default;
1717
}
1818

@@ -28,7 +28,7 @@ public async Task<T> DownloadText<T>(string textURI)
2828
await req.SendWebRequest();
2929
if (req.result != UnityWebRequest.Result.Success)
3030
{
31-
Debug.LogWarning($"Unable to fetch text uri {textURI} data! {req.error}");
31+
ThirdwebDebug.LogWarning($"Unable to fetch text uri {textURI} data! {req.error}");
3232
return default;
3333
}
3434
string json = req.downloadHandler.text;
@@ -39,7 +39,7 @@ public async Task<Sprite> DownloadImage(string imageURI)
3939
{
4040
if (string.IsNullOrEmpty(imageURI))
4141
{
42-
Debug.LogWarning($"Unable to download image from empty uri!");
42+
ThirdwebDebug.LogWarning($"Unable to download image from empty uri!");
4343
return null;
4444
}
4545

@@ -55,7 +55,7 @@ public async Task<Sprite> DownloadImage(string imageURI)
5555
await req.SendWebRequest();
5656
if (req.result != UnityWebRequest.Result.Success)
5757
{
58-
Debug.LogWarning($"Unable to fetch image uri {imageURI} data! {req.error}");
58+
ThirdwebDebug.LogWarning($"Unable to fetch image uri {imageURI} data! {req.error}");
5959
return null;
6060
}
6161
else
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using UnityEngine;
3+
4+
namespace Thirdweb
5+
{
6+
public static class ThirdwebDebug
7+
{
8+
public static bool IsEnabled => ThirdwebManager.Instance != null && ThirdwebManager.Instance.showDebugLogs;
9+
10+
public static void Log(object message)
11+
{
12+
if (IsEnabled)
13+
Debug.Log(message);
14+
}
15+
16+
public static void LogWarning(object message)
17+
{
18+
if (IsEnabled)
19+
Debug.LogWarning(message);
20+
}
21+
22+
public static void LogError(object message)
23+
{
24+
if (IsEnabled)
25+
Debug.LogError(message);
26+
}
27+
28+
public static void LogException(Exception exception)
29+
{
30+
if (IsEnabled)
31+
Debug.LogException(exception);
32+
}
33+
}
34+
}

Assets/Thirdweb/Plugins/MetaMask/Samples/Main/Scripts/CanvasScaler.cs.meta renamed to Assets/Thirdweb/Core/Scripts/ThirdwebDebug.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)