0xproject / 0x-monorepo Goto Github PK
View Code? Open in Web Editor NEW0x protocol monorepo - includes our smart contracts and many developer tools
License: Other
0x protocol monorepo - includes our smart contracts and many developer tools
License: Other
If a method of the same name preciously exists within the documentation, the links go to the first instance of that method rather than the correct one. For example, orderwatcher.subscribe
links to exchange.subscribe
(urls for both are: https://0xproject.com/docs/0xjs#subscribe).
node_modules/0x.js/lib/src/contract_wrappers/ether_token_wrapper.d.ts(29,32): error TS2503: Cannot find namespace 'BigNumber'. node_modules/0x.js/lib/src/types.d.ts(28,36): error TS2503: Cannot find namespace 'BigNumber'.
"I assumed it would have all the types deployed within the npm package…"
I came upon this issue when I sent a 0x order via REST to a node.js server. The salt that is generated using "generatePseudoRandomSalt" is a large number stringified (e.g. "40599983934626278298511948302963119827536450249312932036852600602882883328979"). When calling new BigNumber() on this string, it results in an exponential number - which fails the the schema validator. Should we add the ability to handle exponential figures in this validation?
File: 0x.js/packages/json-schemas/schemas/basic_type_schemas.ts
export const numberSchema = {
id: '/Number',
type: 'string',
pattern: '^\\d+(\\.\\d+)?$',
};
Using 0.21.2
When I visit the 0x portal, I can see that all my tokens have Trade Permissions enabled. Also, token.getProxyAllowanceAsync() confirms that my allowance is "unlimited" for both the maker and taker tokens.
But calling fillOrdersUpToAsync()
gives me the INSUFFICIENT_TAKER_ALLOWANCE
error. I didn't have this problem using v0.20.0, but I can't test right now.
I can see that there's an issue closed regarding this: #191
But it doesn't seem like it's been actually resolved.
I'm trying to check the status of an order programmatically.
I have an order hash, how do I check if it's still available or if it was filler or cancelled? The docs are not quite clear to me, I spent one hour trying to figure it out...
This is what I have at the moment, but I have no idea how to do this... (using parity as provider)
const ZeroEx = require('0x.js').ZeroEx;
const web3 = require('web3');
let provider = new web3.providers.HttpProvider('http://localhost:8545/');
let parity = new web3(provider);
let orderHash = '0123456789abcdef...';
let zeroEx = new ZeroEx(provider);
zeroEx.???(orderHash) // <----- here, which method to use??
.then(function(res) {
console.log(res);
})
.catch(function(error) {
console.log('Caught error: ', error);
});
or should I subscribe to all changes in the orders using subscribeAsync
?
Hello, maybe I am too newbie for this, but i can't find how to provide injectedWeb3Subprovider
to the new ZeroEx
instance. Is it a problem with the API ? Is it the right way to use it ?
Thank you
window.addEventListener('load', () => {
// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof window['web3'] !== 'undefined') {
// Use the browser's ethereum provider
const web3: Web3 = window['web3'];
const injectedWeb3Subprovider: InjectedWeb3Subprovider = new InjectedWeb3Subprovider(web3);
new ZeroEx(injectedWeb3Subprovider, { networkId: 42 })
.getAvailableAddressesAsync()
.then(console.log)
} else {
console.log('No web3? You should consider trying MetaMask!')
}
});
ERROR in src/app/app.component.ts(41,20): error TS2345: Argument of type 'InjectedWeb3Subprovider' is not assignable to parameter of type 'Provider'.
Property 'sendAsync' is missing in type 'InjectedWeb3Subprovider'.
I saw your solution to use testRPC and snapshot with network 50 in local environment. It is ok but my staging environment (= kovan) and production (= mainnet) uses parity. I would like to have the same blockchain setup for all 3 environments so testRPC solution doesn't fit.
I tryied to deploy and use 0x contracts locally with parity. I did following steps:
exchangeContractAddress
, tokenRegistryContractAddress
, ZRXTokenAddress
etc.web3
to point to that chain.zeroEx
package with following config (addresses are taken from deploy):{
"exchangeContractAddress":"0x499d511d6bc3a1a267439645cf50d5dddc688d54",
"etherTokenContractAddress":"0xe76009fd1e1f7ef6d91ecfcd9c6233fd986f1cd3",
"tokenRegistryContractAddress":"0x16d9b9a68ef707c5d5601fae2d29a78a9dde1fe3",
"tokenTransferProxyContractAddress":"0x81f0dfc0a761bba60d63ac4ce8c776d6a1e69979",
"networkId":1000,
}
When I try to run following 0x method:
zeroEx.exchange.getZRXTokenAddress()
I catched following error:
TypeError: Cannot read property 'address' of undefined
.
I checked 0x code internally and seems that:
ExchangeWrapper
has attribute _zrxContractAddressIfExists
this value is returned as ZRX address. Unfortunately I don't see that this attribute is setI observed that described method zeroEx.exchange.getZRXTokenAddress()
is used internally in 0x.js code.
Is there any way to work on custom local chain with custom network and still have possibility to use 0x?package? I'm using 0x.js in version 0.30.
Why using 0x.js connected to kovan infura, certain calls don't work. For example:
let balance = await self.zeroEx.token.getBalanceAsync(token, owner);
throws with:
Error: No addresses were available on the provided web3 provider
I noticed the same thing with getProxyAllowanceAsync
IMO a node shouldn't be required to have an account created on it for those calls to work since they don't interact with local accounts.
I haven't gone through the API exhaustively, but other calls seem to work fine without an account, such as zeroEx.tokenRegistry.getTokensAsync
I confirmed that his error exists on a local kovan node I'm running, but goes away once I create an empty account.
Working on the Kovan Network:
Use Kovan address for WETH contract as makerTokenAddress: "0x05d090b51c40b020eab3bfcb6a2dff130df22e9c"
Set makerAmount to the balance from zeroEx.token.getBalanceAsync(makerTokenAddress, makerAddress)
Complete an otherwise valid order.
Sign order (not sure if this is required)
Submitting to zeroEx().exchange.validateFillOrderThrowIfInvalidAsync throws INSUFFICIENT_MAKER_BALANCE
Changing the balance to -1 wei passes the validation. I figure this is a missing 'or equals' on a greater/less than. I'll see if I can find it. Seems to work fine when submitting total balance of ZRX token.
signTransactionAsync
uses web3.eth.sign
instead of web3.personal.sign
.
web3.eth.sign
is deprecated and gives a scary warning in MetaMask:
Sign Message
Signing this message can have dangerous side effects. Only sign messages from sites you fully trust with your entire account. This dangerous method will be removed in a future version. Read more here.
from read more here:
Security Notice
These methods, personal_sign and its partner, personal_ecRecover have replaced the previous signature methods, eth_sign and eth_recover. That’s because the previous methods signed raw data unmodified, making it vulnerable to chosen ciphertext attacks, as well as potentially signing transactions you didn’t intend to. You can read more about the reasoning behind this change on the go-ethereum repository.
Is there a reason not to replace e.g.
web3.eth.sign(web3.eth.defaultAccount,web3.toHex("msg"), (err,res) => console.log(err,res))
with this:
web3.personal.sign(web3.toHex("msg"),web3.eth.defaultAccount, (err,res) => console.log(err,res))
Same result (I think), no error message.
I may be missing something, but I've having trouble with catching promise rejections using 0x.
I've tried:
async function check() {
try {
const r = await zeroEx.awaitTransactionMinedAsync('0xfake');
} catch(e) {
console.log('caught');
}
}
I've also tried chaining .catch
to the promise itself.
Either way, I don't see my catch statement executing, and I see:
(node:17129) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: invalid argument 0: hex string has length 4, want 64 for common.Hash
(node:17129) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Am I doing something wrong? Or could there be an issue with the library?
When validating maker/taker balances and allowances for an order, we currently define the required amounts like so:
const requiredTakerAmount = isTakerTokenZRX ? fillTakerAmount.plus(signedOrder.takerFee) : fillTakerAmount;
However, this does not account for intermediate state changes. A trader should be able to trade for ZRX and then use that ZRX to pay the fees for that fill. Therefore, as long as the required fee is less than the amount of ZRX that the trader will receive, the trader's ZRX balance should be considered valid (note that they still need a ZRX allowance in order to pay fees).
Hi,
I tried creating an order via OTC and filling the same. However I am getting the following error message.
JSON of the generated order :
{"maker":{"address":"0x7266c50f1f461d2748e675b907ef22987f6b5358","token":{"name":"MLN","symbol":"MLN","decimals":18,"address":"0x323b5d4c32345ced77393b3530b1eed0f346429d"},"amount":"1850000000000000000","feeAmount":"0"},"taker":{"address":"","token":{"name":"ETH","symbol":"ETH","decimals":18,"address":"0xd0a1e359811322d97991e03f863a0c30c2cf029c"},"amount":"320000000000000000","feeAmount":"0"},"expiration":"1514347479","feeRecipient":"0x0000000000000000000000000000000000000000","salt":"99033804502856343259430181946001007533635816863503102978577997033734866165564","signature":{"v":27,"r":"0x3d175dc82add08503a083ee791d75e06caaf86664cf9d4ba76f99246ff282e00","s":"0x3a602580593d51845e7ac667d633e06a3fbbe5ba17687866932fc0c64c0a10a8","hash":"0xd434ea708aee8decf8facd747a3955d9f2e6ef834d9b91102ec775a2eae0b138"},"exchangeContract":"0x90fe2af704b34e0224bf2299c838e04d4dcf1364","networkId":42}
Kindly Help.
The shared BigNumber configuration in utils/src/bignumber_config.ts seems to configure whatever BigNumber
is installed as a dependency for 0xproject/utils
. Note that this is not necessarily the same BigNumber
as the one used by the caller.
I recently ran into an issue where schema validation failed for API calls made by 0xproject/connect
because the BigNumber
used by connect
wasn't configured correctly (Order salts were serialized in the exponential notation).
Running npm dedupe
fixed the issue, so I'm inclined to believe that this was because the BigNumber
that was configured by utils
wasn't the same as the one used by connect
.
Possible fixes:
bignumber
from dependencies
to peerDependencies
in 0xproject/utils
bigNumberConfigs.configure
method in utils
, just configure and re-export BigNumber
and import it from utils
instead of bignumber.js
in the other packages.Related to #293
It's supposed to be possible to add a custom gas price to this request but I don't see it anywhere in the documentation. Where can I find it?
Thanks in advance,
Ran
Hi, I am using the latest version of "0x.js": "^0.29.0"
and "web3-typescript-typings": "^0.9.0"
in an Angular2 app, it fails to compile and output :
ERROR in ./src/app/app.component.ts
Module parse failed: The keyword 'yield' is reserved (23:23)
You may need an appropriate loader to handle this file type.
| // Instantiate 0x.js instance
| var zeroEx = new _0x_js_1.ZeroEx(provider, { networkId: 50 });
| var accounts = yield zeroEx.getAvailableAddressesAsync();
| };
| AppComponent = __decorate([
@ ./src/app/app.module.ts 11:22-48
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in src/app/app.component.ts(23,22): error TS1308: 'await' expression is only allowed within an async function.
entry :
import * as Web3 from 'web3';
import {ZeroEx} from '0x.js';
import BigNumber from 'bignumber.js';
...
ngOnInit() {
// Provider pointing to local TestRPC on default port 8545
const provider = new Web3.providers.HttpProvider('http://localhost:8545');
// Instantiate 0x.js instance
const zeroEx = new ZeroEx(provider, { networkId: 50 });
const accounts = await zeroEx.getAvailableAddressesAsync();
}
tsconfig.ts :
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types",
"node_modules/web3-typescript-typings"
],
"lib": [
"es2017",
"dom"
]
}
}
tsconfig.app.ts :
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015"
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
when order makerTokenAmount bignumber like this makerTokenAmount = new BigNumber(1e21)
it can not pass the validation, because that JSON.stringify will can BigNumberInstance.toString()
, so it will get string 1e21, but not string 1000000000000000000000, unless we configure bigNumber
Sometime I met this error when running the tests, but sometimes may be not
Here is the stack
Error: Invalid signature length
at Object.exports.fromRpcSig (/Users/david/Documents/my_test/node_modules/ethereumjs-util/index.js:401:11)
at Object.parseSignatureHexAsRSV (/Users/david/Documents/my_test/node_modules/0x.js/src/utils/signature_utils.ts:37:15)
at ZeroEx.<anonymous> (/Users/david/Documents/my_test/node_modules/0x.js/src/0x.ts:273:47)
at step (/Users/david/Documents/my_test/node_modules/0x.js/lib/src/0x.js:40:23)
at Object.next (/Users/david/Documents/my_test/node_modules/0x.js/lib/src/0x.js:21:53)
at fulfilled (/Users/david/Documents/my_test/node_modules/0x.js/lib/src/0x.js:12:58)
at propagateAslWrapper (/Users/david/Documents/my_test/node_modules/async-listener/index.js:478:23)
at /Users/david/Documents/my_test/node_modules/async-listener/glue.js:188:31
at /Users/david/Documents/my_test/node_modules/async-listener/index.js:515:70
at /Users/david/Documents/my_test/node_modules/async-listener/glue.js:188:31
at <anonymous>
I tried to debug ethereumjs-util, It seems that sig.length
is 64 sometime.
Any help is appreciated.
I've been playing with 0x.js library, and found this error... currently using "web3": "^1.0.0-beta.18"
I guess this is related to #74?
This is the error:
Caught error: TypeError: this.provider.sendAsync is not a function
at RequestManager.sendAsync (./node_modules/0x.js/node_modules/web3/lib/web3/requestmanager.js:80:19)
at get (./node_modules/0x.js/node_modules/web3/lib/web3/property.js:116:33)
at ./node_modules/es6-promisify/dist/promisify.js:75:41
at Promise (<anonymous>)
at ./node_modules/es6-promisify/dist/promisify.js:54:20
at Web3Wrapper.<anonymous> (./node_modules/0x.js/lib/src/web3_wrapper.js:171:86)
at step (./node_modules/0x.js/lib/src/web3_wrapper.js:32:23)
at Object.next (./node_modules/0x.js/lib/src/web3_wrapper.js:13:53)
at ./node_modules/0x.js/lib/src/web3_wrapper.js:7:71
at Promise (<anonymous>)
at __awaiter (./node_modules/0x.js/lib/src/web3_wrapper.js:3:12)
at Web3Wrapper.getAvailableAddressesAsync (./node_modules/0x.js/lib/src/web3_wrapper.js:167:16)
at ZeroEx.<anonymous> (./node_modules/0x.js/lib/src/0x.js:204:68)
at step (./node_modules/0x.js/lib/src/0x.js:32:23)
at Object.next (./node_modules/0x.js/lib/src/0x.js:13:53)
at ./node_modules/0x.js/lib/src/0x.js:7:71
at Promise (<anonymous>)
at __awaiter (./node_modules/0x.js/lib/src/0x.js:3:12)
at ZeroEx.getAvailableAddressesAsync (./node_modules/0x.js/lib/src/0x.js:200:16)
at Object.<anonymous> (./test.js:12:8)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
This is the workaround I'm using:
provider.sendAsync = provider.send;
Using Geth: 1.7.3-stable-4bb3c89d
signOrderHashAsync(orderHash: string, signerAddress: string) //always throws: new Error(ZeroExError.InvalidSignature)
This code snipped produces a valid signature:
const signature = web3.eth.sign(makerAddress, orderHash);
const ecSignature = <ECSignature>signatureUtils.parseSignatureHexAsRSV(signature);
Probably the filter at SolidityFunction.prototype.validateArgs is wrong.
Here's an output of the command failure error:
yarn build v0.27.5
$ node_modules/.bin/tsc -p ./ && node scripts/build.js
Creating an optimized production build...
ts-loader: Using [email protected] and /Users/marczenn/Desktop/par-ui/tsconfig.json
Failed to compile.
Failed to minify the code from this file:
./node_modules/ethereum-address/index.js:3
Read more here: http://bit.ly/2tRViJ9
error Command failed with exit code 1.
How do we call the methods on the EtherTokenWrapper now that there is no way to get the WETH contract address via getContractAddress
? Are we supposed to hard-code the address somewhere?
Hi, I wanted to try your @0xproject/subproviders package in an angular dapp.
I followed the usage instructions in the readme
But when trying to do the import :
import {
ledgerEthereumBrowserClientFactoryAsync as ledgerEthereumClientFactoryAsync,
LedgerSubprovider,
} from '@0xproject/subproviders';
I get the following error:
ERROR in node_modules/@0xproject/subproviders/lib/src/subproviders/injected_web3.d.ts(6,28): error TS2503: Cannot find namespace 'Web3'.
node_modules/@0xproject/subproviders/lib/src/subproviders/ledger.d.ts(18,28): error TS2503: Cannot find namespace 'Web3'.
We currently re-fetch balances when a user fills an order. If another user fills the order however, we do not currently re-fetch balances for fillEvents
received by a client.
The fix to this should involve some kind of rate-limiting or outstanding request cancelation logic since there is no limit to the number of fillEvents
a user could receive.
exchange contract address on testrpc
https://github.com/0xProject/0x.js/blob/a767c353d25588cf5802868ee7b3710e99316e96/packages/0x.js/src/artifacts/Exchange.json#L603-L605
so the exchange contract address was set as same as EtherToken address?
This test was done on Kovan.
When using the open order book, filling an order causes an INSUFFICIENT_TAKER_ALLOWANCE
error to be thrown by the exchange simulator. It's thrown on this line: https://github.com/0xProject/0x.js/blob/development/src/utils/exchange_transfer_simulator.ts#L100
I think this is because getAllowanceAsync
using the address of the open order book's allowance returns 0 for any spender.
The Faucet can become stuck attempting to use same nonce over and over again.
Added 0x20c0418bf3dcbc66b461100a22852cb4abbdec0d to the ETH queue
Processing ETH 0x20c0418bf3dcbc66b461100a22852cb4abbdec0d
sending tx. from: 0xea95a7a25506c9f70fb7bc50877c435a609353b2 recipient: 0x20c0418bf3dcbc66b461100a22852cb4abbdec0d value: 100000000000000000
txData {"gasPrice":"0x4a817c800","nonce":"0x4e9c","gas":"0x5208","from":"0xea95a7a25506c9f70fb7bc50877c435a609353b2","to":"0x20c0418bf3dcbc66b461100a22852cb4abbdec0d","value":"0x16345785d8a0000"}
Unexpected err: [object Object] - {"code":-32010,"message":"Transaction nonce is too low. Try incrementing the nonce."}
Querying an Infura node for the latest nonce while this happens returns a valid value.
The Metamask Provider Engine Nonce Tracker
caches the getTransactionCount
response (converted into a nonce) until a later sendTransaction
successfully sends. If the returned nonce isn't valid (potential syncing node, or cached an old getTransactionCount) then this value is never cleared from the cache.
I'll create a PR to remove this Nonce Tracker and open an issue on Provider Engine to discuss. We may end up implementing our own in subproviders
or opening a PR on Provider Engine.
There is an issue with completely removing Nonce Tacker. Under high load we may attempt to re-use a nonce and that results in a error:
Unexpected err: [object Object] - {"code":-32010,"message":"Transaction with the same hash was already imported."}
But at least this error is recoverable as the user just has to retry again. Using the Nonce Tracker in its current form will get us stuck forever.
I was poking around in 0x.js and the contracts, and it looks like 0x.js will happily pass along a negative value for takerTokenAmount
(via zeroEx.exchange.fillOrderAsync
) to the contract's exchange.fillOrder
. When a negative BigNumber meets uint256, you end up trying to buy 10^17 of something (or the entire order, whichever's smaller), which is probably not what you wanted!
See input data field [11] in this transaction (takerTokenAmount
), which was filled with a very small negative number: https://kovan.etherscan.io/tx/0x8c83193f05137eb682e0ab41dd2bfdae43db84b5704588761eb08d48547e588b
Example
Object.assign(feesRequest, {
makerTokenAmount: new BigNumber(makerTokenAmount), // units offered
takerTokenAmount: new BigNumber(takerTokenAmount), // units requested
})
console.log(typeof feesRequest.makerTokenAmount) // BigNumber
const feesResponse = await relayerClient.getFeesAsync(feesRequest)
console.log(typeof feesRequest.makerTokenAmount) // string
Looks like node-hid is the probably cause of the failure
This is a clean ubuntu install, is anyone else having similar issues?
error /home/pelsasser/0x.js/node_modules/node-hid: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /home/pelsasser/0x.js/node_modules/node-hid
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp info check checked for "/home/pelsasser/0x.js/node_modules/node-hid/build/Release/HID.node" (not found)
node-pre-gyp http GET https://github.com/node-hid/node-hid/releases/download/0.5.4/HID-v0.5.4-node-v57-linux-x64.tar.gz
node-pre-gyp http 404 https://github.com/node-hid/node-hid/releases/download/0.5.4/HID-v0.5.4-node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Tried to download(404): https://github.com/node-hid/node-hid/releases/download/0.5.4/HID-v0.5.4-node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://github.com/node-hid/node-hid/releases/download/0.5.4/HID-v0.5.4-node-v57-linux-x64.tar.gz
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/pelsasser/0x.js/node_modules/node-hid/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/pelsasser/.node-gyp/8.9.4/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/pelsasser/.node-gyp/8.9.4',
gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/pelsasser/.node-gyp/8.9.4/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/pelsasser/0x.js/node_modules/node-hid',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/pelsasser/0x.js/node_modules/node-hid/build'
CC(target) Release/obj.target/hidapi/hidapi/libusb/hid.o
../hidapi/libusb/hid.c:47:20: fatal error: libusb.h: No such file or directory
compilation terminated.
hidapi.target.mk:97: recipe for target 'Release/obj.target/hidapi/hidapi/libusb/hid.o' failed
make: Leaving directory '/home/pelsasser/0x.js/node_modules/node-hid/build'
make: *** [Release/obj.target/hidapi/hidapi/libusb/hid.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.10.0-28-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/pelsasser/0x.js/node_modules/node-hid/build/Release/HID.node" "--module_name=HID" "--module_path=/home/pelsasser/0x.js/node_modules/node-hid/build/Release"
gyp ERR! cwd /home/pelsasser/0x.js/node_modules/node-hid
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/pelsasser/0x.js/node_modules/node-hid/build/Release/HID.node --module_name=HID --module_path=/home/pelsasser/0x.js/node_modules/node-hid/build/Release' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pelsasser/0x.js/node_modules/node-hid/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.10.0-28-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/pelsasser/0x.js/node_modules/node-hid/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pelsasser/0x.js/node_modules/node-hid
node-pre-gyp ERR! node -v v8.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Partials used in abi-gen need to have the .mustache
suffix to work, while at the same time abi-gen expect Handlebar templates. This confuses users as well as IDEs and stops them from coloring properly.
In 0x Portal, I intermittently receive the following error originating from 0x.js:
Cannot read property 'unsubscribeFromOnLogAdded' of undefined
From this line:
https://github.com/0xProject/0x.js/blob/development/packages/0x.js/src/contract_wrappers/contract_wrapper.ts#L168
Inspecting the code, it seems that _blockAndLogStreamer
should actually be called _blockAndLogStreamerIfExists
since it can be undefined. Further, we should check whether it exists before calling methods on it.
It would also be good to figure out why _stopBlockAndLogStream
is being called multiple times.
I get this error:
Error: Checksummed addresses are not supported. Convert spenderAddress to lower case before passing
when I call
const txHash = await zeroEx.token.setProxyAllowanceAsync(
this.address,
walletStore.availableAddresses[0],
ZeroEx.toBaseUnitAmount(amount, 18)
)
I am using version 0.28.0
I am passing ownerAdress and tokenAdress to that call, I tried putting both into lowerCase, but that does not help.
Hi! I really like the project but I'm missing a contribution guide right now. Having one with steps on getting the project up and running would be great!
Hi, moving from Issue #133 as I'm unable to reopen the same. I'm still unable to solve this. Intend to use infura as I cannot run a local geth node. Here is the code I am using:
const Web3 = require('web3');
const Accounts=require('web3-eth-accounts');
const HookedWeb3Provider=require("hooked-web3-provider");
const ZeroEx = require('0x.js').ZeroEx;
const BigNumber = require('bignumber.js');
const KOVAN_ENDPOINT='https://kovan.infura.io/';
(async () => {
var web3=new Web3(new Web3.providers.HttpProvider(KOVAN_ENDPOINT));
var accounts =new Accounts(KOVAN_ENDPOINT);
// Creating a new Account
var logAcc=web3.eth.accounts.privateKeyToAccount("528d53be9f33de80d68b148aac930b9ab757d798ef251bcbdcfd94b95961144a");
console.log(logAcc);
var zeroEx = new ZeroEx(web3.currentProvider); // Number of decimals to use (for ETH and ZRX)
const DECIMALS = 18; // Addresses
const NULL_ADDRESS = ZeroEx.NULL_ADDRESS;
console.log("Null address is "+NULL_ADDRESS); // Ethereum Null address
const WETH_ADDRESS = await zeroEx.etherToken.getContractAddressAsync();
console.log("ETH token address is "+ WETH_ADDRESS); // The wrapped ETH token contract
const ZRX_ADDRESS = await zeroEx.exchange.getZRXTokenAddressAsync();
console.log("ZeroEx Address is "+ ZRX_ADDRESS) // The ZRX token contract
const EXCHANGE_ADDRESS = await zeroEx.exchange.getContractAddressAsync(); // The Exchange.sol address (0x exchange smart contract)
console.log("Exchange address is "+ EXCHANGE_ADDRESS);
var account = await zeroEx.getAvailableAddressesAsync();
console.log(account);
})().catch(console.log);
I have created an account with a private key and am able to sign the order hash with web3.eth.accounts.sign() but in that case my vrs signatures generated do not match.
I intend to use the standard ZeroEx functions but the function zeroEx.getAvailableAddressesAsync() returns null value even though my web3 object has accounts json associated with it.
Can you please provide a sample of using your standard method with infura ?
Network: Kovan
Web3 provider: MetaMask
Token address (WETH): 0x05d090b51c40b020eab3bfcb6a2dff130df22e9c
Owner address: 0xd5a5643589a2f017eb9545aed4c8c6d19930a008
Returned value: 115792089237316195423570985008687907853269984665640564039457584007913129639935
When I check the allowance on kovan.etherscan.io, it's 0. For a little context, I did test the Radar Relay app a couple of days ago, and used their wrap/unwrap function for WETH/ETH. I first wrapped some ETH and then unwrapped all of it.
It seems 0x connect is using the isomorphic-fetch
library which has no support for react-native. More specifically, I'm getting the following error:
Can't find variable: self
<unknown>
fetch-npm-browserify.js:6:22
loadModuleImplementation
require.js:213:12
<unknown>
http_client.js:40
loadModuleImplementation
require.js:213:12
<unknown>
index.js:3:20
loadModuleImplementation
require.js:213:12
<unknown>
....js:8
loadModuleImplementation
require.js:213:12
<unknown>
index.js:1
loadModuleImplementation
require.js:213:12
<unknown>
<unknown file>:0
loadModuleImplementation
require.js:213:12
<unknown>
index.js:8
loadModuleImplementation
require.js:213:12
<unknown>
index.js:4
loadModuleImplementation
require.js:213:12
guardedLoadModule
require.js:140:45
global code
<unknown file>:0
This is coming from here: https://github.com/matthew-andrews/isomorphic-fetch/blob/master/fetch-npm-browserify.js#L6.
For now, I've been changing instances of self
to global
.
Hi, we have developed a project on Ethereum, currently on testnet. I have a requirement that would require integration with 0x.js. I have successfully fetched results from methods like getBalanceAsync but am unable to understand which API would be used to create an order. Can someone please help.
Just did a node install from their pkg download on a brand new machine. Running npm install fails, but
a) yarn works fine and
b) npm installing other packages works fine
node -v
v9.3.0
npm -v
5.6.0
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone -q https://github.com/frozeman/bignumber.js-nolookahead.git /Users/tomhschmidt/.npm/_cacache/tmp/git-clone-58bc61de
npm ERR! /Users/tomhschmidt/.npm/_cacache/tmp/git-clone-58bc61de/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tomhschmidt/.npm/_logs/2018-01-09T18_39_14_375Z-debug.log
macbook-pro:pipeline tomhschmidt$ sudo npm install --save 0x.js
Password:
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone -q https://github.com/frozeman/bignumber.js-nolookahead.git /Users/tomhschmidt/.npm/_cacache/tmp/git-clone-42a0a849
npm ERR! /Users/tomhschmidt/.npm/_cacache/tmp/git-clone-42a0a849/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tomhschmidt/.npm/_logs/2018-01-09T19_30_18_792Z-debug.log
Right now, we only allow a static gasPrice to be set on instantiation of a ZeroEx object via a ZeroExConfig instance passed into the constructor. We should introduce a way to dynamically set gas price per transaction and default to the initial, static gasPrice when none is provided
Using [email protected]
const ProviderEngine = require('web3-provider-engine')
const FilterSubprovider = require('web3-provider-engine/subproviders/filters')
const RpcSubprovider = require('web3-provider-engine/subproviders/rpc')
const { ZeroEx } = require('0x.js')
const providerEngine = new ProviderEngine()
const rpcUrl = 'https://kovan.infura.io/MYINFURATOKEN'
providerEngine.addProvider(new FilterSubprovider())
providerEngine.addProvider(new RpcSubprovider({ rpcUrl }))
providerEngine.start()
const zeroEx = new ZeroEx(providerEngine)
zeroEx.exchange.subscribeAsync('LogFill', {}, console.log)
.then(console.log)
.catch(console.error)
When running this script with node I get repeated UnhandledPromiseRejectionWarning
messages on the console.
Is there are a reason these interfaces need to be different? I think it would make more sense if we stick to either fillTakerAmount
or takerTokenFillAmount
for both of these interfaces
Interface OrderFillOrKillRequest
{
fillTakerAmount: BigNumber,
signedOrder: SignedOrder,
}
Interface OrderFillRequest
{
signedOrder: SignedOrder,
takerTokenFillAmount: BigNumber,
}
I am just importing with import { ZeroEx } from '0x.js'
per docs and I am getting loads of errors:
ERROR in [at-loader] ./node_modules/0x.js/lib/src/contract_wrappers/contract_wrapper.d.ts:2:23
TS2497: Module '"/home/capaj/git_projects/dextroid/frontend/node_modules/web3/index"' resolves to a non-module entity and cannot be imported using this construct.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/contract_wrappers/contract_wrapper.d.ts:18:151
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/contract_wrappers/contract_wrapper.d.ts:19:178
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/contract_wrappers/contract_wrapper.d.ts:20:78
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/contract_wrappers/contract_wrapper.d.ts:21:104
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/contract_wrappers/exchange_wrapper.d.ts:3:23
TS2497: Module '"/home/capaj/git_projects/dextroid/frontend/node_modules/web3/index"' resolves to a non-module entity and cannot be imported using this construct.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/contract_wrappers/exchange_wrapper.d.ts:226:77
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:3:23
TS2497: Module '"/home/capaj/git_projects/dextroid/frontend/node_modules/web3/index"' resolves to a non-module entity and cannot be imported using this construct.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:41:32
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:86:30
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:226:36
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:254:55
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:257:54
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:262:10
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:273:20
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/types.d.ts:282:36
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/utils/abi_decoder.d.ts:1:23
TS2497: Module '"/home/capaj/git_projects/dextroid/frontend/node_modules/web3/index"' resolves to a non-module entity and cannot be imported using this construct.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/utils/abi_decoder.d.ts:7:28
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/0x.js/lib/src/utils/abi_decoder.d.ts:8:67
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/types/lib/index.d.ts:2:23
TS2497: Module '"/home/capaj/git_projects/dextroid/frontend/node_modules/web3/index"' resolves to a non-module entity and cannot be imported using this construct.
ERROR in [at-loader] ./node_modules/@0xproject/types/lib/index.d.ts:23:11
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:3:23
TS2497: Module '"/home/capaj/git_projects/dextroid/frontend/node_modules/web3/index"' resolves to a non-module entity and cannot be imported using this construct.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:8:27
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:10:27
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:16:27
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:22:40
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:22:66
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:23:49
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:25:26
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:25:54
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:26:29
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:26:48
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:27:30
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./node_modules/@0xproject/web3-wrapper/lib/index.d.ts:27:66
TS2503: Cannot find namespace 'Web3'.
ERROR in [at-loader] ./src/stores/index.ts:7:30
TS2304: Cannot find name 'web3'.
webpack: Failed to compile.
All the links in the abi-gen package (https://github.com/0xProject/0x.js/tree/development/packages/abi-gen) point to non existing resources resulting in 404
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.