Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 1.62 KB

README.md

File metadata and controls

65 lines (53 loc) · 1.62 KB

Uniswap dotnet

NuGet version (DeFiPulse) Nuget downloads

A dotnet standard wrapper for the Uniswap V2 Subgraph on The Graph GraphQL API.

The Uniswap Subgraph can be found here.

Installation

Available on Nuget.

Install-Package Uniswap.dotnet -Version 1.0.0

Register service in your DI container

In order to use this package, simply add in the ConfigureServices method in your Startup.cs class:

services.AddUniswap();

Usage

To have access to the Uniswap service, simply get it by constructor injection:

private readonly IUniswap _uniswap;

public WeatherForecastController(IUniswap uniswap)
{
    _uniswap = uniswap;
}

Example - Get Most Liquid Market Pairs

The following example shows how to get the most liquid market pairs:

Pools pools = await _uniswap.GetMostLiquidMarketPairs();

We get the following JSON response:

{
  "pairs": [
    {
      "reserveETH": "0.000000000000000282",
      "reserveUSD": "0.00000000000009764515173366604499968328796917891",
      "token0": {
        "symbol": "HORE"
      },
      "token1": {
        "symbol": "WETH"
      }
    },
    {
      "reserveETH": "0.000367774762347336",
      "reserveUSD": "0.1469467966437433309224845826987036",
      "token0": {
        "symbol": "DATCx"
      },
      "token1": {
        "symbol": "WETH"
      }
    },