aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/exchange_wrapper_test.ts (renamed from test/exchange_wrapper.ts)10
-rw-r--r--test/fixtures/orders/5_MKR_for_42_MLN.json35
-rw-r--r--test/utils/blockchain_lifecycle.ts2
-rw-r--r--test/utils/order.ts21
4 files changed, 67 insertions, 1 deletions
diff --git a/test/exchange_wrapper.ts b/test/exchange_wrapper_test.ts
index 55b84ce36..b97a62100 100644
--- a/test/exchange_wrapper.ts
+++ b/test/exchange_wrapper_test.ts
@@ -4,6 +4,9 @@ import chaiAsPromised = require('chai-as-promised');
import {web3Factory} from './utils/web3_factory';
import {ZeroEx} from '../src/0x.js';
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
+import * as OrderJSON from './fixtures/orders/5_MKR_for_42_MLN.json';
+import * as BigNumber from 'bignumber.js';
+import {signedOrderFromJSON} from './utils/order';
const expect = chai.expect;
chai.use(chaiAsPromised);
@@ -91,4 +94,11 @@ describe('ExchangeWrapper', () => {
expect(isValid).to.be.true;
});
});
+ describe('#fillOrderAsync', () => {
+ const fillAmount = new BigNumber(1);
+ const signedOrder = signedOrderFromJSON(OrderJSON);
+ it('fillsOrder', async () => {
+ // const orderFillResponse = await zeroEx.exchange.fillOrderAsync(signedOrder, fillAmount);
+ });
+ });
});
diff --git a/test/fixtures/orders/5_MKR_for_42_MLN.json b/test/fixtures/orders/5_MKR_for_42_MLN.json
new file mode 100644
index 000000000..2c2a3d73e
--- /dev/null
+++ b/test/fixtures/orders/5_MKR_for_42_MLN.json
@@ -0,0 +1,35 @@
+{
+ "maker": {
+ "address": "0xffa119a5761eb93eacfe5d2b0e8944648c3d7164",
+ "token": {
+ "name": "MakerDAO",
+ "symbol": "MKR",
+ "decimals": 18,
+ "address": "0x1dad4783cf3fe3085c1426157ab175a6119a04ba"
+ },
+ "amount": "5000000000000000000",
+ "feeAmount": "0"
+ },
+ "taker": {
+ "address": "",
+ "token": {
+ "name": "Melon Token",
+ "symbol": "MLN",
+ "decimals": 18,
+ "address": "0x323b5d4c32345ced77393b3530b1eed0f346429d"
+ },
+ "amount": "42000000000000000000",
+ "feeAmount": "0"
+ },
+ "expiration": "1496181600",
+ "feeRecipient": "0x0000000000000000000000000000000000000000",
+ "salt": "28894038927316056783595066163529969528517282468995826064292810658599101267743",
+ "signature": {
+ "v": 28,
+ "r": "0x1e84173b09bc51e4e3f923718d747bd91c3584cfa3556d79294891ddd740e819",
+ "s": "0x36c0f453a01487f49e16157703cacb6cee08d337549f805c25d3f78221823eed",
+ "hash": "0x3f64711f39393f7f60a0980e3effba087c15bb9b1cbf678ede63a69798e5dc14"
+ },
+ "exchangeContract": "0x9ce1a5e2311f9b8b8e6b40ed20b5b090de4a4c4d",
+ "networkId": 42
+} \ No newline at end of file
diff --git a/test/utils/blockchain_lifecycle.ts b/test/utils/blockchain_lifecycle.ts
index 68e169ac0..50eb57b95 100644
--- a/test/utils/blockchain_lifecycle.ts
+++ b/test/utils/blockchain_lifecycle.ts
@@ -17,4 +17,4 @@ export class BlockchainLifecycle {
throw new Error(`Snapshot with id #${this.snapshotId} failed to revert`);
}
}
-};
+}
diff --git a/test/utils/order.ts b/test/utils/order.ts
new file mode 100644
index 000000000..dc0be670c
--- /dev/null
+++ b/test/utils/order.ts
@@ -0,0 +1,21 @@
+import {SignedOrder} from '../../lib/src/types';
+import * as BigNumber from 'bignumber.js';
+import * as _ from 'lodash';
+
+export function signedOrderFromJSON(signedOrderJSON: any): SignedOrder {
+ const signedOrder = {
+ maker: signedOrderJSON.maker.address,
+ taker: _.isEmpty(signedOrderJSON.taker.address) ? undefined : signedOrderJSON.taker.address,
+ makerTokenAddress: signedOrderJSON.maker.token.address,
+ takerTokenAddress: signedOrderJSON.taker.token.address,
+ makerTokenAmount: new BigNumber(signedOrderJSON.maker.amount),
+ takerTokenAmount: new BigNumber(signedOrderJSON.taker.amount),
+ makerFee: new BigNumber(signedOrderJSON.maker.feeAmount),
+ takerFee: new BigNumber(signedOrderJSON.taker.feeAmount),
+ expirationUnixTimestampSec: new BigNumber(signedOrderJSON.expiration),
+ feeRecipient: signedOrderJSON.feeRecipient,
+ ecSignature: signedOrderJSON.signature,
+ salt: new BigNumber(signedOrderJSON.salt),
+ };
+ return signedOrder;
+}