@ledgerhq/hw-app-btc 6.7.0 → 6.9.1-6.9.1-taproot.0.0
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/lib/Btc.d.ts +7 -3
- package/lib/Btc.d.ts.map +1 -1
- package/lib/Btc.js +95 -26
- package/lib/Btc.js.map +1 -1
- package/lib/BtcNew.d.ts +70 -0
- package/lib/BtcNew.d.ts.map +1 -0
- package/lib/BtcNew.js +372 -0
- package/lib/BtcNew.js.map +1 -0
- package/lib/BtcOld.d.ts +114 -0
- package/lib/BtcOld.d.ts.map +1 -0
- package/lib/BtcOld.js +138 -0
- package/lib/BtcOld.js.map +1 -0
- package/lib/bip32.d.ts +8 -0
- package/lib/bip32.d.ts.map +1 -1
- package/lib/bip32.js +32 -3
- package/lib/bip32.js.map +1 -1
- package/lib/buffertools.d.ts +28 -0
- package/lib/buffertools.d.ts.map +1 -0
- package/lib/buffertools.js +100 -0
- package/lib/buffertools.js.map +1 -0
- package/lib/createTransaction.d.ts.map +1 -1
- package/lib/getWalletPublicKey.d.ts +1 -1
- package/lib/getWalletPublicKey.d.ts.map +1 -1
- package/lib/getWalletPublicKey.js.map +1 -1
- package/lib/hashPublicKey.d.ts +1 -1
- package/lib/hashPublicKey.d.ts.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +8 -0
- package/lib/index.js.map +1 -0
- package/lib/newops/appClient.d.ts +14 -0
- package/lib/newops/appClient.d.ts.map +1 -0
- package/lib/newops/appClient.js +242 -0
- package/lib/newops/appClient.js.map +1 -0
- package/lib/newops/clientCommands.d.ts +61 -0
- package/lib/newops/clientCommands.d.ts.map +1 -0
- package/lib/newops/clientCommands.js +331 -0
- package/lib/newops/clientCommands.js.map +1 -0
- package/lib/newops/merkelizedPsbt.d.ts +15 -0
- package/lib/newops/merkelizedPsbt.d.ts.map +1 -0
- package/lib/newops/merkelizedPsbt.js +91 -0
- package/lib/newops/merkelizedPsbt.js.map +1 -0
- package/lib/newops/merkle.d.ts +29 -0
- package/lib/newops/merkle.d.ts.map +1 -0
- package/lib/newops/merkle.js +133 -0
- package/lib/newops/merkle.js.map +1 -0
- package/lib/newops/merkleMap.d.ts +15 -0
- package/lib/newops/merkleMap.d.ts.map +1 -0
- package/lib/newops/merkleMap.js +37 -0
- package/lib/newops/merkleMap.js.map +1 -0
- package/lib/newops/policy.d.ts +14 -0
- package/lib/newops/policy.d.ts.map +1 -0
- package/lib/newops/policy.js +40 -0
- package/lib/newops/policy.js.map +1 -0
- package/lib/newops/psbtExtractor.d.ts +4 -0
- package/lib/newops/psbtExtractor.d.ts.map +1 -0
- package/lib/newops/psbtExtractor.js +36 -0
- package/lib/newops/psbtExtractor.js.map +1 -0
- package/lib/newops/psbtFinalizer.d.ts +7 -0
- package/lib/newops/psbtFinalizer.d.ts.map +1 -0
- package/lib/newops/psbtFinalizer.js +111 -0
- package/lib/newops/psbtFinalizer.js.map +1 -0
- package/lib/newops/psbtv2.d.ts +129 -0
- package/lib/newops/psbtv2.d.ts.map +1 -0
- package/lib/newops/psbtv2.js +478 -0
- package/lib/newops/psbtv2.js.map +1 -0
- package/lib/varint.d.ts.map +1 -1
- package/lib/varint.js +1 -0
- package/lib/varint.js.map +1 -1
- package/lib-es/Btc.d.ts +7 -3
- package/lib-es/Btc.d.ts.map +1 -1
- package/lib-es/Btc.js +92 -26
- package/lib-es/Btc.js.map +1 -1
- package/lib-es/BtcNew.d.ts +70 -0
- package/lib-es/BtcNew.d.ts.map +1 -0
- package/lib-es/BtcNew.js +370 -0
- package/lib-es/BtcNew.js.map +1 -0
- package/lib-es/BtcOld.d.ts +114 -0
- package/lib-es/BtcOld.d.ts.map +1 -0
- package/lib-es/BtcOld.js +136 -0
- package/lib-es/BtcOld.js.map +1 -0
- package/lib-es/bip32.d.ts +8 -0
- package/lib-es/bip32.d.ts.map +1 -1
- package/lib-es/bip32.js +26 -2
- package/lib-es/bip32.js.map +1 -1
- package/lib-es/buffertools.d.ts +28 -0
- package/lib-es/buffertools.d.ts.map +1 -0
- package/lib-es/buffertools.js +94 -0
- package/lib-es/buffertools.js.map +1 -0
- package/lib-es/createTransaction.d.ts.map +1 -1
- package/lib-es/getWalletPublicKey.d.ts +1 -1
- package/lib-es/getWalletPublicKey.d.ts.map +1 -1
- package/lib-es/getWalletPublicKey.js.map +1 -1
- package/lib-es/hashPublicKey.d.ts +1 -1
- package/lib-es/hashPublicKey.d.ts.map +1 -1
- package/lib-es/index.d.ts +3 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +3 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/newops/appClient.d.ts +14 -0
- package/lib-es/newops/appClient.d.ts.map +1 -0
- package/lib-es/newops/appClient.js +239 -0
- package/lib-es/newops/appClient.js.map +1 -0
- package/lib-es/newops/clientCommands.d.ts +61 -0
- package/lib-es/newops/clientCommands.d.ts.map +1 -0
- package/lib-es/newops/clientCommands.js +328 -0
- package/lib-es/newops/clientCommands.js.map +1 -0
- package/lib-es/newops/merkelizedPsbt.d.ts +15 -0
- package/lib-es/newops/merkelizedPsbt.d.ts.map +1 -0
- package/lib-es/newops/merkelizedPsbt.js +88 -0
- package/lib-es/newops/merkelizedPsbt.js.map +1 -0
- package/lib-es/newops/merkle.d.ts +29 -0
- package/lib-es/newops/merkle.d.ts.map +1 -0
- package/lib-es/newops/merkle.js +129 -0
- package/lib-es/newops/merkle.js.map +1 -0
- package/lib-es/newops/merkleMap.d.ts +15 -0
- package/lib-es/newops/merkleMap.d.ts.map +1 -0
- package/lib-es/newops/merkleMap.js +34 -0
- package/lib-es/newops/merkleMap.js.map +1 -0
- package/lib-es/newops/policy.d.ts +14 -0
- package/lib-es/newops/policy.d.ts.map +1 -0
- package/lib-es/newops/policy.js +36 -0
- package/lib-es/newops/policy.js.map +1 -0
- package/lib-es/newops/psbtExtractor.d.ts +4 -0
- package/lib-es/newops/psbtExtractor.d.ts.map +1 -0
- package/lib-es/newops/psbtExtractor.js +32 -0
- package/lib-es/newops/psbtExtractor.js.map +1 -0
- package/lib-es/newops/psbtFinalizer.d.ts +7 -0
- package/lib-es/newops/psbtFinalizer.d.ts.map +1 -0
- package/lib-es/newops/psbtFinalizer.js +107 -0
- package/lib-es/newops/psbtFinalizer.js.map +1 -0
- package/lib-es/newops/psbtv2.d.ts +129 -0
- package/lib-es/newops/psbtv2.d.ts.map +1 -0
- package/lib-es/newops/psbtv2.js +475 -0
- package/lib-es/newops/psbtv2.js.map +1 -0
- package/lib-es/varint.d.ts.map +1 -1
- package/lib-es/varint.js +1 -0
- package/lib-es/varint.js.map +1 -1
- package/package.json +6 -3
- package/src/Btc.ts +42 -25
- package/src/BtcNew.ts +326 -0
- package/src/BtcOld.ts +156 -0
- package/src/bip32.ts +34 -2
- package/src/buffertools.ts +102 -0
- package/src/createTransaction.ts +1 -1
- package/src/getWalletPublicKey.ts +6 -1
- package/src/hashPublicKey.ts +1 -1
- package/src/index.ts +2 -0
- package/src/newops/appClient.ts +178 -0
- package/src/newops/clientCommands.ts +312 -0
- package/src/newops/merkelizedPsbt.ts +55 -0
- package/src/newops/merkle.ts +123 -0
- package/src/newops/merkleMap.ts +39 -0
- package/src/newops/policy.ts +52 -0
- package/src/newops/psbtExtractor.ts +33 -0
- package/src/newops/psbtFinalizer.ts +110 -0
- package/src/newops/psbtv2.ts +548 -0
- package/src/varint.ts +2 -0
- package/tests/Btc.integration.test.ts +89 -0
- package/tests/Btc.test.ts +6 -0
- package/tests/newops/BtcNew.test.ts +646 -0
- package/tests/newops/common.ts +25 -0
- package/tests/newops/merkle.test.ts +97 -0
- package/tests/trustedInputs.test.ts +4 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type Transport from "@ledgerhq/hw-transport";
|
|
2
|
+
import type { CreateTransactionArg } from "./createTransaction";
|
|
3
|
+
import type { AddressFormat } from "./getWalletPublicKey";
|
|
4
|
+
import type { SignP2SHTransactionArg } from "./signP2SHTransaction";
|
|
5
|
+
export type { AddressFormat };
|
|
6
|
+
/**
|
|
7
|
+
* Bitcoin API.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* import Btc from "@ledgerhq/hw-app-btc";
|
|
11
|
+
* const btc = new Btc(transport)
|
|
12
|
+
*/
|
|
13
|
+
export default class BtcOld {
|
|
14
|
+
transport: Transport;
|
|
15
|
+
constructor(transport: Transport);
|
|
16
|
+
/**
|
|
17
|
+
* @param path a BIP 32 path
|
|
18
|
+
* @param options an object with optional these fields:
|
|
19
|
+
*
|
|
20
|
+
* - verify (boolean) will ask user to confirm the address on the device
|
|
21
|
+
*
|
|
22
|
+
* - format ("legacy" | "p2sh" | "bech32" | "cashaddr") to use different bitcoin address formatter.
|
|
23
|
+
*
|
|
24
|
+
* NB The normal usage is to use:
|
|
25
|
+
*
|
|
26
|
+
* - legacy format with 44' paths
|
|
27
|
+
*
|
|
28
|
+
* - p2sh format with 49' paths
|
|
29
|
+
*
|
|
30
|
+
* - bech32 format with 173' paths
|
|
31
|
+
*
|
|
32
|
+
* - cashaddr in case of Bitcoin Cash
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* btc.getWalletPublicKey("44'/0'/0'/0/0").then(o => o.bitcoinAddress)
|
|
36
|
+
* btc.getWalletPublicKey("49'/0'/0'/0/0", { format: "p2sh" }).then(o => o.bitcoinAddress)
|
|
37
|
+
*/
|
|
38
|
+
getWalletPublicKey(path: string, opts?: {
|
|
39
|
+
verify?: boolean;
|
|
40
|
+
format?: AddressFormat;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
publicKey: string;
|
|
43
|
+
bitcoinAddress: string;
|
|
44
|
+
chainCode: string;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* You can sign a message according to the Bitcoin Signature format and retrieve v, r, s given the message and the BIP 32 path of the account to sign.
|
|
48
|
+
* @example
|
|
49
|
+
btc.signMessageNew_async("44'/60'/0'/0'/0", Buffer.from("test").toString("hex")).then(function(result) {
|
|
50
|
+
var v = result['v'] + 27 + 4;
|
|
51
|
+
var signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');
|
|
52
|
+
console.log("Signature : " + signature);
|
|
53
|
+
}).catch(function(ex) {console.log(ex);});
|
|
54
|
+
*/
|
|
55
|
+
signMessageNew(path: string, messageHex: string): Promise<{
|
|
56
|
+
v: number;
|
|
57
|
+
r: string;
|
|
58
|
+
s: string;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* To sign a transaction involving standard (P2PKH) inputs, call createTransaction with the following parameters
|
|
62
|
+
* @param inputs is an array of [ transaction, output_index, optional redeem script, optional sequence ] where
|
|
63
|
+
*
|
|
64
|
+
* * transaction is the previously computed transaction object for this UTXO
|
|
65
|
+
* * output_index is the output in the transaction used as input for this UTXO (counting from 0)
|
|
66
|
+
* * redeem script is the optional redeem script to use when consuming a Segregated Witness input
|
|
67
|
+
* * sequence is the sequence number to use for this input (when using RBF), or non present
|
|
68
|
+
* @param associatedKeysets is an array of BIP 32 paths pointing to the path to the private key used for each UTXO
|
|
69
|
+
* @param changePath is an optional BIP 32 path pointing to the path to the public key used to compute the change address
|
|
70
|
+
* @param outputScriptHex is the hexadecimal serialized outputs of the transaction to sign
|
|
71
|
+
* @param lockTime is the optional lockTime of the transaction to sign, or default (0)
|
|
72
|
+
* @param sigHashType is the hash type of the transaction to sign, or default (all)
|
|
73
|
+
* @param segwit is an optional boolean indicating wether to use segwit or not
|
|
74
|
+
* @param initialTimestamp is an optional timestamp of the function call to use for coins that necessitate timestamps only, (not the one that the tx will include)
|
|
75
|
+
* @param additionals list of additionnal options
|
|
76
|
+
*
|
|
77
|
+
* - "bech32" for spending native segwit outputs
|
|
78
|
+
* - "abc" for bch
|
|
79
|
+
* - "gold" for btg
|
|
80
|
+
* - "bipxxx" for using BIPxxx
|
|
81
|
+
* - "sapling" to indicate a zec transaction is supporting sapling (to be set over block 419200)
|
|
82
|
+
* @param expiryHeight is an optional Buffer for zec overwinter / sapling Txs
|
|
83
|
+
* @param useTrustedInputForSegwit trust inputs for segwit transactions
|
|
84
|
+
* @return the signed transaction ready to be broadcast
|
|
85
|
+
* @example
|
|
86
|
+
btc.createTransaction({
|
|
87
|
+
inputs: [ [tx1, 1] ],
|
|
88
|
+
associatedKeysets: ["0'/0/0"],
|
|
89
|
+
outputScriptHex: "01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac"
|
|
90
|
+
}).then(res => ...);
|
|
91
|
+
*/
|
|
92
|
+
createPaymentTransactionNew(arg: CreateTransactionArg): Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* To obtain the signature of multisignature (P2SH) inputs, call signP2SHTransaction_async with the folowing parameters
|
|
95
|
+
* @param inputs is an array of [ transaction, output_index, redeem script, optional sequence ] where
|
|
96
|
+
* * transaction is the previously computed transaction object for this UTXO
|
|
97
|
+
* * output_index is the output in the transaction used as input for this UTXO (counting from 0)
|
|
98
|
+
* * redeem script is the mandatory redeem script associated to the current P2SH input
|
|
99
|
+
* * sequence is the sequence number to use for this input (when using RBF), or non present
|
|
100
|
+
* @param associatedKeysets is an array of BIP 32 paths pointing to the path to the private key used for each UTXO
|
|
101
|
+
* @param outputScriptHex is the hexadecimal serialized outputs of the transaction to sign
|
|
102
|
+
* @param lockTime is the optional lockTime of the transaction to sign, or default (0)
|
|
103
|
+
* @param sigHashType is the hash type of the transaction to sign, or default (all)
|
|
104
|
+
* @return the signed transaction ready to be broadcast
|
|
105
|
+
* @example
|
|
106
|
+
btc.signP2SHTransaction({
|
|
107
|
+
inputs: [ [tx, 1, "52210289b4a3ad52a919abd2bdd6920d8a6879b1e788c38aa76f0440a6f32a9f1996d02103a3393b1439d1693b063482c04bd40142db97bdf139eedd1b51ffb7070a37eac321030b9a409a1e476b0d5d17b804fcdb81cf30f9b99c6f3ae1178206e08bc500639853ae"] ],
|
|
108
|
+
associatedKeysets: ["0'/0/0"],
|
|
109
|
+
outputScriptHex: "01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac"
|
|
110
|
+
}).then(result => ...);
|
|
111
|
+
*/
|
|
112
|
+
signP2SHTransaction(arg: SignP2SHTransactionArg): Promise<string[]>;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=BtcOld.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BtcOld.d.ts","sourceRoot":"","sources":["../src/BtcOld.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,YAAY,EAAE,aAAa,EAAE,CAAC;AAC9B;;;;;;GAMG;AAEH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,SAAS,EAAE,SAAS,CAAC;gBAET,SAAS,EAAE,SAAS;IAIhC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GACA,OAAO,CAAC;QACT,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAOF;;;;;;;;OAQG;IACH,cAAc,CACZ,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;QACT,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;KACX,CAAC;IAOF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,2BAA2B,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC;IASvE;;;;;;;;;;;;;;;;;;OAkBG;IACH,mBAAmB,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CASpE"}
|
package/lib-es/BtcOld.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { createTransaction } from "./createTransaction";
|
|
13
|
+
import { getWalletPublicKey } from "./getWalletPublicKey";
|
|
14
|
+
import { signMessage } from "./signMessage";
|
|
15
|
+
import { signP2SHTransaction } from "./signP2SHTransaction";
|
|
16
|
+
/**
|
|
17
|
+
* Bitcoin API.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* import Btc from "@ledgerhq/hw-app-btc";
|
|
21
|
+
* const btc = new Btc(transport)
|
|
22
|
+
*/
|
|
23
|
+
var BtcOld = /** @class */ (function () {
|
|
24
|
+
function BtcOld(transport) {
|
|
25
|
+
this.transport = transport;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @param path a BIP 32 path
|
|
29
|
+
* @param options an object with optional these fields:
|
|
30
|
+
*
|
|
31
|
+
* - verify (boolean) will ask user to confirm the address on the device
|
|
32
|
+
*
|
|
33
|
+
* - format ("legacy" | "p2sh" | "bech32" | "cashaddr") to use different bitcoin address formatter.
|
|
34
|
+
*
|
|
35
|
+
* NB The normal usage is to use:
|
|
36
|
+
*
|
|
37
|
+
* - legacy format with 44' paths
|
|
38
|
+
*
|
|
39
|
+
* - p2sh format with 49' paths
|
|
40
|
+
*
|
|
41
|
+
* - bech32 format with 173' paths
|
|
42
|
+
*
|
|
43
|
+
* - cashaddr in case of Bitcoin Cash
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* btc.getWalletPublicKey("44'/0'/0'/0/0").then(o => o.bitcoinAddress)
|
|
47
|
+
* btc.getWalletPublicKey("49'/0'/0'/0/0", { format: "p2sh" }).then(o => o.bitcoinAddress)
|
|
48
|
+
*/
|
|
49
|
+
BtcOld.prototype.getWalletPublicKey = function (path, opts) {
|
|
50
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.format) === "bech32m") {
|
|
51
|
+
throw new Error("Unsupported address format bech32m");
|
|
52
|
+
}
|
|
53
|
+
return getWalletPublicKey(this.transport, __assign(__assign({}, opts), { path: path }));
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* You can sign a message according to the Bitcoin Signature format and retrieve v, r, s given the message and the BIP 32 path of the account to sign.
|
|
57
|
+
* @example
|
|
58
|
+
btc.signMessageNew_async("44'/60'/0'/0'/0", Buffer.from("test").toString("hex")).then(function(result) {
|
|
59
|
+
var v = result['v'] + 27 + 4;
|
|
60
|
+
var signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');
|
|
61
|
+
console.log("Signature : " + signature);
|
|
62
|
+
}).catch(function(ex) {console.log(ex);});
|
|
63
|
+
*/
|
|
64
|
+
BtcOld.prototype.signMessageNew = function (path, messageHex) {
|
|
65
|
+
return signMessage(this.transport, {
|
|
66
|
+
path: path,
|
|
67
|
+
messageHex: messageHex
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* To sign a transaction involving standard (P2PKH) inputs, call createTransaction with the following parameters
|
|
72
|
+
* @param inputs is an array of [ transaction, output_index, optional redeem script, optional sequence ] where
|
|
73
|
+
*
|
|
74
|
+
* * transaction is the previously computed transaction object for this UTXO
|
|
75
|
+
* * output_index is the output in the transaction used as input for this UTXO (counting from 0)
|
|
76
|
+
* * redeem script is the optional redeem script to use when consuming a Segregated Witness input
|
|
77
|
+
* * sequence is the sequence number to use for this input (when using RBF), or non present
|
|
78
|
+
* @param associatedKeysets is an array of BIP 32 paths pointing to the path to the private key used for each UTXO
|
|
79
|
+
* @param changePath is an optional BIP 32 path pointing to the path to the public key used to compute the change address
|
|
80
|
+
* @param outputScriptHex is the hexadecimal serialized outputs of the transaction to sign
|
|
81
|
+
* @param lockTime is the optional lockTime of the transaction to sign, or default (0)
|
|
82
|
+
* @param sigHashType is the hash type of the transaction to sign, or default (all)
|
|
83
|
+
* @param segwit is an optional boolean indicating wether to use segwit or not
|
|
84
|
+
* @param initialTimestamp is an optional timestamp of the function call to use for coins that necessitate timestamps only, (not the one that the tx will include)
|
|
85
|
+
* @param additionals list of additionnal options
|
|
86
|
+
*
|
|
87
|
+
* - "bech32" for spending native segwit outputs
|
|
88
|
+
* - "abc" for bch
|
|
89
|
+
* - "gold" for btg
|
|
90
|
+
* - "bipxxx" for using BIPxxx
|
|
91
|
+
* - "sapling" to indicate a zec transaction is supporting sapling (to be set over block 419200)
|
|
92
|
+
* @param expiryHeight is an optional Buffer for zec overwinter / sapling Txs
|
|
93
|
+
* @param useTrustedInputForSegwit trust inputs for segwit transactions
|
|
94
|
+
* @return the signed transaction ready to be broadcast
|
|
95
|
+
* @example
|
|
96
|
+
btc.createTransaction({
|
|
97
|
+
inputs: [ [tx1, 1] ],
|
|
98
|
+
associatedKeysets: ["0'/0/0"],
|
|
99
|
+
outputScriptHex: "01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac"
|
|
100
|
+
}).then(res => ...);
|
|
101
|
+
*/
|
|
102
|
+
BtcOld.prototype.createPaymentTransactionNew = function (arg) {
|
|
103
|
+
if (arguments.length > 1) {
|
|
104
|
+
console.warn("@ledgerhq/hw-app-btc: createPaymentTransactionNew multi argument signature is deprecated. please switch to named parameters.");
|
|
105
|
+
}
|
|
106
|
+
return createTransaction(this.transport, arg);
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* To obtain the signature of multisignature (P2SH) inputs, call signP2SHTransaction_async with the folowing parameters
|
|
110
|
+
* @param inputs is an array of [ transaction, output_index, redeem script, optional sequence ] where
|
|
111
|
+
* * transaction is the previously computed transaction object for this UTXO
|
|
112
|
+
* * output_index is the output in the transaction used as input for this UTXO (counting from 0)
|
|
113
|
+
* * redeem script is the mandatory redeem script associated to the current P2SH input
|
|
114
|
+
* * sequence is the sequence number to use for this input (when using RBF), or non present
|
|
115
|
+
* @param associatedKeysets is an array of BIP 32 paths pointing to the path to the private key used for each UTXO
|
|
116
|
+
* @param outputScriptHex is the hexadecimal serialized outputs of the transaction to sign
|
|
117
|
+
* @param lockTime is the optional lockTime of the transaction to sign, or default (0)
|
|
118
|
+
* @param sigHashType is the hash type of the transaction to sign, or default (all)
|
|
119
|
+
* @return the signed transaction ready to be broadcast
|
|
120
|
+
* @example
|
|
121
|
+
btc.signP2SHTransaction({
|
|
122
|
+
inputs: [ [tx, 1, "52210289b4a3ad52a919abd2bdd6920d8a6879b1e788c38aa76f0440a6f32a9f1996d02103a3393b1439d1693b063482c04bd40142db97bdf139eedd1b51ffb7070a37eac321030b9a409a1e476b0d5d17b804fcdb81cf30f9b99c6f3ae1178206e08bc500639853ae"] ],
|
|
123
|
+
associatedKeysets: ["0'/0/0"],
|
|
124
|
+
outputScriptHex: "01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac"
|
|
125
|
+
}).then(result => ...);
|
|
126
|
+
*/
|
|
127
|
+
BtcOld.prototype.signP2SHTransaction = function (arg) {
|
|
128
|
+
if (arguments.length > 1) {
|
|
129
|
+
console.warn("@ledgerhq/hw-app-btc: signP2SHTransaction multi argument signature is deprecated. please switch to named parameters.");
|
|
130
|
+
}
|
|
131
|
+
return signP2SHTransaction(this.transport, arg);
|
|
132
|
+
};
|
|
133
|
+
return BtcOld;
|
|
134
|
+
}());
|
|
135
|
+
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;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,oCAAmB,GAAnB,UAAoB,GAA2B;QAC7C,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;YACxB,OAAO,CAAC,IAAI,CACV,sHAAsH,CACvH,CAAC;SACH;QAED,OAAO,mBAAmB,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;IACH,aAAC;AAAD,CAAC,AA1ID,IA0IC"}
|
package/lib-es/bip32.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
export declare function pathElementsToBuffer(paths: number[]): Buffer;
|
|
2
3
|
export declare function bip32asBuffer(path: string): Buffer;
|
|
4
|
+
export declare function pathArrayToString(pathElements: number[]): string;
|
|
5
|
+
export declare function pathStringToArray(path: string): number[];
|
|
6
|
+
export declare function pubkeyFromXpub(xpub: string): Buffer;
|
|
7
|
+
export declare function getXpubComponents(xpub: string): {
|
|
8
|
+
chaincode: Buffer;
|
|
9
|
+
pubkey: Buffer;
|
|
10
|
+
};
|
|
3
11
|
//# sourceMappingURL=bip32.d.ts.map
|
package/lib-es/bip32.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bip32.d.ts","sourceRoot":"","sources":["../src/bip32.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"bip32.d.ts","sourceRoot":"","sources":["../src/bip32.ts"],"names":[],"mappings":";AAGA,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAO5D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,CAKhE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GACX;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAMvC"}
|
package/lib-es/bip32.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import bippath from "bip32-path";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import bs58check from "bs58check";
|
|
3
|
+
export function pathElementsToBuffer(paths) {
|
|
4
4
|
var buffer = Buffer.alloc(1 + paths.length * 4);
|
|
5
5
|
buffer[0] = paths.length;
|
|
6
6
|
paths.forEach(function (element, index) {
|
|
@@ -8,4 +8,28 @@ export function bip32asBuffer(path) {
|
|
|
8
8
|
});
|
|
9
9
|
return buffer;
|
|
10
10
|
}
|
|
11
|
+
export function bip32asBuffer(path) {
|
|
12
|
+
var pathElements = !path ? [] : pathStringToArray(path);
|
|
13
|
+
return pathElementsToBuffer(pathElements);
|
|
14
|
+
}
|
|
15
|
+
export function pathArrayToString(pathElements) {
|
|
16
|
+
// Limitation: bippath can't handle and empty path. It shouldn't affect us
|
|
17
|
+
// right now, but might in the future.
|
|
18
|
+
// TODO: Fix support for empty path.
|
|
19
|
+
return bippath.fromPathArray(pathElements).toString();
|
|
20
|
+
}
|
|
21
|
+
export function pathStringToArray(path) {
|
|
22
|
+
return bippath.fromString(path).toPathArray();
|
|
23
|
+
}
|
|
24
|
+
export function pubkeyFromXpub(xpub) {
|
|
25
|
+
var xpubBuf = bs58check.decode(xpub);
|
|
26
|
+
return xpubBuf.slice(xpubBuf.length - 33);
|
|
27
|
+
}
|
|
28
|
+
export function getXpubComponents(xpub) {
|
|
29
|
+
var xpubBuf = bs58check.decode(xpub);
|
|
30
|
+
return {
|
|
31
|
+
chaincode: xpubBuf.slice(13, 13 + 32),
|
|
32
|
+
pubkey: xpubBuf.slice(xpubBuf.length - 33)
|
|
33
|
+
};
|
|
34
|
+
}
|
|
11
35
|
//# sourceMappingURL=bip32.js.map
|
package/lib-es/bip32.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bip32.js","sourceRoot":"","sources":["../src/bip32.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"bip32.js","sourceRoot":"","sources":["../src/bip32.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,MAAM,UAAU,oBAAoB,CAAC,KAAe;IAClD,IAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IACzB,KAAK,CAAC,OAAO,CAAC,UAAC,OAAO,EAAE,KAAK;QAC3B,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,IAAM,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1D,OAAO,oBAAoB,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,YAAsB;IACtD,0EAA0E;IAC1E,sCAAsC;IACtC,oCAAoC;IACpC,OAAO,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,IAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAY;IAEZ,IAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;QACrC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare class BufferWriter {
|
|
3
|
+
private bufs;
|
|
4
|
+
write(alloc: number, fn: (b: Buffer) => void): void;
|
|
5
|
+
writeUInt8(i: number): void;
|
|
6
|
+
writeInt32(i: number): void;
|
|
7
|
+
writeUInt32(i: number): void;
|
|
8
|
+
writeUInt64(i: bigint): void;
|
|
9
|
+
writeVarInt(i: number): void;
|
|
10
|
+
writeSlice(slice: Buffer): void;
|
|
11
|
+
writeVarSlice(slice: Buffer): void;
|
|
12
|
+
buffer(): Buffer;
|
|
13
|
+
}
|
|
14
|
+
export declare class BufferReader {
|
|
15
|
+
buffer: Buffer;
|
|
16
|
+
offset: number;
|
|
17
|
+
constructor(buffer: Buffer, offset?: number);
|
|
18
|
+
available(): number;
|
|
19
|
+
readUInt8(): number;
|
|
20
|
+
readInt32(): number;
|
|
21
|
+
readUInt32(): number;
|
|
22
|
+
readUInt64(): bigint;
|
|
23
|
+
readVarInt(): number;
|
|
24
|
+
readSlice(n: number): Buffer;
|
|
25
|
+
readVarSlice(): Buffer;
|
|
26
|
+
readVector(): Buffer[];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=buffertools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffertools.d.ts","sourceRoot":"","sources":["../src/buffertools.ts"],"names":[],"mappings":";AAEA,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAgB;IAE5B,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAMnD,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI3B,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI3B,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI5B,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI5B,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAI5B,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI/B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKlC,MAAM,IAAI,MAAM;CAGjB;AAED,qBAAa,YAAY;IACJ,MAAM,EAAE,MAAM;IAAS,MAAM,EAAE,MAAM;gBAArC,MAAM,EAAE,MAAM,EAAS,MAAM,GAAE,MAAU;IAE5D,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;IAMnB,SAAS,IAAI,MAAM;IAMnB,UAAU,IAAI,MAAM;IAMpB,UAAU,IAAI,MAAM;IAMpB,UAAU,IAAI,MAAM;IAMpB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAS5B,YAAY,IAAI,MAAM;IAItB,UAAU,IAAI,MAAM,EAAE;CAMvB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import varuint from "varuint-bitcoin";
|
|
2
|
+
var BufferWriter = /** @class */ (function () {
|
|
3
|
+
function BufferWriter() {
|
|
4
|
+
this.bufs = [];
|
|
5
|
+
}
|
|
6
|
+
BufferWriter.prototype.write = function (alloc, fn) {
|
|
7
|
+
var b = Buffer.alloc(alloc);
|
|
8
|
+
fn(b);
|
|
9
|
+
this.bufs.push(b);
|
|
10
|
+
};
|
|
11
|
+
BufferWriter.prototype.writeUInt8 = function (i) {
|
|
12
|
+
this.write(1, function (b) { return b.writeUInt8(i, 0); });
|
|
13
|
+
};
|
|
14
|
+
BufferWriter.prototype.writeInt32 = function (i) {
|
|
15
|
+
this.write(4, function (b) { return b.writeInt32LE(i, 0); });
|
|
16
|
+
};
|
|
17
|
+
BufferWriter.prototype.writeUInt32 = function (i) {
|
|
18
|
+
this.write(4, function (b) { return b.writeUInt32LE(i, 0); });
|
|
19
|
+
};
|
|
20
|
+
BufferWriter.prototype.writeUInt64 = function (i) {
|
|
21
|
+
this.write(8, function (b) { return b.writeBigUInt64LE(i, 0); });
|
|
22
|
+
};
|
|
23
|
+
BufferWriter.prototype.writeVarInt = function (i) {
|
|
24
|
+
this.bufs.push(varuint.encode(i));
|
|
25
|
+
};
|
|
26
|
+
BufferWriter.prototype.writeSlice = function (slice) {
|
|
27
|
+
this.bufs.push(Buffer.from(slice));
|
|
28
|
+
};
|
|
29
|
+
BufferWriter.prototype.writeVarSlice = function (slice) {
|
|
30
|
+
this.writeVarInt(slice.length);
|
|
31
|
+
this.writeSlice(slice);
|
|
32
|
+
};
|
|
33
|
+
BufferWriter.prototype.buffer = function () {
|
|
34
|
+
return Buffer.concat(this.bufs);
|
|
35
|
+
};
|
|
36
|
+
return BufferWriter;
|
|
37
|
+
}());
|
|
38
|
+
export { BufferWriter };
|
|
39
|
+
var BufferReader = /** @class */ (function () {
|
|
40
|
+
function BufferReader(buffer, offset) {
|
|
41
|
+
if (offset === void 0) { offset = 0; }
|
|
42
|
+
this.buffer = buffer;
|
|
43
|
+
this.offset = offset;
|
|
44
|
+
}
|
|
45
|
+
BufferReader.prototype.available = function () {
|
|
46
|
+
return this.buffer.length - this.offset;
|
|
47
|
+
};
|
|
48
|
+
BufferReader.prototype.readUInt8 = function () {
|
|
49
|
+
var result = this.buffer.readUInt8(this.offset);
|
|
50
|
+
this.offset++;
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
BufferReader.prototype.readInt32 = function () {
|
|
54
|
+
var result = this.buffer.readInt32LE(this.offset);
|
|
55
|
+
this.offset += 4;
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
BufferReader.prototype.readUInt32 = function () {
|
|
59
|
+
var result = this.buffer.readUInt32LE(this.offset);
|
|
60
|
+
this.offset += 4;
|
|
61
|
+
return result;
|
|
62
|
+
};
|
|
63
|
+
BufferReader.prototype.readUInt64 = function () {
|
|
64
|
+
var result = this.buffer.readBigUInt64LE(this.offset);
|
|
65
|
+
this.offset += 8;
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
68
|
+
BufferReader.prototype.readVarInt = function () {
|
|
69
|
+
var vi = varuint.decode(this.buffer, this.offset);
|
|
70
|
+
this.offset += varuint.decode.bytes;
|
|
71
|
+
return vi;
|
|
72
|
+
};
|
|
73
|
+
BufferReader.prototype.readSlice = function (n) {
|
|
74
|
+
if (this.buffer.length < this.offset + n) {
|
|
75
|
+
throw new Error("Cannot read slice out of bounds");
|
|
76
|
+
}
|
|
77
|
+
var result = this.buffer.slice(this.offset, this.offset + n);
|
|
78
|
+
this.offset += n;
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
BufferReader.prototype.readVarSlice = function () {
|
|
82
|
+
return this.readSlice(this.readVarInt());
|
|
83
|
+
};
|
|
84
|
+
BufferReader.prototype.readVector = function () {
|
|
85
|
+
var count = this.readVarInt();
|
|
86
|
+
var vector = [];
|
|
87
|
+
for (var i = 0; i < count; i++)
|
|
88
|
+
vector.push(this.readVarSlice());
|
|
89
|
+
return vector;
|
|
90
|
+
};
|
|
91
|
+
return BufferReader;
|
|
92
|
+
}());
|
|
93
|
+
export { BufferReader };
|
|
94
|
+
//# sourceMappingURL=buffertools.js.map
|
|
@@ -0,0 +1 @@
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 -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AAGpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAS1D,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,SAAS,CAAC;AAY9D,YAAY,EAAE,aAAa,EAAE,CAAC;AAW9B;;GAEG;AACH,oBAAY,oBAAoB,GAAG;IACjC,MAAM,EAAE,KAAK,CACX;QAAC,WAAW;QAAE,MAAM;QAAE,MAAM,GAAG,IAAI,GAAG,SAAS;QAAE,MAAM,GAAG,IAAI,GAAG,SAAS;KAAC,CAC5E,CAAC;IACF,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,IAAI,CAAC;IACX,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;CACvC,CAAC;AACF,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"createTransaction.d.ts","sourceRoot":"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|
|
3
3
|
* address format is one of legacy | p2sh | bech32 | cashaddr
|
|
4
4
|
*/
|
|
5
|
-
export declare type AddressFormat = "legacy" | "p2sh" | "bech32" | "cashaddr";
|
|
5
|
+
export declare type AddressFormat = "legacy" | "p2sh" | "bech32" | "bech32m" | "cashaddr";
|
|
6
6
|
export declare function getWalletPublicKey(transport: Transport, options: {
|
|
7
7
|
path: string;
|
|
8
8
|
verify?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWalletPublicKey.d.ts","sourceRoot":"","sources":["../src/getWalletPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AAGpD;;GAEG;AACH,oBAAY,aAAa,
|
|
1
|
+
{"version":3,"file":"getWalletPublicKey.d.ts","sourceRoot":"","sources":["../src/getWalletPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AAGpD;;GAEG;AACH,oBAAY,aAAa,GACrB,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,SAAS,GACT,UAAU,CAAC;AAOf,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,GACA,OAAO,CAAC;IACT,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CAgCD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWalletPublicKey.js","sourceRoot":"","sources":["../src/getWalletPublicKey.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"getWalletPubl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G,CAAC,EAAE,CAAC,GAAG,eAAe,GAAG,CAAC,GAAG,aAAa,CAAC;yBACvE,QAAQ,CAAC,OAAO,CAAC,CAAC;oBACf,SAAS,GAAG,QAAQ;yBACvB,KAAK,CACJ,CAAC,GAAG,eAAe,GAAG,CAAC,GAAG,aAAa,EACvC,CAAC,GAAG,eAAe,GAAG,CAAC,GAAG,aAAa,GAAG,EAAE,CAC7C;yBACA,QAAQ,CAAC,KAAK,CAAC,CAAC;oBACnB,sBAAO;4BACL,SAAS,WAAA;4BACT,cAAc,gBAAA;4BACd,SAAS,WAAA;yBACV,EAAC;;;;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashPublicKey.d.ts","sourceRoot":"","sources":["../src/hashPublicKey.ts"],"names":[],"mappings":";AAEA,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"hashPublicKey.d.ts","sourceRoot":"","sources":["../src/hashPublicKey.ts"],"names":[],"mappings":";AAEA,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,eAAe,GAAG,CAAC"}
|
package/lib-es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,OAAO,CAAC;AACxB,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Transport from "@ledgerhq/hw-transport";
|
|
3
|
+
import { PsbtV2 } from "./psbtv2";
|
|
4
|
+
import { WalletPolicy } from "./policy";
|
|
5
|
+
export declare class AppClient {
|
|
6
|
+
transport: Transport;
|
|
7
|
+
constructor(transport: Transport);
|
|
8
|
+
private makeRequest;
|
|
9
|
+
getPubkey(display: boolean, pathElements: number[]): Promise<string>;
|
|
10
|
+
getWalletAddress(walletPolicy: WalletPolicy, walletHMAC: Buffer | null, change: number, addressIndex: number, display: boolean): Promise<string>;
|
|
11
|
+
signPsbt(psbt: PsbtV2, walletPolicy: WalletPolicy, walletHMAC: Buffer | null): Promise<Map<number, Buffer>>;
|
|
12
|
+
getMasterFingerprint(): Promise<Buffer>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=appClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appClient.d.ts","sourceRoot":"","sources":["../../src/newops/appClient.ts"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAoBxC,qBAAa,SAAS;IACpB,SAAS,EAAE,SAAS,CAAC;gBAET,SAAS,EAAE,SAAS;YAIlB,WAAW;IA6BnB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAcpE,gBAAgB,CACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC;IAkCZ,QAAQ,CACZ,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,GACxB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAuDzB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC;CAG9C"}
|