Exemple #1
0
        public Supervisor(string assetId, string buyerAddress = "",
                          string ownerAddress = "")
        {
            requestObject = new SaleDeedRegistryRequest
            {
                GasPrice       = gasPrice,
                GasLimit       = gasLimit,
                Amount         = amount,
                Sender         = sender,
                BuyerAddress   = buyer,
                FeeAmount      = fee,
                WalletName     = walletName,
                WalletPassword = walletPassword,
                OwnerAddress   = propertyOwner,
                AssetId        = assetId
            };

            // Override if we have these values

            if (!string.IsNullOrEmpty(buyerAddress))
            {
                requestObject.BuyerAddress = buyerAddress;
            }

            if (!string.IsNullOrEmpty(ownerAddress))
            {
                requestObject.OwnerAddress = ownerAddress;
            }

            saleRegistryFacade = new SaleRegistryFacade(smartContractUrl, contractAddress);
        }
        /// <summary>
        /// Pay the Application Fee Transfer Fee
        /// </summary>
        /// <returns>ReceiptResponse</returns>
        public async Task <ReceiptResponse> PayTransferFee(string payee,
                                                           string assetId, int applicationFee = 0)
        {
            SaleDeedTransferFeeRequest transferFeeObject = new SaleDeedTransferFeeRequest
            {
                AssetId        = assetId,
                GasPrice       = ConfigHelper.GasPrice,
                GasLimit       = ConfigHelper.GasLimit,
                Amount         = ConfigHelper.Amount,
                Sender         = ConfigHelper.GetSenderAddress,
                BuyerAddress   = ConfigHelper.GetBuyerAddress,
                FeeAmount      = ConfigHelper.GasFee,
                WalletName     = ConfigHelper.GetWalletName,
                WalletPassword = ConfigHelper.GetWalletPassword,
                PayeeAddress   = payee,
                Fees           = applicationFee > 0 ? applicationFee : ConfigHelper.ApplicationFee
            };

            if (!string.IsNullOrEmpty(ownerAddress))
            {
                transferFeeObject.OwnerAddress = ownerAddress;
            }

            if (!string.IsNullOrEmpty(buyerAddress))
            {
                transferFeeObject.BuyerAddress = buyerAddress;
            }

            ReceiptResponse    receiptResponse    = null;
            SaleRegistryFacade saleRegistryFacade = new SaleRegistryFacade(ConfigHelper.GetSmartContractBaseUrl, ConfigHelper.GetContractAddress);

            System.Console.WriteLine("Trying to execute the SaleDeed -> PayApplicationTransferFee Request");

            var transferFeeResponse = await saleRegistryFacade.PayApplicationTransferFee(transferFeeObject);

            System.Console.WriteLine("Completed executing SaleDeed -> PayApplicationTransferFee Request");

            var commandResponse = JsonConvert.DeserializeObject <CommandResponse>(transferFeeResponse.Content.ReadAsStringAsync().Result);

            if (commandResponse.success)
            {
                receiptResponse = await saleRegistryFacade.TryReceiptResponse(commandResponse.transactionId);

                if (receiptResponse != null && receiptResponse.success)
                {
                    Dump(receiptResponse);
                }
                else
                {
                    System.Console.WriteLine("PayTransferFee -> Receipt Response Error");
                    Dump(receiptResponse);
                }
            }

            return(receiptResponse);
        }
Exemple #3
0
        /// <summary>
        /// Use this constructor for performing operations like
        /// Get Application State.
        /// </summary>
        /// <param name="assetId">AssetId</param>
        public Supervisor(string assetId)
        {
            requestObject = new SaleDeedRegistryRequest
            {
                GasPrice       = gasPrice,
                GasLimit       = gasLimit,
                Amount         = amount,
                Sender         = sender,
                BuyerAddress   = buyer,
                FeeAmount      = fee,
                WalletName     = walletName,
                WalletPassword = walletPassword,
                OwnerAddress   = propertyOwner,
                AssetId        = assetId
            };

            saleRegistryFacade = new SaleRegistryFacade(smartContractUrl,
                                                        contractAddress);
        }
        public async Task <ReceiptResponse> Execute(SaleDeedRegistryBaseRequest requestObject)
        {
            try
            {
                SaleRegistryFacade saleRegistryFacade = new SaleRegistryFacade(smartContractUrl, smartContractAddress);
                var response = saleRegistryFacade.CompleteReview((SaleDeedRegistryRequest)requestObject).Result;
                if (response.IsSuccessStatusCode)
                {
                    string json = await response.Content.ReadAsStringAsync();

                    var commandResponse = JsonConvert.DeserializeObject <CommandResponse>(json);
                    return(await TryGetReceiptResponse(commandResponse.transactionId));
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(null);
        }
 public TransferOwnershipCommand(string contractUrl, string contractAddress)
 {
     smartContractUrl     = contractUrl;
     smartContractAddress = contractAddress;
     saleRegistryFacade   = new SaleRegistryFacade(smartContractUrl, smartContractAddress);
 }
 public StartReviewCommand(string contractUrl, string contractAddress)
 {
     smartContractUrl     = contractUrl;
     smartContractAddress = contractAddress;
     saleRegistryFacade   = new SaleRegistryFacade(smartContractUrl, smartContractAddress);
 }
 public InitApplicationCommand(string contractUrl, string contractAddress)
 {
     smartContractUrl     = contractUrl;
     smartContractAddress = contractAddress;
     saleRegistryFacade   = new SaleRegistryFacade(smartContractUrl, smartContractAddress);
 }