@ledgerhq/hw-app-btc 9.0.1-nightly.0 → 9.1.0-next.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.
Files changed (45) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +15 -2
  3. package/README.md +33 -111
  4. package/lib/Btc.d.ts +12 -11
  5. package/lib/Btc.d.ts.map +1 -1
  6. package/lib/Btc.js +47 -143
  7. package/lib/Btc.js.map +1 -1
  8. package/lib/BtcNew.d.ts +2 -4
  9. package/lib/BtcNew.d.ts.map +1 -1
  10. package/lib/BtcNew.js +54 -13
  11. package/lib/BtcNew.js.map +1 -1
  12. package/lib/BtcOld.d.ts +2 -37
  13. package/lib/BtcOld.d.ts.map +1 -1
  14. package/lib/BtcOld.js +3 -45
  15. package/lib/BtcOld.js.map +1 -1
  16. package/lib/getAppAndVersion.d.ts +1 -0
  17. package/lib/getAppAndVersion.d.ts.map +1 -1
  18. package/lib/getAppAndVersion.js +21 -1
  19. package/lib/getAppAndVersion.js.map +1 -1
  20. package/lib-es/Btc.d.ts +12 -11
  21. package/lib-es/Btc.d.ts.map +1 -1
  22. package/lib-es/Btc.js +47 -120
  23. package/lib-es/Btc.js.map +1 -1
  24. package/lib-es/BtcNew.d.ts +2 -4
  25. package/lib-es/BtcNew.d.ts.map +1 -1
  26. package/lib-es/BtcNew.js +54 -8
  27. package/lib-es/BtcNew.js.map +1 -1
  28. package/lib-es/BtcOld.d.ts +2 -37
  29. package/lib-es/BtcOld.d.ts.map +1 -1
  30. package/lib-es/BtcOld.js +3 -45
  31. package/lib-es/BtcOld.js.map +1 -1
  32. package/lib-es/getAppAndVersion.d.ts +1 -0
  33. package/lib-es/getAppAndVersion.d.ts.map +1 -1
  34. package/lib-es/getAppAndVersion.js +19 -0
  35. package/lib-es/getAppAndVersion.js.map +1 -1
  36. package/package.json +4 -4
  37. package/src/Btc.ts +54 -146
  38. package/src/BtcNew.ts +60 -15
  39. package/src/BtcOld.ts +4 -59
  40. package/src/getAppAndVersion.ts +12 -0
  41. package/tests/{Btc.test.ts → Btc.test.ts.disabled} +16 -132
  42. package/tests/newops/BtcNew.test.ts +0 -5
  43. package/tests/newops/integrationtools.ts +4 -4
  44. package/tests/parseTx.test.ts +1 -1
  45. package/tests/{trustedInputs.test.ts → trustedInputs.test.ts.disabled} +6 -8
@@ -1,4 +1,4 @@
1
1
 
2
- > @ledgerhq/hw-app-btc@9.0.0 build /home/runner/work/ledger-live/ledger-live/libs/ledgerjs/packages/hw-app-btc
2
+ > @ledgerhq/hw-app-btc@9.0.1 build /home/runner/work/ledger-live/ledger-live/libs/ledgerjs/packages/hw-app-btc
3
3
  > tsc && tsc -m ES6 --outDir lib-es
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,11 +1,24 @@
1
1
  # @ledgerhq/hw-app-btc
2
2
 
3
- ## 9.0.1-nightly.0
3
+ ## 9.1.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1959](https://github.com/LedgerHQ/ledger-live/pull/1959) [`2aa8cc9c33`](https://github.com/LedgerHQ/ledger-live/commit/2aa8cc9c339ce8c9677b24e70218cc45847d799b) Thanks [@hzheng-ledger](https://github.com/hzheng-ledger)! - Change hw-app-btc to remove any dependency to the legacy Bitcoin Nano app API. Update hw-app-btc API (refer to hw-app-btc/src/Btc.ts for new method signature)
8
+
9
+ ## 9.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies []:
14
+ - @ledgerhq/hw-transport@6.27.8
15
+
16
+ ## 9.0.1-next.0
4
17
 
5
18
  ### Patch Changes
6
19
 
7
20
  - Updated dependencies []:
