Skip to content

Commit

Permalink
feat: Support Exotic rarity (#367)
Browse files Browse the repository at this point in the history
* feat: Support Exotic rarity

* fix: Tests

* fix: Update test workflow

* fix: Use install when building the docker image

* fix: Use new type
  • Loading branch information
LautaroPetaccio authored Apr 3, 2024
1 parent c9adb59 commit 1d3cf97
Show file tree
Hide file tree
Showing 24 changed files with 102 additions and 142 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js 16.x
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 16.x
node-version: 18.x
cache: npm
- name: install
run: npm ci
run: npm install
- name: build
run: npm run build
- name: test
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ RUN apk add --no-cache py3-setuptools python3-dev build-base
# install dependencies
COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json
RUN npm ci
RUN npm install

# build the app
COPY . /app
RUN npm run build
RUN npm run test

# remove devDependencies, keep only used dependencies
RUN npm ci --only=production
RUN npm install --only=production

FROM node:18-alpine

Expand Down
134 changes: 32 additions & 102 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"printWidth": 80
},
"dependencies": {
"@dcl/schemas": "^9.6.0",
"@dcl/schemas": "^11.4.0",
"@well-known-components/env-config-provider": "^1.2.0",
"@well-known-components/http-requests-logger-component": "^2.1.0",
"@well-known-components/http-server": "^1.1.6",
Expand Down
6 changes: 5 additions & 1 deletion src/adapters/handlers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
WearableCategory,
} from '@dcl/schemas'
import { Params } from '../../logic/http/params'
import { AssetsNetworks } from '../../types'

export const getItemsParams = (params: Params) => {
const maxPrice = params.getString('maxPrice')
Expand Down Expand Up @@ -47,7 +48,10 @@ export const getItemsParams = (params: Params) => {
),
contractAddresses: params.getList('contractAddress'),
itemId: params.getString('itemId'),
network: params.getValue<Network>('network', Network),
network: params.getValue<AssetsNetworks>('network', {
[Network.MATIC]: Network.MATIC,
[Network.ETHEREUM]: Network.ETHEREUM,
}),
maxPrice: maxPrice
? ethers.utils.parseEther(maxPrice).toString()
: undefined,
Expand Down
3 changes: 2 additions & 1 deletion src/logic/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ChainId, Contract, Network, NFTCategory } from '@dcl/schemas'
import { ISubgraphComponent } from '@well-known-components/thegraph-component'
import { FragmentItemType, ItemFragment } from '../ports/items/types'
import { AssetsNetworks } from '../types'

const MAX_RESULTS = 1000

Expand All @@ -20,7 +21,7 @@ const getCollectionsQuery = (page: number) => `

export async function getCollectionsContracts(
subgraph: ISubgraphComponent,
network: Network,
network: AssetsNetworks,
chainId: ChainId
): Promise<Contract[]> {
let page = 0
Expand Down
5 changes: 3 additions & 2 deletions src/ports/bids/component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { BidFilters, ChainId, Network } from '@dcl/schemas'
import { BidFilters, ChainId } from '@dcl/schemas'
import { ISubgraphComponent } from '@well-known-components/thegraph-component'
import { AssetsNetworks } from '../../types'
import { BidFragment, IBidsComponent } from './types'
import { fromBidFragment, getBidsQuery } from './utils'

export function createBidsComponent(options: {
subgraph: ISubgraphComponent
network: Network
network: AssetsNetworks
chainId: ChainId
}): IBidsComponent {
const { subgraph, network, chainId } = options
Expand Down
3 changes: 2 additions & 1 deletion src/ports/bids/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import {
ListingStatus,
Network,
} from '@dcl/schemas'
import { AssetsNetworks } from '../../types'
import { BidFragment } from './types'

export const BID_DEFAULT_SORT_BY = BidSortBy.RECENTLY_OFFERED

export function fromBidFragment(
fragment: BidFragment,
network: Network,
network: AssetsNetworks,
chainId: ChainId
): Bid {
const bid: Bid = {
Expand Down
Loading

0 comments on commit 1d3cf97

Please sign in to comment.