Skip to content

Commit

Permalink
Address Peiqian's comments and bump up version
Browse files Browse the repository at this point in the history
  • Loading branch information
gaohan137 committed May 26, 2023
1 parent 27d8929 commit 5125634
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 38 deletions.
66 changes: 29 additions & 37 deletions interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,60 +221,52 @@ export const DeleteTriggerPayloadSchema = z.object({
});
export type DeleteTriggerPayload = z.infer<typeof DeleteTriggerPayloadSchema>;

const UpdateTriggerPayloadBaseSchema = z.object({
const UpdateTriggerIdentifiersSchema = z.object({
ownerAddr: z.string().nonempty(),
chainId: ApertureSupportedChainIdEnum,
taskId: z.number().nonnegative(),
});
export type UpdateTriggerIdentifiers = z.infer<
typeof UpdateTriggerIdentifiersSchema
>;

export const UpdateTriggerClosePayloadSchema =
UpdateTriggerPayloadBaseSchema.merge(
z.object({
ownerAddr: z.string().nonempty().describe('The owner of the trigger.'),
chainId: ApertureSupportedChainIdEnum,

type: z.literal(ActionTypeEnum.enum.Close),
slippage: SlippageSchema.optional(),
maxGasProportion: MaxGasProportionSchema.optional(),
}),
);
export const UpdateTriggerClosePayloadSchema = z.object({
identifiers: UpdateTriggerIdentifiersSchema,
type: z.literal(ActionTypeEnum.enum.Close),
slippage: SlippageSchema.optional(),
maxGasProportion: MaxGasProportionSchema.optional(),
});
export type UpdateTriggerClosePayload = z.infer<
typeof UpdateTriggerClosePayloadSchema
>;

export const UpdateTriggerLimitOrderClosePayloadSchema =
UpdateTriggerPayloadBaseSchema.merge(
z.object({
type: z.literal(ActionTypeEnum.enum.LimitOrderClose),
maxGasProportion: MaxGasProportionSchema,
}),
);
export const UpdateTriggerLimitOrderClosePayloadSchema = z.object({
identifiers: UpdateTriggerIdentifiersSchema,
type: z.literal(ActionTypeEnum.enum.LimitOrderClose),
maxGasProportion: MaxGasProportionSchema,
});
export type UpdateTriggerLimitOrderClosePayload = z.infer<
typeof UpdateTriggerLimitOrderClosePayloadSchema
>;

export const UpdateTriggerReinvestPayloadSchema =
UpdateTriggerPayloadBaseSchema.merge(
z.object({
type: z.literal(ActionTypeEnum.enum.Reinvest),
slippage: SlippageSchema.optional(),
maxGasProportion: MaxGasProportionSchema.optional(),
}),
);
export const UpdateTriggerReinvestPayloadSchema = z.object({
identifiers: UpdateTriggerIdentifiersSchema,
type: z.literal(ActionTypeEnum.enum.Reinvest),
slippage: SlippageSchema.optional(),
maxGasProportion: MaxGasProportionSchema.optional(),
});
export type UpdateTriggerReinvestPayload = z.infer<
typeof UpdateTriggerReinvestPayloadSchema
>;

export const UpdateTriggerRebalancePayloadSchema =
UpdateTriggerPayloadBaseSchema.merge(
z.object({
type: z.literal(ActionTypeEnum.enum.Rebalance),
tickLower: z.number().int().optional(),
tickUpper: z.number().int().optional(),
slippage: SlippageSchema.optional(),
maxGasProportion: MaxGasProportionSchema.optional(),
}),
);
export const UpdateTriggerRebalancePayloadSchema = z.object({
identifiers: UpdateTriggerIdentifiersSchema,
type: z.literal(ActionTypeEnum.enum.Rebalance),
tickLower: z.number().int().optional(),
tickUpper: z.number().int().optional(),
slippage: SlippageSchema.optional(),
maxGasProportion: MaxGasProportionSchema.optional(),
});
export type UpdateTriggerRebalancePayload = z.infer<
typeof UpdateTriggerRebalancePayloadSchema
>;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aperture_finance/uniswap-v3-automation-sdk",
"description": "SDK for Aperture's Uniswap V3 automation platform",
"version": "0.1.5",
"version": "0.1.6",
"scripts": {
"build": "tsc --build",
"clean": "tsc --build --clean",
Expand Down

0 comments on commit 5125634

Please sign in to comment.