Skip to content

Commit

Permalink
Adding the event to the web3unity so that anyone anywhere can be info…
Browse files Browse the repository at this point in the history
…rmed when web3 instance inside of the Web3Unity is initialized. (#1200)

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

* Sync Dependencies [skip ci]

---------

Co-authored-by: kantagara <[email protected]>
  • Loading branch information
kantagara and kantagara authored Oct 21, 2024
1 parent 7d22a67 commit 8897d83
Show file tree
Hide file tree
Showing 17 changed files with 5 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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

0 comments on commit 8897d83

Please sign in to comment.