Add initial exchange contract function, set up web3Wrapper, added types and utils

This commit is contained in:
Fabio Berger
2017-05-25 19:47:11 +02:00
parent 74e7dc46b4
commit bc8fc53433
9 changed files with 252 additions and 19 deletions

30
src/ts/types.ts Normal file
View File

@@ -0,0 +1,30 @@
import * as _ from 'lodash';
// Utility function to create a K:V from a list of strings
// Adapted from: https://basarat.gitbooks.io/typescript/content/docs/types/literal-types.html
function strEnum(values: string[]): {[key: string]: string} {
return _.reduce(values, (result, key) => {
result[key] = key;
return result;
}, Object.create(null));
}
export const ZeroExError = strEnum([
'CONTRACT_DOES_NOT_EXIST',
'UNHANDLED_ERROR',
'USER_HAS_NO_ASSOCIATED_ADDRESSES',
]);
export type ZeroExError = keyof typeof ZeroExError;
/**
* Elliptic Curve signature
*/
export interface ECSignature {
v: number;
r: string;
s: string;
}
export interface ExchangeContract {
isValidSignature: any;
}