Skip to content

Commit

Permalink
chore: fixed file upload as PDA
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth9890 committed Jun 25, 2024
1 parent 45a47da commit d9dbc4e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/v3/pda/pda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from '../../utils/validators';
import { MAX_UPLOAD_FILE_SIZE } from '../../utils/constants';
import { validateSignature } from '../../utils/v3-crypto-helper';
import path from 'path';

export class PDA {
public sdk: Sdk;
Expand Down Expand Up @@ -224,8 +225,8 @@ export class PDA {
const file = await fs.readFile(filePath, { encoding: 'base64' });
const formData = new FormData();
formData.append('pdaId', BigInt(pdaId).toString());
formData.append('file', file);
return fetch(this.url, {
formData.append('file', new Blob([file]), path.basename(filePath));
return await fetch(`${this.url.replace('/graphql', '')}/file/upload`, {
method: 'POST',
body: formData,
headers: {
Expand Down

0 comments on commit d9dbc4e

Please sign in to comment.