Exemplo n.º 1
0
    KinAccount FetchAccount()
    {
        //https://github.com/kinecosystem/kin-sdk-unity#creating-and-retrieving-a-kin-account
        KinAccount ka = null;

        try
        {
            if (!kinClient.HasAccount()) //Check to see if user has a local account created
            {
                //If not, create one locally and return its reference
                ka = kinClient.AddAccount();
            }
            else
            {
                //If already created, just return its reference
                ka = kinClient.GetAccount(0);
            }
        }

        catch (KinException e)
        {
            LogError("Error fetching account: " + e);
        }
        return(ka);
    }
Exemplo n.º 2
0
        public void TestGetPublicAddress()
        {
            KeyPair    keyPair    = KeyPair.Random();
            KinAccount kinAccount = kinClient.GetAccount(keyPair);

            Assert.AreEqual(kinAccount.PublicAddress, keyPair.Address);
        }
Exemplo n.º 3
0
        public void TestGetAccount()
        {
            KeyPair   keyPair   = KeyPair.Random();
            KinClient kinClient = new KinClient(Kin.Sdk.Environment.Test, keystoreProvider);

            KinAccount kinAccount = kinClient.GetAccount(keyPair);

            Assert.AreEqual(kinAccount.keyPair, keyPair);
        }
Exemplo n.º 4
0
 void Start()
 {
     //https://github.com/kinecosystem/kin-sdk-unity#get-started
     kinClient  = new KinClient(environment, appId); //Declare a new client
     kinAccount = FetchAccount();                    //Return the user's *local* account. If doesn't exist, create it first.
 }
Exemplo n.º 5
0
 protected void ImportActivatedAccount()
 {
     _account = _client.ImportAccount(_exportedAccountJson, _exportedAccountPassphrase);
 }
Exemplo n.º 6
0
 protected void AddAccount()
 {
     _account = _client.AddAccount();
 }
Exemplo n.º 7
0
 void OnDestroy()
 {
     _client.ClearAllAccounts();
     _account = null;
 }