Example #1
0
        public async Task <TransactionReceipt> Handle(CreateTemplateRequest aCreateTemplateRequest, CancellationToken aCancellationToken)
        {
            IContractTransactionHandler <CreateTemplateRequest> contractTransactionHandler =
                Web3ContractManager.Web3.Eth.GetContractTransactionHandler <CreateTemplateRequest>();

            HexBigInteger gasEstimate =
                await contractTransactionHandler.EstimateGasAsync(EthereumSettings.NftCreatorAddress, aCreateTemplateRequest);

            aCreateTemplateRequest.Gas = gasEstimate;
            return(await contractTransactionHandler
                   .SendRequestAndWaitForReceiptAsync(EthereumSettings.NftCreatorAddress, aCreateTemplateRequest));
        }
Example #2
0
        public async Task <MintNftResponse> Handle(MintNftRequest aMintNftRequest, CancellationToken aCancellationToken)
        {
            IContractTransactionHandler <MintNftRequest> contractTransactionHandler =
                Web3ContractManager.Web3.Eth.GetContractTransactionHandler <MintNftRequest>();

            HexBigInteger gasEstimate =
                await contractTransactionHandler.EstimateGasAsync(EthereumSettings.NftCreatorAddress, aMintNftRequest);

            aMintNftRequest.Gas = gasEstimate;
            TransactionReceipt transactionReceipt = await contractTransactionHandler
                                                    .SendRequestAndWaitForReceiptAsync(EthereumSettings.NftCreatorAddress, aMintNftRequest);

            List <EventLog <MintNftEventDto> > mintNftEventDtos = transactionReceipt.DecodeAllEvents <MintNftEventDto>();

            return(new MintNftResponse
            {
                MintNftEventDto = mintNftEventDtos.FirstOrDefault()?.Event,
                TransactionReceipt = transactionReceipt
            });
        }