Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 54 additions & 14 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"docker-compose": "0.24.8",
"dockerode": "4.0.6",
"eslint": "8.29.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-prettier": "5.5.4",
"eslint-plugin-tsdoc": "0.2.17",
"husky": "4.3.8",
"is-ci": "3.0.1",
Expand All @@ -196,7 +196,7 @@
"openapi-to-postmanv2": "4.23.1",
"openapi-typescript": "7.3.0",
"pg-connection-string": "2.5.0",
"prettier": "2.8.8",
"prettier": "3.6.2",
"rimraf": "5.0.0",
"rpc-websocket-client": "1.1.4",
"socket.io-client": "4.5.4",
Expand Down
2 changes: 1 addition & 1 deletion src/api/async-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function asyncHandler<
ResBody = any,
ReqBody = any,
ReqQuery = core.Query,
Locals extends Record<string, any> = Record<string, any>
Locals extends Record<string, any> = Record<string, any>,
>(
handler: (
...args: Parameters<express.RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals>>
Expand Down
4 changes: 2 additions & 2 deletions src/api/controllers/db-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,8 @@ function parseDbAbstractTx(dbTx: DbTx, baseTx: BaseTransaction): AbstractTransac
block_time_iso: dbTx.block_time
? unixEpochToIso(dbTx.block_time)
: dbTx.burn_block_time > 0
? unixEpochToIso(dbTx.burn_block_time)
: '',
? unixEpochToIso(dbTx.burn_block_time)
: '',
burn_block_height: dbTx.burn_block_height,
burn_block_time: dbTx.burn_block_time,
burn_block_time_iso: dbTx.burn_block_time > 0 ? unixEpochToIso(dbTx.burn_block_time) : '',
Expand Down
4 changes: 2 additions & 2 deletions src/api/routes/ws/web-socket-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export type WebSocketPayload = {
export type ListenerType<T> = [T] extends [(...args: infer U) => any]
? U
: [T] extends [void]
? []
: [T];
? []
: [T];

/**
* A channel that accepts user subscriptions to real time updates and responds with relevant
Expand Down
4 changes: 2 additions & 2 deletions src/datastore/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,15 +819,15 @@ export interface DbTokenOfferingLocked {

export interface DbGetBlockWithMetadataOpts<
TWithTxs extends boolean,
TWithMicroblocks extends boolean
TWithMicroblocks extends boolean,
> {
txs?: TWithTxs;
microblocks?: TWithMicroblocks;
}

export interface DbGetBlockWithMetadataResponse<
TWithTxs extends boolean,
TWithMicroblocks extends boolean
TWithMicroblocks extends boolean,
> {
block: DbBlock;
txs: TWithTxs extends true ? DbTx[] : null;
Expand Down
2 changes: 1 addition & 1 deletion src/datastore/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function getPgConnectionEnvValue(
): string | undefined {
const defaultVal = process.env[`PG_${name}`] ?? process.env[`PG${name}`];
return pgServer === PgServer.primary
? process.env[`PG_PRIMARY_${name}`] ?? defaultVal
? (process.env[`PG_PRIMARY_${name}`] ?? defaultVal)
: defaultVal;
}

Expand Down
20 changes: 10 additions & 10 deletions src/datastore/pg-store-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ export class PgStoreV2 extends BasePgStoreModule {
args.block.type === 'latest'
? sql`burn_block_hash = (SELECT burn_block_hash FROM blocks WHERE canonical = TRUE ORDER BY block_height DESC LIMIT 1)`
: args.block.type === 'hash'
? sql`burn_block_hash = ${normalizeHashString(args.block.hash)}`
: sql`burn_block_height = ${args.block.height}`;
? sql`burn_block_hash = ${normalizeHashString(args.block.hash)}`
: sql`burn_block_height = ${args.block.height}`;
const blockCheck = await sql`SELECT burn_block_hash FROM blocks WHERE ${filter} LIMIT 1`;
if (blockCheck.count === 0)
throw new InvalidRequestError(
Expand Down Expand Up @@ -218,11 +218,11 @@ export class PgStoreV2 extends BasePgStoreModule {
args.type === 'latest'
? sql`index_block_hash = (SELECT index_block_hash FROM blocks WHERE canonical = TRUE ORDER BY block_height DESC LIMIT 1)`
: args.type === 'hash'
? sql`(
? sql`(
block_hash = ${normalizeHashString(args.hash)}
OR index_block_hash = ${normalizeHashString(args.hash)}
)`
: sql`block_height = ${args.height}`;
: sql`block_height = ${args.height}`;
const blockQuery = await sql<BlockQueryResult[]>`
SELECT ${sql(BLOCK_COLUMNS)}
FROM blocks
Expand All @@ -246,11 +246,11 @@ export class PgStoreV2 extends BasePgStoreModule {
blockId.type === 'latest'
? sql`index_block_hash = (SELECT index_block_hash FROM blocks WHERE canonical = TRUE ORDER BY block_height DESC LIMIT 1)`
: blockId.type === 'hash'
? sql`(
? sql`(
block_hash = ${normalizeHashString(blockId.hash)}
OR index_block_hash = ${normalizeHashString(blockId.hash)}
)`
: sql`block_height = ${blockId.height}`;
: sql`block_height = ${blockId.height}`;
const blockQuery = await sql<{ signer_signatures: string[]; total: number }[]>`
SELECT
signer_signatures[${offset + 1}:${offset + limit}] as signer_signatures,
Expand Down Expand Up @@ -344,11 +344,11 @@ export class PgStoreV2 extends BasePgStoreModule {
args.block.type === 'latest'
? sql`canonical = TRUE ORDER BY block_height DESC`
: args.block.type === 'hash'
? sql`(
? sql`(
block_hash = ${normalizeHashString(args.block.hash)}
OR index_block_hash = ${normalizeHashString(args.block.hash)}
) AND canonical = TRUE`
: sql`block_height = ${args.block.height} AND canonical = TRUE`
: sql`block_height = ${args.block.height} AND canonical = TRUE`
}
LIMIT 1
),
Expand Down Expand Up @@ -448,8 +448,8 @@ export class PgStoreV2 extends BasePgStoreModule {
args.type === 'latest'
? sql`burn_block_hash = (SELECT burn_block_hash FROM blocks WHERE canonical = TRUE ORDER BY block_height DESC LIMIT 1)`
: args.type === 'hash'
? sql`burn_block_hash = ${args.hash}`
: sql`burn_block_height = ${args.height}`;
? sql`burn_block_hash = ${args.hash}`
: sql`burn_block_height = ${args.height}`;
const blockQuery = await sql<DbBurnBlock[]>`
WITH BlocksWithPrevTime AS (
SELECT
Expand Down
24 changes: 12 additions & 12 deletions src/datastore/pg-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ export class PgStore extends BasePgStore {
'hash' in blockIdentifer
? sql`block_hash = ${blockIdentifer.hash}`
: 'height' in blockIdentifer
? sql`block_height = ${blockIdentifer.height}`
: 'burnBlockHash' in blockIdentifer
? sql`burn_block_hash = ${blockIdentifer.burnBlockHash}`
: sql`burn_block_height = ${blockIdentifer.burnBlockHeight}`
? sql`block_height = ${blockIdentifer.height}`
: 'burnBlockHash' in blockIdentifer
? sql`burn_block_hash = ${blockIdentifer.burnBlockHash}`
: sql`burn_block_height = ${blockIdentifer.burnBlockHeight}`
}
ORDER BY canonical DESC, block_height DESC
LIMIT 1
Expand Down Expand Up @@ -1325,13 +1325,13 @@ export class PgStore extends BasePgStore {
OR smart_contract_contract_id = ${address}
OR contract_call_contract_id = ${address})`
: senderAddress && recipientAddress
? sql`(sender_address = ${senderAddress}
? sql`(sender_address = ${senderAddress}
AND token_transfer_recipient_address = ${recipientAddress})`
: senderAddress
? sql`sender_address = ${senderAddress}`
: recipientAddress
? sql`token_transfer_recipient_address = ${recipientAddress}`
: sql`TRUE`
: senderAddress
? sql`sender_address = ${senderAddress}`
: recipientAddress
? sql`token_transfer_recipient_address = ${recipientAddress}`
: sql`TRUE`
}
AND (pruned = false ${
!includeUnanchored && unanchoredTxs.length
Expand Down Expand Up @@ -4528,8 +4528,8 @@ export class PgStore extends BasePgStore {
param.type == 'latest'
? this.sql`index_block_hash = (SELECT index_block_hash FROM chain_tip)`
: param.type == 'hash'
? this.sql`index_block_hash = ${param.hash}`
: this.sql`block_height = ${param.height} AND canonical = true`
? this.sql`index_block_hash = ${param.hash}`
: this.sql`block_height = ${param.height} AND canonical = true`
}
LIMIT 1
`;
Expand Down
14 changes: 7 additions & 7 deletions src/datastore/pg-write-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,8 @@ export class PgWriteStore extends PgStore {
table === 'names'
? sql('registered_at')
: table === 'namespaces'
? sql('ready_block')
: sql('block_height');
? sql('ready_block')
: sql('block_height');
// The smart_contracts table does not have a tx_index column
const txIndexBump = table === 'smart_contracts' ? sql`` : sql`tx_index = tx_index + 1,`;
const metadataResult = await sql`
Expand All @@ -895,10 +895,10 @@ export class PgWriteStore extends PgStore {
Entry extends { tx: DbTx } & ('pox2_events' extends T
? { pox2Events: DbPoxSyntheticEvent[] }
: 'pox3_events' extends T
? { pox3Events: DbPoxSyntheticEvent[] }
: 'pox4_events' extends T
? { pox4Events: DbPoxSyntheticEvent[] }
: never)
? { pox3Events: DbPoxSyntheticEvent[] }
: 'pox4_events' extends T
? { pox4Events: DbPoxSyntheticEvent[] }
: never),
>(sql: PgSqlClient, poxTable: T, entries: Entry[]) {
const values: PoxSyntheticEventInsertValues[] = [];
for (const entry of entries) {
Expand Down Expand Up @@ -2419,7 +2419,7 @@ export class PgWriteStore extends PgStore {
block_height: smartContract.block_height,
index_block_hash: tx.index_block_hash,
source_code: smartContract.source_code,
abi: smartContract.abi ? JSON.parse(smartContract.abi) ?? 'null' : 'null',
abi: smartContract.abi ? (JSON.parse(smartContract.abi) ?? 'null') : 'null',
parent_index_block_hash: tx.parent_index_block_hash,
microblock_hash: tx.microblock_hash,
microblock_sequence: tx.microblock_sequence,
Expand Down
2 changes: 1 addition & 1 deletion src/event-replay/connection-legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function getPgClientConfig<TGetPoolConfig extends boolean = false>({
// See the `.env` file for more information on these options.
const pgEnvValue = (name: string): string | undefined =>
pgServer === PgServer.primary
? process.env[`PG_PRIMARY_${name}`] ?? process.env[`PG_${name}`]
? (process.env[`PG_PRIMARY_${name}`] ?? process.env[`PG_${name}`])
: process.env[`PG_${name}`];
const pgEnvVars = {
database: pgEnvValue('DATABASE'),
Expand Down
4 changes: 2 additions & 2 deletions src/event-stream/core-node-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export interface BurnchainOpDelegateStx {
delegated_ustx: number; // 4500432000000000;
reward_addr: [
number, // 1,
string // 'tb1pf4x64urhdsdmadxxhv2wwjv6e3evy59auu2xaauu3vz3adxtskfschm453'
string, // 'tb1pf4x64urhdsdmadxxhv2wwjv6e3evy59auu2xaauu3vz3adxtskfschm453'
];
sender: {
address: string; // 'ST1Z7V02CJRY3G5R2RDG7SFAZA8VGH0Y44NC2NAJN';
Expand Down Expand Up @@ -363,7 +363,7 @@ export interface CoreNodeBurnBlockMessage {
recipient: string;
/** Amount in BTC satoshis. */
amt: number;
}
},
];
/**
* Array of the Bitcoin addresses that would validly receive PoX commitments during this block.
Expand Down
11 changes: 7 additions & 4 deletions tests/api/teardown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ export default (): void => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const whyIsNodeRunning = require('why-is-node-running');
let whyRunInterval = 1000;
setInterval(() => {
console.log('\n\n\n\n_____WHY IS NODE RUNNING_____');
whyIsNodeRunning();
}, (whyRunInterval *= 2)).unref();
setInterval(
() => {
console.log('\n\n\n\n_____WHY IS NODE RUNNING_____');
whyIsNodeRunning();
},
(whyRunInterval *= 2)
).unref();
}
};
Loading
Loading