Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove support for graphql #1368

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/common/api-config/api.config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,6 @@ export class ApiConfigService {
return this.configService.get<boolean>('features.processNfts.enabled') ?? this.configService.get<boolean>('flags.processNfts') ?? false;
}

isGraphQlActive(): boolean {
return this.configService.get<boolean>('api.graphql') ?? false;
}

getIsPublicApiActive(): boolean {
const isApiActive = this.configService.get<boolean>('api.public');
if (isApiActive === undefined) {
Expand Down
27 changes: 1 addition & 26 deletions src/common/assets/entities/account.assets.social.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,22 @@
import { Field, ObjectType } from "@nestjs/graphql";
import { ObjectType } from "@nestjs/graphql";

@ObjectType("AccountAssetsSocial", { description: "Account assets social object type." })
export class AccountAssetsSocial {
constructor(init?: Partial<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 = '';
}
17 changes: 1 addition & 16 deletions src/common/assets/entities/account.assets.ts
Original file line number Diff line number Diff line change
@@ -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." })
Expand All @@ -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;
}
6 changes: 1 addition & 5 deletions src/common/assets/entities/nft.rank.ts
Original file line number Diff line number Diff line change
@@ -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<NftRank>) {
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;
}
5 changes: 0 additions & 5 deletions src/common/assets/entities/token.assets.price.source.ts
Original file line number Diff line number Diff line change
@@ -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;
}
16 changes: 0 additions & 16 deletions src/common/assets/entities/token.assets.ts
Original file line number Diff line number Diff line change
@@ -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<TokenAssets>) {
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<string, string> | 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;
}
5 changes: 1 addition & 4 deletions src/common/entities/scam-info.dto.ts
Original file line number Diff line number Diff line change
@@ -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<ScamInfo>) {
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;

Expand Down
4 changes: 0 additions & 4 deletions src/common/locked-asset/entities/unlock.milestone.model.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/endpoints/accounts/account.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions src/endpoints/accounts/entities/account.contract.ts
Original file line number Diff line number Diff line change
@@ -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<AccountContract>) {
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;
}
49 changes: 18 additions & 31 deletions src/endpoints/accounts/entities/account.detailed.ts
Original file line number Diff line number Diff line change
@@ -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<AccountDetailed>) {
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;
}
4 changes: 0 additions & 4 deletions src/endpoints/accounts/entities/account.esdt.history.ts
Original file line number Diff line number Diff line change
@@ -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<AccountEsdtHistory>) {
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;
}
Loading
Loading