Stampchain
Guide to use stampchain tool on your AI agent using Vity Toolkit
Surface Stampchain collectibles, recent trades, and market data for on-chain stamp enthusiasts.
Quick Start
1
Install the package.
npm install vity-toolkit langchain @langchain/openai2
Initialize Vity Toolkit and Langchain.
import { ChatOpenAI } from "@langchain/openai";
import { App, LangchainToolkit } from "vity-toolkit";
import { createOpenAIFunctionsAgent, AgentExecutor } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";
const model = new ChatOpenAI({ model: "gpt-4o" });
const toolKit = new LangchainToolkit();3
Add the tool.
const tools = toolKit.getTools({ apps: [App.STAMPCHAIN] });4
Define the Agent.
const prompt = ChatPromptTemplate.fromMessages([
["system", `You are an AI agent that explores Bitcoin Stamps and SRC-20 data using Stampchain APIs. Use the provided tools for all data access.`],
["placeholder", "{chat_history}"],
["human", "{input}"],
["placeholder", "{agent_scratchpad}"],
]);
const agent = await createOpenAIFunctionsAgent({
llm: model,
tools,
prompt,
});
const agentExecutor = new AgentExecutor({ agent, tools, verbose: true });5
Execute the Agent.
const response = await agentExecutor.invoke({ input: "Find recent stamp sales and list the 5 most interesting ones with IDs and prices" });
console.log(response);Supported Actions
Action
Description
Action.STAMPCHAIN_GET_STAMPRetrieve detailed information about a specific Bitcoin Stamp by its ID.
Action.STAMPCHAIN_SEARCH_STAMPSSearch Bitcoin Stamps with various filters and pagination.
Action.STAMPCHAIN_GET_RECENT_STAMPSRetrieve the most recently created Bitcoin Stamps (paginated and sorted).
Action.STAMPCHAIN_GET_RECENT_SALESRetrieve recent stamp sales with optional filtering and pagination.
Action.STAMPCHAIN_GET_MARKET_DATARetrieve stamps with market data filters. Market data is included in the response.
Action.STAMPCHAIN_GET_STAMP_MARKET_DATARetrieve market data details for a specific Bitcoin Stamp.
Last updated