Skip to content

Commit

Permalink
fix: Rename JSONURLDataToEncode
Browse files Browse the repository at this point in the history
  • Loading branch information
richtera committed Dec 12, 2023
1 parent 44bfcc1 commit 808f1b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/lib/encoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
SUPPORTED_VERIFICATION_METHOD_HASHES,
SUPPORTED_VERIFICATION_METHOD_STRINGS,
} from '../constants/constants';
import { JSONURLDataToEncode, URLDataWithHash } from '../types';
import { URLDataToEncode, URLDataWithHash } from '../types';

describe('encoder', () => {
describe('valueType', () => {
Expand Down Expand Up @@ -947,7 +947,7 @@ describe('encoder', () => {
});

it('encodes/decodes: JSONURL', () => {
const dataToEncode: JSONURLDataToEncode = {
const dataToEncode: URLDataToEncode = {
url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx',
json: {
myProperty: 'is a string',
Expand Down
6 changes: 3 additions & 3 deletions src/lib/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
toBN,
} from 'web3-utils';

import { JSONURLDataToEncode, URLDataWithHash, Verification } from '../types';
import { URLDataToEncode, URLDataWithHash, Verification } from '../types';
import { AssetURLEncode } from '../types/encodeData';

import {
Expand Down Expand Up @@ -687,7 +687,7 @@ export const valueContentEncodingMap = (
case 'VerifiableURL': {
return {
type: 'custom',
encode: (dataToEncode: JSONURLDataToEncode) => {
encode: (dataToEncode: URLDataToEncode) => {
const {
verification: { data, method } = {},
json,
Expand Down Expand Up @@ -859,7 +859,7 @@ export function decodeValueType(

export function encodeValueContent(
valueContent: string,
value: string | number | AssetURLEncode | JSONURLDataToEncode | boolean,
value: string | number | AssetURLEncode | URLDataToEncode | boolean,
): string | false {
if (valueContent.slice(0, 2) === '0x') {
return valueContent === value ? value : false;
Expand Down
16 changes: 8 additions & 8 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { arrToBufArr } from 'ethereumjs-util';

import {
JSONURLDataToEncode,
URLDataToEncode,
EncodeDataReturn,
URLDataWithHash,
Verification,
Expand Down Expand Up @@ -77,8 +77,8 @@ export function encodeKeyValue(
| string[]
| number
| number[]
| JSONURLDataToEncode
| JSONURLDataToEncode[]
| URLDataToEncode
| URLDataToEncode[]
| boolean,
name?: string,
): string | false {
Expand Down Expand Up @@ -176,7 +176,7 @@ export function guessKeyTypeFromKeyName(
export const encodeTupleKeyValue = (
valueContent: string, // i.e. (bytes4,Number,bytes16)
valueType: string, // i.e. (bytes4,bytes8,bytes16)
decodedValues: Array<string | number | JSONURLDataToEncode | string[]>,
decodedValues: Array<string | number | URLDataToEncode | string[]>,
) => {
// We assume data has already been validated at this stage

Expand Down Expand Up @@ -239,8 +239,8 @@ export function encodeKey(
| number
| (string | number)[]
| string[][]
| JSONURLDataToEncode
| JSONURLDataToEncode[]
| URLDataToEncode
| URLDataToEncode[]
| boolean,
) {
// NOTE: This will not guarantee order of array as on chain. Assumes developer must set correct order
Expand Down Expand Up @@ -340,8 +340,8 @@ export function encodeKey(
| string[]
| number
| number[]
| JSONURLDataToEncode
| JSONURLDataToEncode[],
| URLDataToEncode
| URLDataToEncode[],
schema.name,
);
default:
Expand Down
4 changes: 2 additions & 2 deletions src/types/encodeData/JSONURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export interface URLDataWithJson extends URLData {
json: Record<string, any>;
}

export type JSONURLDataToEncode = URLDataWithHash | URLDataWithJson;
export type URLDataToEncode = URLDataWithHash | URLDataWithJson;

export type EncodeDataType =
| string
| string[]
| JSONURLDataToEncode
| URLDataToEncode
| boolean
| number;

Expand Down

0 comments on commit 808f1b3

Please sign in to comment.