Example #1
0
        internal static async Task <Account> CreateAsync(FlatClient client, BaseKeyPair keypair, CancellationToken token = default(CancellationToken))
        {
            Account fac = new Account();

            Generated.Models.Account ac = null;
            try
            {
                ac = await client.GetAccountAsync(keypair.PublicKey, token).ConfigureAwait(false);
            }
            catch (ApiException <Error> e)
            {
                if (!e.Result.Reason.ToLowerInvariant().Contains("not found"))
                {
                    throw;
                }
            }

            fac.Nonce   = ac?.Nonce ?? 0;
            fac.Balance = ac?.Balance ?? 0;
            fac.KeyPair = keypair;
            fac.Client  = client;
            return(fac);
        }
Example #2
0
 public static Account GetAccount(this FlatClient client, string base58PublicKey, ulong height) => client.GetAccountAsync(base58PublicKey, height).RunAndUnwrap();
Example #3
0
 public static Account GetAccount(this FlatClient client, string hash, string base58PublicKey) => client.GetAccountAsync(base58PublicKey, hash).RunAndUnwrap();