0xproject / 0x-starter-project Goto Github PK
View Code? Open in Web Editor NEWA project showcasing how to get started with 0x.js
License: Apache License 2.0
A project showcasing how to get started with 0x.js
License: Apache License 2.0
Hey,
I was just wondering, how can we perform reverse of Wrapping ETH, that means converting WETH to ETH again through code ?
Please Suggest.
Thanks
tried on mainnet ubuntu 18 with infura and stucks the pc is lagged and stucks leak of memory..
not working with mainnet building ....
As we are using
await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync('WETH') this method is used in Verion v0 how to get this in verison v2 Can any one please help me in this ?
Hello guys,
I'm trying to run the 0x-starter-project on windows 10.
I got stuck at early stages while running the "yarn" command line .
I got this error as shown in the screenshot
I have looked it up, and im guessing perhaps it was produced cause i haven't ran : brew install yarn --without-node. But obviously i can not run it since Homebrew is specific to MacOSX and it doesn't exist
for windows...
Does anyone have an idea how to make it work?
Thank you !
Hi,
I just wanted to know how to lock the token
Ex: We are unlocking the token using
zeroEx.token.setUnlimitedProxyAllowanceAsync vise versa as a revert process i want to lock the token
Thanks in advance
I tried to place the order as we released our site in server, but it was working in local after changing the according to Production terms i am getting an error like Bad Gateway only for placing order API. What may be the mistake
When running a relayer, how can relayer fees be set in percentage of the transactional value?
I'm trying to test my own smart contracts that call 0x as well as other exchanges. I can't use the ganache snapshot provided by 0x because I am already using a snapshot provided by another project.
How can I deploy the 0x contracts to my ganache network without using your snapshot?
Hey there, was just wondering if there is going to be a starter-project using version 2 of the 0x protocol.
How to get the status if Error: MetaMask Tx Signature: User denied transaction signature. in DAPP to do the further process
yarn run order_actions
yarn run v1.6.0
$ run-s build tutorial:order_actions
$ tsc
node_modules/web3/types.d.ts(1,10): error TS2305: Module ''bn.js'' has no exported member 'BigNumber'.
node_modules/web3/types.d.ts(1,27): error TS2497: Module ''bn.js'' resolves to a non-module entity and cannot be imported using this construct.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
0x Protocol doesn't directly support Token-ETH trade, so it needs to wrapper ETH to WETH.
If I use fillOrder
to finish the order, taker should wrapper ETH to WETH before. If marketBuyOrdersWithEth
, taker can trade with ETH directly. (I know the contract wrapper ETH to WETH instead of taker)
But, for maker, him always receives the WETH Token. is any way that can make maker receives ETH directly?
In src/scenarios/fill_order_erc20.ts, originally there was code that validates the order is fillable before calling fillOrder. However, this part was missing in the new version. I understand the function was moved to OrderUtils, but i’d be nice to add this function back so that people can see how to use it.
I got this error when installing the dependencies. Can anyone help?
$ yarn install
00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: 'install'
What is the way to retrieve the token details and make them locked and unloked
Fetch the data if the user have insufficient balance and notify them . Is there any function or we have to manually calculate the balance
when I run npm run dev i show these errors [email protected] dev C:\Users\hicham\Desktop\project\0x
npm run build; node ./lib/index.js
m ERR! missing script: build;
m ERR! A complete log of this run can be found in:
m ERR! C:\Users\hicham\AppData\Roaming\npm-cache_logs\2018-01-12T16_07_12
80Z-debug.log
m ERR! code ELIFECYCLE
m ERR! errno 1
m ERR! [email protected] dev: npm run build; node ./lib/index.js
m ERR! Exit status 1
m ERR!
m ERR! Failed at the [email protected] dev script.
m ERR! This is probably not a problem with npm. There is likely additional log
ng output above.
m ERR! A complete log of this run can be found in:
m ERR! C:\Users\hicham\AppData\Roaming\npm-cache_logs\2018-01-12T16_07_12
58Z-debug.log
I following this tutorial: https://0xproject.com/wiki#Create,-Validate,-Fill-Order
Everything is ok, until I run this command. What am I missing?
yarn order_actions
yarn run v1.6.0
$ run-s build tutorial:order_actions
/bin/sh: run-s: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Getting error as "Error: INSUFFICIENT_TAKER_FEE_ALLOWANCE" in latest code while running scenario:fill_order_sra, hence fillOrder failed.
As i started using 0x version 2.. i want to connect with MAINNET_CONFIGS can you please tell me the URL of MAINNET as
ROPSTEN_CONFIGS = 'https://ropsten.infura.io/'
KOVAN_CONFIGS = 'https://kovan.infura.io/'
MAINNET_CONFIGS = ?
How to fetch the transaction notification of Wrap, unwrap, lock, unlock and orders. Can any one tell me the hoe to fetch and show in our site
git clone [email protected]:0xProject/0x.js-starter-project.git
When I run this command I am getting the below error
**Cloning into '0x.js-starter-project'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.**
I tried running with sudo, doesn't work either.
However cloning this https://github.com/0xProject/0x-starter-project.git worked, but the problem I was facing from the one mentioned in the 0x wiki command.
If i change the account in Metamask it doesnt change the TOKEN BALANCE Automatically Can any one help in this issue
What's needed to run the starter project with a ganache provider? Or even Ropsten with Infura?
Hello, It is my first time testing the 0x API for limit orders.
Im creating some hardhat tasks to create and fill Limit Orders. Ive followed the tutorial fill_order_example but Im receiving this error `JSON RPC response has no result' I don't know why.
The exact message error is:
Error: JSON RPC response has no result
at Web3Wrapper.<anonymous> (<folder>/node_modules/@0x/web3-wrapper/src/web3_wrapper.ts:789:19)
at Generator.next (<anonymous>)
at fulfilled (<folder>/node_modules/@0x/web3-wrapper/lib/src/web3_wrapper.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Below is the code of my task:
const utils = require('@0x/protocol-utils')
const { ContractWrappers, ERC20TokenContract } = require('@0x/contract-wrappers')
const BigNumber = require('bignumber.js')
const contractAddresses = require('@0x/contract-addresses')
task('fillLimitOrder', 'Fill Limit Order')
.addOptionalParam('gasmultiplier', 'gasmultiplier')
.setAction(async ({ gasmultiplier = 2 }, hre) => {
console.log('fillLimitOrder')
// 1) Get Exchange Address for Polygon
// 2) Approve Maker Token (CCB Token)
// 3) Approve Taker Token (USDC)
// 4) Fetch ordertxHash
// 5) Use the number 4) to fill the order
const CHAIN_ID = 137
const marketTokenAddress = '0x41d2f09f4899f16ed0ed86f8487018cc8c91f547'
const takerTokenAddress = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174'
const marketTokenContract = await hre.ethers.getContractAt('ERC20', marketTokenAddress)
const takerTokenContract = await hre.ethers.getContractAt('ERC20', takerTokenAddress)
const MAX_UINT = hre.ethers.MaxUint256
const contractWrappers = new ContractWrappers(hre.ethers.provider, { chainId: CHAIN_ID })
const [makerSigner, takerSigner] = await hre.ethers.getSigners()
const takerAddress = await takerSigner.getAddress()
console.log('takerAddress', takerAddress)
const addresses = contractAddresses.getContractAddressesForChainOrThrow(
CHAIN_ID
)
const exchangeAddress = addresses.exchangeProxy
console.log('approving maker token')
await marketTokenContract.approve(exchangeAddress, MAX_UINT)
console.log('approving taker token')
await takerTokenContract.connect(takerSigner).approve(exchangeAddress, MAX_UINT)
const order = {
sender: '0x0000000000000000000000000000000000000000',
maker: '0x7e28184ebf20437051034232e7b9cbaa43d901d6',
taker: '0x0000000000000000000000000000000000000000',
takerTokenFeeAmount: '0',
makerAmount: '1000000000000000000',
takerAmount: '1000000',
makerToken: '0x41d2f09f4899f16ed0ed86f8487018cc8c91f547',
takerToken: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
salt: '1698147146829',
verifyingContract: '0xdef1c0ded9bec7f1a1670819833240f027b25eff',
feeRecipient: '0x0000000000000000000000000000000000000000',
expiry: '1698150146',
chainId: 137,
pool: '0x0000000000000000000000000000000000000000000000000000000000000000'
}
const orderSignature = {
signatureType: 2,
r: '0xe83f724835b9f932da5e08a749aab5ecf866b4febad9e0a4a0e43b67034f4c42',
s: '0x767590a016cab96469d5513a91e1223fa0564c067242e17218562ea8f530c644',
v: 28
}
const takerAssetAmount = new BigNumber('100000')
// get the protocol fee multiplier
// protocol fee = multiplier * gasPrice * numOrders
const protocolFeeMultiplier = new BigNumber(
await contractWrappers.exchangeProxy.getProtocolFeeMultiplier().callAsync()
)
const feeData = hre.provider.getFeeData()
console.log('feeData', feeData)
const calculateProtocolFee = (
numOrders,
multiplier
) => {
return multiplier.times(feeData.gasPrice).times(numOrders)
}
// Fill the Order via 0x Exchange Proxy contract
try {
const txHash = await contractWrappers.exchangeProxy
.fillLimitOrder(order, orderSignature, takerAssetAmount)
.sendTransactionAsync({
from: taker,
value: calculateProtocolFee(1, protocolFeeMultiplier),
gasPrice: feeData.gasPrice * 2n
})
console.log(txHash)
} catch (err) {
console.log(err)
}
})
While importing 0x.js using script in index html it shows Uncaught ReferenceError: exports is not defined at 0x.js:43
Object.defineProperty(exports, "__esModule", { value: true }); // shows error at this line
🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
I follow this" https://0xproject.com/wiki#Create,-Validate,-Fill-Orderat " to try,but after typing yarn order_actions
,it return:
dean@dean-ST-S:~/0x-starter-project yarn order_actionsyarn run v1.6.0 yarnorder
a
ctionsyarnrunv1.6.0 run-s build tutorial:order_actions
$ tsc
src/tutorials/order_actions/index.ts(2,27): error TS2307: Cannot find module '@0xproject/utils'.
src/tutorials/relayer_actions/index.ts(14,27): error TS2307: Cannot find module '@0xproject/utils'.
src/tutorials/relayer_websocket/custom_orderbook_channel_handler.ts(10,27): error TS2307: Cannot find module '@0xproject/utils'.
src/tutorials/relayer_websocket/generate_initial_book.ts(12,27): error TS2307: Cannot find module '@0xproject/utils'.
src/tutorials/relayer_websocket/generate_new_orders_with_interval.ts(12,27): error TS2307: Cannot find module '@0xproject/utils'.
src/utils/server.ts(2,27): error TS2307: Cannot find module '@0xproject/utils'.
../node_modules/web3/types.d.ts(1,10): error TS2305: Module ''bn.js'' has no exported member 'BigNumber'.
../node_modules/web3/types.d.ts(1,27): error TS2497: Module ''bn.js'' resolves to a non-module entity and cannot be imported using this construct.
../node_modules/web3/types.d.ts(2,21): error TS7016: Could not find a declaration file for module 'underscore'. '/home/dean/node_modules/underscore/underscore.js' implicitly has an 'any' type.
Try `npm install @types/underscore` if it exists or add a new declaration (.d.ts) file containing `declare module 'underscore';`
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I think there is something wrong with your code in github because there is not @0xproject/utils
where is the BigNumber?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.