@@ -23,7 +23,7 @@ type Bip32AccountProps = {
23
23
} ;
24
24
25
25
export type Bip32AccountDependencies = {
26
- bip32Ed25519 : Pick < Bip32Ed25519 , 'derivePublicKey ' > ;
26
+ bip32Ed25519 : Pick < Bip32Ed25519 , 'derivePublicKeyAsync ' > ;
27
27
blake2b : Blake2b ;
28
28
} ;
29
29
@@ -47,8 +47,8 @@ export class Bip32Account {
47
47
this . accountIndex = accountIndex ;
48
48
}
49
49
50
- async derivePublicKey ( derivationPath : AccountKeyDerivationPath ) {
51
- const extendedKey = this . #bip32Ed25519. derivePublicKey ( this . extendedAccountPublicKeyHex , [
50
+ async derivePublicKey ( derivationPath : AccountKeyDerivationPath ) : Promise < Crypto . Ed25519PublicKeyHex > {
51
+ const extendedKey = await this . #bip32Ed25519. derivePublicKeyAsync ( this . extendedAccountPublicKeyHex , [
52
52
derivationPath . role ,
53
53
derivationPath . index
54
54
] ) ;
@@ -69,10 +69,16 @@ export class Bip32Account {
69
69
role : Number ( paymentKeyDerivationPath . type )
70
70
} ) ;
71
71
72
- const derivedPublicPaymentKeyHash = this . #blake2b. hash ( derivedPublicPaymentKey , BIP32_PUBLIC_KEY_HASH_LENGTH ) ;
72
+ const derivedPublicPaymentKeyHash = ( await this . #blake2b. hashAsync (
73
+ derivedPublicPaymentKey ,
74
+ BIP32_PUBLIC_KEY_HASH_LENGTH
75
+ ) ) as Crypto . Hash28ByteBase16 ;
73
76
74
77
const publicStakeKey = await this . derivePublicKey ( stakeKeyDerivationPath ) ;
75
- const publicStakeKeyHash = this . #blake2b. hash ( publicStakeKey , BIP32_PUBLIC_KEY_HASH_LENGTH ) ;
78
+ const publicStakeKeyHash = ( await this . #blake2b. hashAsync (
79
+ publicStakeKey ,
80
+ BIP32_PUBLIC_KEY_HASH_LENGTH
81
+ ) ) as Crypto . Hash28ByteBase16 ;
76
82
77
83
const stakeCredential = { hash : publicStakeKeyHash , type : Cardano . CredentialType . KeyHash } ;
78
84
@@ -105,6 +111,7 @@ export class Bip32Account {
105
111
* Creates a new instance of the Bip32Ed25519AddressManager class.
106
112
*
107
113
* @param keyAgent The key agent that will be used to derive addresses.
114
+ * @param dependencies Optional dependencies for the Bip32Account. If not provided, default dependencies will be created.
108
115
*/
109
116
static async fromAsyncKeyAgent (
110
117
keyAgent : AsyncKeyAgent ,
0 commit comments