const OrderBuilder = require('@0x/order-utils'); const assetDataUtils = require('@0x/order-utils'); const BigNumber = require('@0x/utils'); async function main() // Example: Create a sell order for WETH to DAI const makerAssetData = assetDataUtils.encodeERC20AssetData('0xTokenA'); const takerAssetData = assetDataUtils.encodeERC20AssetData('0xTokenB');
require("@nomiclabs/hardhat-waffle"); const getContractAddressesForChainId = require('@0x/contract-addresses'); module.exports = solidity: "0.8.19", // Compatible with 0x v8.9.1 networks: goerli: url: https://goerli.infura.io/v3/YOUR_KEY , chainId: 5, , , // 0x v8.9.1 uses chainId 1 (mainnet), 5 (goerli), 137 (polygon) ; Create a file createOrder.js to validate your installation: 0x Version 8.9.1 Download-
node createOrder.js If you see the order object logged, your and installation are successful. 0x Version 8.9.1 Changelog (What’s New?) Understanding what changed in 8.9.1 helps you decide if this is the right version for you. const OrderBuilder = require('@0x/order-utils')
const order = makerAddress: '0xYourWallet', takerAddress: '0x0000000000000000000000000000000000000000', // Public order makerAssetAmount: new BigNumber(10e18), takerAssetAmount: new BigNumber(200e18), makerAssetData, takerAssetData, salt: new BigNumber(Date.now()), expirationTimeSeconds: new BigNumber(Math.floor(Date.now() / 1000) + 86400), feeRecipientAddress: '0x0000000000000000000000000000000000000000', ; const assetDataUtils = require('@0x/order-utils')
| Feature | 0x v7 | 0x v8.9.1 | | :--- | :--- | :--- | | | Hardcoded | Dynamic via AssetProxyRegistry | | Order Validation | validateOrder method | validateOrderWithContext method | | Liquidity Pools | No native support | Native LP integration | | Transaction Calldata | Larger | Optimized via calldata compression |