diff options
Diffstat (limited to 'packages/0x.js/src/0x.ts')
-rw-r--r-- | packages/0x.js/src/0x.ts | 22 |
1 files changed, 9 insertions, 13 deletions
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; } |