@bitgo-beta/unspents 0.13.2-beta.21 → 0.13.2-beta.2100
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/README.md +0 -9
- package/dist/bin/generate_tables.d.ts +2 -0
- package/dist/bin/generate_tables.d.ts.map +1 -0
- package/dist/bin/generate_tables.js +107 -0
- package/dist/{codes.d.ts → src/codes.d.ts} +11 -10
- package/dist/src/codes.d.ts.map +1 -0
- package/dist/src/codes.js +182 -0
- package/dist/{dimensions.d.ts → src/dimensions.d.ts} +17 -17
- package/dist/src/dimensions.d.ts.map +1 -0
- package/dist/src/dimensions.js +502 -0
- package/dist/{index.d.ts → src/index.d.ts} +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +46 -0
- package/dist/{inputWeights.d.ts → src/inputWeights.d.ts} +4 -3
- package/dist/src/inputWeights.d.ts.map +1 -0
- package/dist/src/inputWeights.js +97 -0
- package/dist/{scriptSizes.d.ts → src/scriptSizes.d.ts} +1 -0
- package/dist/src/scriptSizes.d.ts.map +1 -0
- package/dist/src/scriptSizes.js +50 -0
- package/dist/{types.d.ts → src/types.d.ts} +1 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +39 -0
- package/dist/{virtualSizes.d.ts → src/virtualSizes.d.ts} +13 -12
- package/dist/src/virtualSizes.d.ts.map +1 -0
- package/dist/src/virtualSizes.js +114 -0
- package/dist/src/zcash.d.ts +9 -0
- package/dist/src/zcash.d.ts.map +1 -0
- package/dist/src/zcash.js +22 -0
- package/dist/test/chain.d.ts +2 -0
- package/dist/test/chain.d.ts.map +1 -0
- package/dist/test/chain.js +92 -0
- package/dist/test/dimensions.d.ts +2 -0
- package/dist/test/dimensions.d.ts.map +1 -0
- package/dist/test/dimensions.js +235 -0
- package/dist/test/signedTx/inputWeights.d.ts +2 -0
- package/dist/test/signedTx/inputWeights.d.ts.map +1 -0
- package/dist/test/signedTx/inputWeights.js +127 -0
- package/dist/test/signedTx/txCombinations.d.ts +3 -0
- package/dist/test/signedTx/txCombinations.d.ts.map +1 -0
- package/dist/test/signedTx/txCombinations.js +130 -0
- package/dist/test/signedTx/txGen.d.ts +74 -0
- package/dist/test/signedTx/txGen.d.ts.map +1 -0
- package/dist/test/signedTx/txGen.js +233 -0
- package/dist/test/testutils.d.ts +36 -0
- package/dist/test/testutils.d.ts.map +1 -0
- package/dist/test/testutils.js +190 -0
- package/dist/test/virtualSizes.d.ts +2 -0
- package/dist/test/virtualSizes.d.ts.map +1 -0
- package/dist/test/virtualSizes.js +18 -0
- package/dist/test/zcash.d.ts +2 -0
- package/dist/test/zcash.d.ts.map +1 -0
- package/dist/test/zcash.js +60 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +12 -9
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -3
- package/.mocharc.js +0 -6
- package/.prettierrc.yml +0 -3
- package/CHANGELOG.md +0 -157
- package/dist/codes.js +0 -168
- package/dist/dimensions.js +0 -485
- package/dist/index.js +0 -30
- package/dist/inputWeights.js +0 -97
- package/dist/scriptSizes.js +0 -51
- package/dist/types.js +0 -25
- package/dist/virtualSizes.js +0 -114
package/CHANGELOG.md
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [0.13.1](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.13.0...@bitgo/unspents@0.13.1) (2023-04-25)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
9
|
-
|
|
10
|
-
# [0.13.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.12.0...@bitgo/unspents@0.13.0) (2023-04-20)
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- **unspents:** unsigned psbt dimensions can be calculated ([427cc36](https://github.com/BitGo/BitGoJS/commit/427cc36f33842cb4372292dc69fe2f23fde78876))
|
|
15
|
-
|
|
16
|
-
# [0.12.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.12...@bitgo/unspents@0.12.0) (2023-04-13)
|
|
17
|
-
|
|
18
|
-
### Features
|
|
19
|
-
|
|
20
|
-
- **unspents:** add dimensions for psbt ([b125034](https://github.com/BitGo/BitGoJS/commit/b125034d83d1e613e9a7036f9b4d805d6f57c3f7))
|
|
21
|
-
- **unspents:** add p2trMusig2 to dimensions ([de460ad](https://github.com/BitGo/BitGoJS/commit/de460ad5c43f936458b7af6524cefad3d5f94914))
|
|
22
|
-
- **utxo-lib:** create p2tr address using musig2 ([699e829](https://github.com/BitGo/BitGoJS/commit/699e8291f4a205ba0b2071c6369f2c8843b8a945))
|
|
23
|
-
- **utxo-lib:** create p2trMusig2 nonce using derived key ([a0cd1f1](https://github.com/BitGo/BitGoJS/commit/a0cd1f1b67b4e013a53362d3e01aa8818a1a9b33))
|
|
24
|
-
- **utxo-lib:** introduce ParsedScriptType ([3c28bbc](https://github.com/BitGo/BitGoJS/commit/3c28bbc4baada5b614ef5893301059b51b324ce2))
|
|
25
|
-
- **utxo-lib:** parse p2trMusig2 key path witness ([ecb4c31](https://github.com/BitGo/BitGoJS/commit/ecb4c3127343b613cc6ae02bc1cd971d2e032954))
|
|
26
|
-
|
|
27
|
-
## [0.11.12](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.9...@bitgo/unspents@0.11.12) (2023-02-16)
|
|
28
|
-
|
|
29
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
30
|
-
|
|
31
|
-
## [0.11.11](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.9...@bitgo/unspents@0.11.11) (2023-02-08)
|
|
32
|
-
|
|
33
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
34
|
-
|
|
35
|
-
## [0.11.10](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.9...@bitgo/unspents@0.11.10) (2023-01-30)
|
|
36
|
-
|
|
37
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
38
|
-
|
|
39
|
-
## [0.11.9](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.8...@bitgo/unspents@0.11.9) (2023-01-25)
|
|
40
|
-
|
|
41
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
42
|
-
|
|
43
|
-
## [0.11.8](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.7...@bitgo/unspents@0.11.8) (2022-12-23)
|
|
44
|
-
|
|
45
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
46
|
-
|
|
47
|
-
## [0.11.7](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.6...@bitgo/unspents@0.11.7) (2022-12-20)
|
|
48
|
-
|
|
49
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
50
|
-
|
|
51
|
-
## [0.11.6](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.5...@bitgo/unspents@0.11.6) (2022-12-06)
|
|
52
|
-
|
|
53
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
54
|
-
|
|
55
|
-
## [0.11.5](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.0...@bitgo/unspents@0.11.5) (2022-11-29)
|
|
56
|
-
|
|
57
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
58
|
-
|
|
59
|
-
## [0.11.4](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.0...@bitgo/unspents@0.11.4) (2022-11-04)
|
|
60
|
-
|
|
61
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
62
|
-
|
|
63
|
-
## [0.11.2](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.0...@bitgo/unspents@0.11.2) (2022-10-27)
|
|
64
|
-
|
|
65
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
66
|
-
|
|
67
|
-
## [0.11.1](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.11.0...@bitgo/unspents@0.11.1) (2022-10-25)
|
|
68
|
-
|
|
69
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
70
|
-
|
|
71
|
-
# [0.11.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.15...@bitgo/unspents@0.11.0) (2022-10-18)
|
|
72
|
-
|
|
73
|
-
### Bug Fixes
|
|
74
|
-
|
|
75
|
-
- **core:** fix bip32/ecpair, API vs Interface ([bec9c1e](https://github.com/BitGo/BitGoJS/commit/bec9c1e6ff0c23108dc27e171abdd3e4d2cfdfb1))
|
|
76
|
-
- **root:** align versions of bitcoinjs-lib ([b7eb929](https://github.com/BitGo/BitGoJS/commit/b7eb92998836a5945627ef1c80d74414b11f4867))
|
|
77
|
-
- **unspents:** remove bitcoinjs-lib.d.ts ([e4447d4](https://github.com/BitGo/BitGoJS/commit/e4447d4c815050fc405bf766d93f2246b90835c8))
|
|
78
|
-
- **unspents:** use new bip32/BIP32Interface in tests ([9de0c78](https://github.com/BitGo/BitGoJS/commit/9de0c7855111e995a2f75709d16901c1760a7511))
|
|
79
|
-
|
|
80
|
-
### Features
|
|
81
|
-
|
|
82
|
-
- update to work with bitcoinjs-lib@6 ([1950934](https://github.com/BitGo/BitGoJS/commit/1950934d9426385ee12b204cc7456327e4480618))
|
|
83
|
-
- **utxo-lib:** export BIP32/ECPair interfaces ([8628507](https://github.com/BitGo/BitGoJS/commit/862850781b2e8b36c71608c5ae71424b9ebe9dee))
|
|
84
|
-
|
|
85
|
-
## [0.8.3](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.15...@bitgo/unspents@0.8.3) (2022-07-19)
|
|
86
|
-
|
|
87
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
88
|
-
|
|
89
|
-
# [0.8.0-rc.15](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.14...@bitgo/unspents@0.8.0-rc.15) (2022-07-11)
|
|
90
|
-
|
|
91
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
92
|
-
|
|
93
|
-
# [0.8.0-rc.14](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.13...@bitgo/unspents@0.8.0-rc.14) (2022-06-23)
|
|
94
|
-
|
|
95
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
96
|
-
|
|
97
|
-
# [0.8.0-rc.13](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.12...@bitgo/unspents@0.8.0-rc.13) (2022-06-22)
|
|
98
|
-
|
|
99
|
-
### Bug Fixes
|
|
100
|
-
|
|
101
|
-
- add dependency check to fix current and future dependency resolutions ([3074335](https://github.com/BitGo/BitGoJS/commit/30743356cff4ebb6d9e185f1a493b187614a1ea9))
|
|
102
|
-
|
|
103
|
-
# [0.8.0-rc.12](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.11...@bitgo/unspents@0.8.0-rc.12) (2022-06-16)
|
|
104
|
-
|
|
105
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
106
|
-
|
|
107
|
-
# [0.8.0-rc.11](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.10...@bitgo/unspents@0.8.0-rc.11) (2022-06-13)
|
|
108
|
-
|
|
109
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
110
|
-
|
|
111
|
-
# [0.8.0-rc.10](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.9...@bitgo/unspents@0.8.0-rc.10) (2022-06-07)
|
|
112
|
-
|
|
113
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
114
|
-
|
|
115
|
-
# [0.8.0-rc.9](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.8...@bitgo/unspents@0.8.0-rc.9) (2022-06-01)
|
|
116
|
-
|
|
117
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
118
|
-
|
|
119
|
-
# [0.8.0-rc.8](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.7...@bitgo/unspents@0.8.0-rc.8) (2022-05-17)
|
|
120
|
-
|
|
121
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
122
|
-
|
|
123
|
-
# [0.8.0-rc.7](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.6...@bitgo/unspents@0.8.0-rc.7) (2022-05-16)
|
|
124
|
-
|
|
125
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
126
|
-
|
|
127
|
-
# [0.8.0-rc.6](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.5...@bitgo/unspents@0.8.0-rc.6) (2022-05-12)
|
|
128
|
-
|
|
129
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
130
|
-
|
|
131
|
-
# [0.8.0-rc.3](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.2...@bitgo/unspents@0.8.0-rc.3) (2022-04-19)
|
|
132
|
-
|
|
133
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
134
|
-
|
|
135
|
-
## [0.7.4](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.2...@bitgo/unspents@0.7.4) (2022-04-06)
|
|
136
|
-
|
|
137
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
138
|
-
|
|
139
|
-
## [0.7.3](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.2...@bitgo/unspents@0.7.3) (2022-04-05)
|
|
140
|
-
|
|
141
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
142
|
-
|
|
143
|
-
# [0.8.0-rc.2](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.2...@bitgo/unspents@0.8.0-rc.2) (2022-04-05)
|
|
144
|
-
|
|
145
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
146
|
-
|
|
147
|
-
# [0.8.0-rc.3](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.2...@bitgo/unspents@0.8.0-rc.3) (2022-04-05)
|
|
148
|
-
|
|
149
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
150
|
-
|
|
151
|
-
# [0.8.0-rc.2](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.2...@bitgo/unspents@0.8.0-rc.2) (2022-04-05)
|
|
152
|
-
|
|
153
|
-
**Note:** Version bump only for package @bitgo/unspents
|
|
154
|
-
|
|
155
|
-
# [0.8.0-rc.2](https://github.com/BitGo/BitGoJS/compare/@bitgo/unspents@0.8.0-rc.2...@bitgo/unspents@0.8.0-rc.2) (2022-04-05)
|
|
156
|
-
|
|
157
|
-
**Note:** Version bump only for package @bitgo/unspents
|
package/dist/codes.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.CodesByType = exports.CodesByPurpose = exports.CodeGroup = exports.isValid = exports.ChainType = exports.Purpose = exports.UnspentType = exports.ErrorInvalidCode = void 0;
|
|
23
|
-
const tcomb = __importStar(require("tcomb"));
|
|
24
|
-
class ErrorInvalidCode extends Error {
|
|
25
|
-
constructor(code) {
|
|
26
|
-
super(`invalid code ${code}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.ErrorInvalidCode = ErrorInvalidCode;
|
|
30
|
-
var UnspentType;
|
|
31
|
-
(function (UnspentType) {
|
|
32
|
-
UnspentType["p2pkh"] = "p2pkh";
|
|
33
|
-
UnspentType["p2sh"] = "p2sh";
|
|
34
|
-
UnspentType["p2shP2wsh"] = "p2shP2wsh";
|
|
35
|
-
UnspentType["p2wpkh"] = "p2wpkh";
|
|
36
|
-
UnspentType["p2wsh"] = "p2wsh";
|
|
37
|
-
UnspentType["p2tr"] = "p2tr";
|
|
38
|
-
})(UnspentType = exports.UnspentType || (exports.UnspentType = {}));
|
|
39
|
-
const UnspentTypeTcomb = tcomb.enums.of(Object.keys(UnspentType));
|
|
40
|
-
var Purpose;
|
|
41
|
-
(function (Purpose) {
|
|
42
|
-
Purpose["internal"] = "internal";
|
|
43
|
-
Purpose["external"] = "external";
|
|
44
|
-
})(Purpose = exports.Purpose || (exports.Purpose = {}));
|
|
45
|
-
const PurposeTcomb = tcomb.enums.of(Object.keys(Purpose));
|
|
46
|
-
const codeList = Object.freeze([
|
|
47
|
-
[0, UnspentType.p2sh, Purpose.external],
|
|
48
|
-
[10, UnspentType.p2shP2wsh, Purpose.external],
|
|
49
|
-
[20, UnspentType.p2wsh, Purpose.external],
|
|
50
|
-
[30, UnspentType.p2tr, Purpose.external],
|
|
51
|
-
[1, UnspentType.p2sh, Purpose.internal],
|
|
52
|
-
[11, UnspentType.p2shP2wsh, Purpose.internal],
|
|
53
|
-
[21, UnspentType.p2wsh, Purpose.internal],
|
|
54
|
-
[31, UnspentType.p2tr, Purpose.internal],
|
|
55
|
-
].map(([id, type, purpose]) => Object.freeze({ id, type, purpose })));
|
|
56
|
-
exports.ChainType = tcomb.irreducible('ChainType', (n) => exports.isValid(n));
|
|
57
|
-
const forType = (u) => {
|
|
58
|
-
// Do tcomb type checking in js projects that use this lib
|
|
59
|
-
if (!UnspentTypeTcomb.is(u)) {
|
|
60
|
-
throw new Error(`invalid unspent type: ${u}`);
|
|
61
|
-
}
|
|
62
|
-
return new CodesByPurpose(u);
|
|
63
|
-
};
|
|
64
|
-
const typeForCode = (c) => {
|
|
65
|
-
const code = codeList.find(({ id }) => id === c);
|
|
66
|
-
if (!code) {
|
|
67
|
-
throw new ErrorInvalidCode(c);
|
|
68
|
-
}
|
|
69
|
-
return code.type;
|
|
70
|
-
};
|
|
71
|
-
const isValid = (c) => codeList.some(({ id }) => id === c);
|
|
72
|
-
exports.isValid = isValid;
|
|
73
|
-
const throwIfUndefined = (v) => {
|
|
74
|
-
if (v === undefined) {
|
|
75
|
-
throw new Error(`expected value to be defined`);
|
|
76
|
-
}
|
|
77
|
-
return v;
|
|
78
|
-
};
|
|
79
|
-
class CodeGroup {
|
|
80
|
-
constructor(values) {
|
|
81
|
-
this.values = Object.freeze([...values]);
|
|
82
|
-
}
|
|
83
|
-
has(code) {
|
|
84
|
-
if (!exports.isValid(code)) {
|
|
85
|
-
throw new ErrorInvalidCode(code);
|
|
86
|
-
}
|
|
87
|
-
return this.values.includes(code);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.CodeGroup = CodeGroup;
|
|
91
|
-
class CodesByPurpose extends CodeGroup {
|
|
92
|
-
constructor(t) {
|
|
93
|
-
const codeMap = new Map(codeList.filter(({ type }) => type === t).map(({ purpose, id }) => [purpose, id]));
|
|
94
|
-
if (codeMap.size !== 2) {
|
|
95
|
-
throw new Error(`unexpected number of codes for type ${t}`);
|
|
96
|
-
}
|
|
97
|
-
super(codeMap.values());
|
|
98
|
-
this.internal = throwIfUndefined(codeMap.get(Purpose.internal));
|
|
99
|
-
this.external = throwIfUndefined(codeMap.get(Purpose.external));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
exports.CodesByPurpose = CodesByPurpose;
|
|
103
|
-
class CodesByType extends CodeGroup {
|
|
104
|
-
constructor(p) {
|
|
105
|
-
const codeMap = new Map(codeList.filter(({ purpose }) => purpose === p).map(({ type, id }) => [type, id]));
|
|
106
|
-
if (codeMap.size !== 4) {
|
|
107
|
-
throw new Error(`unexpected number of codes`);
|
|
108
|
-
}
|
|
109
|
-
super(codeMap.values());
|
|
110
|
-
this.p2sh = throwIfUndefined(codeMap.get(UnspentType.p2sh));
|
|
111
|
-
this.p2shP2wsh = throwIfUndefined(codeMap.get(UnspentType.p2shP2wsh));
|
|
112
|
-
this.p2wsh = throwIfUndefined(codeMap.get(UnspentType.p2wsh));
|
|
113
|
-
this.p2tr = throwIfUndefined(codeMap.get(UnspentType.p2tr));
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.CodesByType = CodesByType;
|
|
117
|
-
const boundHas = (instance) => instance.has.bind(instance);
|
|
118
|
-
const p2sh = Object.freeze(new CodesByPurpose(UnspentType.p2sh));
|
|
119
|
-
const p2shP2wsh = Object.freeze(new CodesByPurpose(UnspentType.p2shP2wsh));
|
|
120
|
-
const p2wsh = Object.freeze(new CodesByPurpose(UnspentType.p2wsh));
|
|
121
|
-
const p2tr = Object.freeze(new CodesByPurpose(UnspentType.p2tr));
|
|
122
|
-
const external = Object.freeze(new CodesByType(Purpose.external));
|
|
123
|
-
const internal = Object.freeze(new CodesByType(Purpose.internal));
|
|
124
|
-
const all = Object.freeze(codeList.map(({ id }) => id));
|
|
125
|
-
/** @deprecated - use utxolib.bitgo */
|
|
126
|
-
exports.default = Object.freeze({
|
|
127
|
-
/* @deprecated: use ChainCodeTcomb */
|
|
128
|
-
ChainType: exports.ChainType,
|
|
129
|
-
/** @deprecated - use utxolib.bitgo */
|
|
130
|
-
ChainCodeTcomb: exports.ChainType,
|
|
131
|
-
/** @deprecated - use utxolib.bitgo */
|
|
132
|
-
PurposeTcomb,
|
|
133
|
-
/** @deprecated - use utxolib.bitgo */
|
|
134
|
-
UnspentTypeTcomb,
|
|
135
|
-
/** @deprecated - use utxolib.bitgo */
|
|
136
|
-
p2sh,
|
|
137
|
-
/** @deprecated - use utxolib.bitgo */
|
|
138
|
-
p2shP2wsh,
|
|
139
|
-
/** @deprecated - use utxolib.bitgo */
|
|
140
|
-
p2wsh,
|
|
141
|
-
/** @deprecated - use utxolib.bitgo */
|
|
142
|
-
p2tr,
|
|
143
|
-
/** @deprecated - use utxolib.bitgo */
|
|
144
|
-
external,
|
|
145
|
-
/** @deprecated - use utxolib.bitgo */
|
|
146
|
-
internal,
|
|
147
|
-
/** @deprecated - use utxolib.bitgo */
|
|
148
|
-
all,
|
|
149
|
-
/** @deprecated - use utxolib.bitgo */
|
|
150
|
-
isP2sh: boundHas(p2sh),
|
|
151
|
-
/** @deprecated - use utxolib.bitgo */
|
|
152
|
-
isP2shP2wsh: boundHas(p2shP2wsh),
|
|
153
|
-
/** @deprecated - use utxolib.bitgo */
|
|
154
|
-
isP2wsh: boundHas(p2wsh),
|
|
155
|
-
/** @deprecated - use utxolib.bitgo */
|
|
156
|
-
isP2tr: boundHas(p2tr),
|
|
157
|
-
/** @deprecated - use utxolib.bitgo */
|
|
158
|
-
isExternal: boundHas(external),
|
|
159
|
-
/** @deprecated - use utxolib.bitgo */
|
|
160
|
-
isInternal: boundHas(internal),
|
|
161
|
-
/** @deprecated - use utxolib.bitgo */
|
|
162
|
-
isValid: exports.isValid,
|
|
163
|
-
/** @deprecated - use utxolib.bitgo */
|
|
164
|
-
forType,
|
|
165
|
-
/** @deprecated - use utxolib.bitgo */
|
|
166
|
-
typeForCode,
|
|
167
|
-
});
|
|
168
|
-
//# sourceMappingURL=codes.js.map
|