diff --git a/components/DashboardFooter.vue b/components/DashboardFooter.vue old mode 100644 new mode 100755 diff --git a/components/DataTableMyRelays/DataTableMyRelays.vue b/components/DataTableMyRelays/DataTableMyRelays.vue index 388968c..2500f1f 100755 --- a/components/DataTableMyRelays/DataTableMyRelays.vue +++ b/components/DataTableMyRelays/DataTableMyRelays.vue @@ -18,6 +18,7 @@ import LockStatusColumn from './columns/LockStatusColumn.vue'; import RegistrationActionColumn from './columns/RegistrationActionColumn.vue'; import { useRegistrator } from '@/composables/registrator'; import { useRegistratorStore } from '@/stores/useRegistratorStore'; +import {ethers} from 'ethers'; const toast = useToast(); const userStore = useUserStore(); @@ -28,6 +29,7 @@ const registratorStore = useRegistratorStore(); const { allRelays, claimableRelays } = storeToRefs(userStore); const { address } = useAccount({ config}); const currentTab = ref('all'); +const registerModalOpen = ref(false); // Fetching and refreshing the relay data from Warp - stored in Pinia user store const { @@ -49,6 +51,11 @@ const { { watch: [address] } ); +const ethAddress = ref(''); +const ethAddressError = ref(null); +const fingerPrintRegister = ref(''); +const fingerPrintRegisterError = ref(null); + if (claimableRelaysError.value?.cause?.message == "rate limited" || verifiedRelaysError.value?.cause?.message == "rate limited") { toast.add({ id: "claimable-relays-error", @@ -153,6 +160,10 @@ const getVerifiedItems = (row: RelayRow) => [ ], ]; +const rules = { + required: (value: string) => !!value || 'Required', +}; + const handleTabChange = (key: string) => { currentTab.value = key as RelayTabType; }; @@ -166,7 +177,7 @@ const handleLockRelay = async (fingerprint: string) => { try { const register = useRegistrator(); - await register?.lock(fingerprint); + await register?.lock(fingerprint, ""); selectedRow!.class = ''; selectedRow!.isWorking = false; @@ -176,6 +187,45 @@ const handleLockRelay = async (fingerprint: string) => { } }; +// for modal +const handleLockRemote = async () => { + if (fingerPrintRegisterError.value || ethAddressError.value) { + return; + } + + // check for empty + if (fingerPrintRegister.value == "" || ethAddress.value == "") { + toast.remove('invalid-evm-address'); + toast.add({ + id: "invalid-evm-address", + icon: 'i-heroicons-x-circle', + color: 'amber', + title: 'Error', + description: `Please fill in all fields`, + }); + return; + } + + console.log(ethers.isAddress(ethAddress.value)); + if (!ethers.isAddress(ethAddress.value)) { + toast.remove('invalid-evm-address'); + toast.add({ + id: "invalid-evm-address", + icon: 'i-heroicons-x-circle', + color: 'amber', + title: 'Error', + description: `Invalid EVM address`, + }) + return; + } + + try { + const register = useRegistrator(); + await register?.lock(fingerPrintRegister.value, ethAddress.value); + } catch (error: any) { + } +} + const filterUniqueRelays = (relays: RelayRow[]) => { const seen = new Set(); return relays.filter((relay) => { @@ -224,6 +274,42 @@ const handleUnlockClick = (fingerprint: string) => {