Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions plugins/acpPlugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -70,18 +70,15 @@ const acpPlugin = new AcpPlugin({
apiKey: "<your-GAME-dev-api-key-here>",
acpTokenClient: await AcpToken.build(
"<your-whitelisted-wallet-private-key>",
<your-session-entity-key-id>, // can get from service registry page
"<your-session-entity-key-id>", // can get from service registry page
"<your-agent-wallet-address>", // can get from service registry page
baseSepolia, // or base for mainnet (optional)
"<your-contract-address>", // (optional)
"<your-virtuals-token-address>" // (optional)
baseSepoliaConfig // or baseConfig for mainnet (optional)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not optional

),
cluster = "<cluster>", // (optional)
twitterClient = "<twitter_client_instance>", // (optional)
evaluatorCluster = "<evaluator_cluster>", // (optional)
onEvaluate = "<onEvaluate_function>" // (optional)
});
};
});
```

> Note:
Expand All @@ -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({
Expand All @@ -112,9 +109,7 @@ const acpPlugin = new AcpPlugin({
"<your-agent-wallet-private-key>",
"<your-session-entity-key-id>", // can get from service registry page
"<your-agent-wallet-address>", // can get from service registry page
baseSepolia, // or base for mainnet
"<your-contract-address>", // optional
"<your-virtuals-token-address>" // optional
baseSepoliaConfig // or baseConfig for mainnet (optional)
),
twitterClient: gameTwitterClient, // <--- This is the GAME's twitter client
});
Expand Down Expand Up @@ -177,9 +172,7 @@ const acpPlugin = new AcpPlugin({
"<your-agent-wallet-private-key>",
"<your-session-entity-key-id>", // can get from service registry page
"<your-agent-wallet-address>", // can get from service registry page
baseSepolia, // or base for mainnet (optional)
"<your-contract-address>", // (optional)
"<your-virtuals-token-address>" // (optional)
baseSepoliaConfig // or baseConfig for mainnet (optional)
),
cluster = "<cluster>",
twitterClient = "<twitter_client_instance>",
Expand Down
3 changes: 2 additions & 1 deletion plugins/acpPlugin/example/agentic/buyer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -69,6 +69,7 @@ async function test() {
WHITELISTED_WALLET_PRIVATE_KEY,
WHITELISTED_WALLET_ENTITY_ID,
BUYER_AGENT_WALLET_ADDRESS,
baseSepoliaConfig
),
twitterClient: twitterClient,
onEvaluate: onEvaluate,
Expand Down
3 changes: 2 additions & 1 deletion plugins/acpPlugin/example/agentic/seller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -60,6 +60,7 @@ async function test() {
WHITELISTED_WALLET_PRIVATE_KEY,
WHITELISTED_WALLET_ENTITY_ID,
SELLER_AGENT_WALLET_ADDRESS,
baseSepoliaConfig
),
twitterClient: twitterClient,
});
Expand Down
6 changes: 4 additions & 2 deletions plugins/acpPlugin/example/reactive/buyer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions plugins/acpPlugin/example/reactive/seller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
});
Expand Down Expand Up @@ -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) {
Expand Down