示例#1
0
    public IEnumerator TransferEther(string url, string privateKey, string addressTo, string amountText)
    {
        var amount           = System.Decimal.Parse(amountText);
        var ethTransfer      = new EthTransferUnityRequest(url, privateKey);
        var receivingAddress = addressTo;
        var gasPriceGwei     = 2;

        yield return(ethTransfer.TransferEther(receivingAddress, amount, gasPriceGwei));

        if (ethTransfer.Exception != null)
        {
            Debug.Log(ethTransfer.Exception.Message);
            yield break;
        }

        var transactionHash = ethTransfer.Result;

        Debug.Log("Transfer transaction hash:" + transactionHash);

        //create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(url);

        //checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

        Debug.Log("Transaction mined");

        var balanceRequest = new EthGetBalanceUnityRequest(url);

        yield return(balanceRequest.SendRequest(receivingAddress, BlockParameter.CreateLatest()));

        var balanceAddressTo = UnitConversion.Convert.FromWei(balanceRequest.Result.Value);

        Debug.Log("Balance of account:" + balanceAddressTo);
    }
示例#2
0
    public IEnumerator MakePayment(
        string server,
        string fromPrivateKey,
        string fromPublicAddress,
        string toPublicAddress,
        decimal sendAmount,
        int gas
        )
    {
        var ethTransfer = new EthTransferUnityRequest(server, fromPrivateKey, fromPublicAddress);

        yield return(ethTransfer.TransferEther(toPublicAddress, sendAmount, gas));

        if (ethTransfer.Exception != null)
        {
            Debug.Log(ethTransfer.Exception.Message);
            yield break;
        }
        var transactionHash = ethTransfer.Result;

        Debug.Log("Transfer transaction hash:" + transactionHash);
        // create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(server);

        // checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

        Debug.Log("Transaction mined");
        var balanceRequest = new EthGetBalanceUnityRequest(server);

        yield return(balanceRequest.SendRequest(toPublicAddress, BlockParameter.CreateLatest()));

        Debug.Log("Balance of account:" + UnitConversion.Convert.FromWei(balanceRequest.Result.Value));
    }
示例#3
0
    private IEnumerator TransactionPolling(string txHash)
    {
        //create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(Url);

        //checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(txHash, 2));

        Logger("Transaction mined");

        onTransactionDelegate?.Invoke(txHash);
    }
示例#4
0
    public IEnumerator createUsers(string name)
    {
        bool finish = false;
        int  pin    = 4321;

        object[] array = new object[] { name, pin };
        var      wait  = 0;

        yield return(new WaitForSeconds(wait));

        WalletData wd = WalletManager.Instance.GetSelectedWalletData();

        wait = 2;

        if (wd.address != null)
        {
            var transactionInput         = contract.createUserInput(wd.address, wd.privateKey, new HexBigInteger(4712388), name, pin);
            var transactionSignedRequest = new TransactionSignedUnityRequest(WalletManager.Instance.networkUrl, wd.privateKey);
            yield return(transactionSignedRequest.SignAndSendTransaction(transactionInput));

            if (transactionSignedRequest.Exception == null)
            {
                var transactionHash = transactionSignedRequest.Result;
                Debug.Log("Sto creando l'user wait:" + transactionHash);

                //create a poll to get the receipt when mined
                var transactionReceiptPolling = new TransactionReceiptPollingRequest(WalletManager.Instance.networkUrl);
                //checking every 2 seconds for the receipt
                yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

                if (transactionReceiptPolling.Exception == null)
                {
                    Debug.Log("Good Mined");
                }
                else
                {
                    Debug.Log("Bad Mined");
                }
            }
            else
            {
                Debug.Log("error");
                Debug.Log(transactionSignedRequest.Exception.ToString());
            }
        }
    }
