@@ -6,11 +6,6 @@ import {
6
6
generateObjectDeprecated ,
7
7
ModelClass ,
8
8
} from "@elizaos/core" ;
9
- import {
10
- composeContext ,
11
- generateObjectDeprecated ,
12
- ModelClass ,
13
- } from "@elizaos/core" ;
14
9
import {
15
10
createConfig ,
16
11
executeRoute ,
@@ -113,27 +108,6 @@ export const swapAction = {
113
108
callback ?: any
114
109
) => {
115
110
console . log ( "Swap action handler called" ) ;
116
- const walletProvider = initWalletProvider ( runtime ) ;
117
- const action = new SwapAction ( walletProvider ) ;
118
-
119
- // Compose swap context
120
- const swapContext = composeContext ( {
121
- state,
122
- template : swapTemplate ,
123
- } ) ;
124
- const content = await generateObjectDeprecated ( {
125
- runtime,
126
- context : swapContext ,
127
- modelClass : ModelClass . LARGE ,
128
- } ) ;
129
-
130
- const swapOptions : SwapParams = {
131
- chain : content . chain ,
132
- fromToken : content . inputToken ,
133
- toToken : content . outputToken ,
134
- amount : content . amount ,
135
- slippage : content . slippage ,
136
- } ;
137
111
138
112
try {
139
113
const walletProvider = initWalletProvider ( runtime ) ;
@@ -149,12 +123,20 @@ export const swapAction = {
149
123
) ;
150
124
151
125
// Generate swap details object
152
- const swapDetails = ( await generateObjectDeprecated ( {
126
+ const content = ( await generateObjectDeprecated ( {
153
127
runtime,
154
128
context : contextWithChains ,
155
129
modelClass : ModelClass . SMALL ,
156
130
} ) ) as SwapParams ;
157
131
132
+ const swapOptions : SwapParams = {
133
+ chain : content . chain ,
134
+ fromToken : content . fromToken ,
135
+ toToken : content . toToken ,
136
+ amount : content . amount ,
137
+ slippage : content . slippage ,
138
+ } ;
139
+
158
140
const action = new SwapAction ( walletProvider ) ;
159
141
const swapResp = await action . swap ( swapOptions ) ;
160
142
if ( callback ) {
0 commit comments