DownloaderV3 1.0.2

dotnet add package DownloaderV3 --version 1.0.2                
NuGet\Install-Package DownloaderV3 -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DownloaderV3" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DownloaderV3 --version 1.0.2                
#r "nuget: DownloaderV3, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DownloaderV3 as a Cake Addin
#addin nuget:?package=DownloaderV3&version=1.0.2

// Install DownloaderV3 as a Cake Tool
#tool nuget:?package=DownloaderV3&version=1.0.2                

DownloaderV3

DownloaderV3 is a powerful and flexible .NET library designed to download, decode, and process blockchain event data from sources like Covalent API. The project can be used to fetch blockchain logs, decode them, and store them in the destination of your choice.

Features

  • Modular design with support for multiple data sources and destination databases.
  • Extensible architecture allowing easy integration of new sources or event decoders.
  • Uses the factory pattern to create customizable documents and decoders.
  • Integrated with Entity Framework Core for managing database contexts.

Getting Started

Prerequisites

  • .NET 8.0 or later
  • Entity Framework Core 7.0 or later
  • Access to Covalent API or other blockchain data sources

Installation

Clone the repository and add it to your solution:

git clone https://github.com/The-Poolz/DownloaderV3.git

Or, if you've packaged it as a NuGet package:

dotnet add package DownloaderV3

Dependency Injection Setup Setup

To use DownloaderV3, set up services using ServiceConfigurator by default with context and logger configured by default:

using Microsoft.Extensions.DependencyInjection;
using DownloaderV3.Helpers;
using DownloaderV3.Destination;

// Create the context for your database
var context = new CustomDestination(new DbContextOptionsBuilder<CustomDestination>()
    .UseSqlServer("your-connection-string")
    .Options);

// Set up services with context and logging (using console logging by default)
var downloadHandler = new DownloadHandler<InputData>(context);

ServiceConfigurator helps in setting up required dependencies, such as logging, database context, and factories, using default configurations when necessary.

Key Classes

  • DownloadHandler<TData>: The main handler for fetching, decoding, and saving blockchain data.
  • BaseDestination: Extend this class to define your own destination for data storage.

Dependency Injection Setup (Second Option)

using Microsoft.Extensions.DependencyInjection;
using DownloaderV3.Helpers;
using DownloaderV3.Destination;
using Microsoft.Extensions.Logging;

// Set up your services
var services = new ServiceCollection();

// Configure the context and logging
services.AddDbContext<CustomDestination>(options =>
{
    options.UseSqlServer("your-connection-string");
});

services.AddLogging(config => config.AddConsole());

// Configure other services like GetSourcePage, IDocumentFactory, etc.
services.AddTransient<GetSourcePage, MyCustomSourcePage>();
services.AddTransient<IDocumentFactory, MyCustomDocumentFactory>();
services.AddTransient<IDocumentDecoderFactory, MyCustomDocumentDecoderFactory>();

// Build the service provider
var serviceProvider = services.BuildServiceProvider();

// Use the DownloadHandler with the service provider
var downloadHandler = new DownloadHandler<InputData>(serviceProvider);

// Use the handler
var results = await downloadHandler.HandleAsync();

Advanced Configuration

To create a custom destination, extend BaseDestination:

public class CustomDestination : BaseDestination
{
    public CustomDestination(DbContextOptions<CustomDestination> options)
        : base(options) { }
    public DbSet<CustomEntity> CustomEntities { get; set; } = null!;
}

Contributing

We welcome contributions! Please feel free to submit issues, fork the repository, and send pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 102 10/16/2024
1.0.1 104 10/9/2024
1.0.0 103 9/26/2024

Release Notes for DownloaderV3 v1.0.2: