diff --git a/migrations/1676395230930_inscriptions.ts b/migrations/1676395230930_inscriptions.ts index 662bae5e..4d0dc6e0 100644 --- a/migrations/1676395230930_inscriptions.ts +++ b/migrations/1676395230930_inscriptions.ts @@ -34,7 +34,7 @@ export function up(pgm: MigrationBuilder): void { notNull: true, }, fee: { - type: 'bigint', + type: 'numeric', notNull: true, }, }); diff --git a/migrations/1677284495299_locations.ts b/migrations/1677284495299_locations.ts index 2d3d589e..f277da6e 100644 --- a/migrations/1677284495299_locations.ts +++ b/migrations/1677284495299_locations.ts @@ -27,22 +27,19 @@ export function up(pgm: MigrationBuilder): void { }, address: { type: 'text', - notNull: true, }, output: { type: 'text', notNull: true, }, offset: { - type: 'bigint', - notNull: true, + type: 'numeric', }, value: { - type: 'bigint', - notNull: true, + type: 'numeric', }, sat_ordinal: { - type: 'bigint', + type: 'numeric', notNull: true, }, sat_rarity: { diff --git a/src/api/schemas.ts b/src/api/schemas.ts index 7267a2dc..a6e03ab2 100644 --- a/src/api/schemas.ts +++ b/src/api/schemas.ts @@ -38,6 +38,8 @@ export const OpenApiSchemaOptions: SwaggerOptions = { // Parameters // ========================== +const Nullable = (type: T) => Type.Union([type, Type.Null()]); + export const AddressParam = Type.String({ title: 'Address', description: 'Bitcoin address', @@ -208,9 +210,11 @@ export const InscriptionResponse = Type.Object({ examples: ['1463d48e9248159084929294f64bda04487503d30ce7ab58365df1dc6fd58218i0'], }), number: Type.Integer({ examples: [248751] }), - address: Type.String({ - examples: ['bc1pvwh2dl6h388x65rqq47qjzdmsqgkatpt4hye6daf7yxvl0z3xjgq247aq8'], - }), + address: Nullable( + Type.String({ + examples: ['bc1pvwh2dl6h388x65rqq47qjzdmsqgkatpt4hye6daf7yxvl0z3xjgq247aq8'], + }) + ), genesis_address: Type.String({ examples: ['bc1pvwh2dl6h388x65rqq47qjzdmsqgkatpt4hye6daf7yxvl0z3xjgq247aq8'], }), @@ -232,8 +236,8 @@ export const InscriptionResponse = Type.Object({ output: Type.String({ examples: ['1463d48e9248159084929294f64bda04487503d30ce7ab58365df1dc6fd58218:0'], }), - value: Type.String({ examples: ['546'] }), - offset: Type.String({ examples: ['0'] }), + value: Nullable(Type.String({ examples: ['546'] })), + offset: Nullable(Type.String({ examples: ['0'] })), sat_ordinal: Type.String({ examples: ['1232735286933201'] }), sat_rarity: Type.String({ examples: ['common'] }), sat_coinbase_height: Type.Integer({ examples: [430521] }), @@ -274,9 +278,11 @@ export const InscriptionLocationResponse = Type.Object({ block_hash: Type.String({ examples: ['0000000000000000000452773967cdd62297137cdaf79950c5e8bb0c62075133'], }), - address: Type.String({ - examples: ['bc1pvwh2dl6h388x65rqq47qjzdmsqgkatpt4hye6daf7yxvl0z3xjgq247aq8'], - }), + address: Nullable( + Type.String({ + examples: ['bc1pvwh2dl6h388x65rqq47qjzdmsqgkatpt4hye6daf7yxvl0z3xjgq247aq8'], + }) + ), tx_id: Type.String({ examples: ['1463d48e9248159084929294f64bda04487503d30ce7ab58365df1dc6fd58218'], }), @@ -286,8 +292,8 @@ export const InscriptionLocationResponse = Type.Object({ output: Type.String({ examples: ['1463d48e9248159084929294f64bda04487503d30ce7ab58365df1dc6fd58218:0'], }), - value: Type.String({ examples: ['546'] }), - offset: Type.String({ examples: ['0'] }), + value: Nullable(Type.String({ examples: ['546'] })), + offset: Nullable(Type.String({ examples: ['0'] })), timestamp: Type.Integer({ examples: [1677733170000] }), }); export type InscriptionLocationResponse = Static; diff --git a/src/api/util/helpers.ts b/src/api/util/helpers.ts index aa3dbacf..7f9723dc 100644 --- a/src/api/util/helpers.ts +++ b/src/api/util/helpers.ts @@ -19,8 +19,8 @@ export function parseDbInscriptions( tx_id: i.tx_id, location: `${i.output}:${i.offset}`, output: i.output, - value: i.value.toString(), - offset: i.offset.toString(), + value: i.value, + offset: i.offset, sat_ordinal: i.sat_ordinal.toString(), sat_rarity: i.sat_rarity, sat_coinbase_height: i.sat_coinbase_height, @@ -42,8 +42,8 @@ export function parseInscriptionLocations(items: DbLocation[]): InscriptionLocat tx_id: i.tx_id, location: `${i.output}:${i.offset}`, output: i.output, - value: i.value.toString(), - offset: i.offset.toString(), + value: i.value, + offset: i.offset, timestamp: i.timestamp.valueOf(), })); } diff --git a/src/chainhook/helpers.ts b/src/chainhook/helpers.ts index 6b9769ab..39894f0d 100644 --- a/src/chainhook/helpers.ts +++ b/src/chainhook/helpers.ts @@ -4,126 +4,100 @@ import { PgStore } from '../pg/pg-store'; import { ChainhookPayloadCType } from './schemas'; /** - * Process an `inscription_revealed` event from chainhooks and saves inscriptions to the DB. + * Process an `inscription_feed` event from chainhooks and saves inscription data to the DB. * @param payload - Event payload * @param db - DB */ -export async function processInscriptionRevealed(payload: unknown, db: PgStore): Promise { +export async function processInscriptionFeed(payload: unknown, db: PgStore): Promise { if (!ChainhookPayloadCType.Check(payload)) { const errors = [...ChainhookPayloadCType.Errors(payload)]; - logger.warn(errors, `[inscription_revealed] invalid payload`); + logger.error(errors, `[inscription_feed] invalid payload`); return; } for (const event of payload.rollback) { for (const tx of event.transactions) { - const reveal = tx.metadata.ordinal_operations[0].inscription_revealed; - if (!reveal) { - logger.warn(`[inscription_revealed] invalid rollback`); - continue; + for (const operation of tx.metadata.ordinal_operations) { + if (operation.inscription_revealed) { + const genesis_id = operation.inscription_revealed.inscription_id; + await db.rollBackInscriptionGenesis({ genesis_id }); + logger.info(`[inscription_feed] rollback inscription ${genesis_id}`); + } + if (operation.inscription_transferred) { + const genesis_id = operation.inscription_transferred.inscription_id; + const satpoint = operation.inscription_transferred.satpoint_post_transfer.split(':'); + const output = `${satpoint[0]}:${satpoint[1]}`; + await db.rollBackInscriptionTransfer({ genesis_id, output }); + logger.info(`[inscription_feed] rollback transfer ${genesis_id} ${output}`); + } } - const genesis_id = reveal.inscription_id; - await db.rollBackInscriptionGenesis({ genesis_id }); - logger.info(`[inscription_revealed] rollback inscription ${genesis_id}`); } } for (const event of payload.apply) { for (const tx of event.transactions) { - const reveal = tx.metadata.ordinal_operations[0].inscription_revealed; - if (!reveal) { - logger.warn(`[inscription_revealed] invalid apply`); - continue; + for (const operation of tx.metadata.ordinal_operations) { + if (operation.inscription_revealed) { + const reveal = operation.inscription_revealed; + const txId = tx.transaction_identifier.hash.substring(2); + const satoshi = new OrdinalSatoshi(reveal.ordinal_number); + await db.insertInscriptionGenesis({ + inscription: { + genesis_id: reveal.inscription_id, + mime_type: reveal.content_type.split(';')[0], + content_type: reveal.content_type, + content_length: reveal.content_length, + number: reveal.inscription_number, + content: reveal.content_bytes, + fee: reveal.inscription_fee.toString(), + }, + location: { + genesis_id: reveal.inscription_id, + block_height: event.block_identifier.index, + block_hash: event.block_identifier.hash.substring(2), + tx_id: txId, + address: reveal.inscriber_address, + output: `${txId}:0`, + offset: reveal.ordinal_offset.toString(), + value: reveal.inscription_output_value.toString(), + timestamp: event.timestamp, + sat_ordinal: reveal.ordinal_number.toString(), + sat_rarity: satoshi.rarity, + sat_coinbase_height: satoshi.blockHeight, + }, + }); + logger.info( + `[inscription_feed] apply inscription #${reveal.inscription_number} (${reveal.inscription_id}) at block ${event.block_identifier.index}` + ); + } + if (operation.inscription_transferred) { + const transfer = operation.inscription_transferred; + const txId = tx.transaction_identifier.hash.substring(2); + const satpoint = transfer.satpoint_post_transfer.split(':'); + const offset = satpoint[2]; + const output = `${satpoint[0]}:${satpoint[1]}`; + const satoshi = new OrdinalSatoshi(transfer.ordinal_number); + await db.insertInscriptionTransfer({ + location: { + genesis_id: transfer.inscription_id, + block_height: event.block_identifier.index, + block_hash: event.block_identifier.hash, + tx_id: txId, + address: transfer.updated_address, + output: output, + offset: offset ?? null, + value: transfer.post_transfer_output_value + ? transfer.post_transfer_output_value.toString() + : null, + timestamp: event.timestamp, + sat_ordinal: transfer.ordinal_number.toString(), + sat_rarity: satoshi.rarity, + sat_coinbase_height: satoshi.blockHeight, + }, + }); + logger.info( + `[inscription_feed] apply transfer for #${transfer.inscription_number} (${transfer.inscription_id}) to output ${output} at block ${event.block_identifier.index}` + ); + } } - const txId = tx.transaction_identifier.hash.substring(2); - const utxo = tx.metadata.outputs[0]; - const satoshi = new OrdinalSatoshi(reveal.ordinal_number); - await db.insertInscriptionGenesis({ - inscription: { - genesis_id: reveal.inscription_id, - mime_type: reveal.content_type.split(';')[0], - content_type: reveal.content_type, - content_length: reveal.content_length, - number: reveal.inscription_number, - content: reveal.content_bytes, - fee: BigInt(reveal.inscription_fee), - }, - location: { - genesis_id: reveal.inscription_id, - block_height: event.block_identifier.index, - block_hash: event.block_identifier.hash.substring(2), - tx_id: txId, - address: reveal.inscriber_address, - output: `${txId}:0`, - offset: BigInt(reveal.ordinal_offset), - value: BigInt(utxo.value), - timestamp: event.timestamp, - sat_ordinal: BigInt(reveal.ordinal_number), - sat_rarity: satoshi.rarity, - sat_coinbase_height: satoshi.blockHeight, - }, - }); - logger.info( - `[inscription_revealed] apply inscription #${reveal.inscription_number} (${reveal.inscription_id}) at block ${event.block_identifier.index}` - ); - } - } -} - -/** - * Process an `inscription_transfer` event from chainhooks and saves new locations to the DB. - * @param payload - Event payload - * @param db - DB - */ -export async function processInscriptionTransferred(payload: unknown, db: PgStore): Promise { - if (!ChainhookPayloadCType.Check(payload)) { - const errors = [...ChainhookPayloadCType.Errors(payload)]; - logger.warn(errors, `[inscription_transferred] invalid payload`); - return; - } - for (const event of payload.rollback) { - for (const tx of event.transactions) { - const transfer = tx.metadata.ordinal_operations[0].inscription_transferred; - if (!transfer) { - logger.warn(`[inscription_transferred] invalid rollback`); - continue; - } - const genesis_id = transfer.inscription_id; - const satpoint = transfer.satpoint_post_transfer.split(':'); - const output = `${satpoint[0]}:${satpoint[1]}`; - await db.rollBackInscriptionTransfer({ genesis_id, output }); - logger.info(`[inscription_transferred] rollback transfer ${genesis_id} ${output}`); - } - } - for (const event of payload.apply) { - for (const tx of event.transactions) { - const transfer = tx.metadata.ordinal_operations[0].inscription_transferred; - if (!transfer) { - logger.warn(`[inscription_transferred] invalid apply`); - continue; - } - const txId = tx.transaction_identifier.hash.substring(2); - const satpoint = transfer.satpoint_post_transfer.split(':'); - const output = `${satpoint[0]}:${satpoint[1]}`; - const utxo = tx.metadata.outputs[0]; - const satoshi = new OrdinalSatoshi(transfer.ordinal_number); - await db.insertInscriptionTransfer({ - location: { - genesis_id: transfer.inscription_id, - block_height: event.block_identifier.index, - block_hash: event.block_identifier.hash, - tx_id: txId, - address: transfer.updated_address, - output: output, - offset: BigInt(satpoint[2]), - value: BigInt(utxo.value), - timestamp: event.timestamp, - sat_ordinal: BigInt(transfer.ordinal_number), - sat_rarity: satoshi.rarity, - sat_coinbase_height: satoshi.blockHeight, - }, - }); - logger.info( - `[inscription_transferred] apply transfer for #${transfer.inscription_number} (${transfer.inscription_id}) to output ${output} at block ${event.block_identifier.index}` - ); } } } diff --git a/src/chainhook/schemas.ts b/src/chainhook/schemas.ts index fe44c1d5..b92399d6 100644 --- a/src/chainhook/schemas.ts +++ b/src/chainhook/schemas.ts @@ -15,6 +15,7 @@ const InscriptionRevealed = Type.Object({ 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(), @@ -26,9 +27,10 @@ const InscriptionTransferred = Type.Object({ inscription_number: Type.Integer(), inscription_id: Type.String(), ordinal_number: Type.Integer(), - updated_address: Type.String(), + updated_address: Nullable(Type.String()), satpoint_pre_transfer: Type.String(), satpoint_post_transfer: Type.String(), + post_transfer_output_value: Nullable(Type.Integer()), }); const OrdinalOperation = Type.Object({ @@ -46,7 +48,7 @@ const Transaction = Type.Object({ operations: Type.Array(Type.Any()), metadata: Type.Object({ ordinal_operations: Type.Array(OrdinalOperation), - outputs: Type.Array(Output), + outputs: Type.Optional(Type.Array(Output)), proof: Nullable(Type.String()), }), }); @@ -66,7 +68,7 @@ const ChainhookPayload = Type.Object({ uuid: Type.String(), predicate: Type.Object({ scope: Type.String(), - ordinal: Type.String(), + operation: Type.String(), }), }), }); diff --git a/src/chainhook/server.ts b/src/chainhook/server.ts index 8270307c..14e6db5c 100644 --- a/src/chainhook/server.ts +++ b/src/chainhook/server.ts @@ -12,11 +12,10 @@ import { ENV } from '../env'; import { logger, PINO_CONFIG } from '../logger'; import { PgStore } from '../pg/pg-store'; import { timeout } from '../pg/postgres-tools/helpers'; -import { processInscriptionRevealed, processInscriptionTransferred } from './helpers'; +import { processInscriptionFeed } from './helpers'; export const CHAINHOOK_BASE_PATH = `http://${ENV.CHAINHOOK_NODE_RPC_HOST}:${ENV.CHAINHOOK_NODE_RPC_PORT}`; -export const REVEAL__PREDICATE_UUID = randomUUID(); -export const TRANSFER__PREDICATE_UUID = randomUUID(); +export const PREDICATE_UUID = randomUUID(); /** * Ping the chainhooks node indefinitely until it's ready. @@ -40,7 +39,9 @@ async function waitForChainhookNode(this: FastifyInstance) { */ async function registerChainhookPredicates(this: FastifyInstance) { const blockHeight = await this.db.getChainTipBlockHeight(); - logger.info(`EventServer registering predicates starting from block ${blockHeight}...`); + logger.info( + `EventServer registering predicates on ${ENV.CHAINHOOK_NODE_RPC_HOST}:${ENV.CHAINHOOK_NODE_RPC_PORT} starting from block ${blockHeight}...` + ); const register = async (name: string, uuid: string, blockHeight: number) => { await request(`${CHAINHOOK_BASE_PATH}/v1/chainhooks`, { @@ -54,8 +55,8 @@ async function registerChainhookPredicates(this: FastifyInstance) { mainnet: { start_block: blockHeight, if_this: { - scope: 'protocol', - ordinal: name, + scope: 'ordinals_protocol', + operation: name, }, then_that: { http_post: { @@ -73,8 +74,7 @@ async function registerChainhookPredicates(this: FastifyInstance) { }; try { - await register('inscription_revealed', REVEAL__PREDICATE_UUID, blockHeight); - await register('inscription_transferred', TRANSFER__PREDICATE_UUID, blockHeight); + await register('inscription_feed', PREDICATE_UUID, blockHeight); } catch (error) { logger.error(error, `EventServer unable to register predicate`); } @@ -96,8 +96,7 @@ async function removeChainhookPredicates(this: FastifyInstance) { }; try { - await deregister('inscription_revealed', REVEAL__PREDICATE_UUID); - await deregister('inscription_transferred', TRANSFER__PREDICATE_UUID); + await deregister('inscription_feed', PREDICATE_UUID); } catch (error) { logger.error(error, `EventServer unable to deregister predicate`); } @@ -122,19 +121,11 @@ const Chainhook: FastifyPluginCallback, Server, TypeBoxType done ) => { fastify.addHook('preHandler', isAuthorizedChainhookEvent); - fastify.post('/chainhook/inscription_revealed', async (request, reply) => { + fastify.post('/chainhook/inscription_feed', async (request, reply) => { try { - await processInscriptionRevealed(request.body, fastify.db); + await processInscriptionFeed(request.body, fastify.db); } catch (error) { - logger.error(error, `EventServer error processing inscription_revealed`); - } - await reply.code(200).send(); - }); - fastify.post('/chainhook/inscription_transferred', async (request, reply) => { - try { - await processInscriptionTransferred(request.body, fastify.db); - } catch (error) { - logger.error(error, `EventServer error processing inscription_transferred`); + logger.error(error, `EventServer error processing inscription_feed`); } await reply.code(200).send(); }); diff --git a/src/pg/pg-store.ts b/src/pg/pg-store.ts index c50b5e2e..bf8d96ad 100644 --- a/src/pg/pg-store.ts +++ b/src/pg/pg-store.ts @@ -1,6 +1,7 @@ import { Order, OrderBy } from '../api/schemas'; import { SatoshiRarity } from '../api/util/ordinal-satoshi'; import { ENV } from '../env'; +import { logger } from '../logger'; import { inscriptionContentToJson } from './helpers'; import { runMigrations } from './migrations'; import { connectPostgres } from './postgres-tools'; @@ -72,6 +73,32 @@ export class PgStore extends BasePgStore { }): Promise { let inscription_id: number | undefined; await this.sqlWriteTransaction(async sql => { + // Are we upserting? + const prevInscription = await sql<{ id: number }[]>` + SELECT id FROM inscriptions WHERE number = ${args.inscription.number} + `; + if (prevInscription.count !== 0) { + logger.warn( + { + block_height: args.location.block_height, + genesis_id: args.inscription.genesis_id, + }, + `PgStore upserting inscription genesis #${args.inscription.number}` + ); + } else { + // Is this a sequential genesis insert? + const maxNumber = await this.getMaxInscriptionNumber(); + if (maxNumber && maxNumber + 1 !== args.inscription.number) { + logger.warn( + { + block_height: args.location.block_height, + genesis_id: args.inscription.genesis_id, + }, + `PgStore inserting out-of-order inscription genesis #${args.inscription.number}, current max is #${maxNumber}` + ); + } + } + const inscription = await sql<{ id: number }[]>` INSERT INTO inscriptions ${sql(args.inscription)} ON CONFLICT ON CONSTRAINT inscriptions_number_unique DO UPDATE SET @@ -139,6 +166,13 @@ export class PgStore extends BasePgStore { const inscription = await sql<{ id: number }[]>` SELECT id FROM inscriptions WHERE genesis_id = ${args.location.genesis_id} `; + if (inscription.count === 0) { + logger.warn( + args.location, + `PgStore ignoring transfer for an inscription that does not exist` + ); + return; + } inscription_id = inscription[0].id; const location = { inscription_id, @@ -183,6 +217,10 @@ export class PgStore extends BasePgStore { const inscription = await sql<{ id: number }[]>` SELECT id FROM inscriptions WHERE genesis_id = ${args.genesis_id} `; + if (inscription.count === 0) { + logger.warn(args, `PgStore ignoring rollback for a transfer that does not exist`); + return; + } inscription_id = inscription[0].id; await sql` DELETE FROM locations diff --git a/src/pg/types.ts b/src/pg/types.ts index 28766f8e..4a0b1d81 100644 --- a/src/pg/types.ts +++ b/src/pg/types.ts @@ -1,5 +1,5 @@ import { OpJson } from './helpers'; -import { PgBytea, PgJsonb } from './postgres-tools/types'; +import { PgBytea, PgJsonb, PgNumeric } from './postgres-tools/types'; export type DbPaginatedResult = { total: number; @@ -15,12 +15,12 @@ export type DbFullyLocatedInscriptionResult = { genesis_timestamp: Date; genesis_address: string; number: number; - address: string; + address: string | null; tx_id: string; output: string; - offset: bigint; - value: bigint; - sat_ordinal: bigint; + offset: string | null; + value: string | null; + sat_ordinal: string; sat_rarity: string; sat_coinbase_height: number; mime_type: string; @@ -34,11 +34,11 @@ export type DbLocationInsert = { block_height: number; block_hash: string; tx_id: string; - address: string; + address: string | null; output: string; - offset: bigint; - value: bigint; - sat_ordinal: bigint; + offset: PgNumeric | null; + value: PgNumeric | null; + sat_ordinal: PgNumeric; sat_rarity: string; sat_coinbase_height: number; timestamp: number; @@ -50,11 +50,11 @@ export type DbLocation = { block_height: number; block_hash: string; tx_id: string; - address: string; + address: string | null; output: string; - offset: bigint; - value: bigint; - sat_ordinal: bigint; + offset: string | null; + value: string | null; + sat_ordinal: string; sat_rarity: string; sat_coinbase_height: number; timestamp: Date; @@ -87,7 +87,7 @@ export type DbInscriptionInsert = { content_type: string; content_length: number; content: PgBytea; - fee: bigint; + fee: PgNumeric; }; export type DbInscription = { @@ -97,7 +97,7 @@ export type DbInscription = { mime_type: string; content_type: string; content_length: number; - fee: bigint; + fee: string; }; export type DbInscriptionContent = { diff --git a/tests/cache.test.ts b/tests/cache.test.ts index ca4308ba..c9e0bee1 100644 --- a/tests/cache.test.ts +++ b/tests/cache.test.ts @@ -27,7 +27,7 @@ describe('ETag cache', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -36,10 +36,10 @@ describe('ETag cache', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -101,7 +101,7 @@ describe('ETag cache', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -110,10 +110,10 @@ describe('ETag cache', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -126,7 +126,7 @@ describe('ETag cache', () => { content_length: 5, number: 2, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -135,10 +135,10 @@ describe('ETag cache', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -170,10 +170,10 @@ describe('ETag cache', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 102n, + offset: '0', + value: '102', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 20000, }, diff --git a/tests/inscriptions.test.ts b/tests/inscriptions.test.ts index 34c987cf..8a17b55d 100644 --- a/tests/inscriptions.test.ts +++ b/tests/inscriptions.test.ts @@ -28,7 +28,7 @@ describe('/inscriptions', () => { content_length: 5, number: 188, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -37,10 +37,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -53,7 +53,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -62,10 +62,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -120,7 +120,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -129,10 +129,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -147,10 +147,10 @@ describe('/inscriptions', () => { tx_id: 'bdda0d240132bab2af7f797d1507beb1acab6ad43e2c0ef7f96291aea5cc3444', address: 'bc1p3xqwzmddceqrd6x9yxplqzkl5vucta2gqm5szpkmpuvcvgs7g8psjf8htd', output: 'bdda0d240132bab2af7f797d1507beb1acab6ad43e2c0ef7f96291aea5cc3444:0', - offset: 0n, - value: 9000n, + offset: '0', + value: '9000', timestamp: 1678122360, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -193,10 +193,10 @@ describe('/inscriptions', () => { tx_id: 'e3af144354367de58c675e987febcb49f17d6c19e645728b833fe95408feab85', address: 'bc1pkjq7cerr6h53qm86k9t3dq0gqg8lcfz5jx7z4aj2mpqrjggrnass0u7qqj', output: 'e3af144354367de58c675e987febcb49f17d6c19e645728b833fe95408feab85:0', - offset: 0n, - value: 8000n, + offset: '0', + value: '8000', timestamp: 1678124000, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -242,7 +242,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -251,10 +251,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -269,10 +269,10 @@ describe('/inscriptions', () => { tx_id: 'bdda0d240132bab2af7f797d1507beb1acab6ad43e2c0ef7f96291aea5cc3444', address: 'bc1p3xqwzmddceqrd6x9yxplqzkl5vucta2gqm5szpkmpuvcvgs7g8psjf8htd', output: 'bdda0d240132bab2af7f797d1507beb1acab6ad43e2c0ef7f96291aea5cc3444:0', - offset: 0n, - value: 9000n, + offset: '0', + value: '9000', timestamp: 1678122360, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -318,10 +318,10 @@ describe('/inscriptions', () => { tx_id: 'e3af144354367de58c675e987febcb49f17d6c19e645728b833fe95408feab85', address: 'bc1pkjq7cerr6h53qm86k9t3dq0gqg8lcfz5jx7z4aj2mpqrjggrnass0u7qqj', output: 'e3af144354367de58c675e987febcb49f17d6c19e645728b833fe95408feab85:0', - offset: 0n, - value: 8000n, + offset: '0', + value: '8000', timestamp: 1678124000, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -382,7 +382,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -391,10 +391,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -407,7 +407,7 @@ describe('/inscriptions', () => { content_length: 5, number: 1, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -416,10 +416,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -509,7 +509,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -518,10 +518,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -534,7 +534,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -543,10 +543,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -588,7 +588,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -597,10 +597,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -613,7 +613,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -622,10 +622,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -671,7 +671,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -680,10 +680,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -696,7 +696,7 @@ describe('/inscriptions', () => { content_length: 5, number: 50, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -705,10 +705,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -750,7 +750,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -759,10 +759,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -775,7 +775,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -784,10 +784,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -830,7 +830,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -839,10 +839,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -855,7 +855,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -864,10 +864,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -894,7 +894,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -903,10 +903,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1677731361, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -919,7 +919,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -928,10 +928,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1675312161, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -965,7 +965,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -974,10 +974,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1677731361, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -990,7 +990,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -999,10 +999,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1675312161, - sat_ordinal: 1000000000000n, + sat_ordinal: '1000000000000', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -1036,7 +1036,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -1045,10 +1045,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1677731361, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -1061,7 +1061,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -1070,10 +1070,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1675312161, - sat_ordinal: 1000000000000n, + sat_ordinal: '1000000000000', sat_rarity: 'epic', sat_coinbase_height: 750000, }, @@ -1107,7 +1107,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -1116,10 +1116,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1677731361, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -1132,7 +1132,7 @@ describe('/inscriptions', () => { content_length: 5, number: 50, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -1141,10 +1141,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1675312161, - sat_ordinal: 1000000000000n, + sat_ordinal: '1000000000000', sat_rarity: 'epic', sat_coinbase_height: 750000, }, @@ -1178,7 +1178,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -1187,10 +1187,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -1203,7 +1203,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -1212,10 +1212,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -1242,7 +1242,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -1251,10 +1251,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -1267,7 +1267,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -1276,10 +1276,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -1316,7 +1316,7 @@ describe('/inscriptions', () => { content_length: 5, content: '0x48656C6C6F', number: 7, - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -1325,10 +1325,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -1341,7 +1341,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -1350,10 +1350,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -1366,7 +1366,7 @@ describe('/inscriptions', () => { content_length: 5, number: 9, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1i0', @@ -1375,10 +1375,10 @@ describe('/inscriptions', () => { tx_id: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1', address: 'bc1pxq6t85qp57aw8yf8eh9t7vsgd9zm5a8372rdll5jzrmc3cxqdpmqfucdry', output: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 0n, + sat_ordinal: '0', sat_rarity: 'mythic', sat_coinbase_height: 650000, }, @@ -1416,7 +1416,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -1425,10 +1425,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 3n, + sat_ordinal: '3', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -1441,7 +1441,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -1450,10 +1450,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 5n, + sat_ordinal: '5', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -1466,7 +1466,7 @@ describe('/inscriptions', () => { content_length: 5, number: 9, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1i0', @@ -1475,10 +1475,10 @@ describe('/inscriptions', () => { tx_id: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1', address: 'bc1pxq6t85qp57aw8yf8eh9t7vsgd9zm5a8372rdll5jzrmc3cxqdpmqfucdry', output: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 0n, + sat_ordinal: '0', sat_rarity: 'mythic', sat_coinbase_height: 650000, }, @@ -1516,7 +1516,7 @@ describe('/inscriptions', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 705n, + fee: '705', }, location: { genesis_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201i0', @@ -1525,10 +1525,10 @@ describe('/inscriptions', () => { tx_id: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201', address: 'bc1pscktlmn99gyzlvymvrezh6vwd0l4kg06tg5rvssw0czg8873gz5sdkteqj', output: '9f4a9b73b0713c5da01c0a47f97c6c001af9028d6bdd9e264dfacbc4e6790201:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 3n, + sat_ordinal: '3', sat_rarity: 'common', sat_coinbase_height: 650000, }, @@ -1541,7 +1541,7 @@ describe('/inscriptions', () => { content_length: 5, number: 8, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -1550,10 +1550,10 @@ describe('/inscriptions', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 5n, + sat_ordinal: '5', sat_rarity: 'epic', sat_coinbase_height: 650000, }, @@ -1566,7 +1566,7 @@ describe('/inscriptions', () => { content_length: 5, number: 9, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1i0', @@ -1575,10 +1575,10 @@ describe('/inscriptions', () => { tx_id: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1', address: 'bc1pxq6t85qp57aw8yf8eh9t7vsgd9zm5a8372rdll5jzrmc3cxqdpmqfucdry', output: '567c7605439dfdc3a289d13fd2132237852f4a56e784b9364ba94499d5f9baf1:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 0n, + sat_ordinal: '0', sat_rarity: 'mythic', sat_coinbase_height: 650000, }, diff --git a/tests/sats.test.ts b/tests/sats.test.ts index 9e650514..99cff5a1 100644 --- a/tests/sats.test.ts +++ b/tests/sats.test.ts @@ -47,7 +47,7 @@ describe('/sats', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -56,10 +56,10 @@ describe('/sats', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, }, diff --git a/tests/server.test.ts b/tests/server.test.ts index 6428e1ac..d0864a1d 100644 --- a/tests/server.test.ts +++ b/tests/server.test.ts @@ -1,10 +1,5 @@ import { MockAgent, setGlobalDispatcher } from 'undici'; -import { - buildChainhookServer, - CHAINHOOK_BASE_PATH, - REVEAL__PREDICATE_UUID, - TRANSFER__PREDICATE_UUID, -} from '../src/chainhook/server'; +import { buildChainhookServer, CHAINHOOK_BASE_PATH, PREDICATE_UUID } from '../src/chainhook/server'; import { ENV } from '../src/env'; import { cycleMigrations } from '../src/pg/migrations'; import { PgStore } from '../src/pg/pg-store'; @@ -34,13 +29,7 @@ describe('EventServer', () => { interceptor.intercept({ path: '/v1/chainhooks', method: 'POST' }).reply(200).times(2); interceptor .intercept({ - path: `/v1/chainhooks/bitcoin/${REVEAL__PREDICATE_UUID}`, - method: 'DELETE', - }) - .reply(200); - interceptor - .intercept({ - path: `/v1/chainhooks/bitcoin/${TRANSFER__PREDICATE_UUID}`, + path: `/v1/chainhooks/bitcoin/${PREDICATE_UUID}`, method: 'DELETE', }) .reply(200); @@ -50,7 +39,7 @@ describe('EventServer', () => { const payload = { test: 'value' }; await fastify.inject({ method: 'POST', - url: '/chainhook/inscription_revealed', + url: '/chainhook/inscription_feed', headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload, }); @@ -68,13 +57,7 @@ describe('EventServer', () => { interceptor.intercept({ path: '/v1/chainhooks', method: 'POST' }).reply(200).times(2); interceptor .intercept({ - path: `/v1/chainhooks/bitcoin/${REVEAL__PREDICATE_UUID}`, - method: 'DELETE', - }) - .reply(200); - interceptor - .intercept({ - path: `/v1/chainhooks/bitcoin/${TRANSFER__PREDICATE_UUID}`, + path: `/v1/chainhooks/bitcoin/${PREDICATE_UUID}`, method: 'DELETE', }) .reply(200); @@ -84,7 +67,7 @@ describe('EventServer', () => { const payload = { test: 'value' }; const response = await fastify.inject({ method: 'POST', - url: '/chainhook/inscription_revealed', + url: '/chainhook/inscription_feed', payload, }); expect(response.statusCode).toBe(403); @@ -106,13 +89,7 @@ describe('EventServer', () => { interceptor.intercept({ path: '/v1/chainhooks', method: 'POST' }).reply(200).times(2); interceptor .intercept({ - path: `/v1/chainhooks/bitcoin/${REVEAL__PREDICATE_UUID}`, - method: 'DELETE', - }) - .reply(200); - interceptor - .intercept({ - path: `/v1/chainhooks/bitcoin/${TRANSFER__PREDICATE_UUID}`, + path: `/v1/chainhooks/bitcoin/${PREDICATE_UUID}`, method: 'DELETE', }) .reply(200); @@ -125,7 +102,7 @@ describe('EventServer', () => { await agent.close(); }); - test('parses inscription_revealed apply and rollback', async () => { + test('parses inscription_reveal apply and rollback', async () => { const reveal = { block_identifier: { index: 107, @@ -143,13 +120,6 @@ describe('EventServer', () => { }, operations: [], metadata: { - outputs: [ - { - value: 10000, - script_pubkey: - '0x512069cb384754a2ba3fde965ce4e27c60488abe6963181f5f08385dc89615d53520', - }, - ], ordinal_operations: [ { inscription_revealed: { @@ -158,6 +128,7 @@ describe('EventServer', () => { content_length: 12, inscription_number: 100, inscription_fee: 3425, + inscription_output_value: 10000, inscription_id: '0268dd9743c862d80ab02cb1d0228036cfe172522850eb96be60cfee14b31fb8i0', inscriber_address: @@ -184,14 +155,14 @@ describe('EventServer', () => { chainhook: { uuid: '1', predicate: { - scope: 'protocol', - ordinal: 'inscription_revealed', + scope: 'ordinals_protocol', + operation: 'inscription_feed', }, }, }; const response = await fastify.inject({ method: 'POST', - url: '/chainhook/inscription_revealed', + url: '/chainhook/inscription_feed', headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload1, }); @@ -241,14 +212,14 @@ describe('EventServer', () => { chainhook: { uuid: '1', predicate: { - scope: 'protocol', - ordinal: 'inscription_revealed', + scope: 'ordinals_protocol', + operation: 'inscription_feed', }, }, }; const response2 = await fastify.inject({ method: 'POST', - url: '/chainhook/inscription_revealed', + url: '/chainhook/inscription_feed', headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload2, }); @@ -268,7 +239,7 @@ describe('EventServer', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -277,10 +248,10 @@ describe('EventServer', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 5n, + sat_ordinal: '5', sat_rarity: 'common', sat_coinbase_height: 0, }, @@ -302,13 +273,6 @@ describe('EventServer', () => { }, operations: [], metadata: { - outputs: [ - { - value: 10000, - script_pubkey: - '0x512069cb384754a2ba3fde965ce4e27c60488abe6963181f5f08385dc89615d53520', - }, - ], ordinal_operations: [ { inscription_transferred: { @@ -322,6 +286,7 @@ describe('EventServer', () => { '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0:0', satpoint_post_transfer: '0268dd9743c862d80ab02cb1d0228036cfe172522850eb96be60cfee14b31fb8:0:5000', + post_transfer_output_value: 10000, }, }, ], @@ -339,14 +304,14 @@ describe('EventServer', () => { chainhook: { uuid: '1', predicate: { - scope: 'protocol', - ordinal: 'inscription_transferred', + scope: 'ordinals_protocol', + operation: 'inscription_feed', }, }, }; const response = await fastify.inject({ method: 'POST', - url: '/chainhook/inscription_transferred', + url: '/chainhook/inscription_feed', headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload1, }); @@ -396,14 +361,14 @@ describe('EventServer', () => { chainhook: { uuid: '1', predicate: { - scope: 'protocol', - ordinal: 'inscription_transferred', + scope: 'ordinals_protocol', + operation: 'inscription_feed', }, }, }; const response2 = await fastify.inject({ method: 'POST', - url: '/chainhook/inscription_transferred', + url: '/chainhook/inscription_feed', headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload2, }); @@ -432,13 +397,6 @@ describe('EventServer', () => { }, operations: [], metadata: { - outputs: [ - { - value: 10000, - script_pubkey: - '0x512069cb384754a2ba3fde965ce4e27c60488abe6963181f5f08385dc89615d53520', - }, - ], ordinal_operations: [ { inscription_revealed: { @@ -458,6 +416,7 @@ describe('EventServer', () => { ordinal_offset: 0, satpoint_post_inscription: '0268dd9743c862d80ab02cb1d0228036cfe172522850eb96be60cfee14b31fb8:0:0', + inscription_output_value: 10000, }, }, ], @@ -475,14 +434,14 @@ describe('EventServer', () => { chainhook: { uuid: '1', predicate: { - scope: 'protocol', - ordinal: 'inscription_revealed', + scope: 'ordinals_protocol', + operation: 'inscription_feed', }, }, }; const response = await fastify.inject({ method: 'POST', - url: '/chainhook/inscription_revealed', + url: '/chainhook/inscription_feed', headers: { authorization: `Bearer ${ENV.CHAINHOOK_NODE_AUTH_TOKEN}` }, payload: payload1, }); diff --git a/tests/status.test.ts b/tests/status.test.ts index b6ea98ca..49956b75 100644 --- a/tests/status.test.ts +++ b/tests/status.test.ts @@ -40,7 +40,7 @@ describe('Status', () => { content_length: 5, number: 7, content: '0x48656C6C6F', - fee: 2805n, + fee: '2805', }, location: { genesis_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dci0', @@ -49,10 +49,10 @@ describe('Status', () => { tx_id: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc', address: 'bc1p3cyx5e2hgh53w7kpxcvm8s4kkega9gv5wfw7c4qxsvxl0u8x834qf0u2td', output: '38c46a8bf7ec90bc7f6b797e7dc84baa97f4e5fd4286b92fe1b50176d03b18dc:0', - offset: 0n, - value: 10000n, + offset: '0', + value: '10000', timestamp: 1676913207, - sat_ordinal: 257418248345364n, + sat_ordinal: '257418248345364', sat_rarity: 'common', sat_coinbase_height: 650000, },