public SendCreateContractResult SendCreateContractTransaction(Base58Address from, byte[] contractCode, double amount,
                                                                      object[] parameters = null, ulong gasLimit = 50000, ulong gasPrice = SmartContractMempoolValidator.MinGasPrice,
                                                                      double feeAmount    = 0.01)
        {
            if (parameters == null)
            {
                parameters = new object[0];
            }

            string[] stringParameters = parameters.Select(this.GetSerializedStringForObject).ToArray();
            BuildCreateContractTransactionResponse response = this.FirstNode.SendCreateContractTransaction(contractCode, amount, stringParameters, gasLimit, gasPrice, feeAmount, from);

            if (response.Success)
            {
                WaitForMempoolCountOnAllNodes(1);
            }

            return(new SendCreateContractResult
            {
                Fee = response.Fee,
                Hex = response.Hex,
                Message = response.Message,
                NewContractAddress = new Base58Address(response.NewContractAddress),
                Success = response.Success,
                TransactionId = response.TransactionId
            });
        }
        public ulong GetBalanceInStratoshis(Base58Address address)
        {
            // In case it's a contract address
            ulong contractBalance = this.FirstNode.GetContractBalance(address);

            if (contractBalance > 0)
            {
                return(contractBalance);
            }

            return(this.FirstNode.GetWalletAddressBalance(address));
        }
        public ILocalExecutionResult CallContractMethodLocally(Base58Address from, string methodName, Base58Address contractAddress,
                                                               double amount, object[] parameters = null, ulong gasLimit = 50000,
                                                               ulong gasPrice = SmartContractMempoolValidator.MinGasPrice, double feeAmount = 0.01)
        {
            if (parameters == null)
            {
                parameters = new object[0];
            }

            string[] stringParameters = parameters.Select(this.GetSerializedStringForObject).ToArray();
            return(this.FirstNode.CallContractMethodLocally(methodName, contractAddress, amount, stringParameters, gasLimit, gasPrice, from));
        }
 public byte[] GetCode(Base58Address contractAddress)
 {
     return(this.FirstNode.GetCode(contractAddress.Value));
 }