aboutsummaryrefslogtreecommitdiffstats
path: root/src/ts/types.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-05-26 01:47:11 +0800
committerFabio Berger <me@fabioberger.com>2017-05-26 01:47:11 +0800
commitbc8fc534332b5ea82f881bdd3a75773384714f4d (patch)
tree2e50db69032c0c5e8817db34f5a3db34ee088589 /src/ts/types.ts
parent74e7dc46b4ba8b3931a1cdf4dc7f55670219e324 (diff)
downloaddexon-0x-contracts-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar
dexon-0x-contracts-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.gz
dexon-0x-contracts-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.bz2
dexon-0x-contracts-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.lz
dexon-0x-contracts-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.xz
dexon-0x-contracts-bc8fc534332b5ea82f881bdd3a75773384714f4d.tar.zst
dexon-0x-contracts-bc8fc534332b5ea82f881bdd3a75773384714f4d.zip
Add initial exchange contract function, set up web3Wrapper, added types and utils
Diffstat (limited to 'src/ts/types.ts')
-rw-r--r--src/ts/types.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/ts/types.ts b/src/ts/types.ts
new file mode 100644
index 000000000..01380af02
--- /dev/null
+++ b/src/ts/types.ts
@@ -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;
+}