diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-23 02:05:24 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-23 06:27:17 +0800 |
commit | 83c37c6a7a320326975c8afd9d49a42c9afcefd4 (patch) | |
tree | dd58346c8211d7f289a2c822a2309fe932442579 /packages/utils/src/address_utils.ts | |
parent | ac52ad88a1884979c74f418398bbf428d727cf34 (diff) | |
download | dexon-sol-tools-83c37c6a7a320326975c8afd9d49a42c9afcefd4.tar.gz 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.ts | 5 |
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')); + }, }; |