/// <summary> /// Generates an address and gets transactions. /// </summary> /// <param name="seed">The seed from which an address should be generated</param> /// <param name="index">The index of the address</param> /// <param name="cancellationToken">The CancellationToken</param> /// <returns></returns> private async Task <AddressItem> GenerateAddressAsync(string seed, int index, CancellationToken cancellationToken) { await TaskIota.Yield().ConfigureAwait(false); // need yield because new address generation is very costly var addressItem = IotaUtils.GenerateAddress(seed, index, AddressSecurity, cancellationToken); cancellationToken.ThrowIfCancellationRequested(); await RenewTransactions(addressItem); return(addressItem); }
private async Task <AddressItem> NewAddressAsync(string seed, int index, CancellationToken cancellationToken) { await TaskIota.Yield().ConfigureAwait(false); // need yield because new address generation is very costly int[] key = new Signing(new Curl()).Key(Converter.ToTrits(seed), index, 2); string address = IotaApiUtils.NewAddress(key, false, new Curl(), cancellationToken); var addressItem = new AddressItem() { Address = address, PrivateKey = key, Index = index, Balance = 0 }; await RenewTransactions(addressItem); return(addressItem); }