* move orderParsingUtils from order-utils to connect * Remove many functions from signatureUtils Removed from the exported object, that is. All of them are used in other existing code, so they were all moved to be as local to their usage as possible. * remove orderHashUtils.isValidOrderHash() * Move all *RevertErrors from order-utils... ...into their respective @0x/contracts- packages. * Refactor @0x/order-utils' orderHashUtils away - Move existing routines into @0x/contracts-test-utils - Migrate non-contract-test callers to a newly-exposed getOrderHash() method in DevUtils. * Move all *RevertErrors from @0x/utils... ...into their respective @0x/contracts- packages. * rm transactionHashUtils.isValidTransactionHash() * DevUtils.sol: Fail yarn test if too big to deploy * Refactor @0x/order-utils transactionHashUtils away - Move existing routines into @0x/contracts-test-utils - Migrate non-contract-test callers to a newly-exposed getTransactionHash() method in DevUtils. * Consolidate `Removed export...` CHANGELOG entries * Rm EthBalanceChecker from devutils wrapper exports * Stop importing from '.' or '.../src' * fix builds * fix prettier; dangling promise * increase max bundle size
42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
import { DevUtilsContract } from '@0x/contracts-dev-utils/lib/generated-wrappers/dev_utils';
|
|
import { Order } from '@0x/types';
|
|
import { BigNumber } from '@0x/utils';
|
|
import { chaiSetup } from '@0x/contracts-test-utils';
|
|
import { SupportedProvider } from 'ethereum-types';
|
|
|
|
import * as chai from 'chai';
|
|
chaiSetup.configure();
|
|
const expect = chai.expect;
|
|
|
|
const NULL_ADDRESS = '0x' + '00'.repeat(20);
|
|
|
|
describe('DevUtils.getOrderHash', () => {
|
|
it('should return the order hash', async () => {
|
|
const expectedOrderHash = '0x331cb7e07a757bae130702da6646c26531798c92bcfaf671817268fd2c188531';
|
|
const exchangeAddress = '0x1dc4c1cefef38a777b15aa20260a54e584b16c48';
|
|
const chainId = 50;
|
|
const order: Order = {
|
|
makerAddress: NULL_ADDRESS,
|
|
takerAddress: NULL_ADDRESS,
|
|
senderAddress: NULL_ADDRESS,
|
|
feeRecipientAddress: NULL_ADDRESS,
|
|
makerAssetData: NULL_ADDRESS,
|
|
takerAssetData: NULL_ADDRESS,
|
|
makerFeeAssetData: NULL_ADDRESS,
|
|
takerFeeAssetData: NULL_ADDRESS,
|
|
salt: new BigNumber(0),
|
|
makerFee: new BigNumber(0),
|
|
takerFee: new BigNumber(0),
|
|
makerAssetAmount: new BigNumber(0),
|
|
takerAssetAmount: new BigNumber(0),
|
|
expirationTimeSeconds: new BigNumber(0),
|
|
exchangeAddress,
|
|
chainId,
|
|
};
|
|
const devUtilsContract = new DevUtilsContract(NULL_ADDRESS, { isEIP1193: true } as SupportedProvider);
|
|
expect(
|
|
await devUtilsContract.getOrderHash(order, new BigNumber(chainId), exchangeAddress).callAsync(),
|
|
).to.be.equal(expectedOrderHash);
|
|
});
|
|
});
|