Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: nft collections getownednfts createlisting getfloorlistings #2189

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
e3e5d5a
chore: update pnpm lock file after build
IkigaiLabsETH Dec 13, 2024
5047a55
Merge branch 'ai16z:main' into main
IkigaiLabsETH Dec 13, 2024
6e976c5
Merge branch 'ai16z:main' into main
IkigaiLabsETH Dec 14, 2024
398ce22
Merge branch 'ai16z:main' into main
IkigaiLabsETH Dec 18, 2024
ab0df82
feat: add NFT knowledge
IkigaiLabsETH Dec 19, 2024
83272c1
feat: add NFT collections plugin
IkigaiLabsETH Dec 20, 2024
78b52eb
feat: add NFT floor sweeping action
IkigaiLabsETH Dec 20, 2024
174d296
feat: add NFT collection evaluator
IkigaiLabsETH Dec 20, 2024
4d8c4bb
refactor: move NFT collections provider to separate file
IkigaiLabsETH Dec 20, 2024
33ef78f
chore: add dependencies and config files
IkigaiLabsETH Dec 20, 2024
ce18601
gm
IkigaiLabsETH Dec 20, 2024
d53e365
gm
IkigaiLabsETH Dec 20, 2024
7afb328
gm
IkigaiLabsETH Dec 20, 2024
801058b
gm
IkigaiLabsETH Dec 20, 2024
7964caa
gm
IkigaiLabsETH Dec 20, 2024
92823cd
gm
IkigaiLabsETH Dec 20, 2024
1c72033
gm
IkigaiLabsETH Dec 20, 2024
5e17b65
add more knowledge about the overall NFT markets
IkigaiLabsETH Dec 20, 2024
d0e7927
add more knowledge about the artist, news, onchain data
IkigaiLabsETH Dec 20, 2024
78e16d3
gm
IkigaiLabsETH Dec 20, 2024
48af2f0
gm
IkigaiLabsETH Dec 20, 2024
5300fc8
gm
IkigaiLabsETH Dec 20, 2024
69dce6d
gm
IkigaiLabsETH Dec 20, 2024
2b9d42b
gm
IkigaiLabsETH Dec 20, 2024
83638de
gm
IkigaiLabsETH Dec 20, 2024
0ff4c52
gm
IkigaiLabsETH Dec 20, 2024
95d8b9a
gm
IkigaiLabsETH Dec 20, 2024
db3a0d6
gm
IkigaiLabsETH Dec 20, 2024
4973efe
gm
IkigaiLabsETH Dec 20, 2024
2a8f92a
gm
IkigaiLabsETH Dec 20, 2024
8477202
gm
IkigaiLabsETH Dec 20, 2024
5aa68a0
Creates listing at double the purchase price
IkigaiLabsETH Dec 20, 2024
934e921
include information about the automatic listing feature and the inte…
IkigaiLabsETH Dec 20, 2024
5ab5058
add lore
IkigaiLabsETH Dec 21, 2024
cf00f0b
update lore
IkigaiLabsETH Dec 21, 2024
e6eecbd
add templates folder
IkigaiLabsETH Dec 21, 2024
7c3ff0d
update readme + add tests folder & test ts files
IkigaiLabsETH Dec 21, 2024
137d6c9
special support for 420+ curated collections featured on ikigailabs.xyz
IkigaiLabsETH Dec 21, 2024
a6998da
special support for 420+ curated collections featured on ikigailabs.xyz
IkigaiLabsETH Dec 21, 2024
6bfffdd
special support for 420+ curated collections featured on ikigailabs.xyz
IkigaiLabsETH Dec 21, 2024
5462021
Converted all API keys to SCREAMING_SNAKE_CASE format
IkigaiLabsETH Dec 21, 2024
270d98a
comprehensive performance benchmarks and architecture diagrams using…
IkigaiLabsETH Dec 21, 2024
b6eda36
Integration Improvements
IkigaiLabsETH Dec 21, 2024
3b2db54
documentation for Extended Features
IkigaiLabsETH Dec 21, 2024
0414ee4
comprehensive testing and validation documentation
IkigaiLabsETH Dec 21, 2024
1df0f74
Authentication & Security documentation
IkigaiLabsETH Dec 21, 2024
403f52c
leverages Eliza's core strengths in multi-agent systems while enhanci…
IkigaiLabsETH Dec 21, 2024
33c9ee9
caching system?
IkigaiLabsETH Dec 21, 2024
de0442b
update
IkigaiLabsETH Dec 21, 2024
c06a170
update
IkigaiLabsETH Dec 21, 2024
49adae1
tests & debugging
IkigaiLabsETH Dec 21, 2024
d23e90c
update
IkigaiLabsETH Dec 21, 2024
f9db542
draft PR for NFTpro plugin-nft-collections
IkigaiLabsETH Dec 21, 2024
b8637da
add plugin to agent - index.ts
IkigaiLabsETH Dec 21, 2024
79eaa9c
update
IkigaiLabsETH Dec 21, 2024
ef8734e
update
IkigaiLabsETH Dec 21, 2024
15e1ca0
update
IkigaiLabsETH Dec 21, 2024
f2c5dec
update
IkigaiLabsETH Dec 21, 2024
c285491
made the plugin more robust, performant, and maintainable while provi…
IkigaiLabsETH Dec 21, 2024
1ebf516
update
IkigaiLabsETH Dec 21, 2024
c03e10e
update
IkigaiLabsETH Dec 22, 2024
a0cdbfa
Great! All tests are now passing.
IkigaiLabsETH Dec 22, 2024
c43f0bd
Kept all imports at the top of the file
IkigaiLabsETH Dec 22, 2024
c3e4d7c
gm
IkigaiLabsETH Dec 22, 2024
64ff69e
gm
IkigaiLabsETH Dec 22, 2024
5f303dc
clean code
tcm390 Jan 11, 2025
75e5cf0
remove iplugin type
tcm390 Jan 11, 2025
091d677
make nft collection a service
tcm390 Jan 11, 2025
0b11305
revert
tcm390 Jan 11, 2025
261e492
remove LORE.md
tcm390 Jan 11, 2025
bbdf233
remove any
tcm390 Jan 11, 2025
930b8e9
restore turbo
tcm390 Jan 11, 2025
177364c
revert
tcm390 Jan 11, 2025
a3ebfff
revert
tcm390 Jan 11, 2025
847d915
update docs
tcm390 Jan 11, 2025
457b378
resolve conflict
tcm390 Jan 12, 2025
fffd181
add nft plugin
tcm390 Jan 12, 2025
29e80a2
update import
tcm390 Jan 12, 2025
7817056
add nft plugin
tcm390 Jan 12, 2025
57f0eff
update plugin
tcm390 Jan 12, 2025
a9f09bd
update import
tcm390 Jan 12, 2025
1adebb2
update import
tcm390 Jan 12, 2025
ee9accb
corrct return value
tcm390 Jan 12, 2025
2f9f995
corrct paramter
tcm390 Jan 12, 2025
ae42629
corrct paramter
tcm390 Jan 12, 2025
96b5d09
add callback
tcm390 Jan 12, 2025
ea0a9b7
add callback
tcm390 Jan 12, 2025
15b4ddb
add more examples
tcm390 Jan 12, 2025
29b5151
add nft plugin
tcm390 Jan 12, 2025
d7d0e72
feat(nft-collections): Implement getOwnedNFTs method in ReservoirService
IkigaiLabsETH Jan 12, 2025
5484548
feat(nft-collections): Implement createListing method in ReservoirSer…
IkigaiLabsETH Jan 12, 2025
8b1a809
feat(nft-collections): Implement getFloorListings method in Reservoir…
IkigaiLabsETH Jan 12, 2025
a3af687
Merge branch 'develop' into feature/nft-collections-getownednfts
odilitime Jan 12, 2025
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ agent/content