示例#5
0
    public IEnumerator CloseRooms(int id)
    {
        var wait = 0;

        yield return(new WaitForSeconds(wait));

        wait = 2;
        WalletData wd = WalletManager.Instance.GetSelectedWalletData();

        if (wd.address != null)
        {
            var transactionInput = contract.closeRoomInput(wd.address, wd.privateKey, new HexBigInteger(3000000), id);

            var transactionSignedRequest = new TransactionSignedUnityRequest(WalletManager.Instance.networkUrl, wd.privateKey);
            yield return(transactionSignedRequest.SignAndSendTransaction(transactionInput));

            Debug.Log(wd.address);
            if (transactionSignedRequest.Exception == null)
            {
                var transactionHash = transactionSignedRequest.Result;

                Debug.Log("Closing Room:" + transactionHash);

                //create a poll to get the receipt when mined
                var transactionReceiptPolling = new TransactionReceiptPollingRequest(WalletManager.Instance.networkUrl);
                //checking every 2 seconds for the receipt
                yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

                if (transactionReceiptPolling.Exception == null)
                {
                    WalletManager.Instance.RefreshTopPanelView();
                    Debug.Log("Good Mined");
                }
                else
                {
                    Debug.Log("Bad Mined");
                }
            }
            else
            {
                Debug.Log("error");
                Debug.Log(transactionSignedRequest.Exception.ToString());
            }
        }
    }
示例#6
0
        public static IEnumerator Transaction(string url, string privateKey, string account, int value, string contractAddress, string targetAdress, bool toScene)
        {
            Debug.Log($"target : {targetAdress}");
            var transactionTransferRequest = new TransactionSignedUnityRequest(url, privateKey);
            var newAddress = targetAdress;

            Debug.Log(value);
            var transactionMessage = new TransferFunction
            {
                FromAddress = account,
                To          = newAddress,
                Value       = value,
            };

            yield return(transactionTransferRequest.SignAndSendTransaction(transactionMessage, contractAddress));

            var transactionTransferHash = transactionTransferRequest.Result;

            Debug.Log(transactionTransferHash);

            var transactionReceiptPolling = new TransactionReceiptPollingRequest(url);

            yield return(transactionReceiptPolling.PollForReceipt(transactionTransferHash, 2));

            var transferReceipt = transactionReceiptPolling.Result;

            var transferEvent = transferReceipt.DecodeAllEvents <TransferEventDto>();

            Debug.Log("Transferd amount from event: " + transferEvent[0].Event.Value);

            var getLogsRequest = new EthGetLogsUnityRequest(url);
            var eventTransfer  = TransferEventDto.GetEventABI();

            yield return(getLogsRequest.SendRequest(eventTransfer.CreateFilterInput(contractAddress, account)));

            var eventDecoded = getLogsRequest.Result.DecodeAllEvents <TransferEventDto>();

            Debug.Log("Transferd amount from get logs event: " + eventDecoded[0].Event.Value);

            if (toScene)
            {
                SceneManager.LoadScene("Start", LoadSceneMode.Single);
            }
        }
示例#7
0
                public IEnumerator Exec3(double gas, double value_wei, params object[] args)
                {
                    Debug.Log("gas/value = " + gas + "|" + value_wei);
                    yield return(req_.SignAndSendTransaction(
                                     Function.CreateTransactionInput(RPCMgr.instance.Account.address_,
                                                                     new HexBigInteger(new BigInteger(gas)),
                                                                     new HexBigInteger(new BigInteger(value_wei)), args)));

                    var receipt_waiter = new TransactionReceiptPollingRequest(RPCMgr.instance.Account.chain_url_);

                    yield return(receipt_waiter.PollForReceipt(req_.Result, 60));

                    if (receipt_waiter.Exception != null)
                    {
                        Error = receipt_waiter.Exception;
                        yield break;
                    }
                    Result = receipt_waiter.Result;
                }
示例#8
0
    public IEnumerator createRooms(int maxPlayers, int timer, int prn, float bet)
    {
        BigInteger _bet = UnitConversion.Convert.ToWei(bet);
        var        wait = 0;

        yield return(new WaitForSeconds(wait));

        wait = 2;
        WalletData wd = WalletManager.Instance.GetSelectedWalletData();

        if (wd.address != null)
        {
            var transactionInput         = contract.createRoomInput(wd.address, wd.privateKey, maxPlayers, timer, prn, new HexBigInteger(3000000), new HexBigInteger(_bet));
            var transactionSignedRequest = new TransactionSignedUnityRequest(WalletManager.Instance.networkUrl, wd.privateKey);
            yield return(transactionSignedRequest.SignAndSendTransaction(transactionInput));

            if (transactionSignedRequest.Exception == null)
            {
                var transactionHash = transactionSignedRequest.Result;

                Debug.Log("Sto creando la room:" + transactionHash);

                //create a poll to get the receipt when mined
                var transactionReceiptPolling = new TransactionReceiptPollingRequest(WalletManager.Instance.networkUrl);
                //checking every 2 seconds for the receipt
                yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

                if (transactionReceiptPolling.Exception == null)
                {
                    Debug.Log("Good Mined");
                }
                else
                {
                    Debug.Log("Bad Mined");
                }
            }
            else
            {
                Debug.Log("error");
                Debug.Log(transactionSignedRequest.Exception.ToString());
            }
        }
    }
