Example #1
0
        public void RepositorySerializerTest(string cryptoCode)
        {
            var networkProvider = new NRustLightningNetworkProvider(NetworkType.Regtest);
            var ser             = new RepositorySerializer(networkProvider.GetByCryptoCode(cryptoCode));
            // utxo response
            var resp        = new UTXOChangesWithMetadata();
            var confirmed   = new UTXOChangeWithSpentOutput();
            var unconfirmed = new UTXOChangeWithSpentOutput();

            confirmed.SpentOutPoint = new List <OutPoint>()
            {
                OutPoint.Zero
            };
            var coinBaseTx =
                Transaction.Parse(
                    "020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0401750101ffffffff0200f2052a0100000017a914d4bb8bf5f987cd463a2f5e6e4f04618c7aaed1b5870000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000", Network.RegTest);
            var utxo = new UTXO(new NBXplorer.Models.UTXO(coinBaseTx.Outputs.AsCoins().First()));

            Assert.NotNull(JsonSerializer.Serialize(utxo, ser.Options));
            confirmed.UTXO = new List <UTXOChangeWithMetadata>()
            {
                new UTXOChangeWithMetadata(utxo, UTXOKind.UserDeposit, new AddressTrackedSource(coinBaseTx.Outputs[0].ScriptPubKey.GetDestinationAddress(Network.RegTest)))
            };
            resp.Confirmed   = confirmed;
            resp.UnConfirmed = unconfirmed;
            var res = JsonSerializer.Serialize(resp, ser.Options);

            Assert.NotNull(res);
        }
Example #2
0
 public UTXOChangeWithMetadata(UTXO utxo, UTXOKind kind, TrackedSource source)
 {
     Utxo   = utxo ?? throw new ArgumentNullException(nameof(utxo));
     Kind   = kind;
     Source = source;
 }