Fix linter issues
This commit is contained in:
@@ -9,7 +9,8 @@ export interface TraceByContractAddress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAddressFromStackEntry(stackEntry: string): string {
|
function getAddressFromStackEntry(stackEntry: string): string {
|
||||||
return addressUtils.padZeros(new BigNumber(addHexPrefix(stackEntry)).toString(16));
|
const hexBase = 16;
|
||||||
|
return addressUtils.padZeros(new BigNumber(addHexPrefix(stackEntry)).toString(hexBase));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTracesByContractAddress(structLogs: StructLog[], startAddress: string): TraceByContractAddress {
|
export function getTracesByContractAddress(structLogs: StructLog[], startAddress: string): TraceByContractAddress {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import * as _ from 'lodash';
|
|||||||
|
|
||||||
const BASIC_ADDRESS_REGEX = /^(0x)?[0-9a-f]{40}$/i;
|
const BASIC_ADDRESS_REGEX = /^(0x)?[0-9a-f]{40}$/i;
|
||||||
const SAME_CASE_ADDRESS_REGEX = /^(0x)?([0-9a-f]{40}|[0-9A-F]{40})$/;
|
const SAME_CASE_ADDRESS_REGEX = /^(0x)?([0-9a-f]{40}|[0-9A-F]{40})$/;
|
||||||
|
const ADDRESS_LENGTH = 40;
|
||||||
|
|
||||||
export const addressUtils = {
|
export const addressUtils = {
|
||||||
isChecksumAddress(address: string): boolean {
|
isChecksumAddress(address: string): boolean {
|
||||||
@@ -11,8 +12,7 @@ export const addressUtils = {
|
|||||||
const unprefixedAddress = address.replace('0x', '');
|
const unprefixedAddress = address.replace('0x', '');
|
||||||
const addressHash = jsSHA3.keccak256(unprefixedAddress.toLowerCase());
|
const addressHash = jsSHA3.keccak256(unprefixedAddress.toLowerCase());
|
||||||
|
|
||||||
const addressLength = 40;
|
for (let i = 0; i < ADDRESS_LENGTH; i++) {
|
||||||
for (let i = 0; i < addressLength; i++) {
|
|
||||||
// The nth letter should be uppercase if the nth digit of casemap is 1
|
// The nth letter should be uppercase if the nth digit of casemap is 1
|
||||||
const hexBase = 16;
|
const hexBase = 16;
|
||||||
const lowercaseRange = 7;
|
const lowercaseRange = 7;
|
||||||
@@ -41,6 +41,6 @@ export const addressUtils = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
padZeros(address: string): string {
|
padZeros(address: string): string {
|
||||||
return addHexPrefix(_.padStart(stripHexPrefix(address), 40, '0'));
|
return addHexPrefix(_.padStart(stripHexPrefix(address), ADDRESS_LENGTH, '0'));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user