示例#9
0
    //Sample of new features / requests
    public IEnumerator TransferEther(decimal Amount, string AddressTo)
    {
        //Url = InputUrl.text;
        //PrivateKey = InputPrivateKey.text;
        //AddressTo = InputAddressTo.text;
        //Amount = System.Decimal.Parse(InputAmount.text);


        //initialising the transaction request sender
        var ethTransfer = new EthTransferUnityRequest(Url, PrivateKey);

        var receivingAddress = AddressTo;

        yield return(ethTransfer.TransferEther(receivingAddress, Amount, GasPriceGwei));

        if (ethTransfer.Exception != null)
        {
            Debug.Log(ethTransfer.Exception.Message);
            yield break;
        }

        TransactionHash = ethTransfer.Result;
        //ResultTxnHash.text = TransactionHash;
        Debug.Log("Transfer transaction hash:" + TransactionHash);

        //create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(Url);

        //checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(TransactionHash, 2));

        Debug.Log("Transaction mined");

        var balanceRequest = new EthGetBalanceUnityRequest(Url);

        yield return(balanceRequest.SendRequest(receivingAddress, BlockParameter.CreateLatest()));

        BalanceAddressTo = UnitConversion.Convert.FromWei(balanceRequest.Result.Value);
        //ResultBalanceAddressTo.text = BalanceAddressTo.ToString();

        Debug.Log("Balance of account:" + BalanceAddressTo);
    }
示例#10
0
    public IEnumerator Mint()
    {
        hideTokens();
        feedbackLabel.enabled = true;

        feedbackLabel.text = "Waiting for approval";

#if UNITY_EDITOR
        var networkName     = "ganache";
        var contractAddress = "0x345ca3e014aaf5dca488057592ee47305d9b3e10";
#else
        var networkName     = "rinkeby";
        var contractAddress = "0x8f83aadb8098a1b4509aaba77ba9d2cb1ac970ba";
#endif
        var nft = new BitskiNFT(contractAddress, networkName);

        yield return(nft.Mint(getRandom(256)));

        if (nft.Exception != null)
        {
            Debug.Log("Got an error: " + nft.Exception.Message);
            feedbackLabel.text = nft.Exception.Message;
            yield break;
        }

        feedbackLabel.text = "Waiting for transaction receipt";

        var pollingRequest = new TransactionReceiptPollingRequest(networkName);
        yield return(pollingRequest.PollForReceipt(nft.mintReceipt, 1));

        if (pollingRequest.Exception != null)
        {
            Debug.Log("Got an error: " + pollingRequest.Exception.Message);
            feedbackLabel.text = pollingRequest.Exception.Message;
            yield break;
        }

        yield return(GetAccountTokens());
    }
//Sample of new features / requests
    public IEnumerator GetArrayUInt256()
    {
        var url        = "http://localhost:8545";
        var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
        var account    = "0x12890d2cce102216644c59daE5baed380d84830c";
        //initialising the transaction request sender
        var transactionRequest = new TransactionSignedUnityRequest(url, privateKey, account);

        //deploy the contract and True indicates we want to estimate the gas
        yield return(transactionRequest.SignAndSendDeploymentContractTransaction <ArrayUint256DynamicDeployment>());

        if (transactionRequest.Exception != null)
        {
            Debug.Log(transactionRequest.Exception.Message);
            yield break;
        }

        var transactionHash = transactionRequest.Result;

        //create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(url);

        //checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

        var deploymentReceipt = transactionReceiptPolling.Result;

        //Query request using our acccount and the contracts address (no parameters needed and default values)
        var queryRequest = new QueryUnityRequest <GiveMeTheArrayFunction, GiveMeTheArrayOutputDTO>(url, account);

        yield return(queryRequest.Query(deploymentReceipt.ContractAddress));

        //Getting the dto response already decoded
        var dtoResult = queryRequest.Result;

        Debug.Log(dtoResult.Result [0]);
        Debug.Log(dtoResult.Result [1]);
    }
    //Sample of new features / requests
    public IEnumerator TransferEther()
    {
        var url        = "http://localhost:8545";
        var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
        var account    = "0x12890d2cce102216644c59daE5baed380d84830c";
        //initialising the transaction request sender
        var ethTransfer = new EthTransferUnityRequest(url, privateKey, account);

        var receivingAddress = "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe";

        yield return(ethTransfer.TransferEther("0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe", 1.1m, 2));

        if (ethTransfer.Exception != null)
        {
            Debug.Log(ethTransfer.Exception.Message);
            yield break;
        }

        var transactionHash = ethTransfer.Result;

        Debug.Log("Transfer transaction hash:" + transactionHash);

        //create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(url);

        //checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

        Debug.Log("Transaction mined");

        var balanceRequest = new EthGetBalanceUnityRequest(url);

        yield return(balanceRequest.SendRequest(receivingAddress, BlockParameter.CreateLatest()));


        Debug.Log("Balance of account:" + UnitConversion.Convert.FromWei(balanceRequest.Result.Value));
    }
