diff --git a/src/login.ts b/src/login.ts
index 704b99248af3d237f7d88e273315703896cbabe0..e550af17a753afe4b6f06f2f8a39c37758fb4d96 100644
--- a/src/login.ts
+++ b/src/login.ts
@@ -87,7 +87,7 @@ function fetchDetails(
[
Option<PalletIdentityIdtyValue>,
Option<SpMembershipMembershipData>,
- Option<PalletCertificationIdtyCertMeta>
+ PalletCertificationIdtyCertMeta
]
>(
[
@@ -102,9 +102,7 @@ function fetchDetails(
if (m.isSome) {
loginMshipVal.value = m.unwrap()
}
- if (c.isSome) {
- loginCertVal.value = c.unwrap()
- }
+ loginCertVal.value = c
}
)
apollo
diff --git a/src/views/AccountView.vue b/src/views/AccountView.vue
index 750c9211cc45a8384f3e62fd62a0d633f30e1658..31e7914143eb5f1154e8dc9bb2ebb77290cb3120 100644
--- a/src/views/AccountView.vue
+++ b/src/views/AccountView.vue
@@ -11,7 +11,7 @@ import { TxReason, TxSource, type TxComment, type TxItem } from '@/types'
import TransferLine from '@/components/TransferLine.vue'
import { Keyring, type ApiPromise } from '@polkadot/api'
import type { FrameSystemAccountInfo } from '@polkadot/types/lookup'
-import { loginAccount, loginAccountInfo, loginIdtyVal } from '@/global'
+import { currentBlockHeight, loginAccount, loginAccountInfo, loginIdtyVal } from '@/global'
import { signAndSend } from '@/common'
import { ProfileLight } from '@/datapod/profiles.gql'
import type { ProfileLightQuery } from '@/generated/datapod'
@@ -194,7 +194,12 @@ const createIdtyNotif = ref('')
const displayCreateIDty = computed(
() => loginIdtyVal.value?.status.isMember && theAccount && !itsYou.value
)
-const canCreateIdty = computed(() => result.value?.accountByPk?.identity?.status == null)
+// this address is not already used by an identity AND you are ready to create identity
+const canCreateIdty = computed(
+ () =>
+ result.value?.accountByPk?.identity?.status == null &&
+ (loginIdtyVal.value?.nextCreatableIdentityOn.toNumber() ?? 0) < currentBlockHeight.value
+)
async function createIdty() {
createIdtyNotif.value = 'creating identity ... '
signAndSend(api, api.tx.identity.createIdentity(theAccount.value!), createIdtyNotif, () => {})
@@ -298,7 +303,10 @@ async function createIdty() {
/>
</li>
<li v-if="displayCreateIDty">
- <button :disabled="!canCreateIdty" @click="createIdty">create identity</button>
+ <button v-if="canCreateIdty" @click="createIdty">create identity</button>
+ <button v-else :disabled="true" title="not available to certify" @click="createIdty">
+ create identity
+ </button>
{{ createIdtyNotif }}
</li>
</ul>
diff --git a/src/views/IdtyItem.vue b/src/views/IdtyItem.vue
index 8c3274df8aa14558324daad3f16fc9750c513148..ddc94f397ffcd464722470baac5a543f8dd6520d 100644
--- a/src/views/IdtyItem.vue
+++ b/src/views/IdtyItem.vue
@@ -159,18 +159,16 @@ async function confirm() {
})
}
-const canCert = computed(() => true)
+// ready to certify
+const canCert = computed(
+ () => (loginCertVal.value?.nextIssuableOn.toNumber() ?? 0) < currentBlockHeight.value
+)
const certNotif = ref('')
async function certify() {
certNotif.value = 'certifying ... '
signAndSend(api, api.tx.certification.addCert(idty.value?.index!), certNotif, () => {})
}
-const canRenew = computed(
- () =>
- (loginIdtyVal.value?.nextCreatableIdentityOn.toNumber() ?? Infinity) <
- currentBlockHeight.value &&
- (loginCertVal.value?.nextIssuableOn.toNumber() ?? Infinity) < currentBlockHeight.value
-)
+const canRenew = canCert // no additional requirement since only displayed when renewable
const renewNotif = ref('')
async function renew() {
renewNotif.value = 'renewing cert ... '
@@ -347,7 +345,10 @@ async function requestDistEvalFor() {
<button :disabled="!canCert" @click="certify">certify</button> {{ certNotif }}
</li>
<li v-if="displayRenew">
- <button :disabled="!canRenew" @click="renew">renew certification</button>
+ <button v-if="canRenew" @click="renew">renew certification</button>
+ <button v-else disabled="true" title="not available to certify" @click="renew">
+ renew certification
+ </button>
{{ renewNotif }}
</li>
<li v-if="displayRequestDistEval">