void BackupFailed(string json) { Debug.Log("In backup failed"); var ex = KinException.FromNativeErrorJson(json); onBackup.FireActionInDict(ex.AccountId, ex, BackupRestoreResult.Failed); }
/// <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); } }
/// <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)); }
/// <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)); }
/// <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); }
void SendTransactionFailed(string json) { var ex = KinException.FromNativeErrorJson(json); onSendTransaction.FireActionInDict(ex.AccountId, ex, null); }
void GetBalanceFailed(string json) { var ex = KinException.FromNativeErrorJson(json); onGetBalance.FireActionInDict(ex.AccountId, ex, default(decimal)); }
void GetStatusFailed(string error) { var ex = KinException.FromNativeErrorJson(error); onGetStatus.FireActionInDict(ex.AccountId, ex, default(AccountStatus)); }
void GetMinimumFeeFailed(string error) { var ex = KinException.FromNativeErrorJson(error); onGetMinimumFee.FireActionInDict(ex.AccountId, ex, -1); }
void RestoreFailed(string json) { var ex = KinException.FromNativeErrorJson(json); onRestore.FireActionInDict(ex.AccountId, ex, BackupRestoreResult.Failed, null); }