Skip to content

Commit 3764a9f

Browse files
committed
fix: ts error. add default slippage const
1 parent ffa8bf9 commit 3764a9f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/apps/ability-aerodrome-swap/src/lib/schemas.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { z } from 'zod';
22

3+
export const DEFAULT_AERODROME_SWAP_SLIPPAGE = 0.005;
4+
35
export const abilityParamsSchema = z.object({
46
action: z
57
.enum(['approve', 'swap'])
@@ -20,7 +22,7 @@ export const abilityParamsSchema = z.object({
2022
.number()
2123
.min(0)
2224
.max(1)
23-
.default(0.005)
25+
.default(DEFAULT_AERODROME_SWAP_SLIPPAGE)
2426
.optional()
2527
.describe('Slippage tolerance as decimal (e.g., 0.005 for 0.5%, default 0.5%)'),
2628
gasBufferPercentage: z

packages/apps/ability-aerodrome-swap/src/lib/vincent-ability.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
precheckFailSchema,
1212
precheckSuccessSchema,
1313
abilityParamsSchema,
14+
DEFAULT_AERODROME_SWAP_SLIPPAGE,
1415
} from './schemas';
1516
import { AbilityAction, CheckNativeTokenBalanceResultSuccess } from './types';
1617
import { checkErc20Allowance, checkErc20Balance, checkNativeTokenBalance } from './ability-checks';
@@ -218,8 +219,7 @@ export const vincentAbility = createVincentAbility({
218219
baseFeePerGasBufferPercentage,
219220
} = abilityParams;
220221

221-
// If you update the default slippage here, make sure to update the default slippage in the Zod schema as well.
222-
const SLIPPAGE = slippage ?? 0.005;
222+
const SLIPPAGE = slippage ?? DEFAULT_AERODROME_SWAP_SLIPPAGE;
223223

224224
const provider = new ethers.providers.StaticJsonRpcProvider(rpcUrl);
225225
const sugarConfigBaseMainnet = getDefaultConfig({
@@ -388,8 +388,7 @@ export const vincentAbility = createVincentAbility({
388388
const sugarExecuteSwapParams = executeSwapParams({
389389
config: sugarConfigBaseMainnet.sugarConfig,
390390
chainId,
391-
// @ts-expect-error Type 'string' is not assignable to type '`0x${string}`'
392-
commands: planner.commands,
391+
commands: planner.commands as `0x${string}`,
393392
inputs: planner.inputs,
394393
value: amount,
395394
});

0 commit comments

Comments
 (0)