#javascript #blockchain #ethereum #web3
Вопрос:
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
Я использую это для справки
Комментарии:
1. Эй! Ты нашел решение проблемы?
Ответ №1:
В этом ли проблема?
// This example provider won't let you make transactions, only read-only calls:
const provider = new Web3.providers.HttpProvider("https://mainnet.infura.io");