@dew-gg/opensea
v0.1.1
Published
## Features
Downloads
7
Readme
Use Dew Library
Features
| | OpenSea | X2Y2 | LooksRare | | ------------------ | --------------- | ------------ | ----------------- | | Package | @dew-gg/opensea | @dew-gg/x2y2 | @dew-gg/looksrare | | ----------- | | | | | List (Fixed Price) | o | o | o | | Buy | o | o | o | | Buy With Cart | o | o | o | | Delist | o | o | o | | Make Buy Offer | TBD | TBD | TBD |
Install Packages
First install the core package
npm i @dew-gg/core
then choose marketplace and install its corresponding package:
npm i @dew-gg/opensea
npm i @dew-gg/x2y2
npm i @dew-gg/looksrare
Use Marketplace API
import { Wallet } from '@dew-gg/core'
import { X2Y2 } from '@dew-gg/x2y2'
const wallet = new Wallet({ network: 'mainnet', privateKey })
const marketplace = new X2Y2({ network: 'mainnet', wallet })
List
await marketplace.sell({
tokenAddress, // contract address
tokenId, // token_id
price, // price in wei
expirationTime, // milliseconds since Unix Epoch
})
Buy
await marketplace.buy({
tokenAddress, // contract address
tokenId, // token_id
price, // price in wei
})
Buy With Cart
import { buyNftsWithCart, Network, Wallet } from '@dew-gg/core'
const item = await marketplace.signCartItem({
tokenAddress, // contract address
tokenId, // token_id
price, // price in wei
})
await buyNftsWithCart({
network,
signer: wallet.getEthersWallet(),
items: [item],
erc721Tokens: onlyOS
? []
: [
{
token,
tokenId,
},
],
onlyOS,
})
Delist
await marketplace.delist({
tokenAddress, // contract address
tokenId, // token_id
}