From 0dac7db13a04ffb480ec5e6f578e56bc1c1824d6 Mon Sep 17 00:00:00 2001 From: Jorge Antonio Date: Thu, 23 Jan 2025 21:25:06 +0000 Subject: [PATCH 1/6] add a tool folder and add Suilend protocol --- README.md | 5 +- sui-agent/package-lock.json | 533 ++++++++---------- .../src/{ => tools}/aftermath/PoolTool.ts | 0 .../aftermath/PoolTransactionTool.ts | 0 .../src/{ => tools}/aftermath/PriceTool.ts | 0 .../src/{ => tools}/aftermath/TradeTool.ts | 0 sui-agent/src/{ => tools}/aftermath/apr.ts | 0 sui-agent/src/{ => tools}/aftermath/index.ts | 0 .../src/{ => tools}/aftermath/staking.ts | 0 9 files changed, 230 insertions(+), 308 deletions(-) rename sui-agent/src/{ => tools}/aftermath/PoolTool.ts (100%) rename sui-agent/src/{ => tools}/aftermath/PoolTransactionTool.ts (100%) rename sui-agent/src/{ => tools}/aftermath/PriceTool.ts (100%) rename sui-agent/src/{ => tools}/aftermath/TradeTool.ts (100%) rename sui-agent/src/{ => tools}/aftermath/apr.ts (100%) rename sui-agent/src/{ => tools}/aftermath/index.ts (100%) rename sui-agent/src/{ => tools}/aftermath/staking.ts (100%) diff --git a/README.md b/README.md index ced3f7f..3154940 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,8 @@ atoma-agents/ └── src/ ├── app.ts # Main application entry point ├── server.ts # Server configuration - ├── aftermath/ # Aftermath Finance protocol integration + ├── tools/ # Tool registry + | └── aftermath/ # Aftermath Finance protocol integration ├── agents/ # AI agent implementation ├── config/ # Configuration files ├── prompts/ # AI prompt templates @@ -146,7 +147,7 @@ For support, please open an issue in the GitHub repository or contact the mainta ## Roadmap -- [ ] Add support for more Sui protocols like Navi, Cetus, BlueFin, AlphaFi etc. +- [ ] Add support for more Sui protocols like Suilend, Navi, Cetus, BlueFin, AlphaFi etc. - [ ] Allow the prompt to sequentially compose multiple tools - [ ] Implement cross-chain operations - [ ] Add more complex transaction types diff --git a/sui-agent/package-lock.json b/sui-agent/package-lock.json index e71f7a3..1b8dbe2 100644 --- a/sui-agent/package-lock.json +++ b/sui-agent/package-lock.json @@ -9,7 +9,6 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@mysten/sui": "^1.12.0", "aftermath-ts-sdk": "^1.2.49", "atoma-sdk": "github:atoma-network/atoma-sdk-typescript", "axios": "^1.7.9", @@ -35,6 +34,7 @@ "resolved": "https://registry.npmjs.org/@0no-co/graphql.web/-/graphql.web-1.0.13.tgz", "integrity": "sha512-jqYxOevheVTU1S36ZdzAkJIdvRp2m3OYIG5SEoKDw5NI8eVwkoI0D/Q3DYNGmXCxkA6CQuoa7zvMiDPTLqUNuw==", "license": "MIT", + "peer": true, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0" }, @@ -49,6 +49,7 @@ "resolved": "https://registry.npmjs.org/@0no-co/graphqlsp/-/graphqlsp-1.12.16.tgz", "integrity": "sha512-B5pyYVH93Etv7xjT6IfB7QtMBdaaC07yjbhN6v8H7KgFStMkPvi+oWYBTibMFRMY89qwc9H8YixXg8SXDVgYWw==", "license": "MIT", + "peer": true, "dependencies": { "@gql.tada/internal": "^1.0.0", "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0" @@ -135,31 +136,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@eslint/eslintrc/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@eslint/eslintrc/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/@eslint/js": { "version": "8.57.1", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", @@ -175,6 +151,7 @@ "resolved": "https://registry.npmjs.org/@gql.tada/cli-utils/-/cli-utils-1.6.3.tgz", "integrity": "sha512-jFFSY8OxYeBxdKi58UzeMXG1tdm4FVjXa8WHIi66Gzu9JWtCE6mqom3a8xkmSw+mVaybFW5EN2WXf1WztJVNyQ==", "license": "MIT", + "peer": true, "dependencies": { "@0no-co/graphqlsp": "^1.12.13", "@gql.tada/internal": "1.0.8", @@ -201,6 +178,7 @@ "resolved": "https://registry.npmjs.org/@gql.tada/internal/-/internal-1.0.8.tgz", "integrity": "sha512-XYdxJhtHC5WtZfdDqtKjcQ4d7R1s0d1rnlSs3OcBEUbYiPoJJfZU7tWsVXuv047Z6msvmr4ompJ7eLSK5Km57g==", "license": "MIT", + "peer": true, "dependencies": { "@0no-co/graphql.web": "^1.0.5" }, @@ -214,6 +192,7 @@ "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz", "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==", "license": "MIT", + "peer": true, "peerDependencies": { "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } @@ -234,31 +213,6 @@ "node": ">=10.10.0" } }, - "node_modules/@humanwhocodes/config-array/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@humanwhocodes/config-array/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -311,6 +265,7 @@ "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-1.2.1.tgz", "integrity": "sha512-RMSaUsNb8oR0rTRVIOOcyoEVJqQi6DLvMXN+7mvDcki12FJFQ0lF89zQa7AV7cIurWlDQfJ8VIbCuRDyK+955A==", "license": "Apache-2.0", + "peer": true, "dependencies": { "bs58": "^6.0.0" } @@ -320,6 +275,7 @@ "resolved": "https://registry.npmjs.org/@mysten/sui/-/sui-1.20.0.tgz", "integrity": "sha512-/XLogwOYaSP31lPt377fj5b+8sRIyt2Opi/Ssos5dssPqol9vgvN/ZzV5Y5qVl4VquhATJHRpwV33B5rIVi7Ow==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@graphql-typed-document-node/core": "^3.2.0", "@mysten/bcs": "1.2.1", @@ -622,7 +578,8 @@ "resolved": "https://registry.npmjs.org/@simplewebauthn/typescript-types/-/typescript-types-7.4.0.tgz", "integrity": "sha512-8/ZjHeUPe210Bt5oyaOIGx4h8lHdsQs19BiOT44gi/jBEgK7uBGA0Fy7NRsyh777al3m6WM0mBf0UR7xd4R7WQ==", "deprecated": "This package has been renamed to @simplewebauthn/types. Please install @simplewebauthn/types instead to ensure you receive future updates.", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@suchipi/femver": { "version": "1.0.0", @@ -740,9 +697,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.10.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.7.tgz", - "integrity": "sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==", + "version": "22.10.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.10.tgz", + "integrity": "sha512-X47y/mPNzxviAGY5TcYPtYL8JsY3kAq2n8fMmKoRCxq/c4v4pyGNCzM2R6+M5/umG4ZfHuT+sgqDYqWc9rJ6ww==", "license": "MIT", "dependencies": { "undici-types": "~6.20.0" @@ -793,9 +750,9 @@ } }, "node_modules/@types/ws": { - "version": "8.5.13", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", - "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", + "version": "8.5.14", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz", + "integrity": "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==", "license": "MIT", "dependencies": { "@types/node": "*" @@ -836,31 +793,6 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/@typescript-eslint/parser": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", @@ -889,31 +821,6 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/@typescript-eslint/scope-manager": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", @@ -960,31 +867,6 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/@typescript-eslint/types": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", @@ -1027,31 +909,6 @@ } } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/@typescript-eslint/utils": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz", @@ -1079,30 +936,6 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, "node_modules/@typescript-eslint/visitor-keys": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", @@ -1122,9 +955,9 @@ } }, "node_modules/@ungap/structured-clone": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.1.tgz", - "integrity": "sha512-fEzPV3hSkSMltkw152tJKNARhOupqbH96MZWyRjNaYZOMIzbrTeQDG+MTc6Mr2pgzFQzFxAfmhGDNP5QK++2ZA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", "dev": true, "license": "ISC" }, @@ -1225,7 +1058,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -1287,7 +1119,12 @@ }, "node_modules/atoma-sdk": { "version": "0.1.0", - "resolved": "git+ssh://git@github.com/atoma-network/atoma-sdk-typescript.git#328fef6da9d297a013d0fd641355d19e0f9babd1", + "resolved": "git+ssh://git@github.com/atoma-network/atoma-sdk-typescript.git#c1d82e349bd198524497be4a300b9658d35cd388", + "dependencies": { + "@noble/curves": "^1.8.1", + "blake2": "^5.0.0", + "tweetnacl": "^1.0.3" + }, "peerDependencies": { "zod": ">= 3" } @@ -1323,7 +1160,8 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz", "integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/base64-js": { "version": "1.5.1", @@ -1349,7 +1187,8 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/binary-extensions": { "version": "2.3.0", @@ -1363,6 +1202,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/blake2": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/blake2/-/blake2-5.0.0.tgz", + "integrity": "sha512-MLpq1DwBB9rC0IHuRc2gXLEAeNNTTYHEtvYCA5lK4RmoUPRmQLSLQrwgJvou62BvH9KP7whe8n+xxw45++fnYg==", + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "nan": "^2.17.0" + }, + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", @@ -1393,6 +1245,21 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1420,6 +1287,7 @@ "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz", "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==", "license": "MIT", + "peer": true, "dependencies": { "base-x": "^5.0.0" } @@ -1500,7 +1368,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -1513,29 +1380,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chalk/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -1560,11 +1404,22 @@ "fsevents": "~2.3.2" } }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -1577,7 +1432,6 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, "license": "MIT" }, "node_modules/combined-stream": { @@ -1684,12 +1538,20 @@ "license": "MIT" }, "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "license": "MIT", "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, "node_modules/deep-is": { @@ -1910,20 +1772,17 @@ } }, "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" + "estraverse": "^4.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">=8.0.0" } }, "node_modules/eslint-visitor-keys": { @@ -1939,44 +1798,33 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, - "license": "MIT", + "license": "BSD-2-Clause", "dependencies": { - "ms": "^2.1.3" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": ">=6.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, + "license": "BSD-2-Clause", "engines": { - "node": ">=10.13.0" + "node": ">=4.0" } }, - "node_modules/eslint/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -2008,6 +1856,16 @@ "node": ">=0.10" } }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", @@ -2021,7 +1879,7 @@ "node": ">=4.0" } }, - "node_modules/estraverse": { + "node_modules/esrecurse/node_modules/estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", @@ -2031,6 +1889,16 @@ "node": ">=4.0" } }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -2105,6 +1973,21 @@ "url": "https://opencollective.com/express" } }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2129,6 +2012,19 @@ "node": ">=8.6.0" } }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -2219,6 +2115,21 @@ "node": ">= 0.8" } }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -2326,7 +2237,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true, "license": "ISC" }, "node_modules/fsevents": { @@ -2394,7 +2304,6 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -2412,15 +2321,16 @@ } }, "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, "license": "ISC", "dependencies": { - "is-glob": "^4.0.1" + "is-glob": "^4.0.3" }, "engines": { - "node": ">= 6" + "node": ">=10.13.0" } }, "node_modules/globals": { @@ -2477,6 +2387,7 @@ "resolved": "https://registry.npmjs.org/gql.tada/-/gql.tada-1.8.10.tgz", "integrity": "sha512-FrvSxgz838FYVPgZHGOSgbpOjhR+yq44rCzww3oOPJYi0OvBJjAgCiP6LEokZIYND2fUTXzQAyLgcvgw1yNP5A==", "license": "MIT", + "peer": true, "dependencies": { "@0no-co/graphql.web": "^1.0.5", "@0no-co/graphqlsp": "^1.12.13", @@ -2503,17 +2414,18 @@ "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.10.0.tgz", "integrity": "sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==", "license": "MIT", + "peer": true, "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } }, "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "license": "MIT", "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/has-symbols": { @@ -2644,7 +2556,6 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -2734,7 +2645,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, "license": "ISC" }, "node_modules/isomorphic-fetch": { @@ -2781,6 +2691,7 @@ "resolved": "https://registry.npmjs.org/jose/-/jose-5.9.6.tgz", "integrity": "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ==", "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/panva" } @@ -2978,9 +2889,15 @@ } }, "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/nan": { + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.0.tgz", + "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==", "license": "MIT" }, "node_modules/natural-compare": { @@ -3071,29 +2988,27 @@ "url": "https://opencollective.com/nodemon" } }, - "node_modules/nodemon/node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "node_modules/nodemon/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/nodemon/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "license": "MIT", "dependencies": { - "ms": "^2.1.3" + "has-flag": "^3.0.0" }, "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "node": ">=4" } }, - "node_modules/nodemon/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -6164,7 +6079,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -6256,7 +6170,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -6304,7 +6217,8 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/poseidon-lite/-/poseidon-lite-0.2.1.tgz", "integrity": "sha512-xIr+G6HeYfOhCuswdqcFpSX47SPhm0EpisWJ6h7fHlWwaVIvH3dLnejpatrtw6Xc6HaLrpq05y7VRfvDmDGIog==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/prelude-ls": { "version": "1.2.1", @@ -6575,6 +6489,21 @@ "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, "node_modules/send/node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", @@ -6584,12 +6513,6 @@ "node": ">= 0.8" } }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, "node_modules/serve-static": { "version": "1.16.2", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", @@ -6779,22 +6702,21 @@ } }, "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "license": "MIT", "dependencies": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, "license": "MIT" }, "node_modules/to-regex-range": { @@ -7013,7 +6935,8 @@ "version": "0.36.0", "resolved": "https://registry.npmjs.org/valibot/-/valibot-0.36.0.tgz", "integrity": "sha512-CjF1XN4sUce8sBK9TixrDqFM7RwNkuXdJu174/AwmQUB62QbCQADg5lLe8ldBalFgtj1uKj+pKwDJiNo4Mn+eQ==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/vary": { "version": "1.1.2", @@ -7059,7 +6982,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -7085,7 +7007,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, "license": "ISC" }, "node_modules/ws": { diff --git a/sui-agent/src/aftermath/PoolTool.ts b/sui-agent/src/tools/aftermath/PoolTool.ts similarity index 100% rename from sui-agent/src/aftermath/PoolTool.ts rename to sui-agent/src/tools/aftermath/PoolTool.ts diff --git a/sui-agent/src/aftermath/PoolTransactionTool.ts b/sui-agent/src/tools/aftermath/PoolTransactionTool.ts similarity index 100% rename from sui-agent/src/aftermath/PoolTransactionTool.ts rename to sui-agent/src/tools/aftermath/PoolTransactionTool.ts diff --git a/sui-agent/src/aftermath/PriceTool.ts b/sui-agent/src/tools/aftermath/PriceTool.ts similarity index 100% rename from sui-agent/src/aftermath/PriceTool.ts rename to sui-agent/src/tools/aftermath/PriceTool.ts diff --git a/sui-agent/src/aftermath/TradeTool.ts b/sui-agent/src/tools/aftermath/TradeTool.ts similarity index 100% rename from sui-agent/src/aftermath/TradeTool.ts rename to sui-agent/src/tools/aftermath/TradeTool.ts diff --git a/sui-agent/src/aftermath/apr.ts b/sui-agent/src/tools/aftermath/apr.ts similarity index 100% rename from sui-agent/src/aftermath/apr.ts rename to sui-agent/src/tools/aftermath/apr.ts diff --git a/sui-agent/src/aftermath/index.ts b/sui-agent/src/tools/aftermath/index.ts similarity index 100% rename from sui-agent/src/aftermath/index.ts rename to sui-agent/src/tools/aftermath/index.ts diff --git a/sui-agent/src/aftermath/staking.ts b/sui-agent/src/tools/aftermath/staking.ts similarity index 100% rename from sui-agent/src/aftermath/staking.ts rename to sui-agent/src/tools/aftermath/staking.ts From ae4ffbeafca65fc2ca004ae75e7faa34655491ea Mon Sep 17 00:00:00 2001 From: Jorge Antonio Date: Thu, 23 Jan 2025 21:27:24 +0000 Subject: [PATCH 2/6] resolve imports --- sui-agent/src/agents/SuiAgent.ts | 2 +- sui-agent/src/agents/ToolRegistry.ts | 14 +++++++------- sui-agent/src/tools/aftermath/PoolTool.ts | 4 ++-- .../src/tools/aftermath/PoolTransactionTool.ts | 4 ++-- sui-agent/src/tools/aftermath/PriceTool.ts | 4 ++-- sui-agent/src/tools/aftermath/TradeTool.ts | 2 +- sui-agent/src/tools/aftermath/apr.ts | 2 +- sui-agent/src/tools/aftermath/index.ts | 6 +++--- sui-agent/src/tools/aftermath/staking.ts | 4 ++-- sui-agent/src/utils/index.ts | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/sui-agent/src/agents/SuiAgent.ts b/sui-agent/src/agents/SuiAgent.ts index 1430a30..e48ab50 100644 --- a/sui-agent/src/agents/SuiAgent.ts +++ b/sui-agent/src/agents/SuiAgent.ts @@ -1,5 +1,5 @@ import { IntentAgentResponse } from '../../@types/interface'; -import Tools from '../aftermath'; +import Tools from '../tools/aftermath'; import { registerAllTools } from './ToolRegistry'; import Utils from '../utils'; diff --git a/sui-agent/src/agents/ToolRegistry.ts b/sui-agent/src/agents/ToolRegistry.ts index c8e363a..e27e4af 100644 --- a/sui-agent/src/agents/ToolRegistry.ts +++ b/sui-agent/src/agents/ToolRegistry.ts @@ -1,20 +1,20 @@ -import Tools from '../aftermath/index'; -import { getCoinPrice, coinsToPrice } from '../aftermath/PriceTool'; -import { getTokenAPR } from '../aftermath/apr'; +import Tools from '../tools/aftermath'; +import { getCoinPrice, coinsToPrice } from '../tools/aftermath/PriceTool'; +import { getTokenAPR } from '../tools/aftermath/apr'; import { getPool, getAllPools, getPoolEvents, getRankedPools, getFilteredPools, -} from '../aftermath/PoolTool'; +} from '../tools/aftermath/PoolTool'; import { getPoolSpotPrice, getTradeAmountOut, getTradeRoute, getDepositTransaction, getWithdrawTransaction, -} from '../aftermath/TradeTool'; +} from '../tools/aftermath/TradeTool'; import { buildTransferTx, buildMultiTransferTx, @@ -26,7 +26,7 @@ import { import { depositIntoTopPools, buildMultiPoolWithdrawTx, -} from '../aftermath/PoolTransactionTool'; +} from '../tools/aftermath/PoolTransactionTool'; import { TokenBalance } from '../../@types/interface'; import { TransactionBlock } from '@mysten/sui.js/transactions'; import { @@ -34,7 +34,7 @@ import { getSuiTvl, getAfSuiExchangeRate, getStakeTransaction, -} from '../aftermath/staking'; +} from '../tools/aftermath/staking'; /* format for tool registry is: diff --git a/sui-agent/src/tools/aftermath/PoolTool.ts b/sui-agent/src/tools/aftermath/PoolTool.ts index 2cd94b1..bea35fb 100644 --- a/sui-agent/src/tools/aftermath/PoolTool.ts +++ b/sui-agent/src/tools/aftermath/PoolTool.ts @@ -1,6 +1,6 @@ import { Aftermath } from 'aftermath-ts-sdk'; -import { PoolInfo } from '../../@types/interface'; -import { handleError } from '../utils'; +import { PoolInfo } from '../../../@types/interface'; +import { handleError } from '../../utils'; // Initialize Aftermath SDK for mainnet const af = new Aftermath('MAINNET'); diff --git a/sui-agent/src/tools/aftermath/PoolTransactionTool.ts b/sui-agent/src/tools/aftermath/PoolTransactionTool.ts index c452e68..d1e3a61 100644 --- a/sui-agent/src/tools/aftermath/PoolTransactionTool.ts +++ b/sui-agent/src/tools/aftermath/PoolTransactionTool.ts @@ -1,8 +1,8 @@ import { Aftermath } from 'aftermath-ts-sdk'; import { TransactionBlock } from '@mysten/sui.js/transactions'; import { SuiClient } from '@mysten/sui.js/client'; -import { handleError } from '../utils'; -import { initSuiClient } from '../transactions/TransactionTool'; +import { handleError } from '../../utils'; +import { initSuiClient } from '../../transactions/TransactionTool'; import { getRankedPools } from './PoolTool'; // Initialize Aftermath SDK for mainnet diff --git a/sui-agent/src/tools/aftermath/PriceTool.ts b/sui-agent/src/tools/aftermath/PriceTool.ts index 8515956..a5af400 100644 --- a/sui-agent/src/tools/aftermath/PriceTool.ts +++ b/sui-agent/src/tools/aftermath/PriceTool.ts @@ -1,7 +1,7 @@ import { Aftermath } from 'aftermath-ts-sdk'; import axios from 'axios'; -import { COIN_ADDRESSES, COIN_SYNONYMS } from '../../@types/interface'; -import { handleError } from '../utils'; +import { COIN_ADDRESSES, COIN_SYNONYMS } from '../../../@types/interface'; +import { handleError } from '../../utils'; const af = new Aftermath('MAINNET'); const prices = af.Prices(); diff --git a/sui-agent/src/tools/aftermath/TradeTool.ts b/sui-agent/src/tools/aftermath/TradeTool.ts index 7c0b721..d1398c8 100644 --- a/sui-agent/src/tools/aftermath/TradeTool.ts +++ b/sui-agent/src/tools/aftermath/TradeTool.ts @@ -1,5 +1,5 @@ import { Aftermath } from 'aftermath-ts-sdk'; -import { handleError } from '../utils'; +import { handleError } from '../../utils'; // Initialize Aftermath SDK for mainnet const af = new Aftermath('MAINNET'); diff --git a/sui-agent/src/tools/aftermath/apr.ts b/sui-agent/src/tools/aftermath/apr.ts index ae0473d..52bbe32 100644 --- a/sui-agent/src/tools/aftermath/apr.ts +++ b/sui-agent/src/tools/aftermath/apr.ts @@ -1,5 +1,5 @@ import { Aftermath } from 'aftermath-ts-sdk'; -import { handleError } from '../utils'; +import { handleError } from '../../utils'; /** * Singleton class for managing Aftermath SDK interactions for APR calculations. diff --git a/sui-agent/src/tools/aftermath/index.ts b/sui-agent/src/tools/aftermath/index.ts index 46a7e59..12a540f 100644 --- a/sui-agent/src/tools/aftermath/index.ts +++ b/sui-agent/src/tools/aftermath/index.ts @@ -1,7 +1,7 @@ -import intent_agent_prompt from '../prompts/intent_agent_prompt'; +import intent_agent_prompt from '../../prompts/intent_agent_prompt'; -import { Tool, ToolParameter, toolResponse } from '../../@types/interface'; -import { atomaChat } from '../config/atoma'; +import { Tool, ToolParameter, toolResponse } from '../../../@types/interface'; +import { atomaChat } from '../../config/atoma'; /** * Main tools management class diff --git a/sui-agent/src/tools/aftermath/staking.ts b/sui-agent/src/tools/aftermath/staking.ts index 0b98925..c40eaca 100644 --- a/sui-agent/src/tools/aftermath/staking.ts +++ b/sui-agent/src/tools/aftermath/staking.ts @@ -1,7 +1,7 @@ import { Aftermath } from 'aftermath-ts-sdk'; import { SuiClient, SuiHTTPTransport } from '@mysten/sui.js/client'; -import { handleError } from '../utils'; -import { NETWORK_CONFIG } from '../../@types/interface'; +import { handleError } from '../../utils'; +import { NETWORK_CONFIG } from '../../../@types/interface'; // Initialize Sui client const suiClient = new SuiClient({ diff --git a/sui-agent/src/utils/index.ts b/sui-agent/src/utils/index.ts index aca0b78..a171eee 100644 --- a/sui-agent/src/utils/index.ts +++ b/sui-agent/src/utils/index.ts @@ -1,6 +1,6 @@ import final_answer_agent_prompt from '../prompts/final_answer_agent'; import { atomaChat } from '../config/atoma'; -import Tools from '../aftermath'; +import Tools from '../tools/aftermath'; import { IntentAgentResponse } from '../../@types/interface'; import { randomUUID } from 'crypto'; From b17517f004e015e2b87a84824018655e3666af3d Mon Sep 17 00:00:00 2001 From: Jorge Antonio Date: Fri, 24 Jan 2025 10:22:40 +0000 Subject: [PATCH 3/6] move tool wrappers to utils folder --- README.md | 4 +- sui-agent/README.md | 2 +- sui-agent/src/agents/ToolRegistry.ts | 194 ++------------------------- sui-agent/src/utils/toolWrappers.ts | 182 +++++++++++++++++++++++++ 4 files changed, 196 insertions(+), 186 deletions(-) create mode 100644 sui-agent/src/utils/toolWrappers.ts diff --git a/README.md b/README.md index 3154940..80b95c1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Atoma Agents +# Atoma Sage -Built on the Sui blockchain and powered by Atoma Network's AI Infrastructure, Atoma agents are sets of extensible Intelligent Layer system for blockchain operations. This project aims to provide a comprehensive solution for interacting with various blockchain protocols through natural language processing. +Built on the Sui blockchain and powered by Atoma Network's AI Infrastructure, AtomaSage are sets of extensible Intelligent Layer system for blockchain operations. This project aims to provide a comprehensive solution for interacting with various blockchain protocols through natural language processing. ## Vision diff --git a/sui-agent/README.md b/sui-agent/README.md index 1d6d6f1..346dd93 100644 --- a/sui-agent/README.md +++ b/sui-agent/README.md @@ -1,4 +1,4 @@ -# Sui Agent +# Atoma Sage A specialized AI agent for interacting with the Sui blockchain and its protocols, with current support for Aftermath Finance operations. diff --git a/sui-agent/src/agents/ToolRegistry.ts b/sui-agent/src/agents/ToolRegistry.ts index e27e4af..ef2cdfe 100644 --- a/sui-agent/src/agents/ToolRegistry.ts +++ b/sui-agent/src/agents/ToolRegistry.ts @@ -16,195 +16,23 @@ import { getWithdrawTransaction, } from '../tools/aftermath/TradeTool'; import { - buildTransferTx, - buildMultiTransferTx, - estimateGas, - createMergeCoinsTx, - TransactionAgent, - initSuiClient, -} from '../transactions/TransactionTool'; -import { - depositIntoTopPools, - buildMultiPoolWithdrawTx, -} from '../tools/aftermath/PoolTransactionTool'; -import { TokenBalance } from '../../@types/interface'; -import { TransactionBlock } from '@mysten/sui.js/transactions'; -import { - getStakingPositions, - getSuiTvl, - getAfSuiExchangeRate, - getStakeTransaction, -} from '../tools/aftermath/staking'; + transferCoinWrapper, + multiTransferWrapper, + mergeCoinsWrapper, + estimateGasWrapper, + depositTopPoolsWrapper, + withdrawPoolsWrapper, + getStakingPositionsWrapper, + getSuiTvlWrapper, + getAfSuiExchangeRateWrapper, + getStakeTransactionWrapper, +} from '../utils/tool_wrappers'; /* format for tool registry is: tool name, tool description, tool arguments, process(function) */ -// Transaction wrapper functions -async function transferCoinWrapper( - fromAddress: string, - toAddress: string, - tokenType: string, - amount: string, -): Promise { - const client = initSuiClient(); - const tx = await buildTransferTx( - client, - fromAddress, - toAddress, - tokenType, - BigInt(amount), - ); - return JSON.stringify([ - { - reasoning: 'Transfer transaction created successfully', - response: tx.serialize(), - status: 'success', - query: `Transfer ${amount} of ${tokenType} from ${fromAddress} to ${toAddress}`, - errors: [], - }, - ]); -} - -async function multiTransferWrapper( - fromAddress: string, - toAddress: string, - transfers: TokenBalance[], -): Promise { - const client = initSuiClient(); - const tx = await buildMultiTransferTx( - client, - fromAddress, - toAddress, - transfers, - ); - return JSON.stringify([ - { - reasoning: 'Multi-transfer transaction created successfully', - response: tx.serialize(), - status: 'success', - query: `Multi-transfer from ${fromAddress} to ${toAddress}`, - errors: [], - }, - ]); -} - -async function mergeCoinsWrapper( - coinType: string, - walletAddress: string, - maxCoins?: number, -): Promise { - const client = initSuiClient(); - const tx = await createMergeCoinsTx( - client, - coinType, - walletAddress, - maxCoins, - ); - return JSON.stringify([ - { - reasoning: 'Merge coins transaction created successfully', - response: tx.serialize(), - status: 'success', - query: `Merge ${ - maxCoins || 'all' - } coins of type ${coinType} for wallet ${walletAddress}`, - errors: [], - }, - ]); -} - -async function estimateGasWrapper( - transaction: TransactionBlock, -): Promise { - const client = initSuiClient(); - const gasEstimate = await estimateGas(client, transaction); - return JSON.stringify([ - { - reasoning: 'Gas estimation completed successfully', - response: gasEstimate.toString(), - status: 'success', - query: 'Estimate gas for transaction', - errors: [], - }, - ]); -} - -// Pool transaction wrapper functions -async function depositTopPoolsWrapper( - walletAddress: string, - metric: string, - amount: string, - numPools: string, - slippage: string, -): Promise { - return depositIntoTopPools( - walletAddress, - metric as 'apr' | 'tvl' | 'fees' | 'volume', - BigInt(amount), - parseInt(numPools), - parseFloat(slippage), - ); -} - -async function withdrawPoolsWrapper( - walletAddress: string, - poolId: string, - lpAmount: string, - slippage: string, -): Promise { - const client = initSuiClient(); - const tx = await buildMultiPoolWithdrawTx( - client, - walletAddress, - [{ poolId, lpAmount: BigInt(lpAmount) }], - parseFloat(slippage), - ); - return JSON.stringify([ - { - reasoning: 'Successfully created withdrawal transaction', - response: JSON.stringify( - { - transaction: tx.serialize(), - }, - null, - 2, - ), - status: 'success', - query: `Created withdrawal transaction for ${lpAmount} LP tokens from pool ${poolId}`, - errors: [], - }, - ]); -} - -// Staking wrapper functions -async function getStakingPositionsWrapper( - walletAddress: string, -): Promise { - return getStakingPositions(walletAddress); -} - -async function getSuiTvlWrapper(): Promise { - return getSuiTvl(); -} - -async function getAfSuiExchangeRateWrapper(): Promise { - return getAfSuiExchangeRate(); -} - -async function getStakeTransactionWrapper( - walletAddress: string, - suiAmount: string, - validatorAddress: string, -): Promise { - return getStakeTransaction( - walletAddress, - BigInt(suiAmount), - validatorAddress, - ); -} - export function registerAllTools(tools: Tools) { // Price Tools tools.registerTool( diff --git a/sui-agent/src/utils/toolWrappers.ts b/sui-agent/src/utils/toolWrappers.ts new file mode 100644 index 0000000..7066b39 --- /dev/null +++ b/sui-agent/src/utils/toolWrappers.ts @@ -0,0 +1,182 @@ +import { TokenBalance } from "../../@types/interface"; +import { depositIntoTopPools, buildMultiPoolWithdrawTx } from "../tools/aftermath/PoolTransactionTool"; +import { getStakingPositions, getSuiTvl, getAfSuiExchangeRate, getStakeTransaction } from "../tools/aftermath/staking"; +import { initSuiClient, buildTransferTx, buildMultiTransferTx, createMergeCoinsTx, estimateGas } from "../transactions/TransactionTool"; +import { TransactionBlock } from "@mysten/sui.js/transactions"; + +// Transaction wrapper functions +async function transferCoinWrapper( + fromAddress: string, + toAddress: string, + tokenType: string, + amount: string, + ): Promise { + const client = initSuiClient(); + const tx = await buildTransferTx( + client, + fromAddress, + toAddress, + tokenType, + BigInt(amount), + ); + return JSON.stringify([ + { + reasoning: 'Transfer transaction created successfully', + response: tx.serialize(), + status: 'success', + query: `Transfer ${amount} of ${tokenType} from ${fromAddress} to ${toAddress}`, + errors: [], + }, + ]); + } + + async function multiTransferWrapper( + fromAddress: string, + toAddress: string, + transfers: TokenBalance[], + ): Promise { + const client = initSuiClient(); + const tx = await buildMultiTransferTx( + client, + fromAddress, + toAddress, + transfers, + ); + return JSON.stringify([ + { + reasoning: 'Multi-transfer transaction created successfully', + response: tx.serialize(), + status: 'success', + query: `Multi-transfer from ${fromAddress} to ${toAddress}`, + errors: [], + }, + ]); + } + + async function mergeCoinsWrapper( + coinType: string, + walletAddress: string, + maxCoins?: number, + ): Promise { + const client = initSuiClient(); + const tx = await createMergeCoinsTx( + client, + coinType, + walletAddress, + maxCoins, + ); + return JSON.stringify([ + { + reasoning: 'Merge coins transaction created successfully', + response: tx.serialize(), + status: 'success', + query: `Merge ${ + maxCoins || 'all' + } coins of type ${coinType} for wallet ${walletAddress}`, + errors: [], + }, + ]); + } + + async function estimateGasWrapper( + transaction: TransactionBlock, + ): Promise { + const client = initSuiClient(); + const gasEstimate = await estimateGas(client, transaction); + return JSON.stringify([ + { + reasoning: 'Gas estimation completed successfully', + response: gasEstimate.toString(), + status: 'success', + query: 'Estimate gas for transaction', + errors: [], + }, + ]); + } + + // Pool transaction wrapper functions + async function depositTopPoolsWrapper( + walletAddress: string, + metric: string, + amount: string, + numPools: string, + slippage: string, + ): Promise { + return depositIntoTopPools( + walletAddress, + metric as 'apr' | 'tvl' | 'fees' | 'volume', + BigInt(amount), + parseInt(numPools), + parseFloat(slippage), + ); + } + + async function withdrawPoolsWrapper( + walletAddress: string, + poolId: string, + lpAmount: string, + slippage: string, + ): Promise { + const client = initSuiClient(); + const tx = await buildMultiPoolWithdrawTx( + client, + walletAddress, + [{ poolId, lpAmount: BigInt(lpAmount) }], + parseFloat(slippage), + ); + return JSON.stringify([ + { + reasoning: 'Successfully created withdrawal transaction', + response: JSON.stringify( + { + transaction: tx.serialize(), + }, + null, + 2, + ), + status: 'success', + query: `Created withdrawal transaction for ${lpAmount} LP tokens from pool ${poolId}`, + errors: [], + }, + ]); + } + + // Staking wrapper functions + async function getStakingPositionsWrapper( + walletAddress: string, + ): Promise { + return getStakingPositions(walletAddress); + } + + async function getSuiTvlWrapper(): Promise { + return getSuiTvl(); + } + + async function getAfSuiExchangeRateWrapper(): Promise { + return getAfSuiExchangeRate(); + } + + async function getStakeTransactionWrapper( + walletAddress: string, + suiAmount: string, + validatorAddress: string, + ): Promise { + return getStakeTransaction( + walletAddress, + BigInt(suiAmount), + validatorAddress, + ); + } + +export { + transferCoinWrapper, + multiTransferWrapper, + mergeCoinsWrapper, + estimateGasWrapper, + depositTopPoolsWrapper, + withdrawPoolsWrapper, + getStakingPositionsWrapper, + getSuiTvlWrapper, + getAfSuiExchangeRateWrapper, + getStakeTransactionWrapper, +} \ No newline at end of file From 1a3c45540126708ff495aa84eceb446778f8ebf9 Mon Sep 17 00:00:00 2001 From: Jorge Antonio Date: Fri, 24 Jan 2025 10:26:26 +0000 Subject: [PATCH 4/6] fmt --- sui-agent/src/agents/ToolRegistry.ts | 2 +- sui-agent/src/utils/toolWrappers.ts | 370 ++++++++++++++------------- 2 files changed, 193 insertions(+), 179 deletions(-) diff --git a/sui-agent/src/agents/ToolRegistry.ts b/sui-agent/src/agents/ToolRegistry.ts index ef2cdfe..fe6649f 100644 --- a/sui-agent/src/agents/ToolRegistry.ts +++ b/sui-agent/src/agents/ToolRegistry.ts @@ -26,7 +26,7 @@ import { getSuiTvlWrapper, getAfSuiExchangeRateWrapper, getStakeTransactionWrapper, -} from '../utils/tool_wrappers'; +} from '../utils/toolWrappers'; /* format for tool registry is: diff --git a/sui-agent/src/utils/toolWrappers.ts b/sui-agent/src/utils/toolWrappers.ts index 7066b39..7f8fa1b 100644 --- a/sui-agent/src/utils/toolWrappers.ts +++ b/sui-agent/src/utils/toolWrappers.ts @@ -1,182 +1,196 @@ -import { TokenBalance } from "../../@types/interface"; -import { depositIntoTopPools, buildMultiPoolWithdrawTx } from "../tools/aftermath/PoolTransactionTool"; -import { getStakingPositions, getSuiTvl, getAfSuiExchangeRate, getStakeTransaction } from "../tools/aftermath/staking"; -import { initSuiClient, buildTransferTx, buildMultiTransferTx, createMergeCoinsTx, estimateGas } from "../transactions/TransactionTool"; -import { TransactionBlock } from "@mysten/sui.js/transactions"; +import { TokenBalance } from '../../@types/interface'; +import { + depositIntoTopPools, + buildMultiPoolWithdrawTx, +} from '../tools/aftermath/PoolTransactionTool'; +import { + getStakingPositions, + getSuiTvl, + getAfSuiExchangeRate, + getStakeTransaction, +} from '../tools/aftermath/staking'; +import { + initSuiClient, + buildTransferTx, + buildMultiTransferTx, + createMergeCoinsTx, + estimateGas, +} from '../transactions/TransactionTool'; +import { TransactionBlock } from '@mysten/sui.js/transactions'; // Transaction wrapper functions async function transferCoinWrapper( - fromAddress: string, - toAddress: string, - tokenType: string, - amount: string, - ): Promise { - const client = initSuiClient(); - const tx = await buildTransferTx( - client, - fromAddress, - toAddress, - tokenType, - BigInt(amount), - ); - return JSON.stringify([ - { - reasoning: 'Transfer transaction created successfully', - response: tx.serialize(), - status: 'success', - query: `Transfer ${amount} of ${tokenType} from ${fromAddress} to ${toAddress}`, - errors: [], - }, - ]); - } - - async function multiTransferWrapper( - fromAddress: string, - toAddress: string, - transfers: TokenBalance[], - ): Promise { - const client = initSuiClient(); - const tx = await buildMultiTransferTx( - client, - fromAddress, - toAddress, - transfers, - ); - return JSON.stringify([ - { - reasoning: 'Multi-transfer transaction created successfully', - response: tx.serialize(), - status: 'success', - query: `Multi-transfer from ${fromAddress} to ${toAddress}`, - errors: [], - }, - ]); - } - - async function mergeCoinsWrapper( - coinType: string, - walletAddress: string, - maxCoins?: number, - ): Promise { - const client = initSuiClient(); - const tx = await createMergeCoinsTx( - client, - coinType, - walletAddress, - maxCoins, - ); - return JSON.stringify([ - { - reasoning: 'Merge coins transaction created successfully', - response: tx.serialize(), - status: 'success', - query: `Merge ${ - maxCoins || 'all' - } coins of type ${coinType} for wallet ${walletAddress}`, - errors: [], - }, - ]); - } - - async function estimateGasWrapper( - transaction: TransactionBlock, - ): Promise { - const client = initSuiClient(); - const gasEstimate = await estimateGas(client, transaction); - return JSON.stringify([ - { - reasoning: 'Gas estimation completed successfully', - response: gasEstimate.toString(), - status: 'success', - query: 'Estimate gas for transaction', - errors: [], - }, - ]); - } - - // Pool transaction wrapper functions - async function depositTopPoolsWrapper( - walletAddress: string, - metric: string, - amount: string, - numPools: string, - slippage: string, - ): Promise { - return depositIntoTopPools( - walletAddress, - metric as 'apr' | 'tvl' | 'fees' | 'volume', - BigInt(amount), - parseInt(numPools), - parseFloat(slippage), - ); - } - - async function withdrawPoolsWrapper( - walletAddress: string, - poolId: string, - lpAmount: string, - slippage: string, - ): Promise { - const client = initSuiClient(); - const tx = await buildMultiPoolWithdrawTx( - client, - walletAddress, - [{ poolId, lpAmount: BigInt(lpAmount) }], - parseFloat(slippage), - ); - return JSON.stringify([ - { - reasoning: 'Successfully created withdrawal transaction', - response: JSON.stringify( - { - transaction: tx.serialize(), - }, - null, - 2, - ), - status: 'success', - query: `Created withdrawal transaction for ${lpAmount} LP tokens from pool ${poolId}`, - errors: [], - }, - ]); - } - - // Staking wrapper functions - async function getStakingPositionsWrapper( - walletAddress: string, - ): Promise { - return getStakingPositions(walletAddress); - } - - async function getSuiTvlWrapper(): Promise { - return getSuiTvl(); - } - - async function getAfSuiExchangeRateWrapper(): Promise { - return getAfSuiExchangeRate(); - } - - async function getStakeTransactionWrapper( - walletAddress: string, - suiAmount: string, - validatorAddress: string, - ): Promise { - return getStakeTransaction( - walletAddress, - BigInt(suiAmount), - validatorAddress, - ); - } - + fromAddress: string, + toAddress: string, + tokenType: string, + amount: string, +): Promise { + const client = initSuiClient(); + const tx = await buildTransferTx( + client, + fromAddress, + toAddress, + tokenType, + BigInt(amount), + ); + return JSON.stringify([ + { + reasoning: 'Transfer transaction created successfully', + response: tx.serialize(), + status: 'success', + query: `Transfer ${amount} of ${tokenType} from ${fromAddress} to ${toAddress}`, + errors: [], + }, + ]); +} + +async function multiTransferWrapper( + fromAddress: string, + toAddress: string, + transfers: TokenBalance[], +): Promise { + const client = initSuiClient(); + const tx = await buildMultiTransferTx( + client, + fromAddress, + toAddress, + transfers, + ); + return JSON.stringify([ + { + reasoning: 'Multi-transfer transaction created successfully', + response: tx.serialize(), + status: 'success', + query: `Multi-transfer from ${fromAddress} to ${toAddress}`, + errors: [], + }, + ]); +} + +async function mergeCoinsWrapper( + coinType: string, + walletAddress: string, + maxCoins?: number, +): Promise { + const client = initSuiClient(); + const tx = await createMergeCoinsTx( + client, + coinType, + walletAddress, + maxCoins, + ); + return JSON.stringify([ + { + reasoning: 'Merge coins transaction created successfully', + response: tx.serialize(), + status: 'success', + query: `Merge ${ + maxCoins || 'all' + } coins of type ${coinType} for wallet ${walletAddress}`, + errors: [], + }, + ]); +} + +async function estimateGasWrapper( + transaction: TransactionBlock, +): Promise { + const client = initSuiClient(); + const gasEstimate = await estimateGas(client, transaction); + return JSON.stringify([ + { + reasoning: 'Gas estimation completed successfully', + response: gasEstimate.toString(), + status: 'success', + query: 'Estimate gas for transaction', + errors: [], + }, + ]); +} + +// Pool transaction wrapper functions +async function depositTopPoolsWrapper( + walletAddress: string, + metric: string, + amount: string, + numPools: string, + slippage: string, +): Promise { + return depositIntoTopPools( + walletAddress, + metric as 'apr' | 'tvl' | 'fees' | 'volume', + BigInt(amount), + parseInt(numPools), + parseFloat(slippage), + ); +} + +async function withdrawPoolsWrapper( + walletAddress: string, + poolId: string, + lpAmount: string, + slippage: string, +): Promise { + const client = initSuiClient(); + const tx = await buildMultiPoolWithdrawTx( + client, + walletAddress, + [{ poolId, lpAmount: BigInt(lpAmount) }], + parseFloat(slippage), + ); + return JSON.stringify([ + { + reasoning: 'Successfully created withdrawal transaction', + response: JSON.stringify( + { + transaction: tx.serialize(), + }, + null, + 2, + ), + status: 'success', + query: `Created withdrawal transaction for ${lpAmount} LP tokens from pool ${poolId}`, + errors: [], + }, + ]); +} + +// Staking wrapper functions +async function getStakingPositionsWrapper( + walletAddress: string, +): Promise { + return getStakingPositions(walletAddress); +} + +async function getSuiTvlWrapper(): Promise { + return getSuiTvl(); +} + +async function getAfSuiExchangeRateWrapper(): Promise { + return getAfSuiExchangeRate(); +} + +async function getStakeTransactionWrapper( + walletAddress: string, + suiAmount: string, + validatorAddress: string, +): Promise { + return getStakeTransaction( + walletAddress, + BigInt(suiAmount), + validatorAddress, + ); +} + export { - transferCoinWrapper, - multiTransferWrapper, - mergeCoinsWrapper, - estimateGasWrapper, - depositTopPoolsWrapper, - withdrawPoolsWrapper, - getStakingPositionsWrapper, - getSuiTvlWrapper, - getAfSuiExchangeRateWrapper, - getStakeTransactionWrapper, -} \ No newline at end of file + transferCoinWrapper, + multiTransferWrapper, + mergeCoinsWrapper, + estimateGasWrapper, + depositTopPoolsWrapper, + withdrawPoolsWrapper, + getStakingPositionsWrapper, + getSuiTvlWrapper, + getAfSuiExchangeRateWrapper, + getStakeTransactionWrapper, +}; From db223ee74bbd56af68344ee5de6264fc09b16c72 Mon Sep 17 00:00:00 2001 From: Jorge Antonio Date: Sat, 25 Jan 2025 17:23:24 +0000 Subject: [PATCH 5/6] add multiple wrapper for suilend tools --- sui-agent/package-lock.json | 1145 ++++++++++++++++- sui-agent/package.json | 6 +- sui-agent/src/agents/ToolRegistry.ts | 196 +++ sui-agent/src/tools/suilend/borrowRepay.ts | 113 ++ .../src/tools/suilend/depositWithdraw.ts | 215 ++++ sui-agent/src/tools/suilend/index.ts | 96 ++ .../src/tools/suilend/marketManagement.ts | 288 +++++ .../src/tools/suilend/rewardManagement.ts | 297 +++++ 8 files changed, 2326 insertions(+), 30 deletions(-) create mode 100644 sui-agent/src/tools/suilend/borrowRepay.ts create mode 100644 sui-agent/src/tools/suilend/depositWithdraw.ts create mode 100644 sui-agent/src/tools/suilend/index.ts create mode 100644 sui-agent/src/tools/suilend/marketManagement.ts create mode 100644 sui-agent/src/tools/suilend/rewardManagement.ts diff --git a/sui-agent/package-lock.json b/sui-agent/package-lock.json index 1b8dbe2..adbb6ef 100644 --- a/sui-agent/package-lock.json +++ b/sui-agent/package-lock.json @@ -9,6 +9,8 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@mysten/sui": "^1.21.0", + "@suilend/sdk": "^1.1.36", "aftermath-ts-sdk": "^1.2.49", "atoma-sdk": "github:atoma-network/atoma-sdk-typescript", "axios": "^1.7.9", @@ -34,7 +36,6 @@ "resolved": "https://registry.npmjs.org/@0no-co/graphql.web/-/graphql.web-1.0.13.tgz", "integrity": "sha512-jqYxOevheVTU1S36ZdzAkJIdvRp2m3OYIG5SEoKDw5NI8eVwkoI0D/Q3DYNGmXCxkA6CQuoa7zvMiDPTLqUNuw==", "license": "MIT", - "peer": true, "peerDependencies": { "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0" }, @@ -49,7 +50,6 @@ "resolved": "https://registry.npmjs.org/@0no-co/graphqlsp/-/graphqlsp-1.12.16.tgz", "integrity": "sha512-B5pyYVH93Etv7xjT6IfB7QtMBdaaC07yjbhN6v8H7KgFStMkPvi+oWYBTibMFRMY89qwc9H8YixXg8SXDVgYWw==", "license": "MIT", - "peer": true, "dependencies": { "@gql.tada/internal": "^1.0.0", "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0" @@ -83,6 +83,23 @@ "node": ">=12" } }, + "node_modules/@emnapi/runtime": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz", + "integrity": "sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD", + "optional": true + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", @@ -151,7 +168,6 @@ "resolved": "https://registry.npmjs.org/@gql.tada/cli-utils/-/cli-utils-1.6.3.tgz", "integrity": "sha512-jFFSY8OxYeBxdKi58UzeMXG1tdm4FVjXa8WHIi66Gzu9JWtCE6mqom3a8xkmSw+mVaybFW5EN2WXf1WztJVNyQ==", "license": "MIT", - "peer": true, "dependencies": { "@0no-co/graphqlsp": "^1.12.13", "@gql.tada/internal": "1.0.8", @@ -178,7 +194,6 @@ "resolved": "https://registry.npmjs.org/@gql.tada/internal/-/internal-1.0.8.tgz", "integrity": "sha512-XYdxJhtHC5WtZfdDqtKjcQ4d7R1s0d1rnlSs3OcBEUbYiPoJJfZU7tWsVXuv047Z6msvmr4ompJ7eLSK5Km57g==", "license": "MIT", - "peer": true, "dependencies": { "@0no-co/graphql.web": "^1.0.5" }, @@ -192,7 +207,6 @@ "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz", "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==", "license": "MIT", - "peer": true, "peerDependencies": { "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } @@ -235,6 +249,367 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", + "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", + "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", + "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", + "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", + "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", + "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", + "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", + "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", + "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", + "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", + "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.5" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", + "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", + "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", + "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", + "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", + "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", + "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.2.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", + "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", + "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", @@ -265,17 +640,15 @@ "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-1.2.1.tgz", "integrity": "sha512-RMSaUsNb8oR0rTRVIOOcyoEVJqQi6DLvMXN+7mvDcki12FJFQ0lF89zQa7AV7cIurWlDQfJ8VIbCuRDyK+955A==", "license": "Apache-2.0", - "peer": true, "dependencies": { "bs58": "^6.0.0" } }, "node_modules/@mysten/sui": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/@mysten/sui/-/sui-1.20.0.tgz", - "integrity": "sha512-/XLogwOYaSP31lPt377fj5b+8sRIyt2Opi/Ssos5dssPqol9vgvN/ZzV5Y5qVl4VquhATJHRpwV33B5rIVi7Ow==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@mysten/sui/-/sui-1.21.0.tgz", + "integrity": "sha512-A+UXOo2ODhmktV6J6lOIqelRtVvQ0V252T2qaoJ0E92HYjIi3xMNEQrqu4K8TcN3gZCjqK8jQZwmbYZku8rIpw==", "license": "Apache-2.0", - "peer": true, "dependencies": { "@graphql-typed-document-node/core": "^3.2.0", "@mysten/bcs": "1.2.1", @@ -283,7 +656,6 @@ "@noble/hashes": "^1.4.0", "@scure/bip32": "^1.4.0", "@scure/bip39": "^1.3.0", - "@simplewebauthn/typescript-types": "^7.4.0", "@suchipi/femver": "^1.0.0", "bech32": "^2.0.0", "gql.tada": "^1.8.2", @@ -348,6 +720,140 @@ "base-x": "^4.0.0" } }, + "node_modules/@next/env": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.1.6.tgz", + "integrity": "sha512-d9AFQVPEYNr+aqokIiPLNK/MTyt3DWa/dpKveiAaVccUadFbhFEvY6FXYX2LJO2Hv7PHnLBu2oWwB4uBuHjr/w==", + "license": "MIT" + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.6.tgz", + "integrity": "sha512-u7lg4Mpl9qWpKgy6NzEkz/w0/keEHtOybmIl0ykgItBxEM5mYotS5PmqTpo+Rhg8FiOiWgwr8USxmKQkqLBCrw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.6.tgz", + "integrity": "sha512-x1jGpbHbZoZ69nRuogGL2MYPLqohlhnT9OCU6E6QFewwup+z+M6r8oU47BTeJcWsF2sdBahp5cKiAcDbwwK/lg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.6.tgz", + "integrity": "sha512-jar9sFw0XewXsBzPf9runGzoivajeWJUc/JkfbLTC4it9EhU8v7tCRLH7l5Y1ReTMN6zKJO0kKAGqDk8YSO2bg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.6.tgz", + "integrity": "sha512-+n3u//bfsrIaZch4cgOJ3tXCTbSxz0s6brJtU3SzLOvkJlPQMJ+eHVRi6qM2kKKKLuMY+tcau8XD9CJ1OjeSQQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.6.tgz", + "integrity": "sha512-SpuDEXixM3PycniL4iVCLyUyvcl6Lt0mtv3am08sucskpG0tYkW1KlRhTgj4LI5ehyxriVVcfdoxuuP8csi3kQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.6.tgz", + "integrity": "sha512-L4druWmdFSZIIRhF+G60API5sFB7suTbDRhYWSjiw0RbE+15igQvE2g2+S973pMGvwN3guw7cJUjA/TmbPWTHQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.6.tgz", + "integrity": "sha512-s8w6EeqNmi6gdvM19tqKKWbCyOBvXFbndkGHl+c9YrzsLARRdCHsD9S1fMj8gsXm9v8vhC8s3N8rjuC/XrtkEg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.6.tgz", + "integrity": "sha512-6xomMuu54FAFxttYr5PJbEfu96godcxBTRk1OhAvJq0/EnmFU/Ybiax30Snis4vdWZ9LGpf7Roy5fSs7v/5ROQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@noble/curves": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.1.tgz", @@ -537,6 +1043,12 @@ "base-x": "^4.0.0" } }, + "node_modules/@rrweb/types": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/@rrweb/types/-/types-2.0.0-alpha.18.tgz", + "integrity": "sha512-iMH3amHthJZ9x3gGmBPmdfim7wLGygC2GciIkw2A6SO8giSn8PHYtRT8OKNH4V+k3SZ6RSnYHcTQxBA7pSWZ3Q==", + "license": "MIT" + }, "node_modules/@scure/base": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.4.tgz", @@ -578,14 +1090,138 @@ "resolved": "https://registry.npmjs.org/@simplewebauthn/typescript-types/-/typescript-types-7.4.0.tgz", "integrity": "sha512-8/ZjHeUPe210Bt5oyaOIGx4h8lHdsQs19BiOT44gi/jBEgK7uBGA0Fy7NRsyh777al3m6WM0mBf0UR7xd4R7WQ==", "deprecated": "This package has been renamed to @simplewebauthn/types. Please install @simplewebauthn/types instead to ensure you receive future updates.", + "license": "MIT" + }, + "node_modules/@suchipi/femver": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@suchipi/femver/-/femver-1.0.0.tgz", + "integrity": "sha512-bprE8+K5V+DPX7q2e2K57ImqNBdfGHDIWaGI5xHxZoxbKOuQZn4wzPiUxOAHnsUr3w3xHrWXwN7gnG/iIuEMIg==", + "license": "MIT" + }, + "node_modules/@suilend/frontend-sui": { + "version": "0.2.33", + "resolved": "https://registry.npmjs.org/@suilend/frontend-sui/-/frontend-sui-0.2.33.tgz", + "integrity": "sha512-GjAHWdnKiAW/wc1Oo0WGoa401+rs7rg044SUpjIfBm4QEXfYmHUJTyT9Yn9LODYQgyN4tZ1fP4wGhMTmUZa0aA==", "license": "MIT", - "peer": true + "dependencies": { + "@mysten/sui": "1.20.0", + "@pythnetwork/pyth-sui-js": "^2.1.0", + "bignumber.js": "^9.1.2", + "lodash": "^4.17.21", + "mixpanel-browser": "^2.56.0", + "next": "^15.0.3" + }, + "peerDependencies": { + "date-fns": "^4.1.0" + } + }, + "node_modules/@suilend/frontend-sui/node_modules/@mysten/sui": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/@mysten/sui/-/sui-1.20.0.tgz", + "integrity": "sha512-/XLogwOYaSP31lPt377fj5b+8sRIyt2Opi/Ssos5dssPqol9vgvN/ZzV5Y5qVl4VquhATJHRpwV33B5rIVi7Ow==", + "license": "Apache-2.0", + "dependencies": { + "@graphql-typed-document-node/core": "^3.2.0", + "@mysten/bcs": "1.2.1", + "@noble/curves": "^1.4.2", + "@noble/hashes": "^1.4.0", + "@scure/bip32": "^1.4.0", + "@scure/bip39": "^1.3.0", + "@simplewebauthn/typescript-types": "^7.4.0", + "@suchipi/femver": "^1.0.0", + "bech32": "^2.0.0", + "gql.tada": "^1.8.2", + "graphql": "^16.9.0", + "jose": "^5.6.3", + "poseidon-lite": "^0.2.0", + "valibot": "^0.36.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@suilend/frontend-sui/node_modules/@pythnetwork/pyth-sui-js": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/pyth-sui-js/-/pyth-sui-js-2.1.0.tgz", + "integrity": "sha512-oSfpqtLATTEVaac/YbaRQBvOI7DM+Qds5O0GJjEcky7UQRtz/tlU9tjQ6VRn3vm8IXw8P1mKzJcaTIO134X9Sw==", + "license": "Apache-2.0", + "dependencies": { + "@mysten/sui": "^1.3.0", + "@pythnetwork/price-service-client": "1.9.0", + "buffer": "^6.0.3" + } + }, + "node_modules/@suilend/sdk": { + "version": "1.1.36", + "resolved": "https://registry.npmjs.org/@suilend/sdk/-/sdk-1.1.36.tgz", + "integrity": "sha512-mhofvhfiq+3ImIxQ9cGEIytiTjtp0SrswIHtimBkXGfMU/ZMBSd65dtdDlh4A8+AMayQI4S8SkLniyztHod6uA==", + "license": "MIT", + "dependencies": { + "@mysten/bcs": "1.2.1", + "@mysten/sui": "1.20.0", + "@pythnetwork/pyth-sui-js": "^2.1.0", + "@suilend/frontend-sui": "^0.2.33", + "bignumber.js": "^9.1.2", + "p-limit": "3.1.0", + "uuid": "^11.0.3" + } + }, + "node_modules/@suilend/sdk/node_modules/@mysten/sui": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/@mysten/sui/-/sui-1.20.0.tgz", + "integrity": "sha512-/XLogwOYaSP31lPt377fj5b+8sRIyt2Opi/Ssos5dssPqol9vgvN/ZzV5Y5qVl4VquhATJHRpwV33B5rIVi7Ow==", + "license": "Apache-2.0", + "dependencies": { + "@graphql-typed-document-node/core": "^3.2.0", + "@mysten/bcs": "1.2.1", + "@noble/curves": "^1.4.2", + "@noble/hashes": "^1.4.0", + "@scure/bip32": "^1.4.0", + "@scure/bip39": "^1.3.0", + "@simplewebauthn/typescript-types": "^7.4.0", + "@suchipi/femver": "^1.0.0", + "bech32": "^2.0.0", + "gql.tada": "^1.8.2", + "graphql": "^16.9.0", + "jose": "^5.6.3", + "poseidon-lite": "^0.2.0", + "valibot": "^0.36.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@suilend/sdk/node_modules/@pythnetwork/pyth-sui-js": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/pyth-sui-js/-/pyth-sui-js-2.1.0.tgz", + "integrity": "sha512-oSfpqtLATTEVaac/YbaRQBvOI7DM+Qds5O0GJjEcky7UQRtz/tlU9tjQ6VRn3vm8IXw8P1mKzJcaTIO134X9Sw==", + "license": "Apache-2.0", + "dependencies": { + "@mysten/sui": "^1.3.0", + "@pythnetwork/price-service-client": "1.9.0", + "buffer": "^6.0.3" + } + }, + "node_modules/@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", + "license": "Apache-2.0" }, - "node_modules/@suchipi/femver": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@suchipi/femver/-/femver-1.0.0.tgz", - "integrity": "sha512-bprE8+K5V+DPX7q2e2K57ImqNBdfGHDIWaGI5xHxZoxbKOuQZn4wzPiUxOAHnsUr3w3xHrWXwN7gnG/iIuEMIg==", - "license": "MIT" + "node_modules/@swc/helpers": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@swc/helpers/node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/@tsconfig/node10": { "version": "1.0.11", @@ -649,6 +1285,12 @@ "@types/node": "*" } }, + "node_modules/@types/css-font-loading-module": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.7.tgz", + "integrity": "sha512-nl09VhutdjINdWyXxHWN/w9zlNCfr60JUqJbd24YXUuCwgeL0TpFSdElCwb6cxfB6ybE19Gjj4g0jsgkXxKv1Q==", + "license": "MIT" + }, "node_modules/@types/express": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.0.tgz", @@ -961,6 +1603,12 @@ "dev": true, "license": "ISC" }, + "node_modules/@xstate/fsm": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/@xstate/fsm/-/fsm-1.6.5.tgz", + "integrity": "sha512-b5o1I6aLNeYlU/3CPlj/Z91ybk1gUsKT+5NAJI+2W4UjvS5KLG28K9v5UvNoFVjHV8PajVZ00RH3vnjyQO7ZAw==", + "license": "MIT" + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -1058,6 +1706,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -1160,8 +1809,16 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz", "integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==", + "license": "MIT" + }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", "license": "MIT", - "peer": true + "engines": { + "node": ">= 0.6.0" + } }, "node_modules/base64-js": { "version": "1.5.1", @@ -1187,8 +1844,16 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==", + "license": "MIT" + }, + "node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", "license": "MIT", - "peer": true + "engines": { + "node": "*" + } }, "node_modules/binary-extensions": { "version": "2.3.0", @@ -1287,7 +1952,6 @@ "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz", "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==", "license": "MIT", - "peer": true, "dependencies": { "base-x": "^5.0.0" } @@ -1316,6 +1980,17 @@ "ieee754": "^1.2.1" } }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, "node_modules/bytes": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", @@ -1364,10 +2039,31 @@ "node": ">=6" } }, + "node_modules/caniuse-lite": { + "version": "1.0.30001695", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001695.tgz", + "integrity": "sha512-vHyLade6wTgI2u1ec3WQBxv+2BrTERV28UXQu9LO6lZ9pYeMk34vjXFLOxo1A4UBA8XTL4njRQZdno/yYaSmWw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -1416,10 +2112,31 @@ "node": ">= 6" } }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" + }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "devOptional": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -1432,8 +2149,20 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "devOptional": true, "license": "MIT" }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1531,6 +2260,17 @@ "node": ">= 12" } }, + "node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "license": "MIT", + "peer": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/dayjs": { "version": "1.11.13", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", @@ -1589,6 +2329,16 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/detect-libc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=8" + } + }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -2072,6 +2822,12 @@ "node": "^12.20 || >= 14.13" } }, + "node_modules/fflate": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", + "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==", + "license": "MIT" + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -2237,6 +2993,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, "license": "ISC" }, "node_modules/fsevents": { @@ -2304,6 +3061,7 @@ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -2387,7 +3145,6 @@ "resolved": "https://registry.npmjs.org/gql.tada/-/gql.tada-1.8.10.tgz", "integrity": "sha512-FrvSxgz838FYVPgZHGOSgbpOjhR+yq44rCzww3oOPJYi0OvBJjAgCiP6LEokZIYND2fUTXzQAyLgcvgw1yNP5A==", "license": "MIT", - "peer": true, "dependencies": { "@0no-co/graphql.web": "^1.0.5", "@0no-co/graphqlsp": "^1.12.13", @@ -2414,7 +3171,6 @@ "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.10.0.tgz", "integrity": "sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==", "license": "MIT", - "peer": true, "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } @@ -2423,6 +3179,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2556,6 +3313,7 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -2577,6 +3335,13 @@ "node": ">= 0.10" } }, + "node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "license": "MIT", + "optional": true + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -2645,6 +3410,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, "license": "ISC" }, "node_modules/isomorphic-fetch": { @@ -2691,7 +3457,6 @@ "resolved": "https://registry.npmjs.org/jose/-/jose-5.9.6.tgz", "integrity": "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ==", "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/panva" } @@ -2770,6 +3535,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -2888,6 +3659,21 @@ "node": "*" } }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "license": "MIT" + }, + "node_modules/mixpanel-browser": { + "version": "2.59.0", + "resolved": "https://registry.npmjs.org/mixpanel-browser/-/mixpanel-browser-2.59.0.tgz", + "integrity": "sha512-YYCVLBII2eqC71QoZAZxLMVC0kVJpvOnZ9PBU8X4Ts0MDEZfjE/jzArfg2BTizuJAc+3G5ZzOX3U2Cwbr4jchw==", + "license": "Apache-2.0", + "dependencies": { + "rrweb": "2.0.0-alpha.13" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -2900,6 +3686,24 @@ "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==", "license": "MIT" }, + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -2923,6 +3727,60 @@ "node": ">= 0.6" } }, + "node_modules/next": { + "version": "15.1.6", + "resolved": "https://registry.npmjs.org/next/-/next-15.1.6.tgz", + "integrity": "sha512-Hch4wzbaX0vKQtalpXvUiw5sYivBy4cm5rzUKrBnUB/y436LGrvOUqYvlSeNVCWFO/770gDlltR9gqZH62ct4Q==", + "license": "MIT", + "dependencies": { + "@next/env": "15.1.6", + "@swc/counter": "0.1.3", + "@swc/helpers": "0.5.15", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001579", + "postcss": "8.4.31", + "styled-jsx": "5.1.6" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "15.1.6", + "@next/swc-darwin-x64": "15.1.6", + "@next/swc-linux-arm64-gnu": "15.1.6", + "@next/swc-linux-arm64-musl": "15.1.6", + "@next/swc-linux-x64-gnu": "15.1.6", + "@next/swc-linux-x64-musl": "15.1.6", + "@next/swc-win32-arm64-msvc": "15.1.6", + "@next/swc-win32-x64-msvc": "15.1.6", + "sharp": "^0.33.5" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.41.2", + "babel-plugin-react-compiler": "*", + "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "@playwright/test": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, "node_modules/node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -6079,6 +6937,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -6106,7 +6965,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" @@ -6170,6 +7028,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -6201,6 +7060,12 @@ "node": ">=8" } }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -6217,8 +7082,35 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/poseidon-lite/-/poseidon-lite-0.2.1.tgz", "integrity": "sha512-xIr+G6HeYfOhCuswdqcFpSX47SPhm0EpisWJ6h7fHlWwaVIvH3dLnejpatrtw6Xc6HaLrpq05y7VRfvDmDGIog==", + "license": "MIT" + }, + "node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "license": "MIT", - "peer": true + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } }, "node_modules/prelude-ls": { "version": "1.2.1", @@ -6347,6 +7239,29 @@ "node": ">= 0.8" } }, + "node_modules/react": { + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", + "integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0.tgz", + "integrity": "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "scheduler": "^0.25.0" + }, + "peerDependencies": { + "react": "^19.0.0" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -6403,6 +7318,68 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rrdom": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/rrdom/-/rrdom-2.0.0-alpha.18.tgz", + "integrity": "sha512-fSFzFFxbqAViITyYVA4Z0o5G6p1nEqEr/N8vdgSKie9Rn0FJxDSNJgjV0yiCIzcDs0QR+hpvgFhpbdZ6JIr5Nw==", + "license": "MIT", + "dependencies": { + "rrweb-snapshot": "^2.0.0-alpha.18" + } + }, + "node_modules/rrweb": { + "version": "2.0.0-alpha.13", + "resolved": "https://registry.npmjs.org/rrweb/-/rrweb-2.0.0-alpha.13.tgz", + "integrity": "sha512-a8GXOCnzWHNaVZPa7hsrLZtNZ3CGjiL+YrkpLo0TfmxGLhjNZbWY2r7pE06p+FcjFNlgUVTmFrSJbK3kO7yxvw==", + "license": "MIT", + "dependencies": { + "@rrweb/types": "^2.0.0-alpha.13", + "@types/css-font-loading-module": "0.0.7", + "@xstate/fsm": "^1.4.0", + "base64-arraybuffer": "^1.0.1", + "fflate": "^0.4.4", + "mitt": "^3.0.0", + "rrdom": "^2.0.0-alpha.13", + "rrweb-snapshot": "^2.0.0-alpha.13" + } + }, + "node_modules/rrweb-snapshot": { + "version": "2.0.0-alpha.18", + "resolved": "https://registry.npmjs.org/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.18.tgz", + "integrity": "sha512-hBHZL/NfgQX6wO1D9mpwqFu1NJPpim+moIcKhFEjVTZVRUfCln+LOugRc4teVTCISYHN8Cw5e2iNTWCSm+SkoA==", + "license": "MIT", + "dependencies": { + "postcss": "^8.4.38" + } + }, + "node_modules/rrweb-snapshot/node_modules/postcss": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.1.tgz", + "integrity": "sha512-6oz2beyjc5VMn/KV1pPw8fliQkhBXrVn1Z3TVyqZxU8kZpzEKhBdmCFqI6ZbmGtamQvQGuU1sgPTk8ZrXDD7jQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.8", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -6453,6 +7430,13 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "license": "MIT" }, + "node_modules/scheduler": { + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", + "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", + "license": "MIT", + "peer": true + }, "node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -6534,6 +7518,46 @@ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "license": "ISC" }, + "node_modules/sharp": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz", + "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.6.3" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.33.5", + "@img/sharp-darwin-x64": "0.33.5", + "@img/sharp-libvips-darwin-arm64": "1.0.4", + "@img/sharp-libvips-darwin-x64": "1.0.4", + "@img/sharp-libvips-linux-arm": "1.0.5", + "@img/sharp-libvips-linux-arm64": "1.0.4", + "@img/sharp-libvips-linux-s390x": "1.0.4", + "@img/sharp-libvips-linux-x64": "1.0.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", + "@img/sharp-libvips-linuxmusl-x64": "1.0.4", + "@img/sharp-linux-arm": "0.33.5", + "@img/sharp-linux-arm64": "0.33.5", + "@img/sharp-linux-s390x": "0.33.5", + "@img/sharp-linux-x64": "0.33.5", + "@img/sharp-linuxmusl-arm64": "0.33.5", + "@img/sharp-linuxmusl-x64": "0.33.5", + "@img/sharp-wasm32": "0.33.5", + "@img/sharp-win32-ia32": "0.33.5", + "@img/sharp-win32-x64": "0.33.5" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -6629,6 +7653,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "license": "MIT", + "optional": true, + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, "node_modules/simple-update-notifier": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", @@ -6651,6 +7685,15 @@ "node": ">=8" } }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -6660,6 +7703,14 @@ "node": ">= 0.8" } }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/strict-event-emitter-types": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strict-event-emitter-types/-/strict-event-emitter-types-2.0.0.tgz", @@ -6692,6 +7743,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/styled-jsx": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", + "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", + "license": "MIT", + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, "node_modules/superstruct": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.4.tgz", @@ -6705,6 +7779,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -6717,6 +7792,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, "license": "MIT" }, "node_modules/to-regex-range": { @@ -6925,6 +8001,19 @@ "node": ">= 0.4.0" } }, + "node_modules/uuid": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz", + "integrity": "sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -6935,8 +8024,7 @@ "version": "0.36.0", "resolved": "https://registry.npmjs.org/valibot/-/valibot-0.36.0.tgz", "integrity": "sha512-CjF1XN4sUce8sBK9TixrDqFM7RwNkuXdJu174/AwmQUB62QbCQADg5lLe8ldBalFgtj1uKj+pKwDJiNo4Mn+eQ==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/vary": { "version": "1.1.2", @@ -6982,6 +8070,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -7007,6 +8096,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, "license": "ISC" }, "node_modules/ws": { @@ -7043,7 +8133,6 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, "license": "MIT", "engines": { "node": ">=10" diff --git a/sui-agent/package.json b/sui-agent/package.json index 6c70fc1..7f87794 100644 --- a/sui-agent/package.json +++ b/sui-agent/package.json @@ -16,6 +16,8 @@ "license": "ISC", "description": "", "dependencies": { + "@mysten/sui": "^1.21.0", + "@suilend/sdk": "^1.1.36", "aftermath-ts-sdk": "^1.2.49", "atoma-sdk": "github:atoma-network/atoma-sdk-typescript", "axios": "^1.7.9", @@ -32,7 +34,7 @@ "@types/express": "^5.0.0", "@typescript-eslint/eslint-plugin": "^5.0.0", "@typescript-eslint/parser": "^5.0.0", - "prettier": "^3.4.2", - "eslint": "^8.57.0" + "eslint": "^8.57.0", + "prettier": "^3.4.2" } } diff --git a/sui-agent/src/agents/ToolRegistry.ts b/sui-agent/src/agents/ToolRegistry.ts index fe6649f..8391c6b 100644 --- a/sui-agent/src/agents/ToolRegistry.ts +++ b/sui-agent/src/agents/ToolRegistry.ts @@ -27,6 +27,16 @@ import { getAfSuiExchangeRateWrapper, getStakeTransactionWrapper, } from '../utils/toolWrappers'; +import { + depositIntoObligationWrapper, + depositLiquidityAndGetCTokensWrapper, + redeemCtokensAndWithdrawLiquidityWrapper, + withdrawAndSendToUserWrapper, +} from '../tools/suilend/depositWithdraw'; +import { + borrowAndSendToUserWrapper, + repayIntoObligationWrapper, +} from '../tools/suilend/borrowRepay'; /* format for tool registry is: @@ -565,4 +575,190 @@ export function registerAllTools(tools: Tools) { ], getStakeTransactionWrapper, ); + + // Suilend Tools + + // 1. Deposit Into Obligation + tools.registerTool( + 'deposit_into_obligation', + 'Tool to deposit coins into an obligation', + [ + { + name: 'lendingMarketId', + type: 'string', + description: 'ID of the lending market', + required: true, + }, + { + name: 'lendingMarketType', + type: 'string', + description: 'Type of the lending market', + required: true, + }, + { + name: 'ownerId', + type: 'string', + description: 'Address of the owner', + required: true, + }, + { + name: 'coinType', + type: 'string', + description: 'Type of coin to deposit', + required: true, + }, + { + name: 'value', + type: 'string', + description: 'Amount to deposit (in base units)', + required: true, + }, + { + name: 'obligationOwnerCapId', + type: 'string', + description: 'Obligation owner capability ID', + required: true, + }, + ], + depositIntoObligationWrapper, + ); + + // 2. Deposit Liquidity and Get CTokens + tools.registerTool( + 'deposit_liquidity_get_ctokens', + 'Tool to deposit liquidity and receive CTokens', + [ + { + name: 'lendingMarketId', + type: 'string', + description: 'ID of the lending market', + required: true, + }, + { + name: 'lendingMarketType', + type: 'string', + description: 'Type of the lending market', + required: true, + }, + { + name: 'ownerId', + type: 'string', + description: 'Address of the owner', + required: true, + }, + { + name: 'coinType', + type: 'string', + description: 'Type of coin to deposit', + required: true, + }, + { + name: 'value', + type: 'string', + description: 'Amount to deposit (in base units)', + required: true, + }, + ], + depositLiquidityAndGetCTokensWrapper, + ); + + // 3. Withdraw and Send to User + tools.registerTool( + 'withdraw_and_send', + 'Tool to withdraw funds and send them to a user', + [ + { + name: 'lendingMarketId', + type: 'string', + description: 'ID of the lending market', + required: true, + }, + { + name: 'lendingMarketType', + type: 'string', + description: 'Type of the lending market', + required: true, + }, + { + name: 'ownerId', + type: 'string', + description: 'Address of the recipient', + required: true, + }, + { + name: 'obligationOwnerCapId', + type: 'string', + description: 'Obligation owner capability ID', + required: true, + }, + { + name: 'obligationId', + type: 'string', + description: 'ID of the obligation', + required: true, + }, + { + name: 'coinType', + type: 'string', + description: 'Type of coin to withdraw', + required: true, + }, + { + name: 'value', + type: 'string', + description: 'Amount to withdraw (in base units)', + required: true, + }, + ], + withdrawAndSendToUserWrapper, + ); + + // 4. Redeem CTokens and Withdraw Liquidity + tools.registerTool( + 'redeem_ctokens_and_withdraw', + 'Tool to redeem CTokens and withdraw underlying liquidity', + [ + { + name: 'lendingMarketId', + type: 'string', + description: 'ID of the lending market', + required: true, + }, + { + name: 'lendingMarketType', + type: 'string', + description: 'Type of the lending market', + required: true, + }, + { + name: 'ownerId', + type: 'string', + description: 'Address of the owner', + required: true, + }, + { + name: 'ctokenCoinTypes', + type: 'array', + description: 'Array of CToken coin types to redeem', + required: true, + }, + ], + redeemCtokensAndWithdrawLiquidityWrapper, + ); + + // 5. Borrow and Send to User + tools.registerTool( + 'borrow_and_send', + 'Tool to borrow funds and send them to a user', + [], + borrowAndSendToUserWrapper, + ); + + // 6. Repay Into Obligation + tools.registerTool( + 'repay_into_obligation', + 'Tool to repay funds into an obligation', + [], + repayIntoObligationWrapper, + ); } diff --git a/sui-agent/src/tools/suilend/borrowRepay.ts b/sui-agent/src/tools/suilend/borrowRepay.ts new file mode 100644 index 0000000..6f969af --- /dev/null +++ b/sui-agent/src/tools/suilend/borrowRepay.ts @@ -0,0 +1,113 @@ +import { Transaction } from '@mysten/sui/transactions'; +import { SuilendClient } from '@suilend/sdk/client'; +import { handleError } from '../../utils'; +import { suilendClientWrapper } from '.'; + +/** + * Borrow and send funds to user + * @param ownerId - The owner ID + * @param obligationOwnerCapId - The obligation owner cap ID + * @param obligationId - The obligation ID + * @param coinType - The coin type + * @param value - The value + * @returns A JSON string containing the result of the borrow and send to user operation + */ +export async function borrowAndSendToUserWrapper( + ownerId: string, + obligationOwnerCapId: string, + obligationId: string, + coinType: string, + value: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + await client.borrowAndSendToUser( + ownerId, + obligationOwnerCapId, + obligationId, + coinType, + value, + transaction, + ); + return JSON.stringify([ + { + reasoning: 'Successfully borrowed and sent funds to user', + response: JSON.stringify( + { + ownerId: ownerId, + obligationId: obligationId, + coinType: coinType, + borrowedAmount: value, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Borrowed ${value} of ${coinType} for ${ownerId}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to borrow and send funds to user', + query: `Attempted to borrow ${value} of ${coinType}`, + }), + ]); + } +} + +/** + * Repay into obligation + * @param ownerId - The owner ID + * @param obligationId - The obligation ID + * @param coinType - The coin type + * @param value - The value + * @returns A JSON string containing the result of the repay into obligation operation + */ +export async function repayIntoObligationWrapper( + ownerId: string, + obligationId: string, + coinType: string, + value: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + await client.repayIntoObligation( + ownerId, + obligationId, + coinType, + value, + transaction, + ); + return JSON.stringify([ + { + reasoning: 'Successfully repaid into obligation', + response: JSON.stringify( + { + ownerId: ownerId, + obligationId: obligationId, + coinType: coinType, + repaidAmount: value, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Repaid ${value} of ${coinType} into obligation`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to repay into obligation', + query: `Attempted to repay ${value} of ${coinType}`, + }), + ]); + } +} diff --git a/sui-agent/src/tools/suilend/depositWithdraw.ts b/sui-agent/src/tools/suilend/depositWithdraw.ts new file mode 100644 index 0000000..1612edd --- /dev/null +++ b/sui-agent/src/tools/suilend/depositWithdraw.ts @@ -0,0 +1,215 @@ +import { Transaction } from '@mysten/sui/transactions'; +import { SuilendClient } from '@suilend/sdk/client'; +import { handleError } from '../../utils'; +import { suilendClientWrapper } from '.'; + +/** + * Deposits funds into an obligation in a Suilend lending market and returns the result as a JSON string. + * + * @param lendingMarketId - The ID of the lending market + * @param lendingMarketType - The type of lending market + * @param ownerId - The ID of the owner + * @param coinType - The type of coin + * @param value - The amount of coin to deposit + * @param obligationOwnerCapId - The ID of the obligation owner capability + * @returns A JSON string containing the result of the deposit operation + */ +export async function depositIntoObligationWrapper( + ownerId: string, + coinType: string, + value: string, + obligationOwnerCapId: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + await client.depositIntoObligation( + ownerId, + coinType, + value, + transaction, + obligationOwnerCapId, + ); + return JSON.stringify([ + { + reasoning: 'Successfully deposited into obligation', + response: JSON.stringify( + { + transaction: transaction, + ownerId: ownerId, + coinType: coinType, + value: value, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Deposited ${value} of ${coinType} into obligation`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to deposit into obligation', + query: `Attempted to deposit ${value} of ${coinType}`, + }), + ]); + } +} + +/** + * Deposits liquidity into a Suilend lending market and returns the result as a JSON string. + * + * @param ownerId - The ID of the owner + * @param coinType - The type of coin + * @param value - The amount of coin to deposit + * @returns A JSON string containing the result of the deposit operation + */ +export async function depositLiquidityAndGetCTokensWrapper( + ownerId: string, + coinType: string, + value: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + const result = await client.depositLiquidityAndGetCTokens( + ownerId, + coinType, + value, + transaction, + ); + return JSON.stringify([ + { + reasoning: 'Successfully deposited liquidity and received CTokens', + response: JSON.stringify( + { + ownerId: ownerId, + coinType: coinType, + depositedValue: value, + transaction: transaction, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Deposited ${value} of ${coinType} for CTokens`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to deposit liquidity and get CTokens', + query: `Attempted to deposit ${value} of ${coinType}`, + }), + ]); + } +} + +/** + * Withdraws funds from an obligation in a Suilend lending market and returns the result as a JSON string. + * + * @param ownerId - The ID of the owner + * @param obligationOwnerCapId - The ID of the obligation owner capability + * @param obligationId - The ID of the obligation + * @param coinType - The type of coin + * @param value - The amount of coin to withdraw + * @returns A JSON string containing the result of the withdrawal operation + */ +export async function withdrawAndSendToUserWrapper( + ownerId: string, + obligationOwnerCapId: string, + obligationId: string, + coinType: string, + value: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + await client.withdrawAndSendToUser( + ownerId, + obligationOwnerCapId, + obligationId, + coinType, + value, + transaction, + ); + return JSON.stringify([ + { + reasoning: 'Successfully withdrew and sent funds to user', + response: JSON.stringify( + { + ownerId: ownerId, + coinType: coinType, + withdrawnValue: value, + transaction: transaction, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Withdrew ${value} of ${coinType} to ${ownerId}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to withdraw and send to user', + query: `Attempted to withdraw ${value} of ${coinType}`, + }), + ]); + } +} + +/** + * Redeems CTokens and withdraws liquidity from a Suilend lending market and returns the result as a JSON string. + * + * @param ownerId - The ID of the owner + * @param ctokenCoinTypes - The types of CTokens to redeem + * @returns A JSON string containing the result of the redemption operation + */ +export async function redeemCtokensAndWithdrawLiquidityWrapper( + ownerId: string, + ctokenCoinTypes: string[], +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + await client.redeemCtokensAndWithdrawLiquidity( + ownerId, + ctokenCoinTypes, + transaction, + ); + return JSON.stringify([ + { + reasoning: 'Successfully redeemed CTokens and withdrew liquidity', + response: JSON.stringify( + { + ownerId: ownerId, + ctokenCoinTypes: ctokenCoinTypes, + transaction: transaction, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Redeemed CTokens for types: ${ctokenCoinTypes.join(', ')}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to redeem CTokens and withdraw liquidity', + query: `Attempted to redeem CTokens for types: ${ctokenCoinTypes.join(', ')}`, + }), + ]); + } +} diff --git a/sui-agent/src/tools/suilend/index.ts b/sui-agent/src/tools/suilend/index.ts new file mode 100644 index 0000000..38b8d25 --- /dev/null +++ b/sui-agent/src/tools/suilend/index.ts @@ -0,0 +1,96 @@ +import { SuiClient, SuiHTTPTransport } from '@mysten/sui/client'; +import { + Transaction, + TransactionObjectInput, + TransactionResult, +} from '@mysten/sui/transactions'; +import { + SuilendClient, + LENDING_MARKET_ID, + LENDING_MARKET_TYPE, +} from '@suilend/sdk/client'; +import { NETWORK_CONFIG } from '../../../@types/interface'; + +/** + * Initializes and returns a SuilendClient instance configured for the mainnet. + * + * This function creates a configured SuilendClient by: + * 1. Establishing a connection to the Sui mainnet using SuiClient + * 2. Initializing a SuilendClient with predefined lending market parameters + * + * @returns {Promise} A configured SuilendClient instance ready for lending operations + * @throws {Error} If client initialization fails, with detailed error message + * + * @example + * try { + * const client = await suilendClientWrapper(); + * // Use client for lending operations + * } catch (error) { + * console.error('Failed to initialize SuilendClient:', error); + * } + * + * @see {@link SuilendClient} For available lending operations + * @see {@link LENDING_MARKET_ID} For the configured lending market identifier + * @see {@link LENDING_MARKET_TYPE} For the lending market type configuration + */ +async function suilendClientWrapper(): Promise { + try { + const suiClient = new SuiClient({ + transport: new SuiHTTPTransport({ + url: NETWORK_CONFIG.MAINNET.fullnode, + }), + }); + + const suilendClient = await SuilendClient.initialize( + LENDING_MARKET_ID, + LENDING_MARKET_TYPE, + suiClient, + ); + + return suilendClient; + } catch (error) { + throw new Error( + `Failed to initialize SuilendClient: ${error instanceof Error ? error.message : String(error)}`, + ); + } +} + +export { suilendClientWrapper }; + +// // Market Management Methods +// 1. createLendingMarket(registryId, lendingMarketType) +// 2. createReserve(lendingMarketOwnerCapId, pythPriceId, coinType, config) +// 3. updateReserveConfig(lendingMarketOwnerCapId, coinType, config) +// 4. changeReservePriceFeed(lendingMarketOwnerCapId, coinType, pythPriceId) +// 5. updateRateLimiterConfig(lendingMarketOwnerCapId, config) +// 6. migrate(lendingMarketOwnerCapId) +// 7. setFeeReceiversAndWeights(lendingMarketOwnerCapId, receivers, weights) +// 8. claimFees(coinType) + +// // Obligation Management +// 9. createObligation() +// 10. newObligationOwnerCap(lendingMarketOwnerCapId, destinationAddress, obligationId) + +// // Deposit/Withdraw Operations +// 11. depositIntoObligation(ownerId, coinType, value, obligationOwnerCapId) +// 12. depositLiquidityAndGetCTokens(ownerId, coinType, value) +// 13. withdrawAndSendToUser(ownerId, obligationOwnerCapId, obligationId, coinType, value) +// 14. redeemCtokensAndWithdrawLiquidity(ownerId, ctokenCoinTypes) + +// // Borrow/Repay Operations +// 15. borrowAndSendToUser(ownerId, obligationOwnerCapId, obligationId, coinType, value) +// 16. repayIntoObligation(ownerId, obligationId, coinType, value) + +// // Reward Management +// 17. addReward(ownerId, lendingMarketOwnerCapId, reserveArrayIndex, isDepositReward, rewardCoinType, rewardValue, startTimeMs, endTimeMs) +// 18. cancelReward(lendingMarketOwnerCapId, reserveArrayIndex, isDepositReward, rewardIndex, rewardCoinType) +// 19. closeReward(lendingMarketOwnerCapId, reserveArrayIndex, isDepositReward, rewardIndex, rewardCoinType) +// 20. claimRewardsAndSendToUser(ownerId, obligationOwnerCapId, rewards) +// 21. claimRewardsAndDeposit(ownerId, obligationOwnerCapId, rewards) + +// // Liquidation Operations +// 22. liquidateAndRedeem(obligation, repayCoinType, withdrawCoinType, repayCoinId) + +// // Query Methods +// 23. getLendingMarketOwnerCapId(ownerId) +// 24. getObligation(obligationId) diff --git a/sui-agent/src/tools/suilend/marketManagement.ts b/sui-agent/src/tools/suilend/marketManagement.ts new file mode 100644 index 0000000..66ac8d3 --- /dev/null +++ b/sui-agent/src/tools/suilend/marketManagement.ts @@ -0,0 +1,288 @@ +import { Transaction } from '@mysten/sui/transactions'; +import { SuilendClient } from '@suilend/sdk/client'; +import { handleError } from '../../utils'; +import { suilendClientWrapper } from '.'; +import { CreateReserveConfigArgs } from '@suilend/sdk/_generated/suilend/reserve-config/functions'; + +/** + * Creates a new lending market in the Suilend protocol and returns the result as a JSON string. + * + * @param registryId - The ID of the registry where the lending market will be created + * @param lendingMarketType - The type of lending market to create + * @returns A JSON string containing: + * - On success: An array with one object containing: + * - reasoning: Success message + * - response: JSON string with ownerCap and transaction details + * - status: 'success' + * - query: Description of the action performed + * - errors: Empty array + * - On failure: An array with one error object containing: + * - reasoning: Error message + * - query: Description of the attempted action + * - Additional error details from handleError + */ +export async function createLendingMarketWrapper( + registryId: string, + lendingMarketType: string, +): Promise { + try { + const transaction = new Transaction(); + const ownerCap = SuilendClient.createNewLendingMarket( + registryId, + lendingMarketType, + transaction, + ); + + return JSON.stringify([ + { + reasoning: 'Successfully created new lending market', + response: JSON.stringify( + { + ownerCap: ownerCap, + transaction: transaction, + }, + null, + 2, + ), + status: 'success', + query: `Created lending market with registry ID: ${registryId}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to create lending market', + query: `Attempted to create lending market with registry ID: ${registryId}`, + }), + ]); + } +} + +/** + * Creates a new reserve in an existing Suilend lending market and returns the result as a JSON string. + * + * @param lendingMarketOwnerCapId - The ID of the owner capability for the lending market + * @param pythPriceId - The ID of the Pyth price feed to use for the reserve + * @param coinType - The type of coin to be used in the reserve + * @param config - Configuration parameters for the reserve + * @returns A JSON string containing: + * - On success: An array with one object containing: + * - reasoning: Success message with coin type + * - response: JSON string with transaction and result details + * - status: 'success' + * - query: Description of the action performed + * - errors: Empty array + * - On failure: An array with one error object containing: + * - reasoning: Error message + * - query: Description of the attempted action + * - Additional error details from handleError + */ +export async function createReserveWrapper( + lendingMarketOwnerCapId: string, + pythPriceId: string, + coinType: string, + config: CreateReserveConfigArgs, +) { + try { + const transaction = new Transaction(); + const client = await suilendClientWrapper(); + const result = await client.createReserve( + lendingMarketOwnerCapId, + transaction, + pythPriceId, + coinType, + config, + ); + return JSON.stringify([ + { + reasoning: + 'Successfully created reserve in lending market with coin type: ' + + coinType, + response: JSON.stringify({ + transaction: transaction, + createdReserveConfig: { + openLtvPct: config.openLtvPct, + closeLtvPct: config.closeLtvPct, + maxCloseLtvPct: config.maxCloseLtvPct, + borrowWeightBps: config.borrowWeightBps, + depositLimit: config.depositLimit, + borrowLimit: config.borrowLimit, + liquidationBonusBps: config.liquidationBonusBps, + maxLiquidationBonusBps: config.maxLiquidationBonusBps, + depositLimitUsd: config.depositLimitUsd, + borrowLimitUsd: config.borrowLimitUsd, + }, + result: result, + }), + status: 'success', + query: `Created reserve with coin type: ${coinType}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to create reserve', + query: `Attempted to create reserve with coin type: ${coinType}`, + }), + ]); + } +} + +/** + * Updates the configuration of an existing reserve in a Suilend lending market and returns the result as a JSON string. + * + * @param lendingMarketOwnerCapId - The ID of the owner capability for the lending market + * @param coinType - The type of coin used in the reserve to update + * @param config - Configuration parameters for the reserve, including: + * - openLtvPct: Open loan-to-value percentage + * - closeLtvPct: Close loan-to-value percentage + * - maxCloseLtvPct: Maximum close loan-to-value percentage + * - borrowWeightBps: Borrow weight in basis points + * - depositLimit: Maximum deposit limit in base units + * - borrowLimit: Maximum borrow limit in base units + * - liquidationBonusBps: Liquidation bonus in basis points + * - maxLiquidationBonusBps: Maximum liquidation bonus in basis points + * - depositLimitUsd: Maximum deposit limit in USD + * - borrowLimitUsd: Maximum borrow limit in USD + * - borrowFeeBps: Borrow fee in basis points + * - spreadFeeBps: Spread fee in basis points + * - protocolLiquidationFeeBps: Protocol liquidation fee in basis points + * - interestRateUtils: Interest rate utility parameters + * - interestRateAprs: Interest rate APR configurations + * - isolated: Whether the reserve is isolated + * - openAttributedBorrowLimitUsd: Open attributed borrow limit in USD + * - closeAttributedBorrowLimitUsd: Close attributed borrow limit in USD + * @returns A JSON string containing: + * - On success: An array with one object containing: + * - reasoning: Success message + * - response: JSON string with transaction details and updated configuration + * - status: 'success' + * - query: Description of the action performed + * - errors: Empty array + * - On failure: An array with one error object containing: + * - reasoning: Error message + * - query: Description of the attempted action + * - Additional error details from handleError + */ +export async function updateReserveConfigWrapper( + lendingMarketOwnerCapId: string, + coinType: string, + config: CreateReserveConfigArgs, +): Promise { + try { + const transaction = new Transaction(); + const client = await suilendClientWrapper(); + const result = await client.updateReserveConfig( + lendingMarketOwnerCapId, + transaction, + coinType, + config, + ); + // Format the response with the updated configuration + return JSON.stringify([ + { + reasoning: 'Successfully updated reserve configuration', + response: JSON.stringify( + { + lendingMarketOwnerCapId: lendingMarketOwnerCapId, + coinType: coinType, + transaction: transaction, + updatedConfig: { + openLtvPct: config.openLtvPct, + closeLtvPct: config.closeLtvPct, + maxCloseLtvPct: config.maxCloseLtvPct, + borrowWeightBps: config.borrowWeightBps, + depositLimit: config.depositLimit, + borrowLimit: config.borrowLimit, + liquidationBonusBps: config.liquidationBonusBps, + maxLiquidationBonusBps: config.maxLiquidationBonusBps, + depositLimitUsd: config.depositLimitUsd, + borrowLimitUsd: config.borrowLimitUsd, + borrowFeeBps: config.borrowFeeBps, + spreadFeeBps: config.spreadFeeBps, + protocolLiquidationFeeBps: config.protocolLiquidationFeeBps, + interestRateUtils: config.interestRateUtils, + interestRateAprs: config.interestRateAprs, + isolated: config.isolated, + openAttributedBorrowLimitUsd: config.openAttributedBorrowLimitUsd, + closeAttributedBorrowLimitUsd: + config.closeAttributedBorrowLimitUsd, + }, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Updated reserve configuration for coin type: ${coinType}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to update reserve config', + query: `Attempted to update reserve config with coin type: ${coinType}`, + }), + ]); + } +} + +/** + * Changes the price feed for an existing reserve in a Suilend lending market and returns the result as a JSON string. + * + * @param lendingMarketOwnerCapId - The ID of the owner capability for the lending market + * @param coinType - The type of coin used in the reserve + * @param pythPriceId - The ID of the new Pyth price feed to use + * @returns A JSON string containing: + * - On success: An array with one object containing: + * - reasoning: Success message + * - response: JSON string with transaction details and new price feed + * - status: 'success' + * - query: Description of the action performed + * - errors: Empty array + */ +export async function changeReservePriceFeedWrapper( + lendingMarketOwnerCapId: string, + coinType: string, + pythPriceId: string, +) { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + const result = await client.changeReservePriceFeed( + lendingMarketOwnerCapId, + coinType, + pythPriceId, + transaction, + ); + return JSON.stringify([ + { + reasoning: 'Successfully changed reserve price feed', + response: JSON.stringify( + { + transaction: transaction, + lendingMarketId: lendingMarketOwnerCapId, + coinType: coinType, + newPriceId: pythPriceId, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Changed reserve price feed for coin type: ${coinType}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to change reserve price feed', + query: `Attempted to change reserve price feed for coin type: ${coinType}`, + }), + ]); + } +} diff --git a/sui-agent/src/tools/suilend/rewardManagement.ts b/sui-agent/src/tools/suilend/rewardManagement.ts new file mode 100644 index 0000000..dedd047 --- /dev/null +++ b/sui-agent/src/tools/suilend/rewardManagement.ts @@ -0,0 +1,297 @@ +import { Transaction } from '@mysten/sui/transactions'; +import { suilendClientWrapper } from '.'; +import { ClaimRewardsReward, SuilendClient } from '@suilend/sdk/client'; +import { handleError } from '../../utils'; + +/** + * Add a reward + * @param ownerId - The owner ID + * @param lendingMarketOwnerCapId - The lending market owner cap ID + * @param reserveArrayIndex - The reserve array index + * @param isDepositReward - Whether the reward is a deposit reward + * @param rewardCoinType - The reward coin type + * @param rewardValue - The reward value + * @param startTimeMs - The start time in milliseconds + * @param endTimeMs - The end time in milliseconds + * @returns A JSON string containing the result of the add reward operation + */ +export async function addRewardWrapper( + ownerId: string, + lendingMarketOwnerCapId: string, + reserveArrayIndex: number, + isDepositReward: boolean, + rewardCoinType: string, + rewardValue: string, + startTimeMs: string, + endTimeMs: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + await client.addReward( + ownerId, + lendingMarketOwnerCapId, + BigInt(reserveArrayIndex), + isDepositReward, + rewardCoinType, + rewardValue, + BigInt(startTimeMs), + BigInt(endTimeMs), + transaction, + ); + + return JSON.stringify([ + { + reasoning: 'Successfully added reward', + response: JSON.stringify( + { + transaction: transaction, + rewardDetails: { + reserveIndex: reserveArrayIndex, + rewardType: isDepositReward ? 'deposit' : 'borrow', + coinType: rewardCoinType, + value: rewardValue, + duration: `${startTimeMs} to ${endTimeMs}`, + }, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Added ${rewardValue} ${rewardCoinType} reward`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to add reward', + query: `Attempted to add ${rewardValue} ${rewardCoinType} reward`, + }), + ]); + } +} + +/** + * Cancel a reward + * @param lendingMarketOwnerCapId - The lending market owner cap ID + * @param reserveArrayIndex - The reserve array index + * @param isDepositReward - Whether the reward is a deposit reward + * @param rewardIndex - The reward index + * @param rewardCoinType - The reward coin type + * @returns A JSON string containing the result of the cancel reward operation + */ +export async function cancelRewardWrapper( + lendingMarketOwnerCapId: string, + reserveArrayIndex: number, + isDepositReward: boolean, + rewardIndex: number, + rewardCoinType: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + await client.cancelReward( + lendingMarketOwnerCapId, + BigInt(reserveArrayIndex), + isDepositReward, + BigInt(rewardIndex), + rewardCoinType, + transaction, + ); + + return JSON.stringify([ + { + reasoning: 'Successfully cancelled reward', + response: JSON.stringify( + { + transaction: transaction, + cancelledReward: { + reserveIndex: reserveArrayIndex, + rewardIndex: rewardIndex, + rewardType: isDepositReward ? 'deposit' : 'borrow', + coinType: rewardCoinType, + }, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Cancelled reward at index ${rewardIndex}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to cancel reward', + query: `Attempted to cancel reward at index ${rewardIndex}`, + }), + ]); + } +} + +/** + * Close a reward + * @param lendingMarketOwnerCapId - The lending market owner cap ID + * @param reserveArrayIndex - The reserve array index + * @param isDepositReward - Whether the reward is a deposit reward + * @param rewardIndex - The reward index + * @param rewardCoinType - The reward coin type + * @returns A JSON string containing the result of the close reward operation + */ +export async function closeRewardWrapper( + lendingMarketOwnerCapId: string, + reserveArrayIndex: number, + isDepositReward: boolean, + rewardIndex: number, + rewardCoinType: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + + await client.closeReward( + lendingMarketOwnerCapId, + BigInt(reserveArrayIndex), + isDepositReward, + BigInt(rewardIndex), + rewardCoinType, + transaction, + ); + + return JSON.stringify([ + { + reasoning: 'Successfully closed reward', + response: JSON.stringify( + { + transaction: transaction, + closedReward: { + reserveIndex: reserveArrayIndex, + rewardIndex: rewardIndex, + rewardType: isDepositReward ? 'deposit' : 'borrow', + coinType: rewardCoinType, + }, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Closed reward at index ${rewardIndex}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to close reward', + query: `Attempted to close reward at index ${rewardIndex}`, + }), + ]); + } +} + +/** + * Claim rewards and send to user + * @param ownerId - The owner ID + * @param obligationOwnerCapId - The obligation owner cap ID + * @param rewards - The rewards + * @returns A JSON string containing the result of the claim rewards and send to user operation + */ +export async function claimRewardsAndSendToUserWrapper( + ownerId: string, + obligationOwnerCapId: string, + rewards: ClaimRewardsReward[], +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + + await client.claimRewardsAndSendToUser( + ownerId, + obligationOwnerCapId, + rewards, + transaction, + ); + + return JSON.stringify([ + { + reasoning: 'Successfully claimed and sent rewards', + response: JSON.stringify( + { + transaction: transaction, + claimedRewards: rewards, + recipient: ownerId, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Claimed rewards for ${ownerId}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to claim and send rewards', + query: `Attempted to claim rewards for ${ownerId}`, + }), + ]); + } +} + +/** + * Claim rewards and deposit + * @param ownerId - The owner ID + * @param obligationOwnerCapId - The obligation owner cap ID + * @param rewards - The rewards + * @returns A JSON string containing the result of the claim rewards and deposit operation + */ +export async function claimRewardsAndDepositWrapper( + ownerId: string, + obligationOwnerCapId: string, + rewards: ClaimRewardsReward[], +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + + await client.claimRewardsAndDeposit( + ownerId, + obligationOwnerCapId, + rewards, + transaction, + ); + + return JSON.stringify([ + { + reasoning: 'Successfully claimed and deposited rewards', + response: JSON.stringify( + { + transaction: transaction, + claimedRewards: rewards, + depositor: ownerId, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Claimed and deposited rewards for ${ownerId}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to claim and deposit rewards', + query: `Attempted to claim and deposit rewards for ${ownerId}`, + }), + ]); + } +} From 67743ebff9a82ea52c712d0fa787c3e5d2e4147f Mon Sep 17 00:00:00 2001 From: Jorge Antonio Date: Sat, 25 Jan 2025 20:31:26 +0000 Subject: [PATCH 6/6] add query tools and lints --- sui-agent/src/agents/ToolRegistry.ts | 46 ++++++++++ sui-agent/src/tools/suilend/borrowRepay.ts | 1 - .../src/tools/suilend/depositWithdraw.ts | 3 +- sui-agent/src/tools/suilend/index.ts | 5 -- sui-agent/src/tools/suilend/liquidation.ts | 65 +++++++++++++++ sui-agent/src/tools/suilend/queryMethods.ts | 83 +++++++++++++++++++ 6 files changed, 195 insertions(+), 8 deletions(-) create mode 100644 sui-agent/src/tools/suilend/liquidation.ts create mode 100644 sui-agent/src/tools/suilend/queryMethods.ts diff --git a/sui-agent/src/agents/ToolRegistry.ts b/sui-agent/src/agents/ToolRegistry.ts index 8391c6b..13ace2f 100644 --- a/sui-agent/src/agents/ToolRegistry.ts +++ b/sui-agent/src/agents/ToolRegistry.ts @@ -37,6 +37,7 @@ import { borrowAndSendToUserWrapper, repayIntoObligationWrapper, } from '../tools/suilend/borrowRepay'; +import { liquidateAndRedeemWrapper } from '../tools/suilend/liquidation'; /* format for tool registry is: @@ -761,4 +762,49 @@ export function registerAllTools(tools: Tools) { [], repayIntoObligationWrapper, ); + + // 7. Liquidate and Redeem + tools.registerTool( + 'liquidate_and_redeem', + 'Tool to liquidate an underwater position and redeem collateral', + [ + { + name: 'lendingMarketId', + type: 'string', + description: 'ID of the lending market', + required: true, + }, + { + name: 'lendingMarketType', + type: 'string', + description: 'Type of the lending market', + required: true, + }, + { + name: 'obligation', + type: 'string', + description: 'ID of the obligation to liquidate', + required: true, + }, + { + name: 'repayCoinType', + type: 'string', + description: 'Type of coin used to repay the debt', + required: true, + }, + { + name: 'withdrawCoinType', + type: 'string', + description: 'Type of collateral coin to withdraw', + required: true, + }, + { + name: 'repayCoinId', + type: 'string', + description: 'ID of the coin object used for repayment', + required: true, + }, + ], + liquidateAndRedeemWrapper, + ); } diff --git a/sui-agent/src/tools/suilend/borrowRepay.ts b/sui-agent/src/tools/suilend/borrowRepay.ts index 6f969af..a3c4fdc 100644 --- a/sui-agent/src/tools/suilend/borrowRepay.ts +++ b/sui-agent/src/tools/suilend/borrowRepay.ts @@ -1,5 +1,4 @@ import { Transaction } from '@mysten/sui/transactions'; -import { SuilendClient } from '@suilend/sdk/client'; import { handleError } from '../../utils'; import { suilendClientWrapper } from '.'; diff --git a/sui-agent/src/tools/suilend/depositWithdraw.ts b/sui-agent/src/tools/suilend/depositWithdraw.ts index 1612edd..b7a41bf 100644 --- a/sui-agent/src/tools/suilend/depositWithdraw.ts +++ b/sui-agent/src/tools/suilend/depositWithdraw.ts @@ -1,5 +1,4 @@ import { Transaction } from '@mysten/sui/transactions'; -import { SuilendClient } from '@suilend/sdk/client'; import { handleError } from '../../utils'; import { suilendClientWrapper } from '.'; @@ -75,7 +74,7 @@ export async function depositLiquidityAndGetCTokensWrapper( try { const client = await suilendClientWrapper(); const transaction = new Transaction(); - const result = await client.depositLiquidityAndGetCTokens( + await client.depositLiquidityAndGetCTokens( ownerId, coinType, value, diff --git a/sui-agent/src/tools/suilend/index.ts b/sui-agent/src/tools/suilend/index.ts index 38b8d25..389b8a5 100644 --- a/sui-agent/src/tools/suilend/index.ts +++ b/sui-agent/src/tools/suilend/index.ts @@ -1,9 +1,4 @@ import { SuiClient, SuiHTTPTransport } from '@mysten/sui/client'; -import { - Transaction, - TransactionObjectInput, - TransactionResult, -} from '@mysten/sui/transactions'; import { SuilendClient, LENDING_MARKET_ID, diff --git a/sui-agent/src/tools/suilend/liquidation.ts b/sui-agent/src/tools/suilend/liquidation.ts new file mode 100644 index 0000000..21d7484 --- /dev/null +++ b/sui-agent/src/tools/suilend/liquidation.ts @@ -0,0 +1,65 @@ +import { Transaction } from '@mysten/sui/transactions'; +import { handleError } from '../../utils'; +import { suilendClientWrapper } from '.'; + +/** + * Liquidate and redeem + * @param obligation - The obligation ID + * @param repayCoinType - The type of coin to repay + * @param withdrawCoinType - The type of coin to withdraw + * @param repayCoinId - The ID of the coin to repay + * @returns A JSON string containing the result of the liquidation and redemption operation + */ +export async function liquidateAndRedeemWrapper( + obligation: string, + repayCoinType: string, + withdrawCoinType: string, + repayCoinId: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const transaction = new Transaction(); + // Fetch obligation details first to include in response + const obligationDetails = await client.getObligation(obligation); + // Perform liquidation + await client.liquidateAndRedeem( + transaction, + obligation, + repayCoinType, + withdrawCoinType, + repayCoinId, + ); + + return JSON.stringify([ + { + reasoning: 'Successfully performed liquidation', + response: JSON.stringify( + { + transaction: transaction, + liquidationDetails: { + transaction: transaction, + obligation: obligation, + repaidCoinType: repayCoinType, + withdrawnCoinType: withdrawCoinType, + repayCoinId: repayCoinId, + obligationDetails: obligationDetails, // Include original obligation state + }, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Liquidated obligation ${obligation} repaying with ${repayCoinType} and withdrawing ${withdrawCoinType}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to perform liquidation', + query: `Attempted to liquidate obligation ${obligation}`, + }), + ]); + } +} diff --git a/sui-agent/src/tools/suilend/queryMethods.ts b/sui-agent/src/tools/suilend/queryMethods.ts new file mode 100644 index 0000000..2ba74d7 --- /dev/null +++ b/sui-agent/src/tools/suilend/queryMethods.ts @@ -0,0 +1,83 @@ +import { handleError } from '../../utils'; +import { suilendClientWrapper } from '.'; + +/** + * Get lending market owner capability ID + * @param ownerId - The ID of the owner + * @param lendingMarketId - The ID of the lending market + * @param lendingMarketType - The type of the lending market + * @returns A JSON string containing the lending market owner capability ID + */ +export async function getLendingMarketOwnerCapIdWrapper( + ownerId: string, + lendingMarketId: string, +): Promise { + try { + const client = await suilendClientWrapper(); + const ownerCapId = await client.getLendingMarketOwnerCapId(ownerId); + return JSON.stringify([ + { + reasoning: 'Successfully retrieved lending market owner capability ID', + response: JSON.stringify( + { + ownerId: ownerId, + ownerCapId: ownerCapId, + lendingMarketId: lendingMarketId, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Retrieved owner capability ID for ${ownerId}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to retrieve lending market owner capability ID', + query: `Attempted to get owner capability ID for ${ownerId}`, + }), + ]); + } +} + +/** + * Get obligation details + * @param obligationId - The ID of the obligation + * @returns A JSON string containing the obligation details + */ +export async function getObligationWrapper( + obligationId: string, +): Promise { + try { + const client = await suilendClientWrapper(); + + const obligation = await client.getObligation(obligationId); + return JSON.stringify([ + { + reasoning: 'Successfully retrieved obligation details', + response: JSON.stringify( + { + obligationId: obligationId, + obligationDetails: obligation, + status: 'success', + }, + null, + 2, + ), + status: 'success', + query: `Retrieved obligation details for ${obligationId}`, + errors: [], + }, + ]); + } catch (error: unknown) { + return JSON.stringify([ + handleError(error, { + reasoning: 'Failed to retrieve obligation details', + query: `Attempted to get obligation details for ${obligationId}`, + }), + ]); + } +}