aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/address_utils.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-23 02:05:24 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-23 06:27:17 +0800
commit83c37c6a7a320326975c8afd9d49a42c9afcefd4 (patch)
treedd58346c8211d7f289a2c822a2309fe932442579 /packages/utils/src/address_utils.ts
parentac52ad88a1884979c74f418398bbf428d727cf34 (diff)
downloaddexon-sol-tools-83c37c6a7a320326975c8afd9d49a42c9afcefd4.tar
dexon-sol-tools-83c37c6a7a320326975c8afd9d49a42c9afcefd4.tar.gz
dexon-sol-tools-83c37c6a7a320326975c8afd9d49a42c9afcefd4.tar.bz2
dexon-sol-tools-83c37c6a7a320326975c8afd9d49a42c9afcefd4.tar.lz
dexon-sol-tools-83c37c6a7a320326975c8afd9d49a42c9afcefd4.tar.xz
dexon-sol-tools-83c37c6a7a320326975c8afd9d49a42c9afcefd4.tar.zst
dexon-sol-tools-83c37c6a7a320326975c8afd9d49a42c9afcefd4.zip
Address feedback
Diffstat (limited to 'packages/utils/src/address_utils.ts')
-rw-r--r--packages/utils/src/address_utils.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/utils/src/address_utils.ts b/packages/utils/src/address_utils.ts
index e25bde249..cc43bd477 100644
--- a/packages/utils/src/address_utils.ts
+++ b/packages/utils/src/address_utils.ts
@@ -1,4 +1,6 @@
+import { addHexPrefix, stripHexPrefix } from 'ethereumjs-util';
import * as jsSHA3 from 'js-sha3';
+import * as _ from 'lodash';
const BASIC_ADDRESS_REGEX = /^(0x)?[0-9a-f]{40}$/i;
const SAME_CASE_ADDRESS_REGEX = /^(0x)?([0-9a-f]{40}|[0-9A-F]{40})$/;
@@ -38,4 +40,7 @@ export const addressUtils = {
return isValidChecksummedAddress;
}
},
+ padZeros(address: string): string {
+ return addHexPrefix(_.padStart(stripHexPrefix(address), 40, '0'));
+ },
};