diff options
author | Fabio Berger <me@fabioberger.com> | 2018-08-03 23:15:14 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-08-03 23:15:14 +0800 |
commit | d85ce6ac758a9a726c298b972a7c557e01f2ab2f (patch) | |
tree | 4db9ec59a4809ca1fbe140afd71fd0ff6766e95d /packages/contracts/test/exchange | |
parent | 0d3d9dad846d01e84be3b52d48bfabd9e1853b66 (diff) | |
download | dexon-sol-tools-d85ce6ac758a9a726c298b972a7c557e01f2ab2f.tar dexon-sol-tools-d85ce6ac758a9a726c298b972a7c557e01f2ab2f.tar.gz dexon-sol-tools-d85ce6ac758a9a726c298b972a7c557e01f2ab2f.tar.bz2 dexon-sol-tools-d85ce6ac758a9a726c298b972a7c557e01f2ab2f.tar.lz dexon-sol-tools-d85ce6ac758a9a726c298b972a7c557e01f2ab2f.tar.xz dexon-sol-tools-d85ce6ac758a9a726c298b972a7c557e01f2ab2f.tar.zst dexon-sol-tools-d85ce6ac758a9a726c298b972a7c557e01f2ab2f.zip |
Make signature_util into an object literal so related functions are rendered together in the docs
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r-- | packages/contracts/test/exchange/signature_validator.ts | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index f2bb42c75..d5e522220 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -1,5 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; -import { addSignedMessagePrefix, assetDataUtils, MessagePrefixType, orderHashUtils } from '@0xproject/order-utils'; +import { signatureUtils, assetDataUtils, MessagePrefixType, orderHashUtils } from '@0xproject/order-utils'; import { RevertReason, SignatureType, SignedOrder } from '@0xproject/types'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; @@ -213,7 +213,10 @@ describe('MixinSignatureValidator', () => { it('should return true when SignatureType=EthSign and signature is valid', async () => { // Create EthSign signature const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - const orderHashWithEthSignPrefixHex = addSignedMessagePrefix(orderHashHex, MessagePrefixType.EthSign); + const orderHashWithEthSignPrefixHex = signatureUtils.addSignedMessagePrefix( + orderHashHex, + MessagePrefixType.EthSign, + ); const orderHashWithEthSignPrefixBuffer = ethUtil.toBuffer(orderHashWithEthSignPrefixHex); const ecSignature = ethUtil.ecsign(orderHashWithEthSignPrefixBuffer, signerPrivateKey); // Create 0x signature from EthSign signature @@ -236,7 +239,10 @@ describe('MixinSignatureValidator', () => { it('should return false when SignatureType=EthSign and signature is invalid', async () => { // Create EthSign signature const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - const orderHashWithEthSignPrefixHex = addSignedMessagePrefix(orderHashHex, MessagePrefixType.EthSign); + const orderHashWithEthSignPrefixHex = signatureUtils.addSignedMessagePrefix( + orderHashHex, + MessagePrefixType.EthSign, + ); const orderHashWithEthSignPrefixBuffer = ethUtil.toBuffer(orderHashWithEthSignPrefixHex); const ecSignature = ethUtil.ecsign(orderHashWithEthSignPrefixBuffer, signerPrivateKey); // Create 0x signature from EthSign signature @@ -385,7 +391,10 @@ describe('MixinSignatureValidator', () => { it('should return true when SignatureType=Trezor and signature is valid', async () => { // Create Trezor signature const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - const orderHashWithTrezorPrefixHex = addSignedMessagePrefix(orderHashHex, MessagePrefixType.Trezor); + const orderHashWithTrezorPrefixHex = signatureUtils.addSignedMessagePrefix( + orderHashHex, + MessagePrefixType.Trezor, + ); const orderHashWithTrezorPrefixBuffer = ethUtil.toBuffer(orderHashWithTrezorPrefixHex); const ecSignature = ethUtil.ecsign(orderHashWithTrezorPrefixBuffer, signerPrivateKey); // Create 0x signature from Trezor signature @@ -408,7 +417,10 @@ describe('MixinSignatureValidator', () => { it('should return false when SignatureType=Trezor and signature is invalid', async () => { // Create Trezor signature const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - const orderHashWithTrezorPrefixHex = addSignedMessagePrefix(orderHashHex, MessagePrefixType.Trezor); + const orderHashWithTrezorPrefixHex = signatureUtils.addSignedMessagePrefix( + orderHashHex, + MessagePrefixType.Trezor, + ); const orderHashWithTrezorPrefixBuffer = ethUtil.toBuffer(orderHashWithTrezorPrefixHex); const ecSignature = ethUtil.ecsign(orderHashWithTrezorPrefixBuffer, signerPrivateKey); // Create 0x signature from Trezor signature |