8
- - @ledgerhq/hw-transport@6.27.8-nightly.0
21
+ - @ledgerhq/hw-transport@6.27.8-next.0
9
22
 
10
23
  ## 9.0.0
11
24
 
package/README.md CHANGED
@@ -35,10 +35,10 @@ For a smooth and quick integration:
35
35
  * [getWalletPublicKey](#getwalletpublickey)
36
36
  * [Parameters](#parameters-2)
37
37
  * [Examples](#examples-1)
38
- * [signMessageNew](#signmessagenew)
38
+ * [signMessage](#signmessage)
39
39
  * [Parameters](#parameters-3)
40
40
  * [Examples](#examples-2)
41
- * [createPaymentTransactionNew](#createpaymenttransactionnew)
41
+ * [createPaymentTransaction](#createpaymenttransaction)
42
42
  * [Parameters](#parameters-4)
43
43
  * [Examples](#examples-3)
44
44
  * [signP2SHTransaction](#signp2shtransaction)
@@ -50,14 +50,13 @@ For a smooth and quick integration:
50
50
  * [serializeTransactionOutputs](#serializetransactionoutputs)
51
51
  * [Parameters](#parameters-7)
52
52
  * [Examples](#examples-6)
53
- * [impl](#impl)
54
53
  * [BtcNew](#btcnew)
55
54
  * [Parameters](#parameters-8)
56
55
  * [getWalletXpub](#getwalletxpub-1)
57
56
  * [Parameters](#parameters-9)
58
57
  * [getWalletPublicKey](#getwalletpublickey-1)
59
58
  * [Parameters](#parameters-10)
60
- * [createPaymentTransactionNew](#createpaymenttransactionnew-1)
59
+ * [createPaymentTransaction](#createpaymenttransaction-1)
61
60
  * [Parameters](#parameters-11)
62
61
  * [BtcOld](#btcold)
63
62
  * [Parameters](#parameters-12)
@@ -65,53 +64,47 @@ For a smooth and quick integration:
65
64
  * [getWalletPublicKey](#getwalletpublickey-2)
66
65
  * [Parameters](#parameters-13)
67
66
  * [Examples](#examples-8)
68
- * [signMessageNew](#signmessagenew-1)
67
+ * [createPaymentTransaction](#createpaymenttransaction-2)
69
68
  * [Parameters](#parameters-14)
70
69
  * [Examples](#examples-9)
71
- * [createPaymentTransactionNew](#createpaymenttransactionnew-2)
72
- * [Parameters](#parameters-15)
73
- * [Examples](#examples-10)
74
- * [signP2SHTransaction](#signp2shtransaction-1)
75
- * [Parameters](#parameters-16)
76
- * [Examples](#examples-11)
77
70
  * [CreateTransactionArg](#createtransactionarg)
78
71
  * [Properties](#properties)
79
72
  * [AddressFormat](#addressformat)
80
73
  * [AccountType](#accounttype)
81
74
  * [spendingCondition](#spendingcondition)
82
- * [Parameters](#parameters-17)
75
+ * [Parameters](#parameters-15)
83
76
  * [setInput](#setinput)
84
- * [Parameters](#parameters-18)
77
+ * [Parameters](#parameters-16)
85
78
  * [setOwnOutput](#setownoutput)
86
- * [Parameters](#parameters-19)
79
+ * [Parameters](#parameters-17)
87
80
  * [getDescriptorTemplate](#getdescriptortemplate)
88
81
  * [SingleKeyAccount](#singlekeyaccount)
89
82
  * [getTaprootOutputKey](#gettaprootoutputkey)
90
- * [Parameters](#parameters-20)
83
+ * [Parameters](#parameters-18)
91
84
  * [AppClient](#appclient)
92
- * [Parameters](#parameters-21)
85
+ * [Parameters](#parameters-19)
93
86
  * [ClientCommandInterpreter](#clientcommandinterpreter)
94
- * [Parameters](#parameters-22)
87
+ * [Parameters](#parameters-20)
95
88
  * [MerkelizedPsbt](#merkelizedpsbt)
96
- * [Parameters](#parameters-23)
89
+ * [Parameters](#parameters-21)
97
90
  * [Merkle](#merkle)
98
- * [Parameters](#parameters-24)
91
+ * [Parameters](#parameters-22)
99
92
  * [MerkleMap](#merklemap)
100
- * [Parameters](#parameters-25)
93
+ * [Parameters](#parameters-23)
101
94
  * [WalletPolicy](#walletpolicy)
102
- * [Parameters](#parameters-26)
95
+ * [Parameters](#parameters-24)
103
96
  * [extract](#extract)
104
- * [Parameters](#parameters-27)
97
+ * [Parameters](#parameters-25)
105
98
  * [finalize](#finalize)
106
- * [Parameters](#parameters-28)
99
+ * [Parameters](#parameters-26)
107
100
  * [clearFinalizedInput](#clearfinalizedinput)
108
- * [Parameters](#parameters-29)
101
+ * [Parameters](#parameters-27)
109
102
  * [writePush](#writepush)
110
- * [Parameters](#parameters-30)
103
+ * [Parameters](#parameters-28)
111
104
  * [PsbtV2](#psbtv2)
112
105
  * [serializeTransactionOutputs](#serializetransactionoutputs-1)
113
- * [Parameters](#parameters-31)
114
- * [Examples](#examples-12)
106
+ * [Parameters](#parameters-29)
107
+ * [Examples](#examples-10)
115
108
  * [SignP2SHTransactionArg](#signp2shtransactionarg)
116
109
  * [Properties](#properties-1)
117
110
  * [TransactionInput](#transactioninput)
@@ -124,14 +117,17 @@ Bitcoin API.
124
117
 
125
118
  #### Parameters
126
119
 
127
- * `transport` **Transport**
128
- * `scrambleKey` (optional, default `"BTC"`)
120
+ * `$0` **{transport: Transport, scrambleKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, currency: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?}**
121
+
122
+ * `$0.transport`
123
+ * `$0.scrambleKey` (optional, default `"BTC"`)
124
+ * `$0.currency` (optional, default `"bitcoin"`)
129
125
 
130
126
  #### Examples
131
127
 
132
128
  ```javascript
133
129
  import Btc from "@ledgerhq/hw-app-btc";
134
- const btc = new Btc(transport)
130
+ const btc = new Btc({ transport, currency: "bitcoin" });
135
131
  ```
136
132
 
137
133
  #### getWalletXpub
@@ -170,7 +166,7 @@ btc.getWalletPublicKey("49'/0'/0'/0/0", { format: "p2sh" }).then(o => o.bitcoinA
170
166
 
171
167
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{publicKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), bitcoinAddress: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), chainCode: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**
172
168
 
173
- #### signMessageNew
169
+ #### signMessage
174
170
 
175
171
  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.
176
172
 
@@ -182,7 +178,7 @@ You can sign a message according to the Bitcoin Signature format and retrieve v,
182
178
  ##### Examples
183
179
 
184
180
  ```javascript
185
- btc.signMessageNew_async("44'/60'/0'/0'/0", Buffer.from("test").toString("hex")).then(function(result) {
181
+ btc.signMessage("44'/60'/0'/0'/0", Buffer.from("test").toString("hex")).then(function(result) {
186
182
  var v = result['v'] + 27 + 4;
187
183
  var signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');
188
184
  console.log("Signature : " + signature);
@@ -191,7 +187,7 @@ console.log("Signature : " + signature);
191
187
 
192
188
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**
193
189
 
194
- #### createPaymentTransactionNew
190
+ #### createPaymentTransaction
195
191
 
196
192
  To sign a transaction involving standard (P2PKH) inputs, call createTransaction with the following parameters
197
193
 
@@ -293,31 +289,6 @@ const outputScript = btc.serializeTransactionOutputs(tx1).toString('hex');
293
289
 
294
290
  Returns **[Buffer](https://nodejs.org/api/buffer.html)**
295
291
 
296
- ### impl
297
-
298
- Definition: A "normal path" is a prefix of a standard path where all
299
- the hardened steps of the standard path are included. For example, the
300
- paths m/44'/1'/17' and m/44'/1'/17'/1 are normal paths, but m/44'/1'
301
- is not. m/'199/1'/17'/0/1 is not a normal path either.
302
-
303
- There's a compatiblity issue between old and new app: When exporting
304
- the key of a non-normal path with verify=false, the new app would
305
- return an error, whereas the old app would return the key.
306
-
307
- See
308
- https://github.com/LedgerHQ/app-bitcoin-new/blob/master/doc/bitcoin.md#get_extended_pubkey
309
-
310
- If format bech32m is used, we'll not use old, because it doesn't
311
- support it.
312
-
313
- When to use new (given the app supports it)
314
-
315
- * format is bech32m or
316
- * path is normal or
317
- * verify is true
318
-
319
- Otherwise use old.
320
-
321
292
  ### BtcNew
322
293
 
323
294
  This class implements the same interface as BtcOld (formerly
@@ -391,9 +362,9 @@ will be the empty string "", see this.getWalletAddress() for details.
391
362
 
392
363
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{publicKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), bitcoinAddress: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), chainCode: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**
393
364
 
394
- #### createPaymentTransactionNew
365
+ #### createPaymentTransaction
395
366
 
396
- Build and sign a transaction. See Btc.createPaymentTransactionNew for
367
+ Build and sign a transaction. See Btc.createPaymentTransaction for
397
368
  details on how to use this method.
398
369
 
399
370
  This method will convert the legacy arguments, CreateTransactionArg, into
@@ -418,7 +389,7 @@ Bitcoin API.
418
389
 
419
390
  ```javascript
420
391
  import Btc from "@ledgerhq/hw-app-btc";
421
- const btc = new Btc(transport)
392
+ const btc = new Btc({ transport, currency: "zcash" });
422
393
  ```
423
394
 
424
395
  #### getWalletPublicKey
@@ -446,28 +417,7 @@ btc.getWalletPublicKey("49'/0'/0'/0/0", { format: "p2sh" }).then(o => o.bitcoinA
446
417
 
447
418
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{publicKey: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), bitcoinAddress: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), chainCode: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**
448
419
 
449
- #### signMessageNew
450
-
451
- 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.
452
-
453
- ##### Parameters
454
-
455
- * `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
456
- * `messageHex` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**
457
-
458
- ##### Examples
459
-
460
- ```javascript
461
- btc.signMessageNew_async("44'/60'/0'/0'/0", Buffer.from("test").toString("hex")).then(function(result) {
462
- var v = result['v'] + 27 + 4;
463
- var signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');
464
- console.log("Signature : " + signature);
465
- }).catch(function(ex) {console.log(ex);});
466
- ```
467
-
468
- Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<{v: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), r: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), s: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)}>**
469
-
470
- #### createPaymentTransactionNew
420
+ #### createPaymentTransaction
471
421
 
472
422
  To sign a transaction involving standard (P2PKH) inputs, call createTransaction with the following parameters
473
423
 
@@ -505,34 +455,6 @@ outputScriptHex: "01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d
505
455
 
506
456
  Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** the signed transaction ready to be broadcast
507
457
 
508
- #### signP2SHTransaction
509
-
510
- To obtain the signature of multisignature (P2SH) inputs, call signP2SHTransaction_async with the folowing parameters
511
-
512
- ##### Parameters
513
-
514
- * `arg` **[SignP2SHTransactionArg](#signp2shtransactionarg)**
515
- * `inputs` is an array of \[ transaction, output_index, redeem script, optional sequence ] where* transaction is the previously computed transaction object for this UTXO
516
- * output_index is the output in the transaction used as input for this UTXO (counting from 0)
517
- * redeem script is the mandatory redeem script associated to the current P2SH input
518
- * sequence is the sequence number to use for this input (when using RBF), or non present
519
- * `associatedKeysets` is an array of BIP 32 paths pointing to the path to the private key used for each UTXO
520
- * `outputScriptHex` is the hexadecimal serialized outputs of the transaction to sign
521
- * `lockTime` is the optional lockTime of the transaction to sign, or default (0)
522
- * `sigHashType` is the hash type of the transaction to sign, or default (all)
523
-
524
- ##### Examples
525
-
526
- ```javascript
527
- btc.signP2SHTransaction({
528
- inputs: [ [tx, 1, "52210289b4a3ad52a919abd2bdd6920d8a6879b1e788c38aa76f0440a6f32a9f1996d02103a3393b1439d1693b063482c04bd40142db97bdf139eedd1b51ffb7070a37eac321030b9a409a1e476b0d5d17b804fcdb81cf30f9b99c6f3ae1178206e08bc500639853ae"] ],
529
- associatedKeysets: ["0'/0/0"],
530
- outputScriptHex: "01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac"
531
- }).then(result => ...);
532
- ```
533
-
534
- Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>>** the signed transaction ready to be broadcast
535
-
536
458
  ### CreateTransactionArg
537
459
 
538
460
  Type: {inputs: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<\[[Transaction](#transaction), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), ([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)), ([number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number) | null | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))]>, associatedKeysets: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>, changePath: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, outputScriptHex: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String), lockTime: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, sigHashType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, segwit: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, initialTimestamp: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?, additionals: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>, expiryHeight: [Buffer](https://nodejs.org/api/buffer.html)?, useTrustedInputForSegwit: [boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?, onDeviceStreaming: function (arg0: {progress: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), total: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), index: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}): void?, onDeviceSignatureRequested: function (): void?, onDeviceSignatureGranted: function (): void?}
package/lib/Btc.d.ts CHANGED
@@ -12,11 +12,16 @@ export type { AddressFormat };
12
12
  *
13
13
  * @example
14
14
  * import Btc from "@ledgerhq/hw-app-btc";
15
- * const btc = new Btc(transport)
15
+ * const btc = new Btc({ transport, currency: "bitcoin" });
16
16
  */
17
17
  export default class Btc {
18
- transport: Transport;
19
- constructor(transport: Transport, scrambleKey?: string);
18
+ private _transport;
19
+ private _impl;
20
+ constructor({ transport, scrambleKey, currency, }: {
21
+ transport: Transport;
22
+ scrambleKey?: string;
23
+ currency?: string;
24
+ });
20
25
  /**
21
26
  * Get an XPUB with a ledger device
22
27
  * @param arg derivation parameter
@@ -61,13 +66,13 @@ export default class Btc {
61
66
  /**
62
67
  * 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.
63
68
  * @example
64
- btc.signMessageNew_async("44'/60'/0'/0'/0", Buffer.from("test").toString("hex")).then(function(result) {
69
+ btc.signMessage("44'/60'/0'/0'/0", Buffer.from("test").toString("hex")).then(function(result) {
65
70
  var v = result['v'] + 27 + 4;
66
71
  var signature = Buffer.from(v.toString(16) + result['r'] + result['s'], 'hex').toString('base64');
67
72
  console.log("Signature : " + signature);
68
73
  }).catch(function(ex) {console.log(ex);});
69
74
  */
70
- signMessageNew(path: string, messageHex: string): Promise<{
75
+ signMessage(path: string, messageHex: string): Promise<{
71
76
  v: number;
72
77
  r: string;
73
78
  s: string;
@@ -105,7 +110,7 @@ export default class Btc {
105
110
  outputScriptHex: "01905f0100000000001976a91472a5d75c8d2d0565b656a5232703b167d50d5a2b88ac"
106
111
  }).then(res => ...);
107
112
  */
108
- createPaymentTransactionNew(arg: CreateTransactionArg): Promise<string>;
113
+ createPaymentTransaction(arg: CreateTransactionArg): Promise<string>;
109
114
  /**
110
115
  * To obtain the signature of multisignature (P2SH) inputs, call signP2SHTransaction_async with the folowing parameters
111
116
  * @param inputs is an array of [ transaction, output_index, redeem script, optional sequence ] where
@@ -140,10 +145,6 @@ export default class Btc {
140
145
  serializeTransactionOutputs(t: Transaction): Buffer;
141
146
  getTrustedInput(indexLookup: number, transaction: Transaction, additionals?: Array<string>): Promise<string>;
142
147
  getTrustedInputBIP143(indexLookup: number, transaction: Transaction, additionals?: Array<string>): string;
143
- private _lazyImpl;
144
- private getCorrectImpl;
145
- private inferCorrectImpl;
146
- protected old(): BtcOld;
147
- protected new(): BtcNew;
148
+ changeImplIfNecessary(): Promise<BtcOld | BtcNew>;
148
149
  }
149
150
  //# sourceMappingURL=Btc.d.ts.map
package/lib/Btc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Btc.d.ts","sourceRoot":"","sources":["../src/Btc.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,wBAAwB,CAAC;AAEpD,OAAO,MAAyB,MAAM,UAAU,CAAC;AACjD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM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