diff --git a/src/common/entities/scam-info.dto.ts b/src/common/entities/scam-info.dto.ts index d6c2f2b94..30161abc2 100644 --- a/src/common/entities/scam-info.dto.ts +++ b/src/common/entities/scam-info.dto.ts @@ -6,6 +6,7 @@ export class ScamInfo { Object.assign(this, init); } + @ApiProperty({ type: String, nullable: true }) type?: string | null; @ApiProperty({ type: String, nullable: true }) 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.detailed.ts b/src/endpoints/accounts/entities/account.detailed.ts index 4898282d4..2c9f131ec 100644 --- a/src/endpoints/accounts/entities/account.detailed.ts +++ b/src/endpoints/accounts/entities/account.detailed.ts @@ -11,64 +11,64 @@ export class AccountDetailed extends Account { Object.assign(this, init); } - @ApiProperty({ description: 'The source code in hex format' }) + @ApiProperty({ description: 'The source code in hex format', required: false }) code: string = ''; - @ApiProperty({ description: 'The hash of the source code' }) + @ApiProperty({ description: 'The hash of the source code', required: false }) codeHash: string = ''; @ApiProperty({ description: 'The hash of the root node' }) rootHash: string = ''; - @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; @ApiProperty({ description: 'The developer reward' }) developerReward: string = ''; - @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 = ''; - @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean }) + @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false }) isUpgradeable?: boolean; - @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean }) + @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false }) isReadable?: boolean; - @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean }) + @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false }) isPayable?: boolean; - @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; - @ApiProperty({ type: ScamInfo, nullable: true }) + @ApiProperty({ type: ScamInfo, nullable: true, required: false }) scamInfo: ScamInfo | undefined = undefined; - @ApiProperty({ description: 'Account nft collections', type: Boolean, nullable: true }) + @ApiProperty({ description: 'Account nft collections', type: Boolean, nullable: true, required: false }) nftCollections: NftCollectionAccount[] | undefined = undefined; - @ApiProperty({ description: 'Account nfts', type: Boolean, 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.history.ts b/src/endpoints/accounts/entities/account.history.ts index 305e94413..4fe64333b 100644 --- a/src/endpoints/accounts/entities/account.history.ts +++ b/src/endpoints/accounts/entities/account.history.ts @@ -15,6 +15,6 @@ export class AccountHistory { @ApiProperty({ type: Number, example: 10000 }) timestamp: number = 0; - @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.ts b/src/endpoints/accounts/entities/account.ts index 14e77ebf9..6403d3cce 100644 --- a/src/endpoints/accounts/entities/account.ts +++ b/src/endpoints/accounts/entities/account.ts @@ -22,19 +22,19 @@ export class Account { @ApiProperty({ type: Number, description: 'The shard ID allocated to the account', example: 0 }) shard: number = 0; - @ApiProperty({ type: String, description: 'Current owner address' }) + @ApiProperty({ type: String, description: 'Current owner address', required: false }) ownerAddress: string | undefined = undefined; - @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets' }) + @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets', required: false }) assets: AccountAssets | undefined = undefined; - @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; - @ApiProperty({ description: 'The contract deploy transaction hash' }) + @ApiProperty({ description: 'The contract deploy transaction hash', required: false }) deployTxHash?: string | null; - @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets' }) + @ApiProperty({ type: AccountAssets, nullable: true, description: 'Account assets', required: false }) ownerAssets: AccountAssets | undefined = undefined; @ApiProperty({ description: 'Specific property flag for smart contract', type: Boolean, required: false }) @@ -46,6 +46,6 @@ export class Account { @ApiProperty({ description: 'The number of smart contract results of this account' }) scrCount?: number; - @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/deployed.contract.ts b/src/endpoints/accounts/entities/deployed.contract.ts index 952c95806..b2dce1663 100644 --- a/src/endpoints/accounts/entities/deployed.contract.ts +++ b/src/endpoints/accounts/entities/deployed.contract.ts @@ -15,6 +15,6 @@ export class DeployedContract { @ApiProperty({ type: Number }) timestamp: number = 0; - @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/blocks/entities/block.ts b/src/endpoints/blocks/entities/block.ts index b3b9d6d32..52ed4e1e7 100644 --- a/src/endpoints/blocks/entities/block.ts +++ b/src/endpoints/blocks/entities/block.ts @@ -22,7 +22,7 @@ export class Block { @ApiProperty({ type: String }) proposer: string = ''; - @ApiProperty({ type: Identity, nullable: true }) + @ApiProperty({ type: Identity, nullable: true, required: false }) proposerIdentity: Identity | undefined = undefined; @ApiProperty({ type: String }) @@ -61,7 +61,7 @@ export class Block { @ApiProperty({ type: Number }) maxGasLimit: number = 0; - @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/nft.collection.ts b/src/endpoints/collections/entities/nft.collection.ts index e1f92fb99..da03e0c7a 100644 --- a/src/endpoints/collections/entities/nft.collection.ts +++ b/src/endpoints/collections/entities/nft.collection.ts @@ -56,24 +56,24 @@ export class NftCollection { @ApiProperty({ type: Number, nullable: true }) decimals: number | undefined = undefined; - @ApiProperty({ type: TokenAssets, nullable: true }) + @ApiProperty({ type: TokenAssets, nullable: true, required: false }) assets: TokenAssets | undefined = undefined; - @ApiProperty({ type: ScamInfo, nullable: true }) + @ApiProperty({ type: ScamInfo, nullable: true, required: false }) scamInfo: ScamInfo | undefined = undefined; - @ApiProperty({ type: CollectionTrait, isArray: true }) + @ApiProperty({ type: CollectionTrait, isArray: true, required: false }) traits: CollectionTrait[] = []; - @ApiProperty({ type: CollectionAuctionStats, nullable: true }) + @ApiProperty({ type: CollectionAuctionStats, nullable: true, required: false }) auctionStats: CollectionAuctionStats | undefined = undefined; - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) isVerified: boolean | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) holderCount: number | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) nftCount: number | undefined = undefined; } diff --git a/src/endpoints/identities/entities/identity.ts b/src/endpoints/identities/entities/identity.ts index 749283471..adab738d9 100644 --- a/src/endpoints/identities/entities/identity.ts +++ b/src/endpoints/identities/entities/identity.ts @@ -15,19 +15,19 @@ export class Identity { @ApiProperty({ type: String }) description?: string; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) avatar?: string; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) website?: string; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) twitter?: string; @ApiProperty({ type: String }) location?: string; - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) score?: number; @ApiProperty({ type: Number }) @@ -45,15 +45,15 @@ export class Identity { @ApiProperty() distribution?: { [index: string]: number | undefined } = {}; - @ApiProperty({ type: [String] }) + @ApiProperty({ type: [String], required: false }) providers?: string[]; - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) stakePercent?: number; - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) rank?: number; - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) apr?: number; } diff --git a/src/endpoints/mex/entities/mex.farm.ts b/src/endpoints/mex/entities/mex.farm.ts index fd456aae0..392e10148 100644 --- a/src/endpoints/mex/entities/mex.farm.ts +++ b/src/endpoints/mex/entities/mex.farm.ts @@ -10,7 +10,7 @@ export class MexFarm { @ApiProperty({ enum: MexFarmType }) type: MexFarmType = MexFarmType.standard; - @ApiProperty({ nullable: true }) + @ApiProperty({ nullable: true, required: false }) version?: string; @ApiProperty({ type: String, example: 'erd1qqqqqqqqqqqqqpgqzps75vsk97w9nsx2cenv2r2tyxl4fl402jpsx78m9j' }) diff --git a/src/endpoints/network/entities/about.ts b/src/endpoints/network/entities/about.ts index 408331d54..e61665f13 100644 --- a/src/endpoints/network/entities/about.ts +++ b/src/endpoints/network/entities/about.ts @@ -9,13 +9,13 @@ export class About { @ApiProperty({ type: String, nullable: true }) appVersion: string | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) pluginsVersion: string | undefined = undefined; @ApiProperty({ type: String }) network: string = ''; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) cluster: string = ''; @ApiProperty({ type: String }) @@ -27,7 +27,7 @@ export class About { @ApiProperty({ type: String }) gatewayVersion: string | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) scamEngineVersion: string | undefined = undefined; @ApiProperty({ type: FeatureConfigs, nullable: true }) diff --git a/src/endpoints/nfts/entities/nft.account.ts b/src/endpoints/nfts/entities/nft.account.ts index c22e48d35..66cdb2221 100644 --- a/src/endpoints/nfts/entities/nft.account.ts +++ b/src/endpoints/nfts/entities/nft.account.ts @@ -10,9 +10,9 @@ export class NftAccount extends Nft { @ApiProperty({ type: String, example: 10 }) balance: string = ''; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) price: number | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) valueUsd: number | undefined = undefined; } diff --git a/src/endpoints/nfts/entities/nft.ts b/src/endpoints/nfts/entities/nft.ts index b9ba51c93..d8af5956c 100644 --- a/src/endpoints/nfts/entities/nft.ts +++ b/src/endpoints/nfts/entities/nft.ts @@ -50,16 +50,16 @@ export class Nft { @ApiProperty({ type: String }) url: string = ''; - @ApiProperty({ type: NftMedia, nullable: true }) + @ApiProperty({ type: NftMedia, nullable: true, required: false }) media: NftMedia[] | undefined = undefined; - @ApiProperty({ type: Boolean, default: false }) + @ApiProperty({ type: Boolean, default: false, required: false }) isWhitelistedStorage: boolean = false; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) thumbnailUrl: string = ''; - @ApiProperty({ type: String, isArray: true }) + @ApiProperty({ type: String, isArray: true, required: false }) tags: string[] = []; @ApiProperty({ type: NftMetadata, nullable: true }) @@ -79,30 +79,30 @@ export class Nft { @ApiProperty({ type: Number, nullable: true }) decimals: number | undefined = undefined; - @ApiProperty({ type: TokenAssets }) + @ApiProperty({ type: TokenAssets, required: false }) assets?: TokenAssets; @ApiProperty({ type: String }) ticker?: string = ''; - @ApiProperty({ type: ScamInfo, nullable: true }) + @ApiProperty({ type: ScamInfo, nullable: true, required: false }) scamInfo: ScamInfo | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) score: number | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) rank: number | undefined = undefined; - @ApiProperty({ type: NftRarities, nullable: true }) + @ApiProperty({ type: NftRarities, nullable: true, required: false }) rarities: NftRarities | undefined = undefined; @ApiProperty({ type: Boolean, nullable: true }) isNsfw: boolean | undefined = undefined; - @ApiProperty({ type: [UnlockMileStoneModel], nullable: true }) + @ApiProperty({ type: [UnlockMileStoneModel], nullable: true, required: false }) unlockSchedule?: UnlockMileStoneModel[] | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) unlockEpoch?: number | undefined = 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.ts b/src/endpoints/nodes/entities/node.ts index d4d2e27c6..4cc67f2ea 100644 --- a/src/endpoints/nodes/entities/node.ts +++ b/src/endpoints/nodes/entities/node.ts @@ -111,7 +111,7 @@ export class Node { @ApiProperty({ type: Number, example: 15 }) epochsLeft: number | undefined = undefined; - @ApiProperty({ type: Identity, nullable: true }) + @ApiProperty({ type: Identity, nullable: true, required: false }) identityInfo?: Identity; @ApiProperty({ type: String, default: 0 }) diff --git a/src/endpoints/providers/entities/nodes.infos.ts b/src/endpoints/providers/entities/nodes.infos.ts index b798404ef..94804bda0 100644 --- a/src/endpoints/providers/entities/nodes.infos.ts +++ b/src/endpoints/providers/entities/nodes.infos.ts @@ -5,15 +5,15 @@ export class NodesInfos { Object.assign(this, init); } - @ApiProperty({ name: 'Number of nodes', type: Number, example: 10 }) + @ApiProperty({ description: 'Number of nodes', type: Number, example: 10 }) numNodes: number = 0; - @ApiProperty({ name: 'Number of stake', type: Number, example: 100 }) + @ApiProperty({ description: 'Number of stake', type: Number, example: 100 }) stake: string = ''; - @ApiProperty({ name: 'Number of topUp', type: Number, example: 100 }) + @ApiProperty({ description: 'Number of topUp', type: Number, example: 100 }) topUp: string = ''; - @ApiProperty({ name: 'Locked number', type: Number, example: 100 }) + @ApiProperty({ description: 'Locked number', type: Number, example: 100 }) locked: string = ''; } diff --git a/src/endpoints/providers/entities/provider.ts b/src/endpoints/providers/entities/provider.ts index ffed4dbdc..1c4be936b 100644 --- a/src/endpoints/providers/entities/provider.ts +++ b/src/endpoints/providers/entities/provider.ts @@ -34,7 +34,7 @@ export class Provider extends NodesInfos { @ApiProperty({ type: String, nullable: true }) cumulatedRewards: string | null = null; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) identity: string | undefined = undefined; @ApiProperty({ type: String }) @@ -55,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 d4eae487f..ea020a040 100644 --- a/src/endpoints/rounds/entities/round.detailed.ts +++ b/src/endpoints/rounds/entities/round.detailed.ts @@ -7,6 +7,6 @@ export class RoundDetailed extends Round { Object.assign(this, init); } - @ApiProperty({ name: 'Signers', type: String, isArray: true }) + @ApiProperty({ description: 'Signers', type: String, isArray: true }) signers: string[] = []; } diff --git a/src/endpoints/sc-results/entities/smart.contract.result.ts b/src/endpoints/sc-results/entities/smart.contract.result.ts index 81f454fe2..dbaa06ac0 100644 --- a/src/endpoints/sc-results/entities/smart.contract.result.ts +++ b/src/endpoints/sc-results/entities/smart.contract.result.ts @@ -33,13 +33,13 @@ export class SmartContractResult { @ApiProperty({ type: String }) receiver: string = ''; - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) senderAssets: AccountAssets | undefined = undefined; - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) receiverAssets: AccountAssets | undefined = undefined; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) relayedValue: string = ''; @ApiProperty({ type: String }) @@ -54,19 +54,19 @@ export class SmartContractResult { @ApiProperty({ type: String }) callType: string = ''; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) miniBlockHash: string | undefined = undefined; - @ApiProperty({ type: TransactionLog, nullable: true }) + @ApiProperty({ type: TransactionLog, nullable: true, required: false }) logs: TransactionLog | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) returnMessage: string | undefined = undefined; - @ApiProperty({ type: TransactionAction, nullable: true }) + @ApiProperty({ type: TransactionAction, nullable: true, required: false }) action: TransactionAction | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) function: string | undefined = undefined; @ApiProperty({ type: String, nullable: true }) diff --git a/src/endpoints/shards/entities/shard.ts b/src/endpoints/shards/entities/shard.ts index 5e94ce02a..29ee72dff 100644 --- a/src/endpoints/shards/entities/shard.ts +++ b/src/endpoints/shards/entities/shard.ts @@ -5,12 +5,12 @@ export class Shard { Object.assign(this, init); } - @ApiProperty({ name: 'Shard details', type: Number, example: 1 }) + @ApiProperty({ description: 'Shard details', type: Number, example: 1 }) shard: number = 0; - @ApiProperty({ name: 'Validators details', type: Number, example: 800 }) + @ApiProperty({ description: 'Validators details', type: Number, example: 800 }) validators: number = 0; - @ApiProperty({ name: 'Active validtors details', 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 7713de15f..21ef902ff 100644 --- a/src/endpoints/stake/entities/account.delegation.ts +++ b/src/endpoints/stake/entities/account.delegation.ts @@ -7,21 +7,21 @@ export class AccountDelegation { Object.assign(this, init); } - @ApiProperty({ name: 'Delegation account details', type: String }) + @ApiProperty({ description: 'Delegation account details', type: String }) address: string = ""; - @ApiProperty({ name: 'Account delegation contract', type: String }) + @ApiProperty({ description: 'Account delegation contract', type: String }) contract: string = ""; - @ApiProperty(SwaggerUtils.amountPropertyOptions()) + @ApiProperty(SwaggerUtils.amountPropertyOptions({ required: false })) userUnBondable: string = ""; - @ApiProperty(SwaggerUtils.amountPropertyOptions()) + @ApiProperty(SwaggerUtils.amountPropertyOptions({ required: false })) userActiveStake: string = ""; - @ApiProperty(SwaggerUtils.amountPropertyOptions()) + @ApiProperty(SwaggerUtils.amountPropertyOptions({ required: false })) claimableRewards: string = ""; - @ApiProperty({ name: 'User undelegated list details', 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/provider.stake.ts b/src/endpoints/stake/entities/provider.stake.ts index bf4ec0b84..64586736e 100644 --- a/src/endpoints/stake/entities/provider.stake.ts +++ b/src/endpoints/stake/entities/provider.stake.ts @@ -10,6 +10,6 @@ export class ProviderStake { @ApiProperty(SwaggerUtils.amountPropertyOptions()) totalStaked: string = ''; - @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/tokens/entities/token.supply.result.ts b/src/endpoints/tokens/entities/token.supply.result.ts index 9d63d90d4..879486880 100644 --- a/src/endpoints/tokens/entities/token.supply.result.ts +++ b/src/endpoints/tokens/entities/token.supply.result.ts @@ -6,21 +6,21 @@ export class TokenSupplyResult { Object.assign(this, init); } - @ApiProperty({ name: 'Supply details', type: String }) + @ApiProperty({ description: 'Supply details', type: String }) supply: string | number = ''; - @ApiProperty({ name: 'Circulating supply details', type: String }) + @ApiProperty({ description: 'Circulating supply details', type: String }) circulatingSupply: string | number = ''; - @ApiProperty({ name: 'Minted details', type: String }) + @ApiProperty({ description: 'Minted details', type: String }) minted: string | number | undefined; - @ApiProperty({ name: 'Token burnt details', type: String }) + @ApiProperty({ description: 'Token burnt details', type: String }) burnt: string | number | undefined; - @ApiProperty({ name: 'Initial minted details', type: String }) + @ApiProperty({ description: 'Initial minted details', type: String }) initialMinted: string | number | undefined; - @ApiProperty({ name: 'Esdt locked accounts details', type: EsdtLockedAccount, isArray: true }) + @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 a03615cc1..6b2a97ecc 100644 --- a/src/endpoints/tokens/entities/token.ts +++ b/src/endpoints/tokens/entities/token.ts @@ -16,10 +16,10 @@ export class Token { @ApiProperty({ type: String }) identifier: string = ''; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) collection: string | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) nonce: number | undefined = undefined; @ApiProperty({ type: String }) @@ -46,7 +46,7 @@ export class Token { @ApiProperty({ type: Boolean, default: false }) isPaused: boolean = false; - @ApiProperty({ type: TokenAssets, nullable: true }) + @ApiProperty({ type: TokenAssets, nullable: true, required: false }) assets: TokenAssets | undefined = undefined; @ApiProperty({ type: Number, nullable: true }) @@ -94,10 +94,10 @@ export class Token { @ApiProperty({ type: Boolean, nullable: true }) canTransferNftCreateRole: boolean | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) price: number | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) marketCap: number | undefined = undefined; @ApiProperty(SwaggerUtils.amountPropertyOptions({ description: 'Supply amount' })) @@ -112,19 +112,19 @@ export class Token { @ApiProperty({ enum: MexPairType }) mexPairType: MexPairType = MexPairType.experimental; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) totalLiquidity: number | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) totalVolume24h: number | undefined = undefined; - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) isLowLiquidity: boolean | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) lowLiquidityThresholdPercent: number | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) tradesCount: number | undefined = undefined; @Field(() => TokenOwnersHistory, { description: 'Token owners history.', nullable: true }) diff --git a/src/endpoints/tokens/entities/token.with.balance.ts b/src/endpoints/tokens/entities/token.with.balance.ts index f7b9be8df..808b699e8 100644 --- a/src/endpoints/tokens/entities/token.with.balance.ts +++ b/src/endpoints/tokens/entities/token.with.balance.ts @@ -12,10 +12,10 @@ export class TokenWithBalance extends Token { @ApiProperty(SwaggerUtils.amountPropertyOptions()) balance: string = ''; - @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; @ApiProperty({ enum: MexPairType }) 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.log.ts b/src/endpoints/transactions/entities/transaction.log.ts index 6d2c553f7..256f3cd83 100644 --- a/src/endpoints/transactions/entities/transaction.log.ts +++ b/src/endpoints/transactions/entities/transaction.log.ts @@ -7,15 +7,15 @@ export class TransactionLog { Object.assign(this, init); } - @ApiProperty({ name: 'Transaction log ID', type: String }) + @ApiProperty({ description: 'Transaction log ID', type: String }) id: string | undefined = undefined; - @ApiProperty({ name: 'Transaction log address', type: String }) + @ApiProperty({ description: 'Transaction log address', type: String }) address: string = ''; - @ApiProperty({ name: 'Transaction address assets', type: AccountAssets, nullable: true }) + @ApiProperty({ description: 'Transaction address assets', type: AccountAssets, nullable: true, required: false }) addressAssets: AccountAssets | undefined = undefined; - @ApiProperty({ name: 'Transaction log events', type: TransactionLogEvent, isArray: true }) + @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 670476984..eb7471494 100644 --- a/src/endpoints/transactions/entities/transaction.operation.ts +++ b/src/endpoints/transactions/entities/transaction.operation.ts @@ -18,25 +18,25 @@ export class TransactionOperation { @ApiProperty({ enum: TransactionOperationType, default: TransactionOperationType.none }) type: TransactionOperationType = TransactionOperationType.none; - @ApiProperty({ enum: EsdtType }) + @ApiProperty({ enum: EsdtType, required: false }) esdtType?: EsdtType; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) identifier: string = ''; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) ticker?: string = ''; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) collection?: string; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) name?: string; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, required: false }) value?: string; - @ApiProperty({ type: Number }) + @ApiProperty({ type: Number, required: false }) valueUSD?: number; @ApiProperty({ type: String }) @@ -45,24 +45,24 @@ export class TransactionOperation { @ApiProperty({ type: String }) receiver: string = ''; - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) senderAssets: AccountAssets | undefined = undefined; - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) receiverAssets: AccountAssets | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number, nullable: true, required: false }) decimals?: number; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) data?: string; - @ApiProperty() + @ApiProperty({ required: false }) additionalData?: string[] = []; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) message?: string; - @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 30ce18748..4d9da10c5 100644 --- a/src/endpoints/transactions/entities/transaction.pool.ts +++ b/src/endpoints/transactions/entities/transaction.pool.ts @@ -20,7 +20,7 @@ export class TransactionPool { @ApiProperty({ type: Number, description: 'Nonce details', example: 100 }) nonce?: number; - @ApiProperty({ type: String, description: 'Transaction data', example: 'TEST==' }) + @ApiProperty({ type: String, description: 'Transaction data', example: 'TEST==', required: false }) data?: string; @ApiProperty({ type: Number, description: 'Transaction gas price', example: 1000000000 }) diff --git a/src/endpoints/transactions/entities/transaction.ts b/src/endpoints/transactions/entities/transaction.ts index 4ba6f74a5..9eed2dd2f 100644 --- a/src/endpoints/transactions/entities/transaction.ts +++ b/src/endpoints/transactions/entities/transaction.ts @@ -13,53 +13,53 @@ export class Transaction { @ApiProperty({ type: String }) txHash: string = ''; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) gasLimit: number | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) gasPrice: number | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) gasUsed: number | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String }) miniBlockHash: string | undefined = undefined; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) nonce: number | undefined = undefined; @ApiProperty({ type: String }) receiver: string = ''; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, nullable: true, required: false }) receiverUsername: string = ''; receiverAccount: Account | undefined = undefined; - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) receiverAssets: AccountAssets | undefined = undefined; @ApiProperty({ type: Number }) receiverShard: number = 0; - @ApiProperty({ type: Number, nullable: true }) + @ApiProperty({ type: Number }) round: number | undefined = undefined; @ApiProperty({ type: String }) sender: string = ''; - @ApiProperty({ type: String }) + @ApiProperty({ type: String, nullable: true, required: false }) senderUsername: string = ''; senderAccount: Account | undefined = undefined; - @ApiProperty({ type: AccountAssets, nullable: true }) + @ApiProperty({ type: AccountAssets, nullable: true, required: false }) senderAssets: AccountAssets | undefined = undefined; @ApiProperty({ type: Number }) senderShard: number = 0; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String }) signature: string | undefined = undefined; @ApiProperty({ type: String }) @@ -68,43 +68,43 @@ export class Transaction { @ApiProperty({ type: String }) value: string = ''; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String }) fee: string | undefined = undefined; @ApiProperty({ type: Number }) timestamp: number = 0; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) data: string | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) function: string | undefined = undefined; - @ApiProperty({ type: TransactionAction, nullable: true }) + @ApiProperty({ type: TransactionAction, nullable: true, required: false }) action: TransactionAction | undefined = undefined; - @ApiProperty({ type: ScamInfo, nullable: true }) + @ApiProperty({ type: ScamInfo, nullable: true, required: false }) scamInfo: ScamInfo | undefined = undefined; - @ApiProperty({ enum: TransactionType, nullable: true }) + @ApiProperty({ enum: TransactionType, nullable: true, required: false }) type: TransactionType | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) originalTxHash: string | undefined = undefined; - @ApiProperty({ type: Boolean, nullable: true }) + @ApiProperty({ type: Boolean, nullable: true, required: false }) pendingResults: boolean | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) guardianAddress: string | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) guardianSignature: string | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) isRelayed: boolean | undefined = undefined; - @ApiProperty({ type: String, nullable: true }) + @ApiProperty({ type: String, nullable: true, required: false }) relayer: string | undefined = undefined; getDate(): Date | undefined { diff --git a/src/main.ts b/src/main.ts index 7bbcee0b5..0ffab0cd9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -268,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();