Skip to content

Commit ea0a9b7

Browse files
committed
add callback
1 parent 96b5d09 commit ea0a9b7

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

packages/plugin-nft-collections/src/actions/list-nft.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Action, IAgentRuntime, Memory, State } from "@elizaos/core";
22
import { ReservoirService } from "../services/reservoir";
3+
import { HandlerCallback } from "@elizaos/core";
34

45
// Helper function to extract NFT listing details from the message
56
function extractListingDetails(text: string): {
@@ -39,7 +40,9 @@ export const listNFTAction = (nftService: ReservoirService): Action => {
3940
handler: async (
4041
runtime: IAgentRuntime,
4142
message: Memory,
42-
state?: State
43+
state: State,
44+
options: any,
45+
callback: HandlerCallback
4346
) => {
4447
try {
4548
const {
@@ -92,6 +95,10 @@ export const listNFTAction = (nftService: ReservoirService): Action => {
9295
? `• Transaction: ${listing.transactionHash}\n`
9396
: "");
9497

98+
callback({
99+
text: response,
100+
});
101+
95102
await runtime.messageManager.createMemory({
96103
id: message.id,
97104
content: { text: response },

packages/plugin-nft-collections/src/actions/sweep-floor.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Action, IAgentRuntime, Memory, State } from "@elizaos/core";
22
import { ReservoirService } from "../services/reservoir";
3+
import { HandlerCallback } from "@elizaos/core";
34

45
// Helper function to extract NFT details from the message
56
function extractNFTDetails(text: string): {
@@ -34,7 +35,9 @@ export const sweepFloorAction = (nftService: ReservoirService): Action => {
3435
handler: async (
3536
runtime: IAgentRuntime,
3637
message: Memory,
37-
state?: State
38+
state: State,
39+
options: any,
40+
callback: HandlerCallback
3841
) => {
3942
try {
4043
const { collectionAddress, quantity } = extractNFTDetails(
@@ -80,7 +83,9 @@ export const sweepFloorAction = (nftService: ReservoirService): Action => {
8083
`• Average Price: ${(totalPrice / quantity).toFixed(4)} ETH\n` +
8184
`• Transaction Path: ${result.path}\n` +
8285
`• Status: ${result.steps.map((step) => `${step.action} - ${step.status}`).join(", ")}`;
83-
86+
callback({
87+
text: response,
88+
});
8489
await runtime.messageManager.createMemory({
8590
id: message.id,
8691
content: { text: response },

0 commit comments

Comments
 (0)