Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* updated @thirdweb-dev/sdk,chains & wallet package to latest. fixed Marketplace end-points & yarn install possible timeout

* moved marketplaceFilterSchema to sharedSchema
  • Loading branch information
farhanW3 committed Jul 6, 2023
1 parent 00504b5 commit 12f19fc
Show file tree
Hide file tree
Showing 12 changed files with 403 additions and 513 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/docker-hub-image-push.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ COPY package*.json yarn*.lock ./
COPY . .

# Install dependencies for both development and production
RUN yarn install --frozen-lockfile
RUN yarn install --frozen-lockfile --network-timeout 1000000

# Build the project
RUN yarn build
Expand Down Expand Up @@ -53,7 +53,7 @@ COPY package*.json yarn*.lock ./
COPY --from=base /app/dist ./dist

# Install production dependencies only
RUN yarn install --production=true --frozen-lockfile
RUN yarn install --production=true --frozen-lockfile --network-timeout 1000000

# Clean up build dependencies
RUN apk del build-dependencies
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"@fastify/swagger-ui": "^1.8.1",
"@fastify/type-provider-typebox": "^3.2.0",
"@sinclair/typebox": "^0.28",
"@thirdweb-dev/chains": "^0.1.18",
"@thirdweb-dev/sdk": "^3.10.18-nightly-35984362-20230531005908",
"@thirdweb-dev/wallets": "^0.2.22",
"@thirdweb-dev/chains": "^0.1.27",
"@thirdweb-dev/sdk": "^3.10.28",
"@thirdweb-dev/wallets": "^1.0.4",
"@types/express": "^4.17.17",
"@types/pg": "^8.6.6",
"@types/uuid": "^9.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import { Static, Type } from "@sinclair/typebox";
import {
marketplaceV3ContractParamSchema,
standardResponseSchema,
marketplaceFilterSchema,
} from "../../../../../../helpers/sharedApiSchemas";
import {
getAllFilterSchema,
directListingV3OutputSchema,
} from "../../../../../../schemas/marketplaceV3/directListing";
import { directListingV3OutputSchema } from "../../../../../../schemas/marketplaceV3/directListing";
import { formatDirectListingV3Result } from "../../../../../../helpers/marketplaceV3";

// INPUT
const requestSchema = marketplaceV3ContractParamSchema;
const requestQuerySchema = getAllFilterSchema;
const requestQuerySchema = Type.Omit(marketplaceFilterSchema, ["offeror"]);

