mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-06-14 00:22:19 +08:00
feat: support cursed inscriptions in chainhook client
This commit is contained in:
4
components/client/typescript/package-lock.json
generated
4
components/client/typescript/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@hirosystems/chainhook-client",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@hirosystems/chainhook-client",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@fastify/type-provider-typebox": "^3.0.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hirosystems/chainhook-client",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Chainhook TypeScript client",
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
|
||||
@@ -33,7 +33,7 @@ export class ChainhookEventObserver {
|
||||
* @param predicates - Predicates to register
|
||||
* @param callback - Function to handle every Chainhook event payload sent by the node
|
||||
*/
|
||||
async start(predicates: [ServerPredicate], callback: OnEventCallback): Promise<void> {
|
||||
async start(predicates: ServerPredicate[], callback: OnEventCallback): Promise<void> {
|
||||
if (this.fastify) return;
|
||||
this.fastify = await buildServer(this.serverOpts, this.chainhookOpts, predicates, callback);
|
||||
await this.fastify.listen({ host: this.serverOpts.hostname, port: this.serverOpts.port });
|
||||
|
||||
@@ -33,7 +33,27 @@ export const BitcoinInscriptionTransferredSchema = Type.Object({
|
||||
});
|
||||
export type BitcoinInscriptionTransferred = Static<typeof BitcoinInscriptionTransferredSchema>;
|
||||
|
||||
export const BitcoinCursedInscriptionRevealedSchema = Type.Object({
|
||||
content_bytes: Type.String(),
|
||||
content_type: Type.String(),
|
||||
content_length: Type.Integer(),
|
||||
inscription_number: Type.Integer(),
|
||||
inscription_fee: Type.Integer(),
|
||||
inscription_id: Type.String(),
|
||||
inscription_output_value: Type.Integer(),
|
||||
inscriber_address: Type.String(),
|
||||
ordinal_number: Type.Integer(),
|
||||
ordinal_block_height: Type.Integer(),
|
||||
ordinal_offset: Type.Integer(),
|
||||
satpoint_post_inscription: Type.String(),
|
||||
curse_type: Type.String(),
|
||||
});
|
||||
export type BitcoinCursedInscriptionRevealed = Static<
|
||||
typeof BitcoinCursedInscriptionRevealedSchema
|
||||
>;
|
||||
|
||||
export const BitcoinOrdinalOperationSchema = Type.Object({
|
||||
cursed_inscription_revealed: Type.Optional(BitcoinCursedInscriptionRevealedSchema),
|
||||
inscription_revealed: Type.Optional(BitcoinInscriptionRevealedSchema),
|
||||
inscription_transferred: Type.Optional(BitcoinInscriptionTransferredSchema),
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ export type ServerPredicate = Static<typeof ServerPredicateSchema>;
|
||||
export async function buildServer(
|
||||
serverOpts: ServerOptions,
|
||||
chainhookOpts: ChainhookNodeOptions,
|
||||
predicates: [ServerPredicate],
|
||||
predicates: ServerPredicate[],
|
||||
callback: OnEventCallback
|
||||
) {
|
||||
async function waitForNode(this: FastifyInstance) {
|
||||
|
||||
Reference in New Issue
Block a user