コード例 #1
0
        void BackupFailed(string json)
        {
            Debug.Log("In backup failed");
            var ex = KinException.FromNativeErrorJson(json);

            onBackup.FireActionInDict(ex.AccountId, ex, BackupRestoreResult.Failed);
        }
コード例 #2
0
        /// <summary>
        /// attempts to delete the account at index. Throws an exception if it fails.
        /// </summary>
        /// <param name="index"></param>
        public void DeleteAccount(int index = 0)
        {
            var error = NativeBridge.Get().DeleteAccount(_clientId, index);

            if (!string.IsNullOrEmpty(error))
            {
                throw KinException.FromNativeErrorJson(error);
            }
        }
コード例 #3
0
        /// <summary>
        /// adds a new account to the KinClient. Throws an exception if any issues arise while adding it.
        /// </summary>
        /// <returns></returns>
        public KinAccount AddAccount()
        {
            var accountId = Utils.RandomString();
            var error     = NativeBridge.Get().AddAccount(_clientId, accountId);

            if (!string.IsNullOrEmpty(error))
            {
                throw KinException.FromNativeErrorJson(error);
            }
            return(new KinAccount(accountId));
        }
コード例 #4
0
        /// <summary>
        /// imports an account that was exported via the KinAccount.Export method
        /// </summary>
        /// <param name="exportedJson"></param>
        /// <param name="passphrase"></param>
        /// <returns></returns>
        public KinAccount ImportAccount(string exportedJson, string passphrase)
        {
            var accountId = Utils.RandomString();
            var error     = NativeBridge.Get().ImportAccount(_clientId, accountId, exportedJson, passphrase);

            if (!string.IsNullOrEmpty(error))
            {
                throw KinException.FromNativeErrorJson(error);
            }
            return(new KinAccount(accountId));
        }
コード例 #5
0
        /// <summary>
        /// exports an account. The returned JSON can be imported on a different device via KinClient.ImportAccount.
        /// </summary>
        /// <param name="passphrase"></param>
        /// <returns></returns>
        public string Export(string passphrase)
        {
            var json = NativeBridge.Get().Export(_accountId, passphrase);

            var exception = KinException.FromNativeErrorJson(json);

            if (exception != null)
            {
                UnityEngine.Debug.Log(exception);
                throw exception;
            }

            return(json);
        }
コード例 #6
0
        void SendTransactionFailed(string json)
        {
            var ex = KinException.FromNativeErrorJson(json);

            onSendTransaction.FireActionInDict(ex.AccountId, ex, null);
        }
コード例 #7
0
        void GetBalanceFailed(string json)
        {
            var ex = KinException.FromNativeErrorJson(json);

            onGetBalance.FireActionInDict(ex.AccountId, ex, default(decimal));
        }
コード例 #8
0
        void GetStatusFailed(string error)
        {
            var ex = KinException.FromNativeErrorJson(error);

            onGetStatus.FireActionInDict(ex.AccountId, ex, default(AccountStatus));
        }
コード例 #9
0
        void GetMinimumFeeFailed(string error)
        {
            var ex = KinException.FromNativeErrorJson(error);

            onGetMinimumFee.FireActionInDict(ex.AccountId, ex, -1);
        }
コード例 #10
0
        void RestoreFailed(string json)
        {
            var ex = KinException.FromNativeErrorJson(json);

            onRestore.FireActionInDict(ex.AccountId, ex, BackupRestoreResult.Failed, null);
        }