diff --git a/apps/nextjs/src/app/collection/[id]/(list)/L2ERC721Card.tsx b/apps/nextjs/src/app/collection/[id]/(list)/L2ERC721Card.tsx
index beae2eba..c749086a 100644
--- a/apps/nextjs/src/app/collection/[id]/(list)/L2ERC721Card.tsx
+++ b/apps/nextjs/src/app/collection/[id]/(list)/L2ERC721Card.tsx
@@ -45,9 +45,7 @@ export const L2ERC721Card = ({
@@ -126,10 +124,13 @@ const Price = ({
{token?.price}
)}
-
+ {/*TODO Add last price sold */}
+ {/*token?.lastPrice && (
+
+ )*/}
);
};
diff --git a/packages/api/package.json b/packages/api/package.json
index 8c7375b5..5c349e27 100644
--- a/packages/api/package.json
+++ b/packages/api/package.json
@@ -14,6 +14,7 @@
"dependencies": {
"@realms-world/auth": "workspace:*",
"@realms-world/db": "workspace:*",
+ "@realms-world/utils": "workspace:*",
"@trpc/client": "^10.44.1",
"@trpc/server": "^10.44.1",
"superjson": "2.2.1",
diff --git a/packages/api/src/router/erc721Tokens.ts b/packages/api/src/router/erc721Tokens.ts
index 85d0dc3b..e30aa78d 100644
--- a/packages/api/src/router/erc721Tokens.ts
+++ b/packages/api/src/router/erc721Tokens.ts
@@ -1,9 +1,9 @@
-import { padAddress } from "@/utils/utils";
import { sql } from "drizzle-orm";
import { z } from "zod";
import type { SQL } from "@realms-world/db";
import { and, asc, desc, eq, gte, lte, schema } from "@realms-world/db";
+import { padAddress } from "@realms-world/utils";
import { createTRPCRouter, publicProcedure } from "../trpc";
@@ -27,16 +27,19 @@ export const erc721TokensRouter = createTRPCRouter({
const { cursor, contractAddress, owner, orderBy, block, direction } =
input;
const whereFilter: SQL[] = [];
- const orderByFilter: SQL[] = [];
+
const orderByVariable =
orderBy == "floorAskPrice"
? schema.erc721Tokens.price
: schema.erc721Tokens.token_id;
- if (direction === "asc") {
- orderByFilter.push(asc(orderByVariable));
+ const orderByFilter: SQL =
+ direction === "asc" ? asc(orderByVariable) : desc(orderByVariable);
+
+ /*if (direction === "asc") {
+ orderByFilter = asc(orderByVariable);
} else {
- orderByFilter.push(desc(orderByVariable));
- }
+ orderByFilter = desc(orderByVariable);
+ }*/
if (contractAddress) {
whereFilter.push(
diff --git a/packages/utils/src/number.ts b/packages/utils/src/number.ts
index d87c7df1..3603c9b2 100644
--- a/packages/utils/src/number.ts
+++ b/packages/utils/src/number.ts
@@ -152,5 +152,18 @@ function formatBN(
: "";
}
}
-
-export { formatBN, formatNumber, toFixed };
+function padAddress(address?: string) {
+ if (address) {
+ const length = address.length;
+ const neededLength = 66 - length;
+ let zeros = "";
+ for (let i = 0; i < neededLength; i++) {
+ zeros += "0";
+ }
+ const newHex = address?.substring(0, 2) + zeros + address.substring(2);
+ return newHex;
+ } else {
+ return "";
+ }
+}
+export { formatBN, formatNumber, toFixed, padAddress };