I'm trying to purchase a fixed price listed NFT from a specific collection using the opensea-js sdk, however when passing through a valid order into seaport.fulfillOrder()
I am just getting undefined as the returned value.
My assumption is that the web3 provider is incorrectly set up for the account looking to make the purchase but I have been stuck on this for hours and haven't made any progress. Anyone had any luck using this method to successfully purchase NFTs on Opensea through Node.js? I'm testing on the Rinkeby testnet.
Here's the code I use to fulfill the order, the order object is valid and retrieved using seaport.api.getOrder()
const order = await seaport.api.getOrder({
asset_contract_address: NFT_CONTRACT_ADDRESS,
maker: undefined,
taker: '0x0000000000000000000000000000000000000000',
owner: undefined,
side: OrderSide.OrderSide.Sell,
bundled: false,
token_id: token_id,
sale_kind: 0
});
const accountAddress = '0x12....';
const transactionHash = await seaport.fulfillOrder({
accountAddress,
order,
}).catch(err => console.log(err));
console.log("tx hash: " + transactionHash);
Here's the code I'm using to initialise web3 and seaport:
const provider = new Web3.providers.HttpProvider(walletAPIUrl);
const web3 = new Web3(provider);
const account = web3.eth.accounts.privateKeyToAccount('0x' + PRIVATE_KEY);
web3.eth.accounts.wallet.add(account);
web3.eth.defaultAccount = account.address;
const seaport = new OpenSeaPort(
provider,
{
networkName: Network.Rinkeby,
},
(arg) => console.log(arg)
);
Below is the error message I'm seeing when running the function: