Skip to content

Commit

Permalink
feat: podsi and filecoin support
Browse files Browse the repository at this point in the history
  • Loading branch information
slowbackspace committed Aug 20, 2024
1 parent ab8f8dd commit e3aae63
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 24 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"delegators",
"deregistrations",
"emurgo",
"filecoin",
"id",
"io",
"ipfs",
Expand Down
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- added the `gotOptions` property to the `BlockFrostAPI` class. This property can be passed during the initialization of the `BlockFrostAPI` object. For more details, refer to the [Got Options documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md).
- `txsRequiredSigners` for retrieving required signers (extra transaction witnesses)
- `txsRequiredSigners` for retrieving required signers (extra transaction witnesses)
- support for filecoin pinning with `BlockFrostIPFS.pin(cid: string, options: {filecoin: boolean})` method

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

## [5.5.0] - 2023-12-20

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"coverage-ci": "vitest run --coverage"
},
"dependencies": {
"@blockfrost/openapi": "0.1.64",
"@blockfrost/openapi": "0.1.66-beta.0",
"@emurgo/cardano-serialization-lib-nodejs": "^11.5.0",
"@emurgo/cip14-js": "3.0.1",
"bottleneck": "^2.19.5",
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
24 changes: 7 additions & 17 deletions src/types/ipfs.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
type State = 'queued' | 'pinned' | 'unpinned' | 'failed' | 'gc';
import { paths } from '@blockfrost/openapi';

export type AddResponse = {
name: string;
ipfs_hash: string;
size: number;
};
export type AddResponse =
paths['/ipfs/add']['post']['responses']['200']['content']['application/json'];

export type PinResponse = {
ipfs_hash: string;
state: State;
};
export type PinResponse =
paths['/ipfs/pin/add/{IPFS_path}']['post']['responses']['200']['content']['application/json'];

export type ListResponse = {
time_created: number;
time_pinned: number;
ipfs_hash: string;
size: string;
state: State;
};
export type ListResponse =
paths['/ipfs/pin/list']['get']['responses']['200']['content']['application/json'];
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@blockfrost/blockfrost-js@workspace:."
dependencies:
"@blockfrost/openapi": "npm:0.1.64"
"@blockfrost/openapi": "npm:0.1.66-beta.0"
"@emurgo/cardano-serialization-lib-nodejs": "npm:^11.5.0"
"@emurgo/cip14-js": "npm:3.0.1"
"@types/json-bigint": "npm:^1.0.2"
Expand Down Expand Up @@ -63,14 +63,14 @@ __metadata:
languageName: unknown
linkType: soft

"@blockfrost/openapi@npm:0.1.64":
version: 0.1.64
resolution: "@blockfrost/openapi@npm:0.1.64"
"@blockfrost/openapi@npm:0.1.66-beta.0":
version: 0.1.66-beta.0
resolution: "@blockfrost/openapi@npm:0.1.66-beta.0"
dependencies:
ajv: "npm:^8.12.0"
cbor: "npm:^9.0.1"
yaml: "npm:^2.3.4"
checksum: 85708d9cd529e740572f439c6b92a6c44326f8d78af774dae3c4305faebe0ba9676fbea64e919b383ac6882e54128f02a977b9dff41c40c0dc6078f131392d63
checksum: 1e2b93469e5a7ceed9e628b201fa60dcab56c03ae4ab7d3498fa66090438086cd72a1b3e57d99471987d7daf41e48fea83a6e1f44c35a06c31b621a088752d2d
languageName: node
linkType: hard

Expand Down

0 comments on commit e3aae63

Please sign in to comment.