Skip to content

Commit

Permalink
Merge pull request #349 from ai16z/trust-db
Browse files Browse the repository at this point in the history
feat: trust db
  • Loading branch information
lalalune authored Nov 16, 2024
2 parents 0bc3b36 + 20f965f commit a62d312
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 30 deletions.
1 change: 1 addition & 0 deletions packages/client-auto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@ai16z/eliza": "workspace:*",
"@ai16z/plugin-image-generation": "workspace:*",
"@ai16z/plugin-solana": "workspace:*",
"@ai16z/plugin-trustdb": "workspace:*",
"@types/body-parser": "1.19.5",
"@types/cors": "2.8.17",
"@types/express": "5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/client-auto/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Client, IAgentRuntime } from "@ai16z/eliza";
import { TrustScoreManager } from "@ai16z/plugin-solana";
import { TokenProvider } from "@ai16z/plugin-solana";
import { WalletProvider } from "@ai16z/plugin-solana";
import { TrustScoreDatabase } from "@ai16z/plugin-solana";
import { TrustScoreDatabase } from "@ai16z/plugin-trustdb";
import { Connection, PublicKey } from "@solana/web3.js";

export class AutoClient {
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"types": "dist/index.d.ts",
"dependencies": {
"@ai16z/eliza": "workspace:*",
"@ai16z/plugin-trustdb": "workspace:*",
"@coral-xyz/anchor": "^0.30.1",
"@solana/spl-token": "0.4.9",
"@solana/web3.js": "1.95.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-solana/src/evaluators/trust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { TrustScoreManager } from "../providers/trustScoreProvider.ts";
import { TokenProvider } from "../providers/token.ts";
import { WalletProvider } from "../providers/wallet.ts";
import { TrustScoreDatabase } from "../adapters/trustScoreDatabase.ts";
import { TrustScoreDatabase } from "@ai16z/plugin-trustdb";
import { Connection, PublicKey } from "@solana/web3.js";

const shouldProcessTemplate =
Expand Down
1 change: 0 additions & 1 deletion packages/plugin-solana/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from "./providers/token.ts";
export * from "./providers/wallet.ts";
export * from "./providers/trustScoreProvider.ts";
export * from "./evaluators/trust.ts";
export * from "./adapters/trustScoreDatabase.ts";

import { Plugin } from "@ai16z/eliza";
//import { executeSwap } from "./actions/swap.ts";
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-solana/src/providers/trustScoreProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
TokenPerformance,
TradePerformance,
TokenRecommendation,
} from "../adapters/trustScoreDatabase.ts";
} from "@ai16z/plugin-trustdb";
import settings from "@ai16z/eliza/src/settings.ts";
import { IAgentRuntime, Memory, Provider, State } from "@ai16z/eliza";

Expand Down
15 changes: 6 additions & 9 deletions packages/plugin-starknet/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { Plugin } from "@ai16z/eliza";
import { executeSwap } from "./actions/swap";
import {
getStarknetAccountProvider,
getStarknetRpcProvider,
} from "./providers/avnu";

export const starknetPlugin: Plugin = {
name: "Starknet",
description: "Starknet Swap Plugin for Eliza",
actions: [executeSwap],
name: "starknet",
description: "Starknet Plugin for Eliza",
actions: [
// TODO: Add actions like swap, etc.
],
evaluators: [],
providers: [getStarknetAccountProvider, getStarknetRpcProvider],
providers: [],
};

export default starknetPlugin;
14 changes: 0 additions & 14 deletions packages/plugin-starknet/src/providers/avnu.ts

This file was deleted.

20 changes: 20 additions & 0 deletions packages/plugin-trustdb/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@ai16z/plugin-trustdb",
"version": "0.0.1",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"dependencies": {
"@ai16z/eliza": "workspace:*",
"tsup": "^8.3.5",
"uuid": "11.0.2",
"vitest": "^2.1.4"
},
"scripts": {
"build": "tsup --format esm --dts",
"test": "vitest"
},
"peerDependencies": {
"whatwg-url": "7.1.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// src/adapters/sqlite/trustScoreDatabase.ts

import { Database } from "better-sqlite3";
import { v4 as uuidv4 } from "uuid";

// Define interfaces
export interface Recommender {
id: string; // UUID
address: string;
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-trustdb/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./adapters/trustScoreDatabase.ts";
8 changes: 8 additions & 0 deletions packages/plugin-trustdb/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "./src"
},
"include": ["src"]
}
10 changes: 10 additions & 0 deletions packages/plugin-trustdb/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["src/index.ts"],
outDir: "dist",
sourcemap: true,
clean: true,
format: ["esm"], // Ensure you're targeting CommonJS
external: [],
});
24 changes: 24 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fi
# Define packages to build in order
PACKAGES=(
"core"
"plugin-trustdb"
"plugin-solana"
"plugin-starknet"
"adapter-postgres"
Expand Down

0 comments on commit a62d312

Please sign in to comment.