soubhagya
soubhagya

Reputation: 806

Unhandled Rejection Opensea error while making Buying Items

    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 });

Anybody used opensea.js? Please help me out whats wrong Here.

I have attached the error Image. The error is on last part. Buy item code

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

I use this for my reference

enter image description here

Upvotes: 1

Views: 1264

Answers (1)

Kane
Kane

Reputation: 909

Is this the problem?

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

Upvotes: 3

Related Questions