aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js
diff options
context:
space:
mode:
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.