aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contract-wrappers/test/exchange_wrapper_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contract-wrappers/test/exchange_wrapper_test.ts')
-rw-r--r--packages/contract-wrappers/test/exchange_wrapper_test.ts21
1 files changed, 19 insertions, 2 deletions
diff --git a/packages/contract-wrappers/test/exchange_wrapper_test.ts b/packages/contract-wrappers/test/exchange_wrapper_test.ts
index a1d60dc6e..f8fa25491 100644
--- a/packages/contract-wrappers/test/exchange_wrapper_test.ts
+++ b/packages/contract-wrappers/test/exchange_wrapper_test.ts
@@ -1,6 +1,6 @@
import { BlockchainLifecycle, callbackErrorReporter } from '@0x/dev-utils';
import { FillScenarios } from '@0x/fill-scenarios';
-import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
import { DoneCallback, RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
@@ -353,7 +353,7 @@ describe('ExchangeWrapper', () => {
});
});
describe('#preSignAsync/isPreSignedAsync', () => {
- it('should preSign the hash', async () => {
+ it.only('should preSign the hash', async () => {
const senderAddress = takerAddress;
const hash = orderHashUtils.getOrderHashHex(signedOrder);
const signerAddress = signedOrder.makerAddress;
@@ -368,6 +368,23 @@ describe('ExchangeWrapper', () => {
await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
isPreSigned = await contractWrappers.exchange.isPreSignedAsync(hash, signerAddress);
expect(isPreSigned).to.be.true();
+
+ const preSignedSignature = '0x06';
+ const isValidSignature = await contractWrappers.exchange.isValidSignatureAsync(
+ hash,
+ signerAddress,
+ preSignedSignature,
+ );
+ expect(isValidSignature).to.be.true();
+
+ // Test our TS implementation of signature validation
+ const isValidSignatureInTs = await signatureUtils.isValidSignatureAsync(
+ provider,
+ hash,
+ preSignedSignature,
+ signerAddress,
+ );
+ expect(isValidSignatureInTs).to.be.true();
});
});
describe('#getVersionAsync', () => {