aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-15 05:21:47 +0800
committerFabio Berger <me@fabioberger.com>2018-08-15 05:21:47 +0800
commit2f2582a0da3095d61a99ef09744dc0995677558e (patch)
tree54989565919038c42d495dafb7426d4148605e84 /packages/0x.js
parent8169155a6547fb0283cd0f5362aad3c0b173b00b (diff)
parentfadd292ecf367e42154856509d0ea0c20b23f2f1 (diff)
downloaddexon-sol-tools-2f2582a0da3095d61a99ef09744dc0995677558e.tar
dexon-sol-tools-2f2582a0da3095d61a99ef09744dc0995677558e.tar.gz
dexon-sol-tools-2f2582a0da3095d61a99ef09744dc0995677558e.tar.bz2
dexon-sol-tools-2f2582a0da3095d61a99ef09744dc0995677558e.tar.lz
dexon-sol-tools-2f2582a0da3095d61a99ef09744dc0995677558e.tar.xz
dexon-sol-tools-2f2582a0da3095d61a99ef09744dc0995677558e.tar.zst
dexon-sol-tools-2f2582a0da3095d61a99ef09744dc0995677558e.zip
Merge development
Diffstat (limited to 'packages/0x.js')
-rw-r--r--packages/0x.js/CHANGELOG.json13
-rw-r--r--packages/0x.js/CHANGELOG.md11
-rw-r--r--packages/0x.js/package.json38
-rw-r--r--packages/0x.js/src/0x.ts22
-rw-r--r--packages/0x.js/src/index.ts2
-rw-r--r--packages/0x.js/test/0x.js_test.ts7
6 files changed, 54 insertions, 39 deletions
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 4f39a9b8c..e96fda9af 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -1,5 +1,18 @@
[
{
+ "version": "1.0.1-rc.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ },
+ {
+ "pr": 914,
+ "note": "Update ecSignOrderHashAsync to return the signature as a string for immediate use in contracts"
+ }
+ ],
+ "timestamp": 1534210131
+ },
+ {
"version": "1.0.1-rc.2",
"changes": [
{
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index 5fe0f0c25..adeaed9eb 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -5,6 +5,11 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.1-rc.3 - _August 13, 2018_
+
+ * Dependencies updated
+ * Update ecSignOrderHashAsync to return the signature as a string for immediate use in contracts (#914)
+
## v1.0.1-rc.2 - _July 26, 2018_
* Fixed bug caused by importing non-existent dep
@@ -17,11 +22,11 @@ CHANGELOG
* Dependencies updated
-## v1.0.0-rc.2 - _July 20, 2018_
+## v1.0.0-rc.2 - _July 19, 2018_
* Remove `zeroEx.assetData` and instead re-export it's static functions directly off `ZeroEx`
-## v1.0.0-rc.1 - _July 20, 2018_
+## v1.0.0-rc.1 - _July 19, 2018_
* Remove tokenRegistry wrapper (#863)
* Rename `zeroEx.token` to `zeroEx.erc20Token`, and add `zeroEx.erc721Token` (#863)
@@ -61,7 +66,7 @@ CHANGELOG
* Renamed createOrderStateWatcher to createOrderWatcherAsync since it is now async (#579)
* Renamed ZeroExError to ContractWrappersErrors since they now lives in the @0xproject/contract-wrappers subpackage (#579)
-## v0.37.2 - _May 5, 2018_
+## v0.37.2 - _May 4, 2018_
* Dependencies updated
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index a0d4533b3..83a08bce4 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -1,6 +1,6 @@
{
"name": "0x.js",
- "version": "1.0.1-rc.2",
+ "version": "1.0.1-rc.3",
"engines": {
"node": ">=6.12"
},
@@ -50,9 +50,11 @@
},
"license": "Apache-2.0",
"devDependencies": {
- "@0xproject/dev-utils": "^1.0.3",
- "@0xproject/migrations": "^1.0.3",
- "@0xproject/tslint-config": "^1.0.4",
+ "@0xproject/abi-gen": "^1.0.5",
+ "@0xproject/dev-utils": "^1.0.4",
+ "@0xproject/migrations": "^1.0.4",
+ "@0xproject/monorepo-scripts": "^1.0.5",
+ "@0xproject/tslint-config": "^1.0.5",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "^8.0.53",
@@ -65,7 +67,7 @@
"dirty-chai": "^2.0.1",
"json-loader": "^0.5.4",
"make-promises-safe": "^1.1.0",
- "mocha": "^4.0.1",
+ "mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"opn-cli": "^3.1.0",
@@ -74,23 +76,23 @@
"source-map-support": "^0.5.0",
"tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
- "typescript": "2.7.1",
+ "typescript": "2.9.2",
"webpack": "^3.1.0"
},
"dependencies": {
- "@0xproject/assert": "^1.0.4",
- "@0xproject/base-contract": "^1.0.4",
- "@0xproject/contract-wrappers": "^1.0.1-rc.2",
- "@0xproject/order-utils": "^1.0.1-rc.2",
- "@0xproject/sol-compiler": "^1.0.4",
- "@0xproject/subproviders": "^1.0.4",
- "@0xproject/types": "^1.0.1-rc.3",
- "@0xproject/typescript-typings": "^1.0.3",
- "@0xproject/utils": "^1.0.4",
- "@0xproject/web3-wrapper": "^1.1.2",
- "ethereum-types": "^1.0.3",
+ "@0xproject/assert": "^1.0.5",
+ "@0xproject/base-contract": "^2.0.0-rc.1",
+ "@0xproject/contract-wrappers": "^1.0.1-rc.3",
+ "@0xproject/order-utils": "^1.0.1-rc.3",
+ "@0xproject/sol-compiler": "^1.0.5",
+ "@0xproject/subproviders": "^1.0.5",
+ "@0xproject/types": "^1.0.1-rc.4",
+ "@0xproject/typescript-typings": "^1.0.4",
+ "@0xproject/utils": "^1.0.5",
+ "@0xproject/web3-wrapper": "^1.2.0",
+ "ethereum-types": "^1.0.4",
"ethers": "3.0.22",
- "lodash": "^4.17.4"
+ "lodash": "^4.17.5"
},
"publishConfig": {
"access": "public"
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts
index 9c01ebd9e..cdcdac474 100644
--- a/packages/0x.js/src/0x.ts
+++ b/packages/0x.js/src/0x.ts
@@ -9,17 +9,11 @@ import {
EtherTokenWrapper,
ExchangeWrapper,
} from '@0xproject/contract-wrappers';
-import {
- assetDataUtils,
- generatePseudoRandomSalt,
- signatureUtils,
- MessagePrefixOpts,
- orderHashUtils,
-} from '@0xproject/order-utils';
+import { assetDataUtils, generatePseudoRandomSalt, signatureUtils, orderHashUtils } from '@0xproject/order-utils';
// HACK: Since we export assetDataUtils from ZeroEx and it has AssetProxyId, ERC20AssetData and ERC721AssetData
// in it's public interface, we need to import these types here.
// tslint:disable-next-line:no-unused-variable
-import { AssetProxyId, ECSignature, ERC20AssetData, ERC721AssetData, Order, SignedOrder } from '@0xproject/types';
+import { AssetProxyId, ERC20AssetData, ERC721AssetData, Order, SignedOrder, SignerType } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
@@ -237,19 +231,21 @@ export class ZeroEx {
* @param orderHash Hex encoded orderHash to sign.
* @param signerAddress The hex encoded Ethereum address you wish to sign it with. This address
* must be available via the Provider supplied to 0x.js.
- * @param messagePrefixOpts Options regarding the desired prefix and whether to add it before calling `eth_sign`
- * @return An object containing the Elliptic curve signature parameters generated by signing the orderHash.
+ * @param signerType the signer type that will perform the `eth_sign` operation. E.g Default, Metamask, Ledger or Trezor.
+ * Some implementations exhibit different behaviour. Default will assume a spec compliant eth_sign implementation.
+ * This parameter is defaulted to `SignerType.Default`.
+ * @return A hex encoded string of the Elliptic curve signature parameters generated by signing the orderHash and signature type.
*/
public async ecSignOrderHashAsync(
orderHash: string,
signerAddress: string,
- messagePrefixOpts: MessagePrefixOpts,
- ): Promise<ECSignature> {
+ signerType: SignerType = SignerType.Default,
+ ): Promise<string> {
const signature = await signatureUtils.ecSignOrderHashAsync(
this._contractWrappers.getProvider(),
orderHash,
signerAddress,
- messagePrefixOpts,
+ signerType,
);
return signature;
}
diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts
index 7bb624a64..5e465c38c 100644
--- a/packages/0x.js/src/index.ts
+++ b/packages/0x.js/src/index.ts
@@ -48,8 +48,6 @@ export {
OrderInfo,
} from '@0xproject/contract-wrappers';
-export { MessagePrefixType, MessagePrefixOpts } from '@0xproject/order-utils';
-
export {
ExchangeContractErrs,
Order,
diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts
index b4baecb1e..be2a94482 100644
--- a/packages/0x.js/test/0x.js_test.ts
+++ b/packages/0x.js/test/0x.js_test.ts
@@ -48,10 +48,11 @@ describe('ZeroEx library', () => {
const ethSignSignature =
'0x1B61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3340349190569279751135161d22529dc25add4f6069af05be04cacbda2ace225403';
const address = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
+ const bytes32Zeros = '0x0000000000000000000000000000000000000000000000000000000000000000';
it("should return false if the data doesn't pertain to the signature & address", async () => {
- return expect((zeroEx.exchange as any).isValidSignatureAsync('0x0', address, ethSignSignature)).to.become(
- false,
- );
+ return expect(
+ (zeroEx.exchange as any).isValidSignatureAsync(bytes32Zeros, address, ethSignSignature),
+ ).to.become(false);
});
it("should return false if the address doesn't pertain to the signature & data", async () => {
const validUnrelatedAddress = '0x8b0292b11a196601ed2ce54b665cafeca0347d42';