Skip to content

Commit

Permalink
Merge pull request #22 from APRO-com/main
Browse files Browse the repository at this point in the history
feat: add the new plugin from APRO
  • Loading branch information
jxx016 authored Feb 6, 2025
2 parents 9b4d5b5 + 21bec11 commit a107e02
Show file tree
Hide file tree
Showing 13 changed files with 4,133 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
node_modules/
.env
*.lock
4 changes: 4 additions & 0 deletions plugins/attpsPlugin/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PROXY_ADDRESS=
PRIVATE_KEY=
RPC_URL=
AGENT_API_KEY=
2 changes: 2 additions & 0 deletions plugins/attpsPlugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
node_modules/
2 changes: 2 additions & 0 deletions plugins/attpsPlugin/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src
tsconfig.json
89 changes: 89 additions & 0 deletions plugins/attpsPlugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# ATTPs Plugin for Virtuals Game

The ATTPs Plugin enables G.A.M.E agents to interact with the ATTPs Platform, providing capabilities for agent creation, data verification, and price querying functionalities.

### Features
- Create and register new agents on the ATTPs Platform
- Verify data with agent signatures
- Query price data from various feeds

### Available Functions
1. `createAndRegisterAgent`: Creates and registers a new agent with specified signers and settings
2. `verifyData`: Verifies data with provided signatures and metadata
3. `priceQuery`: Fetches price data for specific feeds and agents

## Installation

To install the plugin, use npm or yarn:

```bash
npm install @virtuals-protocol/game-attps-plugin
```

or

```bash
yarn add @virtuals-protocol/game-attps-plugin
```

## Usage

### Importing the Plugin

First, import the `AttpsPlugin` class from the plugin:

```typescript
import AttpsPlugin from "@virtuals-protocol/game-attps-plugin";
```

### Setup environment variables

Set the following environment variables:
- `RPC_URL`: The RPC URL for the blockchain network
- `PRIVATE_KEY`: Your private key for transaction signing
- `PROXY_ADDRESS`: The proxy address for the ATTPs Platform

### Creating a Worker

Create a worker with the necessary credentials:

```typescript
const attpsPlugin = new AttpsPlugin({
credentials: {
proxyAddress: process.env.PROXY_ADDRESS,
privateKey: process.env.PRIVATE_KEY,
rpcUrl: process.env.RPC_URL,
}
});
```

### Creating an Agent

Create an agent and add the worker to it:

```typescript
import { GameAgent } from "@virtuals-protocol/game";

const agent = new GameAgent("GAME_API_KEY", {
name: "ATTPs Bot",
goal: "Create agents, verify data, and query price data.",
description: "A bot that can interact with the ATTPs Platform",
workers: [attpsPlugin.getWorker({})],
});
```

### Running the Agent

Initialize and run the agent:

```typescript
(async () => {
await agent.init();

while (true) {
await agent.step({
verbose: true,
});
}
})();
```
Loading

0 comments on commit a107e02

Please sign in to comment.