Skip to content

Commit

Permalink
Merge pull request #295 from blockfrost/feat/filecoin
Browse files Browse the repository at this point in the history
feat: filecoin support
  • Loading branch information
slowbackspace authored Jan 13, 2025
2 parents efc730d + 50fe0c9 commit ccccc78
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"drep",
"dreps",
"emurgo",
"filecoin",
"id",
"io",
"ipfs",
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- support for filecoin pinning with `BlockFrostIPFS.pin(cid: string, options: {filecoin: boolean})` method

### Changed

- Dropped Byron support from `deriveAddress` util
- `isTestnet` parameter changed to `network` (mainnet/preprod/preview)
- Updated Cardano-Serialization-Lib to v13
- Updated Blockfrost OpenAPI to 0.1.71

### Fixed

- Return type for `BlockFrostIPFS.list` `BlockFrostIPFS.listByPath` methods

## [5.7.0] - 2024-11-05

### Added
Expand Down
3 changes: 3 additions & 0 deletions src/BlockFrostIPFS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class BlockFrostIPFS {

this.apiUrl = `${apiBase}/v${this.options.version}`;

this.apiUrl =
this.options?.customBackend || `${apiBase}/v${this.options.version}`;

this.userAgent =
options?.userAgent ?? `${packageJson.name}@${packageJson.version}`;

Expand Down
7 changes: 6 additions & 1 deletion src/endpoints/ipfs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ export async function gateway(
export async function pin(
this: BlockFrostIPFS,
path: string,
options?: { filecoin?: boolean },
): Promise<PinResponse> {
try {
const res = await this.instance.post<PinResponse>(`ipfs/pin/add/${path}`);
const res = await this.instance.post<PinResponse>(`ipfs/pin/add/${path}`, {
searchParams: {
...(options?.filecoin !== undefined && { filecoin: options.filecoin }),
},
});
return res.body;
} catch (error) {
throw handleError(error);
Expand Down

0 comments on commit ccccc78

Please sign in to comment.