【问题标题】:Unhandled Rejection Opensea error while making Buying Items购买物品时出现未处理的拒绝 Opensea 错误
【发布时间】:2021-06-16 13:54:22
【问题描述】:
    import * as Web3 from "web3";
    import { OpenSeaPort, Network } from "opensea-js";
    import { OrderSide } 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,
    });
    export const OpenSeaAsset = async () =>
    await seaport.api.getAsset({
        tokenAddress: "0x...", // CryptoKitties
        tokenId: "30830", // Token ID
    });

    const asset = {
    tokenAddress: "0x...", // CryptoKitties
    tokenId: "30830", // Token ID
    };

    export const OpenSeaBalance = async () =>
    await seaport.getAssetBalance({
        accountAddress: "0x...", // string
        asset: asset, // Asset
    });

    export const offer = async () =>
    await seaport.createBuyOrder({
        asset: {
        tokenId: "30830",
        tokenAddress: "0x...",
        schemaName: "ERD721", // WyvernSchemaName. If omitted, defaults to 'ERC721'. Other options include 'ERC20' and 'ERC1155'
        },
        accountAddress: "0x...",
        // Value of the offer, in units of the payment token (or wrapped ETH if none is specified):
        startAmount: 1,
    });

    //   https://opensea.io/assets/0x2a46f2ffd99e19a89476e2f62270e0a35bbf0756/30830

    const order = async () => await seaport.api.getOrder({ side: OrderSide.Sell });
    const accountAddress = "0x1105c90c745339675EE8535e06663e5537C25798"; // The buyer's wallet address, also the taker
    export const transaction = async () =>
    await seaport.fulfillOrder({ order: order, accountAddress: accountAddress });

嗨,

有人用过 opensea.js 吗? 请帮我看看这里有什么问题。

我已附上错误图片。 错误在最后一部分。购买商品代码

https://projectopensea.github.io/opensea-js/#buying-items

我以此作为参考

【问题讨论】:

  • 嘿!你找到解决办法了吗?

标签: javascript blockchain ethereum web3


【解决方案1】:

这是问题吗?

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-30
    • 2021-02-15
    • 1970-01-01
    • 2022-10-18
    • 2023-03-03
    • 2017-06-08
    • 2020-05-05
    • 1970-01-01
    相关资源
    最近更新 更多