From 08c6bbdaf7b11df1932bc61bfc82202bedff3691 Mon Sep 17 00:00:00 2001 From: Yakovishin Evgeny <00705@inbox.ru> Date: Thu, 11 Jul 2024 20:08:48 +0300 Subject: [PATCH 1/7] init data base --- .env | 7 +++++++ Makefile | 15 ++++++++++++++ package.json | 2 ++ prisma/schema.prisma | 40 ++++++++++++++++++++++++++++++++++++ yarn.lock | 48 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 112 insertions(+) create mode 100644 .env create mode 100644 Makefile create mode 100644 prisma/schema.prisma diff --git a/.env b/.env new file mode 100644 index 0000000..153f9d9 --- /dev/null +++ b/.env @@ -0,0 +1,7 @@ +# Environment variables declared in this file are automatically made available to Prisma. +# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema + +# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB. +# See the documentation for all the connection string options: https://pris.ly/d/connection-strings + +DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public" \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5da5702 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +create-deps: + docker run --rm --name postgres -p "5432:5432" -e POSTGRES_DB=coindrops -e POSTGRES_USER=coindrops -e POSTGRES_PASSWORD=password -d "postgres:14-bullseye" + @sleep 5 + +destroy-deps: + docker rm -f postgres + +deploy-migrations: + npx prisma migrate deploy + +init-chains: + yarn ts-node tools/claim-data/init-chains.ts + +generate-schema: + npx prisma migrate dev \ No newline at end of file diff --git a/package.json b/package.json index 60b1b94..4b574e4 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@prisma/client": "^5.16.2", "next": "14.2.3", "next-themes": "^0.3.0", "react": "^18", @@ -27,6 +28,7 @@ "postcss": "^8", "prettier": "^3.2.5", "prettier-plugin-tailwindcss": "^0.5.14", + "prisma": "^5.16.2", "tailwindcss": "^3.4.1", "typescript": "^5" } diff --git a/prisma/schema.prisma b/prisma/schema.prisma new file mode 100644 index 0000000..42f0b6f --- /dev/null +++ b/prisma/schema.prisma @@ -0,0 +1,40 @@ +generator client { + provider = "prisma-client-js" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +model Chain { + chainId String @id + name String + coinType Int + denom String + minimalDenom String + coinDecimals Int + logoUrl String + walletUrlForStaking String + coinGeckoId String + bech32Prefix String + + lcdNodes LcdNode[] + rpcNodes RpcNode[] +} + +model RpcNode { + chainId String + chain Chain @relation(fields: [chainId], references: [chainId]) + url String + + @@id([chainId, url]) +} + +model LcdNode { + chainId String + chain Chain @relation(fields: [chainId], references: [chainId]) + url String + + @@id([chainId, url]) +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index a142346..477b59a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -435,6 +435,47 @@ resolved "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== +"@prisma/client@^5.16.2": + version "5.16.2" + resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.16.2.tgz#21df4c092eac29dcc4431ebed8c92579ffc9d8bd" + integrity sha512-+1lmkhR9gHWcTC5oghm2ZKpWljyWdzfazCVlLKUWXVmwHSf52g81aZ8qb6Km5Bs025yBi7puLp3qSLEvktoUtw== + +"@prisma/debug@5.16.2": + version "5.16.2" + resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.16.2.tgz#bf774f4768a3d1634887e6964fcfe04576dc7496" + integrity sha512-ItzB4nR4O8eLzuJiuP3WwUJfoIvewMHqpGCad+64gvThcKEVOtaUza9AEJo2DPqAOa/AWkFyK54oM4WwHeew+A== + +"@prisma/engines-version@5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303": + version "5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303" + resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303.tgz#63ceebefb7daa1eb17f250cad75d35999a50ee1b" + integrity sha512-HkT2WbfmFZ9WUPyuJHhkiADxazHg8Y4gByrTSVeb3OikP6tjQ7txtSUGu9OBOBH0C13dPKN2qqH12xKtHu/Hiw== + +"@prisma/engines@5.16.2": + version "5.16.2" + resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-5.16.2.tgz#d624c816c25a5cbad7ca13c7842b71557b6020e0" + integrity sha512-qUxwMtrwoG3byd4PbX6T7EjHJ8AUhzTuwniOGkh/hIznBfcE2QQnGakyEq4VnwNuttMqvh/GgPFapHQ3lCuRHg== + dependencies: + "@prisma/debug" "5.16.2" + "@prisma/engines-version" "5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303" + "@prisma/fetch-engine" "5.16.2" + "@prisma/get-platform" "5.16.2" + +"@prisma/fetch-engine@5.16.2": + version "5.16.2" + resolved "https://registry.yarnpkg.com/@prisma/fetch-engine/-/fetch-engine-5.16.2.tgz#e7e06cf246340e6ae06791f9133be275c5ee50e5" + integrity sha512-sq51lfHKfH2jjYSjBtMjP+AznFqOJzXpqmq6B9auWrlTJrMgZ7lPyhWUW7VU7LsQU48/TJ+DZeIz8s9bMYvcHg== + dependencies: + "@prisma/debug" "5.16.2" + "@prisma/engines-version" "5.16.0-24.34ace0eb2704183d2c05b60b52fba5c43c13f303" + "@prisma/get-platform" "5.16.2" + +"@prisma/get-platform@5.16.2": + version "5.16.2" + resolved "https://registry.yarnpkg.com/@prisma/get-platform/-/get-platform-5.16.2.tgz#f9b397ddf807b71411fd9d0b17374bc21e91cc40" + integrity sha512-cXiHPgNLNyj22vLouPVNegklpRL/iX2jxTeap5GRO3DmCoVyIHmJAV1CgUMUJhHlcol9yYy7EHvsnXTDJ/PKEA== + dependencies: + "@prisma/debug" "5.16.2" + "@rushstack/eslint-patch@^1.3.3": version "1.10.2" resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.2.tgz" @@ -2410,6 +2451,13 @@ prettier@^3.2.5: resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz" integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA== +prisma@^5.16.2: + version "5.16.2" + resolved "https://registry.yarnpkg.com/prisma/-/prisma-5.16.2.tgz#f46f130550bc148e603d25e06e82263fa6ab68e8" + integrity sha512-rFV/xoBR2hBGGlu4LPLQd4U8WVA+tSAmYyFWGPRVfj+xg7N4kiZV4lSk38htSpF+/IuHKzlrbh4SFk8Z18cI8A== + dependencies: + "@prisma/engines" "5.16.2" + prop-types@^15.8.1: version "15.8.1" resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" From b72b0337e147860595b0382e4caf8cd766affed0 Mon Sep 17 00:00:00 2001 From: Yakovishin Evgeny <00705@inbox.ru> Date: Sun, 14 Jul 2024 19:37:07 +0300 Subject: [PATCH 2/7] init db --- .env | 2 +- Makefile | 4 +- .../20240714162839_init_chains/migration.sql | 62 +++++++++++++++++ prisma/migrations/migration_lock.toml | 3 + prisma/schema.prisma | 19 ++++++ src/tools/chains/init-chains.ts | 68 +++++++++++++++++++ 6 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 prisma/migrations/20240714162839_init_chains/migration.sql create mode 100644 prisma/migrations/migration_lock.toml create mode 100644 src/tools/chains/init-chains.ts diff --git a/.env b/.env index 153f9d9..637fc57 100644 --- a/.env +++ b/.env @@ -4,4 +4,4 @@ # Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB. # See the documentation for all the connection string options: https://pris.ly/d/connection-strings -DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public" \ No newline at end of file +DATABASE_URL="postgresql://validatorinfo:password@localhost:5432/mydb?schema=public" \ No newline at end of file diff --git a/Makefile b/Makefile index 5da5702..0db62a7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ create-deps: - docker run --rm --name postgres -p "5432:5432" -e POSTGRES_DB=coindrops -e POSTGRES_USER=coindrops -e POSTGRES_PASSWORD=password -d "postgres:14-bullseye" + docker run --rm --name postgres -p "5432:5432" -e POSTGRES_DB=validatorinfo -e POSTGRES_USER=validatorinfo -e POSTGRES_PASSWORD=password -d "postgres:14-bullseye" @sleep 5 destroy-deps: @@ -9,7 +9,7 @@ deploy-migrations: npx prisma migrate deploy init-chains: - yarn ts-node tools/claim-data/init-chains.ts + yarn ts-node tools/chains/init-chains.ts generate-schema: npx prisma migrate dev \ No newline at end of file diff --git a/prisma/migrations/20240714162839_init_chains/migration.sql b/prisma/migrations/20240714162839_init_chains/migration.sql new file mode 100644 index 0000000..e6b2705 --- /dev/null +++ b/prisma/migrations/20240714162839_init_chains/migration.sql @@ -0,0 +1,62 @@ +-- CreateTable +CREATE TABLE "Chain" ( + "chainId" TEXT NOT NULL, + "name" TEXT NOT NULL, + "coinType" INTEGER NOT NULL, + "denom" TEXT NOT NULL, + "minimalDenom" TEXT NOT NULL, + "coinDecimals" INTEGER NOT NULL, + "logoUrl" TEXT NOT NULL, + "walletUrlForStaking" TEXT NOT NULL, + "coinGeckoId" TEXT NOT NULL, + "bech32Prefix" TEXT NOT NULL, + "twitterUrl" TEXT NOT NULL, + "docs" TEXT, + + CONSTRAINT "Chain_pkey" PRIMARY KEY ("chainId") +); + +-- CreateTable +CREATE TABLE "Github" ( + "chainId" TEXT NOT NULL, + "url" TEXT NOT NULL, + "mainRepo" TEXT NOT NULL, + + CONSTRAINT "Github_pkey" PRIMARY KEY ("chainId") +); + +-- CreateTable +CREATE TABLE "RpcNode" ( + "chainId" TEXT NOT NULL, + "url" TEXT NOT NULL, + + CONSTRAINT "RpcNode_pkey" PRIMARY KEY ("chainId","url") +); + +-- CreateTable +CREATE TABLE "LcdNode" ( + "chainId" TEXT NOT NULL, + "url" TEXT NOT NULL, + + CONSTRAINT "LcdNode_pkey" PRIMARY KEY ("chainId","url") +); + +-- CreateTable +CREATE TABLE "GrpcNode" ( + "chainId" TEXT NOT NULL, + "url" TEXT NOT NULL, + + CONSTRAINT "GrpcNode_pkey" PRIMARY KEY ("chainId","url") +); + +-- AddForeignKey +ALTER TABLE "Github" ADD CONSTRAINT "Github_chainId_fkey" FOREIGN KEY ("chainId") REFERENCES "Chain"("chainId") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "RpcNode" ADD CONSTRAINT "RpcNode_chainId_fkey" FOREIGN KEY ("chainId") REFERENCES "Chain"("chainId") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "LcdNode" ADD CONSTRAINT "LcdNode_chainId_fkey" FOREIGN KEY ("chainId") REFERENCES "Chain"("chainId") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "GrpcNode" ADD CONSTRAINT "GrpcNode_chainId_fkey" FOREIGN KEY ("chainId") REFERENCES "Chain"("chainId") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..fbffa92 --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "postgresql" \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 42f0b6f..4ebf932 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -18,9 +18,20 @@ model Chain { walletUrlForStaking String coinGeckoId String bech32Prefix String + twitterUrl String + docs String? + github Github? lcdNodes LcdNode[] rpcNodes RpcNode[] + grpc GrpcNode[] +} + +model Github { + chainId String @id + chain Chain @relation(fields: [chainId], references: [chainId]) + url String + mainRepo String } model RpcNode { @@ -36,5 +47,13 @@ model LcdNode { chain Chain @relation(fields: [chainId], references: [chainId]) url String + @@id([chainId, url]) +} + +model GrpcNode { + chainId String + chain Chain @relation(fields: [chainId], references: [chainId]) + url String + @@id([chainId, url]) } \ No newline at end of file diff --git a/src/tools/chains/init-chains.ts b/src/tools/chains/init-chains.ts new file mode 100644 index 0000000..6b8f112 --- /dev/null +++ b/src/tools/chains/init-chains.ts @@ -0,0 +1,68 @@ +import { PrismaClient } from '@prisma/client'; + +const prisma = new PrismaClient(); + +interface Github { + url: string; + mainRepo: string; +} + +export async function addNetwork( + chainId: string, + name: string, + denom: string, + minimalDenom: string, + logoUrl: string, + walletUrlForStaking: string, + coinGeckoId: string, + bech32Prefix: string, + lcdNodeUrl: string, + rpcNodeUrl: string, + grpcNodeUrl: string, + coinDecimals: number, + coinType: number, + twitterUrl: string, + docs: string | null = null, + mainRepo: string, + githubUrl: string, +) { + await prisma.chain.upsert({ + where: { chainId }, + update: {}, + create: { + chainId, + name, + denom, + minimalDenom, + coinDecimals, + coinType, + logoUrl, + walletUrlForStaking, + coinGeckoId, + bech32Prefix, + twitterUrl, + docs, + github: { + create: { + url: githubUrl, + mainRepo: mainRepo, + }, + }, + lcdNodes: { + create: { + url: lcdNodeUrl, + }, + }, + rpcNodes: { + create: { + url: rpcNodeUrl, + }, + }, + grpc: { + create: { + url: grpcNodeUrl, + }, + }, + }, + }); +} From 0f5f91eb4be91d66f0cc5ebb155c78e7d4067edf Mon Sep 17 00:00:00 2001 From: Yakovishin Evgeny <00705@inbox.ru> Date: Sun, 14 Jul 2024 20:50:09 +0300 Subject: [PATCH 3/7] add chain and fixes --- .../20240714172811_fix/migration.sql | 8 + .../20240714173826_add_ws_node/migration.sql | 10 + prisma/schema.prisma | 10 +- src/tools/chains/init-chains.ts | 245 +++++++++++++++--- 4 files changed, 232 insertions(+), 41 deletions(-) create mode 100644 prisma/migrations/20240714172811_fix/migration.sql create mode 100644 prisma/migrations/20240714173826_add_ws_node/migration.sql diff --git a/prisma/migrations/20240714172811_fix/migration.sql b/prisma/migrations/20240714172811_fix/migration.sql new file mode 100644 index 0000000..c9df5a6 --- /dev/null +++ b/prisma/migrations/20240714172811_fix/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - You are about to drop the column `walletUrlForStaking` on the `Chain` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "Chain" DROP COLUMN "walletUrlForStaking"; diff --git a/prisma/migrations/20240714173826_add_ws_node/migration.sql b/prisma/migrations/20240714173826_add_ws_node/migration.sql new file mode 100644 index 0000000..f2fcc23 --- /dev/null +++ b/prisma/migrations/20240714173826_add_ws_node/migration.sql @@ -0,0 +1,10 @@ +-- CreateTable +CREATE TABLE "WsNode" ( + "chainId" TEXT NOT NULL, + "url" TEXT NOT NULL, + + CONSTRAINT "WsNode_pkey" PRIMARY KEY ("chainId","url") +); + +-- AddForeignKey +ALTER TABLE "WsNode" ADD CONSTRAINT "WsNode_chainId_fkey" FOREIGN KEY ("chainId") REFERENCES "Chain"("chainId") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4ebf932..e547069 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -15,7 +15,6 @@ model Chain { minimalDenom String coinDecimals Int logoUrl String - walletUrlForStaking String coinGeckoId String bech32Prefix String twitterUrl String @@ -24,6 +23,7 @@ model Chain { github Github? lcdNodes LcdNode[] rpcNodes RpcNode[] + wsNodes WsNode[] grpc GrpcNode[] } @@ -34,6 +34,14 @@ model Github { mainRepo String } +model WsNode { + chainId String + chain Chain @relation(fields: [chainId], references: [chainId]) + url String + + @@id([chainId, url]) +} + model RpcNode { chainId String chain Chain @relation(fields: [chainId], references: [chainId]) diff --git a/src/tools/chains/init-chains.ts b/src/tools/chains/init-chains.ts index 6b8f112..1bbfdcf 100644 --- a/src/tools/chains/init-chains.ts +++ b/src/tools/chains/init-chains.ts @@ -1,68 +1,233 @@ import { PrismaClient } from '@prisma/client'; + const prisma = new PrismaClient(); -interface Github { - url: string; +type Chain = { + chainId: string; + name: string; + denom: string; + minimalDenom: string; + logoUrl: string; + coinGeckoId: string; + bech32Prefix: string; + lcdNodeUrl: string; + rpcNodeUrl: string; + grpcNodeUrl: string; + wsNodeUrl: string; + coinDecimals: number; + coinType: number; + twitterUrl: string; + docs: string | null; mainRepo: string; -} + githubUrl: string; +}; -export async function addNetwork( - chainId: string, - name: string, - denom: string, - minimalDenom: string, - logoUrl: string, - walletUrlForStaking: string, - coinGeckoId: string, - bech32Prefix: string, - lcdNodeUrl: string, - rpcNodeUrl: string, - grpcNodeUrl: string, - coinDecimals: number, - coinType: number, - twitterUrl: string, - docs: string | null = null, - mainRepo: string, - githubUrl: string, -) { +async function addNetwork(chain: Chain): Promise { await prisma.chain.upsert({ - where: { chainId }, + where: { chainId: chain.chainId }, update: {}, create: { - chainId, - name, - denom, - minimalDenom, - coinDecimals, - coinType, - logoUrl, - walletUrlForStaking, - coinGeckoId, - bech32Prefix, - twitterUrl, - docs, + chainId: chain.chainId, + name: chain.name, + denom: chain.denom, + minimalDenom: chain.minimalDenom, + coinDecimals: chain.coinDecimals, + coinType: chain.coinType, + logoUrl: chain.logoUrl, + coinGeckoId: chain.coinGeckoId, + bech32Prefix: chain.bech32Prefix, + twitterUrl: chain.twitterUrl, + docs: chain.docs, github: { create: { - url: githubUrl, - mainRepo: mainRepo, + url: chain.githubUrl, + mainRepo: chain.mainRepo, }, }, lcdNodes: { create: { - url: lcdNodeUrl, + url: chain.lcdNodeUrl, }, }, rpcNodes: { create: { - url: rpcNodeUrl, + url: chain.rpcNodeUrl, }, }, grpc: { create: { - url: grpcNodeUrl, + url: chain.grpcNodeUrl, + }, + }, + wsNodes: { + create: { + url: chain.wsNodeUrl, }, }, }, }); } + +async function main() { + await addNetwork({ + name: 'CosmosHub', + chainId: 'cosmoshub-4', + bech32Prefix: 'cosmos', + coinDecimals: 6, + coinGeckoId: 'cosmoshub', + coinType: 118, + denom: 'ATOM', + minimalDenom: 'uatom', + grpcNodeUrl: 'grpc.cosmoshub-4.citizenweb3.com/', + lcdNodeUrl: 'https://api.cosmoshub-4.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.cosmoshub-4.citizenweb3.com/', + wsNodeUrl: '', + logoUrl: '', + mainRepo: '', + docs: '', + githubUrl: '', + twitterUrl: '', + }); + + await addNetwork({ + name: 'Celestia', + chainId: 'celestia', + bech32Prefix: 'tia', + coinDecimals: 6, + coinGeckoId: 'celestia', + coinType: 118, + denom: 'TIA', + minimalDenom: 'utia', + grpcNodeUrl: 'grpc.celestia.citizenweb3.com/', + lcdNodeUrl: 'https://api.celestia.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.celestia.citizenweb3.com/', + wsNodeUrl: '', + logoUrl: '', + mainRepo: '', + docs: '', + githubUrl: '', + twitterUrl: '', + }); + + await addNetwork({ + name: 'Picasso', + chainId: 'centauri-1', + bech32Prefix: 'pica', + coinDecimals: 6, + coinGeckoId: '', + coinType: 118, + denom: 'PICA', + minimalDenom: 'ppica', + grpcNodeUrl: 'grpc.celestia.citizenweb3.com/', + lcdNodeUrl: 'https://api.celestia.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.celestia.citizenweb3.com/', + wsNodeUrl: '', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', + mainRepo: '', + docs: '', + githubUrl: '', + twitterUrl: '', + }); + + await addNetwork({ + name: 'Picasso', + chainId: 'centauri-1', + bech32Prefix: 'pica', + coinDecimals: 6, + coinGeckoId: '', + coinType: 118, + denom: 'PICA', + minimalDenom: 'ppica', + grpcNodeUrl: 'grpc.composable.citizenweb3.com/', + lcdNodeUrl: 'https://api.composable.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.composable.citizenweb3.com/', + wsNodeUrl: '', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', + mainRepo: '', + docs: '', + githubUrl: '', + twitterUrl: '', + }); + + await addNetwork({ + name: 'Evmos', + chainId: 'evmos_9001-2', + bech32Prefix: 'evmos', + coinDecimals: 18, + coinGeckoId: '', + coinType: 60, + denom: 'EVMOS', + minimalDenom: 'aevmos', + grpcNodeUrl: 'grpc.evmos.citizenweb3.com/', + lcdNodeUrl: 'https://api.evmos.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.evmos.citizenweb3.com/', + wsNodeUrl: '', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', + mainRepo: '', + docs: '', + githubUrl: '', + twitterUrl: '', + }); + + await addNetwork({ + name: 'BitCanna', + chainId: 'bitcanna-1', + bech32Prefix: 'bcna', + coinDecimals: 6, + coinGeckoId: '', + coinType: 118, + denom: 'BCNA', + minimalDenom: 'ubcna', + grpcNodeUrl: 'grpc.bitcanna.citizenweb3.com/', + lcdNodeUrl: 'https://api.bitcanna.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.bitcanna.citizenweb3.com/', + wsNodeUrl: '', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', + mainRepo: '', + docs: '', + githubUrl: '', + twitterUrl: '', + }); + + + await addNetwork({ + name: 'Likecoin', + chainId: 'likecoin-mainnet-2', + bech32Prefix: 'bcna', + coinDecimals: 6, + coinGeckoId: '', + coinType: 118, + denom: 'LIKE', + minimalDenom: 'nanolike', + grpcNodeUrl: 'grpc.likecoin.citizenweb3.com/', + lcdNodeUrl: 'https://api.likecoin.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.likecoin.citizenweb3.com/', + wsNodeUrl: '', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', + mainRepo: '', + docs: '', + githubUrl: '', + twitterUrl: '', + }); + + await addNetwork({ + name: 'Stride', + chainId: 'stride-1', + bech32Prefix: 'stride', + coinDecimals: 6, + coinGeckoId: '', + coinType: 118, + denom: 'STRD', + minimalDenom: 'ustrd', + grpcNodeUrl: 'grpc.stride.citizenweb3.com/', + lcdNodeUrl: 'https://api.stride.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.stride.citizenweb3.com/', + wsNodeUrl: '', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', + mainRepo: '', + docs: '', + githubUrl: '', + twitterUrl: '', + }); +} \ No newline at end of file From 15b995bc3e549683706364dad12b158bb3c4a1a3 Mon Sep 17 00:00:00 2001 From: Yakovishin Evgeny <00705@inbox.ru> Date: Tue, 16 Jul 2024 15:07:10 +0300 Subject: [PATCH 4/7] fixes and launch api --- Makefile | 2 +- package.json | 2 + src/app/api/chains/route.ts | 11 +++ src/constants.ts | 0 src/tools/chains/init-chains.ts | 116 ++++++++++++++------------------ tsconfig.json | 3 +- yarn.lock | 116 +++++++++++++++++++++++++++++++- 7 files changed, 179 insertions(+), 71 deletions(-) create mode 100644 src/app/api/chains/route.ts create mode 100644 src/constants.ts diff --git a/Makefile b/Makefile index 0db62a7..1e9f7e5 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ deploy-migrations: npx prisma migrate deploy init-chains: - yarn ts-node tools/chains/init-chains.ts + yarn ts-node-esm src/tools/chains/init-chains.ts generate-schema: npx prisma migrate dev \ No newline at end of file diff --git a/package.json b/package.json index 4b574e4..b621552 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@prisma/client": "^5.16.2", + "cron": "^3.1.7", "next": "14.2.3", "next-themes": "^0.3.0", "react": "^18", @@ -30,6 +31,7 @@ "prettier-plugin-tailwindcss": "^0.5.14", "prisma": "^5.16.2", "tailwindcss": "^3.4.1", + "ts-node": "^10.9.2", "typescript": "^5" } } diff --git a/src/app/api/chains/route.ts b/src/app/api/chains/route.ts new file mode 100644 index 0000000..974f1ff --- /dev/null +++ b/src/app/api/chains/route.ts @@ -0,0 +1,11 @@ +import { PrismaClient } from '@prisma/client'; +import type { NextApiRequest, NextApiResponse } from 'next'; + +const client = new PrismaClient(); + + + +export async function GET(req: NextApiRequest) { + const networks = await client.chain.findMany({ include: { lcdNodes: true, rpcNodes: true, grpc: true, wsNodes: true, github: true } }); + return Response.json(networks) +} diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/tools/chains/init-chains.ts b/src/tools/chains/init-chains.ts index 1bbfdcf..3318439 100644 --- a/src/tools/chains/init-chains.ts +++ b/src/tools/chains/init-chains.ts @@ -82,12 +82,12 @@ async function main() { grpcNodeUrl: 'grpc.cosmoshub-4.citizenweb3.com/', lcdNodeUrl: 'https://api.cosmoshub-4.citizenweb3.com/', rpcNodeUrl: 'https://rpc.cosmoshub-4.citizenweb3.com/', - wsNodeUrl: '', - logoUrl: '', - mainRepo: '', - docs: '', - githubUrl: '', - twitterUrl: '', + wsNodeUrl: 'wss://rpc.cosmoshub-4.citizenweb3.com/websocket', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/cosmoshub/images/atom.svg', + mainRepo: 'https://github.com/cosmos/gaia', + docs: 'https://cosmos.network/', + githubUrl: 'https://github.com/cosmos', + twitterUrl: '123', }); await addNetwork({ @@ -102,12 +102,12 @@ async function main() { grpcNodeUrl: 'grpc.celestia.citizenweb3.com/', lcdNodeUrl: 'https://api.celestia.citizenweb3.com/', rpcNodeUrl: 'https://rpc.celestia.citizenweb3.com/', - wsNodeUrl: '', - logoUrl: '', - mainRepo: '', - docs: '', - githubUrl: '', - twitterUrl: '', + wsNodeUrl: 'wss://rpc.celestia.citizenweb3.com/websocket', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/celestia/images/celestia.svg', + mainRepo: '123', + docs: '123', + githubUrl: '123', + twitterUrl: '123', }); await addNetwork({ @@ -115,39 +115,19 @@ async function main() { chainId: 'centauri-1', bech32Prefix: 'pica', coinDecimals: 6, - coinGeckoId: '', + coinGeckoId: '123', coinType: 118, denom: 'PICA', minimalDenom: 'ppica', grpcNodeUrl: 'grpc.celestia.citizenweb3.com/', - lcdNodeUrl: 'https://api.celestia.citizenweb3.com/', - rpcNodeUrl: 'https://rpc.celestia.citizenweb3.com/', - wsNodeUrl: '', - logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', - mainRepo: '', - docs: '', - githubUrl: '', - twitterUrl: '', - }); - - await addNetwork({ - name: 'Picasso', - chainId: 'centauri-1', - bech32Prefix: 'pica', - coinDecimals: 6, - coinGeckoId: '', - coinType: 118, - denom: 'PICA', - minimalDenom: 'ppica', - grpcNodeUrl: 'grpc.composable.citizenweb3.com/', lcdNodeUrl: 'https://api.composable.citizenweb3.com/', rpcNodeUrl: 'https://rpc.composable.citizenweb3.com/', - wsNodeUrl: '', + wsNodeUrl: 'wss://rpc.composable.com/websocket', logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', - mainRepo: '', - docs: '', - githubUrl: '', - twitterUrl: '', + mainRepo: '123', + docs: '123', + githubUrl: '123', + twitterUrl: '123', }); await addNetwork({ @@ -155,19 +135,19 @@ async function main() { chainId: 'evmos_9001-2', bech32Prefix: 'evmos', coinDecimals: 18, - coinGeckoId: '', + coinGeckoId: '123', coinType: 60, denom: 'EVMOS', minimalDenom: 'aevmos', grpcNodeUrl: 'grpc.evmos.citizenweb3.com/', lcdNodeUrl: 'https://api.evmos.citizenweb3.com/', rpcNodeUrl: 'https://rpc.evmos.citizenweb3.com/', - wsNodeUrl: '', - logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', - mainRepo: '', - docs: '', - githubUrl: '', - twitterUrl: '', + wsNodeUrl: 'wss://rpc.evmos.citizenweb3.com/websocket', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/evmos/images/evmos.svg', + mainRepo: '123', + docs: '123', + githubUrl: '11223', + twitterUrl: '123', }); await addNetwork({ @@ -175,19 +155,19 @@ async function main() { chainId: 'bitcanna-1', bech32Prefix: 'bcna', coinDecimals: 6, - coinGeckoId: '', + coinGeckoId: '123', coinType: 118, denom: 'BCNA', minimalDenom: 'ubcna', grpcNodeUrl: 'grpc.bitcanna.citizenweb3.com/', lcdNodeUrl: 'https://api.bitcanna.citizenweb3.com/', rpcNodeUrl: 'https://rpc.bitcanna.citizenweb3.com/', - wsNodeUrl: '', - logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', - mainRepo: '', - docs: '', - githubUrl: '', - twitterUrl: '', + wsNodeUrl: 'wss://rpc.bitcanna.citizenweb3.com/websocket', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/bitcanna/images/bcna.svg', + mainRepo: '123', + docs: '123', + githubUrl: '123', + twitterUrl: '123', }); @@ -196,19 +176,19 @@ async function main() { chainId: 'likecoin-mainnet-2', bech32Prefix: 'bcna', coinDecimals: 6, - coinGeckoId: '', + coinGeckoId: '123', coinType: 118, denom: 'LIKE', minimalDenom: 'nanolike', grpcNodeUrl: 'grpc.likecoin.citizenweb3.com/', lcdNodeUrl: 'https://api.likecoin.citizenweb3.com/', rpcNodeUrl: 'https://rpc.likecoin.citizenweb3.com/', - wsNodeUrl: '', - logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', - mainRepo: '', - docs: '', - githubUrl: '', - twitterUrl: '', + wsNodeUrl: 'wss://rpc.likecoin.citizenweb3.com/websocket', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/likecoin/images/likecoin-chain-logo.svg', + mainRepo: '123', + docs: '123', + githubUrl: '123', + twitterUrl: '123', }); await addNetwork({ @@ -216,18 +196,20 @@ async function main() { chainId: 'stride-1', bech32Prefix: 'stride', coinDecimals: 6, - coinGeckoId: '', + coinGeckoId: '123', coinType: 118, denom: 'STRD', minimalDenom: 'ustrd', grpcNodeUrl: 'grpc.stride.citizenweb3.com/', lcdNodeUrl: 'https://api.stride.citizenweb3.com/', rpcNodeUrl: 'https://rpc.stride.citizenweb3.com/', - wsNodeUrl: '', - logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', - mainRepo: '', - docs: '', - githubUrl: '', - twitterUrl: '', + wsNodeUrl: 'wss://rpc.stride.citizenweb3.com/websocket', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/strd.svg', + mainRepo: '123', + docs: '123', + githubUrl: '123', + twitterUrl: '123', }); -} \ No newline at end of file +} + +main() \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index de90f7c..72aa1fb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,8 +6,7 @@ "strict": true, "noEmit": true, "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "bundler", + "module": "CommonJS", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", diff --git a/yarn.lock b/yarn.lock index 477b59a..3c4ab1c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -137,6 +137,13 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + "@emnapi/runtime@^1.1.1": version "1.2.0" resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.2.0.tgz#71d018546c3a91f3b51106530edbc056b9f2f2e3" @@ -329,7 +336,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.24" -"@jridgewell/resolve-uri@^3.1.0": +"@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0": version "3.1.2" resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz" integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== @@ -344,6 +351,14 @@ resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz" @@ -506,11 +521,36 @@ javascript-natural-sort "0.7.1" lodash "^4.17.21" +"@tsconfig/node10@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" + integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" + integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/luxon@~3.4.0": + version "3.4.2" + resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-3.4.2.tgz#e4fc7214a420173cea47739c33cdf10874694db7" + integrity sha512-TifLZlFudklWlMBfhubvgqTXRzLDI5pCbGa4P8a3wPyUQSW+1xQ5eDsreP9DWHX3tjq1ke96uYG/nwundroWcA== + "@types/node@^20": version "20.12.11" resolved "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz" @@ -594,6 +634,18 @@ acorn-jsx@^5.3.2: resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== +acorn-walk@^8.1.1: + version "8.3.3" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" + integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== + dependencies: + acorn "^8.11.0" + +acorn@^8.11.0, acorn@^8.4.1: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + acorn@^8.9.0: version "8.11.3" resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz" @@ -651,6 +703,11 @@ anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + arg@^5.0.2: version "5.0.2" resolved "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz" @@ -948,6 +1005,19 @@ concat-map@0.0.1: resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +cron@^3.1.7: + version "3.1.7" + resolved "https://registry.yarnpkg.com/cron/-/cron-3.1.7.tgz#3423d618ba625e78458fff8cb67001672d49ba0d" + integrity sha512-tlBg7ARsAMQLzgwqVxy8AZl/qlTc5nibqYwtNGoCrd+cV+ugI+tvZC1oT/8dFH8W455YrywGykx/KMmAqOr7Jw== + dependencies: + "@types/luxon" "~3.4.0" + luxon "~3.4.0" + cross-spawn@^7.0.0, cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" @@ -1051,6 +1121,11 @@ didyoumean@^1.2.2: resolved "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz" integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz" @@ -2099,6 +2174,16 @@ lru-cache@^10.2.0: resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz" integrity sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ== +luxon@~3.4.0: + version "3.4.4" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.4.4.tgz#cf20dc27dc532ba41a169c43fdcc0063601577af" + integrity sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA== + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" @@ -2934,6 +3019,25 @@ ts-interface-checker@^0.1.9: resolved "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz" integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + tsconfig-paths@^3.15.0: version "3.15.0" resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz" @@ -3044,6 +3148,11 @@ util-deprecate@^1.0.2: resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + which-boxed-primitive@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz" @@ -3134,6 +3243,11 @@ yaml@^2.3.4: resolved "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz" integrity sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA== +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" From bb497337f585fb49c98da1c9de67e865007d53dc Mon Sep 17 00:00:00 2001 From: Yakovishin Evgeny <00705@inbox.ru> Date: Tue, 16 Jul 2024 17:47:03 +0300 Subject: [PATCH 5/7] add fixes and cahin routes --- .../migration.sql | 8 +++ prisma/schema.prisma | 1 + src/app/api/[chain]/apr/route.ts | 10 +++ src/app/api/[chain]/route.ts | 9 +++ src/app/api/chains/route.ts | 8 +-- src/tools/chains/init-chains.ts | 63 ++++++++++--------- 6 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 prisma/migrations/20240716144238_pertty_name_fix/migration.sql create mode 100644 src/app/api/[chain]/apr/route.ts create mode 100644 src/app/api/[chain]/route.ts diff --git a/prisma/migrations/20240716144238_pertty_name_fix/migration.sql b/prisma/migrations/20240716144238_pertty_name_fix/migration.sql new file mode 100644 index 0000000..abc6ccf --- /dev/null +++ b/prisma/migrations/20240716144238_pertty_name_fix/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - Added the required column `prettyName` to the `Chain` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "Chain" ADD COLUMN "prettyName" TEXT NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index e547069..14e9dcc 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -10,6 +10,7 @@ datasource db { model Chain { chainId String @id name String + prettyName String coinType Int denom String minimalDenom String diff --git a/src/app/api/[chain]/apr/route.ts b/src/app/api/[chain]/apr/route.ts new file mode 100644 index 0000000..639afcb --- /dev/null +++ b/src/app/api/[chain]/apr/route.ts @@ -0,0 +1,10 @@ +import { PrismaClient } from '@prisma/client'; +import type { NextApiRequest, NextApiResponse } from 'next'; + +export async function GET(request: Request, { params }: { params: { chain: string } }) { + const { chain } = params; + const client = new PrismaClient() + + + return Response.json(chain) +} diff --git a/src/app/api/[chain]/route.ts b/src/app/api/[chain]/route.ts new file mode 100644 index 0000000..7ad3498 --- /dev/null +++ b/src/app/api/[chain]/route.ts @@ -0,0 +1,9 @@ +import { PrismaClient } from '@prisma/client'; +import type { NextApiRequest, NextApiResponse } from 'next'; + +export async function GET(request: Request, { params }: { params: { chain: string } }) { + const { chain } = params; + const client = new PrismaClient(); + const dbResponse = await client.chain.findFirst({ where: { name: chain } }); + return Response.json(dbResponse); +} diff --git a/src/app/api/chains/route.ts b/src/app/api/chains/route.ts index 974f1ff..16d4154 100644 --- a/src/app/api/chains/route.ts +++ b/src/app/api/chains/route.ts @@ -3,9 +3,9 @@ import type { NextApiRequest, NextApiResponse } from 'next'; const client = new PrismaClient(); - - export async function GET(req: NextApiRequest) { - const networks = await client.chain.findMany({ include: { lcdNodes: true, rpcNodes: true, grpc: true, wsNodes: true, github: true } }); - return Response.json(networks) + const networks = await client.chain.findMany({ + include: { lcdNodes: true, rpcNodes: true, grpc: true, wsNodes: true, github: true }, + }); + return Response.json(networks); } diff --git a/src/tools/chains/init-chains.ts b/src/tools/chains/init-chains.ts index 3318439..efa53ba 100644 --- a/src/tools/chains/init-chains.ts +++ b/src/tools/chains/init-chains.ts @@ -1,11 +1,11 @@ import { PrismaClient } from '@prisma/client'; - const prisma = new PrismaClient(); type Chain = { chainId: string; name: string; + prettyName: string; denom: string; minimalDenom: string; logoUrl: string; @@ -30,6 +30,7 @@ async function addNetwork(chain: Chain): Promise { create: { chainId: chain.chainId, name: chain.name, + prettyName: chain.prettyName, denom: chain.denom, minimalDenom: chain.minimalDenom, coinDecimals: chain.coinDecimals, @@ -71,7 +72,8 @@ async function addNetwork(chain: Chain): Promise { async function main() { await addNetwork({ - name: 'CosmosHub', + name: 'cosmoshub', + prettyName: 'CosmosHub', chainId: 'cosmoshub-4', bech32Prefix: 'cosmos', coinDecimals: 6, @@ -91,7 +93,8 @@ async function main() { }); await addNetwork({ - name: 'Celestia', + name: 'celestia', + prettyName: 'Celestia', chainId: 'celestia', bech32Prefix: 'tia', coinDecimals: 6, @@ -111,7 +114,8 @@ async function main() { }); await addNetwork({ - name: 'Picasso', + name: 'picasso', + prettyName: 'Picasso', chainId: 'centauri-1', bech32Prefix: 'pica', coinDecimals: 6, @@ -131,7 +135,8 @@ async function main() { }); await addNetwork({ - name: 'Evmos', + name: 'evmos', + prettyName: 'Evmos', chainId: 'evmos_9001-2', bech32Prefix: 'evmos', coinDecimals: 18, @@ -151,7 +156,8 @@ async function main() { }); await addNetwork({ - name: 'BitCanna', + name: 'bitcanna', + prettyName: 'BitCanna', chainId: 'bitcanna-1', bech32Prefix: 'bcna', coinDecimals: 6, @@ -170,9 +176,9 @@ async function main() { twitterUrl: '123', }); - await addNetwork({ - name: 'Likecoin', + name: 'likecoin', + prettyName: 'LikeCoin', chainId: 'likecoin-mainnet-2', bech32Prefix: 'bcna', coinDecimals: 6, @@ -191,25 +197,26 @@ async function main() { twitterUrl: '123', }); - await addNetwork({ - name: 'Stride', - chainId: 'stride-1', - bech32Prefix: 'stride', - coinDecimals: 6, - coinGeckoId: '123', - coinType: 118, - denom: 'STRD', - minimalDenom: 'ustrd', - grpcNodeUrl: 'grpc.stride.citizenweb3.com/', - lcdNodeUrl: 'https://api.stride.citizenweb3.com/', - rpcNodeUrl: 'https://rpc.stride.citizenweb3.com/', - wsNodeUrl: 'wss://rpc.stride.citizenweb3.com/websocket', - logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/strd.svg', - mainRepo: '123', - docs: '123', - githubUrl: '123', - twitterUrl: '123', - }); + await addNetwork({ + name: 'stride', + prettyName: 'Stride', + chainId: 'stride-1', + bech32Prefix: 'stride', + coinDecimals: 6, + coinGeckoId: '123', + coinType: 118, + denom: 'STRD', + minimalDenom: 'ustrd', + grpcNodeUrl: 'grpc.stride.citizenweb3.com/', + lcdNodeUrl: 'https://api.stride.citizenweb3.com/', + rpcNodeUrl: 'https://rpc.stride.citizenweb3.com/', + wsNodeUrl: 'wss://rpc.stride.citizenweb3.com/websocket', + logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/stride/images/strd.svg', + mainRepo: '123', + docs: '123', + githubUrl: '123', + twitterUrl: '123', + }); } -main() \ No newline at end of file +main(); From 10a71a28a925e7c6c5f98eec3a7e0c2a423774b4 Mon Sep 17 00:00:00 2001 From: Yakovishin Evgeny <00705@inbox.ru> Date: Wed, 17 Jul 2024 06:07:43 +0300 Subject: [PATCH 6/7] add indexer-server --- Makefile | 5 +- package.json | 7 +- server/server.ts | 42 +++++ yarn.lock | 447 ++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 498 insertions(+), 3 deletions(-) create mode 100644 server/server.ts diff --git a/Makefile b/Makefile index 1e9f7e5..0300433 100644 --- a/Makefile +++ b/Makefile @@ -12,4 +12,7 @@ init-chains: yarn ts-node-esm src/tools/chains/init-chains.ts generate-schema: - npx prisma migrate dev \ No newline at end of file + npx prisma migrate dev + +start-indexer: + yarn ts-node-esm server/server.ts \ No newline at end of file diff --git a/package.json b/package.json index b621552..44475d2 100644 --- a/package.json +++ b/package.json @@ -11,19 +11,24 @@ "dependencies": { "@prisma/client": "^5.16.2", "cron": "^3.1.7", + "dotenv": "^16.4.5", + "express": "^4.19.2", "next": "14.2.3", "next-themes": "^0.3.0", "react": "^18", "react-dom": "^18", "sharp": "^0.33.4", "tailwind-scrollbar": "^3.1.0", - "usehooks-ts": "^3.1.0" + "usehooks-ts": "^3.1.0", + "ws": "^8.18.0" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "@types/express": "^4.17.21", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", + "@types/ws": "^8.5.11", "eslint": "^8", "eslint-config-next": "14.2.3", "postcss": "^8", diff --git a/server/server.ts b/server/server.ts new file mode 100644 index 0000000..df2be4e --- /dev/null +++ b/server/server.ts @@ -0,0 +1,42 @@ +import { PrismaClient } from '@prisma/client'; +import { CronJob } from 'cron'; +import express, { Express } from 'express'; +import WebSocket, { WebSocketServer } from 'ws'; + +const app: Express = express(); +const port = process.env.PORT || 3333; + +const client = new PrismaClient(); +const wss = new WebSocket('wss://stride-rpc.w3coins.io:443/websocket'); + +wss.on('open', () => { + const subscriptionRequest = JSON.stringify({ + jsonrpc: '2.0', + method: 'subscribe', + params: ["tm.event = 'NewBlock'"], + id: 1, + }); + + wss.send(subscriptionRequest); +}); + +wss.on('message', (message) => { + const parsedMessage = JSON.parse(message.toString()); + console.log(parsedMessage) + +}); +app.listen(port, () => { + console.log(`[server]: Server is running at http://localhost:${port}`); +}); + +const job = new CronJob( + '* * * * * *', // cronTime + function () { + console.log('You will see this message every second'); + }, // onTick + null, // onComplete + true, // start + 'America/Los_Angeles', // timeZone +); + +job.start(); diff --git a/yarn.lock b/yarn.lock index 3c4ab1c..46558dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -541,6 +541,46 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== +"@types/body-parser@*": + version "1.19.5" + resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.5.tgz#04ce9a3b677dc8bd681a17da1ab9835dc9d3ede4" + integrity sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg== + dependencies: + "@types/connect" "*" + "@types/node" "*" + +"@types/connect@*": + version "3.4.38" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858" + integrity sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug== + dependencies: + "@types/node" "*" + +"@types/express-serve-static-core@^4.17.33": + version "4.19.5" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz#218064e321126fcf9048d1ca25dd2465da55d9c6" + integrity sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg== + dependencies: + "@types/node" "*" + "@types/qs" "*" + "@types/range-parser" "*" + "@types/send" "*" + +"@types/express@^4.17.21": + version "4.17.21" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.21.tgz#c26d4a151e60efe0084b23dc3369ebc631ed192d" + integrity sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "^4.17.33" + "@types/qs" "*" + "@types/serve-static" "*" + +"@types/http-errors@*": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-2.0.4.tgz#7eb47726c391b7345a6ec35ad7f4de469cf5ba4f" + integrity sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" @@ -551,6 +591,18 @@ resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-3.4.2.tgz#e4fc7214a420173cea47739c33cdf10874694db7" integrity sha512-TifLZlFudklWlMBfhubvgqTXRzLDI5pCbGa4P8a3wPyUQSW+1xQ5eDsreP9DWHX3tjq1ke96uYG/nwundroWcA== +"@types/mime@^1": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.5.tgz#1ef302e01cf7d2b5a0fa526790c9123bf1d06690" + integrity sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w== + +"@types/node@*": + version "20.14.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.11.tgz#09b300423343460455043ddd4d0ded6ac579b74b" + integrity sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA== + dependencies: + undici-types "~5.26.4" + "@types/node@^20": version "20.12.11" resolved "https://registry.npmjs.org/@types/node/-/node-20.12.11.tgz" @@ -563,6 +615,16 @@ resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz" integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q== +"@types/qs@*": + version "6.9.15" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.15.tgz#adde8a060ec9c305a82de1babc1056e73bd64dce" + integrity sha512-uXHQKES6DQKKCLh441Xv/dwxOq1TVS3JPUMlEqoEglvlhR6Mxnlew/Xq/LRVHpLyk7iK3zODe1qYHIMltO7XGg== + +"@types/range-parser@*": + version "1.2.7" + resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb" + integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== + "@types/react-dom@^18": version "18.3.0" resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz" @@ -578,6 +640,30 @@ "@types/prop-types" "*" csstype "^3.0.2" +"@types/send@*": + version "0.17.4" + resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.4.tgz#6619cd24e7270793702e4e6a4b958a9010cfc57a" + integrity sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA== + dependencies: + "@types/mime" "^1" + "@types/node" "*" + +"@types/serve-static@*": + version "1.15.7" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.15.7.tgz#22174bbd74fb97fe303109738e9b5c2f3064f714" + integrity sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw== + dependencies: + "@types/http-errors" "*" + "@types/node" "*" + "@types/send" "*" + +"@types/ws@^8.5.11": + version "8.5.11" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.11.tgz#90ad17b3df7719ce3e6bc32f83ff954d38656508" + integrity sha512-4+q7P5h3SpJxaBft0Dzpbr6lmMaqh0Jr2tbhJZ/luAwvD7ohSCniYkwz/pLxuT2h0EOa6QADgJj1Ko+TzRfZ+w== + dependencies: + "@types/node" "*" + "@typescript-eslint/parser@^5.4.2 || ^6.0.0 || 7.0.0 - 7.2.0": version "7.2.0" resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.2.0.tgz" @@ -629,6 +715,14 @@ resolved "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== +accepts@~1.3.8: + version "1.3.8" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" + integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== + dependencies: + mime-types "~2.1.34" + negotiator "0.6.3" + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" @@ -733,6 +827,11 @@ array-buffer-byte-length@^1.0.1: call-bind "^1.0.5" is-array-buffer "^3.0.4" +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== + array-includes@^3.1.6, array-includes@^3.1.7: version "3.1.8" resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz" @@ -863,6 +962,24 @@ binary-extensions@^2.0.0: resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== +body-parser@1.20.2: + version "1.20.2" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.2.tgz#6feb0e21c4724d06de7ff38da36dad4f57a747fd" + integrity sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA== + dependencies: + bytes "3.1.2" + content-type "~1.0.5" + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" + iconv-lite "0.4.24" + on-finished "2.4.1" + qs "6.11.0" + raw-body "2.5.2" + type-is "~1.6.18" + unpipe "1.0.0" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz" @@ -892,6 +1009,11 @@ busboy@1.6.0: dependencies: streamsearch "^1.1.0" +bytes@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" + integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== + call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7: version "1.0.7" resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz" @@ -1005,6 +1127,28 @@ concat-map@0.0.1: resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== +content-disposition@0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== + dependencies: + safe-buffer "5.2.1" + +content-type@~1.0.4, content-type@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" + integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== + +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== + +cookie@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== + create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -1069,6 +1213,13 @@ data-view-byte-offset@^1.0.0: es-errors "^1.3.0" is-data-view "^1.0.1" +debug@2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + debug@^3.2.7: version "3.2.7" resolved "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz" @@ -1106,11 +1257,21 @@ define-properties@^1.2.0, define-properties@^1.2.1: has-property-descriptors "^1.0.0" object-keys "^1.1.1" +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + dequal@^2.0.3: version "2.0.3" resolved "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz" integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== +destroy@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" + integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== + detect-libc@^2.0.3: version "2.0.3" resolved "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz" @@ -1152,11 +1313,21 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dotenv@^16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + eastasianwidth@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== + emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" @@ -1167,6 +1338,11 @@ emoji-regex@^9.2.2: resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== + enhanced-resolve@^5.12.0: version "5.16.1" resolved "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.16.1.tgz" @@ -1291,6 +1467,11 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" @@ -1509,6 +1690,48 @@ esutils@^2.0.2: resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== + +express@^4.19.2: + version "4.19.2" + resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465" + integrity sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q== + dependencies: + accepts "~1.3.8" + array-flatten "1.1.1" + body-parser "1.20.2" + content-disposition "0.5.4" + content-type "~1.0.4" + cookie "0.6.0" + cookie-signature "1.0.6" + debug "2.6.9" + depd "2.0.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "1.2.0" + fresh "0.5.2" + http-errors "2.0.0" + merge-descriptors "1.0.1" + methods "~1.1.2" + on-finished "2.4.1" + parseurl "~1.3.3" + path-to-regexp "0.1.7" + proxy-addr "~2.0.7" + qs "6.11.0" + range-parser "~1.2.1" + safe-buffer "5.2.1" + send "0.18.0" + serve-static "1.15.0" + setprototypeof "1.2.0" + statuses "2.0.1" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" @@ -1556,6 +1779,19 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +finalhandler@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" + integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== + dependencies: + debug "2.6.9" + encodeurl "~1.0.2" + escape-html "~1.0.3" + on-finished "2.4.1" + parseurl "~1.3.3" + statuses "2.0.1" + unpipe "~1.0.0" + find-up@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" @@ -1593,6 +1829,16 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" +forwarded@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" + integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" @@ -1782,6 +2028,24 @@ hasown@^2.0.0, hasown@^2.0.1, hasown@^2.0.2: dependencies: function-bind "^1.1.2" +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== + dependencies: + depd "2.0.0" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses "2.0.1" + toidentifier "1.0.1" + +iconv-lite@0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + ignore@^5.2.0: version "5.3.1" resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz" @@ -1808,7 +2072,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2: +inherits@2, inherits@2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -1822,6 +2086,11 @@ internal-slot@^1.0.7: hasown "^2.0.0" side-channel "^1.0.4" +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + is-array-buffer@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz" @@ -2184,11 +2453,26 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== + +merge-descriptors@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" + integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== + merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== + micromatch@^4.0.4, micromatch@^4.0.5: version "4.0.5" resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz" @@ -2197,6 +2481,23 @@ micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.2" picomatch "^2.3.1" +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@~2.1.24, mime-types@~2.1.34: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + minimatch@9.0.3: version "9.0.3" resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz" @@ -2228,11 +2529,21 @@ minimist@^1.2.0, minimist@^1.2.6: resolved "https://registry.npmjs.org/minipass/-/minipass-7.1.1.tgz" integrity sha512-UZ7eQ+h8ywIRAW1hIEl2AqdwzJucU/Kp59+8kkZeSvafXhZjul247BvIJjEVFVeON6d7lM46XX1HXCduKAS8VA== +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== + ms@2.1.2, ms@^2.1.1: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + mz@^2.7.0: version "2.7.0" resolved "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz" @@ -2252,6 +2563,11 @@ natural-compare@^1.4.0: resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +negotiator@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" + integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== + next-themes@^0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/next-themes/-/next-themes-0.3.0.tgz" @@ -2361,6 +2677,13 @@ object.values@^1.1.6, object.values@^1.1.7: define-properties "^1.2.1" es-object-atoms "^1.0.0" +on-finished@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" + integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + dependencies: + ee-first "1.1.1" + once@^1.3.0: version "1.4.0" resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" @@ -2401,6 +2724,11 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" +parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" @@ -2429,6 +2757,11 @@ path-scurry@^1.10.1: lru-cache "^10.2.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" +path-to-regexp@0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" + integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== + path-type@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" @@ -2552,16 +2885,46 @@ prop-types@^15.8.1: object-assign "^4.1.1" react-is "^16.13.1" +proxy-addr@~2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" + integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== + dependencies: + forwarded "0.2.0" + ipaddr.js "1.9.1" + punycode@^2.1.0: version "2.3.1" resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== +qs@6.11.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" + integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== + dependencies: + side-channel "^1.0.4" + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== +range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + +raw-body@2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" + integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + react-dom@^18: version "18.3.1" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz" @@ -2681,6 +3044,11 @@ safe-array-concat@^1.1.2: has-symbols "^1.0.3" isarray "^2.0.5" +safe-buffer@5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + safe-regex-test@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz" @@ -2690,6 +3058,11 @@ safe-regex-test@^1.0.3: es-errors "^1.3.0" is-regex "^1.1.4" +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + scheduler@^0.23.2: version "0.23.2" resolved "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz" @@ -2707,6 +3080,35 @@ semver@^7.5.4, semver@^7.6.0: resolved "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz" integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== +send@0.18.0: + version "0.18.0" + resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" + integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== + dependencies: + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "2.0.0" + mime "1.6.0" + ms "2.1.3" + on-finished "2.4.1" + range-parser "~1.2.1" + statuses "2.0.1" + +serve-static@1.15.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" + integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== + dependencies: + encodeurl "~1.0.2" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.18.0" + set-function-length@^1.2.1: version "1.2.2" resolved "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz" @@ -2729,6 +3131,11 @@ set-function-name@^2.0.1, set-function-name@^2.0.2: functions-have-names "^1.2.3" has-property-descriptors "^1.0.2" +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + sharp@^0.33.4: version "0.33.4" resolved "https://registry.npmjs.org/sharp/-/sharp-0.33.4.tgz" @@ -2807,6 +3214,11 @@ source-map@^0.5.0: resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + streamsearch@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz" @@ -3009,6 +3421,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + ts-api-utils@^1.0.1: version "1.3.0" resolved "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz" @@ -3065,6 +3482,14 @@ type-fest@^0.20.2: resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== +type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + typed-array-buffer@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz" @@ -3129,6 +3554,11 @@ undici-types@~5.26.4: resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== +unpipe@1.0.0, unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" @@ -3148,11 +3578,21 @@ util-deprecate@^1.0.2: resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== + v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== +vary@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== + which-boxed-primitive@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz" @@ -3238,6 +3678,11 @@ wrappy@1: resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +ws@^8.18.0: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== + yaml@^2.3.4: version "2.4.2" resolved "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz" From 71e80ff9f33d6224b3c5c7bfc4e3c59f30537167 Mon Sep 17 00:00:00 2001 From: Yakovishin Evgeny <00705@inbox.ru> Date: Fri, 19 Jul 2024 22:31:21 +0300 Subject: [PATCH 7/7] fix --- server/server.ts | 50 ++++++++++++++++++++++----------- server/types.d.ts | 26 +++++++++++++++++ src/tools/chains/init-chains.ts | 40 +++++++++++++------------- 3 files changed, 79 insertions(+), 37 deletions(-) create mode 100644 server/types.d.ts diff --git a/server/server.ts b/server/server.ts index df2be4e..bf9907d 100644 --- a/server/server.ts +++ b/server/server.ts @@ -1,30 +1,46 @@ import { PrismaClient } from '@prisma/client'; import { CronJob } from 'cron'; import express, { Express } from 'express'; -import WebSocket, { WebSocketServer } from 'ws'; +import WebSocket from 'ws'; const app: Express = express(); const port = process.env.PORT || 3333; const client = new PrismaClient(); -const wss = new WebSocket('wss://stride-rpc.w3coins.io:443/websocket'); - -wss.on('open', () => { - const subscriptionRequest = JSON.stringify({ - jsonrpc: '2.0', - method: 'subscribe', - params: ["tm.event = 'NewBlock'"], - id: 1, - }); - - wss.send(subscriptionRequest); -}); -wss.on('message', (message) => { - const parsedMessage = JSON.parse(message.toString()); - console.log(parsedMessage) +async function initWss() { + const chains = await client.chain.findMany({ + include: { wsNodes: true }, + }); + console.log('Connecting chains to ws'); + for (const chain of chains) { + console.log(chain.prettyName + ' connecting...'); + try { + const wss = new WebSocket(chain.wsNodes[0].url); + wss.on('open', () => { + console.log(chain.prettyName + ' connected ✅'); + const subscriptionRequest = JSON.stringify({ + jsonrpc: '2.0', + method: 'subscribe', + params: ["tm.event = 'NewBlock'"], + id: 1, + }); + + wss.send(subscriptionRequest); + }); + + wss.on('message', (message) => { + const parsedMessage = JSON.parse(message.toString()); + console.log(parsedMessage.result.data ? parsedMessage.result.data.value.signatures : null); + }); + } catch (e) { + console.log('Something went wrong: ' + e); + } + } +} + +initWss(); -}); app.listen(port, () => { console.log(`[server]: Server is running at http://localhost:${port}`); }); diff --git a/server/types.d.ts b/server/types.d.ts new file mode 100644 index 0000000..85432b4 --- /dev/null +++ b/server/types.d.ts @@ -0,0 +1,26 @@ +declare type NewBlock = { + jsonrpc: '2.0'; + id: 1; + result: { + query: "tm.event = 'NewBlock'"; + data: { type: 'tendermint/event/NewBlock'; value: [] }; + events: { + 'transfer.recipient': any[]; + 'transfer.amount': any[]; + 'rewards.amount': any[]; + 'rewards.validator': any[]; + 'liveness.address': string[]; + 'liveness.missed_blocks': string[]; + 'coin_received.receiver': any[]; + 'coin_received.amount': any[]; + 'tm.event': ['NewBlock']; + 'message.sender': string[]; + 'commission.validator': string[]; + 'liveness.height': string[]; + 'coin_spent.spender': string[]; + 'transfer.sender': string[]; + 'coin_spent.amount': string[]; + 'commission.amount': string[]; + }; + }; +}; diff --git a/src/tools/chains/init-chains.ts b/src/tools/chains/init-chains.ts index efa53ba..9b9f71d 100644 --- a/src/tools/chains/init-chains.ts +++ b/src/tools/chains/init-chains.ts @@ -113,26 +113,26 @@ async function main() { twitterUrl: '123', }); - await addNetwork({ - name: 'picasso', - prettyName: 'Picasso', - chainId: 'centauri-1', - bech32Prefix: 'pica', - coinDecimals: 6, - coinGeckoId: '123', - coinType: 118, - denom: 'PICA', - minimalDenom: 'ppica', - grpcNodeUrl: 'grpc.celestia.citizenweb3.com/', - lcdNodeUrl: 'https://api.composable.citizenweb3.com/', - rpcNodeUrl: 'https://rpc.composable.citizenweb3.com/', - wsNodeUrl: 'wss://rpc.composable.com/websocket', - logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', - mainRepo: '123', - docs: '123', - githubUrl: '123', - twitterUrl: '123', - }); + // await addNetwork({ + // name: 'picasso', + // prettyName: 'Picasso', + // chainId: 'centauri-1', + // bech32Prefix: 'pica', + // coinDecimals: 6, + // coinGeckoId: '123', + // coinType: 118, + // denom: 'PICA', + // minimalDenom: 'ppica', + // grpcNodeUrl: 'grpc.celestia.citizenweb3.com/', + // lcdNodeUrl: 'https://api.composable.citizenweb3.com/', + // rpcNodeUrl: 'https://rpc.composable.citizenweb3.com/', + // wsNodeUrl: 'wss://rpc.composable.com/websocket', + // logoUrl: 'https://raw.githubusercontent.com/cosmos/chain-registry/master/composable/images/pica.svg', + // mainRepo: '123', + // docs: '123', + // githubUrl: '123', + // twitterUrl: '123', + // }); await addNetwork({ name: 'evmos',