Skip to content

Commit

Permalink
chore: remove deprecated getAddresses for deriveAddressFromXPubP2PKH
Browse files Browse the repository at this point in the history
  • Loading branch information
r4mmer committed Feb 26, 2025
1 parent c76801f commit e988c22
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/daemon/src/utils/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import { constants, Output, walletUtils } from '@hathor/wallet-lib';
import { constants, Output, walletUtils, addressUtils } from '@hathor/wallet-lib';
import { Connection as MysqlConnection } from 'mysql2/promise';
import { strict as assert } from 'assert';
import {
Expand Down Expand Up @@ -529,7 +529,11 @@ export const generateAddresses = async (
// (more details in https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#Change)
// so we derive our xpub to this path and use it to get the addresses
const derivedXpub = walletUtils.xpubDeriveChild(xpubkey, 0);
const addrMap = walletUtils.getAddresses(derivedXpub, startIndex, count, network);
const addrMap: StringMap<number> = {};
for (let index = startIndex; index < startIndex + count; index++) {
const address = addressUtils.deriveAddressFromXPubP2PKH(derivedXpub, index, network);
addrMap[address.base58] = index;
}

return addrMap;
};

0 comments on commit e988c22

Please sign in to comment.