diff options
author | Jacob Evans <dekz@dekz.net> | 2018-08-14 07:36:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-14 07:36:11 +0800 |
commit | e51deb93eef2e59a3577195becfb6d602df3892a (patch) | |
tree | a74ca989588877d3552f28144d40b015f1f5b67e /packages/0x.js | |
parent | 0025c6640b3a5840bacfb4ab5f6e937fc9af8eff (diff) | |
parent | a3517574936aa6a4911003dbff06302926b04cb4 (diff) | |
download | dexon-sol-tools-e51deb93eef2e59a3577195becfb6d602df3892a.tar dexon-sol-tools-e51deb93eef2e59a3577195becfb6d602df3892a.tar.gz dexon-sol-tools-e51deb93eef2e59a3577195becfb6d602df3892a.tar.bz2 dexon-sol-tools-e51deb93eef2e59a3577195becfb6d602df3892a.tar.lz dexon-sol-tools-e51deb93eef2e59a3577195becfb6d602df3892a.tar.xz dexon-sol-tools-e51deb93eef2e59a3577195becfb6d602df3892a.tar.zst dexon-sol-tools-e51deb93eef2e59a3577195becfb6d602df3892a.zip |
Merge pull request #914 from 0xProject/feature/0x.js/ec-signature-string
0x.js Return signature as a hex encoded string
Diffstat (limited to 'packages/0x.js')
-rw-r--r-- | packages/0x.js/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/0x.js/src/0x.ts | 15 | ||||
-rw-r--r-- | packages/0x.js/src/index.ts | 2 |
3 files changed, 18 insertions, 8 deletions
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json index 913b7a76e..a1bdcc506 100644 --- a/packages/0x.js/CHANGELOG.json +++ b/packages/0x.js/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "1.0.1-rc.4", + "changes": [ + { + "pr": 914, + "note": "Update ecSignOrderHashAsync to return the signature as a string for immediate use in contracts" + } + ] + }, + { "version": "1.0.1-rc.3", "changes": [ { diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 2a2b82f63..48d00c1ac 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -14,13 +14,12 @@ import { ecSignOrderHashAsync, generatePseudoRandomSalt, isValidSignatureAsync, - MessagePrefixOpts, 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'; @@ -238,19 +237,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 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 95ca07eea..2ba60e730 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -1,12 +1,12 @@ export { ZeroEx } from './0x'; -export { MessagePrefixType, MessagePrefixOpts } from '@0xproject/order-utils'; export { Web3ProviderEngine, RPCSubprovider } from '@0xproject/subproviders'; export { ExchangeContractErrs, Order, SignedOrder, + SignerType, ECSignature, OrderStateValid, OrderStateInvalid, |