Beispiel #1
0
    protected IEnumerator SendTransaction()
    {
        var hasResult = false;

        _account.SendTransaction(_transaction, (ex, transactionId) =>
        {
            Assert.IsNotNull(transactionId);
            Assert.IsNull(ex);
            hasResult = true;
        });

        yield return(new WaitUntil(() => hasResult));
    }
    void BuildTransactionCallBack(KinException ex, Transaction transaction)
    {
        //After building, we can store the transaction id to monitor the status in case of downtime (not implemented in this wrapper)
        if (ex == null)
        {
            if (verbose)
            {
                listenerCallback?.Invoke("Sending transaction", "log");
            }
            //We now send a transaction and fees are charged
            kinAccount.SendTransaction(transaction, SendTransactionCallback);

            //OPTIONAL: Your server account can be authorized by the Kin Foundation to whitelist transactions for zero fees
            //Once authorized, disable the above, and enable below to send whitelisted transactions
            //https://github.com/kinecosystem/kin-sdk-unity#transferring-kin-to-another-account-using-whitelist-service
            //StartCoroutine(WhitelistTransaction(transaction, WhitelistTransactionCallback));
        }
        else
        {
            LogError("Build Transaction Failed. " + ex);
        }
    }