I'm not sure how to use Opensea's SDK function, fulfillOrder, to fulfill orders for a user through our frontend by prompting metamask?
The problem is I'm not going to have access to their mnemonic or private key; I just want to be able to prompt metamask and fulfill the order for them. Currently, my code is just 1) connecting to their metamask, 2) getting the order for the NFT through Openseas, then 3) somehow fulfilling the order (through metamask?)
I'm also using web3 as the provider.
if (typeof window.ethereum !== "undefined") {
try {
await window.ethereum.send('eth_requestAccounts')
const instance = new Web3(window.ethereum)
const accounts = await instance.eth.getAccounts()
let provider = new Web3.providers.HttpProvider("https://rinkeby.infura.io/v3/" + process.env.NEXT_PUBLIC_INFURA_KEY)
const {orders, counts} = await seaport.api.getOrders({
asset_contract_address: token_address,
token_ids: token_id,
side: 1
})
// ?? Not sure how to use fulfill and metamask together here ?? //
const transactionHash = await seaport.fulfillOrder({
order: order,
accountAddress: buyer_address
})
} catch(error) {
console.log("Error", error)
}
}