Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit 6a09a54

Browse files
committed
feat: reserve handles
1 parent 5ce8fca commit 6a09a54

1 file changed

Lines changed: 29 additions & 12 deletions

File tree

src/pages/Mint.vue

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,28 +227,45 @@ const check = async () => {
227227
return;
228228
}
229229
230-
const profiles = await window.unidata?.profiles.get({
231-
source: 'Crossbell Profile',
232-
identity: ruleForm.handle,
233-
platform: 'Crossbell',
234-
});
230+
try {
231+
const profiles = await window.unidata?.profiles.get({
232+
source: 'Crossbell Profile',
233+
identity: ruleForm.handle,
234+
platform: 'Crossbell',
235+
});
236+
237+
const isReserved = (
238+
await fetch(
239+
`https://faas-sgp1-18bc02ac.doserverless.co/api/v1/web/fn-94f39aba-a3e4-4614-9e9a-628569184919/default/crosssync-ens-rns-check?handle=${ruleForm.handle}`,
240+
).then((res) => res.json())
241+
).reserved;
235242
236-
isChecking.value = false;
243+
isChecking.value = false;
237244
238-
if (profiles?.list.length) {
239-
ElMessage.error('Oops, this handle has already been taken...');
245+
if (profiles?.list.length) {
246+
ElMessage.error('Oops, this handle has already been taken...');
247+
return false;
248+
} else if (isReserved) {
249+
ElMessage.error('Oops, this handle is reserved...');
250+
return false;
251+
} else {
252+
ElMessage.success('This handle is available!');
253+
return true;
254+
}
255+
} catch (e) {
256+
ElMessage.error('Sorry, unable to check validity at this moment.');
257+
console.log(e);
240258
return false;
241-
} else {
242-
ElMessage.success('This handle is available!');
243-
return true;
244259
}
245260
};
246261
247262
const tweet = () => {
248263
const text = encodeURIComponent(
249264
`#OwnMyTweets - ${
250265
isENS
251-
? `This Tweet signals that I have claimed my ${isENS.endsWith('.rss3') ? 'RNS' : 'ENS'} ${isENS} as my handle on`
266+
? `This Tweet signals that I have claimed my ${
267+
isENS.endsWith('.rss3') ? 'RNS' : 'ENS'
268+
} ${isENS} as my handle on`
252269
: `My future tweets will be synced on-chain through`
253270
} https://crosssync.app via @_Crossbell ${
254271
isENS ? `(${moment.duration(moment().diff(ensDeadline.value)).humanize()} remaining to claim)` : ``

0 commit comments

Comments
 (0)