Type the ethereumjs-util

This commit is contained in:
Leonid Logvinov 2017-05-24 18:49:19 +02:00
parent 568b9fe742
commit 6470cf54e3
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
2 changed files with 12 additions and 4 deletions

View File

@ -9,13 +9,11 @@ export interface ECSignature {
s: string;
}
export type ETHAddress = string;
export class ZeroEx {
/**
* Checks if the signature is valid
*/
public static isValidSignature(data: string, signature: ECSignature, signer: ETHAddress): boolean {
public static isValidSignature(data: string, signature: ECSignature, signer: ETHAddressHex): boolean {
const dataBuff = ethUtil.toBuffer(data);
const msgHashBuff = ethUtil.hashPersonalMessage(dataBuff);
try {

12
src/ts/globals.d.ts vendored
View File

@ -1 +1,11 @@
declare module 'ethereumjs-util';
declare type PubKey = string;
declare type ETHAddressHex = string;
declare type ETHAddressBuff = Buffer;
declare module 'ethereumjs-util' {
const toBuffer: (data: string) => Buffer;
const hashPersonalMessage: (msg: Buffer) => Buffer;
const bufferToHex: (buff: Buffer) => string;
const ecrecover: (msgHashBuff: Buffer, v: number, r: Buffer, s: Buffer) => PubKey;
const pubToAddress: (pubKey: PubKey) => ETHAddressBuff;
}