Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the event to the web3unity so that anyone anywhere can be informed when web3 instance inside of the Web3Unity is initialized. #1200

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Packages/io.chainsafe.web3-unity/Runtime/Scripts/Web3Unity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using ChainSafe.Gaming.Evm.Contracts.BuiltIn;
using ChainSafe.Gaming.Evm.Contracts.Extensions;
using ChainSafe.Gaming.Evm.Providers;
using ChainSafe.Gaming.Evm.Signers;
using ChainSafe.Gaming.Evm.Transactions;
using ChainSafe.Gaming.UnityPackage.Connection;
using ChainSafe.Gaming.UnityPackage.UI;
Expand Down Expand Up @@ -45,6 +46,8 @@ public static Web3Unity Instance
}
}

public static event Action<(CWeb3 web3, bool isLightweight)> Web3Initialized;

/// <summary>
/// Web3 Instance.
/// </summary>
Expand Down Expand Up @@ -270,6 +273,8 @@ public Task OnWeb3Initialized(CWeb3 web3)
{
_connectModal.Close();
}

Web3Initialized?.Invoke((_web3, _web3.ServiceProvider.GetService(typeof(ISigner)) != null));

return Task.CompletedTask;
}
Expand Down
Loading