Merge branch 'master' into fill-order-amuont
This commit is contained in:
@@ -15,7 +15,9 @@
|
||||
"prebuild": "npm run clean",
|
||||
"build": "run-p build:*:prod",
|
||||
"prepublish": "run-p build:umd:prod build:commonjs:dev",
|
||||
"postpublish": "publish-release --assets _bundles/index.js,_bundles/index.min.js",
|
||||
"postpublish": "run-s release docs:json upload_docs_json",
|
||||
"release": "publish-release --assets _bundles/index.js,_bundles/index.min.js",
|
||||
"upload_docs_json": "aws s3 cp docs/index.json s3://0xjs-docs-jsons/$(git describe --tags).json --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type aplication/json",
|
||||
"lint": "tslint src/*.ts test/*.ts",
|
||||
"test": "run-s clean test:commonjs",
|
||||
"test:umd": "./scripts/test_umd.sh",
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import isUndefined = require('lodash/isUndefined');
|
||||
import * as _ from 'lodash';
|
||||
import * as BigNumber from 'bignumber.js';
|
||||
import {bigNumberConfigs} from './bignumber_config';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
@@ -239,10 +239,10 @@ export class ZeroEx {
|
||||
}
|
||||
private async _getExchangeAddressAsync() {
|
||||
const networkIdIfExists = await this._web3Wrapper.getNetworkIdIfExistsAsync();
|
||||
const exchangeNetworkConfigsIfExists = isUndefined(networkIdIfExists) ?
|
||||
const exchangeNetworkConfigsIfExists = _.isUndefined(networkIdIfExists) ?
|
||||
undefined :
|
||||
(ExchangeArtifacts as any).networks[networkIdIfExists];
|
||||
if (isUndefined(exchangeNetworkConfigsIfExists)) {
|
||||
if (_.isUndefined(exchangeNetworkConfigsIfExists)) {
|
||||
throw new Error(ZeroExError.CONTRACT_NOT_DEPLOYED_ON_NETWORK);
|
||||
}
|
||||
const exchangeAddress = exchangeNetworkConfigsIfExists.address;
|
||||
|
@@ -229,8 +229,59 @@
|
||||
"type": "event"
|
||||
}
|
||||
],
|
||||
"unlinked_binary": "0x606060405234610000575b61072d806100196000396000f300606060405236156100935763ffffffff60e060020a60003504166306fdde038114610098578063095ea7b31461012557806318160ddd1461015557806323b872dd146101745780632e1a7d4d146101aa578063313ce567146101bc57806370a08231146101df57806395d89b411461020a578063a9059cbb14610297578063d0e30db0146102c7578063dd62ed3e146102d1575b610000565b34610000576100a5610302565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3461000057610141600160a060020a0360043516602435610339565b604080519115158252519081900360200190f35b34610000576101626103a4565b60408051918252519081900360200190f35b3461000057610141600160a060020a03600435811690602435166044356103aa565b604080519115158252519081900360200190f35b34610000576101ba6004356104a7565b005b34610000576101c9610527565b6040805160ff9092168252519081900360200190f35b3461000057610162600160a060020a036004351661052c565b60408051918252519081900360200190f35b34610000576100a561054b565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3461000057610141600160a060020a0360043516602435610582565b604080519115158252519081900360200190f35b6101ba610634565b005b3461000057610162600160a060020a0360043581169060243516610683565b60408051918252519081900360200190f35b60408051808201909152600b81527f457468657220546f6b656e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120546103cd90836106b0565b600160a060020a03808616600090815260208181526040808320949094556001815283822033909316825291909152205461040890836106b0565b600160a060020a0380861660009081526001602090815260408083203385168452825280832094909455918616815290819052205461044790836106c9565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060015b9392505050565b600160a060020a0333166000908152602081905260409020546104ca90826106b0565b600160a060020a0333166000908152602081905260409020556002546104f090826106b0565b600255604051600160a060020a0333169082156108fc029083906000818181858888f19350505050151561052357610000565b5b50565b601281565b600160a060020a0381166000908152602081905260409020545b919050565b60408051808201909152600481527f5745544800000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a0333166000908152602081905260408120546105a590836106b0565b600160a060020a0333811660009081526020819052604080822093909355908516815220546105d490836106c9565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060015b92915050565b600160a060020a03331660009081526020819052604090205461065790346106c9565b600160a060020a03331660009081526020819052604090205560025461067d90346106c9565b6002555b565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b60006106be838311156106f1565b508082035b92915050565b60008282016106e68482108015906106e15750838210155b6106f1565b8091505b5092915050565b80151561052357610000565b5b505600a165627a7a72305820dd221653234069427a90e77c21585b4e7c7f669edbf89a71a57b5bccb1ab42a50029",
|
||||
"unlinked_binary": "0x606060405234610000575b61072d806100196000396000f300606060405236156100935763ffffffff60e060020a60003504166306fdde038114610098578063095ea7b31461012557806318160ddd1461015557806323b872dd146101745780632e1a7d4d146101aa578063313ce567146101bc57806370a08231146101df57806395d89b411461020a578063a9059cbb14610297578063d0e30db0146102c7578063dd62ed3e146102d1575b610000565b34610000576100a5610302565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3461000057610141600160a060020a0360043516602435610339565b604080519115158252519081900360200190f35b34610000576101626103a4565b60408051918252519081900360200190f35b3461000057610141600160a060020a03600435811690602435166044356103aa565b604080519115158252519081900360200190f35b34610000576101ba6004356104a7565b005b34610000576101c9610527565b6040805160ff9092168252519081900360200190f35b3461000057610162600160a060020a036004351661052c565b60408051918252519081900360200190f35b34610000576100a561054b565b6040805160208082528351818301528351919283929083019185019080838382156100eb575b8051825260208311156100eb57601f1990920191602091820191016100cb565b505050905090810190601f1680156101175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3461000057610141600160a060020a0360043516602435610582565b604080519115158252519081900360200190f35b6101ba610634565b005b3461000057610162600160a060020a0360043581169060243516610683565b60408051918252519081900360200190f35b60408051808201909152600b81527f457468657220546f6b656e000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120546103cd90836106b0565b600160a060020a03808616600090815260208181526040808320949094556001815283822033909316825291909152205461040890836106b0565b600160a060020a0380861660009081526001602090815260408083203385168452825280832094909455918616815290819052205461044790836106c9565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060015b9392505050565b600160a060020a0333166000908152602081905260409020546104ca90826106b0565b600160a060020a0333166000908152602081905260409020556002546104f090826106b0565b600255604051600160a060020a0333169082156108fc029083906000818181858888f19350505050151561052357610000565b5b50565b601281565b600160a060020a0381166000908152602081905260409020545b919050565b60408051808201909152600481527f5745544800000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a0333166000908152602081905260408120546105a590836106b0565b600160a060020a0333811660009081526020819052604080822093909355908516815220546105d490836106c9565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060015b92915050565b600160a060020a03331660009081526020819052604090205461065790346106c9565b600160a060020a03331660009081526020819052604090205560025461067d90346106c9565b6002555b565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b60006106be838311156106f1565b508082035b92915050565b60008282016106e68482108015906106e15750838210155b6106f1565b8091505b5092915050565b80151561052357610000565b5b505600a165627a7a72305820c7cc457bf87c8b3047275eaa71935a1612af007e4bc77d832c588245805374480029",
|
||||
"networks": {
|
||||
"42": {
|
||||
"links": {},
|
||||
"events": {
|
||||
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": {
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": {
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
}
|
||||
},
|
||||
"updated_at": 1496294576956,
|
||||
"address": "0x771a1bff4a50b59407bee508e9934e8c10feac3e"
|
||||
},
|
||||
"50": {
|
||||
"links": {},
|
||||
"events": {
|
||||
@@ -279,10 +330,10 @@
|
||||
"type": "event"
|
||||
}
|
||||
},
|
||||
"updated_at": 1496427473670,
|
||||
"updated_at": 1495030736786,
|
||||
"address": "0x48bacb9266a570d521063ef5dd96e61686dbe788"
|
||||
}
|
||||
},
|
||||
"schema_version": "0.0.5",
|
||||
"updated_at": 1496427473670
|
||||
"updated_at": 1496294576956
|
||||
}
|
File diff suppressed because one or more lines are too long
@@ -182,8 +182,8 @@
|
||||
"type": "event"
|
||||
}
|
||||
],
|
||||
"unlinked_binary": "0x606060405234610000575b6104e7806100196000396000f300606060405236156100675763ffffffff60e060020a600035041663095ea7b3811461006c57806318160ddd1461009c57806323b872dd146100bb57806370a08231146100f1578063a0712d681461011c578063a9059cbb1461012e578063dd62ed3e1461015e575b610000565b3461000057610088600160a060020a036004351660243561018f565b604080519115158252519081900360200190f35b34610000576100a96101fa565b60408051918252519081900360200190f35b3461000057610088600160a060020a0360043581169060243516604435610200565b604080519115158252519081900360200190f35b34610000576100a9600160a060020a036004351661030d565b60408051918252519081900360200190f35b346100005761012c60043561032c565b005b3461000057610088600160a060020a0360043516602435610393565b604080519115158252519081900360200190f35b34610000576100a9600160a060020a0360043581169060243516610456565b60408051918252519081900360200190f35b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120548290108015906102505750600160a060020a0380851660009081526001602090815260408083203390941683529290522054829010155b80156102755750600160a060020a038316600090815260208190526040902054828101115b1561030157600160a060020a0380841660008181526020818152604080832080548801905588851680845281842080548990039055600183528184203390961684529482529182902080548790039055815186815291519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001610305565b5060005b5b9392505050565b600160a060020a0381166000908152602081905260409020545b919050565b68056bc75e2d6310000081111561034257610000565b600160a060020a033316600090815260208190526040902054610366908290610483565b600160a060020a03331660009081526020819052604090205560025461038c9082610483565b6002555b50565b600160a060020a0333166000908152602081905260408120548290108015906103d55750600160a060020a038316600090815260208190526040902054828101115b1561044757600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060016101f4565b5060006101f4565b5b92915050565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b60008282016104a084821080159061049b5750838210155b6104ab565b8091505b5092915050565b80151561039057610000565b5b505600a165627a7a72305820ee38e175a277bbcf215259201687857177c3da8e0da65470b4f7c1eb1c95a21a0029",
|
||||
"unlinked_binary": "0x606060405234610000575b6104e7806100196000396000f300606060405236156100675763ffffffff60e060020a600035041663095ea7b3811461006c57806318160ddd1461009c57806323b872dd146100bb57806370a08231146100f1578063a0712d681461011c578063a9059cbb1461012e578063dd62ed3e1461015e575b610000565b3461000057610088600160a060020a036004351660243561018f565b604080519115158252519081900360200190f35b34610000576100a96101fa565b60408051918252519081900360200190f35b3461000057610088600160a060020a0360043581169060243516604435610200565b604080519115158252519081900360200190f35b34610000576100a9600160a060020a036004351661030d565b60408051918252519081900360200190f35b346100005761012c60043561032c565b005b3461000057610088600160a060020a0360043516602435610393565b604080519115158252519081900360200190f35b34610000576100a9600160a060020a0360043581169060243516610456565b60408051918252519081900360200190f35b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60025481565b600160a060020a0383166000908152602081905260408120548290108015906102505750600160a060020a0380851660009081526001602090815260408083203390941683529290522054829010155b80156102755750600160a060020a038316600090815260208190526040902054828101115b1561030157600160a060020a0380841660008181526020818152604080832080548801905588851680845281842080548990039055600183528184203390961684529482529182902080548790039055815186815291519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3506001610305565b5060005b5b9392505050565b600160a060020a0381166000908152602081905260409020545b919050565b68056bc75e2d6310000081111561034257610000565b600160a060020a033316600090815260208190526040902054610366908290610483565b600160a060020a03331660009081526020819052604090205560025461038c9082610483565b6002555b50565b600160a060020a0333166000908152602081905260408120548290108015906103d55750600160a060020a038316600090815260208190526040902054828101115b1561044757600160a060020a0333811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060016101f4565b5060006101f4565b5b92915050565b600160a060020a038083166000908152600160209081526040808320938516835292905220545b92915050565b60008282016104a084821080159061049b5750838210155b6104ab565b8091505b5092915050565b80151561039057610000565b5b505600a165627a7a723058204789b7d0fd9aae8d16b771c1b12c5863cfa8aaef739d2d811f91e447ee450bce0029",
|
||||
"networks": {},
|
||||
"schema_version": "0.0.5",
|
||||
"updated_at": 1496427420920
|
||||
"updated_at": 1496294434244
|
||||
}
|
@@ -177,8 +177,49 @@
|
||||
"type": "event"
|
||||
}
|
||||
],
|
||||
"unlinked_binary": "0x60606040525b60008054600160a060020a03191633600160a060020a03161790555b5b610701806100316000396000f300606060405236156100725763ffffffff60e060020a60003504166315dacbea811461007757806342f1181e146100b3578063494503d4146100e0578063707129391461010c5780638da5cb5b14610139578063b918161114610162578063d39de6e91461018f578063f2fde38b146101f7575b610000565b346100005761009f600160a060020a0360043581169060243581169060443516606435610212565b604080519115158252519081900360200190f35b346100005761009f600160a060020a03600435166102d8565b604080519115158252519081900360200190f35b34610000576100f06004356103f5565b60408051600160a060020a039092168252519081900360200190f35b346100005761009f600160a060020a0360043516610425565b604080519115158252519081900360200190f35b34610000576100f06105ee565b60408051600160a060020a039092168252519081900360200190f35b346100005761009f600160a060020a03600435166105fd565b604080519115158252519081900360200190f35b346100005761019c610612565b60408051602080825283518183015283519192839290830191858101910280838382156101e4575b8051825260208311156101e457601f1990920191602091820191016101c4565b5050509050019250505060405180910390f35b3461000057610210600160a060020a036004351661067d565b005b600160a060020a03331660009081526001602052604081205460ff16151561023957610000565b604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301528781166024830152604482018790529351938916936323b872dd9360648084019491938390030190829087803b156100005760325a03f11561000057505060405151151590506102cb57610000565b5060015b5b949350505050565b6000805433600160a060020a039081169116146102f457610000565b600160a060020a038216600090815260016020526040902054829060ff161561031c57610000565b600160a060020a0383166000908152600160208190526040909120805460ff191682179055600280549182018082559091908281838015829011610385576000838152602090206103859181019083015b80821115610381576000815560010161036d565b5090565b5b505050916000526020600020900160005b81546101009190910a600160a060020a0381810219909216878316918202179092556040513390911692507f94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca90600090a3600191505b5b505b919050565b600281815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b60008054819033600160a060020a0390811691161461044357610000565b600160a060020a038316600090815260016020526040902054839060ff16151561046c57610000565b600160a060020a0384166000908152600160205260408120805460ff1916905591505b6002548210156105a75783600160a060020a0316600283815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561059b576002805460001981019081101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600283815481101561000057906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506001600281818054905003915081815481835581811511610591576000838152602090206105919181019083015b80821115610381576000815560010161036d565b5090565b5b505050506105a7565b5b60019091019061048f565b604051600160a060020a0333811691908616907ff5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c90600090a3600192505b5b505b50919050565b600054600160a060020a031681565b60016020526000908152604090205460ff1681565b60408051602081810183526000825260028054845181840281018401909552808552929392909183018282801561067257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610654575b505050505090505b90565b60005433600160a060020a0390811691161461069857610000565b600160a060020a038116156106d0576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b505600a165627a7a72305820f2ffcbe9ff4a73a57b4b40b848879fd6fd1de0cb036195f9541c0a579d2a8b8a0029",
|
||||
"unlinked_binary": "0x60606040525b60008054600160a060020a03191633600160a060020a03161790555b5b610701806100316000396000f300606060405236156100725763ffffffff60e060020a60003504166315dacbea811461007757806342f1181e146100b3578063494503d4146100e0578063707129391461010c5780638da5cb5b14610139578063b918161114610162578063d39de6e91461018f578063f2fde38b146101f7575b610000565b346100005761009f600160a060020a0360043581169060243581169060443516606435610212565b604080519115158252519081900360200190f35b346100005761009f600160a060020a03600435166102d8565b604080519115158252519081900360200190f35b34610000576100f06004356103f5565b60408051600160a060020a039092168252519081900360200190f35b346100005761009f600160a060020a0360043516610425565b604080519115158252519081900360200190f35b34610000576100f06105ee565b60408051600160a060020a039092168252519081900360200190f35b346100005761009f600160a060020a03600435166105fd565b604080519115158252519081900360200190f35b346100005761019c610612565b60408051602080825283518183015283519192839290830191858101910280838382156101e4575b8051825260208311156101e457601f1990920191602091820191016101c4565b5050509050019250505060405180910390f35b3461000057610210600160a060020a036004351661067d565b005b600160a060020a03331660009081526001602052604081205460ff16151561023957610000565b604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301528781166024830152604482018790529351938916936323b872dd9360648084019491938390030190829087803b156100005760325a03f11561000057505060405151151590506102cb57610000565b5060015b5b949350505050565b6000805433600160a060020a039081169116146102f457610000565b600160a060020a038216600090815260016020526040902054829060ff161561031c57610000565b600160a060020a0383166000908152600160208190526040909120805460ff191682179055600280549182018082559091908281838015829011610385576000838152602090206103859181019083015b80821115610381576000815560010161036d565b5090565b5b505050916000526020600020900160005b81546101009190910a600160a060020a0381810219909216878316918202179092556040513390911692507f94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca90600090a3600191505b5b505b919050565b600281815481101561000057906000526020600020900160005b915054906101000a9004600160a060020a031681565b60008054819033600160a060020a0390811691161461044357610000565b600160a060020a038316600090815260016020526040902054839060ff16151561046c57610000565b600160a060020a0384166000908152600160205260408120805460ff1916905591505b6002548210156105a75783600160a060020a0316600283815481101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a0316141561059b576002805460001981019081101561000057906000526020600020900160005b9054906101000a9004600160a060020a0316600283815481101561000057906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506001600281818054905003915081815481835581811511610591576000838152602090206105919181019083015b80821115610381576000815560010161036d565b5090565b5b505050506105a7565b5b60019091019061048f565b604051600160a060020a0333811691908616907ff5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c90600090a3600192505b5b505b50919050565b600054600160a060020a031681565b60016020526000908152604090205460ff1681565b60408051602081810183526000825260028054845181840281018401909552808552929392909183018282801561067257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610654575b505050505090505b90565b60005433600160a060020a0390811691161461069857610000565b600160a060020a038116156106d0576000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b505600a165627a7a72305820e094d2460f9f11db4e36cf6e7af1eb1f6fb883275fea375d814c23e81802753b0029",
|
||||
"networks": {
|
||||
"42": {
|
||||
"links": {},
|
||||
"events": {
|
||||
"0x94bb87f4c15c4587ff559a7584006fa01ddf9299359be6b512b94527aa961aca": {
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "caller",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogAuthorizedAddressAdded",
|
||||
"type": "event"
|
||||
},
|
||||
"0xf5b347a1e40749dd050f5f07fbdbeb7e3efa9756903044dd29401fd1d4bb4a1c": {
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "caller",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogAuthorizedAddressRemoved",
|
||||
"type": "event"
|
||||
}
|
||||
},
|
||||
"updated_at": 1496294576942,
|
||||
"address": "0x946a1c437fb5a61bd5c95416346e684c802c5d2a"
|
||||
},
|
||||
"50": {
|
||||
"links": {},
|
||||
"events": {
|
||||
@@ -217,10 +258,10 @@
|
||||
"type": "event"
|
||||
}
|
||||
},
|
||||
"updated_at": 1496427473664,
|
||||
"updated_at": 1495030736781,
|
||||
"address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c"
|
||||
}
|
||||
},
|
||||
"schema_version": "0.0.5",
|
||||
"updated_at": 1496427473664
|
||||
"updated_at": 1496294576942
|
||||
}
|
@@ -169,8 +169,8 @@
|
||||
"type": "event"
|
||||
}
|
||||
],
|
||||
"unlinked_binary": "0x606060405234610000575b6101d1806100196000396000f3006060604052361561005c5763ffffffff60e060020a600035041663095ea7b3811461006157806318160ddd1461009157806323b872dd146100b057806370a08231146100e6578063a9059cbb14610061578063dd62ed3e14610141575b610000565b346100005761007d600160a060020a0360043516602435610172565b604080519115158252519081900360200190f35b346100005761009e61017b565b60408051918252519081900360200190f35b346100005761007d600160a060020a0360043581169060243516604435610181565b604080519115158252519081900360200190f35b346100005761009e600160a060020a036004351661018b565b60408051918252519081900360200190f35b346100005761007d600160a060020a0360043516602435610172565b604080519115158252519081900360200190f35b346100005761009e600160a060020a0360043581169060243516610172565b60408051918252519081900360200190f35b60005b92915050565b60005b90565b60005b9392505050565b60005b919050565b60005b92915050565b60005b929150505600a165627a7a7230582091fa49296e1416a21d33862878c9ba9a9f7db53c284ddea5857ea6eb7f5c1d180029",
|
||||
"unlinked_binary": "0x606060405234610000575b6101d1806100196000396000f3006060604052361561005c5763ffffffff60e060020a600035041663095ea7b3811461006157806318160ddd1461009157806323b872dd146100b057806370a08231146100e6578063a9059cbb14610061578063dd62ed3e14610141575b610000565b346100005761007d600160a060020a0360043516602435610172565b604080519115158252519081900360200190f35b346100005761009e61017b565b60408051918252519081900360200190f35b346100005761007d600160a060020a0360043581169060243516604435610181565b604080519115158252519081900360200190f35b346100005761009e600160a060020a036004351661018b565b60408051918252519081900360200190f35b346100005761007d600160a060020a0360043516602435610172565b604080519115158252519081900360200190f35b346100005761009e600160a060020a0360043581169060243516610172565b60408051918252519081900360200190f35b60005b92915050565b60005b90565b60005b9392505050565b60005b919050565b60005b92915050565b60005b929150505600a165627a7a7230582041bf388c3189085f6807945974edea68192611a83cc2920536293b220d1e7fcb0029",
|
||||
"networks": {},
|
||||
"schema_version": "0.0.5",
|
||||
"updated_at": 1496427420921
|
||||
"updated_at": 1496294434247
|
||||
}
|
File diff suppressed because one or more lines are too long
@@ -1,5 +1,4 @@
|
||||
import includes = require('lodash/includes');
|
||||
import isUndefined = require('lodash/isUndefined');
|
||||
import * as _ from 'lodash';
|
||||
import contract = require('truffle-contract');
|
||||
import {Web3Wrapper} from '../web3_wrapper';
|
||||
import {ZeroExError, Artifact, ContractInstance} from '../types';
|
||||
@@ -16,17 +15,17 @@ export class ContractWrapper {
|
||||
c.setProvider(providerObj);
|
||||
|
||||
const networkIdIfExists = await this._web3Wrapper.getNetworkIdIfExistsAsync();
|
||||
const artifactNetworkConfigs = isUndefined(networkIdIfExists) ?
|
||||
const artifactNetworkConfigs = _.isUndefined(networkIdIfExists) ?
|
||||
undefined :
|
||||
artifact.networks[networkIdIfExists];
|
||||
let contractAddress;
|
||||
if (!isUndefined(address)) {
|
||||
if (!_.isUndefined(address)) {
|
||||
contractAddress = address;
|
||||
} else if (!isUndefined(artifactNetworkConfigs)) {
|
||||
} else if (!_.isUndefined(artifactNetworkConfigs)) {
|
||||
contractAddress = artifactNetworkConfigs.address;
|
||||
}
|
||||
|
||||
if (!isUndefined(contractAddress)) {
|
||||
if (!_.isUndefined(contractAddress)) {
|
||||
const doesContractExist = await this._web3Wrapper.doesContractExistAtAddressAsync(contractAddress);
|
||||
if (!doesContractExist) {
|
||||
throw new Error(ZeroExError.CONTRACT_DOES_NOT_EXIST);
|
||||
@@ -34,11 +33,11 @@ export class ContractWrapper {
|
||||
}
|
||||
|
||||
try {
|
||||
const contractInstance = isUndefined(address) ? await c.deployed() : await c.at(address);
|
||||
const contractInstance = _.isUndefined(address) ? await c.deployed() : await c.at(address);
|
||||
return contractInstance;
|
||||
} catch (err) {
|
||||
const errMsg = `${err}`;
|
||||
if (includes(errMsg, 'not been deployed to detected network')) {
|
||||
if (_.includes(errMsg, 'not been deployed to detected network')) {
|
||||
throw new Error(ZeroExError.CONTRACT_DOES_NOT_EXIST);
|
||||
} else {
|
||||
utils.consoleLog(`Notice: Error encountered: ${err} ${err.stack}`);
|
||||
|
@@ -1,9 +1,4 @@
|
||||
import map = require('lodash/map');
|
||||
import isEmpty = require('lodash/isEmpty');
|
||||
import find = require('lodash/find');
|
||||
import each = require('lodash/each');
|
||||
import isUndefined = require('lodash/isUndefined');
|
||||
import unzip = require('lodash/unzip');
|
||||
import * as _ from 'lodash';
|
||||
import * as BigNumber from 'bignumber.js';
|
||||
import promisify = require('es6-promisify');
|
||||
import {Web3Wrapper} from '../web3_wrapper';
|
||||
@@ -210,7 +205,7 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
@decorators.contractCallErrorHandler
|
||||
public async fillOrdersUpToAsync(signedOrders: SignedOrder[], takerTokenFillAmount: BigNumber.BigNumber,
|
||||
shouldCheckTransfer: boolean, takerAddress: string): Promise<BigNumber.BigNumber> {
|
||||
const takerTokenAddresses = map(signedOrders, signedOrder => signedOrder.takerTokenAddress);
|
||||
const takerTokenAddresses = _map(signedOrders, signedOrder => signedOrder.takerTokenAddress);
|
||||
assert.hasAtMostOneUniqueValue(takerTokenAddresses,
|
||||
ExchangeContractErrs.MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED);
|
||||
assert.isBigNumber('takerTokenFillAmount', takerTokenFillAmount);
|
||||
@@ -221,11 +216,11 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
await this._validateFillOrderAndThrowIfInvalidAsync(
|
||||
signedOrder, takerTokenFillAmount, takerAddress);
|
||||
}
|
||||
if (isEmpty(signedOrders)) {
|
||||
if (_isEmpty(signedOrders)) {
|
||||
return new BigNumber(0); // no-op
|
||||
}
|
||||
|
||||
const orderAddressesValuesAndSignatureArray = map(signedOrders, signedOrder => {
|
||||
const orderAddressesValuesAndSignatureArray = _.map(signedOrders, signedOrder => {
|
||||
return [
|
||||
...ExchangeWrapper._getOrderAddressesAndValues(signedOrder),
|
||||
signedOrder.ecSignature.v,
|
||||
@@ -233,8 +228,8 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
signedOrder.ecSignature.s,
|
||||
];
|
||||
});
|
||||
// We use unzip<any> because unzip doesn't type check if values have different types :'(
|
||||
const [orderAddressesArray, orderValuesArray, vArray, rArray, sArray] = unzip<any>(
|
||||
// We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
|
||||
const [orderAddressesArray, orderValuesArray, vArray, rArray, sArray] = _.unzip<any>(
|
||||
orderAddressesValuesAndSignatureArray,
|
||||
);
|
||||
|
||||
@@ -294,11 +289,11 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
await this._validateFillOrderAndThrowIfInvalidAsync(
|
||||
orderFillRequest.signedOrder, orderFillRequest.takerTokenFillAmount, takerAddress);
|
||||
}
|
||||
if (isEmpty(orderFillRequests)) {
|
||||
if (_.isEmpty(orderFillRequests)) {
|
||||
return; // no-op
|
||||
}
|
||||
|
||||
const orderAddressesValuesAmountsAndSignatureArray = map(orderFillRequests, orderFillRequest => {
|
||||
const orderAddressesValuesAmountsAndSignatureArray = _.map(orderFillRequests, orderFillRequest => {
|
||||
return [
|
||||
...ExchangeWrapper._getOrderAddressesAndValues(orderFillRequest.signedOrder),
|
||||
orderFillRequest.takerTokenFillAmount,
|
||||
@@ -307,8 +302,8 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
orderFillRequest.signedOrder.ecSignature.s,
|
||||
];
|
||||
});
|
||||
// We use unzip<any> because unzip doesn't type check if values have different types :'(
|
||||
const [orderAddressesArray, orderValuesArray, takerTokenFillAmountArray, vArray, rArray, sArray] = unzip<any>(
|
||||
// We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
|
||||
const [orderAddressesArray, orderValuesArray, takerTokenFillAmountArray, vArray, rArray, sArray] = _.unzip<any>(
|
||||
orderAddressesValuesAmountsAndSignatureArray,
|
||||
);
|
||||
|
||||
@@ -407,7 +402,7 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
request.fillTakerAmount);
|
||||
}
|
||||
|
||||
const orderAddressesValuesAndTakerTokenFillAmounts = map(orderFillOrKillRequests, request => {
|
||||
const orderAddressesValuesAndTakerTokenFillAmounts = _.map(orderFillOrKillRequests, request => {
|
||||
return [
|
||||
...ExchangeWrapper._getOrderAddressesAndValues(request.signedOrder),
|
||||
request.fillTakerAmount,
|
||||
@@ -417,9 +412,9 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
];
|
||||
});
|
||||
|
||||
// We use unzip<any> because unzip doesn't type check if values have different types :'(
|
||||
// We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
|
||||
const [orderAddresses, orderValues, fillTakerAmounts, vParams, rParams, sParams] =
|
||||
unzip<any>(orderAddressesValuesAndTakerTokenFillAmounts);
|
||||
_.unzip<any>(orderAddressesValuesAndTakerTokenFillAmounts);
|
||||
|
||||
const gas = await exchangeInstance.batchFillOrKill.estimateGas(
|
||||
orderAddresses,
|
||||
@@ -494,7 +489,7 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
*/
|
||||
@decorators.contractCallErrorHandler
|
||||
public async batchCancelOrderAsync(orderCancellationRequests: OrderCancellationRequest[]): Promise<void> {
|
||||
const makers = map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker);
|
||||
const makers = _.map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker);
|
||||
assert.hasAtMostOneUniqueValue(makers, ExchangeContractErrs.MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED);
|
||||
const maker = makers[0];
|
||||
await assert.isSenderAddressAsync('maker', maker, this._web3Wrapper);
|
||||
@@ -505,19 +500,19 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
cancellationRequest.order, cancellationRequest.takerTokenCancelAmount,
|
||||
);
|
||||
}
|
||||
if (isEmpty(orderCancellationRequests)) {
|
||||
if (_.isEmpty(orderCancellationRequests)) {
|
||||
return; // no-op
|
||||
}
|
||||
const exchangeInstance = await this._getExchangeContractAsync();
|
||||
const orderAddressesValuesAndTakerTokenCancelAmounts = map(orderCancellationRequests, cancellationRequest => {
|
||||
const orderAddressesValuesAndTakerTokenCancelAmounts = _.map(orderCancellationRequests, cancellationRequest => {
|
||||
return [
|
||||
...ExchangeWrapper._getOrderAddressesAndValues(cancellationRequest.order),
|
||||
cancellationRequest.takerTokenCancelAmount,
|
||||
];
|
||||
});
|
||||
// We use unzip<any> because unzip doesn't type check if values have different types :'(
|
||||
// We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
|
||||
const [orderAddresses, orderValues, takerTokenCancelAmounts] =
|
||||
unzip<any>(orderAddressesValuesAndTakerTokenCancelAmounts);
|
||||
_.unzip<any>(orderAddressesValuesAndTakerTokenCancelAmounts);
|
||||
const gas = await exchangeInstance.batchCancel.estimateGas(
|
||||
orderAddresses,
|
||||
orderValues,
|
||||
@@ -582,7 +577,7 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
* Stops watching for all exchange events
|
||||
*/
|
||||
public async stopWatchingAllEventsAsync(): Promise<void> {
|
||||
const stopWatchingPromises = map(this._exchangeLogEventEmitters,
|
||||
const stopWatchingPromises = _.map(this._exchangeLogEventEmitters,
|
||||
logEventObj => logEventObj.stopWatchingAsync());
|
||||
await Promise.all(stopWatchingPromises);
|
||||
this._exchangeLogEventEmitters = [];
|
||||
@@ -736,8 +731,8 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
}
|
||||
}
|
||||
private _throwErrorLogsAsErrors(logs: ContractEvent[]): void {
|
||||
const errEvent = find(logs, {event: 'LogError'});
|
||||
if (!isUndefined(errEvent)) {
|
||||
const errEvent = _.find(logs, {event: 'LogError'});
|
||||
if (!_.isUndefined(errEvent)) {
|
||||
const errCode = (errEvent.args as LogErrorContractEventArgs).errorId.toNumber();
|
||||
const errMessage = this._exchangeContractErrCodesToMsg[errCode];
|
||||
throw new Error(errMessage);
|
||||
@@ -754,7 +749,7 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
return isRoundingError;
|
||||
}
|
||||
private async _getExchangeContractAsync(): Promise<ExchangeContract> {
|
||||
if (!isUndefined(this._exchangeContractIfExists)) {
|
||||
if (!_.isUndefined(this._exchangeContractIfExists)) {
|
||||
return this._exchangeContractIfExists;
|
||||
}
|
||||
const contractInstance = await this._instantiateContractIfExistsAsync((ExchangeArtifacts as any));
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import map = require('lodash/map');
|
||||
import isUndefined = require('lodash/isUndefined');
|
||||
import * as _ from 'lodash';
|
||||
import {Web3Wrapper} from '../web3_wrapper';
|
||||
import {Token, TokenRegistryContract, TokenMetadata} from '../types';
|
||||
import {assert} from '../utils/assert';
|
||||
@@ -25,12 +24,12 @@ export class TokenRegistryWrapper extends ContractWrapper {
|
||||
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
|
||||
|
||||
const addresses = await tokenRegistryContract.getTokenAddresses.call();
|
||||
const tokenMetadataPromises: Array<Promise<TokenMetadata>> = map(
|
||||
const tokenMetadataPromises: Array<Promise<TokenMetadata>> = _.map(
|
||||
addresses,
|
||||
(address: string) => (tokenRegistryContract.getTokenMetaData.call(address)),
|
||||
);
|
||||
const tokensMetadata = await Promise.all(tokenMetadataPromises);
|
||||
const tokens = map(tokensMetadata, metadata => {
|
||||
const tokens = _.map(tokensMetadata, metadata => {
|
||||
return {
|
||||
address: metadata[0],
|
||||
name: metadata[1],
|
||||
@@ -42,7 +41,7 @@ export class TokenRegistryWrapper extends ContractWrapper {
|
||||
return tokens;
|
||||
}
|
||||
private async _getTokenRegistryContractAsync(): Promise<TokenRegistryContract> {
|
||||
if (!isUndefined(this._tokenRegistryContractIfExists)) {
|
||||
if (!_.isUndefined(this._tokenRegistryContractIfExists)) {
|
||||
return this._tokenRegistryContractIfExists;
|
||||
}
|
||||
const contractInstance = await this._instantiateContractIfExistsAsync((TokenRegistryArtifacts as any));
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import isUndefined = require('lodash/isUndefined');
|
||||
import * as _ from 'lodash';
|
||||
import * as BigNumber from 'bignumber.js';
|
||||
import {Web3Wrapper} from '../web3_wrapper';
|
||||
import {assert} from '../utils/assert';
|
||||
@@ -179,7 +179,7 @@ export class TokenWrapper extends ContractWrapper {
|
||||
}
|
||||
private async _getTokenContractAsync(tokenAddress: string): Promise<TokenContract> {
|
||||
let tokenContract = this._tokenContractsByAddress[tokenAddress];
|
||||
if (!isUndefined(tokenContract)) {
|
||||
if (!_.isUndefined(tokenContract)) {
|
||||
return tokenContract;
|
||||
}
|
||||
const contractInstance = await this._instantiateContractIfExistsAsync((TokenArtifacts as any), tokenAddress);
|
||||
@@ -189,10 +189,10 @@ export class TokenWrapper extends ContractWrapper {
|
||||
}
|
||||
private async _getProxyAddressAsync() {
|
||||
const networkIdIfExists = await this._web3Wrapper.getNetworkIdIfExistsAsync();
|
||||
const proxyNetworkConfigsIfExists = isUndefined(networkIdIfExists) ?
|
||||
const proxyNetworkConfigsIfExists = _.isUndefined(networkIdIfExists) ?
|
||||
undefined :
|
||||
(ProxyArtifacts as any).networks[networkIdIfExists];
|
||||
if (isUndefined(proxyNetworkConfigsIfExists)) {
|
||||
if (_.isUndefined(proxyNetworkConfigsIfExists)) {
|
||||
throw new Error(ZeroExError.CONTRACT_NOT_DEPLOYED_ON_NETWORK);
|
||||
}
|
||||
const proxyAddress = proxyNetworkConfigsIfExists.address;
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import reduce = require('lodash/reduce');
|
||||
import * as _ from 'lodash';
|
||||
import * as Web3 from 'web3';
|
||||
|
||||
// Utility function to create a K:V from a list of strings
|
||||
// Adapted from: https://basarat.gitbooks.io/typescript/content/docs/types/literal-types.html
|
||||
function strEnum(values: string[]): {[key: string]: string} {
|
||||
return reduce(values, (result, key) => {
|
||||
return _.reduce(values, (result, key) => {
|
||||
result[key] = key;
|
||||
return result;
|
||||
}, Object.create(null));
|
||||
|
@@ -1,10 +1,4 @@
|
||||
import uniq = require('lodash/uniq');
|
||||
import isEmpty = require('lodash/isEmpty');
|
||||
import isObject = require('lodash/isObject');
|
||||
import isFinite = require('lodash/isFinite');
|
||||
import isString = require('lodash/isString');
|
||||
import isBoolean = require('lodash/isBoolean');
|
||||
import isUndefined = require('lodash/isUndefined');
|
||||
import * as _ from 'lodash';
|
||||
import * as BigNumber from 'bignumber.js';
|
||||
import * as Web3 from 'web3';
|
||||
import {Web3Wrapper} from '../web3_wrapper';
|
||||
@@ -15,17 +9,17 @@ const HEX_REGEX = /^0x[0-9A-F]*$/i;
|
||||
|
||||
export const assert = {
|
||||
isBigNumber(variableName: string, value: BigNumber.BigNumber): void {
|
||||
const isBigNumber = isObject(value) && value.isBigNumber;
|
||||
const isBigNumber = _.isObject(value) && value.isBigNumber;
|
||||
this.assert(isBigNumber, this.typeAssertionMessage(variableName, 'BigNumber', value));
|
||||
},
|
||||
isUndefined(value: any, variableName?: string): void {
|
||||
this.assert(isUndefined(value), this.typeAssertionMessage(variableName, 'undefined', value));
|
||||
this.assert(_.isUndefined(value), this.typeAssertionMessage(variableName, 'undefined', value));
|
||||
},
|
||||
isString(variableName: string, value: string): void {
|
||||
this.assert(isString(value), this.typeAssertionMessage(variableName, 'string', value));
|
||||
this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
|
||||
},
|
||||
isHexString(variableName: string, value: string): void {
|
||||
this.assert(isString(value) && HEX_REGEX.test(value),
|
||||
this.assert(_.isString(value) && HEX_REGEX.test(value),
|
||||
this.typeAssertionMessage(variableName, 'HexString', value));
|
||||
},
|
||||
isETHAddressHex(variableName: string, value: string): void {
|
||||
@@ -42,19 +36,19 @@ export const assert = {
|
||||
},
|
||||
async isUserAddressAvailableAsync(web3Wrapper: Web3Wrapper): Promise<void> {
|
||||
const availableAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
||||
this.assert(!isEmpty(availableAddresses), 'No addresses were available on the provided web3 instance');
|
||||
this.assert(!_.isEmpty(availableAddresses), 'No addresses were available on the provided web3 instance');
|
||||
},
|
||||
hasAtMostOneUniqueValue(value: any[], errMsg: string): void {
|
||||
this.assert(uniq(value).length <= 1, errMsg);
|
||||
this.assert(_.uniq(value).length <= 1, errMsg);
|
||||
},
|
||||
isNumber(variableName: string, value: number): void {
|
||||
this.assert(isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
|
||||
this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
|
||||
},
|
||||
isValidOrderHash(variableName: string, value: string): void {
|
||||
this.assert(utils.isValidOrderHash(value), this.typeAssertionMessage(variableName, 'orderHash', value));
|
||||
},
|
||||
isBoolean(variableName: string, value: boolean): void {
|
||||
this.assert(isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
|
||||
this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
|
||||
},
|
||||
doesConformToSchema(variableName: string, value: object, schema: Schema): void {
|
||||
const schemaValidator = new SchemaValidator();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import includes = require('lodash/includes');
|
||||
import * as _ from 'lodash';
|
||||
import {constants} from './constants';
|
||||
import {AsyncMethod, ZeroExError} from '../types';
|
||||
|
||||
@@ -20,10 +20,10 @@ export const decorators = {
|
||||
const result = await originalMethod.apply(this, args);
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (includes(error.message, constants.INVALID_JUMP_PATTERN)) {
|
||||
if (_.includes(error.message, constants.INVALID_JUMP_PATTERN)) {
|
||||
throw new Error(ZeroExError.INVALID_JUMP);
|
||||
}
|
||||
if (includes(error.message, constants.OUT_OF_GAS_PATTERN)) {
|
||||
if (_.includes(error.message, constants.OUT_OF_GAS_PATTERN)) {
|
||||
throw new Error(ZeroExError.OUT_OF_GAS);
|
||||
}
|
||||
throw error;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import map = require('lodash/map');
|
||||
import includes = require('lodash/includes');
|
||||
import * as _ from 'lodash';
|
||||
import * as BN from 'bn.js';
|
||||
import * as ethABI from 'ethereumjs-abi';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
@@ -21,7 +20,7 @@ export const utils = {
|
||||
console.log(message);
|
||||
},
|
||||
isParityNode(nodeVersion: string): boolean {
|
||||
return includes(nodeVersion, 'Parity');
|
||||
return _.includes(nodeVersion, 'Parity');
|
||||
},
|
||||
isValidOrderHash(orderHashHex: string): boolean {
|
||||
const isValid = /^0x[0-9A-F]{64}$/i.test(orderHashHex);
|
||||
@@ -45,8 +44,8 @@ export const utils = {
|
||||
{value: utils.bigNumberToBN(order.expirationUnixTimestampSec), type: SolidityTypes.uint256},
|
||||
{value: utils.bigNumberToBN(order.salt), type: SolidityTypes.uint256},
|
||||
];
|
||||
const types = map(orderParts, o => o.type);
|
||||
const values = map(orderParts, o => o.value);
|
||||
const types = _.map(orderParts, o => o.type);
|
||||
const values = _.map(orderParts, o => o.value);
|
||||
const hashBuff = ethABI.soliditySHA3(types, values);
|
||||
const hashHex = ethUtil.bufferToHex(hashBuff);
|
||||
return hashHex;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import includes = require('lodash/includes');
|
||||
import * as _ from 'lodash';
|
||||
import * as Web3 from 'web3';
|
||||
import * as BigNumber from 'bignumber.js';
|
||||
import promisify = require('es6-promisify');
|
||||
@@ -17,7 +17,7 @@ export class Web3Wrapper {
|
||||
}
|
||||
public async isSenderAddressAvailableAsync(senderAddress: string): Promise<boolean> {
|
||||
const addresses = await this.getAvailableAddressesAsync();
|
||||
return includes(addresses, senderAddress);
|
||||
return _.includes(addresses, senderAddress);
|
||||
}
|
||||
public async getNodeVersionAsync(): Promise<string> {
|
||||
const nodeVersion = await promisify(this.web3.version.getNode)();
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import each = require('lodash/each');
|
||||
import assign = require('lodash/assign');
|
||||
import * as _ from 'lodash';
|
||||
import * as chai from 'chai';
|
||||
import {chaiSetup} from './utils/chai_setup';
|
||||
import 'mocha';
|
||||
@@ -68,7 +67,7 @@ describe('ZeroEx library', () => {
|
||||
).to.become(false);
|
||||
});
|
||||
it('should return false if the signature doesn\'t pertain to the dataHex & address', async () => {
|
||||
const wrongSignature = assign({}, signature, {v: 28});
|
||||
const wrongSignature = _.assign({}, signature, {v: 28});
|
||||
expect(ZeroEx.isValidSignature(dataHex, wrongSignature, address)).to.be.false();
|
||||
return expect(
|
||||
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(dataHex, wrongSignature, address),
|
||||
@@ -145,7 +144,7 @@ describe('ZeroEx library', () => {
|
||||
let stubs: Sinon.SinonStub[] = [];
|
||||
afterEach(() => {
|
||||
// clean up any stubs after the test has completed
|
||||
each(stubs, s => s.restore());
|
||||
_.each(stubs, s => s.restore());
|
||||
stubs = [];
|
||||
});
|
||||
it('calculates the order hash', async () => {
|
||||
@@ -172,7 +171,7 @@ describe('ZeroEx library', () => {
|
||||
});
|
||||
afterEach(() => {
|
||||
// clean up any stubs after the test has completed
|
||||
each(stubs, s => s.restore());
|
||||
_.each(stubs, s => s.restore());
|
||||
stubs = [];
|
||||
});
|
||||
it ('Should return the correct ECSignature on TestPRC nodeVersion', async () => {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import 'mocha';
|
||||
import forEach = require('lodash/forEach');
|
||||
import * as _ from 'lodash';
|
||||
import * as chai from 'chai';
|
||||
import * as BigNumber from 'bignumber.js';
|
||||
import promisify = require('es6-promisify');
|
||||
@@ -19,7 +19,7 @@ const expect = chai.expect;
|
||||
describe('Schema', () => {
|
||||
const validator = new SchemaValidator();
|
||||
const validateAgainstSchema = (testCases: any[], schema: any, shouldFail = false) => {
|
||||
forEach(testCases, (testCase: any) => {
|
||||
_.forEach(testCases, (testCase: any) => {
|
||||
if (shouldFail) {
|
||||
expect(validator.validate(testCase, schema).errors).to.be.lengthOf.at.least(1);
|
||||
} else {
|
||||
@@ -285,7 +285,7 @@ describe('Schema', () => {
|
||||
'00.00': '0',
|
||||
'.3': '0.3',
|
||||
};
|
||||
forEach(testCases, (serialized: string, input: string) => {
|
||||
_.forEach(testCases, (serialized: string, input: string) => {
|
||||
expect(JSON.parse(JSON.stringify(new BigNumber(input)))).to.be.equal(serialized);
|
||||
});
|
||||
});
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import each = require('lodash/each');
|
||||
import * as _ from 'lodash';
|
||||
import 'mocha';
|
||||
import * as chai from 'chai';
|
||||
import {chaiSetup} from './utils/chai_setup';
|
||||
@@ -32,7 +32,7 @@ describe('TokenRegistryWrapper', () => {
|
||||
expect(tokens).to.have.lengthOf(TOKEN_REGISTRY_SIZE_AFTER_MIGRATION);
|
||||
|
||||
const schemaValidator = new SchemaValidator();
|
||||
each(tokens, token => {
|
||||
_.each(tokens, token => {
|
||||
const validationResult = schemaValidator.validate(token, tokenSchema);
|
||||
expect(validationResult.errors).to.have.lengthOf(0);
|
||||
});
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import assign = require('lodash/assign');
|
||||
import isUndefined = require('lodash/isUndefined');
|
||||
import * as _ from 'lodash';
|
||||
import * as BigNumber from 'bignumber.js';
|
||||
import {ZeroEx, SignedOrder} from '../../src';
|
||||
|
||||
@@ -17,7 +16,7 @@ export const orderFactory = {
|
||||
feeRecipient: string,
|
||||
expirationUnixTimestampSec?: BigNumber.BigNumber): Promise<SignedOrder> {
|
||||
const defaultExpirationUnixTimestampSec = new BigNumber(2524604400); // Close to infinite
|
||||
expirationUnixTimestampSec = isUndefined(expirationUnixTimestampSec) ?
|
||||
expirationUnixTimestampSec = _.isUndefined(expirationUnixTimestampSec) ?
|
||||
defaultExpirationUnixTimestampSec :
|
||||
expirationUnixTimestampSec;
|
||||
const order = {
|
||||
@@ -35,7 +34,7 @@ export const orderFactory = {
|
||||
};
|
||||
const orderHash = await zeroEx.getOrderHashHexAsync(order);
|
||||
const ecSignature = await zeroEx.signOrderHashAsync(orderHash, maker);
|
||||
const signedOrder: SignedOrder = assign(order, {ecSignature});
|
||||
const signedOrder: SignedOrder = _.assign(order, {ecSignature});
|
||||
return signedOrder;
|
||||
},
|
||||
};
|
||||
|
@@ -1,6 +1,4 @@
|
||||
import find = require('lodash/find');
|
||||
import filter = require('lodash/filter');
|
||||
import isUndefined = require('lodash/isUndefined');
|
||||
import * as _ from 'lodash';
|
||||
import {Token, ZeroExError} from '../../src';
|
||||
|
||||
const PROTOCOL_TOKEN_SYMBOL = 'ZRX';
|
||||
@@ -11,14 +9,14 @@ export class TokenUtils {
|
||||
this.tokens = tokens;
|
||||
}
|
||||
public getProtocolTokenOrThrow(): Token {
|
||||
const zrxToken = find(this.tokens, {symbol: PROTOCOL_TOKEN_SYMBOL});
|
||||
if (isUndefined(zrxToken)) {
|
||||
const zrxToken = _.find(this.tokens, {symbol: PROTOCOL_TOKEN_SYMBOL});
|
||||
if (_.isUndefined(zrxToken)) {
|
||||
throw new Error(ZeroExError.ZRX_NOT_IN_TOKEN_REGISTRY);
|
||||
}
|
||||
return zrxToken;
|
||||
}
|
||||
public getNonProtocolTokens(): Token[] {
|
||||
const nonProtocolTokens = filter(this.tokens, token => {
|
||||
const nonProtocolTokens = _.filter(this.tokens, token => {
|
||||
return token.symbol !== PROTOCOL_TOKEN_SYMBOL;
|
||||
});
|
||||
return nonProtocolTokens;
|
||||
|
Reference in New Issue
Block a user