diff --git a/core/database/dbConnect.ts b/core/database/dbConnect.ts deleted file mode 100644 index bb6df6f82..000000000 --- a/core/database/dbConnect.ts +++ /dev/null @@ -1,25 +0,0 @@ -import pg, { Knex } from "knex"; -import { env } from "../../src/utils/env"; - -// Defaults to postgres -const connectionString = env.POSTGRES_CONNECTION_URL; - -export const connectToDatabase = async ( - databaseURL?: string, -): Promise => { - let knexConfig: Knex.Config = { - client: "pg", - connection: { - connectionString: databaseURL || connectionString, - ssl: { - rejectUnauthorized: false, - }, - }, - acquireConnectionTimeout: 10000, - }; - - // instantiate connection with new config - const knex = pg(knexConfig); - - return knex; -}; diff --git a/core/error/customError.ts b/core/error/customError.ts deleted file mode 100644 index b76f0ae53..000000000 --- a/core/error/customError.ts +++ /dev/null @@ -1,24 +0,0 @@ -export type CustomError = { - message: string; - statusCode: number; - code: string; - stack?: string; -}; - -export const createCustomError = ( - message: string, - statusCode: number, - code: string, -): CustomError => ({ - message, - statusCode, - code, -}); - -export const createCustomDateTimestampError = (key: string): CustomError => { - return createCustomError( - `Invalid ${key} Value. Needs to new Date() / new Date().toISOstring() / new Date().getTime() / Unix Epoch`, - 404, - "INVALID_DATE_TIME", - ); -}; diff --git a/core/error/errorCodes.ts b/core/error/errorCodes.ts deleted file mode 100644 index bf5d7f668..000000000 --- a/core/error/errorCodes.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { StatusCodes } from "http-status-codes"; - -const flipObject = (data: any) => - Object.fromEntries(Object.entries(data).map(([key, value]) => [value, key])); - -const StatusCodeToCode = flipObject(StatusCodes); - -export const getCodeFromStatusCode = (statusCode: number) => - StatusCodeToCode[statusCode]; diff --git a/core/helpers/index.ts b/core/helpers/index.ts deleted file mode 100644 index 0fd9b39e3..000000000 --- a/core/helpers/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const isValidHttpUrl = (urlString: string): boolean => { - let url; - - try { - url = new URL(urlString); - } catch (_) { - return false; - } - - return url.protocol === "http:" || url.protocol === "https:"; -}; diff --git a/core/index.ts b/core/index.ts deleted file mode 100644 index d96756b4e..000000000 --- a/core/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from "../src/utils/env"; -export * from "./database/dbConnect"; -export * from "./error/customError"; -export * from "./error/errorHandler"; -export * from "./sdk/sdk"; diff --git a/core/interfaces/index.ts b/core/interfaces/index.ts deleted file mode 100644 index 14b0f7628..000000000 --- a/core/interfaces/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -export interface WalletData { - walletAddress: string; - chainId: string; - lastUsedNonce: number; - blockchainNonce: number; - lastSyncedTimestamp: Date; - walletType: string; - awsKmsKeyId?: string; - gcpKmsKeyId?: string; - awsKmsKeyArn?: string; - gcpKmsKeyRingId?: string; - gcpKmsKeyVersionId?: string; - gcpKmsLocationId?: string; - gcpKmsProjectId?: string; -} diff --git a/core/schema/index.ts b/core/schema/index.ts deleted file mode 100644 index b76a456a5..000000000 --- a/core/schema/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Type } from "@sinclair/typebox"; - -export const chainResponseSchema = Type.Object({ - name: Type.String({ - description: "Chain name", - }), - chain: Type.String({ - description: "Chain name", - }), - rpc: Type.Array( - Type.String({ - description: "RPC URL", - }), - ), - nativeCurrency: Type.Object({ - name: Type.String({ - description: "Native currency name", - }), - symbol: Type.String({ - description: "Native currency symbol", - }), - decimals: Type.Number({ - description: "Native currency decimals", - }), - }), - shortName: Type.String({ - description: "Chain short name", - }), - chainId: Type.Number({ - description: "Chain ID", - }), - testnet: Type.Boolean({ - description: "Is testnet", - }), - slug: Type.String({ - description: "Chain slug", - }), -}); - -export const walletAuthSchema = Type.Object({ - "x-backend-wallet-address": Type.String({ - description: "Backend wallet address", - }), - "x-account-address": Type.Optional( - Type.String({ - description: "Smart account address", - }), - ), -}); diff --git a/core/services/benchmark.ts b/core/services/benchmark.ts deleted file mode 100644 index 19b49322d..000000000 --- a/core/services/benchmark.ts +++ /dev/null @@ -1,41 +0,0 @@ -// ! Winston Notes: This file is currently not in used. -// Keeping it around for when we might want to track specific function timings. -// Note that you cannot track functions in worker and output timings in server. -// Tracking and outputting timings must be done in the same docker image. -// Might release this as my own npm package and bring it in as a dependency in the future -import { randomUUID } from "crypto"; -import { PerformanceObserver, performance } from "perf_hooks"; - -export const watchPerformance = ( - onNewEntry: (entry: PerformanceEntry) => void, -) => { - const performanceObserver = new PerformanceObserver((items) => { - items.getEntries().forEach((entry) => { - onNewEntry(entry); - }); - }); - performanceObserver.observe({ entryTypes: ["measure"], buffered: true }); -}; - -export const timeFunction = < - F extends (...args: any) => any, - Args = F extends (args: infer A) => any ? A : never, ->( - fn: F, - resultTag: (args: Awaited>) => string, -) => { - const result = async (args: Args): Promise>> => { - const marker = randomUUID(); - const markerStart = `${marker}-start`; - const markerEnd = `${marker}-end`; - - performance.mark(markerStart); - const fnResult = await fn(args); - performance.mark(markerEnd); - - const measureName = resultTag(fnResult); - performance.measure(measureName, markerStart, markerEnd); - return fnResult; - }; - return result; -}; diff --git a/core/services/blockchain.ts b/core/services/blockchain.ts deleted file mode 100644 index 71a425639..000000000 --- a/core/services/blockchain.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { BigNumberish, providers } from "ethers"; - -export const getWalletNonce = async ( - walletAddress: string, - provider: providers.Provider, -): Promise => { - try { - const txCount = await provider.getTransactionCount( - walletAddress, - "pending", - ); - return txCount; - } catch (error) { - throw error; - } -}; - -export const getFeeData = async (provider: providers.Provider) => { - try { - const feeData = await provider.getFeeData(); - - return feeData; - } catch (error) { - throw error; - } -}; diff --git a/server/api/chain/get.ts b/server/api/chain/get.ts index 015562c38..0808eb5e8 100644 --- a/server/api/chain/get.ts +++ b/server/api/chain/get.ts @@ -2,10 +2,12 @@ import { Static, Type } from "@sinclair/typebox"; import { allChains, minimizeChain } from "@thirdweb-dev/chains"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { createCustomError } from "../../../core/index"; -import { chainResponseSchema } from "../../../core/schema"; import { standardResponseSchema } from "../../helpers/sharedApiSchemas"; -import { chainRequestQuerystringSchema } from "../../schemas/chain"; +import { createCustomError } from "../../middleware/error"; +import { + chainRequestQuerystringSchema, + chainResponseSchema, +} from "../../schemas/chain"; // OUPUT const responseSchema = Type.Object({ diff --git a/server/api/chain/getAll.ts b/server/api/chain/getAll.ts index 11ae9d1d7..9e45edc92 100644 --- a/server/api/chain/getAll.ts +++ b/server/api/chain/getAll.ts @@ -2,8 +2,8 @@ import { Static, Type } from "@sinclair/typebox"; import { allChains, minimizeChain } from "@thirdweb-dev/chains"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { chainResponseSchema } from "../../../core/schema"; import { standardResponseSchema } from "../../helpers/sharedApiSchemas"; +import { chainResponseSchema } from "../../schemas/chain"; // OUPUT const responseSchema = Type.Object({ diff --git a/server/api/contract/extensions/account/write/grantAdmin.ts b/server/api/contract/extensions/account/write/grantAdmin.ts index 97974f506..fa4cc446c 100644 --- a/server/api/contract/extensions/account/write/grantAdmin.ts +++ b/server/api/contract/extensions/account/write/grantAdmin.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/account/write/grantSession.ts b/server/api/contract/extensions/account/write/grantSession.ts index 00e5e2009..15befa0dd 100644 --- a/server/api/contract/extensions/account/write/grantSession.ts +++ b/server/api/contract/extensions/account/write/grantSession.ts @@ -1,7 +1,6 @@ import { Static } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers"; import { SessionSchema } from "../../../../../schemas/account"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/account/write/revokeAdmin.ts b/server/api/contract/extensions/account/write/revokeAdmin.ts index 2760c9350..915f4d114 100644 --- a/server/api/contract/extensions/account/write/revokeAdmin.ts +++ b/server/api/contract/extensions/account/write/revokeAdmin.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/account/write/revokeSession.ts b/server/api/contract/extensions/account/write/revokeSession.ts index a13a3dfd7..8e08c9a83 100644 --- a/server/api/contract/extensions/account/write/revokeSession.ts +++ b/server/api/contract/extensions/account/write/revokeSession.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/account/write/updateSession.ts b/server/api/contract/extensions/account/write/updateSession.ts index 97fd55ce8..2068fb34c 100644 --- a/server/api/contract/extensions/account/write/updateSession.ts +++ b/server/api/contract/extensions/account/write/updateSession.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/accountFactory/write/createAccount.ts b/server/api/contract/extensions/accountFactory/write/createAccount.ts index 662df8518..e0cfe390a 100644 --- a/server/api/contract/extensions/accountFactory/write/createAccount.ts +++ b/server/api/contract/extensions/accountFactory/write/createAccount.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, } from "../../../../../helpers"; import { prebuiltDeployResponseSchema } from "../../../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/airdrop.ts b/server/api/contract/extensions/erc1155/write/airdrop.ts index ccab31b87..efae694a9 100644 --- a/server/api/contract/extensions/erc1155/write/airdrop.ts +++ b/server/api/contract/extensions/erc1155/write/airdrop.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/burn.ts b/server/api/contract/extensions/erc1155/write/burn.ts index b676f0dcb..d6648c219 100644 --- a/server/api/contract/extensions/erc1155/write/burn.ts +++ b/server/api/contract/extensions/erc1155/write/burn.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/burnBatch.ts b/server/api/contract/extensions/erc1155/write/burnBatch.ts index 83ea751e9..b4a1b2470 100644 --- a/server/api/contract/extensions/erc1155/write/burnBatch.ts +++ b/server/api/contract/extensions/erc1155/write/burnBatch.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/claimTo.ts b/server/api/contract/extensions/erc1155/write/claimTo.ts index 4f5d56c9e..f235d005a 100644 --- a/server/api/contract/extensions/erc1155/write/claimTo.ts +++ b/server/api/contract/extensions/erc1155/write/claimTo.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/lazyMint.ts b/server/api/contract/extensions/erc1155/write/lazyMint.ts index d951846c8..5aa2181c8 100644 --- a/server/api/contract/extensions/erc1155/write/lazyMint.ts +++ b/server/api/contract/extensions/erc1155/write/lazyMint.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { nftOrInputSchema } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/mintAdditionalSupplyTo.ts b/server/api/contract/extensions/erc1155/write/mintAdditionalSupplyTo.ts index bdc0070a2..adb4b8543 100644 --- a/server/api/contract/extensions/erc1155/write/mintAdditionalSupplyTo.ts +++ b/server/api/contract/extensions/erc1155/write/mintAdditionalSupplyTo.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/mintBatchTo.ts b/server/api/contract/extensions/erc1155/write/mintBatchTo.ts index baee783fb..0b01ddb71 100644 --- a/server/api/contract/extensions/erc1155/write/mintBatchTo.ts +++ b/server/api/contract/extensions/erc1155/write/mintBatchTo.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { nftAndSupplySchema } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/mintTo.ts b/server/api/contract/extensions/erc1155/write/mintTo.ts index 8694ab1db..7ddc854b8 100644 --- a/server/api/contract/extensions/erc1155/write/mintTo.ts +++ b/server/api/contract/extensions/erc1155/write/mintTo.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { nftAndSupplySchema } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/setApprovalForAll.ts b/server/api/contract/extensions/erc1155/write/setApprovalForAll.ts index 5849ad428..f9caac72d 100644 --- a/server/api/contract/extensions/erc1155/write/setApprovalForAll.ts +++ b/server/api/contract/extensions/erc1155/write/setApprovalForAll.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/signatureMint.ts b/server/api/contract/extensions/erc1155/write/signatureMint.ts index d5917c36c..c739767ee 100644 --- a/server/api/contract/extensions/erc1155/write/signatureMint.ts +++ b/server/api/contract/extensions/erc1155/write/signatureMint.ts @@ -3,7 +3,6 @@ import { SignedPayload1155 } from "@thirdweb-dev/sdk"; import { BigNumber } from "ethers"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, @@ -11,6 +10,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { signature1155OutputSchema } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/transfer.ts b/server/api/contract/extensions/erc1155/write/transfer.ts index c00ff4e4d..e61662a21 100644 --- a/server/api/contract/extensions/erc1155/write/transfer.ts +++ b/server/api/contract/extensions/erc1155/write/transfer.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc1155/write/transferFrom.ts b/server/api/contract/extensions/erc1155/write/transferFrom.ts index e1c230632..e17d159c9 100644 --- a/server/api/contract/extensions/erc1155/write/transferFrom.ts +++ b/server/api/contract/extensions/erc1155/write/transferFrom.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc1155ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/burn.ts b/server/api/contract/extensions/erc20/write/burn.ts index 6e6df7861..c75013282 100644 --- a/server/api/contract/extensions/erc20/write/burn.ts +++ b/server/api/contract/extensions/erc20/write/burn.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc20ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/burnFrom.ts b/server/api/contract/extensions/erc20/write/burnFrom.ts index b7930cb8e..81e14a7be 100644 --- a/server/api/contract/extensions/erc20/write/burnFrom.ts +++ b/server/api/contract/extensions/erc20/write/burnFrom.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc20ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/claimTo.ts b/server/api/contract/extensions/erc20/write/claimTo.ts index dccc55cc3..54bd13e7f 100644 --- a/server/api/contract/extensions/erc20/write/claimTo.ts +++ b/server/api/contract/extensions/erc20/write/claimTo.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc20ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/mintBatchTo.ts b/server/api/contract/extensions/erc20/write/mintBatchTo.ts index 3085d968b..63fe2cca9 100644 --- a/server/api/contract/extensions/erc20/write/mintBatchTo.ts +++ b/server/api/contract/extensions/erc20/write/mintBatchTo.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc20ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/mintTo.ts b/server/api/contract/extensions/erc20/write/mintTo.ts index 5c7bb9299..2e7d08475 100644 --- a/server/api/contract/extensions/erc20/write/mintTo.ts +++ b/server/api/contract/extensions/erc20/write/mintTo.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc20ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/setAllowance.ts b/server/api/contract/extensions/erc20/write/setAllowance.ts index 9567ad23a..58378b788 100644 --- a/server/api/contract/extensions/erc20/write/setAllowance.ts +++ b/server/api/contract/extensions/erc20/write/setAllowance.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc20ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/signatureMint.ts b/server/api/contract/extensions/erc20/write/signatureMint.ts index 0ddd9af79..7febf9d0c 100644 --- a/server/api/contract/extensions/erc20/write/signatureMint.ts +++ b/server/api/contract/extensions/erc20/write/signatureMint.ts @@ -3,7 +3,6 @@ import { SignedPayload20 } from "@thirdweb-dev/sdk"; import { BigNumber } from "ethers"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, @@ -11,6 +10,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { signature20OutputSchema } from "../../../../../schemas/erc20"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/transfer.ts b/server/api/contract/extensions/erc20/write/transfer.ts index 9f304db56..e0a3c50e7 100644 --- a/server/api/contract/extensions/erc20/write/transfer.ts +++ b/server/api/contract/extensions/erc20/write/transfer.ts @@ -2,13 +2,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc20ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc20/write/transferFrom.ts b/server/api/contract/extensions/erc20/write/transferFrom.ts index ab42c5432..126af2018 100644 --- a/server/api/contract/extensions/erc20/write/transferFrom.ts +++ b/server/api/contract/extensions/erc20/write/transferFrom.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { erc20ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/read/signatureGenerate.ts b/server/api/contract/extensions/erc721/read/signatureGenerate.ts index 0807ef04a..6a668abb1 100644 --- a/server/api/contract/extensions/erc721/read/signatureGenerate.ts +++ b/server/api/contract/extensions/erc721/read/signatureGenerate.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { erc721ContractParamSchema, standardResponseSchema, @@ -11,6 +10,7 @@ import { signature721InputSchema, signature721OutputSchema, } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { checkAndReturnNFTSignaturePayload } from "../../../../../utilities/validator"; diff --git a/server/api/contract/extensions/erc721/write/burn.ts b/server/api/contract/extensions/erc721/write/burn.ts index dbf0c6235..c7e4bb3cf 100644 --- a/server/api/contract/extensions/erc721/write/burn.ts +++ b/server/api/contract/extensions/erc721/write/burn.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/claimTo.ts b/server/api/contract/extensions/erc721/write/claimTo.ts index 7d884f795..ae1f8d636 100644 --- a/server/api/contract/extensions/erc721/write/claimTo.ts +++ b/server/api/contract/extensions/erc721/write/claimTo.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/lazyMint.ts b/server/api/contract/extensions/erc721/write/lazyMint.ts index a685c36f7..1ee2374d7 100644 --- a/server/api/contract/extensions/erc721/write/lazyMint.ts +++ b/server/api/contract/extensions/erc721/write/lazyMint.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { nftOrInputSchema } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/mintBatchTo.ts b/server/api/contract/extensions/erc721/write/mintBatchTo.ts index f36e036e3..c52b183f6 100644 --- a/server/api/contract/extensions/erc721/write/mintBatchTo.ts +++ b/server/api/contract/extensions/erc721/write/mintBatchTo.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { nftOrInputSchema } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/mintTo.ts b/server/api/contract/extensions/erc721/write/mintTo.ts index 0513534f6..047ae4042 100644 --- a/server/api/contract/extensions/erc721/write/mintTo.ts +++ b/server/api/contract/extensions/erc721/write/mintTo.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { nftOrInputSchema } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/setApprovalForAll.ts b/server/api/contract/extensions/erc721/write/setApprovalForAll.ts index aa6bbbd9f..509636f7b 100644 --- a/server/api/contract/extensions/erc721/write/setApprovalForAll.ts +++ b/server/api/contract/extensions/erc721/write/setApprovalForAll.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/setApprovalForToken.ts b/server/api/contract/extensions/erc721/write/setApprovalForToken.ts index c7f63a13a..a3aa669f6 100644 --- a/server/api/contract/extensions/erc721/write/setApprovalForToken.ts +++ b/server/api/contract/extensions/erc721/write/setApprovalForToken.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/signatureMint.ts b/server/api/contract/extensions/erc721/write/signatureMint.ts index 22f15a862..7509f57e4 100644 --- a/server/api/contract/extensions/erc721/write/signatureMint.ts +++ b/server/api/contract/extensions/erc721/write/signatureMint.ts @@ -3,7 +3,6 @@ import { SignedPayload721WithQuantitySignature } from "@thirdweb-dev/sdk"; import { BigNumber } from "ethers"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, @@ -11,6 +10,7 @@ import { transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; import { signature721OutputSchema } from "../../../../../schemas/nft"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/transfer.ts b/server/api/contract/extensions/erc721/write/transfer.ts index 99d0179e0..d035effaa 100644 --- a/server/api/contract/extensions/erc721/write/transfer.ts +++ b/server/api/contract/extensions/erc721/write/transfer.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/erc721/write/transferFrom.ts b/server/api/contract/extensions/erc721/write/transferFrom.ts index 28ebb7271..09df090d5 100644 --- a/server/api/contract/extensions/erc721/write/transferFrom.ts +++ b/server/api/contract/extensions/erc721/write/transferFrom.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../core/schema"; import { queueTx } from "../../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../../../utilities/chain"; import { getContract } from "../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/directListings/read/isBuyerApprovedForListing.ts b/server/api/contract/extensions/marketplaceV3/directListings/read/isBuyerApprovedForListing.ts index 4cb22aa9f..3cdf7cdb1 100644 --- a/server/api/contract/extensions/marketplaceV3/directListings/read/isBuyerApprovedForListing.ts +++ b/server/api/contract/extensions/marketplaceV3/directListings/read/isBuyerApprovedForListing.ts @@ -1,11 +1,11 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { marketplaceV3ContractParamSchema, standardResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/directListings/write/approveBuyerForReservedListing.ts b/server/api/contract/extensions/marketplaceV3/directListings/write/approveBuyerForReservedListing.ts index c6e30e871..3dc80a208 100644 --- a/server/api/contract/extensions/marketplaceV3/directListings/write/approveBuyerForReservedListing.ts +++ b/server/api/contract/extensions/marketplaceV3/directListings/write/approveBuyerForReservedListing.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/directListings/write/buyFromListing.ts b/server/api/contract/extensions/marketplaceV3/directListings/write/buyFromListing.ts index d45795c8a..237aecbba 100644 --- a/server/api/contract/extensions/marketplaceV3/directListings/write/buyFromListing.ts +++ b/server/api/contract/extensions/marketplaceV3/directListings/write/buyFromListing.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/directListings/write/cancelListing.ts b/server/api/contract/extensions/marketplaceV3/directListings/write/cancelListing.ts index 98e9efaf2..fcd1fc4bd 100644 --- a/server/api/contract/extensions/marketplaceV3/directListings/write/cancelListing.ts +++ b/server/api/contract/extensions/marketplaceV3/directListings/write/cancelListing.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/directListings/write/createListing.ts b/server/api/contract/extensions/marketplaceV3/directListings/write/createListing.ts index ef3f028c2..6f6f2ff95 100644 --- a/server/api/contract/extensions/marketplaceV3/directListings/write/createListing.ts +++ b/server/api/contract/extensions/marketplaceV3/directListings/write/createListing.ts @@ -1,7 +1,6 @@ import { Static } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; import { directListingV3InputSchema } from "../../../../../../schemas/marketplaceV3/directListing"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/directListings/write/revokeBuyerApprovalForReservedListing.ts b/server/api/contract/extensions/marketplaceV3/directListings/write/revokeBuyerApprovalForReservedListing.ts index 42bde959f..490f08c10 100644 --- a/server/api/contract/extensions/marketplaceV3/directListings/write/revokeBuyerApprovalForReservedListing.ts +++ b/server/api/contract/extensions/marketplaceV3/directListings/write/revokeBuyerApprovalForReservedListing.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/directListings/write/revokeCurrencyApprovalForListing.ts b/server/api/contract/extensions/marketplaceV3/directListings/write/revokeCurrencyApprovalForListing.ts index 0840c2e44..80f2f0ca1 100644 --- a/server/api/contract/extensions/marketplaceV3/directListings/write/revokeCurrencyApprovalForListing.ts +++ b/server/api/contract/extensions/marketplaceV3/directListings/write/revokeCurrencyApprovalForListing.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/directListings/write/updateListing.ts b/server/api/contract/extensions/marketplaceV3/directListings/write/updateListing.ts index c2ebb5af4..b6751adbb 100644 --- a/server/api/contract/extensions/marketplaceV3/directListings/write/updateListing.ts +++ b/server/api/contract/extensions/marketplaceV3/directListings/write/updateListing.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; import { directListingV3InputSchema } from "../../../../../../schemas/marketplaceV3/directListing"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/offers/write/acceptOffer.ts b/server/api/contract/extensions/marketplaceV3/offers/write/acceptOffer.ts index 0323c2739..64cb0fb07 100644 --- a/server/api/contract/extensions/marketplaceV3/offers/write/acceptOffer.ts +++ b/server/api/contract/extensions/marketplaceV3/offers/write/acceptOffer.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/offers/write/cancelOffer.ts b/server/api/contract/extensions/marketplaceV3/offers/write/cancelOffer.ts index 3100fe429..81b1c87c9 100644 --- a/server/api/contract/extensions/marketplaceV3/offers/write/cancelOffer.ts +++ b/server/api/contract/extensions/marketplaceV3/offers/write/cancelOffer.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/extensions/marketplaceV3/offers/write/makeOffer.ts b/server/api/contract/extensions/marketplaceV3/offers/write/makeOffer.ts index a668a3b22..747f8c559 100644 --- a/server/api/contract/extensions/marketplaceV3/offers/write/makeOffer.ts +++ b/server/api/contract/extensions/marketplaceV3/offers/write/makeOffer.ts @@ -1,7 +1,6 @@ import { Static } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../../../core/schema"; import { queueTx } from "../../../../../../../src/db/transactions/queueTx"; import { marketplaceV3ContractParamSchema, @@ -9,6 +8,7 @@ import { transactionWritesResponseSchema, } from "../../../../../../helpers/sharedApiSchemas"; import { OfferV3InputSchema } from "../../../../../../schemas/marketplaceV3/offer"; +import { walletAuthSchema } from "../../../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../../../utilities/chain"; import { getContract } from "../../../../../../utils/cache/getContract"; diff --git a/server/api/contract/roles/write/grant.ts b/server/api/contract/roles/write/grant.ts index 65e6d5f8b..c1323299b 100644 --- a/server/api/contract/roles/write/grant.ts +++ b/server/api/contract/roles/write/grant.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../core/schema"; import { queueTx } from "../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../utilities/chain"; import { getContract } from "../../../../utils/cache/getContract"; diff --git a/server/api/contract/roles/write/revoke.ts b/server/api/contract/roles/write/revoke.ts index 42b4a6979..bb2bdc291 100644 --- a/server/api/contract/roles/write/revoke.ts +++ b/server/api/contract/roles/write/revoke.ts @@ -1,13 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../../core/schema"; import { queueTx } from "../../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../../schemas/wallet"; import { getChainIdFromChain } from "../../../../utilities/chain"; import { getContract } from "../../../../utils/cache/getContract"; diff --git a/server/api/contract/write/write.ts b/server/api/contract/write/write.ts index 89fb6751d..f59993163 100644 --- a/server/api/contract/write/write.ts +++ b/server/api/contract/write/write.ts @@ -1,14 +1,13 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; - import { queueTx } from "../../../../src/db/transactions/queueTx"; import { contractParamSchema, standardResponseSchema, transactionWritesResponseSchema, } from "../../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getContract } from "../../../utils/cache/getContract"; diff --git a/server/api/deploy/prebuilt.ts b/server/api/deploy/prebuilt.ts index 637a27db4..91ba1d6f5 100644 --- a/server/api/deploy/prebuilt.ts +++ b/server/api/deploy/prebuilt.ts @@ -1,12 +1,12 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../core/schema"; import { queueTx } from "../../../src/db/transactions/queueTx"; import { prebuiltDeployParamSchema, standardResponseSchema, } from "../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../utilities/chain"; import { getSdk } from "../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/edition.ts b/server/api/deploy/prebuilts/edition.ts index d2b609de2..90c8810bc 100644 --- a/server/api/deploy/prebuilts/edition.ts +++ b/server/api/deploy/prebuilts/edition.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -14,6 +13,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts/index"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/editionDrop.ts b/server/api/deploy/prebuilts/editionDrop.ts index 3b67a4e9d..aa618f7f3 100644 --- a/server/api/deploy/prebuilts/editionDrop.ts +++ b/server/api/deploy/prebuilts/editionDrop.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -15,6 +14,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/marketplaceV3.ts b/server/api/deploy/prebuilts/marketplaceV3.ts index d6e876eb4..0052fd08e 100644 --- a/server/api/deploy/prebuilts/marketplaceV3.ts +++ b/server/api/deploy/prebuilts/marketplaceV3.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -11,6 +10,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/multiwrap.ts b/server/api/deploy/prebuilts/multiwrap.ts index c7a74b92c..e43378f9a 100644 --- a/server/api/deploy/prebuilts/multiwrap.ts +++ b/server/api/deploy/prebuilts/multiwrap.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -12,6 +11,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/nftCollection.ts b/server/api/deploy/prebuilts/nftCollection.ts index 83d434a52..93d770fce 100644 --- a/server/api/deploy/prebuilts/nftCollection.ts +++ b/server/api/deploy/prebuilts/nftCollection.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -14,6 +13,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/nftDrop.ts b/server/api/deploy/prebuilts/nftDrop.ts index 3d9ea9c5f..d645a60b7 100644 --- a/server/api/deploy/prebuilts/nftDrop.ts +++ b/server/api/deploy/prebuilts/nftDrop.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -15,6 +14,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/pack.ts b/server/api/deploy/prebuilts/pack.ts index 7f0d63fb0..f7827c895 100644 --- a/server/api/deploy/prebuilts/pack.ts +++ b/server/api/deploy/prebuilts/pack.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -13,6 +12,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/signatureDrop.ts b/server/api/deploy/prebuilts/signatureDrop.ts index 87c898494..9dce9a34b 100644 --- a/server/api/deploy/prebuilts/signatureDrop.ts +++ b/server/api/deploy/prebuilts/signatureDrop.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -15,6 +14,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/split.ts b/server/api/deploy/prebuilts/split.ts index 895364c38..b3778c3ca 100644 --- a/server/api/deploy/prebuilts/split.ts +++ b/server/api/deploy/prebuilts/split.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -11,6 +10,7 @@ import { prebuiltDeployResponseSchema, splitRecipientInputSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/token.ts b/server/api/deploy/prebuilts/token.ts index 654f9a490..6d47e78bf 100644 --- a/server/api/deploy/prebuilts/token.ts +++ b/server/api/deploy/prebuilts/token.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -13,6 +12,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/tokenDrop.ts b/server/api/deploy/prebuilts/tokenDrop.ts index e6d75d016..ac923e694 100644 --- a/server/api/deploy/prebuilts/tokenDrop.ts +++ b/server/api/deploy/prebuilts/tokenDrop.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -14,6 +13,7 @@ import { prebuiltDeployContractParamSchema, prebuiltDeployResponseSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/prebuilts/vote.ts b/server/api/deploy/prebuilts/vote.ts index 2465333aa..dbe819bff 100644 --- a/server/api/deploy/prebuilts/vote.ts +++ b/server/api/deploy/prebuilts/vote.ts @@ -1,7 +1,6 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../../core/schema"; import { queueTx } from "../../../../src/db/transactions/queueTx"; import { standardResponseSchema } from "../../../helpers/sharedApiSchemas"; import { @@ -11,6 +10,7 @@ import { prebuiltDeployResponseSchema, voteSettingsInputSchema, } from "../../../schemas/prebuilts"; +import { walletAuthSchema } from "../../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../../utilities/chain"; import { getSdk } from "../../../utils/cache/getSdk"; diff --git a/server/api/deploy/published.ts b/server/api/deploy/published.ts index 478f33e41..ee23b6a17 100644 --- a/server/api/deploy/published.ts +++ b/server/api/deploy/published.ts @@ -1,12 +1,12 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { walletAuthSchema } from "../../../core/schema"; import { queueTx } from "../../../src/db/transactions/queueTx"; import { publishedDeployParamSchema, standardResponseSchema, } from "../../helpers/sharedApiSchemas"; +import { walletAuthSchema } from "../../schemas/wallet"; import { txOverridesForWriteRequest } from "../../schemas/web3api-overrides"; import { getChainIdFromChain } from "../../utilities/chain"; import { getSdk } from "../../utils/cache/getSdk"; diff --git a/server/api/transaction/getAll.ts b/server/api/transaction/getAll.ts index 538d29065..91c576e02 100644 --- a/server/api/transaction/getAll.ts +++ b/server/api/transaction/getAll.ts @@ -1,9 +1,9 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { createCustomError } from "../../../core/error/customError"; import { getAllTxs } from "../../../src/db/transactions/getAllTxs"; import { standardResponseSchema } from "../../helpers/sharedApiSchemas"; +import { createCustomError } from "../../middleware/error"; import { TransactionStatusEnum, transactionResponseSchema, diff --git a/server/api/transaction/getAllDeployedContracts.ts b/server/api/transaction/getAllDeployedContracts.ts index bb7b122b3..62cbda6a2 100644 --- a/server/api/transaction/getAllDeployedContracts.ts +++ b/server/api/transaction/getAllDeployedContracts.ts @@ -1,9 +1,9 @@ import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { createCustomError } from "../../../core/error/customError"; import { getAllTxs } from "../../../src/db/transactions/getAllTxs"; import { standardResponseSchema } from "../../helpers/sharedApiSchemas"; +import { createCustomError } from "../../middleware/error"; import { TransactionStatusEnum, transactionResponseSchema, diff --git a/server/api/transaction/status.ts b/server/api/transaction/status.ts index 3897ed019..d6de9cd52 100644 --- a/server/api/transaction/status.ts +++ b/server/api/transaction/status.ts @@ -2,7 +2,6 @@ import { SocketStream } from "@fastify/websocket"; import { Static, Type } from "@sinclair/typebox"; import { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { createCustomError } from "../../../core/error/customError"; import { getTxById } from "../../../src/db/transactions/getTxById"; import { standardResponseSchema } from "../../helpers/sharedApiSchemas"; import { @@ -13,6 +12,7 @@ import { onError, onMessage, } from "../../helpers/websocket"; +import { createCustomError } from "../../middleware/error"; import { transactionResponseSchema } from "../../schemas/transaction"; // INPUT diff --git a/server/controller/tx-update-listener.ts b/server/controller/tx-update-listener.ts index 4bc450af4..9733f693e 100644 --- a/server/controller/tx-update-listener.ts +++ b/server/controller/tx-update-listener.ts @@ -1,4 +1,4 @@ -import { connectToDatabase } from "../../core"; +import { knex } from "../../src/db/client"; import { getTxById } from "../../src/db/transactions/getTxById"; import { env } from "../../src/utils/env"; import { logger } from "../../src/utils/logger"; @@ -6,7 +6,6 @@ import { logger } from "../../src/utils/logger"; export const startTxUpdatesNotificationListener = async (): Promise => { try { // Connect to the DB - const knex = await connectToDatabase(); logger.server.info(`Starting update notification listener`); // Acquire a connection const connection = await knex.client.acquireConnection(); diff --git a/server/helpers/openapi.ts b/server/helpers/openapi.ts index 12265ffc4..9190c14e8 100644 --- a/server/helpers/openapi.ts +++ b/server/helpers/openapi.ts @@ -1,7 +1,7 @@ import swagger from "@fastify/swagger"; import fastifySwaggerUI from "@fastify/swagger-ui"; import { FastifyInstance } from "fastify"; -import { env } from "../../core"; +import { env } from "../../src/utils/env"; // fastify-swagger v8 requires the swagger-ui & openapi specs // to be separate unlike old implementation diff --git a/server/helpers/server.ts b/server/helpers/server.ts index 682aa81bf..bf54c3e9e 100644 --- a/server/helpers/server.ts +++ b/server/helpers/server.ts @@ -3,10 +3,11 @@ import fastifyExpress from "@fastify/express"; import { TypeBoxTypeProvider } from "@fastify/type-provider-typebox"; import WebSocketPlugin from "@fastify/websocket"; import fastify, { FastifyInstance } from "fastify"; -import { env, errorHandler } from "../../core"; import { apiRoutes } from "../../server/api"; +import { env } from "../../src/utils/env"; import { logger } from "../../src/utils/logger"; import { performHTTPAuthentication } from "../middleware/auth"; +import { errorHandler } from "../middleware/error"; import { openapi } from "./openapi"; const createServer = async (): Promise => { diff --git a/server/index.ts b/server/index.ts index 34ab33e82..0b6435d74 100644 --- a/server/index.ts +++ b/server/index.ts @@ -1,4 +1,4 @@ -import { env } from "../core"; +import { env } from "../src/utils/env"; import { logger } from "../src/utils/logger"; import { startTxUpdatesNotificationListener } from "./controller/tx-update-listener"; import createServer from "./helpers/server"; diff --git a/server/middleware/auth.ts b/server/middleware/auth.ts index f2bc1a0d6..5eaf8f2f6 100644 --- a/server/middleware/auth.ts +++ b/server/middleware/auth.ts @@ -1,6 +1,5 @@ import type { FastifyReply, FastifyRequest } from "fastify"; - -import { env } from "../../core"; +import { env } from "../../src/utils/env"; export const performHTTPAuthentication = async ( request: FastifyRequest, diff --git a/core/error/errorHandler.ts b/server/middleware/error.ts similarity index 62% rename from core/error/errorHandler.ts rename to server/middleware/error.ts index 69a944a98..b1e631ede 100644 --- a/core/error/errorHandler.ts +++ b/server/middleware/error.ts @@ -1,8 +1,39 @@ import { FastifyInstance } from "fastify"; import { ReasonPhrases, StatusCodes } from "http-status-codes"; import { env } from "../../src/utils/env"; -import { CustomError } from "./customError"; -import { getCodeFromStatusCode } from "./errorCodes"; + +export type CustomError = { + message: string; + statusCode: number; + code: string; + stack?: string; +}; + +export const createCustomError = ( + message: string, + statusCode: number, + code: string, +): CustomError => ({ + message, + statusCode, + code, +}); + +export const createCustomDateTimestampError = (key: string): CustomError => { + return createCustomError( + `Invalid ${key} Value. Needs to new Date() / new Date().toISOstring() / new Date().getTime() / Unix Epoch`, + 404, + "INVALID_DATE_TIME", + ); +}; + +const flipObject = (data: any) => + Object.fromEntries(Object.entries(data).map(([key, value]) => [value, key])); + +const StatusCodeToCode = flipObject(StatusCodes); + +export const getCodeFromStatusCode = (statusCode: number) => + StatusCodeToCode[statusCode]; export const errorHandler = async (server: FastifyInstance) => { server.setErrorHandler((error: Error | CustomError, request, reply) => { diff --git a/server/schemas/chain/index.ts b/server/schemas/chain/index.ts index 76219126a..9c52ed85f 100644 --- a/server/schemas/chain/index.ts +++ b/server/schemas/chain/index.ts @@ -7,3 +7,40 @@ export const chainRequestQuerystringSchema = Type.Object({ examples: allChains.map((chain) => chain.slug), }), }); + +export const chainResponseSchema = Type.Object({ + name: Type.String({ + description: "Chain name", + }), + chain: Type.String({ + description: "Chain name", + }), + rpc: Type.Array( + Type.String({ + description: "RPC URL", + }), + ), + nativeCurrency: Type.Object({ + name: Type.String({ + description: "Native currency name", + }), + symbol: Type.String({ + description: "Native currency symbol", + }), + decimals: Type.Number({ + description: "Native currency decimals", + }), + }), + shortName: Type.String({ + description: "Chain short name", + }), + chainId: Type.Number({ + description: "Chain ID", + }), + testnet: Type.Boolean({ + description: "Is testnet", + }), + slug: Type.String({ + description: "Chain slug", + }), +}); diff --git a/server/schemas/wallet/index.ts b/server/schemas/wallet/index.ts index fa2511cae..29105e4f6 100644 --- a/server/schemas/wallet/index.ts +++ b/server/schemas/wallet/index.ts @@ -1,5 +1,16 @@ import { Type } from "@sinclair/typebox"; +export const walletAuthSchema = Type.Object({ + "x-backend-wallet-address": Type.String({ + description: "Backend wallet address", + }), + "x-account-address": Type.Optional( + Type.String({ + description: "Smart account address", + }), + ), +}); + export const walletParamSchema = Type.Object({ chain: Type.String({ examples: ["mumbai"], diff --git a/server/utilities/transaction.ts b/server/utilities/transaction.ts index 52de123e0..59bd43ca6 100644 --- a/server/utilities/transaction.ts +++ b/server/utilities/transaction.ts @@ -2,10 +2,10 @@ import { TransactionResponse } from "@ethersproject/abstract-provider"; import { getDefaultGasOverrides } from "@thirdweb-dev/sdk"; import { BigNumber } from "ethers"; import { StatusCodes } from "http-status-codes"; -import { createCustomError } from "../../core"; import { createCancelledTxData } from "../../src/db/cancelledTransactions/createCancelledTxData"; import { getTxById } from "../../src/db/transactions/getTxById"; import { updateTx } from "../../src/db/transactions/updateTx"; +import { createCustomError } from "../middleware/error"; import { TransactionStatusEnum } from "../schemas/transaction"; import { getSdk } from "../utils/cache/getSdk"; diff --git a/server/utilities/validator.ts b/server/utilities/validator.ts index 257f3bbfa..1e3f27b61 100644 --- a/server/utilities/validator.ts +++ b/server/utilities/validator.ts @@ -1,11 +1,11 @@ -import { createCustomDateTimestampError } from "../../core/error/customError"; +import { Static } from "@sinclair/typebox"; +import { createCustomDateTimestampError } from "../middleware/error"; import { erc20ResponseType, signature20InputSchema } from "../schemas/erc20"; import { ercNFTResponseType, signature1155InputSchema, signature721InputSchema, } from "../schemas/nft"; -import { Static } from "@sinclair/typebox"; const timestampValidator = (value: number | string | undefined): Boolean => { if (value === undefined) { diff --git a/core/sdk/sdk.ts b/server/utils/storage/localStorage.ts similarity index 97% rename from core/sdk/sdk.ts rename to server/utils/storage/localStorage.ts index 9a10559a0..fa873e8a3 100644 --- a/core/sdk/sdk.ts +++ b/server/utils/storage/localStorage.ts @@ -1,7 +1,6 @@ import { AsyncStorage } from "@thirdweb-dev/wallets"; import * as fs from "fs"; -//TODO add constructor so you can pass in directory export class LocalFileStorage implements AsyncStorage { constructor(private readonly walletAddress?: string) { if (walletAddress) { diff --git a/server/utils/wallets/createLocalWallet.ts b/server/utils/wallets/createLocalWallet.ts index 2d1d89944..27d1a5a20 100644 --- a/server/utils/wallets/createLocalWallet.ts +++ b/server/utils/wallets/createLocalWallet.ts @@ -1,8 +1,8 @@ import { LocalWallet } from "@thirdweb-dev/wallets"; -import { LocalFileStorage } from "../../../core"; import { createWalletDetails } from "../../../src/db/wallets/createWalletDetails"; import { WalletType } from "../../../src/schema/wallet"; import { env } from "../../../src/utils/env"; +import { LocalFileStorage } from "../storage/localStorage"; export const createLocalWallet = async (): Promise => { if (env.WALLET_CONFIGURATION.type !== WalletType.local) { diff --git a/server/utils/wallets/getLocalWallet.ts b/server/utils/wallets/getLocalWallet.ts index d38fc2518..dd37b6bb6 100644 --- a/server/utils/wallets/getLocalWallet.ts +++ b/server/utils/wallets/getLocalWallet.ts @@ -1,7 +1,7 @@ import { getChainByChainId } from "@thirdweb-dev/chains"; import { LocalWallet } from "@thirdweb-dev/wallets"; -import { LocalFileStorage } from "../../../core"; import { env } from "../../../src/utils/env"; +import { LocalFileStorage } from "../storage/localStorage"; interface GetLocalWalletParams { chainId: number; diff --git a/server/utils/wallets/importAwsKmsWallet.ts b/server/utils/wallets/importAwsKmsWallet.ts index 9fdcef5ab..2c0d63e5d 100644 --- a/server/utils/wallets/importAwsKmsWallet.ts +++ b/server/utils/wallets/importAwsKmsWallet.ts @@ -1,6 +1,6 @@ -import { env } from "../../../core"; import { createWalletDetails } from "../../../src/db/wallets/createWalletDetails"; import { WalletType } from "../../../src/schema/wallet"; +import { env } from "../../../src/utils/env"; import { getAwsKmsWallet } from "./getAwsKmsWallet"; interface ImportAwsKmsWalletParams { diff --git a/server/utils/wallets/importLocalWallet.ts b/server/utils/wallets/importLocalWallet.ts index 81d37a19a..cdc3001ee 100644 --- a/server/utils/wallets/importLocalWallet.ts +++ b/server/utils/wallets/importLocalWallet.ts @@ -1,7 +1,8 @@ import { LocalWallet } from "@thirdweb-dev/wallets"; -import { LocalFileStorage, env } from "../../../core"; import { createWalletDetails } from "../../../src/db/wallets/createWalletDetails"; import { WalletType } from "../../../src/schema/wallet"; +import { env } from "../../../src/utils/env"; +import { LocalFileStorage } from "../storage/localStorage"; type ImportLocalWalletParams = | { diff --git a/src/db/wallets/createWalletNonce.ts b/src/db/wallets/createWalletNonce.ts index 0b8a9b375..598832cdc 100644 --- a/src/db/wallets/createWalletNonce.ts +++ b/src/db/wallets/createWalletNonce.ts @@ -1,6 +1,5 @@ import { ERC4337EthersSigner } from "@thirdweb-dev/wallets/dist/declarations/src/evm/connectors/smart-wallet/lib/erc4337-signer"; import { BigNumber } from "ethers"; -import { getWalletNonce } from "../../../core/services/blockchain"; import { getSdk } from "../../../server/utils/cache/getSdk"; import { PrismaTransaction } from "../../schema/prisma"; import { getPrismaWithPostgresTx } from "../client"; @@ -37,7 +36,9 @@ export const createWalletNonce = async ({ } else { // If the wallet is a regular EOA, get the nonce nonce = BigNumber.from( - (await getWalletNonce(address.toLowerCase(), sdk.getProvider())) ?? 0, + (await sdk + .getProvider() + .getTransactionCount(address.toLowerCase(), "pending")) ?? 0, ).toNumber(); } } catch {