Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

aave-loan-requester: wip #46

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions apps/shinkai-tool-aave-dashboard/generate-shinkai-viem-export.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as fs from 'fs';
import * as path from 'path';

const shinkaViemPath = path.join(
__dirname,
'../../dist/libs/shinkai-viem/shinkai-viem.js',
);
const shinkaiViemContent = fs.readFileSync(shinkaViemPath, 'utf-8');

const outputPath = path.join(
__dirname,
'src/bundled-resources/shinkai-viem.ts',
);
const outputContent = `// autogenerated
export const viemScriptContent = "${Buffer.from(shinkaiViemContent).toString('base64')}";
`;

const outputDir = path.dirname(outputPath);
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}

fs.writeFileSync(outputPath, outputContent);
6 changes: 6 additions & 0 deletions apps/shinkai-tool-aave-dashboard/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint-disable */
export default {
displayName: '@shinkai_protocol/shinkai-tool-aave-dashboard',
preset: '../../jest.preset.js',
coverageDirectory: '../../coverage/apps/shinkai-tool-aave-dashboard',
};
4 changes: 4 additions & 0 deletions apps/shinkai-tool-aave-dashboard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "@shinkai_protocol/shinkai-tool-aave-dashboard",
"type": "commonjs"
}
37 changes: 37 additions & 0 deletions apps/shinkai-tool-aave-dashboard/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@shinkai_protocol/shinkai-tool-aave-dashboard",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/shinkai-tool-aave-dashboard/src",
"projectType": "library",
"tags": ["tool"],
"targets": {
"build": {
"dependsOn": [
{ "projects": "@shinkai_protocol/shinkai-viem", "target": "build" }
],
"executor": "nx:run-commands",
"defaultConfiguration": "production",
"options": {
"commands": [
"npx ts-node apps/shinkai-tool-aave-dashboard/generate-shinkai-viem-export.ts",
"npx ts-node scripts/tool-bundler.ts --entry ./apps/shinkai-tool-aave-dashboard/src/index.ts --outputFolder ./dist/apps/shinkai-tool-aave-dashboard"
],
"parallel": false
},
"configurations": {
"development": {},
"production": {}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/shinkai-tool-aave-dashboard/**/*.ts",
"apps/shinkai-tool-aave-dashboard/package.json"
]
}
}
}
}

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions apps/shinkai-tool-aave-dashboard/src/chrome-paths.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'chrome-paths' {
const chrome: string;
}
31 changes: 31 additions & 0 deletions apps/shinkai-tool-aave-dashboard/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Tool } from '../src/index';

const timeout = 60 * 60 * 1000;

test('exists definition', async () => {
const tool = new Tool({});
const definition = tool.getDefinition();
expect(definition).toBeInstanceOf(Object);
});

test(
'run definition',
async () => {
// const secretKey = 'b869541ac1dcd6ef40a9adb731908e67544314744db071b9fb45056a813048cd';
const secretKey = '665e8f55fdaa6a0f109d263a1a0c83b4c0702862e3cda1d2339c950fe6fb0631';
const tool = new Tool({
chromePath: process.env?.CHROME_PATH,
});
const run_result = await tool.run({
secretKey: `0x${secretKey}`,
});

console.log('suppliedAssets', run_result.data.suppliedAssets);
console.log('borrowedAssets', run_result.data.borrowedAssets);
console.log('toSupplyAssets', run_result.data.toSupplyAssets);
console.log('toBorrowAssets', run_result.data.toBorrowAssets);

expect(run_result).toBeInstanceOf(Object);
},
timeout,
);
Loading
Loading