Skip to content
Merged
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
29 changes: 0 additions & 29 deletions .devcontainer/Dockerfile

This file was deleted.

41 changes: 0 additions & 41 deletions .devcontainer/devcontainer.json

This file was deleted.

103 changes: 103 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,108 @@
# Changelog

## May 21 - Jul 25, 2025

- docs: DEXs API documentation
- fix: transfers count field in transaction type
- fix: use isCoinbase flag in transactions counter; use an auxiliary filter if only chainId was feat: provided in transactions query
- fix: adjust query logic when only first or last was provided
- fix: made fungibleAccount queries use chainweb-node directly
- fix: blocksFromDepth and blocksFromDepth pagination
- fix: circulating coins value
- fix: transactions cursor pagination
- fix: missing ssl config
- fix: adjusted the all transactions fetch logic in the database repository
- fix: the error in streaming by sequalize transaction
- fix: removed the duplicated index (pool_stats_pairid_timestamp_idx) on down function as well
- fix: changed the blocksFromHeight response to return blocks in ascending order based on the startHeight parameter
- fix: improve effectiveSyncMinHeight calculation logic in backfill process
- fix: sanitize data in SaveTransactionDetails to prevent unsupported Unicode errors
- fix: update backfill process to use effectiveSyncMinHeight and rename max function
- fix: adjust nextHeight calculation in backfill process
- fix: backfill time analysis
- fix: no debug on production
- fix: the order error in pools and luiquidity-balances
- fix: the after error
- fix: after error in pools and liquidity-balances
- fix: the false of hasNextPage in pools and liquidity-positions
- fix: the pool-transaction timestamp error
- fix: the error in liquidity position
- fix: the error to show 0 fee data if there are no swaps
- fix: the limit calculation error
- fix: added missing create pool transaction migration
- fix: sequelize.sync and migrations approach conflict
- fix: the empty transaction error in pools query
- fix: missing transaction id during event creation on the streaming process
- fix: use tsconfig-paths to run scrips in dev mode
- fix: added create table migrations for DEX Protocol Data
- fix: the path error in pair service
- fix: resolve the reviews
- fix: the return type for pool-query-resolver
- fix: old graphql import error
- fix: resolve conflicts
- fix: alias resolution inside a container; missing dotenv-cli package
- fix: missing nfts
- fix: graphql hot reload and subscription tests
- remove: duplicated index
- remove: duplicate code to fetch pool data
- remove: env testing
- remove: env example from git ignore
- refactor: removed unused devcontainer configuration
- refactor: changed complexity calculation
- refactor: removed old graphql code
- refactor: changed gasPrice type in graphql schema
- refactor: improved balances backfill; normalized the gas price format in the database to a decimal to ensure consistency
- refactor: removed unnecessary backfill code
- refactor: increase max complexity to 4k
- refactor: use DEFAULT_PROTOCOL in module names
- refactor: creating new path for wss
- refactor: the namespace
- refactor: added canonical flag to the Events table
- refactor: added canonical = true on backfill
- refactor: the contract address
- refactor: decimal from (20,2) to (20,10)
- refactor: liquidity-positions
- refactor: primary key from int to string in pair
- refactor: the total supply when adding/removing liquidity
- refactor: the pool-resolver
- refactor: the sushi namespace
- refactor: splitted the backfill steps in batches to make it faster
- refactor: query params in pools
- refactor: query params in liquidity-position
- refactor: graphql query for pool-transaction
- refactor: scope into span
- refactor: rename example env
- refactor: added a database index for pactid; adjusted how to fetch a cross chain transfer
- feat: added custom database script to run a postgres with pgbackrest inside a docker container
- feat: orphan blocks mechanism
- feat: added coinbase field in block queries
- feat: added latest transactions query and subscription
- feat: removing impractical allowed origin method
- feat: set env without affecting existing services
- feat: enhance SSL configuration for database connections with optional CA validation
- feat: kadena ssl auth config
- feat: displaying block height when throwing errors
- feat: adding some configs for a faster postgres
- feat: calculate tvlUsd in real time in pool query
- feat: transacionCount24h to the PoolStats
- feat: get chart data by hours and days
- feat: store poolstats data by dateonly
- feat: query pairs by the protocol
- feat: group pools by id
- feat: more args for charts and transactions data in the pool query
- feat: logic to process changes in liquidity balances
- feat: get a token price by the protocol
- feat: tokenPrice and tokenPrices queries
- feat: token address in the token query and fix the empty transaction error in pools query
- feat: protocolAddress in pools query
- feat: query dexMetrics by protocol
- feat: migration for new index in pair model
- feat: create a pair if it doesn't exist when updating reserves
- feat: sort events by the transaction creationtime
- feat: sort events by the block height in the backfill
- feat: sentry plugin
- feat: add backfill function for pair tables

## May 13 - May 20, 2025

- merge: PR of Sushi
Expand Down
2 changes: 2 additions & 0 deletions bare-metal/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BACKUP_HOST_IP=100.000.0.1
SYNC_NETWORK=mainnet01
42 changes: 42 additions & 0 deletions bare-metal/Dockerfile.customdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM postgres:17

