From ad057dcec6edea28154af4a777b17d5857688b64 Mon Sep 17 00:00:00 2001 From: Phillip Ho Date: Sat, 7 Dec 2024 08:06:40 +0800 Subject: [PATCH 1/4] Revert "Revert "refactor: clearer folder organization (#792)" (#795)" This reverts commit 8f668fe5eadc41cd68c77dc9ce94144b88fd3aa1. --- .vscode/settings.json | 17 -------- Dockerfile | 1 + package.json | 4 +- {src/scripts => scripts}/apply-migrations.ts | 10 +++-- {src/scripts => scripts}/generate-sdk.ts | 0 {src/scripts => scripts}/setup-db.ts | 8 ++-- src/index.ts | 7 ++-- src/polyfill.ts | 2 +- src/server/index.ts | 10 ++--- src/server/listeners/updateTxListener.ts | 6 +-- src/server/middleware/adminRoutes.ts | 2 +- src/server/middleware/auth.ts | 30 +++++++------- src/server/middleware/cors.ts | 2 +- src/server/middleware/engineMode.ts | 2 +- src/server/middleware/error.ts | 4 +- src/server/middleware/logs.ts | 2 +- src/server/middleware/prometheus.ts | 4 +- src/server/middleware/rateLimit.ts | 4 +- src/server/middleware/websocket.ts | 2 +- src/server/routes/admin/nonces.ts | 14 +++---- src/server/routes/admin/transaction.ts | 14 +++---- .../routes/auth/access-tokens/create.ts | 10 ++--- .../routes/auth/access-tokens/getAll.ts | 2 +- .../routes/auth/access-tokens/revoke.ts | 4 +- .../routes/auth/access-tokens/update.ts | 4 +- src/server/routes/auth/keypair/add.ts | 12 +++--- src/server/routes/auth/keypair/list.ts | 11 +++-- src/server/routes/auth/keypair/remove.ts | 8 ++-- src/server/routes/auth/permissions/getAll.ts | 2 +- src/server/routes/auth/permissions/grant.ts | 4 +- src/server/routes/auth/permissions/revoke.ts | 2 +- .../routes/backend-wallet/cancel-nonces.ts | 6 +-- src/server/routes/backend-wallet/create.ts | 4 +- src/server/routes/backend-wallet/getAll.ts | 2 +- .../routes/backend-wallet/getBalance.ts | 6 +-- src/server/routes/backend-wallet/getNonce.ts | 2 +- .../routes/backend-wallet/getTransactions.ts | 6 +-- .../backend-wallet/getTransactionsByNonce.ts | 8 ++-- src/server/routes/backend-wallet/import.ts | 2 +- src/server/routes/backend-wallet/remove.ts | 8 ++-- .../routes/backend-wallet/reset-nonces.ts | 2 +- .../routes/backend-wallet/sendTransaction.ts | 2 +- .../backend-wallet/sendTransactionBatch.ts | 2 +- .../routes/backend-wallet/signMessage.ts | 6 +-- .../routes/backend-wallet/signTransaction.ts | 6 +-- .../routes/backend-wallet/signTypedData.ts | 6 +-- .../backend-wallet/simulateTransaction.ts | 4 +- src/server/routes/backend-wallet/transfer.ts | 10 ++--- src/server/routes/backend-wallet/update.ts | 6 +-- src/server/routes/backend-wallet/withdraw.ts | 12 +++--- src/server/routes/chain/get.ts | 2 +- src/server/routes/chain/getAll.ts | 2 +- src/server/routes/configuration/auth/get.ts | 6 +-- .../routes/configuration/auth/update.ts | 8 ++-- .../backend-wallet-balance/get.ts | 6 +-- .../backend-wallet-balance/update.ts | 4 +- src/server/routes/configuration/cache/get.ts | 6 +-- .../routes/configuration/cache/update.ts | 12 +++--- src/server/routes/configuration/chains/get.ts | 2 +- .../routes/configuration/chains/update.ts | 6 +-- .../contract-subscriptions/get.ts | 6 +-- .../contract-subscriptions/update.ts | 4 +- src/server/routes/configuration/cors/add.ts | 8 ++-- src/server/routes/configuration/cors/get.ts | 6 +-- .../routes/configuration/cors/remove.ts | 8 ++-- src/server/routes/configuration/cors/set.ts | 4 +- src/server/routes/configuration/ip/get.ts | 6 +-- src/server/routes/configuration/ip/set.ts | 8 ++-- .../routes/configuration/transactions/get.ts | 2 +- .../configuration/transactions/update.ts | 4 +- .../routes/configuration/wallets/get.ts | 4 +- .../routes/configuration/wallets/update.ts | 6 +-- .../routes/contract/events/getAllEvents.ts | 6 +-- .../contract/events/getContractEventLogs.ts | 4 +- .../events/getEventLogsByTimestamp.ts | 2 +- .../routes/contract/events/getEvents.ts | 6 +-- .../contract/events/paginateEventLogs.ts | 4 +- .../extensions/account/read/getAllAdmins.ts | 6 +-- .../extensions/account/read/getAllSessions.ts | 6 +-- .../extensions/account/write/grantAdmin.ts | 4 +- .../extensions/account/write/grantSession.ts | 4 +- .../extensions/account/write/revokeAdmin.ts | 4 +- .../extensions/account/write/revokeSession.ts | 4 +- .../extensions/account/write/updateSession.ts | 4 +- .../accountFactory/read/getAllAccounts.ts | 6 +-- .../read/getAssociatedAccounts.ts | 6 +-- .../accountFactory/read/isAccountDeployed.ts | 6 +-- .../read/predictAccountAddress.ts | 2 +- .../accountFactory/write/createAccount.ts | 6 +-- .../extensions/erc1155/read/balanceOf.ts | 2 +- .../extensions/erc1155/read/canClaim.ts | 2 +- .../contract/extensions/erc1155/read/get.ts | 2 +- .../erc1155/read/getActiveClaimConditions.ts | 2 +- .../extensions/erc1155/read/getAll.ts | 2 +- .../erc1155/read/getAllClaimConditions.ts | 2 +- .../read/getClaimIneligibilityReasons.ts | 2 +- .../erc1155/read/getClaimerProofs.ts | 2 +- .../extensions/erc1155/read/getOwned.ts | 2 +- .../extensions/erc1155/read/isApproved.ts | 2 +- .../erc1155/read/signatureGenerate.ts | 10 ++--- .../extensions/erc1155/read/totalCount.ts | 2 +- .../extensions/erc1155/read/totalSupply.ts | 2 +- .../extensions/erc1155/write/airdrop.ts | 4 +- .../contract/extensions/erc1155/write/burn.ts | 4 +- .../extensions/erc1155/write/burnBatch.ts | 4 +- .../extensions/erc1155/write/claimTo.ts | 6 +-- .../extensions/erc1155/write/lazyMint.ts | 4 +- .../erc1155/write/mintAdditionalSupplyTo.ts | 4 +- .../extensions/erc1155/write/mintBatchTo.ts | 4 +- .../extensions/erc1155/write/mintTo.ts | 4 +- .../erc1155/write/setApprovalForAll.ts | 4 +- .../erc1155/write/setBatchClaimConditions.ts | 4 +- .../erc1155/write/setClaimConditions.ts | 4 +- .../extensions/erc1155/write/signatureMint.ts | 4 +- .../extensions/erc1155/write/transfer.ts | 8 ++-- .../extensions/erc1155/write/transferFrom.ts | 8 ++-- .../erc1155/write/updateClaimConditions.ts | 4 +- .../erc1155/write/updateTokenMetadata.ts | 4 +- .../extensions/erc20/read/allowanceOf.ts | 2 +- .../extensions/erc20/read/balanceOf.ts | 2 +- .../extensions/erc20/read/canClaim.ts | 6 +-- .../contract/extensions/erc20/read/get.ts | 2 +- .../erc20/read/getActiveClaimConditions.ts | 2 +- .../erc20/read/getAllClaimConditions.ts | 2 +- .../read/getClaimIneligibilityReasons.ts | 2 +- .../extensions/erc20/read/getClaimerProofs.ts | 2 +- .../erc20/read/signatureGenerate.ts | 10 ++--- .../extensions/erc20/read/totalSupply.ts | 2 +- .../contract/extensions/erc20/write/burn.ts | 4 +- .../extensions/erc20/write/burnFrom.ts | 4 +- .../extensions/erc20/write/claimTo.ts | 6 +-- .../extensions/erc20/write/mintBatchTo.ts | 4 +- .../contract/extensions/erc20/write/mintTo.ts | 4 +- .../extensions/erc20/write/setAllowance.ts | 4 +- .../erc20/write/setClaimConditions.ts | 4 +- .../extensions/erc20/write/signatureMint.ts | 4 +- .../extensions/erc20/write/transfer.ts | 8 ++-- .../extensions/erc20/write/transferFrom.ts | 8 ++-- .../erc20/write/updateClaimConditions.ts | 4 +- .../extensions/erc721/read/balanceOf.ts | 2 +- .../extensions/erc721/read/canClaim.ts | 2 +- .../contract/extensions/erc721/read/get.ts | 2 +- .../erc721/read/getActiveClaimConditions.ts | 2 +- .../contract/extensions/erc721/read/getAll.ts | 2 +- .../erc721/read/getAllClaimConditions.ts | 2 +- .../read/getClaimIneligibilityReasons.ts | 2 +- .../erc721/read/getClaimerProofs.ts | 2 +- .../extensions/erc721/read/getOwned.ts | 2 +- .../extensions/erc721/read/isApproved.ts | 2 +- .../erc721/read/signatureGenerate.ts | 10 ++--- .../erc721/read/signaturePrepare.ts | 6 +-- .../erc721/read/totalClaimedSupply.ts | 2 +- .../extensions/erc721/read/totalCount.ts | 2 +- .../erc721/read/totalUnclaimedSupply.ts | 2 +- .../contract/extensions/erc721/write/burn.ts | 4 +- .../extensions/erc721/write/claimTo.ts | 6 +-- .../extensions/erc721/write/lazyMint.ts | 8 ++-- .../extensions/erc721/write/mintBatchTo.ts | 8 ++-- .../extensions/erc721/write/mintTo.ts | 8 ++-- .../erc721/write/setApprovalForAll.ts | 8 ++-- .../erc721/write/setApprovalForToken.ts | 8 ++-- .../erc721/write/setClaimConditions.ts | 10 ++--- .../extensions/erc721/write/signatureMint.ts | 18 ++++---- .../extensions/erc721/write/transfer.ts | 8 ++-- .../extensions/erc721/write/transferFrom.ts | 8 ++-- .../erc721/write/updateClaimConditions.ts | 10 ++--- .../erc721/write/updateTokenMetadata.ts | 8 ++-- .../directListings/read/getAll.ts | 2 +- .../directListings/read/getAllValid.ts | 2 +- .../directListings/read/getListing.ts | 2 +- .../directListings/read/getTotalCount.ts | 2 +- .../read/isBuyerApprovedForListing.ts | 2 +- .../read/isCurrencyApprovedForListing.ts | 2 +- .../write/approveBuyerForReservedListing.ts | 4 +- .../directListings/write/buyFromListing.ts | 4 +- .../directListings/write/cancelListing.ts | 4 +- .../directListings/write/createListing.ts | 4 +- .../revokeBuyerApprovalForReservedListing.ts | 4 +- .../write/revokeCurrencyApprovalForListing.ts | 4 +- .../directListings/write/updateListing.ts | 4 +- .../englishAuctions/read/getAll.ts | 2 +- .../englishAuctions/read/getAllValid.ts | 2 +- .../englishAuctions/read/getAuction.ts | 2 +- .../englishAuctions/read/getBidBufferBps.ts | 2 +- .../englishAuctions/read/getMinimumNextBid.ts | 2 +- .../englishAuctions/read/getTotalCount.ts | 2 +- .../englishAuctions/read/getWinner.ts | 2 +- .../englishAuctions/read/getWinningBid.ts | 2 +- .../englishAuctions/read/isWinningBid.ts | 2 +- .../englishAuctions/write/buyoutAuction.ts | 4 +- .../englishAuctions/write/cancelAuction.ts | 4 +- .../write/closeAuctionForBidder.ts | 4 +- .../write/closeAuctionForSeller.ts | 4 +- .../englishAuctions/write/createAuction.ts | 4 +- .../englishAuctions/write/executeSale.ts | 4 +- .../englishAuctions/write/makeBid.ts | 4 +- .../marketplaceV3/offers/read/getAll.ts | 2 +- .../marketplaceV3/offers/read/getAllValid.ts | 2 +- .../marketplaceV3/offers/read/getOffer.ts | 2 +- .../offers/read/getTotalCount.ts | 2 +- .../marketplaceV3/offers/write/acceptOffer.ts | 4 +- .../marketplaceV3/offers/write/cancelOffer.ts | 4 +- .../marketplaceV3/offers/write/makeOffer.ts | 4 +- src/server/routes/contract/metadata/abi.ts | 2 +- src/server/routes/contract/metadata/events.ts | 2 +- .../routes/contract/metadata/extensions.ts | 6 +-- .../routes/contract/metadata/functions.ts | 6 +-- src/server/routes/contract/read/read.ts | 4 +- src/server/routes/contract/roles/read/get.ts | 2 +- .../routes/contract/roles/read/getAll.ts | 2 +- .../routes/contract/roles/write/grant.ts | 4 +- .../routes/contract/roles/write/revoke.ts | 4 +- .../royalties/read/getDefaultRoyaltyInfo.ts | 6 +-- .../royalties/read/getTokenRoyaltyInfo.ts | 2 +- .../royalties/write/setDefaultRoyaltyInfo.ts | 8 ++-- .../royalties/write/setTokenRoyaltyInfo.ts | 8 ++-- .../subscriptions/addContractSubscription.ts | 20 ++++----- .../getContractIndexedBlockRange.ts | 2 +- .../subscriptions/getContractSubscriptions.ts | 6 +-- .../contract/subscriptions/getLatestBlock.ts | 2 +- .../removeContractSubscription.ts | 8 ++-- .../transactions/getTransactionReceipts.ts | 8 ++-- .../getTransactionReceiptsByTimestamp.ts | 2 +- .../paginateTransactionReceipts.ts | 4 +- src/server/routes/contract/write/write.ts | 6 +-- src/server/routes/deploy/prebuilt.ts | 10 ++--- src/server/routes/deploy/prebuilts/edition.ts | 10 ++--- .../routes/deploy/prebuilts/editionDrop.ts | 10 ++--- .../routes/deploy/prebuilts/marketplaceV3.ts | 10 ++--- .../routes/deploy/prebuilts/multiwrap.ts | 10 ++--- .../routes/deploy/prebuilts/nftCollection.ts | 10 ++--- src/server/routes/deploy/prebuilts/nftDrop.ts | 10 ++--- src/server/routes/deploy/prebuilts/pack.ts | 10 ++--- .../routes/deploy/prebuilts/signatureDrop.ts | 10 ++--- src/server/routes/deploy/prebuilts/split.ts | 10 ++--- src/server/routes/deploy/prebuilts/token.ts | 10 ++--- .../routes/deploy/prebuilts/tokenDrop.ts | 10 ++--- src/server/routes/deploy/prebuilts/vote.ts | 10 ++--- src/server/routes/deploy/published.ts | 8 ++-- src/server/routes/relayer/create.ts | 2 +- src/server/routes/relayer/getAll.ts | 2 +- src/server/routes/relayer/index.ts | 8 ++-- src/server/routes/relayer/revoke.ts | 2 +- src/server/routes/relayer/update.ts | 2 +- src/server/routes/system/health.ts | 8 ++-- src/server/routes/system/queue.ts | 6 +-- .../routes/transaction/blockchain/getLogs.ts | 8 ++-- .../transaction/blockchain/getReceipt.ts | 4 +- .../blockchain/getUserOpReceipt.ts | 2 +- .../transaction/blockchain/sendSignedTx.ts | 4 +- .../blockchain/sendSignedUserOp.ts | 4 +- src/server/routes/transaction/cancel.ts | 18 ++++---- src/server/routes/transaction/getAll.ts | 2 +- .../transaction/getAllDeployedContracts.ts | 6 +-- src/server/routes/transaction/retry-failed.ts | 6 +-- src/server/routes/transaction/retry.ts | 10 ++--- src/server/routes/transaction/status.ts | 10 ++--- src/server/routes/transaction/sync-retry.ts | 21 ++++++---- src/server/routes/webhooks/create.ts | 8 ++-- src/server/routes/webhooks/events.ts | 6 +-- src/server/routes/webhooks/getAll.ts | 2 +- src/server/routes/webhooks/revoke.ts | 4 +- src/server/routes/webhooks/test.ts | 4 +- src/server/schemas/transaction/index.ts | 2 +- src/server/schemas/wallet/index.ts | 2 +- src/server/utils/chain.ts | 2 +- src/server/utils/storage/localStorage.ts | 8 ++-- src/server/utils/transactionOverrides.ts | 4 +- .../utils/wallets/createGcpKmsWallet.ts | 6 +-- src/server/utils/wallets/createLocalWallet.ts | 6 +-- src/server/utils/wallets/createSmartWallet.ts | 6 +-- .../utils/wallets/fetchAwsKmsWalletParams.ts | 2 +- .../utils/wallets/fetchGcpKmsWalletParams.ts | 2 +- src/server/utils/wallets/getAwsKmsAccount.ts | 2 +- src/server/utils/wallets/getGcpKmsAccount.ts | 2 +- src/server/utils/wallets/getLocalWallet.ts | 10 ++--- src/server/utils/wallets/getSmartWallet.ts | 6 +-- .../utils/wallets/importAwsKmsWallet.ts | 6 +-- .../utils/wallets/importGcpKmsWallet.ts | 6 +-- src/server/utils/wallets/importLocalWallet.ts | 2 +- src/server/utils/websocket.ts | 12 +++--- .../db/chainIndexers/getChainIndexer.ts | 2 +- .../db/chainIndexers/upsertChainIndexer.ts | 2 +- src/{ => shared}/db/client.ts | 6 +-- .../db/configuration/getConfiguration.ts | 6 +-- .../db/configuration/updateConfiguration.ts | 0 .../createContractEventLogs.ts | 4 +- .../deleteContractEventLogs.ts | 0 .../contractEventLogs/getContractEventLogs.ts | 0 .../createContractSubscription.ts | 0 .../deleteContractSubscription.ts | 0 .../getContractSubscriptions.ts | 0 .../createContractTransactionReceipts.ts | 2 +- .../deleteContractTransactionReceipts.ts | 0 .../getContractTransactionReceipts.ts | 0 src/{ => shared}/db/keypair/delete.ts | 0 src/{ => shared}/db/keypair/get.ts | 0 src/{ => shared}/db/keypair/insert.ts | 6 +-- src/{ => shared}/db/keypair/list.ts | 0 .../db/permissions/deletePermissions.ts | 0 .../db/permissions/getPermissions.ts | 2 +- .../db/permissions/updatePermissions.ts | 0 src/{ => shared}/db/relayer/getRelayerById.ts | 0 src/{ => shared}/db/tokens/createToken.ts | 0 src/{ => shared}/db/tokens/getAccessTokens.ts | 0 src/{ => shared}/db/tokens/getToken.ts | 0 src/{ => shared}/db/tokens/revokeToken.ts | 0 src/{ => shared}/db/tokens/updateToken.ts | 0 src/{ => shared}/db/transactions/db.ts | 0 src/{ => shared}/db/transactions/queueTx.ts | 4 +- .../db/wallets/createWalletDetails.ts | 2 +- .../db/wallets/deleteWalletDetails.ts | 0 src/{ => shared}/db/wallets/getAllWallets.ts | 2 +- .../db/wallets/getWalletDetails.ts | 2 +- src/{ => shared}/db/wallets/nonceMap.ts | 2 +- .../db/wallets/updateWalletDetails.ts | 0 src/{ => shared}/db/wallets/walletNonce.ts | 0 src/{ => shared}/db/webhooks/createWebhook.ts | 2 +- .../db/webhooks/getAllWebhooks.ts | 0 src/{ => shared}/db/webhooks/getWebhook.ts | 0 src/{ => shared}/db/webhooks/revokeWebhook.ts | 0 src/{ => shared}/lib/cache/swr.ts | 0 .../lib/chain/chain-capabilities.ts | 0 .../transaction/get-transaction-receipt.ts | 0 .../auth/index.ts => shared/schemas/auth.ts} | 0 src/{schema => shared/schemas}/config.ts | 0 src/{schema => shared/schemas}/extension.ts | 0 .../keypairs.ts => shared/schemas/keypair.ts} | 4 +- src/{schema => shared/schemas}/prisma.ts | 0 src/{constants => shared/schemas}/relayer.ts | 0 src/{schema => shared/schemas}/wallet.ts | 0 src/{schema => shared/schemas}/webhooks.ts | 0 src/{ => shared}/utils/account.ts | 12 +++--- src/{ => shared}/utils/auth.ts | 0 src/{ => shared}/utils/block.ts | 0 src/{ => shared}/utils/cache/accessToken.ts | 0 src/{ => shared}/utils/cache/authWallet.ts | 0 src/{ => shared}/utils/cache/clearCache.ts | 0 src/{ => shared}/utils/cache/getConfig.ts | 2 +- src/{ => shared}/utils/cache/getContract.ts | 6 +-- src/{ => shared}/utils/cache/getContractv5.ts | 0 src/{ => shared}/utils/cache/getSdk.ts | 2 +- .../utils/cache/getSmartWalletV5.ts | 0 src/{ => shared}/utils/cache/getWallet.ts | 14 +++---- src/{ => shared}/utils/cache/getWebhook.ts | 2 +- src/{ => shared}/utils/cache/keypair.ts | 0 src/{ => shared}/utils/chain.ts | 0 src/{ => shared}/utils/cron/clearCacheCron.ts | 0 src/{ => shared}/utils/cron/isValidCron.ts | 2 +- src/{ => shared}/utils/crypto.ts | 0 src/{ => shared}/utils/date.ts | 0 src/{ => shared}/utils/env.ts | 0 src/{ => shared}/utils/error.ts | 0 src/{ => shared}/utils/ethers.ts | 0 .../utils/indexer/getBlockTime.ts | 0 src/{ => shared}/utils/logger.ts | 0 src/{ => shared}/utils/math.ts | 0 src/{ => shared}/utils/primitiveTypes.ts | 0 src/{ => shared}/utils/prometheus.ts | 2 +- src/{ => shared}/utils/redis/lock.ts | 0 src/{ => shared}/utils/redis/redis.ts | 0 src/{ => shared}/utils/sdk.ts | 0 .../utils/transaction/cancelTransaction.ts | 0 .../utils/transaction/insertTransaction.ts | 8 ++-- .../utils/transaction/queueTransation.ts | 6 +-- .../transaction/simulateQueuedTransaction.ts | 0 src/{ => shared}/utils/transaction/types.ts | 0 src/{ => shared}/utils/transaction/webhook.ts | 4 +- src/{ => shared}/utils/usage.ts | 18 ++++---- src/{ => shared}/utils/webhook.ts | 0 src/{utils => }/tracer.ts | 2 +- src/worker/indexers/chainIndexerRegistry.ts | 4 +- src/worker/listeners/chainIndexerListener.ts | 4 +- src/worker/listeners/configListener.ts | 8 ++-- src/worker/listeners/webhookListener.ts | 6 +-- .../queues/cancelRecycledNoncesQueue.ts | 2 +- .../migratePostgresTransactionsQueue.ts | 2 +- src/worker/queues/mineTransactionQueue.ts | 2 +- src/worker/queues/nonceHealthCheckQueue.ts | 2 +- src/worker/queues/nonceResyncQueue.ts | 2 +- src/worker/queues/processEventLogsQueue.ts | 6 +-- .../queues/processTransactionReceiptsQueue.ts | 6 +-- src/worker/queues/pruneTransactionsQueue.ts | 2 +- src/worker/queues/queues.ts | 4 +- src/worker/queues/sendTransactionQueue.ts | 2 +- src/worker/queues/sendWebhookQueue.ts | 8 ++-- .../tasks/cancelRecycledNoncesWorker.ts | 14 +++---- src/worker/tasks/chainIndexer.ts | 14 +++---- src/worker/tasks/manageChainIndexers.ts | 2 +- .../migratePostgresTransactionsWorker.ts | 19 +++++---- src/worker/tasks/mineTransactionWorker.ts | 39 ++++++++++-------- src/worker/tasks/nonceHealthCheckWorker.ts | 6 +-- src/worker/tasks/nonceResyncWorker.ts | 14 +++---- src/worker/tasks/processEventLogsWorker.ts | 18 ++++---- .../tasks/processTransactionReceiptsWorker.ts | 18 ++++---- src/worker/tasks/pruneTransactionsWorker.ts | 8 ++-- src/worker/tasks/sendTransactionWorker.ts | 30 +++++++------- src/worker/tasks/sendWebhookWorker.ts | 13 +++--- src/worker/utils/contractId.ts | 2 - src/worker/utils/nonce.ts | 25 ----------- {test => tests}/e2e/.env.test.example | 0 {test => tests}/e2e/.gitignore | 0 {test => tests}/e2e/README.md | 0 {test => tests}/e2e/bun.lockb | Bin {test => tests}/e2e/config.ts | 0 {test => tests}/e2e/package.json | 0 {test => tests}/e2e/scripts/counter.ts | 4 +- {test => tests}/e2e/tests/extensions.test.ts | 2 +- {test => tests}/e2e/tests/load.test.ts | 2 +- {test => tests}/e2e/tests/read.test.ts | 2 +- .../e2e/tests/routes/erc1155-transfer.test.ts | 0 .../e2e/tests/routes/erc20-transfer.test.ts | 2 +- .../e2e/tests/routes/erc721-transfer.test.ts | 0 .../e2e/tests/routes/signMessage.test.ts | 0 .../e2e/tests/routes/signaturePrepare.test.ts | 0 .../e2e/tests/routes/write.test.ts | 8 ++-- {test => tests}/e2e/tests/setup.ts | 2 +- .../e2e/tests/sign-transaction.test.ts | 0 .../smart-aws-wallet.test.ts | 0 .../smart-gcp-wallet.test.ts | 0 .../smart-local-wallet-sdk-v4.test.ts | 0 .../smart-local-wallet.test.ts | 0 {test => tests}/e2e/tests/smoke.test.ts | 0 {test => tests}/e2e/tests/userop.test.ts | 2 +- .../e2e/tests/utils/getBlockTime.test.ts | 0 {test => tests}/e2e/tsconfig.json | 0 {test => tests}/e2e/utils/anvil.ts | 0 {test => tests}/e2e/utils/engine.ts | 2 +- {test => tests}/e2e/utils/statistics.ts | 0 {test => tests}/e2e/utils/transactions.ts | 4 +- {test => tests}/e2e/utils/wallets.ts | 0 {src/tests/config => tests/shared}/aws-kms.ts | 0 {src/tests => tests}/shared/chain.ts | 0 {src/tests => tests}/shared/client.ts | 0 {src/tests/config => tests/shared}/gcp-kms.ts | 0 {src/tests => tests}/shared/typed-data.ts | 0 {src/tests => tests/unit}/auth.test.ts | 27 ++++++------ {src/tests => tests/unit}/aws-arn.test.ts | 2 +- .../wallets => tests/unit}/aws-kms.test.ts | 7 +--- {src/tests => tests/unit}/chain.test.ts | 4 +- .../wallets => tests/unit}/gcp-kms.test.ts | 8 ++-- .../unit}/gcp-resource-path.test.ts | 2 +- {src/tests => tests/unit}/math.test.ts | 2 +- {src/tests => tests/unit}/schema.test.ts | 4 +- {src/tests => tests/unit}/swr.test.ts | 2 +- {src/tests => tests/unit}/validator.test.ts | 2 +- tsconfig.json | 2 +- vitest.config.ts | 3 +- vitest.global-setup.ts | 28 +++++++------ 449 files changed, 978 insertions(+), 1000 deletions(-) delete mode 100644 .vscode/settings.json rename {src/scripts => scripts}/apply-migrations.ts (88%) rename {src/scripts => scripts}/generate-sdk.ts (100%) rename {src/scripts => scripts}/setup-db.ts (79%) rename src/{ => shared}/db/chainIndexers/getChainIndexer.ts (94%) rename src/{ => shared}/db/chainIndexers/upsertChainIndexer.ts (91%) rename src/{ => shared}/db/client.ts (84%) rename src/{ => shared}/db/configuration/getConfiguration.ts (98%) rename src/{ => shared}/db/configuration/updateConfiguration.ts (100%) rename src/{ => shared}/db/contractEventLogs/createContractEventLogs.ts (78%) rename src/{ => shared}/db/contractEventLogs/deleteContractEventLogs.ts (100%) rename src/{ => shared}/db/contractEventLogs/getContractEventLogs.ts (100%) rename src/{ => shared}/db/contractSubscriptions/createContractSubscription.ts (100%) rename src/{ => shared}/db/contractSubscriptions/deleteContractSubscription.ts (100%) rename src/{ => shared}/db/contractSubscriptions/getContractSubscriptions.ts (100%) rename src/{ => shared}/db/contractTransactionReceipts/createContractTransactionReceipts.ts (91%) rename src/{ => shared}/db/contractTransactionReceipts/deleteContractTransactionReceipts.ts (100%) rename src/{ => shared}/db/contractTransactionReceipts/getContractTransactionReceipts.ts (100%) rename src/{ => shared}/db/keypair/delete.ts (100%) rename src/{ => shared}/db/keypair/get.ts (100%) rename src/{ => shared}/db/keypair/insert.ts (72%) rename src/{ => shared}/db/keypair/list.ts (100%) rename src/{ => shared}/db/permissions/deletePermissions.ts (100%) rename src/{ => shared}/db/permissions/getPermissions.ts (92%) rename src/{ => shared}/db/permissions/updatePermissions.ts (100%) rename src/{ => shared}/db/relayer/getRelayerById.ts (100%) rename src/{ => shared}/db/tokens/createToken.ts (100%) rename src/{ => shared}/db/tokens/getAccessTokens.ts (100%) rename src/{ => shared}/db/tokens/getToken.ts (100%) rename src/{ => shared}/db/tokens/revokeToken.ts (100%) rename src/{ => shared}/db/tokens/updateToken.ts (100%) rename src/{ => shared}/db/transactions/db.ts (100%) rename src/{ => shared}/db/transactions/queueTx.ts (95%) rename src/{ => shared}/db/wallets/createWalletDetails.ts (98%) rename src/{ => shared}/db/wallets/deleteWalletDetails.ts (100%) rename src/{ => shared}/db/wallets/getAllWallets.ts (86%) rename src/{ => shared}/db/wallets/getWalletDetails.ts (99%) rename src/{ => shared}/db/wallets/nonceMap.ts (98%) rename src/{ => shared}/db/wallets/updateWalletDetails.ts (100%) rename src/{ => shared}/db/wallets/walletNonce.ts (100%) rename src/{ => shared}/db/webhooks/createWebhook.ts (91%) rename src/{ => shared}/db/webhooks/getAllWebhooks.ts (100%) rename src/{ => shared}/db/webhooks/getWebhook.ts (100%) rename src/{ => shared}/db/webhooks/revokeWebhook.ts (100%) rename src/{ => shared}/lib/cache/swr.ts (100%) rename src/{ => shared}/lib/chain/chain-capabilities.ts (100%) rename src/{ => shared}/lib/transaction/get-transaction-receipt.ts (100%) rename src/{server/schemas/auth/index.ts => shared/schemas/auth.ts} (100%) rename src/{schema => shared/schemas}/config.ts (100%) rename src/{schema => shared/schemas}/extension.ts (100%) rename src/{server/schemas/keypairs.ts => shared/schemas/keypair.ts} (93%) rename src/{schema => shared/schemas}/prisma.ts (100%) rename src/{constants => shared/schemas}/relayer.ts (100%) rename src/{schema => shared/schemas}/wallet.ts (100%) rename src/{schema => shared/schemas}/webhooks.ts (100%) rename src/{ => shared}/utils/account.ts (93%) rename src/{ => shared}/utils/auth.ts (100%) rename src/{ => shared}/utils/block.ts (100%) rename src/{ => shared}/utils/cache/accessToken.ts (100%) rename src/{ => shared}/utils/cache/authWallet.ts (100%) rename src/{ => shared}/utils/cache/clearCache.ts (100%) rename src/{ => shared}/utils/cache/getConfig.ts (86%) rename src/{ => shared}/utils/cache/getContract.ts (82%) rename src/{ => shared}/utils/cache/getContractv5.ts (100%) rename src/{ => shared}/utils/cache/getSdk.ts (97%) rename src/{ => shared}/utils/cache/getSmartWalletV5.ts (100%) rename src/{ => shared}/utils/cache/getWallet.ts (91%) rename src/{ => shared}/utils/cache/getWebhook.ts (91%) rename src/{ => shared}/utils/cache/keypair.ts (100%) rename src/{ => shared}/utils/chain.ts (100%) rename src/{ => shared}/utils/cron/clearCacheCron.ts (100%) rename src/{ => shared}/utils/cron/isValidCron.ts (96%) rename src/{ => shared}/utils/crypto.ts (100%) rename src/{ => shared}/utils/date.ts (100%) rename src/{ => shared}/utils/env.ts (100%) rename src/{ => shared}/utils/error.ts (100%) rename src/{ => shared}/utils/ethers.ts (100%) rename src/{ => shared}/utils/indexer/getBlockTime.ts (100%) rename src/{ => shared}/utils/logger.ts (100%) rename src/{ => shared}/utils/math.ts (100%) rename src/{ => shared}/utils/primitiveTypes.ts (100%) rename src/{ => shared}/utils/prometheus.ts (98%) rename src/{ => shared}/utils/redis/lock.ts (100%) rename src/{ => shared}/utils/redis/redis.ts (100%) rename src/{ => shared}/utils/sdk.ts (100%) rename src/{ => shared}/utils/transaction/cancelTransaction.ts (100%) rename src/{ => shared}/utils/transaction/insertTransaction.ts (95%) rename src/{ => shared}/utils/transaction/queueTransation.ts (90%) rename src/{ => shared}/utils/transaction/simulateQueuedTransaction.ts (100%) rename src/{ => shared}/utils/transaction/types.ts (100%) rename src/{ => shared}/utils/transaction/webhook.ts (80%) rename src/{ => shared}/utils/usage.ts (86%) rename src/{ => shared}/utils/webhook.ts (100%) rename src/{utils => }/tracer.ts (79%) delete mode 100644 src/worker/utils/contractId.ts delete mode 100644 src/worker/utils/nonce.ts rename {test => tests}/e2e/.env.test.example (100%) rename {test => tests}/e2e/.gitignore (100%) rename {test => tests}/e2e/README.md (100%) rename {test => tests}/e2e/bun.lockb (100%) rename {test => tests}/e2e/config.ts (100%) rename {test => tests}/e2e/package.json (100%) rename {test => tests}/e2e/scripts/counter.ts (90%) rename {test => tests}/e2e/tests/extensions.test.ts (98%) rename {test => tests}/e2e/tests/load.test.ts (98%) rename {test => tests}/e2e/tests/read.test.ts (99%) rename {test => tests}/e2e/tests/routes/erc1155-transfer.test.ts (100%) rename {test => tests}/e2e/tests/routes/erc20-transfer.test.ts (99%) rename {test => tests}/e2e/tests/routes/erc721-transfer.test.ts (100%) rename {test => tests}/e2e/tests/routes/signMessage.test.ts (100%) rename {test => tests}/e2e/tests/routes/signaturePrepare.test.ts (100%) rename {test => tests}/e2e/tests/routes/write.test.ts (97%) rename {test => tests}/e2e/tests/setup.ts (96%) rename {test => tests}/e2e/tests/sign-transaction.test.ts (100%) rename {test => tests}/e2e/tests/smart-backend-wallet/smart-aws-wallet.test.ts (100%) rename {test => tests}/e2e/tests/smart-backend-wallet/smart-gcp-wallet.test.ts (100%) rename {test => tests}/e2e/tests/smart-backend-wallet/smart-local-wallet-sdk-v4.test.ts (100%) rename {test => tests}/e2e/tests/smart-backend-wallet/smart-local-wallet.test.ts (100%) rename {test => tests}/e2e/tests/smoke.test.ts (100%) rename {test => tests}/e2e/tests/userop.test.ts (98%) rename {test => tests}/e2e/tests/utils/getBlockTime.test.ts (100%) rename {test => tests}/e2e/tsconfig.json (100%) rename {test => tests}/e2e/utils/anvil.ts (100%) rename {test => tests}/e2e/utils/engine.ts (95%) rename {test => tests}/e2e/utils/statistics.ts (100%) rename {test => tests}/e2e/utils/transactions.ts (95%) rename {test => tests}/e2e/utils/wallets.ts (100%) rename {src/tests/config => tests/shared}/aws-kms.ts (100%) rename {src/tests => tests}/shared/chain.ts (100%) rename {src/tests => tests}/shared/client.ts (100%) rename {src/tests/config => tests/shared}/gcp-kms.ts (100%) rename {src/tests => tests}/shared/typed-data.ts (100%) rename {src/tests => tests/unit}/auth.test.ts (96%) rename {src/tests => tests/unit}/aws-arn.test.ts (97%) rename {src/tests/wallets => tests/unit}/aws-kms.test.ts (95%) rename {src/tests => tests/unit}/chain.test.ts (96%) rename {src/tests/wallets => tests/unit}/gcp-kms.test.ts (94%) rename {src/tests => tests/unit}/gcp-resource-path.test.ts (97%) rename {src/tests => tests/unit}/math.test.ts (93%) rename {src/tests => tests/unit}/schema.test.ts (97%) rename {src/tests => tests/unit}/swr.test.ts (98%) rename {src/tests => tests/unit}/validator.test.ts (94%) diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 3bbcfc60d..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "editor.codeActionsOnSave": { - "source.organizeImports": "explicit", - "source.eslint.fixAll": "explicit" - }, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }], - "typescript.tsdk": "node_modules/typescript/lib", - "typescript.enablePromptUseWorkspaceTsdk": true, - "[prisma]": { - "editor.defaultFormatter": "Prisma.prisma" - }, - "[typescript]": { - "editor.defaultFormatter": "biomejs.biome" - } -} diff --git a/Dockerfile b/Dockerfile index 4cf99266f..9728e659f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,6 +64,7 @@ COPY --from=build /app/package.json . COPY --from=build /app/node_modules ./node_modules COPY --from=build /app/src/prisma/* ./src/prisma/ COPY --from=build /app/dist ./dist +COPY --from=build /app/scripts ./dist/scripts # Replace the schema path in the package.json file RUN sed -i 's_"schema": "./src/prisma/schema.prisma"_"schema": "./dist/prisma/schema.prisma"_g' package.json diff --git a/package.json b/package.json index 371ab1621..f8497a342 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "dev:run": "npx nodemon --watch 'src/**/*.ts' --exec 'npx tsx ./src/index.ts' --files src/index.ts", "build": "rm -rf dist && tsc -p ./tsconfig.json --outDir dist", "build:docker": "docker build . -f Dockerfile -t prod", - "generate:sdk": "npx tsx ./src/scripts/generate-sdk && cd ./sdk && yarn build", - "prisma:setup:dev": "npx tsx ./src/scripts/setup-db.ts", + "generate:sdk": "npx tsx ./scripts/generate-sdk && cd ./sdk && yarn build", + "prisma:setup:dev": "npx tsx ./scripts/setup-db.ts", "prisma:setup:prod": "npx tsx ./dist/scripts/setup-db.js", "start": "yarn prisma:setup:prod && yarn start:migrations && yarn start:run", "start:migrations": "npx tsx ./dist/scripts/apply-migrations.js", diff --git a/src/scripts/apply-migrations.ts b/scripts/apply-migrations.ts similarity index 88% rename from src/scripts/apply-migrations.ts rename to scripts/apply-migrations.ts index cda3af90c..12b16ff3b 100644 --- a/src/scripts/apply-migrations.ts +++ b/scripts/apply-migrations.ts @@ -1,6 +1,10 @@ -import { logger } from "../utils/logger"; -import { acquireLock, releaseLock, waitForLock } from "../utils/redis/lock"; -import { redis } from "../utils/redis/redis"; +import { logger } from "../src/shared/utils/logger"; +import { + acquireLock, + releaseLock, + waitForLock, +} from "../src/shared/utils/redis/lock"; +import { redis } from "../src/shared/utils/redis/redis"; const MIGRATION_LOCK_TTL_SECONDS = 60; diff --git a/src/scripts/generate-sdk.ts b/scripts/generate-sdk.ts similarity index 100% rename from src/scripts/generate-sdk.ts rename to scripts/generate-sdk.ts diff --git a/src/scripts/setup-db.ts b/scripts/setup-db.ts similarity index 79% rename from src/scripts/setup-db.ts rename to scripts/setup-db.ts index 80d992fd9..fa6dad550 100644 --- a/src/scripts/setup-db.ts +++ b/scripts/setup-db.ts @@ -1,5 +1,5 @@ -import { execSync } from "child_process"; -import { prisma } from "../db/client"; +import { execSync } from "node:child_process"; +import { prisma } from "../src/shared/db/client"; const main = async () => { const [{ exists: hasWalletsTable }]: [{ exists: boolean }] = @@ -14,8 +14,8 @@ const main = async () => { const schema = process.env.NODE_ENV === "production" - ? `./dist/prisma/schema.prisma` - : `./src/prisma/schema.prisma`; + ? "./dist/prisma/schema.prisma" + : "./src/prisma/schema.prisma"; if (hasWalletsTable) { execSync(`yarn prisma migrate reset --force --schema ${schema}`, { diff --git a/src/index.ts b/src/index.ts index 764540ee4..ba0d72ebb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,9 @@ import "./polyfill"; +import "./tracer"; + import { initServer } from "./server"; -import { env } from "./utils/env"; -import { logger } from "./utils/logger"; -import "./utils/tracer"; +import { env } from "./shared/utils/env"; +import { logger } from "./shared/utils/logger"; import { initWorker } from "./worker"; import { CancelRecycledNoncesQueue } from "./worker/queues/cancelRecycledNoncesQueue"; import { MigratePostgresTransactionsQueue } from "./worker/queues/migratePostgresTransactionsQueue"; diff --git a/src/polyfill.ts b/src/polyfill.ts index 103de544e..029207c32 100644 --- a/src/polyfill.ts +++ b/src/polyfill.ts @@ -1,4 +1,4 @@ -import * as crypto from "crypto"; +import * as crypto from "node:crypto"; if (typeof globalThis.crypto === "undefined") { (globalThis as any).crypto = crypto; diff --git a/src/server/index.ts b/src/server/index.ts index 4b6deb374..a0a576dfc 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -3,11 +3,11 @@ import fastify, { type FastifyInstance } from "fastify"; import * as fs from "node:fs"; import path from "node:path"; import { URL } from "node:url"; -import { clearCacheCron } from "../utils/cron/clearCacheCron"; -import { env } from "../utils/env"; -import { logger } from "../utils/logger"; -import { metricsServer } from "../utils/prometheus"; -import { withServerUsageReporting } from "../utils/usage"; +import { clearCacheCron } from "../shared/utils/cron/clearCacheCron"; +import { env } from "../shared/utils/env"; +import { logger } from "../shared/utils/logger"; +import { metricsServer } from "../shared/utils/prometheus"; +import { withServerUsageReporting } from "../shared/utils/usage"; import { updateTxListener } from "./listeners/updateTxListener"; import { withAdminRoutes } from "./middleware/adminRoutes"; import { withAuth } from "./middleware/auth"; diff --git a/src/server/listeners/updateTxListener.ts b/src/server/listeners/updateTxListener.ts index d8ff01ebf..150a41650 100644 --- a/src/server/listeners/updateTxListener.ts +++ b/src/server/listeners/updateTxListener.ts @@ -1,6 +1,6 @@ -import { knex } from "../../db/client"; -import { TransactionDB } from "../../db/transactions/db"; -import { logger } from "../../utils/logger"; +import { knex } from "../../shared/db/client"; +import { TransactionDB } from "../../shared/db/transactions/db"; +import { logger } from "../../shared/utils/logger"; import { toTransactionSchema } from "../schemas/transaction"; import { subscriptionsData } from "../schemas/websocket"; import { diff --git a/src/server/middleware/adminRoutes.ts b/src/server/middleware/adminRoutes.ts index 1dac982df..297330a13 100644 --- a/src/server/middleware/adminRoutes.ts +++ b/src/server/middleware/adminRoutes.ts @@ -5,7 +5,7 @@ import type { Queue } from "bullmq"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { timingSafeEqual } from "node:crypto"; -import { env } from "../../utils/env"; +import { env } from "../../shared/utils/env"; import { CancelRecycledNoncesQueue } from "../../worker/queues/cancelRecycledNoncesQueue"; import { MigratePostgresTransactionsQueue } from "../../worker/queues/migratePostgresTransactionsQueue"; import { MineTransactionQueue } from "../../worker/queues/mineTransactionQueue"; diff --git a/src/server/middleware/auth.ts b/src/server/middleware/auth.ts index 19883aa98..022519a41 100644 --- a/src/server/middleware/auth.ts +++ b/src/server/middleware/auth.ts @@ -5,25 +5,25 @@ import { type ThirdwebAuthUser, } from "@thirdweb-dev/auth/fastify"; import { AsyncWallet } from "@thirdweb-dev/wallets/evm/wallets/async"; -import { createHash } from "crypto"; +import { createHash } from "node:crypto"; import type { FastifyInstance } from "fastify"; import type { FastifyRequest } from "fastify/types/request"; import jsonwebtoken, { type JwtPayload } from "jsonwebtoken"; import { validate as uuidValidate } from "uuid"; -import { getPermissions } from "../../db/permissions/getPermissions"; -import { createToken } from "../../db/tokens/createToken"; -import { revokeToken } from "../../db/tokens/revokeToken"; -import { WebhooksEventTypes } from "../../schema/webhooks"; -import { THIRDWEB_DASHBOARD_ISSUER, handleSiwe } from "../../utils/auth"; -import { getAccessToken } from "../../utils/cache/accessToken"; -import { getAuthWallet } from "../../utils/cache/authWallet"; -import { getConfig } from "../../utils/cache/getConfig"; -import { getWebhooksByEventType } from "../../utils/cache/getWebhook"; -import { getKeypair } from "../../utils/cache/keypair"; -import { env } from "../../utils/env"; -import { logger } from "../../utils/logger"; -import { sendWebhookRequest } from "../../utils/webhook"; -import { Permission } from "../schemas/auth"; +import { getPermissions } from "../../shared/db/permissions/getPermissions"; +import { createToken } from "../../shared/db/tokens/createToken"; +import { revokeToken } from "../../shared/db/tokens/revokeToken"; +import { WebhooksEventTypes } from "../../shared/schemas/webhooks"; +import { THIRDWEB_DASHBOARD_ISSUER, handleSiwe } from "../../shared/utils/auth"; +import { getAccessToken } from "../../shared/utils/cache/accessToken"; +import { getAuthWallet } from "../../shared/utils/cache/authWallet"; +import { getConfig } from "../../shared/utils/cache/getConfig"; +import { getWebhooksByEventType } from "../../shared/utils/cache/getWebhook"; +import { getKeypair } from "../../shared/utils/cache/keypair"; +import { env } from "../../shared/utils/env"; +import { logger } from "../../shared/utils/logger"; +import { sendWebhookRequest } from "../../shared/utils/webhook"; +import { Permission } from "../../shared/schemas/auth"; import { ADMIN_QUEUES_BASEPATH } from "./adminRoutes"; import { OPENAPI_ROUTES } from "./openApi"; diff --git a/src/server/middleware/cors.ts b/src/server/middleware/cors.ts index ce9997a52..da81b02fa 100644 --- a/src/server/middleware/cors.ts +++ b/src/server/middleware/cors.ts @@ -1,5 +1,5 @@ import type { FastifyInstance } from "fastify"; -import { getConfig } from "../../utils/cache/getConfig"; +import { getConfig } from "../../shared/utils/cache/getConfig"; import { ADMIN_QUEUES_BASEPATH } from "./adminRoutes"; const STANDARD_METHODS = "GET,POST,DELETE,PUT,PATCH,HEAD,PUT,PATCH,POST,DELETE"; diff --git a/src/server/middleware/engineMode.ts b/src/server/middleware/engineMode.ts index c111c5fdd..9abd2c220 100644 --- a/src/server/middleware/engineMode.ts +++ b/src/server/middleware/engineMode.ts @@ -1,5 +1,5 @@ import type { FastifyInstance } from "fastify"; -import { env } from "../../utils/env"; +import { env } from "../../shared/utils/env"; export function withEnforceEngineMode(server: FastifyInstance) { if (env.ENGINE_MODE === "sandbox") { diff --git a/src/server/middleware/error.ts b/src/server/middleware/error.ts index 5b321cbfd..f993750f9 100644 --- a/src/server/middleware/error.ts +++ b/src/server/middleware/error.ts @@ -1,8 +1,8 @@ import type { FastifyInstance } from "fastify"; import { ReasonPhrases, StatusCodes } from "http-status-codes"; import { ZodError } from "zod"; -import { env } from "../../utils/env"; -import { parseEthersError } from "../../utils/ethers"; +import { env } from "../../shared/utils/env"; +import { parseEthersError } from "../../shared/utils/ethers"; export type CustomError = { message: string; diff --git a/src/server/middleware/logs.ts b/src/server/middleware/logs.ts index e5ed3a6b5..3ba0cfaf7 100644 --- a/src/server/middleware/logs.ts +++ b/src/server/middleware/logs.ts @@ -1,6 +1,6 @@ import type { FastifyInstance } from "fastify"; import { stringify } from "thirdweb/utils"; -import { logger } from "../../utils/logger"; +import { logger } from "../../shared/utils/logger"; import { ADMIN_QUEUES_BASEPATH } from "./adminRoutes"; import { OPENAPI_ROUTES } from "./openApi"; diff --git a/src/server/middleware/prometheus.ts b/src/server/middleware/prometheus.ts index 64bae9d49..29a54b252 100644 --- a/src/server/middleware/prometheus.ts +++ b/src/server/middleware/prometheus.ts @@ -1,6 +1,6 @@ import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify"; -import { env } from "../../utils/env"; -import { recordMetrics } from "../../utils/prometheus"; +import { env } from "../../shared/utils/env"; +import { recordMetrics } from "../../shared/utils/prometheus"; export function withPrometheus(server: FastifyInstance) { if (!env.METRICS_ENABLED) { diff --git a/src/server/middleware/rateLimit.ts b/src/server/middleware/rateLimit.ts index 97c3f72cd..96911855a 100644 --- a/src/server/middleware/rateLimit.ts +++ b/src/server/middleware/rateLimit.ts @@ -1,7 +1,7 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { env } from "../../utils/env"; -import { redis } from "../../utils/redis/redis"; +import { env } from "../../shared/utils/env"; +import { redis } from "../../shared/utils/redis/redis"; import { createCustomError } from "./error"; import { OPENAPI_ROUTES } from "./openApi"; diff --git a/src/server/middleware/websocket.ts b/src/server/middleware/websocket.ts index 6c7ebceef..b84363dd3 100644 --- a/src/server/middleware/websocket.ts +++ b/src/server/middleware/websocket.ts @@ -1,6 +1,6 @@ import WebSocketPlugin from "@fastify/websocket"; import type { FastifyInstance } from "fastify"; -import { logger } from "../../utils/logger"; +import { logger } from "../../shared/utils/logger"; export async function withWebSocket(server: FastifyInstance) { await server.register(WebSocketPlugin, { diff --git a/src/server/routes/admin/nonces.ts b/src/server/routes/admin/nonces.ts index 2a2f528d3..75e109405 100644 --- a/src/server/routes/admin/nonces.ts +++ b/src/server/routes/admin/nonces.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { - Address, + type Address, eth_getTransactionCount, getAddress, getRpcClient, @@ -12,10 +12,10 @@ import { lastUsedNonceKey, recycledNoncesKey, sentNoncesKey, -} from "../../../db/wallets/walletNonce"; -import { getChain } from "../../../utils/chain"; -import { redis } from "../../../utils/redis/redis"; -import { thirdwebClient } from "../../../utils/sdk"; +} from "../../../shared/db/wallets/walletNonce"; +import { getChain } from "../../../shared/utils/chain"; +import { redis } from "../../../shared/utils/redis/redis"; +import { thirdwebClient } from "../../../shared/utils/sdk"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { walletWithAddressParamSchema } from "../../schemas/wallet"; diff --git a/src/server/routes/admin/transaction.ts b/src/server/routes/admin/transaction.ts index 5827e5d24..d8eace0b7 100644 --- a/src/server/routes/admin/transaction.ts +++ b/src/server/routes/admin/transaction.ts @@ -1,12 +1,12 @@ -import { Static, Type } from "@sinclair/typebox"; -import { Queue } from "bullmq"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { Queue } from "bullmq"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { stringify } from "thirdweb/utils"; -import { TransactionDB } from "../../../db/transactions/db"; -import { getConfig } from "../../../utils/cache/getConfig"; -import { maybeDate } from "../../../utils/primitiveTypes"; -import { redis } from "../../../utils/redis/redis"; +import { TransactionDB } from "../../../shared/db/transactions/db"; +import { getConfig } from "../../../shared/utils/cache/getConfig"; +import { maybeDate } from "../../../shared/utils/primitiveTypes"; +import { redis } from "../../../shared/utils/redis/redis"; import { MineTransactionQueue } from "../../../worker/queues/mineTransactionQueue"; import { SendTransactionQueue } from "../../../worker/queues/sendTransactionQueue"; import { createCustomError } from "../../middleware/error"; diff --git a/src/server/routes/auth/access-tokens/create.ts b/src/server/routes/auth/access-tokens/create.ts index 9c33113cd..b69b6cf20 100644 --- a/src/server/routes/auth/access-tokens/create.ts +++ b/src/server/routes/auth/access-tokens/create.ts @@ -3,11 +3,11 @@ import { buildJWT } from "@thirdweb-dev/auth"; import { LocalWallet } from "@thirdweb-dev/wallets"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { createToken } from "../../../../db/tokens/createToken"; -import { accessTokenCache } from "../../../../utils/cache/accessToken"; -import { getConfig } from "../../../../utils/cache/getConfig"; -import { env } from "../../../../utils/env"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { createToken } from "../../../../shared/db/tokens/createToken"; +import { accessTokenCache } from "../../../../shared/utils/cache/accessToken"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; +import { env } from "../../../../shared/utils/env"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { AccessTokenSchema } from "./getAll"; diff --git a/src/server/routes/auth/access-tokens/getAll.ts b/src/server/routes/auth/access-tokens/getAll.ts index 181f35ec8..9cbe3646b 100644 --- a/src/server/routes/auth/access-tokens/getAll.ts +++ b/src/server/routes/auth/access-tokens/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getAccessTokens } from "../../../../db/tokens/getAccessTokens"; +import { getAccessTokens } from "../../../../shared/db/tokens/getAccessTokens"; import { AddressSchema } from "../../../schemas/address"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/auth/access-tokens/revoke.ts b/src/server/routes/auth/access-tokens/revoke.ts index 2d509bb65..39aad0a00 100644 --- a/src/server/routes/auth/access-tokens/revoke.ts +++ b/src/server/routes/auth/access-tokens/revoke.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { revokeToken } from "../../../../db/tokens/revokeToken"; -import { accessTokenCache } from "../../../../utils/cache/accessToken"; +import { revokeToken } from "../../../../shared/db/tokens/revokeToken"; +import { accessTokenCache } from "../../../../shared/utils/cache/accessToken"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const requestBodySchema = Type.Object({ diff --git a/src/server/routes/auth/access-tokens/update.ts b/src/server/routes/auth/access-tokens/update.ts index a5d730fdb..f09b5ce5f 100644 --- a/src/server/routes/auth/access-tokens/update.ts +++ b/src/server/routes/auth/access-tokens/update.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateToken } from "../../../../db/tokens/updateToken"; -import { accessTokenCache } from "../../../../utils/cache/accessToken"; +import { updateToken } from "../../../../shared/db/tokens/updateToken"; +import { accessTokenCache } from "../../../../shared/utils/cache/accessToken"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const requestBodySchema = Type.Object({ diff --git a/src/server/routes/auth/keypair/add.ts b/src/server/routes/auth/keypair/add.ts index 3ecc24364..2aab345ba 100644 --- a/src/server/routes/auth/keypair/add.ts +++ b/src/server/routes/auth/keypair/add.ts @@ -1,15 +1,15 @@ -import { Keypairs, Prisma } from "@prisma/client"; -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Keypairs, Prisma } from "@prisma/client"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { insertKeypair } from "../../../../db/keypair/insert"; -import { isWellFormedPublicKey } from "../../../../utils/crypto"; +import { insertKeypair } from "../../../../shared/db/keypair/insert"; +import { isWellFormedPublicKey } from "../../../../shared/utils/crypto"; import { createCustomError } from "../../../middleware/error"; import { KeypairAlgorithmSchema, KeypairSchema, toKeypairSchema, -} from "../../../schemas/keypairs"; +} from "../../../../shared/schemas/keypair"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const requestBodySchema = Type.Object({ diff --git a/src/server/routes/auth/keypair/list.ts b/src/server/routes/auth/keypair/list.ts index 8c4395f0e..81fab4e68 100644 --- a/src/server/routes/auth/keypair/list.ts +++ b/src/server/routes/auth/keypair/list.ts @@ -1,8 +1,11 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { listKeypairs } from "../../../../db/keypair/list"; -import { KeypairSchema, toKeypairSchema } from "../../../schemas/keypairs"; +import { listKeypairs } from "../../../../shared/db/keypair/list"; +import { + KeypairSchema, + toKeypairSchema, +} from "../../../../shared/schemas/keypair"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const responseBodySchema = Type.Object({ diff --git a/src/server/routes/auth/keypair/remove.ts b/src/server/routes/auth/keypair/remove.ts index 939979d52..6cc65f2ff 100644 --- a/src/server/routes/auth/keypair/remove.ts +++ b/src/server/routes/auth/keypair/remove.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { deleteKeypair } from "../../../../db/keypair/delete"; -import { keypairCache } from "../../../../utils/cache/keypair"; +import { deleteKeypair } from "../../../../shared/db/keypair/delete"; +import { keypairCache } from "../../../../shared/utils/cache/keypair"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const requestBodySchema = Type.Object({ diff --git a/src/server/routes/auth/permissions/getAll.ts b/src/server/routes/auth/permissions/getAll.ts index 7a4f5d4a4..22e4b1478 100644 --- a/src/server/routes/auth/permissions/getAll.ts +++ b/src/server/routes/auth/permissions/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { prisma } from "../../../../db/client"; +import { prisma } from "../../../../shared/db/client"; import { AddressSchema } from "../../../schemas/address"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/auth/permissions/grant.ts b/src/server/routes/auth/permissions/grant.ts index 6f9ef49ee..fcde00839 100644 --- a/src/server/routes/auth/permissions/grant.ts +++ b/src/server/routes/auth/permissions/grant.ts @@ -1,9 +1,9 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updatePermissions } from "../../../../db/permissions/updatePermissions"; +import { updatePermissions } from "../../../../shared/db/permissions/updatePermissions"; import { AddressSchema } from "../../../schemas/address"; -import { permissionsSchema } from "../../../schemas/auth"; +import { permissionsSchema } from "../../../../shared/schemas/auth"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const requestBodySchema = Type.Object({ diff --git a/src/server/routes/auth/permissions/revoke.ts b/src/server/routes/auth/permissions/revoke.ts index 08f1609bb..6e72d7364 100644 --- a/src/server/routes/auth/permissions/revoke.ts +++ b/src/server/routes/auth/permissions/revoke.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { deletePermissions } from "../../../../db/permissions/deletePermissions"; +import { deletePermissions } from "../../../../shared/db/permissions/deletePermissions"; import { AddressSchema } from "../../../schemas/address"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/backend-wallet/cancel-nonces.ts b/src/server/routes/backend-wallet/cancel-nonces.ts index cb4f6cf73..47803817c 100644 --- a/src/server/routes/backend-wallet/cancel-nonces.ts +++ b/src/server/routes/backend-wallet/cancel-nonces.ts @@ -3,9 +3,9 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { eth_getTransactionCount, getRpcClient } from "thirdweb"; import { checksumAddress } from "thirdweb/utils"; -import { getChain } from "../../../utils/chain"; -import { thirdwebClient } from "../../../utils/sdk"; -import { sendCancellationTransaction } from "../../../utils/transaction/cancelTransaction"; +import { getChain } from "../../../shared/utils/chain"; +import { thirdwebClient } from "../../../shared/utils/sdk"; +import { sendCancellationTransaction } from "../../../shared/utils/transaction/cancelTransaction"; import { requestQuerystringSchema, standardResponseSchema, diff --git a/src/server/routes/backend-wallet/create.ts b/src/server/routes/backend-wallet/create.ts index c25ff560c..64162c5d0 100644 --- a/src/server/routes/backend-wallet/create.ts +++ b/src/server/routes/backend-wallet/create.ts @@ -6,8 +6,8 @@ import { DEFAULT_ACCOUNT_FACTORY_V0_7, ENTRYPOINT_ADDRESS_v0_7, } from "thirdweb/wallets/smart"; -import { WalletType } from "../../../schema/wallet"; -import { getConfig } from "../../../utils/cache/getConfig"; +import { WalletType } from "../../../shared/schemas/wallet"; +import { getConfig } from "../../../shared/utils/cache/getConfig"; import { createCustomError } from "../../middleware/error"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/backend-wallet/getAll.ts b/src/server/routes/backend-wallet/getAll.ts index a9a9b1a48..0a2b0e36f 100644 --- a/src/server/routes/backend-wallet/getAll.ts +++ b/src/server/routes/backend-wallet/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getAllWallets } from "../../../db/wallets/getAllWallets"; +import { getAllWallets } from "../../../shared/db/wallets/getAllWallets"; import { standardResponseSchema, walletDetailsSchema, diff --git a/src/server/routes/backend-wallet/getBalance.ts b/src/server/routes/backend-wallet/getBalance.ts index 45a9987af..01f262991 100644 --- a/src/server/routes/backend-wallet/getBalance.ts +++ b/src/server/routes/backend-wallet/getBalance.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getSdk } from "../../../utils/cache/getSdk"; +import { getSdk } from "../../../shared/utils/cache/getSdk"; import { AddressSchema } from "../../schemas/address"; import { currencyValueSchema, diff --git a/src/server/routes/backend-wallet/getNonce.ts b/src/server/routes/backend-wallet/getNonce.ts index 593cc9ed9..f5ef87ac3 100644 --- a/src/server/routes/backend-wallet/getNonce.ts +++ b/src/server/routes/backend-wallet/getNonce.ts @@ -2,7 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import type { Address } from "thirdweb"; -import { inspectNonce } from "../../../db/wallets/walletNonce"; +import { inspectNonce } from "../../../shared/db/wallets/walletNonce"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { walletWithAddressParamSchema } from "../../schemas/wallet"; import { getChainIdFromChain } from "../../utils/chain"; diff --git a/src/server/routes/backend-wallet/getTransactions.ts b/src/server/routes/backend-wallet/getTransactions.ts index 5e8dcf89e..24a215697 100644 --- a/src/server/routes/backend-wallet/getTransactions.ts +++ b/src/server/routes/backend-wallet/getTransactions.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getAddress } from "thirdweb"; -import { TransactionDB } from "../../../db/transactions/db"; +import { TransactionDB } from "../../../shared/db/transactions/db"; import { PaginationSchema } from "../../schemas/pagination"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { diff --git a/src/server/routes/backend-wallet/getTransactionsByNonce.ts b/src/server/routes/backend-wallet/getTransactionsByNonce.ts index b804df6aa..0be1571d3 100644 --- a/src/server/routes/backend-wallet/getTransactionsByNonce.ts +++ b/src/server/routes/backend-wallet/getTransactionsByNonce.ts @@ -1,10 +1,10 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { TransactionDB } from "../../../db/transactions/db"; -import { getNonceMap } from "../../../db/wallets/nonceMap"; -import { normalizeAddress } from "../../../utils/primitiveTypes"; -import type { AnyTransaction } from "../../../utils/transaction/types"; +import { TransactionDB } from "../../../shared/db/transactions/db"; +import { getNonceMap } from "../../../shared/db/wallets/nonceMap"; +import { normalizeAddress } from "../../../shared/utils/primitiveTypes"; +import type { AnyTransaction } from "../../../shared/utils/transaction/types"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { TransactionSchema, diff --git a/src/server/routes/backend-wallet/import.ts b/src/server/routes/backend-wallet/import.ts index 510059a14..88a93d48b 100644 --- a/src/server/routes/backend-wallet/import.ts +++ b/src/server/routes/backend-wallet/import.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../utils/cache/getConfig"; +import { getConfig } from "../../../shared/utils/cache/getConfig"; import { createCustomError } from "../../middleware/error"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/backend-wallet/remove.ts b/src/server/routes/backend-wallet/remove.ts index 431c118d8..9f57ace6c 100644 --- a/src/server/routes/backend-wallet/remove.ts +++ b/src/server/routes/backend-wallet/remove.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { deleteWalletDetails } from "../../../db/wallets/deleteWalletDetails"; +import type { Address } from "thirdweb"; +import { deleteWalletDetails } from "../../../shared/db/wallets/deleteWalletDetails"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/backend-wallet/reset-nonces.ts b/src/server/routes/backend-wallet/reset-nonces.ts index 0ec4c30e8..3237a161a 100644 --- a/src/server/routes/backend-wallet/reset-nonces.ts +++ b/src/server/routes/backend-wallet/reset-nonces.ts @@ -6,7 +6,7 @@ import { deleteNoncesForBackendWallets, getUsedBackendWallets, syncLatestNonceFromOnchain, -} from "../../../db/wallets/walletNonce"; +} from "../../../shared/db/wallets/walletNonce"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/backend-wallet/sendTransaction.ts b/src/server/routes/backend-wallet/sendTransaction.ts index bb29f9386..d23add987 100644 --- a/src/server/routes/backend-wallet/sendTransaction.ts +++ b/src/server/routes/backend-wallet/sendTransaction.ts @@ -2,7 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import type { Address, Hex } from "thirdweb"; -import { insertTransaction } from "../../../utils/transaction/insertTransaction"; +import { insertTransaction } from "../../../shared/utils/transaction/insertTransaction"; import { AddressSchema } from "../../schemas/address"; import { requestQuerystringSchema, diff --git a/src/server/routes/backend-wallet/sendTransactionBatch.ts b/src/server/routes/backend-wallet/sendTransactionBatch.ts index 3d69c4431..d887e9bed 100644 --- a/src/server/routes/backend-wallet/sendTransactionBatch.ts +++ b/src/server/routes/backend-wallet/sendTransactionBatch.ts @@ -2,7 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import type { Address, Hex } from "thirdweb"; -import { insertTransaction } from "../../../utils/transaction/insertTransaction"; +import { insertTransaction } from "../../../shared/utils/transaction/insertTransaction"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { txOverridesWithValueSchema } from "../../schemas/txOverrides"; diff --git a/src/server/routes/backend-wallet/signMessage.ts b/src/server/routes/backend-wallet/signMessage.ts index ac810a795..45f9cb69d 100644 --- a/src/server/routes/backend-wallet/signMessage.ts +++ b/src/server/routes/backend-wallet/signMessage.ts @@ -6,9 +6,9 @@ import { arbitrumSepolia } from "thirdweb/chains"; import { getWalletDetails, isSmartBackendWallet, -} from "../../../db/wallets/getWalletDetails"; -import { walletDetailsToAccount } from "../../../utils/account"; -import { getChain } from "../../../utils/chain"; +} from "../../../shared/db/wallets/getWalletDetails"; +import { walletDetailsToAccount } from "../../../shared/utils/account"; +import { getChain } from "../../../shared/utils/chain"; import { createCustomError } from "../../middleware/error"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { walletHeaderSchema } from "../../schemas/wallet"; diff --git a/src/server/routes/backend-wallet/signTransaction.ts b/src/server/routes/backend-wallet/signTransaction.ts index c6a73c2c2..7af06715e 100644 --- a/src/server/routes/backend-wallet/signTransaction.ts +++ b/src/server/routes/backend-wallet/signTransaction.ts @@ -2,13 +2,13 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import type { Hex } from "thirdweb"; -import { getAccount } from "../../../utils/account"; +import { getAccount } from "../../../shared/utils/account"; import { getChecksumAddress, maybeBigInt, maybeInt, -} from "../../../utils/primitiveTypes"; -import { toTransactionType } from "../../../utils/sdk"; +} from "../../../shared/utils/primitiveTypes"; +import { toTransactionType } from "../../../shared/utils/sdk"; import { createCustomError } from "../../middleware/error"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { walletHeaderSchema } from "../../schemas/wallet"; diff --git a/src/server/routes/backend-wallet/signTypedData.ts b/src/server/routes/backend-wallet/signTypedData.ts index 6c4705eea..6033e309b 100644 --- a/src/server/routes/backend-wallet/signTypedData.ts +++ b/src/server/routes/backend-wallet/signTypedData.ts @@ -1,8 +1,8 @@ import type { TypedDataSigner } from "@ethersproject/abstract-signer"; -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getWallet } from "../../../utils/cache/getWallet"; +import { getWallet } from "../../../shared/utils/cache/getWallet"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { walletHeaderSchema } from "../../schemas/wallet"; diff --git a/src/server/routes/backend-wallet/simulateTransaction.ts b/src/server/routes/backend-wallet/simulateTransaction.ts index e30e5d662..eec049d0f 100644 --- a/src/server/routes/backend-wallet/simulateTransaction.ts +++ b/src/server/routes/backend-wallet/simulateTransaction.ts @@ -3,8 +3,8 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { randomUUID } from "node:crypto"; import type { Address, Hex } from "thirdweb"; -import { doSimulateTransaction } from "../../../utils/transaction/simulateQueuedTransaction"; -import type { QueuedTransaction } from "../../../utils/transaction/types"; +import { doSimulateTransaction } from "../../../shared/utils/transaction/simulateQueuedTransaction"; +import type { QueuedTransaction } from "../../../shared/utils/transaction/types"; import { createCustomError } from "../../middleware/error"; import { AddressSchema } from "../../schemas/address"; import { diff --git a/src/server/routes/backend-wallet/transfer.ts b/src/server/routes/backend-wallet/transfer.ts index d45b6cd28..98a1f6fb4 100644 --- a/src/server/routes/backend-wallet/transfer.ts +++ b/src/server/routes/backend-wallet/transfer.ts @@ -10,11 +10,11 @@ import { } from "thirdweb"; import { transfer as transferERC20 } from "thirdweb/extensions/erc20"; import { isContractDeployed, resolvePromisedValue } from "thirdweb/utils"; -import { getChain } from "../../../utils/chain"; -import { normalizeAddress } from "../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../utils/sdk"; -import { insertTransaction } from "../../../utils/transaction/insertTransaction"; -import type { InsertedTransaction } from "../../../utils/transaction/types"; +import { getChain } from "../../../shared/utils/chain"; +import { normalizeAddress } from "../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../shared/utils/sdk"; +import { insertTransaction } from "../../../shared/utils/transaction/insertTransaction"; +import type { InsertedTransaction } from "../../../shared/utils/transaction/types"; import { createCustomError } from "../../middleware/error"; import { AddressSchema } from "../../schemas/address"; import { TokenAmountStringSchema } from "../../schemas/number"; diff --git a/src/server/routes/backend-wallet/update.ts b/src/server/routes/backend-wallet/update.ts index 5c916d8d8..8baabfacf 100644 --- a/src/server/routes/backend-wallet/update.ts +++ b/src/server/routes/backend-wallet/update.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateWalletDetails } from "../../../db/wallets/updateWalletDetails"; +import { updateWalletDetails } from "../../../shared/db/wallets/updateWalletDetails"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/backend-wallet/withdraw.ts b/src/server/routes/backend-wallet/withdraw.ts index e7815ac72..0cfe6fe36 100644 --- a/src/server/routes/backend-wallet/withdraw.ts +++ b/src/server/routes/backend-wallet/withdraw.ts @@ -9,12 +9,12 @@ import { } from "thirdweb"; import { getChainMetadata } from "thirdweb/chains"; import { getWalletBalance } from "thirdweb/wallets"; -import { getAccount } from "../../../utils/account"; -import { getChain } from "../../../utils/chain"; -import { logger } from "../../../utils/logger"; -import { getChecksumAddress } from "../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../utils/sdk"; -import type { PopulatedTransaction } from "../../../utils/transaction/types"; +import { getAccount } from "../../../shared/utils/account"; +import { getChain } from "../../../shared/utils/chain"; +import { logger } from "../../../shared/utils/logger"; +import { getChecksumAddress } from "../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../shared/utils/sdk"; +import type { PopulatedTransaction } from "../../../shared/utils/transaction/types"; import { createCustomError } from "../../middleware/error"; import { AddressSchema, TransactionHashSchema } from "../../schemas/address"; import { TokenAmountStringSchema } from "../../schemas/number"; diff --git a/src/server/routes/chain/get.ts b/src/server/routes/chain/get.ts index b01c90bed..c271613a3 100644 --- a/src/server/routes/chain/get.ts +++ b/src/server/routes/chain/get.ts @@ -2,7 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getChainMetadata } from "thirdweb/chains"; -import { getChain } from "../../../utils/chain"; +import { getChain } from "../../../shared/utils/chain"; import { chainRequestQuerystringSchema, chainResponseSchema, diff --git a/src/server/routes/chain/getAll.ts b/src/server/routes/chain/getAll.ts index e1b85cf0d..c5644f337 100644 --- a/src/server/routes/chain/getAll.ts +++ b/src/server/routes/chain/getAll.ts @@ -2,7 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import { fetchChains } from "@thirdweb-dev/chains"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../utils/cache/getConfig"; +import { getConfig } from "../../../shared/utils/cache/getConfig"; import { chainResponseSchema } from "../../schemas/chain"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/configuration/auth/get.ts b/src/server/routes/configuration/auth/get.ts index 9f8bc0f32..23163fa35 100644 --- a/src/server/routes/configuration/auth/get.ts +++ b/src/server/routes/configuration/auth/get.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; export const responseBodySchema = Type.Object({ diff --git a/src/server/routes/configuration/auth/update.ts b/src/server/routes/configuration/auth/update.ts index 411dd683f..07ab148b3 100644 --- a/src/server/routes/configuration/auth/update.ts +++ b/src/server/routes/configuration/auth/update.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { responseBodySchema } from "./get"; diff --git a/src/server/routes/configuration/backend-wallet-balance/get.ts b/src/server/routes/configuration/backend-wallet-balance/get.ts index 1fce8a8ee..ab430ecc4 100644 --- a/src/server/routes/configuration/backend-wallet-balance/get.ts +++ b/src/server/routes/configuration/backend-wallet-balance/get.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; export const responseBodySchema = Type.Object({ diff --git a/src/server/routes/configuration/backend-wallet-balance/update.ts b/src/server/routes/configuration/backend-wallet-balance/update.ts index edb386e9d..e47a75af6 100644 --- a/src/server/routes/configuration/backend-wallet-balance/update.ts +++ b/src/server/routes/configuration/backend-wallet-balance/update.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { WeiAmountStringSchema } from "../../../schemas/number"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { responseBodySchema } from "./get"; diff --git a/src/server/routes/configuration/cache/get.ts b/src/server/routes/configuration/cache/get.ts index 2d4542585..5ff178bd0 100644 --- a/src/server/routes/configuration/cache/get.ts +++ b/src/server/routes/configuration/cache/get.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; export const responseBodySchema = Type.Object({ diff --git a/src/server/routes/configuration/cache/update.ts b/src/server/routes/configuration/cache/update.ts index 96d34db0b..a87ef1546 100644 --- a/src/server/routes/configuration/cache/update.ts +++ b/src/server/routes/configuration/cache/update.ts @@ -1,10 +1,10 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; -import { clearCacheCron } from "../../../../utils/cron/clearCacheCron"; -import { isValidCron } from "../../../../utils/cron/isValidCron"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; +import { clearCacheCron } from "../../../../shared/utils/cron/clearCacheCron"; +import { isValidCron } from "../../../../shared/utils/cron/isValidCron"; import { createCustomError } from "../../../middleware/error"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { responseBodySchema } from "./get"; diff --git a/src/server/routes/configuration/chains/get.ts b/src/server/routes/configuration/chains/get.ts index 588927206..6b38f9139 100644 --- a/src/server/routes/configuration/chains/get.ts +++ b/src/server/routes/configuration/chains/get.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { chainResponseSchema } from "../../../schemas/chain"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/configuration/chains/update.ts b/src/server/routes/configuration/chains/update.ts index 5ae3ed225..589eb0797 100644 --- a/src/server/routes/configuration/chains/update.ts +++ b/src/server/routes/configuration/chains/update.ts @@ -1,9 +1,9 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; -import { sdkCache } from "../../../../utils/cache/getSdk"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; +import { sdkCache } from "../../../../shared/utils/cache/getSdk"; import { chainResponseSchema } from "../../../schemas/chain"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { responseBodySchema } from "./get"; diff --git a/src/server/routes/configuration/contract-subscriptions/get.ts b/src/server/routes/configuration/contract-subscriptions/get.ts index 36d42d582..ae6dc97dc 100644 --- a/src/server/routes/configuration/contract-subscriptions/get.ts +++ b/src/server/routes/configuration/contract-subscriptions/get.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { contractSubscriptionConfigurationSchema, standardResponseSchema, diff --git a/src/server/routes/configuration/contract-subscriptions/update.ts b/src/server/routes/configuration/contract-subscriptions/update.ts index 501ce8b4b..fdc0897d0 100644 --- a/src/server/routes/configuration/contract-subscriptions/update.ts +++ b/src/server/routes/configuration/contract-subscriptions/update.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { createCustomError } from "../../../middleware/error"; import { contractSubscriptionConfigurationSchema, diff --git a/src/server/routes/configuration/cors/add.ts b/src/server/routes/configuration/cors/add.ts index aace6cb26..24d085d07 100644 --- a/src/server/routes/configuration/cors/add.ts +++ b/src/server/routes/configuration/cors/add.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { mandatoryAllowedCorsUrls } from "../../../utils/cors-urls"; import { responseBodySchema } from "./get"; diff --git a/src/server/routes/configuration/cors/get.ts b/src/server/routes/configuration/cors/get.ts index 37a1aa9bb..f5cbab52b 100644 --- a/src/server/routes/configuration/cors/get.ts +++ b/src/server/routes/configuration/cors/get.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { mandatoryAllowedCorsUrls } from "../../../utils/cors-urls"; diff --git a/src/server/routes/configuration/cors/remove.ts b/src/server/routes/configuration/cors/remove.ts index d32a819ef..a1d4c7c98 100644 --- a/src/server/routes/configuration/cors/remove.ts +++ b/src/server/routes/configuration/cors/remove.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { createCustomError } from "../../../middleware/error"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { mandatoryAllowedCorsUrls } from "../../../utils/cors-urls"; diff --git a/src/server/routes/configuration/cors/set.ts b/src/server/routes/configuration/cors/set.ts index 54ddf3e84..a1a7540bc 100644 --- a/src/server/routes/configuration/cors/set.ts +++ b/src/server/routes/configuration/cors/set.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { mandatoryAllowedCorsUrls } from "../../../utils/cors-urls"; import { responseBodySchema } from "./get"; diff --git a/src/server/routes/configuration/ip/get.ts b/src/server/routes/configuration/ip/get.ts index 99250011e..1f916c14f 100644 --- a/src/server/routes/configuration/ip/get.ts +++ b/src/server/routes/configuration/ip/get.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; export const responseBodySchema = Type.Object({ diff --git a/src/server/routes/configuration/ip/set.ts b/src/server/routes/configuration/ip/set.ts index e92a319ce..8dab64868 100644 --- a/src/server/routes/configuration/ip/set.ts +++ b/src/server/routes/configuration/ip/set.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { responseBodySchema } from "./get"; diff --git a/src/server/routes/configuration/transactions/get.ts b/src/server/routes/configuration/transactions/get.ts index 33cdfeac3..c1d95ff5e 100644 --- a/src/server/routes/configuration/transactions/get.ts +++ b/src/server/routes/configuration/transactions/get.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const responseBodySchema = Type.Object({ diff --git a/src/server/routes/configuration/transactions/update.ts b/src/server/routes/configuration/transactions/update.ts index c94db43ce..c5322dca4 100644 --- a/src/server/routes/configuration/transactions/update.ts +++ b/src/server/routes/configuration/transactions/update.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const requestBodySchema = Type.Partial( diff --git a/src/server/routes/configuration/wallets/get.ts b/src/server/routes/configuration/wallets/get.ts index d170cbea5..eded75a5e 100644 --- a/src/server/routes/configuration/wallets/get.ts +++ b/src/server/routes/configuration/wallets/get.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { WalletType } from "../../../../schema/wallet"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { WalletType } from "../../../../shared/schemas/wallet"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; export const responseBodySchema = Type.Object({ diff --git a/src/server/routes/configuration/wallets/update.ts b/src/server/routes/configuration/wallets/update.ts index d21182227..9b79e6146 100644 --- a/src/server/routes/configuration/wallets/update.ts +++ b/src/server/routes/configuration/wallets/update.ts @@ -1,9 +1,9 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { updateConfiguration } from "../../../../db/configuration/updateConfiguration"; -import { WalletType } from "../../../../schema/wallet"; -import { getConfig } from "../../../../utils/cache/getConfig"; +import { updateConfiguration } from "../../../../shared/db/configuration/updateConfiguration"; +import { WalletType } from "../../../../shared/schemas/wallet"; +import { getConfig } from "../../../../shared/utils/cache/getConfig"; import { createCustomError } from "../../../middleware/error"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { responseBodySchema } from "./get"; diff --git a/src/server/routes/contract/events/getAllEvents.ts b/src/server/routes/contract/events/getAllEvents.ts index a28264b45..5d6150779 100644 --- a/src/server/routes/contract/events/getAllEvents.ts +++ b/src/server/routes/contract/events/getAllEvents.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../utils/cache/getContract"; +import { getContract } from "../../../../shared/utils/cache/getContract"; import { contractEventSchema, eventsQuerystringSchema, diff --git a/src/server/routes/contract/events/getContractEventLogs.ts b/src/server/routes/contract/events/getContractEventLogs.ts index 85e0a0c3c..47a12a269 100644 --- a/src/server/routes/contract/events/getContractEventLogs.ts +++ b/src/server/routes/contract/events/getContractEventLogs.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContractEventLogsByBlockAndTopics } from "../../../../db/contractEventLogs/getContractEventLogs"; -import { isContractSubscribed } from "../../../../db/contractSubscriptions/getContractSubscriptions"; +import { getContractEventLogsByBlockAndTopics } from "../../../../shared/db/contractEventLogs/getContractEventLogs"; +import { isContractSubscribed } from "../../../../shared/db/contractSubscriptions/getContractSubscriptions"; import { createCustomError } from "../../../middleware/error"; import { AddressSchema, TransactionHashSchema } from "../../../schemas/address"; import { diff --git a/src/server/routes/contract/events/getEventLogsByTimestamp.ts b/src/server/routes/contract/events/getEventLogsByTimestamp.ts index 2cde46d21..267ab1eb8 100644 --- a/src/server/routes/contract/events/getEventLogsByTimestamp.ts +++ b/src/server/routes/contract/events/getEventLogsByTimestamp.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getEventLogsByBlockTimestamp } from "../../../../db/contractEventLogs/getContractEventLogs"; +import { getEventLogsByBlockTimestamp } from "../../../../shared/db/contractEventLogs/getContractEventLogs"; import { AddressSchema } from "../../../schemas/address"; import { eventLogSchema } from "../../../schemas/eventLog"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/contract/events/getEvents.ts b/src/server/routes/contract/events/getEvents.ts index f30839eba..69cabe01c 100644 --- a/src/server/routes/contract/events/getEvents.ts +++ b/src/server/routes/contract/events/getEvents.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../utils/cache/getContract"; +import { getContract } from "../../../../shared/utils/cache/getContract"; import { contractEventSchema, eventsQuerystringSchema, diff --git a/src/server/routes/contract/events/paginateEventLogs.ts b/src/server/routes/contract/events/paginateEventLogs.ts index 02a4c5212..1767a4c07 100644 --- a/src/server/routes/contract/events/paginateEventLogs.ts +++ b/src/server/routes/contract/events/paginateEventLogs.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfiguration } from "../../../../db/configuration/getConfiguration"; -import { getEventLogsByCursor } from "../../../../db/contractEventLogs/getContractEventLogs"; +import { getConfiguration } from "../../../../shared/db/configuration/getConfiguration"; +import { getEventLogsByCursor } from "../../../../shared/db/contractEventLogs/getContractEventLogs"; import { AddressSchema } from "../../../schemas/address"; import { eventLogSchema, toEventLogSchema } from "../../../schemas/eventLog"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/contract/extensions/account/read/getAllAdmins.ts b/src/server/routes/contract/extensions/account/read/getAllAdmins.ts index 13d5d38a2..ea6428780 100644 --- a/src/server/routes/contract/extensions/account/read/getAllAdmins.ts +++ b/src/server/routes/contract/extensions/account/read/getAllAdmins.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/account/read/getAllSessions.ts b/src/server/routes/contract/extensions/account/read/getAllSessions.ts index fd3bd971a..68db22c51 100644 --- a/src/server/routes/contract/extensions/account/read/getAllSessions.ts +++ b/src/server/routes/contract/extensions/account/read/getAllSessions.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { sessionSchema } from "../../../../../schemas/account"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/account/write/grantAdmin.ts b/src/server/routes/contract/extensions/account/write/grantAdmin.ts index 6d5b11e82..2a7120ca8 100644 --- a/src/server/routes/contract/extensions/account/write/grantAdmin.ts +++ b/src/server/routes/contract/extensions/account/write/grantAdmin.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/account/write/grantSession.ts b/src/server/routes/contract/extensions/account/write/grantSession.ts index 0e64558d7..ab04cfcfa 100644 --- a/src/server/routes/contract/extensions/account/write/grantSession.ts +++ b/src/server/routes/contract/extensions/account/write/grantSession.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { sessionSchema } from "../../../../../schemas/account"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/account/write/revokeAdmin.ts b/src/server/routes/contract/extensions/account/write/revokeAdmin.ts index 2e21671aa..2b19ee104 100644 --- a/src/server/routes/contract/extensions/account/write/revokeAdmin.ts +++ b/src/server/routes/contract/extensions/account/write/revokeAdmin.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/account/write/revokeSession.ts b/src/server/routes/contract/extensions/account/write/revokeSession.ts index f71e40218..58c74d8c7 100644 --- a/src/server/routes/contract/extensions/account/write/revokeSession.ts +++ b/src/server/routes/contract/extensions/account/write/revokeSession.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/account/write/updateSession.ts b/src/server/routes/contract/extensions/account/write/updateSession.ts index 46da67695..daade19b1 100644 --- a/src/server/routes/contract/extensions/account/write/updateSession.ts +++ b/src/server/routes/contract/extensions/account/write/updateSession.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/accountFactory/read/getAllAccounts.ts b/src/server/routes/contract/extensions/accountFactory/read/getAllAccounts.ts index 5a5208679..7fd003c0d 100644 --- a/src/server/routes/contract/extensions/accountFactory/read/getAllAccounts.ts +++ b/src/server/routes/contract/extensions/accountFactory/read/getAllAccounts.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/accountFactory/read/getAssociatedAccounts.ts b/src/server/routes/contract/extensions/accountFactory/read/getAssociatedAccounts.ts index 66f1ad35a..d3a9020cd 100644 --- a/src/server/routes/contract/extensions/accountFactory/read/getAssociatedAccounts.ts +++ b/src/server/routes/contract/extensions/accountFactory/read/getAssociatedAccounts.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/accountFactory/read/isAccountDeployed.ts b/src/server/routes/contract/extensions/accountFactory/read/isAccountDeployed.ts index 0ccbbde66..bce8ff614 100644 --- a/src/server/routes/contract/extensions/accountFactory/read/isAccountDeployed.ts +++ b/src/server/routes/contract/extensions/accountFactory/read/isAccountDeployed.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/accountFactory/read/predictAccountAddress.ts b/src/server/routes/contract/extensions/accountFactory/read/predictAccountAddress.ts index e4f0089aa..e540a46f0 100644 --- a/src/server/routes/contract/extensions/accountFactory/read/predictAccountAddress.ts +++ b/src/server/routes/contract/extensions/accountFactory/read/predictAccountAddress.ts @@ -2,7 +2,7 @@ import { type Static, Type } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { predictAddress } from "thirdweb/wallets/smart"; -import { getContractV5 } from "../../../../../../utils/cache/getContractv5"; +import { getContractV5 } from "../../../../../../shared/utils/cache/getContractv5"; import { AddressSchema } from "../../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/accountFactory/write/createAccount.ts b/src/server/routes/contract/extensions/accountFactory/write/createAccount.ts index 55f2c34d6..1eb2a60b4 100644 --- a/src/server/routes/contract/extensions/accountFactory/write/createAccount.ts +++ b/src/server/routes/contract/extensions/accountFactory/write/createAccount.ts @@ -4,9 +4,9 @@ import { StatusCodes } from "http-status-codes"; import { createAccount as factoryCreateAccount } from "thirdweb/extensions/erc4337"; import { isHex, stringToHex } from "thirdweb/utils"; import { predictAddress } from "thirdweb/wallets/smart"; -import { getContractV5 } from "../../../../../../utils/cache/getContractv5"; -import { redis } from "../../../../../../utils/redis/redis"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getContractV5 } from "../../../../../../shared/utils/cache/getContractv5"; +import { redis } from "../../../../../../shared/utils/redis/redis"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema } from "../../../../../schemas/address"; import { prebuiltDeployResponseSchema } from "../../../../../schemas/prebuilts"; import { diff --git a/src/server/routes/contract/extensions/erc1155/read/balanceOf.ts b/src/server/routes/contract/extensions/erc1155/read/balanceOf.ts index 635da28ae..2cfa5c07a 100644 --- a/src/server/routes/contract/extensions/erc1155/read/balanceOf.ts +++ b/src/server/routes/contract/extensions/erc1155/read/balanceOf.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc1155ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/read/canClaim.ts b/src/server/routes/contract/extensions/erc1155/read/canClaim.ts index 5b100dd11..c5bcba524 100644 --- a/src/server/routes/contract/extensions/erc1155/read/canClaim.ts +++ b/src/server/routes/contract/extensions/erc1155/read/canClaim.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc1155/read/get.ts b/src/server/routes/contract/extensions/erc1155/read/get.ts index c9edfafca..acb439591 100644 --- a/src/server/routes/contract/extensions/erc1155/read/get.ts +++ b/src/server/routes/contract/extensions/erc1155/read/get.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { nftSchema } from "../../../../../schemas/nft"; import { erc1155ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/read/getActiveClaimConditions.ts b/src/server/routes/contract/extensions/erc1155/read/getActiveClaimConditions.ts index 62f7807b4..739707d3c 100644 --- a/src/server/routes/contract/extensions/erc1155/read/getActiveClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc1155/read/getActiveClaimConditions.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionOutputSchema } from "../../../../../schemas/claimConditions"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/read/getAll.ts b/src/server/routes/contract/extensions/erc1155/read/getAll.ts index 8d1018a5b..42b563c1f 100644 --- a/src/server/routes/contract/extensions/erc1155/read/getAll.ts +++ b/src/server/routes/contract/extensions/erc1155/read/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { nftSchema } from "../../../../../schemas/nft"; import { erc1155ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/read/getAllClaimConditions.ts b/src/server/routes/contract/extensions/erc1155/read/getAllClaimConditions.ts index 5bc021d5d..9003f2db4 100644 --- a/src/server/routes/contract/extensions/erc1155/read/getAllClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc1155/read/getAllClaimConditions.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionOutputSchema } from "../../../../../schemas/claimConditions"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/read/getClaimIneligibilityReasons.ts b/src/server/routes/contract/extensions/erc1155/read/getClaimIneligibilityReasons.ts index d50a6af03..8b061be03 100644 --- a/src/server/routes/contract/extensions/erc1155/read/getClaimIneligibilityReasons.ts +++ b/src/server/routes/contract/extensions/erc1155/read/getClaimIneligibilityReasons.ts @@ -2,7 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import { ClaimEligibility } from "@thirdweb-dev/sdk"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { NumberStringSchema } from "../../../../../schemas/number"; import { diff --git a/src/server/routes/contract/extensions/erc1155/read/getClaimerProofs.ts b/src/server/routes/contract/extensions/erc1155/read/getClaimerProofs.ts index 59a130fb0..05e53b95e 100644 --- a/src/server/routes/contract/extensions/erc1155/read/getClaimerProofs.ts +++ b/src/server/routes/contract/extensions/erc1155/read/getClaimerProofs.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { claimerProofSchema } from "../../../../../schemas/claimConditions"; import { diff --git a/src/server/routes/contract/extensions/erc1155/read/getOwned.ts b/src/server/routes/contract/extensions/erc1155/read/getOwned.ts index e56383bd0..d4a8f08dc 100644 --- a/src/server/routes/contract/extensions/erc1155/read/getOwned.ts +++ b/src/server/routes/contract/extensions/erc1155/read/getOwned.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { nftSchema } from "../../../../../schemas/nft"; import { diff --git a/src/server/routes/contract/extensions/erc1155/read/isApproved.ts b/src/server/routes/contract/extensions/erc1155/read/isApproved.ts index f97a3089a..ac1fac7dd 100644 --- a/src/server/routes/contract/extensions/erc1155/read/isApproved.ts +++ b/src/server/routes/contract/extensions/erc1155/read/isApproved.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc1155ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc1155/read/signatureGenerate.ts b/src/server/routes/contract/extensions/erc1155/read/signatureGenerate.ts index 85e8b8d7b..ab95c40e3 100644 --- a/src/server/routes/contract/extensions/erc1155/read/signatureGenerate.ts +++ b/src/server/routes/contract/extensions/erc1155/read/signatureGenerate.ts @@ -4,11 +4,11 @@ import { StatusCodes } from "http-status-codes"; import { getContract, type Address, type Hex } from "thirdweb"; import type { NFTInput } from "thirdweb/dist/types/utils/nft/parseNft"; import { generateMintSignature } from "thirdweb/extensions/erc1155"; -import { getAccount } from "../../../../../../utils/account"; -import { getContract as getContractV4 } from "../../../../../../utils/cache/getContract"; -import { getChain } from "../../../../../../utils/chain"; -import { maybeBigInt } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; +import { getAccount } from "../../../../../../shared/utils/account"; +import { getContract as getContractV4 } from "../../../../../../shared/utils/cache/getContract"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { maybeBigInt } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; import { createCustomError } from "../../../../../middleware/error"; import { thirdwebSdkVersionSchema } from "../../../../../schemas/httpHeaders/thirdwebSdkVersion"; import { diff --git a/src/server/routes/contract/extensions/erc1155/read/totalCount.ts b/src/server/routes/contract/extensions/erc1155/read/totalCount.ts index ca225d4e9..21b24ad92 100644 --- a/src/server/routes/contract/extensions/erc1155/read/totalCount.ts +++ b/src/server/routes/contract/extensions/erc1155/read/totalCount.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc1155ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc1155/read/totalSupply.ts b/src/server/routes/contract/extensions/erc1155/read/totalSupply.ts index 54de23b04..e1dafd5cf 100644 --- a/src/server/routes/contract/extensions/erc1155/read/totalSupply.ts +++ b/src/server/routes/contract/extensions/erc1155/read/totalSupply.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc1155ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/airdrop.ts b/src/server/routes/contract/extensions/erc1155/write/airdrop.ts index d8e60a5ec..5164f0a83 100644 --- a/src/server/routes/contract/extensions/erc1155/write/airdrop.ts +++ b/src/server/routes/contract/extensions/erc1155/write/airdrop.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc1155ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/burn.ts b/src/server/routes/contract/extensions/erc1155/write/burn.ts index 7c1a126df..d01ea058d 100644 --- a/src/server/routes/contract/extensions/erc1155/write/burn.ts +++ b/src/server/routes/contract/extensions/erc1155/write/burn.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc1155ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/burnBatch.ts b/src/server/routes/contract/extensions/erc1155/write/burnBatch.ts index d4dedc504..a78cb430c 100644 --- a/src/server/routes/contract/extensions/erc1155/write/burnBatch.ts +++ b/src/server/routes/contract/extensions/erc1155/write/burnBatch.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc1155ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/claimTo.ts b/src/server/routes/contract/extensions/erc1155/write/claimTo.ts index 39bd1e4a4..c716b1f61 100644 --- a/src/server/routes/contract/extensions/erc1155/write/claimTo.ts +++ b/src/server/routes/contract/extensions/erc1155/write/claimTo.ts @@ -1,10 +1,10 @@ -import { Static, Type } from "@sinclair/typebox"; +import { type Static, Type } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import type { Address } from "thirdweb"; import { claimTo } from "thirdweb/extensions/erc1155"; -import { getContractV5 } from "../../../../../../utils/cache/getContractv5"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getContractV5 } from "../../../../../../shared/utils/cache/getContractv5"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema } from "../../../../../schemas/address"; import { erc1155ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/lazyMint.ts b/src/server/routes/contract/extensions/erc1155/write/lazyMint.ts index 015284d09..b31c48bf1 100644 --- a/src/server/routes/contract/extensions/erc1155/write/lazyMint.ts +++ b/src/server/routes/contract/extensions/erc1155/write/lazyMint.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { nftOrInputSchema } from "../../../../../schemas/nft"; import { erc1155ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/mintAdditionalSupplyTo.ts b/src/server/routes/contract/extensions/erc1155/write/mintAdditionalSupplyTo.ts index f48e90bea..58fa670ab 100644 --- a/src/server/routes/contract/extensions/erc1155/write/mintAdditionalSupplyTo.ts +++ b/src/server/routes/contract/extensions/erc1155/write/mintAdditionalSupplyTo.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc1155ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/mintBatchTo.ts b/src/server/routes/contract/extensions/erc1155/write/mintBatchTo.ts index 1d31b92aa..e8776756a 100644 --- a/src/server/routes/contract/extensions/erc1155/write/mintBatchTo.ts +++ b/src/server/routes/contract/extensions/erc1155/write/mintBatchTo.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { nftAndSupplySchema } from "../../../../../schemas/nft"; import { diff --git a/src/server/routes/contract/extensions/erc1155/write/mintTo.ts b/src/server/routes/contract/extensions/erc1155/write/mintTo.ts index 0f72457f8..776156ca0 100644 --- a/src/server/routes/contract/extensions/erc1155/write/mintTo.ts +++ b/src/server/routes/contract/extensions/erc1155/write/mintTo.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { nftAndSupplySchema } from "../../../../../schemas/nft"; import { diff --git a/src/server/routes/contract/extensions/erc1155/write/setApprovalForAll.ts b/src/server/routes/contract/extensions/erc1155/write/setApprovalForAll.ts index db5a05f60..510469914 100644 --- a/src/server/routes/contract/extensions/erc1155/write/setApprovalForAll.ts +++ b/src/server/routes/contract/extensions/erc1155/write/setApprovalForAll.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc1155ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/setBatchClaimConditions.ts b/src/server/routes/contract/extensions/erc1155/write/setBatchClaimConditions.ts index 702c5ae4e..36e81475b 100644 --- a/src/server/routes/contract/extensions/erc1155/write/setBatchClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc1155/write/setBatchClaimConditions.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionInputSchema, type setBatchSantiziedClaimConditionsRequestSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/setClaimConditions.ts b/src/server/routes/contract/extensions/erc1155/write/setClaimConditions.ts index cf014efaf..6f3021397 100644 --- a/src/server/routes/contract/extensions/erc1155/write/setClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc1155/write/setClaimConditions.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionInputSchema, type sanitizedClaimConditionInputSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/signatureMint.ts b/src/server/routes/contract/extensions/erc1155/write/signatureMint.ts index adc3ed3e8..b1e12fb4b 100644 --- a/src/server/routes/contract/extensions/erc1155/write/signatureMint.ts +++ b/src/server/routes/contract/extensions/erc1155/write/signatureMint.ts @@ -3,8 +3,8 @@ import type { SignedPayload1155 } from "@thirdweb-dev/sdk"; import { BigNumber } from "ethers"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { signature1155OutputSchema } from "../../../../../schemas/nft"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/transfer.ts b/src/server/routes/contract/extensions/erc1155/write/transfer.ts index 4db2395ec..61d46227a 100644 --- a/src/server/routes/contract/extensions/erc1155/write/transfer.ts +++ b/src/server/routes/contract/extensions/erc1155/write/transfer.ts @@ -3,10 +3,10 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract, type Hex } from "thirdweb"; import { safeTransferFrom } from "thirdweb/extensions/erc1155"; -import { getChain } from "../../../../../../utils/chain"; -import { getChecksumAddress } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { getChecksumAddress } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema, HexSchema } from "../../../../../schemas/address"; import { NumberStringSchema } from "../../../../../schemas/number"; import { diff --git a/src/server/routes/contract/extensions/erc1155/write/transferFrom.ts b/src/server/routes/contract/extensions/erc1155/write/transferFrom.ts index 385857075..66229cc15 100644 --- a/src/server/routes/contract/extensions/erc1155/write/transferFrom.ts +++ b/src/server/routes/contract/extensions/erc1155/write/transferFrom.ts @@ -3,10 +3,10 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract, type Hex } from "thirdweb"; import { safeTransferFrom } from "thirdweb/extensions/erc1155"; -import { getChain } from "../../../../../../utils/chain"; -import { getChecksumAddress } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { getChecksumAddress } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema, HexSchema } from "../../../../../schemas/address"; import { NumberStringSchema } from "../../../../../schemas/number"; import { diff --git a/src/server/routes/contract/extensions/erc1155/write/updateClaimConditions.ts b/src/server/routes/contract/extensions/erc1155/write/updateClaimConditions.ts index 21bb87a40..ce3e63e10 100644 --- a/src/server/routes/contract/extensions/erc1155/write/updateClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc1155/write/updateClaimConditions.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionInputSchema, type sanitizedClaimConditionInputSchema, diff --git a/src/server/routes/contract/extensions/erc1155/write/updateTokenMetadata.ts b/src/server/routes/contract/extensions/erc1155/write/updateTokenMetadata.ts index 3c020ff24..0689517fa 100644 --- a/src/server/routes/contract/extensions/erc1155/write/updateTokenMetadata.ts +++ b/src/server/routes/contract/extensions/erc1155/write/updateTokenMetadata.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { nftMetadataInputSchema } from "../../../../../schemas/nft"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/read/allowanceOf.ts b/src/server/routes/contract/extensions/erc20/read/allowanceOf.ts index 128fd9f86..8386bc054 100644 --- a/src/server/routes/contract/extensions/erc20/read/allowanceOf.ts +++ b/src/server/routes/contract/extensions/erc20/read/allowanceOf.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc20MetadataSchema } from "../../../../../schemas/erc20"; import { erc20ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/read/balanceOf.ts b/src/server/routes/contract/extensions/erc20/read/balanceOf.ts index edade3a9f..167ec4cf4 100644 --- a/src/server/routes/contract/extensions/erc20/read/balanceOf.ts +++ b/src/server/routes/contract/extensions/erc20/read/balanceOf.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc20MetadataSchema } from "../../../../../schemas/erc20"; import { diff --git a/src/server/routes/contract/extensions/erc20/read/canClaim.ts b/src/server/routes/contract/extensions/erc20/read/canClaim.ts index b38495b17..078c8d7f2 100644 --- a/src/server/routes/contract/extensions/erc20/read/canClaim.ts +++ b/src/server/routes/contract/extensions/erc20/read/canClaim.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc20/read/get.ts b/src/server/routes/contract/extensions/erc20/read/get.ts index c89338d37..88f532f0b 100644 --- a/src/server/routes/contract/extensions/erc20/read/get.ts +++ b/src/server/routes/contract/extensions/erc20/read/get.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc20ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc20/read/getActiveClaimConditions.ts b/src/server/routes/contract/extensions/erc20/read/getActiveClaimConditions.ts index 8013f7cff..15a992342 100644 --- a/src/server/routes/contract/extensions/erc20/read/getActiveClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc20/read/getActiveClaimConditions.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionOutputSchema } from "../../../../../schemas/claimConditions"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/read/getAllClaimConditions.ts b/src/server/routes/contract/extensions/erc20/read/getAllClaimConditions.ts index 578466a13..841ebcda3 100644 --- a/src/server/routes/contract/extensions/erc20/read/getAllClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc20/read/getAllClaimConditions.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionOutputSchema } from "../../../../../schemas/claimConditions"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/read/getClaimIneligibilityReasons.ts b/src/server/routes/contract/extensions/erc20/read/getClaimIneligibilityReasons.ts index 832ce01ef..19b7a12de 100644 --- a/src/server/routes/contract/extensions/erc20/read/getClaimIneligibilityReasons.ts +++ b/src/server/routes/contract/extensions/erc20/read/getClaimIneligibilityReasons.ts @@ -2,7 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import { ClaimEligibility } from "@thirdweb-dev/sdk"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc20/read/getClaimerProofs.ts b/src/server/routes/contract/extensions/erc20/read/getClaimerProofs.ts index ad7659b05..0778a85ac 100644 --- a/src/server/routes/contract/extensions/erc20/read/getClaimerProofs.ts +++ b/src/server/routes/contract/extensions/erc20/read/getClaimerProofs.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { claimerProofSchema } from "../../../../../schemas/claimConditions"; import { diff --git a/src/server/routes/contract/extensions/erc20/read/signatureGenerate.ts b/src/server/routes/contract/extensions/erc20/read/signatureGenerate.ts index 341aabf9d..ae6ccff36 100644 --- a/src/server/routes/contract/extensions/erc20/read/signatureGenerate.ts +++ b/src/server/routes/contract/extensions/erc20/read/signatureGenerate.ts @@ -3,11 +3,11 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract, type Address, type Hex } from "thirdweb"; import { generateMintSignature } from "thirdweb/extensions/erc20"; -import { getAccount } from "../../../../../../utils/account"; -import { getContract as getContractV4 } from "../../../../../../utils/cache/getContract"; -import { getChain } from "../../../../../../utils/chain"; -import { maybeBigInt } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; +import { getAccount } from "../../../../../../shared/utils/account"; +import { getContract as getContractV4 } from "../../../../../../shared/utils/cache/getContract"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { maybeBigInt } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; import { createCustomError } from "../../../../../middleware/error"; import { signature20InputSchema, diff --git a/src/server/routes/contract/extensions/erc20/read/totalSupply.ts b/src/server/routes/contract/extensions/erc20/read/totalSupply.ts index fd3399e97..06ee4548b 100644 --- a/src/server/routes/contract/extensions/erc20/read/totalSupply.ts +++ b/src/server/routes/contract/extensions/erc20/read/totalSupply.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc20MetadataSchema } from "../../../../../schemas/erc20"; import { erc20ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/burn.ts b/src/server/routes/contract/extensions/erc20/write/burn.ts index 54ad7e7ce..7c9f093f7 100644 --- a/src/server/routes/contract/extensions/erc20/write/burn.ts +++ b/src/server/routes/contract/extensions/erc20/write/burn.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { erc20ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/burnFrom.ts b/src/server/routes/contract/extensions/erc20/write/burnFrom.ts index 956d9f9b3..ad5498414 100644 --- a/src/server/routes/contract/extensions/erc20/write/burnFrom.ts +++ b/src/server/routes/contract/extensions/erc20/write/burnFrom.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc20ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/claimTo.ts b/src/server/routes/contract/extensions/erc20/write/claimTo.ts index fd5a70ffd..db7678729 100644 --- a/src/server/routes/contract/extensions/erc20/write/claimTo.ts +++ b/src/server/routes/contract/extensions/erc20/write/claimTo.ts @@ -1,10 +1,10 @@ -import { Static, Type } from "@sinclair/typebox"; +import { type Static, Type } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import type { Address } from "thirdweb"; import { claimTo } from "thirdweb/extensions/erc20"; -import { getContractV5 } from "../../../../../../utils/cache/getContractv5"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getContractV5 } from "../../../../../../shared/utils/cache/getContractv5"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { erc20ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/mintBatchTo.ts b/src/server/routes/contract/extensions/erc20/write/mintBatchTo.ts index 2fd89eb9c..dd3e4b601 100644 --- a/src/server/routes/contract/extensions/erc20/write/mintBatchTo.ts +++ b/src/server/routes/contract/extensions/erc20/write/mintBatchTo.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc20ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/mintTo.ts b/src/server/routes/contract/extensions/erc20/write/mintTo.ts index db3a9968e..e78dfb90f 100644 --- a/src/server/routes/contract/extensions/erc20/write/mintTo.ts +++ b/src/server/routes/contract/extensions/erc20/write/mintTo.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc20ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/setAllowance.ts b/src/server/routes/contract/extensions/erc20/write/setAllowance.ts index 80fd18b02..7cad12a44 100644 --- a/src/server/routes/contract/extensions/erc20/write/setAllowance.ts +++ b/src/server/routes/contract/extensions/erc20/write/setAllowance.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc20ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/setClaimConditions.ts b/src/server/routes/contract/extensions/erc20/write/setClaimConditions.ts index 57ce2c8c8..cc6ced02c 100644 --- a/src/server/routes/contract/extensions/erc20/write/setClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc20/write/setClaimConditions.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionInputSchema, type sanitizedClaimConditionInputSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/signatureMint.ts b/src/server/routes/contract/extensions/erc20/write/signatureMint.ts index 38fd423ff..182259b9b 100644 --- a/src/server/routes/contract/extensions/erc20/write/signatureMint.ts +++ b/src/server/routes/contract/extensions/erc20/write/signatureMint.ts @@ -3,8 +3,8 @@ import type { SignedPayload20 } from "@thirdweb-dev/sdk"; import { BigNumber } from "ethers"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { signature20OutputSchema } from "../../../../../schemas/erc20"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc20/write/transfer.ts b/src/server/routes/contract/extensions/erc20/write/transfer.ts index 512903a44..75a3c2d14 100644 --- a/src/server/routes/contract/extensions/erc20/write/transfer.ts +++ b/src/server/routes/contract/extensions/erc20/write/transfer.ts @@ -3,10 +3,10 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract } from "thirdweb"; import { transfer } from "thirdweb/extensions/erc20"; -import { getChain } from "../../../../../../utils/chain"; -import { getChecksumAddress } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { getChecksumAddress } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema } from "../../../../../schemas/address"; import { TokenAmountStringSchema } from "../../../../../schemas/number"; import { diff --git a/src/server/routes/contract/extensions/erc20/write/transferFrom.ts b/src/server/routes/contract/extensions/erc20/write/transferFrom.ts index ce9ed134c..ec1c46403 100644 --- a/src/server/routes/contract/extensions/erc20/write/transferFrom.ts +++ b/src/server/routes/contract/extensions/erc20/write/transferFrom.ts @@ -3,10 +3,10 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract } from "thirdweb"; import { transferFrom } from "thirdweb/extensions/erc20"; -import { getChain } from "../../../../../../utils/chain"; -import { getChecksumAddress } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { getChecksumAddress } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema } from "../../../../../schemas/address"; import { TokenAmountStringSchema } from "../../../../../schemas/number"; import { diff --git a/src/server/routes/contract/extensions/erc20/write/updateClaimConditions.ts b/src/server/routes/contract/extensions/erc20/write/updateClaimConditions.ts index 99cd79b48..96ec7578d 100644 --- a/src/server/routes/contract/extensions/erc20/write/updateClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc20/write/updateClaimConditions.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionInputSchema, type sanitizedClaimConditionInputSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/balanceOf.ts b/src/server/routes/contract/extensions/erc721/read/balanceOf.ts index 72b9e2aef..1bad0235d 100644 --- a/src/server/routes/contract/extensions/erc721/read/balanceOf.ts +++ b/src/server/routes/contract/extensions/erc721/read/balanceOf.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { erc721ContractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/canClaim.ts b/src/server/routes/contract/extensions/erc721/read/canClaim.ts index d80226ccd..6aa53c54d 100644 --- a/src/server/routes/contract/extensions/erc721/read/canClaim.ts +++ b/src/server/routes/contract/extensions/erc721/read/canClaim.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/get.ts b/src/server/routes/contract/extensions/erc721/read/get.ts index 11faf6bdc..e5f332ab2 100644 --- a/src/server/routes/contract/extensions/erc721/read/get.ts +++ b/src/server/routes/contract/extensions/erc721/read/get.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { nftSchema } from "../../../../../schemas/nft"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/getActiveClaimConditions.ts b/src/server/routes/contract/extensions/erc721/read/getActiveClaimConditions.ts index 88164318d..f24521b3d 100644 --- a/src/server/routes/contract/extensions/erc721/read/getActiveClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc721/read/getActiveClaimConditions.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionOutputSchema } from "../../../../../schemas/claimConditions"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/getAll.ts b/src/server/routes/contract/extensions/erc721/read/getAll.ts index 043db6f74..4eb8bacab 100644 --- a/src/server/routes/contract/extensions/erc721/read/getAll.ts +++ b/src/server/routes/contract/extensions/erc721/read/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { nftSchema } from "../../../../../schemas/nft"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/getAllClaimConditions.ts b/src/server/routes/contract/extensions/erc721/read/getAllClaimConditions.ts index 9158456f5..8d4a62f0e 100644 --- a/src/server/routes/contract/extensions/erc721/read/getAllClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc721/read/getAllClaimConditions.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionOutputSchema } from "../../../../../schemas/claimConditions"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/getClaimIneligibilityReasons.ts b/src/server/routes/contract/extensions/erc721/read/getClaimIneligibilityReasons.ts index c4b069987..88d552910 100644 --- a/src/server/routes/contract/extensions/erc721/read/getClaimIneligibilityReasons.ts +++ b/src/server/routes/contract/extensions/erc721/read/getClaimIneligibilityReasons.ts @@ -2,7 +2,7 @@ import { Type, type Static } from "@sinclair/typebox"; import { ClaimEligibility } from "@thirdweb-dev/sdk"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/getClaimerProofs.ts b/src/server/routes/contract/extensions/erc721/read/getClaimerProofs.ts index eee8854cd..d39672dac 100644 --- a/src/server/routes/contract/extensions/erc721/read/getClaimerProofs.ts +++ b/src/server/routes/contract/extensions/erc721/read/getClaimerProofs.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { claimerProofSchema } from "../../../../../schemas/claimConditions"; import { diff --git a/src/server/routes/contract/extensions/erc721/read/getOwned.ts b/src/server/routes/contract/extensions/erc721/read/getOwned.ts index 847d69c36..311ef318c 100644 --- a/src/server/routes/contract/extensions/erc721/read/getOwned.ts +++ b/src/server/routes/contract/extensions/erc721/read/getOwned.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { nftSchema } from "../../../../../schemas/nft"; import { diff --git a/src/server/routes/contract/extensions/erc721/read/isApproved.ts b/src/server/routes/contract/extensions/erc721/read/isApproved.ts index b8ecc6e8a..22d3cbecd 100644 --- a/src/server/routes/contract/extensions/erc721/read/isApproved.ts +++ b/src/server/routes/contract/extensions/erc721/read/isApproved.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/signatureGenerate.ts b/src/server/routes/contract/extensions/erc721/read/signatureGenerate.ts index 0fca0a1f2..281399a7e 100644 --- a/src/server/routes/contract/extensions/erc721/read/signatureGenerate.ts +++ b/src/server/routes/contract/extensions/erc721/read/signatureGenerate.ts @@ -3,11 +3,11 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract, type Address, type Hex } from "thirdweb"; import { generateMintSignature } from "thirdweb/extensions/erc721"; -import { getAccount } from "../../../../../../utils/account"; -import { getContract as getContractV4 } from "../../../../../../utils/cache/getContract"; -import { getChain } from "../../../../../../utils/chain"; -import { maybeBigInt } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; +import { getAccount } from "../../../../../../shared/utils/account"; +import { getContract as getContractV4 } from "../../../../../../shared/utils/cache/getContract"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { maybeBigInt } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; import { thirdwebSdkVersionSchema } from "../../../../../schemas/httpHeaders/thirdwebSdkVersion"; import { signature721InputSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/signaturePrepare.ts b/src/server/routes/contract/extensions/erc721/read/signaturePrepare.ts index 0636354a2..5cb0d632f 100644 --- a/src/server/routes/contract/extensions/erc721/read/signaturePrepare.ts +++ b/src/server/routes/contract/extensions/erc721/read/signaturePrepare.ts @@ -17,9 +17,9 @@ import { import { decimals } from "thirdweb/extensions/erc20"; import { upload } from "thirdweb/storage"; import { checksumAddress } from "thirdweb/utils"; -import { getChain } from "../../../../../../utils/chain"; -import { prettifyError } from "../../../../../../utils/error"; -import { thirdwebClient } from "../../../../../../utils/sdk"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { prettifyError } from "../../../../../../shared/utils/error"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; import { createCustomError } from "../../../../../middleware/error"; import { signature721InputSchemaV5, diff --git a/src/server/routes/contract/extensions/erc721/read/totalClaimedSupply.ts b/src/server/routes/contract/extensions/erc721/read/totalClaimedSupply.ts index 94d6d91bb..342f63448 100644 --- a/src/server/routes/contract/extensions/erc721/read/totalClaimedSupply.ts +++ b/src/server/routes/contract/extensions/erc721/read/totalClaimedSupply.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/totalCount.ts b/src/server/routes/contract/extensions/erc721/read/totalCount.ts index 7599028de..5a6cd5809 100644 --- a/src/server/routes/contract/extensions/erc721/read/totalCount.ts +++ b/src/server/routes/contract/extensions/erc721/read/totalCount.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc721/read/totalUnclaimedSupply.ts b/src/server/routes/contract/extensions/erc721/read/totalUnclaimedSupply.ts index 5eb39d2c7..88c4b12f8 100644 --- a/src/server/routes/contract/extensions/erc721/read/totalUnclaimedSupply.ts +++ b/src/server/routes/contract/extensions/erc721/read/totalUnclaimedSupply.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/erc721/write/burn.ts b/src/server/routes/contract/extensions/erc721/write/burn.ts index f0591eafa..259ba1af1 100644 --- a/src/server/routes/contract/extensions/erc721/write/burn.ts +++ b/src/server/routes/contract/extensions/erc721/write/burn.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/erc721/write/claimTo.ts b/src/server/routes/contract/extensions/erc721/write/claimTo.ts index a18780e08..1366bb9cb 100644 --- a/src/server/routes/contract/extensions/erc721/write/claimTo.ts +++ b/src/server/routes/contract/extensions/erc721/write/claimTo.ts @@ -1,10 +1,10 @@ -import { Static, Type } from "@sinclair/typebox"; +import { type Static, Type } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import type { Address } from "thirdweb"; import { claimTo } from "thirdweb/extensions/erc721"; -import { getContractV5 } from "../../../../../../utils/cache/getContractv5"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getContractV5 } from "../../../../../../shared/utils/cache/getContractv5"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema } from "../../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/write/lazyMint.ts b/src/server/routes/contract/extensions/erc721/write/lazyMint.ts index c553454f8..7f22c2eae 100644 --- a/src/server/routes/contract/extensions/erc721/write/lazyMint.ts +++ b/src/server/routes/contract/extensions/erc721/write/lazyMint.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { nftOrInputSchema } from "../../../../../schemas/nft"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/write/mintBatchTo.ts b/src/server/routes/contract/extensions/erc721/write/mintBatchTo.ts index 79c14a801..38e5aa299 100644 --- a/src/server/routes/contract/extensions/erc721/write/mintBatchTo.ts +++ b/src/server/routes/contract/extensions/erc721/write/mintBatchTo.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { nftOrInputSchema } from "../../../../../schemas/nft"; import { diff --git a/src/server/routes/contract/extensions/erc721/write/mintTo.ts b/src/server/routes/contract/extensions/erc721/write/mintTo.ts index 8099991eb..dc48f446a 100644 --- a/src/server/routes/contract/extensions/erc721/write/mintTo.ts +++ b/src/server/routes/contract/extensions/erc721/write/mintTo.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../schemas/address"; import { nftOrInputSchema } from "../../../../../schemas/nft"; import { diff --git a/src/server/routes/contract/extensions/erc721/write/setApprovalForAll.ts b/src/server/routes/contract/extensions/erc721/write/setApprovalForAll.ts index b521adf4d..3f3c29c8f 100644 --- a/src/server/routes/contract/extensions/erc721/write/setApprovalForAll.ts +++ b/src/server/routes/contract/extensions/erc721/write/setApprovalForAll.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/erc721/write/setApprovalForToken.ts b/src/server/routes/contract/extensions/erc721/write/setApprovalForToken.ts index 8b3f8e7b3..ad7fd5aa8 100644 --- a/src/server/routes/contract/extensions/erc721/write/setApprovalForToken.ts +++ b/src/server/routes/contract/extensions/erc721/write/setApprovalForToken.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { contractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/erc721/write/setClaimConditions.ts b/src/server/routes/contract/extensions/erc721/write/setClaimConditions.ts index 8e67bdaae..42afb844d 100644 --- a/src/server/routes/contract/extensions/erc721/write/setClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc721/write/setClaimConditions.ts @@ -1,11 +1,11 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionInputSchema, - sanitizedClaimConditionInputSchema, + type sanitizedClaimConditionInputSchema, } from "../../../../../schemas/claimConditions"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/write/signatureMint.ts b/src/server/routes/contract/extensions/erc721/write/signatureMint.ts index 2a85bb169..808c14246 100644 --- a/src/server/routes/contract/extensions/erc721/write/signatureMint.ts +++ b/src/server/routes/contract/extensions/erc721/write/signatureMint.ts @@ -1,16 +1,16 @@ -import { Static, Type } from "@sinclair/typebox"; -import { SignedPayload721WithQuantitySignature } from "@thirdweb-dev/sdk"; +import { type Static, Type } from "@sinclair/typebox"; +import type { SignedPayload721WithQuantitySignature } from "@thirdweb-dev/sdk"; import { BigNumber } from "ethers"; -import { FastifyInstance } from "fastify"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address, Hex } from "thirdweb"; +import type { Address, Hex } from "thirdweb"; import { mintWithSignature } from "thirdweb/extensions/erc721"; import { resolvePromisedValue } from "thirdweb/utils"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; -import { getContractV5 } from "../../../../../../utils/cache/getContractv5"; -import { insertTransaction } from "../../../../../../utils/transaction/insertTransaction"; -import { thirdwebSdkVersionSchema } from "../../../../../schemas/httpHeaders/thirdwebSdkVersion"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; +import { getContractV5 } from "../../../../../../shared/utils/cache/getContractv5"; +import { insertTransaction } from "../../../../../../shared/utils/transaction/insertTransaction"; +import type { thirdwebSdkVersionSchema } from "../../../../../schemas/httpHeaders/thirdwebSdkVersion"; import { signature721OutputSchema } from "../../../../../schemas/nft"; import { signature721OutputSchemaV5 } from "../../../../../schemas/nft/v5"; import { diff --git a/src/server/routes/contract/extensions/erc721/write/transfer.ts b/src/server/routes/contract/extensions/erc721/write/transfer.ts index 60f00d5bb..87835ca09 100644 --- a/src/server/routes/contract/extensions/erc721/write/transfer.ts +++ b/src/server/routes/contract/extensions/erc721/write/transfer.ts @@ -3,10 +3,10 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract } from "thirdweb"; import { transferFrom } from "thirdweb/extensions/erc721"; -import { getChain } from "../../../../../../utils/chain"; -import { getChecksumAddress } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { getChecksumAddress } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema } from "../../../../../schemas/address"; import { NumberStringSchema } from "../../../../../schemas/number"; import { diff --git a/src/server/routes/contract/extensions/erc721/write/transferFrom.ts b/src/server/routes/contract/extensions/erc721/write/transferFrom.ts index 404086221..e19e8cb9d 100644 --- a/src/server/routes/contract/extensions/erc721/write/transferFrom.ts +++ b/src/server/routes/contract/extensions/erc721/write/transferFrom.ts @@ -3,10 +3,10 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract } from "thirdweb"; import { transferFrom } from "thirdweb/extensions/erc721"; -import { getChain } from "../../../../../../utils/chain"; -import { getChecksumAddress } from "../../../../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../../../../utils/sdk"; -import { queueTransaction } from "../../../../../../utils/transaction/queueTransation"; +import { getChain } from "../../../../../../shared/utils/chain"; +import { getChecksumAddress } from "../../../../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../../../../shared/utils/sdk"; +import { queueTransaction } from "../../../../../../shared/utils/transaction/queueTransation"; import { AddressSchema } from "../../../../../schemas/address"; import { NumberStringSchema } from "../../../../../schemas/number"; import { diff --git a/src/server/routes/contract/extensions/erc721/write/updateClaimConditions.ts b/src/server/routes/contract/extensions/erc721/write/updateClaimConditions.ts index 8b8faaa49..d9c9fb6f7 100644 --- a/src/server/routes/contract/extensions/erc721/write/updateClaimConditions.ts +++ b/src/server/routes/contract/extensions/erc721/write/updateClaimConditions.ts @@ -1,11 +1,11 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { claimConditionInputSchema, - sanitizedClaimConditionInputSchema, + type sanitizedClaimConditionInputSchema, } from "../../../../../schemas/claimConditions"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/erc721/write/updateTokenMetadata.ts b/src/server/routes/contract/extensions/erc721/write/updateTokenMetadata.ts index 48ba8e64f..c8a610821 100644 --- a/src/server/routes/contract/extensions/erc721/write/updateTokenMetadata.ts +++ b/src/server/routes/contract/extensions/erc721/write/updateTokenMetadata.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../shared/utils/cache/getContract"; import { nftMetadataInputSchema } from "../../../../../schemas/nft"; import { contractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getAll.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getAll.ts index 500b976c6..5debad7eb 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getAll.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { directListingV3OutputSchema } from "../../../../../../schemas/marketplaceV3/directListing"; import { marketplaceFilterSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getAllValid.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getAllValid.ts index 6b3182668..a7e35ab5d 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getAllValid.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getAllValid.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { directListingV3OutputSchema } from "../../../../../../schemas/marketplaceV3/directListing"; import { marketplaceFilterSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getListing.ts index 73397c27f..cd7b396bd 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getListing.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { directListingV3OutputSchema } from "../../../../../../schemas/marketplaceV3/directListing"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getTotalCount.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getTotalCount.ts index 1d6228f9c..c46910f28 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getTotalCount.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/getTotalCount.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/isBuyerApprovedForListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/isBuyerApprovedForListing.ts index 05ff2336a..4b261a5a3 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/isBuyerApprovedForListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/isBuyerApprovedForListing.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../../schemas/address"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/isCurrencyApprovedForListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/isCurrencyApprovedForListing.ts index 02b353a97..3351dd6d7 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/read/isCurrencyApprovedForListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/read/isCurrencyApprovedForListing.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../../schemas/address"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/approveBuyerForReservedListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/approveBuyerForReservedListing.ts index c9b697a25..f723caadc 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/approveBuyerForReservedListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/approveBuyerForReservedListing.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/buyFromListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/buyFromListing.ts index 75ff756b8..37ab99780 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/buyFromListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/buyFromListing.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/cancelListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/cancelListing.ts index 17222f50a..af6a96951 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/cancelListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/cancelListing.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/createListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/createListing.ts index 74c7f63d8..141feddad 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/createListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/createListing.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { directListingV3InputSchema } from "../../../../../../schemas/marketplaceV3/directListing"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/revokeBuyerApprovalForReservedListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/revokeBuyerApprovalForReservedListing.ts index 79cd57d3d..607afb958 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/revokeBuyerApprovalForReservedListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/revokeBuyerApprovalForReservedListing.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../../schemas/address"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/revokeCurrencyApprovalForListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/revokeCurrencyApprovalForListing.ts index 048a81b78..705463bf4 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/revokeCurrencyApprovalForListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/revokeCurrencyApprovalForListing.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../../../schemas/address"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/updateListing.ts b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/updateListing.ts index 63db76bd4..c58104607 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/directListings/write/updateListing.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/directListings/write/updateListing.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { directListingV3InputSchema } from "../../../../../../schemas/marketplaceV3/directListing"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAll.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAll.ts index 674368c5b..f7ebc52d2 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAll.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { englishAuctionOutputSchema } from "../../../../../../schemas/marketplaceV3/englishAuction"; import { marketplaceFilterSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAllValid.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAllValid.ts index d99b58077..25a65fcc1 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAllValid.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAllValid.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { englishAuctionOutputSchema } from "../../../../../../schemas/marketplaceV3/englishAuction"; import { marketplaceFilterSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAuction.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAuction.ts index 0b0ffc488..53353271c 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAuction.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getAuction.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { englishAuctionOutputSchema } from "../../../../../../schemas/marketplaceV3/englishAuction"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getBidBufferBps.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getBidBufferBps.ts index 81193e015..de9247202 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getBidBufferBps.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getBidBufferBps.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getMinimumNextBid.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getMinimumNextBid.ts index f17418ec2..c02d495e9 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getMinimumNextBid.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getMinimumNextBid.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { currencyValueSchema, marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getTotalCount.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getTotalCount.ts index e44013962..4813b190c 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getTotalCount.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getTotalCount.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getWinner.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getWinner.ts index 6781ca0d1..95d4e19ed 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getWinner.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getWinner.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getWinningBid.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getWinningBid.ts index 9c117f18c..6f839ff0c 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getWinningBid.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/getWinningBid.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { bidSchema } from "../../../../../../schemas/marketplaceV3/englishAuction"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/isWinningBid.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/isWinningBid.ts index 08c3b6e20..a70f469a6 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/isWinningBid.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/read/isWinningBid.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/buyoutAuction.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/buyoutAuction.ts index 64a931d47..142d5a6f3 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/buyoutAuction.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/buyoutAuction.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/cancelAuction.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/cancelAuction.ts index df6f44c71..dbcd85bec 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/cancelAuction.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/cancelAuction.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/closeAuctionForBidder.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/closeAuctionForBidder.ts index 1b5236a93..f0131cb06 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/closeAuctionForBidder.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/closeAuctionForBidder.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/closeAuctionForSeller.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/closeAuctionForSeller.ts index 32ad9f01a..0485e4151 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/closeAuctionForSeller.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/closeAuctionForSeller.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/createAuction.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/createAuction.ts index b348b1b1d..f74f0ad23 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/createAuction.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/createAuction.ts @@ -1,8 +1,8 @@ import type { Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { englishAuctionInputSchema } from "../../../../../../schemas/marketplaceV3/englishAuction"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/executeSale.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/executeSale.ts index 19e591eeb..9770164ef 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/executeSale.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/executeSale.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/makeBid.ts b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/makeBid.ts index 7545db42e..8eabd7456 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/makeBid.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/englishAuctions/write/makeBid.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/offers/read/getAll.ts b/src/server/routes/contract/extensions/marketplaceV3/offers/read/getAll.ts index 6497ed6d5..e4b9271c7 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/offers/read/getAll.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/offers/read/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { OfferV3OutputSchema } from "../../../../../../schemas/marketplaceV3/offer"; import { marketplaceFilterSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/offers/read/getAllValid.ts b/src/server/routes/contract/extensions/marketplaceV3/offers/read/getAllValid.ts index e913d2911..01c1b6bcd 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/offers/read/getAllValid.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/offers/read/getAllValid.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { OfferV3OutputSchema } from "../../../../../../schemas/marketplaceV3/offer"; import { marketplaceFilterSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/offers/read/getOffer.ts b/src/server/routes/contract/extensions/marketplaceV3/offers/read/getOffer.ts index 4eb1991cb..d752431fc 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/offers/read/getOffer.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/offers/read/getOffer.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { OfferV3OutputSchema } from "../../../../../../schemas/marketplaceV3/offer"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/offers/read/getTotalCount.ts b/src/server/routes/contract/extensions/marketplaceV3/offers/read/getTotalCount.ts index 86f476220..ada1fb3e6 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/offers/read/getTotalCount.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/offers/read/getTotalCount.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/offers/write/acceptOffer.ts b/src/server/routes/contract/extensions/marketplaceV3/offers/write/acceptOffer.ts index f1614a731..7eed54d24 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/offers/write/acceptOffer.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/offers/write/acceptOffer.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/offers/write/cancelOffer.ts b/src/server/routes/contract/extensions/marketplaceV3/offers/write/cancelOffer.ts index aa205c3ac..0f81e3138 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/offers/write/cancelOffer.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/offers/write/cancelOffer.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { marketplaceV3ContractParamSchema, requestQuerystringSchema, diff --git a/src/server/routes/contract/extensions/marketplaceV3/offers/write/makeOffer.ts b/src/server/routes/contract/extensions/marketplaceV3/offers/write/makeOffer.ts index 3cc4deb43..daa44c8c1 100644 --- a/src/server/routes/contract/extensions/marketplaceV3/offers/write/makeOffer.ts +++ b/src/server/routes/contract/extensions/marketplaceV3/offers/write/makeOffer.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../../../shared/utils/cache/getContract"; import { OfferV3InputSchema } from "../../../../../../schemas/marketplaceV3/offer"; import { marketplaceV3ContractParamSchema, diff --git a/src/server/routes/contract/metadata/abi.ts b/src/server/routes/contract/metadata/abi.ts index 56cbb5b10..f642809bf 100644 --- a/src/server/routes/contract/metadata/abi.ts +++ b/src/server/routes/contract/metadata/abi.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../utils/cache/getContract"; +import { getContract } from "../../../../shared/utils/cache/getContract"; import { abiSchema } from "../../../schemas/contract"; import { contractParamSchema, diff --git a/src/server/routes/contract/metadata/events.ts b/src/server/routes/contract/metadata/events.ts index 0d3e769fa..f16d65e2f 100644 --- a/src/server/routes/contract/metadata/events.ts +++ b/src/server/routes/contract/metadata/events.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../utils/cache/getContract"; +import { getContract } from "../../../../shared/utils/cache/getContract"; import { abiEventSchema } from "../../../schemas/contract"; import { contractParamSchema, diff --git a/src/server/routes/contract/metadata/extensions.ts b/src/server/routes/contract/metadata/extensions.ts index 79255c7f8..d4d553173 100644 --- a/src/server/routes/contract/metadata/extensions.ts +++ b/src/server/routes/contract/metadata/extensions.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; +import { type Static, Type } from "@sinclair/typebox"; import { getAllDetectedExtensionNames } from "@thirdweb-dev/sdk"; -import { FastifyInstance } from "fastify"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../utils/cache/getContract"; +import { getContract } from "../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/metadata/functions.ts b/src/server/routes/contract/metadata/functions.ts index 268254418..3d45736ba 100644 --- a/src/server/routes/contract/metadata/functions.ts +++ b/src/server/routes/contract/metadata/functions.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../utils/cache/getContract"; +import { getContract } from "../../../../shared/utils/cache/getContract"; import { abiFunctionSchema } from "../../../schemas/contract"; import { contractParamSchema, diff --git a/src/server/routes/contract/read/read.ts b/src/server/routes/contract/read/read.ts index 89b0e115d..81721a098 100644 --- a/src/server/routes/contract/read/read.ts +++ b/src/server/routes/contract/read/read.ts @@ -1,8 +1,8 @@ import { Type } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../utils/cache/getContract"; -import { prettifyError } from "../../../../utils/error"; +import { getContract } from "../../../../shared/utils/cache/getContract"; +import { prettifyError } from "../../../../shared/utils/error"; import { createCustomError } from "../../../middleware/error"; import { readRequestQuerySchema, diff --git a/src/server/routes/contract/roles/read/get.ts b/src/server/routes/contract/roles/read/get.ts index a10b1e827..f07c1479f 100644 --- a/src/server/routes/contract/roles/read/get.ts +++ b/src/server/routes/contract/roles/read/get.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../shared/utils/cache/getContract"; import { contractParamSchema, standardResponseSchema, diff --git a/src/server/routes/contract/roles/read/getAll.ts b/src/server/routes/contract/roles/read/getAll.ts index 175b626df..ee4a8d920 100644 --- a/src/server/routes/contract/roles/read/getAll.ts +++ b/src/server/routes/contract/roles/read/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../shared/utils/cache/getContract"; import { rolesResponseSchema } from "../../../../schemas/contract"; import { contractParamSchema, diff --git a/src/server/routes/contract/roles/write/grant.ts b/src/server/routes/contract/roles/write/grant.ts index c82ad2269..538b2d869 100644 --- a/src/server/routes/contract/roles/write/grant.ts +++ b/src/server/routes/contract/roles/write/grant.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/roles/write/revoke.ts b/src/server/routes/contract/roles/write/revoke.ts index 4b1173132..063f9c8e1 100644 --- a/src/server/routes/contract/roles/write/revoke.ts +++ b/src/server/routes/contract/roles/write/revoke.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../shared/utils/cache/getContract"; import { AddressSchema } from "../../../../schemas/address"; import { contractParamSchema, diff --git a/src/server/routes/contract/royalties/read/getDefaultRoyaltyInfo.ts b/src/server/routes/contract/royalties/read/getDefaultRoyaltyInfo.ts index c6282d135..ed85d8712 100644 --- a/src/server/routes/contract/royalties/read/getDefaultRoyaltyInfo.ts +++ b/src/server/routes/contract/royalties/read/getDefaultRoyaltyInfo.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../shared/utils/cache/getContract"; import { royaltySchema } from "../../../../schemas/contract"; import { contractParamSchema, diff --git a/src/server/routes/contract/royalties/read/getTokenRoyaltyInfo.ts b/src/server/routes/contract/royalties/read/getTokenRoyaltyInfo.ts index fec257ad5..163ae5fee 100644 --- a/src/server/routes/contract/royalties/read/getTokenRoyaltyInfo.ts +++ b/src/server/routes/contract/royalties/read/getTokenRoyaltyInfo.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContract } from "../../../../../utils/cache/getContract"; +import { getContract } from "../../../../../shared/utils/cache/getContract"; import { royaltySchema } from "../../../../schemas/contract"; import { contractParamSchema, diff --git a/src/server/routes/contract/royalties/write/setDefaultRoyaltyInfo.ts b/src/server/routes/contract/royalties/write/setDefaultRoyaltyInfo.ts index acfb5c8fd..239c08778 100644 --- a/src/server/routes/contract/royalties/write/setDefaultRoyaltyInfo.ts +++ b/src/server/routes/contract/royalties/write/setDefaultRoyaltyInfo.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../shared/utils/cache/getContract"; import { royaltySchema } from "../../../../schemas/contract"; import { contractParamSchema, diff --git a/src/server/routes/contract/royalties/write/setTokenRoyaltyInfo.ts b/src/server/routes/contract/royalties/write/setTokenRoyaltyInfo.ts index 4d12d72b0..6ff5d09c2 100644 --- a/src/server/routes/contract/royalties/write/setTokenRoyaltyInfo.ts +++ b/src/server/routes/contract/royalties/write/setTokenRoyaltyInfo.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { queueTx } from "../../../../../db/transactions/queueTx"; -import { getContract } from "../../../../../utils/cache/getContract"; +import { queueTx } from "../../../../../shared/db/transactions/queueTx"; +import { getContract } from "../../../../../shared/utils/cache/getContract"; import { royaltySchema } from "../../../../schemas/contract"; import { contractParamSchema, diff --git a/src/server/routes/contract/subscriptions/addContractSubscription.ts b/src/server/routes/contract/subscriptions/addContractSubscription.ts index bddd24fc1..05637d75f 100644 --- a/src/server/routes/contract/subscriptions/addContractSubscription.ts +++ b/src/server/routes/contract/subscriptions/addContractSubscription.ts @@ -1,16 +1,16 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { getContract } from "thirdweb"; import { isContractDeployed } from "thirdweb/utils"; -import { upsertChainIndexer } from "../../../../db/chainIndexers/upsertChainIndexer"; -import { createContractSubscription } from "../../../../db/contractSubscriptions/createContractSubscription"; -import { getContractSubscriptionsUniqueChainIds } from "../../../../db/contractSubscriptions/getContractSubscriptions"; -import { insertWebhook } from "../../../../db/webhooks/createWebhook"; -import { WebhooksEventTypes } from "../../../../schema/webhooks"; -import { getSdk } from "../../../../utils/cache/getSdk"; -import { getChain } from "../../../../utils/chain"; -import { thirdwebClient } from "../../../../utils/sdk"; +import { upsertChainIndexer } from "../../../../shared/db/chainIndexers/upsertChainIndexer"; +import { createContractSubscription } from "../../../../shared/db/contractSubscriptions/createContractSubscription"; +import { getContractSubscriptionsUniqueChainIds } from "../../../../shared/db/contractSubscriptions/getContractSubscriptions"; +import { insertWebhook } from "../../../../shared/db/webhooks/createWebhook"; +import { WebhooksEventTypes } from "../../../../shared/schemas/webhooks"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; +import { getChain } from "../../../../shared/utils/chain"; +import { thirdwebClient } from "../../../../shared/utils/sdk"; import { createCustomError } from "../../../middleware/error"; import { AddressSchema } from "../../../schemas/address"; import { chainIdOrSlugSchema } from "../../../schemas/chain"; diff --git a/src/server/routes/contract/subscriptions/getContractIndexedBlockRange.ts b/src/server/routes/contract/subscriptions/getContractIndexedBlockRange.ts index e708cd8b2..66a5f0cb8 100644 --- a/src/server/routes/contract/subscriptions/getContractIndexedBlockRange.ts +++ b/src/server/routes/contract/subscriptions/getContractIndexedBlockRange.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getContractEventLogsIndexedBlockRange } from "../../../../db/contractEventLogs/getContractEventLogs"; +import { getContractEventLogsIndexedBlockRange } from "../../../../shared/db/contractEventLogs/getContractEventLogs"; import { createCustomError } from "../../../middleware/error"; import { AddressSchema } from "../../../schemas/address"; import { chainIdOrSlugSchema } from "../../../schemas/chain"; diff --git a/src/server/routes/contract/subscriptions/getContractSubscriptions.ts b/src/server/routes/contract/subscriptions/getContractSubscriptions.ts index 81fb1ac2d..d542ee9a2 100644 --- a/src/server/routes/contract/subscriptions/getContractSubscriptions.ts +++ b/src/server/routes/contract/subscriptions/getContractSubscriptions.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getAllContractSubscriptions } from "../../../../db/contractSubscriptions/getContractSubscriptions"; +import { getAllContractSubscriptions } from "../../../../shared/db/contractSubscriptions/getContractSubscriptions"; import { contractSubscriptionSchema, toContractSubscriptionSchema, diff --git a/src/server/routes/contract/subscriptions/getLatestBlock.ts b/src/server/routes/contract/subscriptions/getLatestBlock.ts index 49f81e09c..1cea5a453 100644 --- a/src/server/routes/contract/subscriptions/getLatestBlock.ts +++ b/src/server/routes/contract/subscriptions/getLatestBlock.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getLastIndexedBlock } from "../../../../db/chainIndexers/getChainIndexer"; +import { getLastIndexedBlock } from "../../../../shared/db/chainIndexers/getChainIndexer"; import { chainRequestQuerystringSchema } from "../../../schemas/chain"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { getChainIdFromChain } from "../../../utils/chain"; diff --git a/src/server/routes/contract/subscriptions/removeContractSubscription.ts b/src/server/routes/contract/subscriptions/removeContractSubscription.ts index 3b0711c75..488b2d68c 100644 --- a/src/server/routes/contract/subscriptions/removeContractSubscription.ts +++ b/src/server/routes/contract/subscriptions/removeContractSubscription.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { deleteContractSubscription } from "../../../../db/contractSubscriptions/deleteContractSubscription"; -import { deleteWebhook } from "../../../../db/webhooks/revokeWebhook"; +import { deleteContractSubscription } from "../../../../shared/db/contractSubscriptions/deleteContractSubscription"; +import { deleteWebhook } from "../../../../shared/db/webhooks/revokeWebhook"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; const bodySchema = Type.Object({ diff --git a/src/server/routes/contract/transactions/getTransactionReceipts.ts b/src/server/routes/contract/transactions/getTransactionReceipts.ts index 87b90a530..d0267226d 100644 --- a/src/server/routes/contract/transactions/getTransactionReceipts.ts +++ b/src/server/routes/contract/transactions/getTransactionReceipts.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { isContractSubscribed } from "../../../../db/contractSubscriptions/getContractSubscriptions"; -import { getContractTransactionReceiptsByBlock } from "../../../../db/contractTransactionReceipts/getContractTransactionReceipts"; +import { isContractSubscribed } from "../../../../shared/db/contractSubscriptions/getContractSubscriptions"; +import { getContractTransactionReceiptsByBlock } from "../../../../shared/db/contractTransactionReceipts/getContractTransactionReceipts"; import { createCustomError } from "../../../middleware/error"; import { contractParamSchema, diff --git a/src/server/routes/contract/transactions/getTransactionReceiptsByTimestamp.ts b/src/server/routes/contract/transactions/getTransactionReceiptsByTimestamp.ts index 2c76ec6da..5a9f55393 100644 --- a/src/server/routes/contract/transactions/getTransactionReceiptsByTimestamp.ts +++ b/src/server/routes/contract/transactions/getTransactionReceiptsByTimestamp.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getTransactionReceiptsByBlockTimestamp } from "../../../../db/contractTransactionReceipts/getContractTransactionReceipts"; +import { getTransactionReceiptsByBlockTimestamp } from "../../../../shared/db/contractTransactionReceipts/getContractTransactionReceipts"; import { AddressSchema } from "../../../schemas/address"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { transactionReceiptSchema } from "../../../schemas/transactionReceipt"; diff --git a/src/server/routes/contract/transactions/paginateTransactionReceipts.ts b/src/server/routes/contract/transactions/paginateTransactionReceipts.ts index 0d13b9b1d..6aca2a842 100644 --- a/src/server/routes/contract/transactions/paginateTransactionReceipts.ts +++ b/src/server/routes/contract/transactions/paginateTransactionReceipts.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getConfiguration } from "../../../../db/configuration/getConfiguration"; -import { getTransactionReceiptsByCursor } from "../../../../db/contractTransactionReceipts/getContractTransactionReceipts"; +import { getConfiguration } from "../../../../shared/db/configuration/getConfiguration"; +import { getTransactionReceiptsByCursor } from "../../../../shared/db/contractTransactionReceipts/getContractTransactionReceipts"; import { AddressSchema } from "../../../schemas/address"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { diff --git a/src/server/routes/contract/write/write.ts b/src/server/routes/contract/write/write.ts index b47049786..3f928832f 100644 --- a/src/server/routes/contract/write/write.ts +++ b/src/server/routes/contract/write/write.ts @@ -3,9 +3,9 @@ import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { prepareContractCall, resolveMethod } from "thirdweb"; import { parseAbiParams, type AbiFunction } from "thirdweb/utils"; -import { getContractV5 } from "../../../../utils/cache/getContractv5"; -import { prettifyError } from "../../../../utils/error"; -import { queueTransaction } from "../../../../utils/transaction/queueTransation"; +import { getContractV5 } from "../../../../shared/utils/cache/getContractv5"; +import { prettifyError } from "../../../../shared/utils/error"; +import { queueTransaction } from "../../../../shared/utils/transaction/queueTransation"; import { createCustomError } from "../../../middleware/error"; import { abiArraySchema } from "../../../schemas/contract"; import { diff --git a/src/server/routes/deploy/prebuilt.ts b/src/server/routes/deploy/prebuilt.ts index 38815a755..271d298b7 100644 --- a/src/server/routes/deploy/prebuilt.ts +++ b/src/server/routes/deploy/prebuilt.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../db/transactions/queueTx"; -import { getSdk } from "../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../shared/utils/cache/getSdk"; import { AddressSchema } from "../../schemas/address"; import { contractDeployBasicSchema } from "../../schemas/contract"; import { diff --git a/src/server/routes/deploy/prebuilts/edition.ts b/src/server/routes/deploy/prebuilts/edition.ts index 15b99b65b..611437a7b 100644 --- a/src/server/routes/deploy/prebuilts/edition.ts +++ b/src/server/routes/deploy/prebuilts/edition.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/editionDrop.ts b/src/server/routes/deploy/prebuilts/editionDrop.ts index 9e2c11bbd..8ffa11299 100644 --- a/src/server/routes/deploy/prebuilts/editionDrop.ts +++ b/src/server/routes/deploy/prebuilts/editionDrop.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/marketplaceV3.ts b/src/server/routes/deploy/prebuilts/marketplaceV3.ts index 8635946c9..8d70769a9 100644 --- a/src/server/routes/deploy/prebuilts/marketplaceV3.ts +++ b/src/server/routes/deploy/prebuilts/marketplaceV3.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/multiwrap.ts b/src/server/routes/deploy/prebuilts/multiwrap.ts index 95df0dd8a..beb778bda 100644 --- a/src/server/routes/deploy/prebuilts/multiwrap.ts +++ b/src/server/routes/deploy/prebuilts/multiwrap.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/nftCollection.ts b/src/server/routes/deploy/prebuilts/nftCollection.ts index 002f6e629..d12c2ec63 100644 --- a/src/server/routes/deploy/prebuilts/nftCollection.ts +++ b/src/server/routes/deploy/prebuilts/nftCollection.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/nftDrop.ts b/src/server/routes/deploy/prebuilts/nftDrop.ts index 740df4fe8..19ca2a2f2 100644 --- a/src/server/routes/deploy/prebuilts/nftDrop.ts +++ b/src/server/routes/deploy/prebuilts/nftDrop.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/pack.ts b/src/server/routes/deploy/prebuilts/pack.ts index 1c7c0e44f..9e5eedbec 100644 --- a/src/server/routes/deploy/prebuilts/pack.ts +++ b/src/server/routes/deploy/prebuilts/pack.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/signatureDrop.ts b/src/server/routes/deploy/prebuilts/signatureDrop.ts index f5f54d385..f7a4a6290 100644 --- a/src/server/routes/deploy/prebuilts/signatureDrop.ts +++ b/src/server/routes/deploy/prebuilts/signatureDrop.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/split.ts b/src/server/routes/deploy/prebuilts/split.ts index 8b9435a3e..8184c0699 100644 --- a/src/server/routes/deploy/prebuilts/split.ts +++ b/src/server/routes/deploy/prebuilts/split.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/token.ts b/src/server/routes/deploy/prebuilts/token.ts index 13980f951..50fde94fb 100644 --- a/src/server/routes/deploy/prebuilts/token.ts +++ b/src/server/routes/deploy/prebuilts/token.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/tokenDrop.ts b/src/server/routes/deploy/prebuilts/tokenDrop.ts index 6129ecfa7..73f55b682 100644 --- a/src/server/routes/deploy/prebuilts/tokenDrop.ts +++ b/src/server/routes/deploy/prebuilts/tokenDrop.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/prebuilts/vote.ts b/src/server/routes/deploy/prebuilts/vote.ts index 2073993cd..fce36471f 100644 --- a/src/server/routes/deploy/prebuilts/vote.ts +++ b/src/server/routes/deploy/prebuilts/vote.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { Address } from "thirdweb"; -import { queueTx } from "../../../../db/transactions/queueTx"; -import { getSdk } from "../../../../utils/cache/getSdk"; +import type { Address } from "thirdweb"; +import { queueTx } from "../../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../../schemas/contract"; import { commonContractSchema, diff --git a/src/server/routes/deploy/published.ts b/src/server/routes/deploy/published.ts index 96fd698bb..13a313541 100644 --- a/src/server/routes/deploy/published.ts +++ b/src/server/routes/deploy/published.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { isAddress } from "thirdweb"; -import { queueTx } from "../../../db/transactions/queueTx"; -import { getSdk } from "../../../utils/cache/getSdk"; +import { queueTx } from "../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../shared/utils/cache/getSdk"; import { contractDeployBasicSchema } from "../../schemas/contract"; import { publishedDeployParamSchema, diff --git a/src/server/routes/relayer/create.ts b/src/server/routes/relayer/create.ts index 1cda9f9b1..f7b34d05f 100644 --- a/src/server/routes/relayer/create.ts +++ b/src/server/routes/relayer/create.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { prisma } from "../../../db/client"; +import { prisma } from "../../../shared/db/client"; import { AddressSchema } from "../../schemas/address"; import { chainIdOrSlugSchema } from "../../schemas/chain"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/relayer/getAll.ts b/src/server/routes/relayer/getAll.ts index 55fba56d8..3798b5e67 100644 --- a/src/server/routes/relayer/getAll.ts +++ b/src/server/routes/relayer/getAll.ts @@ -1,7 +1,7 @@ import { Type } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { prisma } from "../../../db/client"; +import { prisma } from "../../../shared/db/client"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/relayer/index.ts b/src/server/routes/relayer/index.ts index 866f18ac8..604a0774d 100644 --- a/src/server/routes/relayer/index.ts +++ b/src/server/routes/relayer/index.ts @@ -8,10 +8,10 @@ import { ForwarderAbi, ForwarderAbiEIP712ChainlessDomain, NativeMetaTransaction, -} from "../../../constants/relayer"; -import { getRelayerById } from "../../../db/relayer/getRelayerById"; -import { queueTx } from "../../../db/transactions/queueTx"; -import { getSdk } from "../../../utils/cache/getSdk"; +} from "../../../shared/schemas/relayer"; +import { getRelayerById } from "../../../shared/db/relayer/getRelayerById"; +import { queueTx } from "../../../shared/db/transactions/queueTx"; +import { getSdk } from "../../../shared/utils/cache/getSdk"; import { AddressSchema } from "../../schemas/address"; import { standardResponseSchema, diff --git a/src/server/routes/relayer/revoke.ts b/src/server/routes/relayer/revoke.ts index c69b8515d..aa84eb1ad 100644 --- a/src/server/routes/relayer/revoke.ts +++ b/src/server/routes/relayer/revoke.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { prisma } from "../../../db/client"; +import { prisma } from "../../../shared/db/client"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; const requestBodySchema = Type.Object({ diff --git a/src/server/routes/relayer/update.ts b/src/server/routes/relayer/update.ts index aca004e0f..421ac46af 100644 --- a/src/server/routes/relayer/update.ts +++ b/src/server/routes/relayer/update.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { prisma } from "../../../db/client"; +import { prisma } from "../../../shared/db/client"; import { AddressSchema } from "../../schemas/address"; import { chainIdOrSlugSchema } from "../../schemas/chain"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/system/health.ts b/src/server/routes/system/health.ts index 2106aecae..23672c92f 100644 --- a/src/server/routes/system/health.ts +++ b/src/server/routes/system/health.ts @@ -1,10 +1,10 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { isDatabaseReachable } from "../../../db/client"; -import { env } from "../../../utils/env"; -import { isRedisReachable } from "../../../utils/redis/redis"; -import { thirdwebClientId } from "../../../utils/sdk"; +import { isDatabaseReachable } from "../../../shared/db/client"; +import { env } from "../../../shared/utils/env"; +import { isRedisReachable } from "../../../shared/utils/redis/redis"; +import { thirdwebClientId } from "../../../shared/utils/sdk"; import { createCustomError } from "../../middleware/error"; type EngineFeature = diff --git a/src/server/routes/system/queue.ts b/src/server/routes/system/queue.ts index 92763139e..8c01d2302 100644 --- a/src/server/routes/system/queue.ts +++ b/src/server/routes/system/queue.ts @@ -1,9 +1,9 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { TransactionDB } from "../../../db/transactions/db"; -import { getPercentile } from "../../../utils/math"; -import type { MinedTransaction } from "../../../utils/transaction/types"; +import { TransactionDB } from "../../../shared/db/transactions/db"; +import { getPercentile } from "../../../shared/utils/math"; +import type { MinedTransaction } from "../../../shared/utils/transaction/types"; import { MineTransactionQueue } from "../../../worker/queues/mineTransactionQueue"; import { SendTransactionQueue } from "../../../worker/queues/sendTransactionQueue"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/transaction/blockchain/getLogs.ts b/src/server/routes/transaction/blockchain/getLogs.ts index 26a185dab..099dc246d 100644 --- a/src/server/routes/transaction/blockchain/getLogs.ts +++ b/src/server/routes/transaction/blockchain/getLogs.ts @@ -12,10 +12,10 @@ import { type Hex, } from "thirdweb"; import { resolveContractAbi } from "thirdweb/contract"; -import { TransactionReceipt } from "thirdweb/transaction"; -import { TransactionDB } from "../../../../db/transactions/db"; -import { getChain } from "../../../../utils/chain"; -import { thirdwebClient } from "../../../../utils/sdk"; +import type { TransactionReceipt } from "thirdweb/transaction"; +import { TransactionDB } from "../../../../shared/db/transactions/db"; +import { getChain } from "../../../../shared/utils/chain"; +import { thirdwebClient } from "../../../../shared/utils/sdk"; import { createCustomError } from "../../../middleware/error"; import { AddressSchema, TransactionHashSchema } from "../../../schemas/address"; import { chainIdOrSlugSchema } from "../../../schemas/chain"; diff --git a/src/server/routes/transaction/blockchain/getReceipt.ts b/src/server/routes/transaction/blockchain/getReceipt.ts index 13cfd7786..b5d3c4378 100644 --- a/src/server/routes/transaction/blockchain/getReceipt.ts +++ b/src/server/routes/transaction/blockchain/getReceipt.ts @@ -9,12 +9,12 @@ import { } from "thirdweb"; import { stringify } from "thirdweb/utils"; import type { TransactionReceipt } from "viem"; -import { getChain } from "../../../../utils/chain"; +import { getChain } from "../../../../shared/utils/chain"; import { fromTransactionStatus, fromTransactionType, thirdwebClient, -} from "../../../../utils/sdk"; +} from "../../../../shared/utils/sdk"; import { createCustomError } from "../../../middleware/error"; import { AddressSchema, TransactionHashSchema } from "../../../schemas/address"; import { chainIdOrSlugSchema } from "../../../schemas/chain"; diff --git a/src/server/routes/transaction/blockchain/getUserOpReceipt.ts b/src/server/routes/transaction/blockchain/getUserOpReceipt.ts index 76c8c43a0..220add1ae 100644 --- a/src/server/routes/transaction/blockchain/getUserOpReceipt.ts +++ b/src/server/routes/transaction/blockchain/getUserOpReceipt.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { env } from "../../../../utils/env"; +import { env } from "../../../../shared/utils/env"; import { createCustomError } from "../../../middleware/error"; import { TransactionHashSchema } from "../../../schemas/address"; import { chainIdOrSlugSchema } from "../../../schemas/chain"; diff --git a/src/server/routes/transaction/blockchain/sendSignedTx.ts b/src/server/routes/transaction/blockchain/sendSignedTx.ts index 5fc53a188..fe7e1ac83 100644 --- a/src/server/routes/transaction/blockchain/sendSignedTx.ts +++ b/src/server/routes/transaction/blockchain/sendSignedTx.ts @@ -2,8 +2,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { eth_sendRawTransaction, getRpcClient, isHex } from "thirdweb"; -import { getChain } from "../../../../utils/chain"; -import { thirdwebClient } from "../../../../utils/sdk"; +import { getChain } from "../../../../shared/utils/chain"; +import { thirdwebClient } from "../../../../shared/utils/sdk"; import { createCustomError } from "../../../middleware/error"; import { TransactionHashSchema } from "../../../schemas/address"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/transaction/blockchain/sendSignedUserOp.ts b/src/server/routes/transaction/blockchain/sendSignedUserOp.ts index f5b3b28a6..8db91f8e3 100644 --- a/src/server/routes/transaction/blockchain/sendSignedUserOp.ts +++ b/src/server/routes/transaction/blockchain/sendSignedUserOp.ts @@ -2,8 +2,8 @@ import { Type, type Static } from "@sinclair/typebox"; import { Value } from "@sinclair/typebox/value"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { env } from "../../../../utils/env"; -import { thirdwebClientId } from "../../../../utils/sdk"; +import { env } from "../../../../shared/utils/env"; +import { thirdwebClientId } from "../../../../shared/utils/sdk"; import { TransactionHashSchema } from "../../../schemas/address"; import { standardResponseSchema } from "../../../schemas/sharedApiSchemas"; import { walletChainParamSchema } from "../../../schemas/wallet"; diff --git a/src/server/routes/transaction/cancel.ts b/src/server/routes/transaction/cancel.ts index d9b704383..cb49beb59 100644 --- a/src/server/routes/transaction/cancel.ts +++ b/src/server/routes/transaction/cancel.ts @@ -1,15 +1,15 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { TransactionDB } from "../../../db/transactions/db"; -import { getBlockNumberish } from "../../../utils/block"; -import { getConfig } from "../../../utils/cache/getConfig"; -import { getChain } from "../../../utils/chain"; -import { msSince } from "../../../utils/date"; -import { sendCancellationTransaction } from "../../../utils/transaction/cancelTransaction"; -import type { CancelledTransaction } from "../../../utils/transaction/types"; -import { enqueueTransactionWebhook } from "../../../utils/transaction/webhook"; -import { reportUsage } from "../../../utils/usage"; +import { TransactionDB } from "../../../shared/db/transactions/db"; +import { getBlockNumberish } from "../../../shared/utils/block"; +import { getConfig } from "../../../shared/utils/cache/getConfig"; +import { getChain } from "../../../shared/utils/chain"; +import { msSince } from "../../../shared/utils/date"; +import { sendCancellationTransaction } from "../../../shared/utils/transaction/cancelTransaction"; +import type { CancelledTransaction } from "../../../shared/utils/transaction/types"; +import { enqueueTransactionWebhook } from "../../../shared/utils/transaction/webhook"; +import { reportUsage } from "../../../shared/utils/usage"; import { SendTransactionQueue } from "../../../worker/queues/sendTransactionQueue"; import { createCustomError } from "../../middleware/error"; import { TransactionHashSchema } from "../../schemas/address"; diff --git a/src/server/routes/transaction/getAll.ts b/src/server/routes/transaction/getAll.ts index 5b58f5b3e..6243e0fc7 100644 --- a/src/server/routes/transaction/getAll.ts +++ b/src/server/routes/transaction/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { TransactionDB } from "../../../db/transactions/db"; +import { TransactionDB } from "../../../shared/db/transactions/db"; import { PaginationSchema } from "../../schemas/pagination"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { diff --git a/src/server/routes/transaction/getAllDeployedContracts.ts b/src/server/routes/transaction/getAllDeployedContracts.ts index 4bcd88a61..d4745f9ad 100644 --- a/src/server/routes/transaction/getAllDeployedContracts.ts +++ b/src/server/routes/transaction/getAllDeployedContracts.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { TransactionDB } from "../../../db/transactions/db"; +import { TransactionDB } from "../../../shared/db/transactions/db"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { TransactionSchema, diff --git a/src/server/routes/transaction/retry-failed.ts b/src/server/routes/transaction/retry-failed.ts index 5ac43c43b..1550a97ca 100644 --- a/src/server/routes/transaction/retry-failed.ts +++ b/src/server/routes/transaction/retry-failed.ts @@ -1,12 +1,12 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { TransactionDB } from "../../../db/transactions/db"; +import { TransactionDB } from "../../../shared/db/transactions/db"; import { getReceiptForEOATransaction, getReceiptForUserOp, -} from "../../../lib/transaction/get-transaction-receipt"; -import type { QueuedTransaction } from "../../../utils/transaction/types"; +} from "../../../shared/lib/transaction/get-transaction-receipt"; +import type { QueuedTransaction } from "../../../shared/utils/transaction/types"; import { MineTransactionQueue } from "../../../worker/queues/mineTransactionQueue"; import { SendTransactionQueue } from "../../../worker/queues/sendTransactionQueue"; import { createCustomError } from "../../middleware/error"; diff --git a/src/server/routes/transaction/retry.ts b/src/server/routes/transaction/retry.ts index c8716e2dd..affd9a88c 100644 --- a/src/server/routes/transaction/retry.ts +++ b/src/server/routes/transaction/retry.ts @@ -1,9 +1,9 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { TransactionDB } from "../../../db/transactions/db"; -import { maybeBigInt } from "../../../utils/primitiveTypes"; -import { SentTransaction } from "../../../utils/transaction/types"; +import { TransactionDB } from "../../../shared/db/transactions/db"; +import { maybeBigInt } from "../../../shared/utils/primitiveTypes"; +import type { SentTransaction } from "../../../shared/utils/transaction/types"; import { SendTransactionQueue } from "../../../worker/queues/sendTransactionQueue"; import { createCustomError } from "../../middleware/error"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/transaction/status.ts b/src/server/routes/transaction/status.ts index a5c9c1b95..616009cbf 100644 --- a/src/server/routes/transaction/status.ts +++ b/src/server/routes/transaction/status.ts @@ -1,9 +1,9 @@ -import { SocketStream } from "@fastify/websocket"; -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import type { SocketStream } from "@fastify/websocket"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { TransactionDB } from "../../../db/transactions/db"; -import { logger } from "../../../utils/logger"; +import { TransactionDB } from "../../../shared/db/transactions/db"; +import { logger } from "../../../shared/utils/logger"; import { createCustomError } from "../../middleware/error"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { diff --git a/src/server/routes/transaction/sync-retry.ts b/src/server/routes/transaction/sync-retry.ts index 3eabdbd1e..e6ef887c4 100644 --- a/src/server/routes/transaction/sync-retry.ts +++ b/src/server/routes/transaction/sync-retry.ts @@ -2,15 +2,18 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; import { toSerializableTransaction } from "thirdweb"; -import { TransactionDB } from "../../../db/transactions/db"; -import { getReceiptForEOATransaction } from "../../../lib/transaction/get-transaction-receipt"; -import { getAccount } from "../../../utils/account"; -import { getBlockNumberish } from "../../../utils/block"; -import { getChain } from "../../../utils/chain"; -import { getChecksumAddress, maybeBigInt } from "../../../utils/primitiveTypes"; -import { thirdwebClient } from "../../../utils/sdk"; -import type { SentTransaction } from "../../../utils/transaction/types"; -import { enqueueTransactionWebhook } from "../../../utils/transaction/webhook"; +import { TransactionDB } from "../../../shared/db/transactions/db"; +import { getReceiptForEOATransaction } from "../../../shared/lib/transaction/get-transaction-receipt"; +import { getAccount } from "../../../shared/utils/account"; +import { getBlockNumberish } from "../../../shared/utils/block"; +import { getChain } from "../../../shared/utils/chain"; +import { + getChecksumAddress, + maybeBigInt, +} from "../../../shared/utils/primitiveTypes"; +import { thirdwebClient } from "../../../shared/utils/sdk"; +import type { SentTransaction } from "../../../shared/utils/transaction/types"; +import { enqueueTransactionWebhook } from "../../../shared/utils/transaction/webhook"; import { MineTransactionQueue } from "../../../worker/queues/mineTransactionQueue"; import { createCustomError } from "../../middleware/error"; import { TransactionHashSchema } from "../../schemas/address"; diff --git a/src/server/routes/webhooks/create.ts b/src/server/routes/webhooks/create.ts index a1cc44b32..b9e71f2a9 100644 --- a/src/server/routes/webhooks/create.ts +++ b/src/server/routes/webhooks/create.ts @@ -1,8 +1,8 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { insertWebhook } from "../../../db/webhooks/createWebhook"; -import { WebhooksEventTypes } from "../../../schema/webhooks"; +import { insertWebhook } from "../../../shared/db/webhooks/createWebhook"; +import { WebhooksEventTypes } from "../../../shared/schemas/webhooks"; import { createCustomError } from "../../middleware/error"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { WebhookSchema, toWebhookSchema } from "../../schemas/webhook"; diff --git a/src/server/routes/webhooks/events.ts b/src/server/routes/webhooks/events.ts index 1e621e771..35f636d0b 100644 --- a/src/server/routes/webhooks/events.ts +++ b/src/server/routes/webhooks/events.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; -import { FastifyInstance } from "fastify"; +import { type Static, Type } from "@sinclair/typebox"; +import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { WebhooksEventTypes } from "../../../schema/webhooks"; +import { WebhooksEventTypes } from "../../../shared/schemas/webhooks"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; export const responseBodySchema = Type.Object({ diff --git a/src/server/routes/webhooks/getAll.ts b/src/server/routes/webhooks/getAll.ts index 9e22617f4..1c3c26149 100644 --- a/src/server/routes/webhooks/getAll.ts +++ b/src/server/routes/webhooks/getAll.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getAllWebhooks } from "../../../db/webhooks/getAllWebhooks"; +import { getAllWebhooks } from "../../../shared/db/webhooks/getAllWebhooks"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; import { WebhookSchema, toWebhookSchema } from "../../schemas/webhook"; diff --git a/src/server/routes/webhooks/revoke.ts b/src/server/routes/webhooks/revoke.ts index d6725c6ba..e3b220442 100644 --- a/src/server/routes/webhooks/revoke.ts +++ b/src/server/routes/webhooks/revoke.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getWebhook } from "../../../db/webhooks/getWebhook"; -import { deleteWebhook } from "../../../db/webhooks/revokeWebhook"; +import { getWebhook } from "../../../shared/db/webhooks/getWebhook"; +import { deleteWebhook } from "../../../shared/db/webhooks/revokeWebhook"; import { createCustomError } from "../../middleware/error"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/routes/webhooks/test.ts b/src/server/routes/webhooks/test.ts index 68bc341c6..c70bbb5de 100644 --- a/src/server/routes/webhooks/test.ts +++ b/src/server/routes/webhooks/test.ts @@ -1,8 +1,8 @@ import { Type, type Static } from "@sinclair/typebox"; import type { FastifyInstance } from "fastify"; import { StatusCodes } from "http-status-codes"; -import { getWebhook } from "../../../db/webhooks/getWebhook"; -import { sendWebhookRequest } from "../../../utils/webhook"; +import { getWebhook } from "../../../shared/db/webhooks/getWebhook"; +import { sendWebhookRequest } from "../../../shared/utils/webhook"; import { createCustomError } from "../../middleware/error"; import { NumberStringSchema } from "../../schemas/number"; import { standardResponseSchema } from "../../schemas/sharedApiSchemas"; diff --git a/src/server/schemas/transaction/index.ts b/src/server/schemas/transaction/index.ts index c9dd5500c..c2ddb8825 100644 --- a/src/server/schemas/transaction/index.ts +++ b/src/server/schemas/transaction/index.ts @@ -1,7 +1,7 @@ import { Type, type Static } from "@sinclair/typebox"; import type { Hex } from "thirdweb"; import { stringify } from "thirdweb/utils"; -import type { AnyTransaction } from "../../../utils/transaction/types"; +import type { AnyTransaction } from "../../../shared/utils/transaction/types"; import { AddressSchema, TransactionHashSchema } from "../address"; export const TransactionSchema = Type.Object({ diff --git a/src/server/schemas/wallet/index.ts b/src/server/schemas/wallet/index.ts index c4119fa61..3f4d940f4 100644 --- a/src/server/schemas/wallet/index.ts +++ b/src/server/schemas/wallet/index.ts @@ -1,6 +1,6 @@ import { Type } from "@sinclair/typebox"; import { getAddress, type Address } from "thirdweb"; -import { env } from "../../../utils/env"; +import { env } from "../../../shared/utils/env"; import { badAddressError } from "../../middleware/error"; import { AddressSchema } from "../address"; import { chainIdOrSlugSchema } from "../chain"; diff --git a/src/server/utils/chain.ts b/src/server/utils/chain.ts index 5ea5741d6..b0e5c7d7b 100644 --- a/src/server/utils/chain.ts +++ b/src/server/utils/chain.ts @@ -1,5 +1,5 @@ import { getChainBySlugAsync } from "@thirdweb-dev/chains"; -import { getChain } from "../../utils/chain"; +import { getChain } from "../../shared/utils/chain"; import { badChainError } from "../middleware/error"; /** diff --git a/src/server/utils/storage/localStorage.ts b/src/server/utils/storage/localStorage.ts index 8c5557faa..95665f675 100644 --- a/src/server/utils/storage/localStorage.ts +++ b/src/server/utils/storage/localStorage.ts @@ -1,8 +1,8 @@ import type { AsyncStorage } from "@thirdweb-dev/wallets"; import fs from "node:fs"; -import { prisma } from "../../../db/client"; -import { WalletType } from "../../../schema/wallet"; -import { logger } from "../../../utils/logger"; +import { prisma } from "../../../shared/db/client"; +import { WalletType } from "../../../shared/schemas/wallet"; +import { logger } from "../../../shared/utils/logger"; /** * @deprecated @@ -38,7 +38,7 @@ export class LocalFileStorage implements AsyncStorage { logger({ service: "server", level: "error", - message: `No local wallet found!`, + message: "No local wallet found!", }); return null; } diff --git a/src/server/utils/transactionOverrides.ts b/src/server/utils/transactionOverrides.ts index a048504ed..83f728024 100644 --- a/src/server/utils/transactionOverrides.ts +++ b/src/server/utils/transactionOverrides.ts @@ -1,6 +1,6 @@ import type { Static } from "@sinclair/typebox"; -import { maybeBigInt } from "../../utils/primitiveTypes"; -import type { InsertedTransaction } from "../../utils/transaction/types"; +import { maybeBigInt } from "../../shared/utils/primitiveTypes"; +import type { InsertedTransaction } from "../../shared/utils/transaction/types"; import type { txOverridesSchema, txOverridesWithValueSchema, diff --git a/src/server/utils/wallets/createGcpKmsWallet.ts b/src/server/utils/wallets/createGcpKmsWallet.ts index 2b4b47201..bf4a249a2 100644 --- a/src/server/utils/wallets/createGcpKmsWallet.ts +++ b/src/server/utils/wallets/createGcpKmsWallet.ts @@ -1,7 +1,7 @@ import { KeyManagementServiceClient } from "@google-cloud/kms"; -import { createWalletDetails } from "../../../db/wallets/createWalletDetails"; -import { WalletType } from "../../../schema/wallet"; -import { thirdwebClient } from "../../../utils/sdk"; +import { createWalletDetails } from "../../../shared/db/wallets/createWalletDetails"; +import { WalletType } from "../../../shared/schemas/wallet"; +import { thirdwebClient } from "../../../shared/utils/sdk"; import { FetchGcpKmsWalletParamsError, fetchGcpKmsWalletParams, diff --git a/src/server/utils/wallets/createLocalWallet.ts b/src/server/utils/wallets/createLocalWallet.ts index 03392c1a6..c8b187171 100644 --- a/src/server/utils/wallets/createLocalWallet.ts +++ b/src/server/utils/wallets/createLocalWallet.ts @@ -1,9 +1,9 @@ import { encryptKeystore } from "@ethersproject/json-wallets"; import { privateKeyToAccount } from "thirdweb/wallets"; import { generatePrivateKey } from "viem/accounts"; -import { createWalletDetails } from "../../../db/wallets/createWalletDetails"; -import { env } from "../../../utils/env"; -import { thirdwebClient } from "../../../utils/sdk"; +import { createWalletDetails } from "../../../shared/db/wallets/createWalletDetails"; +import { env } from "../../../shared/utils/env"; +import { thirdwebClient } from "../../../shared/utils/sdk"; interface CreateLocalWallet { label?: string; diff --git a/src/server/utils/wallets/createSmartWallet.ts b/src/server/utils/wallets/createSmartWallet.ts index 5859a430a..263c60f03 100644 --- a/src/server/utils/wallets/createSmartWallet.ts +++ b/src/server/utils/wallets/createSmartWallet.ts @@ -1,8 +1,8 @@ import { defineChain, type Address, type Chain } from "thirdweb"; import { smartWallet, type Account } from "thirdweb/wallets"; -import { createWalletDetails } from "../../../db/wallets/createWalletDetails"; -import { WalletType } from "../../../schema/wallet"; -import { thirdwebClient } from "../../../utils/sdk"; +import { createWalletDetails } from "../../../shared/db/wallets/createWalletDetails"; +import { WalletType } from "../../../shared/schemas/wallet"; +import { thirdwebClient } from "../../../shared/utils/sdk"; import { splitAwsKmsArn } from "./awsKmsArn"; import { createAwsKmsKey, diff --git a/src/server/utils/wallets/fetchAwsKmsWalletParams.ts b/src/server/utils/wallets/fetchAwsKmsWalletParams.ts index f94cd0f1f..eea36e9ca 100644 --- a/src/server/utils/wallets/fetchAwsKmsWalletParams.ts +++ b/src/server/utils/wallets/fetchAwsKmsWalletParams.ts @@ -1,4 +1,4 @@ -import { getConfig } from "../../../utils/cache/getConfig"; +import { getConfig } from "../../../shared/utils/cache/getConfig"; export type AwsKmsWalletParams = { awsAccessKeyId: string; diff --git a/src/server/utils/wallets/fetchGcpKmsWalletParams.ts b/src/server/utils/wallets/fetchGcpKmsWalletParams.ts index b0c468ebc..a5f6de90b 100644 --- a/src/server/utils/wallets/fetchGcpKmsWalletParams.ts +++ b/src/server/utils/wallets/fetchGcpKmsWalletParams.ts @@ -1,4 +1,4 @@ -import { getConfig } from "../../../utils/cache/getConfig"; +import { getConfig } from "../../../shared/utils/cache/getConfig"; export type GcpKmsWalletParams = { gcpApplicationCredentialEmail: string; diff --git a/src/server/utils/wallets/getAwsKmsAccount.ts b/src/server/utils/wallets/getAwsKmsAccount.ts index 91e99104d..33d828ec7 100644 --- a/src/server/utils/wallets/getAwsKmsAccount.ts +++ b/src/server/utils/wallets/getAwsKmsAccount.ts @@ -17,7 +17,7 @@ import type { TypedDataDefinition, } from "viem"; import { hashTypedData } from "viem"; -import { getChain } from "../../../utils/chain"; +import { getChain } from "../../../shared/utils/chain"; type SendTransactionResult = { transactionHash: Hex; diff --git a/src/server/utils/wallets/getGcpKmsAccount.ts b/src/server/utils/wallets/getGcpKmsAccount.ts index b73135331..cf02625a7 100644 --- a/src/server/utils/wallets/getGcpKmsAccount.ts +++ b/src/server/utils/wallets/getGcpKmsAccount.ts @@ -17,7 +17,7 @@ import type { TypedDataDefinition, } from "viem"; import { hashTypedData } from "viem"; -import { getChain } from "../../../utils/chain"; // Adjust import path as needed +import { getChain } from "../../../shared/utils/chain"; // Adjust import path as needed type SendTransactionResult = { transactionHash: Hex; diff --git a/src/server/utils/wallets/getLocalWallet.ts b/src/server/utils/wallets/getLocalWallet.ts index 0f4456423..dd078f4e4 100644 --- a/src/server/utils/wallets/getLocalWallet.ts +++ b/src/server/utils/wallets/getLocalWallet.ts @@ -3,11 +3,11 @@ import { Wallet } from "ethers"; import type { Address } from "thirdweb"; import { getChainMetadata } from "thirdweb/chains"; import { privateKeyToAccount, type Account } from "thirdweb/wallets"; -import { getWalletDetails } from "../../../db/wallets/getWalletDetails"; -import { getChain } from "../../../utils/chain"; -import { env } from "../../../utils/env"; -import { logger } from "../../../utils/logger"; -import { thirdwebClient } from "../../../utils/sdk"; +import { getWalletDetails } from "../../../shared/db/wallets/getWalletDetails"; +import { getChain } from "../../../shared/utils/chain"; +import { env } from "../../../shared/utils/env"; +import { logger } from "../../../shared/utils/logger"; +import { thirdwebClient } from "../../../shared/utils/sdk"; import { badChainError } from "../../middleware/error"; import { LocalFileStorage } from "../storage/localStorage"; diff --git a/src/server/utils/wallets/getSmartWallet.ts b/src/server/utils/wallets/getSmartWallet.ts index 59ab4d885..67db9f1d1 100644 --- a/src/server/utils/wallets/getSmartWallet.ts +++ b/src/server/utils/wallets/getSmartWallet.ts @@ -1,7 +1,7 @@ import { SmartWallet, type EVMWallet } from "@thirdweb-dev/wallets"; -import { getContract } from "../../../utils/cache/getContract"; -import { env } from "../../../utils/env"; -import { redis } from "../../../utils/redis/redis"; +import { getContract } from "../../../shared/utils/cache/getContract"; +import { env } from "../../../shared/utils/env"; +import { redis } from "../../../shared/utils/redis/redis"; interface GetSmartWalletParams { chainId: number; diff --git a/src/server/utils/wallets/importAwsKmsWallet.ts b/src/server/utils/wallets/importAwsKmsWallet.ts index 159db1a69..82d3969b4 100644 --- a/src/server/utils/wallets/importAwsKmsWallet.ts +++ b/src/server/utils/wallets/importAwsKmsWallet.ts @@ -1,6 +1,6 @@ -import { createWalletDetails } from "../../../db/wallets/createWalletDetails"; -import { WalletType } from "../../../schema/wallet"; -import { thirdwebClient } from "../../../utils/sdk"; +import { createWalletDetails } from "../../../shared/db/wallets/createWalletDetails"; +import { WalletType } from "../../../shared/schemas/wallet"; +import { thirdwebClient } from "../../../shared/utils/sdk"; import { splitAwsKmsArn } from "./awsKmsArn"; import { getAwsKmsAccount } from "./getAwsKmsAccount"; diff --git a/src/server/utils/wallets/importGcpKmsWallet.ts b/src/server/utils/wallets/importGcpKmsWallet.ts index 5ac149b55..d34d1f865 100644 --- a/src/server/utils/wallets/importGcpKmsWallet.ts +++ b/src/server/utils/wallets/importGcpKmsWallet.ts @@ -1,6 +1,6 @@ -import { createWalletDetails } from "../../../db/wallets/createWalletDetails"; -import { WalletType } from "../../../schema/wallet"; -import { thirdwebClient } from "../../../utils/sdk"; +import { createWalletDetails } from "../../../shared/db/wallets/createWalletDetails"; +import { WalletType } from "../../../shared/schemas/wallet"; +import { thirdwebClient } from "../../../shared/utils/sdk"; import { getGcpKmsAccount } from "./getGcpKmsAccount"; interface ImportGcpKmsWalletParams { diff --git a/src/server/utils/wallets/importLocalWallet.ts b/src/server/utils/wallets/importLocalWallet.ts index 3ad1c7a6e..a917c484f 100644 --- a/src/server/utils/wallets/importLocalWallet.ts +++ b/src/server/utils/wallets/importLocalWallet.ts @@ -1,5 +1,5 @@ import { LocalWallet } from "@thirdweb-dev/wallets"; -import { env } from "../../../utils/env"; +import { env } from "../../../shared/utils/env"; import { LocalFileStorage } from "../storage/localStorage"; type ImportLocalWalletParams = diff --git a/src/server/utils/websocket.ts b/src/server/utils/websocket.ts index 4e68a198d..b18f1dd13 100644 --- a/src/server/utils/websocket.ts +++ b/src/server/utils/websocket.ts @@ -1,9 +1,9 @@ -import { SocketStream } from "@fastify/websocket"; -import { Static } from "@sinclair/typebox"; -import { FastifyRequest } from "fastify"; -import { logger } from "../../utils/logger"; -import { TransactionSchema } from "../schemas/transaction"; -import { UserSubscription, subscriptionsData } from "../schemas/websocket"; +import type { SocketStream } from "@fastify/websocket"; +import type { Static } from "@sinclair/typebox"; +import type { FastifyRequest } from "fastify"; +import { logger } from "../../shared/utils/logger"; +import type { TransactionSchema } from "../schemas/transaction"; +import { type UserSubscription, subscriptionsData } from "../schemas/websocket"; // websocket timeout, i.e., ws connection closed after 10 seconds const timeoutDuration = 10 * 60 * 1000; diff --git a/src/db/chainIndexers/getChainIndexer.ts b/src/shared/db/chainIndexers/getChainIndexer.ts similarity index 94% rename from src/db/chainIndexers/getChainIndexer.ts rename to src/shared/db/chainIndexers/getChainIndexer.ts index 166c2f228..ae7f3e7e8 100644 --- a/src/db/chainIndexers/getChainIndexer.ts +++ b/src/shared/db/chainIndexers/getChainIndexer.ts @@ -1,5 +1,5 @@ import { Prisma } from "@prisma/client"; -import type { PrismaTransaction } from "../../schema/prisma"; +import type { PrismaTransaction } from "../../schemas/prisma"; import { getPrismaWithPostgresTx } from "../client"; interface GetLastIndexedBlockParams { diff --git a/src/db/chainIndexers/upsertChainIndexer.ts b/src/shared/db/chainIndexers/upsertChainIndexer.ts similarity index 91% rename from src/db/chainIndexers/upsertChainIndexer.ts rename to src/shared/db/chainIndexers/upsertChainIndexer.ts index 123a2a464..744a12a81 100644 --- a/src/db/chainIndexers/upsertChainIndexer.ts +++ b/src/shared/db/chainIndexers/upsertChainIndexer.ts @@ -1,4 +1,4 @@ -import type { PrismaTransaction } from "../../schema/prisma"; +import type { PrismaTransaction } from "../../schemas/prisma"; import { getPrismaWithPostgresTx } from "../client"; interface UpsertChainIndexerParams { diff --git a/src/db/client.ts b/src/shared/db/client.ts similarity index 84% rename from src/db/client.ts rename to src/shared/db/client.ts index bddb0eafe..9c57b1417 100644 --- a/src/db/client.ts +++ b/src/shared/db/client.ts @@ -1,6 +1,6 @@ import { PrismaClient } from "@prisma/client"; -import pg, { Knex } from "knex"; -import { PrismaTransaction } from "../schema/prisma"; +import pg, { type Knex } from "knex"; +import type { PrismaTransaction } from "../schemas/prisma"; import { env } from "../utils/env"; export const prisma = new PrismaClient({ @@ -26,7 +26,7 @@ export const isDatabaseReachable = async () => { try { await prisma.walletDetails.findFirst(); return true; - } catch (error) { + } catch { return false; } }; diff --git a/src/db/configuration/getConfiguration.ts b/src/shared/db/configuration/getConfiguration.ts similarity index 98% rename from src/db/configuration/getConfiguration.ts rename to src/shared/db/configuration/getConfiguration.ts index 67c47f9a6..5d1698ccd 100644 --- a/src/db/configuration/getConfiguration.ts +++ b/src/shared/db/configuration/getConfiguration.ts @@ -7,9 +7,9 @@ import type { AwsWalletConfiguration, GcpWalletConfiguration, ParsedConfig, -} from "../../schema/config"; -import { WalletType } from "../../schema/wallet"; -import { mandatoryAllowedCorsUrls } from "../../server/utils/cors-urls"; +} from "../../schemas/config"; +import { WalletType } from "../../schemas/wallet"; +import { mandatoryAllowedCorsUrls } from "../../../server/utils/cors-urls"; import type { networkResponseSchema } from "../../utils/cache/getSdk"; import { decrypt } from "../../utils/crypto"; import { env } from "../../utils/env"; diff --git a/src/db/configuration/updateConfiguration.ts b/src/shared/db/configuration/updateConfiguration.ts similarity index 100% rename from src/db/configuration/updateConfiguration.ts rename to src/shared/db/configuration/updateConfiguration.ts diff --git a/src/db/contractEventLogs/createContractEventLogs.ts b/src/shared/db/contractEventLogs/createContractEventLogs.ts similarity index 78% rename from src/db/contractEventLogs/createContractEventLogs.ts rename to src/shared/db/contractEventLogs/createContractEventLogs.ts index cb498e9c1..5b4c94e13 100644 --- a/src/db/contractEventLogs/createContractEventLogs.ts +++ b/src/shared/db/contractEventLogs/createContractEventLogs.ts @@ -1,5 +1,5 @@ -import { ContractEventLogs, Prisma } from "@prisma/client"; -import { PrismaTransaction } from "../../schema/prisma"; +import type { ContractEventLogs, Prisma } from "@prisma/client"; +import type { PrismaTransaction } from "../../schemas/prisma"; import { getPrismaWithPostgresTx } from "../client"; export interface BulkInsertContractLogsParams { diff --git a/src/db/contractEventLogs/deleteContractEventLogs.ts b/src/shared/db/contractEventLogs/deleteContractEventLogs.ts similarity index 100% rename from src/db/contractEventLogs/deleteContractEventLogs.ts rename to src/shared/db/contractEventLogs/deleteContractEventLogs.ts diff --git a/src/db/contractEventLogs/getContractEventLogs.ts b/src/shared/db/contractEventLogs/getContractEventLogs.ts similarity index 100% rename from src/db/contractEventLogs/getContractEventLogs.ts rename to src/shared/db/contractEventLogs/getContractEventLogs.ts diff --git a/src/db/contractSubscriptions/createContractSubscription.ts b/src/shared/db/contractSubscriptions/createContractSubscription.ts similarity index 100% rename from src/db/contractSubscriptions/createContractSubscription.ts rename to src/shared/db/contractSubscriptions/createContractSubscription.ts diff --git a/src/db/contractSubscriptions/deleteContractSubscription.ts b/src/shared/db/contractSubscriptions/deleteContractSubscription.ts similarity index 100% rename from src/db/contractSubscriptions/deleteContractSubscription.ts rename to src/shared/db/contractSubscriptions/deleteContractSubscription.ts diff --git a/src/db/contractSubscriptions/getContractSubscriptions.ts b/src/shared/db/contractSubscriptions/getContractSubscriptions.ts similarity index 100% rename from src/db/contractSubscriptions/getContractSubscriptions.ts rename to src/shared/db/contractSubscriptions/getContractSubscriptions.ts diff --git a/src/db/contractTransactionReceipts/createContractTransactionReceipts.ts b/src/shared/db/contractTransactionReceipts/createContractTransactionReceipts.ts similarity index 91% rename from src/db/contractTransactionReceipts/createContractTransactionReceipts.ts rename to src/shared/db/contractTransactionReceipts/createContractTransactionReceipts.ts index 1cd733b4c..ac3396516 100644 --- a/src/db/contractTransactionReceipts/createContractTransactionReceipts.ts +++ b/src/shared/db/contractTransactionReceipts/createContractTransactionReceipts.ts @@ -1,5 +1,5 @@ import { ContractTransactionReceipts, Prisma } from "@prisma/client"; -import { PrismaTransaction } from "../../schema/prisma"; +import { PrismaTransaction } from "../../schemas/prisma"; import { getPrismaWithPostgresTx } from "../client"; export interface BulkInsertContractLogsParams { diff --git a/src/db/contractTransactionReceipts/deleteContractTransactionReceipts.ts b/src/shared/db/contractTransactionReceipts/deleteContractTransactionReceipts.ts similarity index 100% rename from src/db/contractTransactionReceipts/deleteContractTransactionReceipts.ts rename to src/shared/db/contractTransactionReceipts/deleteContractTransactionReceipts.ts diff --git a/src/db/contractTransactionReceipts/getContractTransactionReceipts.ts b/src/shared/db/contractTransactionReceipts/getContractTransactionReceipts.ts similarity index 100% rename from src/db/contractTransactionReceipts/getContractTransactionReceipts.ts rename to src/shared/db/contractTransactionReceipts/getContractTransactionReceipts.ts diff --git a/src/db/keypair/delete.ts b/src/shared/db/keypair/delete.ts similarity index 100% rename from src/db/keypair/delete.ts rename to src/shared/db/keypair/delete.ts diff --git a/src/db/keypair/get.ts b/src/shared/db/keypair/get.ts similarity index 100% rename from src/db/keypair/get.ts rename to src/shared/db/keypair/get.ts diff --git a/src/db/keypair/insert.ts b/src/shared/db/keypair/insert.ts similarity index 72% rename from src/db/keypair/insert.ts rename to src/shared/db/keypair/insert.ts index c6d7b737d..77f1ada59 100644 --- a/src/db/keypair/insert.ts +++ b/src/shared/db/keypair/insert.ts @@ -1,6 +1,6 @@ -import { Keypairs } from "@prisma/client"; -import { createHash } from "crypto"; -import { KeypairAlgorithm } from "../../server/schemas/keypairs"; +import type { Keypairs } from "@prisma/client"; +import { createHash } from "node:crypto"; +import type { KeypairAlgorithm } from "../../schemas/keypair"; import { prisma } from "../client"; export const insertKeypair = async ({ diff --git a/src/db/keypair/list.ts b/src/shared/db/keypair/list.ts similarity index 100% rename from src/db/keypair/list.ts rename to src/shared/db/keypair/list.ts diff --git a/src/db/permissions/deletePermissions.ts b/src/shared/db/permissions/deletePermissions.ts similarity index 100% rename from src/db/permissions/deletePermissions.ts rename to src/shared/db/permissions/deletePermissions.ts diff --git a/src/db/permissions/getPermissions.ts b/src/shared/db/permissions/getPermissions.ts similarity index 92% rename from src/db/permissions/getPermissions.ts rename to src/shared/db/permissions/getPermissions.ts index 6d178b5eb..7017ae12e 100644 --- a/src/db/permissions/getPermissions.ts +++ b/src/shared/db/permissions/getPermissions.ts @@ -1,4 +1,4 @@ -import { Permission } from "../../server/schemas/auth"; +import { Permission } from "../../schemas/auth"; import { env } from "../../utils/env"; import { prisma } from "../client"; diff --git a/src/db/permissions/updatePermissions.ts b/src/shared/db/permissions/updatePermissions.ts similarity index 100% rename from src/db/permissions/updatePermissions.ts rename to src/shared/db/permissions/updatePermissions.ts diff --git a/src/db/relayer/getRelayerById.ts b/src/shared/db/relayer/getRelayerById.ts similarity index 100% rename from src/db/relayer/getRelayerById.ts rename to src/shared/db/relayer/getRelayerById.ts diff --git a/src/db/tokens/createToken.ts b/src/shared/db/tokens/createToken.ts similarity index 100% rename from src/db/tokens/createToken.ts rename to src/shared/db/tokens/createToken.ts diff --git a/src/db/tokens/getAccessTokens.ts b/src/shared/db/tokens/getAccessTokens.ts similarity index 100% rename from src/db/tokens/getAccessTokens.ts rename to src/shared/db/tokens/getAccessTokens.ts diff --git a/src/db/tokens/getToken.ts b/src/shared/db/tokens/getToken.ts similarity index 100% rename from src/db/tokens/getToken.ts rename to src/shared/db/tokens/getToken.ts diff --git a/src/db/tokens/revokeToken.ts b/src/shared/db/tokens/revokeToken.ts similarity index 100% rename from src/db/tokens/revokeToken.ts rename to src/shared/db/tokens/revokeToken.ts diff --git a/src/db/tokens/updateToken.ts b/src/shared/db/tokens/updateToken.ts similarity index 100% rename from src/db/tokens/updateToken.ts rename to src/shared/db/tokens/updateToken.ts diff --git a/src/db/transactions/db.ts b/src/shared/db/transactions/db.ts similarity index 100% rename from src/db/transactions/db.ts rename to src/shared/db/transactions/db.ts diff --git a/src/db/transactions/queueTx.ts b/src/shared/db/transactions/queueTx.ts similarity index 95% rename from src/db/transactions/queueTx.ts rename to src/shared/db/transactions/queueTx.ts index 76baa3656..4c12eeae0 100644 --- a/src/db/transactions/queueTx.ts +++ b/src/shared/db/transactions/queueTx.ts @@ -1,11 +1,11 @@ import type { DeployTransaction, Transaction } from "@thirdweb-dev/sdk"; import type { ERC4337EthersSigner } from "@thirdweb-dev/wallets/dist/declarations/src/evm/connectors/smart-wallet/lib/erc4337-signer"; import { ZERO_ADDRESS, type Address } from "thirdweb"; -import type { ContractExtension } from "../../schema/extension"; -import { parseTransactionOverrides } from "../../server/utils/transactionOverrides"; +import type { ContractExtension } from "../../schemas/extension"; import { maybeBigInt, normalizeAddress } from "../../utils/primitiveTypes"; import { insertTransaction } from "../../utils/transaction/insertTransaction"; import type { InsertedTransaction } from "../../utils/transaction/types"; +import { parseTransactionOverrides } from "../../../server/utils/transactionOverrides"; interface QueueTxParams { // we should move away from Transaction type (v4 SDK) diff --git a/src/db/wallets/createWalletDetails.ts b/src/shared/db/wallets/createWalletDetails.ts similarity index 98% rename from src/db/wallets/createWalletDetails.ts rename to src/shared/db/wallets/createWalletDetails.ts index 13f89c41a..2dbb2f242 100644 --- a/src/db/wallets/createWalletDetails.ts +++ b/src/shared/db/wallets/createWalletDetails.ts @@ -1,5 +1,5 @@ import type { Address } from "thirdweb"; -import type { PrismaTransaction } from "../../schema/prisma"; +import type { PrismaTransaction } from "../../schemas/prisma"; import { encrypt } from "../../utils/crypto"; import { getPrismaWithPostgresTx } from "../client"; diff --git a/src/db/wallets/deleteWalletDetails.ts b/src/shared/db/wallets/deleteWalletDetails.ts similarity index 100% rename from src/db/wallets/deleteWalletDetails.ts rename to src/shared/db/wallets/deleteWalletDetails.ts diff --git a/src/db/wallets/getAllWallets.ts b/src/shared/db/wallets/getAllWallets.ts similarity index 86% rename from src/db/wallets/getAllWallets.ts rename to src/shared/db/wallets/getAllWallets.ts index fd8ef80a0..5f0603e81 100644 --- a/src/db/wallets/getAllWallets.ts +++ b/src/shared/db/wallets/getAllWallets.ts @@ -1,4 +1,4 @@ -import { PrismaTransaction } from "../../schema/prisma"; +import { PrismaTransaction } from "../../schemas/prisma"; import { getPrismaWithPostgresTx } from "../client"; interface GetAllWalletsParams { diff --git a/src/db/wallets/getWalletDetails.ts b/src/shared/db/wallets/getWalletDetails.ts similarity index 99% rename from src/db/wallets/getWalletDetails.ts rename to src/shared/db/wallets/getWalletDetails.ts index fcc8db3f5..fcbc8e9d6 100644 --- a/src/db/wallets/getWalletDetails.ts +++ b/src/shared/db/wallets/getWalletDetails.ts @@ -1,6 +1,6 @@ import { getAddress } from "thirdweb"; import { z } from "zod"; -import type { PrismaTransaction } from "../../schema/prisma"; +import type { PrismaTransaction } from "../../schemas/prisma"; import { getConfig } from "../../utils/cache/getConfig"; import { decrypt } from "../../utils/crypto"; import { env } from "../../utils/env"; diff --git a/src/db/wallets/nonceMap.ts b/src/shared/db/wallets/nonceMap.ts similarity index 98% rename from src/db/wallets/nonceMap.ts rename to src/shared/db/wallets/nonceMap.ts index 868b00dcc..aac67c2be 100644 --- a/src/db/wallets/nonceMap.ts +++ b/src/shared/db/wallets/nonceMap.ts @@ -1,4 +1,4 @@ -import { Address } from "thirdweb"; +import type { Address } from "thirdweb"; import { env } from "../../utils/env"; import { normalizeAddress } from "../../utils/primitiveTypes"; import { redis } from "../../utils/redis/redis"; diff --git a/src/db/wallets/updateWalletDetails.ts b/src/shared/db/wallets/updateWalletDetails.ts similarity index 100% rename from src/db/wallets/updateWalletDetails.ts rename to src/shared/db/wallets/updateWalletDetails.ts diff --git a/src/db/wallets/walletNonce.ts b/src/shared/db/wallets/walletNonce.ts similarity index 100% rename from src/db/wallets/walletNonce.ts rename to src/shared/db/wallets/walletNonce.ts diff --git a/src/db/webhooks/createWebhook.ts b/src/shared/db/webhooks/createWebhook.ts similarity index 91% rename from src/db/webhooks/createWebhook.ts rename to src/shared/db/webhooks/createWebhook.ts index 8e8bb66d7..7c32a5f13 100644 --- a/src/db/webhooks/createWebhook.ts +++ b/src/shared/db/webhooks/createWebhook.ts @@ -1,6 +1,6 @@ import { Webhooks } from "@prisma/client"; import { createHash, randomBytes } from "crypto"; -import { WebhooksEventTypes } from "../../schema/webhooks"; +import { WebhooksEventTypes } from "../../schemas/webhooks"; import { prisma } from "../client"; interface CreateWebhooksParams { diff --git a/src/db/webhooks/getAllWebhooks.ts b/src/shared/db/webhooks/getAllWebhooks.ts similarity index 100% rename from src/db/webhooks/getAllWebhooks.ts rename to src/shared/db/webhooks/getAllWebhooks.ts diff --git a/src/db/webhooks/getWebhook.ts b/src/shared/db/webhooks/getWebhook.ts similarity index 100% rename from src/db/webhooks/getWebhook.ts rename to src/shared/db/webhooks/getWebhook.ts diff --git a/src/db/webhooks/revokeWebhook.ts b/src/shared/db/webhooks/revokeWebhook.ts similarity index 100% rename from src/db/webhooks/revokeWebhook.ts rename to src/shared/db/webhooks/revokeWebhook.ts diff --git a/src/lib/cache/swr.ts b/src/shared/lib/cache/swr.ts similarity index 100% rename from src/lib/cache/swr.ts rename to src/shared/lib/cache/swr.ts diff --git a/src/lib/chain/chain-capabilities.ts b/src/shared/lib/chain/chain-capabilities.ts similarity index 100% rename from src/lib/chain/chain-capabilities.ts rename to src/shared/lib/chain/chain-capabilities.ts diff --git a/src/lib/transaction/get-transaction-receipt.ts b/src/shared/lib/transaction/get-transaction-receipt.ts similarity index 100% rename from src/lib/transaction/get-transaction-receipt.ts rename to src/shared/lib/transaction/get-transaction-receipt.ts diff --git a/src/server/schemas/auth/index.ts b/src/shared/schemas/auth.ts similarity index 100% rename from src/server/schemas/auth/index.ts rename to src/shared/schemas/auth.ts diff --git a/src/schema/config.ts b/src/shared/schemas/config.ts similarity index 100% rename from src/schema/config.ts rename to src/shared/schemas/config.ts diff --git a/src/schema/extension.ts b/src/shared/schemas/extension.ts similarity index 100% rename from src/schema/extension.ts rename to src/shared/schemas/extension.ts diff --git a/src/server/schemas/keypairs.ts b/src/shared/schemas/keypair.ts similarity index 93% rename from src/server/schemas/keypairs.ts rename to src/shared/schemas/keypair.ts index 31a3a7bc7..5e0a85bc3 100644 --- a/src/server/schemas/keypairs.ts +++ b/src/shared/schemas/keypair.ts @@ -1,5 +1,5 @@ -import { Keypairs } from "@prisma/client"; -import { Static, Type } from "@sinclair/typebox"; +import type { Keypairs } from "@prisma/client"; +import { type Static, Type } from "@sinclair/typebox"; // https://github.com/auth0/node-jsonwebtoken#algorithms-supported const _supportedAlgorithms = [ diff --git a/src/schema/prisma.ts b/src/shared/schemas/prisma.ts similarity index 100% rename from src/schema/prisma.ts rename to src/shared/schemas/prisma.ts diff --git a/src/constants/relayer.ts b/src/shared/schemas/relayer.ts similarity index 100% rename from src/constants/relayer.ts rename to src/shared/schemas/relayer.ts diff --git a/src/schema/wallet.ts b/src/shared/schemas/wallet.ts similarity index 100% rename from src/schema/wallet.ts rename to src/shared/schemas/wallet.ts diff --git a/src/schema/webhooks.ts b/src/shared/schemas/webhooks.ts similarity index 100% rename from src/schema/webhooks.ts rename to src/shared/schemas/webhooks.ts diff --git a/src/utils/account.ts b/src/shared/utils/account.ts similarity index 93% rename from src/utils/account.ts rename to src/shared/utils/account.ts index 0c8373f7d..ef3d83e68 100644 --- a/src/utils/account.ts +++ b/src/shared/utils/account.ts @@ -6,15 +6,15 @@ import { isSmartBackendWallet, type ParsedWalletDetails, } from "../db/wallets/getWalletDetails"; -import { WalletType } from "../schema/wallet"; -import { splitAwsKmsArn } from "../server/utils/wallets/awsKmsArn"; -import { getConnectedSmartWallet } from "../server/utils/wallets/createSmartWallet"; -import { getAwsKmsAccount } from "../server/utils/wallets/getAwsKmsAccount"; -import { getGcpKmsAccount } from "../server/utils/wallets/getGcpKmsAccount"; +import { WalletType } from "../schemas/wallet"; +import { splitAwsKmsArn } from "../../server/utils/wallets/awsKmsArn"; +import { getConnectedSmartWallet } from "../../server/utils/wallets/createSmartWallet"; +import { getAwsKmsAccount } from "../../server/utils/wallets/getAwsKmsAccount"; +import { getGcpKmsAccount } from "../../server/utils/wallets/getGcpKmsAccount"; import { encryptedJsonToAccount, getLocalWalletAccount, -} from "../server/utils/wallets/getLocalWallet"; +} from "../../server/utils/wallets/getLocalWallet"; import { getSmartWalletV5 } from "./cache/getSmartWalletV5"; import { getChain } from "./chain"; import { thirdwebClient } from "./sdk"; diff --git a/src/utils/auth.ts b/src/shared/utils/auth.ts similarity index 100% rename from src/utils/auth.ts rename to src/shared/utils/auth.ts diff --git a/src/utils/block.ts b/src/shared/utils/block.ts similarity index 100% rename from src/utils/block.ts rename to src/shared/utils/block.ts diff --git a/src/utils/cache/accessToken.ts b/src/shared/utils/cache/accessToken.ts similarity index 100% rename from src/utils/cache/accessToken.ts rename to src/shared/utils/cache/accessToken.ts diff --git a/src/utils/cache/authWallet.ts b/src/shared/utils/cache/authWallet.ts similarity index 100% rename from src/utils/cache/authWallet.ts rename to src/shared/utils/cache/authWallet.ts diff --git a/src/utils/cache/clearCache.ts b/src/shared/utils/cache/clearCache.ts similarity index 100% rename from src/utils/cache/clearCache.ts rename to src/shared/utils/cache/clearCache.ts diff --git a/src/utils/cache/getConfig.ts b/src/shared/utils/cache/getConfig.ts similarity index 86% rename from src/utils/cache/getConfig.ts rename to src/shared/utils/cache/getConfig.ts index 59b9850e9..f18937576 100644 --- a/src/utils/cache/getConfig.ts +++ b/src/shared/utils/cache/getConfig.ts @@ -1,5 +1,5 @@ import { getConfiguration } from "../../db/configuration/getConfiguration"; -import type { ParsedConfig } from "../../schema/config"; +import type { ParsedConfig } from "../../schemas/config"; let _config: ParsedConfig | null = null; diff --git a/src/utils/cache/getContract.ts b/src/shared/utils/cache/getContract.ts similarity index 82% rename from src/utils/cache/getContract.ts rename to src/shared/utils/cache/getContract.ts index 4ace9a679..b9b4dcb51 100644 --- a/src/utils/cache/getContract.ts +++ b/src/shared/utils/cache/getContract.ts @@ -1,7 +1,7 @@ -import { Static, Type } from "@sinclair/typebox"; +import { type Static, Type } from "@sinclair/typebox"; import { StatusCodes } from "http-status-codes"; -import { createCustomError } from "../../server/middleware/error"; -import { abiSchema } from "../../server/schemas/contract"; +import { createCustomError } from "../../../server/middleware/error"; +import { abiSchema } from "../../../server/schemas/contract"; import { getSdk } from "./getSdk"; const abiArraySchema = Type.Array(abiSchema); diff --git a/src/utils/cache/getContractv5.ts b/src/shared/utils/cache/getContractv5.ts similarity index 100% rename from src/utils/cache/getContractv5.ts rename to src/shared/utils/cache/getContractv5.ts diff --git a/src/utils/cache/getSdk.ts b/src/shared/utils/cache/getSdk.ts similarity index 97% rename from src/utils/cache/getSdk.ts rename to src/shared/utils/cache/getSdk.ts index 42c754610..f15781715 100644 --- a/src/utils/cache/getSdk.ts +++ b/src/shared/utils/cache/getSdk.ts @@ -2,7 +2,7 @@ import { Type } from "@sinclair/typebox"; import { ThirdwebSDK } from "@thirdweb-dev/sdk"; import LRUMap from "mnemonist/lru-map"; import { getChainMetadata } from "thirdweb/chains"; -import { badChainError } from "../../server/middleware/error"; +import { badChainError } from "../../../server/middleware/error"; import { getChain } from "../chain"; import { env } from "../env"; import { getWallet } from "./getWallet"; diff --git a/src/utils/cache/getSmartWalletV5.ts b/src/shared/utils/cache/getSmartWalletV5.ts similarity index 100% rename from src/utils/cache/getSmartWalletV5.ts rename to src/shared/utils/cache/getSmartWalletV5.ts diff --git a/src/utils/cache/getWallet.ts b/src/shared/utils/cache/getWallet.ts similarity index 91% rename from src/utils/cache/getWallet.ts rename to src/shared/utils/cache/getWallet.ts index 6b078594b..520cf924f 100644 --- a/src/utils/cache/getWallet.ts +++ b/src/shared/utils/cache/getWallet.ts @@ -7,13 +7,13 @@ import { getWalletDetails, type ParsedWalletDetails, } from "../../db/wallets/getWalletDetails"; -import type { PrismaTransaction } from "../../schema/prisma"; -import { WalletType } from "../../schema/wallet"; -import { createCustomError } from "../../server/middleware/error"; -import { splitAwsKmsArn } from "../../server/utils/wallets/awsKmsArn"; -import { splitGcpKmsResourcePath } from "../../server/utils/wallets/gcpKmsResourcePath"; -import { getLocalWallet } from "../../server/utils/wallets/getLocalWallet"; -import { getSmartWallet } from "../../server/utils/wallets/getSmartWallet"; +import type { PrismaTransaction } from "../../schemas/prisma"; +import { WalletType } from "../../schemas/wallet"; +import { createCustomError } from "../../../server/middleware/error"; +import { splitAwsKmsArn } from "../../../server/utils/wallets/awsKmsArn"; +import { splitGcpKmsResourcePath } from "../../../server/utils/wallets/gcpKmsResourcePath"; +import { getLocalWallet } from "../../../server/utils/wallets/getLocalWallet"; +import { getSmartWallet } from "../../../server/utils/wallets/getSmartWallet"; export const walletsCache = new LRUMap(2048); diff --git a/src/utils/cache/getWebhook.ts b/src/shared/utils/cache/getWebhook.ts similarity index 91% rename from src/utils/cache/getWebhook.ts rename to src/shared/utils/cache/getWebhook.ts index ded5543df..1ed9df187 100644 --- a/src/utils/cache/getWebhook.ts +++ b/src/shared/utils/cache/getWebhook.ts @@ -1,7 +1,7 @@ import type { Webhooks } from "@prisma/client"; import LRUMap from "mnemonist/lru-map"; import { getAllWebhooks } from "../../db/webhooks/getAllWebhooks"; -import type { WebhooksEventTypes } from "../../schema/webhooks"; +import type { WebhooksEventTypes } from "../../schemas/webhooks"; export const webhookCache = new LRUMap(2048); diff --git a/src/utils/cache/keypair.ts b/src/shared/utils/cache/keypair.ts similarity index 100% rename from src/utils/cache/keypair.ts rename to src/shared/utils/cache/keypair.ts diff --git a/src/utils/chain.ts b/src/shared/utils/chain.ts similarity index 100% rename from src/utils/chain.ts rename to src/shared/utils/chain.ts diff --git a/src/utils/cron/clearCacheCron.ts b/src/shared/utils/cron/clearCacheCron.ts similarity index 100% rename from src/utils/cron/clearCacheCron.ts rename to src/shared/utils/cron/clearCacheCron.ts diff --git a/src/utils/cron/isValidCron.ts b/src/shared/utils/cron/isValidCron.ts similarity index 96% rename from src/utils/cron/isValidCron.ts rename to src/shared/utils/cron/isValidCron.ts index f0ea16ccf..abfdc5715 100644 --- a/src/utils/cron/isValidCron.ts +++ b/src/shared/utils/cron/isValidCron.ts @@ -1,6 +1,6 @@ import cronParser from "cron-parser"; import { StatusCodes } from "http-status-codes"; -import { createCustomError } from "../../server/middleware/error"; +import { createCustomError } from "../../../server/middleware/error"; export const isValidCron = (input: string): boolean => { try { diff --git a/src/utils/crypto.ts b/src/shared/utils/crypto.ts similarity index 100% rename from src/utils/crypto.ts rename to src/shared/utils/crypto.ts diff --git a/src/utils/date.ts b/src/shared/utils/date.ts similarity index 100% rename from src/utils/date.ts rename to src/shared/utils/date.ts diff --git a/src/utils/env.ts b/src/shared/utils/env.ts similarity index 100% rename from src/utils/env.ts rename to src/shared/utils/env.ts diff --git a/src/utils/error.ts b/src/shared/utils/error.ts similarity index 100% rename from src/utils/error.ts rename to src/shared/utils/error.ts diff --git a/src/utils/ethers.ts b/src/shared/utils/ethers.ts similarity index 100% rename from src/utils/ethers.ts rename to src/shared/utils/ethers.ts diff --git a/src/utils/indexer/getBlockTime.ts b/src/shared/utils/indexer/getBlockTime.ts similarity index 100% rename from src/utils/indexer/getBlockTime.ts rename to src/shared/utils/indexer/getBlockTime.ts diff --git a/src/utils/logger.ts b/src/shared/utils/logger.ts similarity index 100% rename from src/utils/logger.ts rename to src/shared/utils/logger.ts diff --git a/src/utils/math.ts b/src/shared/utils/math.ts similarity index 100% rename from src/utils/math.ts rename to src/shared/utils/math.ts diff --git a/src/utils/primitiveTypes.ts b/src/shared/utils/primitiveTypes.ts similarity index 100% rename from src/utils/primitiveTypes.ts rename to src/shared/utils/primitiveTypes.ts diff --git a/src/utils/prometheus.ts b/src/shared/utils/prometheus.ts similarity index 98% rename from src/utils/prometheus.ts rename to src/shared/utils/prometheus.ts index abfb9b8e0..dbada9ad4 100644 --- a/src/utils/prometheus.ts +++ b/src/shared/utils/prometheus.ts @@ -1,7 +1,7 @@ import fastify from "fastify"; import { Counter, Gauge, Histogram, Registry } from "prom-client"; import { getUsedBackendWallets, inspectNonce } from "../db/wallets/walletNonce"; -import { getLastUsedOnchainNonce } from "../server/routes/admin/nonces"; +import { getLastUsedOnchainNonce } from "../../server/routes/admin/nonces"; const nonceMetrics = new Gauge({ name: "engine_nonces", diff --git a/src/utils/redis/lock.ts b/src/shared/utils/redis/lock.ts similarity index 100% rename from src/utils/redis/lock.ts rename to src/shared/utils/redis/lock.ts diff --git a/src/utils/redis/redis.ts b/src/shared/utils/redis/redis.ts similarity index 100% rename from src/utils/redis/redis.ts rename to src/shared/utils/redis/redis.ts diff --git a/src/utils/sdk.ts b/src/shared/utils/sdk.ts similarity index 100% rename from src/utils/sdk.ts rename to src/shared/utils/sdk.ts diff --git a/src/utils/transaction/cancelTransaction.ts b/src/shared/utils/transaction/cancelTransaction.ts similarity index 100% rename from src/utils/transaction/cancelTransaction.ts rename to src/shared/utils/transaction/cancelTransaction.ts diff --git a/src/utils/transaction/insertTransaction.ts b/src/shared/utils/transaction/insertTransaction.ts similarity index 95% rename from src/utils/transaction/insertTransaction.ts rename to src/shared/utils/transaction/insertTransaction.ts index fe79018fb..5d4f33da4 100644 --- a/src/utils/transaction/insertTransaction.ts +++ b/src/shared/utils/transaction/insertTransaction.ts @@ -1,14 +1,14 @@ import { StatusCodes } from "http-status-codes"; import { randomUUID } from "node:crypto"; -import { TransactionDB } from "../../db/transactions/db"; +import { TransactionDB } from "../../../shared/db/transactions/db"; import { getWalletDetails, isSmartBackendWallet, type ParsedWalletDetails, -} from "../../db/wallets/getWalletDetails"; +} from "../../../shared/db/wallets/getWalletDetails"; import { doesChainSupportService } from "../../lib/chain/chain-capabilities"; -import { createCustomError } from "../../server/middleware/error"; -import { SendTransactionQueue } from "../../worker/queues/sendTransactionQueue"; +import { createCustomError } from "../../../server/middleware/error"; +import { SendTransactionQueue } from "../../../worker/queues/sendTransactionQueue"; import { getChecksumAddress } from "../primitiveTypes"; import { recordMetrics } from "../prometheus"; import { reportUsage } from "../usage"; diff --git a/src/utils/transaction/queueTransation.ts b/src/shared/utils/transaction/queueTransation.ts similarity index 90% rename from src/utils/transaction/queueTransation.ts rename to src/shared/utils/transaction/queueTransation.ts index cdaf2245d..e883a83aa 100644 --- a/src/utils/transaction/queueTransation.ts +++ b/src/shared/utils/transaction/queueTransation.ts @@ -7,9 +7,9 @@ import { type PreparedTransaction, } from "thirdweb"; import { resolvePromisedValue } from "thirdweb/utils"; -import { createCustomError } from "../../server/middleware/error"; -import type { txOverridesWithValueSchema } from "../../server/schemas/txOverrides"; -import { parseTransactionOverrides } from "../../server/utils/transactionOverrides"; +import { createCustomError } from "../../../server/middleware/error"; +import type { txOverridesWithValueSchema } from "../../../server/schemas/txOverrides"; +import { parseTransactionOverrides } from "../../../server/utils/transactionOverrides"; import { prettifyError } from "../error"; import { insertTransaction } from "./insertTransaction"; import type { InsertedTransaction } from "./types"; diff --git a/src/utils/transaction/simulateQueuedTransaction.ts b/src/shared/utils/transaction/simulateQueuedTransaction.ts similarity index 100% rename from src/utils/transaction/simulateQueuedTransaction.ts rename to src/shared/utils/transaction/simulateQueuedTransaction.ts diff --git a/src/utils/transaction/types.ts b/src/shared/utils/transaction/types.ts similarity index 100% rename from src/utils/transaction/types.ts rename to src/shared/utils/transaction/types.ts diff --git a/src/utils/transaction/webhook.ts b/src/shared/utils/transaction/webhook.ts similarity index 80% rename from src/utils/transaction/webhook.ts rename to src/shared/utils/transaction/webhook.ts index 40cb71ed0..159844a9d 100644 --- a/src/utils/transaction/webhook.ts +++ b/src/shared/utils/transaction/webhook.ts @@ -1,5 +1,5 @@ -import { WebhooksEventTypes } from "../../schema/webhooks"; -import { SendWebhookQueue } from "../../worker/queues/sendWebhookQueue"; +import { WebhooksEventTypes } from "../../schemas/webhooks"; +import { SendWebhookQueue } from "../../../worker/queues/sendWebhookQueue"; import type { AnyTransaction } from "./types"; export const enqueueTransactionWebhook = async ( diff --git a/src/utils/usage.ts b/src/shared/utils/usage.ts similarity index 86% rename from src/utils/usage.ts rename to src/shared/utils/usage.ts index 002c437c8..97de003e3 100644 --- a/src/utils/usage.ts +++ b/src/shared/utils/usage.ts @@ -1,12 +1,12 @@ -import { Static } from "@sinclair/typebox"; -import { UsageEvent } from "@thirdweb-dev/service-utils/cf-worker"; -import { FastifyInstance } from "fastify"; -import { Address, Hex } from "thirdweb"; -import { ADMIN_QUEUES_BASEPATH } from "../server/middleware/adminRoutes"; -import { OPENAPI_ROUTES } from "../server/middleware/openApi"; -import { contractParamSchema } from "../server/schemas/sharedApiSchemas"; -import { walletWithAddressParamSchema } from "../server/schemas/wallet"; -import { getChainIdFromChain } from "../server/utils/chain"; +import type { Static } from "@sinclair/typebox"; +import type { UsageEvent } from "@thirdweb-dev/service-utils/cf-worker"; +import type { FastifyInstance } from "fastify"; +import type { Address, Hex } from "thirdweb"; +import { ADMIN_QUEUES_BASEPATH } from "../../server/middleware/adminRoutes"; +import { OPENAPI_ROUTES } from "../../server/middleware/openApi"; +import type { contractParamSchema } from "../../server/schemas/sharedApiSchemas"; +import type { walletWithAddressParamSchema } from "../../server/schemas/wallet"; +import { getChainIdFromChain } from "../../server/utils/chain"; import { env } from "./env"; import { logger } from "./logger"; import { thirdwebClientId } from "./sdk"; diff --git a/src/utils/webhook.ts b/src/shared/utils/webhook.ts similarity index 100% rename from src/utils/webhook.ts rename to src/shared/utils/webhook.ts diff --git a/src/utils/tracer.ts b/src/tracer.ts similarity index 79% rename from src/utils/tracer.ts rename to src/tracer.ts index c07e15c1a..4aae137e3 100644 --- a/src/utils/tracer.ts +++ b/src/tracer.ts @@ -1,5 +1,5 @@ import tracer from "dd-trace"; -import { env } from "./env"; +import { env } from "./shared/utils/env"; if (env.DD_TRACER_ACTIVATED) { tracer.init(); // initialized in a different file to avoid hoisting. diff --git a/src/worker/indexers/chainIndexerRegistry.ts b/src/worker/indexers/chainIndexerRegistry.ts index df37adde8..760b556f1 100644 --- a/src/worker/indexers/chainIndexerRegistry.ts +++ b/src/worker/indexers/chainIndexerRegistry.ts @@ -1,6 +1,6 @@ import cron from "node-cron"; -import { getBlockTimeSeconds } from "../../utils/indexer/getBlockTime"; -import { logger } from "../../utils/logger"; +import { getBlockTimeSeconds } from "../../shared/utils/indexer/getBlockTime"; +import { logger } from "../../shared/utils/logger"; import { handleContractSubscriptions } from "../tasks/chainIndexer"; // @TODO: Move all worker logic to Bullmq to better handle multiple hosts. diff --git a/src/worker/listeners/chainIndexerListener.ts b/src/worker/listeners/chainIndexerListener.ts index e7be532dc..186aee895 100644 --- a/src/worker/listeners/chainIndexerListener.ts +++ b/src/worker/listeners/chainIndexerListener.ts @@ -1,6 +1,6 @@ import cron from "node-cron"; -import { getConfig } from "../../utils/cache/getConfig"; -import { logger } from "../../utils/logger"; +import { getConfig } from "../../shared/utils/cache/getConfig"; +import { logger } from "../../shared/utils/logger"; import { manageChainIndexers } from "../tasks/manageChainIndexers"; let processChainIndexerStarted = false; diff --git a/src/worker/listeners/configListener.ts b/src/worker/listeners/configListener.ts index 48213c731..62594280d 100644 --- a/src/worker/listeners/configListener.ts +++ b/src/worker/listeners/configListener.ts @@ -1,7 +1,7 @@ -import { knex } from "../../db/client"; -import { getConfig } from "../../utils/cache/getConfig"; -import { clearCacheCron } from "../../utils/cron/clearCacheCron"; -import { logger } from "../../utils/logger"; +import { knex } from "../../shared/db/client"; +import { getConfig } from "../../shared/utils/cache/getConfig"; +import { clearCacheCron } from "../../shared/utils/cron/clearCacheCron"; +import { logger } from "../../shared/utils/logger"; import { chainIndexerListener } from "./chainIndexerListener"; export const newConfigurationListener = async (): Promise => { diff --git a/src/worker/listeners/webhookListener.ts b/src/worker/listeners/webhookListener.ts index 2ab19ba2f..d1ab64e18 100644 --- a/src/worker/listeners/webhookListener.ts +++ b/src/worker/listeners/webhookListener.ts @@ -1,6 +1,6 @@ -import { knex } from "../../db/client"; -import { webhookCache } from "../../utils/cache/getWebhook"; -import { logger } from "../../utils/logger"; +import { knex } from "../../shared/db/client"; +import { webhookCache } from "../../shared/utils/cache/getWebhook"; +import { logger } from "../../shared/utils/logger"; export const newWebhooksListener = async (): Promise => { logger({ diff --git a/src/worker/queues/cancelRecycledNoncesQueue.ts b/src/worker/queues/cancelRecycledNoncesQueue.ts index ff2991d52..28bc4fde9 100644 --- a/src/worker/queues/cancelRecycledNoncesQueue.ts +++ b/src/worker/queues/cancelRecycledNoncesQueue.ts @@ -1,5 +1,5 @@ import { Queue } from "bullmq"; -import { redis } from "../../utils/redis/redis"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; export class CancelRecycledNoncesQueue { diff --git a/src/worker/queues/migratePostgresTransactionsQueue.ts b/src/worker/queues/migratePostgresTransactionsQueue.ts index 5e3100080..b24498c6d 100644 --- a/src/worker/queues/migratePostgresTransactionsQueue.ts +++ b/src/worker/queues/migratePostgresTransactionsQueue.ts @@ -1,5 +1,5 @@ import { Queue } from "bullmq"; -import { redis } from "../../utils/redis/redis"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; export class MigratePostgresTransactionsQueue { diff --git a/src/worker/queues/mineTransactionQueue.ts b/src/worker/queues/mineTransactionQueue.ts index e35627272..f3a0f09ba 100644 --- a/src/worker/queues/mineTransactionQueue.ts +++ b/src/worker/queues/mineTransactionQueue.ts @@ -1,6 +1,6 @@ import { Queue } from "bullmq"; import superjson from "superjson"; -import { redis } from "../../utils/redis/redis"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; export type MineTransactionData = { diff --git a/src/worker/queues/nonceHealthCheckQueue.ts b/src/worker/queues/nonceHealthCheckQueue.ts index 31795e7ec..80ddf5453 100644 --- a/src/worker/queues/nonceHealthCheckQueue.ts +++ b/src/worker/queues/nonceHealthCheckQueue.ts @@ -1,5 +1,5 @@ import { Queue } from "bullmq"; -import { redis } from "../../utils/redis/redis"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; export class NonceHealthCheckQueue { diff --git a/src/worker/queues/nonceResyncQueue.ts b/src/worker/queues/nonceResyncQueue.ts index 23fbf22bc..59ca44b65 100644 --- a/src/worker/queues/nonceResyncQueue.ts +++ b/src/worker/queues/nonceResyncQueue.ts @@ -1,5 +1,5 @@ import { Queue } from "bullmq"; -import { redis } from "../../utils/redis/redis"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; export class NonceResyncQueue { diff --git a/src/worker/queues/processEventLogsQueue.ts b/src/worker/queues/processEventLogsQueue.ts index 1c32ad36f..de3c97a0d 100644 --- a/src/worker/queues/processEventLogsQueue.ts +++ b/src/worker/queues/processEventLogsQueue.ts @@ -1,8 +1,8 @@ import { Queue } from "bullmq"; import SuperJSON from "superjson"; -import { Address } from "thirdweb"; -import { getConfig } from "../../utils/cache/getConfig"; -import { redis } from "../../utils/redis/redis"; +import type { Address } from "thirdweb"; +import { getConfig } from "../../shared/utils/cache/getConfig"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; // Each job handles a block range for a given chain, filtered by addresses + events. diff --git a/src/worker/queues/processTransactionReceiptsQueue.ts b/src/worker/queues/processTransactionReceiptsQueue.ts index 0f595e73f..6ee7c7557 100644 --- a/src/worker/queues/processTransactionReceiptsQueue.ts +++ b/src/worker/queues/processTransactionReceiptsQueue.ts @@ -1,8 +1,8 @@ import { Queue } from "bullmq"; import superjson from "superjson"; -import { Address } from "thirdweb"; -import { getConfig } from "../../utils/cache/getConfig"; -import { redis } from "../../utils/redis/redis"; +import type { Address } from "thirdweb"; +import { getConfig } from "../../shared/utils/cache/getConfig"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; // Each job handles a block range for a given chain, filtered by addresses + events. diff --git a/src/worker/queues/pruneTransactionsQueue.ts b/src/worker/queues/pruneTransactionsQueue.ts index 717162f77..5786346cd 100644 --- a/src/worker/queues/pruneTransactionsQueue.ts +++ b/src/worker/queues/pruneTransactionsQueue.ts @@ -1,5 +1,5 @@ import { Queue } from "bullmq"; -import { redis } from "../../utils/redis/redis"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; export class PruneTransactionsQueue { diff --git a/src/worker/queues/queues.ts b/src/worker/queues/queues.ts index d22534c37..6331d3a8d 100644 --- a/src/worker/queues/queues.ts +++ b/src/worker/queues/queues.ts @@ -1,6 +1,6 @@ import type { Job, JobsOptions, Worker } from "bullmq"; -import { env } from "../../utils/env"; -import { logger } from "../../utils/logger"; +import { env } from "../../shared/utils/env"; +import { logger } from "../../shared/utils/logger"; export const defaultJobOptions: JobsOptions = { // Does not retry by default. Queues must explicitly define their own retry count and backoff behavior. diff --git a/src/worker/queues/sendTransactionQueue.ts b/src/worker/queues/sendTransactionQueue.ts index ba93068b8..4f4db261b 100644 --- a/src/worker/queues/sendTransactionQueue.ts +++ b/src/worker/queues/sendTransactionQueue.ts @@ -1,6 +1,6 @@ import { Queue } from "bullmq"; import superjson from "superjson"; -import { redis } from "../../utils/redis/redis"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; export type SendTransactionData = { diff --git a/src/worker/queues/sendWebhookQueue.ts b/src/worker/queues/sendWebhookQueue.ts index 1861e4375..a39bb7468 100644 --- a/src/worker/queues/sendWebhookQueue.ts +++ b/src/worker/queues/sendWebhookQueue.ts @@ -8,10 +8,10 @@ import SuperJSON from "superjson"; import { WebhooksEventTypes, type BackendWalletBalanceWebhookParams, -} from "../../schema/webhooks"; -import { getWebhooksByEventType } from "../../utils/cache/getWebhook"; -import { logger } from "../../utils/logger"; -import { redis } from "../../utils/redis/redis"; +} from "../../shared/schemas/webhooks"; +import { getWebhooksByEventType } from "../../shared/utils/cache/getWebhook"; +import { logger } from "../../shared/utils/logger"; +import { redis } from "../../shared/utils/redis/redis"; import { defaultJobOptions } from "./queues"; export type EnqueueContractSubscriptionWebhookData = { diff --git a/src/worker/tasks/cancelRecycledNoncesWorker.ts b/src/worker/tasks/cancelRecycledNoncesWorker.ts index 6b8b6a125..2fa58212a 100644 --- a/src/worker/tasks/cancelRecycledNoncesWorker.ts +++ b/src/worker/tasks/cancelRecycledNoncesWorker.ts @@ -1,10 +1,10 @@ -import { Job, Processor, Worker } from "bullmq"; -import { Address } from "thirdweb"; -import { recycleNonce } from "../../db/wallets/walletNonce"; -import { isNonceAlreadyUsedError } from "../../utils/error"; -import { logger } from "../../utils/logger"; -import { redis } from "../../utils/redis/redis"; -import { sendCancellationTransaction } from "../../utils/transaction/cancelTransaction"; +import { type Job, type Processor, Worker } from "bullmq"; +import type { Address } from "thirdweb"; +import { recycleNonce } from "../../shared/db/wallets/walletNonce"; +import { isNonceAlreadyUsedError } from "../../shared/utils/error"; +import { logger } from "../../shared/utils/logger"; +import { redis } from "../../shared/utils/redis/redis"; +import { sendCancellationTransaction } from "../../shared/utils/transaction/cancelTransaction"; import { CancelRecycledNoncesQueue } from "../queues/cancelRecycledNoncesQueue"; import { logWorkerExceptions } from "../queues/queues"; diff --git a/src/worker/tasks/chainIndexer.ts b/src/worker/tasks/chainIndexer.ts index a7fbcc304..41bf92288 100644 --- a/src/worker/tasks/chainIndexer.ts +++ b/src/worker/tasks/chainIndexer.ts @@ -4,13 +4,13 @@ import { getRpcClient, type Address, } from "thirdweb"; -import { getBlockForIndexing } from "../../db/chainIndexers/getChainIndexer"; -import { upsertChainIndexer } from "../../db/chainIndexers/upsertChainIndexer"; -import { prisma } from "../../db/client"; -import { getContractSubscriptionsByChainId } from "../../db/contractSubscriptions/getContractSubscriptions"; -import { getChain } from "../../utils/chain"; -import { logger } from "../../utils/logger"; -import { thirdwebClient } from "../../utils/sdk"; +import { getBlockForIndexing } from "../../shared/db/chainIndexers/getChainIndexer"; +import { upsertChainIndexer } from "../../shared/db/chainIndexers/upsertChainIndexer"; +import { prisma } from "../../shared/db/client"; +import { getContractSubscriptionsByChainId } from "../../shared/db/contractSubscriptions/getContractSubscriptions"; +import { getChain } from "../../shared/utils/chain"; +import { logger } from "../../shared/utils/logger"; +import { thirdwebClient } from "../../shared/utils/sdk"; import { ProcessEventsLogQueue } from "../queues/processEventLogsQueue"; import { ProcessTransactionReceiptsQueue } from "../queues/processTransactionReceiptsQueue"; diff --git a/src/worker/tasks/manageChainIndexers.ts b/src/worker/tasks/manageChainIndexers.ts index 741562ee7..787f88116 100644 --- a/src/worker/tasks/manageChainIndexers.ts +++ b/src/worker/tasks/manageChainIndexers.ts @@ -1,4 +1,4 @@ -import { getContractSubscriptionsUniqueChainIds } from "../../db/contractSubscriptions/getContractSubscriptions"; +import { getContractSubscriptionsUniqueChainIds } from "../../shared/db/contractSubscriptions/getContractSubscriptions"; import { INDEXER_REGISTRY, addChainIndexer, diff --git a/src/worker/tasks/migratePostgresTransactionsWorker.ts b/src/worker/tasks/migratePostgresTransactionsWorker.ts index 7547d9b75..fb3b3c4e2 100644 --- a/src/worker/tasks/migratePostgresTransactionsWorker.ts +++ b/src/worker/tasks/migratePostgresTransactionsWorker.ts @@ -2,17 +2,20 @@ import type { Transactions } from "@prisma/client"; import { Worker, type Job, type Processor } from "bullmq"; import assert from "node:assert"; import type { Hex } from "thirdweb"; -import { getPrismaWithPostgresTx, prisma } from "../../db/client"; -import { TransactionDB } from "../../db/transactions/db"; -import type { PrismaTransaction } from "../../schema/prisma"; -import { getConfig } from "../../utils/cache/getConfig"; -import { logger } from "../../utils/logger"; -import { maybeBigInt, normalizeAddress } from "../../utils/primitiveTypes"; -import { redis } from "../../utils/redis/redis"; +import { getPrismaWithPostgresTx, prisma } from "../../shared/db/client"; +import { TransactionDB } from "../../shared/db/transactions/db"; +import type { PrismaTransaction } from "../../shared/schemas/prisma"; +import { getConfig } from "../../shared/utils/cache/getConfig"; +import { logger } from "../../shared/utils/logger"; +import { + maybeBigInt, + normalizeAddress, +} from "../../shared/utils/primitiveTypes"; +import { redis } from "../../shared/utils/redis/redis"; import type { QueuedTransaction, SentTransaction, -} from "../../utils/transaction/types"; +} from "../../shared/utils/transaction/types"; import { MigratePostgresTransactionsQueue } from "../queues/migratePostgresTransactionsQueue"; import { MineTransactionQueue } from "../queues/mineTransactionQueue"; import { logWorkerExceptions } from "../queues/queues"; diff --git a/src/worker/tasks/mineTransactionWorker.ts b/src/worker/tasks/mineTransactionWorker.ts index 1d3ce45f9..b8facc1fa 100644 --- a/src/worker/tasks/mineTransactionWorker.ts +++ b/src/worker/tasks/mineTransactionWorker.ts @@ -10,31 +10,34 @@ import { } from "thirdweb"; import { stringify } from "thirdweb/utils"; import { getUserOpReceipt } from "thirdweb/wallets/smart"; -import { TransactionDB } from "../../db/transactions/db"; -import { recycleNonce, removeSentNonce } from "../../db/wallets/walletNonce"; +import { TransactionDB } from "../../shared/db/transactions/db"; +import { + recycleNonce, + removeSentNonce, +} from "../../shared/db/wallets/walletNonce"; import { getReceiptForEOATransaction, getReceiptForUserOp, -} from "../../lib/transaction/get-transaction-receipt"; -import { WebhooksEventTypes } from "../../schema/webhooks"; -import { getBlockNumberish } from "../../utils/block"; -import { getConfig } from "../../utils/cache/getConfig"; -import { getWebhooksByEventType } from "../../utils/cache/getWebhook"; -import { getChain } from "../../utils/chain"; -import { msSince } from "../../utils/date"; -import { env } from "../../utils/env"; -import { prettifyError } from "../../utils/error"; -import { logger } from "../../utils/logger"; -import { recordMetrics } from "../../utils/prometheus"; -import { redis } from "../../utils/redis/redis"; -import { thirdwebClient } from "../../utils/sdk"; +} from "../../shared/lib/transaction/get-transaction-receipt"; +import { WebhooksEventTypes } from "../../shared/schemas/webhooks"; +import { getBlockNumberish } from "../../shared/utils/block"; +import { getConfig } from "../../shared/utils/cache/getConfig"; +import { getWebhooksByEventType } from "../../shared/utils/cache/getWebhook"; +import { getChain } from "../../shared/utils/chain"; +import { msSince } from "../../shared/utils/date"; +import { env } from "../../shared/utils/env"; +import { prettifyError } from "../../shared/utils/error"; +import { logger } from "../../shared/utils/logger"; +import { recordMetrics } from "../../shared/utils/prometheus"; +import { redis } from "../../shared/utils/redis/redis"; +import { thirdwebClient } from "../../shared/utils/sdk"; import type { ErroredTransaction, MinedTransaction, SentTransaction, -} from "../../utils/transaction/types"; -import { enqueueTransactionWebhook } from "../../utils/transaction/webhook"; -import { reportUsage } from "../../utils/usage"; +} from "../../shared/utils/transaction/types"; +import { enqueueTransactionWebhook } from "../../shared/utils/transaction/webhook"; +import { reportUsage } from "../../shared/utils/usage"; import { MineTransactionQueue, type MineTransactionData, diff --git a/src/worker/tasks/nonceHealthCheckWorker.ts b/src/worker/tasks/nonceHealthCheckWorker.ts index 4d528c0c8..2c2ab63a3 100644 --- a/src/worker/tasks/nonceHealthCheckWorker.ts +++ b/src/worker/tasks/nonceHealthCheckWorker.ts @@ -3,10 +3,10 @@ import { getAddress, type Address } from "thirdweb"; import { getUsedBackendWallets, inspectNonce, -} from "../../db/wallets/walletNonce"; +} from "../../shared/db/wallets/walletNonce"; import { getLastUsedOnchainNonce } from "../../server/routes/admin/nonces"; -import { logger } from "../../utils/logger"; -import { redis } from "../../utils/redis/redis"; +import { logger } from "../../shared/utils/logger"; +import { redis } from "../../shared/utils/redis/redis"; import { NonceHealthCheckQueue } from "../queues/nonceHealthCheckQueue"; import { logWorkerExceptions } from "../queues/queues"; diff --git a/src/worker/tasks/nonceResyncWorker.ts b/src/worker/tasks/nonceResyncWorker.ts index 8f5cb0c65..144390076 100644 --- a/src/worker/tasks/nonceResyncWorker.ts +++ b/src/worker/tasks/nonceResyncWorker.ts @@ -5,13 +5,13 @@ import { isSentNonce, recycleNonce, splitSentNoncesKey, -} from "../../db/wallets/walletNonce"; -import { getConfig } from "../../utils/cache/getConfig"; -import { getChain } from "../../utils/chain"; -import { prettifyError } from "../../utils/error"; -import { logger } from "../../utils/logger"; -import { redis } from "../../utils/redis/redis"; -import { thirdwebClient } from "../../utils/sdk"; +} from "../../shared/db/wallets/walletNonce"; +import { getConfig } from "../../shared/utils/cache/getConfig"; +import { getChain } from "../../shared/utils/chain"; +import { prettifyError } from "../../shared/utils/error"; +import { logger } from "../../shared/utils/logger"; +import { redis } from "../../shared/utils/redis/redis"; +import { thirdwebClient } from "../../shared/utils/sdk"; import { NonceResyncQueue } from "../queues/nonceResyncQueue"; import { logWorkerExceptions } from "../queues/queues"; diff --git a/src/worker/tasks/processEventLogsWorker.ts b/src/worker/tasks/processEventLogsWorker.ts index b3ad7c5fa..b1fd0c357 100644 --- a/src/worker/tasks/processEventLogsWorker.ts +++ b/src/worker/tasks/processEventLogsWorker.ts @@ -15,16 +15,16 @@ import { type ThirdwebContract, } from "thirdweb"; import { resolveContractAbi } from "thirdweb/contract"; -import { bulkInsertContractEventLogs } from "../../db/contractEventLogs/createContractEventLogs"; -import { getContractSubscriptionsByChainId } from "../../db/contractSubscriptions/getContractSubscriptions"; -import { WebhooksEventTypes } from "../../schema/webhooks"; -import { getChain } from "../../utils/chain"; -import { logger } from "../../utils/logger"; -import { normalizeAddress } from "../../utils/primitiveTypes"; -import { redis } from "../../utils/redis/redis"; -import { thirdwebClient } from "../../utils/sdk"; +import { bulkInsertContractEventLogs } from "../../shared/db/contractEventLogs/createContractEventLogs"; +import { getContractSubscriptionsByChainId } from "../../shared/db/contractSubscriptions/getContractSubscriptions"; +import { WebhooksEventTypes } from "../../shared/schemas/webhooks"; +import { getChain } from "../../shared/utils/chain"; +import { logger } from "../../shared/utils/logger"; +import { normalizeAddress } from "../../shared/utils/primitiveTypes"; +import { redis } from "../../shared/utils/redis/redis"; +import { thirdwebClient } from "../../shared/utils/sdk"; import { - EnqueueProcessEventLogsData, + type EnqueueProcessEventLogsData, ProcessEventsLogQueue, } from "../queues/processEventLogsQueue"; import { logWorkerExceptions } from "../queues/queues"; diff --git a/src/worker/tasks/processTransactionReceiptsWorker.ts b/src/worker/tasks/processTransactionReceiptsWorker.ts index d8cdb23ae..5bfb4e5a0 100644 --- a/src/worker/tasks/processTransactionReceiptsWorker.ts +++ b/src/worker/tasks/processTransactionReceiptsWorker.ts @@ -12,20 +12,19 @@ import { } from "thirdweb"; import { resolveContractAbi } from "thirdweb/contract"; import { decodeFunctionData, type Abi, type Hash } from "viem"; -import { bulkInsertContractTransactionReceipts } from "../../db/contractTransactionReceipts/createContractTransactionReceipts"; -import { WebhooksEventTypes } from "../../schema/webhooks"; -import { getChain } from "../../utils/chain"; -import { logger } from "../../utils/logger"; -import { normalizeAddress } from "../../utils/primitiveTypes"; -import { redis } from "../../utils/redis/redis"; -import { thirdwebClient } from "../../utils/sdk"; +import { bulkInsertContractTransactionReceipts } from "../../shared/db/contractTransactionReceipts/createContractTransactionReceipts"; +import { WebhooksEventTypes } from "../../shared/schemas/webhooks"; +import { getChain } from "../../shared/utils/chain"; +import { logger } from "../../shared/utils/logger"; +import { normalizeAddress } from "../../shared/utils/primitiveTypes"; +import { redis } from "../../shared/utils/redis/redis"; +import { thirdwebClient } from "../../shared/utils/sdk"; import { ProcessTransactionReceiptsQueue, type EnqueueProcessTransactionReceiptsData, } from "../queues/processTransactionReceiptsQueue"; import { logWorkerExceptions } from "../queues/queues"; import { SendWebhookQueue } from "../queues/sendWebhookQueue"; -import { getContractId } from "../utils/contractId"; import { getWebhooksByContractAddresses } from "./processEventLogsWorker"; const handler: Processor = async (job: Job) => { @@ -228,3 +227,6 @@ export const initProcessTransactionReceiptsWorker = () => { }); logWorkerExceptions(_worker); }; + +const getContractId = (chainId: number, contractAddress: string) => + `${chainId}:${contractAddress}`; diff --git a/src/worker/tasks/pruneTransactionsWorker.ts b/src/worker/tasks/pruneTransactionsWorker.ts index 9ba8a361a..d736c23f3 100644 --- a/src/worker/tasks/pruneTransactionsWorker.ts +++ b/src/worker/tasks/pruneTransactionsWorker.ts @@ -1,8 +1,8 @@ import { Worker, type Job, type Processor } from "bullmq"; -import { TransactionDB } from "../../db/transactions/db"; -import { pruneNonceMaps } from "../../db/wallets/nonceMap"; -import { env } from "../../utils/env"; -import { redis } from "../../utils/redis/redis"; +import { TransactionDB } from "../../shared/db/transactions/db"; +import { pruneNonceMaps } from "../../shared/db/wallets/nonceMap"; +import { env } from "../../shared/utils/env"; +import { redis } from "../../shared/utils/redis/redis"; import { PruneTransactionsQueue } from "../queues/pruneTransactionsQueue"; import { logWorkerExceptions } from "../queues/queues"; diff --git a/src/worker/tasks/sendTransactionWorker.ts b/src/worker/tasks/sendTransactionWorker.ts index 783530ba0..65c810733 100644 --- a/src/worker/tasks/sendTransactionWorker.ts +++ b/src/worker/tasks/sendTransactionWorker.ts @@ -18,39 +18,39 @@ import { type UserOperation, } from "thirdweb/wallets/smart"; import { getContractAddress } from "viem"; -import { TransactionDB } from "../../db/transactions/db"; +import { TransactionDB } from "../../shared/db/transactions/db"; import { acquireNonce, addSentNonce, recycleNonce, syncLatestNonceFromOnchainIfHigher, -} from "../../db/wallets/walletNonce"; +} from "../../shared/db/wallets/walletNonce"; import { getAccount, getSmartBackendWalletAdminAccount, -} from "../../utils/account"; -import { getBlockNumberish } from "../../utils/block"; -import { getChain } from "../../utils/chain"; -import { msSince } from "../../utils/date"; -import { env } from "../../utils/env"; +} from "../../shared/utils/account"; +import { getBlockNumberish } from "../../shared/utils/block"; +import { getChain } from "../../shared/utils/chain"; +import { msSince } from "../../shared/utils/date"; +import { env } from "../../shared/utils/env"; import { isInsufficientFundsError, isNonceAlreadyUsedError, isReplacementGasFeeTooLow, wrapError, -} from "../../utils/error"; -import { getChecksumAddress } from "../../utils/primitiveTypes"; -import { recordMetrics } from "../../utils/prometheus"; -import { redis } from "../../utils/redis/redis"; -import { thirdwebClient } from "../../utils/sdk"; +} from "../../shared/utils/error"; +import { getChecksumAddress } from "../../shared/utils/primitiveTypes"; +import { recordMetrics } from "../../shared/utils/prometheus"; +import { redis } from "../../shared/utils/redis/redis"; +import { thirdwebClient } from "../../shared/utils/sdk"; import type { ErroredTransaction, PopulatedTransaction, QueuedTransaction, SentTransaction, -} from "../../utils/transaction/types"; -import { enqueueTransactionWebhook } from "../../utils/transaction/webhook"; -import { reportUsage } from "../../utils/usage"; +} from "../../shared/utils/transaction/types"; +import { enqueueTransactionWebhook } from "../../shared/utils/transaction/webhook"; +import { reportUsage } from "../../shared/utils/usage"; import { MineTransactionQueue } from "../queues/mineTransactionQueue"; import { logWorkerExceptions } from "../queues/queues"; import { diff --git a/src/worker/tasks/sendWebhookWorker.ts b/src/worker/tasks/sendWebhookWorker.ts index a8cf60c23..bd62edc40 100644 --- a/src/worker/tasks/sendWebhookWorker.ts +++ b/src/worker/tasks/sendWebhookWorker.ts @@ -1,20 +1,23 @@ import type { Static } from "@sinclair/typebox"; import { Worker, type Job, type Processor } from "bullmq"; import superjson from "superjson"; -import { TransactionDB } from "../../db/transactions/db"; +import { TransactionDB } from "../../shared/db/transactions/db"; import { WebhooksEventTypes, type BackendWalletBalanceWebhookParams, -} from "../../schema/webhooks"; +} from "../../shared/schemas/webhooks"; import { toEventLogSchema } from "../../server/schemas/eventLog"; import { toTransactionSchema, type TransactionSchema, } from "../../server/schemas/transaction"; import { toTransactionReceiptSchema } from "../../server/schemas/transactionReceipt"; -import { logger } from "../../utils/logger"; -import { redis } from "../../utils/redis/redis"; -import { sendWebhookRequest, type WebhookResponse } from "../../utils/webhook"; +import { logger } from "../../shared/utils/logger"; +import { redis } from "../../shared/utils/redis/redis"; +import { + sendWebhookRequest, + type WebhookResponse, +} from "../../shared/utils/webhook"; import { SendWebhookQueue, type WebhookJob } from "../queues/sendWebhookQueue"; const handler: Processor = async (job: Job) => { diff --git a/src/worker/utils/contractId.ts b/src/worker/utils/contractId.ts deleted file mode 100644 index 6cf991fca..000000000 --- a/src/worker/utils/contractId.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const getContractId = (chainId: number, contractAddress: string) => - `${chainId}:${contractAddress}`; diff --git a/src/worker/utils/nonce.ts b/src/worker/utils/nonce.ts deleted file mode 100644 index d225ae87b..000000000 --- a/src/worker/utils/nonce.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { BigNumber } from "ethers"; -import { concat, toHex } from "viem"; - -const generateRandomUint192 = (): bigint => { - const rand1 = BigInt(Math.floor(Math.random() * 0x100000000)); - const rand2 = BigInt(Math.floor(Math.random() * 0x100000000)); - const rand3 = BigInt(Math.floor(Math.random() * 0x100000000)); - const rand4 = BigInt(Math.floor(Math.random() * 0x100000000)); - const rand5 = BigInt(Math.floor(Math.random() * 0x100000000)); - const rand6 = BigInt(Math.floor(Math.random() * 0x100000000)); - return ( - (rand1 << 160n) | - (rand2 << 128n) | - (rand3 << 96n) | - (rand4 << 64n) | - (rand5 << 32n) | - rand6 - ); -}; - -export const randomNonce = () => { - return BigNumber.from( - concat([toHex(generateRandomUint192()), "0x0000000000000000"]), - ); -}; diff --git a/test/e2e/.env.test.example b/tests/e2e/.env.test.example similarity index 100% rename from test/e2e/.env.test.example rename to tests/e2e/.env.test.example diff --git a/test/e2e/.gitignore b/tests/e2e/.gitignore similarity index 100% rename from test/e2e/.gitignore rename to tests/e2e/.gitignore diff --git a/test/e2e/README.md b/tests/e2e/README.md similarity index 100% rename from test/e2e/README.md rename to tests/e2e/README.md diff --git a/test/e2e/bun.lockb b/tests/e2e/bun.lockb similarity index 100% rename from test/e2e/bun.lockb rename to tests/e2e/bun.lockb diff --git a/test/e2e/config.ts b/tests/e2e/config.ts similarity index 100% rename from test/e2e/config.ts rename to tests/e2e/config.ts diff --git a/test/e2e/package.json b/tests/e2e/package.json similarity index 100% rename from test/e2e/package.json rename to tests/e2e/package.json diff --git a/test/e2e/scripts/counter.ts b/tests/e2e/scripts/counter.ts similarity index 90% rename from test/e2e/scripts/counter.ts rename to tests/e2e/scripts/counter.ts index ccb9bd8de..b0c40f50e 100644 --- a/test/e2e/scripts/counter.ts +++ b/tests/e2e/scripts/counter.ts @@ -2,8 +2,8 @@ // You can save the output to a file and then use this script to count the number of times a specific RPC call is made. import { argv } from "bun"; -import { readFile } from "fs/promises"; -import { join } from "path"; +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; const file = join(__dirname, argv[2]); diff --git a/test/e2e/tests/extensions.test.ts b/tests/e2e/tests/extensions.test.ts similarity index 98% rename from test/e2e/tests/extensions.test.ts rename to tests/e2e/tests/extensions.test.ts index 1126f2877..ed0674da8 100644 --- a/test/e2e/tests/extensions.test.ts +++ b/tests/e2e/tests/extensions.test.ts @@ -1,4 +1,4 @@ -import assert from "assert"; +import assert from "node:assert"; import { sleep } from "bun"; import { beforeAll, describe, expect, test } from "bun:test"; import { getAddress, type Address } from "viem"; diff --git a/test/e2e/tests/load.test.ts b/tests/e2e/tests/load.test.ts similarity index 98% rename from test/e2e/tests/load.test.ts rename to tests/e2e/tests/load.test.ts index 1e31a2e4b..0cdea6317 100644 --- a/test/e2e/tests/load.test.ts +++ b/tests/e2e/tests/load.test.ts @@ -1,4 +1,4 @@ -import assert from "assert"; +import assert from "node:assert"; import { sleep } from "bun"; import { describe, expect, test } from "bun:test"; import { getAddress } from "viem"; diff --git a/test/e2e/tests/read.test.ts b/tests/e2e/tests/read.test.ts similarity index 99% rename from test/e2e/tests/read.test.ts rename to tests/e2e/tests/read.test.ts index 7be048956..25acbc951 100644 --- a/test/e2e/tests/read.test.ts +++ b/tests/e2e/tests/read.test.ts @@ -1,6 +1,6 @@ import { beforeAll, describe, expect, test } from "bun:test"; import { sepolia } from "thirdweb/chains"; -import type { ApiError } from "../../../sdk/dist/thirdweb-dev-engine.cjs"; +import type { ApiError } from "../../../sdk/dist/thirdweb-dev-engine.cjs.js"; import type { setupEngine } from "../utils/engine"; import { setup } from "./setup"; diff --git a/test/e2e/tests/routes/erc1155-transfer.test.ts b/tests/e2e/tests/routes/erc1155-transfer.test.ts similarity index 100% rename from test/e2e/tests/routes/erc1155-transfer.test.ts rename to tests/e2e/tests/routes/erc1155-transfer.test.ts diff --git a/test/e2e/tests/routes/erc20-transfer.test.ts b/tests/e2e/tests/routes/erc20-transfer.test.ts similarity index 99% rename from test/e2e/tests/routes/erc20-transfer.test.ts rename to tests/e2e/tests/routes/erc20-transfer.test.ts index 7a22c149e..867e1d43b 100644 --- a/test/e2e/tests/routes/erc20-transfer.test.ts +++ b/tests/e2e/tests/routes/erc20-transfer.test.ts @@ -4,7 +4,7 @@ import { ZERO_ADDRESS, toWei, type Address } from "thirdweb"; import { CONFIG } from "../../config"; import { getEngineBackendWalletB, type setupEngine } from "../../utils/engine"; import { pollTransactionStatus } from "../../utils/transactions"; -import { setup } from "./../setup"; +import { setup } from "../setup"; describe("ERC20 transfer", () => { let tokenContractAddress: string; diff --git a/test/e2e/tests/routes/erc721-transfer.test.ts b/tests/e2e/tests/routes/erc721-transfer.test.ts similarity index 100% rename from test/e2e/tests/routes/erc721-transfer.test.ts rename to tests/e2e/tests/routes/erc721-transfer.test.ts diff --git a/test/e2e/tests/routes/signMessage.test.ts b/tests/e2e/tests/routes/signMessage.test.ts similarity index 100% rename from test/e2e/tests/routes/signMessage.test.ts rename to tests/e2e/tests/routes/signMessage.test.ts diff --git a/test/e2e/tests/routes/signaturePrepare.test.ts b/tests/e2e/tests/routes/signaturePrepare.test.ts similarity index 100% rename from test/e2e/tests/routes/signaturePrepare.test.ts rename to tests/e2e/tests/routes/signaturePrepare.test.ts diff --git a/test/e2e/tests/routes/write.test.ts b/tests/e2e/tests/routes/write.test.ts similarity index 97% rename from test/e2e/tests/routes/write.test.ts rename to tests/e2e/tests/routes/write.test.ts index d891055d6..68e9db9de 100644 --- a/test/e2e/tests/routes/write.test.ts +++ b/tests/e2e/tests/routes/write.test.ts @@ -3,10 +3,10 @@ import assert from "node:assert"; import { stringToHex, type Address } from "thirdweb"; import { zeroAddress } from "viem"; import type { ApiError } from "../../../../sdk/dist/thirdweb-dev-engine.cjs.js"; -import { CONFIG } from "../../config"; -import type { setupEngine } from "../../utils/engine"; -import { pollTransactionStatus } from "../../utils/transactions"; -import { setup } from "../setup"; +import { CONFIG } from "../../config.js"; +import type { setupEngine } from "../../utils/engine.js"; +import { pollTransactionStatus } from "../../utils/transactions.js"; +import { setup } from "../setup.js"; describe("/contract/write route", () => { let tokenContractAddress: string; diff --git a/test/e2e/tests/setup.ts b/tests/e2e/tests/setup.ts similarity index 96% rename from test/e2e/tests/setup.ts rename to tests/e2e/tests/setup.ts index c65b07e06..0be24b7f7 100644 --- a/test/e2e/tests/setup.ts +++ b/tests/e2e/tests/setup.ts @@ -25,7 +25,7 @@ export const setup = async (): Promise => { const engine = setupEngine(); const backendWallet = await getEngineBackendWallet(engine); - await engine.backendWallet.resetNonces(); + await engine.backendWallet.resetNonces({}); if (!env.THIRDWEB_API_SECRET_KEY) throw new Error("THIRDWEB_API_SECRET_KEY is not set"); diff --git a/test/e2e/tests/sign-transaction.test.ts b/tests/e2e/tests/sign-transaction.test.ts similarity index 100% rename from test/e2e/tests/sign-transaction.test.ts rename to tests/e2e/tests/sign-transaction.test.ts diff --git a/test/e2e/tests/smart-backend-wallet/smart-aws-wallet.test.ts b/tests/e2e/tests/smart-backend-wallet/smart-aws-wallet.test.ts similarity index 100% rename from test/e2e/tests/smart-backend-wallet/smart-aws-wallet.test.ts rename to tests/e2e/tests/smart-backend-wallet/smart-aws-wallet.test.ts diff --git a/test/e2e/tests/smart-backend-wallet/smart-gcp-wallet.test.ts b/tests/e2e/tests/smart-backend-wallet/smart-gcp-wallet.test.ts similarity index 100% rename from test/e2e/tests/smart-backend-wallet/smart-gcp-wallet.test.ts rename to tests/e2e/tests/smart-backend-wallet/smart-gcp-wallet.test.ts diff --git a/test/e2e/tests/smart-backend-wallet/smart-local-wallet-sdk-v4.test.ts b/tests/e2e/tests/smart-backend-wallet/smart-local-wallet-sdk-v4.test.ts similarity index 100% rename from test/e2e/tests/smart-backend-wallet/smart-local-wallet-sdk-v4.test.ts rename to tests/e2e/tests/smart-backend-wallet/smart-local-wallet-sdk-v4.test.ts diff --git a/test/e2e/tests/smart-backend-wallet/smart-local-wallet.test.ts b/tests/e2e/tests/smart-backend-wallet/smart-local-wallet.test.ts similarity index 100% rename from test/e2e/tests/smart-backend-wallet/smart-local-wallet.test.ts rename to tests/e2e/tests/smart-backend-wallet/smart-local-wallet.test.ts diff --git a/test/e2e/tests/smoke.test.ts b/tests/e2e/tests/smoke.test.ts similarity index 100% rename from test/e2e/tests/smoke.test.ts rename to tests/e2e/tests/smoke.test.ts diff --git a/test/e2e/tests/userop.test.ts b/tests/e2e/tests/userop.test.ts similarity index 98% rename from test/e2e/tests/userop.test.ts rename to tests/e2e/tests/userop.test.ts index 18c5cba6d..875231e67 100644 --- a/test/e2e/tests/userop.test.ts +++ b/tests/e2e/tests/userop.test.ts @@ -1,5 +1,5 @@ import { beforeAll, describe, expect, test } from "bun:test"; -import { randomBytes } from "crypto"; +import { randomBytes } from "node:crypto"; import { getAddress, type Address } from "thirdweb"; import { sepolia } from "thirdweb/chains"; import { DEFAULT_ACCOUNT_FACTORY_V0_6 } from "thirdweb/wallets/smart"; diff --git a/test/e2e/tests/utils/getBlockTime.test.ts b/tests/e2e/tests/utils/getBlockTime.test.ts similarity index 100% rename from test/e2e/tests/utils/getBlockTime.test.ts rename to tests/e2e/tests/utils/getBlockTime.test.ts diff --git a/test/e2e/tsconfig.json b/tests/e2e/tsconfig.json similarity index 100% rename from test/e2e/tsconfig.json rename to tests/e2e/tsconfig.json diff --git a/test/e2e/utils/anvil.ts b/tests/e2e/utils/anvil.ts similarity index 100% rename from test/e2e/utils/anvil.ts rename to tests/e2e/utils/anvil.ts diff --git a/test/e2e/utils/engine.ts b/tests/e2e/utils/engine.ts similarity index 95% rename from test/e2e/utils/engine.ts rename to tests/e2e/utils/engine.ts index 53cb57be0..b4bdede4f 100644 --- a/test/e2e/utils/engine.ts +++ b/tests/e2e/utils/engine.ts @@ -1,5 +1,5 @@ import { checksumAddress } from "thirdweb/utils"; -import { Engine } from "../../../sdk"; +import { Engine } from "../../../sdk/dist/thirdweb-dev-engine.cjs"; import { CONFIG } from "../config"; import { ANVIL_PKEY_A, ANVIL_PKEY_B } from "./wallets"; diff --git a/test/e2e/utils/statistics.ts b/tests/e2e/utils/statistics.ts similarity index 100% rename from test/e2e/utils/statistics.ts rename to tests/e2e/utils/statistics.ts diff --git a/test/e2e/utils/transactions.ts b/tests/e2e/utils/transactions.ts similarity index 95% rename from test/e2e/utils/transactions.ts rename to tests/e2e/utils/transactions.ts index 7e51b5a6c..4f889d3a9 100644 --- a/test/e2e/utils/transactions.ts +++ b/tests/e2e/utils/transactions.ts @@ -1,6 +1,6 @@ import { sleep } from "bun"; -import { type Address } from "viem"; -import { Engine } from "../../../sdk"; +import type { Address } from "viem"; +import type { Engine } from "../../../sdk/dist/thirdweb-dev-engine.cjs"; import { CONFIG } from "../config"; type Timing = { diff --git a/test/e2e/utils/wallets.ts b/tests/e2e/utils/wallets.ts similarity index 100% rename from test/e2e/utils/wallets.ts rename to tests/e2e/utils/wallets.ts diff --git a/src/tests/config/aws-kms.ts b/tests/shared/aws-kms.ts similarity index 100% rename from src/tests/config/aws-kms.ts rename to tests/shared/aws-kms.ts diff --git a/src/tests/shared/chain.ts b/tests/shared/chain.ts similarity index 100% rename from src/tests/shared/chain.ts rename to tests/shared/chain.ts diff --git a/src/tests/shared/client.ts b/tests/shared/client.ts similarity index 100% rename from src/tests/shared/client.ts rename to tests/shared/client.ts diff --git a/src/tests/config/gcp-kms.ts b/tests/shared/gcp-kms.ts similarity index 100% rename from src/tests/config/gcp-kms.ts rename to tests/shared/gcp-kms.ts diff --git a/src/tests/shared/typed-data.ts b/tests/shared/typed-data.ts similarity index 100% rename from src/tests/shared/typed-data.ts rename to tests/shared/typed-data.ts diff --git a/src/tests/auth.test.ts b/tests/unit/auth.test.ts similarity index 96% rename from src/tests/auth.test.ts rename to tests/unit/auth.test.ts index 8e6e774e9..7ea7ab5f2 100644 --- a/src/tests/auth.test.ts +++ b/tests/unit/auth.test.ts @@ -1,19 +1,22 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { LocalWallet } from "@thirdweb-dev/wallets"; -import { FastifyRequest } from "fastify/types/request"; +import type { FastifyRequest } from "fastify/types/request"; import jsonwebtoken from "jsonwebtoken"; -import { getPermissions } from "../db/permissions/getPermissions"; -import { WebhooksEventTypes } from "../schema/webhooks"; -import { onRequest } from "../server/middleware/auth"; -import { Permission } from "../server/schemas/auth"; -import { THIRDWEB_DASHBOARD_ISSUER, handleSiwe } from "../utils/auth"; -import { getAccessToken } from "../utils/cache/accessToken"; -import { getAuthWallet } from "../utils/cache/authWallet"; -import { getConfig } from "../utils/cache/getConfig"; -import { getWebhooksByEventType } from "../utils/cache/getWebhook"; -import { getKeypair } from "../utils/cache/keypair"; -import { sendWebhookRequest } from "../utils/webhook"; +import { getPermissions } from "../../src/shared/db/permissions/getPermissions"; +import { WebhooksEventTypes } from "../../src/shared/schemas/webhooks"; +import { onRequest } from "../../src/server/middleware/auth"; +import { + THIRDWEB_DASHBOARD_ISSUER, + handleSiwe, +} from "../../src/shared/utils/auth"; +import { getAccessToken } from "../../src/shared/utils/cache/accessToken"; +import { getAuthWallet } from "../../src/shared/utils/cache/authWallet"; +import { getConfig } from "../../src/shared/utils/cache/getConfig"; +import { getWebhooksByEventType } from "../../src/shared/utils/cache/getWebhook"; +import { getKeypair } from "../../src/shared/utils/cache/keypair"; +import { sendWebhookRequest } from "../../src/shared/utils/webhook"; +import { Permission } from "../../src/shared/schemas"; vi.mock("../utils/cache/accessToken"); const mockGetAccessToken = vi.mocked(getAccessToken); diff --git a/src/tests/aws-arn.test.ts b/tests/unit/aws-arn.test.ts similarity index 97% rename from src/tests/aws-arn.test.ts rename to tests/unit/aws-arn.test.ts index cc885a4a9..8b46025f3 100644 --- a/src/tests/aws-arn.test.ts +++ b/tests/unit/aws-arn.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import { getAwsKmsArn, splitAwsKmsArn, -} from "../server/utils/wallets/awsKmsArn"; +} from "../../src/server/utils/wallets/awsKmsArn"; describe("splitAwsKmsArn", () => { it("should correctly split a valid AWS KMS ARN", () => { diff --git a/src/tests/wallets/aws-kms.test.ts b/tests/unit/aws-kms.test.ts similarity index 95% rename from src/tests/wallets/aws-kms.test.ts rename to tests/unit/aws-kms.test.ts index 4d0b7a129..b02c4e28a 100644 --- a/src/tests/wallets/aws-kms.test.ts +++ b/tests/unit/aws-kms.test.ts @@ -1,11 +1,7 @@ import { beforeAll, expect, test, vi } from "vitest"; import { ANVIL_CHAIN, anvilTestClient } from "../shared/chain.ts"; - -import { TEST_AWS_KMS_CONFIG } from "../config/aws-kms.ts"; - import { typedData } from "../shared/typed-data.ts"; - import { verifyTypedData } from "thirdweb"; import { verifyEOASignature } from "thirdweb/auth"; import { @@ -14,8 +10,9 @@ import { } from "thirdweb/transaction"; import { toUnits, toWei } from "thirdweb/utils"; import { getWalletBalance } from "thirdweb/wallets"; -import { getAwsKmsAccount } from "../../server/utils/wallets/getAwsKmsAccount.js"; import { TEST_CLIENT } from "../shared/client.ts"; +import { getAwsKmsAccount } from "../../src/server/utils/wallets/getAwsKmsAccount"; +import { TEST_AWS_KMS_CONFIG } from "../shared/aws-kms.ts"; let account: Awaited>; diff --git a/src/tests/chain.test.ts b/tests/unit/chain.test.ts similarity index 96% rename from src/tests/chain.test.ts rename to tests/unit/chain.test.ts index 4a3684a6c..dff36db94 100644 --- a/src/tests/chain.test.ts +++ b/tests/unit/chain.test.ts @@ -3,8 +3,8 @@ import { getChainBySlugAsync, } from "@thirdweb-dev/chains"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import { getChainIdFromChain } from "../server/utils/chain"; -import { getConfig } from "../utils/cache/getConfig"; +import { getChainIdFromChain } from "../../src/server/utils/chain"; +import { getConfig } from "../../src/shared/utils/cache/getConfig"; // Mock the external dependencies vi.mock("../utils/cache/getConfig"); diff --git a/src/tests/wallets/gcp-kms.test.ts b/tests/unit/gcp-kms.test.ts similarity index 94% rename from src/tests/wallets/gcp-kms.test.ts rename to tests/unit/gcp-kms.test.ts index afc4feffb..1f2d183cc 100644 --- a/src/tests/wallets/gcp-kms.test.ts +++ b/tests/unit/gcp-kms.test.ts @@ -1,9 +1,7 @@ import { beforeAll, expect, test, vi } from "vitest"; import { ANVIL_CHAIN, anvilTestClient } from "../shared/chain.ts"; - import { typedData } from "../shared/typed-data.ts"; - import { verifyTypedData } from "thirdweb"; import { verifyEOASignature } from "thirdweb/auth"; import { @@ -12,9 +10,9 @@ import { } from "thirdweb/transaction"; import { toUnits, toWei } from "thirdweb/utils"; import { getWalletBalance } from "thirdweb/wallets"; -import { getGcpKmsAccount } from "../../server/utils/wallets/getGcpKmsAccount.ts"; -import { TEST_GCP_KMS_CONFIG } from "../config/gcp-kms.ts"; -import { TEST_CLIENT } from "../shared/client.ts"; +import { getGcpKmsAccount } from "../../src/server/utils/wallets/getGcpKmsAccount"; +import { TEST_GCP_KMS_CONFIG } from "../shared/gcp-kms"; +import { TEST_CLIENT } from "../shared/client"; let account: Awaited>; diff --git a/src/tests/gcp-resource-path.test.ts b/tests/unit/gcp-resource-path.test.ts similarity index 97% rename from src/tests/gcp-resource-path.test.ts rename to tests/unit/gcp-resource-path.test.ts index ae6da618f..52a497d2a 100644 --- a/src/tests/gcp-resource-path.test.ts +++ b/tests/unit/gcp-resource-path.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"; import { getGcpKmsResourcePath, splitGcpKmsResourcePath, -} from "../server/utils/wallets/gcpKmsResourcePath"; +} from "../../src/server/utils/wallets/gcpKmsResourcePath"; describe("splitGcpKmsResourcePath", () => { it("should correctly split a valid GCP KMS resource path", () => { diff --git a/src/tests/math.test.ts b/tests/unit/math.test.ts similarity index 93% rename from src/tests/math.test.ts rename to tests/unit/math.test.ts index 6303d6bed..725084dd1 100644 --- a/src/tests/math.test.ts +++ b/tests/unit/math.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { getPercentile } from "../utils/math"; +import { getPercentile } from "../../src/shared/utils/math"; describe("getPercentile", () => { it("should correctly calculate the p50 (median) of a sorted array", () => { diff --git a/src/tests/schema.test.ts b/tests/unit/schema.test.ts similarity index 97% rename from src/tests/schema.test.ts rename to tests/unit/schema.test.ts index 17f4b167a..c1de80d36 100644 --- a/src/tests/schema.test.ts +++ b/tests/unit/schema.test.ts @@ -4,8 +4,8 @@ import { AddressSchema, HexSchema, TransactionHashSchema, -} from "../server/schemas/address"; -import { chainIdOrSlugSchema } from "../server/schemas/chain"; +} from "../../src/server/schemas/address"; +import { chainIdOrSlugSchema } from "../../src/server/schemas/chain"; // Test cases describe("chainIdOrSlugSchema", () => { diff --git a/src/tests/swr.test.ts b/tests/unit/swr.test.ts similarity index 98% rename from src/tests/swr.test.ts rename to tests/unit/swr.test.ts index ce709ddf3..33fb485ef 100644 --- a/src/tests/swr.test.ts +++ b/tests/unit/swr.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"; -import { createSWRCache, type SWRCache } from "../lib/cache/swr"; +import { createSWRCache, type SWRCache } from "../../src/shared/lib/cache/swr"; describe("SWRCache", () => { let cache: SWRCache; diff --git a/src/tests/validator.test.ts b/tests/unit/validator.test.ts similarity index 94% rename from src/tests/validator.test.ts rename to tests/unit/validator.test.ts index 31304c01d..f15612258 100644 --- a/src/tests/validator.test.ts +++ b/tests/unit/validator.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import { isValidWebhookUrl } from "../server/utils/validator"; +import { isValidWebhookUrl } from "../../src/server/utils/validator"; describe("isValidWebhookUrl", () => { it("should return true for a valid HTTPS URL", () => { diff --git a/tsconfig.json b/tsconfig.json index e708959bb..6fb9b351a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,5 +25,5 @@ "src/**/*.js", "src/**/*.d.ts" ], - "exclude": ["node_modules", "src/tests/**/*.ts"] + "exclude": ["node_modules", "tests/tests/**/*.ts"] } diff --git a/vitest.config.ts b/vitest.config.ts index cfcdaf467..d2f6a0cda 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,9 +2,8 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { - include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], + include: ["tests/unit/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], exclude: ["tests/e2e/**/*"], - // setupFiles: ["./vitest.setup.ts"], globalSetup: ["./vitest.global-setup.ts"], mockReset: true, }, diff --git a/vitest.global-setup.ts b/vitest.global-setup.ts index 53f215c91..c09752690 100644 --- a/vitest.global-setup.ts +++ b/vitest.global-setup.ts @@ -5,17 +5,19 @@ config({ path: [path.resolve(".env.test.local"), path.resolve(".env.test")], }); -import { createServer } from "prool"; -import { anvil } from "prool/instances"; +// import { createServer } from "prool"; +// import { anvil } from "prool/instances"; -export async function setup() { - const server = createServer({ - instance: anvil(), - port: 8645, // Choose an appropriate port - }); - await server.start(); - // Return a teardown function that will be called after all tests are complete - return async () => { - await server.stop(); - }; -} +// export async function setup() { +// const server = createServer({ +// instance: anvil(), +// port: 8645, // Choose an appropriate port +// }); +// await server.start(); +// // Return a teardown function that will be called after all tests are complete +// return async () => { +// await server.stop(); +// }; +// } + +export async function setup() {} From 13a5a274ff5e8d87e211c5b68177aca1ae018e6a Mon Sep 17 00:00:00 2001 From: Phillip Ho Date: Sat, 7 Dec 2024 09:53:01 +0800 Subject: [PATCH 2/4] copy scripts folder --- package.json | 230 +++++++++++++++++++++++++-------------------------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/package.json b/package.json index f8497a342..35f4a6863 100644 --- a/package.json +++ b/package.json @@ -1,117 +1,117 @@ { - "name": "engine", - "version": "0.1.0", - "license": "Apache-2.0", - "description": "thirdweb Engine", - "main": "src/server/index.ts", - "author": "thirdweb engineering ", - "type": "module", - "scripts": { - "dev": "yarn dev:infra && yarn dev:db && yarn dev:run", - "dev:infra": "docker compose -f ./docker-compose.yml up -d", - "dev:db": "yarn prisma:setup:dev", - "dev:run": "npx nodemon --watch 'src/**/*.ts' --exec 'npx tsx ./src/index.ts' --files src/index.ts", - "build": "rm -rf dist && tsc -p ./tsconfig.json --outDir dist", - "build:docker": "docker build . -f Dockerfile -t prod", - "generate:sdk": "npx tsx ./scripts/generate-sdk && cd ./sdk && yarn build", - "prisma:setup:dev": "npx tsx ./scripts/setup-db.ts", - "prisma:setup:prod": "npx tsx ./dist/scripts/setup-db.js", - "start": "yarn prisma:setup:prod && yarn start:migrations && yarn start:run", - "start:migrations": "npx tsx ./dist/scripts/apply-migrations.js", - "start:run": "node --experimental-specifier-resolution=node ./dist/index.js", - "start:docker": "docker compose --profile engine --env-file ./.env up --remove-orphans", - "start:docker-force-build": "docker compose --profile engine --env-file ./.env up --remove-orphans --build", - "lint:fix": "eslint --fix 'src/**/*.ts'", - "test:unit": "vitest", - "test:coverage": "vitest run --coverage", - "copy-files": "cp -r ./src/prisma ./dist/" - }, - "dependencies": { - "@aws-sdk/client-kms": "^3.679.0", - "@bull-board/fastify": "^5.23.0", - "@cloud-cryptographic-wallet/cloud-kms-signer": "^0.1.2", - "@cloud-cryptographic-wallet/signer": "^0.0.5", - "@ethersproject/json-wallets": "^5.7.0", - "@fastify/swagger": "^8.9.0", - "@fastify/type-provider-typebox": "^3.2.0", - "@fastify/websocket": "^8.2.0", - "@google-cloud/kms": "^4.4.0", - "@prisma/client": "5.17.0", - "@sinclair/typebox": "^0.31.28", - "@t3-oss/env-core": "^0.6.0", - "@thirdweb-dev/auth": "^4.1.87", - "@thirdweb-dev/chains": "^0.1.77", - "@thirdweb-dev/sdk": "^4.0.89", - "@thirdweb-dev/service-utils": "^0.4.28", - "@types/base-64": "^1.0.2", - "aws-kms-signer": "^0.5.3", - "base-64": "^1.0.0", - "bullmq": "^5.11.0", - "cron-parser": "^4.9.0", - "crypto": "^1.0.1", - "crypto-js": "^4.2.0", - "dd-trace": "^5.23.0", - "dotenv": "^16.0.3", - "ethers": "5", - "ethers-aws-kms-signer": "^1.3.2", - "ethers-gcp-kms-signer": "^1.1.6", - "fastify": "^4.28.1", - "fastify-plugin": "^4.5.0", - "http-status-codes": "^2.2.0", - "ioredis": "^5.4.1", - "jsonwebtoken": "^9.0.2", - "knex": "^3.1.0", - "mnemonist": "^0.39.8", - "node-cron": "^3.0.2", - "pg": "^8.11.3", - "prisma": "^5.14.0", - "prom-client": "^15.1.3", - "superjson": "^2.2.1", - "thirdweb": "^5.71.0", - "uuid": "^9.0.1", - "winston": "^3.14.1", - "zod": "^3.23.8" - }, - "devDependencies": { - "@biomejs/biome": "^1.9.2", - "@types/cli-progress": "^3.11.3", - "@types/crypto-js": "^4.2.2", - "@types/jsonwebtoken": "^9.0.6", - "@types/node": "^18.15.4", - "@types/node-cron": "^3.0.8", - "@types/pg": "^8.6.6", - "@types/uuid": "^9.0.1", - "@types/ws": "^8.5.5", - "@typescript-eslint/eslint-plugin": "^5.55.0", - "@typescript-eslint/parser": "^5.55.0", - "@vitest/coverage-v8": "^2.0.3", - "eslint": "^9.3.0", - "eslint-config-prettier": "^8.7.0", - "openapi-typescript-codegen": "^0.25.0", - "prettier": "^2.8.7", - "prool": "^0.0.16", - "typescript": "^5.1.3", - "vitest": "^2.0.3" - }, - "lint-staged": { - "*.{js,ts}": "eslint --cache --fix", - "*.{js,ts,md}": "prettier --write" - }, - "prisma": { - "schema": "./src/prisma/schema.prisma" - }, - "resolutions": { - "@thirdweb-dev/auth/**/axios": ">=1.7.8", - "@thirdweb-dev/auth/**/web3-utils": ">=4.2.1", - "ethers-gcp-kms-signer/**/protobufjs": ">=7.2.5", - "fastify/**/find-my-way": ">=8.2.2", - "@grpc/grpc-js": ">=1.8.22", - "body-parser": ">=1.20.3", - "cookie": ">=0.7.0", - "elliptic": ">=6.6.0", - "micromatch": ">=4.0.8", - "secp256k1": ">=4.0.4", - "ws": ">=8.17.1", - "cross-spawn": ">=7.0.6" - } + "name": "engine", + "version": "0.1.0", + "license": "Apache-2.0", + "description": "thirdweb Engine", + "main": "src/server/index.ts", + "author": "thirdweb engineering ", + "type": "module", + "scripts": { + "dev": "yarn dev:infra && yarn dev:db && yarn dev:run", + "dev:infra": "docker compose -f ./docker-compose.yml up -d", + "dev:db": "yarn prisma:setup:dev", + "dev:run": "npx nodemon --watch 'src/**/*.ts' --exec 'npx tsx ./src/index.ts' --files src/index.ts", + "build": "rm -rf dist && tsc -p ./tsconfig.json --outDir dist", + "build:docker": "docker build . -f Dockerfile -t prod", + "generate:sdk": "npx tsx ./scripts/generate-sdk && cd ./sdk && yarn build", + "prisma:setup:dev": "npx tsx ./scripts/setup-db.ts", + "prisma:setup:prod": "npx tsx ./dist/scripts/setup-db.js", + "start": "yarn prisma:setup:prod && yarn start:migrations && yarn start:run", + "start:migrations": "npx tsx ./dist/scripts/apply-migrations.js", + "start:run": "node --experimental-specifier-resolution=node ./dist/index.js", + "start:docker": "docker compose --profile engine --env-file ./.env up --remove-orphans", + "start:docker-force-build": "docker compose --profile engine --env-file ./.env up --remove-orphans --build", + "lint:fix": "eslint --fix 'src/**/*.ts'", + "test:unit": "vitest", + "test:coverage": "vitest run --coverage", + "copy-files": "cp -r ./src/prisma ./dist/ && cp -r ./scripts ./dist/" + }, + "dependencies": { + "@aws-sdk/client-kms": "^3.679.0", + "@bull-board/fastify": "^5.23.0", + "@cloud-cryptographic-wallet/cloud-kms-signer": "^0.1.2", + "@cloud-cryptographic-wallet/signer": "^0.0.5", + "@ethersproject/json-wallets": "^5.7.0", + "@fastify/swagger": "^8.9.0", + "@fastify/type-provider-typebox": "^3.2.0", + "@fastify/websocket": "^8.2.0", + "@google-cloud/kms": "^4.4.0", + "@prisma/client": "5.17.0", + "@sinclair/typebox": "^0.31.28", + "@t3-oss/env-core": "^0.6.0", + "@thirdweb-dev/auth": "^4.1.87", + "@thirdweb-dev/chains": "^0.1.77", + "@thirdweb-dev/sdk": "^4.0.89", + "@thirdweb-dev/service-utils": "^0.4.28", + "@types/base-64": "^1.0.2", + "aws-kms-signer": "^0.5.3", + "base-64": "^1.0.0", + "bullmq": "^5.11.0", + "cron-parser": "^4.9.0", + "crypto": "^1.0.1", + "crypto-js": "^4.2.0", + "dd-trace": "^5.23.0", + "dotenv": "^16.0.3", + "ethers": "5", + "ethers-aws-kms-signer": "^1.3.2", + "ethers-gcp-kms-signer": "^1.1.6", + "fastify": "^4.28.1", + "fastify-plugin": "^4.5.0", + "http-status-codes": "^2.2.0", + "ioredis": "^5.4.1", + "jsonwebtoken": "^9.0.2", + "knex": "^3.1.0", + "mnemonist": "^0.39.8", + "node-cron": "^3.0.2", + "pg": "^8.11.3", + "prisma": "^5.14.0", + "prom-client": "^15.1.3", + "superjson": "^2.2.1", + "thirdweb": "^5.71.0", + "uuid": "^9.0.1", + "winston": "^3.14.1", + "zod": "^3.23.8" + }, + "devDependencies": { + "@biomejs/biome": "^1.9.2", + "@types/cli-progress": "^3.11.3", + "@types/crypto-js": "^4.2.2", + "@types/jsonwebtoken": "^9.0.6", + "@types/node": "^18.15.4", + "@types/node-cron": "^3.0.8", + "@types/pg": "^8.6.6", + "@types/uuid": "^9.0.1", + "@types/ws": "^8.5.5", + "@typescript-eslint/eslint-plugin": "^5.55.0", + "@typescript-eslint/parser": "^5.55.0", + "@vitest/coverage-v8": "^2.0.3", + "eslint": "^9.3.0", + "eslint-config-prettier": "^8.7.0", + "openapi-typescript-codegen": "^0.25.0", + "prettier": "^2.8.7", + "prool": "^0.0.16", + "typescript": "^5.1.3", + "vitest": "^2.0.3" + }, + "lint-staged": { + "*.{js,ts}": "eslint --cache --fix", + "*.{js,ts,md}": "prettier --write" + }, + "prisma": { + "schema": "./src/prisma/schema.prisma" + }, + "resolutions": { + "@thirdweb-dev/auth/**/axios": ">=1.7.8", + "@thirdweb-dev/auth/**/web3-utils": ">=4.2.1", + "ethers-gcp-kms-signer/**/protobufjs": ">=7.2.5", + "fastify/**/find-my-way": ">=8.2.2", + "@grpc/grpc-js": ">=1.8.22", + "body-parser": ">=1.20.3", + "cookie": ">=0.7.0", + "elliptic": ">=6.6.0", + "micromatch": ">=4.0.8", + "secp256k1": ">=4.0.4", + "ws": ">=8.17.1", + "cross-spawn": ">=7.0.6" + } } From 3faa81d0ce85f09a5cab1c91a1d071cf18c5d330 Mon Sep 17 00:00:00 2001 From: Phillip Ho Date: Tue, 10 Dec 2024 12:54:58 +0800 Subject: [PATCH 3/4] move scripts back --- Dockerfile | 1 - package.json | 230 +++++++++---------- {scripts => src/scripts}/apply-migrations.ts | 6 +- {scripts => src/scripts}/generate-sdk.ts | 0 {scripts => src/scripts}/setup-db.ts | 0 5 files changed, 118 insertions(+), 119 deletions(-) rename {scripts => src/scripts}/apply-migrations.ts (91%) rename {scripts => src/scripts}/generate-sdk.ts (100%) rename {scripts => src/scripts}/setup-db.ts (100%) diff --git a/Dockerfile b/Dockerfile index 9728e659f..4cf99266f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,7 +64,6 @@ COPY --from=build /app/package.json . COPY --from=build /app/node_modules ./node_modules COPY --from=build /app/src/prisma/* ./src/prisma/ COPY --from=build /app/dist ./dist -COPY --from=build /app/scripts ./dist/scripts # Replace the schema path in the package.json file RUN sed -i 's_"schema": "./src/prisma/schema.prisma"_"schema": "./dist/prisma/schema.prisma"_g' package.json diff --git a/package.json b/package.json index 35f4a6863..371ab1621 100644 --- a/package.json +++ b/package.json @@ -1,117 +1,117 @@ { - "name": "engine", - "version": "0.1.0", - "license": "Apache-2.0", - "description": "thirdweb Engine", - "main": "src/server/index.ts", - "author": "thirdweb engineering ", - "type": "module", - "scripts": { - "dev": "yarn dev:infra && yarn dev:db && yarn dev:run", - "dev:infra": "docker compose -f ./docker-compose.yml up -d", - "dev:db": "yarn prisma:setup:dev", - "dev:run": "npx nodemon --watch 'src/**/*.ts' --exec 'npx tsx ./src/index.ts' --files src/index.ts", - "build": "rm -rf dist && tsc -p ./tsconfig.json --outDir dist", - "build:docker": "docker build . -f Dockerfile -t prod", - "generate:sdk": "npx tsx ./scripts/generate-sdk && cd ./sdk && yarn build", - "prisma:setup:dev": "npx tsx ./scripts/setup-db.ts", - "prisma:setup:prod": "npx tsx ./dist/scripts/setup-db.js", - "start": "yarn prisma:setup:prod && yarn start:migrations && yarn start:run", - "start:migrations": "npx tsx ./dist/scripts/apply-migrations.js", - "start:run": "node --experimental-specifier-resolution=node ./dist/index.js", - "start:docker": "docker compose --profile engine --env-file ./.env up --remove-orphans", - "start:docker-force-build": "docker compose --profile engine --env-file ./.env up --remove-orphans --build", - "lint:fix": "eslint --fix 'src/**/*.ts'", - "test:unit": "vitest", - "test:coverage": "vitest run --coverage", - "copy-files": "cp -r ./src/prisma ./dist/ && cp -r ./scripts ./dist/" - }, - "dependencies": { - "@aws-sdk/client-kms": "^3.679.0", - "@bull-board/fastify": "^5.23.0", - "@cloud-cryptographic-wallet/cloud-kms-signer": "^0.1.2", - "@cloud-cryptographic-wallet/signer": "^0.0.5", - "@ethersproject/json-wallets": "^5.7.0", - "@fastify/swagger": "^8.9.0", - "@fastify/type-provider-typebox": "^3.2.0", - "@fastify/websocket": "^8.2.0", - "@google-cloud/kms": "^4.4.0", - "@prisma/client": "5.17.0", - "@sinclair/typebox": "^0.31.28", - "@t3-oss/env-core": "^0.6.0", - "@thirdweb-dev/auth": "^4.1.87", - "@thirdweb-dev/chains": "^0.1.77", - "@thirdweb-dev/sdk": "^4.0.89", - "@thirdweb-dev/service-utils": "^0.4.28", - "@types/base-64": "^1.0.2", - "aws-kms-signer": "^0.5.3", - "base-64": "^1.0.0", - "bullmq": "^5.11.0", - "cron-parser": "^4.9.0", - "crypto": "^1.0.1", - "crypto-js": "^4.2.0", - "dd-trace": "^5.23.0", - "dotenv": "^16.0.3", - "ethers": "5", - "ethers-aws-kms-signer": "^1.3.2", - "ethers-gcp-kms-signer": "^1.1.6", - "fastify": "^4.28.1", - "fastify-plugin": "^4.5.0", - "http-status-codes": "^2.2.0", - "ioredis": "^5.4.1", - "jsonwebtoken": "^9.0.2", - "knex": "^3.1.0", - "mnemonist": "^0.39.8", - "node-cron": "^3.0.2", - "pg": "^8.11.3", - "prisma": "^5.14.0", - "prom-client": "^15.1.3", - "superjson": "^2.2.1", - "thirdweb": "^5.71.0", - "uuid": "^9.0.1", - "winston": "^3.14.1", - "zod": "^3.23.8" - }, - "devDependencies": { - "@biomejs/biome": "^1.9.2", - "@types/cli-progress": "^3.11.3", - "@types/crypto-js": "^4.2.2", - "@types/jsonwebtoken": "^9.0.6", - "@types/node": "^18.15.4", - "@types/node-cron": "^3.0.8", - "@types/pg": "^8.6.6", - "@types/uuid": "^9.0.1", - "@types/ws": "^8.5.5", - "@typescript-eslint/eslint-plugin": "^5.55.0", - "@typescript-eslint/parser": "^5.55.0", - "@vitest/coverage-v8": "^2.0.3", - "eslint": "^9.3.0", - "eslint-config-prettier": "^8.7.0", - "openapi-typescript-codegen": "^0.25.0", - "prettier": "^2.8.7", - "prool": "^0.0.16", - "typescript": "^5.1.3", - "vitest": "^2.0.3" - }, - "lint-staged": { - "*.{js,ts}": "eslint --cache --fix", - "*.{js,ts,md}": "prettier --write" - }, - "prisma": { - "schema": "./src/prisma/schema.prisma" - }, - "resolutions": { - "@thirdweb-dev/auth/**/axios": ">=1.7.8", - "@thirdweb-dev/auth/**/web3-utils": ">=4.2.1", - "ethers-gcp-kms-signer/**/protobufjs": ">=7.2.5", - "fastify/**/find-my-way": ">=8.2.2", - "@grpc/grpc-js": ">=1.8.22", - "body-parser": ">=1.20.3", - "cookie": ">=0.7.0", - "elliptic": ">=6.6.0", - "micromatch": ">=4.0.8", - "secp256k1": ">=4.0.4", - "ws": ">=8.17.1", - "cross-spawn": ">=7.0.6" - } + "name": "engine", + "version": "0.1.0", + "license": "Apache-2.0", + "description": "thirdweb Engine", + "main": "src/server/index.ts", + "author": "thirdweb engineering ", + "type": "module", + "scripts": { + "dev": "yarn dev:infra && yarn dev:db && yarn dev:run", + "dev:infra": "docker compose -f ./docker-compose.yml up -d", + "dev:db": "yarn prisma:setup:dev", + "dev:run": "npx nodemon --watch 'src/**/*.ts' --exec 'npx tsx ./src/index.ts' --files src/index.ts", + "build": "rm -rf dist && tsc -p ./tsconfig.json --outDir dist", + "build:docker": "docker build . -f Dockerfile -t prod", + "generate:sdk": "npx tsx ./src/scripts/generate-sdk && cd ./sdk && yarn build", + "prisma:setup:dev": "npx tsx ./src/scripts/setup-db.ts", + "prisma:setup:prod": "npx tsx ./dist/scripts/setup-db.js", + "start": "yarn prisma:setup:prod && yarn start:migrations && yarn start:run", + "start:migrations": "npx tsx ./dist/scripts/apply-migrations.js", + "start:run": "node --experimental-specifier-resolution=node ./dist/index.js", + "start:docker": "docker compose --profile engine --env-file ./.env up --remove-orphans", + "start:docker-force-build": "docker compose --profile engine --env-file ./.env up --remove-orphans --build", + "lint:fix": "eslint --fix 'src/**/*.ts'", + "test:unit": "vitest", + "test:coverage": "vitest run --coverage", + "copy-files": "cp -r ./src/prisma ./dist/" + }, + "dependencies": { + "@aws-sdk/client-kms": "^3.679.0", + "@bull-board/fastify": "^5.23.0", + "@cloud-cryptographic-wallet/cloud-kms-signer": "^0.1.2", + "@cloud-cryptographic-wallet/signer": "^0.0.5", + "@ethersproject/json-wallets": "^5.7.0", + "@fastify/swagger": "^8.9.0", + "@fastify/type-provider-typebox": "^3.2.0", + "@fastify/websocket": "^8.2.0", + "@google-cloud/kms": "^4.4.0", + "@prisma/client": "5.17.0", + "@sinclair/typebox": "^0.31.28", + "@t3-oss/env-core": "^0.6.0", + "@thirdweb-dev/auth": "^4.1.87", + "@thirdweb-dev/chains": "^0.1.77", + "@thirdweb-dev/sdk": "^4.0.89", + "@thirdweb-dev/service-utils": "^0.4.28", + "@types/base-64": "^1.0.2", + "aws-kms-signer": "^0.5.3", + "base-64": "^1.0.0", + "bullmq": "^5.11.0", + "cron-parser": "^4.9.0", + "crypto": "^1.0.1", + "crypto-js": "^4.2.0", + "dd-trace": "^5.23.0", + "dotenv": "^16.0.3", + "ethers": "5", + "ethers-aws-kms-signer": "^1.3.2", + "ethers-gcp-kms-signer": "^1.1.6", + "fastify": "^4.28.1", + "fastify-plugin": "^4.5.0", + "http-status-codes": "^2.2.0", + "ioredis": "^5.4.1", + "jsonwebtoken": "^9.0.2", + "knex": "^3.1.0", + "mnemonist": "^0.39.8", + "node-cron": "^3.0.2", + "pg": "^8.11.3", + "prisma": "^5.14.0", + "prom-client": "^15.1.3", + "superjson": "^2.2.1", + "thirdweb": "^5.71.0", + "uuid": "^9.0.1", + "winston": "^3.14.1", + "zod": "^3.23.8" + }, + "devDependencies": { + "@biomejs/biome": "^1.9.2", + "@types/cli-progress": "^3.11.3", + "@types/crypto-js": "^4.2.2", + "@types/jsonwebtoken": "^9.0.6", + "@types/node": "^18.15.4", + "@types/node-cron": "^3.0.8", + "@types/pg": "^8.6.6", + "@types/uuid": "^9.0.1", + "@types/ws": "^8.5.5", + "@typescript-eslint/eslint-plugin": "^5.55.0", + "@typescript-eslint/parser": "^5.55.0", + "@vitest/coverage-v8": "^2.0.3", + "eslint": "^9.3.0", + "eslint-config-prettier": "^8.7.0", + "openapi-typescript-codegen": "^0.25.0", + "prettier": "^2.8.7", + "prool": "^0.0.16", + "typescript": "^5.1.3", + "vitest": "^2.0.3" + }, + "lint-staged": { + "*.{js,ts}": "eslint --cache --fix", + "*.{js,ts,md}": "prettier --write" + }, + "prisma": { + "schema": "./src/prisma/schema.prisma" + }, + "resolutions": { + "@thirdweb-dev/auth/**/axios": ">=1.7.8", + "@thirdweb-dev/auth/**/web3-utils": ">=4.2.1", + "ethers-gcp-kms-signer/**/protobufjs": ">=7.2.5", + "fastify/**/find-my-way": ">=8.2.2", + "@grpc/grpc-js": ">=1.8.22", + "body-parser": ">=1.20.3", + "cookie": ">=0.7.0", + "elliptic": ">=6.6.0", + "micromatch": ">=4.0.8", + "secp256k1": ">=4.0.4", + "ws": ">=8.17.1", + "cross-spawn": ">=7.0.6" + } } diff --git a/scripts/apply-migrations.ts b/src/scripts/apply-migrations.ts similarity index 91% rename from scripts/apply-migrations.ts rename to src/scripts/apply-migrations.ts index 12b16ff3b..2c12f0915 100644 --- a/scripts/apply-migrations.ts +++ b/src/scripts/apply-migrations.ts @@ -1,10 +1,10 @@ -import { logger } from "../src/shared/utils/logger"; +import { logger } from "../shared/utils/logger"; import { acquireLock, releaseLock, waitForLock, -} from "../src/shared/utils/redis/lock"; -import { redis } from "../src/shared/utils/redis/redis"; +} from "../shared/utils/redis/lock"; +import { redis } from "../shared/utils/redis/redis"; const MIGRATION_LOCK_TTL_SECONDS = 60; diff --git a/scripts/generate-sdk.ts b/src/scripts/generate-sdk.ts similarity index 100% rename from scripts/generate-sdk.ts rename to src/scripts/generate-sdk.ts diff --git a/scripts/setup-db.ts b/src/scripts/setup-db.ts similarity index 100% rename from scripts/setup-db.ts rename to src/scripts/setup-db.ts From 547a6b51d4bd58b0d920ade834ab8592eaac0c02 Mon Sep 17 00:00:00 2001 From: Phillip Ho Date: Tue, 10 Dec 2024 13:09:07 +0800 Subject: [PATCH 4/4] fix import --- src/scripts/setup-db.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripts/setup-db.ts b/src/scripts/setup-db.ts index fa6dad550..d38542756 100644 --- a/src/scripts/setup-db.ts +++ b/src/scripts/setup-db.ts @@ -1,5 +1,5 @@ import { execSync } from "node:child_process"; -import { prisma } from "../src/shared/db/client"; +import { prisma } from "../shared/db/client"; const main = async () => { const [{ exists: hasWalletsTable }]: [{ exists: boolean }] =