From 5adfcb58b2b2e06fac4499ed6a53ad2d4ef0ede6 Mon Sep 17 00:00:00 2001 From: ybgbob Date: Thu, 23 Jan 2025 19:58:02 +0800 Subject: [PATCH] feat: Update transfer bnb to gnfd template --- packages/plugin-bnb/src/actions/gnfd.ts | 9 ++++++--- packages/plugin-bnb/src/actions/transfer.ts | 8 ++++---- packages/plugin-bnb/src/templates/index.ts | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/plugin-bnb/src/actions/gnfd.ts b/packages/plugin-bnb/src/actions/gnfd.ts index 44039623c43..0e82564d07e 100644 --- a/packages/plugin-bnb/src/actions/gnfd.ts +++ b/packages/plugin-bnb/src/actions/gnfd.ts @@ -272,7 +272,7 @@ export const greenfieldAction = { break; } - case "transfer": { + case "transferBNBToGreenfield": { const hash = await action.bnbTransferToGnfd(content.content, runtime) result = `transfer bnb to greenfield successfully, hash: ${hash}`; break; @@ -329,8 +329,11 @@ export const greenfieldAction = { { user: "user", content: { - text: "for create account on greenfield, transfer ${amount} BNB to myself", + text: "Transfer 0.00001 BNB to myself greenfield for create account", action: "GREENFIELD_ACTION", + content: { + amount: "0.00001" + } }, }, ], @@ -340,7 +343,7 @@ export const greenfieldAction = { "CREATE_BUCKET", "UPLOAD_OBJECT", "DELETE_BUCKET", - "BNB_TRANSFER_TO_GREENFIELD", + "TRANSFER_BNB_TO_GREENFIELD", ], }; diff --git a/packages/plugin-bnb/src/actions/transfer.ts b/packages/plugin-bnb/src/actions/transfer.ts index c32534bad31..a4373388b66 100644 --- a/packages/plugin-bnb/src/actions/transfer.ts +++ b/packages/plugin-bnb/src/actions/transfer.ts @@ -222,13 +222,13 @@ export const transferAction = { { user: "{{user1}}", content: { - text: "Transfer 1 BNB to 0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + text: "Transfer 1 BNB to wallet 0x742d35Cc6634C0532925a3b844Bc454e4438f44e", }, }, { user: "{{agent}}", content: { - text: "I'll help you transfer 1 BNB to 0x742d35Cc6634C0532925a3b844Bc454e4438f44e on BSC", + text: "I'll help you transfer 1 BNB to wallet 0x742d35Cc6634C0532925a3b844Bc454e4438f44e on BSC", action: "TRANSFER", content: { chain: "bsc", @@ -243,13 +243,13 @@ export const transferAction = { { user: "{{user1}}", content: { - text: "Transfer 1 token of 0x1234 to 0x742d35Cc6634C0532925a3b844Bc454e4438f44e", + text: "Transfer 1 token of 0x1234 to wallet 0x742d35Cc6634C0532925a3b844Bc454e4438f44e", }, }, { user: "{{agent}}", content: { - text: "I'll help you transfer 1 token of 0x1234 to 0x742d35Cc6634C0532925a3b844Bc454e4438f44e on BSC", + text: "I'll help you transfer 1 token of 0x1234 to wallet 0x742d35Cc6634C0532925a3b844Bc454e4438f44e on BSC", action: "TRANSFER", content: { chain: "bsc", diff --git a/packages/plugin-bnb/src/templates/index.ts b/packages/plugin-bnb/src/templates/index.ts index dc0a3911c91..80365597829 100644 --- a/packages/plugin-bnb/src/templates/index.ts +++ b/packages/plugin-bnb/src/templates/index.ts @@ -183,14 +183,14 @@ Respond with a JSON markdown block containing only the extracted values. Use nul \`\`\` `; -export const greenfieldTemplate = `Given the recent messages and wallet information below: +export const greenfieldTemplate = `Given the recent messages and wallet information below(only including 'Greenfield' keyword): {{recentMessages}} {{walletInfo}} Extract the following details for Greenfield operations: -- **actionType** (string): The type of operation to perform (e.g., "createBucket", "uploadObject", "deleteObject", "transfer") +- **actionType** (string): The type of operation to perform (e.g., "createBucket", "uploadObject", "deleteObject", "transferBNBToGreenfield") - **bucketName** (string, optional): The name of the bucket to operate - **objectName** (string, optional): The name of the object for upload operations - **visibility** (string, optional): Bucket visibility setting ("private" or "public") @@ -199,7 +199,7 @@ Extract the following details for Greenfield operations: Required response format: \`\`\`json { - "actionType": "createBucket" | "uploadObject" | "deleteObject" | "transfer", + "actionType": "createBucket" | "uploadObject" | "deleteObject" | "transferBNBToGreenfield", "bucketName": string, "objectName": string, "visibility": "private" | "public",