diff --git a/.yarn/cache/@blockfrost-openapi-npm-0.1.60-64f77da01a-1f857bda8d.zip b/.yarn/cache/@blockfrost-openapi-npm-0.1.60-64f77da01a-1f857bda8d.zip deleted file mode 100644 index ba067ea4..00000000 Binary files a/.yarn/cache/@blockfrost-openapi-npm-0.1.60-64f77da01a-1f857bda8d.zip and /dev/null differ 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 new file mode 100644 index 00000000..6527443b Binary files /dev/null and b/.yarn/cache/@blockfrost-openapi-npm-0.1.64-f292412f31-85708d9cd5.zip differ diff --git a/.yarn/cache/cbor-npm-8.1.0-c1a4d6266a-fc6c6d4f8d.zip b/.yarn/cache/cbor-npm-8.1.0-c1a4d6266a-fc6c6d4f8d.zip deleted file mode 100644 index 82db1fcb..00000000 Binary files a/.yarn/cache/cbor-npm-8.1.0-c1a4d6266a-fc6c6d4f8d.zip and /dev/null differ diff --git a/.yarn/cache/cbor-npm-9.0.2-dcdfe6a47e-a64f7d4daf.zip b/.yarn/cache/cbor-npm-9.0.2-dcdfe6a47e-a64f7d4daf.zip new file mode 100644 index 00000000..f67af8cc Binary files /dev/null and b/.yarn/cache/cbor-npm-9.0.2-dcdfe6a47e-a64f7d4daf.zip differ diff --git a/.yarn/cache/yaml-npm-2.2.1-b7f7f5e84d-2e443fed32.zip b/.yarn/cache/yaml-npm-2.2.1-b7f7f5e84d-2e443fed32.zip deleted file mode 100644 index e26fda6b..00000000 Binary files a/.yarn/cache/yaml-npm-2.2.1-b7f7f5e84d-2e443fed32.zip and /dev/null differ diff --git a/.yarn/cache/yaml-npm-2.3.4-8bb6dc2c0d-f8207ce430.zip b/.yarn/cache/yaml-npm-2.3.4-8bb6dc2c0d-f8207ce430.zip new file mode 100644 index 00000000..e6c7a670 Binary files /dev/null and b/.yarn/cache/yaml-npm-2.3.4-8bb6dc2c0d-f8207ce430.zip differ diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 9d5d14e3..dad4de0e 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - 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) ## [5.5.0] - 2023-12-20 diff --git a/package.json b/package.json index e51985e6..b6e9ecba 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "coverage-ci": "vitest run --coverage" }, "dependencies": { - "@blockfrost/openapi": "0.1.60", + "@blockfrost/openapi": "0.1.64", "@emurgo/cardano-serialization-lib-nodejs": "^11.5.0", "@emurgo/cip14-js": "3.0.1", "bottleneck": "^2.19.5", diff --git a/src/BlockFrostAPI.ts b/src/BlockFrostAPI.ts index 05327578..55cbd45d 100644 --- a/src/BlockFrostAPI.ts +++ b/src/BlockFrostAPI.ts @@ -123,6 +123,7 @@ import { txsMirs, txsMetadata, txsRedeemers, + txsRequiredSigners, txSubmit, } from './endpoints/api/txs'; import { @@ -329,6 +330,7 @@ class BlockFrostAPI { txsMirs = txsMirs; txsMetadata = txsMetadata; txsRedeemers = txsRedeemers; + txsRequiredSigners = txsRequiredSigners; txSubmit = txSubmit; network = network; diff --git a/src/endpoints/api/txs/index.ts b/src/endpoints/api/txs/index.ts index d307c87c..72ec8374 100644 --- a/src/endpoints/api/txs/index.ts +++ b/src/endpoints/api/txs/index.ts @@ -244,6 +244,28 @@ export async function txsRedeemers( } } +/** + * Obtains extra transaction witnesses. + * @see {@link https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1txs~1%7Bhash%7D~required_signers/get | API docs for Transaction redeemers} + * + * @param hash - Transaction hash + * @returns Extra transaction witnesses + * + */ +export async function txsRequiredSigners( + this: BlockFrostAPI, + hash: string, +): Promise { + try { + const res = await this.instance< + components['schemas']['tx_content_required_signers'] + >(`txs/${hash}/required_signers`); + return res.body; + } catch (error) { + throw handleError(error); + } +} + /** * Submits a transaction to the network. * @see {@link https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1tx~1submit/post | API docs for Transaction submit} diff --git a/test/fixtures/endpoints.ts b/test/fixtures/endpoints.ts index 835f97f1..37b7e832 100644 --- a/test/fixtures/endpoints.ts +++ b/test/fixtures/endpoints.ts @@ -517,6 +517,27 @@ export default [ endpointMock: [], response: [], }, + { + command: (SDK: BlockFrostAPI) => + SDK.txsRequiredSigners( + 'b024ad35c6309a71a8e613d8bfea2a8185d81eda379ca9128877adefcde1c515', + ), + path: mainnetUrl( + '/txs/b024ad35c6309a71a8e613d8bfea2a8185d81eda379ca9128877adefcde1c515/required_signers', + ), + endpointMock: [ + { + witness_hash: + 'db7685e2d763133630e1a4afdefc5752d4b1c9be6c102e71242fb06f', + }, + ], + response: [ + { + witness_hash: + 'db7685e2d763133630e1a4afdefc5752d4b1c9be6c102e71242fb06f', + }, + ], + }, { command: (SDK: BlockFrostAPI) => SDK.txsMetadata( diff --git a/yarn.lock b/yarn.lock index cf9de71b..c49f5d55 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.60" + "@blockfrost/openapi": "npm:0.1.64" "@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.60": - version: 0.1.60 - resolution: "@blockfrost/openapi@npm:0.1.60" +"@blockfrost/openapi@npm:0.1.64": + version: 0.1.64 + resolution: "@blockfrost/openapi@npm:0.1.64" dependencies: - ajv: "npm:^8.11.2" - cbor: "npm:^8.1.0" - yaml: "npm:^2.2.1" - checksum: 1f857bda8dc4759d0f11317cd99bf3037e44e3f7cc87518a2af956616155e1c09ca1c85a4e3c9c9258fb0229007337cff29803ab61aca9988bac9408c082e8b2 + ajv: "npm:^8.12.0" + cbor: "npm:^9.0.1" + yaml: "npm:^2.3.4" + checksum: 85708d9cd529e740572f439c6b92a6c44326f8d78af774dae3c4305faebe0ba9676fbea64e919b383ac6882e54128f02a977b9dff41c40c0dc6078f131392d63 languageName: node linkType: hard @@ -982,7 +982,7 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^8.11.2": +"ajv@npm:^8.12.0": version: 8.12.0 resolution: "ajv@npm:8.12.0" dependencies: @@ -1316,12 +1316,12 @@ __metadata: languageName: node linkType: hard -"cbor@npm:^8.1.0": - version: 8.1.0 - resolution: "cbor@npm:8.1.0" +"cbor@npm:^9.0.1": + version: 9.0.2 + resolution: "cbor@npm:9.0.2" dependencies: nofilter: "npm:^3.1.0" - checksum: fc6c6d4f8d14def3a0f2ef111f4fc14b3b0bc91d22ed8fd0eb005095c4699c723a45721e515d713571148d0d965ceeb771f4ad422953cb4e9658b379991b52c9 + checksum: a64f7d4dafed933adeafe7745e2ce9f39a2e669eba73db96de6bd1b39c2dbde4bdd51d0240beed179cc429a7dc8653c8d7c991c5addb9f4e0cee8cd167d87116 languageName: node linkType: hard @@ -4995,10 +4995,10 @@ __metadata: languageName: node linkType: hard -"yaml@npm:^2.2.1": - version: 2.2.1 - resolution: "yaml@npm:2.2.1" - checksum: 2e443fed323db4d5ae0c7134c6dbd30cb920e0c8f79a6ce78677731409af83ee2d74a09563fce01503a07f9a02274d42784d816f87294a53b47b955bc83dc655 +"yaml@npm:^2.3.4": + version: 2.3.4 + resolution: "yaml@npm:2.3.4" + checksum: f8207ce43065a22268a2806ea6a0fa3974c6fde92b4b2fa0082357e487bc333e85dc518910007e7ac001b532c7c84bd3eccb6c7757e94182b564028b0008f44b languageName: node linkType: hard