OpenSea错误 - 请使用ProviderItils.StandardizeorThrow()
我使用 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
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,检查显而易见的事情 - 我不时地咬我咬我 -
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 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.