Skip to content

Instantly share code, notes, and snippets.

@0xlxy
Created September 13, 2022 02:06
Show Gist options
  • Save 0xlxy/37a815513341aa7981f914450e3c327c to your computer and use it in GitHub Desktop.
Save 0xlxy/37a815513341aa7981f914450e3c327c to your computer and use it in GitHub Desktop.
PoC for NFT instant sell on X2Y2
import { Signer } from 'ethers'
import { ethersWallet, init, acceptOffer } from '@x2y2-io/sdk'
import { Network } from '@x2y2-io/sdk/dist/network'
require('dotenv').config()
// https://github.com/X2Y2-io/x2y2-sdk
const X2Y2_API_KEY: string = process.env.X2Y2_API_KEY || ""
const WALLET_PRIVATE_KEY: string = process.env.WALLET_PRIVATE_KEY || ""
init(X2Y2_API_KEY)
const network: Network = 'mainnet'
const signer: Signer = ethersWallet(WALLET_PRIVATE_KEY, network)
const orderId = 10824325 // luckyneko13
const tokenId = '3786'
// Approve to X2Y2: 0xF849de01B080aDC3A814FaBE1E2087475cF2E354
async function sellOrder(network, signer, orderId, tokenId) {
// await approve(rpcURL, signerAddress, tokenAddress, WALLET_PRIVATE_KEY)
console.log("start selling")
const res = await acceptOffer({network, signer, orderId, tokenId})
console.log(res)
console.log("selling succeeded")
}
sellOrder(network, signer, orderId, tokenId)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment