public string GenerateMethods() { var messageType = _contractDeploymentCQSMessageModel.GetTypeName(); var messageVariableName = _contractDeploymentCQSMessageModel.GetVariableName(); var sendRequestReceipt = $@"{SpaceUtils.TwoTabs}public static Task<TransactionReceipt> DeployContractAndWaitForReceiptAsync(Nethereum.Web3.Web3 web3, {messageType} {messageVariableName}, CancellationTokenSource cancellationTokenSource = null) {SpaceUtils.TwoTabs}{{ {SpaceUtils.ThreeTabs}return web3.Eth.GetContractDeploymentHandler<{messageType}>().SendRequestAndWaitForReceiptAsync({messageVariableName}, cancellationTokenSource); {SpaceUtils.TwoTabs}}}"; var sendRequest = $@"{SpaceUtils.TwoTabs}public static Task<string> DeployContractAsync(Nethereum.Web3.Web3 web3, {messageType} {messageVariableName}) {SpaceUtils.TwoTabs}{{ {SpaceUtils.ThreeTabs}return web3.Eth.GetContractDeploymentHandler<{messageType}>().SendRequestAsync({messageVariableName}); {SpaceUtils.TwoTabs}}}"; var sendRequestContract = $@"{SpaceUtils.TwoTabs}public static async Task<{_serviceModel.GetTypeName()}> DeployContractAndGetServiceAsync(Nethereum.Web3.Web3 web3, {messageType} {messageVariableName}, CancellationTokenSource cancellationTokenSource = null) {SpaceUtils.TwoTabs}{{ {SpaceUtils.ThreeTabs}var receipt = await DeployContractAndWaitForReceiptAsync(web3, {messageVariableName}, cancellationTokenSource); {SpaceUtils.ThreeTabs}return new {_serviceModel.GetTypeName()}(web3, receipt.ContractAddress); {SpaceUtils.TwoTabs}}}"; return(string.Join(Environment.NewLine, sendRequestReceipt, sendRequest, sendRequestContract)); }
public string GenerateMethods() { var messageType = _contractDeploymentCQSMessageModel.GetTypeName(); var messageVariableName = _contractDeploymentCQSMessageModel.GetVariableName(); var sendRequestReceipt = $@"{SpaceUtils.TwoTabs}static member DeployContractAndWaitForReceiptAsync(web3: Web3, {messageVariableName}: {messageType}, ?cancellationTokenSource : CancellationTokenSource): Task<TransactionReceipt> = {SpaceUtils.ThreeTabs}let cancellationTokenSourceVal = defaultArg cancellationTokenSource null {SpaceUtils.ThreeTabs}web3.Eth.GetContractDeploymentHandler<{messageType}>().SendRequestAndWaitForReceiptAsync({messageVariableName}, cancellationTokenSourceVal) {SpaceUtils.TwoTabs}"; var sendRequest = $@"{SpaceUtils.TwoTabs}static member DeployContractAsync(web3: Web3, {messageVariableName}: {messageType}): Task<string> = {SpaceUtils.ThreeTabs}web3.Eth.GetContractDeploymentHandler<{messageType}>().SendRequestAsync({messageVariableName}) {SpaceUtils.TwoTabs}"; var sendRequestContract = $@"{SpaceUtils.TwoTabs}static member DeployContractAndGetServiceAsync(web3: Web3, {messageVariableName}: {messageType}, ?cancellationTokenSource : CancellationTokenSource) = async {{ {SpaceUtils.ThreeTabs}let cancellationTokenSourceVal = defaultArg cancellationTokenSource null {SpaceUtils.ThreeTabs}let! receipt = {_serviceModel.GetTypeName()}.DeployContractAndWaitForReceiptAsync(web3, {messageVariableName}, cancellationTokenSourceVal) |> Async.AwaitTask {SpaceUtils.ThreeTabs}return new {_serviceModel.GetTypeName()}(web3, receipt.ContractAddress); {SpaceUtils.ThreeTabs}}}"; return(String.Join(Environment.NewLine, sendRequestReceipt, sendRequest, sendRequestContract)); }
public string GenerateMethods() { var messageType = _contractDeploymentCQSMessageModel.GetTypeName(); var messageVariableName = _contractDeploymentCQSMessageModel.GetVariableName(); var sendRequestReceipt = $@"{SpaceUtils.TwoTabs}Public Shared Function DeployContractAndWaitForReceiptAsync(ByVal web3 As Web3, ByVal {messageVariableName} As {messageType}, ByVal Optional cancellationTokenSource As CancellationTokenSource = Nothing) As Task(Of TransactionReceipt) {SpaceUtils.TwoTabs} {SpaceUtils.ThreeTabs}Return web3.Eth.GetContractDeploymentHandler(Of {messageType})().SendRequestAndWaitForReceiptAsync({messageVariableName}, cancellationTokenSource) {SpaceUtils.TwoTabs} {SpaceUtils.TwoTabs}End Function"; var sendRequest = $@"{SpaceUtils.TwoTabs} Public Shared Function DeployContractAsync(ByVal web3 As Web3, ByVal {messageVariableName} As {messageType}) As Task(Of String) {SpaceUtils.TwoTabs} {SpaceUtils.ThreeTabs}Return web3.Eth.GetContractDeploymentHandler(Of {messageType})().SendRequestAsync({messageVariableName}) {SpaceUtils.TwoTabs} {SpaceUtils.TwoTabs}End Function"; var sendRequestContract = $@"{SpaceUtils.TwoTabs}Public Shared Async Function DeployContractAndGetServiceAsync(ByVal web3 As Web3, ByVal {messageVariableName} As {messageType}, ByVal Optional cancellationTokenSource As CancellationTokenSource = Nothing) As Task(Of {_serviceModel.GetTypeName()}) {SpaceUtils.TwoTabs} {SpaceUtils.ThreeTabs}Dim receipt = Await DeployContractAndWaitForReceiptAsync(web3, {messageVariableName}, cancellationTokenSource) {SpaceUtils.ThreeTabs}Return New {_serviceModel.GetTypeName()}(web3, receipt.ContractAddress) {SpaceUtils.TwoTabs} {SpaceUtils.TwoTabs}End Function"; return(String.Join(Environment.NewLine, sendRequestReceipt, sendRequest, sendRequestContract)); }