/// <summary> /// Public Constructor. /// </summary> /// <param name="message"> /// The message generated by the library describing the /// condition that raised the exception. /// </param> /// <param name="transaction"> /// The Transaction ID of the request that failed. /// </param> /// <param name="code"> /// The final <see cref="ResponseCode"/> returned by the network /// prior to transaction request expiration. /// </param> /// <param name="callResult"> /// The results returned from the contract, which may include /// additional information regarding the error. /// </param> public ContractException(string message, TxId transaction, ResponseCode code, ulong cost, ContractCallResult callResult) : base(message) { Status = code; TxId = transaction; RequiredFee = cost; CallResult = callResult; }
protected async Task HandleValidSubmit() { _output = null; await _network.ExecuteAsync(_input.Gateway, _input.Payer, async client => { var queryParams = new QueryContractParams { Contract = _input.Contract, Gas = _input.Gas.GetValueOrDefault(), ReturnValueCharge = _input.ReturnValueCharge.GetValueOrDefault(), MaxAllowedReturnSize = _input.MaxAllowedReturnSize.GetValueOrDefault(), FunctionName = _input.FunctionName, FunctionArgs = _input.Arguments.ToArray() }; _output = await client.QueryContractAsync(queryParams, ctx => ctx.Memo = _input.Memo?.Trim()); }); }
internal Hashgraph.ContractCallResult ToContractCallResult() { return(new Hashgraph.ContractCallResult { Result = new Hashgraph.ContractCallResultData(ContractCallResult.ToArray()), Error = ErrorMessage, Bloom = Bloom.ToArray(), Gas = GasUsed, Events = LogInfo?.Select(log => new Hashgraph.ContractEvent { Contract = log.ContractID.ToAddress(), Bloom = log.Bloom.ToArray(), Topic = log.Topic.Select(bs => new ReadOnlyMemory <byte>(bs.ToArray())).ToArray(), Data = new Hashgraph.ContractCallResultData(log.Data.ToArray()), }).ToArray() ?? new Hashgraph.ContractEvent[0], CreatedContracts = CreatedContractIDs?.Select(id => id.ToAddress()).ToArray() ?? new Hashgraph.Address[0] }); }
internal CallContractRecord FillProperties(CallContractRecord record) { FillCommonProperties(record); record.CallResult = ContractCallResult.ToContractCallResult(); return(record); }