コード例 #1
0
        public async Task <Coin> ReceiveUTXO(Money value, BTCPayNetwork network)
        {
            var cashCow      = parent.ExplorerNode;
            var btcPayWallet = parent.PayTester.GetService <BTCPayWalletProvider>().GetWallet(network);
            var address      = (await btcPayWallet.ReserveAddressAsync(this.DerivationScheme)).Address;
            await parent.WaitForEvent <NewOnChainTransactionEvent>(async() =>
            {
                await cashCow.SendToAddressAsync(address, value);
            });

            int i = 0;

            while (i < 30)
            {
                var result = (await btcPayWallet.GetUnspentCoins(DerivationScheme))
                             .FirstOrDefault(c => c.ScriptPubKey == address.ScriptPubKey)?.Coin;
                if (result != null)
                {
                    return(result);
                }

                await Task.Delay(1000);

                i++;
            }
            Assert.False(true);
            return(null);
        }