Skip to content

Commit

Permalink
[Cross-Platform] ZkCandy Sepolia AA Support (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFirekeeper authored Jun 11, 2024
1 parent 5026d3d commit 5b590dd
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class SmartWallet
public bool IsDeploying => _deploying;

private readonly ThirdwebSDK _sdk;
private bool IsZkSync => _sdk.Session.ChainId == 300 || _sdk.Session.ChainId == 324;
private bool IsZkSync => Utils.IsZkSyncChain(_sdk.Session.ChainId);

public SmartWallet(IThirdwebWallet personalWallet, ThirdwebSDK sdk)
{
Expand Down
5 changes: 5 additions & 0 deletions Assets/Thirdweb/Core/Scripts/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -780,5 +780,10 @@ public static Nethereum.Contracts.Function GetFunctionMatchSignature(Nethereum.C
}
throw new UnityException($"Can't find function {functionName} in contract {contract.Address}, that takes: {paramsCount} arguments");
}

public static bool IsZkSyncChain(BigInteger chainId)
{
return chainId == 324 || chainId == 300 || chainId == 302;
}
}
}
2 changes: 1 addition & 1 deletion Assets/Thirdweb/Core/Scripts/Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public async Task<string> SignTypedDataV4<T, TDomain>(T data, TypedData<TDomain>
if (_sdk.Session.ActiveWallet.GetProvider() == WalletProvider.SmartWallet)
{
// Zk AA
if (_sdk.Session.ChainId == 300 || _sdk.Session.ChainId == 324)
if (Utils.IsZkSyncChain(_sdk.Session.ChainId))
{
var hashToken = jsonObject.SelectToken("$.message.data");
if (hashToken != null)
Expand Down
170 changes: 85 additions & 85 deletions Assets/WebGLTemplates/Thirdweb/lib/thirdweb-unity-bridge.js

Large diffs are not rendered by default.

0 comments on commit 5b590dd

Please sign in to comment.