Skip to content

Commit 1b5a944

Browse files
authored
[WebGL] ERC1155.TransferBatch and SW deployOnSign support (#147)
1 parent 0a3825c commit 1b5a944

File tree

6 files changed

+33267
-32502
lines changed

6 files changed

+33267
-32502
lines changed

Assets/Thirdweb/Core/Scripts/ERC1155.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,7 @@ public async Task<TransactionResult> TransferBatch(string to, BigInteger[] token
348348
{
349349
if (Utils.IsWebGLBuild())
350350
{
351-
throw new UnityException("This functionality is not yet available on your current platform.");
352-
// WEN WEBGL
353-
// return await Bridge.InvokeRoute<TransactionResult>(getRoute("transferBatch"), Utils.ToJsonStringArray(to, tokenIds, amounts));
351+
return await Bridge.InvokeRoute<TransactionResult>(getRoute("transferBatch"), Utils.ToJsonStringArray(to, tokenIds, amounts));
354352
}
355353
else
356354
{

Assets/Thirdweb/Core/Scripts/ThirdwebManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public class ThirdwebManager : MonoBehaviour
100100
public bool gasless;
101101

102102
[Tooltip("Indicates whether to deploy the smart wallet upon signing any type of message.")]
103-
public bool doNotDeployOnSignMessage;
103+
public bool deployOnSign;
104104

105105
[Tooltip("Optional - If you want to use a custom relayer, you can provide the URL here")]
106106
public string bundlerUrl;
@@ -284,7 +284,7 @@ public void Initialize(string chainIdentifier)
284284
{
285285
factoryAddress = factoryAddress,
286286
gasless = gasless,
287-
doNotDeployOnSignMessage = doNotDeployOnSignMessage,
287+
deployOnSign = deployOnSign,
288288
bundlerUrl = string.IsNullOrEmpty(bundlerUrl) ? $"https://{activeChainId}.bundler.thirdweb.com" : bundlerUrl,
289289
paymasterUrl = string.IsNullOrEmpty(paymasterUrl) ? $"https://{activeChainId}.bundler.thirdweb.com" : paymasterUrl,
290290
entryPointAddress = string.IsNullOrEmpty(entryPointAddress) ? Thirdweb.AccountAbstraction.Constants.DEFAULT_ENTRYPOINT_ADDRESS : entryPointAddress,

Assets/Thirdweb/Core/Scripts/ThirdwebSDK.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public struct SmartWalletConfig
115115
/// <summary>
116116
/// Indicates whether to deploy the smart wallet upon signing any type of message.
117117
/// </summary>
118-
public bool doNotDeployOnSignMessage;
118+
public bool deployOnSign;
119119

120120
/// <summary>
121121
/// The URL of the bundler service.

Assets/Thirdweb/Core/Scripts/Wallet.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,7 @@ public async Task<string> Sign(string message)
416416
}
417417
else
418418
{
419-
if (
420-
ThirdwebManager.Instance.SDK.session.ActiveWallet.GetProvider() == WalletProvider.SmartWallet
421-
&& !ThirdwebManager.Instance.SDK.session.Options.smartWalletConfig.Value.doNotDeployOnSignMessage
422-
)
419+
if (ThirdwebManager.Instance.SDK.session.ActiveWallet.GetProvider() == WalletProvider.SmartWallet && ThirdwebManager.Instance.SDK.session.Options.smartWalletConfig.Value.deployOnSign)
423420
{
424421
var sw = ThirdwebManager.Instance.SDK.session.ActiveWallet as Wallets.ThirdwebSmartWallet;
425422
if (!sw.SmartWallet.IsDeployed && !sw.SmartWallet.IsDeploying)
@@ -447,10 +444,7 @@ public async Task<string> SignTypedDataV4<T, TDomain>(T data, TypedData<TDomain>
447444
if (!await IsConnected())
448445
throw new Exception("No account connected!");
449446

450-
if (
451-
ThirdwebManager.Instance.SDK.session.ActiveWallet.GetProvider() == WalletProvider.SmartWallet
452-
&& !ThirdwebManager.Instance.SDK.session.Options.smartWalletConfig.Value.doNotDeployOnSignMessage
453-
)
447+
if (ThirdwebManager.Instance.SDK.session.ActiveWallet.GetProvider() == WalletProvider.SmartWallet && ThirdwebManager.Instance.SDK.session.Options.smartWalletConfig.Value.deployOnSign)
454448
{
455449
var sw = ThirdwebManager.Instance.SDK.session.ActiveWallet as Wallets.ThirdwebSmartWallet;
456450
if (!sw.SmartWallet.IsDeployed && !sw.SmartWallet.IsDeploying)

Assets/Thirdweb/Editor/ThirdwebManagerEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class ThirdwebManagerEditor : Editor
2727
private SerializedProperty walletConnectExplorerRecommendedWalletIdsProperty;
2828
private SerializedProperty factoryAddressProperty;
2929
private SerializedProperty gaslessProperty;
30-
private SerializedProperty doNotDeployOnSignMessageProperty;
30+
private SerializedProperty deployOnSignProperty;
3131
private SerializedProperty bundlerUrlProperty;
3232
private SerializedProperty paymasterUrlProperty;
3333
private SerializedProperty entryPointAddressProperty;
@@ -68,7 +68,7 @@ private void OnEnable()
6868
walletConnectExplorerRecommendedWalletIdsProperty = serializedObject.FindProperty("walletConnectExplorerRecommendedWalletIds");
6969
factoryAddressProperty = serializedObject.FindProperty("factoryAddress");
7070
gaslessProperty = serializedObject.FindProperty("gasless");
71-
doNotDeployOnSignMessageProperty = serializedObject.FindProperty("doNotDeployOnSignMessage");
71+
deployOnSignProperty = serializedObject.FindProperty("deployOnSign");
7272
bundlerUrlProperty = serializedObject.FindProperty("bundlerUrl");
7373
paymasterUrlProperty = serializedObject.FindProperty("paymasterUrl");
7474
entryPointAddressProperty = serializedObject.FindProperty("entryPointAddress");
@@ -306,7 +306,7 @@ public override void OnInspectorGUI()
306306

307307
if (showSmartWalletOptionalFields)
308308
{
309-
EditorGUILayout.PropertyField(doNotDeployOnSignMessageProperty);
309+
EditorGUILayout.PropertyField(deployOnSignProperty);
310310
EditorGUILayout.PropertyField(bundlerUrlProperty);
311311
EditorGUILayout.PropertyField(paymasterUrlProperty);
312312
EditorGUILayout.PropertyField(entryPointAddressProperty);

0 commit comments

Comments
 (0)