示例#13
0
    //Sample of new features / requests
    public IEnumerator TransferEther()
    {
        var url        = "http://localhost:8545";
        var privateKey = "0xa5ca770c997e53e182c5015bcf1b58ba5cefe358bf217800d8ec7d64ca919edd";
        var account    = "0x47E95DCdb798Bc315198138bC930758E6f399f81";
        //initialising the transaction request sender
        var ethTransfer = new EthTransferUnityRequest(url, privateKey, account);

        var receivingAddress = "0x09f8F8c219D94A5db8Ee466dC072748603A7A0D9";

        yield return(ethTransfer.TransferEther("0x09f8F8c219D94A5db8Ee466dC072748603A7A0D9", 1.1m, 2));

        if (ethTransfer.Exception != null)
        {
            Debug.Log(ethTransfer.Exception.Message);
            yield break;
        }

        var transactionHash = ethTransfer.Result;

        Debug.Log("Transfer transaction hash:" + transactionHash);

        //create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(url);

        //checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

        Debug.Log("Transaction mined");

        var balanceRequest = new EthGetBalanceUnityRequest(url);

        yield return(balanceRequest.SendRequest(receivingAddress, BlockParameter.CreateLatest()));


        Debug.Log("Balance of account:" + UnitConversion.Convert.FromWei(balanceRequest.Result.Value));
    }
示例#14
0
        public static IEnumerator GetTransactionReceipt(TransactionSignedUnityRequest transactionRequest, string eventName, Async thread = null)
        {
            if (transactionRequest.Exception != null)
            {
                Debug.Log(transactionRequest.Exception.Message);
                yield break;
            }

            var transactionHash = transactionRequest.Result;

            Debug.Log(eventName + " transaction hash: " + transactionHash);

            var transactionReceiptPolling = new TransactionReceiptPollingRequest(NetworkSettings.infuraProvider);

            yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

            yield return(transactionReceiptPolling.Result);

            if (thread != null)
            {
                string suffix = transactionReceiptPolling.Result.Status.Value == new BigInteger(1) ? "-success" : "-failure";
                thread.pushEvent(eventName + suffix, transactionReceiptPolling.Result);
            }
        }
