Skip to content

Commit

Permalink
fix: More renames _FUNCTIONS to _METHODS
Browse files Browse the repository at this point in the history
  • Loading branch information
richtera committed Nov 6, 2023
1 parent 852918c commit 1a96be1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export enum SUPPORTED_VERIFICATION_METHOD_HASHES {
HASH_KECCAK256_BYTES = '0x8019f9b1',
}

export type SUPPORTED_VERIFICATION_FUNCTIONS =
export type SUPPORTED_VERIFICATION_METHODS =
| SUPPORTED_VERIFICATION_METHOD_STRINGS
| SUPPORTED_VERIFICATION_METHOD_HASHES;

Expand All @@ -126,11 +126,11 @@ const KECCAK256_BYTES = {
sig: SUPPORTED_VERIFICATION_METHOD_HASHES.HASH_KECCAK256_BYTES,
};

export const HASH_FUNCTIONS: {
export const HASH_METHODS: {
[key: string]: {
method: Function;
name: SUPPORTED_VERIFICATION_METHOD_STRINGS;
sig: SUPPORTED_VERIFICATION_FUNCTIONS;
sig: SUPPORTED_VERIFICATION_METHODS;
};
} = {
[SUPPORTED_VERIFICATION_METHOD_STRINGS.KECCAK256_UTF8]: KECCAK256_UTF8,
Expand Down
8 changes: 4 additions & 4 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import {
} from '../types/ERC725JSONSchema';

import {
HASH_FUNCTIONS,
SUPPORTED_VERIFICATION_FUNCTIONS,
HASH_METHODS,
SUPPORTED_VERIFICATION_METHODS,
SUPPORTED_VERIFICATION_METHODS_LIST,
COMPACT_BYTES_ARRAY_STRING,
} from '../constants/constants';
Expand Down Expand Up @@ -470,7 +470,7 @@ export function encodeData(
}

export function getVerificationMethod(nameOrSig: string) {
const verificationMethod = Object.values(HASH_FUNCTIONS).find(
const verificationMethod = Object.values(HASH_METHODS).find(
({ name, sig }) => name === nameOrSig || sig === nameOrSig,
);

Expand All @@ -485,7 +485,7 @@ export function getVerificationMethod(nameOrSig: string) {

export function hashData(
data: string | Uint8Array | Record<string, any>,
nameOrSig: SUPPORTED_VERIFICATION_FUNCTIONS | string,
nameOrSig: SUPPORTED_VERIFICATION_METHODS | string,
): string {
return getVerificationMethod(nameOrSig).method(data);
}
Expand Down
4 changes: 2 additions & 2 deletions src/types/encodeData/JSONURL.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SUPPORTED_VERIFICATION_FUNCTIONS } from '../../constants/constants';
import { SUPPORTED_VERIFICATION_METHODS } from '../../constants/constants';

export interface KeyValuePair {
key: string;
Expand All @@ -11,7 +11,7 @@ interface URLData {

export interface Verification {
data: string;
method: SUPPORTED_VERIFICATION_FUNCTIONS | string;
method: SUPPORTED_VERIFICATION_METHODS | string;
source?: string;
}

Expand Down

0 comments on commit 1a96be1

Please sign in to comment.