Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ygrishajev committed May 20, 2024
1 parent fd781cd commit d7f9f45
Show file tree
Hide file tree
Showing 1,151 changed files with 45,042 additions and 130 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions api/package.json → apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"dependencies": {
"@akashnetwork/akash-api": "^1.3.0",
"@akashnetwork/cloudmos-shared": "*",
"@chain-registry/assets": "^0.7.1",
"@cosmjs/crypto": "^0.28.11",
"@cosmjs/encoding": "^0.28.11",
Expand All @@ -38,7 +39,7 @@
"@octokit/rest": "^18.12.0",
"@sentry/node": "^7.55.2",
"axios": "^0.27.2",
"cloudmos-shared": "file:../shared/",
"bufferutil": "^4.0.8",
"cosmjs-types": "^0.5.0",
"date-fns": "^2.29.2",
"date-fns-tz": "^1.3.6",
Expand All @@ -50,13 +51,15 @@
"markdown-to-txt": "^2.0.1",
"memory-cache": "^0.2.0",
"node-fetch": "^2.6.1",
"pg": "^8.7.3",
"pg": "^8.11.5",
"pg-hstore": "^2.3.4",
"pg-native": "^3.0.1",
"protobufjs": "^6.11.2",
"semver": "^7.3.8",
"sequelize": "^6.21.3",
"sequelize-typescript": "^2.1.5",
"stripe": "^10.14.0",
"utf-8-validate": "^5.0.10",
"zod": "^3.22.4"
},
"devDependencies": {
Expand Down
4 changes: 4 additions & 0 deletions api/src/app.ts → apps/api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { Hono } from "hono";
import { cors } from "hono/cors";
import { serve } from "@hono/node-server";
import { legacyRouter } from "./routers/legacyRouter";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import { sentry } from "@hono/sentry";
import { internalRouter } from "./routers/internalRouter";

Expand All @@ -26,6 +28,8 @@ appHono.use(

const { PORT = 3080 } = process.env;

console.log("DEBUG sentry", sentry);

Sentry.init({
dsn: env.SentryDSN,
environment: env.NODE_ENV,
Expand Down
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions api/src/db/dbConnection.ts → apps/api/src/db/dbConnection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defaults as pgDefaults } from "pg";
import pg from "pg";
import { env } from "@src/utils/env";
import { Transaction as DbTransaction } from "sequelize";
import { Sequelize } from "sequelize-typescript";
import { chainModels, getChainModels, userModels } from "@shared/dbSchemas";
import { Template, TemplateFavorite, UserAddressName, UserSetting } from "@shared/dbSchemas/user";
import { chainDefinitions } from "@shared/chainDefinitions";
import { chainModels, getChainModels, userModels } from "@akashnetwork/cloudmos-shared/dbSchemas";
import { Template, TemplateFavorite, UserAddressName, UserSetting } from "@akashnetwork/cloudmos-shared/dbSchemas/user";
import { chainDefinitions } from "@akashnetwork/cloudmos-shared/chainDefinitions";

function isValidNetwork(network: string): network is keyof typeof csMap {
return network in csMap;
Expand All @@ -24,9 +24,9 @@ if (!csMap[env.Network]) {
throw new Error(`Missing connection string for network: ${env.Network}`);
}

pgDefaults.parseInt8 = true;
pg.defaults.parseInt8 = true;
export const chainDb = new Sequelize(csMap[env.Network], {
dialect: "postgres",
dialectModule: pg,
logging: false,
transactionType: DbTransaction.TYPES.IMMEDIATE,
define: {
Expand All @@ -42,7 +42,7 @@ export const chainDbs: { [key: string]: Sequelize } = Object.keys(chainDefinitio
(obj, chain) => ({
...obj,
[chain]: new Sequelize(chainDefinitions[chain].connectionString, {
dialect: "postgres",
dialectModule: pg,
logging: false,
repositoryMode: true,
transactionType: DbTransaction.TYPES.IMMEDIATE,
Expand All @@ -57,7 +57,7 @@ export const chainDbs: { [key: string]: Sequelize } = Object.keys(chainDefinitio
);

export const userDb = new Sequelize(env.UserDatabaseCS, {
dialect: "postgres",
dialectModule: pg,
logging: false,
transactionType: DbTransaction.TYPES.IMMEDIATE,
define: {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Template, UserSetting } from "@shared/dbSchemas/user";
import { Template, UserSetting } from "@akashnetwork/cloudmos-shared/dbSchemas/user";
import { privateMiddleware } from "@src/middlewares/privateMiddleware";
import { Hono } from "hono";

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
import { Block } from "@shared/dbSchemas";
import { AkashMessage, Deployment, DeploymentGroup, DeploymentGroupResource } from "@shared/dbSchemas/akash";
import { Day, Transaction } from "@shared/dbSchemas/base";
import { Block } from "@akashnetwork/cloudmos-shared/dbSchemas";
import { AkashMessage, Deployment, DeploymentGroup, DeploymentGroupResource } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { Day, Transaction } from "@akashnetwork/cloudmos-shared/dbSchemas/base";
import { cacheResponse } from "@src/caching/helpers";
import { chainDb } from "@src/db/dbConnection";
import { MsgCreateBid } from "@akashnetwork/akash-api/akash/market/v1beta4";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
import { Block } from "@shared/dbSchemas";
import { Lease } from "@shared/dbSchemas/akash";
import { Block } from "@akashnetwork/cloudmos-shared/dbSchemas";
import { Lease } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { openApiExampleAddress } from "@src/utils/constants";
import { differenceInSeconds } from "date-fns";
import { Op } from "sequelize";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AkashBlock as Block, AkashMessage as Message } from "@shared/dbSchemas/akash";
import { Transaction, Validator } from "@shared/dbSchemas/base";
import { AkashBlock as Block, AkashMessage as Message } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { Transaction, Validator } from "@akashnetwork/cloudmos-shared/dbSchemas/base";
import { addSeconds, differenceInSeconds } from "date-fns";

export async function getBlocks(limit: number) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as v1beta1 from "@akashnetwork/akash-api/deprecated/akash/market/v1beta1";
import * as v2beta2 from "@akashnetwork/akash-api/akash/market/v1beta2";
import { decodeMsg } from "@src/utils/protobuf";
import { Transaction } from "@shared/dbSchemas/base";
import { Deployment, Lease } from "@shared/dbSchemas/akash";
import { Transaction } from "@akashnetwork/cloudmos-shared/dbSchemas/base";
import { Deployment, Lease } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { Op, WhereOptions } from "sequelize";
import { Block, Message } from "@shared/dbSchemas";
import { Block, Message } from "@akashnetwork/cloudmos-shared/dbSchemas";

export async function getDeploymentRelatedMessages(owner: string, dseq: string) {
const deployment = await Deployment.findOne({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Op } from "sequelize";
import { Day } from "@shared/dbSchemas/base";
import { AkashBlock as Block } from "@shared/dbSchemas/akash";
import { Day } from "@akashnetwork/cloudmos-shared/dbSchemas/base";
import { AkashBlock as Block } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { add } from "date-fns";
import { getTodayUTC } from "@src/utils";
import { round, uaktToAKT, udenomToDenom } from "@src/utils/math";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Provider, ProviderAttribute } from "@shared/dbSchemas/akash";
import { Provider, ProviderAttribute } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { getProviderAttributesSchema } from "@src/services/external/githubService";

export async function getProviderRegions() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Provider, ProviderAttribute, ProviderAttributeSignature, ProviderSnapshotNode, ProviderSnapshotNodeGPU } from "@shared/dbSchemas/akash";
import { ProviderSnapshot } from "@shared/dbSchemas/akash/providerSnapshot";
import {
Provider,
ProviderAttribute,
ProviderAttributeSignature,
ProviderSnapshotNode,
ProviderSnapshotNodeGPU
} from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { ProviderSnapshot } from "@akashnetwork/cloudmos-shared/dbSchemas/akash/providerSnapshot";
import { toUTC } from "@src/utils";
import { add, sub } from "date-fns";
import { Op } from "sequelize";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Day } from "@shared/dbSchemas/base";
import { AkashBlock as Block } from "@shared/dbSchemas/akash";
import { Day } from "@akashnetwork/cloudmos-shared/dbSchemas/base";
import { AkashBlock as Block } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { subHours } from "date-fns";
import { Op, QueryTypes } from "sequelize";
import { chainDb } from "@src/db/dbConnection";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Template, TemplateFavorite, UserSetting } from "@shared/dbSchemas/user";
import { Template, TemplateFavorite, UserSetting } from "@akashnetwork/cloudmos-shared/dbSchemas/user";
import * as uuid from "uuid";
import { Op } from "sequelize";
import { toUTC } from "@src/utils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Transaction, AddressReference } from "@shared/dbSchemas/base";
import { AkashBlock as Block, AkashMessage as Message } from "@shared/dbSchemas/akash";
import { Transaction, AddressReference } from "@akashnetwork/cloudmos-shared/dbSchemas/base";
import { AkashBlock as Block, AkashMessage as Message } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { msgToJSON } from "@src/utils/protobuf";
import { QueryTypes } from "sequelize";
import { chainDb } from "@src/db/dbConnection";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserAddressName, UserSetting } from "@shared/dbSchemas/user";
import { UserAddressName, UserSetting } from "@akashnetwork/cloudmos-shared/dbSchemas/user";
import { getUserPlan } from "../external/stripeService";
import { Transaction } from "sequelize";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { averageBlockCountInAMonth } from "@src/utils/constants";
import { coinToAsset } from "@src/utils/coin";
import { getTransactionByAddress } from "@src/services/db/transactionsService";
import axios from "axios";
import { Validator } from "@shared/dbSchemas/base";
import { Validator } from "@akashnetwork/cloudmos-shared/dbSchemas/base";
import { Op } from "sequelize";
import { Deployment, Lease, Provider, ProviderAttribute } from "@shared/dbSchemas/akash";
import { Deployment, Lease, Provider, ProviderAttribute } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { cacheKeys, cacheResponse } from "@src/caching/helpers";
import { env } from "@src/utils/env";
import {
Expand All @@ -22,7 +22,7 @@ import {
RestGovProposalsTallyResponse,
RestCosmosStakingDelegatorsRedelegationsResponse
} from "@src/types/rest";
import { Block } from "@shared/dbSchemas";
import { Block } from "@akashnetwork/cloudmos-shared/dbSchemas";
import { CosmosDistributionCommunityPoolResponse } from "@src/types/rest/cosmosDistributionCommunityPoolResponse";
import { CosmosStakingPoolResponse } from "@src/types/rest/cosmosStakingPoolResponse";
import { CosmosBankSupplyResponse } from "@src/types/rest/cosmosBankSupplyResponse";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UserSetting } from "@shared/dbSchemas/user";
import { PlanCode } from "@shared/plans";
import { UserSetting } from "@akashnetwork/cloudmos-shared/dbSchemas/user";
import { PlanCode } from "@akashnetwork/cloudmos-shared/plans";
import { env } from "@src/utils/env";

import Stripe from "stripe";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Provider, ProviderSnapshot, ProviderSnapshotNode } from "@shared/dbSchemas/akash";
import { Provider, ProviderSnapshot, ProviderSnapshotNode } from "@akashnetwork/cloudmos-shared/dbSchemas/akash";
import { Auditor, ProviderAttributesSchema, ProviderList } from "@src/types/provider";
import { createFilterUnique } from "../array/array";
import semver from "semver";
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion api/tsconfig.json → apps/api/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"baseUrl": "./src",
"paths": {
"@src/*": ["*"],
"@shared/*": ["../../shared/*"],
"@test/*": ["../test/*"]
}
},
Expand Down
2 changes: 1 addition & 1 deletion api/tsconfig.build.json → apps/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "./tsconfig.json",
"extends": "./tsconfig.build.json",
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*spec.ts"],
"compileOnSave": false
Expand Down
2 changes: 1 addition & 1 deletion api/webpack.dev.js → apps/api/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: "ts-loader",
options: { configFile: "tsconfig.build.json" }
options: { configFile: "tsconfig.json" }
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion api/webpack.prod.js → apps/api/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: "ts-loader",
options: { configFile: "tsconfig.build.json" }
options: { configFile: "tsconfig.json" }
}
]
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d7f9f45

Please sign in to comment.