0x-api
0x-api copied to clipboard
Failed to fill orders
I failed to fill an order with this code. Can anyone help?
import { BigNumber, providerUtils } from '@0x/utils';
async function fill() {
const utils = require("@0x/protocol-utils");
const order = new utils.LimitOrder({
sender: "0x0000000000000000000000000000000000000000",
maker: "0x55c18a6d97e738d27b29ecd7018e04ef2da8ff0a",
taker: "0x0000000000000000000000000000000000000000",
takerTokenFeeAmount: "0",
makerAmount: "2600",
takerAmount: "2600",
makerToken: "0xad6d458402f60fd3bd25163575031acdce07538d",
takerToken: "0x07865c6e87b9f70255377e024ace6630c1eaa37f",
salt: "0",
verifyingContract: "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
feeRecipient: "0x0000000000000000000000000000000000000000",
expiry: "2014956256",
chainId: 3,
pool: "0x0000000000000000000000000000000000000000000000000000000000000000"
});
const signature = await order.getSignatureWithKey(<my private key>, utils.SignatureType.EIP712);
var Web3 = require('web3');
var web3 = new Web3(Web3.givenProvider || 'http://localhost:8545/');
const supportedProvider = providerUtils.standardizeOrThrow(web3.currentProvider)
const wrappers = require("@0x/contract-wrappers");
const exchange = new wrappers.IZeroExContract("0xdef1c0ded9bec7f1a1670819833240f027b25eff", supportedProvider);
const amount = new BigNumber(1);
const res = await exchange.fillLimitOrder(order, signature, amount);
console.log(JSON.stringify(res));
}
fill().catch((err) => console.error(err));
Console output:
{}