diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-10-29 09:36:13 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-10-29 10:07:53 +0800 |
commit | 8d1689073b702d973075d30b2bb36369487fad1c (patch) | |
tree | cb0380d4782b0715f0d24e7a9c5f88b49a60fa50 /packages/order-utils | |
parent | 4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8 (diff) | |
parent | ae6202ed3d777605a3fd02cd29141a3ba40f4b34 (diff) | |
download | dexon-sol-tools-8d1689073b702d973075d30b2bb36369487fad1c.tar dexon-sol-tools-8d1689073b702d973075d30b2bb36369487fad1c.tar.gz dexon-sol-tools-8d1689073b702d973075d30b2bb36369487fad1c.tar.bz2 dexon-sol-tools-8d1689073b702d973075d30b2bb36369487fad1c.tar.lz dexon-sol-tools-8d1689073b702d973075d30b2bb36369487fad1c.tar.xz dexon-sol-tools-8d1689073b702d973075d30b2bb36369487fad1c.tar.zst dexon-sol-tools-8d1689073b702d973075d30b2bb36369487fad1c.zip |
Merge branch 'development' into feature/instant/fixed-orders-in-render-method
* development:
fix(instant): refactor some props to use isDisabled instead of disabled
linting imports
feat(instant): Disable input when processing
Add back debounce
Make doesBuyQuoteMatchState in reducer less strict
fix(instant): prevent outdated quote requests from overriding the correct quote
selected asset buy order state button -> selected asset buy order state buttons
buy order state button -> buy order state buttons
feat(order_utils.py): ERC721 asset data codec (#1186)
Add note about tslint false positive
tsx -> ts
Get BuyOrderState one big connected component, and let user view failure
Show View Transaction button on failure, and allow setting of width for Try Again button and View Txn button
Added string to constants
chore: Update contract-wrappers CHANGELOG.json
fix(contract-wrappers): Fix tslint errors that were lingering due to misconfiguration
chore: Add --format stylish to tslint
Diffstat (limited to 'packages/order-utils')
-rw-r--r-- | packages/order-utils/package.json | 2 | ||||
-rw-r--r-- | packages/order-utils/test/asset_data_utils_test.ts | 25 |
2 files changed, 23 insertions, 4 deletions
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 69f14a79e..a6a84b940 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -17,7 +17,7 @@ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "clean": "shx rm -rf lib generated_docs", - "lint": "tslint --project .", + "lint": "tslint --format stylish --project .", "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { diff --git a/packages/order-utils/test/asset_data_utils_test.ts b/packages/order-utils/test/asset_data_utils_test.ts index f8b850604..f175b7a38 100644 --- a/packages/order-utils/test/asset_data_utils_test.ts +++ b/packages/order-utils/test/asset_data_utils_test.ts @@ -1,6 +1,7 @@ import * as chai from 'chai'; -import { ERC20AssetData } from '@0x/types'; +import { ERC20AssetData, ERC721AssetData } from '@0x/types'; +import { BigNumber } from '@0x/utils'; import { assetDataUtils } from '../src/asset_data_utils'; @@ -14,18 +15,36 @@ const KNOWN_ENCODINGS = [ address: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48', assetData: '0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48', }, + { + address: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48', + tokenId: new BigNumber(1), + assetData: + '0x025717920000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c480000000000000000000000000000000000000000000000000000000000000001', + }, ]; const ERC20_ASSET_PROXY_ID = '0xf47261b0'; +const ERC721_ASSET_PROXY_ID = '0x02571792'; describe('assetDataUtils', () => { - it('should encode', () => { + it('should encode ERC20', () => { const assetData = assetDataUtils.encodeERC20AssetData(KNOWN_ENCODINGS[0].address); expect(assetData).to.equal(KNOWN_ENCODINGS[0].assetData); }); - it('should decode', () => { + it('should decode ERC20', () => { const assetData: ERC20AssetData = assetDataUtils.decodeERC20AssetData(KNOWN_ENCODINGS[0].assetData); expect(assetData.tokenAddress).to.equal(KNOWN_ENCODINGS[0].address); expect(assetData.assetProxyId).to.equal(ERC20_ASSET_PROXY_ID); }); + it('should encode ERC721', () => { + const assetData = assetDataUtils.encodeERC721AssetData(KNOWN_ENCODINGS[1].address, KNOWN_ENCODINGS[1] + .tokenId as BigNumber); + expect(assetData).to.equal(KNOWN_ENCODINGS[1].assetData); + }); + it('should decode ERC721', () => { + const assetData: ERC721AssetData = assetDataUtils.decodeERC721AssetData(KNOWN_ENCODINGS[1].assetData); + expect(assetData.tokenAddress).to.equal(KNOWN_ENCODINGS[1].address); + expect(assetData.assetProxyId).to.equal(ERC721_ASSET_PROXY_ID); + expect(assetData.tokenId).to.be.bignumber.equal(KNOWN_ENCODINGS[1].tokenId); + }); }); |