Skip to content

Commit e46cf6d

Browse files
committed
Port handler new api
1 parent 8a83953 commit e46cf6d

3 files changed

Lines changed: 35 additions & 17 deletions

File tree

src/actions/bridge.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { IAgentRuntime, Memory, State } from "@elizaos/core";
1+
import type { IAgentRuntime, Memory, State, HandlerCallback } from "@elizaos/core";
22
import {
33
composeContext,
44
generateObjectDeprecated,
@@ -89,13 +89,19 @@ export class BridgeAction {
8989
export const bridgeAction = {
9090
name: "bridge",
9191
description: "Bridge tokens between different chains",
92-
handler: async (
92+
handler: async ({
93+
runtime,
94+
message,
95+
state,
96+
options,
97+
callback,
98+
}: {
9399
runtime: IAgentRuntime,
94-
_message: Memory,
100+
message: Memory,
95101
state: State,
96-
_options: any,
97-
callback?: any
98-
) => {
102+
options: any,
103+
callback: HandlerCallback
104+
}) => {
99105
console.log("Bridge action handler called");
100106
const walletProvider = initWalletProvider(runtime);
101107
const action = new BridgeAction(walletProvider);

src/actions/swap.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { IAgentRuntime, Memory, State } from "@elizaos/core";
1+
import type { IAgentRuntime, Memory, State, HandlerCallback } from "@elizaos/core";
22
import {
33
composeContext,
44
generateObjectDeprecated,
@@ -99,13 +99,19 @@ export class SwapAction {
9999
export const swapAction = {
100100
name: "swap",
101101
description: "Swap tokens on the same chain",
102-
handler: async (
102+
handler: async ({
103+
runtime,
104+
message,
105+
state,
106+
options,
107+
callback,
108+
}: {
103109
runtime: IAgentRuntime,
104-
_message: Memory,
110+
message: Memory,
105111
state: State,
106-
_options: any,
107-
callback?: any
108-
) => {
112+
options: any,
113+
callback: HandlerCallback
114+
}) => {
109115
console.log("Swap action handler called");
110116
const walletProvider = initWalletProvider(runtime);
111117
const action = new SwapAction(walletProvider);

src/actions/transfer.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,19 @@ const buildTransferDetails = async (
107107
export const transferAction = {
108108
name: "transfer",
109109
description: "Transfer tokens between addresses on the same chain",
110-
handler: async (
110+
handler: async ({
111+
runtime,
112+
message,
113+
state,
114+
options,
115+
callback,
116+
}: {
111117
runtime: IAgentRuntime,
112-
_message: Memory,
118+
message: Memory,
113119
state: State,
114-
_options: any,
115-
callback?: HandlerCallback
116-
) => {
120+
options: any,
121+
callback: HandlerCallback
122+
}) => {
117123
console.log("Transfer action handler called");
118124
const walletProvider = initWalletProvider(runtime);
119125
const action = new TransferAction(walletProvider);

0 commit comments

Comments
 (0)