OpenSea错误 - 请使用ProviderItils.StandardizeorThrow()

发布于 2025-01-22 09:20:57 字数 1446 浏览 0 评论 0原文

我使用 openseas.js.js library都遇到了麻烦。我正在尝试对我发现的openseas进行随机资产进行getAsset呼叫,但是我一直遇到

错误:devected:请使用provideritils.standardizeorthrow(),而不是supportedprovider.send.send.tostring.tostring(...)。不是功能

完整错误:

我目前在节点V16.14.2上。

如何解决这个问题?感谢您的帮助!

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一向肩并 2025-01-29 09:20:57

首先,检查显而易见的事情 - 我不时地咬我咬我 - node_modules并重新安装,请确保您的package> package> package-lock.json匹配您的版本。从package.json期望,请确保您没有从以前的构建中运行,等等...

我的猜测是项目中的某些内容正在导入/使用某些的旧版本0xProject libs。运行NPM列表 - ALL,然后查看导入哪些。

Worst case: that error is coming from the isWeb3Provider function 在0xproject/assert项目中 - grep -r在您的node_modules中用于调用iseweb3provider的事物。希望这会有一个线索。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文