Skip to content

Commit

Permalink
(fix): logging in order endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jipperism committed Mar 14, 2024
1 parent fd15e97 commit ec1fba6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pages/api/marketplace/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export default async function handler(

if (req.method === "POST") {
// Validate inputs
console.log(req.body);
const parsedBody = inputSchemaPost.safeParse(req.body);
if (!parsedBody.success) {
console.error(parsedBody.error);
Expand All @@ -122,15 +121,22 @@ export default async function handler(
});
}
const { signature, chainId, ...makerOrder } = parsedBody.data;
const typedData = getTypedData(chainId);

console.log("[marketplace-api] Verifying signature");
console.log("[marketplace-api] Chain ID", chainId);
console.log("[marketplace-api] Maker Order", makerOrder);
console.log("[marketplace-api] Signature", signature);
console.log("[marketplace-api] Maker Types", makerTypes);
console.log("[marketplace-api] typed data", typedData);

console.log("[marketplace-api] Verifying signature", makerTypes, signature);
const recoveredAddress = verifyTypedData(
getTypedData(chainId),
typedData,
makerTypes,
makerOrder,
signature,
);
console.log("[marketplace-api] Signature verified", recoveredAddress);
console.log("[marketplace-api] Recovered address", recoveredAddress);

if (!(recoveredAddress.toLowerCase() === makerOrder.signer.toLowerCase())) {
return res
Expand Down

0 comments on commit ec1fba6

Please sign in to comment.