这是indexloc提供的服务,不要输入任何密码
Skip to content

SendTransaction sample not working with Web3Auth #995

@juans-chainsafe

Description

@juans-chainsafe

Describe the bug
SendTransaction is failing when you login using Web3Auth but works with HyperPlay or Wallet connect.

Steps
Steps to reproduce the behavior:

  1. Use the scene [SampleLogin - Web3Auth]
  2. Login with [Web3Auth]
  3. Click on "SendTransaction" button in More examples section

Expected behavior
Tx hash output is printed in the console

Console errors

UnityException: Create can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEngine.Networking.UnityWebRequest..ctor (System.String url, System.String method) (at /Users/bokken/build/output/unity/unity/Modules/UnityWebRequest/Public/UnityWebRequest.bindings.cs:197)
Nethereum.Unity.Rpc.UnityWebRequestRpcTaskClient.SendAsyncInternally (System.String rpcRequestJson, System.String uri, System.String rpcRequestMethod, Nethereum.JsonRpc.Client.RpcLogger logger) (at <9a162927cb4e440db1acb885b11469b0>:0)
Nethereum.Unity.Rpc.UnityWebRequestRpcTaskClient.SendAsync (Nethereum.JsonRpc.Client.RpcMessages.RpcRequestMessage request, System.String route) (at <9a162927cb4e440db1acb885b11469b0>:0)
Nethereum.JsonRpc.Client.ClientBase.SendInnerRequestAsync[T] (Nethereum.JsonRpc.Client.RpcMessages.RpcRequestMessage reqMsg, System.String route) (at <36dfdb77e13d48349875c9b86643edf3>:0)
Nethereum.JsonRpc.Client.ClientBase.SendRequestAsync[T] (Nethereum.JsonRpc.Client.RpcRequest request, System.String route) (at <36dfdb77e13d48349875c9b86643edf3>:0)
Nethereum.RPC.NonceServices.InMemoryNonceService.GetNextNonceAsync () (at <1b89ca6ffbac47b18b7203c7f6da5e98>:0)
Nethereum.Web3.Accounts.AccountSignerTransactionManager.GetNonceAsync (Nethereum.RPC.Eth.DTOs.TransactionInput transaction) (at <3da9a257e6c340efa8406e7705ab135d>:0)
Nethereum.Web3.Accounts.AccountSignerTransactionManager.SignTransactionRetrievingNextNonceAsync (Nethereum.RPC.Eth.DTOs.TransactionInput transaction) (at <3da9a257e6c340efa8406e7705ab135d>:0)
Nethereum.Web3.Accounts.AccountSignerTransactionManager.SignTransactionAsync (Nethereum.RPC.Eth.DTOs.TransactionInput transaction) (at <3da9a257e6c340efa8406e7705ab135d>:0)
ChainSafe.Gaming.InProcessTransactionExecutor.InProcessTransactionExecutor.SendTransaction (ChainSafe.Gaming.Evm.Transactions.TransactionRequest transaction) (at <00132046cbe64d3fb1db54a90588baf0>:0)
Rethrow as Web3Exception: Create can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
ChainSafe.Gaming.InProcessTransactionExecutor.InProcessTransactionExecutor.SendTransaction (ChainSafe.Gaming.Evm.Transactions.TransactionRequest transaction) (at <00132046cbe64d3fb1db54a90588baf0>:0)
Scripts.EVM.Token.Evm.SendTransaction (ChainSafe.Gaming.Web3.Web3 web3, System.String to) (at ./Library/PackageCache/io.chainsafe.web3-unity@8365aedec2/Runtime/Scripts/EVM/Token/Evm.cs:109)
EvmCalls.SendTransaction () (at Assets/Samples/web3.unity SDK/2.6.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/EVM/EvmCalls.cs:226)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <e307bbb467104258887a104f6151f183>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)

Desktop (please complete the following information):

  • Chainsafe SDK version: [dev - 2.6.0]
  • Unity Version: [2022.2]
  • Operating System: [Mac]

Additional context
Transactions that require gas fee are VERY slow with Web3Auth, a lot of them fails after being Pending for a lot of time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: P1Added to issues and PRs relating to a high severity bugs.Type: BugAdded to issues and PRs if they are addressing a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions