Skip to content

Commit

Permalink
feat: support cursed inscriptions in chainhook client
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Jun 21, 2023
1 parent ea1ff9a commit d7cc5a4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions components/client/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/client/typescript/package.json
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion components/client/typescript/src/index.ts
Expand Up @@ -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 });
Expand Down
20 changes: 20 additions & 0 deletions components/client/typescript/src/schemas/bitcoin/payload.ts
Expand Up @@ -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),
});
Expand Down
2 changes: 1 addition & 1 deletion components/client/typescript/src/server.ts
Expand Up @@ -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) {
Expand Down

0 comments on commit d7cc5a4

Please sign in to comment.