From b11ae265c6d1f8963e8ad497cb0365ddd440c5f8 Mon Sep 17 00:00:00 2001 From: xm0onh Date: Mon, 3 Feb 2025 16:56:24 -0800 Subject: [PATCH] change the name of dsn api to autoDriveApi --- src/agents/tools/utils/dsn/{api.ts => autoDriveApi.ts} | 2 +- src/agents/tools/utils/dsn/dsnDownload.ts | 4 ++-- src/agents/tools/utils/dsn/dsnUpload.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/agents/tools/utils/dsn/{api.ts => autoDriveApi.ts} (82%) diff --git a/src/agents/tools/utils/dsn/api.ts b/src/agents/tools/utils/dsn/autoDriveApi.ts similarity index 82% rename from src/agents/tools/utils/dsn/api.ts rename to src/agents/tools/utils/dsn/autoDriveApi.ts index 480f2126..dfd886e6 100644 --- a/src/agents/tools/utils/dsn/api.ts +++ b/src/agents/tools/utils/dsn/autoDriveApi.ts @@ -1,7 +1,7 @@ import { createAutoDriveApi } from '@autonomys/auto-drive'; import { config } from '../../../../config/index.js'; -export const dsnApi = createAutoDriveApi({ +export const autoDriveApi = createAutoDriveApi({ apiKey: config.autoDriveConfig.AUTO_DRIVE_API_KEY || '', network: config.autoDriveConfig.AUTO_DRIVE_NETWORK, }); diff --git a/src/agents/tools/utils/dsn/dsnDownload.ts b/src/agents/tools/utils/dsn/dsnDownload.ts index b994703b..6885d819 100644 --- a/src/agents/tools/utils/dsn/dsnDownload.ts +++ b/src/agents/tools/utils/dsn/dsnDownload.ts @@ -1,5 +1,5 @@ import { downloadFile } from '@autonomys/auto-drive'; -import { dsnApi } from './api.js'; +import { autoDriveApi } from './autoDriveApi.js'; import { createLogger } from '../../../../utils/logger.js'; import { withRetry } from './retry.js'; @@ -16,7 +16,7 @@ export const download = async (cid: string): Promise => { return withRetry( async () => { logger.info(`Downloading file: ${cid}`); - const stream = await downloadFile(dsnApi, cid); + const stream = await downloadFile(autoDriveApi, cid); const chunks: Uint8Array[] = []; for await (const chunk of stream) { diff --git a/src/agents/tools/utils/dsn/dsnUpload.ts b/src/agents/tools/utils/dsn/dsnUpload.ts index 946e643b..afdd6dbc 100644 --- a/src/agents/tools/utils/dsn/dsnUpload.ts +++ b/src/agents/tools/utils/dsn/dsnUpload.ts @@ -6,7 +6,7 @@ import { agentVersion, config } from '../../../../config/index.js'; import { signMessage, wallet } from '../blockchain/agentWallet.js'; import { getLastMemoryCid, setLastMemoryHash } from '../blockchain/agentMemoryContract.js'; import { withRetry } from './retry.js'; -import { dsnApi } from './api.js'; +import { autoDriveApi } from './autoDriveApi.js'; const logger = createLogger('dsn-upload-tool'); @@ -14,7 +14,7 @@ let currentNonce = await wallet.getNonce(); // eslint-disable-next-line @typescript-eslint/no-explicit-any const uploadFileToDsn = async (file: any, options: UploadFileOptions) => - withRetry(() => uploadFile(dsnApi, file, options), { operationName: 'Dsn file upload' }); + withRetry(() => uploadFile(autoDriveApi, file, options), { operationName: 'Dsn file upload' }); // Helper function for memory hash const submitMemoryHash = async (hash: string, nonce: number) =>