Comments (12)
@narmadhasugumar to reverse the process set the allowance to 0. You can do this using:
zeroEx.token.setProxyAllowanceAsync(new BigNumber(0));
Or in-case you are using the V2 0x.js library (>= 1.0.1):
contractWrappers.erc20Token.setProxyAllowanceAsync(new BigNumber(0));
from 0x-starter-project.
@fabioberger, This is for locking the token?..
zeroEx.token.setProxyAllowanceAsync(new BigNumber(0));
And if i want to get the unlocked contract tokens and loked contract tokens dynamically how to get that one ?
from 0x-starter-project.
How to get
const zeroEx = new ZeroEx(web3js.currentProvider, { networkId: networkId })
networkid dynamically?
If i am trying to get dynamically it shows error like this
from 0x-starter-project.
@narmadhasugumar to reverse the process set the allowance to 0. You can do this using:
zeroEx.token.setProxyAllowanceAsync(new BigNumber(0));
Or in-case you are using the V2 0x.js library (>= 1.0.1):
contractWrappers.erc20Token.setProxyAllowanceAsync(new BigNumber(0));
by locking it doesn't sign into metamask for permission?As u suggested i tried but not working i think
@fabioberger
from 0x-starter-project.
@narmadhasugumar I cannot understand your issue fully. Please write in full sentences and try and describe the issue you are facing fully.
As for the networkId issue, make sure the networkId you are passing in is a number
, not a string
.
from 0x-starter-project.
First Issue:
I just want to UNLOCK and LOCK the token, here in below image WETH can locked & unlocked, so i am able to UNLOCK the token but unable to LOCK the token, and unable to get the UNLOCKED tokens from. Just want to know how to LOCK and how to get the UNLOCKED list of tokens
.
SECOND ISSUE:
Is we have any possibilities to get the networkId dynamically instead of mentioning the networkid : 1 (statically)
Are you getting my issue @fabioberger
from 0x-starter-project.
@narmadhasugumar the UI showing "locked" and "unlocked" is a simplification of the reality. In reality, users are setting and unsetting their addresses' allowance to the 0x proxy contract. Locked is when the allowance set is 0
, unlocked is when it's set to the largest possible allowance amount 2^256-1
.
Setting allowances always requires the user to send a TX to the network.
from 0x-starter-project.
ok thank you @fabioberger for the explanation you gave for locking and unlocking i will try
below code is for unlock
await Promise.all(addresses.map(address => {
return zeroEx.token.setUnlimitedProxyAllowanceAsync(WETH_ADDRESS, address)
}))
and, for lock
zeroEx.token.setProxyAllowanceAsync(new BigNumber(0))
from 0x-starter-project.
Np. Yes, that is correct but be sure to also await that those transactions are mined (you can use: https://0xproject.com/docs/web3-wrapper#Web3Wrapper-awaitTransactionSuccessAsync).
Good luck!
from 0x-starter-project.
ok thankyou @fabioberger .
One more think i want to know,
const zeroExConfig: ZeroExConfig = {
networkId: 50, // testrpc
};
Is this the only way to get networkid directly, we cnt't take dynamically ? I am new to this platform so have so many doubts
from 0x-starter-project.
First Issue:
I just want to UNLOCK and LOCK the token, here in below image WETH can locked & unlocked, so i am able to UNLOCK the token but unable to LOCK the token, and unable to get the UNLOCKED tokens from. Just want to know how to LOCK and how to get the UNLOCKED list of tokens
.SECOND ISSUE:
Is we have any possibilities to get the networkId dynamically instead of mentioning the networkid : 1 (statically)Are you getting my issue @fabioberger
how do you know the state of Token ? like WETH is locked , is there a function in 0x.js?
from 0x-starter-project.
Yes, @fpChan it is called Checking the allowance status of the tokens, Here below i mentioned
const allowance = await contractWrappers.erc20Token.getProxyAllowanceAsync(tokenAddress, address)
from 0x-starter-project.
Related Issues (20)
- Missing code for validating order is fillable before calling fillOrder HOT 1
- [Q] What is color theme of this console? HOT 1
- How to get the data if Error: MetaMask Tx Signature: User denied transaction signature. HOT 10
- Mainnet rpcUrl HOT 1
- 0x protocol version 2 Get token by symbol HOT 1
- not works with mainnet
- Place order in 0x V2 HOT 22
- Fill order HOT 1
- Fetch Transaction Notification from Metamask HOT 1
- insufficient balance error notify to user HOT 1
- [Question] How to finish the trade with ETH not WETH for maker and taker?
- Relayer fees in percentage
- Failed to install dependencies HOT 1
- ll
- 'JSON RPC response has no result' when using fillLimitOrder
- 0
- Action required: Greenkeeper could not be activated 🚨
- Error: INSUFFICIENT_TAKER_FEE_ALLOWANCE HOT 1
- How was the ganache snapshot generated? HOT 1
- By placing an order facing issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 0x-starter-project.