diff --git a/src/common/api-config/api.config.service.ts b/src/common/api-config/api.config.service.ts index a1e79e5ec..caa42d10b 100644 --- a/src/common/api-config/api.config.service.ts +++ b/src/common/api-config/api.config.service.ts @@ -367,10 +367,6 @@ export class ApiConfigService { return this.configService.get('features.processNfts.enabled') ?? this.configService.get('flags.processNfts') ?? false; } - isGraphQlActive(): boolean { - return this.configService.get('api.graphql') ?? false; - } - getIsPublicApiActive(): boolean { const isApiActive = this.configService.get('api.public'); if (isApiActive === undefined) { diff --git a/src/common/assets/entities/account.assets.social.ts b/src/common/assets/entities/account.assets.social.ts index 6a5a8bdfb..8bd923fbc 100644 --- a/src/common/assets/entities/account.assets.social.ts +++ b/src/common/assets/entities/account.assets.social.ts @@ -1,4 +1,4 @@ -import { Field, ObjectType } from "@nestjs/graphql"; +import { ObjectType } from "@nestjs/graphql"; @ObjectType("AccountAssetsSocial", { description: "Account assets social object type." }) export class AccountAssetsSocial { @@ -6,42 +6,17 @@ export class AccountAssetsSocial { Object.assign(this, init); } - @Field(() => String, { description: "Website asset for the given account asset." }) website: string = ''; - - @Field(() => String, { description: "Email asset for the given account asset." }) email: string = ''; - - @Field(() => String, { description: "Blog asset for the given account asset." }) blog: string = ''; - - @Field(() => String, { description: "Twitter asset for the given account asset." }) twitter: string = ''; - - @Field(() => String, { description: "Discord asset for the given account asset." }) discord: string = ''; - - @Field(() => String, { description: "Telegram asset for the given account asset." }) telegram: string = ''; - - @Field(() => String, { description: "Facebook asset for the given account asset." }) facebook: string = ''; - - @Field(() => String, { description: "Instagram asset for the given account asset." }) instagram: string = ''; - - @Field(() => String, { description: "YouTube asset for the given account asset." }) youtube: string = ''; - - @Field(() => String, { description: "Whitepaper asset for the given account asset." }) whitepaper: string = ''; - - @Field(() => String, { description: "Coinmarketcap asset for the given account asset." }) coinmarketcap: string = ''; - - @Field(() => String, { description: "Coingecko asset for the given account asset." }) coingecko: string = ''; - - @Field(() => String, { description: "Linkedin asset for the given account asset." }) linkedin: string = ''; } diff --git a/src/common/assets/entities/account.assets.ts b/src/common/assets/entities/account.assets.ts index dff920aea..7ef54ea16 100644 --- a/src/common/assets/entities/account.assets.ts +++ b/src/common/assets/entities/account.assets.ts @@ -1,4 +1,4 @@ -import { Field, ObjectType } from "@nestjs/graphql"; +import { ObjectType } from "@nestjs/graphql"; import { AccountAssetsSocial } from "./account.assets.social"; @ObjectType("AccountAssets", { description: "Account assets object type." }) @@ -7,27 +7,12 @@ export class AccountAssets { Object.assign(this, init); } - @Field(() => String, { description: "Name for the given account asset." }) name: string = ''; - - @Field(() => String, { description: "Description for the given account asset." }) description: string = ''; - - @Field(() => String, { description: "Social for the given account asset." }) social: AccountAssetsSocial | undefined = undefined; - - @Field(() => [String], { description: "Tags list for the given account asset." }) tags: string[] = []; - - @Field(() => String, { description: "Proof for the given account asset.", nullable: true }) proof: string | undefined = undefined; - - @Field(() => String, { description: "Icon for the given account asset.", nullable: true }) icon: string | undefined = undefined; - - @Field(() => String, { description: "Icon PNG for the given account asset.", nullable: true }) iconPng: string | undefined = undefined; - - @Field(() => String, { description: "Icon SVG for the given account asset.", nullable: true }) iconSvg: string | undefined = undefined; } diff --git a/src/common/assets/entities/nft.rank.ts b/src/common/assets/entities/nft.rank.ts index 50df3875a..8463ca6a4 100644 --- a/src/common/assets/entities/nft.rank.ts +++ b/src/common/assets/entities/nft.rank.ts @@ -1,19 +1,15 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; - -@ObjectType("NftRank", { description: "NFT rank object type" }) export class NftRank { + constructor(init?: Partial) { if (init) { Object.assign(this, init); } } - @Field(() => String, { description: 'NFT identifier' }) @ApiProperty({ type: String }) identifier: string = ''; - @Field(() => Float, { description: 'NFT rank' }) @ApiProperty({ type: Number }) rank: number = 0; } diff --git a/src/common/assets/entities/token.assets.price.source.ts b/src/common/assets/entities/token.assets.price.source.ts index 635308e46..489935414 100644 --- a/src/common/assets/entities/token.assets.price.source.ts +++ b/src/common/assets/entities/token.assets.price.source.ts @@ -1,18 +1,13 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { TokenAssetsPriceSourceType } from "./token.assets.price.source.type"; -@ObjectType("TokenAssetsPriceSource", { description: "Token assets price source object type." }) export class TokenAssetsPriceSource { - @Field(() => String, { description: 'Type of price source', nullable: true }) @ApiProperty({ type: TokenAssetsPriceSourceType, nullable: true }) type: TokenAssetsPriceSourceType | undefined = undefined; - @Field(() => String, { description: 'URL of price source in case of customUrl type', nullable: true }) @ApiProperty({ type: String, nullable: true }) url: string | undefined = undefined; - @Field(() => String, { description: '(Optional) path to fetch the price info in case of customUrl type', nullable: true }) @ApiProperty({ type: String, nullable: true }) path: string | undefined = undefined; } diff --git a/src/common/assets/entities/token.assets.ts b/src/common/assets/entities/token.assets.ts index ebd7bb1a3..5455abfeb 100644 --- a/src/common/assets/entities/token.assets.ts +++ b/src/common/assets/entities/token.assets.ts @@ -1,59 +1,43 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; - -import GraphQLJSON from "graphql-type-json"; - import { TokenAssetStatus } from "../../../endpoints/tokens/entities/token.asset.status"; import { NftRankAlgorithm } from "./nft.rank.algorithm"; import { TokenAssetsPriceSource } from "./token.assets.price.source"; -@ObjectType("TokenAssets", { description: "Token assets object type." }) export class TokenAssets { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Website for the given token assets.' }) @ApiProperty({ type: String }) website: string = ''; - @Field(() => String, { description: 'Description for the given token assets.' }) @ApiProperty({ type: String }) description: string = ''; - @Field(() => String, { description: 'Status for the given token assets.' }) @ApiProperty({ enum: TokenAssetStatus, default: 'inactive' }) status: TokenAssetStatus = TokenAssetStatus.inactive; - @Field(() => String, { description: 'PNG URL for the given token assets.' }) @ApiProperty({ type: String }) pngUrl: string = ''; - @Field(() => String, { description: 'Name for the given token assets.' }) @ApiProperty({ type: String }) name: string = ''; - @Field(() => String, { description: 'SVG URL for the given token assets.' }) @ApiProperty({ type: String }) svgUrl: string = ''; - @Field(() => String, { description: 'Ledger signature for the given token assets.', nullable: true }) @ApiProperty({ type: String }) ledgerSignature: string | undefined; - @Field(() => GraphQLJSON, { description: 'Locked accounts for the given token assets.', nullable: true }) @ApiProperty({ type: String }) lockedAccounts: Record | undefined = undefined; - @Field(() => [String], { description: 'Extra tokens for the given token assets.', nullable: true }) @ApiProperty({ type: String, isArray: true }) extraTokens: string[] | undefined = undefined; - @Field(() => String, { description: 'Preferred ranking algorithm for NFT collections. Supported values are "trait", "statistical", "jaccardDistances", "openRarity" and "custom".', nullable: true }) @ApiProperty({ enum: NftRankAlgorithm, nullable: true }) preferredRankAlgorithm: NftRankAlgorithm | undefined = undefined; - @Field(() => TokenAssetsPriceSource, { description: 'Custom price source for the given token', nullable: true }) @ApiProperty({ enum: TokenAssetsPriceSource, nullable: true }) priceSource: TokenAssetsPriceSource | undefined = undefined; } diff --git a/src/common/entities/scam-info.dto.ts b/src/common/entities/scam-info.dto.ts index a0d795a3e..30161abc2 100644 --- a/src/common/entities/scam-info.dto.ts +++ b/src/common/entities/scam-info.dto.ts @@ -1,17 +1,14 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from '@nestjs/swagger'; import { ScamType } from './scam-type.enum'; -@ObjectType("ScamInformation", { description: "Scam information object type." }) export class ScamInfo { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ScamType, { description: "Type for the given scam information." }) + @ApiProperty({ type: String, nullable: true }) type?: string | null; - @Field(() => String, { description: "Information for the given scam.", nullable: true }) @ApiProperty({ type: String, nullable: true }) info?: string | null; diff --git a/src/common/locked-asset/entities/unlock.milestone.model.ts b/src/common/locked-asset/entities/unlock.milestone.model.ts index d807ac277..9e19bd489 100644 --- a/src/common/locked-asset/entities/unlock.milestone.model.ts +++ b/src/common/locked-asset/entities/unlock.milestone.model.ts @@ -1,13 +1,9 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType('UnlockMileStoneModel', { description: 'Unlock mile stone model object type.' }) export class UnlockMileStoneModel { - @Field(() => Float, { description: 'Remaining epochs for the given unlock mile stone model.' }) @ApiProperty({ type: Number, description: 'Remaining epochs until unlock can be performed', example: 42 }) remainingEpochs: number = 0; - @Field(() => Float, { description: 'Percent for the given unlock mile stone model.' }) @ApiProperty({ type: Number, description: 'Percent of token unlockable after the epochs pass', example: 42 }) percent: number = 0; diff --git a/src/endpoints/accounts/account.controller.ts b/src/endpoints/accounts/account.controller.ts index 3e1a51e06..8d77f4879 100644 --- a/src/endpoints/accounts/account.controller.ts +++ b/src/endpoints/accounts/account.controller.ts @@ -1299,6 +1299,7 @@ export class AccountController { @ApiQuery({ name: 'after', description: 'After timestamp', required: false }) @ApiQuery({ name: 'identifier', description: 'Filter by multiple esdt identifiers, comma-separated', required: false }) @ApiQuery({ name: 'token', description: 'Token identifier', required: false }) + @ApiOkResponse({ type: [AccountEsdtHistory] }) async getAccountEsdtHistory( @Param('address', ParseAddressPipe) address: string, @Query('from', new DefaultValuePipe(0), ParseIntPipe) from: number, diff --git a/src/endpoints/accounts/entities/account.contract.ts b/src/endpoints/accounts/entities/account.contract.ts index 7a73f8eda..e75cf782a 100644 --- a/src/endpoints/accounts/entities/account.contract.ts +++ b/src/endpoints/accounts/entities/account.contract.ts @@ -1,26 +1,20 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; -@ObjectType("AccountContract", { description: "Account contract object type." }) export class AccountContract { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Address for the given account.' }) @ApiProperty({ type: String }) address: string = ""; - @Field(() => String, { description: 'DeployTxHash for the given account.' }) @ApiProperty({ type: String }) deployTxHash: string = ""; - @Field(() => Float, { description: 'Timestamp for the given account.' }) @ApiProperty({ type: Number }) timestamp: number = 0; - @Field(() => AccountAssets, { description: 'Assets for the given account.', nullable: true }) @ApiProperty({ type: AccountAssets, nullable: true, description: 'Contract assets' }) assets: AccountAssets | undefined = undefined; } diff --git a/src/endpoints/accounts/entities/account.detailed.ts b/src/endpoints/accounts/entities/account.detailed.ts index e48c1d507..2c9f131ec 100644 --- a/src/endpoints/accounts/entities/account.detailed.ts +++ b/src/endpoints/accounts/entities/account.detailed.ts @@ -1,87 +1,74 @@ import { ComplexityEstimation } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { ScamInfo } from "src/common/entities/scam-info.dto"; import { NftCollectionAccount } from "src/endpoints/collections/entities/nft.collection.account"; import { NftAccount } from "src/endpoints/nfts/entities/nft.account"; import { Account } from "./account"; -@ObjectType("AccountDetailed", { description: "Detailed Account object type that extends Account." }) export class AccountDetailed extends Account { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => String, { description: 'Code for the given detailed account.' }) - @ApiProperty({ description: 'The source code in hex format' }) + @ApiProperty({ description: 'The source code in hex format', required: false }) code: string = ''; - @Field(() => String, { description: 'Code hash for the given detailed account.', nullable: true }) - @ApiProperty({ description: 'The hash of the source code' }) + @ApiProperty({ description: 'The hash of the source code', required: false }) codeHash: string = ''; - @Field(() => String, { description: 'Root hash for the given detailed account.', nullable: true }) @ApiProperty({ description: 'The hash of the root node' }) rootHash: string = ''; - @Field(() => String, { description: 'Username for the given detailed account.', nullable: true }) - @ApiProperty({ description: 'The username specific for this account', nullable: true }) + @ApiProperty({ description: 'The username specific for this account', nullable: true, required: false }) username: string | undefined = undefined; - @Field(() => String, { description: 'Developer reward for the given detailed account.' }) @ApiProperty({ description: 'The developer reward' }) developerReward: string = ''; - @Field(() => String, { description: 'Owner address for the given detailed account.' }) - @ApiProperty({ description: 'The address in bech 32 format of owner account' }) + @ApiProperty({ description: 'The address in bech 32 format of owner account', required: false }) ownerAddress: string = ''; - @Field(() => Boolean, { description: 'If the given detailed account is upgradeable.', nullable: true }) - @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean }) + @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false }) isUpgradeable?: boolean; - @Field(() => Boolean, { description: 'If the given detailed account is readable.', nullable: true }) - @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean }) + @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false }) isReadable?: boolean; - @Field(() => Boolean, { description: 'If the given detailed account is payable.', nullable: true }) - @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean }) + @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false }) isPayable?: boolean; - @Field(() => Boolean, { description: 'If the given detailed account is payable by smart contract.', nullable: true }) - @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, nullable: true }) + @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, nullable: true, required: false }) isPayableBySmartContract?: boolean | undefined = undefined; - @Field(() => ScamInfo, { description: 'Scam information for the given detailed account.', nullable: true }) - @ApiProperty({ type: ScamInfo, nullable: true }) + @ApiProperty({ type: ScamInfo, nullable: true, required: false }) scamInfo: ScamInfo | undefined = undefined; - @Field(() => [NftCollectionAccount], { description: 'NFT collections for the given detailed account.', nullable: true }) + @ApiProperty({ description: 'Account nft collections', type: Boolean, nullable: true, required: false }) nftCollections: NftCollectionAccount[] | undefined = undefined; - @Field(() => [NftAccount], { description: 'NFTs for the given detailed account. Complexity: 1000', nullable: true }) + @ApiProperty({ description: 'Account nfts', type: Boolean, nullable: true, required: false }) @ComplexityEstimation({ group: 'nfts', value: 1000 }) nfts: NftAccount[] | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) activeGuardianActivationEpoch?: number; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) activeGuardianAddress?: string; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) activeGuardianServiceUid?: string; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) pendingGuardianActivationEpoch?: number; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) pendingGuardianAddress?: string; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) pendingGuardianServiceUid?: string; - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) isGuarded?: boolean; } diff --git a/src/endpoints/accounts/entities/account.esdt.history.ts b/src/endpoints/accounts/entities/account.esdt.history.ts index 0e154e6f9..ce48af609 100644 --- a/src/endpoints/accounts/entities/account.esdt.history.ts +++ b/src/endpoints/accounts/entities/account.esdt.history.ts @@ -1,19 +1,15 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountHistory } from "./account.history"; -@ObjectType("AccountEsdtHistory", { description: "Account Esdt History object type." }) export class AccountEsdtHistory extends AccountHistory { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => String, { description: 'Token for the given history account details.' }) @ApiProperty({ type: String, example: 'WEGLD-bd4d79' }) token: string = ''; - @Field(() => String, { description: 'Identifier for the given history account details.' }) @ApiProperty({ type: String, example: 'XPACHIEVE-5a0519-01' }) identifier: string | undefined = undefined; } diff --git a/src/endpoints/accounts/entities/account.history.ts b/src/endpoints/accounts/entities/account.history.ts index b1cb6d328..4fe64333b 100644 --- a/src/endpoints/accounts/entities/account.history.ts +++ b/src/endpoints/accounts/entities/account.history.ts @@ -1,26 +1,20 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("AccountHistory", { description: "Detailed history object type that." }) export class AccountHistory { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Address for the given account.' }) @ApiProperty({ type: String, example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) address: string = ''; - @Field(() => String, { description: 'Balance for the given account.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) balance: string = ''; - @Field(() => Float, { description: 'Timestamp for the given account.' }) @ApiProperty({ type: Number, example: 10000 }) timestamp: number = 0; - @Field(() => Boolean, { description: 'IsSender for the given account.', nullable: true }) - @ApiProperty({ type: Boolean, nullable: true, example: true }) + @ApiProperty({ type: Boolean, nullable: true, example: true, required: false }) isSender?: boolean | undefined = undefined; } diff --git a/src/endpoints/accounts/entities/account.key.filter.ts b/src/endpoints/accounts/entities/account.key.filter.ts index 8adb4b93c..67f73fade 100644 --- a/src/endpoints/accounts/entities/account.key.filter.ts +++ b/src/endpoints/accounts/entities/account.key.filter.ts @@ -1,13 +1,10 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { NodeStatusRaw } from "src/endpoints/nodes/entities/node.status"; -@ObjectType("AccountKeyFilter", { description: "Account key filter object type." }) export class AccountKeyFilter { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => AccountKeyFilter, { description: "Account key status filter for the given keys.", nullable: true }) status: NodeStatusRaw[] = []; } diff --git a/src/endpoints/accounts/entities/account.key.ts b/src/endpoints/accounts/entities/account.key.ts index 780126c13..51a59f4fc 100644 --- a/src/endpoints/accounts/entities/account.key.ts +++ b/src/endpoints/accounts/entities/account.key.ts @@ -1,43 +1,33 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("AccountKey", { description: "Account key object type." }) export class AccountKey { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Bls key for the given provider account.' }) @ApiProperty({ type: String, example: '2ef384d4d38bf3aad5cef34ce6eab047fba6d52b9735dbfdf7591289ed9c26ac7e816c9bb56ebf4f09129f045860f401275a91009befb4dc8ddc24ea4bc597290bd916b9f984c2a415ec9b2cfbc4a09de42c032314e6a21e69daf76302fcaa99' }) blsKey: string = ''; - @Field(() => String, { description: 'Stake for the given provider account.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) stake: string = ''; - @Field(() => String, { description: 'Top Up for the given provideraccount.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) topUp: string = ''; - @Field(() => String, { description: 'Status for the given provider account.' }) @ApiProperty({ type: String, example: 'online' }) status: string = ''; - @Field(() => String, { description: 'Reward address for the given provider account .' }) @ApiProperty({ type: String, example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) rewardAddress: string = ''; - @Field(() => String, { description: 'Queue index for the given provider account .', nullable: true }) @ApiProperty({ type: String, nullable: true, example: '2' }) queueIndex: string | undefined = undefined; - @Field(() => String, { description: 'Queue size for the given provider account.', nullable: true }) @ApiProperty({ type: String, nullable: true, example: '100' }) queueSize: string | undefined = undefined; - @Field(() => Number, { description: "Remaining UnBond Period for node with status leaving.", nullable: true }) @ApiProperty({ type: Number, example: 10 }) remainingUnBondPeriod: number | undefined = 0; } diff --git a/src/endpoints/accounts/entities/account.ts b/src/endpoints/accounts/entities/account.ts index c0c62963b..6403d3cce 100644 --- a/src/endpoints/accounts/entities/account.ts +++ b/src/endpoints/accounts/entities/account.ts @@ -1,67 +1,51 @@ -import { Field, Float, ID, ObjectType } from "@nestjs/graphql"; import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; -@ObjectType("Account", { description: "Account object type." }) export class Account { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: 'Address for the given account.' }) @ApiProperty({ type: String, description: 'Account bech32 address', example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) address: string = ''; - @Field(() => String, { description: 'Balance for the given account.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Account current balance' })) balance: string = ''; - @Field(() => Float, { description: 'Nonce for the given account.' }) @ApiProperty({ type: Number, description: 'Account current nonce', example: 42 }) nonce: number = 0; - @Field(() => Float, { description: 'Timestamp of the block where the account was first indexed.' }) @ApiProperty({ type: Number, description: 'Timestamp of the block where the account was first indexed', example: 1676979360 }) timestamp: number = 0; - @Field(() => Float, { description: 'Shard for the given account.' }) @ApiProperty({ type: Number, description: 'The shard ID allocated to the account', example: 0 }) shard: number = 0; - @Field(() => String, { description: 'Current owner address.' }) - @ApiProperty({ type: String, description: 'Current owner address' }) + @ApiProperty({ type: String, description: 'Current owner address', required: false }) ownerAddress: string | undefined = undefined; - @Field(() => AccountAssets, { description: 'Account assets for the given account.', nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets' }) + @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets', required: false }) assets: AccountAssets | undefined = undefined; - @Field(() => Float, { description: 'Deployment timestamp for the given detailed account.', nullable: true }) - @ApiProperty({ description: 'Specific property flag for smart contract', type: Number }) + @ApiProperty({ description: 'Specific property flag for smart contract', type: Number, required: false }) deployedAt?: number | null; - @Field(() => String, { description: 'DeployTxHash for the given detailed account.', nullable: true }) - @ApiProperty({ description: 'The contract deploy transaction hash' }) + @ApiProperty({ description: 'The contract deploy transaction hash', required: false }) deployTxHash?: string | null; - @Field(() => AccountAssets, { description: 'Owner Account Address assets details.', nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets' }) + @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets', required: false }) ownerAssets: AccountAssets | undefined = undefined; - @Field(() => Boolean, { description: 'If the given detailed account is verified.', nullable: true }) @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false }) isVerified?: boolean; - @Field(() => Float, { description: 'Transactions count for the given detailed account.' }) @ApiProperty({ description: 'The number of transactions performed on this account' }) txCount?: number; - @Field(() => Float, { description: 'Smart contract results count for the given detailed account.' }) @ApiProperty({ description: 'The number of smart contract results of this account' }) scrCount?: number; - @Field(() => Number, { description: 'Transfers in the last 24 hours.' }) - @ApiProperty({ type: Number, description: 'Transfers in the last 24 hours' }) + @ApiProperty({ type: Number, description: 'Transfers in the last 24 hours', required: false }) transfersLast24h: number | undefined = undefined; } diff --git a/src/endpoints/accounts/entities/account.verification.ts b/src/endpoints/accounts/entities/account.verification.ts index fff0db4f8..29e72590d 100644 --- a/src/endpoints/accounts/entities/account.verification.ts +++ b/src/endpoints/accounts/entities/account.verification.ts @@ -10,12 +10,12 @@ export class AccountVerification { @ApiProperty({ description: 'Source code hash' }) codeHash?: string = ''; - @ApiProperty({ description: 'Source code of contract', type: AccountVerificationSource }) + @ApiProperty({ description: 'Source code of contract', type: AccountVerificationSource, required: false }) source?: any; @ApiProperty({ description: 'Verifier process status', enum: AccountVerificationStatus }) status!: AccountVerificationStatus; - @ApiProperty({ description: 'File hash for IPFS' }) + @ApiProperty({ description: 'File hash for IPFS', required: false }) ipfsFileHash?: string; } diff --git a/src/endpoints/accounts/entities/contract.upgrades.ts b/src/endpoints/accounts/entities/contract.upgrades.ts index 996d9e32d..2c7c7c601 100644 --- a/src/endpoints/accounts/entities/contract.upgrades.ts +++ b/src/endpoints/accounts/entities/contract.upgrades.ts @@ -1,24 +1,17 @@ - -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("ContractUpgrades", { description: "ContractUpgrades object type." }) export class ContractUpgrades { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Address details.' }) @ApiProperty({ type: String, nullable: true, example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) address: string = ''; - @Field(() => String, { description: 'TxHash details.' }) @ApiProperty({ type: String, nullable: true, example: '1c8c6b2148f25621fa2c798a2c9a184df61fdd1991aa0af7ea01eb7b89025d2a' }) txHash: string = ''; - @Field(() => String, { description: 'CodeHash details.' }) @ApiProperty({ type: String, nullable: true, example: '1c8c6b2148f25621fa2c798a2c9a184df61fdd1991aa0af7ea01eb7b89025d2a' }) codeHash: string = ''; - @Field(() => Float, { description: 'Timestamp details.' }) @ApiProperty({ type: Number, nullable: true, example: '1638577452' }) timestamp: number = 0; } diff --git a/src/endpoints/accounts/entities/deployed.contract.ts b/src/endpoints/accounts/entities/deployed.contract.ts index c7a6f3d88..b2dce1663 100644 --- a/src/endpoints/accounts/entities/deployed.contract.ts +++ b/src/endpoints/accounts/entities/deployed.contract.ts @@ -1,26 +1,20 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; -@ObjectType("DeployedContract", { description: "Deployed contract object type." }) export class DeployedContract { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Address for the given account.' }) @ApiProperty({ type: String }) address: string = ""; - @Field(() => String, { description: 'DeployTxHash for the given account.' }) @ApiProperty({ type: String }) deployTxHash: string = ""; - @Field(() => Float, { description: 'Timestamp for the given account.' }) @ApiProperty({ type: Number }) timestamp: number = 0; - @Field(() => AccountAssets, { description: 'Assets for the given account.', nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true, description: 'Contract assets' }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false, description: 'Contract assets' }) assets: AccountAssets | undefined = undefined; } diff --git a/src/endpoints/applications/entities/application.ts b/src/endpoints/applications/entities/application.ts index 70a79696e..ea5dc2da5 100644 --- a/src/endpoints/applications/entities/application.ts +++ b/src/endpoints/applications/entities/application.ts @@ -1,34 +1,26 @@ -import { Field, Float, ObjectType } from '@nestjs/graphql'; import { ApiProperty } from '@nestjs/swagger'; import { AccountAssets } from '../../../common/assets/entities/account.assets'; -@ObjectType('Application', { description: 'Application object type.' }) export class Application { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Contract address details.' }) @ApiProperty({ type: String }) contract: string = ''; - @Field(() => String, { description: 'Deployer address details.' }) @ApiProperty({ type: String }) deployer: string = ''; - @Field(() => String, { description: 'Owner address details.' }) @ApiProperty({ type: String }) owner: string = ''; - @Field(() => String, { description: 'Code hash details.' }) @ApiProperty({ type: String }) codeHash: string = ''; - @Field(() => Float, { description: 'Timestamp details.' }) @ApiProperty({ type: Number }) timestamp: number = 0; - @Field(() => AccountAssets, { description: 'Assets for the given account.', nullable: true }) @ApiProperty({ type: AccountAssets, nullable: true, description: 'Contract assets' }) assets: AccountAssets | undefined = undefined; } diff --git a/src/endpoints/blocks/entities/block.detailed.ts b/src/endpoints/blocks/entities/block.detailed.ts index d4997eb6c..4808245d0 100644 --- a/src/endpoints/blocks/entities/block.detailed.ts +++ b/src/endpoints/blocks/entities/block.detailed.ts @@ -1,23 +1,18 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { Block } from "./block"; -@ObjectType("BlockDetailed", { description: "BlockDetailed object type." }) export class BlockDetailed extends Block { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => [String], { description: "MiniBlockHashes for the given block hash." }) @ApiProperty({ type: [String] }) miniBlocksHashes: string[] = []; - @Field(() => [String], { description: "NotarizedBlocksHashes for the given block hash." }) @ApiProperty({ type: [String] }) notarizedBlocksHashes: string[] = []; - @Field(() => [String], { description: "Validators for the given block hash." }) @ApiProperty({ type: [String] }) validators: string[] = []; } diff --git a/src/endpoints/blocks/entities/block.ts b/src/endpoints/blocks/entities/block.ts index e9258cd2f..52ed4e1e7 100644 --- a/src/endpoints/blocks/entities/block.ts +++ b/src/endpoints/blocks/entities/block.ts @@ -1,88 +1,67 @@ import { ApiUtils } from "@multiversx/sdk-nestjs-http"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { Identity } from "src/endpoints/identities/entities/identity"; -@ObjectType("Block", { description: "Block object type." }) export class Block { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Hash for the given Block." }) @ApiProperty({ type: String }) hash: string = ''; - @Field(() => Float, { description: "Epoch for the given Block." }) @ApiProperty({ type: Number }) epoch: number = 0; - @Field(() => Number, { description: "Nonce for the given Block." }) @ApiProperty({ type: Number }) nonce: number = 0; - @Field(() => String, { description: "Previous Hash for the given Block." }) @ApiProperty({ type: String }) prevHash: string = ''; - @Field(() => String, { description: "Proposer for the given Block." }) @ApiProperty({ type: String }) proposer: string = ''; - @Field(() => Identity, { description: "Proposer Identity for the given Block." }) - @ApiProperty({ type: Identity, nullable: true }) + @ApiProperty({ type: Identity, nullable: true, required: false }) proposerIdentity: Identity | undefined = undefined; - @Field(() => String, { description: "Public Key Bitmap for the given Block." }) @ApiProperty({ type: String }) pubKeyBitmap: string = ''; - @Field(() => Float, { description: "Round for the given Block." }) @ApiProperty({ type: Number }) round: number = 0; - @Field(() => Float, { description: "Shard for the given Block." }) @ApiProperty({ type: Number }) shard: number = 0; - @Field(() => Float, { description: "Size for the given Block." }) @ApiProperty({ type: Number }) size: number = 0; - @Field(() => Float, { description: "Size Txs for the given Block." }) @ApiProperty({ type: Number }) sizeTxs: number = 0; - @Field(() => String, { description: "State Root Hash for the given Block." }) @ApiProperty({ type: String }) stateRootHash: string = ''; - @Field(() => Float, { description: "Timestamp for the given Block." }) @ApiProperty({ type: Number }) timestamp: number = 0; - @Field(() => Float, { description: "TxCount for the given NFT." }) @ApiProperty({ type: Number }) txCount: number = 0; - @Field(() => Float, { description: "Gas Consumed for the given NFT." }) @ApiProperty({ type: Number }) gasConsumed: number = 0; - @Field(() => Float, { description: "Gas Refunded for the given NFT." }) @ApiProperty({ type: Number }) gasRefunded: number = 0; - @Field(() => Float, { description: "Gas Penalized for the given NFT." }) @ApiProperty({ type: Number }) gasPenalized: number = 0; - @Field(() => Float, { description: "Max Gas Limit for the given NFT." }) @ApiProperty({ type: Number }) maxGasLimit: number = 0; - @Field(() => String, { description: "Scheduled Root Hash for the given Block.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) scheduledRootHash: string | undefined = undefined; static mergeWithElasticResponse(newBlock: T, blockRaw: any): T { diff --git a/src/endpoints/collections/entities/collection.trait.attribute.ts b/src/endpoints/collections/entities/collection.trait.attribute.ts index 69e379894..1eef70363 100644 --- a/src/endpoints/collections/entities/collection.trait.attribute.ts +++ b/src/endpoints/collections/entities/collection.trait.attribute.ts @@ -1,17 +1,12 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("CollectionTraitAttribute", { description: "NFT collection trait attribute type." }) export class CollectionTraitAttribute { - @Field(() => String, { description: 'Name of the attribute.', nullable: true }) @ApiProperty({ type: String }) name: string = ''; - @Field(() => Number, { description: 'Number of times the attribute appears in the nft list.' }) @ApiProperty({ type: Number }) occurrenceCount: number = 0; - @Field(() => Number, { description: 'Percentage for the occurrence of the attribute in the nft list.' }) @ApiProperty({ type: Number }) occurrencePercentage: number = 0; } diff --git a/src/endpoints/collections/entities/collection.trait.ts b/src/endpoints/collections/entities/collection.trait.ts index 867f3395b..f15591c0f 100644 --- a/src/endpoints/collections/entities/collection.trait.ts +++ b/src/endpoints/collections/entities/collection.trait.ts @@ -1,22 +1,16 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { CollectionTraitAttribute } from "./collection.trait.attribute"; -@ObjectType("CollectionTrait", { description: "NFT collection trait type." }) export class CollectionTrait { - @Field(() => String, { description: 'Name of the trait.' }) @ApiProperty({ type: String }) name: string = ''; - @Field(() => Number, { description: 'Number of times the trait appears in the nft list.' }) @ApiProperty({ type: Number }) occurrenceCount: number = 0; - @Field(() => Number, { description: 'Percentage for the occurrence of the trait in the nft list.' }) @ApiProperty({ type: Number }) occurrencePercentage: number = 0; - @Field(() => [CollectionTraitAttribute], { description: 'Distinct attributes for the given trait.' }) @ApiProperty({ type: CollectionTraitAttribute, isArray: true }) attributes: CollectionTraitAttribute[] = []; } diff --git a/src/endpoints/collections/entities/nft.collection.account.ts b/src/endpoints/collections/entities/nft.collection.account.ts index f086e100c..06401dc4b 100644 --- a/src/endpoints/collections/entities/nft.collection.account.ts +++ b/src/endpoints/collections/entities/nft.collection.account.ts @@ -1,15 +1,12 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { NftCollection } from "./nft.collection"; -@ObjectType("NftCollectionAccount", { description: "NFT collection account object type." }) export class NftCollectionAccount extends NftCollection { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => Float, { description: 'Count for the given NFT collection account.' }) @ApiProperty() count: number = 0; } diff --git a/src/endpoints/collections/entities/nft.collection.detailed.ts b/src/endpoints/collections/entities/nft.collection.detailed.ts index 91c2560c9..c7268fe35 100644 --- a/src/endpoints/collections/entities/nft.collection.detailed.ts +++ b/src/endpoints/collections/entities/nft.collection.detailed.ts @@ -1,4 +1,3 @@ -import { Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { CollectionRoles } from "src/endpoints/tokens/entities/collection.roles"; import { NftCollection } from "./nft.collection"; @@ -10,11 +9,9 @@ export class NftCollectionDetailed extends NftCollection { Object.assign(this, init); } - @Field(() => Boolean, { description: 'If the given NFT collection can transfer the underlying tokens by default.', nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canTransfer: boolean | undefined = undefined; - @Field(() => [CollectionRoles], { description: 'Roles list for the given NFT collection.', nullable: true }) @ApiProperty({ type: CollectionRoles, isArray: true }) roles: CollectionRoles[] = []; } diff --git a/src/endpoints/collections/entities/nft.collection.ts b/src/endpoints/collections/entities/nft.collection.ts index d8d02dddb..da03e0c7a 100644 --- a/src/endpoints/collections/entities/nft.collection.ts +++ b/src/endpoints/collections/entities/nft.collection.ts @@ -2,103 +2,78 @@ import { ApiProperty } from "@nestjs/swagger"; import { TokenAssets } from "src/common/assets/entities/token.assets"; import { NftType } from "../../nfts/entities/nft.type"; import { ScamInfo } from "src/common/entities/scam-info.dto"; -import { Field, Float, ID, ObjectType } from "@nestjs/graphql"; -import { Account } from "src/endpoints/accounts/entities/account"; import { CollectionTrait } from "./collection.trait"; import { CollectionAuctionStats } from "src/endpoints/marketplace/entities/collection.auction.stats"; import { NftSubType } from "src/endpoints/nfts/entities/nft.sub.type"; -@ObjectType("NftCollection", { description: "NFT collection object type." }) export class NftCollection { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: 'Collection identifier for the given NFT collection.' }) @ApiProperty({ type: String }) collection: string = ''; - @Field(() => NftType, { description: 'NFT type for the given NFT collection.' }) @ApiProperty({ enum: NftType }) type: NftType = NftType.NonFungibleESDT; - @Field(() => NftSubType, { description: 'NFT sub type for the given NFT collection.', nullable: true }) @ApiProperty({ enum: NftSubType, nullable: true }) subType: NftSubType | undefined = undefined; - @Field(() => String, { description: 'Name for the given NFT collection.' }) @ApiProperty({ type: String }) name: string = ''; - @Field(() => ID, { description: 'Ticker for the given NFT collection.' }) @ApiProperty({ type: String }) ticker: string = ''; - @Field(() => Account, { description: 'Owner for the given NFT collection.', nullable: true }) @ApiProperty({ type: String, nullable: true }) owner: string | undefined = undefined; - @Field(() => Float, { description: 'Timestamp for the given NFT collection.' }) @ApiProperty({ type: Number }) timestamp: number = 0; - @Field(() => Boolean, { description: 'If the given NFT collection can freeze.', nullable: true }) @ApiProperty({ type: Boolean, default: false }) canFreeze: boolean = false; - @Field(() => Boolean, { description: 'If the given NFT collection can wipe.', nullable: true }) @ApiProperty({ type: Boolean, default: false }) canWipe: boolean = false; - @Field(() => Boolean, { description: 'If the given NFT collection can pause.', nullable: true }) @ApiProperty({ type: Boolean, default: false }) canPause: boolean = false; - @Field(() => Boolean, { description: 'If the given NFT collection can transfer NFT create role.', nullable: true }) @ApiProperty({ type: Boolean, default: false }) canTransferNftCreateRole: boolean = false; - @Field(() => Boolean, { description: 'If the given NFT collection can change owner.', nullable: true }) @ApiProperty({ type: Boolean, default: false }) canChangeOwner: boolean = false; - @Field(() => Boolean, { description: 'If the given NFT collection can upgrade.', nullable: true }) @ApiProperty({ type: Boolean, default: false }) canUpgrade: boolean = false; - @Field(() => Boolean, { description: 'If the given NFT collection can add special role.', nullable: true }) @ApiProperty({ type: Boolean, default: false }) canAddSpecialRoles: boolean = false; - @Field(() => Float, { description: 'Decimals for the given NFT collection.', nullable: true }) @ApiProperty({ type: Number, nullable: true }) decimals: number | undefined = undefined; - @Field(() => TokenAssets, { description: 'Assets for the given NFT collection.', nullable: true }) - @ApiProperty({ type: TokenAssets, nullable: true }) + @ApiProperty({ type: TokenAssets, nullable: true, required: false }) assets: TokenAssets | undefined = undefined; - @Field(() => ScamInfo, { description: 'Scam information for the underlying collection.', nullable: true }) - @ApiProperty({ type: ScamInfo, nullable: true }) + @ApiProperty({ type: ScamInfo, nullable: true, required: false }) scamInfo: ScamInfo | undefined = undefined; - @Field(() => [CollectionTrait], { description: 'Trait list for the given NFT collection.', nullable: true }) - @ApiProperty({ type: CollectionTrait, isArray: true }) + @ApiProperty({ type: CollectionTrait, isArray: true, required: false }) traits: CollectionTrait[] = []; - @Field(() => CollectionAuctionStats, { description: 'Collection auction statistics.', nullable: true }) - @ApiProperty({ type: CollectionAuctionStats, nullable: true }) + @ApiProperty({ type: CollectionAuctionStats, nullable: true, required: false }) auctionStats: CollectionAuctionStats | undefined = undefined; - @Field(() => Boolean, { description: 'Returns true if the collection is verified.', nullable: true }) - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) isVerified: boolean | undefined = undefined; - @Field(() => Number, { description: 'Number of holders. Will be returned only if the collection is verified.', nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) holderCount: number | undefined = undefined; - @Field(() => Number, { description: 'Number of NFTs for this collection. Will be returned only if the collection is verified.', nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) nftCount: number | undefined = undefined; } diff --git a/src/endpoints/collections/entities/nft.collection.with.roles.ts b/src/endpoints/collections/entities/nft.collection.with.roles.ts index 48f1e3150..019a4d167 100644 --- a/src/endpoints/collections/entities/nft.collection.with.roles.ts +++ b/src/endpoints/collections/entities/nft.collection.with.roles.ts @@ -1,40 +1,31 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { CollectionRoles } from "src/endpoints/tokens/entities/collection.roles"; import { NftCollection } from "./nft.collection"; -@ObjectType("NftCollection", { description: "NFT collection with roles object type." }) export class NftCollectionWithRoles extends NftCollection { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => CollectionRoles, { description: 'Collection roles for the current address.' }) @ApiProperty({ type: CollectionRoles }) role: CollectionRoles = new CollectionRoles(); - @Field(() => Boolean, { description: 'Determines whether the collection is globally transferrable.' }) @ApiProperty({ type: Boolean }) canTransfer: Boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can create.', deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, default: false }) canCreate: boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can burn.', deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, default: false }) canBurn: boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can add quantity.', deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, default: false }) canAddQuantity: boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can update attributes.', deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, default: false }) canUpdateAttributes: boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can add URI.', deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, default: false }) canAddUri: boolean = false; } diff --git a/src/endpoints/dapp-config/entities/dapp-config.ts b/src/endpoints/dapp-config/entities/dapp-config.ts index bf98007f0..4044f06ef 100644 --- a/src/endpoints/dapp-config/entities/dapp-config.ts +++ b/src/endpoints/dapp-config/entities/dapp-config.ts @@ -1,61 +1,46 @@ -import { Field, ID, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("DappConfig", { description: "DappConfig object type." }) export class DappConfig { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: 'Network Details.' }) @ApiProperty({ type: String, example: 'mainnet' }) id: string = ''; - @Field(() => String, { description: 'Network name.' }) @ApiProperty({ type: String, example: 'Mainnet' }) name: string = ''; - @Field(() => String, { description: 'Token label details' }) @ApiProperty({ type: String, example: 'EGLD' }) egldLabel: string = ''; - @Field(() => String, { description: 'Token details' }) @ApiProperty({ type: String, example: '4' }) decimals: string = ''; - @Field(() => String, { description: 'Token denomination details' }) @ApiProperty({ type: String, example: '18' }) egldDenomination: string = ''; - @Field(() => String, { description: 'Gas data byte details' }) @ApiProperty({ type: String, example: '1500' }) gasPerDataByte: string = ''; - @Field(() => String, { description: 'Api Timeout details' }) @ApiProperty({ type: String, example: '4000' }) apiTimeout: string = ''; - @Field(() => String, { description: 'Wallet connect url details' }) @ApiProperty({ type: String, example: 'https://maiar.page.link/?apn=com.multiversx.maiar.wallet&isi=1519405832&ibi=com.multiversx.maiar.wallet&link=https://maiar.com/' }) walletConnectDeepLink: string = ''; - @Field(() => [String], { description: 'Bridge wallet url details' }) @ApiProperty({ type: [String], example: 'https://bridge.walletconnect.org' }) walletConnectBridgeAddresses: string = ''; - @Field(() => String, { description: 'Wallet url details' }) @ApiProperty({ type: String, example: 'https://wallet.multiversx.com' }) walletAddress: string = ''; - @Field(() => String, { description: 'Api url details' }) @ApiProperty({ type: String, example: 'https://api.multiversx.com' }) apiAddress: string = ''; - @Field(() => String, { description: 'Explorer address details' }) @ApiProperty({ type: String, example: 'https://explorer.multiversx.com' }) explorerAddress: string = ''; - @Field(() => String, { description: 'ChainID details' }) @ApiProperty({ type: String, example: '1' }) chainId: string = ''; } diff --git a/src/endpoints/delegation.legacy/entities/account.delegation.legacy.ts b/src/endpoints/delegation.legacy/entities/account.delegation.legacy.ts index bf03df2b9..1f4053b43 100644 --- a/src/endpoints/delegation.legacy/entities/account.delegation.legacy.ts +++ b/src/endpoints/delegation.legacy/entities/account.delegation.legacy.ts @@ -1,33 +1,25 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("AccountDelegationLegacy", { description: "Account delegation legacy." }) export class AccountDelegationLegacy { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Claimable rewards for the given detailed account.' }) @ApiProperty({ type: String, default: 0 }) claimableRewards: string = ''; - @Field(() => String, { description: 'User active stake for the given detailed account.' }) @ApiProperty({ type: String, default: 0 }) userActiveStake: string = ''; - @Field(() => String, { description: 'User deferred payment stake for the given detailed account.' }) @ApiProperty({ type: String, default: 0 }) userDeferredPaymentStake: string = ''; - @Field(() => String, { description: 'User unstaked stake for the given detailed account.' }) @ApiProperty({ type: String, default: 0 }) userUnstakedStake: string = ''; - @Field(() => String, { description: 'User waiting stake for the given detailed account.' }) @ApiProperty({ type: String, default: 0 }) userWaitingStake: string = ''; - @Field(() => String, { description: 'User withdraw only stake for the given detailed account.' }) @ApiProperty({ type: String, default: 0 }) userWithdrawOnlyStake: string = ''; } diff --git a/src/endpoints/delegation.legacy/entities/delegation.legacy.ts b/src/endpoints/delegation.legacy/entities/delegation.legacy.ts index 0164dfc9d..3bca7b5eb 100644 --- a/src/endpoints/delegation.legacy/entities/delegation.legacy.ts +++ b/src/endpoints/delegation.legacy/entities/delegation.legacy.ts @@ -1,34 +1,26 @@ import { SwaggerUtils } from '@multiversx/sdk-nestjs-common'; -import { Field, Float, ObjectType } from '@nestjs/graphql'; import { ApiProperty } from '@nestjs/swagger'; -@ObjectType("DelegationLegacy", { description: "DelegationLegacy object type." }) export class DelegationLegacy { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Total Withdraw Only Stake details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) totalWithdrawOnlyStake: string = ''; - @Field(() => String, { description: "Total Waiting Stake details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) totalWaitingStake: string = ''; - @Field(() => String, { description: "Total Active Stake details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) totalActiveStake: string = ''; - @Field(() => String, { description: "Total Unstake Stake details" }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) totalUnstakedStake: string = ''; - @Field(() => String, { description: "Total Deferred Payment Stake details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) totalDeferredPaymentStake: string = ''; - @Field(() => Float, { description: "Total number of users." }) @ApiProperty() numUsers: number = 0; } diff --git a/src/endpoints/delegation/entities/delegation.ts b/src/endpoints/delegation/entities/delegation.ts index 83c93d7ee..08b55b714 100644 --- a/src/endpoints/delegation/entities/delegation.ts +++ b/src/endpoints/delegation/entities/delegation.ts @@ -1,26 +1,20 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("Delegation", { description: "Delegation object type." }) export class Delegation { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Stake details.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) stake: string = ''; - @Field(() => String, { description: 'TopUp details.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) topUp: string = ''; - @Field(() => String, { description: 'Locked details.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) locked: string = ''; - @Field(() => String, { description: 'MinDelegation details.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) minDelegation: string = ''; } diff --git a/src/endpoints/esdt/entities/esdt.locked.account.ts b/src/endpoints/esdt/entities/esdt.locked.account.ts index 50e187e5b..17a4973cc 100644 --- a/src/endpoints/esdt/entities/esdt.locked.account.ts +++ b/src/endpoints/esdt/entities/esdt.locked.account.ts @@ -1,21 +1,16 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("EsdtLockedAccount", { description: "EsdtLockedAccount object type." }) export class EsdtLockedAccount { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Locked account address." }) @ApiProperty() address: string = ''; - @Field(() => String, { description: "Locked account name.", nullable: true }) @ApiProperty({ type: String, nullable: true }) name: string | undefined = undefined; - @Field(() => String, { description: "Locked account balance." }) @ApiProperty({ type: String }) balance: string | number = ''; } diff --git a/src/endpoints/identities/entities/identity.ts b/src/endpoints/identities/entities/identity.ts index 54282473f..adab738d9 100644 --- a/src/endpoints/identities/entities/identity.ts +++ b/src/endpoints/identities/entities/identity.ts @@ -1,79 +1,59 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -import GraphQLJSON from "graphql-type-json"; -@ObjectType("Identity", { description: "Identity object type." }) export class Identity { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Identity provider.", nullable: true }) @ApiProperty({ type: String }) identity?: string = ''; - @Field(() => String, { description: "Provider name details.", nullable: true }) @ApiProperty({ type: String }) name?: string; - @Field(() => String, { description: "Provider description details.", nullable: true }) @ApiProperty({ type: String }) description?: string; - @Field(() => String, { description: "Provider avatar.", nullable: true }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) avatar?: string; - @Field(() => String, { description: "Provider website details.", nullable: true }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) website?: string; - @Field(() => String, { description: "Provider twitter account.", nullable: true }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) twitter?: string; - @Field(() => String, { description: "Provider location details.", nullable: true }) @ApiProperty({ type: String }) location?: string; - @Field(() => Float, { description: "Provider score details.", nullable: true }) - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) score?: number; - @Field(() => Float, { description: "Provider validators details.", nullable: true }) @ApiProperty({ type: Number }) validators?: number; - @Field(() => String, { description: "Provider stake details.", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) stake?: string; - @Field(() => String, { description: "Provider topUp amount details.", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) topUp?: string; - @Field(() => String, { description: "Provider locked ESDT details.", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) locked: string = ''; - @Field(() => GraphQLJSON, { description: "Provider distribution details.", nullable: true }) @ApiProperty() distribution?: { [index: string]: number | undefined } = {}; - @Field(() => [String], { description: "Providers details.", nullable: true }) - @ApiProperty({ type: [String] }) + @ApiProperty({ type: [String], required: false }) providers?: string[]; - @Field(() => Float, { description: "Provider stake percent details", nullable: true }) - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) stakePercent?: number; - @Field(() => Float, { description: "Provider rank details.", nullable: true }) - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) rank?: number; - @Field(() => Float, { description: "Provider apr details.", nullable: true }) - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) apr?: number; } diff --git a/src/endpoints/marketplace/entities/collection.auction.stats.ts b/src/endpoints/marketplace/entities/collection.auction.stats.ts index e9da8b820..bf38b464b 100644 --- a/src/endpoints/marketplace/entities/collection.auction.stats.ts +++ b/src/endpoints/marketplace/entities/collection.auction.stats.ts @@ -1,33 +1,25 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("CollectionAuctionStats", { description: "Collection auction statistics." }) export class CollectionAuctionStats { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Number, { description: 'Number of active auctions.', nullable: true }) @ApiProperty({ type: Number }) activeAuctions: number = 0; - @Field(() => Number, { description: 'Number of ended auctions.', nullable: true }) @ApiProperty({ type: Number }) endedAuctions: number = 0; - @Field(() => String, { description: 'Maximum price in EGLD.', nullable: true }) @ApiProperty({ type: String }) maxPrice: String = ""; - @Field(() => String, { description: 'Minimum (floor) price in EGLD.', nullable: true }) @ApiProperty({ type: String }) minPrice: String = ""; - @Field(() => String, { description: 'Ended auction average price in EGLD.', nullable: true }) @ApiProperty({ type: String }) saleAverage: String = ""; - @Field(() => String, { description: 'Total traded volume in EGLD.', nullable: true }) @ApiProperty({ type: String }) volumeTraded: String = ""; } diff --git a/src/endpoints/mex/entities/mex.economics.ts b/src/endpoints/mex/entities/mex.economics.ts index 822ad524c..fc77053e5 100644 --- a/src/endpoints/mex/entities/mex.economics.ts +++ b/src/endpoints/mex/entities/mex.economics.ts @@ -1,34 +1,26 @@ -import { Field, Float, ObjectType } from '@nestjs/graphql'; import { ApiProperty } from '@nestjs/swagger'; import { MexSettings } from './mex.settings'; -@ObjectType("MexEconomics", { description: "MexEconomics object type." }) export class MexEconomics { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Float, { description: "Total supply details." }) @ApiProperty({ type: Number, example: 8045920000000 }) totalSupply: number = 0; - @Field(() => Float, { description: "Circulating supply." }) @ApiProperty({ type: Number, example: 4913924072690 }) circulatingSupply: number = 0; - @Field(() => Float, { description: "Mex current price." }) @ApiProperty({ type: Number, example: 0.00020552146843751037 }) price: number = 0; - @Field(() => Float, { description: "Mex market cap." }) @ApiProperty({ type: Number, example: 1009916891 }) marketCap: number = 0; - @Field(() => Float, { description: "Mex volume in 24h." }) @ApiProperty({ type: Number, example: 13680479 }) volume24h: number = 0; - @Field(() => Float, { description: "Mex tokens pairs." }) @ApiProperty({ type: Number, example: 15 }) marketPairs: number = 0; diff --git a/src/endpoints/mex/entities/mex.farm.ts b/src/endpoints/mex/entities/mex.farm.ts index bcc515b39..392e10148 100644 --- a/src/endpoints/mex/entities/mex.farm.ts +++ b/src/endpoints/mex/entities/mex.farm.ts @@ -1,71 +1,54 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { MexFarmType } from "./mex.farm.type"; import { MexToken } from "./mex.token"; -@ObjectType("MexFarm", { description: "MexFarm object type." }) export class MexFarm { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => MexFarmType, { description: "Mex farm type." }) @ApiProperty({ enum: MexFarmType }) type: MexFarmType = MexFarmType.standard; - @Field(() => String, { description: "Mex farm version.", nullable: true }) - @ApiProperty({ nullable: true }) + @ApiProperty({ nullable: true, required: false }) version?: string; - @Field(() => String, { description: "Address details." }) @ApiProperty({ type: String, example: 'erd1qqqqqqqqqqqqqpgqzps75vsk97w9nsx2cenv2r2tyxl4fl402jpsx78m9j' }) address: string = ''; - @Field(() => String, { description: "Identifier farm details." }) @ApiProperty() id: string = ''; - @Field(() => String, { description: "Symbol details." }) @ApiProperty() symbol: string = ''; - @Field(() => String, { description: "Name details." }) @ApiProperty() name: string = ''; - @Field(() => Float, { description: "Price details." }) @ApiProperty() price: number = 0; - @Field(() => String, { description: "Farming identifier details." }) @ApiProperty() farmingId: string = ''; - @Field(() => String, { description: "Farming symbol details." }) @ApiProperty() farmingSymbol: string = ''; - @Field(() => String, { description: "Farming name details." }) @ApiProperty() farmingName: string = ''; - @Field(() => Float, { description: "Farming price details." }) @ApiProperty() farmingPrice: number = 0; - @Field(() => String, { description: "Farmed identifier details." }) @ApiProperty() farmedId: string = ''; - @Field(() => String, { description: "Farmed symbol details." }) @ApiProperty() farmedSymbol: string = ''; - @Field(() => String, { description: "Farmed name details." }) @ApiProperty() farmedName: string = ''; - @Field(() => Float, { description: "Farmed price details." }) @ApiProperty() farmedPrice: number = 0; diff --git a/src/endpoints/mex/entities/mex.pair.ts b/src/endpoints/mex/entities/mex.pair.ts index ea6a9ecc0..0e7cc5d76 100644 --- a/src/endpoints/mex/entities/mex.pair.ts +++ b/src/endpoints/mex/entities/mex.pair.ts @@ -1,112 +1,85 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { MexPairState } from "./mex.pair.state"; import { MexPairType } from "./mex.pair.type"; import { MexPairExchange } from "./mex.pair.exchange"; -@ObjectType("MexPair", { description: "MexPair object type." }) export class MexPair { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Address details." }) @ApiProperty() address: string = ''; - @Field(() => String, { description: "Id details." }) @ApiProperty() id: string = ''; - @Field(() => String, { description: "Pair symbol details." }) @ApiProperty() symbol: string = ''; - @Field(() => String, { description: "Pair name details." }) @ApiProperty() name: string = ''; - @Field(() => String, { description: "Mex token price equivalent" }) @ApiProperty() price: number = 0; - @Field(() => Number, { description: "Mex token basePrevious24hPrice equivalent" }) @ApiProperty() basePrevious24hPrice: number = 0; - @Field(() => Number, { description: "Mex token quotePrevious24hPrice equivalent" }) @ApiProperty() quotePrevious24hPrice: number = 0; - @Field(() => String, { description: "Base id details." }) @ApiProperty({ type: String, example: 'MEX-455c57' }) baseId: string = ''; - @Field(() => String, { description: "Base symbol details." }) @ApiProperty({ type: String, example: 'MEX' }) baseSymbol: string = ''; - @Field(() => String, { description: "Base name details." }) @ApiProperty({ type: String, example: 'MEX' }) baseName: string = ''; - @Field(() => String, { description: "Base price details." }) @ApiProperty({ type: Number, example: 0.00020596180499578328 }) basePrice: number = 0; - @Field(() => String, { description: "Quote id details." }) @ApiProperty({ type: String, example: 'WEGLD-bd4d79' }) quoteId: string = ''; - @Field(() => String, { description: "Quote symbol details." }) @ApiProperty({ type: String, example: 'WEGLD' }) quoteSymbol: string = ''; - @Field(() => String, { description: "Quote name details." }) @ApiProperty({ type: String, example: 'WrappedEGLD' }) quoteName: string = ''; - @Field(() => String, { description: "Quote price details." }) @ApiProperty({ type: Number, example: 145.26032 }) quotePrice: number = 0; - @Field(() => String, { description: "Total value details." }) @ApiProperty({ type: Number, example: '347667206.84174806' }) totalValue: number = 0; - @Field(() => String, { description: "Total volume in 24h details.", nullable: true }) @ApiProperty({ type: Number, example: '2109423.4531209776' }) volume24h: number | undefined; - @Field(() => MexPairState, { description: "State details." }) @ApiProperty({ enum: MexPairState }) state: MexPairState = MexPairState.inactive; - @Field(() => MexPairType, { description: "Mex pair type details." }) @ApiProperty({ enum: MexPairType }) type: MexPairType = MexPairType.experimental; - @Field(() => String, { description: "Mex pair exchange details.", nullable: true }) @ApiProperty({ type: String, example: 'jungledex' }) exchange: MexPairExchange | undefined; - @Field(() => Boolean, { description: 'Mex pair farms details.', nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) hasFarms: boolean | undefined = undefined; - @Field(() => Boolean, { description: 'Mex pair dual farms details.', nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) hasDualFarms: boolean | undefined = undefined; - @Field(() => Number, { description: 'Mex pair trades count.', nullable: true }) @ApiProperty({ type: Number, nullable: true }) tradesCount: number | undefined = undefined; - @Field(() => Number, { description: 'Mex pair trades count 24h.', nullable: true }) @ApiProperty({ type: Number, nullable: true }) tradesCount24h: number | undefined = undefined; - @Field(() => Number, { description: 'Mex pair deploy date in unix time.', nullable: true }) @ApiProperty({ type: Number, nullable: true }) deployedAt: number | undefined = undefined; } diff --git a/src/endpoints/mex/entities/mex.staking.proxy.ts b/src/endpoints/mex/entities/mex.staking.proxy.ts index c6b7880d4..fc3445251 100644 --- a/src/endpoints/mex/entities/mex.staking.proxy.ts +++ b/src/endpoints/mex/entities/mex.staking.proxy.ts @@ -1,21 +1,16 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("MexStakingProxy", { description: "MexStakingProxy object type." }) export class MexStakingProxy { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Address details." }) @ApiProperty({ type: String, example: 'erd1qqqqqqqqqqqqqpgq2ymdr66nk5hx32j2tqdeqv9ajm9dj9uu2jps3dtv6v' }) address: string = ''; - @Field(() => String, { description: "Dual Yield token name." }) @ApiProperty() dualYieldTokenName: string = ''; - @Field(() => String, { description: "Dual Yield token collection." }) @ApiProperty() dualYieldTokenCollection: string = ''; diff --git a/src/endpoints/mex/entities/mex.token.chart.ts b/src/endpoints/mex/entities/mex.token.chart.ts index 10670e2d7..d0c40a57d 100644 --- a/src/endpoints/mex/entities/mex.token.chart.ts +++ b/src/endpoints/mex/entities/mex.token.chart.ts @@ -1,17 +1,13 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("MexTokenChart", { description: "MexTokenChart object type." }) export class MexTokenChart { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Timestamp details." }) @ApiProperty() timestamp: number = 0; - @Field(() => String, { description: "Value details." }) @ApiProperty() value: number = 0; } diff --git a/src/endpoints/mex/entities/mex.token.ts b/src/endpoints/mex/entities/mex.token.ts index f8e7b60aa..884d0da64 100644 --- a/src/endpoints/mex/entities/mex.token.ts +++ b/src/endpoints/mex/entities/mex.token.ts @@ -1,36 +1,27 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("MexToken", { description: "MexToken object type." }) export class MexToken { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Identifier for the mex token." }) @ApiProperty({ type: String, example: 'MEX-455c57' }) id: string = ''; - @Field(() => String, { description: "Symbol for the mex token." }) @ApiProperty({ type: String, example: 'MEX' }) symbol: string = ''; - @Field(() => String, { description: "Mex token name." }) @ApiProperty({ type: String, example: 'MEX' }) name: string = ''; - @Field(() => Float, { description: "Mex token current price." }) @ApiProperty({ type: Number, example: 0.000206738758250580 }) price: number = 0; - @Field(() => Float, { description: "Mex token previous24hPrice." }) @ApiProperty({ type: Number, example: 0.000206738758250580 }) previous24hPrice: number = 0; - @Field(() => Float, { description: "Mex token previous24hVolume." }) @ApiProperty({ type: Number, example: 0.000206738758250580 }) previous24hVolume: number | undefined = 0; - @Field(() => Number, { description: 'Mex token trades count.', nullable: true }) @ApiProperty({ type: Number, nullable: true }) tradesCount: number | undefined = 0; } diff --git a/src/endpoints/mex/entities/mex.token.type.ts b/src/endpoints/mex/entities/mex.token.type.ts index 4302cab28..f1356d941 100644 --- a/src/endpoints/mex/entities/mex.token.type.ts +++ b/src/endpoints/mex/entities/mex.token.type.ts @@ -1,18 +1,14 @@ -import { Field, ObjectType } from '@nestjs/graphql'; import { ApiProperty } from '@nestjs/swagger'; import { MexPairType } from './mex.pair.type'; -@ObjectType("MexTokenType", { description: "MexTokenType object type." }) export class MexTokenType { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Mex token identifier" }) @ApiProperty({ type: String, example: '' }) identifier: string = ''; - @Field(() => MexPairType, { description: "Mex token type details." }) @ApiProperty({ enum: MexPairType }) type: MexPairType = MexPairType.experimental; } diff --git a/src/endpoints/miniblocks/entities/mini.block.detailed.ts b/src/endpoints/miniblocks/entities/mini.block.detailed.ts index 578d39cf5..fc30c38d5 100644 --- a/src/endpoints/miniblocks/entities/mini.block.detailed.ts +++ b/src/endpoints/miniblocks/entities/mini.block.detailed.ts @@ -1,37 +1,28 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("MiniBlocks", { description: "MiniBlocks object type." }) export class MiniBlockDetailed { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "MiniBlock Hash details." }) @ApiProperty({ type: String, example: 'c956ecbefbba25f0bcb0b182357d41287384fb8707d5860ad5cacc66f3fe0bc8' }) miniBlockHash: string = ''; - @Field(() => String, { description: "Receiver Block Hash details." }) @ApiProperty({ type: String, example: '3d008f54446e7f3c636159e0f4934267e154541a95665477676ea7f3abbc0aa7' }) receiverBlockHash: string = ''; - @Field(() => Float, { description: "Receiver Shard details." }) @ApiProperty({ type: Number, example: 0 }) receiverShard: number = 0; - @Field(() => String, { description: "Sender Block Hash details." }) @ApiProperty({ type: String, example: '3d008f54446e7f3c636159e0f4934267e154541a95665477676ea7f3abbc0aa7' }) senderBlockHash: string = ''; - @Field(() => Float, { description: "Sender shard details." }) @ApiProperty({ type: Number, example: 0 }) senderShard: number = 0; - @Field(() => Float, { description: "Timestamp details." }) @ApiProperty({ type: Number, example: 1646579514 }) timestamp: number = 0; - @Field(() => String, { description: "Transaction type details." }) @ApiProperty({ type: String, example: 'TxBlock' }) type: string = ''; } diff --git a/src/endpoints/network/entities/about.ts b/src/endpoints/network/entities/about.ts index de275d733..e61665f13 100644 --- a/src/endpoints/network/entities/about.ts +++ b/src/endpoints/network/entities/about.ts @@ -1,46 +1,35 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { FeatureConfigs } from "./feature.configs"; -@ObjectType("About", { description: "About object type." }) export class About { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Application Version details." }) @ApiProperty({ type: String, nullable: true }) appVersion: string | undefined = undefined; - @Field(() => String, { description: "Plugins Version details." }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) pluginsVersion: string | undefined = undefined; - @Field(() => String, { description: "Current network details." }) @ApiProperty({ type: String }) network: string = ''; - @Field(() => String, { description: "Deployment cluster." }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) cluster: string = ''; - @Field(() => String, { description: "API deployment version." }) @ApiProperty({ type: String }) version: string = ''; - @Field(() => String, { description: "Indexer version.", nullable: true }) @ApiProperty({ type: String }) indexerVersion: string | undefined = undefined; - @Field(() => String, { description: "Gateway version.", nullable: true }) @ApiProperty({ type: String }) gatewayVersion: string | undefined = undefined; - @Field(() => String, { description: "Scam engine version.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) scamEngineVersion: string | undefined = undefined; - @Field(() => FeatureConfigs, { description: "Feature Flags.", nullable: true }) @ApiProperty({ type: FeatureConfigs, nullable: true }) features: FeatureConfigs | undefined = undefined; } diff --git a/src/endpoints/network/entities/constants.ts b/src/endpoints/network/entities/constants.ts index ffae90dcb..5c309419c 100644 --- a/src/endpoints/network/entities/constants.ts +++ b/src/endpoints/network/entities/constants.ts @@ -1,29 +1,22 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("NetworkConstants", { description: "NetworkConstants object type." }) export class NetworkConstants { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "ChainId details." }) @ApiProperty({ description: 'The chain identifier' }) chainId: string = ''; - @Field(() => Float, { description: "GasPerDataByte details." }) @ApiProperty({ description: 'Gas per data byte' }) gasPerDataByte: number = 0; - @Field(() => Float, { description: "MinGasLimit details." }) @ApiProperty({ description: 'Minimum gas limit' }) minGasLimit: number = 0; - @Field(() => Float, { description: "MinGasPrice details." }) @ApiProperty({ description: 'Minimum gas price' }) minGasPrice: number = 0; - @Field(() => Float, { description: "MinTransactionVersion details." }) @ApiProperty({ description: 'Minimum transaction version' }) minTransactionVersion: number = 0; } diff --git a/src/endpoints/network/entities/economics.ts b/src/endpoints/network/entities/economics.ts index c01058c90..8bd393758 100644 --- a/src/endpoints/network/entities/economics.ts +++ b/src/endpoints/network/entities/economics.ts @@ -1,45 +1,34 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("Economics", { description: "Economics object type." }) export class Economics { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Float, { description: "Total Supply general information." }) @ApiProperty() totalSupply: number = 0; - @Field(() => Float, { description: "Total Supply general information." }) @ApiProperty() circulatingSupply: number = 0; - @Field(() => Float, { description: "Total Supply general information." }) @ApiProperty() staked: number = 0; - @Field(() => Float, { description: "Total Supply general information.", nullable: true }) @ApiProperty({ type: Number }) price: number | undefined = undefined; - @Field(() => Float, { description: "Total Supply general information.", nullable: true }) @ApiProperty({ type: Number }) marketCap: number | undefined = undefined; - @Field(() => Float, { description: "Total Supply general information." }) @ApiProperty() apr: number = 0; - @Field(() => Float, { description: "Total Supply general information." }) @ApiProperty() topUpApr: number = 0; - @Field(() => Float, { description: "Total Supply general information." }) @ApiProperty() baseApr: number = 0; - @Field(() => Float, { description: "Total Supply general information.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) tokenMarketCap: number | undefined = undefined; } diff --git a/src/endpoints/network/entities/feature.configs.ts b/src/endpoints/network/entities/feature.configs.ts index 5b8f7c3cb..cbd9692c9 100644 --- a/src/endpoints/network/entities/feature.configs.ts +++ b/src/endpoints/network/entities/feature.configs.ts @@ -1,25 +1,19 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("FeatureConfigs", { description: "FeatureConfigs object type." }) export class FeatureConfigs { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Boolean, { description: "Update Collection Extra Details flag details." }) @ApiProperty({ description: 'Update Collection extra details flag activation value' }) updateCollectionExtraDetails: boolean = false; - @Field(() => Boolean, { description: "Marketplace flag details." }) @ApiProperty({ description: 'Marketplace flag activation value' }) marketplace: boolean = false; - @Field(() => Boolean, { description: "Exchange flag details." }) @ApiProperty({ description: 'Exchange flag activation value' }) exchange: boolean = false; - @Field(() => Boolean, { description: "DataApi flag details." }) @ApiProperty({ description: 'DataApi flag activation value' }) dataApi: boolean = false; } diff --git a/src/endpoints/network/entities/stats.ts b/src/endpoints/network/entities/stats.ts index 3f9f247c2..1885ff54f 100644 --- a/src/endpoints/network/entities/stats.ts +++ b/src/endpoints/network/entities/stats.ts @@ -1,45 +1,34 @@ -import { Field, Float, ObjectType } from '@nestjs/graphql'; import { ApiProperty } from '@nestjs/swagger'; -@ObjectType("Stats", { description: "Stats object type." }) export class Stats { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Float, { description: "Total number of accounts available on blockchain." }) @ApiProperty() accounts: number = 0; - @Field(() => Float, { description: "Total blocks available on blockchain." }) @ApiProperty() blocks: number = 0; - @Field(() => Float, { description: "Current epoch details." }) @ApiProperty() epoch: number = 0; - @Field(() => Float, { description: "RefreshRate details." }) @ApiProperty() refreshRate: number = 0; - @Field(() => Float, { description: "RoundPassed details." }) @ApiProperty() roundsPassed: number = 0; - @Field(() => Float, { description: "Rounds per epoch details." }) @ApiProperty() roundsPerEpoch: number = 0; - @Field(() => Float, { description: "Shards available on blockchain." }) @ApiProperty() shards: number = 0; - @Field(() => Float, { description: "Total number of transactions." }) @ApiProperty() transactions: number = 0; - @Field(() => Float, { description: "Total number of smart contract results." }) @ApiProperty() scResults: number = 0; } diff --git a/src/endpoints/nfts/entities/nft.account.ts b/src/endpoints/nfts/entities/nft.account.ts index 7db162cdb..66cdb2221 100644 --- a/src/endpoints/nfts/entities/nft.account.ts +++ b/src/endpoints/nfts/entities/nft.account.ts @@ -1,23 +1,18 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { Nft } from "./nft"; -@ObjectType("NftAccount", { description: "NFT account object type." }) export class NftAccount extends Nft { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => String, { description: "Balance for the given NFT account." }) @ApiProperty({ type: String, example: 10 }) balance: string = ''; - @Field(() => Float, { description: "Price for the given NFT account.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) price: number | undefined = undefined; - @Field(() => Float, { description: "Value in USD for the given NFT account.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) valueUsd: number | undefined = undefined; } diff --git a/src/endpoints/nfts/entities/nft.media.ts b/src/endpoints/nfts/entities/nft.media.ts index eb7f55dcc..fcf7d10b7 100644 --- a/src/endpoints/nfts/entities/nft.media.ts +++ b/src/endpoints/nfts/entities/nft.media.ts @@ -1,29 +1,22 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("NftMedia", { description: "NFT media object type." }) export class NftMedia { constructor(init?: Partial) { Object.assign(this, init); } - - @Field(() => String, { description: "URL for the given NFT media." }) + @ApiProperty() url: string = ''; - @Field(() => String, { description: "Original URL for the given NFT media." }) @ApiProperty() originalUrl: string = ''; - @Field(() => String, { description: "Thumbnail URL for the given NFT media." }) @ApiProperty() thumbnailUrl: string = ''; - @Field(() => String, { description: "File type for the given NFT media." }) @ApiProperty() fileType: string = ''; - @Field(() => Float, { description: "File size for the given NFT media." }) @ApiProperty() fileSize: number = 0; } diff --git a/src/endpoints/nfts/entities/nft.metadata.error.ts b/src/endpoints/nfts/entities/nft.metadata.error.ts index 730f9f5e8..58a7e1954 100644 --- a/src/endpoints/nfts/entities/nft.metadata.error.ts +++ b/src/endpoints/nfts/entities/nft.metadata.error.ts @@ -1,18 +1,13 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { NftMetadataErrorCode } from "./nft.metadata.error.code"; -@ObjectType("NftMetadataError", { description: "NFT Metadata error." }) export class NftMetadataError { - @Field(() => NftMetadataErrorCode, { description: "Error code" }) @ApiProperty({ enum: NftMetadataErrorCode }) code: NftMetadataErrorCode = NftMetadataErrorCode.unknownError; - @Field(() => String, { description: "Error message" }) @ApiProperty() message: string = ''; - @Field(() => Number, { description: "Timestamp when the error was generated" }) @ApiProperty() timestamp: number = 0; } diff --git a/src/endpoints/nfts/entities/nft.metadata.ts b/src/endpoints/nfts/entities/nft.metadata.ts index 849e7d383..93a8aeafd 100644 --- a/src/endpoints/nfts/entities/nft.metadata.ts +++ b/src/endpoints/nfts/entities/nft.metadata.ts @@ -1,30 +1,23 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { NftMetadataError } from "./nft.metadata.error"; -@ObjectType("NftMetadata", { description: "NFT metadata object type." }) export class NftMetadata { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Description for the given NFT metadata." }) @ApiProperty() description: string = ''; - @Field(() => String, { description: "File type for the given NFT metadata." }) @ApiProperty() fileType: string = ''; - @Field(() => String, { description: "File URI for the given NFT metadata." }) @ApiProperty() fileUri: string = ''; - @Field(() => String, { description: "File name for the given NFT metadata." }) @ApiProperty() fileName: string = ''; - @Field(() => NftMetadataError, { description: "NFT Metadata fetch error.", nullable: true }) @ApiProperty({ type: NftMetadataError, nullable: true }) error: NftMetadataError | undefined = undefined; } diff --git a/src/endpoints/nfts/entities/nft.rarities.ts b/src/endpoints/nfts/entities/nft.rarities.ts index 0ce781113..27f4f5b3f 100644 --- a/src/endpoints/nfts/entities/nft.rarities.ts +++ b/src/endpoints/nfts/entities/nft.rarities.ts @@ -1,4 +1,3 @@ -import { Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { NftRarity } from "./nft.rarity"; @@ -7,23 +6,18 @@ export class NftRarities { Object.assign(this, init); } - @Field(() => NftRarity, { description: "Statistical rarity information." }) @ApiProperty({ type: NftRarity }) statistical: NftRarity | undefined; - @Field(() => NftRarity, { description: "Trait-based rarity information." }) @ApiProperty({ type: NftRarity }) trait: NftRarity | undefined; - @Field(() => NftRarity, { description: "Jaccard distances rarity information." }) @ApiProperty({ type: NftRarity }) jaccardDistances: NftRarity | undefined; - @Field(() => NftRarity, { description: "OpenRarity information." }) @ApiProperty({ type: NftRarity }) openRarity: NftRarity | undefined; - @Field(() => NftRarity, { description: "Custom rarity information." }) @ApiProperty({ type: NftRarity }) custom: NftRarity | undefined; } diff --git a/src/endpoints/nfts/entities/nft.rarity.ts b/src/endpoints/nfts/entities/nft.rarity.ts index 0527aefbd..de23cea1a 100644 --- a/src/endpoints/nfts/entities/nft.rarity.ts +++ b/src/endpoints/nfts/entities/nft.rarity.ts @@ -1,4 +1,3 @@ -import { Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; export class NftRarity { @@ -6,11 +5,9 @@ export class NftRarity { Object.assign(this, init); } - @Field(() => Number, { description: "Rank for the given algorithm." }) @ApiProperty({ type: Number }) rank: number = 0; - @Field(() => Number, { description: "Score for the given algorithm." }) @ApiProperty({ type: Number }) score: number = 0; } diff --git a/src/endpoints/nfts/entities/nft.ts b/src/endpoints/nfts/entities/nft.ts index 06365a96e..d8af5956c 100644 --- a/src/endpoints/nfts/entities/nft.ts +++ b/src/endpoints/nfts/entities/nft.ts @@ -4,139 +4,105 @@ import { NftMedia } from "./nft.media"; import { NftMetadata } from "./nft.metadata"; import { NftType } from "./nft.type"; import { ComplexityEstimation, SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ID, ObjectType } from "@nestjs/graphql"; -import { NftCollection } from "src/endpoints/collections/entities/nft.collection"; -import { Account } from "src/endpoints/accounts/entities/account"; import { NftRarities } from "./nft.rarities"; import { UnlockMileStoneModel } from "src/common/locked-asset/entities/unlock.milestone.model"; import { ScamInfo } from "src/common/entities/scam-info.dto"; import { NftSubType } from "./nft.sub.type"; -@ObjectType("Nft", { description: "NFT object type." }) export class Nft { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: "Identifier for the given NFT." }) @ApiProperty({ type: String }) identifier: string = ''; - @Field(() => NftCollection, { description: "NFT collection for the given NFT." }) @ApiProperty({ type: String }) collection: string = ''; - @Field(() => Float, { description: "Timestamp for the given NFT.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) timestamp?: number = undefined; - @Field(() => String, { description: "Attributes for the given NFT.", nullable: true }) @ApiProperty({ type: String }) attributes: string = ''; - @Field(() => Float, { description: "Nonce for the given NFT." }) @ApiProperty({ type: Number }) nonce: number = 0; - @Field(() => NftType, { description: "NFT type for the given NFT." }) @ApiProperty({ enum: NftType }) type: NftType = NftType.NonFungibleESDT; - @Field(() => NftSubType, { description: "NFT sub type for the given NFT.", nullable: true }) @ApiProperty({ enum: NftSubType }) subType: NftSubType = NftSubType.NonFungibleESDT; - @Field(() => String, { description: "Name for the given NFT." }) @ApiProperty({ type: String }) name: string = ''; - @Field(() => Account, { description: "Creator account for the given NFT." }) @ApiProperty({ type: String }) creator: string = ''; - @Field(() => Float, { description: "Royalties for the given NFT.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) royalties: number | undefined = undefined; - @Field(() => [String], { description: "URIs for the given NFT." }) @ApiProperty({ type: String, isArray: true }) uris: string[] = []; - @Field(() => String, { description: "URL for the given NFT." }) @ApiProperty({ type: String }) url: string = ''; - @Field(() => [NftMedia], { description: "NFT media for the given NFT.", nullable: true }) - @ApiProperty({ type: NftMedia, nullable: true }) + @ApiProperty({ type: NftMedia, nullable: true, required: false }) media: NftMedia[] | undefined = undefined; - @Field(() => Boolean, { description: "Is whitelisted storage for the given NFT." }) - @ApiProperty({ type: Boolean, default: false }) + @ApiProperty({ type: Boolean, default: false, required: false }) isWhitelistedStorage: boolean = false; - @Field(() => String, { description: "Thumbnail URL for the given NFT." }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) thumbnailUrl: string = ''; - @Field(() => [String], { description: "Tags for the given NFT." }) - @ApiProperty({ type: String, isArray: true }) + @ApiProperty({ type: String, isArray: true, required: false }) tags: string[] = []; - @Field(() => NftMetadata, { description: "Metadata for the given NFT.", nullable: true }) @ApiProperty({ type: NftMetadata, nullable: true }) metadata: NftMetadata | undefined = undefined; - @Field(() => Account, { description: "Owner account for the given NFT. Complexity: 100", nullable: true }) @ApiProperty({ type: String, nullable: true }) @ComplexityEstimation({ value: 100, alternatives: ['withOwner'], group: 'extras' }) owner: string | undefined = undefined; - @Field(() => String, { description: "Balance for the given NFT.", nullable: true }) @ApiProperty({ type: String, nullable: true }) balance: string | undefined = undefined; - @Field(() => String, { description: "Supply for the given NFT. Complexity: 100", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) @ComplexityEstimation({ value: 100, alternatives: ['withSupply'], group: 'extras' }) supply: string | undefined = undefined; - @Field(() => Float, { description: "Decimals for the given NFT.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) decimals: number | undefined = undefined; - @Field(() => TokenAssets, { description: "Assets for the given NFT.", nullable: true }) - @ApiProperty({ type: TokenAssets }) + @ApiProperty({ type: TokenAssets, required: false }) assets?: TokenAssets; - @Field(() => String, { description: "Ticker for the given NFT." }) @ApiProperty({ type: String }) ticker?: string = ''; - @Field(() => ScamInfo, { description: "Scam information for the given NFT. Complexity: 100", nullable: true }) - @ApiProperty({ type: ScamInfo, nullable: true }) + @ApiProperty({ type: ScamInfo, nullable: true, required: false }) scamInfo: ScamInfo | undefined = undefined; - @Field(() => Float, { description: "Score for the given NFT.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) score: number | undefined = undefined; - @Field(() => Float, { description: "Rank for the given NFT.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) rank: number | undefined = undefined; - @Field(() => Float, { description: "Rarities according to all possible algorithms for the given NFT.", nullable: true }) - @ApiProperty({ type: NftRarities, nullable: true }) + @ApiProperty({ type: NftRarities, nullable: true, required: false }) rarities: NftRarities | undefined = undefined; - @Field(() => Boolean, { description: "Is NSFW for the given NFT.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) isNsfw: boolean | undefined = undefined; - @Field(() => [UnlockMileStoneModel], { description: "Unlock mile stone model for the given NFT.", nullable: true }) - @ApiProperty({ type: [UnlockMileStoneModel], nullable: true }) + @ApiProperty({ type: [UnlockMileStoneModel], nullable: true, required: false }) unlockSchedule?: UnlockMileStoneModel[] | undefined = undefined; - @Field(() => Float, { description: "Unlock epoch for the given NFT.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) unlockEpoch?: number | undefined = undefined; } diff --git a/src/endpoints/nfttags/entities/tag.ts b/src/endpoints/nfttags/entities/tag.ts index fc77d294c..b2732bb11 100644 --- a/src/endpoints/nfttags/entities/tag.ts +++ b/src/endpoints/nfttags/entities/tag.ts @@ -1,17 +1,13 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("Tag", { description: "Tag object type." }) export class Tag { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Tag details.' }) @ApiProperty({ type: String, nullable: true, example: 'sunny' }) tag: string = ''; - @Field(() => Float, { description: 'Count for the given tag.', nullable: true }) @ApiProperty({ type: Number, nullable: true, example: 46135 }) count: number | undefined = undefined; } diff --git a/src/endpoints/nodes/entities/node.auction.filter.ts b/src/endpoints/nodes/entities/node.auction.filter.ts index 3df8e349a..5f1f9efa5 100644 --- a/src/endpoints/nodes/entities/node.auction.filter.ts +++ b/src/endpoints/nodes/entities/node.auction.filter.ts @@ -1,20 +1,14 @@ import { SortOrder } from "src/common/entities/sort.order"; -import { NodeSort } from "./node.sort"; -import { Field, ObjectType } from "@nestjs/graphql"; import { NodeSortAuction } from "./node.sort.auction"; -@ObjectType("NodeAuctionFilter", { description: "NodeAuctionFilter object type." }) export class NodeAuctionFilter { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Search filter for the given nodes.", nullable: true }) search: string | undefined; - @Field(() => NodeSort, { description: "Node sort filter.", nullable: true }) sort: NodeSortAuction | undefined; - @Field(() => SortOrder, { description: "Node order filter .", nullable: true }) order: SortOrder | undefined; } diff --git a/src/endpoints/nodes/entities/node.auction.ts b/src/endpoints/nodes/entities/node.auction.ts index 68b5bb28c..d85754f5e 100644 --- a/src/endpoints/nodes/entities/node.auction.ts +++ b/src/endpoints/nodes/entities/node.auction.ts @@ -11,13 +11,13 @@ export class NodeAuction { @ApiProperty({ type: String }) name?: string = ''; - @ApiProperty({ type: String, default: 0 }) + @ApiProperty({ type: String, default: 0, required: false }) description: string = ''; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) avatar: string = ''; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) provider?: string = ''; @ApiProperty({ type: String }) @@ -29,7 +29,7 @@ export class NodeAuction { @ApiProperty({ type: String }) owner: string = ''; - @ApiProperty() + @ApiProperty({ required: false }) distribution?: { [index: string]: number | undefined } = {}; @ApiProperty({ type: String }) diff --git a/src/endpoints/nodes/entities/node.filter.ts b/src/endpoints/nodes/entities/node.filter.ts index b4ec1951a..5d0a17e84 100644 --- a/src/endpoints/nodes/entities/node.filter.ts +++ b/src/endpoints/nodes/entities/node.filter.ts @@ -2,65 +2,28 @@ import { SortOrder } from "src/common/entities/sort.order"; import { NodeStatus } from "./node.status"; import { NodeType } from "./node.type"; import { NodeSort } from "./node.sort"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; -@ObjectType("NodeFilter", { description: "NodeFilter object type." }) export class NodeFilter { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Search filter for the given nodes.", nullable: true }) search: string | undefined; - - @Field(() => Boolean, { description: "Online status filter for the given nodes.", nullable: true }) online: boolean | undefined; - - @Field(() => NodeType, { description: "Node type filter for the given nodes.", nullable: true }) type: NodeType | undefined; - - @Field(() => NodeStatus, { description: "Node status filter for the given nodes.", nullable: true }) status: NodeStatus | undefined; - - @Field(() => Float, { description: "Shard filter for the given nodes.", nullable: true }) shard: number | undefined; - - @Field(() => Boolean, { description: "Node issues filter for the given nodes.", nullable: true }) issues: boolean | undefined; - - @Field(() => String, { description: "Identity filter for the given nodes.", nullable: true }) identity: string | undefined; - - @Field(() => String, { description: "Provider filter for the given nodes.", nullable: true }) provider: string | undefined; - - @Field(() => String, { description: "Owner node filter address.", nullable: true }) owner: string | undefined; - - @Field(() => Boolean, { description: "Auctioned filter for the given nodes.", nullable: true }) auctioned: boolean | undefined; - - @Field(() => Boolean, { description: "Full history node filter for the given nodes.", nullable: true }) fullHistory: boolean | undefined; - - @Field(() => NodeSort, { description: "Node sort filter.", nullable: true }) sort: NodeSort | undefined; - - @Field(() => SortOrder, { description: "Node order filter .", nullable: true }) order: SortOrder | undefined; - - @Field(() => [String], { description: "Search by multiple keys, comma-separated.", nullable: true }) keys: string[] | undefined; - - @Field(() => Boolean, { description: "Node isQualified filter for the given nodes.", nullable: true }) isQualified: boolean | undefined; - - @Field(() => Boolean, { description: "Node isAuctionDangeZone filter for the given nodes.", nullable: true }) isAuctionDangerZone: boolean | undefined; - - @Field(() => Boolean, { description: "Node auction filter for the given nodes.", nullable: true }) isAuctioned: boolean | undefined; - - @Field(() => Boolean, { description: "Identity info for the given nodes.", nullable: true }) withIdentityInfo: boolean | undefined; } diff --git a/src/endpoints/nodes/entities/node.ts b/src/endpoints/nodes/entities/node.ts index 822f5d9ef..4cc67f2ea 100644 --- a/src/endpoints/nodes/entities/node.ts +++ b/src/endpoints/nodes/entities/node.ts @@ -1,157 +1,119 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { NodeStatus } from "./node.status"; import { NodeType } from "./node.type"; import { Identity } from "src/endpoints/identities/entities/identity"; -@ObjectType("Node", { description: "Node object type." }) export class Node { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Bls address for the given node." }) @ApiProperty({ type: String }) bls: string = ''; - @Field(() => String, { description: "Name for the given node." }) @ApiProperty({ type: String }) name: string = ''; - @Field(() => String, { description: "Version for the given node." }) @ApiProperty({ type: String, default: 0 }) version: string = ''; - @Field(() => Float, { description: "Rating for the given node." }) @ApiProperty({ type: Number }) rating: number = 0; - @Field(() => Float, { description: "Temp rating for the given node." }) @ApiProperty({ type: Number }) tempRating: number = 0; - @Field(() => Float, { description: "Rating modifier for the given node." }) @ApiProperty({ type: Number }) ratingModifier: number = 0; - @Field(() => Float, { description: "Shard for the given node.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) shard: number | undefined = undefined; - @Field(() => NodeType, { description: "Type for the given node.", nullable: true }) @ApiProperty({ enum: NodeType, nullable: true }) type: NodeType | undefined = undefined; - @Field(() => NodeStatus, { description: "Status for the given node.", nullable: true }) @ApiProperty({ enum: NodeStatus, nullable: true }) status: NodeStatus | undefined = undefined; - @Field(() => Boolean, { description: "Online for the given node." }) @ApiProperty({ type: Boolean, default: false }) online: boolean = false; - @Field(() => Float, { description: "Nonce for the given node." }) @ApiProperty({ type: Number }) nonce: number = 0; - @Field(() => Float, { description: "Instances for the given node." }) @ApiProperty({ type: Number }) instances: number = 0; - @Field(() => String, { description: "Owner for the given node." }) @ApiProperty({ type: String }) owner: string = ''; - @Field(() => String, { description: "Identity for the given node.", nullable: true }) @ApiProperty({ type: String, nullable: true }) identity: string | undefined = undefined; - @Field(() => String, { description: "Provider for the given node." }) @ApiProperty({ type: String }) provider: string = ''; - @Field(() => [String], { description: "Issues for the given node." }) @ApiProperty({ type: [String] }) issues: string[] = []; - @Field(() => String, { description: "Stake for the given node." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) stake: string = ''; - @Field(() => String, { description: "Top up for the given node." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) topUp: string = ''; - @Field(() => String, { description: "Locked details for the given node." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) locked: string = ''; - @Field(() => Float, { description: "Leader failure for the given node." }) @ApiProperty({ type: Number, default: 0 }) leaderFailure: number = 0; - @Field(() => Float, { description: "Leader success for the given node." }) @ApiProperty({ type: Number, default: 15 }) leaderSuccess: number = 0; - @Field(() => Float, { description: "Validator failure for the given node." }) @ApiProperty({ type: Number, default: 0 }) validatorFailure: number = 0; - @Field(() => Float, { description: "Validator ignored signatures details for the given node." }) @ApiProperty({ type: Number, default: 0 }) validatorIgnoredSignatures: number = 0; - @Field(() => Float, { description: "Bls address for the given node." }) @ApiProperty({ type: Number, default: 10000 }) validatorSuccess: number = 0; - @Field(() => Float, { description: "Bls address for the given node." }) @ApiProperty({ type: Number, default: 0 }) position: number = 0; - @Field(() => Boolean, { description: "Auctioned detailes for the given node.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) auctioned: boolean | undefined = undefined; - @Field(() => Number, { description: "Auction position for the given node.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) auctionPosition: number | undefined = undefined; - @Field(() => String, { description: "Auction top up for the given node.", nullable: true }) @ApiProperty({ type: String, nullable: true }) auctionTopUp: string | undefined = undefined; - @Field(() => Boolean, { description: "Auction selected for the given node.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) auctionQualified: boolean | undefined = undefined; - @Field(() => Boolean, { description: "Full history details for the given node.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) fullHistory: boolean | undefined = undefined; - @Field(() => Number, { description: "Sync progress in case the node is currently in sync mode. If specified, the value can be between 0 and 1.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) syncProgress: number | undefined = undefined; - @Field(() => Number, { description: "Remaining UnBond Period for node with status leaving.", nullable: true }) @ApiProperty({ type: Number, example: 10 }) remainingUnBondPeriod: number | undefined = undefined; - @Field(() => Boolean, { description: "Nodes in auction danger zone.", nullable: true }) @ApiProperty({ type: Boolean, example: false }) isInDangerZone: boolean | undefined = undefined; - @Field(() => Number, { description: "Number of epochs left for a node in waiting state.", nullable: true }) @ApiProperty({ type: Number, example: 15 }) epochsLeft: number | undefined = undefined; - @Field(() => Identity, { description: "Identity details for given nodes", nullable: true }) - @ApiProperty({ type: Identity, nullable: true }) + @ApiProperty({ type: Identity, nullable: true, required: false }) identityInfo?: Identity; - @Field(() => String, { description: "Qualified stake amout for a given node." }) @ApiProperty({ type: String, default: 0 }) qualifiedStake: string = ''; } diff --git a/src/endpoints/pool/entities/transaction.in.pool.dto.ts b/src/endpoints/pool/entities/transaction.in.pool.dto.ts index 1396f8942..0b8b471a8 100644 --- a/src/endpoints/pool/entities/transaction.in.pool.dto.ts +++ b/src/endpoints/pool/entities/transaction.in.pool.dto.ts @@ -1,50 +1,38 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { TransactionType } from "src/endpoints/transactions/entities/transaction.type"; -@ObjectType("TransactionInPool", { description: "Transaction in pool object type." }) export class TransactionInPool { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Transaction hash." }) @ApiProperty({ type: String, example: "6dc737fcb21e6f599c557f6001f78ae1f073241d1bd9b488b02f86c5131d477c" }) txHash: string = ''; - @Field(() => String, { description: "Sender address." }) @ApiProperty({ type: String, example: "erd17rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rc0pu8s7rcqqkhty3" }) sender: string = ''; - @Field(() => String, { description: "Receiver address." }) @ApiProperty({ type: String, example: "erd1an4xpn58j7ymd58m2jznr32t0vmas75egrdfa8mta6fzvqn9tkxq4jvghn" }) receiver: string = ''; - @Field(() => String, { description: "Receiver username." }) @ApiProperty({ type: String, example: "alice.elrond" }) receiverUsername: string = ''; - @Field(() => Number, { description: "Transaction nonce." }) @ApiProperty({ type: Number, example: 37 }) nonce: number = 0; - @Field(() => String, { description: "Transaction value." }) @ApiProperty({ type: String, example: "83499410000000000000000" }) value: string = ''; - @Field(() => String, { description: "Transaction data." }) @ApiProperty({ type: String, example: "dGV4dA==" }) data: string = ''; - @Field(() => Number, { description: "Gas price for the transaction." }) @ApiProperty({ type: Number, example: 1000000000 }) gasPrice: number = 0; - @Field(() => Number, { description: "Gas limit for the transaction." }) @ApiProperty({ type: Number, example: 50000 }) gasLimit: number = 0; - @Field(() => TransactionType, { description: "The type of the transaction." }) @ApiProperty({ type: String, example: "SmartContractResult" }) type: TransactionType = TransactionType.Transaction; } diff --git a/src/endpoints/providers/entities/nodes.infos.ts b/src/endpoints/providers/entities/nodes.infos.ts index 1241c21eb..94804bda0 100644 --- a/src/endpoints/providers/entities/nodes.infos.ts +++ b/src/endpoints/providers/entities/nodes.infos.ts @@ -1,25 +1,19 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("NodesInfos", { description: "NodesInfos object type." }) export class NodesInfos { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Float, { description: "Total numbers of nodes." }) - @ApiProperty() + @ApiProperty({ description: 'Number of nodes', type: Number, example: 10 }) numNodes: number = 0; - @Field(() => Float, { description: "Total stake amount." }) - @ApiProperty() + @ApiProperty({ description: 'Number of stake', type: Number, example: 100 }) stake: string = ''; - @Field(() => String, { description: "Top up details." }) - @ApiProperty() + @ApiProperty({ description: 'Number of topUp', type: Number, example: 100 }) topUp: string = ''; - @Field(() => String, { description: "Locked amound details." }) - @ApiProperty() + @ApiProperty({ description: 'Locked number', type: Number, example: 100 }) locked: string = ''; } diff --git a/src/endpoints/providers/entities/provider.accounts.ts b/src/endpoints/providers/entities/provider.accounts.ts index 445ca5125..3ddfe5d5c 100644 --- a/src/endpoints/providers/entities/provider.accounts.ts +++ b/src/endpoints/providers/entities/provider.accounts.ts @@ -1,4 +1,3 @@ -import { Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; export class ProviderAccounts { @@ -6,11 +5,9 @@ export class ProviderAccounts { Object.assign(this, init); } - @Field(() => String, { description: 'Address details.' }) @ApiProperty({ type: String, nullable: true, example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) address: string = ''; - @Field(() => String, { description: 'Stake details.' }) @ApiProperty({ type: String, nullable: true, example: '9999109666430000000' }) stake: string = ''; } diff --git a/src/endpoints/providers/entities/provider.ts b/src/endpoints/providers/entities/provider.ts index f51a9ecbf..1c4be936b 100644 --- a/src/endpoints/providers/entities/provider.ts +++ b/src/endpoints/providers/entities/provider.ts @@ -1,51 +1,40 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { NodesInfos } from "./nodes.infos"; import { Identity } from "src/endpoints/identities/entities/identity"; -@ObjectType("Provider", { description: "Provider object type." }) export class Provider extends NodesInfos { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => String, { description: "Provider address details." }) @ApiProperty({ type: String }) provider: string = ''; - @Field(() => String, { description: "Owner address details.", nullable: true }) @ApiProperty({ type: String, nullable: true }) owner: string | null = null; - @Field(() => Boolean, { description: "Featured details." }) @ApiProperty({ type: Boolean, default: false }) featured: boolean = false; - @Field(() => Float, { description: "Service fee details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) serviceFee: number = 0; - @Field(() => String, { description: "Delegation cap details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) delegationCap: string = ''; - @Field(() => Float, { description: "APR details percentage." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) apr: number = 0; - @Field(() => Float, { description: "Total number of users." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) numUsers: number = 0; - @Field(() => String, { description: "Provider cumulated rewards.", nullable: true }) @ApiProperty({ type: String, nullable: true }) cumulatedRewards: string | null = null; - @Field(() => String, { description: "Provider identity.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) identity: string | undefined = undefined; @ApiProperty({ type: String }) @@ -66,18 +55,18 @@ export class Provider extends NodesInfos { @ApiProperty({ type: Number }) createdNonce: number | undefined = undefined; - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) githubProfileValidated: boolean | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) githubProfileValidatedAt: string | undefined = undefined; - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) githubKeysValidated: boolean | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) githubKeysValidatedAt: string | undefined = undefined; - @ApiProperty({ type: Identity, nullable: true }) + @ApiProperty({ type: Identity, nullable: true, required: false }) identityInfo?: Identity; } diff --git a/src/endpoints/rounds/entities/round.detailed.ts b/src/endpoints/rounds/entities/round.detailed.ts index cb70ca9cb..ea020a040 100644 --- a/src/endpoints/rounds/entities/round.detailed.ts +++ b/src/endpoints/rounds/entities/round.detailed.ts @@ -1,15 +1,12 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { Round } from "./round"; -@ObjectType("RoundDetailed", { description: "RoundDetailed object type." }) export class RoundDetailed extends Round { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => [String]) - @ApiProperty({ type: String, isArray: true }) + @ApiProperty({ description: 'Signers', type: String, isArray: true }) signers: string[] = []; } diff --git a/src/endpoints/rounds/entities/round.ts b/src/endpoints/rounds/entities/round.ts index f7397fdec..9f09616d0 100644 --- a/src/endpoints/rounds/entities/round.ts +++ b/src/endpoints/rounds/entities/round.ts @@ -1,29 +1,22 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("Round", { description: "Round object type." }) export class Round { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Boolean, { description: "Block proposer for the given round." }) @ApiProperty({ type: Boolean, default: false }) blockWasProposed: boolean = false; - @Field(() => Float, { description: "Round number details." }) @ApiProperty({ type: Number, example: 9171722 }) round: number = 0; - @Field(() => Float, { description: "Shard ID for the given round." }) @ApiProperty({ type: Number, example: 1 }) shard: number = 0; - @Field(() => Float, { description: "Epoch for the given round." }) @ApiProperty({ type: Number, example: 636 }) epoch: number = 0; - @Field(() => Float, { description: "Timestamp for the given round." }) @ApiProperty({ type: Number, example: 1651148112 }) timestamp: number = 0; } diff --git a/src/endpoints/sc-results/entities/smart.contract.result.ts b/src/endpoints/sc-results/entities/smart.contract.result.ts index bd4b4ee19..dbaa06ac0 100644 --- a/src/endpoints/sc-results/entities/smart.contract.result.ts +++ b/src/endpoints/sc-results/entities/smart.contract.result.ts @@ -1,97 +1,74 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ID, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; import { TransactionAction } from "src/endpoints/transactions/transaction-action/entities/transaction.action"; import { TransactionLog } from "../../transactions/entities/transaction.log"; -@ObjectType("SmartContractResult", { description: "Smart contract result object type." }) export class SmartContractResult { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: 'Hash for the given smart contract result.', nullable: true }) @ApiProperty({ type: String }) hash: string = ''; - @Field(() => Float, { description: 'Timestamp for the given smart contract result.' }) @ApiProperty({ type: Number }) timestamp: number = 0; - @Field(() => Float, { description: 'Nonce for the given smart contract result.' }) @ApiProperty({ type: Number }) nonce: number = 0; - @Field(() => Float, { description: 'Gas limit for the given smart contract result.' }) @ApiProperty({ type: Number }) gasLimit: number = 0; - @Field(() => Float, { description: 'Gas price for the given smart contract result.' }) @ApiProperty({ type: Number }) gasPrice: number = 0; - @Field(() => String, { description: 'Value for the given smart contract result.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) value: string = ''; - @Field(() => String, { description: 'Sender address for the given smart contract result.' }) @ApiProperty({ type: String }) sender: string = ''; - @Field(() => String, { description: 'Receiver address for the given smart contract result.' }) @ApiProperty({ type: String }) receiver: string = ''; - @Field(() => AccountAssets, { description: 'Sender assets for the given smart contract result.', nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) senderAssets: AccountAssets | undefined = undefined; - @Field(() => AccountAssets, { description: 'Receiver assets for the given smart contract result.', nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) receiverAssets: AccountAssets | undefined = undefined; - @Field(() => String, { description: 'Relayed value for the given smart contract result.' }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) relayedValue: string = ''; - @Field(() => String, { description: 'Data for the given smart contract result.' }) @ApiProperty({ type: String }) data: string = ''; - @Field(() => String, { description: 'Previous transaction hash for the given smart contract result.' }) @ApiProperty({ type: String }) prevTxHash: string = ''; - @Field(() => String, { description: 'Original transaction hash for the given smart contract result.' }) @ApiProperty({ type: String }) originalTxHash: string = ''; - @Field(() => String, { description: 'Call type for the given smart contract result.' }) @ApiProperty({ type: String }) callType: string = ''; - @Field(() => String, { description: 'Mini block hash for the given smart contract result.', nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) miniBlockHash: string | undefined = undefined; - @Field(() => TransactionLog, { description: 'Transaction logs for the given smart contract result.', nullable: true }) - @ApiProperty({ type: TransactionLog, nullable: true }) + @ApiProperty({ type: TransactionLog, nullable: true, required: false }) logs: TransactionLog | undefined = undefined; - @Field(() => String, { description: 'Return message for the given smart contract result.', nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) returnMessage: string | undefined = undefined; - @Field(() => TransactionAction, { description: 'Transaction action for the given smart contract result.', nullable: true }) - @ApiProperty({ type: TransactionAction, nullable: true }) + @ApiProperty({ type: TransactionAction, nullable: true, required: false }) action: TransactionAction | undefined = undefined; - @Field(() => String, { description: 'Function call', nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) function: string | undefined = undefined; - @Field(() => String, { description: 'Result status', nullable: true }) @ApiProperty({ type: String, nullable: true }) status: string | undefined = undefined; } diff --git a/src/endpoints/shards/entities/shard.ts b/src/endpoints/shards/entities/shard.ts index 1aaa2071f..29ee72dff 100644 --- a/src/endpoints/shards/entities/shard.ts +++ b/src/endpoints/shards/entities/shard.ts @@ -1,21 +1,16 @@ -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("Shard", { description: "Shard object type." }) export class Shard { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Float, { description: "Shard details." }) - @ApiProperty({ type: Number, example: 1 }) + @ApiProperty({ description: 'Shard details', type: Number, example: 1 }) shard: number = 0; - @Field(() => Float, { description: "Total number of validators." }) - @ApiProperty({ type: Number, example: 800 }) + @ApiProperty({ description: 'Validators details', type: Number, example: 800 }) validators: number = 0; - @Field(() => Float, { description: "Total number of active validators." }) - @ApiProperty({ type: Number, example: 800 }) + @ApiProperty({ description: 'Active validators details', type: Number, example: 800 }) activeValidators: number = 0; } diff --git a/src/endpoints/stake/entities/account.delegation.ts b/src/endpoints/stake/entities/account.delegation.ts index a10f38346..21ef902ff 100644 --- a/src/endpoints/stake/entities/account.delegation.ts +++ b/src/endpoints/stake/entities/account.delegation.ts @@ -1,35 +1,27 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountUndelegation } from "./account.undelegation"; -@ObjectType("AccountDelegation", { description: "Account delegation object type that extends Account." }) export class AccountDelegation { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Address for the given detailed account.' }) - @ApiProperty({ type: String }) + @ApiProperty({ description: 'Delegation account details', type: String }) address: string = ""; - @Field(() => String, { description: 'Contract for the given detailed account.' }) - @ApiProperty({ type: String }) + @ApiProperty({ description: 'Account delegation contract', type: String }) contract: string = ""; - @Field(() => String, { description: 'UserUnBondable for the given detailed account.' }) - @ApiProperty(SwaggerUtils.amountPropertyOptions()) + @ApiProperty(SwaggerUtils.amountPropertyOptions({ required: false })) userUnBondable: string = ""; - @Field(() => String, { description: 'UserActiveStake for the given detailed account.' }) - @ApiProperty(SwaggerUtils.amountPropertyOptions()) + @ApiProperty(SwaggerUtils.amountPropertyOptions({ required: false })) userActiveStake: string = ""; - @Field(() => String, { description: 'Claimable Rewards for the given detailed account.' }) - @ApiProperty(SwaggerUtils.amountPropertyOptions()) + @ApiProperty(SwaggerUtils.amountPropertyOptions({ required: false })) claimableRewards: string = ""; - @Field(() => AccountUndelegation, { description: 'UserUndelegatedList for the given detailed account.' }) - @ApiProperty({ type: AccountUndelegation, isArray: true }) + @ApiProperty({ description: 'User undelegated list details', type: AccountUndelegation, isArray: true, required: false }) userUndelegatedList: AccountUndelegation[] = []; } diff --git a/src/endpoints/stake/entities/account.undelegation.ts b/src/endpoints/stake/entities/account.undelegation.ts index 565b9bfa3..466f89e32 100644 --- a/src/endpoints/stake/entities/account.undelegation.ts +++ b/src/endpoints/stake/entities/account.undelegation.ts @@ -1,18 +1,14 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("AccountUndelegation", { description: "Account undelegation object type that extends Account." }) export class AccountUndelegation { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Amount for the given detailed account.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) amount: string = ''; - @Field(() => Float, { description: 'Seconds for the given detailed account.' }) @ApiProperty({ type: Number }) seconds: number = 0; } diff --git a/src/endpoints/stake/entities/global.stake.ts b/src/endpoints/stake/entities/global.stake.ts index d5c224ad2..4612ea62c 100644 --- a/src/endpoints/stake/entities/global.stake.ts +++ b/src/endpoints/stake/entities/global.stake.ts @@ -1,66 +1,50 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("GlobalStake", { description: "GlobalStake object type." }) export class GlobalStake { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Float, { description: "Total validators." }) @ApiProperty({ type: Number, default: 3200 }) totalValidators: number = 0; - @Field(() => Float, { description: "Active validators." }) @ApiProperty({ type: Number, default: 3199 }) activeValidators: number = 0; - @Field(() => Float, { description: "Total observers." }) @ApiProperty({ type: Number, default: 3199 }) totalObservers: number = 0; - @Field(() => Float, { description: "Validators queue size." }) @ApiProperty({ type: Number, default: 2 }) queueSize: number = 0; - @Field(() => Float, { description: "Total stake amount." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) totalStaked: string = ''; - @Field(() => String, { description: "Minimum Auction Qualified Top Up information.", nullable: true }) @ApiProperty({ type: String, nullable: true }) minimumAuctionQualifiedTopUp: string | undefined = undefined; - @Field(() => String, { description: "Minimum Auction Qualified Stake information.", nullable: true }) @ApiProperty({ type: String, nullable: true }) minimumAuctionQualifiedStake: string | undefined = undefined; - @Field(() => Float, { description: "Auction Validators." }) @ApiProperty({ type: Number, nullable: true }) auctionValidators: number | undefined = undefined; - @Field(() => Float, { description: "Nakamoto Coefficient." }) @ApiProperty({ type: Number, nullable: true }) nakamotoCoefficient: number | undefined = undefined; - @Field(() => Float, { description: "Danger Zone Validators." }) @ApiProperty({ type: Number, nullable: true }) dangerZoneValidators: number | undefined = undefined; - @Field(() => Float, { description: "Eligible Validators." }) @ApiProperty({ type: Number, nullable: true }) eligibleValidators: number | undefined = undefined; - @Field(() => Float, { description: "Not Eligible Validators." }) @ApiProperty({ type: Number, nullable: true }) waitingValidators: number | undefined = undefined; - @Field(() => Float, { description: "Qualified Auction Validators." }) @ApiProperty({ type: Number, nullable: true }) qualifiedAuctionValidators: number | undefined = undefined; - @Field(() => Float, { description: "All Staked Nodes." }) @ApiProperty({ type: Number, nullable: true }) allStakedNodes: number | undefined = undefined; } diff --git a/src/endpoints/stake/entities/provider.stake.ts b/src/endpoints/stake/entities/provider.stake.ts index 9bd6fe3cd..64586736e 100644 --- a/src/endpoints/stake/entities/provider.stake.ts +++ b/src/endpoints/stake/entities/provider.stake.ts @@ -1,19 +1,15 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { ProviderUnstakedTokens } from "./provider.unstaked.tokens"; -@ObjectType("ProviderStake", { description: "Provider stake object type." }) export class ProviderStake { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Total stake for the given account.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) totalStaked: string = ''; - @Field(() => [ProviderUnstakedTokens], { description: 'Unstaked tokens details for the given account.', nullable: true }) - @ApiProperty({ type: ProviderUnstakedTokens, isArray: true, nullable: true }) + @ApiProperty({ type: ProviderUnstakedTokens, isArray: true, nullable: true, required: false }) unstakedTokens: ProviderUnstakedTokens[] | undefined = undefined; } diff --git a/src/endpoints/stake/entities/provider.unstaked.tokens.ts b/src/endpoints/stake/entities/provider.unstaked.tokens.ts index 4e60c9920..eeffc16b6 100644 --- a/src/endpoints/stake/entities/provider.unstaked.tokens.ts +++ b/src/endpoints/stake/entities/provider.unstaked.tokens.ts @@ -1,22 +1,17 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("ProviderUnstakedTokens", { description: "Provider unstaked tokens object type." }) export class ProviderUnstakedTokens { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Amount for the given token.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) amount: string = ''; - @Field(() => String, { description: 'Expires details for the given token.', nullable: true }) @ApiProperty({ type: Number, nullable: true }) expires: number | undefined = undefined; - @Field(() => String, { description: 'Epoch number for the given token.', nullable: true }) @ApiProperty({ type: Number, nullable: true }) epochs: number | undefined; } diff --git a/src/endpoints/tokens/entities/collection.roles.ts b/src/endpoints/tokens/entities/collection.roles.ts index 74bd94321..a81a21504 100644 --- a/src/endpoints/tokens/entities/collection.roles.ts +++ b/src/endpoints/tokens/entities/collection.roles.ts @@ -1,41 +1,31 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("CollectionRoles", { description: "Collection roles object type." }) export class CollectionRoles { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Address for the given collection roles.', nullable: true }) @ApiProperty({ type: String, nullable: true }) address: string | undefined = undefined; - @Field(() => Boolean, { description: 'If the given collection role can create.' }) @ApiProperty({ type: Boolean, default: false }) canCreate: boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can burn.' }) @ApiProperty({ type: Boolean, default: false }) canBurn: boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can add quantity.' }) @ApiProperty({ type: Boolean, default: false }) canAddQuantity: boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can update attributes.' }) @ApiProperty({ type: Boolean, default: false }) canUpdateAttributes: boolean = false; - @Field(() => Boolean, { description: 'If the given collection role can add URI.' }) @ApiProperty({ type: Boolean, default: false }) canAddUri: boolean = false; - @Field(() => Boolean, { description: 'If tokens from the given collections are allowed to be transferred by the given account.' }) @ApiProperty({ type: Boolean, default: false }) canTransfer: boolean | undefined = undefined; - @Field(() => [String], { description: 'Roles list for the given collection roles.' }) @ApiProperty({ type: [String] }) roles: string[] = []; } diff --git a/src/endpoints/tokens/entities/token.account.ts b/src/endpoints/tokens/entities/token.account.ts index 3655c438c..8ce3b2837 100644 --- a/src/endpoints/tokens/entities/token.account.ts +++ b/src/endpoints/tokens/entities/token.account.ts @@ -1,31 +1,24 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; -@ObjectType("TokenAccount", { description: "TokenAccount object type." }) export class TokenAccount { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Token account address." }) @ApiProperty({ type: String, example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) address: string = ""; - @Field(() => String, { description: "Token balance account amount." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) balance: string = ""; - @Field(() => String, { description: "Token identifier if MetaESDT.", nullable: true }) @ApiProperty({ type: String, nullable: true }) identifier: string | undefined = undefined; - @Field(() => String, { description: "Token attributes if MetaESDT.", nullable: true }) @ApiProperty({ type: String, nullable: true }) attributes: string | undefined = undefined; - @Field(() => AccountAssets, { description: 'Account assets for the given account.', nullable: true }) @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets' }) assets: AccountAssets | undefined = undefined; } diff --git a/src/endpoints/tokens/entities/token.detailed.ts b/src/endpoints/tokens/entities/token.detailed.ts index 773490a33..3c9385bfe 100644 --- a/src/endpoints/tokens/entities/token.detailed.ts +++ b/src/endpoints/tokens/entities/token.detailed.ts @@ -1,41 +1,32 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { Token } from "./token"; import { TokenRoles } from "./token.roles"; -@ObjectType("TokenDetailed", { description: "TokenDetailed object type." }) export class TokenDetailed extends Token { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => String, { description: "Token supply amount details.", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Supply amount' })) supply: string | number | undefined = undefined; - @Field(() => String, { description: "Token circulating supply amount details.", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Circulating supply amount' })) circulatingSupply: string | number | undefined = undefined; - @Field(() => [TokenRoles], { description: "Token roles details.", nullable: true }) @ApiProperty({ type: TokenRoles, nullable: true, isArray: true }) roles: TokenRoles[] | undefined = undefined; - @Field(() => String, { description: "Token minted amount details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Minted amount' })) minted: string = ''; - @Field(() => String, { description: "Token burn amount details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Burnt amount' })) burnt: string = ''; - @Field(() => String, { description: "Token initial minted amount details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Initial minted amount' })) initialMinted: string = ''; - @Field(() => Boolean, { description: 'If the given NFT collection can transfer the underlying tokens by default.', nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canTransfer: boolean | undefined = undefined; } diff --git a/src/endpoints/tokens/entities/token.roles.ts b/src/endpoints/tokens/entities/token.roles.ts index dfaa1181d..612fc5c3e 100644 --- a/src/endpoints/tokens/entities/token.roles.ts +++ b/src/endpoints/tokens/entities/token.roles.ts @@ -1,49 +1,37 @@ -import { Field, ObjectType } from '@nestjs/graphql'; import { ApiProperty } from '@nestjs/swagger'; -@ObjectType("TokenRoles", { description: "TokenRoles object type." }) export class TokenRoles { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Token address with role.", nullable: true }) @ApiProperty({ type: String, nullable: true }) address: string | undefined; - @Field(() => Boolean, { description: "Token canLocalMint property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canLocalMint: boolean = false; - @Field(() => Boolean, { description: "Token canLocalBurn property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canLocalBurn: boolean = false; - @Field(() => Boolean, { description: "Token canCreate property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canCreate?: boolean = undefined; - @Field(() => Boolean, { description: "Token canBurn property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canBurn?: boolean = undefined; - @Field(() => Boolean, { description: "Token canAddQuantity property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canAddQuantity?: boolean = undefined; - @Field(() => Boolean, { description: "Token canUpdateAttributes property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canUpdateAttributes?: boolean = undefined; - @Field(() => Boolean, { description: "Token canAddUri property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canAddUri?: boolean = undefined; - @Field(() => Boolean, { description: "Token canTransfer property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canTransfer?: boolean = undefined; - @Field(() => [String], { description: "Token roles details." }) @ApiProperty({ type: [String] }) roles: string[] = []; } diff --git a/src/endpoints/tokens/entities/token.supply.options.ts b/src/endpoints/tokens/entities/token.supply.options.ts index fdceac47d..ff730dbbe 100644 --- a/src/endpoints/tokens/entities/token.supply.options.ts +++ b/src/endpoints/tokens/entities/token.supply.options.ts @@ -1,14 +1,11 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("TokenSupplyOptions", { description: "TokenSupplyOptions object." }) export class TokenSupplyOptions { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => Boolean, { description: "Token supply denominated details.", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Supply amount' })) denominated?: boolean; } diff --git a/src/endpoints/tokens/entities/token.supply.result.ts b/src/endpoints/tokens/entities/token.supply.result.ts index 27147ff3c..879486880 100644 --- a/src/endpoints/tokens/entities/token.supply.result.ts +++ b/src/endpoints/tokens/entities/token.supply.result.ts @@ -1,27 +1,26 @@ -import { Field, ObjectType } from "@nestjs/graphql"; +import { ApiProperty } from "@nestjs/swagger"; import { EsdtLockedAccount } from "src/endpoints/esdt/entities/esdt.locked.account"; -@ObjectType("TokenSupplyResult", { description: "TokenSupplyResult object type." }) export class TokenSupplyResult { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Token supply." }) + @ApiProperty({ description: 'Supply details', type: String }) supply: string | number = ''; - @Field(() => String, { description: "Token circulating supply." }) + @ApiProperty({ description: 'Circulating supply details', type: String }) circulatingSupply: string | number = ''; - @Field(() => String, { description: "Token minted details." }) + @ApiProperty({ description: 'Minted details', type: String }) minted: string | number | undefined; - @Field(() => String, { description: "Token burnt." }) + @ApiProperty({ description: 'Token burnt details', type: String }) burnt: string | number | undefined; - @Field(() => String, { description: "Token initial minted." }) + @ApiProperty({ description: 'Initial minted details', type: String }) initialMinted: string | number | undefined; - @Field(() => [EsdtLockedAccount], { description: "Token locked accounts." }) + @ApiProperty({ description: 'Esdt locked accounts details', type: EsdtLockedAccount, isArray: true }) lockedAccounts: EsdtLockedAccount[] | undefined = undefined; } diff --git a/src/endpoints/tokens/entities/token.ts b/src/endpoints/tokens/entities/token.ts index 426c5f749..fc59d4b98 100644 --- a/src/endpoints/tokens/entities/token.ts +++ b/src/endpoints/tokens/entities/token.ts @@ -1,174 +1,132 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { TokenType } from "src/common/indexer/entities"; import { TokenAssets } from "../../../common/assets/entities/token.assets"; import { MexPairType } from "src/endpoints/mex/entities/mex.pair.type"; import { TokenOwnersHistory } from "./token.owner.history"; -@ObjectType("Token", { description: "Token object type." }) export class Token { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => TokenType, { description: "Token type." }) @ApiProperty({ enum: TokenType }) type: TokenType = TokenType.FungibleESDT; - @Field(() => String, { description: "Token Identifier." }) @ApiProperty({ type: String }) identifier: string = ''; - @Field(() => String, { description: "Token Collection if type is MetaESDT.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) collection: string | undefined = undefined; - @Field(() => Number, { description: "Token Nonce if type is MetaESDT.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) nonce: number | undefined = undefined; - @Field(() => String, { description: "Token name." }) @ApiProperty({ type: String }) name: string = ''; - @Field(() => String, { description: "Token ticker." }) @ApiProperty({ type: String }) ticker: string = ''; - @Field(() => String, { description: "Token owner address." }) @ApiProperty({ type: String }) owner: string = ''; - @Field(() => String, { description: "Token minted details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) minted: string = ''; - @Field(() => String, { description: "Token burnt details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) burnt: string = ''; - @Field(() => String, { description: "Token initial minting details." }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) initialMinted: string = ''; - @Field(() => Float, { description: "Token decimals." }) @ApiProperty({ type: Number }) decimals: number = 0; - @Field(() => Boolean, { description: "Token isPause property." }) @ApiProperty({ type: Boolean, default: false }) isPaused: boolean = false; - @Field(() => TokenAssets, { description: "Token assests details.", nullable: true }) - @ApiProperty({ type: TokenAssets, nullable: true }) + @ApiProperty({ type: TokenAssets, nullable: true, required: false }) assets: TokenAssets | undefined = undefined; - @Field(() => Float, { description: "Token transactions.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) transactions: number | undefined = undefined; - @Field(() => Number, { description: "Token transactions last updated timestamp.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) transactionsLastUpdatedAt: number | undefined = undefined; - @Field(() => Number, { description: "Token transfers.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) transfers: number | undefined = undefined; - @Field(() => Number, { description: "Token transfers last updated timestamp.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) transfersLastUpdatedAt: number | undefined = undefined; - @Field(() => Number, { description: "Token accounts." }) @ApiProperty({ type: Number, nullable: true }) accounts: number | undefined = undefined; - @Field(() => Number, { description: "Token accounts last updated timestamp.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) accountsLastUpdatedAt: number | undefined = undefined; - @Field(() => Boolean, { description: "Token canUpgrade property." }) @ApiProperty({ type: Boolean, default: false }) canUpgrade: boolean = false; - @Field(() => Boolean, { description: "Token canMint property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canMint: boolean | undefined = undefined; - @Field(() => Boolean, { description: "Token canBurn property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canBurn: boolean | undefined = undefined; - @Field(() => Boolean, { description: "Token canChangeOwner property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canChangeOwner: boolean | undefined = undefined; - @Field(() => Boolean, { description: "Token canAddSpecialRoles property in case of type MetaESDT.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canAddSpecialRoles: boolean | undefined = undefined; - @Field(() => Boolean, { description: "Token canPause property." }) @ApiProperty({ type: Boolean, default: false }) canPause: boolean = false; - @Field(() => Boolean, { description: "Token canFreeze property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canFreeze: boolean | undefined = undefined; - @Field(() => Boolean, { description: "Token canWipe property.", nullable: true }) @ApiProperty({ type: Boolean, default: false }) canWipe: boolean = false; - @Field(() => Boolean, { description: "Token canFreeze property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canTransferNftCreateRole: boolean | undefined = undefined; - @Field(() => Float, { description: "Current token price.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) price: number | undefined = undefined; - @Field(() => Float, { description: "Current market cap details.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) marketCap: number | undefined = undefined; - @Field(() => String, { description: "Token supply amount details.", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Supply amount' })) supply: string | number | undefined = undefined; - @Field(() => String, { description: "Token circulating supply amount details.", nullable: true }) @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Circulating supply amount' })) circulatingSupply: string | number | undefined = undefined; - @Field(() => Number, { description: "Creation timestamp." }) @ApiProperty({ type: Number, description: 'Creation timestamp' }) timestamp: number | undefined = undefined; - @Field(() => MexPairType, { description: "Mex pair type details." }) @ApiProperty({ enum: MexPairType }) mexPairType: MexPairType = MexPairType.experimental; - @Field(() => Number, { description: "Total value captured in liquidity pools." }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) totalLiquidity: number | undefined = undefined; - @Field(() => Number, { description: "Total traded value in the last 24h within the liquidity pools." }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) totalVolume24h: number | undefined = undefined; - @Field(() => Boolean, { description: 'If the liquidity to market cap ratio is less than 0.5%, we consider it as low liquidity.', nullable: true }) - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) isLowLiquidity: boolean | undefined = undefined; - @Field(() => Number, { description: 'If the liquidity to market cap ratio is less than 0.5%, we consider it as low liquidity and display threshold percent .', nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) lowLiquidityThresholdPercent: number | undefined = undefined; - @Field(() => Number, { description: 'Mex pair trades count.', nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) tradesCount: number | undefined = undefined; - @Field(() => TokenOwnersHistory, { description: 'Token owners history.', nullable: true }) @ApiProperty({ type: TokenOwnersHistory, nullable: true }) ownersHistory: TokenOwnersHistory[] = []; } diff --git a/src/endpoints/tokens/entities/token.with.balance.ts b/src/endpoints/tokens/entities/token.with.balance.ts index de10262c9..808b699e8 100644 --- a/src/endpoints/tokens/entities/token.with.balance.ts +++ b/src/endpoints/tokens/entities/token.with.balance.ts @@ -1,28 +1,23 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, Float, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { Token } from "./token"; import { MexPairType } from "src/endpoints/mex/entities/mex.pair.type"; -@ObjectType("TokenWithBalance", { description: "NFT collection account object type." }) export class TokenWithBalance extends Token { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => String, { description: 'Balance for the given token account.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) balance: string = ''; - @Field(() => Float, { description: 'ValueUsd token for the given token account.', nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) valueUsd: number | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) attributes: string | undefined = undefined; - @Field(() => MexPairType, { description: "Mex pair type details." }) @ApiProperty({ enum: MexPairType }) mexPairType: MexPairType = MexPairType.experimental; } diff --git a/src/endpoints/tokens/entities/token.with.roles.ts b/src/endpoints/tokens/entities/token.with.roles.ts index c4b23adf1..6b2a386f7 100644 --- a/src/endpoints/tokens/entities/token.with.roles.ts +++ b/src/endpoints/tokens/entities/token.with.roles.ts @@ -1,4 +1,3 @@ -import { Field } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { Token } from "./token"; import { TokenRoles } from "./token.roles"; @@ -9,43 +8,30 @@ export class TokenWithRoles extends Token { Object.assign(this, init); } - @Field(() => TokenRoles, { description: "The roles of the token." }) @ApiProperty({ type: TokenRoles }) role: TokenRoles = new TokenRoles(); - @Field(() => String, { description: "Token address with role.", nullable: true, deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: String, nullable: true }) address: string | undefined; - @Field(() => Boolean, { description: "Token canLocalMint property.", nullable: true, deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, nullable: true }) canLocalMint: boolean = false; - @Field(() => Boolean, { description: "Token canLocalBurn property.", nullable: true, deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, nullable: true }) canLocalBurn: boolean = false; - @Field(() => Boolean, { description: "Token canCreate property.", nullable: true, deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, nullable: true }) canCreate?: boolean = undefined; - // @Field(() => Boolean, { description: "Token canBurn property.", nullable: true, deprecationReason: 'Already included in underlying roles structure' }) - // @ApiProperty({ type: Boolean, nullable: true }) - // canBurn?: boolean = undefined; - - @Field(() => Boolean, { description: "Token canAddQuantity property.", nullable: true, deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, nullable: true }) canAddQuantity?: boolean = undefined; - @Field(() => Boolean, { description: "Token canUpdateAttributes property.", nullable: true, deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, nullable: true }) canUpdateAttributes?: boolean = undefined; - @Field(() => Boolean, { description: "Token canAddUri property.", nullable: true, deprecationReason: 'Already included in underlying roles structure' }) @ApiProperty({ type: Boolean, nullable: true }) canAddUri?: boolean = undefined; - @Field(() => Boolean, { description: "Token canTransfer property.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) canTransfer: boolean = false; } diff --git a/src/endpoints/tps/entities/tps.ts b/src/endpoints/tps/entities/tps.ts index 215cf6740..2f8ed44e2 100644 --- a/src/endpoints/tps/entities/tps.ts +++ b/src/endpoints/tps/entities/tps.ts @@ -1,8 +1,13 @@ +import { ApiProperty } from "@nestjs/swagger"; + export class Tps { constructor(init?: Partial) { Object.assign(this, init); } + @ApiProperty({ description: 'The number of transactions per second', type: Number, example: 10000 }) tps: number = 0; + + @ApiProperty({ description: 'The timestamp when the TPS was recorder', type: Number, example: 1704070861 }) timestamp: number = 0; } diff --git a/src/endpoints/transactions/entities/transaction.detailed.ts b/src/endpoints/transactions/entities/transaction.detailed.ts index 8bc5e538b..a98e28fa3 100644 --- a/src/endpoints/transactions/entities/transaction.detailed.ts +++ b/src/endpoints/transactions/entities/transaction.detailed.ts @@ -1,4 +1,3 @@ -import { Field, Float, ObjectType } from '@nestjs/graphql'; import { ApiProperty } from '@nestjs/swagger'; import { SmartContractResult } from '../../sc-results/entities/smart.contract.result'; import { Transaction } from './transaction'; @@ -6,61 +5,49 @@ import { TransactionReceipt } from './transaction.receipt'; import { TransactionLog } from './transaction.log'; import { TransactionOperation } from './transaction.operation'; import { ComplexityEstimation } from '@multiversx/sdk-nestjs-common'; -@ObjectType(TransactionDetailed.name, { description: 'Detailed Transaction object type that extends Transaction.' }) export class TransactionDetailed extends Transaction { constructor(init?: Partial) { super(); Object.assign(this, init); } - @Field(() => [SmartContractResult], { description: 'Smart contract results list for the given detailed transaction. Complexity: 200', nullable: true }) @ApiProperty({ type: SmartContractResult, isArray: true }) @ComplexityEstimation({ group: "details", value: 200, alternatives: ["withScResults"] }) results: SmartContractResult[] | undefined = undefined; - @Field(() => TransactionReceipt, { description: 'Transaction receipt for the given detailed transaction.', nullable: true }) @ApiProperty({ type: TransactionReceipt, nullable: true }) receipt: TransactionReceipt | undefined = undefined; - @Field(() => Float, { description: 'Price for the given detailed transaction.', nullable: true }) @ApiProperty({ type: Number, nullable: true }) price: number | undefined = undefined; - @Field(() => TransactionLog, { description: 'Transaction log for the given detailed transaction.', nullable: true }) @ApiProperty({ type: TransactionLog, nullable: true }) @ComplexityEstimation({ group: "details", value: 200, alternatives: ["withLogs"] }) logs: TransactionLog | undefined = undefined; - @Field(() => [TransactionOperation], { description: 'Transaction operations list for the given detailed transaction. Complexity: 200', nullable: true }) @ApiProperty({ type: TransactionOperation, isArray: true }) @ComplexityEstimation({ group: "details", value: 200, alternatives: ["withOperations"] }) operations: TransactionOperation[] = []; - @Field(() => String, { description: "Sender Block hash for the given transaction.", nullable: true }) @ApiProperty({ type: String, nullable: true }) @ComplexityEstimation({ group: "blockInfo", value: 200, alternatives: ["withBlockInfo"] }) senderBlockHash: string | undefined = undefined; - @Field(() => Float, { description: "Sender Block nonce for the given transaction.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) @ComplexityEstimation({ group: "blockInfo", value: 200, alternatives: ["withBlockInfo"] }) senderBlockNonce: number | undefined = undefined; - @Field(() => String, { description: "Receiver Block hash for the given transaction.", nullable: true }) @ApiProperty({ type: String, nullable: true }) @ComplexityEstimation({ group: "blockInfo", value: 200, alternatives: ["withBlockInfo"] }) receiverBlockHash: string | undefined = undefined; - @Field(() => Float, { description: "Receiver Block nonce for the given transaction.", nullable: true }) @ApiProperty({ type: Number, nullable: true }) @ComplexityEstimation({ group: "blockInfo", value: 200, alternatives: ["withBlockInfo"] }) receiverBlockNonce: number | undefined = undefined; - @Field(() => Boolean, { description: "InTransit transaction details.", nullable: true }) @ApiProperty({ type: Boolean, nullable: true }) inTransit: boolean | undefined = undefined; - @Field(() => String, { description: "Relayed transaction version.", nullable: true }) @ApiProperty({ type: String, nullable: true }) relayedVersion: string | undefined = undefined; } diff --git a/src/endpoints/transactions/entities/transaction.log.event.ts b/src/endpoints/transactions/entities/transaction.log.event.ts index 6ea8aed30..34a588f66 100644 --- a/src/endpoints/transactions/entities/transaction.log.event.ts +++ b/src/endpoints/transactions/entities/transaction.log.event.ts @@ -1,34 +1,26 @@ -import { Field, ID, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; -@ObjectType("TransactionLogEvent", { description: "Transaction log event object type." }) export class TransactionLogEvent { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Address for the given transaction log event.' }) @ApiProperty() address: string = ''; - @Field(() => AccountAssets, { description: 'Address assets for the given transaction log event.' }) @ApiProperty({ type: AccountAssets, nullable: true }) addressAssets: AccountAssets | undefined = undefined; - @Field(() => ID, { description: 'Identifier for the given transaction log event.' }) @ApiProperty() identifier: string = ''; - @Field(() => [String], { description: 'Topics list for the given transaction log event.' }) @ApiProperty() topics: string[] = []; - @Field(() => String, { description: 'Data for the given transaction log event.', nullable: true }) @ApiProperty() data: string = ''; - @Field(() => String, { description: 'Additional data for the given transaction log event.', nullable: true }) @ApiProperty() additionalData: string[] | undefined = undefined; } diff --git a/src/endpoints/transactions/entities/transaction.log.ts b/src/endpoints/transactions/entities/transaction.log.ts index 20d530882..256f3cd83 100644 --- a/src/endpoints/transactions/entities/transaction.log.ts +++ b/src/endpoints/transactions/entities/transaction.log.ts @@ -1,26 +1,21 @@ -import { Field, ID, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; import { TransactionLogEvent } from "./transaction.log.event"; -@ObjectType("TransactionLog", { description: "Transaction log object type." }) export class TransactionLog { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: 'Identifier for the given transaction log.' }) + @ApiProperty({ description: 'Transaction log ID', type: String }) id: string | undefined = undefined; - @Field(() => String, { description: 'Address for the given transaction log.' }) - @ApiProperty() + @ApiProperty({ description: 'Transaction log address', type: String }) address: string = ''; - @Field(() => AccountAssets, { description: 'Account assets for the given transaction log.', nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ description: 'Transaction address assets', type: AccountAssets, nullable: true, required: false }) addressAssets: AccountAssets | undefined = undefined; - @Field(() => [TransactionLogEvent], { description: 'Transaction log events list for the given transaction log.' }) - @ApiProperty() + @ApiProperty({ description: 'Transaction log events', type: TransactionLogEvent, isArray: true }) events: TransactionLogEvent[] = []; } diff --git a/src/endpoints/transactions/entities/transaction.operation.ts b/src/endpoints/transactions/entities/transaction.operation.ts index e5158ab8a..eb7471494 100644 --- a/src/endpoints/transactions/entities/transaction.operation.ts +++ b/src/endpoints/transactions/entities/transaction.operation.ts @@ -1,89 +1,68 @@ -import { Field, Float, ID, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; import { EsdtType } from "src/endpoints/esdt/entities/esdt.type"; import { TransactionOperationAction } from "./transaction.operation.action"; import { TransactionOperationType } from "./transaction.operation.type"; -@ObjectType('TransactionOperation', { description: 'Transaction operation object type.' }) export class TransactionOperation { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: 'Identifier for the transaction operation.' }) @ApiProperty({ type: String }) id: string = ''; - @Field(() => TransactionOperationAction, { description: 'Transaction operation action for the transaction operation.' }) @ApiProperty({ enum: TransactionOperationAction, default: TransactionOperationAction.none }) action: TransactionOperationAction = TransactionOperationAction.none; - @Field(() => TransactionOperationType, { description: 'Transaction operation type for the transaction operation.' }) @ApiProperty({ enum: TransactionOperationType, default: TransactionOperationType.none }) type: TransactionOperationType = TransactionOperationType.none; - @Field(() => EsdtType, { description: 'ESDT type for the transaction operation.', nullable: true }) - @ApiProperty({ enum: EsdtType }) + @ApiProperty({ enum: EsdtType, required: false }) esdtType?: EsdtType; - @Field(() => String, { description: 'Identifier for the transaction operation.' }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) identifier: string = ''; - @Field(() => String, { description: 'Token ticker for the transaction operation.' }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) ticker?: string = ''; - @Field(() => String, { description: 'Collection for the transaction operation.', nullable: true }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) collection?: string; - @Field(() => String, { description: 'Name for the transaction operation.', nullable: true }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) name?: string; - @Field(() => String, { description: 'Value for the transaction operation.', nullable: true }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) value?: string; - @Field(() => Number, { description: 'Value for the transaction operation in USD.', nullable: true }) - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) valueUSD?: number; - @Field(() => String, { description: 'Sender address for the transaction operation.' }) @ApiProperty({ type: String }) sender: string = ''; - @Field(() => String, { description: 'Receiver address for the transaction operation.' }) @ApiProperty({ type: String }) receiver: string = ''; - @Field(() => AccountAssets, { description: 'Sender account assets for the transaction operation.', nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) senderAssets: AccountAssets | undefined = undefined; - @Field(() => AccountAssets, { description: 'Receiver account assets for the transaction operation.', nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) receiverAssets: AccountAssets | undefined = undefined; - @Field(() => Float, { description: 'Decimals for the transaction operation.', nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) decimals?: number; - @Field(() => String, { description: 'Data for the transaction operation.', nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) data?: string; - @Field(() => String, { description: 'Additional data for the given transaction operation.', nullable: true }) - @ApiProperty() + @ApiProperty({ required: false }) additionalData?: string[] = []; - @Field(() => String, { description: 'Message for the transaction operation.', nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) message?: string; - @Field(() => String, { description: 'SVG URL for the transaction operation.', nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) svgUrl?: string; } diff --git a/src/endpoints/transactions/entities/transaction.pool.ts b/src/endpoints/transactions/entities/transaction.pool.ts index 6a9f1b7ce..4d9da10c5 100644 --- a/src/endpoints/transactions/entities/transaction.pool.ts +++ b/src/endpoints/transactions/entities/transaction.pool.ts @@ -1,40 +1,31 @@ -import { Field, Float, ID, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("TransactionPool", { description: "TransactionPool object type." }) export class TransactionPool { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: "Hash for the given transaction." }) + @ApiProperty({ type: String, description: 'Transaction hash', example: '39098e005c9f53622e9c8a946f9141d7c29a5da3bc38e07e056b549fa017ae1b' }) txHash?: string; - @Field(() => String, { description: "Sender account for the given transaction." }) @ApiProperty({ type: String, description: 'Sender bech32 address', example: 'erd1wh9c0sjr2xn8hzf02lwwcr4jk2s84tat9ud2kaq6zr7xzpvl9l5q8awmex' }) sender?: string; - @Field(() => String, { description: "Receiver account for the given transaction." }) @ApiProperty({ type: String, description: 'Receiver bech32 address', example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) receiver?: string; - @Field(() => String, { description: "Value for the given transaction." }) @ApiProperty({ type: Number, description: 'Transaction value', example: 1000000000000000000 }) value?: number; - @Field(() => Float, { description: "Nonce for the given transaction.", nullable: true }) @ApiProperty({ type: Number, description: 'Nonce details', example: 100 }) nonce?: number; - @Field(() => String, { description: "Data for the given transaction.", nullable: true }) - @ApiProperty({ type: String, description: 'Transaction data', example: 'TEST==' }) + @ApiProperty({ type: String, description: 'Transaction data', example: 'TEST==', required: false }) data?: string; - @Field(() => Float, { description: "Gas price for the given transaction.", nullable: true }) @ApiProperty({ type: Number, description: 'Transaction gas price', example: 1000000000 }) gasPrice?: number; - @Field(() => Float, { description: "Gas limit for the given transaction.", nullable: true }) @ApiProperty({ type: Number, description: 'Transaction gas limit', example: 50000 }) gasLimit?: number; } diff --git a/src/endpoints/transactions/entities/transaction.receipt.ts b/src/endpoints/transactions/entities/transaction.receipt.ts index a305fa7be..d4bd7552b 100644 --- a/src/endpoints/transactions/entities/transaction.receipt.ts +++ b/src/endpoints/transactions/entities/transaction.receipt.ts @@ -1,21 +1,16 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType('TransactionReceipt', { description: 'Transaction receipt object type.' }) export class TransactionReceipt { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Value for the given transaction receipt.' }) @ApiProperty() value: string = ''; - @Field(() => String, { description: 'Sender address for the given transaction receipt.' }) @ApiProperty() sender: string = ''; - @Field(() => String, { description: 'Data for the given transaction receipt.' }) @ApiProperty() data: string = ''; } diff --git a/src/endpoints/transactions/entities/transaction.ts b/src/endpoints/transactions/entities/transaction.ts index 0a10e3a30..9eed2dd2f 100644 --- a/src/endpoints/transactions/entities/transaction.ts +++ b/src/endpoints/transactions/entities/transaction.ts @@ -1,4 +1,3 @@ -import { Field, Float, ID, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; import { AccountAssets } from "src/common/assets/entities/account.assets"; import { ScamInfo } from "src/common/entities/scam-info.dto"; @@ -6,140 +5,106 @@ import { Account } from "src/endpoints/accounts/entities/account"; import { TransactionType } from "src/endpoints/transactions/entities/transaction.type"; import { TransactionAction } from "../transaction-action/entities/transaction.action"; -@ObjectType("Transaction", { description: "Transaction object type." }) export class Transaction { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: "Hash for the given transaction." }) @ApiProperty({ type: String }) txHash: string = ''; - @Field(() => Float, { description: "Gas limit for the given transaction.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) gasLimit: number | undefined = undefined; - @Field(() => Float, { description: "Gas price for the given transaction.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) gasPrice: number | undefined = undefined; - @Field(() => Float, { description: "Gas used for the given transaction.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) gasUsed: number | undefined = undefined; - @Field(() => String, { description: "Mini block hash for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String }) miniBlockHash: string | undefined = undefined; - @Field(() => Float, { description: "Nonce for the given transaction.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) nonce: number | undefined = undefined; - @Field(() => String, { name: "receiverAddress", description: "Receiver account for the given transaction." }) @ApiProperty({ type: String }) receiver: string = ''; - @Field(() => String, { name: "receiverUsername", description: "The username of the receiver for the given transaction." }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, nullable: true, required: false }) receiverUsername: string = ''; - @Field(() => Account, { description: "Receiver account for the given transaction." }) receiverAccount: Account | undefined = undefined; - @Field(() => AccountAssets, { name: "receiverAssets", description: "Receiver assets for the given transaction.", nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) receiverAssets: AccountAssets | undefined = undefined; - @Field(() => String, { name: "receiverShard", description: "Receiver account shard for the given transaction." }) @ApiProperty({ type: Number }) receiverShard: number = 0; - @Field(() => Float, { description: "Round for the given transaction.", nullable: true }) - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) round: number | undefined = undefined; - @Field(() => String, { name: "senderAddress", description: "Sender account for the given transaction." }) @ApiProperty({ type: String }) sender: string = ''; - @Field(() => String, { name: "senderUsername", description: "The username of the sender for the given transaction." }) - @ApiProperty({ type: String }) + @ApiProperty({ type: String, nullable: true, required: false }) senderUsername: string = ''; - @Field(() => Account, { description: "Sender account for the given transaction." }) senderAccount: Account | undefined = undefined; - @Field(() => AccountAssets, { name: "senderAssets", description: "Sender assets for the given transaction.", nullable: true }) - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) senderAssets: AccountAssets | undefined = undefined; - @Field(() => Float, { name: "senderShard", description: "Sender account shard for the given transaction." }) @ApiProperty({ type: Number }) senderShard: number = 0; - @Field(() => String, { description: "Signature for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String }) signature: string | undefined = undefined; - @Field(() => String, { description: "Status for the given transaction." }) @ApiProperty({ type: String }) status: string = ''; - @Field(() => String, { description: "Value for the given transaction." }) @ApiProperty({ type: String }) value: string = ''; - @Field(() => String, { description: "Fee for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String }) fee: string | undefined = undefined; - @Field(() => Float, { description: "Timestamp for the given transaction." }) @ApiProperty({ type: Number }) timestamp: number = 0; - @Field(() => String, { description: "Data for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) data: string | undefined = undefined; - @Field(() => String, { description: "Function for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) function: string | undefined = undefined; - @Field(() => TransactionAction, { description: "Transaction action for the given transaction.", nullable: true }) - @ApiProperty({ type: TransactionAction, nullable: true }) + @ApiProperty({ type: TransactionAction, nullable: true, required: false }) action: TransactionAction | undefined = undefined; - @Field(() => ScamInfo, { description: "Scam information for the given transaction.", nullable: true }) - @ApiProperty({ type: ScamInfo, nullable: true }) + @ApiProperty({ type: ScamInfo, nullable: true, required: false }) scamInfo: ScamInfo | undefined = undefined; - @Field(() => TransactionType, { description: "Transaction type.", nullable: true }) - @ApiProperty({ enum: TransactionType, nullable: true }) + @ApiProperty({ enum: TransactionType, nullable: true, required: false }) type: TransactionType | undefined = undefined; - @Field(() => String, { description: "Original tx hash for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) originalTxHash: string | undefined = undefined; - @Field(() => Boolean, { description: "Pending results for the given transaction.", nullable: true }) - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) pendingResults: boolean | undefined = undefined; - @Field(() => String, { description: "Guardian address for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) guardianAddress: string | undefined = undefined; - @Field(() => String, { description: "Guardian signature for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) guardianSignature: string | undefined = undefined; - @Field(() => Boolean, { description: "Is relayed transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) isRelayed: boolean | undefined = undefined; - @Field(() => String, { description: "Relayer address for the given transaction.", nullable: true }) - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) relayer: string | undefined = undefined; getDate(): Date | undefined { diff --git a/src/endpoints/transactions/transaction-action/entities/transaction.action.ts b/src/endpoints/transactions/transaction-action/entities/transaction.action.ts index b90eef1bc..15cd4a025 100644 --- a/src/endpoints/transactions/transaction-action/entities/transaction.action.ts +++ b/src/endpoints/transactions/transaction-action/entities/transaction.action.ts @@ -1,27 +1,19 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -import GraphQLJSON from "graphql-type-json"; - -@ObjectType("TransactionAction", { description: "Transaction action object type." }) export class TransactionAction { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: "Category for the given transaction action." }) @ApiProperty({ type: String }) category: string = ''; - @Field(() => String, { description: "Name for the given transaction action." }) @ApiProperty({ type: String }) name: string = ''; - @Field(() => String, { description: "Description for the given transaction action." }) @ApiProperty({ type: String }) description: string = ''; - @Field(() => GraphQLJSON, { description: "Description for the given transaction action.", nullable: true }) @ApiProperty() arguments?: { [key: string]: any }; } diff --git a/src/endpoints/usernames/entities/account.username.ts b/src/endpoints/usernames/entities/account.username.ts index 771acaaa7..2a5c4783d 100644 --- a/src/endpoints/usernames/entities/account.username.ts +++ b/src/endpoints/usernames/entities/account.username.ts @@ -1,46 +1,35 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("Username", { description: "Username object type." }) export class AccountUsername { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => String, { description: 'Address details.' }) @ApiProperty({ type: String, example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) address: string = ''; - @Field(() => String, { description: 'Nonce details.', nullable: true }) @ApiProperty({ type: Number, example: 12, nullable: true }) nonce: number | undefined; - @Field(() => String, { description: 'Balance details.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) balance: string = ''; - @Field(() => String, { description: 'RootHash details.' }) @ApiProperty({ type: String, example: '829LsRk/pB5HCJZTvZzkBJ8g4ca1RiBpYjLzzK61pwM=' }) rootHash: string = ''; - @Field(() => Number, { description: 'txCount details.', nullable: true }) @ApiProperty({ type: Number, example: 47, nullable: true }) txCount: number | undefined; - @Field(() => String, { description: 'ScrCount details.', nullable: true }) @ApiProperty({ type: Number, example: 49, nullable: true }) scrCount: number | undefined; - @Field(() => String, { description: 'Username details.' }) @ApiProperty({ type: String, example: 'alice.elrond' }) username: string = ''; - @Field(() => String, { description: 'Shard details.', nullable: true }) @ApiProperty({ type: Number, example: 0, nullable: true }) shard: number | undefined; - @Field(() => String, { description: 'Developer Reward details.' }) @ApiProperty({ type: String, default: 0 }) developerReward: string = ''; } diff --git a/src/endpoints/waiting-list/entities/waiting.list.ts b/src/endpoints/waiting-list/entities/waiting.list.ts index ae57172f7..b5f2df670 100644 --- a/src/endpoints/waiting-list/entities/waiting.list.ts +++ b/src/endpoints/waiting-list/entities/waiting.list.ts @@ -1,26 +1,20 @@ import { SwaggerUtils } from "@multiversx/sdk-nestjs-common"; -import { Field, ID, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("WaitingList", { description: "Waiting object type." }) export class WaitingList { constructor(init?: Partial) { Object.assign(this, init); } - @Field(() => ID, { description: 'Address details.' }) @ApiProperty({ type: String, example: 'erd1qga7ze0l03chfgru0a32wxqf2226nzrxnyhzer9lmudqhjgy7ycqjjyknz' }) address: string = ''; - @Field(() => Number, { description: 'Nonce details.' }) @ApiProperty({ type: Number, example: 46 }) nonce: number = 0; - @Field(() => Number, { description: 'Rank details.' }) @ApiProperty({ type: Number, example: 2 }) rank: number = 0; - @Field(() => Number, { description: 'Value details.' }) @ApiProperty(SwaggerUtils.amountPropertyOptions()) value: string = ''; } diff --git a/src/endpoints/websocket/entities/websocket.config.ts b/src/endpoints/websocket/entities/websocket.config.ts index 6076a8a70..3aebdb1d7 100644 --- a/src/endpoints/websocket/entities/websocket.config.ts +++ b/src/endpoints/websocket/entities/websocket.config.ts @@ -1,10 +1,7 @@ -import { Field, ObjectType } from "@nestjs/graphql"; import { ApiProperty } from "@nestjs/swagger"; -@ObjectType("WebsocketConfig", { description: "WebsocketConfig object type." }) export class WebsocketConfig { - @Field(() => String, { description: "Cluster url." }) @ApiProperty({ type: String }) url: string = ''; } diff --git a/src/graphql/decorators/fields.ts b/src/graphql/decorators/fields.ts deleted file mode 100644 index 23c3ea57d..000000000 --- a/src/graphql/decorators/fields.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { createParamDecorator, ExecutionContext } from "@nestjs/common"; -import { GqlExecutionContext } from "@nestjs/graphql"; - -import { fieldsList } from "graphql-fields-list"; - -export const Fields = createParamDecorator( - (_data: unknown, context: ExecutionContext) => fieldsList(GqlExecutionContext.create(context).getInfo()), -); diff --git a/src/graphql/entities/account.detailed/account.detailed.input.ts b/src/graphql/entities/account.detailed/account.detailed.input.ts deleted file mode 100644 index 50ffd82a7..000000000 --- a/src/graphql/entities/account.detailed/account.detailed.input.ts +++ /dev/null @@ -1,287 +0,0 @@ -import { Field, Float, ID, InputType } from "@nestjs/graphql"; -import { SortOrder } from "src/common/entities/sort.order"; - -import { EsdtDataSource } from "src/endpoints/esdt/entities/esdt.data.source"; -import { NftType } from "src/endpoints/nfts/entities/nft.type"; -import { TransactionStatus } from "src/endpoints/transactions/entities/transaction.status"; - -@InputType({ description: "Input to retrieve the given detailed account for." }) -export class GetAccountDetailedInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => ID, { name: "address", description: "Address to retrieve the corresponding detailed account for." }) - address: string = ""; - - public static resolve(input: GetAccountDetailedInput): string { - return input.address; - } -} - -@InputType({ description: "Input to retrieve the given from and size for." }) -export class GetFromAndSizeInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of collections to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of collections to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; -} - -@InputType({ description: "Input to retrieve the given NFT collections for." }) -export class GetNftCollectionsAccountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of NFT collections to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of NFT collections to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => ID, { name: "search", description: "Collection identifier to retrieve for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => [NftType], { name: "type", description: "NFT types list to retrieve for the given result set.", nullable: true }) - type: Array | undefined = undefined; -} - -@InputType({ description: "Input to retrieve the given NFTs for." }) -export class GetNftsAccountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of collections to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of collections to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => String, { name: "search", description: "NFT identifier to retrieve for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => [ID], { name: "identifiers", description: "NFT comma-separated identifiers list to retrieve for the given result set.", nullable: true }) - identifiers: Array | undefined = undefined; - - @Field(() => [NftType], { name: "type", description: "NFT type to retrieve for the given result set.", nullable: true }) - type: Array | undefined = undefined; - - @Field(() => [String], { name: "collections", description: "Collections to retrieve for the given result set.", nullable: true }) - collections: Array | undefined = undefined; - - @Field(() => String, { name: "name", description: "Name to retrieve for the given result set.", nullable: true }) - name: string | undefined = undefined; - - @Field(() => [String], { name: "tags", description: "Tags list to retrieve for the given result set.", nullable: true }) - tags: Array | undefined = undefined; - - @Field(() => String, { name: "creator", description: "Creator to retrieve for the given result set.", nullable: true }) - creator: string | undefined = undefined; - - @Field(() => Boolean, { name: "hasUris", description: "Has URIs to retrieve for the given result set.", nullable: true }) - hasUris: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "includeFlagged", description: "Include flagged to retrieve for the given result set.", nullable: true }) - includeFlagged: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withSupply", description: "With supply to retrieve for the given result set.", nullable: true }) - withSupply: boolean | undefined = undefined; - - @Field(() => EsdtDataSource, { name: "source", description: "Source to retrieve for the given result set.", nullable: true }) - source: EsdtDataSource | undefined = undefined; - - @Field(() => Boolean, { name: "excludeMetaESDT", description: `Do not include collections of type "MetaESDT" in the responsee for the given result set.`, nullable: true }) - excludeMetaESDT: boolean | undefined = undefined; -} - -@InputType({ description: "Input to retrieve the given tokens for." }) -export class GetTokensAccountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of tokens to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of tokens to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => String, { name: "search", description: "Token identifier to retrieve for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => ID, { name: "identifier", description: "Search by token identifier for the given result set.", nullable: true }) - identifier: string | undefined = undefined; - - @Field(() => [String], { name: "identifiers", description: "Token comma-separated identifiers list to retrieve for the given result set.", nullable: true }) - identifiers: Array | undefined = undefined; - - @Field(() => String, { name: "name", description: "Name to retrieve for the given result set.", nullable: true }) - name: string | undefined = undefined; -} - -@InputType({ description: "Input to retrieve the given transactions count for." }) -export class GetTransactionsAccountCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "sender", description: "Sender for the given result set.", nullable: true }) - sender: string | undefined = undefined; - - @Field(() => [String], { name: "receiver", description: "Receiver for the given result set.", nullable: true }) - receiver: string[] | undefined = undefined; - - @Field(() => String, { name: "token", description: "Token identfier for the given result set.", nullable: true }) - token: string | undefined = undefined; - - @Field(() => Float, { name: "senderShard", description: "Sender shard for the given result set.", nullable: true }) - senderShard: number | undefined = undefined; - - @Field(() => Float, { name: "receiverShard", description: "Receiver shard for the given result set.", nullable: true }) - receiverShard: number | undefined = undefined; - - @Field(() => String, { name: "miniBlockHash", description: "Mini block hash for the given result set.", nullable: true }) - miniBlockHash: string | undefined = undefined; - - @Field(() => [String], { name: "hashes", description: "Filter by a comma-separated list of transaction hashes for the given result set.", nullable: true }) - hashes: Array | undefined = undefined; - - @Field(() => TransactionStatus, { name: "status", description: "Status of the transaction for the given result set.", nullable: true }) - status: TransactionStatus | undefined = undefined; - - @Field(() => String, { name: "search", description: "Search in data object for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => String, { name: "function", description: "Filter transactions by function name for the given result set.", nullable: true }) - function: Array | undefined = undefined; - - @Field(() => Float, { name: "before", description: "Before timestamp for the given result set.", nullable: true }) - before: number | undefined = undefined; - - @Field(() => Float, { name: "after", description: "After timestamp for the given result set.", nullable: true }) - after: number | undefined = undefined; -} -@InputType({ description: "Input to retrieve the given transactions for." }) -export class GetTransactionsAccountInput extends GetTransactionsAccountCountInput { - constructor(partial?: Partial) { - super(); - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of transactions to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of transactions to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => SortOrder, { name: "order", description: "Order transactions for the given result set.", nullable: true }) - order: SortOrder | undefined = undefined; - - @Field(() => Boolean, { name: "withScResults", description: "After timestamp for the given result set.", nullable: true }) - withScResults: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withOperations", description: "After timestamp for the given result set.", nullable: true }) - withOperations: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withLogs", description: "After timestamp for the given result set.", nullable: true }) - withLogs: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withScamInfo", description: "After timestamp for the given result set.", nullable: true }) - withScamInfo: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withUsername", description: "After timestamp for the given result set.", nullable: true }) - withUsername: boolean | undefined = undefined; -} - - - -@InputType({ description: "Input to retrieve the given transfers for." }) -export class GetTransfersAccountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of transactions to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of transactions to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => String, { name: "sender", description: "Sender for the given result set.", nullable: true }) - sender: string | undefined = undefined; - - @Field(() => [String], { name: "receiver", description: "Receiver for the given result set.", nullable: true }) - receiver: string[] | undefined = undefined; - - @Field(() => String, { name: "token", description: "Token identfier for the given result set.", nullable: true }) - token: string | undefined = undefined; - - @Field(() => Float, { name: "senderShard", description: "Sender shard for the given result set.", nullable: true }) - senderShard: number | undefined = undefined; - - @Field(() => Float, { name: "receiverShard", description: "Receiver shard for the given result set.", nullable: true }) - receiverShard: number | undefined = undefined; - - @Field(() => String, { name: "miniBlockHash", description: "Mini block hash for the given result set.", nullable: true }) - miniBlockHash: string | undefined = undefined; - - @Field(() => [String], { name: "hashes", description: "Filter by a comma-separated list of transaction hashes for the given result set.", nullable: true }) - hashes: Array | undefined = undefined; - - @Field(() => TransactionStatus, { name: "status", description: "Status of the transaction for the given result set.", nullable: true }) - status: TransactionStatus | undefined = undefined; - - @Field(() => String, { name: "search", description: "Search in data object for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => String, { name: "function", description: "Filter transactions by function name for the given result set.", nullable: true }) - function: Array | undefined = undefined; - - @Field(() => Float, { name: "before", description: "Before timestamp for the given result set.", nullable: true }) - before: number | undefined = undefined; - - @Field(() => Float, { name: "after", description: "After timestamp for the given result set.", nullable: true }) - after: number | undefined = undefined; - - @Field(() => SortOrder, { name: "order", description: "Order transactions for the given result set.", nullable: true }) - order: SortOrder | undefined = undefined; - - @Field(() => Boolean, { name: "withScamInfo", description: "After timestamp for the given result set.", nullable: true }) - withScamInfo: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withUsername", description: "After timestamp for the given result set.", nullable: true }) - withUsername: boolean | undefined = undefined; -} - - -@InputType({ description: "Input to retrieve the given transactions count for." }) -export class GetAccountHistory extends GetFromAndSizeInput { - constructor(partial?: Partial) { - super(); - Object.assign(this, partial); - } - @Field(() => Float, { name: "before", description: "Before timestamp for the given result set.", nullable: true }) - before: number | undefined = undefined; - - @Field(() => Float, { name: "after", description: "After timestamp for the given result set.", nullable: true }) - after: number | undefined = undefined; -} - -@InputType({ description: "Input to retrieve the given history token for." }) -export class GetHistoryTokenAccountInput extends GetAccountHistory { - constructor(partial?: Partial) { - super(); - Object.assign(this, partial); - } - @Field(() => ID, { name: "identifier", description: "Identifier token to retrieve for the given result set." }) - identifier: string = ""; -} - - - diff --git a/src/graphql/entities/account.detailed/account.detailed.module.ts b/src/graphql/entities/account.detailed/account.detailed.module.ts deleted file mode 100644 index 849ec9403..000000000 --- a/src/graphql/entities/account.detailed/account.detailed.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Module } from "@nestjs/common"; - -import { AccountDetailedResolver } from "src/graphql/entities/account.detailed/account.detailed.resolver"; -import { AccountModule } from "src/endpoints/accounts/account.module"; -import { CollectionModule } from "src/endpoints/collections/collection.module"; -import { NftModule } from "src/endpoints/nfts/nft.module"; -import { TokenModule } from "src/endpoints/tokens/token.module"; -import { DelegationModule } from "src/endpoints/delegation/delegation.module"; -import { StakeModule } from "src/endpoints/stake/stake.module"; -import { DelegationLegacyModule } from "src/endpoints/delegation.legacy/delegation.legacy.module"; -import { TransactionModule } from "src/endpoints/transactions/transaction.module"; -import { TransferModule } from "src/endpoints/transfers/transfer.module"; -import { SmartContractResultModule } from "src/endpoints/sc-results/scresult.module"; - -@Module({ - imports: [ - AccountModule, - CollectionModule, - NftModule, - TokenModule, - DelegationModule, - StakeModule, - DelegationLegacyModule, - TransactionModule, - TransferModule, - SmartContractResultModule, - ], - providers: [AccountDetailedResolver], -}) -export class AccountDetailedModule { } diff --git a/src/graphql/entities/account.detailed/account.detailed.object.ts b/src/graphql/entities/account.detailed/account.detailed.object.ts deleted file mode 100644 index d023e1e01..000000000 --- a/src/graphql/entities/account.detailed/account.detailed.object.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ObjectType, OmitType } from "@nestjs/graphql"; - -import { NftAccount } from "src/endpoints/nfts/entities/nft.account"; -import { NftCollectionAccount } from "src/endpoints/collections/entities/nft.collection.account"; -import { TokenWithBalance } from "src/endpoints/tokens/entities/token.with.balance"; - -@ObjectType() -export class NftAccountFlat extends OmitType(NftAccount, [ - "collection", - "creator", - "owner", -] as const) { } - -@ObjectType() -export class NftCollectionAccountFlat extends OmitType(NftCollectionAccount, [ - "owner", -] as const) { } - -@ObjectType() -export class TokenWithBalanceAccountFlat extends OmitType(TokenWithBalance, [ - "owner", -] as const) { } diff --git a/src/graphql/entities/account.detailed/account.detailed.query.ts b/src/graphql/entities/account.detailed/account.detailed.query.ts deleted file mode 100644 index 67e9f899a..000000000 --- a/src/graphql/entities/account.detailed/account.detailed.query.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Args, Query, Resolver } from "@nestjs/graphql"; - -import { ApplyComplexity } from "@multiversx/sdk-nestjs-common"; - -import { AccountDetailed } from "src/endpoints/accounts/entities/account.detailed"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { GetAccountDetailedInput } from "src/graphql/entities/account.detailed/account.detailed.input"; -import { NotFoundException } from "@nestjs/common"; - -@Resolver() -export class AccountDetailedQuery { - constructor(protected readonly accountService: AccountService) { } - - @Query(() => AccountDetailed, { name: "account", description: "Retrieve the detailed account for the given input.", nullable: true }) - @ApplyComplexity({ target: AccountDetailed }) - public async getAccountDetailed(@Args("input", { description: "Input to retrieve the given detailed account for." }) input: GetAccountDetailedInput): Promise { - const account = await this.accountService.getAccountSimple(GetAccountDetailedInput.resolve(input)); - - if (!account) { - throw new NotFoundException('Account not found'); - } - - return account; - } -} diff --git a/src/graphql/entities/account.detailed/account.detailed.resolver.ts b/src/graphql/entities/account.detailed/account.detailed.resolver.ts deleted file mode 100644 index 92fa56ed9..000000000 --- a/src/graphql/entities/account.detailed/account.detailed.resolver.ts +++ /dev/null @@ -1,281 +0,0 @@ -import { Resolver, ResolveField, Parent, Float, Args } from "@nestjs/graphql"; - -import { ApplyComplexity } from "@multiversx/sdk-nestjs-common"; - -import { AccountDetailed } from "src/endpoints/accounts/entities/account.detailed"; -import { AccountDetailedQuery } from "src/graphql/entities/account.detailed/account.detailed.query"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { CollectionFilter } from "src/endpoints/collections/entities/collection.filter"; -import { CollectionService } from "src/endpoints/collections/collection.service"; -import { GetAccountHistory, GetFromAndSizeInput, GetHistoryTokenAccountInput, GetNftCollectionsAccountInput, GetNftsAccountInput, GetTokensAccountInput, GetTransactionsAccountCountInput, GetTransactionsAccountInput, GetTransfersAccountInput } from "src/graphql/entities/account.detailed/account.detailed.input"; -import { NftAccountFlat, NftCollectionAccountFlat, TokenWithBalanceAccountFlat } from "src/graphql/entities/account.detailed/account.detailed.object"; -import { NftFilter } from "src/endpoints/nfts/entities/nft.filter"; -import { NftService } from "src/endpoints/nfts/nft.service"; -import { NftQueryOptions } from "src/endpoints/nfts/entities/nft.query.options"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { TokenFilter } from "src/endpoints/tokens/entities/token.filter"; -import { TokenService } from "src/endpoints/tokens/token.service"; -import { AccountDelegation } from "src/endpoints/stake/entities/account.delegation"; -import { DelegationService } from "src/endpoints/delegation/delegation.service"; -import { StakeService } from "src/endpoints/stake/stake.service"; -import { ProviderStake } from "src/endpoints/stake/entities/provider.stake"; -import { DelegationLegacyService } from "src/endpoints/delegation.legacy/delegation.legacy.service"; -import { AccountDelegationLegacy } from "src/endpoints/delegation.legacy/entities/account.delegation.legacy"; -import { AccountKey } from "src/endpoints/accounts/entities/account.key"; -import { Transaction } from "src/endpoints/transactions/entities/transaction"; -import { TransactionFilter } from "src/endpoints/transactions/entities/transaction.filter"; -import { TransactionQueryOptions } from "src/endpoints/transactions/entities/transactions.query.options"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; -import { TransferService } from "src/endpoints/transfers/transfer.service"; -import { DeployedContract } from "src/endpoints/accounts/entities/deployed.contract"; -import { SmartContractResult } from "src/endpoints/sc-results/entities/smart.contract.result"; -import { SmartContractResultService } from "src/endpoints/sc-results/scresult.service"; -import { AccountHistory } from "src/endpoints/accounts/entities/account.history"; -import { AccountEsdtHistory } from "src/endpoints/accounts/entities/account.esdt.history"; -import { AccountHistoryFilter } from "src/endpoints/accounts/entities/account.history.filter"; -import { AccountKeyFilter } from "src/endpoints/accounts/entities/account.key.filter"; - -@Resolver(() => AccountDetailed) -export class AccountDetailedResolver extends AccountDetailedQuery { - constructor( - protected readonly nftService: NftService, - protected readonly collectionService: CollectionService, - protected readonly tokenService: TokenService, - protected readonly delegationService: DelegationService, - protected readonly delegationLegacyService: DelegationLegacyService, - protected readonly stakeService: StakeService, - protected readonly transactionService: TransactionService, - protected readonly transferService: TransferService, - protected readonly scResultService: SmartContractResultService, - accountService: AccountService - ) { - super(accountService); - } - - @ResolveField("txCount", () => Float, { name: "txCount", description: "Transactions count for the given detailed account." }) - public async getAccountDetailedTransactionCount(@Parent() account: AccountDetailed) { - return await this.accountService.getAccountTxCount(account.address); - } - - @ResolveField("scrCount", () => Float, { name: "scrCount", description: "Smart contracts count for the given detailed account." }) - public async getAccountDetailedSmartContractCount(@Parent() account: AccountDetailed) { - return await this.accountService.getAccountScResults(account.address); - } - - @ResolveField("delegation", () => [AccountDelegation], { name: "delegation", description: "Summarizes all delegation positions with staking providers, together with unDelegation positions for the givven detailed account." }) - public async getDelegationForAddress(@Parent() account: AccountDetailed) { - return await this.delegationService.getDelegationForAddress(account.address); - } - - @ResolveField("delegationLegacy", () => AccountDelegationLegacy, { name: "delegationLegacy", description: "Returns staking information related to the legacy delegation pool." }) - public async getAccountDelegationLegacy(@Parent() account: AccountDetailed) { - return await this.delegationLegacyService.getDelegationForAddress(account.address); - } - - @ResolveField("stake", () => ProviderStake, { name: "stake", description: "Summarizes total staked amount for the given provider, as well as when and how much unbond will be performed." }) - public async getStakeForAddress(@Parent() account: AccountDetailed) { - return await this.stakeService.getStakeForAddress(account.address); - } - - @ResolveField("keys", () => [AccountKey], { name: "keys", description: "Returns all nodes in the node queue where the account is owner." }) - public async getKeys(@Parent() account: AccountDetailed) { - return await this.accountService.getKeys(account.address, new AccountKeyFilter(), new QueryPagination()); - } - - @ResolveField("resultsAccount", () => [SmartContractResult], { name: "resultsAccount", description: "Returns smart contract results where the account is sender or receiver." }) - public async getAccountScResults(@Args("input", { description: "Input to retrieve the given sc results for." }) input: GetFromAndSizeInput, @Parent() account: AccountDetailed) { - return await this.scResultService.getAccountScResults( - account.address, - new QueryPagination({ - from: input.from, - size: input.size, - })); - } - - @ResolveField("resultsAccountCount", () => Float, { name: "resultsAccountCount", description: "Returns smart contract results count where the account is sender or receiver." }) - public async getAccountScResultsCount(@Parent() account: AccountDetailed) { - return await this.scResultService.getAccountScResultsCount(account.address); - } - - @ResolveField("historyAccount", () => [AccountHistory], { name: "historyAccount", description: "Return account EGLD balance history." }) - public async getAccountHistory(@Args("input", { description: "Input to retrieve the given EGLD balance history for." }) input: GetAccountHistory, @Parent() account: AccountDetailed) { - return await this.accountService.getAccountHistory( - account.address, - new QueryPagination({ - from: input.from, - size: input.size, - }), new AccountHistoryFilter({ - before: input.before, - after: input.after, - })); - } - - @ResolveField("historyTokenAccount", () => [AccountEsdtHistory], { name: "historyTokenAccount", description: "Return account balance history for a specifc token." }) - public async getAccountTokenHistory(@Args("input", { description: "Input to retrieve the given token history for." }) input: GetHistoryTokenAccountInput, @Parent() account: AccountDetailed) { - return await this.accountService.getAccountTokenHistory( - account.address, - input.identifier, - new QueryPagination({ - from: input.from, - size: input.size, - }), new AccountHistoryFilter({ - before: input.before, - after: input.after, - })); - } - - @ResolveField("deploysAccount", () => [DeployedContract], { name: "deploysAccount", description: "Deploys for the given detailed account.", nullable: true }) - public async getAccountDeploys(@Args("input", { description: "Input to retrieve the given deploys for." }) input: GetFromAndSizeInput, @Parent() account: AccountDetailed) { - return await this.accountService.getAccountDeploys( - new QueryPagination({ - from: input.from, - size: input.size, - }), account.address - ); - } - - @ResolveField("deployAccountCount", () => Float, { name: "deployAccountCount", description: "Contracts count for the given detailed account." }) - public async getAccountDeploysCount(@Parent() account: AccountDetailed) { - return await this.accountService.getAccountDeploysCount(account.address); - } - - @ResolveField("nftCollections", () => [NftCollectionAccountFlat], { name: "nftCollections", description: "NFT collections for the given detailed account.", nullable: true }) - public async getAccountDetailedNftCollections(@Args("input", { description: "Input to retrieve the given NFT collections for." }) input: GetNftCollectionsAccountInput, @Parent() account: AccountDetailed) { - return await this.collectionService.getCollectionsForAddress( - account.address, - new CollectionFilter({ - search: input.search, - type: input.type, - }), - new QueryPagination({ - from: input.from, - size: input.size, - }) - ); - } - - @ResolveField("nfts", () => [NftAccountFlat], { name: "nfts", description: "NFTs for the given detailed account.", nullable: true }) - @ApplyComplexity({ target: NftAccountFlat }) - public async getAccountDetailedNfts(@Args("input", { description: "Input to retrieve the given NFTs for." }) input: GetNftsAccountInput, @Parent() account: AccountDetailed) { - return await this.nftService.getNftsForAddress( - account.address, - new QueryPagination({ - from: input.from, - size: input.size, - }), - new NftFilter({ - search: input.search, - identifiers: input.identifiers, - type: input.type, - name: input.name, - collections: input.collections, - tags: input.tags, - creator: input.creator, - hasUris: input.hasUris, - includeFlagged: input.includeFlagged, - excludeMetaESDT: input.excludeMetaESDT, - }), - undefined, - new NftQueryOptions({ - withSupply: input.withSupply, - }), - input.source - ); - } - - @ResolveField("tokensAccount", () => [TokenWithBalanceAccountFlat], { name: "tokensAccount", description: "Tokens for the given detailed account.", nullable: true }) - public async getTokensForAddress(@Args("input", { description: "Input to retrieve the given tokens for." }) input: GetTokensAccountInput, @Parent() account: AccountDetailed) { - return await this.tokenService.getTokensForAddress( - account.address, - new QueryPagination({ - from: input.from, - size: input.size, - }), - new TokenFilter({ - search: input.search, - identifier: input.identifier, - identifiers: input.identifiers, - name: input.name, - }), - ); - } - - @ResolveField("transactionsAccount", () => [Transaction], { name: "transactionsAccount", description: "Transactions for the given detailed account.", nullable: true }) - @ApplyComplexity({ target: Transaction }) - public async getTransactions(@Args("input", { description: "Input to retrieve the given transactions for." }) input: GetTransactionsAccountInput, @Parent() account: AccountDetailed) { - const options = TransactionQueryOptions.applyDefaultOptions(input.size, new TransactionQueryOptions({ - withScResults: input.withScResults, - withOperations: input.withOperations, - withLogs: input.withLogs, - withScamInfo: input.withScamInfo, - withUsername: input.withUsername, - })); - - return await this.transactionService.getTransactions( - new TransactionFilter({ - sender: input.sender, - token: input.token, - functions: input.function, - senderShard: input.senderShard, - receiverShard: input.receiverShard, - miniBlockHash: input.miniBlockHash, - hashes: input.hashes, - status: input.status, - before: input.before, - after: input.after, - order: input.order, - }), - new QueryPagination({ - from: input.from, - size: input.size, - }), - options, account.address - ); - } - - @ResolveField("transactionsAccountCount", () => Float, { name: "transactionsAccountCount", description: "Transactions count for the given detailed account.", nullable: true }) - public async getTransactionCount(@Args("input", { description: "Input to retrieve the given transctions count for." }) input: GetTransactionsAccountCountInput, @Parent() account: AccountDetailed) { - return await this.transactionService.getTransactionCount( - new TransactionFilter({ - sender: input.sender, - token: input.token, - functions: input.function, - senderShard: input.senderShard, - receiverShard: input.receiverShard, - miniBlockHash: input.miniBlockHash, - hashes: input.hashes, - status: input.status, - before: input.before, - after: input.after, - }), - account.address - ); - } - - //Todo: add address - @ResolveField("transfersAccount", () => [Transaction], { name: "transfersAccount", description: "Returns both transfers triggerred by a user account (type = Transaction), as well as transfers triggerred by smart contracts (type = SmartContractResult), thus providing a full picture of all in/out value transfers for a given account.", nullable: true }) - public async getAccountTransfers(@Args("input", { description: "Input to retrieve the given transfers for." }) input: GetTransfersAccountInput) { - const options = TransactionQueryOptions.applyDefaultOptions(input.size, { withScamInfo: input.withScamInfo, withUsername: input.withUsername }); - - return await this.transferService.getTransfers( - new TransactionFilter({ - sender: input.sender, - token: input.token, - functions: input.function, - senderShard: input.senderShard, - receiverShard: input.receiverShard, - miniBlockHash: input.miniBlockHash, - hashes: input.hashes, - status: input.status, - before: input.before, - after: input.after, - order: input.order, - }), - new QueryPagination({ - from: input.from, - size: input.size, - }), - options, - ); - } -} diff --git a/src/graphql/entities/account/account.input.ts b/src/graphql/entities/account/account.input.ts deleted file mode 100644 index 2977a3b4f..000000000 --- a/src/graphql/entities/account/account.input.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Field, InputType, Float } from "@nestjs/graphql"; -import { AccountQueryOptions } from "src/endpoints/accounts/entities/account.query.options"; - -@InputType({ description: "Input to retrieve the given accounts for." }) -export class GetAccountFilteredInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "ownerAddress", description: "Owner address to retrieve for the given result set.", nullable: true }) - ownerAddress: string | undefined = undefined; - public static resolve(input: GetAccountFilteredInput): AccountQueryOptions { - return new AccountQueryOptions({ - ownerAddress: input.ownerAddress, - }); - } -} - - -@InputType({ description: "Input to retrieve the given accounts for." }) -export class GetAccountsInput extends GetAccountFilteredInput { - constructor(partial?: Partial) { - super(); - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of accounts to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of accounts to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; -} diff --git a/src/graphql/entities/account/account.module.ts b/src/graphql/entities/account/account.module.ts deleted file mode 100644 index ec116d2ca..000000000 --- a/src/graphql/entities/account/account.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Module } from "@nestjs/common"; - -import { AccountModule as InternalAccountModule } from "src/endpoints/accounts/account.module"; -import { AccountResolver } from "src/graphql/entities/account/account.resolver"; - -@Module({ - imports: [InternalAccountModule], - providers: [AccountResolver], -}) -export class AccountModule {} diff --git a/src/graphql/entities/account/account.query.ts b/src/graphql/entities/account/account.query.ts deleted file mode 100644 index 234218241..000000000 --- a/src/graphql/entities/account/account.query.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Args, Float, Resolver, Query } from "@nestjs/graphql"; - -import { Account } from "src/endpoints/accounts/entities/account"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { GetAccountFilteredInput, GetAccountsInput } from "src/graphql/entities/account/account.input"; -import { ApplyComplexity } from "@multiversx/sdk-nestjs-common"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { AccountQueryOptions } from "src/endpoints/accounts/entities/account.query.options"; - -@Resolver() -export class AccountQuery { - constructor(protected readonly accountService: AccountService) { } - - @Query(() => [Account], { name: "accounts", description: "Retrieve all accounts for the given input." }) - @ApplyComplexity({ target: Account }) - public async getAccounts(@Args("input", { description: "Input to retrieve the given accounts for." }) input: GetAccountsInput): Promise { - return await this.accountService.getAccounts( - new QueryPagination({ from: input.from, size: input.size }), new AccountQueryOptions({ ownerAddress: input.ownerAddress }) - ); - } - - @Query(() => Float, { name: "accountsCount", description: "Retrieve all accounts count." }) - public async getAccountsCount(@Args("input", { description: "Input to retrieve the given accounts for." }) input: GetAccountFilteredInput): Promise { - return await this.accountService.getAccountsCount(new AccountQueryOptions({ ownerAddress: input.ownerAddress })); - } -} diff --git a/src/graphql/entities/account/account.resolver.ts b/src/graphql/entities/account/account.resolver.ts deleted file mode 100644 index df38989d0..000000000 --- a/src/graphql/entities/account/account.resolver.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; - -import { Account } from "src/endpoints/accounts/entities/account"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { AccountQuery } from "src/graphql/entities/account/account.query"; - -@Resolver(() => Account) -export class AccountResolver extends AccountQuery { - constructor(accountService: AccountService) { - super(accountService); - } -} diff --git a/src/graphql/entities/block/block.input.ts b/src/graphql/entities/block/block.input.ts deleted file mode 100644 index 6b5fb8147..000000000 --- a/src/graphql/entities/block/block.input.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Field, Float, ID, InputType } from "@nestjs/graphql"; -import { BlockFilter } from "src/endpoints/blocks/entities/block.filter"; - -@InputType({ description: "Input to retrieve the given blocks for." }) -export class GetBlocksCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "shard", description: "Shard ID for the given result set.", nullable: true }) - shard: number | undefined = undefined; - - @Field(() => String, { name: "proposer", description: "Proposer for the given result set.", nullable: true }) - proposer: string | undefined = undefined; - - @Field(() => String, { name: "validator", description: "Validator for the given result set.", nullable: true }) - validator: string | undefined = undefined; - - @Field(() => Float, { name: "epoch", description: "Epoch for the given result set.", nullable: true }) - epoch: number | undefined = undefined; - - @Field(() => Float, { name: "nonce", description: "Nonce for the given result set.", nullable: true }) - nonce: number | undefined = undefined; - - public static resolve(input: GetBlocksCountInput): BlockFilter { - return new BlockFilter({ - shard: input.shard, - proposer: input.proposer, - validator: input.validator, - epoch: input.epoch, - nonce: input.nonce, - }); - } -} - -@InputType({ description: "Input to retrieve the given blocks for." }) -export class GetBlocksInput extends GetBlocksCountInput { - constructor(partial?: Partial) { - super(); - - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of blocks to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of blocks to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => Boolean, { name: "withProposerIdentity", description: "Provide identity information for proposer node.", nullable: true }) - withProposerIdentity: boolean | undefined; -} - -@InputType({ description: "Input to retrieve the given hash block for." }) -export class GetBlockHashInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => ID, { name: "hash", description: "Specific block hash to retrieve the corresponding blocks for." }) - hash: string = ""; - - public static resolve(input: GetBlockHashInput): string { - return input.hash; - } -} diff --git a/src/graphql/entities/block/block.module.ts b/src/graphql/entities/block/block.module.ts deleted file mode 100644 index 7eadd21d5..000000000 --- a/src/graphql/entities/block/block.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { BlockModule as InternalBlockModule } from "src/endpoints/blocks/block.module"; -import { BlockResolver } from "./block.resolver"; - -@Module({ - imports: [InternalBlockModule], - providers: [BlockResolver], -}) -export class BlockModule { } diff --git a/src/graphql/entities/block/block.query.ts b/src/graphql/entities/block/block.query.ts deleted file mode 100644 index 908c8d680..000000000 --- a/src/graphql/entities/block/block.query.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Args, Resolver, Query, Float } from "@nestjs/graphql"; -import { GetBlockHashInput, GetBlocksCountInput, GetBlocksInput } from "./block.input"; -import { BlockService } from "src/endpoints/blocks/block.service"; -import { Block } from "src/endpoints/blocks/entities/block"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { BlockFilter } from "src/endpoints/blocks/entities/block.filter"; -import { BlockDetailed } from "src/endpoints/blocks/entities/block.detailed"; - -@Resolver() -export class BlockQuery { - constructor(protected readonly blockService: BlockService) { } - - @Query(() => [Block], { name: "blocks", description: "Retrieve all blocks for the given input." }) - public async getBlocks(@Args("input", { description: "Input to retrieve the given blocks for." }) input: GetBlocksInput): Promise { - return await this.blockService.getBlocks( - new BlockFilter({ - shard: input.shard, - proposer: input.proposer, - validator: input.validator, - epoch: input.epoch, - nonce: input.nonce, - }), - new QueryPagination({ from: input.from, size: input.size }), - input.withProposerIdentity - ); - } - - - @Query(() => Float, { name: "blocksCount", description: "Retrieve the all blocks count for the given input.", nullable: true }) - public async getBlocksCount(@Args("input", { description: "Input to retrieve the given blocks count for." }) input: GetBlocksCountInput): Promise { - return await this.blockService.getBlocksCount(GetBlocksCountInput.resolve(input)); - } - - @Query(() => BlockDetailed, { name: "blockHash", description: "Retrieve the block for the given input." }) - public async getBlock(@Args("input", { description: "Input to retrieve the given block hash details for." }) input: GetBlockHashInput): Promise { - return await this.blockService.getBlock(GetBlockHashInput.resolve(input)); - } -} diff --git a/src/graphql/entities/block/block.resolver.ts b/src/graphql/entities/block/block.resolver.ts deleted file mode 100644 index 784e4d0b0..000000000 --- a/src/graphql/entities/block/block.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { BlockQuery } from "./block.query"; -import { Block } from "src/endpoints/blocks/entities/block"; -import { BlockService } from "src/endpoints/blocks/block.service"; - -@Resolver(() => Block) -export class BlockResolver extends BlockQuery { - constructor(blockService: BlockService) { - super(blockService); - } -} diff --git a/src/graphql/entities/dapp.config/dap.config.resolver.ts b/src/graphql/entities/dapp.config/dap.config.resolver.ts deleted file mode 100644 index ca2700504..000000000 --- a/src/graphql/entities/dapp.config/dap.config.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { DappConfig } from "src/endpoints/dapp-config/entities/dapp-config"; -import { DappConfigQuery } from "./dapp.config.query"; -import { DappConfigService } from "src/endpoints/dapp-config/dapp.config.service"; - -@Resolver(() => DappConfig) -export class DappConfigResolver extends DappConfigQuery { - constructor(dapConfigService: DappConfigService) { - super(dapConfigService); - } -} diff --git a/src/graphql/entities/dapp.config/dapp.config.module.ts b/src/graphql/entities/dapp.config/dapp.config.module.ts deleted file mode 100644 index 636c259e3..000000000 --- a/src/graphql/entities/dapp.config/dapp.config.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { DappConfigModule as InternalDappConfigModule } from "src/endpoints/dapp-config/dapp.config.module"; -import { DappConfigResolver } from "./dap.config.resolver"; - -@Module({ - imports: [InternalDappConfigModule], - providers: [DappConfigResolver], -}) -export class DappConfigModule { } diff --git a/src/graphql/entities/dapp.config/dapp.config.query.ts b/src/graphql/entities/dapp.config/dapp.config.query.ts deleted file mode 100644 index 216ede05d..000000000 --- a/src/graphql/entities/dapp.config/dapp.config.query.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Resolver, Query } from "@nestjs/graphql"; -import { DappConfigService } from "src/endpoints/dapp-config/dapp.config.service"; -import { DappConfig } from "src/endpoints/dapp-config/entities/dapp-config"; - -@Resolver() -export class DappConfigQuery { - constructor(protected readonly dappConfigService: DappConfigService) { } - - @Query(() => DappConfig, { name: "dappConfig", description: "Retrieve configuration used in dapp." }) - public async getDappConfig(): Promise { - return await this.dappConfigService.getDappConfiguration(); - } -} diff --git a/src/graphql/entities/delegation-legacy/delegation-legacy.module.ts b/src/graphql/entities/delegation-legacy/delegation-legacy.module.ts deleted file mode 100644 index 7dd5be8dd..000000000 --- a/src/graphql/entities/delegation-legacy/delegation-legacy.module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Module } from "@nestjs/common"; -import { DelegationLegacyModule as InternalDelegationLegacyModule } from "src/endpoints/delegation.legacy/delegation.legacy.module"; -import { DelegationLegacyResolver } from "./delegation-legacy.resolver"; -@Module({ - imports: [InternalDelegationLegacyModule], - providers: [DelegationLegacyResolver], -}) -export class DelegationLegacyModule { } diff --git a/src/graphql/entities/delegation-legacy/delegation-legacy.query.ts b/src/graphql/entities/delegation-legacy/delegation-legacy.query.ts deleted file mode 100644 index 34da833a0..000000000 --- a/src/graphql/entities/delegation-legacy/delegation-legacy.query.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Query, Resolver } from "@nestjs/graphql"; -import { DelegationLegacyService } from "src/endpoints/delegation.legacy/delegation.legacy.service"; -import { DelegationLegacy } from "src/endpoints/delegation.legacy/entities/delegation.legacy"; - -@Resolver() -export class DelegationLegacyQuery { - constructor(protected readonly delegationLegacyService: DelegationLegacyService) { } - - @Query(() => DelegationLegacy, { name: "delegationLegacy", description: "Retrieve legacy delegation contract global information." }) - public async getDelegation(): Promise { - return await this.delegationLegacyService.getDelegation(); - } -} diff --git a/src/graphql/entities/delegation-legacy/delegation-legacy.resolver.ts b/src/graphql/entities/delegation-legacy/delegation-legacy.resolver.ts deleted file mode 100644 index 4ee1d5cca..000000000 --- a/src/graphql/entities/delegation-legacy/delegation-legacy.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { DelegationLegacyQuery } from "./delegation-legacy.query"; -import { DelegationLegacy } from "src/endpoints/delegation.legacy/entities/delegation.legacy"; -import { DelegationLegacyService } from "src/endpoints/delegation.legacy/delegation.legacy.service"; - -@Resolver(() => DelegationLegacy) -export class DelegationLegacyResolver extends DelegationLegacyQuery { - constructor(delegationLegacyService: DelegationLegacyService) { - super(delegationLegacyService); - } -} diff --git a/src/graphql/entities/delegation/delegation.module.ts b/src/graphql/entities/delegation/delegation.module.ts deleted file mode 100644 index 0c91ce54d..000000000 --- a/src/graphql/entities/delegation/delegation.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { DelegationModule as InternalDelegationModule } from "src/endpoints/delegation/delegation.module"; -import { DelegationResolver } from "./delegation.resolver"; - -@Module({ - imports: [InternalDelegationModule], - providers: [DelegationResolver], -}) -export class DelegationModule { } diff --git a/src/graphql/entities/delegation/delegation.query.ts b/src/graphql/entities/delegation/delegation.query.ts deleted file mode 100644 index a544988fc..000000000 --- a/src/graphql/entities/delegation/delegation.query.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Query, Resolver } from "@nestjs/graphql"; -import { DelegationService } from "src/endpoints/delegation/delegation.service"; -import { Delegation } from "src/endpoints/delegation/entities/delegation"; - -@Resolver() -export class DelegationQuery { - constructor(protected readonly delegationService: DelegationService) { } - - @Query(() => Delegation, { name: "delegation", description: "Retrieve all delegation staking information." }) - public async getDelegation(): Promise { - return await this.delegationService.getDelegation(); - } -} diff --git a/src/graphql/entities/delegation/delegation.resolver.ts b/src/graphql/entities/delegation/delegation.resolver.ts deleted file mode 100644 index b89121edf..000000000 --- a/src/graphql/entities/delegation/delegation.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { Delegation } from "src/endpoints/delegation/entities/delegation"; -import { DelegationQuery } from "./delegation.query"; -import { DelegationService } from "src/endpoints/delegation/delegation.service"; - -@Resolver(() => Delegation) -export class DelegationResolver extends DelegationQuery { - constructor(delegationService: DelegationService) { - super(delegationService); - } -} diff --git a/src/graphql/entities/graphql.services.module.ts b/src/graphql/entities/graphql.services.module.ts deleted file mode 100644 index dd9379469..000000000 --- a/src/graphql/entities/graphql.services.module.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Module } from "@nestjs/common"; -import { AccountDetailedModule } from "src/graphql/entities/account.detailed/account.detailed.module"; -import { AccountModule } from "src/graphql/entities/account/account.module"; -import { NftModule } from "src/graphql/entities/nft/nft.module"; -import { NftCollectionModule } from "src/graphql/entities/nft.collection/nft.collection.module"; -import { SmartContractResultModule } from "src/graphql/entities/smart.contract.result/smart.contract.result.module"; -import { TransactionDetailedModule } from "src/graphql/entities/transaction.detailed/transaction.detailed.module"; -import { TransactionModule } from "src/graphql/entities/transaction/transaction.module"; -import { TagModule } from "src/graphql/entities/tag/tag.module"; -import { DelegationModule } from "src/graphql/entities/delegation/delegation.module"; -import { DappConfigModule } from "src/graphql/entities/dapp.config/dapp.config.module"; -import { WaitingListModule } from "src/graphql/entities/waiting.list/waiting.list.module"; -import { UsernameModule } from "src/graphql/entities/username/username.module"; -import { BlockModule } from "src/graphql/entities/block/block.module"; -import { MiniBlockModule } from "src/graphql/entities/miniblock/mini.block.module"; -import { NetworkModule } from "src/graphql/entities/network/network.module"; -import { ShardModule } from "src/graphql/entities/shard/shard.module"; -import { DelegationLegacyModule } from "src/graphql/entities/delegation-legacy/delegation-legacy.module"; -import { IdentitiesModule } from "src/graphql/entities/identities/identities.module"; -import { NodeModule } from "src/graphql/entities/nodes/nodes.module"; -import { RoundModule } from "src/graphql/entities/rounds/rounds.module"; -import { ProviderModule } from "src/graphql/entities/providers/providers.module"; -import { StakeModule } from "src/graphql/entities/stake/stake.module"; -import { MexTokenModule } from "src/graphql/entities/xexchange/mex.token.module"; -import { TokenModule } from "src/graphql/entities/tokens/tokens.module"; -import { WebsocketModule } from "src/graphql/entities/web.socket/web.socket.module"; -import { TransferModule } from "src/graphql/entities/transfers/transfers.module"; - - -@Module({ - imports: [ - AccountDetailedModule, - AccountModule, - NftModule, - NftCollectionModule, - SmartContractResultModule, - TransactionDetailedModule, - TransactionModule, - TagModule, - DelegationModule, - DappConfigModule, - WaitingListModule, - UsernameModule, - BlockModule, - MiniBlockModule, - NetworkModule, - ShardModule, - DelegationLegacyModule, - IdentitiesModule, - NodeModule, - RoundModule, - ProviderModule, - StakeModule, - MexTokenModule, - TokenModule, - WebsocketModule, - TransferModule, - ], - exports: [ - AccountDetailedModule, AccountModule, NftModule, NftCollectionModule, SmartContractResultModule, TransactionDetailedModule, - TransactionModule, TagModule, DelegationModule, DappConfigModule, WaitingListModule, UsernameModule, BlockModule, - MiniBlockModule, NetworkModule, ShardModule, DelegationLegacyModule, IdentitiesModule, NodeModule, RoundModule, ProviderModule, - StakeModule, MexTokenModule, TokenModule, WebsocketModule, TransferModule, - ], -}) -export class GraphQLServicesModule { } diff --git a/src/graphql/entities/identities/identities.input.ts b/src/graphql/entities/identities/identities.input.ts deleted file mode 100644 index cb5e174cd..000000000 --- a/src/graphql/entities/identities/identities.input.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Field, InputType } from "@nestjs/graphql"; - -@InputType({ description: "Input to retrieve the given identity for." }) -export class GetIndentityInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => [String], { name: "identities", description: "list of identities.", nullable: true }) - identities!: Array; - - public static resolve(input: GetIndentityInput): string[] { - return input.identities; - } -} diff --git a/src/graphql/entities/identities/identities.module.ts b/src/graphql/entities/identities/identities.module.ts deleted file mode 100644 index 26287563c..000000000 --- a/src/graphql/entities/identities/identities.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { IdentityResolver } from "./identitites.resolver"; -import { IdentitiesModule as InternalIdentitiesModule } from "src/endpoints/identities/identities.module"; - -@Module({ - imports: [InternalIdentitiesModule], - providers: [IdentityResolver], -}) -export class IdentitiesModule { } diff --git a/src/graphql/entities/identities/identities.query.ts b/src/graphql/entities/identities/identities.query.ts deleted file mode 100644 index 3e51aee71..000000000 --- a/src/graphql/entities/identities/identities.query.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Args, Query, Resolver } from "@nestjs/graphql"; -import { Identity } from "src/endpoints/identities/entities/identity"; -import { IdentitiesService } from "src/endpoints/identities/identities.service"; -import { GetIndentityInput } from "./identities.input"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -@Resolver() -export class IdentityQuery { - constructor(protected readonly identitiesService: IdentitiesService) { } - - @Query(() => [Identity], { name: "identity", description: `Retrieve list of all node identities, used to group nodes by the same entity. "Free-floating" nodes that do not belong to any identity will also be returned` }) - public async getIdentity(@Args("input", { description: "." }) input: GetIndentityInput): Promise { - return await this.identitiesService.getIdentities(new QueryPagination(), GetIndentityInput.resolve(input)); - } - - @Query(() => [Identity], { name: "identities", description: `Retrieve list of all node identities, used to group nodes by the same entity. "Free-floating" nodes that do not belong to any identity will also be returned`, nullable: true }) - public async getIdentities(): Promise { - return await this.identitiesService.getAllIdentities(); - } -} diff --git a/src/graphql/entities/identities/identitites.resolver.ts b/src/graphql/entities/identities/identitites.resolver.ts deleted file mode 100644 index d5acf4ac4..000000000 --- a/src/graphql/entities/identities/identitites.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { Identity } from "src/endpoints/identities/entities/identity"; -import { IdentitiesService } from "src/endpoints/identities/identities.service"; -import { IdentityQuery } from "./identities.query"; - -@Resolver(() => Identity) -export class IdentityResolver extends IdentityQuery { - constructor(identitiesService: IdentitiesService) { - super(identitiesService); - } -} diff --git a/src/graphql/entities/miniblock/mini.block.input.ts b/src/graphql/entities/miniblock/mini.block.input.ts deleted file mode 100644 index 2a7466f48..000000000 --- a/src/graphql/entities/miniblock/mini.block.input.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Field, ID, InputType } from "@nestjs/graphql"; - - -@InputType({ description: "Input to retrieve the given block for." }) -export class GetMiniBlockHashInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => ID, { name: "miniBlockHash", description: "Specific mini block hash to retrieve the corresponding block for." }) - miniBlockHash: string = ""; - - public static resolve(input: GetMiniBlockHashInput): string { - return input.miniBlockHash; - } -} diff --git a/src/graphql/entities/miniblock/mini.block.module.ts b/src/graphql/entities/miniblock/mini.block.module.ts deleted file mode 100644 index a15e3428c..000000000 --- a/src/graphql/entities/miniblock/mini.block.module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Module } from "@nestjs/common"; -import { MiniBlockModule as InternalMiniBlockModule } from "src/endpoints/miniblocks/miniblock.module"; -import { MiniBlockResolver } from "./mini.block.resolver"; -@Module({ - imports: [InternalMiniBlockModule], - providers: [MiniBlockResolver], -}) -export class MiniBlockModule { } diff --git a/src/graphql/entities/miniblock/mini.block.query.ts b/src/graphql/entities/miniblock/mini.block.query.ts deleted file mode 100644 index adc675e3c..000000000 --- a/src/graphql/entities/miniblock/mini.block.query.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Args, Resolver, Query } from "@nestjs/graphql"; -import { GetMiniBlockHashInput } from "./mini.block.input"; -import { MiniBlockService } from "src/endpoints/miniblocks/mini.block.service"; -import { MiniBlockDetailed } from "src/endpoints/miniblocks/entities/mini.block.detailed"; -import { NotFoundException } from "@nestjs/common"; - -@Resolver() -export class MiniBlockQuery { - constructor(protected readonly miniBlockService: MiniBlockService) { } - - @Query(() => MiniBlockDetailed, { name: "miniBlockHash", description: "Retrieve the mini block hash for the given input." }) - public async getMiniBlockHash(@Args("input", { description: "Input to retrieve the given mini block hash details for." }) input: GetMiniBlockHashInput): Promise { - - try { - return await this.miniBlockService.getMiniBlock(GetMiniBlockHashInput.resolve(input)); - } catch { - throw new NotFoundException('Miniblock not found'); - } - } -} diff --git a/src/graphql/entities/miniblock/mini.block.resolver.ts b/src/graphql/entities/miniblock/mini.block.resolver.ts deleted file mode 100644 index dc16f54e7..000000000 --- a/src/graphql/entities/miniblock/mini.block.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { MiniBlockQuery } from "./mini.block.query"; -import { MiniBlockDetailed } from "src/endpoints/miniblocks/entities/mini.block.detailed"; -import { MiniBlockService } from "src/endpoints/miniblocks/mini.block.service"; - -@Resolver(() => MiniBlockDetailed) -export class MiniBlockResolver extends MiniBlockQuery { - constructor(miniBlockService: MiniBlockService) { - super(miniBlockService); - } -} diff --git a/src/graphql/entities/network/network.module.ts b/src/graphql/entities/network/network.module.ts deleted file mode 100644 index 26c09c7a1..000000000 --- a/src/graphql/entities/network/network.module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Module } from "@nestjs/common"; -import { NetworkModule as InternalNetworkModule } from "src/endpoints/network/network.module"; -import { ConstantsResolver } from "./network.resolver"; -@Module({ - imports: [InternalNetworkModule], - providers: [ConstantsResolver], -}) -export class NetworkModule { } diff --git a/src/graphql/entities/network/network.query.ts b/src/graphql/entities/network/network.query.ts deleted file mode 100644 index 83d8cd48f..000000000 --- a/src/graphql/entities/network/network.query.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Resolver, Query } from "@nestjs/graphql"; -import { NetworkService } from "src/endpoints/network/network.service"; -import { NetworkConstants } from "src/endpoints/network/entities/constants"; -import { Economics } from "src/endpoints/network/entities/economics"; -import { Stats } from "src/endpoints/network/entities/stats"; -import { About } from "src/endpoints/network/entities/about"; - -@Resolver() -export class NetworkQuery { - constructor(protected readonly networkService: NetworkService) { } - - @Query(() => NetworkConstants, { name: "constants", description: "Retrieve network-specific constants that can be used to automatically configure dapps." }) - public async getConstants(): Promise { - return await this.networkService.getConstants(); - } - - @Query(() => Economics, { name: "economics", description: "Retrieve general economics information." }) - public async getEconomics(): Promise { - return await this.networkService.getEconomics(); - } - - @Query(() => Stats, { name: "stats", description: "Retrieve general network statistics." }) - public async getStats(): Promise { - return await this.networkService.getStats(); - } - - @Query(() => About, { name: "about", description: "Retrieve general information about API deployment." }) - public async getAbout(): Promise { - return await this.networkService.getAbout(); - } -} diff --git a/src/graphql/entities/network/network.resolver.ts b/src/graphql/entities/network/network.resolver.ts deleted file mode 100644 index 10d334e33..000000000 --- a/src/graphql/entities/network/network.resolver.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { About } from "src/endpoints/network/entities/about"; -import { NetworkConstants } from "src/endpoints/network/entities/constants"; -import { Economics } from "src/endpoints/network/entities/economics"; -import { Stats } from "src/endpoints/network/entities/stats"; -import { NetworkService } from "src/endpoints/network/network.service"; -import { NetworkQuery } from "./network.query"; - -@Resolver(() => NetworkConstants) -export class ConstantsResolver extends NetworkQuery { - constructor(networkService: NetworkService) { - super(networkService); - } -} - -@Resolver(() => Economics) -export class EconomicsResolver extends NetworkQuery { - constructor(networkService: NetworkService) { - super(networkService); - } -} - -@Resolver(() => Stats) -export class StatsResolver extends NetworkQuery { - constructor(networkService: NetworkService) { - super(networkService); - } -} - -@Resolver(() => About) -export class AboutResolver extends NetworkQuery { - constructor(networkService: NetworkService) { - super(networkService); - } -} diff --git a/src/graphql/entities/nft.collection/nft.collection.input.ts b/src/graphql/entities/nft.collection/nft.collection.input.ts deleted file mode 100644 index a964de133..000000000 --- a/src/graphql/entities/nft.collection/nft.collection.input.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Field, InputType, Float, ID } from "@nestjs/graphql"; - -import { CollectionFilter } from "src/endpoints/collections/entities/collection.filter"; -import { NftType } from "src/endpoints/nfts/entities/nft.type"; - -@InputType({ description: "Input to retrieve the given NFT collections count for." }) -export class GetNftCollectionsCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => ID, { name: "search", description: "Collection identifier to retrieve for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => [NftType], { name: "type", description: "NFT types list to retrieve for the given result set.", nullable: true }) - type: Array | undefined = undefined; - - @Field(() => String, { name: "canBurn", description: "Can burn to retrieve for the given result set.", nullable: true }) - canBurn: string | undefined = undefined; - - @Field(() => String, { name: "canAddQuantity", description: "Can add quantity to retrieve for the given result set.", nullable: true }) - canAddQuantity: string | undefined = undefined; - - @Field(() => String, { name: "canUpdateAttributes", description: "Can update attributes to retrieve for the given result set.", nullable: true }) - canUpdateAttributes: string | undefined = undefined; - - @Field(() => String, { name: "canAddUri", description: "Can add URI to retrieve for the given result set.", nullable: true }) - canAddUri: string | undefined = undefined; - - @Field(() => String, { name: "canTransferRole", description: "Can transfer role to retrieve for the given result set.", nullable: true }) - canTransferRole: string | undefined = undefined; - - @Field(() => Float, { name: "before", description: "Before timestamp to retrieve for the given result set.", nullable: true }) - before: number | undefined = undefined; - - @Field(() => Float, { name: "after", description: "After timestamp to retrieve for the given result set.", nullable: true }) - after: number | undefined = undefined; - - @Field(() => Boolean, { name: "excludeMetaESDT", description: `Do not include collections of type "MetaESDT" in the responsee for the given result set.`, nullable: true }) - excludeMetaESDT: boolean | undefined = undefined; - - public static resolve(input: GetNftCollectionsCountInput): CollectionFilter { - return new CollectionFilter({ - search: input.search, - type: input.type, - before: input.before, - after: input.after, - canBurn: input.canBurn, - canAddQuantity: input.canAddQuantity, - canUpdateAttributes: input.canUpdateAttributes, - canAddUri: input.canAddUri, - canTransferRole: input.canTransferRole, - excludeMetaESDT: input.excludeMetaESDT, - }); - } -} - -@InputType({ description: "Input to retrieve the given NFT collections for." }) -export class GetNftCollectionsInput extends GetNftCollectionsCountInput { - constructor(partial?: Partial) { - super(); - - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of NFT collections to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of NFT collections to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => [ID], { name: "identifiers", description: "Collection comma-separated identifiers to retrieve for the given result set.", nullable: true }) - identifiers: Array | undefined = undefined; -} - -@InputType({ description: "Input to retrieve the given NFT collection for." }) -export class GetNftCollectionInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => ID, { name: "collection", description: "Collection identifier to retrieve the corresponding NFT collection for." }) - collection: string = ""; - - public static resolve(input: GetNftCollectionInput): string { - return input.collection; - } -} diff --git a/src/graphql/entities/nft.collection/nft.collection.loader.ts b/src/graphql/entities/nft.collection/nft.collection.loader.ts deleted file mode 100644 index 6aaa4686a..000000000 --- a/src/graphql/entities/nft.collection/nft.collection.loader.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Injectable } from "@nestjs/common"; -import DataLoader from "dataloader"; -import { Account } from "src/endpoints/accounts/entities/account"; -import { AccountService } from "src/endpoints/accounts/account.service"; - -@Injectable() -export class NftCollectionLoader { - constructor(private readonly accountService: AccountService) { } - - public async getAccount(address: string): Promise> { - return await this.accountDataLoader.load(address); - } - - private readonly accountDataLoader: any = new DataLoader(async addresses => { - const accounts = await this.accountService.getAccountsForAddresses(addresses.concat()); - - return addresses.concat().mapIndexed(accounts, account => account.address); - }, { cache: false }); -} diff --git a/src/graphql/entities/nft.collection/nft.collection.module.ts b/src/graphql/entities/nft.collection/nft.collection.module.ts deleted file mode 100644 index 4e73f6d37..000000000 --- a/src/graphql/entities/nft.collection/nft.collection.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Module } from "@nestjs/common"; - -import { AccountModule } from "src/endpoints/accounts/account.module"; -import { CollectionModule } from "src/endpoints/collections/collection.module"; -import { NftCollectionLoader } from "src/graphql/entities/nft.collection/nft.collection.loader"; -import { NftCollectionResolver } from "src/graphql/entities/nft.collection/nft.collection.resolver"; - -@Module({ - imports: [AccountModule, CollectionModule], - providers: [NftCollectionLoader, NftCollectionResolver], -}) -export class NftCollectionModule {} diff --git a/src/graphql/entities/nft.collection/nft.collection.query.ts b/src/graphql/entities/nft.collection/nft.collection.query.ts deleted file mode 100644 index 2d049ef97..000000000 --- a/src/graphql/entities/nft.collection/nft.collection.query.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Args, Float, Resolver, Query } from "@nestjs/graphql"; - -import { CollectionService } from "src/endpoints/collections/collection.service"; -import { CollectionFilter } from "src/endpoints/collections/entities/collection.filter"; -import { GetNftCollectionInput, GetNftCollectionsCountInput, GetNftCollectionsInput } from "src/graphql/entities/nft.collection/nft.collection.input"; -import { NftCollection } from "src/endpoints/collections/entities/nft.collection"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { NotFoundException } from "@nestjs/common"; -import { NftRank } from "src/common/assets/entities/nft.rank"; - -@Resolver() -export class NftCollectionQuery { - constructor(protected readonly collectionService: CollectionService) { } - - @Query(() => Float, { name: "collectionsCount", description: "Retrieve all NFT collections count for the given input." }) - public async getNftCollectionsCount(@Args("input", { description: "Input to retrieve the given NFT collections count for." }) input: GetNftCollectionsCountInput): Promise { - return await this.collectionService.getNftCollectionCount(GetNftCollectionsCountInput.resolve(input)); - } - - @Query(() => [NftCollection], { name: "collections", description: "Retrieve all NFT collections for the given input." }) - public async getNftCollections(@Args("input", { description: "Input to retrieve the given NFT collections for." }) input: GetNftCollectionsInput): Promise { - return await this.collectionService.getNftCollections( - new QueryPagination({ from: input.from, size: input.size }), - new CollectionFilter({ - before: input.before, - after: input.after, - search: input.search, - type: input.type, - identifiers: input.identifiers, - canBurn: input.canBurn, - canAddQuantity: input.canAddQuantity, - canUpdateAttributes: input.canUpdateAttributes, - canAddUri: input.canAddUri, - canTransferRole: input.canTransferRole, - excludeMetaESDT: input.excludeMetaESDT, - }), - ); - } - - @Query(() => NftCollection, { name: "collection", description: "Retrieve the NFT collection for the given input.", nullable: true }) - public async getNftCollection(@Args("input", { description: "Input to retrieve the given NFT collection for." }) input: GetNftCollectionInput): Promise { - const collection = await this.collectionService.getNftCollection(GetNftCollectionInput.resolve(input)); - - if (!collection) { - throw new NotFoundException('Collection not found'); - } - - return collection; - } - - @Query(() => [NftRank], { name: "collectionRank", description: "Retrieve the NFT collection ranks for the given input.", nullable: true }) - public async getNftCollectionRanks(@Args("input", { description: "Input to retrieve the given NFT collection ranks for." }) input: GetNftCollectionInput): Promise { - const collection = await this.collectionService.getNftCollectionRanks(GetNftCollectionInput.resolve(input)); - - if (!collection) { - throw new NotFoundException('Collection not found'); - } - - return collection; - } - -} diff --git a/src/graphql/entities/nft.collection/nft.collection.resolver.ts b/src/graphql/entities/nft.collection/nft.collection.resolver.ts deleted file mode 100644 index 7ee4be5f6..000000000 --- a/src/graphql/entities/nft.collection/nft.collection.resolver.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Parent, ResolveField, Resolver } from "@nestjs/graphql"; - -import { Account } from "src/endpoints/accounts/entities/account"; -import { CollectionService } from "src/endpoints/collections/collection.service"; -import { Fields } from "src/graphql/decorators/fields"; -import { NftCollection } from "src/endpoints/collections/entities/nft.collection"; -import { NftCollectionLoader } from "src/graphql/entities/nft.collection/nft.collection.loader"; -import { NftCollectionQuery } from "src/graphql/entities/nft.collection/nft.collection.query"; - -@Resolver(() => NftCollection) -export class NftCollectionResolver extends NftCollectionQuery { - constructor( - private readonly nftCollectionLoader: NftCollectionLoader, - collectionService: CollectionService - ) { - super(collectionService); - } - - @ResolveField("owner", () => Account, { name: "owner", description: "Owner account for the given NFT collection.", nullable: true }) - public async getNftOwner(@Parent() nftCollection: NftCollection, @Fields() fields: Array) { - if (nftCollection.owner === undefined) { - return null; - } - - if (fields.singleOrUndefined() === 'address') { - return new Account({ - address: nftCollection.owner, - }); - } - - return await this.nftCollectionLoader.getAccount(nftCollection.owner); - } -} diff --git a/src/graphql/entities/nft/nft.input.ts b/src/graphql/entities/nft/nft.input.ts deleted file mode 100644 index 7c2e27ab0..000000000 --- a/src/graphql/entities/nft/nft.input.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { Field, InputType, Float, ID } from "@nestjs/graphql"; - -import { NftFilter } from "src/endpoints/nfts/entities/nft.filter"; -import { NftType } from "src/endpoints/nfts/entities/nft.type"; - -@InputType({ description: "Input to retrieve the given NFTs count for." }) -export class GetNftsCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "search", description: "NFT identifier to retrieve for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => [ID], { name: "identifiers", description: "NFT comma-separated identifiers list to retrieve for the given result set.", nullable: true }) - identifiers: Array | undefined = undefined; - - @Field(() => [NftType], { name: "type", description: "NFT type to retrieve for the given result set.", nullable: true }) - type: Array | undefined = undefined; - - @Field(() => ID, { name: "collection", description: "Collection identifier for the given result set.", nullable: true }) - collection: string | undefined = ""; - - @Field(() => String, { name: "name", description: "Name to retrieve for the given result set.", nullable: true }) - name: string | undefined = undefined; - - @Field(() => [String], { name: "tags", description: "Tags list to retrieve for the given result set.", nullable: true }) - tags: Array | undefined = undefined; - - @Field(() => String, { name: "creator", description: "Creator to retrieve for the given result set.", nullable: true }) - creator: string | undefined = undefined; - - @Field(() => Boolean, { name: "isWhitelistedStorage", description: "Is whitelisted storage to retrieve for the given result set.", nullable: true }) - isWhitelistedStorage: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "isNsfw", description: "Is NSFW to retrieve for the given result set.", nullable: true }) - isNsfw: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "hasUris", description: "Has URIs to retrieve for the given result set.", nullable: true }) - hasUris: boolean | undefined = undefined; - - @Field(() => Float, { name: "before", description: "Before timestamp to retrieve for the given result set.", nullable: true }) - before: number | undefined = undefined; - - @Field(() => Float, { name: "after", description: "After timestamp to retrieve for the given result set.", nullable: true }) - after: number | undefined = undefined; - - @Field(() => Float, { name: "nonce", description: "Nonce to retrieve for the given result set.", nullable: true }) - nonce: number | undefined = undefined; - - public static resolve(input: GetNftsCountInput): NftFilter { - return new NftFilter({ - after: input.after, - before: input.before, - search: input.search, - identifiers: input.identifiers, - type: input.type, - collection: input.collection, - name: input.name, - tags: input.tags, - creator: input.creator, - isWhitelistedStorage: input.isWhitelistedStorage, - hasUris: input.hasUris, - isNsfw: input.isNsfw, - }); - } -} - -@InputType({ description: "Input to retrieve the given NFTs for." }) -export class GetNftsInput extends GetNftsCountInput { - constructor(partial?: Partial) { - super(); - - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of collections to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of collections to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => Boolean, { name: "withOwner", description: "With owner to retrieve for the given result set.", nullable: true }) - withOwner: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withSupply", description: "With supply to retrieve for the given result set.", nullable: true }) - withSupply: boolean | undefined = undefined; -} - -@InputType({ description: "Input to retrieve the given NFT for." }) -export class GetNftInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => ID, { name: "identifier", description: "Identifier to retrieve the corresponding NFT for." }) - identifier: string = ""; - - public static resolve(input: GetNftInput): string { - return input.identifier; - } -} diff --git a/src/graphql/entities/nft/nft.loader.ts b/src/graphql/entities/nft/nft.loader.ts deleted file mode 100644 index 589ecfcaf..000000000 --- a/src/graphql/entities/nft/nft.loader.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Injectable } from "@nestjs/common"; -import DataLoader from "dataloader"; -import { Account } from "src/endpoints/accounts/entities/account"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { CollectionService } from "src/endpoints/collections/collection.service"; -import { NftCollection } from "src/endpoints/collections/entities/nft.collection"; - -@Injectable() -export class NftLoader { - constructor( - private readonly accountService: AccountService, - protected readonly collectionService: CollectionService - ) { } - - public async getAccount(address: string): Promise { - return await this.accountDataLoader.load(address); - } - - private readonly accountDataLoader: any = new DataLoader(async addresses => { - const accounts = await this.accountService.getAccountsForAddresses(addresses.concat()); - - return addresses.concat().mapIndexed(accounts, account => account.address); - }, { cache: false }); - - public async getCollection(identifier: string): Promise> { - return await this.nftDataLoader.load(identifier); - } - - private readonly nftDataLoader: any = new DataLoader(async identifiers => { - const collections = await this.collectionService.getNftCollectionsByIds(identifiers.concat()); - - return identifiers.concat().mapIndexed(collections, collection => collection.collection); - }, { cache: false }); -} diff --git a/src/graphql/entities/nft/nft.module.ts b/src/graphql/entities/nft/nft.module.ts deleted file mode 100644 index ef61e8387..000000000 --- a/src/graphql/entities/nft/nft.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Module } from "@nestjs/common"; - -import { AccountModule } from "src/endpoints/accounts/account.module"; -import { CollectionModule } from "src/endpoints/collections/collection.module"; -import { NftLoader } from "src/graphql/entities/nft/nft.loader"; -import { NftResolver } from "src/graphql/entities/nft/nft.resolver"; -import { NftModule as InternalNftModule } from "src/endpoints/nfts/nft.module"; - -@Module({ - imports: [AccountModule, CollectionModule, InternalNftModule], - providers: [NftLoader, NftResolver], -}) -export class NftModule {} diff --git a/src/graphql/entities/nft/nft.query.ts b/src/graphql/entities/nft/nft.query.ts deleted file mode 100644 index e2275b894..000000000 --- a/src/graphql/entities/nft/nft.query.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { Args, Float, Resolver, Query } from "@nestjs/graphql"; - -import { GetNftInput, GetNftsCountInput, GetNftsInput } from "src/graphql/entities/nft/nft.input"; -import { Nft } from "src/endpoints/nfts/entities/nft"; -import { NftFilter } from "src/endpoints/nfts/entities/nft.filter"; -import { NftService } from "src/endpoints/nfts/nft.service"; -import { NftQueryOptions } from "src/endpoints/nfts/entities/nft.query.options"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { NotFoundException } from "@nestjs/common"; - -@Resolver() -export class NftQuery { - constructor(protected readonly nftService: NftService) { } - - @Query(() => Float, { name: "nftsCount", description: "Retrieve all NFTs count for the given input." }) - public async getNftsCount(@Args("input", { description: "Input to retrieve the given NFTs count for." }) input: GetNftsCountInput): Promise { - return await this.nftService.getNftCount(GetNftsCountInput.resolve(input)); - } - - @Query(() => [Nft], { name: "nfts", description: "Retrieve all NFTs for the given input." }) - public async getNfts(@Args("input", { description: "Input to retrieve the given NFTs for." }) input: GetNftsInput): Promise { - return await this.nftService.getNfts( - new QueryPagination({ - from: input.from, - size: input.size, - }), - new NftFilter({ - after: input.after, - before: input.before, - search: input.search, - identifiers: input.identifiers, - type: input.type, - collection: input.collection, - name: input.name, - tags: input.tags, - creator: input.creator, - hasUris: input.hasUris, - isWhitelistedStorage: input.isWhitelistedStorage, - isNsfw: input.isNsfw, - }), - new NftQueryOptions({ - withOwner: input.withOwner, - withSupply: input.withSupply, - }), - ); - } - - @Query(() => Nft, { name: "nft", description: "Retrieve the NFT for the given input.", nullable: true }) - public async getNft(@Args("input", { description: "Input to retrieve the given NFT for." }) input: GetNftInput): Promise { - const token = await this.nftService.getSingleNft(GetNftInput.resolve(input)); - - if (!token) { - throw new NotFoundException('NFT not found'); - } - return token; - } -} diff --git a/src/graphql/entities/nft/nft.resolver.ts b/src/graphql/entities/nft/nft.resolver.ts deleted file mode 100644 index d98552951..000000000 --- a/src/graphql/entities/nft/nft.resolver.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Parent, ResolveField, Resolver } from "@nestjs/graphql"; - -import { Account } from "src/endpoints/accounts/entities/account"; -import { Fields } from "src/graphql/decorators/fields"; -import { Nft } from "src/endpoints/nfts/entities/nft"; -import { NftCollection } from "src/endpoints/collections/entities/nft.collection"; -import { NftLoader } from "src/graphql/entities/nft/nft.loader"; -import { NftService } from "src/endpoints/nfts/nft.service"; -import { NftQuery } from "src/graphql/entities/nft/nft.query"; - -@Resolver(() => Nft) -export class NftResolver extends NftQuery { - constructor( - private readonly nftLoader: NftLoader, - nftService: NftService - ) { - super(nftService); - } - - @ResolveField("collection", () => NftCollection, { name: "collection", description: "NFT collection for the given NFT." }) - public async getNftCollection(@Parent() nft: Nft) { - return await this.nftLoader.getCollection(nft.collection); - } - - @ResolveField("creator", () => Account, { name: "creator", description: "Creator account for the given NFT." }) - public async getNftCreator(@Parent() nft: Nft, @Fields() fields: Array) { - if (fields.singleOrUndefined() === 'address') { - return new Account({ - address: nft.creator, - }); - } - - return await this.nftLoader.getAccount(nft.creator); - } - - @ResolveField("owner", () => Account, { name: "owner", description: "Owner account for the given NFT.", nullable: true }) - public async getNftOwner(@Parent() nft: Nft, @Fields() fields: Array) { - if (nft.owner === undefined) { - return null; - } - - if (fields.singleOrUndefined() === 'address') { - return new Account({ - address: nft.owner, - }); - } - - return await this.nftLoader.getAccount(nft.owner); - } -} diff --git a/src/graphql/entities/nodes/nodes.input.ts b/src/graphql/entities/nodes/nodes.input.ts deleted file mode 100644 index f9537e239..000000000 --- a/src/graphql/entities/nodes/nodes.input.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; -import { SortOrder } from "src/common/entities/sort.order"; -import { NodeFilter } from "src/endpoints/nodes/entities/node.filter"; -import { NodeSort } from "src/endpoints/nodes/entities/node.sort"; -import { NodeStatus } from "src/endpoints/nodes/entities/node.status"; -import { NodeType } from "src/endpoints/nodes/entities/node.type"; - -@InputType({ description: "Input to retreive the given nodes count for." }) -export class GetNodesCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "search", description: "Search for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => Boolean, { name: "online", description: "Online filter for the given result set.", nullable: true }) - online: boolean | undefined = undefined; - - @Field(() => NodeType, { name: "type", description: "Type filter for the given result set.", nullable: true }) - type: NodeType | undefined = undefined; - - @Field(() => NodeStatus, { name: "status", description: "Status filter for the given result set.", nullable: true }) - status: NodeStatus | undefined = undefined; - - @Field(() => Float, { name: "shard", description: "Shard ID for the given result set.", nullable: true }) - shard: number | undefined = undefined; - - @Field(() => Boolean, { name: "issues", description: "Issues filter for the given result set.", nullable: true }) - issues: boolean | undefined = undefined; - - @Field(() => String, { name: "identity", description: "Identity filter for the given result set.", nullable: true }) - identity: string | undefined = undefined; - - @Field(() => String, { name: "provider", description: "Provider filter for the given result set.", nullable: true }) - provider: string | undefined = undefined; - - @Field(() => String, { name: "owner", description: "Owner filter for the given result set.", nullable: true }) - owner: string | undefined = undefined; - - @Field(() => Boolean, { name: "auctioned", description: "Auctioned filter for the given result set.", nullable: true }) - auctioned: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "fullHistory", description: "FullHistory filter for the given result set.", nullable: true }) - fullHistory: boolean | undefined = undefined; - - @Field(() => NodeSort, { name: "sort", description: "Sort filter for the given result set.", nullable: true }) - sort: NodeSort | undefined = undefined; - - @Field(() => SortOrder, { name: "order", description: "Order filter for the given result set.", nullable: true }) - order: SortOrder | undefined = undefined; - - public static resolve(input: GetNodesCountInput): NodeFilter { - return new NodeFilter({ - search: input.search, - online: input.online, - type: input.type, - status: input.status, - shard: input.shard, - issues: input.issues, - identity: input.identity, - provider: input.provider, - owner: input.owner, - auctioned: input.auctioned, - fullHistory: input.fullHistory, - sort: input.sort, - order: input.order, - }); - } -} - -@InputType({ description: "Input to retrieve the given nodes for." }) -export class GetNodesInput extends GetNodesCountInput { - constructor(partial?: Partial) { - super(); - - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of blocks to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of blocks to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; -} - -@InputType({ description: "Input to retrieve the given bls node for." }) -export class GetNodeBlsInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "bls", description: "Bls to retrieve the corresponding node for.", nullable: true }) - bls: string = ""; - - public static resolve(input: GetNodeBlsInput): string { - return input.bls; - } -} diff --git a/src/graphql/entities/nodes/nodes.module.ts b/src/graphql/entities/nodes/nodes.module.ts deleted file mode 100644 index 0a36c088d..000000000 --- a/src/graphql/entities/nodes/nodes.module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Module } from "@nestjs/common"; -import { NodeModule as InternalNodeModule } from "src/endpoints/nodes/node.module"; -import { NodeResolver } from "./nodes.resolver"; -@Module({ - imports: [InternalNodeModule], - providers: [NodeResolver], -}) -export class NodeModule { } diff --git a/src/graphql/entities/nodes/nodes.query.ts b/src/graphql/entities/nodes/nodes.query.ts deleted file mode 100644 index b21ad8de1..000000000 --- a/src/graphql/entities/nodes/nodes.query.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { NotFoundException } from "@nestjs/common"; -import { Args, Float, Query, Resolver } from "@nestjs/graphql"; -import GraphQLJSON from "graphql-type-json"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { Node } from "src/endpoints/nodes/entities/node"; -import { NodeFilter } from "src/endpoints/nodes/entities/node.filter"; -import { NodeService } from "src/endpoints/nodes/node.service"; -import { GetNodeBlsInput, GetNodesCountInput, GetNodesInput } from "./nodes.input"; - -@Resolver() -export class NodeQuery { - constructor(protected readonly nodeService: NodeService) { } - - @Query(() => [Node], { name: "nodes", description: "Retrieve all nodes for the given input." }) - public async getNodes(@Args("input", { description: "Input to retrieve the given nodes for." }) input: GetNodesInput): Promise { - return await this.nodeService.getNodes( - new QueryPagination({ from: input.from, size: input.size }), - new NodeFilter({ - search: input.search, - online: input.online, - type: input.type, - status: input.status, - shard: input.shard, - issues: input.issues, - identity: input.identity, - provider: input.provider, - owner: input.owner, - auctioned: input.auctioned, - fullHistory: input.fullHistory, - sort: input.sort, - order: input.order, - }), - ); - } - - @Query(() => Float, { name: "nodesCount", description: "Returns number of all observer/validator nodes available on blockchain.", nullable: true }) - public async getNodesCount(@Args("input", { description: "Input to retrieve the given nodes count for." }) input: GetNodesCountInput): Promise { - return await this.nodeService.getNodeCount(GetNodesCountInput.resolve(input)); - } - - @Query(() => GraphQLJSON, { name: "nodesVersion", description: "Retrieve the nodes version." }) - public async getNodeVersions(): Promise { - return await this.nodeService.getNodeVersions(); - } - - @Query(() => Node, { name: "node", description: "Retrieve the node details for the given input.", nullable: true }) - public async getNode(@Args("input", { description: "Input to retrieve the given node for." }) input: GetNodeBlsInput): Promise { - const node = await this.nodeService.getNode(GetNodeBlsInput.resolve(input)); - - if (!node) { - throw new NotFoundException('Node not found'); - } - - return node; - } -} - diff --git a/src/graphql/entities/nodes/nodes.resolver.ts b/src/graphql/entities/nodes/nodes.resolver.ts deleted file mode 100644 index 69ac8de4a..000000000 --- a/src/graphql/entities/nodes/nodes.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { Node } from "src/endpoints/nodes/entities/node"; -import { NodeService } from "src/endpoints/nodes/node.service"; -import { NodeQuery } from "./nodes.query"; - -@Resolver(() => Node) -export class NodeResolver extends NodeQuery { - constructor(nodeService: NodeService) { - super(nodeService); - } -} diff --git a/src/graphql/entities/providers/providers.input.ts b/src/graphql/entities/providers/providers.input.ts deleted file mode 100644 index 642f85f40..000000000 --- a/src/graphql/entities/providers/providers.input.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Field, InputType } from "@nestjs/graphql"; - -@InputType({ description: "Input to retrieve the given provider for." }) -export class GetProviderInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "identity", description: "Identity provider for the given result set.", nullable: true }) - identity: string = ""; - - public static resolve(input: GetProviderInput) { - return input.identity; - } -} - -@InputType({ description: "Input to retrieve the given provider for." }) -export class GetProviderByAddressInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "address", description: "Identity provider for the given result set.", nullable: true }) - address: string = ""; - - public static resolve(input: GetProviderByAddressInput) { - return input.address; - } -} diff --git a/src/graphql/entities/providers/providers.module.ts b/src/graphql/entities/providers/providers.module.ts deleted file mode 100644 index ea5d08244..000000000 --- a/src/graphql/entities/providers/providers.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { ProviderModule as InternalProviderModule } from "src/endpoints/providers/provider.module"; -import { ProviderResolver } from "./providers.resolver"; - -@Module({ - imports: [InternalProviderModule], - providers: [ProviderResolver], -}) -export class ProviderModule { } diff --git a/src/graphql/entities/providers/providers.query.ts b/src/graphql/entities/providers/providers.query.ts deleted file mode 100644 index fe3e4608c..000000000 --- a/src/graphql/entities/providers/providers.query.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Args, Query, Resolver } from "@nestjs/graphql"; -import { ProviderService } from "src/endpoints/providers/provider.service"; -import { GetProviderByAddressInput, GetProviderInput } from "./providers.input"; -import { NotFoundException } from "@nestjs/common"; -import { ProviderFilter } from "src/endpoints/providers/entities/provider.filter"; -import { Provider } from "src/endpoints/providers/entities/provider"; - -@Resolver() -export class ProviderQuery { - constructor(protected readonly providerService: ProviderService) { } - - @Query(() => [Provider], { name: "providers", description: "Retrieve all providers for the given input." }) - public async getProviders(@Args("input", { description: "Input to retrieve the given identity provider for." }) input: GetProviderInput): Promise { - return await this.providerService.getProviders(new ProviderFilter({ - identity: input.identity, - })); - } - - @Query(() => Provider, { name: "provider", description: "Retrieve a specific provider for the given input." }) - public async getProvider(@Args("input", { description: "Input to retrieve the given identity provider for." }) input: GetProviderByAddressInput): Promise { - const provider = await this.providerService.getProvider(GetProviderByAddressInput.resolve(input)); - - if (!provider) { - throw new NotFoundException('Provider not found'); - } - - return provider; - } -} diff --git a/src/graphql/entities/providers/providers.resolver.ts b/src/graphql/entities/providers/providers.resolver.ts deleted file mode 100644 index daeb2ed44..000000000 --- a/src/graphql/entities/providers/providers.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { Provider } from "src/endpoints/providers/entities/provider"; -import { ProviderService } from "src/endpoints/providers/provider.service"; -import { ProviderQuery } from "./providers.query"; - -@Resolver(() => Provider) -export class ProviderResolver extends ProviderQuery { - constructor(providerService: ProviderService) { - super(providerService); - } -} diff --git a/src/graphql/entities/rounds/rounds.input.ts b/src/graphql/entities/rounds/rounds.input.ts deleted file mode 100644 index 8be0f60f8..000000000 --- a/src/graphql/entities/rounds/rounds.input.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; -import { RoundFilter } from "src/endpoints/rounds/entities/round.filter"; - -@InputType({ description: "Input to retreive the given rounds count for." }) -export class GetRoundsCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "validator", description: "Validator for the given result set.", nullable: true }) - validator: string | undefined = undefined; - - // This property filter need to be adjusted in erdnest - // @Field(() => QueryConditionOptions, { name: "condition", description: "Condition filter for the given result set.", nullable: true }) - // condition: QueryConditionOptions | undefined; - - @Field(() => Float, { name: "shard", description: "Shard ID for the given result set.", nullable: true }) - shard: number | undefined = undefined; - - @Field(() => Float, { name: "epoch", description: "Epoch for the given result set.", nullable: true }) - epoch: number | undefined = undefined; - - public static resolve(input: GetRoundsCountInput): RoundFilter { - return new RoundFilter({ - validator: input.validator, - shard: input.shard, - epoch: input.epoch, - }); - } -} - -@InputType({ description: "Input to retrieve the given rounds for." }) -export class GetRoundsInput extends GetRoundsCountInput { - constructor(partial?: Partial) { - super(); - - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of blocks to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of blocks to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; -} - -@InputType({ description: "Input to retrieve the given rounds for." }) -export class GetRoundInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "shard", description: "Epoch for the given result set." }) - shard!: number; - - @Field(() => Float, { name: "round", description: "Round for the given result set." }) - round!: number; - - public static resolve(input: GetRoundInput) { - return input.shard, input.round; - } -} diff --git a/src/graphql/entities/rounds/rounds.module.ts b/src/graphql/entities/rounds/rounds.module.ts deleted file mode 100644 index 9493a90f1..000000000 --- a/src/graphql/entities/rounds/rounds.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { RoundModule as InternalRoundModule } from "src/endpoints/rounds/round.module"; -import { RoundResolver } from "./rounds.resolver"; - -@Module({ - imports: [InternalRoundModule], - providers: [RoundResolver], -}) -export class RoundModule { } diff --git a/src/graphql/entities/rounds/rounds.query.ts b/src/graphql/entities/rounds/rounds.query.ts deleted file mode 100644 index eded2f63d..000000000 --- a/src/graphql/entities/rounds/rounds.query.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { RoundService } from "src/endpoints/rounds/round.service"; -import { Args, Float, Query, Resolver } from "@nestjs/graphql"; -import { Round } from "src/endpoints/rounds/entities/round"; -import { GetRoundInput, GetRoundsCountInput, GetRoundsInput } from "./rounds.input"; -import { RoundFilter } from "src/endpoints/rounds/entities/round.filter"; -import { RoundDetailed } from "src/endpoints/rounds/entities/round.detailed"; -import { NotFoundException } from "@nestjs/common"; - -@Resolver() -export class RoundQuery { - constructor(protected readonly roundService: RoundService) { } - - @Query(() => [Round], { name: "rounds", description: "Retrieve all rounds for the given input." }) - public async getRounds(@Args("input", { description: "Input to retrieve the given rounds for." }) input: GetRoundsInput): Promise { - return await this.roundService.getRounds( - new RoundFilter({ - from: input.from, - size: input.size, - validator: input.validator, - shard: input.shard, - epoch: input.epoch, - }), - ); - } - - @Query(() => Float, { name: "roundsCount", description: "Returns total number of rounds.", nullable: true }) - public async getBlocksCount(@Args("input", { description: "Input to retrieve the given rounds count for." }) input: GetRoundsCountInput): Promise { - return await this.roundService.getRoundCount(GetRoundsCountInput.resolve(input)); - } - - @Query(() => RoundDetailed, { name: "round", description: "Retrieve the round details for the given input.", nullable: true }) - public async getNode(@Args("input", { description: "Input to retrieve the given node for." }) input: GetRoundInput): Promise { - try { - return await this.roundService.getRound(input.shard, input.round); - } catch { - throw new NotFoundException('Round not found'); - } - } -} diff --git a/src/graphql/entities/rounds/rounds.resolver.ts b/src/graphql/entities/rounds/rounds.resolver.ts deleted file mode 100644 index 9a7909d6e..000000000 --- a/src/graphql/entities/rounds/rounds.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { Round } from "src/endpoints/rounds/entities/round"; -import { RoundService } from "src/endpoints/rounds/round.service"; -import { RoundQuery } from "./rounds.query"; - -@Resolver(() => Round) -export class RoundResolver extends RoundQuery { - constructor(roundService: RoundService) { - super(roundService); - } -} diff --git a/src/graphql/entities/shard/shard.input.ts b/src/graphql/entities/shard/shard.input.ts deleted file mode 100644 index fdf06cd2d..000000000 --- a/src/graphql/entities/shard/shard.input.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -@InputType({ description: "Input to retrieve the given tags for." }) -export class GetShardInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of shards to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of shards to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - public static resolve(input: GetShardInput): QueryPagination { - return { from: input.from, size: input.size }; - } -} diff --git a/src/graphql/entities/shard/shard.module.ts b/src/graphql/entities/shard/shard.module.ts deleted file mode 100644 index 1693e4a1a..000000000 --- a/src/graphql/entities/shard/shard.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { ShardResolver } from "./shard.resolver"; -import { ShardModule as InternalShardModule } from "src/endpoints/shards/shard.module"; - -@Module({ - imports: [InternalShardModule], - providers: [ShardResolver], -}) -export class ShardModule { } diff --git a/src/graphql/entities/shard/shard.query.ts b/src/graphql/entities/shard/shard.query.ts deleted file mode 100644 index d35aee39b..000000000 --- a/src/graphql/entities/shard/shard.query.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Args, Resolver, Query } from "@nestjs/graphql"; -import { ShardService } from "src/endpoints/shards/shard.service"; -import { Shard } from "src/endpoints/shards/entities/shard"; -import { GetShardInput } from "./shard.input"; - -@Resolver() -export class ShardsQuery { - constructor(protected readonly shardService: ShardService) { } - - @Query(() => [Shard], { name: "shards", description: "Retrieve all shards for the given input." }) - public async getShards(@Args("input", { description: "Input to retrieve the given shards for." }) input: GetShardInput): Promise { - return await this.shardService.getShards(GetShardInput.resolve(input)); - } -} diff --git a/src/graphql/entities/shard/shard.resolver.ts b/src/graphql/entities/shard/shard.resolver.ts deleted file mode 100644 index 875bbd0fc..000000000 --- a/src/graphql/entities/shard/shard.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { ShardsQuery } from "./shard.query"; -import { Shard } from "src/endpoints/shards/entities/shard"; -import { ShardService } from "src/endpoints/shards/shard.service"; - -@Resolver(() => Shard) -export class ShardResolver extends ShardsQuery { - constructor(shardService: ShardService) { - super(shardService); - } -} diff --git a/src/graphql/entities/smart.contract.result/smart.contract.result.input.ts b/src/graphql/entities/smart.contract.result/smart.contract.result.input.ts deleted file mode 100644 index ab4f26feb..000000000 --- a/src/graphql/entities/smart.contract.result/smart.contract.result.input.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; - -@InputType({ description: "Input to retrieve the given smart contract results for." }) -export class GetSmartContractResultInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of blocks to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of blocks to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => String, { name: "miniBlockHash", description: "Miniblockhash txHash for the given result set.", nullable: true }) - miniBlockHash: string | undefined; - - @Field(() => [String], { name: "originalTxHashes", description: "Original TxHashes for the given result set.", nullable: true }) - originalTxHashes: string[] | undefined; -} - -@InputType({ description: "Input to retrieve the given smart contract hash for." }) -export class GetSmartContractHashInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "scHash", description: "scHash for the given smart contract set." }) - scHash!: string; - - public static resolve(input: GetSmartContractHashInput) { - return input.scHash; - } -} diff --git a/src/graphql/entities/smart.contract.result/smart.contract.result.loader.ts b/src/graphql/entities/smart.contract.result/smart.contract.result.loader.ts deleted file mode 100644 index 6aaa374d6..000000000 --- a/src/graphql/entities/smart.contract.result/smart.contract.result.loader.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Injectable } from "@nestjs/common"; -import DataLoader from "dataloader"; -import { TransactionLog } from "src/endpoints/transactions/entities/transaction.log"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; - -@Injectable() -export class SmartContractResultLoader { - constructor(private readonly transactionService: TransactionService) { } - - public async getLog(hash: string): Promise> { - return await this.logDataLoader.load(hash); - } - - private readonly logDataLoader: any = new DataLoader( - async hashes => await this.transactionService.getLogs(hashes.concat()), - { cache: false } - ); -} diff --git a/src/graphql/entities/smart.contract.result/smart.contract.result.module.ts b/src/graphql/entities/smart.contract.result/smart.contract.result.module.ts deleted file mode 100644 index 4c673355a..000000000 --- a/src/graphql/entities/smart.contract.result/smart.contract.result.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Module } from "@nestjs/common"; - -import { SmartContractResultLoader } from "src/graphql/entities/smart.contract.result/smart.contract.result.loader"; -import { SmartContractResultResolver } from "src/graphql/entities/smart.contract.result/smart.contract.result.resolver"; -import { TransactionModule } from "src/endpoints/transactions/transaction.module"; -import { SmartContractResultQueryResolver } from "./smart.contract.result.query.resolver"; -import { SmartContractResultModule as InternalSmartContractResultModule } from "src/endpoints/sc-results/scresult.module"; - -@Module({ - imports: [TransactionModule, InternalSmartContractResultModule], - providers: [SmartContractResultLoader, SmartContractResultResolver, SmartContractResultQueryResolver], -}) -export class SmartContractResultModule { } diff --git a/src/graphql/entities/smart.contract.result/smart.contract.result.query.resolver.ts b/src/graphql/entities/smart.contract.result/smart.contract.result.query.resolver.ts deleted file mode 100644 index cac5a35b1..000000000 --- a/src/graphql/entities/smart.contract.result/smart.contract.result.query.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { SmartContractResult } from "src/endpoints/sc-results/entities/smart.contract.result"; -import { SmartContractResultService } from "src/endpoints/sc-results/scresult.service"; -import { SmartContractResultQuery } from "./smart.contract.result.query"; - -@Resolver(() => SmartContractResult) -export class SmartContractResultQueryResolver extends SmartContractResultQuery { - constructor(smartContractResultsService: SmartContractResultService) { - super(smartContractResultsService); - } -} diff --git a/src/graphql/entities/smart.contract.result/smart.contract.result.query.ts b/src/graphql/entities/smart.contract.result/smart.contract.result.query.ts deleted file mode 100644 index 969c5a303..000000000 --- a/src/graphql/entities/smart.contract.result/smart.contract.result.query.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Args, Float, Query, Resolver } from "@nestjs/graphql"; -import { SmartContractResultService } from "src/endpoints/sc-results/scresult.service"; -import { SmartContractResult } from "src/endpoints/sc-results/entities/smart.contract.result"; -import { GetSmartContractHashInput, GetSmartContractResultInput } from "./smart.contract.result.input"; -import { SmartContractResultFilter } from "src/endpoints/sc-results/entities/smart.contract.result.filter"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { NotFoundException } from "@nestjs/common"; -import { SmartContractResultOptions } from "src/endpoints/sc-results/entities/smart.contract.result.options"; - -@Resolver() -export class SmartContractResultQuery { - constructor(protected readonly smartContractResultService: SmartContractResultService) { } - - @Query(() => [SmartContractResult], { name: "results", description: "Retrieve all smart contract results for the given input." }) - public async getScResults(@Args("input", { description: "Input to retrieve the given smart contract results for." }) input: GetSmartContractResultInput): Promise { - return await this.smartContractResultService.getScResults( - new QueryPagination({ - from: input.from, - size: input.size, - }), - new SmartContractResultFilter({ - miniBlockHash: input.miniBlockHash, - originalTxHashes: input.originalTxHashes, - }), - new SmartContractResultOptions(), - ); - } - - @Query(() => Float, { name: "resultsCount", description: "Returns total number of smart contracts." }) - public async getScResultsCount(): Promise { - return await this.smartContractResultService.getScResultsCount(new SmartContractResultFilter()); - } - - @Query(() => SmartContractResult, { name: "result", description: "Retrieve the smart contract details for the given input.", nullable: true }) - public async getScResult(@Args("input", { description: "Input to retrieve the given smart contract for." }) input: GetSmartContractHashInput): Promise { - try { - return await this.smartContractResultService.getScResult(input.scHash); - } catch { - throw new NotFoundException('Smart contract not found'); - } - } -} diff --git a/src/graphql/entities/smart.contract.result/smart.contract.result.resolver.ts b/src/graphql/entities/smart.contract.result/smart.contract.result.resolver.ts deleted file mode 100644 index 72f5fe543..000000000 --- a/src/graphql/entities/smart.contract.result/smart.contract.result.resolver.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Parent, ResolveField, Resolver } from "@nestjs/graphql"; - -import { SmartContractResult } from "src/endpoints/sc-results/entities/smart.contract.result"; -import { SmartContractResultLoader } from "src/graphql/entities/smart.contract.result/smart.contract.result.loader"; -import { TransactionLog } from "src/endpoints/transactions/entities/transaction.log"; -@Resolver(() => SmartContractResult) -export class SmartContractResultResolver { - constructor(private readonly smartContractResultLoader: SmartContractResultLoader) { } - - @ResolveField("logs", () => TransactionLog, { name: "logs", description: "Transaction logs for the given smart contract result.", nullable: true }) - public async getSmartContractResultLog(@Parent() smartContractResult: SmartContractResult) { - return await this.smartContractResultLoader.getLog(smartContractResult.hash); - } -} diff --git a/src/graphql/entities/stake/stake.module.ts b/src/graphql/entities/stake/stake.module.ts deleted file mode 100644 index 9b179573e..000000000 --- a/src/graphql/entities/stake/stake.module.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Module } from "@nestjs/common"; -import { StakeModule as InternalStakeModule } from "src/endpoints/stake/stake.module"; -import { StakeResolver } from "./stake.resolver"; -@Module({ - imports: [InternalStakeModule], - providers: [StakeResolver], -}) -export class StakeModule { } diff --git a/src/graphql/entities/stake/stake.query.ts b/src/graphql/entities/stake/stake.query.ts deleted file mode 100644 index a50d4eb9e..000000000 --- a/src/graphql/entities/stake/stake.query.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Resolver, Query } from "@nestjs/graphql"; -import { GlobalStake } from "src/endpoints/stake/entities/global.stake"; -import { StakeService } from "src/endpoints/stake/stake.service"; - -@Resolver() -export class StakeQuery { - constructor(protected readonly stakeService: StakeService) { } - - @Query(() => GlobalStake, { name: "stake", description: "Retrieve general stake informations." }) - public async getGlobalStake(): Promise { - return await this.stakeService.getGlobalStake(); - } -} diff --git a/src/graphql/entities/stake/stake.resolver.ts b/src/graphql/entities/stake/stake.resolver.ts deleted file mode 100644 index cdf4c818e..000000000 --- a/src/graphql/entities/stake/stake.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { GlobalStake } from "src/endpoints/stake/entities/global.stake"; -import { StakeService } from "src/endpoints/stake/stake.service"; -import { StakeQuery } from "./stake.query"; - -@Resolver(() => GlobalStake) -export class StakeResolver extends StakeQuery { - constructor(stakeService: StakeService) { - super(stakeService); - } -} diff --git a/src/graphql/entities/tag/tag.input.ts b/src/graphql/entities/tag/tag.input.ts deleted file mode 100644 index 9858facdf..000000000 --- a/src/graphql/entities/tag/tag.input.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -@InputType({ description: "Input to retrieve the given tags for." }) -export class GetTagsInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of tags to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of tags to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - public static resolve(input: GetTagsInput): QueryPagination { - return { from: input.from, size: input.size }; - } -} diff --git a/src/graphql/entities/tag/tag.module.ts b/src/graphql/entities/tag/tag.module.ts deleted file mode 100644 index 81301a250..000000000 --- a/src/graphql/entities/tag/tag.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { TagModule as InternalTagModule } from "src/endpoints/nfttags/tag.module"; -import { TagResolver } from "./tag.resolver"; - -@Module({ - imports: [InternalTagModule], - providers: [TagResolver], -}) -export class TagModule { } diff --git a/src/graphql/entities/tag/tag.query.ts b/src/graphql/entities/tag/tag.query.ts deleted file mode 100644 index a8fcf544e..000000000 --- a/src/graphql/entities/tag/tag.query.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Args, Float, Resolver, Query } from "@nestjs/graphql"; -import { TagService } from "src/endpoints/nfttags/tag.service"; -import { Tag } from "src/endpoints/nfttags/entities/tag"; -import { GetTagsInput } from "./tag.input"; - -@Resolver() -export class TagQuery { - constructor(protected readonly tagService: TagService) { } - - @Query(() => [Tag], { name: "tags", description: "Retrieve all tags for the given input." }) - public async getTags(@Args("input", { description: "Input to retrieve the given tags for." }) input: GetTagsInput): Promise { - return await this.tagService.getNftTags(GetTagsInput.resolve(input)); - } - - @Query(() => Float, { name: "tagsCount", description: "Retrieve all tags count." }) - public async getTagsCount(): Promise { - return await this.tagService.getNftTagCount(); - } -} diff --git a/src/graphql/entities/tag/tag.resolver.ts b/src/graphql/entities/tag/tag.resolver.ts deleted file mode 100644 index e312f5447..000000000 --- a/src/graphql/entities/tag/tag.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { Tag } from "src/endpoints/nfttags/entities/tag"; -import { TagQuery } from "./tag.query"; -import { TagService } from "src/endpoints/nfttags/tag.service"; - -@Resolver(() => Tag) -export class TagResolver extends TagQuery { - constructor(tagServicce: TagService) { - super(tagServicce); - } -} diff --git a/src/graphql/entities/tokens/tokens.input.ts b/src/graphql/entities/tokens/tokens.input.ts deleted file mode 100644 index a0a79f59f..000000000 --- a/src/graphql/entities/tokens/tokens.input.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { Field, Float, ID, InputType } from "@nestjs/graphql"; -import { SortOrder } from "src/common/entities/sort.order"; -import { TokenFilter } from "src/endpoints/tokens/entities/token.filter"; -import { TokenSort } from "src/endpoints/tokens/entities/token.sort"; - -@InputType({ description: "Input to retreive the given tokens count for." }) -export class GetTokensCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "search", description: "Search filter for the given tokens set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => String, { name: "name", description: "Name filter for the given tokens set.", nullable: true }) - name: string | undefined = undefined; - - @Field(() => String, { name: "identifier", description: "Identifier filter for the given tokens set.", nullable: true }) - identifier: string | undefined = undefined; - - @Field(() => [String], { name: "identifiers", description: "Identifiers filter for the given tokens set.", nullable: true }) - identifiers: string[] | undefined = undefined; - - public static resolve(input: GetTokensCountInput): TokenFilter { - return new TokenFilter({ - search: input.search, - name: input.name, - identifier: input.identifier, - identifiers: input.identifiers, - }); - } -} - -@InputType({ description: "Input to retreive the given tokens count for." }) -export class GetTokensInput extends GetTokensCountInput { - constructor(partial?: Partial) { - super(); - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of tokens to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of tokens to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => TokenSort, { name: "sort", description: "Sort filter for the given tokens set.", nullable: true }) - sort: TokenSort | undefined = undefined; - - @Field(() => SortOrder, { name: "order", description: "Order filter for the given tokens set.", nullable: true }) - order: SortOrder | undefined = undefined; -} - -@InputType({ description: "Input to retrieve the given token for." }) -export class GetTokenInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => ID, { name: "identifier", description: "Identifier to retrieve the corresponding token for." }) - identifier: string = ""; - - public static resolve(input: GetTokenInput): string { - return input.identifier; - } -} - -@InputType({ description: "Input to retrieve the given token role address for." }) -export class GetTokenRolesForIdentifierAndAddressInput extends GetTokenInput { - constructor(partial?: Partial) { - super(); - Object.assign(this, partial); - } - - @Field(() => ID, { name: "address", description: "Address to retrieve the corresponding token roles for." }) - address: string = ""; -} - -@InputType({ description: "Input to retrieve the given token accounts for." }) -export class GetTokenAccountsInput extends GetTokenInput { - constructor(partial?: Partial) { - super(); - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of tokens to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of tokens to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; -} diff --git a/src/graphql/entities/tokens/tokens.module.ts b/src/graphql/entities/tokens/tokens.module.ts deleted file mode 100644 index 8c2280597..000000000 --- a/src/graphql/entities/tokens/tokens.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { TokenModule as InternalTokenModule } from "src/endpoints/tokens/token.module"; -import { TokenResolver } from "./tokens.resolver"; - -@Module({ - imports: [InternalTokenModule], - providers: [TokenResolver], -}) -export class TokenModule { } diff --git a/src/graphql/entities/tokens/tokens.query.ts b/src/graphql/entities/tokens/tokens.query.ts deleted file mode 100644 index f93a1d185..000000000 --- a/src/graphql/entities/tokens/tokens.query.ts +++ /dev/null @@ -1,103 +0,0 @@ -import { Args, Float, Query, Resolver } from "@nestjs/graphql"; -import { TokenService } from "src/endpoints/tokens/token.service"; -import { GetTokenAccountsInput, GetTokenInput, GetTokenRolesForIdentifierAndAddressInput, GetTokensCountInput, GetTokensInput } from "./tokens.input"; -import { TokenFilter } from "src/endpoints/tokens/entities/token.filter"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { TokenDetailed } from "src/endpoints/tokens/entities/token.detailed"; -import { NotFoundException } from "@nestjs/common"; -import { TokenSupplyResult } from "src/endpoints/tokens/entities/token.supply.result"; -import { TokenAccount } from "src/endpoints/tokens/entities/token.account"; -import { TokenRoles } from "src/endpoints/tokens/entities/token.roles"; - -@Resolver() -export class TokenQuery { - constructor(protected readonly tokenService: TokenService) { } - - @Query(() => Float, { name: "tokensCount", description: "Retrieve all tokens count for the given input." }) - public async getTokenCount(@Args("input", { description: "Input to retrieve the given count for." }) input: GetTokensCountInput): Promise { - return await this.tokenService.getTokenCount( - new TokenFilter({ - search: input.search, - name: input.name, - identifier: input.identifier, - identifiers: input.identifiers, - }), - ); - } - - @Query(() => Float, { name: "tokenAccountsCount", description: "Retrieve all token accounts count for the given input." }) - public async getTokenAccountsCount(@Args("input", { description: "Input to retrieve the given count for." }) input: GetTokenInput): Promise { - const token = await this.tokenService.getTokenAccountsCount(input.identifier); - - if (!token) { - throw new NotFoundException('Token not found'); - } - return token; - } - - @Query(() => [TokenDetailed], { name: "tokens", description: "Retrieve all tokens for the given input." }) - public async getTokens(@Args("input", { description: "Input to retrieve the given tokens for." }) input: GetTokensInput): Promise { - return await this.tokenService.getTokens( - new QueryPagination({ from: input.from, size: input.size }), - new TokenFilter({ - search: input.search, - name: input.name, - identifier: input.identifier, - identifiers: input.identifiers, - sort: input.sort, - order: input.order, - }) - ); - } - - @Query(() => TokenDetailed, { name: "token", description: "Retrieve token for the given input.", nullable: true }) - public async getToken(@Args("input", { description: "Input to retrieve the given token for." }) input: GetTokenInput): Promise { - const token = await this.tokenService.getToken(GetTokenInput.resolve(input)); - - if (!token) { - throw new NotFoundException('Token not found'); - } - return token; - } - - @Query(() => TokenSupplyResult, { name: "tokenSupply", description: "Retrieve token supply for the given input.", nullable: true }) - public async getTokenSupply(@Args("input", { description: "Input to retrieve the given token for." }) input: GetTokenInput): Promise { - const token = await this.tokenService.getTokenSupply(GetTokenInput.resolve(input)); - - if (!token) { - throw new NotFoundException('Token not found'); - } - return token; - } - - @Query(() => [TokenRoles], { name: "tokenRoles", description: "Retrieve token roles for the given input.", nullable: true }) - public async getTokenRoles(@Args("input", { description: "Input to retrieve the given token for." }) input: GetTokenInput): Promise { - const token = await this.tokenService.getTokenRoles(GetTokenInput.resolve(input)); - - if (!token) { - throw new NotFoundException('Token not found'); - } - return token; - } - - @Query(() => TokenRoles, { name: "tokenRolesAddress", description: "Retrieve token roles for the given input.", nullable: true }) - public async getTokenRolesForIdentifierAndAddress(@Args("input", { description: "Input to retrieve the given token for." }) input: GetTokenRolesForIdentifierAndAddressInput): Promise { - const token = await this.tokenService.getTokenRolesForIdentifierAndAddress(input.identifier, input.address); - - if (!token) { - throw new NotFoundException('Token not found'); - } - return token; - } - - @Query(() => [TokenAccount], { name: "tokenAccounts", description: "Retrieve token accounts for the given input.", nullable: true }) - public async getTokenAccounts(@Args("input", { description: "Input to retrieve the given token for." }) input: GetTokenAccountsInput): Promise { - const token = await this.tokenService.getTokenAccounts( - new QueryPagination({ from: input.from, size: input.size }), input.identifier); - - if (!token) { - throw new NotFoundException('Token not found'); - } - return token; - } -} diff --git a/src/graphql/entities/tokens/tokens.resolver.ts b/src/graphql/entities/tokens/tokens.resolver.ts deleted file mode 100644 index 2ec8ba26a..000000000 --- a/src/graphql/entities/tokens/tokens.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { TokenDetailed } from "src/endpoints/tokens/entities/token.detailed"; -import { TokenService } from "src/endpoints/tokens/token.service"; -import { TokenQuery } from "./tokens.query"; - -@Resolver(() => TokenDetailed) -export class TokenResolver extends TokenQuery { - constructor(tokenService: TokenService) { - super(tokenService); - } -} diff --git a/src/graphql/entities/transaction.detailed/transaction.detailed.input.ts b/src/graphql/entities/transaction.detailed/transaction.detailed.input.ts deleted file mode 100644 index cdaa259dd..000000000 --- a/src/graphql/entities/transaction.detailed/transaction.detailed.input.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; - -import { GetTransactionsCountInput } from "src/graphql/entities/transaction/transaction.input"; -import { SortOrder } from "src/common/entities/sort.order"; - -@InputType({ description: "Input to retrieve the given transactions for." }) -export class GetTransactionsInput extends GetTransactionsCountInput { - constructor(partial?: Partial) { - super(); - - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of transactions to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of transactions to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => SortOrder, { name: "condition", description: "Sort order for the given result set.", nullable: true }) - order: SortOrder | undefined = undefined; - - @Field(() => Boolean, { name: "withScamInfo", description: "Request scam info for the given result set.", nullable: true }) - withScamInfo: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withUsername", description: "Integrates username in assets for all addresses present in the result set.", nullable: true }) - withUsername: boolean | undefined = undefined; -} - -@InputType({ description: "Input to retrieve the given detailed transaction for." }) -export class GetTransactionDetailedInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "hash", description: "Hash to retrieve the corresponding detailed transaction for." }) - hash: string = ""; - - public static resolve(input: GetTransactionDetailedInput): string { - return input.hash; - } -} diff --git a/src/graphql/entities/transaction.detailed/transaction.detailed.loader.ts b/src/graphql/entities/transaction.detailed/transaction.detailed.loader.ts deleted file mode 100644 index a942fc9a1..000000000 --- a/src/graphql/entities/transaction.detailed/transaction.detailed.loader.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Injectable } from "@nestjs/common"; -import DataLoader from "dataloader"; -import { Account } from "src/endpoints/accounts/entities/account"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { SmartContractResult } from "src/endpoints/sc-results/entities/smart.contract.result"; -import { TransactionDetailed } from "src/endpoints/transactions/entities/transaction.detailed"; -import { TransactionLog } from "src/endpoints/transactions/entities/transaction.log"; -import { TransactionOperation } from "src/endpoints/transactions/entities/transaction.operation"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; - -@Injectable() -export class TransactionDetailedLoader { - constructor( - private readonly accountService: AccountService, - private readonly transactionService: TransactionService - ) { } - - public async getSmartContractResults(hash: string): Promise> { - return await this.smartContractResultsDataLoader.load(hash); - } - - public async getOperations(transaction: TransactionDetailed): Promise> { - return await this.operationsDataLoader.load(transaction); - } - - public async getLog(hash: string): Promise> { - return await this.logDataLoader.load(hash); - } - - private readonly smartContractResultsDataLoader: any = new DataLoader( - async hashes => await this.transactionService.getSmartContractResults(hashes.concat()), - { cache: false }, - ); - - private readonly operationsDataLoader: any = new DataLoader( - async txHashes => await this.transactionService.getOperations(txHashes.concat()), - { cache: false }, - ); - - private readonly logDataLoader: any = new DataLoader( - async hashes => await this.transactionService.getLogs(hashes.concat()), - { cache: false } - ); - - public async getAccount(address: string): Promise> { - return await this.accountDataLoader.load(address); - } - - private readonly accountDataLoader: any = new DataLoader(async addresses => { - const accounts = await this.accountService.getAccountsForAddresses(addresses.concat()); - - return addresses.concat().mapIndexed(accounts, account => account.address); - }, { cache: false }); -} diff --git a/src/graphql/entities/transaction.detailed/transaction.detailed.module.ts b/src/graphql/entities/transaction.detailed/transaction.detailed.module.ts deleted file mode 100644 index b4ff3121b..000000000 --- a/src/graphql/entities/transaction.detailed/transaction.detailed.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Module } from "@nestjs/common"; - -import { AccountModule } from "src/endpoints/accounts/account.module"; -import { TransactionDetailedResolver } from "src/graphql/entities/transaction.detailed/transaction.detailed.resolver"; -import { TransactionDetailedLoader } from "src/graphql/entities/transaction.detailed/transaction.detailed.loader"; -import { TransactionModule } from "src/endpoints/transactions/transaction.module"; - -@Module({ - imports: [AccountModule, TransactionModule], - providers: [TransactionDetailedLoader, TransactionDetailedResolver], -}) -export class TransactionDetailedModule {} diff --git a/src/graphql/entities/transaction.detailed/transaction.detailed.query.ts b/src/graphql/entities/transaction.detailed/transaction.detailed.query.ts deleted file mode 100644 index 3a41ea397..000000000 --- a/src/graphql/entities/transaction.detailed/transaction.detailed.query.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Args, Resolver, Query } from "@nestjs/graphql"; - -import { ApplyComplexity } from "@multiversx/sdk-nestjs-common"; - -import { GetTransactionDetailedInput, GetTransactionsInput } from "src/graphql/entities/transaction.detailed/transaction.detailed.input"; -import { Transaction } from "src/endpoints/transactions/entities/transaction"; -import { TransactionDetailed } from "src/endpoints/transactions/entities/transaction.detailed"; -import { TransactionFilter } from "src/endpoints/transactions/entities/transaction.filter"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { TransactionQueryOptions } from "src/endpoints/transactions/entities/transactions.query.options"; - -@Resolver() -export class TransactionDetailedQuery { - constructor(private readonly transactionService: TransactionService) { } - - @Query(() => [TransactionDetailed], { name: "transactions", description: "Retrieve all transactions available for the given input." }) - @ApplyComplexity({ target: TransactionDetailed }) - public async getTransactions(@Args("input", { description: "Input to retrieve the given transactions for." }) input: GetTransactionsInput): Promise { - const options = TransactionQueryOptions.applyDefaultOptions(input.size, { withScamInfo: input.withScamInfo, withUsername: input.withUsername }); - - return await this.transactionService.getTransactions( - new TransactionFilter({ - sender: input.sender, - receivers: input.receiver ? [input.receiver] : [], - token: input.token, - senderShard: input.senderShard, - receiverShard: input.receiverShard, - miniBlockHash: input.miniBlockHash, - hashes: input.hashes, - status: input.status, - functions: input.function, - before: input.before, - after: input.after, - condition: input.condition, - order: input.order, - }), - new QueryPagination({ from: input.from, size: input.size }), - options, - ); - } - - @Query(() => TransactionDetailed, { name: "transaction", description: "Retrieve the detailed transaction for the given input.", nullable: true }) - public async getTransactionDetailed(@Args("input", { description: "Input to retrieve the given detailed transaction for." }) input: GetTransactionDetailedInput): Promise { - return await this.transactionService.getTransaction(GetTransactionDetailedInput.resolve(input)); - } -} diff --git a/src/graphql/entities/transaction.detailed/transaction.detailed.resolver.ts b/src/graphql/entities/transaction.detailed/transaction.detailed.resolver.ts deleted file mode 100644 index 52acbf5cd..000000000 --- a/src/graphql/entities/transaction.detailed/transaction.detailed.resolver.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Parent, ResolveField, Resolver } from "@nestjs/graphql"; - -import { Account } from "src/endpoints/accounts/entities/account"; -import { SmartContractResult } from "src/endpoints/sc-results/entities/smart.contract.result"; -import { TransactionDetailed } from "src/endpoints/transactions/entities/transaction.detailed"; -import { TransactionDetailedQuery } from "src/graphql/entities/transaction.detailed/transaction.detailed.query"; -import { TransactionDetailedLoader } from "src/graphql/entities/transaction.detailed/transaction.detailed.loader"; -import { TransactionLog } from "src/endpoints/transactions/entities/transaction.log"; -import { TransactionOperation } from "src/endpoints/transactions/entities/transaction.operation"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; - -@Resolver(() => TransactionDetailed) -export class TransactionDetailedResolver extends TransactionDetailedQuery { - constructor( - private readonly transactionDetailedLoader: TransactionDetailedLoader, - transactionService: TransactionService - ) { - super(transactionService); - } - - @ResolveField("results", () => [SmartContractResult], { name: "results", description: "Smart contract results for the given detailed transaction.", nullable: true }) - public async getTransactionDetailedSmartContractResults(@Parent() transaction: TransactionDetailed) { - return await this.transactionDetailedLoader.getSmartContractResults(transaction.txHash); - } - - @ResolveField("operations", () => [TransactionOperation], { name: "operations", description: "Transaction operations for the given detailed transaction.", nullable: true }) - public async getTransactionDetailedOperations(@Parent() transaction: TransactionDetailed) { - return await this.transactionDetailedLoader.getOperations(transaction); - } - - @ResolveField("logs", () => TransactionLog, { name: "logs", description: "Transaction log for the given detailed transaction.", nullable: true }) - public async getTransactionDetailedLog(@Parent() transaction: TransactionDetailed) { - return await this.transactionDetailedLoader.getLog(transaction.txHash); - } - - @ResolveField("receiverAccount", () => Account, { name: "receiverAccount", description: "Receiver account for the given detailed transaction." }) - public async getTransactionReceiver(@Parent() transaction: TransactionDetailed) { - return await this.transactionDetailedLoader.getAccount(transaction.receiver); - } - - @ResolveField("senderAccount", () => Account, { name: "senderAccount", description: "Sender account for the given detailed transaction." }) - public async getTransactionSender(@Parent() transaction: TransactionDetailed) { - return await this.transactionDetailedLoader.getAccount(transaction.sender); - } -} diff --git a/src/graphql/entities/transaction/transaction.input.ts b/src/graphql/entities/transaction/transaction.input.ts deleted file mode 100644 index 3ac348c8c..000000000 --- a/src/graphql/entities/transaction/transaction.input.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { QueryConditionOptions } from "@multiversx/sdk-nestjs-elastic"; -import { Field, Float, InputType } from "@nestjs/graphql"; - -import { TransactionFilter } from "src/endpoints/transactions/entities/transaction.filter"; -import { TransactionStatus } from "src/endpoints/transactions/entities/transaction.status"; - -@InputType({ description: "Input to retrieve the given transactions count for." }) -export class GetTransactionsCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "sender", description: "Sender for the given result set.", nullable: true }) - sender: string | undefined = undefined; - - @Field(() => String, { name: "receiver", description: "Receiver for the given result set.", nullable: true }) - receiver: string | undefined = undefined; - - @Field(() => String, { name: "token", description: "Token identfier for the given result set.", nullable: true }) - token: string | undefined = undefined; - - @Field(() => Float, { name: "senderShard", description: "Sender shard for the given result set.", nullable: true }) - senderShard: number | undefined = undefined; - - @Field(() => Float, { name: "receiverShard", description: "Receiver shard for the given result set.", nullable: true }) - receiverShard: number | undefined = undefined; - - @Field(() => String, { name: "miniBlockHash", description: "Mini block hash for the given result set.", nullable: true }) - miniBlockHash: string | undefined = undefined; - - @Field(() => [String], { name: "hashes", description: "Filter by a comma-separated list of transaction hashes for the given result set.", nullable: true }) - hashes: Array | undefined = undefined; - - @Field(() => TransactionStatus, { name: "status", description: "Status of the transaction for the given result set.", nullable: true }) - status: TransactionStatus | undefined = undefined; - - @Field(() => String, { name: "search", description: "Search in data object for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => String, { name: "function", description: "Filter transactions by function name for the given result set.", nullable: true }) - function: Array | undefined = undefined; - - @Field(() => Float, { name: "before", description: "Before timestamp for the given result set.", nullable: true }) - before: number | undefined = undefined; - - @Field(() => Float, { name: "after", description: "After timestamp for the given result set.", nullable: true }) - after: number | undefined = undefined; - - @Field(() => String, { name: "condition", description: "Condition for ElasticSearch queries for the given result set.", nullable: true }) - condition: QueryConditionOptions | undefined = undefined; - - public static resolve(input: GetTransactionsCountInput): TransactionFilter { - return new TransactionFilter({ - sender: input.sender, - receivers: input.receiver ? [input.receiver] : [], - token: input.token, - senderShard: input.senderShard, - receiverShard: input.receiverShard, - miniBlockHash: input.miniBlockHash, - hashes: input.hashes, - status: input.status, - functions: input.function, - before: input.before, - after: input.after, - condition: input.condition, - }); - } -} diff --git a/src/graphql/entities/transaction/transaction.module.ts b/src/graphql/entities/transaction/transaction.module.ts deleted file mode 100644 index 6ba35a007..000000000 --- a/src/graphql/entities/transaction/transaction.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Module } from "@nestjs/common"; - -import { TransactionModule as InternalTransactionModule } from "src/endpoints/transactions/transaction.module"; -import { TransactionResolver } from "src/graphql/entities/transaction/transaction.resolver"; - -@Module({ - imports: [InternalTransactionModule], - providers: [TransactionResolver], -}) -export class TransactionModule {} diff --git a/src/graphql/entities/transaction/transaction.query.ts b/src/graphql/entities/transaction/transaction.query.ts deleted file mode 100644 index 3c324fb28..000000000 --- a/src/graphql/entities/transaction/transaction.query.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Args, Float, Resolver, Query } from "@nestjs/graphql"; - -import { GetTransactionsCountInput } from "src/graphql/entities/transaction/transaction.input"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; - -@Resolver() -export class TransactionQuery { - constructor(private readonly transactionService: TransactionService) {} - - @Query(() => Float, { name: "transactionsCount", description: "Retrieve all transactions count for the given input." }) - public async getTransactionsCount(@Args("input", { description: "Input to retrieve the given transactions count for." }) input: GetTransactionsCountInput): Promise { - return await this.transactionService.getTransactionCount(GetTransactionsCountInput.resolve(input)); - } -} diff --git a/src/graphql/entities/transaction/transaction.resolver.ts b/src/graphql/entities/transaction/transaction.resolver.ts deleted file mode 100644 index a122de0c1..000000000 --- a/src/graphql/entities/transaction/transaction.resolver.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; - -import { Transaction } from "src/endpoints/transactions/entities/transaction"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; -import { TransactionQuery } from "src/graphql/entities/transaction/transaction.query"; - -@Resolver(() => Transaction) -export class TransactionResolver extends TransactionQuery { - constructor(transactionService: TransactionService) { - super(transactionService); - } -} diff --git a/src/graphql/entities/transfers/transfers.input.ts b/src/graphql/entities/transfers/transfers.input.ts deleted file mode 100644 index 09f56f609..000000000 --- a/src/graphql/entities/transfers/transfers.input.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; -import { SortOrder } from "src/common/entities/sort.order"; -import { TransactionFilter } from "src/endpoints/transactions/entities/transaction.filter"; -import { TransactionStatus } from "src/endpoints/transactions/entities/transaction.status"; - -@InputType({ description: "Input to retrieve the given transfers count for." }) -export class GetTransfersCountInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "sender", description: "Sender for the given result set.", nullable: true }) - sender: string | undefined = undefined; - - @Field(() => String, { name: "receiver", description: "Receiver for the given result set.", nullable: true }) - receiver: string | undefined = undefined; - - @Field(() => String, { name: "token", description: "Token identfier for the given result set.", nullable: true }) - token: string | undefined = undefined; - - @Field(() => Float, { name: "senderShard", description: "Sender shard for the given result set.", nullable: true }) - senderShard: number | undefined = undefined; - - @Field(() => Float, { name: "receiverShard", description: "Receiver shard for the given result set.", nullable: true }) - receiverShard: number | undefined = undefined; - - @Field(() => String, { name: "miniBlockHash", description: "Mini block hash for the given result set.", nullable: true }) - miniBlockHash: string | undefined = undefined; - - @Field(() => [String], { name: "hashes", description: "Filter by a comma-separated list of transaction hashes for the given result set.", nullable: true }) - hashes: Array | undefined = undefined; - - @Field(() => TransactionStatus, { name: "status", description: "Status of the transaction for the given result set.", nullable: true }) - status: TransactionStatus | undefined = undefined; - - @Field(() => String, { name: "search", description: "Search in data object for the given result set.", nullable: true }) - search: string | undefined = undefined; - - @Field(() => Float, { name: "before", description: "Before timestamp for the given result set.", nullable: true }) - before: number | undefined = undefined; - - @Field(() => Float, { name: "after", description: "After timestamp for the given result set.", nullable: true }) - after: number | undefined = undefined; - - @Field(() => SortOrder, { name: "order", description: "SortOrder data transfers for the given result set.", nullable: true }) - order: SortOrder | undefined = undefined; - - public static resolve(input: GetTransfersCountInput): TransactionFilter { - return new TransactionFilter({ - sender: input.sender, - receivers: input.receiver ? [input.receiver] : [], - token: input.token, - senderShard: input.senderShard, - receiverShard: input.receiverShard, - miniBlockHash: input.miniBlockHash, - hashes: input.hashes, - status: input.status, - before: input.before, - after: input.after, - order: input.order, - }); - } -} -@InputType({ description: "Input to retrieve the given transfers for." }) -export class GetTransfersInput extends GetTransfersCountInput { - constructor(partial?: Partial) { - super(); - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of transfers to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of transfers to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - @Field(() => Boolean, { name: "withScamInfo", description: "Request scam info for the given result set.", nullable: true }) - withScamInfo: boolean | undefined = undefined; - - @Field(() => Boolean, { name: "withUsername", description: "Integrates username in assets for all addresses present in the result set.", nullable: true }) - withUsername: boolean | undefined = undefined; -} diff --git a/src/graphql/entities/transfers/transfers.module.ts b/src/graphql/entities/transfers/transfers.module.ts deleted file mode 100644 index 1e184721e..000000000 --- a/src/graphql/entities/transfers/transfers.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { TransferModule as InternalTransferModule } from "src/endpoints/transfers/transfer.module"; -import { TransferResolver } from "./transfers.resolver"; - -@Module({ - imports: [InternalTransferModule], - providers: [TransferResolver], -}) -export class TransferModule { } diff --git a/src/graphql/entities/transfers/transfers.query.ts b/src/graphql/entities/transfers/transfers.query.ts deleted file mode 100644 index 7138d97de..000000000 --- a/src/graphql/entities/transfers/transfers.query.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Args, Float, Query, Resolver } from "@nestjs/graphql"; -import { ApiConfigService } from "src/common/api-config/api.config.service"; -import { QueryPagination } from "src/common/entities/query.pagination"; -import { Transaction } from "src/endpoints/transactions/entities/transaction"; -import { TransactionFilter } from "src/endpoints/transactions/entities/transaction.filter"; -import { TransactionQueryOptions } from "src/endpoints/transactions/entities/transactions.query.options"; -import { TransferService } from "src/endpoints/transfers/transfer.service"; -import { GetTransfersCountInput, GetTransfersInput } from "./transfers.input"; - -@Resolver() -export class TransferQuery { - constructor( - protected readonly apiConfigService: ApiConfigService, - protected readonly transferService: TransferService, - ) { } - - @Query(() => [Transaction], { name: "transfers", description: "Retrieve all transfers for the given input." }) - public async getTransfers(@Args("input", { description: "Input to retreive the given transfers for." }) input: GetTransfersInput): Promise { - const options = TransactionQueryOptions.applyDefaultOptions(input.size, { withScamInfo: input.withScamInfo, withUsername: input.withUsername }); - - return await this.transferService.getTransfers( - new TransactionFilter({ - sender: input.sender, - token: input.token, - senderShard: input.senderShard, - receiverShard: input.receiverShard, - miniBlockHash: input.miniBlockHash, - hashes: input.hashes, - status: input.status, - before: input.before, - after: input.after, - }), - new QueryPagination({ from: input.from, size: input.size }), - options, - ); - } - - @Query(() => Float, { name: "transfersCount", description: "Retrieve all transfers count for the given input." }) - public async getTransfersCount(@Args("input", { description: "Input to retrieve the given transfers count for." }) input: GetTransfersCountInput): Promise { - return await this.transferService.getTransfersCount(GetTransfersCountInput.resolve(input)); - } -} diff --git a/src/graphql/entities/transfers/transfers.resolver.ts b/src/graphql/entities/transfers/transfers.resolver.ts deleted file mode 100644 index 015cb1e60..000000000 --- a/src/graphql/entities/transfers/transfers.resolver.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { ApiConfigService } from "src/common/api-config/api.config.service"; -import { Transaction } from "src/endpoints/transactions/entities/transaction"; -import { TransferService } from "src/endpoints/transfers/transfer.service"; -import { TransferQuery } from "./transfers.query"; - -@Resolver(() => Transaction) -export class TransferResolver extends TransferQuery { - constructor( - apiConfigService: ApiConfigService, - transferService: TransferService - ) { - super(apiConfigService, transferService); - } -} diff --git a/src/graphql/entities/username/username.input.ts b/src/graphql/entities/username/username.input.ts deleted file mode 100644 index fd471cdb5..000000000 --- a/src/graphql/entities/username/username.input.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Field, InputType } from "@nestjs/graphql"; - -@InputType({ description: "Input to retrieve the given account details for." }) -export class GetUsernameInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "username", description: "Username" }) - username: string = ""; - - public static resolve(input: GetUsernameInput): string { - return input.username; - } -} diff --git a/src/graphql/entities/username/username.module.ts b/src/graphql/entities/username/username.module.ts deleted file mode 100644 index e86d7a9a4..000000000 --- a/src/graphql/entities/username/username.module.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Module } from "@nestjs/common"; -import { UsernameResolver } from "./username.resolver"; -import { UsernameModule as InternalUsernameModule } from "src/endpoints/usernames/username.module"; -import { AccountModule } from "src/endpoints/accounts/account.module"; - -@Module({ - imports: [InternalUsernameModule, AccountModule], - providers: [UsernameResolver], -}) -export class UsernameModule { } diff --git a/src/graphql/entities/username/username.query.ts b/src/graphql/entities/username/username.query.ts deleted file mode 100644 index d989972e2..000000000 --- a/src/graphql/entities/username/username.query.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Args, Resolver, Query } from "@nestjs/graphql"; -import { AccountUsername } from "src/endpoints/usernames/entities/account.username"; -import { GetUsernameInput } from "./username.input"; -import { UsernameService } from "src/endpoints/usernames/username.service"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { NotFoundException } from "@nestjs/common"; - -@Resolver() -export class UsernameQuery { - constructor( - protected readonly usernameAccount: UsernameService, - protected readonly accountService: AccountService, - ) { } - - @Query(() => AccountUsername, { name: "username", description: "Retrieve account detailed for a given username" }) - public async getAccountDetailed(@Args("input", { description: "Input to retrieve the given detailed account for." }) input: GetUsernameInput): Promise { - const address = await this.usernameAccount.getAddressForUsername(GetUsernameInput.resolve(input)); - - if (!address) { - throw new NotFoundException('Address not found'); - } - - return this.accountService.getAccountSimple(address); - } -} diff --git a/src/graphql/entities/username/username.resolver.ts b/src/graphql/entities/username/username.resolver.ts deleted file mode 100644 index fd69ba900..000000000 --- a/src/graphql/entities/username/username.resolver.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { UsernameQuery } from "./username.query"; -import { AccountUsername } from "src/endpoints/usernames/entities/account.username"; -import { UsernameService } from "src/endpoints/usernames/username.service"; -import { AccountService } from "src/endpoints/accounts/account.service"; - -@Resolver(() => AccountUsername) -export class UsernameResolver extends UsernameQuery { - constructor( - usernameAccount: UsernameService, - accountService: AccountService) { - super(usernameAccount, accountService); - } -} diff --git a/src/graphql/entities/waiting.list/waiting.list.input.ts b/src/graphql/entities/waiting.list/waiting.list.input.ts deleted file mode 100644 index deed5f665..000000000 --- a/src/graphql/entities/waiting.list/waiting.list.input.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -@InputType({ description: "Input to retrieve the given waiting-list for." }) -export class GetWaitingListInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of waiting-list to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of waiting-list to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - public static resolve(input: GetWaitingListInput): QueryPagination { - return { from: input.from, size: input.size }; - } -} diff --git a/src/graphql/entities/waiting.list/waiting.list.module.ts b/src/graphql/entities/waiting.list/waiting.list.module.ts deleted file mode 100644 index 40ccaec50..000000000 --- a/src/graphql/entities/waiting.list/waiting.list.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { WaitingListModule as InternalWaitingListModule } from "src/endpoints/waiting-list/waiting.list.module"; -import { WaitingListResolver } from "./waiting.list.resolver"; - -@Module({ - imports: [InternalWaitingListModule], - providers: [WaitingListResolver], -}) -export class WaitingListModule { } diff --git a/src/graphql/entities/waiting.list/waiting.list.query.ts b/src/graphql/entities/waiting.list/waiting.list.query.ts deleted file mode 100644 index 182d74c3c..000000000 --- a/src/graphql/entities/waiting.list/waiting.list.query.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Float, Resolver, Query, Args } from "@nestjs/graphql"; -import { WaitingList } from "src/endpoints/waiting-list/entities/waiting.list"; -import { WaitingListService } from "src/endpoints/waiting-list/waiting.list.service"; -import { GetWaitingListInput } from "./waiting.list.input"; - - -@Resolver() -export class WaitingListQuery { - constructor(protected readonly waitingListService: WaitingListService) { } - - @Query(() => [WaitingList], { name: "waitingList", description: "Retrieve all address that are in waiting." }) - public async getWaitingList(@Args("input", { description: "Input to retrieve the given waiting accounts for." }) input: GetWaitingListInput): Promise { - return await this.waitingListService.getWaitingList(GetWaitingListInput.resolve(input)); - } - - @Query(() => Float, { name: "waitingListCount", description: "Retrieve all addresses count that are in waiting." }) - public async getWaitingListCount(): Promise { - return await this.waitingListService.getWaitingListCount(); - } -} diff --git a/src/graphql/entities/waiting.list/waiting.list.resolver.ts b/src/graphql/entities/waiting.list/waiting.list.resolver.ts deleted file mode 100644 index 464056e7c..000000000 --- a/src/graphql/entities/waiting.list/waiting.list.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { WaitingList } from "src/endpoints/waiting-list/entities/waiting.list"; -import { WaitingListQuery } from "./waiting.list.query"; -import { WaitingListService } from "src/endpoints/waiting-list/waiting.list.service"; - -@Resolver(() => WaitingList) -export class WaitingListResolver extends WaitingListQuery { - constructor(waitingListService: WaitingListService) { - super(waitingListService); - } -} diff --git a/src/graphql/entities/web.socket/web.socket.module.ts b/src/graphql/entities/web.socket/web.socket.module.ts deleted file mode 100644 index d5592dd1d..000000000 --- a/src/graphql/entities/web.socket/web.socket.module.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Module } from "@nestjs/common"; -import { WebsocketModule as InternalWebsocketModule } from "src/endpoints/websocket/websocket.module"; -import { WebsocketConfigResolver } from "./web.socket.resolver"; - -@Module({ - imports: [InternalWebsocketModule], - providers: [WebsocketConfigResolver], -}) -export class WebsocketModule { } diff --git a/src/graphql/entities/web.socket/web.socket.query.ts b/src/graphql/entities/web.socket/web.socket.query.ts deleted file mode 100644 index bae5b0c72..000000000 --- a/src/graphql/entities/web.socket/web.socket.query.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Resolver, Query } from "@nestjs/graphql"; -import { WebsocketConfig } from "src/endpoints/websocket/entities/websocket.config"; -import { WebsocketService } from "src/endpoints/websocket/websocket.service"; - -@Resolver() -export class WebsocketConfigQuery { - constructor(protected readonly websocketService: WebsocketService) { } - - @Query(() => WebsocketConfig, { name: "webSocketConfig", description: "Retrieve config used for accessing websocket on the same cluster." }) - public getSocketUrl(): WebsocketConfig { - return this.websocketService.getConfiguration(); - } -} diff --git a/src/graphql/entities/web.socket/web.socket.resolver.ts b/src/graphql/entities/web.socket/web.socket.resolver.ts deleted file mode 100644 index 3ebd06054..000000000 --- a/src/graphql/entities/web.socket/web.socket.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { WebsocketConfig } from "src/endpoints/websocket/entities/websocket.config"; -import { WebsocketService } from "src/endpoints/websocket/websocket.service"; -import { WebsocketConfigQuery } from "./web.socket.query"; - -@Resolver(() => WebsocketConfig) -export class WebsocketConfigResolver extends WebsocketConfigQuery { - constructor(websocketService: WebsocketService) { - super(websocketService); - } -} diff --git a/src/graphql/entities/xexchange/mex.economics/mex.economics.query.ts b/src/graphql/entities/xexchange/mex.economics/mex.economics.query.ts deleted file mode 100644 index 9411a762c..000000000 --- a/src/graphql/entities/xexchange/mex.economics/mex.economics.query.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Resolver, Query } from "@nestjs/graphql"; -import { MexEconomics } from "src/endpoints/mex/entities/mex.economics"; -import { MexEconomicsService } from "src/endpoints/mex/mex.economics.service"; - -@Resolver() -export class MexEconomicsQuery { - constructor(protected readonly mexEconomicsService: MexEconomicsService) { } - - @Query(() => MexEconomics, { name: "mexEconomics", description: "Retrieve economics details of xExchange." }) - public async getMexEconomics(): Promise { - return await this.mexEconomicsService.getMexEconomics(); - } -} diff --git a/src/graphql/entities/xexchange/mex.economics/mex.economics.resolver.ts b/src/graphql/entities/xexchange/mex.economics/mex.economics.resolver.ts deleted file mode 100644 index 8bbc49ad6..000000000 --- a/src/graphql/entities/xexchange/mex.economics/mex.economics.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { MexEconomics } from "src/endpoints/mex/entities/mex.economics"; -import { MexEconomicsService } from "src/endpoints/mex/mex.economics.service"; -import { MexEconomicsQuery } from "./mex.economics.query"; - -@Resolver(() => MexEconomics) -export class MexEconomicsResolver extends MexEconomicsQuery { - constructor(mexEconomicsService: MexEconomicsService) { - super(mexEconomicsService); - } -} diff --git a/src/graphql/entities/xexchange/mex.farms/mex.farms.input.ts b/src/graphql/entities/xexchange/mex.farms/mex.farms.input.ts deleted file mode 100644 index aa1726c1c..000000000 --- a/src/graphql/entities/xexchange/mex.farms/mex.farms.input.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -@InputType({ description: "Input to retrieve the given mex farms for." }) -export class GetMexFarmsInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of mex farms to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of mex farms to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - public static resolve(input: GetMexFarmsInput): QueryPagination { - return { from: input.from, size: input.size }; - } -} - diff --git a/src/graphql/entities/xexchange/mex.farms/mex.farms.query.ts b/src/graphql/entities/xexchange/mex.farms/mex.farms.query.ts deleted file mode 100644 index 4650fe0de..000000000 --- a/src/graphql/entities/xexchange/mex.farms/mex.farms.query.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Args, Resolver, Query } from "@nestjs/graphql"; -import { MexFarm } from "src/endpoints/mex/entities/mex.farm"; -import { MexFarmService } from "src/endpoints/mex/mex.farm.service"; -import { GetMexFarmsInput } from "./mex.farms.input"; - -@Resolver() -export class MexFarmsQuery { - constructor(protected readonly mexFarmsService: MexFarmService) { } - - @Query(() => [MexFarm], { name: "mexFarms", description: "Retrieve a list of farms listed on xExchange." }) - public async getMexFarms(@Args("input", { description: "Input to retrieve the given farms for." }) input: GetMexFarmsInput): Promise { - return await this.mexFarmsService.getMexFarms(GetMexFarmsInput.resolve(input)); - } -} diff --git a/src/graphql/entities/xexchange/mex.farms/mex.farms.resolver.ts b/src/graphql/entities/xexchange/mex.farms/mex.farms.resolver.ts deleted file mode 100644 index 7ab18c641..000000000 --- a/src/graphql/entities/xexchange/mex.farms/mex.farms.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { MexFarm } from "src/endpoints/mex/entities/mex.farm"; -import { MexFarmService } from "src/endpoints/mex/mex.farm.service"; -import { MexFarmsQuery } from "./mex.farms.query"; - -@Resolver(() => MexFarm) -export class MexFarmResolver extends MexFarmsQuery { - constructor(mexFarmsService: MexFarmService) { - super(mexFarmsService); - } -} diff --git a/src/graphql/entities/xexchange/mex.pairs/mex.pairs.input.ts b/src/graphql/entities/xexchange/mex.pairs/mex.pairs.input.ts deleted file mode 100644 index 0e258855f..000000000 --- a/src/graphql/entities/xexchange/mex.pairs/mex.pairs.input.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Field, Float, InputType } from "@nestjs/graphql"; - -@InputType({ description: "Input to retrieve the given mex tokens pairs for." }) -export class GetMexTokenPairsInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of mex tokens pair to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of mex tokens pair to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - public static resolve(input: GetMexTokenPairsInput): number { - return input.from, input.size; - } -} - -@InputType({ description: "Input to retrieve the given mex tokens pairs by quote and baseId for." }) -export class GetMexTokenPairsByQuotePairIdInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => String, { name: "baseId", description: "Number of mex tokens pair to skip for the given result set." }) - baseId!: string; - - @Field(() => String, { name: "quoteId", description: "Number of mex tokens pair to retrieve for the given result set." }) - quoteId!: string; - - public static resolve(input: GetMexTokenPairsByQuotePairIdInput): any { - return input.baseId, input.quoteId; - } -} - - - diff --git a/src/graphql/entities/xexchange/mex.pairs/mex.pairs.query.ts b/src/graphql/entities/xexchange/mex.pairs/mex.pairs.query.ts deleted file mode 100644 index d31b065ce..000000000 --- a/src/graphql/entities/xexchange/mex.pairs/mex.pairs.query.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { NotFoundException } from "@nestjs/common"; -import { Args, Resolver, Query } from "@nestjs/graphql"; -import { MexPair } from "src/endpoints/mex/entities/mex.pair"; -import { MexPairService } from "src/endpoints/mex/mex.pair.service"; -import { GetMexTokenPairsByQuotePairIdInput, GetMexTokenPairsInput } from "./mex.pairs.input"; - -@Resolver() -export class MexTokenPairsQuery { - constructor(protected readonly mexTokenPairService: MexPairService) { } - - @Query(() => [MexPair], { name: "mexPairs", description: "Retrieve all mex token pairs listed on xExchange for the given input." }) - public async getMexPairs(@Args("input", { description: "Input to retrieve the given tokens for." }) input: GetMexTokenPairsInput): Promise { - return await this.mexTokenPairService.getMexPairs(input.from, input.size); - } - - @Query(() => MexPair, { name: "mexPair", description: "Retrieve one mex pair listed on xExchange for the given input." }) - public async getMexPair(@Args("input", { description: "Input to retrieve the given tokens mex pair for." }) input: GetMexTokenPairsByQuotePairIdInput): Promise { - const mexPair = await this.mexTokenPairService.getMexPair(input.baseId, input.quoteId); - - if (!mexPair) { - throw new NotFoundException('Mex pair not found'); - } - - return mexPair; - } -} diff --git a/src/graphql/entities/xexchange/mex.pairs/mex.pairs.resolver.ts b/src/graphql/entities/xexchange/mex.pairs/mex.pairs.resolver.ts deleted file mode 100644 index 2035ba197..000000000 --- a/src/graphql/entities/xexchange/mex.pairs/mex.pairs.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { MexPair } from "src/endpoints/mex/entities/mex.pair"; -import { MexPairService } from "src/endpoints/mex/mex.pair.service"; -import { MexTokenPairsQuery } from "./mex.pairs.query"; - -@Resolver(() => MexPair) -export class MexTokenPairsResolver extends MexTokenPairsQuery { - constructor(mexTokenPairService: MexPairService) { - super(mexTokenPairService); - } -} diff --git a/src/graphql/entities/xexchange/mex.token.module.ts b/src/graphql/entities/xexchange/mex.token.module.ts deleted file mode 100644 index 049fa82c8..000000000 --- a/src/graphql/entities/xexchange/mex.token.module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Module } from "@nestjs/common"; -import { MexModule } from "src/endpoints/mex/mex.module"; -import { MexEconomicsResolver } from "./mex.economics/mex.economics.resolver"; -import { MexFarmResolver } from "./mex.farms/mex.farms.resolver"; -import { MexTokenPairsResolver } from "./mex.pairs/mex.pairs.resolver"; -import { MexTokenResolver } from "./mex.token/mex.token.resolver"; -@Module({ - imports: [MexModule.forRoot()], - providers: [ - MexTokenResolver, - MexEconomicsResolver, - MexTokenPairsResolver, - MexFarmResolver, - ], -}) -export class MexTokenModule { } diff --git a/src/graphql/entities/xexchange/mex.token/mex.token.input.ts b/src/graphql/entities/xexchange/mex.token/mex.token.input.ts deleted file mode 100644 index c52ae7902..000000000 --- a/src/graphql/entities/xexchange/mex.token/mex.token.input.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Field, Float, ID, InputType } from "@nestjs/graphql"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -@InputType({ description: "Input to retrieve the given mex tokens for." }) -export class GetMexTokensInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => Float, { name: "from", description: "Number of mex tokens to skip for the given result set.", nullable: true, defaultValue: 0 }) - from: number = 0; - - @Field(() => Float, { name: "size", description: "Number of mex tokens to retrieve for the given result set.", nullable: true, defaultValue: 25 }) - size: number = 25; - - public static resolve(input: GetMexTokensInput): QueryPagination { - return { from: input.from, size: input.size }; - } -} - -@InputType({ description: "Input to retrieve the given mex token for." }) -export class GetMexTokenInput { - constructor(partial?: Partial) { - Object.assign(this, partial); - } - - @Field(() => ID, { name: "id", description: "Identifier to retrieve the corresponding mex token for." }) - id: string = ""; - - public static resolve(input: GetMexTokenInput): string { - return input.id; - } -} diff --git a/src/graphql/entities/xexchange/mex.token/mex.token.query.ts b/src/graphql/entities/xexchange/mex.token/mex.token.query.ts deleted file mode 100644 index fade13922..000000000 --- a/src/graphql/entities/xexchange/mex.token/mex.token.query.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { NotFoundException } from "@nestjs/common"; -import { Args, Resolver, Query } from "@nestjs/graphql"; -import { MexToken } from "src/endpoints/mex/entities/mex.token"; -import { MexTokenService } from "src/endpoints/mex/mex.token.service"; -import { GetMexTokenInput, GetMexTokensInput } from "./mex.token.input"; - -@Resolver() -export class MexTokensQuery { - constructor(protected readonly mexTokenService: MexTokenService) { } - - @Query(() => [MexToken], { name: "mexTokens", description: "Retrieve all tokens listed on xExchange for the given input." }) - public async getMexTokens(@Args("input", { description: "Input to retrieve the given tokens for." }) input: GetMexTokensInput): Promise { - return await this.mexTokenService.getMexTokens(GetMexTokensInput.resolve(input)); - } - - @Query(() => MexToken, { name: "mexToken", description: "Retrieve the mex token for the given input.", nullable: true }) - public async getNft(@Args("input", { description: "Input to retrieve the given NFT for." }) input: GetMexTokenInput): Promise { - const token = await this.mexTokenService.getMexTokenByIdentifier(GetMexTokenInput.resolve(input)); - - if (!token) { - throw new NotFoundException('Mex token not found'); - } - return token; - } -} diff --git a/src/graphql/entities/xexchange/mex.token/mex.token.resolver.ts b/src/graphql/entities/xexchange/mex.token/mex.token.resolver.ts deleted file mode 100644 index ccc75ab24..000000000 --- a/src/graphql/entities/xexchange/mex.token/mex.token.resolver.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Resolver } from "@nestjs/graphql"; -import { MexToken } from "src/endpoints/mex/entities/mex.token"; -import { MexTokenService } from "src/endpoints/mex/mex.token.service"; -import { MexTokensQuery } from "./mex.token.query"; - -@Resolver(() => MexToken) -export class MexTokenResolver extends MexTokensQuery { - constructor(mexTokenService: MexTokenService) { - super(mexTokenService); - } -} diff --git a/src/graphql/graphql.module.ts b/src/graphql/graphql.module.ts deleted file mode 100644 index ee5aa0598..000000000 --- a/src/graphql/graphql.module.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { ApolloDriver, ApolloDriverConfig } from "@nestjs/apollo"; -import { DynamicModule, Module } from "@nestjs/common"; -import { GraphQLModule } from "@nestjs/graphql"; - -import configuration from "config/configuration"; - -import { join } from "path"; -import { GraphQLServicesModule } from "./entities/graphql.services.module"; - -@Module({}) -export class GraphQlModule { - static register(): DynamicModule { - const module: DynamicModule = { - module: GraphQlModule, - imports: [], - }; - - const isGraphqlActive = configuration().api?.graphql ?? false; - if (isGraphqlActive) { - module.imports = [ - GraphQLModule.forRoot({ - autoSchemaFile: join(process.cwd(), "src/graphql/schema/schema.gql"), - driver: ApolloDriver, - fieldResolverEnhancers: ["interceptors"], - sortSchema: true, - }), - GraphQLServicesModule, - ]; - } - - return module; - } -} diff --git a/src/graphql/interceptors/graphql.complexity.interceptor.ts b/src/graphql/interceptors/graphql.complexity.interceptor.ts deleted file mode 100644 index 8e96a084a..000000000 --- a/src/graphql/interceptors/graphql.complexity.interceptor.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from "@nestjs/common"; -import { GqlExecutionContext } from "@nestjs/graphql"; - -import { ApplyComplexityOptions, ComplexityExceededException, ComplexityUtils, DecoratorUtils } from "@multiversx/sdk-nestjs-common"; - -import { fieldsList } from "graphql-fields-list"; -import { Observable } from "rxjs"; - -@Injectable() -export class GraphqlComplexityInterceptor implements NestInterceptor { - private readonly complexityThreshold: number = 10000; - - intercept(context: ExecutionContext, next: CallHandler): Observable { - const complexityMetadata = DecoratorUtils.getMethodDecorator(ApplyComplexityOptions, context.getHandler()); - if (!complexityMetadata) { - return next.handle(); - } - - const contextType: string = context.getType(); - - if (["graphql"].includes(contextType)) { - this.handleGraphQlRequest(complexityMetadata.target, context); - } - - return next.handle(); - } - - private handleGraphQlRequest(target: any, context: ExecutionContext) { - const fields: string[] = fieldsList(GqlExecutionContext.create(context).getInfo()); - const size: number = context.getArgByIndex(1).input?.size ?? 1; - - const previousComplexity = GqlExecutionContext.create(context).getInfo().variableValues?.complexity; - const processed = previousComplexity?.processed ?? []; - - if (processed.find((name: string) => name === `${target.name}-${size}-${fields.toString()}`)) { - // special case for resolvers since they get called a bunch of times for one given query. - return; - } - - const complexityTree = ComplexityUtils.updateComplexityTree(previousComplexity, target, fields, size); - - const complexity = complexityTree.getComplexity(); - if (complexity > this.complexityThreshold) { - throw new ComplexityExceededException(complexity, this.complexityThreshold); - } - - processed.push(`${target.name}-${size}-${fields.toString()}`); - - GqlExecutionContext.create(context).getInfo().variableValues.complexity = { - processed: processed, - tree: complexityTree, - }; - - context.switchToHttp().getNext().req.res.set("X-Request-Complexity", complexity); - } -} diff --git a/src/graphql/interceptors/graphql.metrics.interceptor.ts b/src/graphql/interceptors/graphql.metrics.interceptor.ts deleted file mode 100644 index 55759a55d..000000000 --- a/src/graphql/interceptors/graphql.metrics.interceptor.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { PerformanceProfiler } from '@multiversx/sdk-nestjs-monitoring'; -import { - Injectable, - NestInterceptor, - ExecutionContext, - CallHandler, -} from '@nestjs/common'; -import { EventEmitter2 } from '@nestjs/event-emitter'; -import { GqlContextType, GqlExecutionContext } from '@nestjs/graphql'; -import { Observable } from 'rxjs'; -import { tap } from 'rxjs/operators'; -import { MetricsEvents } from 'src/utils/metrics-events.constants'; -import { LogMetricsEvent } from 'src/common/entities/log.metrics.event'; - -@Injectable() -export class GraphQLMetricsInterceptor implements NestInterceptor { - - constructor(private readonly eventEmitter: EventEmitter2) { } - - intercept(context: ExecutionContext, next: CallHandler): Observable { - if (context.getType() === 'graphql') { - const gqlContext = GqlExecutionContext.create(context); - const info = gqlContext.getInfo(); - const parentType = info.parentType.name; - const fieldName = info.fieldName; - - const profiler = new PerformanceProfiler(); - return next.handle().pipe( - tap(() => { - profiler.stop(); - - if (parentType === 'Query') { - const metricsEvent = new LogMetricsEvent(); - metricsEvent.args = [fieldName, profiler.duration]; - - this.eventEmitter.emit( - MetricsEvents.SetGraphqlDuration, - metricsEvent - ); - } - }), - ); - } - return next.handle(); - } -} diff --git a/src/graphql/schema/schema.gql b/src/graphql/schema/schema.gql deleted file mode 100644 index 16071b96d..000000000 --- a/src/graphql/schema/schema.gql +++ /dev/null @@ -1,4527 +0,0 @@ -# ------------------------------------------------------ -# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) -# ------------------------------------------------------ - -"""About object type.""" -type About { - """Application Version details.""" - appVersion: String! - - """Deployment cluster.""" - cluster: String! - - """Feature Flags.""" - features: FeatureConfigs - - """Gateway version.""" - gatewayVersion: String - - """Indexer version.""" - indexerVersion: String - - """Current network details.""" - network: String! - - """Plugins Version details.""" - pluginsVersion: String! - - """Scam engine version.""" - scamEngineVersion: String - - """API deployment version.""" - version: String! -} - -"""Account object type.""" -type Account { - """Address for the given account.""" - address: ID! - - """Account assets for the given account.""" - assets: AccountAssets - - """Balance for the given account.""" - balance: String! - - """DeployTxHash for the given detailed account.""" - deployTxHash: String - - """Deployment timestamp for the given detailed account.""" - deployedAt: Float - - """If the given detailed account is verified.""" - isVerified: Boolean - - """Nonce for the given account.""" - nonce: Float! - - """Current owner address.""" - ownerAddress: String! - - """Owner Account Address assets details.""" - ownerAssets: AccountAssets - - """Smart contract results count for the given detailed account.""" - scrCount: Float! - - """Shard for the given account.""" - shard: Float! - - """Timestamp of the block where the account was first indexed.""" - timestamp: Float! - - """Transfers in the last 24 hours.""" - transfersLast24h: Float! - - """Transactions count for the given detailed account.""" - txCount: Float! -} - -"""Account assets object type.""" -type AccountAssets { - """Description for the given account asset.""" - description: String! - - """Icon for the given account asset.""" - icon: String - - """Icon PNG for the given account asset.""" - iconPng: String - - """Icon SVG for the given account asset.""" - iconSvg: String - - """Name for the given account asset.""" - name: String! - - """Proof for the given account asset.""" - proof: String - - """Social for the given account asset.""" - social: String! - - """Tags list for the given account asset.""" - tags: [String!]! -} - -"""Account delegation object type that extends Account.""" -type AccountDelegation { - """Address for the given detailed account.""" - address: String! - - """Claimable Rewards for the given detailed account.""" - claimableRewards: String! - - """Contract for the given detailed account.""" - contract: String! - - """UserActiveStake for the given detailed account.""" - userActiveStake: String! - - """UserUnBondable for the given detailed account.""" - userUnBondable: String! - - """UserUndelegatedList for the given detailed account.""" - userUndelegatedList: AccountUndelegation! -} - -"""Account delegation legacy.""" -type AccountDelegationLegacy { - """Claimable rewards for the given detailed account.""" - claimableRewards: String! - - """User active stake for the given detailed account.""" - userActiveStake: String! - - """User deferred payment stake for the given detailed account.""" - userDeferredPaymentStake: String! - - """User unstaked stake for the given detailed account.""" - userUnstakedStake: String! - - """User waiting stake for the given detailed account.""" - userWaitingStake: String! - - """User withdraw only stake for the given detailed account.""" - userWithdrawOnlyStake: String! -} - -"""Detailed Account object type that extends Account.""" -type AccountDetailed { - """Address for the given account.""" - address: ID! - - """Account assets for the given account.""" - assets: AccountAssets - - """Balance for the given account.""" - balance: String! - - """Code for the given detailed account.""" - code: String! - - """Code hash for the given detailed account.""" - codeHash: String - - """ - Summarizes all delegation positions with staking providers, together with unDelegation positions for the givven detailed account. - """ - delegation: [AccountDelegation!]! - - """Returns staking information related to the legacy delegation pool.""" - delegationLegacy: AccountDelegationLegacy! - - """Contracts count for the given detailed account.""" - deployAccountCount: Float! - - """DeployTxHash for the given detailed account.""" - deployTxHash: String - - """Deployment timestamp for the given detailed account.""" - deployedAt: Float - - """Deploys for the given detailed account.""" - deploysAccount( - """Input to retrieve the given deploys for.""" - input: GetFromAndSizeInput! - ): [DeployedContract!] - - """Developer reward for the given detailed account.""" - developerReward: String! - - """Return account EGLD balance history.""" - historyAccount( - """Input to retrieve the given EGLD balance history for.""" - input: GetAccountHistory! - ): [AccountHistory!]! - - """Return account balance history for a specifc token.""" - historyTokenAccount( - """Input to retrieve the given token history for.""" - input: GetHistoryTokenAccountInput! - ): [AccountEsdtHistory!]! - - """If the given detailed account is payable.""" - isPayable: Boolean - - """If the given detailed account is payable by smart contract.""" - isPayableBySmartContract: Boolean - - """If the given detailed account is readable.""" - isReadable: Boolean - - """If the given detailed account is upgradeable.""" - isUpgradeable: Boolean - - """If the given detailed account is verified.""" - isVerified: Boolean - - """Returns all nodes in the node queue where the account is owner.""" - keys: [AccountKey!]! - - """NFT collections for the given detailed account.""" - nftCollections( - """Input to retrieve the given NFT collections for.""" - input: GetNftCollectionsAccountInput! - ): [NftCollectionAccountFlat!] - - """NFTs for the given detailed account.""" - nfts( - """Input to retrieve the given NFTs for.""" - input: GetNftsAccountInput! - ): [NftAccountFlat!] - - """Nonce for the given account.""" - nonce: Float! - - """Owner address for the given detailed account.""" - ownerAddress: String! - - """Owner Account Address assets details.""" - ownerAssets: AccountAssets - - """ - Returns smart contract results where the account is sender or receiver. - """ - resultsAccount( - """Input to retrieve the given sc results for.""" - input: GetFromAndSizeInput! - ): [SmartContractResult!]! - - """ - Returns smart contract results count where the account is sender or receiver. - """ - resultsAccountCount: Float! - - """Root hash for the given detailed account.""" - rootHash: String - - """Scam information for the given detailed account.""" - scamInfo: ScamInformation - - """Smart contracts count for the given detailed account.""" - scrCount: Float! - - """Shard for the given account.""" - shard: Float! - - """ - Summarizes total staked amount for the given provider, as well as when and how much unbond will be performed. - """ - stake: ProviderStake! - - """Timestamp of the block where the account was first indexed.""" - timestamp: Float! - - """Tokens for the given detailed account.""" - tokensAccount( - """Input to retrieve the given tokens for.""" - input: GetTokensAccountInput! - ): [TokenWithBalanceAccountFlat!] - - """Transactions for the given detailed account.""" - transactionsAccount( - """Input to retrieve the given transactions for.""" - input: GetTransactionsAccountInput! - ): [Transaction!] - - """Transactions count for the given detailed account.""" - transactionsAccountCount( - """Input to retrieve the given transctions count for.""" - input: GetTransactionsAccountCountInput! - ): Float - - """ - Returns both transfers triggerred by a user account (type = Transaction), as well as transfers triggerred by smart contracts (type = SmartContractResult), thus providing a full picture of all in/out value transfers for a given account. - """ - transfersAccount( - """Input to retrieve the given transfers for.""" - input: GetTransfersAccountInput! - ): [Transaction!] - - """Transfers in the last 24 hours.""" - transfersLast24h: Float! - - """Transactions count for the given detailed account.""" - txCount: Float! - - """Username for the given detailed account.""" - username: String -} - -"""Account Esdt History object type.""" -type AccountEsdtHistory { - """Address for the given account.""" - address: String! - - """Balance for the given account.""" - balance: String! - - """Identifier for the given history account details.""" - identifier: String! - - """IsSender for the given account.""" - isSender: Boolean - - """Timestamp for the given account.""" - timestamp: Float! - - """Token for the given history account details.""" - token: String! -} - -"""Detailed history object type that.""" -type AccountHistory { - """Address for the given account.""" - address: String! - - """Balance for the given account.""" - balance: String! - - """IsSender for the given account.""" - isSender: Boolean - - """Timestamp for the given account.""" - timestamp: Float! -} - -"""Account key object type.""" -type AccountKey { - """Bls key for the given provider account.""" - blsKey: String! - - """Queue index for the given provider account .""" - queueIndex: String - - """Queue size for the given provider account.""" - queueSize: String - - """Remaining UnBond Period for node with status leaving.""" - remainingUnBondPeriod: Float - - """Reward address for the given provider account .""" - rewardAddress: String! - - """Stake for the given provider account.""" - stake: String! - - """Status for the given provider account.""" - status: String! - - """Top Up for the given provideraccount.""" - topUp: String! -} - -"""Account key filter object type.""" -type AccountKeyFilter { - """Account key status filter for the given keys.""" - status: AccountKeyFilter -} - -"""Account undelegation object type that extends Account.""" -type AccountUndelegation { - """Amount for the given detailed account.""" - amount: String! - - """Seconds for the given detailed account.""" - seconds: Float! -} - -"""Block object type.""" -type Block { - """Epoch for the given Block.""" - epoch: Float! - - """Gas Consumed for the given NFT.""" - gasConsumed: Float! - - """Gas Penalized for the given NFT.""" - gasPenalized: Float! - - """Gas Refunded for the given NFT.""" - gasRefunded: Float! - - """Hash for the given Block.""" - hash: String! - - """Max Gas Limit for the given NFT.""" - maxGasLimit: Float! - - """Nonce for the given Block.""" - nonce: Float! - - """Previous Hash for the given Block.""" - prevHash: String! - - """Proposer for the given Block.""" - proposer: String! - - """Proposer Identity for the given Block.""" - proposerIdentity: Identity! - - """Public Key Bitmap for the given Block.""" - pubKeyBitmap: String! - - """Round for the given Block.""" - round: Float! - - """Scheduled Root Hash for the given Block.""" - scheduledRootHash: String - - """Shard for the given Block.""" - shard: Float! - - """Size for the given Block.""" - size: Float! - - """Size Txs for the given Block.""" - sizeTxs: Float! - - """State Root Hash for the given Block.""" - stateRootHash: String! - - """Timestamp for the given Block.""" - timestamp: Float! - - """TxCount for the given NFT.""" - txCount: Float! -} - -"""BlockDetailed object type.""" -type BlockDetailed { - """Epoch for the given Block.""" - epoch: Float! - - """Gas Consumed for the given NFT.""" - gasConsumed: Float! - - """Gas Penalized for the given NFT.""" - gasPenalized: Float! - - """Gas Refunded for the given NFT.""" - gasRefunded: Float! - - """Hash for the given Block.""" - hash: String! - - """Max Gas Limit for the given NFT.""" - maxGasLimit: Float! - - """MiniBlockHashes for the given block hash.""" - miniBlocksHashes: [String!]! - - """Nonce for the given Block.""" - nonce: Float! - - """NotarizedBlocksHashes for the given block hash.""" - notarizedBlocksHashes: [String!]! - - """Previous Hash for the given Block.""" - prevHash: String! - - """Proposer for the given Block.""" - proposer: String! - - """Proposer Identity for the given Block.""" - proposerIdentity: Identity! - - """Public Key Bitmap for the given Block.""" - pubKeyBitmap: String! - - """Round for the given Block.""" - round: Float! - - """Scheduled Root Hash for the given Block.""" - scheduledRootHash: String - - """Shard for the given Block.""" - shard: Float! - - """Size for the given Block.""" - size: Float! - - """Size Txs for the given Block.""" - sizeTxs: Float! - - """State Root Hash for the given Block.""" - stateRootHash: String! - - """Timestamp for the given Block.""" - timestamp: Float! - - """TxCount for the given NFT.""" - txCount: Float! - - """Validators for the given block hash.""" - validators: [String!]! -} - -"""Collection auction statistics.""" -type CollectionAuctionStats { - """Number of active auctions.""" - activeAuctions: Float - - """Number of ended auctions.""" - endedAuctions: Float - - """Maximum price in EGLD.""" - maxPrice: String - - """Minimum (floor) price in EGLD.""" - minPrice: String - - """Ended auction average price in EGLD.""" - saleAverage: String - - """Total traded volume in EGLD.""" - volumeTraded: String -} - -"""Collection roles object type.""" -type CollectionRoles { - """Address for the given collection roles.""" - address: String - - """If the given collection role can add quantity.""" - canAddQuantity: Boolean! - - """If the given collection role can add URI.""" - canAddUri: Boolean! - - """If the given collection role can burn.""" - canBurn: Boolean! - - """If the given collection role can create.""" - canCreate: Boolean! - - """ - If tokens from the given collections are allowed to be transferred by the given account. - """ - canTransfer: Boolean! - - """If the given collection role can update attributes.""" - canUpdateAttributes: Boolean! - - """Roles list for the given collection roles.""" - roles: [String!]! -} - -"""NFT collection trait type.""" -type CollectionTrait { - """Distinct attributes for the given trait.""" - attributes: [CollectionTraitAttribute!]! - - """Name of the trait.""" - name: String! - - """Number of times the trait appears in the nft list.""" - occurrenceCount: Float! - - """Percentage for the occurrence of the trait in the nft list.""" - occurrencePercentage: Float! -} - -"""NFT collection trait attribute type.""" -type CollectionTraitAttribute { - """Name of the attribute.""" - name: String - - """Number of times the attribute appears in the nft list.""" - occurrenceCount: Float! - - """Percentage for the occurrence of the attribute in the nft list.""" - occurrencePercentage: Float! -} - -"""DappConfig object type.""" -type DappConfig { - """Api url details""" - apiAddress: String! - - """Api Timeout details""" - apiTimeout: String! - - """ChainID details""" - chainId: String! - - """Token details""" - decimals: String! - - """Token denomination details""" - egldDenomination: String! - - """Token label details""" - egldLabel: String! - - """Explorer address details""" - explorerAddress: String! - - """Gas data byte details""" - gasPerDataByte: String! - - """Network Details.""" - id: ID! - - """Network name.""" - name: String! - - """Wallet url details""" - walletAddress: String! - - """Bridge wallet url details""" - walletConnectBridgeAddresses: [String!]! - - """Wallet connect url details""" - walletConnectDeepLink: String! -} - -"""Delegation object type.""" -type Delegation { - """Locked details.""" - locked: String! - - """MinDelegation details.""" - minDelegation: String! - - """Stake details.""" - stake: String! - - """TopUp details.""" - topUp: String! -} - -"""DelegationLegacy object type.""" -type DelegationLegacy { - """Total number of users.""" - numUsers: Float! - - """Total Active Stake details.""" - totalActiveStake: String! - - """Total Deferred Payment Stake details.""" - totalDeferredPaymentStake: String! - - """Total Unstake Stake details""" - totalUnstakedStake: String! - - """Total Waiting Stake details.""" - totalWaitingStake: String! - - """Total Withdraw Only Stake details.""" - totalWithdrawOnlyStake: String! -} - -"""Deployed contract object type.""" -type DeployedContract { - """Address for the given account.""" - address: String! - - """Assets for the given account.""" - assets: AccountAssets - - """DeployTxHash for the given account.""" - deployTxHash: String! - - """Timestamp for the given account.""" - timestamp: Float! -} - -"""Economics object type.""" -type Economics { - """Total Supply general information.""" - apr: Float! - - """Total Supply general information.""" - baseApr: Float! - - """Total Supply general information.""" - circulatingSupply: Float! - - """Total Supply general information.""" - marketCap: Float - - """Total Supply general information.""" - price: Float - - """Total Supply general information.""" - staked: Float! - - """Total Supply general information.""" - tokenMarketCap: Float - - """Total Supply general information.""" - topUpApr: Float! - - """Total Supply general information.""" - totalSupply: Float! -} - -"""ESDT data source.""" -enum EsdtDataSource { - """Elastic data source.""" - elastic - - """Gateway data source.""" - gateway -} - -"""EsdtLockedAccount object type.""" -type EsdtLockedAccount { - """Locked account address.""" - address: String! - - """Locked account balance.""" - balance: String! - - """Locked account name.""" - name: String -} - -"""Esdt type enum.""" -enum EsdtType { - """Fungible ESDT token type.""" - FungibleESDT - - """Meta ESDT token type.""" - MetaESDT - - """Non-fungible ESDT token type.""" - NonFungibleESDT - - """Semi-fungible ESDT token type.""" - SemiFungibleESDT -} - -"""FeatureConfigs object type.""" -type FeatureConfigs { - """DataApi flag details.""" - dataApi: Boolean! - - """Exchange flag details.""" - exchange: Boolean! - - """Marketplace flag details.""" - marketplace: Boolean! - - """Update Collection Extra Details flag details.""" - updateCollectionExtraDetails: Boolean! -} - -"""Input to retrieve the given detailed account for.""" -input GetAccountDetailedInput { - """Address to retrieve the corresponding detailed account for.""" - address: ID! = "" -} - -"""Input to retrieve the given accounts for.""" -input GetAccountFilteredInput { - """Owner address to retrieve for the given result set.""" - ownerAddress: String -} - -"""Input to retrieve the given transactions count for.""" -input GetAccountHistory { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """Number of collections to skip for the given result set.""" - from: Float = 0 - - """Number of collections to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given accounts for.""" -input GetAccountsInput { - """Number of accounts to skip for the given result set.""" - from: Float = 0 - - """Owner address to retrieve for the given result set.""" - ownerAddress: String - - """Number of accounts to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given hash block for.""" -input GetBlockHashInput { - """Specific block hash to retrieve the corresponding blocks for.""" - hash: ID! = "" -} - -"""Input to retrieve the given blocks for.""" -input GetBlocksCountInput { - """Epoch for the given result set.""" - epoch: Float - - """Nonce for the given result set.""" - nonce: Float - - """Proposer for the given result set.""" - proposer: String - - """Shard ID for the given result set.""" - shard: Float - - """Validator for the given result set.""" - validator: String -} - -"""Input to retrieve the given blocks for.""" -input GetBlocksInput { - """Epoch for the given result set.""" - epoch: Float - - """Number of blocks to skip for the given result set.""" - from: Float = 0 - - """Nonce for the given result set.""" - nonce: Float - - """Proposer for the given result set.""" - proposer: String - - """Shard ID for the given result set.""" - shard: Float - - """Number of blocks to retrieve for the given result set.""" - size: Float = 25 - - """Validator for the given result set.""" - validator: String - - """Provide identity information for proposer node.""" - withProposerIdentity: Boolean -} - -"""Input to retrieve the given from and size for.""" -input GetFromAndSizeInput { - """Number of collections to skip for the given result set.""" - from: Float = 0 - - """Number of collections to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given history token for.""" -input GetHistoryTokenAccountInput { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """Number of collections to skip for the given result set.""" - from: Float = 0 - - """Identifier token to retrieve for the given result set.""" - identifier: ID! = "" - - """Number of collections to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given identity for.""" -input GetIndentityInput { - """list of identities.""" - identities: [String!] -} - -"""Input to retrieve the given mex farms for.""" -input GetMexFarmsInput { - """Number of mex farms to skip for the given result set.""" - from: Float = 0 - - """Number of mex farms to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given mex token for.""" -input GetMexTokenInput { - """Identifier to retrieve the corresponding mex token for.""" - id: ID! = "" -} - -"""Input to retrieve the given mex tokens pairs by quote and baseId for.""" -input GetMexTokenPairsByQuotePairIdInput { - """Number of mex tokens pair to skip for the given result set.""" - baseId: String! - - """Number of mex tokens pair to retrieve for the given result set.""" - quoteId: String! -} - -"""Input to retrieve the given mex tokens pairs for.""" -input GetMexTokenPairsInput { - """Number of mex tokens pair to skip for the given result set.""" - from: Float = 0 - - """Number of mex tokens pair to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given mex tokens for.""" -input GetMexTokensInput { - """Number of mex tokens to skip for the given result set.""" - from: Float = 0 - - """Number of mex tokens to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given block for.""" -input GetMiniBlockHashInput { - """Specific mini block hash to retrieve the corresponding block for.""" - miniBlockHash: ID! = "" -} - -"""Input to retrieve the given NFT collection for.""" -input GetNftCollectionInput { - """ - Collection identifier to retrieve the corresponding NFT collection for. - """ - collection: ID! = "" -} - -"""Input to retrieve the given NFT collections for.""" -input GetNftCollectionsAccountInput { - """Number of NFT collections to skip for the given result set.""" - from: Float = 0 - - """Collection identifier to retrieve for the given result set.""" - search: ID - - """Number of NFT collections to retrieve for the given result set.""" - size: Float = 25 - - """NFT types list to retrieve for the given result set.""" - type: [NftType!] -} - -"""Input to retrieve the given NFT collections count for.""" -input GetNftCollectionsCountInput { - """After timestamp to retrieve for the given result set.""" - after: Float - - """Before timestamp to retrieve for the given result set.""" - before: Float - - """Can add quantity to retrieve for the given result set.""" - canAddQuantity: String - - """Can add URI to retrieve for the given result set.""" - canAddUri: String - - """Can burn to retrieve for the given result set.""" - canBurn: String - - """Can transfer role to retrieve for the given result set.""" - canTransferRole: String - - """Can update attributes to retrieve for the given result set.""" - canUpdateAttributes: String - - """ - Do not include collections of type "MetaESDT" in the responsee for the given result set. - """ - excludeMetaESDT: Boolean - - """Collection identifier to retrieve for the given result set.""" - search: ID - - """NFT types list to retrieve for the given result set.""" - type: [NftType!] -} - -"""Input to retrieve the given NFT collections for.""" -input GetNftCollectionsInput { - """After timestamp to retrieve for the given result set.""" - after: Float - - """Before timestamp to retrieve for the given result set.""" - before: Float - - """Can add quantity to retrieve for the given result set.""" - canAddQuantity: String - - """Can add URI to retrieve for the given result set.""" - canAddUri: String - - """Can burn to retrieve for the given result set.""" - canBurn: String - - """Can transfer role to retrieve for the given result set.""" - canTransferRole: String - - """Can update attributes to retrieve for the given result set.""" - canUpdateAttributes: String - - """ - Do not include collections of type "MetaESDT" in the responsee for the given result set. - """ - excludeMetaESDT: Boolean - - """Number of NFT collections to skip for the given result set.""" - from: Float = 0 - - """ - Collection comma-separated identifiers to retrieve for the given result set. - """ - identifiers: [ID!] - - """Collection identifier to retrieve for the given result set.""" - search: ID - - """Number of NFT collections to retrieve for the given result set.""" - size: Float = 25 - - """NFT types list to retrieve for the given result set.""" - type: [NftType!] -} - -"""Input to retrieve the given NFT for.""" -input GetNftInput { - """Identifier to retrieve the corresponding NFT for.""" - identifier: ID! = "" -} - -"""Input to retrieve the given NFTs for.""" -input GetNftsAccountInput { - """Collections to retrieve for the given result set.""" - collections: [String!] - - """Creator to retrieve for the given result set.""" - creator: String - - """ - Do not include collections of type "MetaESDT" in the responsee for the given result set. - """ - excludeMetaESDT: Boolean - - """Number of collections to skip for the given result set.""" - from: Float = 0 - - """Has URIs to retrieve for the given result set.""" - hasUris: Boolean - - """ - NFT comma-separated identifiers list to retrieve for the given result set. - """ - identifiers: [ID!] - - """Include flagged to retrieve for the given result set.""" - includeFlagged: Boolean - - """Name to retrieve for the given result set.""" - name: String - - """NFT identifier to retrieve for the given result set.""" - search: String - - """Number of collections to retrieve for the given result set.""" - size: Float = 25 - - """Source to retrieve for the given result set.""" - source: EsdtDataSource - - """Tags list to retrieve for the given result set.""" - tags: [String!] - - """NFT type to retrieve for the given result set.""" - type: [NftType!] - - """With supply to retrieve for the given result set.""" - withSupply: Boolean -} - -"""Input to retrieve the given NFTs count for.""" -input GetNftsCountInput { - """After timestamp to retrieve for the given result set.""" - after: Float - - """Before timestamp to retrieve for the given result set.""" - before: Float - - """Collection identifier for the given result set.""" - collection: ID = "" - - """Creator to retrieve for the given result set.""" - creator: String - - """Has URIs to retrieve for the given result set.""" - hasUris: Boolean - - """ - NFT comma-separated identifiers list to retrieve for the given result set. - """ - identifiers: [ID!] - - """Is NSFW to retrieve for the given result set.""" - isNsfw: Boolean - - """Is whitelisted storage to retrieve for the given result set.""" - isWhitelistedStorage: Boolean - - """Name to retrieve for the given result set.""" - name: String - - """Nonce to retrieve for the given result set.""" - nonce: Float - - """NFT identifier to retrieve for the given result set.""" - search: String - - """Tags list to retrieve for the given result set.""" - tags: [String!] - - """NFT type to retrieve for the given result set.""" - type: [NftType!] -} - -"""Input to retrieve the given NFTs for.""" -input GetNftsInput { - """After timestamp to retrieve for the given result set.""" - after: Float - - """Before timestamp to retrieve for the given result set.""" - before: Float - - """Collection identifier for the given result set.""" - collection: ID = "" - - """Creator to retrieve for the given result set.""" - creator: String - - """Number of collections to skip for the given result set.""" - from: Float = 0 - - """Has URIs to retrieve for the given result set.""" - hasUris: Boolean - - """ - NFT comma-separated identifiers list to retrieve for the given result set. - """ - identifiers: [ID!] - - """Is NSFW to retrieve for the given result set.""" - isNsfw: Boolean - - """Is whitelisted storage to retrieve for the given result set.""" - isWhitelistedStorage: Boolean - - """Name to retrieve for the given result set.""" - name: String - - """Nonce to retrieve for the given result set.""" - nonce: Float - - """NFT identifier to retrieve for the given result set.""" - search: String - - """Number of collections to retrieve for the given result set.""" - size: Float = 25 - - """Tags list to retrieve for the given result set.""" - tags: [String!] - - """NFT type to retrieve for the given result set.""" - type: [NftType!] - - """With owner to retrieve for the given result set.""" - withOwner: Boolean - - """With supply to retrieve for the given result set.""" - withSupply: Boolean -} - -"""Input to retrieve the given bls node for.""" -input GetNodeBlsInput { - """Bls to retrieve the corresponding node for.""" - bls: String = "" -} - -"""Input to retreive the given nodes count for.""" -input GetNodesCountInput { - """Auctioned filter for the given result set.""" - auctioned: Boolean - - """FullHistory filter for the given result set.""" - fullHistory: Boolean - - """Identity filter for the given result set.""" - identity: String - - """Issues filter for the given result set.""" - issues: Boolean - - """Online filter for the given result set.""" - online: Boolean - - """Order filter for the given result set.""" - order: SortOrder - - """Owner filter for the given result set.""" - owner: String - - """Provider filter for the given result set.""" - provider: String - - """Search for the given result set.""" - search: String - - """Shard ID for the given result set.""" - shard: Float - - """Sort filter for the given result set.""" - sort: NodeSort - - """Status filter for the given result set.""" - status: NodeStatus - - """Type filter for the given result set.""" - type: NodeType -} - -"""Input to retrieve the given nodes for.""" -input GetNodesInput { - """Auctioned filter for the given result set.""" - auctioned: Boolean - - """Number of blocks to skip for the given result set.""" - from: Float = 0 - - """FullHistory filter for the given result set.""" - fullHistory: Boolean - - """Identity filter for the given result set.""" - identity: String - - """Issues filter for the given result set.""" - issues: Boolean - - """Online filter for the given result set.""" - online: Boolean - - """Order filter for the given result set.""" - order: SortOrder - - """Owner filter for the given result set.""" - owner: String - - """Provider filter for the given result set.""" - provider: String - - """Search for the given result set.""" - search: String - - """Shard ID for the given result set.""" - shard: Float - - """Number of blocks to retrieve for the given result set.""" - size: Float = 25 - - """Sort filter for the given result set.""" - sort: NodeSort - - """Status filter for the given result set.""" - status: NodeStatus - - """Type filter for the given result set.""" - type: NodeType -} - -"""Input to retrieve the given provider for.""" -input GetProviderByAddressInput { - """Identity provider for the given result set.""" - address: String = "" -} - -"""Input to retrieve the given provider for.""" -input GetProviderInput { - """Identity provider for the given result set.""" - identity: String = "" -} - -"""Input to retrieve the given rounds for.""" -input GetRoundInput { - """Round for the given result set.""" - round: Float! - - """Epoch for the given result set.""" - shard: Float! -} - -"""Input to retreive the given rounds count for.""" -input GetRoundsCountInput { - """Epoch for the given result set.""" - epoch: Float - - """Shard ID for the given result set.""" - shard: Float - - """Validator for the given result set.""" - validator: String -} - -"""Input to retrieve the given rounds for.""" -input GetRoundsInput { - """Epoch for the given result set.""" - epoch: Float - - """Number of blocks to skip for the given result set.""" - from: Float = 0 - - """Shard ID for the given result set.""" - shard: Float - - """Number of blocks to retrieve for the given result set.""" - size: Float = 25 - - """Validator for the given result set.""" - validator: String -} - -"""Input to retrieve the given tags for.""" -input GetShardInput { - """Number of shards to skip for the given result set.""" - from: Float = 0 - - """Number of shards to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given smart contract hash for.""" -input GetSmartContractHashInput { - """scHash for the given smart contract set.""" - scHash: String! -} - -"""Input to retrieve the given smart contract results for.""" -input GetSmartContractResultInput { - """Number of blocks to skip for the given result set.""" - from: Float = 0 - - """Miniblockhash txHash for the given result set.""" - miniBlockHash: String - - """Original TxHashes for the given result set.""" - originalTxHashes: [String!] - - """Number of blocks to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given tags for.""" -input GetTagsInput { - """Number of tags to skip for the given result set.""" - from: Float = 0 - - """Number of tags to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given token accounts for.""" -input GetTokenAccountsInput { - """Number of tokens to skip for the given result set.""" - from: Float = 0 - - """Identifier to retrieve the corresponding token for.""" - identifier: ID! = "" - - """Number of tokens to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retrieve the given token for.""" -input GetTokenInput { - """Identifier to retrieve the corresponding token for.""" - identifier: ID! = "" -} - -"""Input to retrieve the given token role address for.""" -input GetTokenRolesForIdentifierAndAddressInput { - """Address to retrieve the corresponding token roles for.""" - address: ID! = "" - - """Identifier to retrieve the corresponding token for.""" - identifier: ID! = "" -} - -"""Input to retrieve the given tokens for.""" -input GetTokensAccountInput { - """Number of tokens to skip for the given result set.""" - from: Float = 0 - - """Search by token identifier for the given result set.""" - identifier: ID - - """ - Token comma-separated identifiers list to retrieve for the given result set. - """ - identifiers: [String!] - - """Name to retrieve for the given result set.""" - name: String - - """Token identifier to retrieve for the given result set.""" - search: String - - """Number of tokens to retrieve for the given result set.""" - size: Float = 25 -} - -"""Input to retreive the given tokens count for.""" -input GetTokensCountInput { - """Identifier filter for the given tokens set.""" - identifier: String - - """Identifiers filter for the given tokens set.""" - identifiers: [String!] - - """Name filter for the given tokens set.""" - name: String - - """Search filter for the given tokens set.""" - search: String -} - -"""Input to retreive the given tokens count for.""" -input GetTokensInput { - """Number of tokens to skip for the given result set.""" - from: Float = 0 - - """Identifier filter for the given tokens set.""" - identifier: String - - """Identifiers filter for the given tokens set.""" - identifiers: [String!] - - """Name filter for the given tokens set.""" - name: String - - """Order filter for the given tokens set.""" - order: SortOrder - - """Search filter for the given tokens set.""" - search: String - - """Number of tokens to retrieve for the given result set.""" - size: Float = 25 - - """Sort filter for the given tokens set.""" - sort: TokenSort -} - -"""Input to retrieve the given detailed transaction for.""" -input GetTransactionDetailedInput { - """Hash to retrieve the corresponding detailed transaction for.""" - hash: String! = "" -} - -"""Input to retrieve the given transactions count for.""" -input GetTransactionsAccountCountInput { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """Filter transactions by function name for the given result set.""" - function: String - - """ - Filter by a comma-separated list of transaction hashes for the given result set. - """ - hashes: [String!] - - """Mini block hash for the given result set.""" - miniBlockHash: String - - """Receiver for the given result set.""" - receiver: [String!] - - """Receiver shard for the given result set.""" - receiverShard: Float - - """Search in data object for the given result set.""" - search: String - - """Sender for the given result set.""" - sender: String - - """Sender shard for the given result set.""" - senderShard: Float - - """Status of the transaction for the given result set.""" - status: TransactionStatus - - """Token identfier for the given result set.""" - token: String -} - -"""Input to retrieve the given transactions for.""" -input GetTransactionsAccountInput { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """Number of transactions to skip for the given result set.""" - from: Float = 0 - - """Filter transactions by function name for the given result set.""" - function: String - - """ - Filter by a comma-separated list of transaction hashes for the given result set. - """ - hashes: [String!] - - """Mini block hash for the given result set.""" - miniBlockHash: String - - """Order transactions for the given result set.""" - order: SortOrder - - """Receiver for the given result set.""" - receiver: [String!] - - """Receiver shard for the given result set.""" - receiverShard: Float - - """Search in data object for the given result set.""" - search: String - - """Sender for the given result set.""" - sender: String - - """Sender shard for the given result set.""" - senderShard: Float - - """Number of transactions to retrieve for the given result set.""" - size: Float = 25 - - """Status of the transaction for the given result set.""" - status: TransactionStatus - - """Token identfier for the given result set.""" - token: String - - """After timestamp for the given result set.""" - withLogs: Boolean - - """After timestamp for the given result set.""" - withOperations: Boolean - - """After timestamp for the given result set.""" - withScResults: Boolean - - """After timestamp for the given result set.""" - withScamInfo: Boolean - - """After timestamp for the given result set.""" - withUsername: Boolean -} - -"""Input to retrieve the given transactions count for.""" -input GetTransactionsCountInput { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """Condition for ElasticSearch queries for the given result set.""" - condition: String - - """Filter transactions by function name for the given result set.""" - function: String - - """ - Filter by a comma-separated list of transaction hashes for the given result set. - """ - hashes: [String!] - - """Mini block hash for the given result set.""" - miniBlockHash: String - - """Receiver for the given result set.""" - receiver: String - - """Receiver shard for the given result set.""" - receiverShard: Float - - """Search in data object for the given result set.""" - search: String - - """Sender for the given result set.""" - sender: String - - """Sender shard for the given result set.""" - senderShard: Float - - """Status of the transaction for the given result set.""" - status: TransactionStatus - - """Token identfier for the given result set.""" - token: String -} - -"""Input to retrieve the given transactions for.""" -input GetTransactionsInput { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """Sort order for the given result set.""" - condition: SortOrder - - """Number of transactions to skip for the given result set.""" - from: Float = 0 - - """Filter transactions by function name for the given result set.""" - function: String - - """ - Filter by a comma-separated list of transaction hashes for the given result set. - """ - hashes: [String!] - - """Mini block hash for the given result set.""" - miniBlockHash: String - - """Receiver for the given result set.""" - receiver: String - - """Receiver shard for the given result set.""" - receiverShard: Float - - """Search in data object for the given result set.""" - search: String - - """Sender for the given result set.""" - sender: String - - """Sender shard for the given result set.""" - senderShard: Float - - """Number of transactions to retrieve for the given result set.""" - size: Float = 25 - - """Status of the transaction for the given result set.""" - status: TransactionStatus - - """Token identfier for the given result set.""" - token: String - - """Request scam info for the given result set.""" - withScamInfo: Boolean - - """ - Integrates username in assets for all addresses present in the result set. - """ - withUsername: Boolean -} - -"""Input to retrieve the given transfers for.""" -input GetTransfersAccountInput { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """Number of transactions to skip for the given result set.""" - from: Float = 0 - - """Filter transactions by function name for the given result set.""" - function: String - - """ - Filter by a comma-separated list of transaction hashes for the given result set. - """ - hashes: [String!] - - """Mini block hash for the given result set.""" - miniBlockHash: String - - """Order transactions for the given result set.""" - order: SortOrder - - """Receiver for the given result set.""" - receiver: [String!] - - """Receiver shard for the given result set.""" - receiverShard: Float - - """Search in data object for the given result set.""" - search: String - - """Sender for the given result set.""" - sender: String - - """Sender shard for the given result set.""" - senderShard: Float - - """Number of transactions to retrieve for the given result set.""" - size: Float = 25 - - """Status of the transaction for the given result set.""" - status: TransactionStatus - - """Token identfier for the given result set.""" - token: String - - """After timestamp for the given result set.""" - withScamInfo: Boolean - - """After timestamp for the given result set.""" - withUsername: Boolean -} - -"""Input to retrieve the given transfers count for.""" -input GetTransfersCountInput { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """ - Filter by a comma-separated list of transaction hashes for the given result set. - """ - hashes: [String!] - - """Mini block hash for the given result set.""" - miniBlockHash: String - - """SortOrder data transfers for the given result set.""" - order: SortOrder - - """Receiver for the given result set.""" - receiver: String - - """Receiver shard for the given result set.""" - receiverShard: Float - - """Search in data object for the given result set.""" - search: String - - """Sender for the given result set.""" - sender: String - - """Sender shard for the given result set.""" - senderShard: Float - - """Status of the transaction for the given result set.""" - status: TransactionStatus - - """Token identfier for the given result set.""" - token: String -} - -"""Input to retrieve the given transfers for.""" -input GetTransfersInput { - """After timestamp for the given result set.""" - after: Float - - """Before timestamp for the given result set.""" - before: Float - - """Number of transfers to skip for the given result set.""" - from: Float = 0 - - """ - Filter by a comma-separated list of transaction hashes for the given result set. - """ - hashes: [String!] - - """Mini block hash for the given result set.""" - miniBlockHash: String - - """SortOrder data transfers for the given result set.""" - order: SortOrder - - """Receiver for the given result set.""" - receiver: String - - """Receiver shard for the given result set.""" - receiverShard: Float - - """Search in data object for the given result set.""" - search: String - - """Sender for the given result set.""" - sender: String - - """Sender shard for the given result set.""" - senderShard: Float - - """Number of transfers to retrieve for the given result set.""" - size: Float = 25 - - """Status of the transaction for the given result set.""" - status: TransactionStatus - - """Token identfier for the given result set.""" - token: String - - """Request scam info for the given result set.""" - withScamInfo: Boolean - - """ - Integrates username in assets for all addresses present in the result set. - """ - withUsername: Boolean -} - -"""Input to retrieve the given account details for.""" -input GetUsernameInput { - """Username""" - username: String! = "" -} - -"""Input to retrieve the given waiting-list for.""" -input GetWaitingListInput { - """Number of waiting-list to skip for the given result set.""" - from: Float = 0 - - """Number of waiting-list to retrieve for the given result set.""" - size: Float = 25 -} - -"""GlobalStake object type.""" -type GlobalStake { - """Active validators.""" - activeValidators: Float! - - """All Staked Nodes.""" - allStakedNodes: Float! - - """Auction Validators.""" - auctionValidators: Float! - - """Danger Zone Validators.""" - dangerZoneValidators: Float! - - """Eligible Validators.""" - eligibleValidators: Float! - - """Minimum Auction Qualified Stake information.""" - minimumAuctionQualifiedStake: String - - """Minimum Auction Qualified Top Up information.""" - minimumAuctionQualifiedTopUp: String - - """Nakamoto Coefficient.""" - nakamotoCoefficient: Float! - - """Qualified Auction Validators.""" - qualifiedAuctionValidators: Float! - - """Validators queue size.""" - queueSize: Float! - - """Total observers.""" - totalObservers: Float! - - """Total stake amount.""" - totalStaked: Float! - - """Total validators.""" - totalValidators: Float! - - """Not Eligible Validators.""" - waitingValidators: Float! -} - -"""Identity object type.""" -type Identity { - """Provider apr details.""" - apr: Float - - """Provider avatar.""" - avatar: String - - """Provider description details.""" - description: String - - """Provider distribution details.""" - distribution: JSON - - """Identity provider.""" - identity: String - - """Provider location details.""" - location: String - - """Provider locked ESDT details.""" - locked: String - - """Provider name details.""" - name: String - - """Providers details.""" - providers: [String!] - - """Provider rank details.""" - rank: Float - - """Provider score details.""" - score: Float - - """Provider stake details.""" - stake: String - - """Provider stake percent details""" - stakePercent: Float - - """Provider topUp amount details.""" - topUp: String - - """Provider twitter account.""" - twitter: String - - """Provider validators details.""" - validators: Float - - """Provider website details.""" - website: String -} - -""" -The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). -""" -scalar JSON - -"""MexEconomics object type.""" -type MexEconomics { - """Circulating supply.""" - circulatingSupply: Float! - - """Mex market cap.""" - marketCap: Float! - - """Mex tokens pairs.""" - marketPairs: Float! - - """Mex current price.""" - price: Float! - - """Total supply details.""" - totalSupply: Float! - - """Mex volume in 24h.""" - volume24h: Float! -} - -"""MexFarm object type.""" -type MexFarm { - """Address details.""" - address: String! - - """Farmed identifier details.""" - farmedId: String! - - """Farmed name details.""" - farmedName: String! - - """Farmed price details.""" - farmedPrice: Float! - - """Farmed symbol details.""" - farmedSymbol: String! - - """Farming identifier details.""" - farmingId: String! - - """Farming name details.""" - farmingName: String! - - """Farming price details.""" - farmingPrice: Float! - - """Farming symbol details.""" - farmingSymbol: String! - - """Identifier farm details.""" - id: String! - - """Name details.""" - name: String! - - """Price details.""" - price: Float! - - """Symbol details.""" - symbol: String! - - """Mex farm type.""" - type: MexFarmType! - - """Mex farm version.""" - version: String -} - -"""MexFarmType object type.""" -enum MexFarmType { - """Metastaking type.""" - metastaking - - """Standard type.""" - standard -} - -"""MexPair object type.""" -type MexPair { - """Address details.""" - address: String! - - """Base id details.""" - baseId: String! - - """Base name details.""" - baseName: String! - - """Mex token basePrevious24hPrice equivalent""" - basePrevious24hPrice: Float! - - """Base price details.""" - basePrice: String! - - """Base symbol details.""" - baseSymbol: String! - - """Mex pair deploy date in unix time.""" - deployedAt: Float - - """Mex pair exchange details.""" - exchange: String - - """Mex pair dual farms details.""" - hasDualFarms: Boolean - - """Mex pair farms details.""" - hasFarms: Boolean - - """Id details.""" - id: String! - - """Pair name details.""" - name: String! - - """Mex token price equivalent""" - price: String! - - """Quote id details.""" - quoteId: String! - - """Quote name details.""" - quoteName: String! - - """Mex token quotePrevious24hPrice equivalent""" - quotePrevious24hPrice: Float! - - """Quote price details.""" - quotePrice: String! - - """Quote symbol details.""" - quoteSymbol: String! - - """State details.""" - state: MexPairState! - - """Pair symbol details.""" - symbol: String! - - """Total value details.""" - totalValue: String! - - """Mex pair trades count.""" - tradesCount: Float - - """Mex pair trades count 24h.""" - tradesCount24h: Float - - """Mex pair type details.""" - type: MexPairType! - - """Total volume in 24h details.""" - volume24h: String -} - -"""MexPairState object type.""" -enum MexPairState { - """Active state.""" - active - - """Inactive state.""" - inactive - - """Partial state.""" - partial - - """Pause state.""" - paused -} - -"""MexPairType object type.""" -enum MexPairType { - """Community Type.""" - community - - """Core Type.""" - core - - """Ecosystem Type.""" - ecosystem - - """Experimental Type.""" - experimental - - """Unlisted Type.""" - unlisted -} - -"""MexToken object type.""" -type MexToken { - """Identifier for the mex token.""" - id: String! - - """Mex token name.""" - name: String! - - """Mex token previous24hPrice.""" - previous24hPrice: Float! - - """Mex token previous24hVolume.""" - previous24hVolume: Float! - - """Mex token current price.""" - price: Float! - - """Symbol for the mex token.""" - symbol: String! - - """Mex token trades count.""" - tradesCount: Float -} - -"""MiniBlocks object type.""" -type MiniBlocks { - """MiniBlock Hash details.""" - miniBlockHash: String! - - """Receiver Block Hash details.""" - receiverBlockHash: String! - - """Receiver Shard details.""" - receiverShard: Float! - - """Sender Block Hash details.""" - senderBlockHash: String! - - """Sender shard details.""" - senderShard: Float! - - """Timestamp details.""" - timestamp: Float! - - """Transaction type details.""" - type: String! -} - -"""NetworkConstants object type.""" -type NetworkConstants { - """ChainId details.""" - chainId: String! - - """GasPerDataByte details.""" - gasPerDataByte: Float! - - """MinGasLimit details.""" - minGasLimit: Float! - - """MinGasPrice details.""" - minGasPrice: Float! - - """MinTransactionVersion details.""" - minTransactionVersion: Float! -} - -"""NFT object type.""" -type Nft { - """Assets for the given NFT.""" - assets: TokenAssets - - """Attributes for the given NFT.""" - attributes: String - - """Balance for the given NFT.""" - balance: String - - """NFT collection for the given NFT.""" - collection: NftCollection! - - """Creator account for the given NFT.""" - creator: Account! - - """Decimals for the given NFT.""" - decimals: Float - - """Identifier for the given NFT.""" - identifier: ID! - - """Is NSFW for the given NFT.""" - isNsfw: Boolean - - """Is whitelisted storage for the given NFT.""" - isWhitelistedStorage: Boolean! - - """NFT media for the given NFT.""" - media: [NftMedia!] - - """Metadata for the given NFT.""" - metadata: NftMetadata - - """Name for the given NFT.""" - name: String! - - """Nonce for the given NFT.""" - nonce: Float! - - """Owner account for the given NFT.""" - owner: Account - - """Rank for the given NFT.""" - rank: Float - - """Rarities according to all possible algorithms for the given NFT.""" - rarities: Float - - """Royalties for the given NFT.""" - royalties: Float - - """Scam information for the given NFT. Complexity: 100""" - scamInfo: ScamInformation - - """Score for the given NFT.""" - score: Float - - """NFT sub type for the given NFT.""" - subType: NftSubType - - """Supply for the given NFT. Complexity: 100""" - supply: String - - """Tags for the given NFT.""" - tags: [String!]! - - """Thumbnail URL for the given NFT.""" - thumbnailUrl: String! - - """Ticker for the given NFT.""" - ticker: String! - - """Timestamp for the given NFT.""" - timestamp: Float - - """NFT type for the given NFT.""" - type: NftType! - - """Unlock epoch for the given NFT.""" - unlockEpoch: Float - - """Unlock mile stone model for the given NFT.""" - unlockSchedule: [UnlockMileStoneModel!] - - """URIs for the given NFT.""" - uris: [String!]! - - """URL for the given NFT.""" - url: String! -} - -"""NFT account object type.""" -type NftAccount { - """Assets for the given NFT.""" - assets: TokenAssets - - """Attributes for the given NFT.""" - attributes: String - - """Balance for the given NFT account.""" - balance: String! - - """NFT collection for the given NFT.""" - collection: NftCollection! - - """Creator account for the given NFT.""" - creator: Account! - - """Decimals for the given NFT.""" - decimals: Float - - """Identifier for the given NFT.""" - identifier: ID! - - """Is NSFW for the given NFT.""" - isNsfw: Boolean - - """Is whitelisted storage for the given NFT.""" - isWhitelistedStorage: Boolean! - - """NFT media for the given NFT.""" - media: [NftMedia!] - - """Metadata for the given NFT.""" - metadata: NftMetadata - - """Name for the given NFT.""" - name: String! - - """Nonce for the given NFT.""" - nonce: Float! - - """Owner account for the given NFT.""" - owner: Account - - """Price for the given NFT account.""" - price: Float - - """Rank for the given NFT.""" - rank: Float - - """Rarities according to all possible algorithms for the given NFT.""" - rarities: Float - - """Royalties for the given NFT.""" - royalties: Float - - """Scam information for the given NFT. Complexity: 100""" - scamInfo: ScamInformation - - """Score for the given NFT.""" - score: Float - - """NFT sub type for the given NFT.""" - subType: NftSubType - - """Supply for the given NFT. Complexity: 100""" - supply: String - - """Tags for the given NFT.""" - tags: [String!]! - - """Thumbnail URL for the given NFT.""" - thumbnailUrl: String! - - """Ticker for the given NFT.""" - ticker: String! - - """Timestamp for the given NFT.""" - timestamp: Float - - """NFT type for the given NFT.""" - type: NftType! - - """Unlock epoch for the given NFT.""" - unlockEpoch: Float - - """Unlock mile stone model for the given NFT.""" - unlockSchedule: [UnlockMileStoneModel!] - - """URIs for the given NFT.""" - uris: [String!]! - - """URL for the given NFT.""" - url: String! - - """Value in USD for the given NFT account.""" - valueUsd: Float -} - -type NftAccountFlat { - """Assets for the given NFT.""" - assets: TokenAssets - - """Attributes for the given NFT.""" - attributes: String - - """Balance for the given NFT.""" - balance: String - - """Decimals for the given NFT.""" - decimals: Float - - """Identifier for the given NFT.""" - identifier: ID! - - """Is NSFW for the given NFT.""" - isNsfw: Boolean - - """Is whitelisted storage for the given NFT.""" - isWhitelistedStorage: Boolean! - - """NFT media for the given NFT.""" - media: [NftMedia!] - - """Metadata for the given NFT.""" - metadata: NftMetadata - - """Name for the given NFT.""" - name: String! - - """Nonce for the given NFT.""" - nonce: Float! - - """Price for the given NFT account.""" - price: Float - - """Rank for the given NFT.""" - rank: Float - - """Rarities according to all possible algorithms for the given NFT.""" - rarities: Float - - """Royalties for the given NFT.""" - royalties: Float - - """Scam information for the given NFT. Complexity: 100""" - scamInfo: ScamInformation - - """Score for the given NFT.""" - score: Float - - """NFT sub type for the given NFT.""" - subType: NftSubType - - """Supply for the given NFT. Complexity: 100""" - supply: String - - """Tags for the given NFT.""" - tags: [String!]! - - """Thumbnail URL for the given NFT.""" - thumbnailUrl: String! - - """Ticker for the given NFT.""" - ticker: String! - - """Timestamp for the given NFT.""" - timestamp: Float - - """NFT type for the given NFT.""" - type: NftType! - - """Unlock epoch for the given NFT.""" - unlockEpoch: Float - - """Unlock mile stone model for the given NFT.""" - unlockSchedule: [UnlockMileStoneModel!] - - """URIs for the given NFT.""" - uris: [String!]! - - """URL for the given NFT.""" - url: String! - - """Value in USD for the given NFT account.""" - valueUsd: Float -} - -"""NFT collection object type.""" -type NftCollection { - """Assets for the given NFT collection.""" - assets: TokenAssets - - """Collection auction statistics.""" - auctionStats: CollectionAuctionStats - - """If the given NFT collection can add special role.""" - canAddSpecialRoles: Boolean - - """If the given NFT collection can change owner.""" - canChangeOwner: Boolean - - """If the given NFT collection can freeze.""" - canFreeze: Boolean - - """If the given NFT collection can pause.""" - canPause: Boolean - - """If the given NFT collection can transfer NFT create role.""" - canTransferNftCreateRole: Boolean - - """If the given NFT collection can upgrade.""" - canUpgrade: Boolean - - """If the given NFT collection can wipe.""" - canWipe: Boolean - - """Collection identifier for the given NFT collection.""" - collection: ID! - - """Decimals for the given NFT collection.""" - decimals: Float - - """ - Number of holders. Will be returned only if the collection is verified. - """ - holderCount: Float - - """Returns true if the collection is verified.""" - isVerified: Boolean - - """Name for the given NFT collection.""" - name: String! - - """ - Number of NFTs for this collection. Will be returned only if the collection is verified. - """ - nftCount: Float - - """Owner account for the given NFT collection.""" - owner: Account - - """Scam information for the underlying collection.""" - scamInfo: ScamInformation - - """NFT sub type for the given NFT collection.""" - subType: NftSubType - - """Ticker for the given NFT collection.""" - ticker: ID! - - """Timestamp for the given NFT collection.""" - timestamp: Float! - - """Trait list for the given NFT collection.""" - traits: [CollectionTrait!] - - """NFT type for the given NFT collection.""" - type: NftType! -} - -"""NFT collection account object type.""" -type NftCollectionAccount { - """Assets for the given NFT collection.""" - assets: TokenAssets - - """Collection auction statistics.""" - auctionStats: CollectionAuctionStats - - """If the given NFT collection can add special role.""" - canAddSpecialRoles: Boolean - - """If the given NFT collection can change owner.""" - canChangeOwner: Boolean - - """If the given NFT collection can freeze.""" - canFreeze: Boolean - - """If the given NFT collection can pause.""" - canPause: Boolean - - """If the given NFT collection can transfer NFT create role.""" - canTransferNftCreateRole: Boolean - - """If the given NFT collection can upgrade.""" - canUpgrade: Boolean - - """If the given NFT collection can wipe.""" - canWipe: Boolean - - """Collection identifier for the given NFT collection.""" - collection: ID! - - """Count for the given NFT collection account.""" - count: Float! - - """Decimals for the given NFT collection.""" - decimals: Float - - """ - Number of holders. Will be returned only if the collection is verified. - """ - holderCount: Float - - """Returns true if the collection is verified.""" - isVerified: Boolean - - """Name for the given NFT collection.""" - name: String! - - """ - Number of NFTs for this collection. Will be returned only if the collection is verified. - """ - nftCount: Float - - """Owner account for the given NFT collection.""" - owner: Account - - """Scam information for the underlying collection.""" - scamInfo: ScamInformation - - """NFT sub type for the given NFT collection.""" - subType: NftSubType - - """Ticker for the given NFT collection.""" - ticker: ID! - - """Timestamp for the given NFT collection.""" - timestamp: Float! - - """Trait list for the given NFT collection.""" - traits: [CollectionTrait!] - - """NFT type for the given NFT collection.""" - type: NftType! -} - -type NftCollectionAccountFlat { - """Assets for the given NFT collection.""" - assets: TokenAssets - - """Collection auction statistics.""" - auctionStats: CollectionAuctionStats - - """If the given NFT collection can add special role.""" - canAddSpecialRoles: Boolean - - """If the given NFT collection can change owner.""" - canChangeOwner: Boolean - - """If the given NFT collection can freeze.""" - canFreeze: Boolean - - """If the given NFT collection can pause.""" - canPause: Boolean - - """If the given NFT collection can transfer NFT create role.""" - canTransferNftCreateRole: Boolean - - """If the given NFT collection can upgrade.""" - canUpgrade: Boolean - - """If the given NFT collection can wipe.""" - canWipe: Boolean - - """Collection identifier for the given NFT collection.""" - collection: ID! - - """Count for the given NFT collection account.""" - count: Float! - - """Decimals for the given NFT collection.""" - decimals: Float - - """ - Number of holders. Will be returned only if the collection is verified. - """ - holderCount: Float - - """Returns true if the collection is verified.""" - isVerified: Boolean - - """Name for the given NFT collection.""" - name: String! - - """ - Number of NFTs for this collection. Will be returned only if the collection is verified. - """ - nftCount: Float - - """Scam information for the underlying collection.""" - scamInfo: ScamInformation - - """NFT sub type for the given NFT collection.""" - subType: NftSubType - - """Ticker for the given NFT collection.""" - ticker: ID! - - """Timestamp for the given NFT collection.""" - timestamp: Float! - - """Trait list for the given NFT collection.""" - traits: [CollectionTrait!] - - """NFT type for the given NFT collection.""" - type: NftType! -} - -"""NFT media object type.""" -type NftMedia { - """File size for the given NFT media.""" - fileSize: Float! - - """File type for the given NFT media.""" - fileType: String! - - """Original URL for the given NFT media.""" - originalUrl: String! - - """Thumbnail URL for the given NFT media.""" - thumbnailUrl: String! - - """URL for the given NFT media.""" - url: String! -} - -"""NFT metadata object type.""" -type NftMetadata { - """Description for the given NFT metadata.""" - description: String! - - """NFT Metadata fetch error.""" - error: NftMetadataError - - """File name for the given NFT metadata.""" - fileName: String! - - """File type for the given NFT metadata.""" - fileType: String! - - """File URI for the given NFT metadata.""" - fileUri: String! -} - -"""NFT Metadata error.""" -type NftMetadataError { - """Error code""" - code: NftMetadataErrorCode! - - """Error message""" - message: String! - - """Timestamp when the error was generated""" - timestamp: Float! -} - -"""NFT Metadata error code""" -enum NftMetadataErrorCode { - """Metadata is empty""" - emptyMetadata - - """Invalid contentm type (should be application/json)""" - invalidContentType - - """IPFS error""" - ipfsError - jsonParseError - - """IPFS link does not have any underlying resource""" - notFound - - """IPFS request timeout""" - timeout - - """Unknown error""" - unknownError -} - -"""NFT rank object type""" -type NftRank { - """NFT identifier""" - identifier: String! - - """NFT rank""" - rank: Float! -} - -"""NFT subtype.""" -enum NftSubType { - """Dynamic meta ESDT NFT type.""" - DynamicMetaESDT - - """Dynamic non-fungible NFT type.""" - DynamicNonFungibleESDT - - """Dynamic semi-fungible NFT type.""" - DynamicSemiFungibleESDT - - """Meta ESDT NFT type.""" - MetaESDT - - """Non-fungible ESDT NFT type.""" - NonFungibleESDT - - """Non-fungible ESDT v2 NFT type.""" - NonFungibleESDTv2 - - """Semi-fungible ESDT NFT type.""" - SemiFungibleESDT -} - -"""NFT type.""" -enum NftType { - """Meta ESDT NFT type.""" - MetaESDT - - """Non-fungible NFT type.""" - NonFungibleESDT - - """Semi-fungible NFT type.""" - SemiFungibleESDT -} - -"""Node object type.""" -type Node { - """Auction position for the given node.""" - auctionPosition: Float - - """Auction selected for the given node.""" - auctionQualified: Boolean - - """Auction top up for the given node.""" - auctionTopUp: String - - """Auctioned detailes for the given node.""" - auctioned: Boolean - - """Bls address for the given node.""" - bls: String! - - """Number of epochs left for a node in waiting state.""" - epochsLeft: Float - - """Full history details for the given node.""" - fullHistory: Boolean - - """Identity for the given node.""" - identity: String - - """Identity details for given nodes""" - identityInfo: Identity - - """Instances for the given node.""" - instances: Float! - - """Nodes in auction danger zone.""" - isInDangerZone: Boolean - - """Issues for the given node.""" - issues: [String!]! - - """Leader failure for the given node.""" - leaderFailure: Float! - - """Leader success for the given node.""" - leaderSuccess: Float! - - """Locked details for the given node.""" - locked: String! - - """Name for the given node.""" - name: String! - - """Nonce for the given node.""" - nonce: Float! - - """Online for the given node.""" - online: Boolean! - - """Owner for the given node.""" - owner: String! - - """Bls address for the given node.""" - position: Float! - - """Provider for the given node.""" - provider: String! - - """Qualified stake amout for a given node.""" - qualifiedStake: String! - - """Rating for the given node.""" - rating: Float! - - """Rating modifier for the given node.""" - ratingModifier: Float! - - """Remaining UnBond Period for node with status leaving.""" - remainingUnBondPeriod: Float - - """Shard for the given node.""" - shard: Float - - """Stake for the given node.""" - stake: String! - - """Status for the given node.""" - status: NodeStatus - - """ - Sync progress in case the node is currently in sync mode. If specified, the value can be between 0 and 1. - """ - syncProgress: Float - - """Temp rating for the given node.""" - tempRating: Float! - - """Top up for the given node.""" - topUp: String! - - """Type for the given node.""" - type: NodeType - - """Validator failure for the given node.""" - validatorFailure: Float! - - """Validator ignored signatures details for the given node.""" - validatorIgnoredSignatures: Float! - - """Bls address for the given node.""" - validatorSuccess: Float! - - """Version for the given node.""" - version: String! -} - -"""Node Sort object.""" -enum NodeSort { - """Node auction position.""" - auctionPosition - - """Node leader failure.""" - leaderFailure - - """Node learder success.""" - leaderSuccess - - """Node locked.""" - locked - - """Node name.""" - name - - """Node position.""" - position - - """Node qualified stake.""" - qualifiedStake - - """Node temp rating.""" - tempRating - - """Node validator failure.""" - validatorFailure - - """Node validator ignored signatures.""" - validatorIgnoredSignatures - - """Node validator success.""" - validatorSuccess - - """Node version.""" - version -} - -"""Node status object type.""" -enum NodeStatus { - auction - - """Eligible status.""" - eligible - - """Inactive status.""" - inactive - - """Jailed status.""" - jailed - - """Leaving status.""" - leaving - - """New status.""" - new - - """Queued status.""" - queued - - """Unknown status.""" - unknown - - """Waiting status.""" - waiting -} - -"""Node Type object.""" -enum NodeType { - """Observer type.""" - observer - - """Validator type.""" - validator -} - -"""Provider object type.""" -type Provider { - """APR details percentage.""" - apr: Float! - - """Provider cumulated rewards.""" - cumulatedRewards: String - - """Delegation cap details.""" - delegationCap: String! - - """Featured details.""" - featured: Boolean! - - """Provider identity.""" - identity: String - - """Locked amound details.""" - locked: String! - - """Total numbers of nodes.""" - numNodes: Float! - - """Total number of users.""" - numUsers: Float! - - """Owner address details.""" - owner: String - - """Provider address details.""" - provider: String! - - """Service fee details.""" - serviceFee: Float! - - """Total stake amount.""" - stake: Float! - - """Top up details.""" - topUp: String! -} - -"""Provider stake object type.""" -type ProviderStake { - """Total stake for the given account.""" - totalStaked: String! - - """Unstaked tokens details for the given account.""" - unstakedTokens: [ProviderUnstakedTokens!] -} - -"""Provider unstaked tokens object type.""" -type ProviderUnstakedTokens { - """Amount for the given token.""" - amount: String! - - """Epoch number for the given token.""" - epochs: String - - """Expires details for the given token.""" - expires: String -} - -type Query { - """Retrieve general information about API deployment.""" - about: About! - - """Retrieve the detailed account for the given input.""" - account( - """Input to retrieve the given detailed account for.""" - input: GetAccountDetailedInput! - ): AccountDetailed - - """Retrieve all accounts for the given input.""" - accounts( - """Input to retrieve the given accounts for.""" - input: GetAccountsInput! - ): [Account!]! - - """Retrieve all accounts count.""" - accountsCount( - """Input to retrieve the given accounts for.""" - input: GetAccountFilteredInput! - ): Float! - - """Retrieve the block for the given input.""" - blockHash( - """Input to retrieve the given block hash details for.""" - input: GetBlockHashInput! - ): BlockDetailed! - - """Retrieve all blocks for the given input.""" - blocks( - """Input to retrieve the given blocks for.""" - input: GetBlocksInput! - ): [Block!]! - - """Retrieve the all blocks count for the given input.""" - blocksCount( - """Input to retrieve the given blocks count for.""" - input: GetBlocksCountInput! - ): Float - - """Retrieve the NFT collection for the given input.""" - collection( - """Input to retrieve the given NFT collection for.""" - input: GetNftCollectionInput! - ): NftCollection - - """Retrieve the NFT collection ranks for the given input.""" - collectionRank( - """Input to retrieve the given NFT collection ranks for.""" - input: GetNftCollectionInput! - ): [NftRank!] - - """Retrieve all NFT collections for the given input.""" - collections( - """Input to retrieve the given NFT collections for.""" - input: GetNftCollectionsInput! - ): [NftCollection!]! - - """Retrieve all NFT collections count for the given input.""" - collectionsCount( - """Input to retrieve the given NFT collections count for.""" - input: GetNftCollectionsCountInput! - ): Float! - - """ - Retrieve network-specific constants that can be used to automatically configure dapps. - """ - constants: NetworkConstants! - - """Retrieve configuration used in dapp.""" - dappConfig: DappConfig! - - """Retrieve all delegation staking information.""" - delegation: Delegation! - - """Retrieve legacy delegation contract global information.""" - delegationLegacy: DelegationLegacy! - - """Retrieve general economics information.""" - economics: Economics! - - """ - Retrieve list of all node identities, used to group nodes by the same entity. "Free-floating" nodes that do not belong to any identity will also be returned - """ - identities: [Identity!] - - """ - Retrieve list of all node identities, used to group nodes by the same entity. "Free-floating" nodes that do not belong to any identity will also be returned - """ - identity( - """.""" - input: GetIndentityInput! - ): [Identity!]! - - """Retrieve economics details of xExchange.""" - mexEconomics: MexEconomics! - - """Retrieve a list of farms listed on xExchange.""" - mexFarms( - """Input to retrieve the given farms for.""" - input: GetMexFarmsInput! - ): [MexFarm!]! - - """Retrieve one mex pair listed on xExchange for the given input.""" - mexPair( - """Input to retrieve the given tokens mex pair for.""" - input: GetMexTokenPairsByQuotePairIdInput! - ): MexPair! - - """Retrieve all mex token pairs listed on xExchange for the given input.""" - mexPairs( - """Input to retrieve the given tokens for.""" - input: GetMexTokenPairsInput! - ): [MexPair!]! - - """Retrieve the mex token for the given input.""" - mexToken( - """Input to retrieve the given NFT for.""" - input: GetMexTokenInput! - ): MexToken - - """Retrieve all tokens listed on xExchange for the given input.""" - mexTokens( - """Input to retrieve the given tokens for.""" - input: GetMexTokensInput! - ): [MexToken!]! - - """Retrieve the mini block hash for the given input.""" - miniBlockHash( - """Input to retrieve the given mini block hash details for.""" - input: GetMiniBlockHashInput! - ): MiniBlocks! - - """Retrieve the NFT for the given input.""" - nft( - """Input to retrieve the given NFT for.""" - input: GetNftInput! - ): Nft - - """Retrieve all NFTs for the given input.""" - nfts( - """Input to retrieve the given NFTs for.""" - input: GetNftsInput! - ): [Nft!]! - - """Retrieve all NFTs count for the given input.""" - nftsCount( - """Input to retrieve the given NFTs count for.""" - input: GetNftsCountInput! - ): Float! - - """Retrieve the node details for the given input.""" - node( - """Input to retrieve the given node for.""" - input: GetNodeBlsInput! - ): Node - - """Retrieve all nodes for the given input.""" - nodes( - """Input to retrieve the given nodes for.""" - input: GetNodesInput! - ): [Node!]! - - """ - Returns number of all observer/validator nodes available on blockchain. - """ - nodesCount( - """Input to retrieve the given nodes count for.""" - input: GetNodesCountInput! - ): Float - - """Retrieve the nodes version.""" - nodesVersion: JSON! - - """Retrieve a specific provider for the given input.""" - provider( - """Input to retrieve the given identity provider for.""" - input: GetProviderByAddressInput! - ): Provider! - - """Retrieve all providers for the given input.""" - providers( - """Input to retrieve the given identity provider for.""" - input: GetProviderInput! - ): [Provider!]! - - """Retrieve the smart contract details for the given input.""" - result( - """Input to retrieve the given smart contract for.""" - input: GetSmartContractHashInput! - ): SmartContractResult - - """Retrieve all smart contract results for the given input.""" - results( - """Input to retrieve the given smart contract results for.""" - input: GetSmartContractResultInput! - ): [SmartContractResult!]! - - """Returns total number of smart contracts.""" - resultsCount: Float! - - """Retrieve the round details for the given input.""" - round( - """Input to retrieve the given node for.""" - input: GetRoundInput! - ): RoundDetailed - - """Retrieve all rounds for the given input.""" - rounds( - """Input to retrieve the given rounds for.""" - input: GetRoundsInput! - ): [Round!]! - - """Returns total number of rounds.""" - roundsCount( - """Input to retrieve the given rounds count for.""" - input: GetRoundsCountInput! - ): Float - - """Retrieve all shards for the given input.""" - shards( - """Input to retrieve the given shards for.""" - input: GetShardInput! - ): [Shard!]! - - """Retrieve general stake informations.""" - stake: GlobalStake! - - """Retrieve general network statistics.""" - stats: Stats! - - """Retrieve all tags for the given input.""" - tags( - """Input to retrieve the given tags for.""" - input: GetTagsInput! - ): [Tag!]! - - """Retrieve all tags count.""" - tagsCount: Float! - - """Retrieve token for the given input.""" - token( - """Input to retrieve the given token for.""" - input: GetTokenInput! - ): TokenDetailed - - """Retrieve token accounts for the given input.""" - tokenAccounts( - """Input to retrieve the given token for.""" - input: GetTokenAccountsInput! - ): [TokenAccount!] - - """Retrieve all token accounts count for the given input.""" - tokenAccountsCount( - """Input to retrieve the given count for.""" - input: GetTokenInput! - ): Float! - - """Retrieve token roles for the given input.""" - tokenRoles( - """Input to retrieve the given token for.""" - input: GetTokenInput! - ): [TokenRoles!] - - """Retrieve token roles for the given input.""" - tokenRolesAddress( - """Input to retrieve the given token for.""" - input: GetTokenRolesForIdentifierAndAddressInput! - ): TokenRoles - - """Retrieve token supply for the given input.""" - tokenSupply( - """Input to retrieve the given token for.""" - input: GetTokenInput! - ): TokenSupplyResult - - """Retrieve all tokens for the given input.""" - tokens( - """Input to retrieve the given tokens for.""" - input: GetTokensInput! - ): [TokenDetailed!]! - - """Retrieve all tokens count for the given input.""" - tokensCount( - """Input to retrieve the given count for.""" - input: GetTokensCountInput! - ): Float! - - """Retrieve the detailed transaction for the given input.""" - transaction( - """Input to retrieve the given detailed transaction for.""" - input: GetTransactionDetailedInput! - ): TransactionDetailed - - """Retrieve all transactions available for the given input.""" - transactions( - """Input to retrieve the given transactions for.""" - input: GetTransactionsInput! - ): [TransactionDetailed!]! - - """Retrieve all transactions count for the given input.""" - transactionsCount( - """Input to retrieve the given transactions count for.""" - input: GetTransactionsCountInput! - ): Float! - - """Retrieve all transfers for the given input.""" - transfers( - """Input to retreive the given transfers for.""" - input: GetTransfersInput! - ): [Transaction!]! - - """Retrieve all transfers count for the given input.""" - transfersCount( - """Input to retrieve the given transfers count for.""" - input: GetTransfersCountInput! - ): Float! - - """Retrieve account detailed for a given username""" - username( - """Input to retrieve the given detailed account for.""" - input: GetUsernameInput! - ): Username! - - """Retrieve all address that are in waiting.""" - waitingList( - """Input to retrieve the given waiting accounts for.""" - input: GetWaitingListInput! - ): [WaitingList!]! - - """Retrieve all addresses count that are in waiting.""" - waitingListCount: Float! - - """Retrieve config used for accessing websocket on the same cluster.""" - webSocketConfig: WebsocketConfig! -} - -"""Round object type.""" -type Round { - """Block proposer for the given round.""" - blockWasProposed: Boolean! - - """Epoch for the given round.""" - epoch: Float! - - """Round number details.""" - round: Float! - - """Shard ID for the given round.""" - shard: Float! - - """Timestamp for the given round.""" - timestamp: Float! -} - -"""RoundDetailed object type.""" -type RoundDetailed { - """Block proposer for the given round.""" - blockWasProposed: Boolean! - - """Epoch for the given round.""" - epoch: Float! - - """Round number details.""" - round: Float! - - """Shard ID for the given round.""" - shard: Float! - signers: [String!]! - - """Timestamp for the given round.""" - timestamp: Float! -} - -"""Scam information object type.""" -type ScamInformation { - """Information for the given scam.""" - info: String - - """Type for the given scam information.""" - type: ScamType! -} - -"""Scam type object type.""" -enum ScamType { - """No scam type.""" - none - - """Potential scam type.""" - potentialScam - - """Scam type.""" - scam -} - -"""Shard object type.""" -type Shard { - """Total number of active validators.""" - activeValidators: Float! - - """Shard details.""" - shard: Float! - - """Total number of validators.""" - validators: Float! -} - -"""Smart contract result object type.""" -type SmartContractResult { - """Transaction action for the given smart contract result.""" - action: TransactionAction - - """Call type for the given smart contract result.""" - callType: String! - - """Data for the given smart contract result.""" - data: String! - - """Function call""" - function: String - - """Gas limit for the given smart contract result.""" - gasLimit: Float! - - """Gas price for the given smart contract result.""" - gasPrice: Float! - - """Hash for the given smart contract result.""" - hash: ID - - """Transaction logs for the given smart contract result.""" - logs: TransactionLog - - """Mini block hash for the given smart contract result.""" - miniBlockHash: String - - """Nonce for the given smart contract result.""" - nonce: Float! - - """Original transaction hash for the given smart contract result.""" - originalTxHash: String! - - """Previous transaction hash for the given smart contract result.""" - prevTxHash: String! - - """Receiver address for the given smart contract result.""" - receiver: String! - - """Receiver assets for the given smart contract result.""" - receiverAssets: AccountAssets - - """Relayed value for the given smart contract result.""" - relayedValue: String! - - """Return message for the given smart contract result.""" - returnMessage: String - - """Sender address for the given smart contract result.""" - sender: String! - - """Sender assets for the given smart contract result.""" - senderAssets: AccountAssets - - """Result status""" - status: String - - """Timestamp for the given smart contract result.""" - timestamp: Float! - - """Value for the given smart contract result.""" - value: String! -} - -"""Sort order object type.""" -enum SortOrder { - """Ascending order.""" - asc - - """Descending order.""" - desc -} - -"""Stats object type.""" -type Stats { - """Total number of accounts available on blockchain.""" - accounts: Float! - - """Total blocks available on blockchain.""" - blocks: Float! - - """Current epoch details.""" - epoch: Float! - - """RefreshRate details.""" - refreshRate: Float! - - """RoundPassed details.""" - roundsPassed: Float! - - """Rounds per epoch details.""" - roundsPerEpoch: Float! - - """Total number of smart contract results.""" - scResults: Float! - - """Shards available on blockchain.""" - shards: Float! - - """Total number of transactions.""" - transactions: Float! -} - -"""Tag object type.""" -type Tag { - """Count for the given tag.""" - count: Float - - """Tag details.""" - tag: String! -} - -"""TokenAccount object type.""" -type TokenAccount { - """Token account address.""" - address: String! - - """Account assets for the given account.""" - assets: AccountAssets - - """Token attributes if MetaESDT.""" - attributes: String - - """Token balance account amount.""" - balance: String! - - """Token identifier if MetaESDT.""" - identifier: String -} - -"""Token assets object type.""" -type TokenAssets { - """Description for the given token assets.""" - description: String! - - """Extra tokens for the given token assets.""" - extraTokens: [String!] - - """Ledger signature for the given token assets.""" - ledgerSignature: String - - """Locked accounts for the given token assets.""" - lockedAccounts: JSON - - """Name for the given token assets.""" - name: String! - - """PNG URL for the given token assets.""" - pngUrl: String! - - """ - Preferred ranking algorithm for NFT collections. Supported values are "trait", "statistical", "jaccardDistances", "openRarity" and "custom". - """ - preferredRankAlgorithm: String - - """Custom price source for the given token""" - priceSource: TokenAssetsPriceSource - - """Status for the given token assets.""" - status: String! - - """SVG URL for the given token assets.""" - svgUrl: String! - - """Website for the given token assets.""" - website: String! -} - -"""Token assets price source object type.""" -type TokenAssetsPriceSource { - """(Optional) path to fetch the price info in case of customUrl type""" - path: String - - """Type of price source""" - type: String - - """URL of price source in case of customUrl type""" - url: String -} - -"""TokenDetailed object type.""" -type TokenDetailed { - """Token accounts.""" - accounts: Float! - - """Token accounts last updated timestamp.""" - accountsLastUpdatedAt: Float - - """Token assests details.""" - assets: TokenAssets - - """Token burn amount details.""" - burnt: String! - - """Token canAddSpecialRoles property in case of type MetaESDT.""" - canAddSpecialRoles: Boolean - - """Token canBurn property.""" - canBurn: Boolean - - """Token canChangeOwner property.""" - canChangeOwner: Boolean - - """Token canFreeze property.""" - canFreeze: Boolean - - """Token canMint property.""" - canMint: Boolean - - """Token canPause property.""" - canPause: Boolean! - - """ - If the given NFT collection can transfer the underlying tokens by default. - """ - canTransfer: Boolean - - """Token canFreeze property.""" - canTransferNftCreateRole: Boolean - - """Token canUpgrade property.""" - canUpgrade: Boolean! - - """Token canWipe property.""" - canWipe: Boolean - - """Token circulating supply amount details.""" - circulatingSupply: String - - """Token Collection if type is MetaESDT.""" - collection: String - - """Token decimals.""" - decimals: Float! - - """Token Identifier.""" - identifier: String! - - """Token initial minted amount details.""" - initialMinted: String! - - """ - If the liquidity to market cap ratio is less than 0.5%, we consider it as low liquidity. - """ - isLowLiquidity: Boolean - - """Token isPause property.""" - isPaused: Boolean! - - """ - If the liquidity to market cap ratio is less than 0.5%, we consider it as low liquidity and display threshold percent . - """ - lowLiquidityThresholdPercent: Float - - """Current market cap details.""" - marketCap: Float - - """Mex pair type details.""" - mexPairType: MexPairType! - - """Token minted amount details.""" - minted: String! - - """Token name.""" - name: String! - - """Token Nonce if type is MetaESDT.""" - nonce: Float - - """Token owner address.""" - owner: String! - - """Current token price.""" - price: Float - - """Token roles details.""" - roles: [TokenRoles!] - - """Token supply amount details.""" - supply: String - - """Token ticker.""" - ticker: String! - - """Creation timestamp.""" - timestamp: Float! - - """Total value captured in liquidity pools.""" - totalLiquidity: Float! - - """Total traded value in the last 24h within the liquidity pools.""" - totalVolume24h: Float! - - """Mex pair trades count.""" - tradesCount: Float - - """Token transactions.""" - transactions: Float - - """Token transactions last updated timestamp.""" - transactionsLastUpdatedAt: Float - - """Token transfers.""" - transfers: Float - - """Token transfers last updated timestamp.""" - transfersLastUpdatedAt: Float - - """Token type.""" - type: TokenType! -} - -"""TokenRoles object type.""" -type TokenRoles { - """Token address with role.""" - address: String - - """Token canAddQuantity property.""" - canAddQuantity: Boolean - - """Token canAddUri property.""" - canAddUri: Boolean - - """Token canBurn property.""" - canBurn: Boolean - - """Token canCreate property.""" - canCreate: Boolean - - """Token canLocalBurn property.""" - canLocalBurn: Boolean - - """Token canLocalMint property.""" - canLocalMint: Boolean - - """Token canTransfer property.""" - canTransfer: Boolean - - """Token canUpdateAttributes property.""" - canUpdateAttributes: Boolean - - """Token roles details.""" - roles: [String!]! -} - -"""Token Sort object type.""" -enum TokenSort { - """Accounts sort.""" - accounts - - """MarketCap sort.""" - marketCap - - """Price sort.""" - price - - """Transactions sort.""" - transactions -} - -"""TokenSupplyResult object type.""" -type TokenSupplyResult { - """Token burnt.""" - burnt: String! - - """Token circulating supply.""" - circulatingSupply: String! - - """Token initial minted.""" - initialMinted: String! - - """Token locked accounts.""" - lockedAccounts: [EsdtLockedAccount!]! - - """Token minted details.""" - minted: String! - - """Token supply.""" - supply: String! -} - -"""Token Type object.""" -enum TokenType { - """FungibleESDT.""" - FungibleESDT - - """MetaESDT.""" - MetaESDT - - """NonFungibleESDT.""" - NonFungibleESDT - - """SemiFungibleESDT.""" - SemiFungibleESDT -} - -type TokenWithBalanceAccountFlat { - """Token accounts.""" - accounts: Float! - - """Token accounts last updated timestamp.""" - accountsLastUpdatedAt: Float - - """Token assests details.""" - assets: TokenAssets - - """Balance for the given token account.""" - balance: String! - - """Token burnt details.""" - burnt: String! - - """Token canAddSpecialRoles property in case of type MetaESDT.""" - canAddSpecialRoles: Boolean - - """Token canBurn property.""" - canBurn: Boolean - - """Token canChangeOwner property.""" - canChangeOwner: Boolean - - """Token canFreeze property.""" - canFreeze: Boolean - - """Token canMint property.""" - canMint: Boolean - - """Token canPause property.""" - canPause: Boolean! - - """Token canFreeze property.""" - canTransferNftCreateRole: Boolean - - """Token canUpgrade property.""" - canUpgrade: Boolean! - - """Token canWipe property.""" - canWipe: Boolean - - """Token circulating supply amount details.""" - circulatingSupply: String - - """Token Collection if type is MetaESDT.""" - collection: String - - """Token decimals.""" - decimals: Float! - - """Token Identifier.""" - identifier: String! - - """Token initial minting details.""" - initialMinted: String! - - """ - If the liquidity to market cap ratio is less than 0.5%, we consider it as low liquidity. - """ - isLowLiquidity: Boolean - - """Token isPause property.""" - isPaused: Boolean! - - """ - If the liquidity to market cap ratio is less than 0.5%, we consider it as low liquidity and display threshold percent . - """ - lowLiquidityThresholdPercent: Float - - """Current market cap details.""" - marketCap: Float - - """Mex pair type details.""" - mexPairType: MexPairType! - - """Token minted details.""" - minted: String! - - """Token name.""" - name: String! - - """Token Nonce if type is MetaESDT.""" - nonce: Float - - """Current token price.""" - price: Float - - """Token supply amount details.""" - supply: String - - """Token ticker.""" - ticker: String! - - """Creation timestamp.""" - timestamp: Float! - - """Total value captured in liquidity pools.""" - totalLiquidity: Float! - - """Total traded value in the last 24h within the liquidity pools.""" - totalVolume24h: Float! - - """Mex pair trades count.""" - tradesCount: Float - - """Token transactions.""" - transactions: Float - - """Token transactions last updated timestamp.""" - transactionsLastUpdatedAt: Float - - """Token transfers.""" - transfers: Float - - """Token transfers last updated timestamp.""" - transfersLastUpdatedAt: Float - - """Token type.""" - type: TokenType! - - """ValueUsd token for the given token account.""" - valueUsd: Float -} - -"""Transaction object type.""" -type Transaction { - """Transaction action for the given transaction.""" - action: TransactionAction - - """Data for the given transaction.""" - data: String - - """Fee for the given transaction.""" - fee: String - - """Function for the given transaction.""" - function: String - - """Gas limit for the given transaction.""" - gasLimit: Float - - """Gas price for the given transaction.""" - gasPrice: Float - - """Gas used for the given transaction.""" - gasUsed: Float - - """Guardian address for the given transaction.""" - guardianAddress: String - - """Guardian signature for the given transaction.""" - guardianSignature: String - - """Is relayed transaction.""" - isRelayed: Boolean - - """Mini block hash for the given transaction.""" - miniBlockHash: String - - """Nonce for the given transaction.""" - nonce: Float - - """Original tx hash for the given transaction.""" - originalTxHash: String - - """Pending results for the given transaction.""" - pendingResults: Boolean - - """Receiver account for the given transaction.""" - receiverAccount: Account! - - """Receiver account for the given transaction.""" - receiverAddress: String! - - """Receiver assets for the given transaction.""" - receiverAssets: AccountAssets - - """Receiver account shard for the given transaction.""" - receiverShard: String! - - """The username of the receiver for the given transaction.""" - receiverUsername: String! - - """Relayer address for the given transaction.""" - relayer: String - - """Round for the given transaction.""" - round: Float - - """Scam information for the given transaction.""" - scamInfo: ScamInformation - - """Sender account for the given transaction.""" - senderAccount: Account! - - """Sender account for the given transaction.""" - senderAddress: String! - - """Sender assets for the given transaction.""" - senderAssets: AccountAssets - - """Sender account shard for the given transaction.""" - senderShard: Float! - - """The username of the sender for the given transaction.""" - senderUsername: String! - - """Signature for the given transaction.""" - signature: String - - """Status for the given transaction.""" - status: String! - - """Timestamp for the given transaction.""" - timestamp: Float! - - """Hash for the given transaction.""" - txHash: ID! - - """Transaction type.""" - type: TransactionType - - """Value for the given transaction.""" - value: String! -} - -"""Transaction action object type.""" -type TransactionAction { - """Description for the given transaction action.""" - arguments: JSON - - """Category for the given transaction action.""" - category: String! - - """Description for the given transaction action.""" - description: String! - - """Name for the given transaction action.""" - name: String! -} - -"""Detailed Transaction object type that extends Transaction.""" -type TransactionDetailed { - """Transaction action for the given transaction.""" - action: TransactionAction - - """Data for the given transaction.""" - data: String - - """Fee for the given transaction.""" - fee: String - - """Function for the given transaction.""" - function: String - - """Gas limit for the given transaction.""" - gasLimit: Float - - """Gas price for the given transaction.""" - gasPrice: Float - - """Gas used for the given transaction.""" - gasUsed: Float - - """Guardian address for the given transaction.""" - guardianAddress: String - - """Guardian signature for the given transaction.""" - guardianSignature: String - - """InTransit transaction details.""" - inTransit: Boolean - - """Is relayed transaction.""" - isRelayed: Boolean - - """Transaction log for the given detailed transaction.""" - logs: TransactionLog - - """Mini block hash for the given transaction.""" - miniBlockHash: String - - """Nonce for the given transaction.""" - nonce: Float - - """Transaction operations for the given detailed transaction.""" - operations: [TransactionOperation!] - - """Original tx hash for the given transaction.""" - originalTxHash: String - - """Pending results for the given transaction.""" - pendingResults: Boolean - - """Price for the given detailed transaction.""" - price: Float - - """Transaction receipt for the given detailed transaction.""" - receipt: TransactionReceipt - - """Receiver account for the given detailed transaction.""" - receiverAccount: Account! - - """Receiver account for the given transaction.""" - receiverAddress: String! - - """Receiver assets for the given transaction.""" - receiverAssets: AccountAssets - - """Receiver Block hash for the given transaction.""" - receiverBlockHash: String - - """Receiver Block nonce for the given transaction.""" - receiverBlockNonce: Float - - """Receiver account shard for the given transaction.""" - receiverShard: String! - - """The username of the receiver for the given transaction.""" - receiverUsername: String! - - """Relayed transaction version.""" - relayedVersion: String - - """Relayer address for the given transaction.""" - relayer: String - - """Smart contract results for the given detailed transaction.""" - results: [SmartContractResult!] - - """Round for the given transaction.""" - round: Float - - """Scam information for the given transaction.""" - scamInfo: ScamInformation - - """Sender account for the given detailed transaction.""" - senderAccount: Account! - - """Sender account for the given transaction.""" - senderAddress: String! - - """Sender assets for the given transaction.""" - senderAssets: AccountAssets - - """Sender Block hash for the given transaction.""" - senderBlockHash: String - - """Sender Block nonce for the given transaction.""" - senderBlockNonce: Float - - """Sender account shard for the given transaction.""" - senderShard: Float! - - """The username of the sender for the given transaction.""" - senderUsername: String! - - """Signature for the given transaction.""" - signature: String - - """Status for the given transaction.""" - status: String! - - """Timestamp for the given transaction.""" - timestamp: Float! - - """Hash for the given transaction.""" - txHash: ID! - - """Transaction type.""" - type: TransactionType - - """Value for the given transaction.""" - value: String! -} - -"""Transaction log object type.""" -type TransactionLog { - """Address for the given transaction log.""" - address: String! - - """Account assets for the given transaction log.""" - addressAssets: AccountAssets - - """Transaction log events list for the given transaction log.""" - events: [TransactionLogEvent!]! - - """Identifier for the given transaction log.""" - id: ID! -} - -"""Transaction log event object type.""" -type TransactionLogEvent { - """Additional data for the given transaction log event.""" - additionalData: String - - """Address for the given transaction log event.""" - address: String! - - """Address assets for the given transaction log event.""" - addressAssets: AccountAssets! - - """Data for the given transaction log event.""" - data: String - - """Identifier for the given transaction log event.""" - identifier: ID! - - """Topics list for the given transaction log event.""" - topics: [String!]! -} - -"""Transaction operation object type.""" -type TransactionOperation { - """Transaction operation action for the transaction operation.""" - action: TransactionOperationAction! - - """Additional data for the given transaction operation.""" - additionalData: String - - """Collection for the transaction operation.""" - collection: String - - """Data for the transaction operation.""" - data: String - - """Decimals for the transaction operation.""" - decimals: Float - - """ESDT type for the transaction operation.""" - esdtType: EsdtType - - """Identifier for the transaction operation.""" - id: ID! - - """Identifier for the transaction operation.""" - identifier: String! - - """Message for the transaction operation.""" - message: String - - """Name for the transaction operation.""" - name: String - - """Receiver address for the transaction operation.""" - receiver: String! - - """Receiver account assets for the transaction operation.""" - receiverAssets: AccountAssets - - """Sender address for the transaction operation.""" - sender: String! - - """Sender account assets for the transaction operation.""" - senderAssets: AccountAssets - - """SVG URL for the transaction operation.""" - svgUrl: String - - """Token ticker for the transaction operation.""" - ticker: String! - - """Transaction operation type for the transaction operation.""" - type: TransactionOperationType! - - """Value for the transaction operation.""" - value: String - - """Value for the transaction operation in USD.""" - valueUSD: Float -} - -"""Transaction operation action object type.""" -enum TransactionOperationAction { - """Add quantity operation action.""" - addQuantity - - """Burn operation action.""" - burn - - """Create operation action.""" - create - - """Freeze operation action.""" - freeze - - """Local burn operation action.""" - localBurn - - """Local mint operation action.""" - localMint - - """No operation operation action.""" - none - - """Signal error operation action.""" - signalError - - """Transafer operation action.""" - transfer - - """Transfer only value operation action.""" - transferValueOnly - - """Wipe operation action.""" - wipe - - """Write log operation action.""" - writeLog -} - -"""Transaction operation type object type.""" -enum TransactionOperationType { - """EGLD operation type.""" - egld - - """Error operation type.""" - error - - """ESDT operation type.""" - esdt - - """Log operation type.""" - log - - """NFT operation type.""" - nft - - """No operation type.""" - none -} - -"""Transaction receipt object type.""" -type TransactionReceipt { - """Data for the given transaction receipt.""" - data: String! - - """Sender address for the given transaction receipt.""" - sender: String! - - """Value for the given transaction receipt.""" - value: String! -} - -"""Transaction status object type.""" -enum TransactionStatus { - """Fail status.""" - fail - - """Invalid status.""" - invalid - - """Pending status.""" - pending - - """Success status.""" - success -} - -"""Transaction type object type.""" -enum TransactionType { - """InnerTransaction type.""" - InnerTransaction - - """Reward type.""" - Reward - - """SmartContractResult type.""" - SmartContractResult - - """Transaction type.""" - Transaction -} - -"""Unlock mile stone model object type.""" -type UnlockMileStoneModel { - """Percent for the given unlock mile stone model.""" - percent: Float! - - """Remaining epochs for the given unlock mile stone model.""" - remainingEpochs: Float! -} - -"""Username object type.""" -type Username { - """Address details.""" - address: String! - - """Balance details.""" - balance: String! - - """Developer Reward details.""" - developerReward: String! - - """Nonce details.""" - nonce: String - - """RootHash details.""" - rootHash: String! - - """ScrCount details.""" - scrCount: String - - """Shard details.""" - shard: String - - """txCount details.""" - txCount: Float - - """Username details.""" - username: String! -} - -"""Waiting object type.""" -type WaitingList { - """Address details.""" - address: ID! - - """Nonce details.""" - nonce: Float! - - """Rank details.""" - rank: Float! - - """Value details.""" - value: Float! -} - -"""WebsocketConfig object type.""" -type WebsocketConfig { - """Cluster url.""" - url: String! -} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index ae0a9db8f..0ffab0cd9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,7 +8,6 @@ import { PrivateAppModule } from './private.app.module'; import { CacheWarmerModule } from './crons/cache.warmer/cache.warmer.module'; import { MicroserviceOptions, Transport } from '@nestjs/microservices'; import { INestApplication, Logger, NestInterceptor } from '@nestjs/common'; -import { EventEmitter2 } from '@nestjs/event-emitter'; import * as bodyParser from 'body-parser'; import * as requestIp from 'request-ip'; import { WINSTON_MODULE_NEST_PROVIDER } from 'nest-winston'; @@ -30,8 +29,6 @@ import { MxnestConfigServiceImpl } from './common/api-config/mxnest-config-servi import { RabbitMqModule } from './common/rabbitmq/rabbitmq.module'; import { TransactionLoggingInterceptor } from './interceptors/transaction.logging.interceptor'; import { BatchTransactionProcessorModule } from './crons/transaction.processor/batch.transaction.processor.module'; -import { GraphqlComplexityInterceptor } from './graphql/interceptors/graphql.complexity.interceptor'; -import { GraphQLMetricsInterceptor } from './graphql/interceptors/graphql.metrics.interceptor'; import { SettingsService } from './common/settings/settings.service'; import { StatusCheckerModule } from './crons/status.checker/status.checker.module'; import { JwtOrNativeAuthGuard } from '@multiversx/sdk-nestjs-auth'; @@ -190,7 +187,6 @@ async function configurePublicApp(publicApp: NestExpressApplication, apiConfigSe publicApp.useStaticAssets(join(__dirname, 'public/assets')); const metricsService = publicApp.get(MetricsService); - const eventEmitterService = publicApp.get(EventEmitter2); const pluginService = publicApp.get(PluginService); const httpAdapterHostService = publicApp.get(HttpAdapterHost); const cachingService = publicApp.get(CacheService); @@ -220,8 +216,6 @@ async function configurePublicApp(publicApp: NestExpressApplication, apiConfigSe globalInterceptors.push(new OriginInterceptor()); // @ts-ignore globalInterceptors.push(new ComplexityInterceptor()); - globalInterceptors.push(new GraphqlComplexityInterceptor()); - globalInterceptors.push(new GraphQLMetricsInterceptor(eventEmitterService)); // @ts-ignore globalInterceptors.push(new RequestCpuTimeInterceptor(metricsService)); // @ts-ignore @@ -274,7 +268,7 @@ async function configurePublicApp(publicApp: NestExpressApplication, apiConfigSe const documentBuilder = new DocumentBuilder() .setTitle('Multiversx API') .setDescription(description) - .setVersion('1.0.0') + .setVersion('1.8.0') .setExternalDoc('Find out more about Multiversx API', 'https://docs.multiversx.com/sdk-and-tools/rest-api/rest-api/'); const config = documentBuilder.build(); diff --git a/src/public.app.module.ts b/src/public.app.module.ts index c598eafa4..426717e6d 100644 --- a/src/public.app.module.ts +++ b/src/public.app.module.ts @@ -9,7 +9,6 @@ import { GuestCacheService } from '@multiversx/sdk-nestjs-cache'; import { LoggingModule } from '@multiversx/sdk-nestjs-common'; import { DynamicModuleUtils } from './utils/dynamic.module.utils'; import { LocalCacheController } from './endpoints/caching/local.cache.controller'; -import { GraphQlModule } from './graphql/graphql.module'; @Module({ imports: [ @@ -17,7 +16,6 @@ import { GraphQlModule } from './graphql/graphql.module'; EndpointsServicesModule, EndpointsControllersModule.forRoot(), DynamicModuleUtils.getRedisCacheModule(), - GraphQlModule.register(), ], controllers: [ LocalCacheController, diff --git a/src/test/unit/graphql/entities/account.detailed/account.detailed.query.spec.ts b/src/test/unit/graphql/entities/account.detailed/account.detailed.query.spec.ts deleted file mode 100644 index ccba83c63..000000000 --- a/src/test/unit/graphql/entities/account.detailed/account.detailed.query.spec.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Test } from "@nestjs/testing"; - -import { Account } from "src/endpoints/accounts/entities/account"; -import { AccountDetailedQuery } from "src/graphql/entities/account.detailed/account.detailed.query"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { AccountServiceMock } from "src/test/unit/graphql/mocks/account.service.mock"; -import { GetAccountDetailedInput } from "src/graphql/entities/account.detailed/account.detailed.input"; - -describe(AccountDetailedQuery, () => { - - const AccountServiceMockProvider = { - provide: AccountService, - useClass: AccountServiceMock, - }; - - let accountDetailedQuery: AccountDetailedQuery; - - let accountServiceMock: AccountService; - - beforeEach(async () => { - const module = await Test.createTestingModule({ - providers: [ - AccountDetailedQuery, - - AccountServiceMockProvider, - ], - }).compile(); - - accountDetailedQuery = module.get(AccountDetailedQuery); - - accountServiceMock = module.get(AccountService); - }); - - it("should be defined", () => { - expect(accountDetailedQuery).toBeDefined(); - }); - - // it("get account with non-existing address should return null", async () => { - // const expectedAccount = null; - - // await assertGetAccountDetailed("", expectedAccount); - // }); - - it("get account with existing address should return account", async () => { - // @ts-ignore - const expectedAccount: Account = AccountServiceMock.accounts.at(0); - - await assertGetAccountDetailed(expectedAccount.address, expectedAccount); - }); - - async function assertGetAccountDetailed(address: string, expectedAccount: Account | null) { - jest.spyOn(accountServiceMock, "getAccountSimple"); - - const input: GetAccountDetailedInput = new GetAccountDetailedInput({ - address: address, - }); - - const actualAccount = await accountDetailedQuery.getAccountDetailed(input); - - expect(actualAccount).toEqual(expectedAccount); - - expect(accountServiceMock.getAccountSimple).toHaveBeenCalledWith(input.address); - } -}); diff --git a/src/test/unit/graphql/entities/account.detailed/account.detailed.resolver.spec.ts b/src/test/unit/graphql/entities/account.detailed/account.detailed.resolver.spec.ts deleted file mode 100644 index 05423252a..000000000 --- a/src/test/unit/graphql/entities/account.detailed/account.detailed.resolver.spec.ts +++ /dev/null @@ -1,204 +0,0 @@ -import { Test } from "@nestjs/testing"; -import { randomInt } from "crypto"; -import { AccountDetailed } from "src/endpoints/accounts/entities/account.detailed"; -import { AccountDetailedResolver } from "src/graphql/entities/account.detailed/account.detailed.resolver"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { AccountServiceMock } from "src/test/unit/graphql/mocks/account.service.mock"; -import { CollectionFilter } from "src/endpoints/collections/entities/collection.filter"; -import { CollectionService } from "src/endpoints/collections/collection.service"; -import { CollectionServiceMock } from "src/test/unit/graphql/mocks/collection.service.mock"; -import { GetNftCollectionsAccountInput, GetNftsAccountInput } from "src/graphql/entities/account.detailed/account.detailed.input"; -import { NftAccount } from "src/endpoints/nfts/entities/nft.account"; -import { NftCollectionAccount } from "src/endpoints/collections/entities/nft.collection.account"; -import { NftFilter } from "src/endpoints/nfts/entities/nft.filter"; -import { NftService } from "src/endpoints/nfts/nft.service"; -import { NftServiceMock } from "src/test/unit/graphql/mocks/nft.service.mock"; -import { NftQueryOptions } from "src/endpoints/nfts/entities/nft.query.options"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -describe.skip(AccountDetailedResolver, () => { - - const AccountServiceMockProvider = { - provide: AccountService, - useClass: AccountServiceMock, - }; - - const CollectionServiceMockProvider = { - provide: CollectionService, - useClass: CollectionServiceMock, - }; - - const NftServiceMockProvider = { - provide: NftService, - useClass: NftServiceMock, - }; - - let accountDetailedResolver: AccountDetailedResolver; - - let accountServiceMock: AccountService; - let collectionServiceMock: CollectionService; - let nftServiceMock: NftService; - - // @ts-ignore - const parent: AccountDetailed = AccountServiceMock.accounts.at(0); - - beforeAll(async () => { - const module = await Test.createTestingModule({ - providers: [ - AccountDetailedResolver, - - AccountServiceMockProvider, - CollectionServiceMockProvider, - NftServiceMockProvider, - ], - }).compile(); - - accountDetailedResolver = module.get(AccountDetailedResolver); - - nftServiceMock = module.get(NftService); - collectionServiceMock = module.get(CollectionService); - accountServiceMock = module.get(AccountService); - }); - - it("should be defined", () => { - expect(accountDetailedResolver).toBeDefined(); - }); - - it("get account detailed transaction count should return count", async () => { - const expectedCount: number = randomInt(3); - - jest.spyOn(accountServiceMock, "getAccountTxCount").mockImplementation(() => Promise.resolve(expectedCount)); - - const actualCount: number = await accountDetailedResolver.getAccountDetailedTransactionCount(parent); - - expect(actualCount).toEqual(expectedCount); - - expect(accountServiceMock.getAccountTxCount).toHaveBeenCalledWith(parent.address); - }); - - it("get account detailed smart contract count should return count", async () => { - const expectedCount: number = randomInt(3); - - jest.spyOn(accountServiceMock, "getAccountScResults").mockImplementation(() => Promise.resolve(expectedCount)); - - const actualCount: number = await accountDetailedResolver.getAccountDetailedSmartContractCount(parent); - - expect(actualCount).toEqual(expectedCount); - - expect(accountServiceMock.getAccountScResults).toHaveBeenCalledWith(parent.address); - }); - - it("get account detailed NFT collections with non-existing account should return null", async () => { - const input: GetNftCollectionsAccountInput = new GetNftCollectionsAccountInput(); - - const expectedCollections = null; - - await assertGetAccountDetailedNftCollections(new AccountDetailed({ address: "" }), input, expectedCollections); - }); - - it("get account detailed NFT collections with existing account and default input should return collection", async () => { - CollectionServiceMock.generateCollections(parent.address); - - const input: GetNftCollectionsAccountInput = new GetNftCollectionsAccountInput(); - - const expectedCollections: NftCollectionAccount[] = CollectionServiceMock.collections[parent.address].slice(input.from, input.size); - - await assertGetAccountDetailedNftCollections(parent, input, expectedCollections); - }); - - it("get account detailed NFT collections with existing account and user input should return collection", async () => { - CollectionServiceMock.generateCollections(parent.address); - - const input: GetNftCollectionsAccountInput = new GetNftCollectionsAccountInput({ - from: randomInt(3), - size: randomInt(3), - }); - - const expectedCollections: NftCollectionAccount[] = CollectionServiceMock.collections[parent.address].slice(input.from, input.size); - - await assertGetAccountDetailedNftCollections(parent, input, expectedCollections); - }); - - it("get account detailed NFTs with non-existing account should return null", async () => { - const input: GetNftsAccountInput = new GetNftsAccountInput(); - - const expectedNfts = null; - - await assertGetAccountDetailedNfts(new AccountDetailed({ address: "" }), input, expectedNfts); - }); - - it("get account detailed NFTs with existing account and default input should return NFTs", async () => { - NftServiceMock.generateNfts(parent.address); - - const input: GetNftsAccountInput = new GetNftsAccountInput(); - - const expectedNfts: NftAccount[] = NftServiceMock.nfts[parent.address].slice(input.from, input.size); - - await assertGetAccountDetailedNfts(parent, input, expectedNfts); - }); - - it("get account detailed NFTs with existing account and user input should return NFTs", async () => { - NftServiceMock.generateNfts(parent.address); - - const input: GetNftsAccountInput = new GetNftsAccountInput({ - from: randomInt(3), - size: randomInt(3), - }); - - const expectedNfts: NftAccount[] = NftServiceMock.nfts[parent.address].slice(input.from, input.size); - - await assertGetAccountDetailedNfts(parent, input, expectedNfts); - }); - - async function assertGetAccountDetailedNftCollections(account: AccountDetailed, input: GetNftCollectionsAccountInput, expectedCollections: NftCollectionAccount[] | null) { - jest.spyOn(collectionServiceMock, "getCollectionsForAddress"); - - const actualCollection: NftCollectionAccount[] = await accountDetailedResolver.getAccountDetailedNftCollections(input, account); - - expect(actualCollection).toEqual(expectedCollections); - - expect(collectionServiceMock.getCollectionsForAddress).toHaveBeenCalledWith( - account.address, - new CollectionFilter({ - search: input.search, - type: input.type, - }), - new QueryPagination({ - from: input.from, - size: input.size, - }) - ); - } - - async function assertGetAccountDetailedNfts(account: AccountDetailed, input: GetNftsAccountInput, expectedNfts: NftAccount[] | null) { - jest.spyOn(nftServiceMock, "getNftsForAddress"); - - const nfts: NftAccount[] = await accountDetailedResolver.getAccountDetailedNfts(input, account); - - expect(nfts).toEqual(expectedNfts); - - expect(nftServiceMock.getNftsForAddress).toHaveBeenCalledWith( - account.address, - new QueryPagination({ - from: input.from, - size: input.size, - }), - new NftFilter({ - search: input.search, - identifiers: input.identifiers, - type: input.type, - name: input.name, - collections: input.collections, - tags: input.tags, - creator: input.creator, - hasUris: input.hasUris, - includeFlagged: input.includeFlagged, - }), - undefined, - new NftQueryOptions({ - withSupply: input.withSupply, - }), - input.source - ); - } -}); diff --git a/src/test/unit/graphql/entities/account/account.query.spec.ts b/src/test/unit/graphql/entities/account/account.query.spec.ts deleted file mode 100644 index 1917c3aed..000000000 --- a/src/test/unit/graphql/entities/account/account.query.spec.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Test } from "@nestjs/testing"; - -import { randomInt } from "crypto"; - -import { Account } from "src/endpoints/accounts/entities/account"; -import { AccountQuery } from "src/graphql/entities/account/account.query"; -import { AccountService } from "src/endpoints/accounts/account.service"; -import { AccountServiceMock } from "src/test/unit/graphql/mocks/account.service.mock"; -import { GetAccountFilteredInput, GetAccountsInput } from "src/graphql/entities/account/account.input"; - -describe(AccountQuery, () => { - - const AccountServiceMockProvider = { - provide: AccountService, - useClass: AccountServiceMock, - }; - - let accountQuery: AccountQuery; - - let accountServiceMock: AccountService; - - beforeAll(async () => { - const module = await Test.createTestingModule({ - providers: [ - AccountQuery, - - AccountServiceMockProvider, - ], - }).compile(); - - accountQuery = module.get(AccountQuery); - - accountServiceMock = module.get(AccountService); - }); - - it("should be defined", () => { - expect(accountQuery).toBeDefined(); - }); - - it("get accounts with default input should return accounts", async () => { - const input: GetAccountsInput = new GetAccountsInput(); - - const expectedAccounts: Account[] = AccountServiceMock.accounts.slice(input.from, input.size); - - await assertGetAccounts(input, expectedAccounts); - }); - - it("get accounts with user input should return accounts", async () => { - const input: GetAccountsInput = new GetAccountsInput({ - from: randomInt(3), - size: randomInt(3), - ownerAddress: 'erd1', - }); - - const expectedAccounts: Account[] = AccountServiceMock.accounts.slice(input.from, input.size); - - await assertGetAccounts(input, expectedAccounts); - }); - - it("get accounts count should return accounts count", async () => { - jest.spyOn(accountServiceMock, "getAccountsCount"); - - const actualAccountsCount: number = await accountQuery.getAccountsCount(new GetAccountFilteredInput()); - const expectedAccountsCount: number = AccountServiceMock.accounts.length; - - expect(actualAccountsCount).toEqual(expectedAccountsCount); - - expect(accountServiceMock.getAccountsCount).toHaveBeenCalledTimes(1); - }); - - async function assertGetAccounts(input: GetAccountsInput, expectedAccounts: Account[]) { - jest.spyOn(accountServiceMock, "getAccounts"); - - const actualAccounts: Account[] = await accountQuery.getAccounts(input); - - expect(actualAccounts).toEqual(expectedAccounts); - } -}); diff --git a/src/test/unit/graphql/entities/transaction.detailed/transaction.deatiled.query.spec.ts b/src/test/unit/graphql/entities/transaction.detailed/transaction.deatiled.query.spec.ts deleted file mode 100644 index aa0d16e65..000000000 --- a/src/test/unit/graphql/entities/transaction.detailed/transaction.deatiled.query.spec.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Test } from "@nestjs/testing"; - -import { Transaction } from "src/endpoints/transactions/entities/transaction"; -import { TransactionDetailedQuery } from "src/graphql/entities/transaction.detailed/transaction.detailed.query"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; -import { TransactionServiceMock } from "src/test/unit/graphql/mocks/transaction.service.mock"; -import { GetTransactionDetailedInput } from "src/graphql/entities/transaction.detailed/transaction.detailed.input"; - -describe(TransactionDetailedQuery, () => { - - const TransactionServiceMockProvider = { - provide: TransactionService, - useClass: TransactionServiceMock, - }; - - let transactionDetailedQuery: TransactionDetailedQuery; - - let transactionServiceMock: TransactionService; - - beforeAll(async () => { - const module = await Test.createTestingModule({ - providers: [ - TransactionDetailedQuery, - - TransactionServiceMockProvider, - ], - }).compile(); - - transactionDetailedQuery = module.get(TransactionDetailedQuery); - - transactionServiceMock = module.get(TransactionService); - }); - - it("should be defined", () => { - expect(transactionDetailedQuery).toBeDefined(); - }); - - it("get transaction with non-existing hash should return null", async () => { - const expectedTransaction = null; - - await assertGetTransactionDetailed("", expectedTransaction); - }); - - it("get transaction with existing hash should return transaction", async () => { - // @ts-ignore - const expectedTransaction: Transaction = TransactionServiceMock.transactions.at(0); - - await assertGetTransactionDetailed(expectedTransaction.txHash, expectedTransaction); - }); - - async function assertGetTransactionDetailed(hash: string, expectedTransaction: Transaction | null) { - jest.spyOn(transactionServiceMock, "getTransaction"); - - const input: GetTransactionDetailedInput = new GetTransactionDetailedInput({ - hash: hash, - }); - - const actualTransaction = await transactionDetailedQuery.getTransactionDetailed(input); - - expect(actualTransaction).toEqual(expectedTransaction); - - expect(transactionServiceMock.getTransaction).toHaveBeenCalledWith(input.hash); - } -}); diff --git a/src/test/unit/graphql/entities/transaction/transaction.query.spec.ts b/src/test/unit/graphql/entities/transaction/transaction.query.spec.ts deleted file mode 100644 index 0b786efcf..000000000 --- a/src/test/unit/graphql/entities/transaction/transaction.query.spec.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { Test } from "@nestjs/testing"; - -import { GetTransactionsCountInput } from "src/graphql/entities/transaction/transaction.input"; -import { TransactionFilter } from "src/endpoints/transactions/entities/transaction.filter"; -import { TransactionService } from "src/endpoints/transactions/transaction.service"; -import { TransactionServiceMock } from "src/test/unit/graphql/mocks/transaction.service.mock"; -import { TransactionQuery } from "src/graphql/entities/transaction/transaction.query"; -import { TransactionDetailed } from "src/endpoints/transactions/entities/transaction.detailed"; - -describe(TransactionQuery, () => { - - const TransactionServiceMockProvider = { - provide: TransactionService, - useClass: TransactionServiceMock, - }; - - let transactionQuery: TransactionQuery; - - let transactionServiceMock: TransactionService; - - beforeEach(async () => { - const module = await Test.createTestingModule({ - providers: [ - TransactionQuery, - - TransactionServiceMockProvider, - ], - }).compile(); - - transactionQuery = module.get(TransactionQuery); - - transactionServiceMock = module.get(TransactionService); - }); - - it("should be defined", () => { - expect(transactionQuery).toBeDefined(); - }); - - it("get transactions count with non-existing transactions should return count", async () => { - const input: GetTransactionsCountInput = new GetTransactionsCountInput(); - - const expectedTransactionsCount: number = TransactionServiceMock.transactions.length; - - await assertGetTransactionsCount(input, expectedTransactionsCount); - }); - - it("get transactions count with existing transactions should return one", async () => { - // @ts-ignore - const expectedTransactions: TransactionDetailed[] = TransactionServiceMock.transactions.slice(0, 3); - - const input: GetTransactionsCountInput = new GetTransactionsCountInput({ - hashes: expectedTransactions.map((transaction) => transaction.txHash), - }); - - const expectedTransactionsCount: number = expectedTransactions.length; - - await assertGetTransactionsCount(input, expectedTransactionsCount); - }); - - async function assertGetTransactionsCount(input: GetTransactionsCountInput, expectedTransactionsCount: number) { - jest.spyOn(transactionServiceMock, "getTransactionCount"); - - const actualTransactionsCount: number = await transactionQuery.getTransactionsCount(input); - - expect(actualTransactionsCount).toEqual(expectedTransactionsCount); - - expect(transactionServiceMock.getTransactionCount).toHaveBeenCalledWith( - new TransactionFilter({ - sender: input.sender, - receivers: input.receiver ? [input.receiver] : [], - token: input.token, - senderShard: input.senderShard, - receiverShard: input.receiverShard, - miniBlockHash: input.miniBlockHash, - hashes: input.hashes, - status: input.status, - functions: input.function, - before: input.before, - after: input.after, - condition: input.condition, - }) - ); - } -}); diff --git a/src/test/unit/graphql/mocks/account.service.mock.ts b/src/test/unit/graphql/mocks/account.service.mock.ts deleted file mode 100644 index e8006b02e..000000000 --- a/src/test/unit/graphql/mocks/account.service.mock.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { randomInt, randomUUID } from "crypto"; - -import { Account } from "src/endpoints/accounts/entities/account"; -import { AccountDetailed } from "src/endpoints/accounts/entities/account.detailed"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -export class AccountServiceMock { - private static readonly count = randomInt(25, 100); - - private static readonly generateAccount = (): AccountDetailed => { - return new AccountDetailed({ - address: randomUUID(), - }); - }; - - static readonly accounts: Array = Array.from({ length: AccountServiceMock.count }, () => AccountServiceMock.generateAccount()); - - public getAccounts(queryPagination: QueryPagination): Array { - return AccountServiceMock.accounts.slice(queryPagination.from, queryPagination.size); - } - - public getAccountsCount(): number { - return AccountServiceMock.accounts.length; - } - - public getAccountSimple(address: string): AccountDetailed | null { - return AccountServiceMock.accounts.find(account => account.address === address) ?? null; - } - - public getAccountTxCount(_: string): number { - return 0; - } - - public getAccountScResults(_: string): number { - return 0; - } -} diff --git a/src/test/unit/graphql/mocks/collection.service.mock.ts b/src/test/unit/graphql/mocks/collection.service.mock.ts deleted file mode 100644 index bc393f467..000000000 --- a/src/test/unit/graphql/mocks/collection.service.mock.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { randomInt } from "crypto"; - -import { CollectionFilter } from "src/endpoints/collections/entities/collection.filter"; -import { NftCollectionAccount } from "src/endpoints/collections/entities/nft.collection.account"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -export class CollectionServiceMock { - private static readonly count = randomInt(25, 100); - - private static readonly generateCollection = (address: string) => { - return new NftCollectionAccount({ - owner: address, - }); - }; - - public static readonly generateCollections = (address: string) => { - CollectionServiceMock.collections[address] = Array.from({ length: CollectionServiceMock.count }, () => CollectionServiceMock.generateCollection(address)); - }; - - static readonly collections: { [address: string]: NftCollectionAccount[] } = {}; - - public getCollectionsForAddress(address: string, _: CollectionFilter, queryPagination: QueryPagination): NftCollectionAccount[] | null { - return CollectionServiceMock.collections[address]?.slice(queryPagination.from, queryPagination.size) ?? null; - } -} diff --git a/src/test/unit/graphql/mocks/nft.service.mock.ts b/src/test/unit/graphql/mocks/nft.service.mock.ts deleted file mode 100644 index 2fd44990b..000000000 --- a/src/test/unit/graphql/mocks/nft.service.mock.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { randomInt } from "crypto"; - -import { NftAccount } from "src/endpoints/nfts/entities/nft.account"; -import { NftFilter } from "src/endpoints/nfts/entities/nft.filter"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -export class NftServiceMock { - private static readonly count = randomInt(25, 100); - - private static readonly generateNft = (address: string) => { - return new NftAccount({ - owner: address, - }); - }; - - public static readonly generateNfts = (address: string) => { - NftServiceMock.nfts[address] = Array.from({ length: NftServiceMock.count }, () => NftServiceMock.generateNft(address)); - }; - - static readonly nfts: { [address: string]: NftAccount[] } = {}; - - public getNftsForAddress(address: string, queryPagination: QueryPagination, _: NftFilter): NftAccount[] | null { - return NftServiceMock.nfts[address]?.slice(queryPagination.from, queryPagination.size) ?? null; - } -} diff --git a/src/test/unit/graphql/mocks/transaction.service.mock.ts b/src/test/unit/graphql/mocks/transaction.service.mock.ts deleted file mode 100644 index 0fe56b263..000000000 --- a/src/test/unit/graphql/mocks/transaction.service.mock.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { randomInt, randomUUID } from "crypto"; - -import { Transaction } from "src/endpoints/transactions/entities/transaction"; -import { TransactionDetailed } from "src/endpoints/transactions/entities/transaction.detailed"; -import { TransactionFilter } from "src/endpoints/transactions/entities/transaction.filter"; -import { TransactionQueryOptions } from "src/endpoints/transactions/entities/transactions.query.options"; -import { QueryPagination } from "src/common/entities/query.pagination"; - -export class TransactionServiceMock { - private static readonly count = randomInt(25, 100); - - private static readonly generateTransaction = (): TransactionDetailed => { - return new TransactionDetailed({ - txHash: randomUUID(), - sender: randomUUID(), - }); - }; - - static readonly transactions: Array = Array.from({ length: TransactionServiceMock.count }, () => TransactionServiceMock.generateTransaction()); - - public getTransactions(_: TransactionFilter, __: QueryPagination, ___?: TransactionQueryOptions, ____?: string): Array { - return TransactionServiceMock.transactions; - } - - public getTransactionCount(transactionFilter: TransactionFilter, __?: string): number { - const length: number = TransactionServiceMock.transactions.filter(transaction => transactionFilter.hashes?.some((hash) => transaction.txHash === hash)).length; - - return length === 0 ? TransactionServiceMock.transactions.length : length; - } - - public getTransaction(hash: string, _?: string[]): TransactionDetailed | null { - return TransactionServiceMock.transactions.find(transaction => transaction.txHash === hash) ?? null; - } -}