Skip to content

Commit

Permalink
change the name of dsn api to autoDriveApi
Browse files Browse the repository at this point in the history
  • Loading branch information
Xm0onh committed Feb 4, 2025
1 parent fa0ebef commit b11ae26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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,
});
4 changes: 2 additions & 2 deletions src/agents/tools/utils/dsn/dsnDownload.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -16,7 +16,7 @@ export const download = async (cid: string): Promise<BaseMemory> => {
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) {
Expand Down
4 changes: 2 additions & 2 deletions src/agents/tools/utils/dsn/dsnUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ 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');

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) =>
Expand Down

0 comments on commit b11ae26

Please sign in to comment.