Skip to content

Commit

Permalink
Merge pull request #801 from multiversx/development
Browse files Browse the repository at this point in the history
Development to main
  • Loading branch information
danielailie authored Jan 10, 2023
2 parents 9a92f5c + b516999 commit e113847
Show file tree
Hide file tree
Showing 209 changed files with 1,319 additions and 780 deletions.
15 changes: 10 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ NODE_ENV=test
KEYBASE_ENV=devnet # testnet | devnet | mainnet
NODE_CONFIG_DIR="src/config"

# ELROND configs
ELROND_API=https://testnet-api.elrond.com
ELROND_GATEWAY=https://testnet-gateway.elrond.com
ELROND_PRIVATE_API=https://testnet-private-api.elrond.com
# MultiversX configs
ELROND_API=https://testnet-api.multiversx.com
ELROND_GATEWAY=https://testnet-gateway.multiversx.com
ELROND_PRIVATE_API=https://testnet-private-api.multiversx.com
ELROND_MARKETPLACE=
ELROND_ELASTICSEARCH=
ELROND_ELASTICSEARCH_UPDATE=
Expand Down Expand Up @@ -100,4 +100,9 @@ LOG_FILE=
LOG_LEVEL=error

# CORS domains
CORS_ORIGINS=/\.elrond\.com$/,127.0.0.1,localhost
CORS_ORIGINS=/\.multiversx\.com$/,127.0.0.1,localhost

# Slack
ALERT_CHANNEL=
REPORT_CHANNEL=
REPORT_BEARER=
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at contact@elrond.com. All
reported by contacting the project team at contact@multiversx.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to nfts-graph.elrond.com
# Contributing to nfts-graph.multiversx.com

