aboutsummaryrefslogtreecommitdiffstats
path: root/packages/base-contract/src/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base-contract/src/utils.ts')
-rw-r--r--packages/base-contract/src/utils.ts25
1 files changed, 0 insertions, 25 deletions
diff --git a/packages/base-contract/src/utils.ts b/packages/base-contract/src/utils.ts
deleted file mode 100644
index 61f176df5..000000000
--- a/packages/base-contract/src/utils.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { DataItem } from 'ethereum-types';
-import * as _ from 'lodash';
-
-// tslint:disable-next-line:completed-docs
-export function formatABIDataItem(abi: DataItem, value: any, formatter: (type: string, value: any) => any): any {
- const trailingArrayRegex = /\[\d*\]$/;
- if (abi.type.match(trailingArrayRegex)) {
- const arrayItemType = abi.type.replace(trailingArrayRegex, '');
- return _.map(value, val => {
- const arrayItemAbi = {
- ...abi,
- type: arrayItemType,
- };
- return formatABIDataItem(arrayItemAbi, val, formatter);
- });
- } else if (abi.type === 'tuple') {
- const formattedTuple: { [componentName: string]: DataItem } = {};
- _.forEach(abi.components, componentABI => {
- formattedTuple[componentABI.name] = formatABIDataItem(componentABI, value[componentABI.name], formatter);
- });
- return formattedTuple;
- } else {
- return formatter(abi.type, value);
- }
-}