@virtuals-protocol/game-attps-plugin
v0.0.1
Published
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.
Readme
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
createAndRegisterAgent: Creates and registers a new agent with specified signers and settingsverifyData: Verifies data with provided signatures and metadatapriceQuery: Fetches price data for specific feeds and agents
Installation
To install the plugin, use npm or yarn:
npm install @virtuals-protocol/game-attps-pluginor
yarn add @virtuals-protocol/game-attps-pluginUsage
Importing the Plugin
First, import the AttpsPlugin class from the plugin:
import AttpsPlugin from "@virtuals-protocol/game-attps-plugin";Setup environment variables
Set the following environment variables:
RPC_URL: The RPC URL for the blockchain networkPRIVATE_KEY: Your private key for transaction signingPROXY_ADDRESS: The proxy address for the ATTPs Platform
Creating a Worker
Create a worker with the necessary credentials:
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:
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:
(async () => {
await agent.init();
while (true) {
await agent.step({
verbose: true,
});
}
})();