mainnet-js 2.3.2 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/wallet/Wif.ts CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  generatePrivateKey,
23
23
  } from "@bitauth/libauth";
24
24
 
25
- import { mnemonicToSeedSync, generateMnemonic } from "bip39";
25
+ import { mnemonicToSeedSync, generateMnemonic } from "@scure/bip39";
26
26
  import { NetworkType, prefixFromNetworkMap, UnitEnum } from "../enum.js";
27
27
 
28
28
  import { Network, HeaderI, TxI, NFTCapability } from "../interface.js";
@@ -345,7 +345,7 @@ export class Wallet extends BaseWallet {
345
345
  }
346
346
 
347
347
  private async _generateMnemonic() {
348
- this.mnemonic = generateMnemonic();
348
+ this.mnemonic = generateMnemonic(Config.getWordlist());
349
349
  if (this.mnemonic.length == 0)
350
350
  throw Error("refusing to create wallet from empty mnemonic");
351
351
  let seed = mnemonicToSeedSync(this.mnemonic!);
@@ -1670,7 +1670,7 @@ export class Wallet extends BaseWallet {
1670
1670
  // if we are burning last fungible tokens, let us destroy the token completely
1671
1671
  if (totalFungibleAmount === fungibleBurnAmount) {
1672
1672
  changeSendRequests = [];
1673
- utxoIds.push(tokenUtxos[0]);
1673
+ utxoIds.push(...tokenUtxos);
1674
1674
  } else {
1675
1675
  // add utxos to spend from
1676
1676
  let available = 0n;
@@ -1683,14 +1683,14 @@ export class Wallet extends BaseWallet {
1683
1683
  }
1684
1684
 
1685
1685
  // reduce the FT amount
1686
- const newAmount = totalFungibleAmount - fungibleBurnAmount;
1686
+ const newAmount = available - fungibleBurnAmount;
1687
1687
  const safeNewAmount = newAmount < 0n ? 0n : newAmount;
1688
1688
  changeSendRequests = [
1689
1689
  new TokenSendRequest({
1690
1690
  cashaddr: burnRequest.cashaddr || this.tokenaddr!,
1691
1691
  tokenId: burnRequest.tokenId,
1692
1692
  amount: safeNewAmount,
1693
- value: tokenUtxos[0].satoshis,
1693
+ value: tokenUtxos.reduce((a, c) => a + c.satoshis, 0),
1694
1694
  }),
1695
1695
  ];
1696
1696
  }
@@ -89,10 +89,6 @@ const browserConfig = {
89
89
  // set the current working directory for displaying module paths
90
90
  cwd: process.cwd(),
91
91
  }),
92
- new webpack.IgnorePlugin({
93
- resourceRegExp: /wordlists\/(?!english)/,
94
- contextRegExp: /bip39/,
95
- }),
96
92
  ],
97
93
  resolve: {
98
94
  alias: {