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/dist/index.html +1 -1
- package/dist/{mainnet-2.3.2.js → mainnet-2.3.5.js} +129 -469
- package/dist/module/config.d.ts +3 -0
- package/dist/module/config.d.ts.map +1 -1
- package/dist/module/config.js +13 -0
- package/dist/module/config.js.map +1 -1
- package/dist/module/constant.d.ts +12 -0
- package/dist/module/constant.d.ts.map +1 -1
- package/dist/module/constant.js +12 -0
- package/dist/module/constant.js.map +1 -1
- package/dist/module/util/checkForEmptySeed.d.ts +1 -2
- package/dist/module/util/checkForEmptySeed.d.ts.map +1 -1
- package/dist/module/util/checkForEmptySeed.js +1 -1
- package/dist/module/util/checkForEmptySeed.js.map +1 -1
- package/dist/module/wallet/Wif.js +5 -5
- package/dist/module/wallet/Wif.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/config.test.ts +81 -0
- package/src/config.ts +18 -0
- package/src/constant.ts +16 -0
- package/src/util/checkForEmptySeed.ts +2 -2
- package/src/wallet/Cashtokens.test.ts +40 -4
- package/src/wallet/Wif.bip39.test.ts +34 -8
- package/src/wallet/Wif.ts +5 -5
- package/webpack.config.cjs +0 -4
- package/polyfill/bip39.browser.cjs +0 -11898
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
|
|
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 =
|
|
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
|
|
1693
|
+
value: tokenUtxos.reduce((a, c) => a + c.satoshis, 0),
|
|
1694
1694
|
}),
|
|
1695
1695
|
];
|
|
1696
1696
|
}
|
package/webpack.config.cjs
CHANGED
|
@@ -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: {
|