OpenSea Error - Please use providerUtils.standardizeOrThrow()

891 views Asked by At

I'm having trouble using the openseas.js library. I'm trying to do a getAsset call on a random asset on openseas I found, but I keep getting

Error: DEPRECATED: Please use providerUtils.standardizeOrThrow() instead supportedProvider.send.toString(...).replaceAll is not a function

Full Error: enter image description here

I'm currently on node v16.14.2.

How can I resolve this issue? I appreciate the help!

const Web3 = require("web3");
import { OpenSeaPort, Network } from "opensea-js";
import { OpenSeaAsset } from "opensea-js/lib/types";

// This example provider won't let you make transactions, only read-only calls:
const provider = new Web3.providers.HttpProvider("https://mainnet.infura.io");

const seaport = new OpenSeaPort(provider, {
  networkName: Network.Main,
});

(async function main() {
  try {
    //random asset I found on OpenSea
    const asset: OpenSeaAsset = await seaport.api.getAsset({
      tokenAddress: "0x20ed6cdf9344b3a187063a3ff4d883b6b1947b81", // string
      tokenId: 220, // string | number | null
    });
    console.log("Asset", asset);
  } catch (e) {
    console.log("ERROR", e);
  }
});
  "dependencies": {
    "opensea-js": "^3.0.2",
    "typescript": "^4.6.3",
    "web3": "^1.7.3",
    "web3-provider-engine": "^16.0.3"
  }
1

There are 1 answers

1
bruels On

First, check the obvious things—since I know these bite me from time to time—clear your node_modules and reinstall, make sure your package-lock.json matches the versions you expect from package.json, make sure you're not running from a previous build, etc...

My guess is that something in your project is importing/using old versions of some of the 0xProject libs. Run npm list --all and see which ones are imported.

Worst case: that error is coming from the isWeb3Provider function in the 0xProject/assert project -- grep -r in your node_modules for something calling isWeb3Provider. Hopefully that'll give a clue.