Skip to content

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

Notifications You must be signed in to change notification settings

strykerin/Uniswap-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

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"
      }
    },

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages