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

fix: WebGLTemplate correct folder, old metamask references #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
35 changes: 19 additions & 16 deletions Assets/MetamaskController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,31 +181,34 @@ private IEnumerator GetDeploymentSmartContractAddressFromReceipt(string transact

private void MetamaskConnectButton_Clicked()
{
Debug.Log("Connect");
_lblError.visible = false;
#if !DEBUG
if (MetamaskInterop.IsMetamaskAvailable())

Debug.Log("Connect Run");

if (MetamaskWebglInterop.IsMetamaskAvailable())
{
MetamaskInterop.EnableEthereum(gameObject.name, nameof(EthereumEnabled), nameof(DisplayError));
MetamaskWebglInterop.EnableEthereum(gameObject.name, nameof(EthereumEnabled), nameof(DisplayError));
}
else
{
DisplayError("Metamask is not available, please install it");
}
#endif


}

public void EthereumEnabled(string addressSelected)
{
#if !DEBUG

if (!_isMetamaskInitialised)
{
MetamaskInterop.EthereumInit(gameObject.name, nameof(NewAccountSelected), nameof(ChainChanged));
MetamaskInterop.GetChainId(gameObject.name, nameof(ChainChanged), nameof(DisplayError));
MetamaskWebglInterop.EthereumInit(gameObject.name, nameof(NewAccountSelected), nameof(ChainChanged));
MetamaskWebglInterop.GetChainId(gameObject.name, nameof(ChainChanged), nameof(DisplayError));
_isMetamaskInitialised = true;
}
NewAccountSelected(addressSelected);
#endif

}

public void ChainChanged(string chainId)
Expand Down Expand Up @@ -250,35 +253,35 @@ private IEnumerator GetBlockNumber()

public IUnityRpcRequestClientFactory GetUnityRpcRequestClientFactory()
{
#if !DEBUG
if (MetamaskInterop.IsMetamaskAvailable())

if (MetamaskWebglInterop.IsMetamaskAvailable())
{
return new MetamaskRequestRpcClientFactory(_selectedAccountAddress, null, 1000);
return new MetamaskWebglCoroutineRequestRpcClientFactory(_selectedAccountAddress, null, 1000);
}
else
{
DisplayError("Metamask is not available, please install it");
return null;
}
#endif

_selectedAccountAddress = "0x12890D2cce102216644c59daE5baed380d84830c";
return new UnityWebRequestRpcClientFactory("http://localhost:8545");
}


public IContractTransactionUnityRequest GetContractTransactionUnityRequest()
{
#if !DEBUG
if (MetamaskInterop.IsMetamaskAvailable())

if (MetamaskWebglInterop.IsMetamaskAvailable())
{
return new MetamaskTransactionUnityRequest(_selectedAccountAddress, GetUnityRpcRequestClientFactory());
return new MetamaskTransactionCoroutineUnityRequest (_selectedAccountAddress, GetUnityRpcRequestClientFactory());
}
else
{
DisplayError("Metamask is not available, please install it");
return null;
}
#endif

_selectedAccountAddress = "0x12890D2cce102216644c59daE5baed380d84830c";
return new TransactionSignedUnityRequest("http://localhost:8545", "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7", 444444444500);
}
Expand Down
8 changes: 8 additions & 0 deletions Assets/WebGLTemplates.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/WebGLTemplates/Nethereum.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/WebGLTemplates/Nethereum/Build.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
7 changes: 7 additions & 0 deletions Assets/WebGLTemplates/Nethereum/Build/WebGl.data.br.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/WebGLTemplates/Nethereum/Build/WebGl.loader.js.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
7 changes: 7 additions & 0 deletions Assets/WebGLTemplates/Nethereum/Build/WebGl.wasm.br.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/WebGLTemplates/Nethereum/TemplateData.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/WebGLTemplates/Nethereum/TemplateData/favicon.ico.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/WebGLTemplates/Nethereum/TemplateData/style.css.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
7 changes: 7 additions & 0 deletions Assets/WebGLTemplates/Nethereum/index.html.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.