我正在使用 OpenSea-js 中的海港对象(https://github.com/ProjectOpenSea/opensea-js/blob/6b2b9ab382a04a0ca83003d9d8b81740055e1e6d/lib/seaport.js#L512),并成功实现了 createBuyOrder 函数:
try {
await seaport.createBuyOrder({
asset: {
tokenId,
tokenAddress,
},
accountAddress,
expirationTime: expirationtime,
// Value of the offer, in units of the payment token (or wrapped ETH if none is specified):
startAmount: offerPrice,
})
} catch (error) {
console.log(error)
}
但是至今还不能实现一个cancelOrder函数。我目前正在使用以下内容:
try {
await seaport.cancelOrder({
accountAddress,
order: this.state.orders[next_order],
})
.catch(err => console.error('error:' + err));
} catch (error) {
console.log(error)
}
订单来自我通过 opensea.io api 正确收集的一系列订单:https ://docs.opensea.io/reference/retrieving-orders ,示例如下:
{
"id": 498545629,
"asset": {
"id": 33209696,
"token_id": "3284",
"num_sales": 0,
"background_color": null,
"image_url": "https://lh3.googleusercontent.com/zEsszuXh41Yf8sHgAlbenYr3bnmG9OG__-M2wlUR2rLmmUDKITJmo48vbgfU2LYDf7TW3Ks5aNiM2L2GWunsmUKImdeM4-Pbebr6lw",
"image_preview_url": "https://lh3.googleusercontent.com/zEsszuXh41Yf8sHgAlbenYr3bnmG9OG__-M2wlUR2rLmmUDKITJmo48vbgfU2LYDf7TW3Ks5aNiM2L2GWunsmUKImdeM4-Pbebr6lw=s250",
"image_thumbnail_url": "https://lh3.googleusercontent.com/zEsszuXh41Yf8sHgAlbenYr3bnmG9OG__-M2wlUR2rLmmUDKITJmo48vbgfU2LYDf7TW3Ks5aNiM2L2GWunsmUKImdeM4-Pbebr6lw=s128",
"image_original_url": "https://gateway.pinata.cloud/ipfs/QmetwxehQcDvV9Az8Y7E6pca8vGghYt7Z1VXuteqQTnm9w/3284.jpeg",
"animation_url": null,
"animation_original_url": null,
"name": "Long Neckie Lady #3284",
"description": "This Long Neckie Lady #3284 is a fine art, hand drawn, computer generated collectible out of 3333 diverse females created by 12-year-old digital artist Nyla Hayes. Each Long Neckie features an elongated neck that is inspired by Nyla’s favorite dinosaur, the brontosaurus. Nyla has collaborated her signature long Neckie collection with Andi Rutz, using Computer Generation to create 3333 unique ladies, with up to 101 traits, using an erc-721 contract and living on the eth blockchain.",
"external_link": null,
"asset_contract": {
"address": "0xbb3d13260b3f6893ace34a4284be70eccf4cc0f1",
"asset_contract_type": "non-fungible",
"created_date": "2021-07-26T07:26:57.436850",
"name": "Long Neckie Ladies",
"nft_version": "3.0",
"opensea_version": null,
"owner": 22926506,
"schema_name": "ERC721",
"symbol": "LNL",
"total_supply": "0",
"description": "Long Neckie Ladies are a fine art, hand drawn, computer generated collectible of 3333 diverse females created by 12-year-old digital artist Nyla Hayes. Each Long Neckie features an elongated neck that is inspired by Nyla’s favorite dinosaur, the brontosaurus. Nyla has collaborated her signature long Neckie collection with Andi Rutz, using Computer Generation to create 3333 unique ladies, with up to 101 traits, using an erc-721 contract and living on the eth blockchain.\n\n***************Long Neckie Ladies NFT Licensing Agreement******************\nAs of 8/5/21 Long Neckie NFT collectors have Non-Exclusive Licensee rights. Please visit https://nylahayes.com/lnl-licensing-agreement for more details",
"external_link": "https://longneckieladies.io/",
"image_url": "https://lh3.googleusercontent.com/eV3XbDmvPumzQMiWECbJK8P0LY3YlRYM6k4Xn5QmYMRy0yRxi5hsLJcFNxAp4JxpjpzRIwxpDdi83CdUa0nWl4BdtZTarelmG5Vu=s120",
"default_to_fiat": false,
"dev_buyer_fee_basis_points": 0,
"dev_seller_fee_basis_points": 1000,
"only_proxied_transfers": false,
"opensea_buyer_fee_basis_points": 0,
"opensea_seller_fee_basis_points": 250,
"buyer_fee_basis_points": 0,
"seller_fee_basis_points": 1250,
"payout_address": "0xfc92a0656b4bd7fbf4cbdf2d7b55c251d738c3d8"
},
"permalink": "https://opensea.io/assets/0xbb3d13260b3f6893ace34a4284be70eccf4cc0f1/3284",
"collection": {
"banner_image_url": "https://lh3.googleusercontent.com/QLSVo3VbidUSWlWmBw9uByy7mlJfptj07LcE9VBeE9ITnuyvV4l_4Pai0BFuhHwmNF-GuPHQddvRPGpmUBFipkNmTFZoq9IJirG82S0=s2500",
"chat_url": null,
"created_date": "2021-07-26T07:37:38.155753",
"default_to_fiat": false,
"description": "Long Neckie Ladies are a fine art, hand drawn, computer generated collectible of 3333 diverse females created by 12-year-old digital artist Nyla Hayes. Each Long Neckie features an elongated neck that is inspired by Nyla’s favorite dinosaur, the brontosaurus. Nyla has collaborated her signature long Neckie collection with Andi Rutz, using Computer Generation to create 3333 unique ladies, with up to 101 traits, using an erc-721 contract and living on the eth blockchain.\n\n***************Long Neckie Ladies NFT Licensing Agreement******************\nAs of 8/5/21 Long Neckie NFT collectors have Non-Exclusive Licensee rights. Please visit https://nylahayes.com/lnl-licensing-agreement for more details",
"dev_buyer_fee_basis_points": "0",
"dev_seller_fee_basis_points": "1000",
"discord_url": "https://discord.gg/UEpMpVyjd2",
"display_data": {
"card_display_style": "contain"
},
"external_url": "https://longneckieladies.io/",
"featured": false,
"featured_image_url": "https://lh3.googleusercontent.com/eV3XbDmvPumzQMiWECbJK8P0LY3YlRYM6k4Xn5QmYMRy0yRxi5hsLJcFNxAp4JxpjpzRIwxpDdi83CdUa0nWl4BdtZTarelmG5Vu=s300",
"hidden": false,
"safelist_request_status": "verified",
"image_url": "https://lh3.googleusercontent.com/eV3XbDmvPumzQMiWECbJK8P0LY3YlRYM6k4Xn5QmYMRy0yRxi5hsLJcFNxAp4JxpjpzRIwxpDdi83CdUa0nWl4BdtZTarelmG5Vu=s120",
"is_subject_to_whitelist": false,
"large_image_url": "https://lh3.googleusercontent.com/eV3XbDmvPumzQMiWECbJK8P0LY3YlRYM6k4Xn5QmYMRy0yRxi5hsLJcFNxAp4JxpjpzRIwxpDdi83CdUa0nWl4BdtZTarelmG5Vu=s300",
"medium_username": null,
"name": "Long Neckie Ladies",
"only_proxied_transfers": false,
"opensea_buyer_fee_basis_points": "0",
"opensea_seller_fee_basis_points": "250",
"payout_address": "0xfc92a0656b4bd7fbf4cbdf2d7b55c251d738c3d8",
"require_email": false,
"short_description": null,
"slug": "long-neckie-ladies",
"telegram_url": null,
"twitter_username": "NylaCollection",
"instagram_username": null,
"wiki_url": null
},
"decimals": 0,
"token_metadata": "https://gateway.pinata.cloud/ipfs/QmRf1jZqtVuM8XY5Q5TPxzDzyWGY5Hj9wLd8vHE92c1zD1/3284",
"owner": {
"user": {
"username": "mario"
},
"profile_img_url": "https://storage.googleapis.com/opensea-static/opensea-profile/11.png",
"address": "0x81be7f475e335693fda594abc8b42bb0d873f9a0",
"config": ""
}
},
"asset_bundle": null,
"created_date": "2021-08-23T19:37:05.811852",
"closing_date": null,
"closing_extendable": false,
"expiration_time": 0,
"listing_time": 1629747322,
"order_hash": "0x7d2ded5c1b220d4ade386cd17a94078d3855967165f5c0640d6626f44b7af993",
"metadata": {
"asset": {
"id": "3284",
"address": "0xbb3d13260b3f6893ace34a4284be70eccf4cc0f1"
},
"schema": "ERC721"
},
"exchange": "0x7be8076f4ea4a4ad08075c2508e481d6c946d12b",
"maker": {
"user": {
"username": "singingvike"
},
"profile_img_url": "https://storage.googleapis.com/opensea-static/opensea-profile/20.png",
"address": "0x8bf826abab746e8fe9137e9452b255fe5571e83d",
"config": ""
},
"taker": {
"user": {
"username": "NullAddress"
},
"profile_img_url": "https://storage.googleapis.com/opensea-static/opensea-profile/1.png",
"address": "0x0000000000000000000000000000000000000000",
"config": ""
},
"current_price": "100000000000000000",
"current_bounty": "1000000000000000",
"bounty_multiple": "0.01",
"maker_relayer_fee": "0",
"taker_relayer_fee": "1250",
"maker_protocol_fee": "0",
"taker_protocol_fee": "0",
"maker_referrer_fee": "0",
"fee_recipient": {
"user": {
"username": "OS-Wallet"
},
"profile_img_url": "https://storage.googleapis.com/opensea-static/opensea-profile/28.png",
"address": "0x5b3256965e7c3cf26e11fcaf296dfc8807c01073",
"config": "verified"
},
"fee_method": 1,
"side": 0,
"sale_kind": 0,
"target": "0xbb3d13260b3f6893ace34a4284be70eccf4cc0f1",
"how_to_call": 0,
"calldata": "0x23b872dd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008bf826abab746e8fe9137e9452b255fe5571e83d0000000000000000000000000000000000000000000000000000000000000cd4",
"replacement_pattern": "0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"static_target": "0x0000000000000000000000000000000000000000",
"static_extradata": "0x",
"payment_token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"payment_token_contract": {
"id": 2,
"symbol": "WETH",
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"image_url": "https://storage.opensea.io/files/accae6b6fb3888cbff27a013729c22dc.svg",
"name": "Wrapped Ether",
"decimals": 18,
"eth_price": "1.000000000000000",
"usd_price": "3190.420000000000073000"
},
"base_price": "100000000000000000",
"extra": "0",
"quantity": "1",
"salt": "56947226028330970068635932848766220590627293086475703254930814390558123375927",
"v": 27,
"r": "0xdfcb224d6a7b0fae1db9ae23a7c43adda6dbb9ef28541acb2c1ede8263b025d9",
"s": "0x05d4c8379318fa412c8cec48bae0de70a4b7e2c8bb5cbabafe4421ea6c373d89",
"approved_on_chain": false,
"cancelled": false,
"finalized": false,
"marked_invalid": false,
"prefixed_hash": "0xa7cae22d5d4fd58b288e15100ca2ca7222998c0d36700e40741cceac99f362b7"
},
当我尝试运行时,我得到:错误:BigNumber 错误:new BigNumber() not a number: [object Object]。我尝试过传递部分订单(比如 order.id),但仍然出现错误。有人可以分享一个我可以为我的项目进行逆向工程的 cancelOrder 的工作调用示例吗?非常感谢,我希望我提供了所需的一切:)