Skip to content

Commit 163aefe

Browse files
committed
More small fixes
1 parent 252c3e8 commit 163aefe

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

packages/key-management/src/util/ownSignatureKeyPaths.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,10 @@ const checkStakeCredential = (
299299
keyHash: Crypto.Ed25519KeyHashHex,
300300
paths: AccountKeyDerivationPath[]
301301
) => {
302-
if (address.stakeKeyDerivationPath &&
303-
Cardano.RewardAccount.toHash(address.rewardAccount) === Crypto.Hash28ByteBase16.fromEd25519KeyHashHex(keyHash)) {
302+
if (
303+
address.stakeKeyDerivationPath &&
304+
Cardano.RewardAccount.toHash(address.rewardAccount) === Crypto.Hash28ByteBase16.fromEd25519KeyHashHex(keyHash)
305+
) {
304306
paths.push(address.stakeKeyDerivationPath);
305307
}
306308
};
@@ -311,8 +313,10 @@ const checkPaymentCredential = (
311313
paths: AccountKeyDerivationPath[]
312314
) => {
313315
const paymentCredential = Cardano.Address.fromBech32(address.address)?.asBase()?.getPaymentCredential();
314-
if (paymentCredential?.type === Cardano.CredentialType.KeyHash &&
315-
paymentCredential.hash === Crypto.Hash28ByteBase16.fromEd25519KeyHashHex(keyHash)) {
316+
if (
317+
paymentCredential?.type === Cardano.CredentialType.KeyHash &&
318+
paymentCredential.hash === Crypto.Hash28ByteBase16.fromEd25519KeyHashHex(keyHash)
319+
) {
316320
paths.push({ index: address.index, role: Number(address.type) });
317321
}
318322
};
@@ -328,10 +332,7 @@ const processSignatureScript = (
328332
}
329333
};
330334

331-
const processTimeScript = () => {
332-
// Time-based scripts don't require key paths
333-
return;
334-
};
335+
const processTimeScript = () => undefined;
335336

336337
const getNativeScriptKeyPaths = (
337338
groupedAddresses: GroupedAddress[],
@@ -351,7 +352,9 @@ const getNativeScriptKeyPaths = (
351352
case Cardano.NativeScriptKind.RequireAllOf:
352353
case Cardano.NativeScriptKind.RequireAnyOf:
353354
case Cardano.NativeScriptKind.RequireNOf:
354-
(script as Cardano.RequireAllOfScript | Cardano.RequireAnyOfScript).scripts.forEach(processScript);
355+
for (const subScript of (script as Cardano.RequireAllOfScript | Cardano.RequireAnyOfScript).scripts) {
356+
processScript(subScript);
357+
}
355358
break;
356359
case Cardano.NativeScriptKind.RequireTimeBefore:
357360
case Cardano.NativeScriptKind.RequireTimeAfter:
@@ -360,7 +363,9 @@ const getNativeScriptKeyPaths = (
360363
}
361364
};
362365

363-
nativeScripts.forEach(processScript);
366+
for (const script of nativeScripts) {
367+
processScript(script);
368+
}
364369
return paths;
365370
};
366371

0 commit comments

Comments
 (0)