1.0.8 • Published 2 months ago

sudo-defined-quoter v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

sudoswap SDK

Uses the sudoswap Defined API to get bid/asks for any NFT.

The Defined API free tier allows for 50k requests a month. The lib can also be easily forked to support additional data sources (e.g. The Graph, direct on-chain values, etc.)

Install

Published on npm.

npm i sudo-defined-quoter

Usage

Create an instance of Quoter with your Defined API key.

Supports both Mainnet (by default), or Goerli (pass in a value of 5 to the Quoter constructor).

Quoter supports getting instant asks (i.e. prices to buy at) and instant bids (i.e. prices to sell at) for any NFT collection listed on sudoswap v2.

Both getBidQuotes and getAskQuotes have the same function signature:

getBidQuotes(
    address: string, // Required, the NFT collection to get quotes for
    id: string | undefined = undefined, // Optional, for ERC1155 listings, filters by a specific ID
    quoteTokenAddress: string | undefined = undefined // Optional, defaults to ETH pools if undefined, otherwise specify a specific token address for pools listed in that token
  ) 

Simple use case of getting the immediate pools/prices to sell a Remilio NFT:

import { Quoter } from "sudo-defined-quoter";
let q = new Quoter(DEFINED_API_KEY, chainID /* 1 or 5, optional, defaults to 1 for Mainnet */);
let p = await q.getAskQuotes('0xd3d9ddd0cf0a5f0bfb8f7fceae075df687eaebab');

/*
[
  {
    pool: {
      address: '0xcdb8f114d2fb28a4b85bb1ab6e09444006ef5385',
      tokenBalance: 3356524524442673218n,
      spotPrice: 572773849040265576n,
      delta: 1040000000000000000n,
      royalty: 0n,
      nftIds: [Set],
      nftBalance: 9n,
      fee: 20000000000000000n,
      bondingCurveAddress: '0xfa056c602ad0c0c4ee4385b3233f2cb06730334a',
      isETHPool: true,
      tokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
      poolType: 1
    },
    quote: 558454502814258937n
  },
  {
    pool: {
      ...
    },
    quote: 565156442280810239n
  }
]

*/
1.0.8

2 months ago

1.0.7

9 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago