From 372769ffd4b3b78badc3ff987fc5ca005366154b Mon Sep 17 00:00:00 2001 From: danielailie Date: Thu, 12 Jun 2025 14:09:30 +0300 Subject: [PATCH 01/11] Remove graphql-upload and add graphql-upload-ts --- package-lock.json | 187 ++++++------------ package.json | 6 +- src/main.ts | 20 +- .../assets/assets-mutations.resolver.ts | 26 +-- .../assets/assets-transaction.service.ts | 4 +- .../models/requests/CreateNftRequest.ts | 10 +- 6 files changed, 96 insertions(+), 157 deletions(-) diff --git a/package-lock.json b/package-lock.json index 853e8007c..be5545da6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,7 +38,7 @@ "agentkeepalive": "4.2.1", "amqp-connection-manager": "3.7.0", "amqplib": "0.8.0", - "axios": "1.7.4", + "axios": "1.8.1", "axios-retry": "4.5.0", "bignumber.js": "9.0.1", "clarifai-nodejs-grpc": "10.8.7", @@ -54,7 +54,7 @@ "graphql-query-complexity": "0.12.0", "graphql-relay": "0.10.0", "graphql-tools": "8.3.18", - "graphql-upload": "13.0.0", + "graphql-upload-ts": "^2.1.2", "helmet": "4.4.1", "jwks-rsa": "2.0.3", "moment": "^2.29.4", @@ -81,7 +81,7 @@ "@nestjs/cli": "10.4.5", "@nestjs/schematics": "10.1.4", "@nestjs/testing": "10.4.4", - "@types/express": "5.0.0", + "@types/express": "4.0.29", "@types/graphql-relay": "^0.6.0", "@types/jest": "29.5.0", "@types/node": "^14.14.42", @@ -5888,9 +5888,9 @@ } }, "node_modules/@nestjs/cli/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "dependencies": { "balanced-match": "^1.0.0" @@ -6530,6 +6530,15 @@ "node": ">=10.13.0" } }, + "node_modules/@paralleldrive/cuid2": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@paralleldrive/cuid2/-/cuid2-2.2.2.tgz", + "integrity": "sha512-ZOBkgDwEdoYVlSeRbYYXs0S9MejQofiVYoTbKzy/6GQa39/q5tQU2IX46+shYnUkpEl3wc+J6wRlar7r2EK2xA==", + "dev": true, + "dependencies": { + "@noble/hashes": "^1.1.5" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -9009,14 +9018,12 @@ "dev": true }, "node_modules/@types/express": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.0.tgz", - "integrity": "sha512-DvZriSMehGHL1ZNLzi6MidnsDhUZM/x2pRdDIKdwbUNqqwHxMlRdkxtn6/EPKyqKpHqTl/4nRZsRNLpZxZRpPQ==", + "version": "4.0.29", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.0.29.tgz", + "integrity": "sha512-XfrKW4C4huxUqcckQ2gP5+Ef6D3viUTlKO+1bW6tULmFHi9TDj/Tu+H5Fnj9KRYQhPPQ3JMtzOFH3ICGHdtB6g==", "dependencies": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^5.0.0", - "@types/qs": "*", - "@types/serve-static": "*" + "@types/express-serve-static-core": "4.0.*", + "@types/serve-static": "1.7.*" } }, "node_modules/@types/express-jwt": { @@ -9049,14 +9056,20 @@ } }, "node_modules/@types/express/node_modules/@types/express-serve-static-core": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.0.tgz", - "integrity": "sha512-AbXMTZGt40T+KON9/Fdxx0B2WK5hsgxcfXJLr5bFpZ7b4JCex2WyQPTEKdXqfHiY5nKKBScZ7yCoO6Pvgxfvnw==", + "version": "4.0.57", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.0.57.tgz", + "integrity": "sha512-QLAHjdLwEICm3thVbXSKRoisjfgMVI4xJH/HU8F385BR2HI7PmM6ax4ELXf8Du6sLmSpySXMYaI+xc//oQ/IFw==", "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*", - "@types/send": "*" + "@types/node": "*" + } + }, + "node_modules/@types/express/node_modules/@types/serve-static": { + "version": "1.7.32", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.7.32.tgz", + "integrity": "sha512-WpI0g7M1FiOmJ/a97Qrjafq2I938tjAZ3hZr9O7sXyA6oUhH3bqUNZIt7r1KZg8TQAKxcvxt6JjQ5XuLfIBFvg==", + "dependencies": { + "@types/express-serve-static-core": "*", + "@types/mime": "*" } }, "node_modules/@types/graceful-fs": { @@ -9979,9 +9992,9 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", - "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.1.tgz", + "integrity": "sha512-NN+fvwH/kV01dYUQ3PTOZns4LWtWhOFCAhQ/pHb88WQ1hNe5V/dvFwc4VJcDL11LT9xSX0QtsR8sWUuyOuOq7g==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -10329,9 +10342,9 @@ "integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==" }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -10475,14 +10488,14 @@ ] }, "node_modules/busboy": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-0.3.1.tgz", - "integrity": "sha512-y7tTxhGKXcyBxRKAni+awqx8uqaJKrSFSNFSeRG5CsWNdmy2BIK+6VGWEW7TZnIO/533mtMEA4rOevQV815YJw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", "dependencies": { - "dicer": "0.3.0" + "streamsearch": "^1.1.0" }, "engines": { - "node": ">=4.5.0" + "node": ">=10.16.0" } }, "node_modules/bytes": { @@ -11305,17 +11318,6 @@ "wrappy": "1" } }, - "node_modules/dicer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/dicer/-/dicer-0.3.0.tgz", - "integrity": "sha512-MdceRRWqltEG2dZqO769g27N/3PXfcKl04VhYnBlo2YhH7zPi88VebsjTKclaOyiuMaGU72hTfw3VkUitGcVCA==", - "dependencies": { - "streamsearch": "0.1.2" - }, - "engines": { - "node": ">=4.5.0" - } - }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -12366,13 +12368,13 @@ } }, "node_modules/formidable": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz", - "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==", + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.5.tgz", + "integrity": "sha512-Oz5Hwvwak/DCaXVVUtPn4oLMLLy1CdclLKO1LFgU7XzDpVMUU5UjlSLpGMocyQNNk8F6IJW9M/YdooSn2MRI+Q==", "dev": true, "dependencies": { + "@paralleldrive/cuid2": "^2.2.2", "dezalgo": "^1.0.4", - "hexoid": "^1.0.0", "once": "^1.4.0", "qs": "^6.11.0" }, @@ -12401,14 +12403,6 @@ "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==" }, - "node_modules/fs-capacitor": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/fs-capacitor/-/fs-capacitor-6.2.0.tgz", - "integrity": "sha512-nKcE1UduoSKX27NSZlg879LdQc94OtbOsEmKMN2MBNudXREvijRKx2GEBsTMTfws+BrbkJoEuynbGSVRSpauvw==", - "engines": { - "node": ">=10" - } - }, "node_modules/fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -12728,47 +12722,20 @@ "node": ">=12" } }, - "node_modules/graphql-upload": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/graphql-upload/-/graphql-upload-13.0.0.tgz", - "integrity": "sha512-YKhx8m/uOtKu4Y1UzBFJhbBGJTlk7k4CydlUUiNrtxnwZv0WigbRHP+DVhRNKt7u7DXOtcKZeYJlGtnMXvreXA==", + "node_modules/graphql-upload-ts": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/graphql-upload-ts/-/graphql-upload-ts-2.1.2.tgz", + "integrity": "sha512-g0mL/55NI1MzRrTczIJw1cruIrqlUm7liQRkuGl6l9s4/j0aSuPkvZ52BS7teI43g6KXE/NeDyUotEAiTyZdHw==", "dependencies": { - "busboy": "^0.3.1", - "fs-capacitor": "^6.2.0", - "http-errors": "^1.8.1", + "busboy": "^1.6.0", + "http-errors": "^2.0.0", "object-path": "^0.11.8" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >= 16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/jaydenseric" + "node": ">=12" }, "peerDependencies": { - "graphql": "0.13.1 - 16" - } - }, - "node_modules/graphql-upload/node_modules/http-errors": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", - "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/graphql-upload/node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", - "engines": { - "node": ">= 0.6" + "graphql": ">=0.13.1" } }, "node_modules/graphql-ws": { @@ -12897,15 +12864,6 @@ "node": ">=10.0.0" } }, - "node_modules/hexoid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", - "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/highlight.js": { "version": "10.7.3", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", @@ -14883,17 +14841,6 @@ "node": ">= 6.0.0" } }, - "node_modules/multer/node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } - }, "node_modules/multer/node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", @@ -14905,14 +14852,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/multer/node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -16729,11 +16668,11 @@ } }, "node_modules/streamsearch": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", - "integrity": "sha512-jos8u++JKm0ARcSUTAZXOVC0mSox7Bhn6sBgty73P1f3JGf7yG2clTbBNHUdde/kdvP2FESam+vM6l8jBrNxHA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", "engines": { - "node": ">=0.8.0" + "node": ">=10.0.0" } }, "node_modules/string_decoder": { @@ -17577,9 +17516,9 @@ } }, "node_modules/typeorm/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dependencies": { "balanced-match": "^1.0.0" } diff --git a/package.json b/package.json index 67ab12248..b757a105a 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "agentkeepalive": "4.2.1", "amqp-connection-manager": "3.7.0", "amqplib": "0.8.0", - "axios": "1.7.4", + "axios": "1.8.1", "axios-retry": "4.5.0", "bignumber.js": "9.0.1", "clarifai-nodejs-grpc": "10.8.7", @@ -79,7 +79,7 @@ "graphql-query-complexity": "0.12.0", "graphql-relay": "0.10.0", "graphql-tools": "8.3.18", - "graphql-upload": "13.0.0", + "graphql-upload-ts": "^2.1.2", "helmet": "4.4.1", "jwks-rsa": "2.0.3", "moment": "^2.29.4", @@ -106,7 +106,7 @@ "@nestjs/cli": "10.4.5", "@nestjs/schematics": "10.1.4", "@nestjs/testing": "10.4.4", - "@types/express": "5.0.0", + "@types/express": "4.0.29", "@types/graphql-relay": "^0.6.0", "@types/jest": "29.5.0", "@types/node": "^14.14.42", diff --git a/src/main.ts b/src/main.ts index b2f3e13f8..fbc55e50a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,24 +1,24 @@ import { ValidationPipe } from '@nestjs/common'; import { HttpAdapterHost, NestFactory } from '@nestjs/core'; +import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import BigNumber from 'bignumber.js'; +import { graphqlUploadExpress } from 'graphql-upload-ts'; import { AppModule } from './app.module'; -import { MicroserviceOptions, Transport } from '@nestjs/microservices'; +import { ports } from './config'; import { CacheWarmerModule } from './crons/cache.warmer/cache.warmer.module'; import { ClaimableModule } from './crons/claimable/claimable.auction.module'; -import { LoggingInterceptor } from './modules/metrics/logging.interceptor'; -import { PrivateAppModule } from './private.app.module'; -import { RabbitMqProcessorModule } from './rabbitmq.processor.module'; import { ElasticNsfwUpdaterModule } from './crons/elastic.updater/elastic-nsfw.updater.module'; import { ElasticRarityUpdaterModule } from './crons/elastic.updater/elastic-rarity.updater.module'; -import { CacheEventsModule } from './modules/rabbitmq/cache-invalidation/cache-events.module'; -import { ElasticTraitsUpdaterModule } from './crons/elastic.updater/elastic-traits.updater.module'; import { ElasticNftScamUpdaterModule } from './crons/elastic.updater/elastic-scam.updater.module'; -import { ports } from './config'; -import { LoggerService } from './utils/LoggerService'; -import { graphqlUploadExpress } from 'graphql-upload'; -import { PubSubListenerModule } from './pubsub/pub.sub.listener.module'; +import { ElasticTraitsUpdaterModule } from './crons/elastic.updater/elastic-traits.updater.module'; import { ApiConfigModule } from './modules/common/api-config/api.config.module'; import { ApiConfigService } from './modules/common/api-config/api.config.service'; +import { LoggingInterceptor } from './modules/metrics/logging.interceptor'; +import { CacheEventsModule } from './modules/rabbitmq/cache-invalidation/cache-events.module'; +import { PrivateAppModule } from './private.app.module'; +import { PubSubListenerModule } from './pubsub/pub.sub.listener.module'; +import { RabbitMqProcessorModule } from './rabbitmq.processor.module'; +import { LoggerService } from './utils/LoggerService'; async function bootstrap() { BigNumber.config({ EXPONENTIAL_AT: [-100, 100] }); diff --git a/src/modules/assets/assets-mutations.resolver.ts b/src/modules/assets/assets-mutations.resolver.ts index c1e7a4d6d..1ee1f6f78 100644 --- a/src/modules/assets/assets-mutations.resolver.ts +++ b/src/modules/assets/assets-mutations.resolver.ts @@ -1,17 +1,17 @@ -import { Resolver, Args, Mutation } from '@nestjs/graphql'; -import { BaseResolver } from '../common/base.resolver'; -import { AssetsTransactionService } from '.'; -import { Asset, CreateNftArgs, TransferNftArgs, HandleQuantityArgs, AddLikeArgs, RemoveLikeArgs } from './models'; -import { GraphQLUpload, FileUpload } from 'graphql-upload'; -import { AssetsLikesService } from './assets-likes.service'; import { UseGuards } from '@nestjs/common'; -import { ContentValidation } from './content.validation.service'; -import { TransactionNode } from '../common/transaction'; -import { CreateNftRequest, UpdateQuantityRequest, TransferNftRequest, CreateNftWithMultipleFilesRequest } from './models/requests'; +import { Args, Mutation, Resolver } from '@nestjs/graphql'; +import { GraphQLUpload, Upload } from 'graphql-upload-ts'; +import { AssetsTransactionService } from '.'; import { AuthorizationHeader } from '../auth/authorization-header'; -import { JwtOrNativeAuthGuard } from '../auth/jwt.or.native.auth-guard'; import { AuthUser } from '../auth/authUser'; +import { JwtOrNativeAuthGuard } from '../auth/jwt.or.native.auth-guard'; import { UserAuthResult } from '../auth/userAuthResult'; +import { BaseResolver } from '../common/base.resolver'; +import { TransactionNode } from '../common/transaction'; +import { AssetsLikesService } from './assets-likes.service'; +import { ContentValidation } from './content.validation.service'; +import { AddLikeArgs, Asset, CreateNftArgs, HandleQuantityArgs, RemoveLikeArgs, TransferNftArgs } from './models'; +import { CreateNftRequest, CreateNftWithMultipleFilesRequest, TransferNftRequest, UpdateQuantityRequest } from './models/requests'; @Resolver(() => Asset) export class AssetsMutationsResolver extends BaseResolver(Asset) { @@ -27,7 +27,7 @@ export class AssetsMutationsResolver extends BaseResolver(Asset) { @UseGuards(JwtOrNativeAuthGuard) async createNft( @Args('input', { type: () => CreateNftArgs }) input: CreateNftArgs, - @Args({ name: 'file', type: () => GraphQLUpload }) file: FileUpload, + @Args({ name: 'file', type: () => GraphQLUpload }) file: Upload, @AuthUser() user: UserAuthResult, ): Promise { const request = CreateNftRequest.fromArgs(input, file); @@ -38,7 +38,7 @@ export class AssetsMutationsResolver extends BaseResolver(Asset) { @UseGuards(JwtOrNativeAuthGuard) async createNftWithMultipleFiles( @Args('input', { type: () => CreateNftArgs }) input: CreateNftArgs, - @Args({ name: 'files', type: () => [GraphQLUpload] }) files: [FileUpload], + @Args({ name: 'files', type: () => [GraphQLUpload] }) files: [Upload], @AuthUser() user: UserAuthResult, ): Promise { const request = CreateNftWithMultipleFilesRequest.fromArgs(input, files); @@ -47,7 +47,7 @@ export class AssetsMutationsResolver extends BaseResolver(Asset) { @Mutation(() => Boolean) @UseGuards(JwtOrNativeAuthGuard) - async verifyContent(@Args({ name: 'file', type: () => GraphQLUpload }) file: FileUpload): Promise { + async verifyContent(@Args({ name: 'file', type: () => GraphQLUpload }) file: Upload): Promise { const fileData = await file; const contentStatus = (await this.contentValidation.checkContentType(fileData).checkContentSensitivity(fileData)).getStatus(); diff --git a/src/modules/assets/assets-transaction.service.ts b/src/modules/assets/assets-transaction.service.ts index c634235b1..610c170b4 100644 --- a/src/modules/assets/assets-transaction.service.ts +++ b/src/modules/assets/assets-transaction.service.ts @@ -13,7 +13,7 @@ import { RedisCacheService } from '@multiversx/sdk-nestjs-cache'; import { Constants } from '@multiversx/sdk-nestjs-common'; import { Injectable, Logger, NotFoundException } from '@nestjs/common'; import BigNumber from 'bignumber.js'; -import { FileUpload } from 'graphql-upload'; +import { Upload } from 'graphql-upload-ts'; import { MxApiService } from 'src/common'; import { MxStats } from 'src/common/services/mx-communication/models/mx-stats.model'; import { gas, mxConfig } from 'src/config'; @@ -141,7 +141,7 @@ export class AssetsTransactionService { return assetMetadata; } - private async uploadFileToPinata(fileUpload: FileUpload) { + private async uploadFileToPinata(fileUpload: Upload) { const file = await fileUpload; const fileData = await this.pinataService.uploadFile(file); await this.s3Service.upload(file, fileData.hash); diff --git a/src/modules/assets/models/requests/CreateNftRequest.ts b/src/modules/assets/models/requests/CreateNftRequest.ts index b92d2d4a1..bd32db3aa 100644 --- a/src/modules/assets/models/requests/CreateNftRequest.ts +++ b/src/modules/assets/models/requests/CreateNftRequest.ts @@ -1,4 +1,4 @@ -import { FileUpload } from 'graphql-upload'; +import { Upload } from 'graphql-upload-ts'; import { CreateNftArgs } from '../CreateNftArgs'; export class CreateNftRequest { @@ -7,13 +7,13 @@ export class CreateNftRequest { name: string; royalties: string = '0'; attributes: Attribute; - file: FileUpload; + file: Upload; constructor(init?: Partial) { Object.assign(this, init); } - static fromArgs(nftArgs: CreateNftArgs, file: FileUpload) { + static fromArgs(nftArgs: CreateNftArgs, file: Upload) { return new CreateNftRequest({ collection: nftArgs.collection, quantity: nftArgs.quantity, @@ -39,13 +39,13 @@ export class CreateNftWithMultipleFilesRequest { name: string; royalties: string = '0'; attributes: Attribute; - files: FileUpload[]; + files: Upload[]; constructor(init?: Partial) { Object.assign(this, init); } - static fromArgs(nftArgs: CreateNftArgs, files: FileUpload[]) { + static fromArgs(nftArgs: CreateNftArgs, files: Upload[]) { return new CreateNftWithMultipleFilesRequest({ collection: nftArgs.collection, quantity: nftArgs.quantity, From 43cc301687de001be2eed11807ab14e81394100c Mon Sep 17 00:00:00 2001 From: danielailie Date: Thu, 12 Jun 2025 14:23:22 +0300 Subject: [PATCH 02/11] Add logging --- src/modules/assets/assets-transaction.service.ts | 10 +++++++++- src/modules/ipfs/pinata.service.ts | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/modules/assets/assets-transaction.service.ts b/src/modules/assets/assets-transaction.service.ts index 610c170b4..2c1c94adc 100644 --- a/src/modules/assets/assets-transaction.service.ts +++ b/src/modules/assets/assets-transaction.service.ts @@ -117,7 +117,15 @@ export class AssetsTransactionService { for (const file of filesData) { uris.push(file.url); } - + console.log({ + col: request.collection, + q: request.quantity, + n: request.name, + r: request.royalties, + has: filesData[0].hash, + attributes, + uris, + }); const transaction = factory.createTransactionForCreatingNFT(Address.newFromBech32(ownerAddress), { tokenIdentifier: request.collection, initialQuantity: BigInt(request.quantity), diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index 8155445b7..83da95bc9 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -25,6 +25,7 @@ export class PinataService { Authorization: `Bearer ${process.env.PINATA_JWT}`, }, }); + return this.mapReturnType(response.data.cid); } catch (error) { this.logger.error('An error occurred while trying to add file to pinata.', { @@ -75,6 +76,7 @@ export class PinataService { } private mapReturnType(path: any): UploadToIpfsResult | PromiseLike { + console.log({ path, url: this.getUrl(path) }); return new UploadToIpfsResult({ hash: path, url: this.getUrl(path), From 687a45087909d9e4ba927183654009e8428e0dbc Mon Sep 17 00:00:00 2001 From: danielailie Date: Thu, 12 Jun 2025 14:34:30 +0300 Subject: [PATCH 03/11] Update upload pinata --- src/modules/ipfs/pinata.service.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index 83da95bc9..8126ea573 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -1,4 +1,5 @@ import { Injectable, Logger } from '@nestjs/common'; +import { Upload } from 'graphql-upload-ts'; import { PinataUploadError } from 'src/common/models/errors/pinata-upload.error'; import { fileStorage } from 'src/config'; import { Readable } from 'stream'; @@ -12,11 +13,14 @@ const FormData = require('form-data'); export class PinataService { constructor(private readonly logger: Logger) {} - async uploadFile(file: any): Promise { + async uploadFile(file: Upload): Promise { const url = `${process.env.PINATA_API_URL}/v3/files`; - const readStream = await file.createReadStream(); + + const { createReadStream, filename } = file.file; + + const readStream = await createReadStream(); const data = new FormData(); - data.append('file', readStream, file.filename); + data.append('file', readStream, filename); data.append('network', 'public'); try { const response = await axios.post(url, data, { From db5fec20cdbc503d58a365cad90e5a540b673fe1 Mon Sep 17 00:00:00 2001 From: danielailie Date: Thu, 12 Jun 2025 15:56:51 +0300 Subject: [PATCH 04/11] Add logging --- src/modules/ipfs/pinata.service.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index 8126ea573..12eee8f17 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -1,5 +1,4 @@ import { Injectable, Logger } from '@nestjs/common'; -import { Upload } from 'graphql-upload-ts'; import { PinataUploadError } from 'src/common/models/errors/pinata-upload.error'; import { fileStorage } from 'src/config'; import { Readable } from 'stream'; @@ -13,14 +12,13 @@ const FormData = require('form-data'); export class PinataService { constructor(private readonly logger: Logger) {} - async uploadFile(file: Upload): Promise { + async uploadFile(file: any): Promise { const url = `${process.env.PINATA_API_URL}/v3/files`; - - const { createReadStream, filename } = file.file; - - const readStream = await createReadStream(); + const wa = await file; + console.log({ file, wa }); + const readStream = await wa.createReadStream(); const data = new FormData(); - data.append('file', readStream, filename); + data.append('file', readStream, file.filename); data.append('network', 'public'); try { const response = await axios.post(url, data, { From 59667a75c5e81c327ee5f380991c01d048850321 Mon Sep 17 00:00:00 2001 From: danielailie Date: Mon, 16 Jun 2025 10:26:37 +0300 Subject: [PATCH 05/11] Update pinata upload --- src/modules/ipfs/pinata.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index 12eee8f17..d7136ea85 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -14,9 +14,9 @@ export class PinataService { async uploadFile(file: any): Promise { const url = `${process.env.PINATA_API_URL}/v3/files`; - const wa = await file; - console.log({ file, wa }); - const readStream = await wa.createReadStream(); + console.log({ file }); + const readStream = file.createReadStream(); + console.log({ readStream }); const data = new FormData(); data.append('file', readStream, file.filename); data.append('network', 'public'); From a3b64d5c9ef2020bb73850869679ae6557c66f53 Mon Sep 17 00:00:00 2001 From: danielailie Date: Mon, 16 Jun 2025 10:59:51 +0300 Subject: [PATCH 06/11] Update pinata upload --- src/modules/ipfs/pinata.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index d7136ea85..84375cf7b 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -15,10 +15,10 @@ export class PinataService { async uploadFile(file: any): Promise { const url = `${process.env.PINATA_API_URL}/v3/files`; console.log({ file }); - const readStream = file.createReadStream(); - console.log({ readStream }); + const { createReadStream, filename /*, fieldName, mimetype, encoding */ } = await file; + console.log({ filename }); const data = new FormData(); - data.append('file', readStream, file.filename); + data.append('file', createReadStream, filename); data.append('network', 'public'); try { const response = await axios.post(url, data, { From d0e16542c59131b73bf5d18340f11d2363f54fd7 Mon Sep 17 00:00:00 2001 From: danielailie Date: Mon, 16 Jun 2025 11:11:52 +0300 Subject: [PATCH 07/11] Update logginh --- src/modules/ipfs/pinata.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index 84375cf7b..4f48af1bf 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -16,9 +16,9 @@ export class PinataService { const url = `${process.env.PINATA_API_URL}/v3/files`; console.log({ file }); const { createReadStream, filename /*, fieldName, mimetype, encoding */ } = await file; - console.log({ filename }); + console.log({ filename, CRS: createReadStream() }); const data = new FormData(); - data.append('file', createReadStream, filename); + data.append('file', createReadStream(), filename); data.append('network', 'public'); try { const response = await axios.post(url, data, { From 1a235753aa3ce7caa5242a0db812a6a7da95c1fe Mon Sep 17 00:00:00 2001 From: danielailie Date: Mon, 16 Jun 2025 14:59:44 +0300 Subject: [PATCH 08/11] Fix upload --- src/modules/assets/assets-mutations.resolver.ts | 15 ++++++++------- src/modules/assets/assets-transaction.service.ts | 10 +++++----- .../assets/models/requests/CreateNftRequest.ts | 10 +++++----- src/modules/ipfs/pinata.service.ts | 2 -- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/modules/assets/assets-mutations.resolver.ts b/src/modules/assets/assets-mutations.resolver.ts index 1ee1f6f78..2561312ac 100644 --- a/src/modules/assets/assets-mutations.resolver.ts +++ b/src/modules/assets/assets-mutations.resolver.ts @@ -1,6 +1,6 @@ import { UseGuards } from '@nestjs/common'; import { Args, Mutation, Resolver } from '@nestjs/graphql'; -import { GraphQLUpload, Upload } from 'graphql-upload-ts'; +import { FileUpload, GraphQLUpload } from 'graphql-upload-ts'; import { AssetsTransactionService } from '.'; import { AuthorizationHeader } from '../auth/authorization-header'; import { AuthUser } from '../auth/authUser'; @@ -24,21 +24,22 @@ export class AssetsMutationsResolver extends BaseResolver(Asset) { } @Mutation(() => TransactionNode) - @UseGuards(JwtOrNativeAuthGuard) + // @UseGuards(JwtOrNativeAuthGuard) async createNft( @Args('input', { type: () => CreateNftArgs }) input: CreateNftArgs, - @Args({ name: 'file', type: () => GraphQLUpload }) file: Upload, - @AuthUser() user: UserAuthResult, + @Args({ name: 'file', type: () => GraphQLUpload }) file: FileUpload, + // @AuthUser() user: UserAuthResult, ): Promise { + console.log(1313131); const request = CreateNftRequest.fromArgs(input, file); - return await this.assetsTransactionService.createNft(user.address, request); + return await this.assetsTransactionService.createNft('erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th', request); } @Mutation(() => TransactionNode) @UseGuards(JwtOrNativeAuthGuard) async createNftWithMultipleFiles( @Args('input', { type: () => CreateNftArgs }) input: CreateNftArgs, - @Args({ name: 'files', type: () => [GraphQLUpload] }) files: [Upload], + @Args({ name: 'files', type: () => [GraphQLUpload] }) files: [FileUpload], @AuthUser() user: UserAuthResult, ): Promise { const request = CreateNftWithMultipleFilesRequest.fromArgs(input, files); @@ -47,7 +48,7 @@ export class AssetsMutationsResolver extends BaseResolver(Asset) { @Mutation(() => Boolean) @UseGuards(JwtOrNativeAuthGuard) - async verifyContent(@Args({ name: 'file', type: () => GraphQLUpload }) file: Upload): Promise { + async verifyContent(@Args({ name: 'file', type: () => GraphQLUpload }) file: FileUpload): Promise { const fileData = await file; const contentStatus = (await this.contentValidation.checkContentType(fileData).checkContentSensitivity(fileData)).getStatus(); diff --git a/src/modules/assets/assets-transaction.service.ts b/src/modules/assets/assets-transaction.service.ts index 2c1c94adc..4d4e6cf64 100644 --- a/src/modules/assets/assets-transaction.service.ts +++ b/src/modules/assets/assets-transaction.service.ts @@ -13,7 +13,7 @@ import { RedisCacheService } from '@multiversx/sdk-nestjs-cache'; import { Constants } from '@multiversx/sdk-nestjs-common'; import { Injectable, Logger, NotFoundException } from '@nestjs/common'; import BigNumber from 'bignumber.js'; -import { Upload } from 'graphql-upload-ts'; +import { FileUpload } from 'graphql-upload-ts'; import { MxApiService } from 'src/common'; import { MxStats } from 'src/common/services/mx-communication/models/mx-stats.model'; import { gas, mxConfig } from 'src/config'; @@ -149,10 +149,10 @@ export class AssetsTransactionService { return assetMetadata; } - private async uploadFileToPinata(fileUpload: Upload) { - const file = await fileUpload; - const fileData = await this.pinataService.uploadFile(file); - await this.s3Service.upload(file, fileData.hash); + private async uploadFileToPinata(fileUpload: FileUpload) { + console.log(3333); + const fileData = await this.pinataService.uploadFile(fileUpload); + await this.s3Service.upload(fileUpload, fileData.hash); return fileData; } diff --git a/src/modules/assets/models/requests/CreateNftRequest.ts b/src/modules/assets/models/requests/CreateNftRequest.ts index bd32db3aa..4833722bc 100644 --- a/src/modules/assets/models/requests/CreateNftRequest.ts +++ b/src/modules/assets/models/requests/CreateNftRequest.ts @@ -1,4 +1,4 @@ -import { Upload } from 'graphql-upload-ts'; +import { FileUpload } from 'graphql-upload-ts'; import { CreateNftArgs } from '../CreateNftArgs'; export class CreateNftRequest { @@ -7,13 +7,13 @@ export class CreateNftRequest { name: string; royalties: string = '0'; attributes: Attribute; - file: Upload; + file: FileUpload; constructor(init?: Partial) { Object.assign(this, init); } - static fromArgs(nftArgs: CreateNftArgs, file: Upload) { + static fromArgs(nftArgs: CreateNftArgs, file: FileUpload) { return new CreateNftRequest({ collection: nftArgs.collection, quantity: nftArgs.quantity, @@ -39,13 +39,13 @@ export class CreateNftWithMultipleFilesRequest { name: string; royalties: string = '0'; attributes: Attribute; - files: Upload[]; + files: FileUpload[]; constructor(init?: Partial) { Object.assign(this, init); } - static fromArgs(nftArgs: CreateNftArgs, files: Upload[]) { + static fromArgs(nftArgs: CreateNftArgs, files: FileUpload[]) { return new CreateNftWithMultipleFilesRequest({ collection: nftArgs.collection, quantity: nftArgs.quantity, diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index 4f48af1bf..f69c0b5f2 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -14,9 +14,7 @@ export class PinataService { async uploadFile(file: any): Promise { const url = `${process.env.PINATA_API_URL}/v3/files`; - console.log({ file }); const { createReadStream, filename /*, fieldName, mimetype, encoding */ } = await file; - console.log({ filename, CRS: createReadStream() }); const data = new FormData(); data.append('file', createReadStream(), filename); data.append('network', 'public'); From b22f8c775b14e6312660c67a6397568626c3bf7d Mon Sep 17 00:00:00 2001 From: danielailie Date: Mon, 16 Jun 2025 15:11:14 +0300 Subject: [PATCH 09/11] Add logging --- src/modules/ipfs/pinata.service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index f69c0b5f2..cee381328 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -26,6 +26,7 @@ export class PinataService { }, }); + console.log({ response }); return this.mapReturnType(response.data.cid); } catch (error) { this.logger.error('An error occurred while trying to add file to pinata.', { From 2621fe5cffde71b540fbb7bcf7a81198e6444ec3 Mon Sep 17 00:00:00 2001 From: danielailie Date: Mon, 16 Jun 2025 15:16:38 +0300 Subject: [PATCH 10/11] Remove console.logs --- src/app.module.ts | 60 +++++++++---------- .../assets/assets-mutations.resolver.ts | 7 +-- .../assets/assets-transaction.service.ts | 10 ---- src/modules/ipfs/pinata.service.ts | 6 +- 4 files changed, 35 insertions(+), 48 deletions(-) diff --git a/src/app.module.ts b/src/app.module.ts index 4cbb5743f..f1847606c 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -1,46 +1,46 @@ -import { Module } from '@nestjs/common'; -import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo'; import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default'; +import '@multiversx/sdk-nestjs-common/lib/utils/extensions/array.extensions'; +import '@multiversx/sdk-nestjs-common/lib/utils/extensions/date.extensions'; +import '@multiversx/sdk-nestjs-common/lib/utils/extensions/number.extensions'; +import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo'; +import { Module } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config/dist'; import { GraphQLModule } from '@nestjs/graphql'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { GraphQLError, GraphQLFormattedError } from 'graphql'; import 'reflect-metadata'; -import { CollectionsModuleGraph } from './modules/nftCollections/collections.module'; +import { CommonModule } from './common.module'; +import { PersistenceModule } from './common/persistence/persistence.module'; +import { TimescaleDbModule } from './common/persistence/timescaledb/timescaledb.module'; +import { AccountsStatsModuleGraph } from './modules/account-stats/accounts-stats.module'; +import { AdminOperationsModuleGraph } from './modules/admins/admin-operations.module'; +import { ArtistsModuleGraph } from './modules/artists/artists.module'; +import { AssetHistoryModuleGraph } from './modules/asset-history/asset-history.module'; import { AssetsModuleGraph } from './modules/assets/assets.module'; import { AuctionsModuleGraph } from './modules/auctions/auctions.module'; -import { OrdersModuleGraph } from './modules/orders/orders.module'; -import { IpfsModule } from './modules/ipfs/ipfs.module'; -import { GraphQLError, GraphQLFormattedError } from 'graphql'; import { AuthModule } from './modules/auth/auth.module'; -import { CommonModule } from './common.module'; -import { AssetHistoryModuleGraph } from './modules/asset-history/asset-history.module'; +import { BlacklistedCollectionsModule } from './modules/blacklist/blacklisted-collections.module'; +import { CampaignsModuleGraph } from './modules/campaigns/campaigns.module'; +import { CollectionsStatsModuleGraph } from './modules/collection-stats/collections-stats.module'; +import { ComplexityPlugin } from './modules/common/complexity.plugin'; +import { ExploreStatsModuleGraph } from './modules/explore-stats/explore-stats.module'; import { FeaturedModuleGraph } from './modules/featured/featured.module'; +import { IpfsModule } from './modules/ipfs/ipfs.module'; +import { MarketplacesModuleGraph } from './modules/marketplaces/marketplaces.module'; +import { MintersModuleGraph } from './modules/minters/minters.module'; +import { NftRarityModuleGraph } from './modules/nft-rarity/nft-rarity.module'; +import { CollectionsModuleGraph } from './modules/nftCollections/collections.module'; +import { NotificationsModuleGraph } from './modules/notifications/notifications.module'; +import { OrdersModuleGraph } from './modules/orders/orders.module'; import { OwnersModuleGraph } from './modules/owners/owners.module'; -import { AccountsStatsModuleGraph } from './modules/account-stats/accounts-stats.module'; -import { UsdPriceModuleGraph } from './modules/usdPrice/usd-price.module'; -import { TrendingModuleGraph } from './modules/trending/trending.module'; +import { ProxyDeployerModuleGraph } from './modules/proxy-deployer/proxy-deployer.module'; import { ReportsModuleGraph } from './modules/reports/reports.module'; -import { CampaignsModuleGraph } from './modules/campaigns/campaigns.module'; -import { CollectionsStatsModuleGraph } from './modules/collection-stats/collections-stats.module'; +import { ScamModule } from './modules/scam/scam.module'; import { SearchModuleGraph } from './modules/search/search.module'; import { TagsModuleGraph } from './modules/tags/tags.module'; -import { NftRarityModuleGraph } from './modules/nft-rarity/nft-rarity.module'; -import { AdminOperationsModuleGraph } from './modules/admins/admin-operations.module'; -import { NotificationsModuleGraph } from './modules/notifications/notifications.module'; +import { TrendingModuleGraph } from './modules/trending/trending.module'; +import { UsdPriceModuleGraph } from './modules/usdPrice/usd-price.module'; import * as ormconfig from './ormconfig'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { MarketplacesModuleGraph } from './modules/marketplaces/marketplaces.module'; -import { ArtistsModuleGraph } from './modules/artists/artists.module'; -import { ExploreStatsModuleGraph } from './modules/explore-stats/explore-stats.module'; -import { ScamModule } from './modules/scam/scam.module'; -import { ComplexityPlugin } from './modules/common/complexity.plugin'; -import { BlacklistedCollectionsModule } from './modules/blacklist/blacklisted-collections.module'; -import '@multiversx/sdk-nestjs-common/lib/utils/extensions/date.extensions'; -import '@multiversx/sdk-nestjs-common/lib/utils/extensions/array.extensions'; -import '@multiversx/sdk-nestjs-common/lib/utils/extensions/number.extensions'; -import { TimescaleDbModule } from './common/persistence/timescaledb/timescaledb.module'; -import { MintersModuleGraph } from './modules/minters/minters.module'; -import { PersistenceModule } from './common/persistence/persistence.module'; -import { ProxyDeployerModuleGraph } from './modules/proxy-deployer/proxy-deployer.module'; @Module({ imports: [ diff --git a/src/modules/assets/assets-mutations.resolver.ts b/src/modules/assets/assets-mutations.resolver.ts index 2561312ac..9747852c6 100644 --- a/src/modules/assets/assets-mutations.resolver.ts +++ b/src/modules/assets/assets-mutations.resolver.ts @@ -24,15 +24,14 @@ export class AssetsMutationsResolver extends BaseResolver(Asset) { } @Mutation(() => TransactionNode) - // @UseGuards(JwtOrNativeAuthGuard) + @UseGuards(JwtOrNativeAuthGuard) async createNft( @Args('input', { type: () => CreateNftArgs }) input: CreateNftArgs, @Args({ name: 'file', type: () => GraphQLUpload }) file: FileUpload, - // @AuthUser() user: UserAuthResult, + @AuthUser() user: UserAuthResult, ): Promise { - console.log(1313131); const request = CreateNftRequest.fromArgs(input, file); - return await this.assetsTransactionService.createNft('erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th', request); + return await this.assetsTransactionService.createNft(user.address, request); } @Mutation(() => TransactionNode) diff --git a/src/modules/assets/assets-transaction.service.ts b/src/modules/assets/assets-transaction.service.ts index 4d4e6cf64..d48409f1e 100644 --- a/src/modules/assets/assets-transaction.service.ts +++ b/src/modules/assets/assets-transaction.service.ts @@ -117,15 +117,6 @@ export class AssetsTransactionService { for (const file of filesData) { uris.push(file.url); } - console.log({ - col: request.collection, - q: request.quantity, - n: request.name, - r: request.royalties, - has: filesData[0].hash, - attributes, - uris, - }); const transaction = factory.createTransactionForCreatingNFT(Address.newFromBech32(ownerAddress), { tokenIdentifier: request.collection, initialQuantity: BigInt(request.quantity), @@ -150,7 +141,6 @@ export class AssetsTransactionService { } private async uploadFileToPinata(fileUpload: FileUpload) { - console.log(3333); const fileData = await this.pinataService.uploadFile(fileUpload); await this.s3Service.upload(fileUpload, fileData.hash); return fileData; diff --git a/src/modules/ipfs/pinata.service.ts b/src/modules/ipfs/pinata.service.ts index cee381328..e26ea3df9 100644 --- a/src/modules/ipfs/pinata.service.ts +++ b/src/modules/ipfs/pinata.service.ts @@ -26,8 +26,7 @@ export class PinataService { }, }); - console.log({ response }); - return this.mapReturnType(response.data.cid); + return this.mapReturnType(response.data.data.cid); } catch (error) { this.logger.error('An error occurred while trying to add file to pinata.', { path: 'PinataService.uploadFile', @@ -61,7 +60,7 @@ export class PinataService { }, }); - return this.mapReturnType(response.data.cid); + return this.mapReturnType(response.data.data.cid); } catch (error) { this.logger.error('An error occurred while trying to add file to pinata.', { path: 'PinataService.uploadText', @@ -77,7 +76,6 @@ export class PinataService { } private mapReturnType(path: any): UploadToIpfsResult | PromiseLike { - console.log({ path, url: this.getUrl(path) }); return new UploadToIpfsResult({ hash: path, url: this.getUrl(path), From 1f9580c0da7e4d6102b16fad3254252352412d2a Mon Sep 17 00:00:00 2001 From: danielailie Date: Mon, 16 Jun 2025 15:32:27 +0300 Subject: [PATCH 11/11] Fix dependencies --- .../rabbitmq/blockchain-events/feed-events.service.ts | 9 +++++---- .../handlers/startAuction-event.handler.ts | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/rabbitmq/blockchain-events/feed-events.service.ts b/src/modules/rabbitmq/blockchain-events/feed-events.service.ts index 72979d081..844546518 100644 --- a/src/modules/rabbitmq/blockchain-events/feed-events.service.ts +++ b/src/modules/rabbitmq/blockchain-events/feed-events.service.ts @@ -1,21 +1,22 @@ -import { Injectable } from '@nestjs/common'; +import { forwardRef, Inject, Injectable } from '@nestjs/common'; import { CollectionApi } from 'src/common'; -import { MxFeedService } from 'src/common/services/mx-communication/mx-feed.service'; import { EventEnum, Feed } from 'src/common/services/mx-communication/models/feed.dto'; +import { MxFeedService } from 'src/common/services/mx-communication/mx-feed.service'; import { AuctionEntity } from 'src/db/auctions'; +import { OfferEntity } from 'src/db/offers'; import { OrderEntity } from 'src/db/orders'; import { AssetByIdentifierService } from 'src/modules/assets'; import { Marketplace } from 'src/modules/marketplaces/models'; import { Order } from 'src/modules/orders/models'; +import { Token } from 'src/modules/usdPrice/Token.model'; import { UsdPriceService } from 'src/modules/usdPrice/usd-price.service'; import { MintEvent } from '../entities/auction/mint.event'; -import { OfferEntity } from 'src/db/offers'; -import { Token } from 'src/modules/usdPrice/Token.model'; @Injectable() export class FeedEventsSenderService { constructor( private accountFeedService: MxFeedService, + @Inject(forwardRef(() => AssetByIdentifierService)) private assetByIdentifierService: AssetByIdentifierService, private readonly usdPriceService: UsdPriceService, ) {} diff --git a/src/modules/rabbitmq/blockchain-events/handlers/startAuction-event.handler.ts b/src/modules/rabbitmq/blockchain-events/handlers/startAuction-event.handler.ts index 270a9a345..357aea793 100644 --- a/src/modules/rabbitmq/blockchain-events/handlers/startAuction-event.handler.ts +++ b/src/modules/rabbitmq/blockchain-events/handlers/startAuction-event.handler.ts @@ -2,7 +2,7 @@ import { Inject, Injectable, Logger, forwardRef } from '@nestjs/common'; import { mxConfig } from 'src/config'; import { AuctionEntity } from 'src/db/auctions'; import { AssetByIdentifierService } from 'src/modules/assets'; -import { KroganSwapAuctionEventEnum, ExternalAuctionEventEnum } from 'src/modules/assets/models'; +import { ExternalAuctionEventEnum, KroganSwapAuctionEventEnum } from 'src/modules/assets/models'; import { AuctionsGetterService, AuctionsSetterService } from 'src/modules/auctions'; import { ElrondSwapAuctionTypeEnum } from 'src/modules/auctions/models'; import { MarketplacesService } from 'src/modules/marketplaces/marketplaces.service'; @@ -22,6 +22,7 @@ export class StartAuctionEventHandler { private auctionsSetterService: AuctionsSetterService, private auctionsGetterService: AuctionsGetterService, private feedEventsSenderService: FeedEventsSenderService, + @Inject(forwardRef(() => AssetByIdentifierService)) private assetByIdentifierService: AssetByIdentifierService, private usdPriceService: UsdPriceService, @Inject(forwardRef(() => MarketplacesService))