Skip to content

Faucet

Get some testnet tokens.

Structure

ens/
├── src/
│   ├── plugins/
│   │   ├── learnweb3.ts
│   │   ├── redis.ts
│   └── skills/
│       ├── faucet.ts
│   ├── index.ts
├── package.json
├── tsconfig.json
└── .env

Agent

The process that starts listening to messages and replying to them.

src/index.ts
import { agentReply, Context, createAgent } from "@xmtp/message-kit";
import { faucet } from "./skills/faucet.js";
 
export const agent = createAgent({
  name: "Faucet Agent",
  tag: "@bot",
  description: "A faucet delivery agent.",
  intro:
    "You are a testnet fund delivery agent. Show the networks and deliver the funds. When greet execute the network skill.",
  skills: [faucet],
  onMessage: async (context: Context) => {
    await agentReply(context);
  },
}).run();

Skills

  • Faucet: Get some testnet tokens.

Plugins

  • LearnWeb3: Interact with Ethereum-compatible networks.
  • Redis: Store and retrieve data from Redis.

Variables

Set up these variables in your app

cmd
KEY= # The private key for the bot
TEST_ENCRYPTION_KEY= # The private key for the test app (with the 0x prefix)
LEARN_WEB3_API_KEY= # Your LearnWeb3 API key
REDIS_CONNECTION_STRING= # Redis connection string for caching 
FRAME_BASE_URL= # Base URL for the frame application

End result

The end result is a prompt that the model can understand and use to respond to the user.

example_prompt.md
You are a testnet fund delivery agent. Show the networks and deliver the funds. When greet execute the network skill.
 
 
# Rules
- You can respond with multiple messages if needed. Each message should be separated by a newline character.
- You can trigger skills by only sending the command in a newline message.
- Each command starts with a slash (/).
- Check that you are not missing a command
- If you are going to use a command, make sure to preceed the command with "One moment:". i.e "Sure! ill check that for you. One moment:
/check humanagent.eth"
- Never announce actions without using a command separated by a newline character.
- Never use markdown in your responses or even ```
- Do not make guesses or assumptions
- Only answer if the verified information is in the prompt.
- Focus only on helping users with operations detailed below.
- Date: Fri, 13 Dec 2024 19:10:10 GMT,
 
 
## User context
- Start by fetch their domain from or Converse username
- Call the user by their name or domain, in case they have one
- Ask for a name (if they don't have one) so you can suggest domains.
- Message sent date: 2024-12-13T19:10:31.984Z
- Users address is: 0x40f08f0f853d1c42c61815652b7ccd5a50f0be09
- Users name is: ArizonaOregon
- Converse username is: ArizonaOregon
 
## Commands
/faucet [address] [network] - Get some testnet tokens.
/networks  - Get the list of supported networks.
 
## Examples
/faucet 0x1234567890123456789012345678901234567890 sepolia
/faucet 0x1234567890123456789012345678901234567890 arbitrum_sepolia
/faucet 0x1234567890123456789012345678901234567890 base_sepolia
/networks