public virtual IBitcoinBasedTransaction CreateSwapRefundTx(
            IEnumerable <ITxOutput> unspentOutputs,
            string destinationAddress,
            string changeAddress,
            long amount,
            long fee,
            DateTimeOffset lockTime)
        {
            var coins = unspentOutputs
                        .Cast <BitcoinBasedTxOutput>()
                        .Select(o => o.Coin);

            var destination = BitcoinAddress.Create(destinationAddress, Network)
                              .ScriptPubKey;

            var change = BitcoinAddress.Create(changeAddress, Network)
                         .ScriptPubKey;

            return(BitcoinBasedTransaction.CreateTransaction(
                       currency: this,
                       coins: coins,
                       destination: destination,
                       change: change,
                       amount: amount,
                       fee: fee,
                       lockTime: lockTime));
        }
        public virtual IBitcoinBasedTransaction CreateP2PkhSwapPaymentTx(
            IEnumerable <ITxOutput> unspentOutputs,
            byte[] aliceRefundPubKey,
            byte[] bobRefundPubKey,
            string bobAddress,
            byte[] secretHash,
            long amount,
            long fee)
        {
            var coins = unspentOutputs
                        .Cast <BitcoinBasedTxOutput>()
                        .Select(o => o.Coin);

            var alicePubKey = new PubKey(aliceRefundPubKey);

            var swap = BitcoinBasedSwapTemplate.GenerateP2PkhSwapPayment(
                aliceRefundPubKey: aliceRefundPubKey,
                bobRefundPubKey: bobRefundPubKey,
                bobAddress: bobAddress,
                secretHash: secretHash,
                expectedNetwork: Network);

            return(BitcoinBasedTransaction.CreateTransaction(
                       currency: this,
                       coins: coins,
                       destination: swap,
                       change: alicePubKey.Hash.ScriptPubKey,
                       amount: amount,
                       fee: fee));
        }
        public virtual IBitcoinBasedTransaction CreateHtlcP2PkhSwapPaymentTx(
            IEnumerable <ITxOutput> unspentOutputs,
            string aliceRefundAddress,
            string bobAddress,
            DateTimeOffset lockTime,
            byte[] secretHash,
            int secretSize,
            long amount,
            long fee)
        {
            var coins = unspentOutputs
                        .Cast <BitcoinBasedTxOutput>()
                        .Select(o => o.Coin);

            var swap = BitcoinBasedSwapTemplate.GenerateHtlcP2PkhSwapPayment(
                aliceRefundAddress: aliceRefundAddress,
                bobAddress: bobAddress,
                lockTimeStamp: lockTime.ToUnixTimeSeconds(),
                secretHash: secretHash,
                secretSize: secretSize,
                expectedNetwork: Network);

            var change = BitcoinAddress.Create(aliceRefundAddress, Network)
                         .ScriptPubKey;

            return(BitcoinBasedTransaction.CreateTransaction(
                       currency: this,
                       coins: coins,
                       destination: swap,
                       change: change,
                       amount: amount,
                       fee: fee));
        }
        public IBitcoinBasedTransaction CreateP2WPkhTx(
            IEnumerable <ITxOutput> unspentOutputs,
            string destinationAddress,
            string changeAddress,
            long amount,
            long fee)
        {
            var coins = unspentOutputs
                        .Cast <BitcoinBasedTxOutput>()
                        .Select(o => o.Coin);

            var destination = new BitcoinWitPubKeyAddress(destinationAddress, Network)
                              .ScriptPubKey;

            var change = new BitcoinWitPubKeyAddress(changeAddress, Network)
                         .ScriptPubKey;

            return(BitcoinBasedTransaction.CreateTransaction(
                       currency: this,
                       coins: coins,
                       destination: destination,
                       change: change,
                       amount: amount,
                       fee: fee));
        }