示例#15
0
        //Sample of new features / requests
        public IEnumerator DeployAndTransferToken()
        {
            var url        = "https://ropsten.infura.io/v3/4394d608f8694f62ac54a673f7940e11";
            var privateKey = "622bdcf3915f11859a8657af0aa0dea840fbbf52c9fb9607adfa156f18f734e1";
            var account    = "0x88144534Bd291b9c3D7BDB9A92D7270566f5622d";
            //initialising the transaction request sender

            var transactionRequest = new TransactionSignedUnityRequest(url, privateKey);

            var deployContract = new Eip20Deployment()
            {
                InitialAmount = 100000,
                FromAddress   = account,
                TokenName     = "GameBank",

                TokenSymbol = "GB"
            };

            //deploy the contract
            yield return(transactionRequest.SignAndSendDeploymentContractTransaction <Eip20DeploymentBase>(deployContract));

            if (transactionRequest.Exception != null)
            {
                Debug.Log(transactionRequest.Exception.Message);
                yield break;
            }

            var transactionHash = transactionRequest.Result;

            Debug.Log("Deployment transaction hash:" + transactionHash);

            //create a poll to get the receipt when mined
            var transactionReceiptPolling = new TransactionReceiptPollingRequest(url);

            //checking every 2 seconds for the receipt
            yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

            var deploymentReceipt = transactionReceiptPolling.Result;

            Debug.Log("Deployment contract address:" + deploymentReceipt.ContractAddress);

            //Query request using our acccount and the contracts address (no parameters needed and default values)
            var queryRequest = new QueryUnityRequest <BalanceOfFunction, BalanceOfFunctionOutput>(url, account);

            yield return(queryRequest.Query(new BalanceOfFunction()
            {
                Owner = account
            }, deploymentReceipt.ContractAddress));

            //Getting the dto response already decoded
            var dtoResult = queryRequest.Result;

            Debug.Log(dtoResult.Balance);

            /*var transactionTransferRequest = new TransactionSignedUnityRequest(url, privateKey);
             * var newAddress = "0x88144534Bd291b9c3D7BDB9A92D7270566f5622d";
             *
             *
             * var transactionMessage = new TransferFunction
             * {
             *  FromAddress = account,
             *  To = newAddress,
             *  Value = 100000,
             * };
             *
             * yield return transactionTransferRequest.SignAndSendTransaction(transactionMessage, deploymentReceipt.ContractAddress);
             * var transactionTransferHash = transactionTransferRequest.Result;
             *
             * Debug.Log("Transfer txn hash:" + transactionHash);
             *
             * transactionReceiptPolling = new TransactionReceiptPollingRequest(url);
             * yield return transactionReceiptPolling.PollForReceipt(transactionTransferHash, 2);
             * var transferReceipt = transactionReceiptPolling.Result;
             *
             * var transferEvent = transferReceipt.DecodeAllEvents<TransferEventDto>();
             * Debug.Log("Transferd amount from event: " + transferEvent[0].Event.Value);
             *
             * var getLogsRequest = new EthGetLogsUnityRequest(url);
             * var eventTransfer = TransferEventDto.GetEventABI();
             * yield return getLogsRequest.SendRequest(eventTransfer.CreateFilterInput(deploymentReceipt.ContractAddress, account));
             *
             * var eventDecoded = getLogsRequest.Result.DecodeAllEvents<TransferEventDto>();
             * Debug.Log("Transferd amount from get logs event: " + eventDecoded[0].Event.Value);*/
        }
示例#16
0
    //Sample of new features / requests
    public IEnumerator DeployAndTransferToken()
    {
        var url        = "http://localhost:8545";
        var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
        var account    = "0x12890d2cce102216644c59daE5baed380d84830c";
        //initialising the transaction request sender
        var transactionRequest = new TransactionSignedUnityRequest(url, privateKey);


        var deployContract = new EIP20Deployment()
        {
            InitialAmount = 10000,
            FromAddress   = account,
            TokenName     = "TST",
            TokenSymbol   = "TST"
        };

        //deploy the contract and True indicates we want to estimate the gas
        yield return(transactionRequest.SignAndSendDeploymentContractTransaction <EIP20DeploymentBase>(deployContract));

        if (transactionRequest.Exception != null)
        {
            Debug.Log(transactionRequest.Exception.Message);
            yield break;
        }

        var transactionHash = transactionRequest.Result;

        Debug.Log("Deployment transaction hash:" + transactionHash);

        //create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(url);

        //checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

        var deploymentReceipt = transactionReceiptPolling.Result;

        Debug.Log("Deployment contract address:" + deploymentReceipt.ContractAddress);

        //Query request using our acccount and the contracts address (no parameters needed and default values)
        var queryRequest = new QueryUnityRequest <BalanceOfFunction, BalanceOfFunctionOutput>(url, account);

        yield return(queryRequest.Query(new BalanceOfFunction()
        {
            Owner = account
        }, deploymentReceipt.ContractAddress));

        //Getting the dto response already decoded
        var dtoResult = queryRequest.Result;

        Debug.Log(dtoResult.Balance);


        var transactionTransferRequest = new TransactionSignedUnityRequest(url, privateKey);

        var newAddress = "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe";

        var transactionMessage = new TransferFunction
        {
            FromAddress = account,
            To          = newAddress,
            Value       = 1000,
        };

        yield return(transactionTransferRequest.SignAndSendTransaction(transactionMessage, deploymentReceipt.ContractAddress));

        var transactionTransferHash = transactionTransferRequest.Result;

        Debug.Log("Transfer txn hash:" + transactionHash);

        transactionReceiptPolling = new TransactionReceiptPollingRequest(url);
        yield return(transactionReceiptPolling.PollForReceipt(transactionTransferHash, 2));

        var transferReceipt = transactionReceiptPolling.Result;

        var transferEvent = transferReceipt.DecodeAllEvents <TransferEventDTO>();

        Debug.Log("Transferd amount from event: " + transferEvent[0].Event.Value);

        var getLogsRequest = new EthGetLogsUnityRequest(url);

        var eventTransfer = TransferEventDTO.GetEventABI();

        yield return(getLogsRequest.SendRequest(eventTransfer.CreateFilterInput(deploymentReceipt.ContractAddress, account)));

        var eventDecoded = getLogsRequest.Result.DecodeAllEvents <TransferEventDTO>();

        Debug.Log("Transferd amount from get logs event: " + eventDecoded[0].Event.Value);
    }
