From 67ba3d4f48e6ce8e955c08fd75cbf009786c0160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20C=C3=A1rdenas?= Date: Wed, 29 Nov 2023 11:00:48 -0600 Subject: [PATCH] fix: upgrade chainhook client to v1.4.2 (#277) --- package-lock.json | 43 ++++++++++++++++++++++----- package.json | 2 +- src/chainhook/server.ts | 9 +++--- src/env.ts | 16 +++++----- src/pg/pg-store.ts | 47 +---------------------------- tests/cache.test.ts | 7 +++++ tests/helpers.ts | 7 +---- tests/inscriptions.test.ts | 61 ++++++++++++++++++++++++++++++++++++-- tests/sats.test.ts | 5 ++-- tests/server.test.ts | 26 +++++++++++----- tests/stats.test.ts | 1 + tests/status.test.ts | 3 +- 12 files changed, 142 insertions(+), 85 deletions(-) diff --git a/package-lock.json b/package-lock.json index 479f269c..60ed95e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@fastify/swagger": "^8.3.1", "@fastify/type-provider-typebox": "^3.2.0", "@hirosystems/api-toolkit": "^1.3.1", - "@hirosystems/chainhook-client": "^1.4.1", + "@hirosystems/chainhook-client": "^1.4.2", "@semantic-release/changelog": "^6.0.3", "@semantic-release/commit-analyzer": "^10.0.4", "@semantic-release/git": "^10.0.1", @@ -95,6 +95,35 @@ "node": ">=18" } }, + "../chainhook/components/client/typescript": { + "name": "@hirosystems/chainhook-client", + "version": "1.4.2", + "extraneous": true, + "license": "Apache 2.0", + "dependencies": { + "@fastify/type-provider-typebox": "^3.2.0", + "fastify": "^4.15.0", + "pino": "^8.11.0", + "undici": "^5.21.2" + }, + "devDependencies": { + "@stacks/eslint-config": "^1.2.0", + "@types/jest": "^29.5.0", + "@types/node": "^18.15.7", + "@typescript-eslint/eslint-plugin": "^5.56.0", + "@typescript-eslint/parser": "^5.56.0", + "babel-jest": "^29.5.0", + "eslint": "^8.36.0", + "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-tsdoc": "^0.2.17", + "jest": "^29.5.0", + "prettier": "^2.8.7", + "rimraf": "^4.4.1", + "ts-jest": "^29.0.5", + "ts-node": "^10.9.1", + "typescript": "^5.0.2" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -1270,9 +1299,9 @@ } }, "node_modules/@hirosystems/chainhook-client": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@hirosystems/chainhook-client/-/chainhook-client-1.4.1.tgz", - "integrity": "sha512-ZiOk8RlLgtyDc9oRDkWHXGbzhRIMyxRIAi0OHZG/mt5yu3qNzYZ7OmK4txShxAytwDb3okMZEwPK/CrsoLPLXA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@hirosystems/chainhook-client/-/chainhook-client-1.4.2.tgz", + "integrity": "sha512-cz92ikNHwWi/ypwnitk4anOvuL7KoHLKRSQidDYyM8Pnar0yinir3GZm4q7/QCoDij0PIMg50aE7KCCzLrEhjA==", "dependencies": { "@fastify/type-provider-typebox": "^3.2.0", "fastify": "^4.15.0", @@ -19714,9 +19743,9 @@ } }, "@hirosystems/chainhook-client": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@hirosystems/chainhook-client/-/chainhook-client-1.4.1.tgz", - "integrity": "sha512-ZiOk8RlLgtyDc9oRDkWHXGbzhRIMyxRIAi0OHZG/mt5yu3qNzYZ7OmK4txShxAytwDb3okMZEwPK/CrsoLPLXA==", + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@hirosystems/chainhook-client/-/chainhook-client-1.4.2.tgz", + "integrity": "sha512-cz92ikNHwWi/ypwnitk4anOvuL7KoHLKRSQidDYyM8Pnar0yinir3GZm4q7/QCoDij0PIMg50aE7KCCzLrEhjA==", "requires": { "@fastify/type-provider-typebox": "^3.2.0", "fastify": "^4.15.0", diff --git a/package.json b/package.json index 723f2e3d..e9abf85d 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@fastify/swagger": "^8.3.1", "@fastify/type-provider-typebox": "^3.2.0", "@hirosystems/api-toolkit": "^1.3.1", - "@hirosystems/chainhook-client": "^1.4.1", + "@hirosystems/chainhook-client": "^1.4.2", "@semantic-release/changelog": "^6.0.3", "@semantic-release/commit-analyzer": "^10.0.4", "@semantic-release/git": "^10.0.1", diff --git a/src/chainhook/server.ts b/src/chainhook/server.ts index d5e6dec2..34ced05e 100644 --- a/src/chainhook/server.ts +++ b/src/chainhook/server.ts @@ -10,7 +10,7 @@ import { } from '@hirosystems/chainhook-client'; import { logger } from '@hirosystems/api-toolkit'; -export const CHAINHOOK_BASE_PATH = `http://${ENV.CHAINHOOK_NODE_RPC_HOST}:${ENV.CHAINHOOK_NODE_RPC_PORT}`; +export const ORDHOOK_BASE_PATH = `http://${ENV.CHAINHOOK_NODE_RPC_HOST}:${ENV.CHAINHOOK_NODE_RPC_PORT}`; export const PREDICATE_UUID = randomUUID(); /** @@ -48,11 +48,12 @@ export async function startChainhookServer(args: { db: PgStore }): Promise { await args.db.updateInscriptions(payload); }); diff --git a/src/env.ts b/src/env.ts index c1de7e08..88f64f65 100644 --- a/src/env.ts +++ b/src/env.ts @@ -5,8 +5,8 @@ const schema = Type.Object({ /** * Run mode for this service. Allows you to control how the API runs, typically in an auto-scaled * environment. Available values are: - * * `default`: Runs the chainhook server and the REST API server (this is the default) - * * `writeonly`: Runs only the chainhook server + * * `default`: Runs the ordhook server and the REST API server (this is the default) + * * `writeonly`: Runs only the ordhook server * * `readonly`: Runs only the REST API server */ RUN_MODE: Type.Enum( @@ -20,24 +20,24 @@ const schema = Type.Object({ API_PORT: Type.Number({ default: 3000, minimum: 0, maximum: 65535 }), /** Port in which to serve the Admin RPC interface */ ADMIN_RPC_PORT: Type.Number({ default: 3001, minimum: 0, maximum: 65535 }), - /** Port in which to receive chainhook events */ + /** Port in which to receive ordhook events */ EVENT_PORT: Type.Number({ default: 3099, minimum: 0, maximum: 65535 }), /** Event server body limit (bytes) */ EVENT_SERVER_BODY_LIMIT: Type.Integer({ default: 20971520 }), - /** Hostname that will be reported to the chainhook node so it can call us back with events */ + /** Hostname that will be reported to the ordhook node so it can call us back with events */ EXTERNAL_HOSTNAME: Type.String({ default: '127.0.0.1' }), - /** Hostname of the chainhook node we'll use to register predicates */ + /** Hostname of the ordhook node we'll use to register predicates */ CHAINHOOK_NODE_RPC_HOST: Type.String({ default: '127.0.0.1' }), - /** Control port of the chainhook node */ + /** Control port of the ordhook node */ CHAINHOOK_NODE_RPC_PORT: Type.Number({ default: 20456, minimum: 0, maximum: 65535 }), /** - * Authorization token that the chainhook node must send with every event to make sure it's + * Authorization token that the ordhook node must send with every event to make sure it's * coming from the valid instance */ CHAINHOOK_NODE_AUTH_TOKEN: Type.String(), /** - * Register chainhook predicates automatically when the API is first launched. Set this to `false` + * Register ordhook predicates automatically when the API is first launched. Set this to `false` * if you're configuring your predicates manually for any reason. */ CHAINHOOK_AUTO_PREDICATE_REGISTRATION: Type.Boolean({ default: true }), diff --git a/src/pg/pg-store.ts b/src/pg/pg-store.ts index 8e7a16db..db533410 100644 --- a/src/pg/pg-store.ts +++ b/src/pg/pg-store.ts @@ -106,11 +106,6 @@ export class PgStore extends BasePgStore { const genesis_id = operation.inscription_revealed.inscription_id; await this.rollBackInscription({ genesis_id, number, block_height }); } - if (operation.cursed_inscription_revealed) { - const number = operation.cursed_inscription_revealed.inscription_number; - const genesis_id = operation.cursed_inscription_revealed.inscription_id; - await this.rollBackInscription({ genesis_id, number, block_height }); - } if (operation.inscription_transferred) { const genesis_id = operation.inscription_transferred.inscription_id; const satpoint = parseSatPoint( @@ -160,47 +155,7 @@ export class PgStore extends BasePgStore { number: reveal.inscription_number, content: removeNullBytes(reveal.content_bytes), fee: reveal.inscription_fee.toString(), - curse_type: null, - sat_ordinal: reveal.ordinal_number.toString(), - sat_rarity: satoshi.rarity, - sat_coinbase_height: satoshi.blockHeight, - recursive: recursive_refs.length > 0, - }, - location: { - block_hash, - block_height, - tx_id, - tx_index: reveal.tx_index, - block_transfer_index: null, - genesis_id: reveal.inscription_id, - address: reveal.inscriber_address, - output: `${satpoint.tx_id}:${satpoint.vout}`, - offset: satpoint.offset ?? null, - prev_output: null, - prev_offset: null, - value: reveal.inscription_output_value.toString(), - timestamp: event.timestamp, - transfer_type: DbLocationTransferType.transferred, - }, - recursive_refs, - }); - } - if (operation.cursed_inscription_revealed) { - const reveal = operation.cursed_inscription_revealed; - const satoshi = new OrdinalSatoshi(reveal.ordinal_number); - const satpoint = parseSatPoint(reveal.satpoint_post_inscription); - const recursive_refs = getInscriptionRecursion(reveal.content_bytes); - const contentType = removeNullBytes(reveal.content_type); - writes.push({ - inscription: { - genesis_id: reveal.inscription_id, - mime_type: contentType.split(';')[0], - content_type: contentType, - content_length: reveal.content_length, - number: reveal.inscription_number, - content: removeNullBytes(reveal.content_bytes), - fee: reveal.inscription_fee.toString(), - curse_type: JSON.stringify(reveal.curse_type), + curse_type: reveal.curse_type ? JSON.stringify(reveal.curse_type) : null, sat_ordinal: reveal.ordinal_number.toString(), sat_rarity: satoshi.rarity, sat_coinbase_height: satoshi.blockHeight, diff --git a/tests/cache.test.ts b/tests/cache.test.ts index 29c890eb..c188683f 100644 --- a/tests/cache.test.ts +++ b/tests/cache.test.ts @@ -41,6 +41,7 @@ describe('ETag cache', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(block); @@ -172,6 +173,7 @@ describe('ETag cache', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(block1); @@ -196,6 +198,7 @@ describe('ETag cache', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(block2); @@ -267,6 +270,7 @@ describe('ETag cache', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(block1); @@ -310,6 +314,7 @@ describe('ETag cache', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(block2); @@ -345,6 +350,7 @@ describe('ETag cache', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(block1); @@ -388,6 +394,7 @@ describe('ETag cache', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(block2); diff --git a/tests/helpers.ts b/tests/helpers.ts index e57966e6..fe26f3e9 100644 --- a/tests/helpers.ts +++ b/tests/helpers.ts @@ -1,6 +1,5 @@ import { TypeBoxTypeProvider } from '@fastify/type-provider-typebox'; import { - BitcoinCursedInscriptionRevealed, BitcoinEvent, BitcoinInscriptionRevealed, BitcoinInscriptionTransferred, @@ -91,11 +90,6 @@ export class TestChainhookPayloadBuilder { return this; } - cursedInscriptionRevealed(args: BitcoinCursedInscriptionRevealed): this { - this.lastBlockTx.metadata.ordinal_operations.push({ cursed_inscription_revealed: args }); - return this; - } - inscriptionTransferred(args: BitcoinInscriptionTransferred): this { this.lastBlockTx.metadata.ordinal_operations.push({ inscription_transferred: args }); return this; @@ -137,6 +131,7 @@ export function brc20Reveal(args: { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }; return reveal; } diff --git a/tests/inscriptions.test.ts b/tests/inscriptions.test.ts index 4fbf4255..4e0cc04c 100644 --- a/tests/inscriptions.test.ts +++ b/tests/inscriptions.test.ts @@ -53,6 +53,7 @@ describe('/inscriptions', () => { tx_index: 0, inscription_input_index: 0, transfers_pre_inscription: 0, + curse_type: null, }) .build() ); @@ -84,6 +85,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -160,6 +162,7 @@ describe('/inscriptions', () => { tx_index: 0, inscription_input_index: 0, transfers_pre_inscription: 0, + curse_type: null, }) .transaction({ hash: '0xf351d86c6e6cae3c64e297e7463095732f216875bcc1f3c03f950a492bb25421', @@ -181,6 +184,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -218,6 +222,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -297,6 +302,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -356,7 +362,7 @@ describe('/inscriptions', () => { .transaction({ hash: '0x38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', }) - .cursedInscriptionRevealed({ + .inscriptionRevealed({ content_bytes: '0x48656C6C6F', content_type: 'image/png', content_length: 5, @@ -450,6 +456,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -594,6 +601,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -681,7 +689,7 @@ describe('/inscriptions', () => { .transaction({ hash: '0x38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', }) - .cursedInscriptionRevealed({ + .inscriptionRevealed({ content_bytes: '0x48656C6C6F', content_type: 'image/png', content_length: 5, @@ -845,6 +853,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1008,6 +1017,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .transaction({ hash: '7ac73ecd01b9da4a7eab904655416dbfe8e03f193e091761b5a63ad0963570cd', @@ -1029,6 +1039,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 1, + curse_type: null, }) .build() ); @@ -1358,6 +1369,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1389,6 +1401,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1486,6 +1499,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1517,6 +1531,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1631,6 +1646,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1662,6 +1678,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1722,6 +1739,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1753,6 +1771,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1817,6 +1836,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1848,6 +1868,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1908,6 +1929,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -1939,6 +1961,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2001,6 +2024,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2045,6 +2069,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2076,6 +2101,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2122,6 +2148,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2153,6 +2180,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2207,6 +2235,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2238,6 +2267,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2292,6 +2322,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2323,6 +2354,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2377,6 +2409,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2408,6 +2441,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2461,6 +2495,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2492,6 +2527,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2526,6 +2562,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }; await db.updateInscriptions( new TestChainhookPayloadBuilder() @@ -2569,6 +2606,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2727,6 +2765,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2760,6 +2799,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2818,6 +2858,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2832,7 +2873,7 @@ describe('/inscriptions', () => { .transaction({ hash: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', }) - .cursedInscriptionRevealed({ + .inscriptionRevealed({ content_bytes: `0x${Buffer.from( 'Hello /content/9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0' ).toString('hex')}`, @@ -2910,6 +2951,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -2940,6 +2982,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(genesis2); @@ -3008,6 +3051,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3039,6 +3083,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3070,6 +3115,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3126,6 +3172,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3157,6 +3204,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3188,6 +3236,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3244,6 +3293,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3275,6 +3325,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3306,6 +3357,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3362,6 +3414,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3393,6 +3446,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -3424,6 +3478,7 @@ describe('/inscriptions', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); diff --git a/tests/sats.test.ts b/tests/sats.test.ts index 723d23c7..4d422c76 100644 --- a/tests/sats.test.ts +++ b/tests/sats.test.ts @@ -62,6 +62,7 @@ describe('/sats', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -81,7 +82,7 @@ describe('/sats', () => { .apply() .block({ height: 775617 }) .transaction({ hash: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc' }) - .cursedInscriptionRevealed({ + .inscriptionRevealed({ content_bytes: '0x48656C6C6F', content_type: 'image/png', content_length: 5, @@ -113,7 +114,7 @@ describe('/sats', () => { .transaction({ hash: 'b9cd9489fe30b81d007f753663d12766f1368721a87f4c69056c8215caa57993', }) - .cursedInscriptionRevealed({ + .inscriptionRevealed({ content_bytes: '0x48656C6C6F', content_type: 'image/png', content_length: 5, diff --git a/tests/server.test.ts b/tests/server.test.ts index b375d741..8b0132c9 100644 --- a/tests/server.test.ts +++ b/tests/server.test.ts @@ -50,6 +50,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }; // Apply @@ -67,7 +68,7 @@ describe('EventServer', () => { .build(); const response = await server['fastify'].inject({ method: 'POST', - url: `/chainhook/${PREDICATE_UUID}`, + url: `/payload`, headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload1, }); @@ -127,7 +128,7 @@ describe('EventServer', () => { .build(); const response2 = await server['fastify'].inject({ method: 'POST', - url: `/chainhook/${PREDICATE_UUID}`, + url: `/payload`, headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload2, }); @@ -167,6 +168,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -200,7 +202,7 @@ describe('EventServer', () => { .build(); const response = await server['fastify'].inject({ method: 'POST', - url: `/chainhook/${PREDICATE_UUID}`, + url: `/payload`, headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload1, }); @@ -260,7 +262,7 @@ describe('EventServer', () => { .build(); const response2 = await server['fastify'].inject({ method: 'POST', - url: `/chainhook/${PREDICATE_UUID}`, + url: `/payload`, headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload2, }); @@ -301,6 +303,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 995, + curse_type: null, }) .transaction({ hash: '7edaa48337a94da327b6262830505f116775a32db5ad4ad46e87ecea33f21bac', @@ -357,6 +360,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -387,12 +391,13 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await expect(db.updateInscriptions(errorPayload)).rejects.toThrow(BadPayloadRequestError); const response = await server['fastify'].inject({ method: 'POST', - url: `/chainhook/${PREDICATE_UUID}`, + url: `/payload`, headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: errorPayload, }); @@ -428,6 +433,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -458,6 +464,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .transaction({ hash: '6891d374a17ba85f6b5514f2f7edc301c1c860284dff5a5c6e88ab3a20fcd8a5', @@ -479,12 +486,13 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await expect(db.updateInscriptions(errorPayload)).rejects.toThrow(BadPayloadRequestError); const response = await server['fastify'].inject({ method: 'POST', - url: `/chainhook/${PREDICATE_UUID}`, + url: `/payload`, headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: errorPayload, }); @@ -520,6 +528,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -550,6 +559,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .transaction({ hash: '6891d374a17ba85f6b5514f2f7edc301c1c860284dff5a5c6e88ab3a20fcd8a5', @@ -571,6 +581,7 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await expect(db.updateInscriptions(unboundPayload)).resolves.not.toThrow( @@ -606,13 +617,14 @@ describe('EventServer', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build(); await db.updateInscriptions(payload); const response = await server['fastify'].inject({ method: 'POST', - url: `/chainhook/${PREDICATE_UUID}`, + url: `/payload`, headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload, }); diff --git a/tests/stats.test.ts b/tests/stats.test.ts index bc7119b1..f4850c17 100644 --- a/tests/stats.test.ts +++ b/tests/stats.test.ts @@ -223,6 +223,7 @@ function testRevealApply(blockHeight: number, numbers: number[]) { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }); } return block.build(); diff --git a/tests/status.test.ts b/tests/status.test.ts index 50596a48..18d5fcb0 100644 --- a/tests/status.test.ts +++ b/tests/status.test.ts @@ -55,6 +55,7 @@ describe('Status', () => { inscription_input_index: 0, transfers_pre_inscription: 0, tx_index: 0, + curse_type: null, }) .build() ); @@ -63,7 +64,7 @@ describe('Status', () => { .apply() .block({ height: 791975 }) .transaction({ hash: 'a98d7055a77fa0b96cc31e30bb8bacf777382d1b67f1b7eca6f2014e961591c8' }) - .cursedInscriptionRevealed({ + .inscriptionRevealed({ content_bytes: '0x48656C6C6F', content_type: 'text/plain;charset=utf-8', content_length: 5,