eliza.manifest
eliza.manifest.sgx
eliza.sig
eliza.sig
1 change: 1 addition & 0 deletions agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"@elizaos/plugin-hyperliquid": "workspace:*",
"@elizaos/plugin-akash": "workspace:*",
"@elizaos/plugin-quai": "workspace:*",
"@elizaos/plugin-nft-collections": "workspace:*",
"readline": "1.3.0",
"ws": "8.18.0",
"yargs": "17.7.2"
Expand Down
103 changes: 65 additions & 38 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { SlackClientInterface } from "@elizaos/client-slack";
import { TelegramClientInterface } from "@elizaos/client-telegram";
import { TwitterClientInterface } from "@elizaos/client-twitter";
// import { ReclaimAdapter } from "@elizaos/plugin-reclaim";
import { DirectClient } from "@elizaos/client-direct";
import { PrimusAdapter } from "@elizaos/plugin-primus";

import {
Expand Down Expand Up @@ -102,7 +101,7 @@ import net from "net";
import path from "path";
import { fileURLToPath } from "url";
import yargs from "yargs";
import {dominosPlugin} from "@elizaos/plugin-dominos";
import createNFTCollectionsPlugin from "@elizaos/plugin-nft-collections";

const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory
Expand Down Expand Up @@ -152,14 +151,29 @@ function tryLoadFile(filePath: string): string | null {
function mergeCharacters(base: Character, child: Character): Character {
const mergeObjects = (baseObj: any, childObj: any) => {
const result: any = {};
const keys = new Set([...Object.keys(baseObj || {}), ...Object.keys(childObj || {})]);
keys.forEach(key => {
if (typeof baseObj[key] === 'object' && typeof childObj[key] === 'object' && !Array.isArray(baseObj[key]) && !Array.isArray(childObj[key])) {
const keys = new Set([
...Object.keys(baseObj || {}),
...Object.keys(childObj || {}),
]);
keys.forEach((key) => {
if (
typeof baseObj[key] === "object" &&
typeof childObj[key] === "object" &&
!Array.isArray(baseObj[key]) &&
!Array.isArray(childObj[key])
) {
result[key] = mergeObjects(baseObj[key], childObj[key]);
} else if (Array.isArray(baseObj[key]) || Array.isArray(childObj[key])) {
result[key] = [...(baseObj[key] || []), ...(childObj[key] || [])];
} else if (
Array.isArray(baseObj[key]) ||
Array.isArray(childObj[key])
) {
result[key] = [
...(baseObj[key] || []),
...(childObj[key] || []),
];
} else {
result[key] = childObj[key] !== undefined ? childObj[key] : baseObj[key];
result[key] =
childObj[key] !== undefined ? childObj[key] : baseObj[key];
}
});
return result;
Expand All @@ -174,32 +188,36 @@ async function loadCharacter(filePath: string): Promise<Character> {
let character = JSON.parse(content);
validateCharacterConfig(character);

// .id isn't really valid
const characterId = character.id || character.name;
const characterPrefix = `CHARACTER.${characterId.toUpperCase().replace(/ /g, "_")}.`;
const characterSettings = Object.entries(process.env)
.filter(([key]) => key.startsWith(characterPrefix))
.reduce((settings, [key, value]) => {
const settingKey = key.slice(characterPrefix.length);
return { ...settings, [settingKey]: value };
}, {});
if (Object.keys(characterSettings).length > 0) {
character.settings = character.settings || {};
character.settings.secrets = {
...characterSettings,
...character.settings.secrets,
};
}
// Handle plugins
character.plugins = await handlePluginImporting(
character.plugins
);
// .id isn't really valid
const characterId = character.id || character.name;
const characterPrefix = `CHARACTER.${characterId.toUpperCase().replace(/ /g, "_")}.`;
const characterSettings = Object.entries(process.env)
.filter(([key]) => key.startsWith(characterPrefix))
.reduce((settings, [key, value]) => {
const settingKey = key.slice(characterPrefix.length);
return { ...settings, [settingKey]: value };
}, {});
if (Object.keys(characterSettings).length > 0) {
character.settings = character.settings || {};
character.settings.secrets = {
...characterSettings,
...character.settings.secrets,
};
}
// Handle plugins
character.plugins = await handlePluginImporting(character.plugins);
if (character.extends) {
elizaLogger.info(`Merging ${character.name} character with parent characters`);
elizaLogger.info(
`Merging ${character.name} character with parent characters`
);
for (const extendPath of character.extends) {
const baseCharacter = await loadCharacter(path.resolve(path.dirname(filePath), extendPath));
const baseCharacter = await loadCharacter(
path.resolve(path.dirname(filePath), extendPath)
);
character = mergeCharacters(baseCharacter, character);
elizaLogger.info(`Merged ${character.name} with ${baseCharacter.name}`);
elizaLogger.info(
`Merged ${character.name} with ${baseCharacter.name}`
);
}
}
return character;
Expand Down Expand Up @@ -472,7 +490,9 @@ function initializeDatabase(dataDir: string) {
// Test the connection
db.init()
.then(() => {
elizaLogger.success("Successfully connected to Supabase database");
elizaLogger.success(
"Successfully connected to Supabase database"
);
})
.catch((error) => {
elizaLogger.error("Failed to connect to Supabase:", error);
Expand All @@ -489,7 +509,9 @@ function initializeDatabase(dataDir: string) {
// Test the connection
db.init()
.then(() => {
elizaLogger.success("Successfully connected to PostgreSQL database");
elizaLogger.success(
"Successfully connected to PostgreSQL database"
);
})
.catch((error) => {
elizaLogger.error("Failed to connect to PostgreSQL:", error);
Expand All @@ -504,14 +526,17 @@ function initializeDatabase(dataDir: string) {
});
return db;
} else {
const filePath = process.env.SQLITE_FILE ?? path.resolve(dataDir, "db.sqlite");
const filePath =
process.env.SQLITE_FILE ?? path.resolve(dataDir, "db.sqlite");
elizaLogger.info(`Initializing SQLite database at ${filePath}...`);
const db = new SqliteDatabaseAdapter(new Database(filePath));

// Test the connection
db.init()
.then(() => {
elizaLogger.success("Successfully connected to SQLite database");
elizaLogger.success(
"Successfully connected to SQLite database"
);
})
.catch((error) => {
elizaLogger.error("Failed to connect to SQLite:", error);
Expand Down Expand Up @@ -689,7 +714,8 @@ export async function createAgent(
if (
process.env.PRIMUS_APP_ID &&
process.env.PRIMUS_APP_SECRET &&
process.env.VERIFIABLE_INFERENCE_ENABLED === "true"){
process.env.VERIFIABLE_INFERENCE_ENABLED === "true"
) {
verifiableInferenceAdapter = new PrimusAdapter({
appId: process.env.PRIMUS_APP_ID,
appSecret: process.env.PRIMUS_APP_SECRET,
Expand Down Expand Up @@ -851,8 +877,9 @@ export async function createAgent(
getSecret(character, "AKASH_WALLET_ADDRESS")
? akashPlugin
: null,
getSecret(character, "QUAI_PRIVATE_KEY")
? quaiPlugin
getSecret(character, "QUAI_PRIVATE_KEY") ? quaiPlugin : null,
getSecret(character, "RESERVOIR_API_KEY")
? createNFTCollectionsPlugin()
: null,
].filter(Boolean),
providers: [],
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"devDependencies": {
"@commitlint/cli": "18.6.1",
"@commitlint/config-conventional": "18.6.3",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "8.16.0",
"@typescript-eslint/parser": "8.16.0",
"@vitest/eslint-plugin": "1.1.13",
Expand All @@ -35,18 +36,17 @@
"eslint": "9.16.0",
"eslint-config-prettier": "9.1.0",
"husky": "9.1.7",
"jest": "^29.7.0",
"lerna": "8.1.5",
"only-allow": "1.2.1",
"prettier": "3.4.1",
"ts-jest": "^29.1.1",
"turbo": "2.3.3",
"typedoc": "0.26.11",
"typescript": "5.6.3",
"vite": "5.4.11",
"vitest": "2.1.5",
"viem": "2.21.58",
"ts-jest": "^29.1.1",
"@types/jest": "^29.5.11",
"jest": "^29.7.0"
"vite": "5.4.11",
"vitest": "2.1.5"
},
"pnpm": {
"overrides": {
Expand All @@ -64,6 +64,7 @@
"@vitest/eslint-plugin": "1.0.1",
"amqplib": "0.10.5",
"csv-parse": "5.6.0",
"langdetect": "^0.2.1",
"ollama-ai-provider": "0.16.1",
"optional": "0.1.4",
"pnpm": "9.14.4",
Expand All @@ -74,4 +75,4 @@
"workspaces": [
"packages/*"
]
}
}
2 changes: 1 addition & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1554,4 +1554,4 @@ export enum TranscriptionProvider {
export enum ActionTimelineType {
ForYou = "foryou",
Following = "following",
}
}
2 changes: 1 addition & 1 deletion packages/plugin-evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
"peerDependencies": {
"whatwg-url": "7.1.0"
}
}
}
8 changes: 8 additions & 0 deletions packages/plugin-nft-collections/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../.eslintrc.json",
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"root": true
}
7 changes: 7 additions & 0 deletions packages/plugin-nft-collections/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 4,
"semi": true,
"singleQuote": false,
"trailingComma": "es5",
"printWidth": 80
}
Loading
Loading