diff options
author | Jacob Evans <jacob@dekz.net> | 2018-07-31 17:24:19 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-08-09 10:02:12 +0800 |
commit | 45e9fbe8f93f68f3786629fff1861b1a66b90635 (patch) | |
tree | 872fb25d4f5246e132f0211ea1ffd6770c12c7e2 /packages/0x.js/src/0x.ts | |
parent | 53713188fee57391040c24cc627fdc5ab8982d2e (diff) | |
download | dexon-sol-tools-45e9fbe8f93f68f3786629fff1861b1a66b90635.tar dexon-sol-tools-45e9fbe8f93f68f3786629fff1861b1a66b90635.tar.gz dexon-sol-tools-45e9fbe8f93f68f3786629fff1861b1a66b90635.tar.bz2 dexon-sol-tools-45e9fbe8f93f68f3786629fff1861b1a66b90635.tar.lz dexon-sol-tools-45e9fbe8f93f68f3786629fff1861b1a66b90635.tar.xz dexon-sol-tools-45e9fbe8f93f68f3786629fff1861b1a66b90635.tar.zst dexon-sol-tools-45e9fbe8f93f68f3786629fff1861b1a66b90635.zip |
Introduce SignerProviderType
This allows the developer to indicate the nuanced signer provider. Some have different implementations (trezor, ledger) and others have different implementations (metamask). Breaking the abstraction of eth_sign. EthSign assumes a spec compliant implementation and can be used as a default
Diffstat (limited to 'packages/0x.js/src/0x.ts')
-rw-r--r-- | packages/0x.js/src/0x.ts | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts index 2a2b82f63..86859c368 100644 --- a/packages/0x.js/src/0x.ts +++ b/packages/0x.js/src/0x.ts @@ -14,13 +14,19 @@ 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, + SignerProviderType, +} from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; @@ -238,19 +244,19 @@ 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 SignerProviderType The type of Signer Provider which implements `eth_sign`. E.g Metamask, Ledger, Trezor or EthSign. + * @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> { + signerProviderType: SignerProviderType, + ): Promise<string> { const signature = await ecSignOrderHashAsync( this._contractWrappers.getProvider(), orderHash, signerAddress, - messagePrefixOpts, + signerProviderType, ); return signature; } |