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
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"
}
First, check the obvious things—since I know these bite me from time to time—clear your
node_modules
and reinstall, make sure yourpackage-lock.json
matches the versions you expect frompackage.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. Runnpm 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 yournode_modules
for something callingisWeb3Provider
. Hopefully that'll give a clue.