Skip to content

Commit

Permalink
Merge pull request #291 from blockfrost/feat/required-signers
Browse files Browse the repository at this point in the history
feat: required signers (extra tx witnesses)
  • Loading branch information
vladimirvolek authored Jul 18, 2024
2 parents 8099a5b + 65251af commit ab8f8dd
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 19 deletions.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/cbor-npm-8.1.0-c1a4d6266a-fc6c6d4f8d.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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

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.60",
"@blockfrost/openapi": "0.1.64",
"@emurgo/cardano-serialization-lib-nodejs": "^11.5.0",
"@emurgo/cip14-js": "3.0.1",
"bottleneck": "^2.19.5",
Expand Down
2 changes: 2 additions & 0 deletions src/BlockFrostAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ import {
txsMirs,
txsMetadata,
txsRedeemers,
txsRequiredSigners,
txSubmit,
} from './endpoints/api/txs';
import {
Expand Down Expand Up @@ -329,6 +330,7 @@ class BlockFrostAPI {
txsMirs = txsMirs;
txsMetadata = txsMetadata;
txsRedeemers = txsRedeemers;
txsRequiredSigners = txsRequiredSigners;
txSubmit = txSubmit;

network = network;
Expand Down
22 changes: 22 additions & 0 deletions src/endpoints/api/txs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<components['schemas']['tx_content_required_signers']> {
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}
Expand Down
21 changes: 21 additions & 0 deletions test/fixtures/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
34 changes: 17 additions & 17 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.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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ab8f8dd

Please sign in to comment.