@rabbitholegg/questdk-plugin-utils
Advanced tools
Comparing version 1.0.0-alpha.47 to 1.0.0-alpha.48
# @rabbitholegg/questdk-plugin-utils | ||
## 1.0.0-alpha.48 | ||
### Minor Changes | ||
- [#517](https://github.com/rabbitholegg/questdk-plugins/pull/517) [`ab67847e`](https://github.com/rabbitholegg/questdk-plugins/commit/ab67847e37e4cb67011f5723c665c345fd8b81ea) Thanks [@sammccord](https://github.com/sammccord)! - allow any combination of filters in mint params | ||
## 1.0.0-alpha.47 | ||
@@ -4,0 +10,0 @@ |
export { CHAIN_TO_TOKENS, Chains, DEFAULT_ACCOUNT, BOOST_TREASURY_ADDRESS, DEFAULT_REFERRAL, } from './constants/index'; | ||
export type { TestParams, TestCase } from './helpers/index'; | ||
export { chainIdToViemChain, createTestCase, getExitAddresses, formatAmountToFilterOperator, formatAmountToInteger, } from './helpers'; | ||
export type { IntentParams, MintIntentParams, SwapActionParams, OptionsActionParams, StakeActionParams, BridgeActionParams, VoteActionParams, MintActionParams, BurnActionParams, QuestActionParams, DelegateActionParams, ActionParams, FollowActionParams, RecastActionParams, CreateActionParams, CompleteActionParams, CompleteValidationParams, CompleteActionForm, CollectActionParams, CollectValidationParams, CollectActionForm, CollectActionDetail, IActionPlugin, FilterObject, BitmaskFilter, NthFilter, Filter, FilterArray, AbiFilter, AbstractAbiFilter, AbiParamFilter, ArrayOperator, LogicalOperator, NumericOperator, StringOperator, FilterOperator, TransactionFilter, DisctriminatedActionParams, Quest, QuestReward, QuestAndReward, RewardType, NetworkWithChainId, Reward, Task, QuestDetails, RewardWithClaim, QuestInputActionParamsAmountOperator, BridgeActionDetail, SwapActionDetail, DelegateActionDetail, DelegateActionForm, StakeActionDetail, MintActionDetail, MintActionForm, VoteActionDetail, VoteActionForm, OptionsActionDetail, OptionsActionForm, ActionParamsForm, CreateQuestInput, QuestActionParamsByType, FollowValidationParams, FollowActionDetail, FollowActionForm, RecastValidationParams, RecastActionDetail, RecastActionForm, ValidationParams, ActionValidation, PluginActionPayload, PluginActionValidation, QuestCompletionPayload, PremintActionParams, PremintValidationParams, PremintActionDetail, PremintActionForm, } from './types'; | ||
export type { IntentParams, MintIntentParams, SwapActionParams, OptionsActionParams, StakeActionParams, BridgeActionParams, VoteActionParams, MintActionParams, BurnActionParams, QuestActionParams, DelegateActionParams, ActionParams, FollowActionParams, RecastActionParams, CreateActionParams, CompleteActionParams, CompleteValidationParams, CompleteActionForm, CollectActionParams, CollectValidationParams, CollectActionForm, CollectActionDetail, IActionPlugin, FilterObject, BitmaskFilter, NthFilter, Filter, FilterArray, AbiFilter, AbstractAbiFilter, AbiParamFilter, ArrayOperator, LogicalOperator, NumericOperator, StringOperator, FilterOperator, TransactionFilter, DisctriminatedActionParams, Quest, QuestReward, QuestAndReward, RewardType, NetworkWithChainId, Reward, Task, QuestDetails, RewardWithClaim, QuestInputActionParamsAmountOperator, BridgeActionDetail, SwapActionDetail, DelegateActionDetail, DelegateActionForm, StakeActionDetail, MintActionDetail, MintActionForm, VoteActionDetail, VoteActionForm, OptionsActionDetail, OptionsActionForm, ActionParamsForm, CreateQuestInput, QuestActionParamsByType, FollowValidationParams, FollowActionDetail, FollowActionForm, RecastValidationParams, RecastActionDetail, RecastActionForm, ValidationParams, ActionValidation, PluginActionPayload, PluginActionValidation, QuestCompletionPayload, PremintActionParams, PremintValidationParams, PremintActionDetail, PremintActionForm, Primitive, } from './types'; | ||
export { ActionType, OrderType, GetQuestsResponseSchema, NetworkWithChainIdSchema, QuestDetailsSchema, RewardWithClaimSchema, QuestInputActionParamsAmountOperatorEnum, QuestInputActionParamsAmountOperatorWithoutAny, BridgeActionDetailSchema, SwapActionDetailSchema, DelegateActionFormSchema, DelegateActionDetailSchema, StakeActionDetailSchema, BridgeActionFormSchema, SwapActionFormSchema, BaseStakeActionFormaSchema, StakeActionFormSchema, MintActionFormSchema, MintActionDetailSchema, VoteActionFormSchema, VoteActionDetailSchema, OptionsActionFormSchema, OptionsActionDetailSchema, ActionParamsFormSchema, CreateQuestInputSchema, EthAddressSchema, QuestActionParamsSchema, NetworkNameSchema, FollowActionFormSchema, FollowActionDetailSchema, FollowValidationParamsSchema, RecastActionFormSchema, RecastActionDetailSchema, RecastValidationParamsSchema, CollectActionFormSchema, CollectActionDetailSchema, CollectValidationParamsSchema, ActionParamsSchema, ValidationParamsSchema, ActionValidationSchema, PluginActionValidationSchema, PremintValidationParamsSchema, PremintActionDetailSchema, PremintActionFormSchema, NumericSchema, NumericOperatorSchema, BitmaskFilterSchema, StringOperatorSchema, ArrayOperatorSchema, LogicalOperatorSchema, FilterOperatorSchema, TransactionFilterSchema, PrimitiveSchema, FilterObjectSchema, AbiFilterSchema, AbstractAbiFilterSchema, AbiParamFilterSchema, FilterSchema, FilterArraySchema, NthFilterSchema, } from './types'; | ||
export { PluginActionNotImplementedError, ValidationNotValid, } from './errors'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,7 +7,7 @@ import { z } from 'zod'; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
chainId: string; | ||
}, { | ||
name: string; | ||
}, { | ||
chainId: string; | ||
name: string; | ||
}>; | ||
@@ -14,0 +14,0 @@ export type NetworkName = z.infer<typeof NetworkNameSchema>; |
@@ -104,7 +104,7 @@ import type { Abi, Transaction } from 'viem'; | ||
export type ArrayOperator = { | ||
$some?: FilterOperator[]; | ||
$some?: Filter[]; | ||
} | { | ||
$first?: FilterOperator; | ||
$first?: Filter; | ||
} | { | ||
$last?: FilterOperator; | ||
$last?: Filter; | ||
} | { | ||
@@ -115,5 +115,5 @@ $nth?: NthFilter; | ||
export type LogicalOperator = { | ||
$and?: FilterOperator[]; | ||
$and?: Filter[]; | ||
} | { | ||
$or?: FilterOperator[]; | ||
$or?: Filter[]; | ||
}; | ||
@@ -153,37 +153,7 @@ export declare const LogicalOperatorSchema: z.ZodType<LogicalOperator>; | ||
export type TransactionFilter = { | ||
[K in keyof Transaction]: FilterOperator; | ||
[K in keyof Partial<Transaction>]: Filter; | ||
}; | ||
export declare const TransactionFilterSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodType<LogicalOperator, z.ZodTypeDef, LogicalOperator>, z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString, z.ZodObject<{ | ||
$gt: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodString, z.ZodNumber]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
$gt?: string | number | bigint | undefined; | ||
}, { | ||
$gt?: string | number | bigint | undefined; | ||
}>, z.ZodObject<{ | ||
$gte: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodString, z.ZodNumber]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
$gte?: string | number | bigint | undefined; | ||
}, { | ||
$gte?: string | number | bigint | undefined; | ||
}>, z.ZodObject<{ | ||
$lt: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodString, z.ZodNumber]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
$lt?: string | number | bigint | undefined; | ||
}, { | ||
$lt?: string | number | bigint | undefined; | ||
}>, z.ZodObject<{ | ||
$lte: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodString, z.ZodNumber]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
$lte?: string | number | bigint | undefined; | ||
}, { | ||
$lte?: string | number | bigint | undefined; | ||
}>]>, z.ZodType<ArrayOperator, z.ZodTypeDef, ArrayOperator>, z.ZodObject<{ | ||
$regex: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
$regex?: string | undefined; | ||
}, { | ||
$regex?: string | undefined; | ||
}>]>>; | ||
type Primitive = string | number | boolean; | ||
export declare const PrimitiveSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>; | ||
export declare const TransactionFilterSchema: z.ZodType<TransactionFilter>; | ||
export type Primitive = string | number | boolean | bigint; | ||
export declare const PrimitiveSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodBigInt]>; | ||
export type FilterObject = { | ||
@@ -1222,3 +1192,3 @@ [key: string]: Filter; | ||
}, z.ZodLazy<any>, "strip">>; | ||
export type Filter = Primitive | FilterObject | FilterArray | FilterOperator | Abi; | ||
export type Filter = Primitive | Array<Primitive> | FilterObject | FilterArray | FilterOperator | Abi; | ||
export declare const FilterSchema: any; | ||
@@ -1229,65 +1199,14 @@ export type FilterArray = Filter[]; | ||
index: bigint | number | string; | ||
value: TransactionFilter | FilterObject; | ||
value: TransactionFilter | Filter; | ||
}; | ||
export declare const NthFilterSchema: z.ZodObject<{ | ||
index: z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>; | ||
value: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodType<LogicalOperator, z.ZodTypeDef, LogicalOperator>, z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString, z.ZodObject<{ | ||
$gt: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodString, z.ZodNumber]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
$gt?: string | number | bigint | undefined; | ||
}, { | ||
$gt?: string | number | bigint | undefined; | ||
}>, z.ZodObject<{ | ||
$gte: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodString, z.ZodNumber]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
$gte?: string | number | bigint | undefined; | ||
}, { | ||
$gte?: string | number | bigint | undefined; | ||
}>, z.ZodObject<{ | ||
$lt: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodString, z.ZodNumber]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
$lt?: string | number | bigint | undefined; | ||
}, { | ||
$lt?: string | number | bigint | undefined; | ||
}>, z.ZodObject<{ | ||
$lte: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodString, z.ZodNumber]>>; | ||
}, "strip", z.ZodTypeAny, { | ||
$lte?: string | number | bigint | undefined; | ||
}, { | ||
$lte?: string | number | bigint | undefined; | ||
}>]>, z.ZodType<ArrayOperator, z.ZodTypeDef, ArrayOperator>, z.ZodObject<{ | ||
$regex: z.ZodOptional<z.ZodString>; | ||
}, "strip", z.ZodTypeAny, { | ||
$regex?: string | undefined; | ||
}, { | ||
$regex?: string | undefined; | ||
}>]>>, z.ZodType<FilterObject, z.ZodTypeDef, FilterObject>]>; | ||
value: z.ZodUnion<[z.ZodType<TransactionFilter, z.ZodTypeDef, TransactionFilter>, z.ZodType<FilterObject, z.ZodTypeDef, FilterObject>]>; | ||
}, "strip", z.ZodTypeAny, { | ||
value: Record<string, string | number | bigint | { | ||
$gt?: string | number | bigint | undefined; | ||
} | { | ||
$gte?: string | number | bigint | undefined; | ||
} | { | ||
$lt?: string | number | bigint | undefined; | ||
} | { | ||
$lte?: string | number | bigint | undefined; | ||
} | { | ||
$regex?: string | undefined; | ||
} | LogicalOperator | ArrayOperator> | FilterObject; | ||
value: FilterObject | TransactionFilter; | ||
index: string | number | bigint; | ||
}, { | ||
value: Record<string, string | number | bigint | { | ||
$gt?: string | number | bigint | undefined; | ||
} | { | ||
$gte?: string | number | bigint | undefined; | ||
} | { | ||
$lt?: string | number | bigint | undefined; | ||
} | { | ||
$lte?: string | number | bigint | undefined; | ||
} | { | ||
$regex?: string | undefined; | ||
} | LogicalOperator | ArrayOperator> | FilterObject; | ||
value: FilterObject | TransactionFilter; | ||
index: string | number | bigint; | ||
}>; | ||
export {}; | ||
//# sourceMappingURL=filters.d.ts.map |
@@ -6,3 +6,3 @@ export type { IntentParams, MintIntentParams } from './intents'; | ||
export { ActionType, OrderType } from './actions'; | ||
export type { FilterObject, BitmaskFilter, NthFilter, Filter, FilterArray, AbiFilter, AbstractAbiFilter, AbiParamFilter, ArrayOperator, LogicalOperator, NumericOperator, StringOperator, FilterOperator, TransactionFilter, } from './filters'; | ||
export type { Primitive, FilterObject, BitmaskFilter, NthFilter, Filter, FilterArray, AbiFilter, AbstractAbiFilter, AbiParamFilter, ArrayOperator, LogicalOperator, NumericOperator, StringOperator, FilterOperator, TransactionFilter, } from './filters'; | ||
export { NumericSchema, NumericOperatorSchema, BitmaskFilterSchema, StringOperatorSchema, ArrayOperatorSchema, LogicalOperatorSchema, FilterOperatorSchema, TransactionFilterSchema, PrimitiveSchema, FilterObjectSchema, AbiFilterSchema, AbstractAbiFilterSchema, AbiParamFilterSchema, FilterSchema, FilterArraySchema, NthFilterSchema, } from './filters'; | ||
@@ -9,0 +9,0 @@ export type { Quest, QuestReward, QuestAndReward, RewardType, NetworkWithChainId, Reward, Task, QuestDetails, RewardWithClaim, CreateQuestInput, QuestActionParamsByType, QuestCompletionPayload, } from './quests'; |
{ | ||
"name": "@rabbitholegg/questdk-plugin-utils", | ||
"version": "1.0.0-alpha.47", | ||
"version": "1.0.0-alpha.48", | ||
"exports": { | ||
@@ -5,0 +5,0 @@ "require": "./dist/cjs/index.js", |
@@ -96,2 +96,3 @@ export { | ||
PremintActionForm, | ||
Primitive, | ||
} from './types' | ||
@@ -98,0 +99,0 @@ |
@@ -0,18 +1,17 @@ | ||
import { UUID } from 'crypto' | ||
import { | ||
type Address, | ||
type PublicClient, | ||
type Address, | ||
type SimulateContractReturnType, | ||
type TransactionRequest, | ||
} from 'viem' | ||
import { ZodSchema, z } from 'zod' | ||
import { PluginActionNotImplementedError } from '../errors' | ||
import { EthAddressSchema } from './common' | ||
import { | ||
FilterOperatorSchema, | ||
NumericSchema, | ||
FilterSchema, | ||
type FilterOperator, | ||
type TransactionFilter, | ||
} from './filters' | ||
import { PluginActionNotImplementedError } from '../errors' | ||
import type { MintIntentParams } from './intents' | ||
import { ZodSchema, z } from 'zod' | ||
import { EthAddressSchema } from './common' | ||
import { UUID } from 'crypto' | ||
import { QuestCompletionPayload } from './quests' | ||
@@ -219,3 +218,3 @@ | ||
tokenId: z.number().optional(), | ||
amount: z.union([NumericSchema, FilterOperatorSchema]), | ||
amount: FilterSchema, | ||
amountOperator: QuestInputActionParamsAmountOperatorEnum.optional(), | ||
@@ -228,3 +227,3 @@ }) | ||
tokenId: z.number().optional(), | ||
amount: z.union([NumericSchema, FilterOperatorSchema]), | ||
amount: FilterSchema, | ||
amountOperator: QuestInputActionParamsAmountOperatorEnum.optional(), | ||
@@ -231,0 +230,0 @@ }) |
@@ -69,9 +69,9 @@ // eslint-disable-next-line import/no-internal-modules | ||
| { | ||
$some?: FilterOperator[] | ||
$some?: Filter[] | ||
} | ||
| { | ||
$first?: FilterOperator | ||
$first?: Filter | ||
} | ||
| { | ||
$last?: FilterOperator | ||
$last?: Filter | ||
} | ||
@@ -85,9 +85,9 @@ | { | ||
$some: z | ||
.lazy(() => FilterOperatorSchema) | ||
.lazy(() => FilterSchema) | ||
.array() | ||
.optional(), | ||
}), | ||
z.object({ $first: z.lazy(() => FilterOperatorSchema).optional() }), | ||
z.object({ $last: z.lazy(() => FilterOperatorSchema).optional() }), | ||
z.object({ $nth: z.lazy(() => NthFilterSchema).optional() }), | ||
z.object({ $first: z.lazy(() => FilterSchema).optional() }), | ||
z.object({ $last: z.lazy(() => FilterSchema).optional() }), | ||
z.object({ $nth: z.lazy(() => FilterSchema).optional() }), | ||
]) | ||
@@ -97,6 +97,6 @@ | ||
| { | ||
$and?: FilterOperator[] | ||
$and?: Filter[] | ||
} | ||
| { | ||
$or?: FilterOperator[] | ||
$or?: Filter[] | ||
} | ||
@@ -107,3 +107,3 @@ | ||
$and: z | ||
.lazy(() => FilterOperatorSchema) | ||
.lazy(() => FilterSchema) | ||
.array() | ||
@@ -114,3 +114,3 @@ .optional(), | ||
$or: z | ||
.lazy(() => FilterOperatorSchema) | ||
.lazy(() => FilterSchema) | ||
.array() | ||
@@ -129,12 +129,17 @@ .optional(), | ||
export type TransactionFilter = { | ||
[K in keyof Transaction]: FilterOperator | ||
[K in keyof Partial<Transaction>]: Filter | ||
} | ||
export const TransactionFilterSchema = z.record( | ||
export const TransactionFilterSchema: z.ZodType<TransactionFilter> = z.record( | ||
z.string(), | ||
FilterOperatorSchema, | ||
z.lazy(() => FilterSchema), | ||
) | ||
type Primitive = string | number | boolean | ||
export const PrimitiveSchema = z.union([z.string(), z.number(), z.boolean()]) | ||
export type Primitive = string | number | boolean | bigint | ||
export const PrimitiveSchema = z.union([ | ||
z.string(), | ||
z.number(), | ||
z.boolean(), | ||
z.bigint(), | ||
]) | ||
@@ -180,2 +185,3 @@ export type FilterObject = { | ||
| Primitive | ||
| Array<Primitive> | ||
| FilterObject | ||
@@ -187,2 +193,3 @@ | FilterArray | ||
PrimitiveSchema, | ||
PrimitiveSchema.array(), | ||
FilterObjectSchema, | ||
@@ -199,3 +206,3 @@ FilterOperatorSchema, | ||
index: bigint | number | string | ||
value: TransactionFilter | FilterObject | ||
value: TransactionFilter | Filter | ||
} | ||
@@ -202,0 +209,0 @@ export const NthFilterSchema = z.object({ |
@@ -104,2 +104,3 @@ export type { IntentParams, MintIntentParams } from './intents' | ||
export type { | ||
Primitive, | ||
FilterObject, | ||
@@ -106,0 +107,0 @@ BitmaskFilter, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1520674
22034