aboutsummaryrefslogtreecommitdiffstats
path: root/packages/pipeline/src/utils/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/pipeline/src/utils/index.ts')
-rw-r--r--packages/pipeline/src/utils/index.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/pipeline/src/utils/index.ts b/packages/pipeline/src/utils/index.ts
index a083cd8c9..78aa89374 100644
--- a/packages/pipeline/src/utils/index.ts
+++ b/packages/pipeline/src/utils/index.ts
@@ -1,4 +1,5 @@
import { BigNumber } from '@0x/utils';
+import { ValueTransformer } from 'typeorm/decorator/options/ValueTransformer';
/**
* If the given BigNumber is not null, returns the string representation of that
@@ -34,3 +35,17 @@ export function handleError(e: any): void {
}
process.exit(1);
}
+
+class BigNumberTransformer implements ValueTransformer {
+ // tslint:disable-next-line:prefer-function-over-method
+ public to(value: BigNumber): string {
+ return value.toString();
+ }
+
+ // tslint:disable-next-line:prefer-function-over-method
+ public from(value: string): BigNumber {
+ return new BigNumber(value);
+ }
+}
+
+export const bigNumberTransformer = new BigNumberTransformer();