diff --git a/.vscode/settings.json b/.vscode/settings.json index d57d4141..3a4d2be0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,6 +15,7 @@ "delegators", "deregistrations", "emurgo", + "filecoin", "id", "io", "ipfs", diff --git a/.yarn/cache/@blockfrost-openapi-npm-0.1.64-f292412f31-85708d9cd5.zip b/.yarn/cache/@blockfrost-openapi-npm-0.1.64-f292412f31-85708d9cd5.zip deleted file mode 100644 index 6527443b..00000000 Binary files a/.yarn/cache/@blockfrost-openapi-npm-0.1.64-f292412f31-85708d9cd5.zip and /dev/null differ diff --git a/.yarn/cache/@blockfrost-openapi-npm-0.1.66-beta.0-ca9829c65e-1e2b93469e.zip b/.yarn/cache/@blockfrost-openapi-npm-0.1.66-beta.0-ca9829c65e-1e2b93469e.zip new file mode 100644 index 00000000..7c6464f9 Binary files /dev/null and b/.yarn/cache/@blockfrost-openapi-npm-0.1.66-beta.0-ca9829c65e-1e2b93469e.zip differ diff --git a/CHANGELOG.MD b/CHANGELOG.MD index dad4de0e..fcabd45b 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -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 diff --git a/package.json b/package.json index b6e9ecba..40b7ca94 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/endpoints/ipfs/index.ts b/src/endpoints/ipfs/index.ts index 9570a963..520121bd 100644 --- a/src/endpoints/ipfs/index.ts +++ b/src/endpoints/ipfs/index.ts @@ -73,9 +73,14 @@ export async function gateway( export async function pin( this: BlockFrostIPFS, path: string, + options?: { filecoin?: boolean }, ): Promise { try { - const res = await this.instance.post(`ipfs/pin/add/${path}`); + const res = await this.instance.post(`ipfs/pin/add/${path}`, { + searchParams: { + ...(options?.filecoin !== undefined && { filecoin: options.filecoin }), + }, + }); return res.body; } catch (error) { throw handleError(error); diff --git a/src/types/ipfs.ts b/src/types/ipfs.ts index 5423b1fa..068b9262 100644 --- a/src/types/ipfs.ts +++ b/src/types/ipfs.ts @@ -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']; diff --git a/yarn.lock b/yarn.lock index c49f5d55..ede4ff4e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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