opnet 1.8.3 → 1.8.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opnet",
3
3
  "type": "module",
4
- "version": "1.8.3",
4
+ "version": "1.8.4",
5
5
  "author": "OP_NET",
6
6
  "description": "The perfect library for building Bitcoin-based applications.",
7
7
  "engines": {
@@ -104,22 +104,23 @@
104
104
  "@babel/preset-env": "^7.29.0",
105
105
  "@babel/preset-typescript": "^7.28.5",
106
106
  "@eslint/js": "^10.0.1",
107
- "@microsoft/api-extractor": "7.57.6",
108
- "@types/node": "^25.3.5",
109
- "@vitest/browser": "^4.0.18",
110
- "@vitest/browser-playwright": "^4.0.18",
111
- "@vitest/ui": "^4.0.18",
107
+ "@microsoft/api-extractor": "7.57.7",
108
+ "@types/node": "^25.5.0",
109
+ "@vitest/browser": "^4.1.0",
110
+ "@vitest/browser-playwright": "^4.1.0",
111
+ "@vitest/ui": "^4.1.0",
112
+ "esbuild": "^0.27.4",
112
113
  "eslint": "^10.0.3",
113
114
  "madge": "^8.0.0",
114
115
  "playwright": "^1.58.2",
115
116
  "stream-browserify": "^3.0.0",
116
117
  "typedoc": "^0.28.17",
117
118
  "typescript": "^5.9.3",
118
- "typescript-eslint": "^8.56.1",
119
- "vite": "^7.3.1",
119
+ "typescript-eslint": "^8.57.0",
120
+ "vite": "^8.0.0",
120
121
  "vite-plugin-dts": "4.5.4",
121
122
  "vite-plugin-node-polyfills": "^0.25.0",
122
- "vitest": "^4.0.18"
123
+ "vitest": "^4.1.0"
123
124
  },
124
125
  "peerDependencies": {
125
126
  "react-native-worklets": ">=0.7.0"
@@ -135,13 +136,18 @@
135
136
  "@btc-vision/bitcoin-rpc": "^1.1.2",
136
137
  "@btc-vision/ecpair": "^4.0.5",
137
138
  "@btc-vision/logger": "^1.0.8",
138
- "@btc-vision/transaction": "^1.8.0",
139
+ "@btc-vision/transaction": "^1.8.2",
139
140
  "@noble/hashes": "^2.0.1",
140
141
  "bignumber.js": "^10.0.2",
141
142
  "long": "^5.3.2",
142
143
  "p-limit": "^7.3.0",
143
144
  "pako": "^2.1.0",
144
145
  "protobufjs": "^8.0.0",
145
- "undici": "^7.22.0"
146
+ "undici": "^7.24.0"
147
+ },
148
+ "overrides": {
149
+ "vite-plugin-node-polyfills": {
150
+ "vite": "$vite"
151
+ }
146
152
  }
147
153
  }
package/src/_version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.8.3';
1
+ export const version = '1.8.4';
@@ -1,5 +1,13 @@
1
1
  import { QuantumBIP32Interface } from '@btc-vision/bip32';
2
- import { fromBase64, fromHex, Network, networks, PsbtOutputExtended, Signer, toHex, } from '@btc-vision/bitcoin';
2
+ import {
3
+ fromBase64,
4
+ fromHex,
5
+ Network,
6
+ networks,
7
+ PsbtOutputExtended,
8
+ Signer,
9
+ toHex,
10
+ } from '@btc-vision/bitcoin';
3
11
  import { UniversalSigner } from '@btc-vision/ecpair';
4
12
  import {
5
13
  Address,
@@ -804,6 +812,10 @@ export class CallResult<
804
812
  }
805
813
  }
806
814
 
815
+ private max(a: bigint, b: bigint): bigint {
816
+ return a > b ? a : b;
817
+ }
818
+
807
819
  /**
808
820
  * Acquire UTXOs for the transaction.
809
821
  * @param {TransactionParameters} interactionParams - The transaction parameters.
@@ -829,12 +841,10 @@ export class CallResult<
829
841
 
830
842
  const gasFee = this.bigintMax(this.estimatedSatGas, interactionParams.minGas ?? 0n);
831
843
 
832
- const preWant =
833
- gasFee +
834
- priority +
835
- amountAddition +
836
- totalOuts +
837
- interactionParams.maximumAllowedSatToSpend;
844
+ const preWant = this.max(
845
+ gasFee + priority + amountAddition + totalOuts,
846
+ interactionParams.maximumAllowedSatToSpend,
847
+ );
838
848
 
839
849
  let utxos = interactionParams.utxos ?? (await this.#fetchUTXOs(preWant, interactionParams));
840
850
 
@@ -848,13 +858,10 @@ export class CallResult<
848
858
  feeRate,
849
859
  );
850
860
 
851
- const want =
852
- gasFee +
853
- priority +
854
- amountAddition +
855
- totalOuts +
856
- miningCost +
857
- interactionParams.maximumAllowedSatToSpend;
861
+ const want = this.max(
862
+ gasFee + priority + amountAddition + totalOuts + miningCost,
863
+ interactionParams.maximumAllowedSatToSpend,
864
+ );
858
865
 
859
866
  const have = utxos.reduce((s, u) => s + u.value, 0n);
860
867
  if (have >= want) break;