Skip to content

Transfer ERC 1155 example not working #681

@juans-chainsafe

Description

@juans-chainsafe

Describe the bug
TransferErc1155 is not working correctly, throws insufficient balance error

To Reproduce
Steps to reproduce the behavior:

  1. Login with remote wallet (Metamask)
  2. Go to More examples section
  3. Click on 'TransferErc1155' button
  4. See error

Expected behavior
Successful output is displayed on the console

Screenshots
Screenshot 2023-10-23 at 16 21 16

Desktop (please complete the following information):

  • Chainsafe SDK version: [main]
  • Unity Platform: [Windows, Mac, Linux]
  • OS [e.g. Mac]

Additional context

ChainSafe.Gaming.Web3.Web3Exception: eth_estimateGas: bad result from RPC endpoint ---> ChainSafe.Gaming.Web3.Web3Exception: RPC returned error for "eth_estimateGas": 3 execution reverted: ERC1155: insufficient balance for transfer 0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002a455243313135353a20696e73756666696369656e742062616c616e636520666f72207472616e7366657200000000000000000000000000000000000000000000
  at ChainSafe.Gaming.Evm.Providers.RpcClientProvider.Perform[T] (System.String method, System.Object[] parameters) [0x00120] in <7a05048c9dc24ea2adbc648be3f0a75f>:0 
   --- End of inner exception stack trace ---
  at ChainSafe.Gaming.Evm.Providers.RpcClientProvider.Perform[T] (System.String method, System.Object[] parameters) [0x00156] in <7a05048c9dc24ea2adbc648be3f0a75f>:0 
  at ChainSafe.Gaming.Evm.Providers.RpcProviderExtensions.EstimateGas (ChainSafe.Gaming.Evm.Providers.IRpcProvider provider, ChainSafe.Gaming.Evm.Transactions.TransactionRequest transaction) [0x00076] in <7a05048c9dc24ea2adbc648be3f0a75f>:0 
  at ChainSafe.Gaming.Evm.Contracts.Contract.SendWithReceipt (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) [0x00296] in <7a05048c9dc24ea2adbc648be3f0a75f>:0 
  at ChainSafe.Gaming.Evm.Contracts.Contract.Send (System.String method, System.Object[] parameters, ChainSafe.Gaming.Evm.Transactions.TransactionRequest overwrite) [0x00074] in <7a05048c9dc24ea2adbc648be3f0a75f>:0 
  at Web3Unity.Scripts.Prefabs.UnsortedSample.TransferErc1155 (System.String contractAddress, System.Int32 tokenId, System.Int32 amount, System.String toAccount) [0x000f2] in /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/Packages/io.chainsafe.web3-unity/Runtime/Scripts/Samples/UnsortedSample.cs:189 
  at Samples.Behaviours.Unsorted.TransferErc1155Behaviour.ExecuteSample () [0x0003a] in /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/Unsorted/TransferErc1155Behaviour.cs:23 
  at Samples.Behaviours.SampleBehaviour.Execute () [0x000a7] in /Users/juanmanuelspoleti/Desktop/workspace/web3.unity/src/UnitySampleProject/Assets/Samples/web3.unity SDK/2.5.0/Web3.Unity Samples/Scripts/Scenes/SampleMain/SampleBehaviour.cs:31 
 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*)
 #3  (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
 #4  (Mono JIT Code) [DebugLogHandler.cs:10] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
 #5  (Mono JIT Code) [Logger.cs:61] UnityEngine.Logger:Log (UnityEngine.LogType,object)
 #6  (Mono JIT Code) [Debug.bindings.cs:130] UnityEngine.Debug:LogError (object)
 #7  (Mono JIT Code) [SampleBehaviour.cs:38] Samples.Behaviours.SampleBehaviour/<Execute>d__3:MoveNext ()
 #8  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #9  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #10  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #11  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
 #12  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
 #13  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
 #14  (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
 #15  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #16  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #17  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo ()
 #18  (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool)
 #19  (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object)
 #20  (Mono JIT Code) System.Threading.Tasks.Task/WhenAllPromise:Invoke (System.Threading.Tasks.Task)
 #21  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #22  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #23  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo ()
 #24  (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool)
 #25  (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object)
 #26  (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.Threading.Tasks.VoidTaskResult>:SetException (System.Exception)
 #27  (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
 #28  (Mono JIT Code) [TransferErc1155Behaviour.cs:26] Samples.Behaviours.Unsorted.TransferErc1155Behaviour/<ExecuteSample>d__6:MoveNext ()
 #29  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #30  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #31  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #32  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
 #33  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
 #34  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
 #35  (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
 #36  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #37  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #38  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo ()
 #39  (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool)
 #40  (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object)
 #41  (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>:SetException (System.Exception)
 #42  (Mono JIT Code) [UnsortedSample.cs:198] Web3Unity.Scripts.Prefabs.UnsortedSample/<TransferErc1155>d__18:MoveNext ()
 #43  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #44  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #45  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #46  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
 #47  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
 #48  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
 #49  (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
 #50  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #51  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #52  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo ()
 #53  (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool)
 #54  (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object)
 #55  (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>:SetException (System.Exception)
 #56  (Mono JIT Code) ChainSafe.Gaming.Evm.Contracts.Contract/<Send>d__9:MoveNext ()
 #57  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #58  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #59  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #60  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
 #61  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
 #62  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
 #63  (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
 #64  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #65  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #66  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo ()
 #67  (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool)
 #68  (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object)
 #69  (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.ValueTuple`2<object[], ChainSafe.Gaming.Evm.Transactions.TransactionReceipt>>:SetException (System.Exception)
 #70  (Mono JIT Code) ChainSafe.Gaming.Evm.Contracts.Contract/<SendWithReceipt>d__10:MoveNext ()
 #71  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #72  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #73  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #74  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
 #75  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
 #76  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
 #77  (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
 #78  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #79  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #80  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo ()
 #81  (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool)
 #82  (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object)
 #83  (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>:SetException (System.Exception)
 #84  (Mono JIT Code) ChainSafe.Gaming.Evm.Providers.RpcProviderExtensions/<EstimateGas>d__12:MoveNext ()
 #85  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #86  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #87  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #88  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
 #89  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
 #90  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
 #91  (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
 #92  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #93  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #94  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo ()
 #95  (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool)
 #96  (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object)
 #97  (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>:SetException (System.Exception)
 #98  (Mono JIT Code) ChainSafe.Gaming.Evm.Providers.RpcClientProvider/<Perform>d__13`1<T_REF>:MoveNext ()
 #99  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #100  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #101  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #102  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
 #103  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
 #104  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
 #105  (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
 #106  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #107  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #108  (Mono JIT Code) System.Threading.Tasks.Task`1<TResult_REF>:TrySetResult (TResult_REF)
 #109  (Mono JIT Code) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>:SetResult (TResult_REF)
 #110  (Mono JIT Code) System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder`1<TResult_REF>:SetResult (TResult_REF)
 #111  (Mono JIT Code) ChainSafe.Gaming.Web3.Core.Unity.UnityHttpClient/<Post>d__6`2<TRequest_REF, TResponse_REF>:MoveNext ()
 #112  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #113  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #114  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #115  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run ()
 #116  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
 #117  (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
 #118  (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool)
 #119  (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations ()
 #120  (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
 #121  (Mono JIT Code) System.Threading.Tasks.Task`1<TResult_REF>:TrySetResult (TResult_REF)
 #122  (Mono JIT Code) System.Threading.Tasks.TaskCompletionSource`1<TResult_REF>:TrySetResult (TResult_REF)
 #123  (Mono JIT Code) ChainSafe.Gaming.Evm.Unity.Dispatcher/<>c__DisplayClass6_0`1/<<EnqueueTask>g__WrappedAction|0>d<T_REF>:MoveNext ()
 #124  (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
 #125  (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
 #126  (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)

Metadata

Metadata

Assignees

Labels

Type: BugAdded to issues and PRs if they are addressing a bugVersion: 2.5All the issues related to 2.5

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions