-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add required signers * fixup! Add required signers * tmp: bump openapi to beta.5 * chore: one liner transform * chore: array of objects * chore: add 404 * chore: fix fixtures * chore: bump tests * chore: stable blockfrost/openapi * fix: remove unnecessary fork for unpaged result --------- Co-authored-by: slowbackspace <[email protected]>
- Loading branch information
1 parent
536dddf
commit f55709b
Showing
53 changed files
with
255 additions
and
169 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-9.08 KB
.yarn/cache/@babel-helper-validator-identifier-npm-7.18.6-357e4653ab-e295254d61.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-101 KB
.yarn/cache/@blockfrost-openapi-npm-0.1.60-64f77da01a-2ab66de532.zip
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-10.8 KB
.yarn/cache/@jest-expect-utils-npm-29.3.1-97cd2f0a06-7f3b853eb1.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-70.9 KB
.yarn/cache/@sinclair-typebox-npm-0.24.51-cdde4a266f-fd0d855e74.zip
Binary file not shown.
Binary file added
BIN
+3.04 KB
.yarn/cache/@types-istanbul-lib-coverage-npm-2.0.6-2ea31fda9c-3feac423fd.zip
Binary file not shown.
Binary file removed
BIN
-4.14 KB
.yarn/cache/@types-istanbul-lib-report-npm-3.0.0-50de3e6b3b-656398b62d.zip
Binary file not shown.
Binary file added
BIN
+3.97 KB
.yarn/cache/@types-istanbul-lib-report-npm-3.0.3-a5c0ef4b88-b91e9b60f8.zip
Binary file not shown.
Binary file removed
BIN
-3.79 KB
.yarn/cache/@types-istanbul-reports-npm-3.0.1-770e825002-f1ad54bc68.zip
Binary file not shown.
Binary file added
BIN
+3.55 KB
.yarn/cache/@types-istanbul-reports-npm-3.0.4-1afa69db29-93eb188357.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-4.2 KB
.yarn/cache/@types-yargs-parser-npm-21.0.0-c8a3b32c52-b2f4c8d12a.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed
BIN
-10.4 KB
.yarn/cache/jest-matcher-utils-npm-29.3.1-5d9d00434d-311e8d9f1e.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { getSchemaForEndpoint } from '@blockfrost/openapi'; | ||
import { FastifyInstance, FastifyRequest } from 'fastify'; | ||
import { SQLQuery } from '../../../sql/index.js'; | ||
import * as QueryTypes from '../../../types/queries/tx.js'; | ||
import * as ResponseTypes from '../../../types/responses/tx.js'; | ||
import { getDbSync } from '../../../utils/database.js'; | ||
import { handle404 } from '@blockfrost/blockfrost-utils/lib/fastify.js'; | ||
|
||
async function route(fastify: FastifyInstance) { | ||
fastify.route({ | ||
url: '/txs/:hash/required_signers', | ||
method: 'GET', | ||
schema: getSchemaForEndpoint('/txs/{hash}/required_signers'), | ||
handler: async (request: FastifyRequest<QueryTypes.RequestParameters>, reply) => { | ||
const clientDbSync = await getDbSync(fastify); | ||
|
||
try { | ||
const query404 = await clientDbSync.query<QueryTypes.ResultFound>(SQLQuery.get('txs_404'), [ | ||
request.params.hash, | ||
]); | ||
|
||
if (query404.rows.length === 0) { | ||
clientDbSync.release(); | ||
return handle404(reply); | ||
} | ||
|
||
const { rows }: { rows: ResponseTypes.TxWitnesses } = | ||
await clientDbSync.query<QueryTypes.TxWitnesses>(SQLQuery.get('txs_hash_wits'), [ | ||
request.params.hash, | ||
]); | ||
|
||
clientDbSync.release(); | ||
|
||
if (rows.length === 0) { | ||
return reply.send([]); | ||
} | ||
|
||
return reply.send(rows); | ||
} catch (error) { | ||
if (clientDbSync) { | ||
clientDbSync.release(); | ||
} | ||
throw error; | ||
} | ||
}, | ||
}); | ||
} | ||
|
||
export default route; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT encode(wit.hash, 'hex') AS "witness_hash" | ||
FROM tx | ||
JOIN extra_key_witness wit ON (wit.tx_id = tx.id) | ||
WHERE encode(tx.hash, 'hex') = $1 | ||
ORDER BY wit.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.