/// <summary> /// Executes a new message call immediately without creating a transaction on the block chain. /// </summary> public async Task <TReturn> Call(CallParams callParams = null, DefaultBlockParameter blockParameter = null) { var callResult = await CallRaw(callParams, blockParameter); var result = ParseReturnData(callResult); return(result); }
public async Task <UInt256> EstimateGas(CallParams callParams = null, DefaultBlockParameter blockParameter = null) { callParams = _contract.GetCallParams(callParams); callParams.Data = _callData; blockParameter = blockParameter ?? BlockParameterType.Latest; var result = await _contract.JsonRpcClient.EstimateGas(callParams, blockParameter); return(result); }
/// <summary> /// Executes a new message call immediately without creating a transaction on the block chain. /// Returns the raw ABI encoded response. /// </summary> public async Task <byte[]> CallRaw(CallParams callParams = null, DefaultBlockParameter blockParameter = null) { callParams = _contract.GetCallParams(callParams); callParams.Data = _callData; blockParameter = blockParameter ?? BlockParameterType.Latest; byte[] callResult; try { callResult = await _contract.JsonRpcClient.Call(callParams, blockParameter); } catch (JsonRpcErrorException rpcEx) when(_contract.JsonRpcClient.ErrorFormatter != null) { var formattedException = await _contract.JsonRpcClient.ErrorFormatter(_contract.JsonRpcClient, rpcEx.Error); throw formattedException; } return(callResult); }
/// <summary> /// Executes a new message call immediately without creating a transaction on the block chain and expects a revert. /// Throws an exception if call does not revert. /// </summary> public async Task ExpectRevertCall(CallParams callParams = null, DefaultBlockParameter blockParameter = null) { callParams = _contract.GetCallParams(callParams); callParams.Data = _callData; blockParameter = blockParameter ?? BlockParameterType.Latest; var(error, callResult) = await _contract.JsonRpcClient.TryCall(callParams, blockParameter, expectingException : true); if (error == null) { // Check if call is void (no return value) if (this is EthFunc) { throw new Exception("Expected call to revert"); } else { var result = ParseReturnData(callResult); throw new Exception($"Expected call to revert but got back result: {result}"); } } }
public virtual Task <ulong> GetBlockTransactionCountByNumber(DefaultBlockParameter blockParameter) { return(_proxyClient.GetBlockTransactionCountByNumber(blockParameter)); }
public virtual Task <Block> GetBlockByNumber(bool getFullTransactionObjects, DefaultBlockParameter blockParameter) { return(_proxyClient.GetBlockByNumber(getFullTransactionObjects, blockParameter)); }
public Task <ulong> GetTransactionCount(Address address, DefaultBlockParameter blockParameter) { throw new System.NotImplementedException(); }
public virtual Task <UInt256> EstimateGas(CallParams callParams, DefaultBlockParameter blockParameter) { return(_proxyClient.EstimateGas(callParams, blockParameter)); }
public virtual Task <UInt256> GetBalance(Address account, DefaultBlockParameter blockParameter) { return(_proxyClient.GetBalance(account, blockParameter)); }
public virtual Task <ulong> GetTransactionCount(Address address, DefaultBlockParameter blockParameter) { return(_proxyClient.GetTransactionCount(address, blockParameter)); }
public virtual Task <byte[]> Call(CallParams callParams, DefaultBlockParameter blockParameter) { return(_proxyClient.Call(callParams, blockParameter)); }
public Task <byte[]> Call(CallParams ethCallParam, DefaultBlockParameter blockParameter) { throw new System.NotImplementedException(); }
public Task <UInt256> GetBalance(Address account, DefaultBlockParameter blockParameter) { var balance = _accounts[account]; return(Task.FromResult(balance)); }
public Task <byte[]> GetCode(Address address, DefaultBlockParameter blockParameter) { throw new System.NotImplementedException(); }
public Task <ulong> GetBlockTransactionCountByNumber(DefaultBlockParameter blockParameter) { throw new System.NotImplementedException(); }
public Task <Block> GetBlockByNumber(DefaultBlockParameter blockParameter, bool getFullTransactionObjects) { throw new System.NotImplementedException(); }
public Task <UInt256> GetBalance(Address account, DefaultBlockParameter blockParameter) { throw new System.NotImplementedException(); }
public Task <UInt256> EstimateGas(CallParams callParams, DefaultBlockParameter blockParameter) { throw new System.NotImplementedException(); }
public virtual Task <byte[]> GetCode(Address address, DefaultBlockParameter blockParameter) { return(_proxyClient.GetCode(address, blockParameter)); }
public Task <byte[]> Call(CallParams callParams, DefaultBlockParameter blockParameter) { throw new NotImplementedException(); }