@bitgo-beta/unspents 0.13.2-beta.6 → 0.13.2-beta.61

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/CHANGELOG.md CHANGED
@@ -3,6 +3,48 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.15.3](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.15.2...@bitgo/unspents@0.15.3) (2023-06-21)
7
+
8
+ **Note:** Version bump only for package @bitgo/unspents
9
+
10
+ ## [0.15.2](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.15.1...@bitgo/unspents@0.15.2) (2023-06-13)
11
+
12
+ **Note:** Version bump only for package @bitgo/unspents
13
+
14
+ ## [0.15.1](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.15.0...@bitgo/unspents@0.15.1) (2023-06-07)
15
+
16
+ **Note:** Version bump only for package @bitgo/unspents
17
+
18
+ # [0.15.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.14.2...@bitgo/unspents@0.15.0) (2023-06-05)
19
+
20
+ ### Bug Fixes
21
+
22
+ - **utxo-lib:** use PsbtInput instead of UtxoPsbt ([1f73539](https://github.com/BitGo/BitGoJS/commit/1f73539409cf69fc55ab8aedb9d8873bb82bc375))
23
+
24
+ ### BREAKING CHANGES
25
+
26
+ - **utxo-lib:** functions signature is changed
27
+
28
+ ## [0.14.2](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.14.1...@bitgo/unspents@0.14.2) (2023-05-25)
29
+
30
+ **Note:** Version bump only for package @bitgo/unspents
31
+
32
+ ## [0.14.1](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.14.0...@bitgo/unspents@0.14.1) (2023-05-17)
33
+
34
+ ### Bug Fixes
35
+
36
+ - **bitgo:** drone is no longer used in this repo so can safely be removed ([badc0de](https://github.com/BitGo/BitGoJS/commit/badc0ded6870f56a0dc3925eba639b0fdb313c2b)), closes [#3554](https://github.com/BitGo/BitGoJS/issues/3554) [#3554](https://github.com/BitGo/BitGoJS/issues/3554)
37
+
38
+ # [0.14.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.13.2...@bitgo/unspents@0.14.0) (2023-05-10)
39
+
40
+ ### Features
41
+
42
+ - **utxo-lib:** add musig2 nonce at input index ([9991d3f](https://github.com/BitGo/BitGoJS/commit/9991d3ff4fbecc326c8fc67e523a5108843a0f9d))
43
+
44
+ ## [0.13.2](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.13.1...@bitgo/unspents@0.13.2) (2023-05-03)
45
+
46
+ **Note:** Version bump only for package @bitgo/unspents
47
+
6
48
  ## [0.13.1](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.13.0...@bitgo/unspents@0.13.1) (2023-04-25)
7
49
 
8
50
  **Note:** Version bump only for package @bitgo/unspents
@@ -119,10 +119,9 @@ export declare class Dimensions {
119
119
  static fromInput(input: utxolib.TxInput, params?: FromInputParams): Dimensions;
120
120
  /**
121
121
  * Create Dimensions from psbt input
122
- * @param psbt - psbt
123
- * @param inputIndex - psbt input index
122
+ * @param input - psbt input
124
123
  */
125
- static fromPsbtInput(psbt: bitgo.UtxoPsbt, inputIndex: number): Dimensions;
124
+ static fromPsbtInput(input: bitgo.PsbtInputType): Dimensions;
126
125
  /**
127
126
  * @param inputs - Array of inputs
128
127
  * @param params - @see Dimensions.fromInput()
@@ -131,11 +130,10 @@ export declare class Dimensions {
131
130
  static fromInputs(inputs: utxolib.TxInput[], params?: FromInputParams): Dimensions;
132
131
  /**
133
132
  * Create Dimensions from multiple psbt inputs
134
- * @param psbt
135
- * @param params - @see Dimensions.fromInput()
136
- * @return {Dimensions} sum of the dimensions for each input (@see Dimensions.fromInput())
133
+ * @param inputs psbt input array
134
+ * @return {Dimensions} sum of the dimensions for each input (@see Dimensions.fromPsbtInput())
137
135
  */
138
- static fromPsbtInputs(psbt: bitgo.UtxoPsbt): Dimensions;
136
+ static fromPsbtInputs(inputs: bitgo.PsbtInputType[]): Dimensions;
139
137
  /**
140
138
  * @param scriptLength {number} - size of the output script in bytes
141
139
  * @return {Dimensions} - Dimensions of the output
@@ -229,15 +229,11 @@ class Dimensions {
229
229
  }
230
230
  /**
231
231
  * Create Dimensions from psbt input
232
- * @param psbt - psbt
233
- * @param inputIndex - psbt input index
232
+ * @param input - psbt input
234
233
  */
235
- static fromPsbtInput(psbt, inputIndex) {
236
- const parsed = utxolib.bitgo.parsePsbtInput(psbt, inputIndex);
237
- if (parsed && parsed.scriptType) {
238
- return Dimensions.fromScriptType(parsed.scriptType, parsed);
239
- }
240
- throw new Error(`illegal input ${inputIndex}: empty script`);
234
+ static fromPsbtInput(input) {
235
+ const parsed = utxo_lib_1.bitgo.parsePsbtInput(input);
236
+ return Dimensions.fromScriptType(parsed.scriptType, parsed);
241
237
  }
242
238
  /**
243
239
  * @param inputs - Array of inputs
@@ -252,15 +248,14 @@ class Dimensions {
252
248
  }
253
249
  /**
254
250
  * Create Dimensions from multiple psbt inputs
255
- * @param psbt
256
- * @param params - @see Dimensions.fromInput()
257
- * @return {Dimensions} sum of the dimensions for each input (@see Dimensions.fromInput())
251
+ * @param inputs psbt input array
252
+ * @return {Dimensions} sum of the dimensions for each input (@see Dimensions.fromPsbtInput())
258
253
  */
259
- static fromPsbtInputs(psbt) {
260
- if (!Array.isArray(psbt.txInputs)) {
261
- throw new TypeError(`psbt must have inputs`);
254
+ static fromPsbtInputs(inputs) {
255
+ if (!Array.isArray(inputs)) {
256
+ throw new TypeError(`inputs must be array`);
262
257
  }
263
- return Dimensions.sum(...psbt.txInputs.map((input, inputIndex) => Dimensions.fromPsbtInput(psbt, inputIndex)));
258
+ return Dimensions.sum(...inputs.map((input, _) => Dimensions.fromPsbtInput(input)));
264
259
  }
265
260
  /**
266
261
  * @param scriptLength {number} - size of the output script in bytes
@@ -346,7 +341,7 @@ class Dimensions {
346
341
  * @return {Dimensions}
347
342
  */
348
343
  static fromPsbt(psbt) {
349
- return Dimensions.fromPsbtInputs(psbt).plus(Dimensions.fromOutputs(psbt.getUnsignedTx().outs));
344
+ return Dimensions.fromPsbtInputs(psbt.data.inputs).plus(Dimensions.fromOutputs(psbt.getUnsignedTx().outs));
350
345
  }
351
346
  /**
352
347
  * @param dimensions (can be partially defined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgo-beta/unspents",
3
- "version": "0.13.2-beta.6",
3
+ "version": "0.13.2-beta.61",
4
4
  "description": "Defines the chain codes used for different unspent types and methods to calculate bitcoin transaction sizes",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "should": "~13.2.3"
37
37
  },
38
38
  "dependencies": {
39
- "@bitgo-beta/utxo-lib": "8.0.3-beta.6",
39
+ "@bitgo-beta/utxo-lib": "8.0.3-beta.61",
40
40
  "lodash": "~4.17.21",
41
41
  "tcomb": "~3.2.29",
42
42
  "varuint-bitcoin": "^1.0.4"
@@ -50,5 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "44617e298b9369114d917c38470a637922561e14"
53
+ "gitHead": "a2a82b9f8474b97120c0be75436c7b701d7b69f6"
54
54
  }