Skip to content

Commit

Permalink
update type import in generateSupportedContentTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Jan 31, 2024
1 parent ff83db7 commit 59d46aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/ensjs/src/utils/encoders/encodeAbi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { bytesToHex, stringToHex, type Hex } from 'viem'
import { UnknownContentTypeError } from '../../errors/utils.js'
import type { Prettify } from '../../types.js'

type AbiEncodeAs = 'json' | 'zlib' | 'cbor' | 'uri'
export type AbiEncodeAs = 'json' | 'zlib' | 'cbor' | 'uri'

type AbiContentType = 1 | 2 | 4 | 8

Expand Down
8 changes: 3 additions & 5 deletions packages/ensjs/src/utils/generateSupportedContentTypes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { EncodeAbiParameters } from './encoders/encodeAbi.js'
import type { AbiEncodeAs } from './encoders/encodeAbi.js'

type AbiEncodeAs = EncodeAbiParameters['encodeAs']

const abiEncodeMap: { [key in AbiEncodeAs]: bigint } = {
const abiEncodeAsMap: { [key in AbiEncodeAs]: bigint } = {
json: 1n,
zlib: 2n,
cbor: 4n,
Expand All @@ -16,7 +14,7 @@ export const generateSupportedContentTypes = (
? encodeAsItemOrList
: [encodeAsItemOrList]
return encodeAsList.reduce<bigint>((result, encodeAs) => {
const contentType = abiEncodeMap[encodeAs]
const contentType = abiEncodeAsMap[encodeAs]
if (contentType) result |= contentType
return result
}, 0n)
Expand Down

0 comments on commit 59d46aa

Please sign in to comment.