mirror of
https://github.com/Discreetly/frontend.git
synced 2026-01-08 20:38:04 -05:00
fixed ethereum group message signing UI bug
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
let btnEl: HTMLElement;
|
||||
let address: string = '';
|
||||
let loadingRooms: boolean = false;
|
||||
let groups: string[] = [];
|
||||
let groups: { name: string }[] = [];
|
||||
let isConnected = false;
|
||||
const chains = [mainnet, arbitrum, optimism, base, polygon];
|
||||
const metadata = {
|
||||
@@ -37,7 +37,7 @@
|
||||
const result = ethereumGroupRequest(commitment, signature);
|
||||
}
|
||||
} else {
|
||||
alertQueue.enqueue('Error getting Identity', 'error');
|
||||
alertQueue.enqueue("Unable to sign Identity Commitment, can't access identity", 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
loadingRooms = true;
|
||||
getEthAddressRoomNames($selectedServer, address)
|
||||
.then((groupNames) => {
|
||||
console.log(groupNames);
|
||||
loadingRooms = false;
|
||||
groups = groupNames;
|
||||
})
|
||||
@@ -76,7 +77,7 @@
|
||||
|
||||
<div class="flex flex-col gap-3 justify-between">
|
||||
<div>
|
||||
<h3 class="h4 mb-2">Step 1: Connect your wallet</h3>
|
||||
<h3 class="h4 mb-2"><span class="text-success-500">Step 1:</span> Connect your wallet</h3>
|
||||
<button bind:this={btnEl} class="btn variant-outline-tertiary">Connect</button>
|
||||
</div>
|
||||
{#if isConnected}
|
||||
@@ -87,12 +88,13 @@
|
||||
<p>You are eligible for the following Ethereum Groups:</p>
|
||||
<ul>
|
||||
{#each groups as group}
|
||||
<li>{group}</li>
|
||||
<ins class="ins border-y border-success-800">{group.name}</ins>
|
||||
{/each}
|
||||
</ul>
|
||||
<div>
|
||||
<h3 class="h4 mb-2">
|
||||
Step 2: Sign your Identity Commitment to prove ownership of this address
|
||||
<h3 class="h4 my-2">
|
||||
<span class="text-success-500">Step 2:</span> Sign your Identity Commitment to prove ownership
|
||||
of this address
|
||||
</h3>
|
||||
<button on:click={proveOwnership} id="btn" class="btn variant-outline-success">Sign</button>
|
||||
</div>
|
||||
|
||||
@@ -33,8 +33,8 @@ export async function getServerData(serverUrl: string): Promise<ServerI> {
|
||||
export async function getEthAddressRoomNames(
|
||||
server: string,
|
||||
ethAddress: string
|
||||
): Promise<string[]> {
|
||||
return get([server, `gateway/eth/group/${ethAddress}`]) as Promise<string[]>;
|
||||
): Promise<{ name: string }[]> {
|
||||
return get([server, `gateway/eth/group/${ethAddress}`]) as Promise<{ name: string }[]>;
|
||||
}
|
||||
|
||||
export async function postInviteCode(
|
||||
|
||||
@@ -59,20 +59,28 @@ export function createIdentity(regenerate = false): 'created' | 'exists' | 'unsa
|
||||
}
|
||||
|
||||
export function getIdentity(): IdentityStoreI | null {
|
||||
const decryptedIdentity = get(identityKeyStore) as unknown as IdentityStoreI;
|
||||
|
||||
if (decryptedIdentity._commitment) {
|
||||
return decryptedIdentity;
|
||||
} else {
|
||||
const idExists = get(identityExists);
|
||||
if (idExists === 'safe') {
|
||||
return get(identityKeyStore) as unknown as IdentityStoreI;
|
||||
} else if (idExists === 'unsafe') {
|
||||
const identity = get(identityStore);
|
||||
if (identity._commitment?.length > 0) {
|
||||
alertQueue.enqueue('Identity not encrypted, set a password!', 'warning');
|
||||
return identity;
|
||||
} else {
|
||||
alertQueue.enqueue('Identity not created, create an identity!', 'warning');
|
||||
alertQueue.enqueue(
|
||||
'Problem retrieving identity, please unlock and restore your identity',
|
||||
'warning'
|
||||
);
|
||||
return null;
|
||||
}
|
||||
} else if (idExists === 'encrypted') {
|
||||
alertQueue.enqueue('Unlock Identity!', 'error');
|
||||
return null;
|
||||
} else {
|
||||
alertQueue.enqueue('Identity not created, create an identity!', 'warning');
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function getCommitment(): string | null {
|
||||
|
||||
Reference in New Issue
Block a user