utxo-lib 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +19 -16
- package/dist/src/address.d.ts.map +1 -1
- package/dist/src/address.js +11 -1
- package/dist/src/addressFormat.d.ts +1 -1
- package/dist/src/addressFormat.d.ts.map +1 -1
- package/dist/src/addressFormat.js +1 -1
- package/dist/src/bitgo/Musig2.d.ts +115 -17
- package/dist/src/bitgo/Musig2.d.ts.map +1 -1
- package/dist/src/bitgo/Musig2.js +283 -100
- package/dist/src/bitgo/PsbtUtil.d.ts +59 -0
- package/dist/src/bitgo/PsbtUtil.d.ts.map +1 -0
- package/dist/src/bitgo/PsbtUtil.js +91 -0
- package/dist/src/bitgo/UtxoPsbt.d.ts +180 -47
- package/dist/src/bitgo/UtxoPsbt.d.ts.map +1 -1
- package/dist/src/bitgo/UtxoPsbt.js +651 -107
- package/dist/src/bitgo/bitcoincash/address.js +2 -2
- package/dist/src/bitgo/index.d.ts +11 -0
- package/dist/src/bitgo/index.d.ts.map +1 -1
- package/dist/src/bitgo/index.js +6 -2
- package/dist/src/bitgo/legacysafe/index.d.ts +15 -0
- package/dist/src/bitgo/legacysafe/index.d.ts.map +1 -0
- package/dist/src/bitgo/legacysafe/index.js +61 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts +10 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.js +17 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts +16 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.js +46 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts +10 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.js +15 -0
- package/dist/src/bitgo/litecoin/index.d.ts +4 -0
- package/dist/src/bitgo/litecoin/index.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/index.js +16 -0
- package/dist/src/bitgo/outputScripts.d.ts +3 -1
- package/dist/src/bitgo/outputScripts.d.ts.map +1 -1
- package/dist/src/bitgo/outputScripts.js +18 -10
- package/dist/src/bitgo/parseInput.d.ts +49 -20
- package/dist/src/bitgo/parseInput.d.ts.map +1 -1
- package/dist/src/bitgo/parseInput.js +109 -25
- package/dist/src/bitgo/psbt/fromHalfSigned.d.ts.map +1 -1
- package/dist/src/bitgo/psbt/fromHalfSigned.js +9 -6
- package/dist/src/bitgo/signature.d.ts +3 -3
- package/dist/src/bitgo/signature.d.ts.map +1 -1
- package/dist/src/bitgo/signature.js +48 -16
- package/dist/src/bitgo/transaction.d.ts +18 -3
- package/dist/src/bitgo/transaction.d.ts.map +1 -1
- package/dist/src/bitgo/transaction.js +28 -15
- package/dist/src/bitgo/types.d.ts +2 -0
- package/dist/src/bitgo/types.d.ts.map +1 -1
- package/dist/src/bitgo/types.js +1 -1
- package/dist/src/bitgo/wallet/Psbt.d.ts +104 -12
- package/dist/src/bitgo/wallet/Psbt.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/Psbt.js +285 -70
- package/dist/src/bitgo/wallet/Unspent.d.ts +28 -0
- package/dist/src/bitgo/wallet/Unspent.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/Unspent.js +172 -68
- package/dist/src/bitgo/wallet/WalletOutput.d.ts +17 -1
- package/dist/src/bitgo/wallet/WalletOutput.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/WalletOutput.js +64 -23
- package/dist/src/bitgo/wallet/chains.d.ts +2 -2
- package/dist/src/bitgo/wallet/chains.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/chains.js +1 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.d.ts +0 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.d.ts.map +1 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.js +6 -14
- package/dist/src/musig.d.ts +0 -1
- package/dist/src/musig.d.ts.map +1 -1
- package/dist/src/musig.js +15 -29
- package/dist/src/networks.d.ts +1 -2
- package/dist/src/networks.d.ts.map +1 -1
- package/dist/src/networks.js +22 -29
- package/dist/src/noble_ecc.d.ts.map +1 -1
- package/dist/src/noble_ecc.js +7 -3
- package/dist/src/payments/p2tr.d.ts.map +1 -1
- package/dist/src/payments/p2tr.js +15 -9
- package/dist/src/taproot.d.ts +16 -0
- package/dist/src/taproot.d.ts.map +1 -1
- package/dist/src/taproot.js +44 -2
- package/dist/src/testutil/index.d.ts +2 -0
- package/dist/src/testutil/index.d.ts.map +1 -1
- package/dist/src/testutil/index.js +3 -1
- package/dist/src/testutil/keys.d.ts +3 -0
- package/dist/src/testutil/keys.d.ts.map +1 -1
- package/dist/src/testutil/keys.js +17 -2
- package/dist/src/testutil/mock.d.ts +1 -1
- package/dist/src/testutil/mock.d.ts.map +1 -1
- package/dist/src/testutil/mock.js +12 -4
- package/dist/src/testutil/psbt.d.ts +89 -0
- package/dist/src/testutil/psbt.d.ts.map +1 -0
- package/dist/src/testutil/psbt.js +150 -0
- package/dist/src/testutil/transaction.d.ts +70 -0
- package/dist/src/testutil/transaction.d.ts.map +1 -0
- package/dist/src/testutil/transaction.js +107 -0
- package/package.json +6 -6
package/README.md
CHANGED
@@ -3,12 +3,13 @@
|
|
3
3
|
This library is a wrapper around [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib) adding altcoin support.
|
4
4
|
|
5
5
|
## Features
|
6
|
+
|
6
7
|
- Multicoin support: Configurable behaviour based on [network](https://github.com/BitGo/bitgo-utxo-lib/blob/master/src/networks.js) objects.
|
7
8
|
- Backed by [BitGo](https://www.bitgo.com/info/)
|
8
9
|
|
9
10
|
## Installation
|
10
11
|
|
11
|
-
```
|
12
|
+
```bash
|
12
13
|
# using npm
|
13
14
|
npm install @bitgo/utxo-lib
|
14
15
|
|
@@ -19,20 +20,22 @@ yarn add @bitgo/utxo-lib
|
|
19
20
|
## Setup
|
20
21
|
|
21
22
|
JavaScript (ESM)
|
22
|
-
|
23
|
-
|
23
|
+
|
24
|
+
```javascript
|
25
|
+
import * as utxolib from '@bitgo/utxo-lib';
|
24
26
|
```
|
25
27
|
|
26
28
|
NodeJS (CJS)
|
27
|
-
|
28
|
-
|
29
|
+
|
30
|
+
```javascript
|
31
|
+
const utxolib = require('@bitgo/utxo-lib');
|
29
32
|
```
|
30
33
|
|
31
34
|
## Usage
|
32
35
|
|
33
36
|
Support for parsing and building altcoin transactions is provided by the following methods
|
34
37
|
|
35
|
-
```
|
38
|
+
```typescript
|
36
39
|
utxolib.bitgo.createTransactionFromBuffer(buffer, network): UtxoTransaction
|
37
40
|
// (similarly `createTransactionFromHex(string, network)`)
|
38
41
|
|
@@ -45,15 +48,15 @@ The `UtxoTransaction(Builder)` classes have the same interface as the `Transacti
|
|
45
48
|
|
46
49
|
## Supported coins
|
47
50
|
|
48
|
-
|Network|Mainnet|Testnet|
|
49
|
-
|
50
|
-
|Bitcoin
|
51
|
-
|Bitcoin Cash
|
52
|
-
|Bitcoin Gold
|
53
|
-
|Bitcoin SV (Satoshi Vision)
|
54
|
-
|Dash
|
55
|
-
|eCash
|
56
|
-
|Litecoin
|
57
|
-
|Zcash
|
51
|
+
| Network | Mainnet | Testnet |
|
52
|
+
| --------------------------- | ------------------------------ | ------------------------------------- |
|
53
|
+
| Bitcoin | `utxolib.networks.bitcoin` | `utxolib.networks.testnet` |
|
54
|
+
| Bitcoin Cash | `utxolib.networks.bitcoincash` | `utxolib.networks.bitcoincashTestnet` |
|
55
|
+
| Bitcoin Gold | `utxolib.networks.bitcoingold` | `utxolib.networks.bitcoingoldTestnet` |
|
56
|
+
| Bitcoin SV (Satoshi Vision) | `utxolib.networks.bitcoinsv` | `utxolib.networks.bitcoinsvTestnet` |
|
57
|
+
| Dash | `utxolib.networks.dash` | `utxolib.networks.dash` |
|
58
|
+
| eCash | `utxolib.networks.ecash` | `utxolib.networks.ecashTestnet` |
|
59
|
+
| Litecoin | `utxolib.networks.litecoin` | `utxolib.networks.litecoinTest` |
|
60
|
+
| Zcash | `utxolib.networks.zcash` | `utxolib.networks.zcashTest` |
|
58
61
|
|
59
62
|
> [Bitcoin SV](https://blog.bitgo.com/bsv-deprecation-6b3fff4df34c) no longer supports sending funds to BitGo wallets. Existing customers with Bitcoin SV in BitGo wallets will still be able to access and sweep funds to an external Bitcoin SV wallet.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/address.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAA2B,OAAO,EAAE,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/address.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAA2B,OAAO,EAAE,MAAM,YAAY,CAAC;AAG9D,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAe/E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAKxE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAKrF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAKpF;AAED,eAAO,MAAQ,UAAU,uCAAE,QAAQ,mCAAsB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/src/address.js
CHANGED
@@ -5,10 +5,20 @@ exports.toBech32 = exports.fromBech32 = exports.fromBase58Check = exports.toBase
|
|
5
5
|
const bitcoinjs = require("bitcoinjs-lib");
|
6
6
|
const zcashAddress = require("../src/bitgo/zcash/address");
|
7
7
|
const networks_1 = require("./networks");
|
8
|
+
const index_1 = require("./index");
|
8
9
|
function fromOutputScript(outputScript, network) {
|
9
10
|
if (networks_1.isValidNetwork(network) && networks_1.isZcash(network)) {
|
10
11
|
return zcashAddress.fromOutputScript(outputScript, network);
|
11
12
|
}
|
13
|
+
// We added p2tr payments from our forked bitcoinjs-lib to utxo-lib instead. Our bitcoinjs fork will no longer have
|
14
|
+
// p2tr support so utxo-lib should take care of retrieving a p2tr address from outputScript and bitcoinjs-lib can
|
15
|
+
// handle the other type of payments.
|
16
|
+
try {
|
17
|
+
return index_1.p2trPayments.p2tr({ output: outputScript, network }).address;
|
18
|
+
}
|
19
|
+
catch (e) {
|
20
|
+
// noop. try the bitcoinjs method
|
21
|
+
}
|
12
22
|
return bitcoinjs.address.fromOutputScript(outputScript, network);
|
13
23
|
}
|
14
24
|
exports.fromOutputScript = fromOutputScript;
|
@@ -34,4 +44,4 @@ function fromBase58Check(address, network) {
|
|
34
44
|
}
|
35
45
|
exports.fromBase58Check = fromBase58Check;
|
36
46
|
_a = bitcoinjs.address, exports.fromBech32 = _a.fromBech32, exports.toBech32 = _a.toBech32;
|
37
|
-
//# sourceMappingURL=data:application/json;base64,
|
47
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hZGRyZXNzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSwyQ0FBMkM7QUFHM0MsMkRBQTJEO0FBQzNELHlDQUE4RDtBQUM5RCxtQ0FBdUM7QUFFdkMsU0FBZ0IsZ0JBQWdCLENBQUMs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|
import { Network } from './networks';
|
9
9
|
export declare const addressFormats: readonly ["default", "cashaddr"];
|
10
|
-
export declare type AddressFormat = typeof addressFormats[number];
|
10
|
+
export declare type AddressFormat = (typeof addressFormats)[number];
|
11
11
|
/**
|
12
12
|
* @param format
|
13
13
|
* @param network
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addressFormat.d.ts","sourceRoot":"","sources":["../../src/addressFormat.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,OAAO,EAA8B,OAAO,EAAY,MAAM,YAAY,CAAC;AAK3E,eAAO,MAAM,cAAc,kCAAmC,CAAC;AAE/D,oBAAY,aAAa,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"addressFormat.d.ts","sourceRoot":"","sources":["../../src/addressFormat.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,OAAO,EAA8B,OAAO,EAAY,MAAM,YAAY,CAAC;AAK3E,eAAO,MAAM,cAAc,kCAAmC,CAAC;AAE/D,oBAAY,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAQzF;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAYhH;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAYzG;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,aAAa,EAAE,GACxB,CAAC,aAAa,EAAE,MAAM,CAAC,CAczB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,CAG7G;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAE3E"}
|
@@ -107,4 +107,4 @@ function toCanonicalFormat(address, network) {
|
|
107
107
|
return address_1.fromOutputScript(toOutputScriptTryFormats(address, network), network);
|
108
108
|
}
|
109
109
|
exports.toCanonicalFormat = toCanonicalFormat;
|
110
|
-
//# sourceMappingURL=data:application/json;base64,
|
110
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzc0Zvcm1hdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hZGRyZXNzRm9ybWF0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBOzs7OztHQUtHO0FBQ0gseUNBQTJFO0FBQzNFLHVDQUE2RDtBQUU3RCxtQ0FBdUM7QUFFMUIsUUFBQSxjQUFjLEdBQUcsQ0FBQyxTQUFTLEVBQUUsVUFBVSxDQUFVLENBQUM7QUFJL0Q7Ozs7R0FJRztBQUNILFNBQWdCLHdCQUF3QixDQUFDLE1BQXFCLEVBQUUsT0FBZ0I7SUFDOUUsUUFBUSxNQUFNLEVBQUU7UUFDZCxLQUFLLFNBQVM7WUFDWixPQUFPLElBQUksQ0FBQztRQUNkLEtBQUssVUFBVTtZQUNiLE9BQU8sQ0FBQyxtQkFBUSxDQUFDLFdBQVcsRUFBRSxtQkFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDLFFBQVEsQ0FBQyxxQkFBVSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7S0FDL0U7SUFDRCxNQUFNLElBQUksS0FBSyxDQUFDL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@@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import {
|
3
|
-
import { BIP32Interface } from 'bip32';
|
2
|
+
import { SessionKey } from '@brandonblack/musig';
|
4
3
|
import { Tuple } from './types';
|
4
|
+
import { PsbtInput } from 'bip174/src/lib/interfaces';
|
5
|
+
import { ProprietaryKeyValue } from './PsbtUtil';
|
5
6
|
/**
|
6
7
|
* Participant key value object.
|
7
8
|
*/
|
8
|
-
export interface
|
9
|
+
export interface PsbtMusig2Participants {
|
9
10
|
tapOutputKey: Buffer;
|
10
11
|
tapInternalKey: Buffer;
|
11
12
|
participantPubKeys: Tuple<Buffer>;
|
12
13
|
}
|
14
|
+
export interface PsbtMusig2DeterministicParams {
|
15
|
+
privateKey: Buffer;
|
16
|
+
otherNonce: Buffer;
|
17
|
+
publicKeys: Tuple<Buffer>;
|
18
|
+
internalPubKey: Buffer;
|
19
|
+
tapTreeRoot: Buffer;
|
20
|
+
hash: Buffer;
|
21
|
+
}
|
13
22
|
/**
|
14
23
|
* Nonce key value object.
|
15
24
|
*/
|
16
|
-
export interface
|
25
|
+
export interface PsbtMusig2PubNonce {
|
17
26
|
participantPubKey: Buffer;
|
18
27
|
tapOutputKey: Buffer;
|
19
|
-
|
28
|
+
pubNonce: Buffer;
|
29
|
+
}
|
30
|
+
/**
|
31
|
+
* Partial signature key value object.
|
32
|
+
*/
|
33
|
+
export interface PsbtMusig2PartialSig {
|
34
|
+
participantPubKey: Buffer;
|
35
|
+
tapOutputKey: Buffer;
|
36
|
+
partialSig: Buffer;
|
37
|
+
}
|
38
|
+
/**
|
39
|
+
* Because musig uses reference-equal buffers to cache nonces, we wrap it here to allow using
|
40
|
+
* nonces that are byte-equal but not reference-equal.
|
41
|
+
*/
|
42
|
+
export declare class Musig2NonceStore {
|
43
|
+
private nonces;
|
44
|
+
/**
|
45
|
+
* Get original Buffer instance for nonce (which may be a copy).
|
46
|
+
* @return byte-equal buffer that is reference-equal to what was stored earlier in createMusig2Nonce
|
47
|
+
*/
|
48
|
+
getRef(nonce: Uint8Array): Uint8Array;
|
49
|
+
/**
|
50
|
+
* Creates musig2 nonce and stores buffer reference.
|
51
|
+
* tapInternalkey, tapMerkleRoot, tapBip32Derivation for rootWalletKey are required per p2trMusig2 key path input.
|
52
|
+
* Also participant keys are required from psbt proprietary key values.
|
53
|
+
* Ref: https://gist.github.com/sanket1729/4b525c6049f4d9e034d27368c49f28a6
|
54
|
+
* @param privateKey - signer private key
|
55
|
+
* @param publicKey - signer xy public key
|
56
|
+
* @param xOnlyPublicKey - tweaked aggregated key (tapOutputKey)
|
57
|
+
* @param sessionId Additional entropy. If provided it must either be a counter unique to this secret key,
|
58
|
+
* (converted to an array of 32 bytes), or 32 uniformly random bytes.
|
59
|
+
*/
|
60
|
+
createMusig2Nonce(privateKey: Uint8Array, publicKey: Uint8Array, xOnlyPublicKey: Uint8Array, txHash: Uint8Array, sessionId?: Buffer): Uint8Array;
|
20
61
|
}
|
21
62
|
/**
|
22
63
|
* Psbt proprietary key val util function for participants pub keys. SubType is 0x01
|
23
64
|
* Ref: https://gist.github.com/sanket1729/4b525c6049f4d9e034d27368c49f28a6
|
24
65
|
* @return x-only tapOutputKey||tapInternalKey as sub keydata, plain sigining participant keys as valuedata
|
25
66
|
*/
|
26
|
-
export declare function
|
67
|
+
export declare function encodePsbtMusig2Participants(participants: PsbtMusig2Participants): ProprietaryKeyValue;
|
27
68
|
/**
|
28
69
|
* Psbt proprietary key val util function for pub nonce. SubType is 0x02
|
29
70
|
* Ref: https://gist.github.com/sanket1729/4b525c6049f4d9e034d27368c49f28a6
|
30
71
|
* @return plain-participantPubKey||x-only-tapOutputKey as sub keydata, 66 bytes of 2 pub nonces as valuedata
|
31
72
|
*/
|
32
|
-
export declare function
|
73
|
+
export declare function encodePsbtMusig2PubNonce(nonce: PsbtMusig2PubNonce): ProprietaryKeyValue;
|
74
|
+
export declare function encodePsbtMusig2PartialSig(partialSig: PsbtMusig2PartialSig): ProprietaryKeyValue;
|
33
75
|
/**
|
34
76
|
* Decodes proprietary key value data for participant pub keys
|
35
77
|
* @param kv
|
36
78
|
*/
|
37
|
-
export declare function
|
79
|
+
export declare function decodePsbtMusig2Participants(kv: ProprietaryKeyValue): PsbtMusig2Participants;
|
80
|
+
/**
|
81
|
+
* Decodes proprietary key value data for musig2 nonce
|
82
|
+
* @param kv
|
83
|
+
*/
|
84
|
+
export declare function decodePsbtMusig2Nonce(kv: ProprietaryKeyValue): PsbtMusig2PubNonce;
|
85
|
+
/**
|
86
|
+
* Decodes proprietary key value data for musig2 partial sig
|
87
|
+
* @param kv
|
88
|
+
*/
|
89
|
+
export declare function decodePsbtMusig2PartialSig(kv: ProprietaryKeyValue): PsbtMusig2PartialSig;
|
38
90
|
export declare function createTapInternalKey(plainPubKeys: Buffer[]): Buffer;
|
39
91
|
export declare function createTapOutputKey(internalPubKey: Buffer, tapTreeRoot: Buffer): Buffer;
|
92
|
+
export declare function createAggregateNonce(pubNonces: Tuple<Buffer>): Buffer;
|
93
|
+
export declare function createTapTweak(tapInternalKey: Buffer, tapMerkleRoot: Buffer): Buffer;
|
94
|
+
export declare function musig2PartialSign(privateKey: Buffer, publicNonce: Uint8Array, sessionKey: SessionKey, nonceStore: Musig2NonceStore): Buffer;
|
95
|
+
export declare function musig2PartialSigVerify(sig: Buffer, publicKey: Buffer, publicNonce: Buffer, sessionKey: SessionKey): boolean;
|
96
|
+
export declare function musig2AggregateSigs(sigs: Buffer[], sessionKey: SessionKey): Buffer;
|
97
|
+
/** @return session key that can be used to reference the session later */
|
98
|
+
export declare function createMusig2SigningSession(sessionArgs: {
|
99
|
+
pubNonces: Tuple<Buffer>;
|
100
|
+
txHash: Buffer;
|
101
|
+
pubKeys: Tuple<Buffer>;
|
102
|
+
internalPubKey: Buffer;
|
103
|
+
tapTreeRoot: Buffer;
|
104
|
+
}): SessionKey;
|
40
105
|
/**
|
41
|
-
*
|
42
|
-
*
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
* @
|
47
|
-
*
|
48
|
-
|
106
|
+
* @returns psbt proprietary key for musig2 participant key value data
|
107
|
+
* If no key value exists, undefined is returned.
|
108
|
+
*/
|
109
|
+
export declare function parsePsbtMusig2Participants(input: PsbtInput): PsbtMusig2Participants | undefined;
|
110
|
+
/**
|
111
|
+
* @returns psbt proprietary key for musig2 public nonce key value data
|
112
|
+
* If no key value exists, undefined is returned.
|
113
|
+
*/
|
114
|
+
export declare function parsePsbtMusig2Nonces(input: PsbtInput): PsbtMusig2PubNonce[] | undefined;
|
115
|
+
/**
|
116
|
+
* @returns psbt proprietary key for musig2 partial sig key value data
|
117
|
+
* If no key value exists, undefined is returned.
|
118
|
+
*/
|
119
|
+
export declare function parsePsbtMusig2PartialSigs(input: PsbtInput): PsbtMusig2PartialSig[] | undefined;
|
120
|
+
/**
|
121
|
+
* Assert musig2 participant key value data with tapInternalKey and tapMerkleRoot.
|
122
|
+
* <tapOutputKey><tapInputKey> => <participantKey1><participantKey2>
|
123
|
+
* Using tapMerkleRoot and 2 participant keys, the tapInputKey is validated and using tapMerkleRoot and tapInputKey,
|
124
|
+
* the tapOutputKey is validated.
|
125
|
+
*/
|
126
|
+
export declare function assertPsbtMusig2Participants(participantKeyValData: PsbtMusig2Participants, tapInternalKey: Buffer, tapMerkleRoot: Buffer): void;
|
127
|
+
/**
|
128
|
+
* Assert musig2 public nonce key value data with participant key value data
|
129
|
+
* (refer assertPsbtMusig2ParticipantsKeyValData).
|
130
|
+
* <participantKey1><tapOutputKey> => <pubNonce1>
|
131
|
+
* <participantKey2><tapOutputKey> => <pubNonce2>
|
132
|
+
* Checks against participant keys and tapOutputKey
|
133
|
+
*/
|
134
|
+
export declare function assertPsbtMusig2Nonces(noncesKeyValData: PsbtMusig2PubNonce[], participantKeyValData: PsbtMusig2Participants): void;
|
135
|
+
/**
|
136
|
+
* @returns Input object but sig hash type data is taken out from partialSig field.
|
137
|
+
* If sig hash type is not common for all sigs, error out, otherwise returns the modified object and single hash type.
|
49
138
|
*/
|
50
|
-
export declare function
|
139
|
+
export declare function getSigHashTypeFromSigs(partialSigs: PsbtMusig2PartialSig[]): {
|
140
|
+
partialSigs: PsbtMusig2PartialSig[];
|
141
|
+
sigHashType: number;
|
142
|
+
};
|
143
|
+
export declare function createMusig2DeterministicNonce(params: PsbtMusig2DeterministicParams): Buffer;
|
144
|
+
export declare function musig2DeterministicSign(params: PsbtMusig2DeterministicParams): {
|
145
|
+
sig: Buffer;
|
146
|
+
sessionKey: SessionKey;
|
147
|
+
publicNonce: Buffer;
|
148
|
+
};
|
51
149
|
//# sourceMappingURL=Musig2.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Musig2.d.ts","sourceRoot":"","sources":["../../../src/bitgo/Musig2.ts"],"names":[],"mappings":";AAAA,OAAO,
|
1
|
+
{"version":3,"file":"Musig2.d.ts","sourceRoot":"","sources":["../../../src/bitgo/Musig2.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAUjD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAGL,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,6BAA6B;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B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