// OUPUT
const responseSchema = Type.Object({
Expand Down Expand Up @@ -82,15 +80,13 @@ export async function directListingsGetAll(fastify: FastifyInstance) {
},
handler: async (request, reply) => {
const { network, contract_address } = request.params;
const { start, count, offeror, seller, tokenContract, tokenId } =
request.query;
const { start, count, seller, tokenContract, tokenId } = request.query;
const contract = await getContractInstance(network, contract_address);
const result = await contract.directListings.getAll({
start,
count,
tokenContract,
tokenId,
offeror,
seller,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import { Static, Type } from "@sinclair/typebox";
import {
marketplaceV3ContractParamSchema,
standardResponseSchema,
marketplaceFilterSchema,
} from "../../../../../../helpers/sharedApiSchemas";
import {
getAllFilterSchema,
directListingV3OutputSchema,
} from "../../../../../../schemas/marketplaceV3/directListing";
import { directListingV3OutputSchema } from "../../../../../../schemas/marketplaceV3/directListing";
import { formatDirectListingV3Result } from "../../../../../../helpers/marketplaceV3";

// INPUT
const requestSchema = marketplaceV3ContractParamSchema;
const requestQuerySchema = getAllFilterSchema;
const requestQuerySchema = Type.Omit(marketplaceFilterSchema, ["offeror"]);

// OUPUT
const responseSchema = Type.Object({
Expand Down Expand Up @@ -82,15 +80,13 @@ export async function directListingsGetAllValid(fastify: FastifyInstance) {
},
handler: async (request, reply) => {
const { network, contract_address } = request.params;
const { start, count, offeror, seller, tokenContract, tokenId } =
request.query;
const { start, count, seller, tokenContract, tokenId } = request.query;
const contract = await getContractInstance(network, contract_address);
const result = await contract.directListings.getAllValid({
start,
count,
tokenContract,
tokenId,
offeror,
seller,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { Static, Type } from "@sinclair/typebox";
import {
marketplaceV3ContractParamSchema,
standardResponseSchema,
marketplaceFilterSchema,
} from "../../../../../../helpers/sharedApiSchemas";
import { getAllFilterSchema } from "../../../../../../schemas/marketplaceV3/directListing";
import { englishAuctionOutputSchema } from "../../../../../../schemas/marketplaceV3/englishAuction";
import { formatEnglishAuctionResult } from "../../../../../../helpers/marketplaceV3";

// INPUT
const requestSchema = marketplaceV3ContractParamSchema;
const requestQuerySchema = getAllFilterSchema;
const requestQuerySchema = Type.Omit(marketplaceFilterSchema, ["offeror"]);

// OUPUT
const responseSchema = Type.Object({
Expand Down Expand Up @@ -82,15 +82,13 @@ export async function englishAuctionsGetAll(fastify: FastifyInstance) {
},
handler: async (request, reply) => {
const { network, contract_address } = request.params;
const { start, count, offeror, seller, tokenContract, tokenId } =
request.query;
const { start, count, seller, tokenContract, tokenId } = request.query;
const contract = await getContractInstance(network, contract_address);
const result = await contract.englishAuctions.getAll({
start,
count,
tokenContract,
tokenId,
offeror,
seller,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { Static, Type } from "@sinclair/typebox";
import {
marketplaceV3ContractParamSchema,
standardResponseSchema,
marketplaceFilterSchema,
} from "../../../../../../helpers/sharedApiSchemas";
import { getAllFilterSchema } from "../../../../../../schemas/marketplaceV3/directListing";
import { englishAuctionOutputSchema } from "../../../../../../schemas/marketplaceV3/englishAuction";
import { formatEnglishAuctionResult } from "../../../../../../helpers/marketplaceV3";

// INPUT
const requestSchema = marketplaceV3ContractParamSchema;
const requestQuerySchema = getAllFilterSchema;
const requestQuerySchema = Type.Omit(marketplaceFilterSchema, ["offeror"]);

// OUPUT
const responseSchema = Type.Object({
Expand Down Expand Up @@ -82,15 +82,13 @@ export async function englishAuctionsGetAllValid(fastify: FastifyInstance) {
},
handler: async (request, reply) => {
const { network, contract_address } = request.params;
const { start, count, offeror, seller, tokenContract, tokenId } =
request.query;
const { start, count, seller, tokenContract, tokenId } = request.query;
const contract = await getContractInstance(network, contract_address);
const result = await contract.englishAuctions.getAllValid({
start,
count,
tokenContract,
tokenId,
offeror,
seller,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { Static, Type } from "@sinclair/typebox";
import {
marketplaceV3ContractParamSchema,
standardResponseSchema,
marketplaceFilterSchema,
} from "../../../../../../helpers/sharedApiSchemas";
import { getAllFilterSchema } from "../../../../../../schemas/marketplaceV3/directListing";
import { OfferV3OutputSchema } from "../../../../../../schemas/marketplaceV3/offer";
import { formatOffersV3Result } from "../../../../../../helpers/marketplaceV3";

// INPUT
const requestSchema = marketplaceV3ContractParamSchema;
const requestQuerySchema = getAllFilterSchema;
const requestQuerySchema = Type.Omit(marketplaceFilterSchema, ["seller"]);

// OUPUT
const responseSchema = Type.Object({
Expand Down Expand Up @@ -80,16 +80,14 @@ export async function offersGetAll(fastify: FastifyInstance) {
},
handler: async (request, reply) => {
const { network, contract_address } = request.params;
const { start, count, offeror, seller, tokenContract, tokenId } =
request.query;
const { start, count, offeror, tokenContract, tokenId } = request.query;
const contract = await getContractInstance(network, contract_address);
const result = await contract.offers.getAll({
start,
count,
tokenContract,
tokenId,
offeror,
seller,
});

const finalResult = result.map((data) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { Static, Type } from "@sinclair/typebox";
import {
marketplaceV3ContractParamSchema,
standardResponseSchema,
marketplaceFilterSchema,
} from "../../../../../../helpers/sharedApiSchemas";
import { getAllFilterSchema } from "../../../../../../schemas/marketplaceV3/directListing";
import { OfferV3OutputSchema } from "../../../../../../schemas/marketplaceV3/offer";
import { formatOffersV3Result } from "../../../../../../helpers/marketplaceV3";

// INPUT
const requestSchema = marketplaceV3ContractParamSchema;
const requestQuerySchema = getAllFilterSchema;
const requestQuerySchema = Type.Omit(marketplaceFilterSchema, ["seller"]);

// OUPUT
const responseSchema = Type.Object({
Expand Down Expand Up @@ -80,16 +80,14 @@ export async function offersGetAllValid(fastify: FastifyInstance) {
},
handler: async (request, reply) => {
const { network, contract_address } = request.params;
const { start, count, offeror, seller, tokenContract, tokenId } =
request.query;
const { start, count, offeror, tokenContract, tokenId } = request.query;
const contract = await getContractInstance(network, contract_address);
const result = await contract.offers.getAllValid({
start,
count,
tokenContract,
tokenId,
offeror,
seller,
});

const finalResult = result.map((data) => {
Expand Down
33 changes: 33 additions & 0 deletions server/helpers/sharedApiSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,36 @@ export const marketplaceV3ContractParamSchema = Type.Object({
description: "Contract Addres on the Chain",
}),
});

export const marketplaceFilterSchema = Type.Object({
count: Type.Optional(
Type.Number({
description: "Number of listings to fetch",
}),
),
offeror: Type.Optional(
Type.String({
description: "has offers from this Address",
}),
),
seller: Type.Optional(
Type.String({
description: "Being sold by this Address",
}),
),
start: Type.Optional(
Type.Number({
description: "Satrt from this index (pagination)",
}),
),
tokenContract: Type.Optional(
Type.String({
description: "Token contract address to show NFTs from",
}),
),
tokenId: Type.Optional(
Type.String({
description: "Only show NFTs with this ID",
}),
),
});
33 changes: 0 additions & 33 deletions server/schemas/marketplaceV3/directListing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,36 +98,3 @@ export const directListingV3OutputSchema = Type.Object({
}),
),
});

export const getAllFilterSchema = Type.Object({
count: Type.Optional(
Type.Number({
description: "Number of listings to fetch",
}),
),
offeror: Type.Optional(
Type.String({
description: "has offers from this Address",
}),
),
seller: Type.Optional(
Type.String({
description: "Being sold by this Address",
}),
),
start: Type.Optional(
Type.Number({
description: "Satrt from this index (pagination)",
}),
),
tokenContract: Type.Optional(
Type.String({
description: "Token contract address to show NFTs from",
}),
),
tokenId: Type.Optional(
Type.String({
description: "Only show NFTs with this ID",
}),
),
});
Loading

0 comments on commit 12f19fc

Please sign in to comment.