If you are unfamiliar with the workflow of contributing to github, you can refer to this [this article](https://github.com/firstcontributions/first-contributions/blob/master/README.md)

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ RUN apt install build-essential
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
RUN apt-get install -y npm
RUN useradd -m elrond
RUN useradd -m multiversx

FROM build as development
WORKDIR /usr/src/app

COPY package*.json ./

RUN chown -R elrond /usr/src/app
RUN chown -R multiversx /usr/src/app

RUN npm install
COPY . .
Expand Down
54 changes: 52 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
},
"dependencies": {
"@elastic/elasticsearch": "7.12.0",
"@elrondnetwork/erdjs": "10.2.8",
"@elrondnetwork/erdjs-network-providers": "1.1.3",
"@elrondnetwork/erdnest": "0.1.84",
"@golevelup/nestjs-rabbitmq": "3.4.0",
"@multiversx/erdjs": "11.1.3",
"@multiversx/erdjs-network-providers": "1.2.1",
"@nestjs-query/query-graphql": "0.30.0",
"@nestjs/common": "8.4.7",
"@nestjs/config": "2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion sam/template.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Elrond NFTs Service
Description: MultiversX NFT Service

Resources:
BucketMediaProduction:
Expand Down
30 changes: 20 additions & 10 deletions schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type Asset {
marketplaces: [Marketplace!]
media: [Media!]
metadata: Metadata
name: String
name: String!
nonce: Int!
owner: Account
ownerAddress: String
Expand All @@ -100,7 +100,7 @@ type Asset {
thumbnailUrl: String @deprecated(reason: "This field will be removed in the next version")
totalAvailableTokens: String
totalRunningAuctions: String
type: NftTypeEnum
type: NftTypeEnum!
uris: [String!]!
url: String @deprecated(reason: "This field will be removed in the next version")
verified: Boolean!
Expand Down Expand Up @@ -206,7 +206,7 @@ type AttributeType {
}

type Auction {
asset: Asset
asset: Asset!
availableTokens: Int
collection: String!
creationDate: Int!
Expand All @@ -223,13 +223,13 @@ type Auction {
nrAuctionedTokens: Int
orders(pagination: ConnectionArgs): OrdersResponse
owner: Account
ownerAddress: String
ownerAddress: String!
startDate: Int!
status: AuctionStatusEnum
status: AuctionStatusEnum!
tags: [String!]
topBid: Price
topBidder: Account
type: AuctionTypeEnum
type: AuctionTypeEnum!
}

enum AuctionCustomEnum {
Expand Down Expand Up @@ -396,6 +396,7 @@ input ClaimTicketsArgs {
}

type Collection {
aggregatorUrl: String!
artist: Account
artistAddress: String!
artistFollowersCount: Int!
Expand Down Expand Up @@ -438,6 +439,7 @@ type CollectionAsset {

type CollectionAssetModel {
identifier: String!
isNsfw: Boolean
thumbnailUrl: String
}

Expand Down Expand Up @@ -611,6 +613,11 @@ enum FeaturedCollectionTypeEnum {
Hero
}

input FeaturedCollectionsArgs {
collection: String!
type: FeaturedCollectionTypeEnum!
}

input FeaturedCollectionsFilter {
type: FeaturedCollectionTypeEnum!
}
Expand Down Expand Up @@ -693,6 +700,7 @@ type Marketplace {
acceptedCollectionIdentifiers: [String!]
acceptedPaymentTokens: [Token!]
address: String!
iconUrl: String!
isPaused: Boolean
key: ID!
marketplaceCutPercentage: String
Expand Down Expand Up @@ -775,6 +783,7 @@ type MintPrice {
}

type Mutation {
addFeaturedCollection(input: FeaturedCollectionsArgs!): Boolean!
addLike(input: AddLikeArgs!): Boolean!
addReport(input: ReportNftInput!): Boolean!
addSftQuantity(input: HandleQuantityArgs!): TransactionNode!
Expand All @@ -794,6 +803,7 @@ type Mutation {
issueNftCollection(input: IssueCollectionArgs!): TransactionNode!
issueSftCollection(input: IssueCollectionArgs!): TransactionNode!
reindexMarketplaceEvents(input: MarketplaceEventsIndexingArgs!): Boolean!
removeFeaturedCollection(input: FeaturedCollectionsArgs!): Boolean!
removeLike(input: RemoveLikeArgs!): Boolean!
setNftScamInfo(identifier: String!, info: String!, type: ScamInfoTypeEnum!): Boolean!
setRoles(input: SetNftRolesArgs!): TransactionNode!
Expand Down Expand Up @@ -955,7 +965,7 @@ type Price {
nonce: Int!
timestamp: Int!
token: ID!
tokenData: Token
tokenData: Token!
usdAmount: String
}

Expand Down Expand Up @@ -1187,11 +1197,11 @@ enum TierStatusEnum {

type Token {
activeAuctions: Int
decimals: Float
decimals: Float!
identifier: String!
name: String
name: String!
priceUsd: String
symbol: String
symbol: String!
}

input TokenFilter {
Expand Down
6 changes: 3 additions & 3 deletions src/common.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { forwardRef, Logger, Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config/dist';
import { ScheduleModule } from '@nestjs/schedule';
import { ElrondCommunicationModule } from './common/services/elrond-communication/elrond-communication.module';
import { MxCommunicationModule } from './common/services/mx-communication/mx-communication.module';
import { CachingModule } from './common/services/caching/caching.module';
import { ApiConfigService } from './utils/api.config.service';

Expand All @@ -10,9 +10,9 @@ import { ApiConfigService } from './utils/api.config.service';
forwardRef(() => CachingModule),
ScheduleModule.forRoot(),
ConfigModule,
ElrondCommunicationModule,
MxCommunicationModule,
],
exports: [ElrondCommunicationModule, CachingModule, ApiConfigService, Logger],
exports: [MxCommunicationModule, CachingModule, ApiConfigService, Logger],
providers: [ApiConfigService, Logger],
})
export class CommonModule {}
2 changes: 1 addition & 1 deletion src/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './services/elrond-communication';
export * from './services/mx-communication';
export * from './services/caching/redis-cache.service';
4 changes: 2 additions & 2 deletions src/common/persistence/persistence.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { ReportNftsRepository } from 'src/db/reportNft/report-nft.repository';
import { CacheEventsPublisherModule } from 'src/modules/rabbitmq/cache-invalidation/cache-invalidation-publisher/change-events-publisher.module';
import { PersistenceService } from './persistence.service';
import { UsdPriceService } from 'src/modules/usdPrice/usd-price.service';
import { ElrondCommunicationModule } from '../services/elrond-communication';
import { MxCommunicationModule } from '../services/mx-communication';
import { MarketplaceEventsRepository } from 'src/db/marketplaces/marketplace-events.repository';

@Global()
Expand All @@ -44,7 +44,7 @@ import { MarketplaceEventsRepository } from 'src/db/marketplaces/marketplace-eve
TypeOrmModule.forFeature([AuctionEntity]),
TypeOrmModule.forFeature([MarketplaceEventsRepository]),
CacheEventsPublisherModule,
ElrondCommunicationModule,
MxCommunicationModule,
],
providers: [
UsdPriceService,
Expand Down
34 changes: 31 additions & 3 deletions src/common/persistence/persistence.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PerformanceProfiler } from '@elrondnetwork/erdnest';
import { Injectable } from '@nestjs/common';
import { constants, elrondConfig } from 'src/config';
import { mxConfig } from 'src/config';
import { AccountStatsEntity } from 'src/db/account-stats/account-stats';
import { AccountStatsRepository } from 'src/db/account-stats/account-stats.repository';
import { AssetLikeEntity, AssetsLikesRepository } from 'src/db/assets';
Expand Down Expand Up @@ -43,10 +43,11 @@ import { OrderEntity, OrdersRepository } from 'src/db/orders';
import { ReportNftEntity, ReportNftsRepository } from 'src/db/reportNft';
import { AuctionStatusEnum } from 'src/modules/auctions/models/AuctionStatus.enum';
import { QueryRequest } from 'src/modules/common/filters/QueryRequest';
import { FeaturedCollectionTypeEnum } from 'src/modules/featured/FeatureCollectionType.enum';
import { MetricsCollector } from 'src/modules/metrics/metrics.collector';
import { OrderStatusEnum } from 'src/modules/orders/models';
import { DeleteResult } from 'typeorm';
import { NftTag } from '../services/elrond-communication/models/nft.dto';
import { NftTag } from '../services/mx-communication/models/nft.dto';

@Injectable()
export class PersistenceService {
Expand Down Expand Up @@ -230,7 +231,7 @@ export class PersistenceService {
async getCollectionStats(
identifier: string,
marketplaceKey: string = undefined,
paymentToken: string = elrondConfig.egld,
paymentToken: string = mxConfig.egld,
): Promise<CollectionStatsEntity> {
return await this.execute(
this.getCollectionStats.name,
Expand Down Expand Up @@ -322,6 +323,33 @@ export class PersistenceService {
);
}

async addFeaturedCollection(
collection: string,
type: FeaturedCollectionTypeEnum,
): Promise<boolean> {
const res = await this.execute(
this.addFeaturedCollection.name,
this.featuredCollectionsRepository.save(
new FeaturedCollectionEntity({ identifier: collection, type }),
),
);
return !!res.id;
}

async removeFeaturedCollection(
collection: string,
type: FeaturedCollectionTypeEnum,
): Promise<boolean> {
const res = await this.execute(
this.removeFeaturedCollection.name,
this.featuredCollectionsRepository.delete({
identifier: collection,
type: type,
}),
);
return res.affected === 1;
}

async getFeaturedNfts(
limit: number = 20,
offset: number = 0,
Expand Down
Loading

0 comments on commit e113847

Please sign in to comment.