From 063eb608ee07408d0b3f652a20e34962ff29e85e Mon Sep 17 00:00:00 2001 From: Amritesh Khare Date: Tue, 21 Jan 2025 02:20:36 +0530 Subject: [PATCH 1/3] POC:plugin-trikon --- packages/plugin-trikon/package.json | 32 ++ packages/plugin-trikon/readme.md | 9 + packages/plugin-trikon/src/actions/trikon.ts | 170 ++++++++++ packages/plugin-trikon/src/index.ts | 5 + .../plugin-trikon/src/plugins/trikonPlugin.ts | 15 + .../plugin-trikon/src/providers/wallet.ts | 62 ++++ packages/plugin-trikon/tsconfig.json | 10 + packages/plugin-trikon/tsup.config.ts | 26 ++ pnpm-lock.yaml | 318 +++++++++++++++--- 9 files changed, 600 insertions(+), 47 deletions(-) create mode 100644 packages/plugin-trikon/package.json create mode 100644 packages/plugin-trikon/readme.md create mode 100644 packages/plugin-trikon/src/actions/trikon.ts create mode 100644 packages/plugin-trikon/src/index.ts create mode 100644 packages/plugin-trikon/src/plugins/trikonPlugin.ts create mode 100644 packages/plugin-trikon/src/providers/wallet.ts create mode 100644 packages/plugin-trikon/tsconfig.json create mode 100644 packages/plugin-trikon/tsup.config.ts diff --git a/packages/plugin-trikon/package.json b/packages/plugin-trikon/package.json new file mode 100644 index 00000000000..6f670a75136 --- /dev/null +++ b/packages/plugin-trikon/package.json @@ -0,0 +1,32 @@ +{ + "name": "@elizaos/plugin-trikon", + "version": "0.1.0-alpha.1", + "type": "module", + "main": "dist/index.js", + "module": "dist/index.js", + "types": "dist/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "import": { + "@elizaos/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + } + }, + "files": [ + "dist" + ], + "dependencies": { + "@elizaos/core": "workspace:*" + }, + "devDependencies": { + "tsup": "8.3.5", + "vitest": "2.1.4" + }, + "scripts": { + "build": "tsup --format esm --dts", + "test": "vitest run" + } +} \ No newline at end of file diff --git a/packages/plugin-trikon/readme.md b/packages/plugin-trikon/readme.md new file mode 100644 index 00000000000..eb70f071d5a --- /dev/null +++ b/packages/plugin-trikon/readme.md @@ -0,0 +1,9 @@ +# @elizaos/plugin-trikon + +Core Trikon plugin for Eliza OS that provides essential services and actions. + +## Overview + +This plugin provides functionality for Trikon integration. + +## Installation diff --git a/packages/plugin-trikon/src/actions/trikon.ts b/packages/plugin-trikon/src/actions/trikon.ts new file mode 100644 index 00000000000..dfb23277af6 --- /dev/null +++ b/packages/plugin-trikon/src/actions/trikon.ts @@ -0,0 +1,170 @@ +// import type { Action } from "@elizaos/core"; + +// export const trikonAction: Action = { +// name: "Trikon", +// description: "A Trikon action for Trikon plugin", +// execute: async (context) => { +// // Implementation here +// return { +// success: true, +// message: "Trikon action executed successfully" +// }; +// } +// }; + +// export default trikonAction; +import { elizaLogger } from "@elizaos/core"; +import { + type ActionExample, + type Content, + type HandlerCallback, + type IAgentRuntime, + type Memory, + ModelClass, + type State, + type Action, +} from "@elizaos/core"; +import { composeContext } from "@elizaos/core"; +import { generateObjectDeprecated } from "@elizaos/core"; + +export interface TransferContent extends Content { + recipient: string; + amount: string | number; +} + +function isTransferContent(content: any): content is TransferContent { + elizaLogger.log("Content for transfer", content); + return ( + typeof content.recipient === "string" && + (typeof content.amount === "string" || + typeof content.amount === "number") + ); +} + +const transferTemplate = `Respond with a JSON markdown block containing only the extracted values. Use null for any values that cannot be determined. + +Example response: +\`\`\`json +{ + "recipient": "0x2badda48c062e861ef17a96a806c451fd296a49f45b272dee17f85b0e32663fd", + "amount": "1000" +} +\`\`\` + +{{recentMessages}} + +Given the recent messages, extract the following information about the requested token transfer: +- Recipient wallet address +- Amount to transfer + +Respond with a JSON markdown block containing only the extracted values.`; + +export default { + name: "SEND_TOKEN", + similes: [ + "TRANSFER_TOKEN", + "TRANSFER_TOKENS", + "SEND_TOKENS", + "SEND_TRK", + "PAY", + ], + validate: async (runtime: IAgentRuntime, message: Memory) => { + elizaLogger.log("Validating trikon transfer from user:", message.userId); + return false; + }, + description: "Transfer tokens from the agent's wallet to another address", + handler: async ( + runtime: IAgentRuntime, + message: Memory, + state: State, + _options: { [key: string]: unknown }, + callback?: HandlerCallback + ): Promise => { + elizaLogger.log("Starting SEND_TOKEN handler..."); + + // Initialize or update state + if (!state) { + state = (await runtime.composeState(message)) as State; + } else { + state = await runtime.updateRecentMessageState(state); + } + + // Compose transfer context + const transferContext = composeContext({ + state, + template: transferTemplate, + }); + + // Generate transfer content + const content = await generateObjectDeprecated({ + runtime, + context: transferContext, + modelClass: ModelClass.SMALL, + }); + + // Validate transfer content + if (!isTransferContent(content)) { + elizaLogger.error("Invalid content for TRANSFER_TOKEN action."); + if (callback) { + callback({ + text: "Unable to process transfer request. Invalid content provided.", + content: { error: "Invalid transfer content" }, + }); + } + return false; + } + + try { + // TODO: Implement Trikon-specific transfer logic here + elizaLogger.log( + `Would transfer ${content.amount} tokens to ${content.recipient}` + ); + + if (callback) { + callback({ + text: `Transfer simulation successful for ${content.amount} TRK to ${content.recipient}`, + content: { + success: true, + amount: content.amount, + recipient: content.recipient, + }, + }); + } + + return true; + } catch (error) { + elizaLogger.error("Error during token transfer:", error); + if (callback) { + callback({ + text: `Error transferring tokens: ${error.message}`, + content: { error: error.message }, + }); + } + return false; + } + }, + + examples: [ + [ + { + user: "{{user1}}", + content: { + text: "Send 100 TRK tokens to 0xa385EEeFB533703dc4c811CB6Eb44cac2C14af07", + }, + }, + { + user: "{{user2}}", + content: { + text: "I'll send 100 TRK tokens now...", + action: "SEND_TOKEN", + }, + }, + { + user: "{{user2}}", + content: { + text: "Successfully sent 100 TRK tokens to 0xa385EEeFB533703dc4c811CB6Eb44cac2C14af07", + }, + }, + ], + ] as ActionExample[][], +} as Action; \ No newline at end of file diff --git a/packages/plugin-trikon/src/index.ts b/packages/plugin-trikon/src/index.ts new file mode 100644 index 00000000000..63f0d13e0e1 --- /dev/null +++ b/packages/plugin-trikon/src/index.ts @@ -0,0 +1,5 @@ +export * from "./plugins/trikonPlugin"; +export * from "./actions/trikon"; +export * from "./providers/wallet"; + +export { default } from "./plugins/trikonPlugin"; \ No newline at end of file diff --git a/packages/plugin-trikon/src/plugins/trikonPlugin.ts b/packages/plugin-trikon/src/plugins/trikonPlugin.ts new file mode 100644 index 00000000000..2950cc39b6b --- /dev/null +++ b/packages/plugin-trikon/src/plugins/trikonPlugin.ts @@ -0,0 +1,15 @@ +import type { Plugin } from "@elizaos/core"; +import transferAction from "../actions/trikon"; +import walletProvider from "../providers/wallet"; + +export const trikonPlugin: Plugin = { + name: "trikon", + description: "Trikon Plugin for Eliza", + actions: [transferAction], + providers: [walletProvider], + evaluators: [], + services: [], + clients: [], +}; + +export default trikonPlugin; \ No newline at end of file diff --git a/packages/plugin-trikon/src/providers/wallet.ts b/packages/plugin-trikon/src/providers/wallet.ts new file mode 100644 index 00000000000..14b95b0cfc3 --- /dev/null +++ b/packages/plugin-trikon/src/providers/wallet.ts @@ -0,0 +1,62 @@ +import { elizaLogger, type Provider } from "@elizaos/core"; + +export interface WalletProvider { + address: string; + balance: string; + getBalance(): Promise; + getAddress(): Promise; +} + +export const walletProvider: Provider = { + get: async (context) => { + elizaLogger.log("Initializing Trikon wallet provider..."); + + try { + // TODO: Implement Trikon-specific wallet logic here + const wallet: WalletProvider = { + address: "0xa385EEeFB533703dc4c811CB6Eb44cac2C14af07", + balance: "0", + + async getBalance(): Promise { + try { + // TODO: Implement actual balance fetching + elizaLogger.log("Fetching Trikon wallet balance..."); + return this.balance; + } catch (error) { + elizaLogger.error("Error fetching balance:", error); + throw error; + } + }, + + async getAddress(): Promise { + try { + // TODO: Implement actual address fetching + elizaLogger.log("Fetching Trikon wallet address..."); + return this.address; + } catch (error) { + elizaLogger.error("Error fetching address:", error); + throw error; + } + } + }; + + elizaLogger.log("Trikon wallet provider initialized successfully"); + return wallet; + + } catch (error) { + elizaLogger.error("Error initializing Trikon wallet provider:", error); + throw error; + } + }, + // get: async () => { + // elizaLogger.log("Getting Trikon wallet provider..."); + // return { + // address: "0xa385EEeFB533703dc4c811CB6Eb44cac2C14af07", + // balance: "0", + // getBalance: async () => "0", + // getAddress: async () => "0xa385EEeFB533703dc4c811CB6Eb44cac2C14af07" + // }; + // } +}; + +export default walletProvider; \ No newline at end of file diff --git a/packages/plugin-trikon/tsconfig.json b/packages/plugin-trikon/tsconfig.json new file mode 100644 index 00000000000..73993deaaf7 --- /dev/null +++ b/packages/plugin-trikon/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../core/tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**/*.ts" + ] +} \ No newline at end of file diff --git a/packages/plugin-trikon/tsup.config.ts b/packages/plugin-trikon/tsup.config.ts new file mode 100644 index 00000000000..bbf6e87e9af --- /dev/null +++ b/packages/plugin-trikon/tsup.config.ts @@ -0,0 +1,26 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + entry: ["src/index.ts"], + outDir: "dist", + sourcemap: true, + clean: true, + format: ["esm"], + external: [ + "dotenv", + "fs", + "path", + "@reflink/reflink", + "@node-llama-cpp", + "https", + "http", + "agentkeepalive", + "safe-buffer", + "base-x", + "bs58", + "borsh", + "stream", + "buffer", + "querystring" + ], +}); \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f66f6a08f74..e9a1477e465 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,19 +14,19 @@ importers: dependencies: '@0glabs/0g-ts-sdk': specifier: 0.2.1 - version: 0.2.1(bufferutil@4.0.9)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@6.0.5))(utf-8-validate@6.0.5) + version: 0.2.1(bufferutil@4.0.9)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(utf-8-validate@5.0.10) '@coinbase/coinbase-sdk': specifier: 0.10.0 - version: 0.10.0(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@6.0.5)(zod@3.24.1) + version: 0.10.0(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.24.1) '@deepgram/sdk': specifier: ^3.9.0 - version: 3.9.0(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@6.0.5) + version: 3.9.0(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10) '@injectivelabs/sdk-ts': specifier: ^1.14.33 - version: 1.14.33(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@6.0.5) + version: 1.14.33(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@5.0.10) '@vitest/eslint-plugin': specifier: 1.0.1 - version: 1.0.1(@typescript-eslint/utils@8.20.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3))(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)(vitest@2.1.5(@types/node@22.10.7)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0)) + version: 1.0.1(@typescript-eslint/utils@8.20.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3))(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)(vitest@2.1.5(@types/node@20.17.9)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@5.0.10))(terser@5.37.0)) amqplib: specifier: 0.10.5 version: 0.10.5 @@ -57,7 +57,7 @@ importers: version: 1.9.4 '@commitlint/cli': specifier: 18.6.1 - version: 18.6.1(@types/node@22.10.7)(typescript@5.6.3) + version: 18.6.1(@types/node@20.17.9)(typescript@5.6.3) '@commitlint/config-conventional': specifier: 18.6.3 version: 18.6.3 @@ -75,7 +75,7 @@ importers: version: 9.1.7 jest: specifier: ^29.7.0 - version: 29.7.0(@types/node@22.10.7)(babel-plugin-macros@3.1.0) + version: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) lerna: specifier: 8.1.5 version: 8.1.5(@swc/core@1.10.8(@swc/helpers@0.5.15))(babel-plugin-macros@3.1.0)(encoding@0.1.13) @@ -93,13 +93,13 @@ importers: version: 5.6.3 viem: specifier: 2.21.58 - version: 2.21.58(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@6.0.5)(zod@3.24.1) + version: 2.21.58(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.24.1) vite: specifier: 5.4.11 - version: 5.4.11(@types/node@22.10.7)(terser@5.37.0) + version: 5.4.11(@types/node@20.17.9)(terser@5.37.0) vitest: specifier: 2.1.5 - version: 2.1.5(@types/node@22.10.7)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0) + version: 2.1.5(@types/node@20.17.9)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@5.0.10))(terser@5.37.0) agent: dependencies: @@ -3340,6 +3340,19 @@ importers: specifier: 7.1.0 version: 7.1.0 + packages/plugin-trikon: + dependencies: + '@elizaos/core': + specifier: workspace:* + version: link:../core + devDependencies: + tsup: + specifier: 8.3.5 + version: 8.3.5(@swc/core@1.10.8(@swc/helpers@0.5.15))(jiti@2.4.2)(postcss@8.5.1)(tsx@4.19.2)(typescript@5.7.3)(yaml@2.7.0) + vitest: + specifier: 2.1.4 + version: 2.1.4(@types/node@22.10.7)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0) + packages/plugin-trustdb: dependencies: '@elizaos/core': @@ -24624,6 +24637,18 @@ packages: snapshots: + '@0glabs/0g-ts-sdk@0.2.1(bufferutil@4.0.9)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10))(utf-8-validate@5.0.10)': + dependencies: + '@ethersproject/bytes': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + ethers: 6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10) + open-jsonrpc-provider: 0.2.1(bufferutil@4.0.9)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - debug + - supports-color + - utf-8-validate + '@0glabs/0g-ts-sdk@0.2.1(bufferutil@4.0.9)(ethers@6.13.4(bufferutil@4.0.9)(utf-8-validate@6.0.5))(utf-8-validate@6.0.5)': dependencies: '@ethersproject/bytes': 5.7.0 @@ -24756,7 +24781,7 @@ snapshots: '@acuminous/bitsyntax@0.1.2': dependencies: buffer-more-ints: 1.0.0 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 safe-buffer: 5.1.2 transitivePeerDependencies: - supports-color @@ -25924,7 +25949,7 @@ snapshots: '@babel/traverse': 7.26.5 '@babel/types': 7.26.5 convert-source-map: 2.0.0 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -26704,7 +26729,7 @@ snapshots: '@babel/parser': 7.26.5 '@babel/template': 7.25.9 '@babel/types': 7.26.5 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -26966,7 +26991,7 @@ snapshots: - typescript - utf-8-validate - '@coinbase/coinbase-sdk@0.10.0(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@6.0.5)(zod@3.24.1)': + '@coinbase/coinbase-sdk@0.10.0(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.24.1)': dependencies: '@scure/bip32': 1.6.2 abitype: 1.0.8(typescript@5.6.3)(zod@3.24.1) @@ -26977,10 +27002,10 @@ snapshots: bip39: 3.1.0 decimal.js: 10.4.3 dotenv: 16.4.7 - ethers: 6.13.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + ethers: 6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10) node-jose: 2.2.0 secp256k1: 5.0.1 - viem: 2.21.58(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@6.0.5)(zod@3.24.1) + viem: 2.21.58(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.24.1) transitivePeerDependencies: - bufferutil - debug @@ -27020,11 +27045,11 @@ snapshots: '@colors/colors@1.5.0': optional: true - '@commitlint/cli@18.6.1(@types/node@22.10.7)(typescript@5.6.3)': + '@commitlint/cli@18.6.1(@types/node@20.17.9)(typescript@5.6.3)': dependencies: '@commitlint/format': 18.6.1 '@commitlint/lint': 18.6.1 - '@commitlint/load': 18.6.1(@types/node@22.10.7)(typescript@5.6.3) + '@commitlint/load': 18.6.1(@types/node@20.17.9)(typescript@5.6.3) '@commitlint/read': 18.6.1 '@commitlint/types': 18.6.1 execa: 5.1.1 @@ -27074,7 +27099,7 @@ snapshots: '@commitlint/rules': 18.6.1 '@commitlint/types': 18.6.1 - '@commitlint/load@18.6.1(@types/node@22.10.7)(typescript@5.6.3)': + '@commitlint/load@18.6.1(@types/node@20.17.9)(typescript@5.6.3)': dependencies: '@commitlint/config-validator': 18.6.1 '@commitlint/execute-rule': 18.6.1 @@ -27082,7 +27107,7 @@ snapshots: '@commitlint/types': 18.6.1 chalk: 4.1.2 cosmiconfig: 8.3.6(typescript@5.6.3) - cosmiconfig-typescript-loader: 5.1.0(@types/node@22.10.7)(cosmiconfig@8.3.6(typescript@5.6.3))(typescript@5.6.3) + cosmiconfig-typescript-loader: 5.1.0(@types/node@20.17.9)(cosmiconfig@8.3.6(typescript@5.6.3))(typescript@5.6.3) lodash.isplainobject: 4.0.6 lodash.merge: 4.6.2 lodash.uniq: 4.5.0 @@ -27941,14 +27966,14 @@ snapshots: dependencies: dayjs: 1.11.13 - '@deepgram/sdk@3.9.0(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@6.0.5)': + '@deepgram/sdk@3.9.0(bufferutil@4.0.9)(encoding@0.1.13)(utf-8-validate@5.0.10)': dependencies: '@deepgram/captions': 1.2.0 '@types/node': 18.19.71 cross-fetch: 3.2.0(encoding@0.1.13) deepmerge: 4.3.1 events: 3.3.0 - ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - encoding @@ -29775,7 +29800,7 @@ snapshots: '@eslint/config-array@0.19.1': dependencies: '@eslint/object-schema': 2.1.5 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -29805,7 +29830,7 @@ snapshots: '@eslint/eslintrc@3.2.0': dependencies: ajv: 6.12.6 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 espree: 10.3.0 globals: 14.0.0 ignore: 5.3.2 @@ -30774,12 +30799,12 @@ snapshots: protobufjs: 7.4.0 rxjs: 7.8.1 - '@injectivelabs/sdk-ts@1.14.33(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@6.0.5)': + '@injectivelabs/sdk-ts@1.14.33(@types/react@19.0.7)(bufferutil@4.0.9)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(utf-8-validate@5.0.10)': dependencies: '@apollo/client': 3.12.6(@types/react@19.0.7)(graphql@16.10.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@cosmjs/amino': 0.32.4 '@cosmjs/proto-signing': 0.32.4 - '@cosmjs/stargate': 0.32.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + '@cosmjs/stargate': 0.32.4(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@ethersproject/bytes': 5.7.0 '@injectivelabs/core-proto-ts': 1.13.4 '@injectivelabs/exceptions': 1.14.33(google-protobuf@3.21.4) @@ -30800,7 +30825,7 @@ snapshots: bip39: 3.1.0 cosmjs-types: 0.9.0 ethereumjs-util: 7.1.5 - ethers: 6.13.4(bufferutil@4.0.9)(utf-8-validate@6.0.5) + ethers: 6.13.4(bufferutil@4.0.9)(utf-8-validate@5.0.10) google-protobuf: 3.21.4 graphql: 16.10.0 http-status-codes: 2.3.0 @@ -31252,6 +31277,41 @@ snapshots: jest-util: 29.7.0 slash: 3.0.0 + '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3))': + dependencies: + '@jest/console': 29.7.0 + '@jest/reporters': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 20.17.9 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + ci-info: 3.9.0 + exit: 0.1.2 + graceful-fs: 4.2.11 + jest-changed-files: 29.7.0 + jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) + jest-haste-map: 29.7.0 + jest-message-util: 29.7.0 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-resolve-dependencies: 29.7.0 + jest-runner: 29.7.0 + jest-runtime: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + jest-watcher: 29.7.0 + micromatch: 4.0.8 + pretty-format: 29.7.0 + slash: 3.0.0 + strip-ansi: 6.0.1 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + - ts-node + '@jest/core@29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3))': dependencies: '@jest/console': 29.7.0 @@ -38948,7 +39008,7 @@ snapshots: dependencies: '@typescript-eslint/types': 8.20.0 '@typescript-eslint/visitor-keys': 8.20.0 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 fast-glob: 3.3.3 is-glob: 4.0.3 minimatch: 9.0.5 @@ -39168,13 +39228,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@vitest/eslint-plugin@1.0.1(@typescript-eslint/utils@8.20.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3))(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)(vitest@2.1.5(@types/node@22.10.7)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0))': + '@vitest/eslint-plugin@1.0.1(@typescript-eslint/utils@8.20.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3))(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3)(vitest@2.1.5(@types/node@20.17.9)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@5.0.10))(terser@5.37.0))': dependencies: eslint: 9.18.0(jiti@2.4.2) optionalDependencies: '@typescript-eslint/utils': 8.20.0(eslint@9.18.0(jiti@2.4.2))(typescript@5.6.3) typescript: 5.6.3 - vitest: 2.1.5(@types/node@22.10.7)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0) + vitest: 2.1.5(@types/node@20.17.9)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@5.0.10))(terser@5.37.0) '@vitest/expect@0.34.6': dependencies: @@ -39230,6 +39290,14 @@ snapshots: optionalDependencies: vite: 5.4.11(@types/node@22.10.7)(terser@5.37.0) + '@vitest/mocker@2.1.5(vite@5.4.11(@types/node@20.17.9)(terser@5.37.0))': + dependencies: + '@vitest/spy': 2.1.5 + estree-walker: 3.0.3 + magic-string: 0.30.17 + optionalDependencies: + vite: 5.4.11(@types/node@20.17.9)(terser@5.37.0) + '@vitest/mocker@2.1.5(vite@5.4.11(@types/node@22.10.7)(terser@5.37.0))': dependencies: '@vitest/spy': 2.1.5 @@ -40408,7 +40476,7 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 transitivePeerDependencies: - supports-color @@ -41035,6 +41103,13 @@ snapshots: transitivePeerDependencies: - debug + axios@0.27.2: + dependencies: + follow-redirects: 1.15.9 + form-data: 4.0.1 + transitivePeerDependencies: + - debug + axios@0.27.2(debug@4.3.4): dependencies: follow-redirects: 1.15.9(debug@4.3.4) @@ -41083,7 +41158,7 @@ snapshots: axios@1.7.9: dependencies: - follow-redirects: 1.15.9(debug@4.3.4) + follow-redirects: 1.15.9 form-data: 4.0.1 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -42617,9 +42692,9 @@ snapshots: dependencies: layout-base: 2.0.1 - cosmiconfig-typescript-loader@5.1.0(@types/node@22.10.7)(cosmiconfig@8.3.6(typescript@5.6.3))(typescript@5.6.3): + cosmiconfig-typescript-loader@5.1.0(@types/node@20.17.9)(cosmiconfig@8.3.6(typescript@5.6.3))(typescript@5.6.3): dependencies: - '@types/node': 22.10.7 + '@types/node': 20.17.9 cosmiconfig: 8.3.6(typescript@5.6.3) jiti: 1.21.7 typescript: 5.6.3 @@ -42705,6 +42780,21 @@ snapshots: safe-buffer: 5.2.1 sha.js: 2.4.11 + create-jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)): + dependencies: + '@jest/types': 29.6.3 + chalk: 4.1.2 + exit: 0.1.2 + graceful-fs: 4.2.11 + jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) + jest-util: 29.7.0 + prompts: 2.4.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + create-jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): dependencies: '@jest/types': 29.6.3 @@ -43301,6 +43391,10 @@ snapshots: dependencies: ms: 2.1.3 + debug@4.4.0: + dependencies: + ms: 2.1.3 + debug@4.4.0(supports-color@5.5.0): dependencies: ms: 2.1.3 @@ -44423,7 +44517,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 escape-string-regexp: 4.0.0 eslint-scope: 8.2.0 eslint-visitor-keys: 4.2.0 @@ -45206,6 +45300,8 @@ snapshots: async: 0.2.10 which: 1.3.1 + follow-redirects@1.15.9: {} + follow-redirects@1.15.9(debug@4.3.4): optionalDependencies: debug: 4.3.4 @@ -46347,7 +46443,7 @@ snapshots: http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.3 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 transitivePeerDependencies: - supports-color @@ -46405,14 +46501,14 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 transitivePeerDependencies: - supports-color https-proxy-agent@7.0.6: dependencies: agent-base: 7.1.3 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 transitivePeerDependencies: - supports-color @@ -47068,7 +47164,7 @@ snapshots: istanbul-lib-source-maps@4.0.1: dependencies: - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: @@ -47187,6 +47283,25 @@ snapshots: - babel-plugin-macros - supports-color + jest-cli@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)): + dependencies: + '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 + chalk: 4.1.2 + create-jest: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) + exit: 0.1.2 + import-local: 3.2.0 + jest-config: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) + jest-util: 29.7.0 + jest-validate: 29.7.0 + yargs: 17.7.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + jest-cli@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): dependencies: '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) @@ -47244,6 +47359,37 @@ snapshots: - supports-color - ts-node + jest-config@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)): + dependencies: + '@babel/core': 7.26.0 + '@jest/test-sequencer': 29.7.0 + '@jest/types': 29.6.3 + babel-jest: 29.7.0(@babel/core@7.26.0) + chalk: 4.1.2 + ci-info: 3.9.0 + deepmerge: 4.3.1 + glob: 7.2.3 + graceful-fs: 4.2.11 + jest-circus: 29.7.0(babel-plugin-macros@3.1.0) + jest-environment-node: 29.7.0 + jest-get-type: 29.6.3 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-runner: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + micromatch: 4.0.8 + parse-json: 5.2.0 + pretty-format: 29.7.0 + slash: 3.0.0 + strip-json-comments: 3.1.1 + optionalDependencies: + '@types/node': 20.17.9 + ts-node: 10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3) + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + jest-config@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): dependencies: '@babel/core': 7.26.0 @@ -47588,6 +47734,18 @@ snapshots: merge-stream: 2.0.0 supports-color: 8.1.1 + jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)): + dependencies: + '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) + '@jest/types': 29.6.3 + import-local: 3.2.0 + jest-cli: 29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.6.3)) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + jest@29.7.0(@types/node@20.17.9)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)): dependencies: '@jest/core': 29.7.0(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@swc/core@1.10.8(@swc/helpers@0.5.15))(@types/node@20.17.9)(typescript@5.7.3)) @@ -50251,6 +50409,18 @@ snapshots: platform: 1.3.6 protobufjs: 7.4.0 + open-jsonrpc-provider@0.2.1(bufferutil@4.0.9)(utf-8-validate@5.0.10): + dependencies: + axios: 0.27.2 + reconnecting-websocket: 4.4.0 + websocket: 1.0.35 + ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - debug + - supports-color + - utf-8-validate + open-jsonrpc-provider@0.2.1(bufferutil@4.0.9)(utf-8-validate@6.0.5): dependencies: axios: 0.27.2(debug@4.3.4) @@ -53612,7 +53782,7 @@ snapshots: socks-proxy-agent@8.0.5: dependencies: agent-base: 7.1.3 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 socks: 2.8.3 transitivePeerDependencies: - supports-color @@ -55196,7 +55366,7 @@ snapshots: cac: 6.7.14 chokidar: 4.0.3 consola: 3.4.0 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 esbuild: 0.24.2 joycon: 3.1.1 picocolors: 1.1.1 @@ -55230,7 +55400,7 @@ snapshots: tuf-js@2.2.1: dependencies: '@tufjs/models': 2.0.1 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 make-fetch-happen: 13.0.1 transitivePeerDependencies: - supports-color @@ -55933,17 +56103,17 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - viem@2.21.58(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@6.0.5)(zod@3.24.1): + viem@2.21.58(bufferutil@4.0.9)(typescript@5.6.3)(utf-8-validate@5.0.10)(zod@3.24.1): dependencies: '@noble/curves': 1.7.0 '@noble/hashes': 1.6.1 '@scure/bip32': 1.6.0 '@scure/bip39': 1.5.0 abitype: 1.0.7(typescript@5.6.3)(zod@3.24.1) - isows: 1.0.6(ws@8.18.0(bufferutil@4.0.9)(utf-8-validate@6.0.5)) + isows: 1.0.6(ws@8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10)) ox: 0.4.4(typescript@5.6.3)(zod@3.24.1) webauthn-p256: 0.0.10 - ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@6.0.5) + ws: 8.18.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) optionalDependencies: typescript: 5.6.3 transitivePeerDependencies: @@ -56134,7 +56304,7 @@ snapshots: vite-node@2.1.4(@types/node@22.10.7)(terser@5.37.0): dependencies: cac: 6.7.14 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 pathe: 1.1.2 vite: 5.4.11(@types/node@22.10.7)(terser@5.37.0) transitivePeerDependencies: @@ -56148,6 +56318,24 @@ snapshots: - supports-color - terser + vite-node@2.1.5(@types/node@20.17.9)(terser@5.37.0): + dependencies: + cac: 6.7.14 + debug: 4.4.0 + es-module-lexer: 1.6.0 + pathe: 1.1.2 + vite: 5.4.11(@types/node@20.17.9)(terser@5.37.0) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vite-node@2.1.5(@types/node@22.10.7)(terser@5.37.0): dependencies: cac: 6.7.14 @@ -56739,7 +56927,7 @@ snapshots: '@vitest/spy': 2.1.4 '@vitest/utils': 2.1.4 chai: 5.1.2 - debug: 4.4.0(supports-color@5.5.0) + debug: 4.4.0 expect-type: 1.1.0 magic-string: 0.30.17 pathe: 1.1.2 @@ -56765,6 +56953,42 @@ snapshots: - supports-color - terser + vitest@2.1.5(@types/node@20.17.9)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@5.0.10))(terser@5.37.0): + dependencies: + '@vitest/expect': 2.1.5 + '@vitest/mocker': 2.1.5(vite@5.4.11(@types/node@20.17.9)(terser@5.37.0)) + '@vitest/pretty-format': 2.1.8 + '@vitest/runner': 2.1.5 + '@vitest/snapshot': 2.1.5 + '@vitest/spy': 2.1.5 + '@vitest/utils': 2.1.5 + chai: 5.1.2 + debug: 4.4.0 + expect-type: 1.1.0 + magic-string: 0.30.17 + pathe: 1.1.2 + std-env: 3.8.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinypool: 1.0.2 + tinyrainbow: 1.2.0 + vite: 5.4.11(@types/node@20.17.9)(terser@5.37.0) + vite-node: 2.1.5(@types/node@20.17.9)(terser@5.37.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 20.17.9 + jsdom: 25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@5.0.10) + transitivePeerDependencies: + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vitest@2.1.5(@types/node@22.10.7)(jsdom@25.0.1(bufferutil@4.0.9)(canvas@2.11.2(encoding@0.1.13))(utf-8-validate@6.0.5))(terser@5.37.0): dependencies: '@vitest/expect': 2.1.5 From d885885c38cf12a7c54dc6bf29e59af15b08d422 Mon Sep 17 00:00:00 2001 From: Amritesh Khare Date: Tue, 21 Jan 2025 03:22:45 +0530 Subject: [PATCH 2/3] fix:wallet.ts --- .../plugin-trikon/src/providers/wallet.ts | 58 +++---------------- 1 file changed, 9 insertions(+), 49 deletions(-) diff --git a/packages/plugin-trikon/src/providers/wallet.ts b/packages/plugin-trikon/src/providers/wallet.ts index 14b95b0cfc3..40f9afa181c 100644 --- a/packages/plugin-trikon/src/providers/wallet.ts +++ b/packages/plugin-trikon/src/providers/wallet.ts @@ -8,55 +8,15 @@ export interface WalletProvider { } export const walletProvider: Provider = { - get: async (context) => { - elizaLogger.log("Initializing Trikon wallet provider..."); - - try { - // TODO: Implement Trikon-specific wallet logic here - const wallet: WalletProvider = { - address: "0xa385EEeFB533703dc4c811CB6Eb44cac2C14af07", - balance: "0", - - async getBalance(): Promise { - try { - // TODO: Implement actual balance fetching - elizaLogger.log("Fetching Trikon wallet balance..."); - return this.balance; - } catch (error) { - elizaLogger.error("Error fetching balance:", error); - throw error; - } - }, - - async getAddress(): Promise { - try { - // TODO: Implement actual address fetching - elizaLogger.log("Fetching Trikon wallet address..."); - return this.address; - } catch (error) { - elizaLogger.error("Error fetching address:", error); - throw error; - } - } - }; - - elizaLogger.log("Trikon wallet provider initialized successfully"); - return wallet; - - } catch (error) { - elizaLogger.error("Error initializing Trikon wallet provider:", error); - throw error; - } - }, - // get: async () => { - // elizaLogger.log("Getting Trikon wallet provider..."); - // return { - // address: "0xa385EEeFB533703dc4c811CB6Eb44cac2C14af07", - // balance: "0", - // getBalance: async () => "0", - // getAddress: async () => "0xa385EEeFB533703dc4c811CB6Eb44cac2C14af07" - // }; - // } + get: async () => { + elizaLogger.log("Getting Trikon wallet provider..."); + return { + address: process.env.TRIKON_WALLET_ADDRESS || "0x4f2e63be8e7fe287836e29cde6f3d5cbc96eefd0c0e3f3747668faa2ae7324b0", + balance: process.env.TRIKON_INITIAL_BALANCE || "0", + getBalance: async () => process.env.TRIKON_INITIAL_BALANCE || "0", + getAddress: async () => process.env.TRIKON_WALLET_ADDRESS || "0x4f2e63be8e7fe287836e29cde6f3d5cbc96eefd0c0e3f3747668faa2ae7324b0" + }; + } }; export default walletProvider; \ No newline at end of file From ac58141564e91e1efc4cd8821161422f631f4866 Mon Sep 17 00:00:00 2001 From: Sayo Date: Tue, 21 Jan 2025 16:12:45 +0530 Subject: [PATCH 3/3] Update trikon.ts --- packages/plugin-trikon/src/actions/trikon.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/packages/plugin-trikon/src/actions/trikon.ts b/packages/plugin-trikon/src/actions/trikon.ts index dfb23277af6..552c5569cb3 100644 --- a/packages/plugin-trikon/src/actions/trikon.ts +++ b/packages/plugin-trikon/src/actions/trikon.ts @@ -1,18 +1,3 @@ -// import type { Action } from "@elizaos/core"; - -// export const trikonAction: Action = { -// name: "Trikon", -// description: "A Trikon action for Trikon plugin", -// execute: async (context) => { -// // Implementation here -// return { -// success: true, -// message: "Trikon action executed successfully" -// }; -// } -// }; - -// export default trikonAction; import { elizaLogger } from "@elizaos/core"; import { type ActionExample, @@ -167,4 +152,4 @@ export default { }, ], ] as ActionExample[][], -} as Action; \ No newline at end of file +} as Action;