Skip to content

Commit

Permalink
feat: Template support cross chain transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
ybgbob committed Jan 24, 2025
1 parent 5adfcb5 commit 9d675d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions packages/plugin-bnb/src/actions/gnfd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { DelegatedPubObjectRequest } from "@bnb-chain/greenfield-js-sdk";
import { SupportedChain } from "../types";
import { CROSS_CHAIN_ABI } from "../abi/CrossChainAbi";
import { TOKENHUB_ABI } from "../abi/TokenHubAbi";
import { stringToHex } from "viem";
import { parseEther, stringToHex } from "viem";

export { greenfieldTemplate };

Expand Down Expand Up @@ -214,7 +214,7 @@ export const greenfieldAction = {
const actionType = content.actionType;
const spInfo = await action.selectSp();

elizaLogger.log("spInfo", spInfo);
elizaLogger.log('content', content)

const { bucketName, objectName } = content;
const attachments = message.content.attachments;
Expand Down Expand Up @@ -272,8 +272,8 @@ export const greenfieldAction = {
break;
}

case "transferBNBToGreenfield": {
const hash = await action.bnbTransferToGnfd(content.content, runtime)
case "crossChainTransfer": {
const hash = await action.bnbTransferToGnfd(parseEther(String(content.amount)), runtime)
result = `transfer bnb to greenfield successfully, hash: ${hash}`;
break;
}
Expand Down Expand Up @@ -329,7 +329,7 @@ export const greenfieldAction = {
{
user: "user",
content: {
text: "Transfer 0.00001 BNB to myself greenfield for create account",
text: "Cross Chain Transfer 0.00001 BNB to myself greenfield for create account",
action: "GREENFIELD_ACTION",
content: {
amount: "0.00001"
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-bnb/src/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const greenfieldTemplate = `Given the recent messages and wallet informat
{{walletInfo}}
Extract the following details for Greenfield operations:
- **actionType** (string): The type of operation to perform (e.g., "createBucket", "uploadObject", "deleteObject", "transferBNBToGreenfield")
- **actionType** (string): The type of operation to perform (e.g., "createBucket", "uploadObject", "deleteObject", "crossChainTransfer")
- **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")
Expand All @@ -199,7 +199,7 @@ Extract the following details for Greenfield operations:
Required response format:
\`\`\`json
{
"actionType": "createBucket" | "uploadObject" | "deleteObject" | "transferBNBToGreenfield",
"actionType": "createBucket" | "uploadObject" | "deleteObject" | "crossChainTransfer",
"bucketName": string,
"objectName": string,
"visibility": "private" | "public",
Expand Down

0 comments on commit 9d675d4

Please sign in to comment.