From c68e955f583965466c7b262c56ce1a8eb6527f12 Mon Sep 17 00:00:00 2001
From: Han <56923450+waddaboo@users.noreply.github.com>
Date: Thu, 10 Oct 2024 21:23:53 +0800
Subject: [PATCH] feat(dashboard): add EAS network list dropdown
---
apps/api/src/app/credentials/credentials.service.ts | 9 +++------
.../new-group-stepper/access-mode-step.tsx | 12 ++++++++++--
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/apps/api/src/app/credentials/credentials.service.ts b/apps/api/src/app/credentials/credentials.service.ts
index 4e36ac89..f33ca565 100644
--- a/apps/api/src/app/credentials/credentials.service.ts
+++ b/apps/api/src/app/credentials/credentials.service.ts
@@ -7,8 +7,7 @@ import {
providers,
Web2Context,
BlockchainContext,
- EASContext,
- EASNetworks
+ EASContext
} from "@bandada/credentials"
import { blockchainCredentialSupportedNetworks } from "@bandada/utils"
import { id } from "@ethersproject/hash"
@@ -177,7 +176,6 @@ export class CredentialsService {
accountHash = id(address + groupId)
} else if (address && credentialProvider === "eas") {
context = {
- network: EASNetworks.ETHEREUM_SEPOLIA,
address: address[0]
}
@@ -276,7 +274,7 @@ export class CredentialsService {
group.credentials
).criteria
- if (network) {
+ if (network && !minAttestations) {
const supportedNetwork =
blockchainCredentialSupportedNetworks.find(
(n) => n.name.toLowerCase() === network.toLowerCase()
@@ -302,9 +300,8 @@ export class CredentialsService {
}
}
- if (minAttestations) {
+ if (network && minAttestations) {
context = {
- network: EASNetworks.ETHEREUM_SEPOLIA,
address: address[0]
}
}
diff --git a/apps/dashboard/src/components/new-group-stepper/access-mode-step.tsx b/apps/dashboard/src/components/new-group-stepper/access-mode-step.tsx
index 55f39420..cca026d5 100644
--- a/apps/dashboard/src/components/new-group-stepper/access-mode-step.tsx
+++ b/apps/dashboard/src/components/new-group-stepper/access-mode-step.tsx
@@ -1,5 +1,5 @@
import { validators } from "@bandada/credentials"
-import { blockchainCredentialSupportedNetworks } from "@bandada/utils"
+import { blockchainCredentialSupportedNetworks, easCredentialSupportedNetworks } from "@bandada/utils"
import {
Box,
Button,
@@ -254,7 +254,15 @@ export default function AccessModeStep({
})
}
>
- {blockchainCredentialSupportedNetworks.map(
+ {validators[_validator].criteriaABI.minAttestations ? easCredentialSupportedNetworks.map(
+ (network: any) => (
+
+ )
+ ) : blockchainCredentialSupportedNetworks.map(
(network: any) => (