Buy & Sweep

Reservoir's APIs and SDKs make it easy to add buying and sweeping functionality directly into your product. Showcase your users the best prices across all major marketplaces and execute orders through one simple interface.

With Reservoir you can:

  • Buy multiple on sale NFTs across many marketplaces in one transaction
  • Set your own referrer fees on-top of aggregated orders
  • Automatically add missing royalty fees on-top of aggregated orders
  • Buy any non-ETH listing with ETH

Here is an example cURL request sweeping three tokens from the same collection. You can view execute/buy/v7 here: (https://docs.reservoir.tools/reference/postexecutebuyv7)

curl --request POST \
     --url https://api.reservoir.tools/execute/buy/v6 \
     --header 'accept: */*' \
     --header 'content-type: application/json' \
     --header 'x-api-key: demo-api-key' \
     --data '
{
  "tokens": [
    "0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258:61558",
    "0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258:74395",
    "0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258:80443"
  ],
  "onlyPath": false,
  "currency": "0x0000000000000000000000000000000000000000",
  "normalizeRoyalties": false,
  "partial": false,
  "skipBalanceCheck": false,
  "allowInactiveOrderIds": false,
  "excludeEOA": false,
  "taker": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c000000"
}
'

Here is an example with the SDK with the same tokens. You can view buyToken from the SDK here: (https://docs.reservoir.tools/docs/buytoken)

import { getClient, Execute } from "@reservoir0x/reservoir-sdk";
import { ethers } from "ethers";

...

const address = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c000000";
const signer = new ethers.VoidSigner(address, provider);

getClient()?.actions.buyToken({
  items: [
    { token: "0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258:61558"},
    { token: "0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258:74395"},
    { token: "0x34d85c9cdeb23fa97cb08333b511ac86e1c4e258:80443"},
  ],
  signer,
  onProgress: (steps: Execute['steps']) => {
    console.log(steps);
  },
});

πŸ“˜

API Docs: Execute Buy

πŸ“˜

Quick Start: Add Buying with Reservoir SDK