Hello. Trying to execute, but getting error "Sell failed authorization"
const ethers = require("ethers");
const OracleOrder = [
{ name: 'order', type: 'Order' },
{ name: 'blockNumber', type: 'uint256' },
]
const Order = [
{ name: 'trader', type: 'address' },
{ name: 'side', type: 'uint8' },
{ name: 'matchingPolicy', type: 'address' },
{ name: 'collection', type: 'address' },
{ name: 'tokenId', type: 'uint256' },
{ name: 'amount', type: 'uint256' },
{ name: 'paymentToken', type: 'address' },
{ name: 'price', type: 'uint256' },
{ name: 'listingTime', type: 'uint256' },
{ name: 'expirationTime', type: 'uint256' },
{ name: 'fees', type: 'Fee[]' },
{ name: 'salt', type: 'uint256' },
{ name: 'extraParams', type: 'bytes' }
]
const Fee = [
{ name: 'rate', type: 'uint16' },
{ name: 'recipient', type: 'address' },
]
const domain = {
name: 'Blur Exchange',
version: '1.0',
chainId: '1',
verifyingContract: '0x000000000000ad05ccc4f10045630fb830b95127',
}
const execute = async () => {
const node = new ethers.providers.JsonRpcProvider("https://rpc.ankr.com/eth");
const listingTime = String((((Date.now() - 1000000) / 1000)).toFixed());
const expirationTime = String(((Date.now() + 1000 * 60 * 60 * 24 * 3) / 1000).toFixed());
const salt = "5287962905876209576"
const block = await node.getBlockNumber();
const sellOrder = {
"trader":sellerAddress,
"side":"1",
"matchingPolicy":"0x00000000006411739DA1c40B106F8511de5D1FAC",
"collection":"0xaC3748673eE62a248D859191a74FBf837A448FD3",
"tokenId":"2",
"amount":"1",
"paymentToken":"0x0000000000000000000000000000000000000000",
"price":"1000000000000000",
"listingTime":listingTime,
"expirationTime":expirationTime,
"fees":[{
"rate":"10000",
"recipient":buyerAddress
}],
"salt":salt,
"extraParams":"0x"
}
sell_signature = await sellerSigner._signTypedData(domain, {Order, Fee}, sellOrder);
sell_signature = await ethers.utils.splitSignature(sell_signature);
const buyOrder = {
"trader":buyerAddress,
"side":"0","matchingPolicy":"0x00000000006411739DA1c40B106F8511de5D1FAC",
"collection":"0xaC3748673eE62a248D859191a74FBf837A448FD3",
"tokenId":"2",
"amount":"1",
"paymentToken":"0x0000000000000000000000000000000000000000",
"price":"1000000000000000",
"listingTime":listingTime,
"expirationTime":expirationTime,
"fees":[],
"salt":salt,
"extraParams":"0x"
}
const sell = {
"order": sellOrder,
"v": sell_signature.v,
"r": sell_signature.r,
"s": sell_signature.s,
"extraSignature": "0x",
"signatureVersion": "0",
"blockNumber": block
}
const buy = {
"order": buyOrder,
"v": 0,
"r": "0x0000000000000000000000000000000000000000000000000000000000000000",
"s": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraSignature": "0x",
"signatureVersion": "0",
"blockNumber": block
}
console.log(JSON.stringify(sell))
console.log(JSON.stringify(buy))
const contract = new ethers.Contract("0x000000000000ad05ccc4f10045630fb830b95127", Blur_ABI, buyerSigner);
const transaction = await contract.execute(
sell, buy
)
console.log(transaction);
}
execute()