From 49f27acf371a88cb5aae6d442758da8322816e4b Mon Sep 17 00:00:00 2001 From: Sam McCord Date: Wed, 14 Aug 2024 15:54:47 -0600 Subject: [PATCH] feat(utils): implement filters schemas fix(utils): better zod lazy usage to fix type issues chore(utils): ignore esoteric arrayoperator type error chore(questdk): re-export zod schemas chore(types): address build issues for unknown / any types fix(utils): update zod to utilize abitype readonly chore: fix formatting --- .changeset/blue-pigs-visit.md | 5 + apps/create-plugin/src/questions.ts | 2 +- apps/questdk/src/filter/filters.ts | 61 ++++++---- apps/questdk/src/filter/index.ts | 19 +++ package.json | 2 +- packages/balancer/src/utils.ts | 2 +- packages/llama/src/Llama.ts | 3 +- packages/orbit/src/utils.ts | 2 +- packages/utils/package.json | 3 + packages/utils/src/index.ts | 17 +++ packages/utils/src/types/actions.ts | 25 +--- packages/utils/src/types/filters.ts | 179 +++++++++++++++++++++++----- packages/utils/src/types/index.ts | 19 +++ packages/vela/src/utils.ts | 4 +- pnpm-lock.yaml | 134 ++++++--------------- tsconfig.json | 1 + 16 files changed, 299 insertions(+), 179 deletions(-) create mode 100644 .changeset/blue-pigs-visit.md diff --git a/.changeset/blue-pigs-visit.md b/.changeset/blue-pigs-visit.md new file mode 100644 index 000000000..ba6fe7a05 --- /dev/null +++ b/.changeset/blue-pigs-visit.md @@ -0,0 +1,5 @@ +--- +"@rabbitholegg/questdk-plugin-utils": minor +--- + +implement filter types as zod schemas diff --git a/apps/create-plugin/src/questions.ts b/apps/create-plugin/src/questions.ts index da1c643ee..7904374ce 100644 --- a/apps/create-plugin/src/questions.ts +++ b/apps/create-plugin/src/questions.ts @@ -55,7 +55,7 @@ export const mainQuestions: PromptObject[] = [ name: 'action', message: 'How would you describe the action you want the user to take?', initial: '', - choices: _actionArray, + choices: _actionArray as Choice[], }, { type: 'confirm', diff --git a/apps/questdk/src/filter/filters.ts b/apps/questdk/src/filter/filters.ts index e3444301c..4a390b8a7 100644 --- a/apps/questdk/src/filter/filters.ts +++ b/apps/questdk/src/filter/filters.ts @@ -20,6 +20,8 @@ import { parseAbiParameters, slice, AbiParameter, + ByteArray, + Hex, } from 'viem' type OperatorKey = keyof typeof operators @@ -29,7 +31,7 @@ type OperatorKey = keyof typeof operators * @param filter - The set of filters to apply. * @returns True if all filters pass, false otherwise. */ -export const handleAnd = (context: any, filter: Filter[]): boolean => { +export const handleAnd = (context: TransactionEIP1559 | Record, filter: Filter[]): boolean => { for (let i = 0; i < filter.length; i++) { if (!apply(context, filter[i] as FilterObject)) { return false @@ -44,7 +46,7 @@ export const handleAnd = (context: any, filter: Filter[]): boolean => { * @param filter - The set of filters to apply. * @returns True if any filter passes, false otherwise. */ -export const handleOr = (context: any, filter: Filter[]): boolean => { +export const handleOr = (context: TransactionEIP1559 | Record, filter: Filter[]): boolean => { for (let i = 0; i < filter.length; i++) { if (apply(context, filter[i] as FilterObject)) { return true @@ -60,7 +62,7 @@ export const handleOr = (context: any, filter: Filter[]): boolean => { * @returns True if any filter passes, false otherwise. */ export const handleSome = ( - context: any, + context: Array>, filter: TransactionFilter | FilterObject, ): boolean => { for (let i = 0; i < context.length; i++) { @@ -77,7 +79,7 @@ export const handleSome = ( * @returns True if context is less than filter, false otherwise. */ export const handleLessThan = ( - context: any, + context: bigint | boolean | number | string, filter: bigint | number | string, ): boolean => { return BigInt(context) < BigInt(filter) @@ -90,7 +92,7 @@ export const handleLessThan = ( * @returns True if context is less than or equal to filter, false otherwise. */ export const handleLessThanOrEqual = ( - context: any, + context: bigint | boolean | number | string, filter: bigint | number | string, ): boolean => { return BigInt(context) <= BigInt(filter) @@ -103,7 +105,7 @@ export const handleLessThanOrEqual = ( * @returns True if context is equal to filter, false otherwise. */ export const handleEqual = ( - context: any, + context: bigint | boolean | number | string, filter: bigint | number | string, ): boolean => { return BigInt(context) === BigInt(filter) @@ -116,7 +118,7 @@ export const handleEqual = ( * @returns True if context is greater than filter, false otherwise. */ export const handleGreaterThan = ( - context: any, + context: bigint | boolean | number | string, filter: bigint | number | string, ): boolean => { return BigInt(context) > BigInt(filter) @@ -129,7 +131,7 @@ export const handleGreaterThan = ( * @returns True if context is greater than or equal to filter, false otherwise. */ export const handleGreaterThanOrEqual = ( - context: any, + context: bigint | boolean | number | string, filter: bigint | number | string, ): boolean => { return BigInt(context) >= BigInt(filter) @@ -142,7 +144,7 @@ export const handleGreaterThanOrEqual = ( * @returns The result of applying the filter. */ export const handleFirst = ( - context: any, + context: Array>, filter: TransactionFilter | FilterObject, ): boolean => { return apply(context[0], filter) @@ -155,7 +157,7 @@ export const handleFirst = ( * @returns The result of applying the filter. */ export const handleLast = ( - context: any, + context: Array>, filter: TransactionFilter | FilterObject, ): boolean => { return apply(context[context.length - 1], filter) @@ -167,10 +169,10 @@ export const handleLast = ( * @param filter - An object containing the index and the condition to check. * @returns True if the value at the nth index meets the condition, false otherwise. */ -export const handleNth = (context: any, filter: NthFilter): boolean => { +export const handleNth = (context: Array>, filter: NthFilter): boolean => { const { index, value } = filter - if (Number(index) < 0 || index >= context.length) { + if (Number(index) < 0 || Number(index) >= context.length) { return false // index out of bounds } return apply(context[Number(index)], value as FilterObject) @@ -182,7 +184,7 @@ export const handleNth = (context: any, filter: NthFilter): boolean => { * @param filter - The regular expression to match against. * @returns True if the context matches the filter, false otherwise. */ -export const handleRegex = (context: any, filter: string): boolean => { +export const handleRegex = (context: string, filter: string): boolean => { const re = new RegExp(filter) return re.test(context) } @@ -193,9 +195,10 @@ export const handleRegex = (context: any, filter: string): boolean => { * @param filter - An object containing the bitmask and the value to compare against. * @returns True if the masked context is equal to the value, false otherwise. */ -export const handleBitmask = (context: any, filter: BitmaskFilter): boolean => { +export const handleBitmask = (context: bigint | boolean | number | string, filter: BitmaskFilter): boolean => { const maskedContext = BigInt(context) & BigInt(filter.bitmask) if (typeof filter.value === 'object') { + // eslint-disable-next-line @typescript-eslint/no-explicit-any return apply(maskedContext as any, filter.value as FilterObject) } return maskedContext === BigInt(filter.value) @@ -207,6 +210,7 @@ export const handleBitmask = (context: any, filter: BitmaskFilter): boolean => { * @param filter - The filter containing the ABI. * @returns The decoded ABI. */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any export const handleAbiDecode = (context: any, filter: AbiFilter) => { try { const sighash = slice(context, 0, 4) @@ -222,12 +226,14 @@ export const handleAbiDecode = (context: any, filter: AbiFilter) => { }) as AbiFunction const namedArgs = [...abiItem.inputs].reduce( + // eslint-disable-next-line @typescript-eslint/no-explicit-any (acc: Record, input, index) => { acc[`${input.name || index}`] = args[index] return acc }, {}, ) + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { $abi: _, ...newFilter } = filter if (apply({ ...namedArgs, sighash, functionName }, newFilter)) { return true @@ -239,12 +245,14 @@ export const handleAbiDecode = (context: any, filter: AbiFilter) => { } export const handleAbstractAbiDecode = ( + // eslint-disable-next-line @typescript-eslint/no-explicit-any context: any, filter: AbstractAbiFilter, ) => { const decodedReturn: Array> = [] const elementCount = filter.$abiAbstract!.length const $abiAbstract = filter.$abiAbstract + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { $abiAbstract: _, ...newFilter } = filter const contextMap = new Map() @@ -284,18 +292,19 @@ export const handleAbstractAbiDecode = ( * @param filter - The filter containing the ABI parameters. * @returns The decoded ABI parameters. */ -export const handleAbiParamDecode = (context: any, filter: AbiParamFilter) => { +export const handleAbiParamDecode = (context: ByteArray | Hex, filter: AbiParamFilter) => { try { - const params = parseAbiParameters(filter.$abiParams.join(', ')) + const params = parseAbiParameters(filter.$abiParams.join(', ')) as AbiParameter[] const args = decodeAbiParameters(params, context) const namedArgs = params.reduce( - (acc: Record, param: AbiParameter, index) => { + (acc: Record, param: AbiParameter, index) => { acc[`${param.name || index}`] = args[index] return acc }, {}, ) - const { $abiParams: _, ...newFilter } = filter + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { $abiParams: _unused, ...newFilter } = filter if (apply(namedArgs, newFilter)) { return true } @@ -335,10 +344,10 @@ const operators = { * @returns True if all filters pass, false otherwise. */ export function apply( - originalContext: TransactionEIP1559 | Record, + originalContext: TransactionEIP1559 | Record, filters: TransactionFilter | FilterObject, ): boolean { - let context: TransactionEIP1559 | Record = originalContext + let context: TransactionEIP1559 | Record = originalContext if (typeof filters === 'object') { if ('$abi' in filters) { const processedContext = handleAbiDecode(context, filters as AbiFilter) @@ -367,7 +376,8 @@ export function apply( if ('$abiParams' in filters) { const processedContext = handleAbiParamDecode( - context, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + context as any, filters as AbiParamFilter, ) if (processedContext === true) { @@ -394,7 +404,8 @@ export function apply( if ( !operator( - context, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + context as any, filter as Filter[] & string & TransactionFilter & @@ -410,7 +421,8 @@ export function apply( if (!(key in context)) { return false } - if (!apply(_context, filter as FilterObject | TransactionFilter)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (!apply(_context as any, filter as FilterObject | TransactionFilter)) { return false } } else if (isAddress(_context as string)) { @@ -428,7 +440,8 @@ export function apply( ) { if ( _context === undefined || - BigInt(_context) !== BigInt(filter as bigint | number | string) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + BigInt(_context as any) !== BigInt(filter as bigint | number | string) ) { return false } diff --git a/apps/questdk/src/filter/index.ts b/apps/questdk/src/filter/index.ts index a7c78e6c1..4047aec0b 100644 --- a/apps/questdk/src/filter/index.ts +++ b/apps/questdk/src/filter/index.ts @@ -18,3 +18,22 @@ export type { Filter, FilterObject, } from '@rabbitholegg/questdk-plugin-utils' + +export { + NumericSchema, + NumericOperatorSchema, + BitmaskFilterSchema, + StringOperatorSchema, + ArrayOperatorSchema, + LogicalOperatorSchema, + FilterOperatorSchema, + TransactionFilterSchema, + PrimitiveSchema, + FilterObjectSchema, + AbiFilterSchema, + AbstractAbiFilterSchema, + AbiParamFilterSchema, + FilterSchema, + FilterArraySchema, + NthFilterSchema, +} from '@rabbitholegg/questdk-plugin-utils' diff --git a/package.json b/package.json index a0518027e..5d9d69969 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "react-intl": "6.6.2", "ts-pattern": "5.0.1", "viem": "2.15.1", - "zod": "3.21.4" + "zod": "3.23.8" }, "pnpm": { "overrides": { diff --git a/packages/balancer/src/utils.ts b/packages/balancer/src/utils.ts index c669010d5..21e8c17ee 100644 --- a/packages/balancer/src/utils.ts +++ b/packages/balancer/src/utils.ts @@ -35,7 +35,7 @@ export const buildAmountQuery = ( if (amountOut) { let condition: FilterOperator | undefined if (typeof amountOut === 'object') { - const [operator, value] = Object.entries(amountOut)[0] + const [operator, value] = Object.entries(amountOut)[0] as [string, (bigint | boolean | number | string)] switch (operator) { case '$gte': condition = { $lte: BigInt(-value) } diff --git a/packages/llama/src/Llama.ts b/packages/llama/src/Llama.ts index 39e9cefb2..d2abb0582 100644 --- a/packages/llama/src/Llama.ts +++ b/packages/llama/src/Llama.ts @@ -8,7 +8,8 @@ export const vote = async (voteParams: VoteActionParams) => { const supportIsBoolean = support !== undefined && typeof support === 'boolean' - let abi = [] + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let abi: any[] = [] if (supportIsBoolean) { // if the support param is a boolean, we only want to use the abi that matches the boolean if (support) { diff --git a/packages/orbit/src/utils.ts b/packages/orbit/src/utils.ts index 55ec0d488..0000ae668 100644 --- a/packages/orbit/src/utils.ts +++ b/packages/orbit/src/utils.ts @@ -9,7 +9,7 @@ export function getUnlockTime( const now = Math.floor(new Date().getTime() / 1000) if (typeof duration === 'object') { - const [operator, value] = Object.entries(duration)[0] + const [operator, value] = Object.entries(duration)[0] as [string, (string | number | bigint | boolean)] return { [operator]: BigInt(value) + BigInt(now) } } return { $gte: BigInt(duration) + BigInt(now) } diff --git a/packages/utils/package.json b/packages/utils/package.json index 188893564..5c73b7fb9 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -22,5 +22,8 @@ "test:cov": "vitest dev --coverage", "test:ci": "CI=true vitest --coverage", "test:ui": "vitest dev --ui" + }, + "dependencies": { + "abitype": "^1.0.6" } } diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index ff9c6ca80..12b42d13c 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -140,6 +140,23 @@ export { PremintValidationParamsSchema, PremintActionDetailSchema, PremintActionFormSchema, + // Filter Schemas + NumericSchema, + NumericOperatorSchema, + BitmaskFilterSchema, + StringOperatorSchema, + ArrayOperatorSchema, + LogicalOperatorSchema, + FilterOperatorSchema, + TransactionFilterSchema, + PrimitiveSchema, + FilterObjectSchema, + AbiFilterSchema, + AbstractAbiFilterSchema, + AbiParamFilterSchema, + FilterSchema, + FilterArraySchema, + NthFilterSchema, } from './types' export { diff --git a/packages/utils/src/types/actions.ts b/packages/utils/src/types/actions.ts index a23641308..c037f346c 100644 --- a/packages/utils/src/types/actions.ts +++ b/packages/utils/src/types/actions.ts @@ -4,7 +4,7 @@ import { type SimulateContractReturnType, type TransactionRequest, } from 'viem' -import type { FilterOperator, TransactionFilter } from './filters' +import { FilterOperatorSchema, NumericSchema, type FilterOperator, type TransactionFilter } from './filters' import { PluginActionNotImplementedError } from '../errors' import type { MintIntentParams } from './intents' import { ZodSchema, z } from 'zod' @@ -211,34 +211,15 @@ export const StakeActionFormSchema = BaseStakeActionFormaSchema export const MintActionFormSchema = z.object({ contractAddress: EthAddressSchema, tokenId: z.number().optional(), - amount: z.string().optional(), + amount: z.union([NumericSchema, FilterOperatorSchema]), amountOperator: QuestInputActionParamsAmountOperatorEnum.optional(), }) -export const NumericSchema = z.union([z.bigint(), z.string(), z.number()]) -export const AmountSchema = z.union([ - z.bigint(), - z.number(), - z.string(), - z.object({ - $gt: NumericSchema.optional(), - }), - z.object({ - $gte: NumericSchema.optional(), - }), - z.object({ - $lt: NumericSchema.optional(), - }), - z.object({ - $lte: NumericSchema.optional(), - }), -]) - export const MintActionDetailSchema = z.object({ chainId: z.number(), contractAddress: EthAddressSchema, tokenId: z.number().optional(), - amount: AmountSchema, + amount: z.union([NumericSchema, FilterOperatorSchema]), amountOperator: QuestInputActionParamsAmountOperatorEnum.optional(), }) diff --git a/packages/utils/src/types/filters.ts b/packages/utils/src/types/filters.ts index ed483f49f..5c80ebb3f 100644 --- a/packages/utils/src/types/filters.ts +++ b/packages/utils/src/types/filters.ts @@ -1,26 +1,9 @@ +// eslint-disable-next-line import/no-internal-modules +import { Abi as AbiSchema } from 'abitype/zod' import type { Abi, Transaction } from 'viem' +import { z } from 'zod' -export type ArrayOperator = - | { - $some?: FilterOperator[] - } - | { - $first?: FilterOperator - } - | { - $last?: FilterOperator - } - | { - $nth?: NthFilter - } - -export type LogicalOperator = - | { - $and?: FilterOperator[] - } - | { - $or?: FilterOperator[] - } +export const NumericSchema = z.union([z.bigint(), z.string(), z.number()]) export type NumericOperator = | bigint @@ -39,41 +22,175 @@ export type NumericOperator = $lte?: bigint | string | number } +export const NumericOperatorSchema = z.union([ + z.bigint(), + z.number(), + z.string(), + z.object({ + $gt: NumericSchema.optional(), + }), + z.object({ + $gte: NumericSchema.optional(), + }), + z.object({ + $lt: NumericSchema.optional(), + }), + z.object({ + $lte: NumericSchema.optional(), + }), +]) + +export type BitmaskFilter = { + bitmask: bigint | number | string + value: bigint | number | string | NumericOperator +} + +export const BitmaskFilterSchema = z.object({ + bitmask: z.union([z.bigint(), z.number(), z.string()]), + value: z.union([z.bigint(), z.number(), z.string(), NumericOperatorSchema]), +}) + export type StringOperator = { $regex?: string } +export const StringOperatorSchema = z.object({ + $regex: z.string().optional(), +}) + export type FilterOperator = | LogicalOperator | NumericOperator | ArrayOperator | StringOperator +export type ArrayOperator = + | { + $some?: FilterOperator[] + } + | { + $first?: FilterOperator + } + | { + $last?: FilterOperator + } + | { + $nth?: NthFilter + } + +export const ArrayOperatorSchema: z.ZodType = z.union([ + z.object({ + $some: z + .lazy(() => FilterOperatorSchema) + .array() + .optional(), + }), + z.object({ $first: z.lazy(() => FilterOperatorSchema).optional() }), + z.object({ $last: z.lazy(() => FilterOperatorSchema).optional() }), + z.object({ $nth: z.lazy(() => NthFilterSchema).optional() }), +]) + +export type LogicalOperator = + | { + $and?: FilterOperator[] + } + | { + $or?: FilterOperator[] + } + +export const LogicalOperatorSchema: z.ZodType = z.union([ + z.object({ + $and: z + .lazy(() => FilterOperatorSchema) + .array() + .optional(), + }), + z.object({ + $or: z + .lazy(() => FilterOperatorSchema) + .array() + .optional(), + }), +]) + +export const FilterOperatorSchema = z.union([ + LogicalOperatorSchema, + NumericOperatorSchema, + ArrayOperatorSchema, + StringOperatorSchema, +]) + export type TransactionFilter = { [K in keyof Transaction]: FilterOperator } +export const TransactionFilterSchema = z.record( + z.string(), + FilterOperatorSchema, +) + type Primitive = string | number | boolean +export const PrimitiveSchema = z.union([z.string(), z.number(), z.boolean()]) + export type FilterObject = { [key: string]: Filter } -export type BitmaskFilter = { - bitmask: bigint | number | string - value: bigint | number | string | NumericOperator -} -export type NthFilter = { - index: bigint | number | string - value: TransactionFilter | FilterObject -} -export type Filter = Primitive | FilterObject | FilterArray | Abi -export type FilterArray = Filter[] + +export const FilterObjectSchema: z.ZodType = z.record( + z.string(), + z.lazy(() => FilterSchema), +) + export interface AbiFilter extends FilterObject { $abi: Abi } +export const AbiFilterSchema = z + .object({ + $abi: AbiSchema, + }) + .catchall(z.lazy(() => FilterSchema)) export interface AbstractAbiFilter extends FilterObject { $abiAbstract: Abi } +export const AbstractAbiFilterSchema = z + .object({ + $abiAbstract: AbiSchema, + }) + .catchall(z.lazy(() => FilterSchema)) + export interface AbiParamFilter extends FilterObject { $abiParams: string[] } + +export const AbiParamFilterSchema = z + .object({ + $abiParams: AbiSchema, + }) + .catchall(z.lazy(() => FilterSchema)) + +export type Filter = + | Primitive + | FilterObject + | FilterArray + | FilterOperator + | Abi +export const FilterSchema = z.union([ + PrimitiveSchema, + FilterObjectSchema, + FilterOperatorSchema, + z.lazy(() => FilterSchema.array()), + AbiSchema, +]) + +export type FilterArray = Filter[] +export const FilterArraySchema = FilterSchema.array() + +export type NthFilter = { + index: bigint | number | string + value: TransactionFilter | FilterObject +} +export const NthFilterSchema = z.object({ + index: z.union([z.bigint(), z.number(), z.string()]), + value: z.union([TransactionFilterSchema, FilterObjectSchema]), +}) diff --git a/packages/utils/src/types/index.ts b/packages/utils/src/types/index.ts index 001158dc2..a5c953e32 100644 --- a/packages/utils/src/types/index.ts +++ b/packages/utils/src/types/index.ts @@ -117,6 +117,25 @@ export type { TransactionFilter, } from './filters' +export { + NumericSchema, + NumericOperatorSchema, + BitmaskFilterSchema, + StringOperatorSchema, + ArrayOperatorSchema, + LogicalOperatorSchema, + FilterOperatorSchema, + TransactionFilterSchema, + PrimitiveSchema, + FilterObjectSchema, + AbiFilterSchema, + AbstractAbiFilterSchema, + AbiParamFilterSchema, + FilterSchema, + FilterArraySchema, + NthFilterSchema, +} from './filters' + export type { Quest, QuestReward, diff --git a/packages/vela/src/utils.ts b/packages/vela/src/utils.ts index ef10710c5..0539fff77 100644 --- a/packages/vela/src/utils.ts +++ b/packages/vela/src/utils.ts @@ -36,7 +36,7 @@ export function getAmountPacked( if (amount === undefined) return undefined const multiplier = BigInt(2 ** 128) * BigInt(10 ** 12) if (typeof amount === 'object') { - const [operator, value] = Object.entries(amount)[0] + const [operator, value] = Object.entries(amount)[0] as [string, (string | number | bigint | boolean)] if (operator === '$lte' || operator === '$lt') { return { [operator]: (BigInt(value) + 1n) * multiplier } } @@ -95,7 +95,7 @@ export function getAmount(amount: Amount): FilterOperator | undefined { if (amount === undefined) return undefined const multiplier = BigInt(10 ** 12) if (typeof amount === 'object') { - const [operator, value] = Object.entries(amount)[0] + const [operator, value] = Object.entries(amount)[0] as [string, (string | number | bigint | boolean)] if (operator === '$lte' || operator === '$lt') { return { [operator]: (BigInt(value) + 1n) * multiplier } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 678a5ea93..4b3c6ad03 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,10 +23,10 @@ importers: version: 5.0.1 viem: specifier: 2.15.1 - version: 2.15.1(typescript@5.3.2)(zod@3.21.4) + version: 2.15.1(typescript@5.3.2)(zod@3.23.8) zod: - specifier: 3.21.4 - version: 3.21.4 + specifier: 3.23.8 + version: 3.23.8 devDependencies: '@changesets/changelog-github': specifier: 0.4.8 @@ -430,7 +430,7 @@ importers: dependencies: '@eth-optimism/contracts-ts': specifier: 0.15.0 - version: 0.15.0(typescript@5.3.2)(zod@3.21.4) + version: 0.15.0(typescript@5.3.2)(zod@3.23.8) '@rabbitholegg/questdk': specifier: workspace:* version: link:../../apps/questdk @@ -790,7 +790,11 @@ importers: specifier: 1.9.0 version: 1.9.0(hardhat@2.22.5) - packages/utils: {} + packages/utils: + dependencies: + abitype: + specifier: ^1.0.6 + version: 1.0.6(typescript@5.3.2)(zod@3.23.8) packages/vela: dependencies: @@ -820,10 +824,10 @@ importers: version: link:../utils '@zoralabs/protocol-sdk': specifier: 0.9.0 - version: 0.9.0(typescript@5.3.2)(viem@2.15.1)(zod@3.21.4) + version: 0.9.0(typescript@5.3.2)(viem@2.15.1)(zod@3.23.8) '@zoralabs/universal-minter': specifier: 0.2.15 - version: 0.2.15(@types/node@20.4.5)(ts-node@10.9.1)(typescript@5.3.2)(zod@3.21.4) + version: 0.2.15(@types/node@20.4.5)(ts-node@10.9.1)(typescript@5.3.2)(zod@3.23.8) packages: @@ -1809,7 +1813,7 @@ packages: requiresBuild: true dev: false - /@eth-optimism/contracts-ts@0.15.0(typescript@5.3.2)(zod@3.21.4): + /@eth-optimism/contracts-ts@0.15.0(typescript@5.3.2)(zod@3.23.8): resolution: {integrity: sha512-qga3xsj+NhnxjY96TWktKAmc2DSYrdy0E+lVkS3NZ/b5w898IisoMj/Xvv3KoovBJmnk+/ENNnMX7kk+fwQdtA==} peerDependencies: '@wagmi/core': '>1.0.0' @@ -1823,7 +1827,7 @@ packages: '@testing-library/react': 14.3.1(react-dom@18.3.1)(react@18.3.1) react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - viem: 2.15.1(typescript@5.3.2)(zod@3.21.4) + viem: 2.15.1(typescript@5.3.2)(zod@3.23.8) transitivePeerDependencies: - bufferutil - typescript @@ -2415,7 +2419,7 @@ packages: peerDependencies: viem: 2.15.1 dependencies: - viem: 2.15.1(typescript@5.3.2)(zod@3.21.4) + viem: 2.15.1(typescript@5.3.2)(zod@3.23.8) dev: false /@graphql-typed-document-node/core@3.2.0(graphql@16.8.2): @@ -2595,7 +2599,7 @@ packages: '@ledgerhq/hw-transport-node-hid-noevents': 5.51.1 '@ledgerhq/logs': 5.50.0 lodash: 4.17.21 - node-hid: 1.3.0 + node-hid: 2.1.1 usb: 1.9.2 dev: false optional: true @@ -4973,7 +4977,7 @@ packages: wagmi: optional: true dependencies: - abitype: 0.8.7(typescript@5.3.2)(zod@3.21.4) + abitype: 0.8.7(typescript@5.3.2)(zod@3.23.8) abort-controller: 3.0.0 bundle-require: 3.1.2(esbuild@0.16.17) cac: 6.7.14 @@ -4994,8 +4998,8 @@ packages: picocolors: 1.0.0 prettier: 2.8.8 typescript: 5.3.2 - viem: 2.15.1(typescript@5.3.2)(zod@3.21.4) - zod: 3.21.4 + viem: 2.15.1(typescript@5.3.2)(zod@3.23.8) + zod: 3.23.8 transitivePeerDependencies: - bufferutil - utf-8-validate @@ -5501,24 +5505,24 @@ packages: resolution: {integrity: sha512-Jf2aIHhyAsybCCv1byV5uP/YiwA/ZB3zTywDO6d15796Bf58zzC3D1ptKuh+z1Nba3dU2Hzqz0K7EEQOjoq+1A==} dev: false - /@zoralabs/protocol-sdk@0.9.0(typescript@5.3.2)(viem@2.15.1)(zod@3.21.4): + /@zoralabs/protocol-sdk@0.9.0(typescript@5.3.2)(viem@2.15.1)(zod@3.23.8): resolution: {integrity: sha512-g5Eoy9TFcUOLvOfNxRs/QT2noigTAbyVLN+siM5m7JroXB5gmwz8Ca7wE/XGffBiylgJLm9GEX0djod9AHDHhw==} peerDependencies: viem: 2.15.1 dependencies: '@zoralabs/protocol-deployments': 0.3.0 - abitype: 1.0.6(typescript@5.3.2)(zod@3.21.4) - viem: 2.15.1(typescript@5.3.2)(zod@3.21.4) + abitype: 1.0.6(typescript@5.3.2)(zod@3.23.8) + viem: 2.15.1(typescript@5.3.2)(zod@3.23.8) transitivePeerDependencies: - typescript - zod dev: false - /@zoralabs/universal-minter@0.2.15(@types/node@20.4.5)(ts-node@10.9.1)(typescript@5.3.2)(zod@3.21.4): + /@zoralabs/universal-minter@0.2.15(@types/node@20.4.5)(ts-node@10.9.1)(typescript@5.3.2)(zod@3.23.8): resolution: {integrity: sha512-4ck2Rur7ltoBTV5EdQ0TtJtSyRTnNZtZyZSWhnrglfZ7574KOOAu0E/DJCgRXhNTo4RSNCbTXQh6+7WzjehagA==} dependencies: - '@zoralabs/zora-1155-contracts': 1.6.1(@types/node@20.4.5)(ts-node@10.9.1)(zod@3.21.4) - abitype: 0.9.10(typescript@5.3.2)(zod@3.21.4) + '@zoralabs/zora-1155-contracts': 1.6.1(@types/node@20.4.5)(ts-node@10.9.1)(zod@3.23.8) + abitype: 0.9.10(typescript@5.3.2)(zod@3.23.8) transitivePeerDependencies: - '@edge-runtime/vm' - '@swc/core' @@ -5547,7 +5551,7 @@ packages: - zod dev: false - /@zoralabs/zora-1155-contracts@1.6.1(@types/node@20.4.5)(ts-node@10.9.1)(zod@3.21.4): + /@zoralabs/zora-1155-contracts@1.6.1(@types/node@20.4.5)(ts-node@10.9.1)(zod@3.23.8): resolution: {integrity: sha512-8b872/BOfaW5D8UhFOW2NIrCIXsPvTVoxPZGRs8BNXLEhgQD5nWGoWq11+9fVYxpAMAEtr6/OyvYbT4XtNHTfQ==} dependencies: '@changesets/cli': 2.26.2 @@ -5555,7 +5559,7 @@ packages: '@wagmi/cli': 1.5.2(typescript@5.3.2) '@zoralabs/openzeppelin-contracts-upgradeable': 4.8.4 '@zoralabs/protocol-rewards': 1.2.1 - abitype: 0.8.11(typescript@5.3.2)(zod@3.21.4) + abitype: 0.8.11(typescript@5.3.2)(zod@3.23.8) ds-test: github.com/dapphub/ds-test/cd98eff28324bfac652e63a239a60632a761790b es-main: 1.3.0 forge-std: github.com/foundry-rs/forge-std/705263c95892a906d7af65f0f73ce8a4a0c80b80 @@ -5567,7 +5571,7 @@ packages: tsup: 7.2.0(ts-node@10.9.1)(typescript@5.3.2) tsx: 3.14.0 typescript: 5.3.2 - viem: 2.15.1(typescript@5.3.2)(zod@3.21.4) + viem: 2.15.1(typescript@5.3.2)(zod@3.23.8) vite: 4.5.3(@types/node@20.4.5) vitest: 0.30.1 transitivePeerDependencies: @@ -5603,7 +5607,7 @@ packages: dev: true optional: true - /abitype@0.8.11(typescript@5.3.2)(zod@3.21.4): + /abitype@0.8.11(typescript@5.3.2)(zod@3.23.8): resolution: {integrity: sha512-bM4v2dKvX08sZ9IU38IN5BKmN+ZkOSd2oI4a9f0ejHYZQYV6cDr7j+d95ga0z2XHG36Y4jzoG5Z7qDqxp7fi/A==} peerDependencies: typescript: '>=5.0.4' @@ -5613,10 +5617,10 @@ packages: optional: true dependencies: typescript: 5.3.2 - zod: 3.21.4 + zod: 3.23.8 dev: false - /abitype@0.8.7(typescript@5.3.2)(zod@3.21.4): + /abitype@0.8.7(typescript@5.3.2)(zod@3.23.8): resolution: {integrity: sha512-wQ7hV8Yg/yKmGyFpqrNZufCxbszDe5es4AZGYPBitocfSqXtjrTG9JMWFcc4N30ukl2ve48aBTwt7NJxVQdU3w==} peerDependencies: typescript: '>=5.0.4' @@ -5626,10 +5630,10 @@ packages: optional: true dependencies: typescript: 5.3.2 - zod: 3.21.4 + zod: 3.23.8 dev: false - /abitype@0.9.10(typescript@5.3.2)(zod@3.21.4): + /abitype@0.9.10(typescript@5.3.2)(zod@3.23.8): resolution: {integrity: sha512-FIS7U4n7qwAT58KibwYig5iFG4K61rbhAqaQh/UWj8v1Y8mjX3F8TC9gd8cz9yT1TYel9f8nS5NO5kZp2RW0jQ==} peerDependencies: typescript: '>=5.0.4' @@ -5641,10 +5645,10 @@ packages: optional: true dependencies: typescript: 5.3.2 - zod: 3.21.4 + zod: 3.23.8 dev: false - /abitype@1.0.0(typescript@5.3.2)(zod@3.21.4): + /abitype@1.0.0(typescript@5.3.2)(zod@3.23.8): resolution: {integrity: sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==} peerDependencies: typescript: '>=5.0.4' @@ -5656,10 +5660,10 @@ packages: optional: true dependencies: typescript: 5.3.2 - zod: 3.21.4 + zod: 3.23.8 dev: false - /abitype@1.0.6(typescript@5.3.2)(zod@3.21.4): + /abitype@1.0.6(typescript@5.3.2)(zod@3.23.8): resolution: {integrity: sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==} peerDependencies: typescript: '>=5.0.4' @@ -5671,7 +5675,7 @@ packages: optional: true dependencies: typescript: 5.3.2 - zod: 3.21.4 + zod: 3.23.8 dev: false /abort-controller@3.0.0: @@ -10920,12 +10924,6 @@ packages: thenify-all: 1.6.0 dev: false - /nan@2.20.0: - resolution: {integrity: sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==} - requiresBuild: true - dev: false - optional: true - /nano-json-stream-parser@0.1.2: resolution: {integrity: sha512-9MqxMH/BSJC7dnLsEMPyfN5Dvoo49IsPFYMcHw3Bcfc2kN0lpHRBSzlMSVx4HGyJ7s9B31CyBTVehWJoQ8Ctew==} dev: false @@ -11072,19 +11070,6 @@ packages: hasBin: true dev: false - /node-hid@1.3.0: - resolution: {integrity: sha512-BA6G4V84kiNd1uAChub/Z/5s/xS3EHBCxotQ0nyYrUG65mXewUDHE1tWOSqA2dp3N+mV0Ffq9wo2AW9t4p/G7g==} - engines: {node: '>=6.0.0'} - hasBin: true - requiresBuild: true - dependencies: - bindings: 1.5.0 - nan: 2.20.0 - node-abi: 2.30.1 - prebuild-install: 5.3.6 - dev: false - optional: true - /node-hid@2.1.1: resolution: {integrity: sha512-Skzhqow7hyLZU93eIPthM9yjot9lszg9xrKxESleEs05V2NcbUptZc5HFqzjOkSmL0sFlZFr3kmvaYebx06wrw==} engines: {node: '>=10'} @@ -11118,12 +11103,6 @@ packages: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true - /noop-logger@0.1.1: - resolution: {integrity: sha512-6kM8CLXvuW5crTxsAtva2YLrRrDaiTIkIePWs9moLHqbFWT94WpNFjwS/5dfLfECg5i/lkmw3aoqVidxt23TEQ==} - requiresBuild: true - dev: false - optional: true - /normalize-package-data@2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} dependencies: @@ -11779,30 +11758,6 @@ packages: picocolors: 1.0.0 source-map-js: 1.2.0 - /prebuild-install@5.3.6: - resolution: {integrity: sha512-s8Aai8++QQGi4sSbs/M1Qku62PFK49Jm1CbgXklGz4nmHveDq0wzJkg7Na5QbnO1uNH8K7iqx2EQ/mV0MZEmOg==} - engines: {node: '>=6'} - hasBin: true - requiresBuild: true - dependencies: - detect-libc: 1.0.3 - expand-template: 2.0.3 - github-from-package: 0.0.0 - minimist: 1.2.8 - mkdirp-classic: 0.5.3 - napi-build-utils: 1.0.2 - node-abi: 2.30.1 - noop-logger: 0.1.1 - npmlog: 4.1.2 - pump: 3.0.0 - rc: 1.2.8 - simple-get: 3.1.1 - tar-fs: 2.1.1 - tunnel-agent: 0.6.0 - which-pm-runs: 1.1.0 - dev: false - optional: true - /prebuild-install@6.1.4: resolution: {integrity: sha512-Z4vpywnK1lBg+zdPCVCsKq0xO66eEV9rWo2zrROGGiRS4JtueBOdlB1FnY8lcy7JsUud/Q3ijUxyWN26Ika0vQ==} engines: {node: '>=6'} @@ -14158,7 +14113,7 @@ packages: extsprintf: 1.3.0 dev: false - /viem@2.15.1(typescript@5.3.2)(zod@3.21.4): + /viem@2.15.1(typescript@5.3.2)(zod@3.23.8): resolution: {integrity: sha512-Vrveen3vDOJyPf8Q8TDyWePG2pTdK6IpSi4P6qlvAP+rXkAeqRvwYBy9AmGm+BeYpCETAyTT0SrCP6458XSt+w==} peerDependencies: typescript: '>=5.0.4' @@ -14171,7 +14126,7 @@ packages: '@noble/hashes': 1.3.2 '@scure/bip32': 1.3.2 '@scure/bip39': 1.2.1 - abitype: 1.0.0(typescript@5.3.2)(zod@3.21.4) + abitype: 1.0.0(typescript@5.3.2)(zod@3.23.8) isows: 1.0.4(ws@8.17.1) typescript: 5.3.2 ws: 8.17.1 @@ -15115,13 +15070,6 @@ packages: /which-module@2.0.1: resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==} - /which-pm-runs@1.1.0: - resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==} - engines: {node: '>=4'} - requiresBuild: true - dev: false - optional: true - /which-pm@2.0.0: resolution: {integrity: sha512-Lhs9Pmyph0p5n5Z3mVnN0yWcbQYUAD7rbQUiMsQxOJ3T57k7RFe35SUwWMf7dsbDZks1uOmw4AecB/JMDj3v/w==} engines: {node: '>=8.15'} @@ -15430,10 +15378,6 @@ packages: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} engines: {node: '>=12.20'} - /zod@3.21.4: - resolution: {integrity: sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==} - dev: false - /zod@3.23.8: resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==} dev: false diff --git a/tsconfig.json b/tsconfig.json index da755959f..81a032f5e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ "noImplicitOverride": true, "noUnusedLocals": true, "noUnusedParameters": true, + "noImplicitAny": false, "allowJs": false, "checkJs": false, "esModuleInterop": true,