# Install pgBackRest and dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
pgbackrest \
openssh-client \
gettext-base \
ssh \
&& rm -rf /var/lib/apt/lists/*

# Create folders for pgBackRest and adjust permissions
RUN mkdir -p /tmp/pgbackrest /var/log/pgbackrest && \
chown postgres:postgres /tmp/pgbackrest /var/log/pgbackrest && \
chmod 700 /tmp/pgbackrest /var/log/pgbackrest

# Add the pgbackrest configuration file
COPY pgbackrest.conf.generated /etc/pgbackrest.conf
RUN chown postgres:postgres /etc/pgbackrest.conf && \
chmod 600 /etc/pgbackrest.conf

# Create the .ssh folder and copy the SSH keys
RUN mkdir -p /var/lib/postgresql/.ssh
COPY id_ed25519 /var/lib/postgresql/.ssh/id_ed25519
COPY id_ed25519.pub /var/lib/postgresql/.ssh/id_ed25519.pub

# Adjust permissions for the SSH keys
RUN chown -R postgres:postgres /var/lib/postgresql/.ssh && \
chmod 700 /var/lib/postgresql/.ssh && \
chmod 600 /var/lib/postgresql/.ssh/id_ed25519 && \
chmod 644 /var/lib/postgresql/.ssh/id_ed25519.pub

# Copy the custom initialization script
COPY script.sh.generated /script.sh
RUN chmod +x /script.sh

# Expose the default PostgreSQL port
EXPOSE 5432
EXPOSE 5433

# Default CMD to keep container alive and interactive
CMD ["bash"]
34 changes: 34 additions & 0 deletions bare-metal/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status.
set -e

# Check if .env file exists
if [ ! -f .env ]; then
echo "Error: .env file not found."
exit 1
fi

# Export variables from .env file
export $(grep -v '^#' .env | xargs)

# Check for required variables
if [ -z "$SYNC_NETWORK" ] || [ -z "$BACKUP_HOST_IP" ]; then
echo "Error: SYNC_NETWORK and BACKUP_HOST_IP must be set in .env"
exit 1
fi

# Substitute variables in script.sh.template
envsubst < ./script.sh.template > ./script.sh.generated

# Substitute variables in pgbackrest.conf.template
envsubst < ./pgbackrest.conf.template > ./pgbackrest.conf.generated

# Build the Docker image
docker build -f Dockerfile.customdb -t custom-db:${SYNC_NETWORK} .

# Clean up generated files
rm script.sh.generated
rm pgbackrest.conf.generated

echo "Docker image 'custom-db' built successfully."
14 changes: 14 additions & 0 deletions bare-metal/pgbackrest.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[global]
repo1-host=${BACKUP_HOST_IP}
repo1-host-user=ubuntu
repo1-path=/var/lib/pgbackrest
repo1-retention-full=1
repo1-retention-diff=7
start-fast=y
log-level-console=info
log-level-file=info

[${SYNC_NETWORK}]
pg1-path=/var/lib/postgresql/data
pg1-user=postgres
pg1-database=indexer
7 changes: 7 additions & 0 deletions bare-metal/script.sh.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

ssh-keyscan -H ${BACKUP_HOST_IP} >> ~postgres/.ssh/known_hosts
chown postgres:postgres ~postgres/.ssh/known_hosts
chmod 644 ~postgres/.ssh/known_hosts

exec /usr/local/bin/docker-entrypoint.sh postgres -c archive_mode=on -c archive_command='pgbackrest --stanza=${SYNC_NETWORK} archive-push %p' -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key -c shared_buffers=8GB -c effective_cache_size=24GB -c maintenance_work_mem=2GB -c work_mem=64MB -c max_wal_size=16GB -c random_page_cost=1.1 -c effective_io_concurrency=200 -c synchronous_commit=off
9 changes: 6 additions & 3 deletions indexer/src/kadena-server/config/graphql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1103,15 +1103,18 @@ export type SubscriptionEventsArgs = {
minimumDepth?: InputMaybe<Scalars['Int']['input']>;
parametersFilter?: InputMaybe<Scalars['String']['input']>;
qualifiedEventName: Scalars['String']['input'];
quantity?: InputMaybe<Scalars['Int']['input']>;
};

export type SubscriptionNewBlocksArgs = {
chainIds?: InputMaybe<Array<Scalars['String']['input']>>;
quantity?: InputMaybe<Scalars['Int']['input']>;
};

export type SubscriptionNewBlocksFromDepthArgs = {
chainIds?: InputMaybe<Array<Scalars['String']['input']>>;
minimumDepth: Scalars['Int']['input'];
quantity?: InputMaybe<Scalars['Int']['input']>;
};

export type SubscriptionTransactionArgs = {
Expand Down Expand Up @@ -3101,21 +3104,21 @@ export type SubscriptionResolvers<
'events',
ParentType,
ContextType,
RequireFields<SubscriptionEventsArgs, 'qualifiedEventName'>
RequireFields<SubscriptionEventsArgs, 'qualifiedEventName' | 'quantity'>
>;
newBlocks?: SubscriptionResolver<
Maybe<Array<ResolversTypes['Block']>>,
'newBlocks',
ParentType,
ContextType,
Partial<SubscriptionNewBlocksArgs>
RequireFields<SubscriptionNewBlocksArgs, 'quantity'>
>;
newBlocksFromDepth?: SubscriptionResolver<
Maybe<Array<ResolversTypes['Block']>>,
'newBlocksFromDepth',
ParentType,
ContextType,
RequireFields<SubscriptionNewBlocksFromDepthArgs, 'minimumDepth'>
RequireFields<SubscriptionNewBlocksFromDepthArgs, 'minimumDepth' | 'quantity'>
>;
transaction?: SubscriptionResolver<
Maybe<ResolversTypes['Transaction']>,
Expand Down
Loading