From d3a0d4ab0bc6918402a034a97ce3453557c2f80c Mon Sep 17 00:00:00 2001
From: piyush-bitpack
Date: Tue, 26 Dec 2023 17:16:12 +0530
Subject: [PATCH 1/2] added verification sign
---
src/features/dapp/dapp_api.ts | 4 +++
src/pages/dapp/index.tsx | 65 ++++++++++++++++++++++++++---------
2 files changed, 53 insertions(+), 16 deletions(-)
diff --git a/src/features/dapp/dapp_api.ts b/src/features/dapp/dapp_api.ts
index bbf4eeb..7bf3c84 100644
--- a/src/features/dapp/dapp_api.ts
+++ b/src/features/dapp/dapp_api.ts
@@ -186,6 +186,10 @@ export class DappDataSource implements IDappDataSource {
query: ({ ...body }) => {
return {
url: `${ApiEndpoints.RATING}`,
+ headers: {
+ 'x-message': body?.message,
+ 'x-signature': body?.signature
+ },
method: "POST",
body: body,
};
diff --git a/src/pages/dapp/index.tsx b/src/pages/dapp/index.tsx
index 627ef9e..0269e76 100644
--- a/src/pages/dapp/index.tsx
+++ b/src/pages/dapp/index.tsx
@@ -30,6 +30,7 @@ import { useSearchByIdQuery } from "../../features/search";
import { AppStrings } from "../constants";
import { convertUrl } from "../../utils";
import VerificationDetails from "../../components/VerificationDetails";
+import { signTypedData } from "@wagmi/core";
Modal.setAppElement("#__next");
@@ -62,6 +63,18 @@ const reviewModalStyle = {
},
};
+// The named list of all type definitions
+const types = {
+ Dapp: [
+ { name: "Wallet", type: "address" },
+ { name: "DappId", type: "string" },
+ { name: "Rating", type: "string" },
+ { name: "Review", type: "string" },
+ { name: "Time", type: "string" },
+ ],
+};
+
+
function Divider(props) {
return ;
}
@@ -219,20 +232,26 @@ export function StarRating(props) {
onChange(rating);
}
}, [rating]);
+
+ const handleChangeRating = (ratings: number) => {
+ setHover(0);
+ setRating(ratings);
+ };
+
return (
setRating(rating) : undefined}
+ onMouseLeave={editable ? () => handleChangeRating(rating) : undefined}
>
{[...Array(5)].map((_, idx) => {
idx += 1;
return (
diff --git a/src/features/dapp/dapp_api.ts b/src/features/dapp/dapp_api.ts
index 7bf3c84..c071c1e 100644
--- a/src/features/dapp/dapp_api.ts
+++ b/src/features/dapp/dapp_api.ts
@@ -184,14 +184,17 @@ export class DappDataSource implements IDappDataSource {
postReview(builder: EndpointBuilder) {
return builder.mutation({
query: ({ ...body }) => {
+ const newBody = {...body}
+ delete newBody?.signature
+ delete newBody?.message
return {
- url: `${ApiEndpoints.RATING}`,
+ url: `${ApiEndpoints.POSTRATING}`,
headers: {
'x-message': body?.message,
'x-signature': body?.signature
},
method: "POST",
- body: body,
+ body: newBody,
};
},
});