Skip to content

Commit

Permalink
Removed destructuring to simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox authored and deansallinen committed Jun 13, 2024
1 parent d144b3b commit 5cddd08
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/snap/src/lib/keyDeriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export async function derivePublicKey(coinType?: number, addressIndex = 0) {
*/
export async function derivePrivateKey(coinType?: number, addressIndex = 0) {
const keyDeriver = await getKeyDeriver(coinType);
const { privateKeyBytes = undefined } = await keyDeriver(addressIndex);
const derived = await keyDeriver(addressIndex);

if (privateKeyBytes === undefined) {
return null;
if (!derived.privateKeyBytes) {
throw new Error('Private key not found');
}

return new PrivateKey(AntelopeKeyType.K1, Bytes.from(privateKeyBytes));
return new PrivateKey(AntelopeKeyType.K1, Bytes.from(derived.privateKeyBytes));
}

0 comments on commit 5cddd08

Please sign in to comment.