示例#17
0
    //Sample of new features / requests
    public IEnumerator DeployAndTransferToken()
    {
        var url        = "http://localhost:8545";
        var privateKey = "0xa5ca770c997e53e182c5015bcf1b58ba5cefe358bf217800d8ec7d64ca919edd";
        var account    = "0x47E95DCdb798Bc315198138bC930758E6f399f81";
        //initialising the transaction request sender
        var transactionRequest = new TransactionSignedUnityRequest(url, privateKey, account);


        var deployContract = new EIP20Deployment()
        {
            InitialAmount = 10000,
            FromAddress   = account,
            TokenName     = "TST",
            TokenSymbol   = "TST"
        };

        //deploy the contract and True indicates we want to estimate the gas
        yield return(transactionRequest.SignAndSendDeploymentContractTransaction <EIP20DeploymentBase>(deployContract));

        if (transactionRequest.Exception != null)
        {
            Debug.Log(transactionRequest.Exception.Message);
            yield break;
        }

        var transactionHash = transactionRequest.Result;

        Debug.Log("Deployment transaction hash:" + transactionHash);

        //create a poll to get the receipt when mined
        var transactionReceiptPolling = new TransactionReceiptPollingRequest(url);

        //checking every 2 seconds for the receipt
        yield return(transactionReceiptPolling.PollForReceipt(transactionHash, 2));

        var deploymentReceipt = transactionReceiptPolling.Result;

        Debug.Log("Deployment contract address:" + deploymentReceipt.ContractAddress);

        //Query request using our acccount and the contracts address (no parameters needed and default values)
        var queryRequest = new QueryUnityRequest <BalanceOfFunction, BalanceOfFunctionOutput>(url, account);

        yield return(queryRequest.Query(new BalanceOfFunction()
        {
            Owner = account
        }, deploymentReceipt.ContractAddress));

        //Getting the dto response already decoded
        var dtoResult = queryRequest.Result;

        Debug.Log(dtoResult.Balance);


        var transactionTransferRequest = new TransactionSignedUnityRequest(url, privateKey, account);

        var newAddress = "0x4e70A9177Aff5077217f069E582992f7F9bec945";

        var transactionMessage = new TransferFunction
        {
            FromAddress = account,
            To          = newAddress,
            Value       = 1000,
        };

        yield return(transactionTransferRequest.SignAndSendTransaction(transactionMessage, deploymentReceipt.ContractAddress));

        var transactionTransferHash = transactionTransferRequest.Result;

        Debug.Log("Transfer txn hash:" + transactionHash);

        transactionReceiptPolling = new TransactionReceiptPollingRequest(url);
        yield return(transactionReceiptPolling.PollForReceipt(transactionTransferHash, 2));

        var transferReceipt = transactionReceiptPolling.Result;

        var transferEvent = transferReceipt.DecodeAllEvents <TransferEventDTO>();

        Debug.Log("Transferd amount from event: " + transferEvent[0].Event.Value);

        var getLogsRequest = new EthGetLogsUnityRequest(url);

        var eventTransfer = TransferEventDTO.GetEventABI();

        yield return(getLogsRequest.SendRequest(eventTransfer.CreateFilterInput(deploymentReceipt.ContractAddress, account)));

        var eventDecoded = getLogsRequest.Result.DecodeAllEvents <TransferEventDTO>();

        Debug.Log("Transferd amount from get logs event: " + eventDecoded[0].Event.Value);
    }