Closed shekaryf closed 3 weeks ago
I changed the network and the problem solved
How can I use Sepolia test network, Is that possible?
@shekaryf do you get NullReferenceException
when calling AppKit.Evm.GetBalanceAsync
with Sepolia, but not with other networks?
Yes, I do
Could you please share the code of your Chain
object for Sepolia chain? 🙏
You mean this? let me know if I'm wrong. I put this code after OpenModal():
AppKit.ChainChanged += (sender, eventArgs) => {
Chain newChain = eventArgs.Chain;
Debug.Log("Chain Changed....");
Debug.Log(newChain.ToString());
};
Now I'm getting this error:
NullReferenceException: Object reference not set to an instance of an object
MapMenuDialog+<>c.<SetValues>b__16_7 (System.Object sender, Reown.AppKit.Unity.NetworkController+ChainChangedEventArgs eventArgs) (at Assets/Scripts/UI/Dialogs/MapMenuDialog.cs:225)
Reown.AppKit.Unity.NetworkController.OnChainChanged (Reown.AppKit.Unity.NetworkController+ChainChangedEventArgs e) (at ./Library/PackageCache/com.reown.appkit.unity@1.0.1/Runtime/Controllers/NetworkController/NetworkController.cs:72)
Reown.AppKit.Unity.NetworkControllerCore.ConnectorAccountConnectedHandlerCore (System.Object sender, Reown.AppKit.Unity.Connector+AccountConnectedEventArgs e) (at ./Library/PackageCache/com.reown.appkit.unity@1.0.1/Runtime/Controllers/NetworkController/NetworkControllerCore.cs:66)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <31687ccd371e4dc6b0c23a1317cf9474>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <6ff3bcb667574bf9a8630184172fcfbf>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <6ff3bcb667574bf9a8630184172fcfbf>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <6ff3bcb667574bf9a8630184172fcfbf>:0)
But In Ethereum Main Network I don't see this error!
Testnets aren't supported out of the box, you need to add them to the supportedChains
array in the AppKitConfig
.
https://docs.reown.com/appkit/unity/core/options#supported-chains
Did you add Sepolia to the supportedChains
? If so, could you share the code please?
I changed the code to
await AppKit.InitializeAsync(new AppKitConfig(
"aaaaaaaaaaaaaaa",
new Metadata(
"aaaaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaaa",
"https://mmmmm.net",
"https://mmmmm.net/Logo.png"
))
{
supportedChains = new[]
{
ChainConstants.Chains.Ethereum,
ChainConstants.Chains.Polygon,
ChainConstants.Chains.Ronin,
new Chain(ChainConstants.Namespaces.Evm,
chainReference: "11155111",
name: "Sepolia test network",
nativeCurrency: new Currency(),
blockExplorer: new BlockExplorer(),
rpcUrl: "wss://sepolia.drpc.org ",
isTestnet: true,
imageUrl: $"https://chainlist.org/unknown-logo.png",
viemName: "Sepoliatestnetwork" // required only on WebGL
)
}
});
And it works fine thank you
Nice! Could you help me understand what caused Sepolia not to work for you earlier? Did you add it to the supportedChains, or were you using a different RPC URL?
No, I didn't use supportedChains in InitializeAsync
Now I use
supportedChains
and I got the balance
Thanks
I'm using this document: https://docs.reown.com/appkit/unity/core/usage I did installation completely; Now I'm starting to get balance here:
I see this error, now:
My unity version is 2022.3.5f1 Any help? thanks