Skip to content

Commit

Permalink
Remove unneeded 'block: undefined' return values from 'lookupRecipien…
Browse files Browse the repository at this point in the history
…t' function
  • Loading branch information
jferas committed May 8, 2024
1 parent b38db26 commit 4ba3928
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions umbra-js/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ export async function lookupRecipient(
const isPublicKey = id.length === 132 && isHexString(id);
if (supportPubKey && isPublicKey) {
assertValidPoint(id);
return { spendingPublicKey: id, viewingPublicKey: id, block: undefined };
return { spendingPublicKey: id, viewingPublicKey: id };
}

// Check if identifier is a transaction hash. If so, we recover the sender's public keys from the transaction
const isTxHash = id.length === 66 && isHexString(id);
if (supportTxHash && isTxHash) {
const publicKey = await recoverPublicKeyFromTransaction(id, provider);
assertValidPoint(publicKey);
return { spendingPublicKey: publicKey, viewingPublicKey: publicKey, block: undefined };
return { spendingPublicKey: publicKey, viewingPublicKey: publicKey };
}

// The remaining checks are dependent on the advanced mode option. The provided identifier is now either an
Expand Down Expand Up @@ -273,7 +273,7 @@ export async function lookupRecipient(
console.log('Error using subgraph to lookup receipient stealth keys, will query registry contract');
const registry = new StealthKeyRegistry(provider);
const { spendingPublicKey, viewingPublicKey } = await registry.getStealthKeys(address);
return { spendingPublicKey, viewingPublicKey, block: undefined };
return { spendingPublicKey, viewingPublicKey };
}
}

Expand All @@ -282,7 +282,7 @@ export async function lookupRecipient(
if (!txHash) throw new Error('Could not get public key because the provided account has not sent any transactions');
const publicKey = await recoverPublicKeyFromTransaction(txHash, provider);
assertValidPoint(publicKey);
return { spendingPublicKey: publicKey, viewingPublicKey: publicKey, block: undefined };
return { spendingPublicKey: publicKey, viewingPublicKey: publicKey };
}

export async function getBlockNumberUserRegistered(
Expand Down

0 comments on commit 4ba3928

Please sign in to comment.