diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-11-22 21:52:25 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-12-03 18:31:53 +0800 |
commit | 4668b0732ce4b62b3b7d19ea4e155a6d3c4e6004 (patch) | |
tree | 43cad9046ecc4c9e59e9d9743c6f076878881037 /packages/contracts/test/utils/signing_utils.ts | |
parent | 502e9c7be48caafd7725451789f896efdaf17dac (diff) | |
download | dexon-0x-contracts-4668b0732ce4b62b3b7d19ea4e155a6d3c4e6004.tar.gz dexon-0x-contracts-4668b0732ce4b62b3b7d19ea4e155a6d3c4e6004.tar.zst dexon-0x-contracts-4668b0732ce4b62b3b7d19ea4e155a6d3c4e6004.zip |
Move packages/contracts to contracts/core
Diffstat (limited to 'packages/contracts/test/utils/signing_utils.ts')
-rw-r--r-- | packages/contracts/test/utils/signing_utils.ts | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/packages/contracts/test/utils/signing_utils.ts b/packages/contracts/test/utils/signing_utils.ts deleted file mode 100644 index 21f864bfa..000000000 --- a/packages/contracts/test/utils/signing_utils.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { SignatureType } from '@0x/types'; -import * as ethUtil from 'ethereumjs-util'; - -export const signingUtils = { - signMessage(message: Buffer, privateKey: Buffer, signatureType: SignatureType): Buffer { - if (signatureType === SignatureType.EthSign) { - const prefixedMessage = ethUtil.hashPersonalMessage(message); - const ecSignature = ethUtil.ecsign(prefixedMessage, privateKey); - const signature = Buffer.concat([ - ethUtil.toBuffer(ecSignature.v), - ecSignature.r, - ecSignature.s, - ethUtil.toBuffer(signatureType), - ]); - return signature; - } else if (signatureType === SignatureType.EIP712) { - const ecSignature = ethUtil.ecsign(message, privateKey); - const signature = Buffer.concat([ - ethUtil.toBuffer(ecSignature.v), - ecSignature.r, - ecSignature.s, - ethUtil.toBuffer(signatureType), - ]); - return signature; - } else { - throw new Error(`${signatureType} is not a valid signature type`); - } - }, -}; |