aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-07-21 07:15:04 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-07-21 07:15:04 +0800
commit6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8 (patch)
tree7b6a6eb86d6a0463221a502fb886bae6ff5a243c /packages/0x.js
parent938aabde3db0044c658e86765e1bbdbdce4e4a17 (diff)
parente54501522dcf93521c8ff7dfe5b216cffeaa1b29 (diff)
downloaddexon-sol-tools-6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8.tar
dexon-sol-tools-6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8.tar.gz
dexon-sol-tools-6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8.tar.bz2
dexon-sol-tools-6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8.tar.lz
dexon-sol-tools-6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8.tar.xz
dexon-sol-tools-6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8.tar.zst
dexon-sol-tools-6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8.zip
Merge branch 'v2-prototype' into feature/website/jobs-page-part2
* v2-prototype: (103 commits) Add changelog entry for @0xproject/utils Add AbortController polyfill to fetchAsync in utils Increase node heap size for webpack command Add missing timestamp to CHANGELOG entries Upgrade some @0xproject packages to 1.0.0 in website Hard code fillOrder selector into abiEncodeFillOrder Returns byte array instead of memory range for encoding fillOrder calldata Created LibAbiEncoder with `fillOrderNoThrow` Add missing dep in migrations Fix the abi-gen entry point Fix linter error Remove the postinstall hook Update website package.json with original imports @0xproject/sra-report@1.0.0 Change all package to depend on the new @0xproject/connect@1.0.0 @0xproject/connect@1.0.0 Use old assert version in @0xproject/connect FIx a typo Remove rc versions from unmigrated packages 0x.js@1.0.0-rc.2 ...
Diffstat (limited to 'packages/0x.js')
-rw-r--r--packages/0x.js/CHANGELOG.json28
-rw-r--r--packages/0x.js/package.json50
-rw-r--r--packages/0x.js/src/0x.ts55
3 files changed, 92 insertions, 41 deletions
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 27dafe4ca..c3b8728c6 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -1,32 +1,42 @@
[
{
- "version": "1.0.0",
+ "timestamp": 1532043100,
+ "version": "1.0.0-rc.2",
+ "changes": [
+ {
+ "note": "Remove `zeroEx.assetData` and instead re-export it's static functions directly off `ZeroEx`"
+ }
+ ]
+ },
+ {
+ "timestamp": 1532043000,
+ "version": "1.0.0-rc.1",
"changes": [
{
"note": "Remove tokenRegistry wrapper",
"pr": 863
},
{
- "note": "Rename zeroEx.token to zeroEx.erc20Token, and add zeroEx.erc721Token",
+ "note": "Rename `zeroEx.token` to `zeroEx.erc20Token`, and add `zeroEx.erc721Token`",
"pr": 863
},
{
- "note": "Rename zeroEx.proxy to zeroEx.erc20Proxy and add zeroEx.erc721Proxy",
+ "note": "Rename `zeroEx.proxy` to `zeroEx.erc20Proxy` and add `zeroEx.erc721Proxy`",
"pr": 863
},
{
"note":
- "Refactored ZeroEx.isValidSignature to zeroEx.isValidSignatureAsync. It is now async so that it can verify contract-dependent signature types",
+ "Refactored `ZeroEx.isValidSignature` to `zeroEx.isValidSignatureAsync`. It is now async so that it can verify contract-dependent signature types",
"pr": 863
},
{
"note":
- "Refactored signOrderHashAsync to ecSignOrderHashAsync. There are now many non-ECSignature ways to sign orders too.",
+ "Refactored `signOrderHashAsync` to `ecSignOrderHashAsync`. There are now many non-ECSignature ways to sign orders too.",
"pr": 863
},
{
"note":
- "Removed createOrderWatcherAsync method. Will be added back once OrderWatcher is refactored for V2",
+ "Removed `createOrderWatcherAsync` method. Will be added back once OrderWatcher is refactored for V2",
"pr": 863
},
{
@@ -34,11 +44,7 @@
"pr": 863
},
{
- "note": "Remove stateLayer config from OrderWatcher. It now always operates on the latest block",
- "pr": 875
- },
- {
- "note": "Export ZeroEx.assetData with methods to decode/encode assetData fields found in 0x orders",
+ "note": "Export `ZeroEx.assetData` with methods to decode/encode assetData fields found in 0x orders",
"pr": 884
}
]
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index 538eafd59..06ffe2daf 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -1,6 +1,6 @@
{
"name": "0x.js",
- "version": "0.38.6",
+ "version": "1.0.0-rc.2",
"engines": {
"node": ">=6.12"
},
@@ -41,8 +41,8 @@
"contracts": "ZRXToken",
"postpublish": {
"assets": [
- "packages/0x.js/_bundles/index.js",
- "packages/0x.js/_bundles/index.min.js"
+ "_bundles/index.js",
+ "_bundles/index.min.js"
],
"docPublishConfigs": {
"extraFileIncludes": [
@@ -51,13 +51,11 @@
"../contract-wrappers/src/types.ts",
"../contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/exchange_wrapper.ts",
- "../contract-wrappers/src/contract_wrappers/token_registry_wrapper.ts",
- "../contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper.ts",
- "../contract-wrappers/src/contract_wrappers/token_wrapper.ts",
- "../order-watcher/src/order_watcher/order_watcher.ts",
- "./src/generated_contract_wrappers/ether_token.ts",
- "./src/generated_contract_wrappers/token.ts",
- "./src/generated_contract_wrappers/exchange.ts"
+ "../contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts",
+ "../contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts",
+ "../contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts",
+ "../contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts",
+ "../order-watcher/src/order_watcher/order_watcher.ts"
],
"s3BucketPath": "s3://doc-jsons/0x.js/",
"s3StagingBucketPath": "s3://staging-doc-jsons/0x.js/"
@@ -70,11 +68,11 @@
},
"license": "Apache-2.0",
"devDependencies": {
- "@0xproject/abi-gen": "^0.3.4",
- "@0xproject/dev-utils": "^0.4.6",
- "@0xproject/migrations": "^0.0.10",
- "@0xproject/monorepo-scripts": "^0.2.2",
- "@0xproject/tslint-config": "^0.4.21",
+ "@0xproject/abi-gen": "^1.0.0",
+ "@0xproject/dev-utils": "^1.0.0",
+ "@0xproject/migrations": "^1.0.0",
+ "@0xproject/monorepo-scripts": "^1.0.0",
+ "@0xproject/tslint-config": "^1.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "^8.0.53",
@@ -100,17 +98,17 @@
"webpack": "^3.1.0"
},
"dependencies": {
- "@0xproject/assert": "^0.2.14",
- "@0xproject/base-contract": "^0.3.6",
- "@0xproject/contract-wrappers": "^0.1.1",
- "@0xproject/order-utils": "^1.0.0",
- "@0xproject/sol-compiler": "^0.5.4",
- "@0xproject/subproviders": "^0.10.6",
- "@0xproject/types": "^1.0.0",
- "@0xproject/typescript-typings": "^0.4.3",
- "@0xproject/utils": "^0.7.3",
- "@0xproject/web3-wrapper": "^0.7.3",
- "ethereum-types": "^0.0.2",
+ "@0xproject/assert": "^1.0.0",
+ "@0xproject/base-contract": "^1.0.0",
+ "@0xproject/contract-wrappers": "^1.0.0-rc.1",
+ "@0xproject/order-utils": "^1.0.0-rc.1",
+ "@0xproject/sol-compiler": "^1.0.0",
+ "@0xproject/subproviders": "^1.0.0",
+ "@0xproject/types": "^1.0.0-rc.1",
+ "@0xproject/typescript-typings": "^1.0.0",
+ "@0xproject/utils": "^1.0.0",
+ "@0xproject/web3-wrapper": "^1.0.0",
+ "ethereum-types": "^1.0.0",
"ethers": "3.0.22",
"lodash": "^4.17.4"
},
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts
index 7c06a53af..2a2b82f63 100644
--- a/packages/0x.js/src/0x.ts
+++ b/packages/0x.js/src/0x.ts
@@ -39,10 +39,6 @@ export class ZeroEx {
*/
public static NULL_ADDRESS = constants.NULL_ADDRESS;
/**
- * A set of methods to easily decode/encode assetData fields found in 0x orders.
- */
- public static assetData = assetDataUtils;
- /**
* An instance of the ExchangeWrapper class containing methods for interacting with the 0x Exchange smart contract.
*/
public exchange: ExchangeWrapper;
@@ -126,6 +122,57 @@ export class ZeroEx {
return baseUnitAmount;
}
/**
+ * Encodes an ERC20 token address into a hex encoded assetData string, usable in the makerAssetData or
+ * takerAssetData fields in a 0x order.
+ * @param tokenAddress The ERC20 token address to encode
+ * @return The hex encoded assetData string
+ */
+ public static encodeERC20AssetData(tokenAddress: string): string {
+ return assetDataUtils.encodeERC20AssetData(tokenAddress);
+ }
+ /**
+ * Decodes an ERC20 assetData hex string into it's corresponding ERC20 tokenAddress & assetProxyId
+ * @param assetData Hex encoded assetData string to decode
+ * @return An object containing the decoded tokenAddress & assetProxyId
+ */
+ public static decodeERC20AssetData(assetData: string): ERC20AssetData {
+ return assetDataUtils.decodeERC20AssetData(assetData);
+ }
+ /**
+ * Encodes an ERC721 token address into a hex encoded assetData string, usable in the makerAssetData or
+ * takerAssetData fields in a 0x order.
+ * @param tokenAddress The ERC721 token address to encode
+ * @param tokenId The ERC721 tokenId to encode
+ * @return The hex encoded assetData string
+ */
+ public static encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber): string {
+ return assetDataUtils.encodeERC721AssetData(tokenAddress, tokenId);
+ }
+ /**
+ * Decodes an ERC721 assetData hex string into it's corresponding ERC721 tokenAddress, tokenId & assetProxyId
+ * @param assetData Hex encoded assetData string to decode
+ * @return An object containing the decoded tokenAddress, tokenId & assetProxyId
+ */
+ public static decodeERC721AssetData(assetData: string): ERC721AssetData {
+ return assetDataUtils.decodeERC721AssetData(assetData);
+ }
+ /**
+ * Decode and return the assetProxyId from the assetData
+ * @param assetData Hex encoded assetData string to decode
+ * @return The assetProxyId
+ */
+ public static decodeAssetProxyId(assetData: string): AssetProxyId {
+ return assetDataUtils.decodeAssetProxyId(assetData);
+ }
+ /**
+ * Decode any assetData into it's corresponding assetData object
+ * @param assetData Hex encoded assetData string to decode
+ * @return Either a ERC20 or ERC721 assetData object
+ */
+ public static decodeAssetDataOrThrow(assetData: string): ERC20AssetData | ERC721AssetData {
+ return assetDataUtils.decodeAssetDataOrThrow(assetData);
+ }
+ /**
* Instantiates a new ZeroEx instance that provides the public interface to the 0x.js library.
* @param provider The Provider instance you would like the 0x.js library to use for interacting with
* the Ethereum network.