Skip to content

Commit 6120b34

Browse files
fixup! feat: remove async from crypto API
1 parent af2ec81 commit 6120b34

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

packages/core/test/Cardano/util/computeImplicitCoin.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ describe('Cardano.util.computeImplicitCoin', () => {
77
let dRepPublicKey: Crypto.Ed25519PublicKeyHex;
88
let dRepKeyHash: Crypto.Ed25519KeyHashHex;
99

10+
beforeAll(async () => {
11+
await Crypto.ready();
12+
});
13+
1014
beforeEach(async () => {
1115
rewardAccount = Cardano.RewardAccount('stake_test1uqfu74w3wh4gfzu8m6e7j987h4lq9r3t7ef5gaw497uu85qsqfy27');
1216
stakeCredential = {
1317
hash: Cardano.RewardAccount.toHash(rewardAccount) as unknown as Crypto.Hash28ByteBase16,
1418
type: Cardano.CredentialType.KeyHash
1519
};
1620
dRepPublicKey = Crypto.Ed25519PublicKeyHex('deeb8f82f2af5836ebbc1b450b6dbf0b03c93afe5696f10d49e8a8304ebfac01');
17-
dRepKeyHash = (await Crypto.Ed25519PublicKey.fromHex(dRepPublicKey).hash()).hex();
21+
dRepKeyHash = Crypto.Ed25519PublicKey.fromHex(dRepPublicKey).hash().hex();
1822
});
1923

2024
describe('calculates deposit', () => {

packages/key-management/test/util/ensureStakeKeys.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as Crypto from '@cardano-sdk/crypto';
12
import { AddressType, Bip32Account, util } from '../../src';
23
import { Bip32PublicKeyHex } from '@cardano-sdk/crypto';
34
import { Cardano } from '@cardano-sdk/core';
@@ -7,6 +8,10 @@ describe('ensureStakeKeys', () => {
78
let bip32Account: Bip32Account;
89
let logger: Logger;
910

11+
beforeAll(async () => {
12+
await Crypto.ready();
13+
});
14+
1015
beforeEach(async () => {
1116
logger = dummyLogger;
1217
bip32Account = new Bip32Account({

packages/key-management/test/util/ownSignaturePaths.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,13 @@ describe('KeyManagement.util.ownSignaturePaths', () => {
5959

6060
const knownAddress1 = createGroupedAddress(address1, ownRewardAccount, AddressType.External, 0, stakeKeyPath);
6161

62+
beforeAll(async () => {
63+
await Crypto.ready();
64+
});
65+
6266
beforeEach(async () => {
6367
dRepPublicKey = Crypto.Ed25519PublicKeyHex('deeb8f82f2af5836ebbc1b450b6dbf0b03c93afe5696f10d49e8a8304ebfac01');
64-
dRepKeyHash = (await Crypto.Ed25519PublicKey.fromHex(dRepPublicKey).hash()).hex();
68+
dRepKeyHash = Crypto.Ed25519PublicKey.fromHex(dRepPublicKey).hash().hex();
6569
});
6670

6771
it('returns distinct derivation paths required to sign the transaction', async () => {

packages/key-management/test/util/stubSignTransaction.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
import { Cardano } from '@cardano-sdk/core';
2-
import { Ed25519PublicKey, Ed25519PublicKeyHex } from '@cardano-sdk/crypto';
2+
import { Ed25519PublicKey, Ed25519PublicKeyHex, ready } from '@cardano-sdk/crypto';
33

44
import { GroupedAddress, util } from '../../src';
55

66
jest.mock('../../src/util/ownSignatureKeyPaths');
77
const { ownSignatureKeyPaths } = jest.requireMock('../../src/util/ownSignatureKeyPaths');
88

99
describe('KeyManagement.util.stubSignTransaction', () => {
10+
beforeAll(async () => {
11+
await ready();
12+
});
13+
1014
it('returns as many signatures as number of keys returned by ownSignaturePaths', async () => {
1115
const txBody = {} as Cardano.HydratedTxBody;
1216
const knownAddresses = [{} as GroupedAddress];
1317
const dRepPublicKey = Ed25519PublicKeyHex('0b1c96fad4179d7910bd9485ac28c4c11368c83d18d01b29d4cf84d8ff6a06c4');
14-
const dRepKeyHash = (await Ed25519PublicKey.fromHex(dRepPublicKey).hash()).hex();
18+
const dRepKeyHash = Ed25519PublicKey.fromHex(dRepPublicKey).hash().hex();
1519
const txInKeyPathMap = {};
1620
ownSignatureKeyPaths.mockReturnValueOnce(['a']).mockReturnValueOnce(['a', 'b']);
1721
expect(

packages/wallet/test/services/DRepRegistrationTracker.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import { createTestScheduler } from '@cardano-sdk/util-dev';
66
import { of } from 'rxjs';
77

88
describe('createDRepRegistrationTracker', () => {
9+
beforeAll(async () => {
10+
await Crypto.ready();
11+
});
12+
913
let dRepPublicKey: Crypto.Ed25519PublicKeyHex;
1014
let dRepKeyHash: Crypto.Hash28ByteBase16;
1115
let dRepPublicKeyHash: Crypto.Ed25519KeyHashHex;
@@ -26,9 +30,9 @@ describe('createDRepRegistrationTracker', () => {
2630
beforeEach(async () => {
2731
dRepPublicKey = Crypto.Ed25519PublicKeyHex('deeb8f82f2af5836ebbc1b450b6dbf0b03c93afe5696f10d49e8a8304ebfac01');
2832
dRepKeyHash = Crypto.Hash28ByteBase16.fromEd25519KeyHashHex(
29-
(await Crypto.Ed25519PublicKey.fromHex(dRepPublicKey).hash()).hex()
33+
Crypto.Ed25519PublicKey.fromHex(dRepPublicKey).hash().hex()
3034
);
31-
dRepPublicKeyHash = (await Crypto.Ed25519PublicKey.fromHex(dRepPublicKey).hash()).hex();
35+
dRepPublicKeyHash = Crypto.Ed25519PublicKey.fromHex(dRepPublicKey).hash().hex();
3236
});
3337

3438
test('computes proper isRegisteredDrep value from historyTransactions$', () => {

0 commit comments

Comments
 (0)