aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package.json1
-rw-r--r--src/globals.d.ts8
-rw-r--r--test/artifacts_test.ts54
-rw-r--r--yarn.lock40
4 files changed, 99 insertions, 4 deletions
diff --git a/package.json b/package.json
index d26ec6791..f8e2a37cb 100644
--- a/package.json
+++ b/package.json
@@ -79,6 +79,7 @@
"shx": "^0.2.2",
"sinon": "^2.3.2",
"source-map-support": "^0.4.15",
+ "truffle-hdwallet-provider": "^0.0.3",
"tslint": "^5.3.2",
"tslint-config-0xproject": "^0.0.2",
"typedoc": "^0.7.1",
diff --git a/src/globals.d.ts b/src/globals.d.ts
index 15ebe03d0..84f634193 100644
--- a/src/globals.d.ts
+++ b/src/globals.d.ts
@@ -86,3 +86,11 @@ declare module 'es6-promisify' {
declare module 'ethereumjs-abi' {
const soliditySHA3: (argTypes: string[], args: any[]) => Buffer;
}
+
+declare class HDWalletProvider {
+ constructor(mnemonic: string, rpcUrl: string);
+}
+
+declare module 'truffle-hdwallet-provider' {
+ export = HDWalletProvider;
+}
diff --git a/test/artifacts_test.ts b/test/artifacts_test.ts
new file mode 100644
index 000000000..937d2674d
--- /dev/null
+++ b/test/artifacts_test.ts
@@ -0,0 +1,54 @@
+import * as _ from 'lodash';
+import * as chai from 'chai';
+import * as BigNumber from 'bignumber.js';
+import HDWalletProvider = require('truffle-hdwallet-provider');
+import {chaiSetup} from './utils/chai_setup';
+import {ZeroEx, Order} from '../src';
+import {web3Factory} from './utils/web3_factory';
+import {FillScenarios} from './utils/fill_scenarios';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// Those tests are slower cause they're talking to a remote node
+const TIMEOUT = 10000;
+
+describe('Artifacts', () => {
+ describe('contracts are deployed on kovan', () => {
+ const kovanRpcUrl = 'https://kovan.0xproject.com';
+ const mnemonic = 'concert load couple harbor equip island argue ramp clarify fence smart topic';
+ const web3Provider = new HDWalletProvider(mnemonic, kovanRpcUrl);
+ const zeroEx = new ZeroEx(web3Provider);
+ it('token registry contract is deployed', async () => {
+ const tokens = await zeroEx.tokenRegistry.getTokensAsync();
+ }).timeout(TIMEOUT);
+ it('proxy contract is deployed', async () => {
+ const [token] = await zeroEx.tokenRegistry.getTokensAsync();
+ const allowance = await zeroEx.token.getProxyAllowanceAsync(token.address, ZeroEx.NULL_ADDRESS);
+ expect(allowance).to.be.bignumber.equal(0);
+ }).timeout(TIMEOUT);
+ it('exchange contract is deployed', async () => {
+ const userAddreses = await zeroEx.getAvailableAddressesAsync();
+ const tokens = await zeroEx.tokenRegistry.getTokensAsync();
+ const makerTokenAddress = tokens[0].address;
+ const takerTokenAddress = tokens[1].address;
+ // Unused anyway
+ const zrxTokenAddress = ZeroEx.NULL_ADDRESS;
+ const fillScenarios = new FillScenarios(zeroEx, userAddreses, tokens, zrxTokenAddress);
+ const order: Order = {
+ maker: userAddreses[0],
+ taker: userAddreses[0],
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ makerTokenAmount: new BigNumber(0),
+ takerTokenAmount: new BigNumber(0),
+ makerTokenAddress,
+ takerTokenAddress,
+ salt: ZeroEx.generatePseudoRandomSalt(),
+ feeRecipient: ZeroEx.NULL_ADDRESS,
+ expirationUnixTimestampSec: new BigNumber(2524604400),
+ };
+ const orderHash = await zeroEx.getOrderHashHexAsync(order);
+ }).timeout(TIMEOUT);
+ });
+});
diff --git a/yarn.lock b/yarn.lock
index 674bb9246..94d3ad2db 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -42,10 +42,14 @@
version "2.2.41"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-2.2.41.tgz#e27cf0817153eb9f2713b2d3f6c68f1e1c3ca608"
-"@types/node@*", "@types/node@^7.0.22":
+"@types/node@*":
version "7.0.23"
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.23.tgz#ededfd92e61046c32fcad56ea7e1101733fad4a4"
+"@types/node@^8.0.1":
+ version "8.0.1"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.1.tgz#89c271e0c3b9ebb6a3756dd601336970b6228b77"
+
"@types/shelljs@^0.7.0":
version "0.7.1"
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.1.tgz#30fe144e3bdd37c11c174445bc54190cb7992a45"
@@ -716,7 +720,7 @@ bindings@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
-bip39@~2.2.0:
+bip39@^2.2.0, bip39@~2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/bip39/-/bip39-2.2.0.tgz#40e73f70674c267f148cdbf8374f2a50be166b0d"
dependencies:
@@ -1548,7 +1552,7 @@ ethereumjs-vm@^2.0.2, ethereumjs-vm@~2.0.1:
functional-red-black-tree "^1.0.1"
merkle-patricia-tree "^2.1.2"
-ethereumjs-wallet@~0.6.0:
+ethereumjs-wallet@^0.6.0, ethereumjs-wallet@~0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz#82763b1697ee7a796be7155da9dfb49b2f98cfdb"
dependencies:
@@ -4247,6 +4251,15 @@ truffle-contract@^2.0.1:
truffle-contract-schema "0.0.5"
web3 "^0.18.0"
+truffle-hdwallet-provider@^0.0.3:
+ version "0.0.3"
+ resolved "https://registry.yarnpkg.com/truffle-hdwallet-provider/-/truffle-hdwallet-provider-0.0.3.tgz#0e1de02104b73d3875e1cf7093305b4ea8a2d843"
+ dependencies:
+ bip39 "^2.2.0"
+ ethereumjs-wallet "^0.6.0"
+ web3 "^0.18.2"
+ web3-provider-engine "^8.4.0"
+
tslib@^1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec"
@@ -4448,6 +4461,25 @@ web3-provider-engine@^13.0.1:
xhr "^2.2.0"
xtend "^4.0.1"
+web3-provider-engine@^8.4.0:
+ version "8.6.1"
+ resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-8.6.1.tgz#4d86e19e30caaf97df351511ec0f60136e5b30eb"
+ dependencies:
+ async "^2.1.2"
+ clone "^2.0.0"
+ ethereumjs-block "^1.2.2"
+ ethereumjs-tx "^1.2.0"
+ ethereumjs-util "^5.0.1"
+ ethereumjs-vm "^2.0.2"
+ isomorphic-fetch "^2.2.0"
+ request "^2.67.0"
+ semaphore "^1.0.3"
+ solc "^0.4.2"
+ tape "^4.4.0"
+ web3 "^0.16.0"
+ xhr "^2.2.0"
+ xtend "^4.0.1"
+
web3-provider-engine@~8.1.0:
version "8.1.19"
resolved "https://registry.yarnpkg.com/web3-provider-engine/-/web3-provider-engine-8.1.19.tgz#3ccae95adecef55632e2a73bf3bee64b7e62fcf7"
@@ -4482,7 +4514,7 @@ web3@^0.16.0, web3@~0.16.0:
utf8 "^2.1.1"
xmlhttprequest "*"
-web3@^0.18.0:
+web3@^0.18.0, web3@^0.18.2:
version "0.18.4"
resolved "https://registry.yarnpkg.com/web3/-/web3-0.18.4.tgz#81ec1784145491f2eaa8955b31c06049e07c5e7d"
dependencies: