From 29e9ef3259d6c525819d4672890adf7560f54d7d Mon Sep 17 00:00:00 2001 From: Celeste Ang Date: Mon, 26 May 2025 11:26:11 +0800 Subject: [PATCH 1/3] [acp plugin] update reactive examples for test/mainnet configs --- plugins/acpPlugin/example/reactive/buyer.ts | 6 ++++-- plugins/acpPlugin/example/reactive/seller.ts | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/acpPlugin/example/reactive/buyer.ts b/plugins/acpPlugin/example/reactive/buyer.ts index f770711d..b5eecb65 100644 --- a/plugins/acpPlugin/example/reactive/buyer.ts +++ b/plugins/acpPlugin/example/reactive/buyer.ts @@ -11,7 +11,8 @@ import AcpPlugin, { AcpToken, EvaluateResult, IDeliverable, -} from "@virtuals-protocol/game-acp-plugin"; + baseSepoliaConfig +} from "../../src"; //TODO: replace with npm package import { WHITELISTED_WALLET_PRIVATE_KEY, WHITELISTED_WALLET_ENTITY_ID, @@ -73,7 +74,8 @@ async function test() { acpTokenClient: await AcpToken.build( WHITELISTED_WALLET_PRIVATE_KEY, WHITELISTED_WALLET_ENTITY_ID, - BUYER_AGENT_WALLET_ADDRESS + BUYER_AGENT_WALLET_ADDRESS, + baseSepoliaConfig ), twitterClient: twitterClient, onEvaluate: onEvaluate, diff --git a/plugins/acpPlugin/example/reactive/seller.ts b/plugins/acpPlugin/example/reactive/seller.ts index 18ad0312..ae9d4cd5 100644 --- a/plugins/acpPlugin/example/reactive/seller.ts +++ b/plugins/acpPlugin/example/reactive/seller.ts @@ -4,7 +4,7 @@ import { GameAgent, GameFunction, } from "@virtuals-protocol/game"; -import AcpPlugin, { AcpToken, AcpJob, AcpJobPhasesDesc } from "@virtuals-protocol/game-acp-plugin" +import AcpPlugin, { AcpToken, AcpJobPhasesDesc, baseSepoliaConfig } from "../../src"; //TODO: replace with npm package import { GAME_API_KEY, GAME_DEV_API_KEY, @@ -43,7 +43,8 @@ async function test() { acpTokenClient: await AcpToken.build( WHITELISTED_WALLET_PRIVATE_KEY, WHITELISTED_WALLET_ENTITY_ID, - SELLER_AGENT_WALLET_ADDRESS + SELLER_AGENT_WALLET_ADDRESS, + baseSepoliaConfig ), twitterClient: twitterClient }); @@ -141,7 +142,7 @@ async function test() { Respond to the following transaction: ${JSON.stringify(job)} - decide to wheater you should accept the job or not. + decide whether you should accept the job or not. once you have responded to the job, do not proceed with producing the deliverable and wait. `; } else if (job.phase === AcpJobPhasesDesc.TRANSACTION) { From 46ce67d6ddf99dba524e9471ea3f680e7182bf79 Mon Sep 17 00:00:00 2001 From: Celeste Ang Date: Mon, 26 May 2025 11:37:39 +0800 Subject: [PATCH 2/3] [acp plugin] update README and agentic examples for test/mainnet configs --- plugins/acpPlugin/README.md | 23 +++++++-------------- plugins/acpPlugin/example/agentic/buyer.ts | 3 ++- plugins/acpPlugin/example/agentic/seller.ts | 3 ++- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/plugins/acpPlugin/README.md b/plugins/acpPlugin/README.md index 9d6ef672..293e015a 100644 --- a/plugins/acpPlugin/README.md +++ b/plugins/acpPlugin/README.md @@ -46,7 +46,7 @@ The Agent Commerce Protocol (ACP) plugin is used to handle trading transactions ## Prerequisite -⚠️⚠️⚠️ Important: Before testing your agent’s services with a counterpart agent, you must register your agent with the [Service Registry](https://acp-staging.virtuals.io/). +⚠️ Important: Before testing your agent’s services with a counterpart agent, you must register your agent with the [Service Registry](https://acp-staging.virtuals.io/). This step is a critical precursor. Without registration, the counterpart agent will not be able to discover or interact with your agent. ## Installation @@ -60,7 +60,7 @@ npm i @virtuals-protocol/game-acp-plugin 1. Import AcpPlugin by running: ```typescript -import AcpPlugin, { AcpToken } from "@virtuals-protocol/game-acp-plugin"; +import AcpPlugin, { AcpToken, baseSepoliaConfig } from "@virtuals-protocol/game-acp-plugin"; ``` 2. Create and initialize an ACP instance by running: @@ -70,18 +70,15 @@ const acpPlugin = new AcpPlugin({ apiKey: "", acpTokenClient: await AcpToken.build( "", - , // can get from service registry page + "", // can get from service registry page "", // can get from service registry page - baseSepolia, // or base for mainnet (optional) - "", // (optional) - "" // (optional) + baseSepoliaConfig // or baseConfig for mainnet (optional) ), cluster = "", // (optional) twitterClient = "", // (optional) evaluatorCluster = "", // (optional) onEvaluate = "" // (optional) - }); -}; +}); ``` > Note: @@ -99,7 +96,7 @@ const acpPlugin = new AcpPlugin({ > - This is where you can get your session entity key ID: > ![Session Entity ID](../../docs/imgs/session-entity-id-location.png) -3. (optional) If you want to use GAME's twitter client with the ACP plugin, you can initialize it by running: +1. (optional) If you want to use GAME's twitter client with the ACP plugin, you can initialize it by running: ```typescript const gameTwitterClient = new TwitterClient({ @@ -112,9 +109,7 @@ const acpPlugin = new AcpPlugin({ "", "", // can get from service registry page "", // can get from service registry page - baseSepolia, // or base for mainnet - "", // optional - "" // optional + baseSepoliaConfig // or baseConfig for mainnet (optional) ), twitterClient: gameTwitterClient, // <--- This is the GAME's twitter client }); @@ -177,9 +172,7 @@ const acpPlugin = new AcpPlugin({ "", "", // can get from service registry page "", // can get from service registry page - baseSepolia, // or base for mainnet (optional) - "", // (optional) - "" // (optional) + baseSepoliaConfig // or baseConfig for mainnet (optional) ), cluster = "", twitterClient = "", diff --git a/plugins/acpPlugin/example/agentic/buyer.ts b/plugins/acpPlugin/example/agentic/buyer.ts index a8e00e71..35b4510c 100644 --- a/plugins/acpPlugin/example/agentic/buyer.ts +++ b/plugins/acpPlugin/example/agentic/buyer.ts @@ -6,7 +6,7 @@ import { GameWorker, } from "@virtuals-protocol/game"; import * as readline from "readline"; -import AcpPlugin, { AcpToken, EvaluateResult, IDeliverable } from "@virtuals-protocol/game-acp-plugin"; +import AcpPlugin, { AcpToken, EvaluateResult, IDeliverable, baseSepoliaConfig } from "../../src"; //TODO: replace with npm package import { WHITELISTED_WALLET_PRIVATE_KEY, WHITELISTED_WALLET_ENTITY_ID, @@ -69,6 +69,7 @@ async function test() { WHITELISTED_WALLET_PRIVATE_KEY, WHITELISTED_WALLET_ENTITY_ID, BUYER_AGENT_WALLET_ADDRESS, + baseSepoliaConfig ), twitterClient: twitterClient, onEvaluate: onEvaluate, diff --git a/plugins/acpPlugin/example/agentic/seller.ts b/plugins/acpPlugin/example/agentic/seller.ts index de4b8c5f..d0d2d2e1 100644 --- a/plugins/acpPlugin/example/agentic/seller.ts +++ b/plugins/acpPlugin/example/agentic/seller.ts @@ -6,7 +6,7 @@ import { GameWorker, } from "@virtuals-protocol/game"; import * as readline from "readline"; -import AcpPlugin, { AcpToken } from "@virtuals-protocol/game-acp-plugin"; +import AcpPlugin, { AcpToken, baseSepoliaConfig } from "../../src"; //TODO: replace with npm package import { GAME_API_KEY, GAME_DEV_API_KEY, @@ -60,6 +60,7 @@ async function test() { WHITELISTED_WALLET_PRIVATE_KEY, WHITELISTED_WALLET_ENTITY_ID, SELLER_AGENT_WALLET_ADDRESS, + baseSepoliaConfig ), twitterClient: twitterClient, }); From f6d538edc28ced93bf226eb205d37f8a7c7ee395 Mon Sep 17 00:00:00 2001 From: Celeste Ang Date: Mon, 26 May 2025 11:42:23 +0800 Subject: [PATCH 3/3] [acp plugin] remove config optional tag from readme --- plugins/acpPlugin/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/acpPlugin/README.md b/plugins/acpPlugin/README.md index 293e015a..ed27eaaf 100644 --- a/plugins/acpPlugin/README.md +++ b/plugins/acpPlugin/README.md @@ -72,7 +72,7 @@ const acpPlugin = new AcpPlugin({ "", "", // can get from service registry page "", // can get from service registry page - baseSepoliaConfig // or baseConfig for mainnet (optional) + baseSepoliaConfig // or baseConfig for mainnet ), cluster = "", // (optional) twitterClient = "", // (optional)