@ledgerhq/hw-app-btc 10.2.1 → 10.2.2-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 (59) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +104 -58
  3. package/lib/Btc.d.ts +31 -7
  4. package/lib/Btc.d.ts.map +1 -1
  5. package/lib/Btc.js +31 -7
  6. package/lib/Btc.js.map +1 -1
  7. package/lib/BtcNew.d.ts +4 -2
  8. package/lib/BtcNew.d.ts.map +1 -1
  9. package/lib/BtcNew.js +9 -2
  10. package/lib/BtcNew.js.map +1 -1
  11. package/lib/BtcOld.d.ts +8 -6
  12. package/lib/BtcOld.d.ts.map +1 -1
  13. package/lib/BtcOld.js +8 -6
  14. package/lib/BtcOld.js.map +1 -1
  15. package/lib/bip32.d.ts +9 -0
  16. package/lib/bip32.d.ts.map +1 -1
  17. package/lib/bip32.js +9 -0
  18. package/lib/bip32.js.map +1 -1
  19. package/lib/constants.d.ts.map +1 -1
  20. package/lib/constants.js +6 -1
  21. package/lib/constants.js.map +1 -1
  22. package/lib/createTransaction.d.ts.map +1 -1
  23. package/lib/createTransaction.js +2 -1
  24. package/lib/createTransaction.js.map +1 -1
  25. package/lib/getWalletPublicKey.d.ts +1 -1
  26. package/lib/types.d.ts.map +1 -1
  27. package/lib-es/Btc.d.ts +31 -7
  28. package/lib-es/Btc.d.ts.map +1 -1
  29. package/lib-es/Btc.js +31 -7
  30. package/lib-es/Btc.js.map +1 -1
  31. package/lib-es/BtcNew.d.ts +4 -2
  32. package/lib-es/BtcNew.d.ts.map +1 -1
  33. package/lib-es/BtcNew.js +9 -2
  34. package/lib-es/BtcNew.js.map +1 -1
  35. package/lib-es/BtcOld.d.ts +8 -6
  36. package/lib-es/BtcOld.d.ts.map +1 -1
  37. package/lib-es/BtcOld.js +8 -6
  38. package/lib-es/BtcOld.js.map +1 -1
  39. package/lib-es/bip32.d.ts +9 -0
  40. package/lib-es/bip32.d.ts.map +1 -1
  41. package/lib-es/bip32.js +9 -0
  42. package/lib-es/bip32.js.map +1 -1
  43. package/lib-es/constants.d.ts.map +1 -1
  44. package/lib-es/constants.js +6 -1
  45. package/lib-es/constants.js.map +1 -1
  46. package/lib-es/createTransaction.d.ts.map +1 -1
  47. package/lib-es/createTransaction.js +2 -1
  48. package/lib-es/createTransaction.js.map +1 -1
  49. package/lib-es/getWalletPublicKey.d.ts +1 -1
  50. package/lib-es/types.d.ts.map +1 -1
  51. package/package.json +4 -4
  52. package/src/Btc.ts +34 -8
  53. package/src/BtcNew.ts +9 -2
  54. package/src/BtcOld.ts +8 -6
  55. package/src/bip32.ts +10 -0
  56. package/src/constants.ts +6 -1
  57. package/src/createTransaction.ts +2 -1
  58. package/src/getWalletPublicKey.ts +1 -1
  59. package/src/types.ts +12 -0
@@ -173,7 +173,8 @@ export async function createTransaction(
173
173
 
174
174
  if (expiryHeight && !isDecred) {
175
175
  targetTransaction.nVersionGroupId = Buffer.from(
176
- // nVersionGroupId is 0x26A7270A for zcash from https://z.cash/upgrade/nu5/
176
+ // nVersionGroupId is 0x26A7270A for zcash NU5 upgrade
177
+ // refer to https://github.com/zcash/zcash/blob/master/src/primitives/transaction.h
177
178
  isZcash
178
179
  ? [0x0a, 0x27, 0xa7, 0x26]
179
180
  : sapling
@@ -2,7 +2,7 @@ import type Transport from "@ledgerhq/hw-transport";
2
2
  import { bip32asBuffer } from "./bip32";
3
3
 
4
4
  /**
5
- * address format is one of legacy | p2sh | bech32 | cashaddr
5
+ * address format is one of legacy | p2sh | bech32 | bech32m | cashaddr
6
6
  */
7
7
  export type AddressFormat = "legacy" | "p2sh" | "bech32" | "bech32m" | "cashaddr";
8
8
  const addressFormatMap = {
package/src/types.ts CHANGED
@@ -17,14 +17,26 @@ export interface TransactionOutput {
17
17
  /**
18
18
  */
19
19
  export interface Transaction {
20
+ // Each transaction is prefixed by a four-byte transaction version number
21
+ // which tells Bitcoin peers and miners which set of rules to use to validate it.
20
22
  version: Buffer;
21
23
  inputs: TransactionInput[];
22
24
  outputs?: TransactionOutput[];
25
+ // locktime indicates the earliest time or earliest block when that transaction may
26
+ // be added to the block chain.
23
27
  locktime?: Buffer;
24
28
  witness?: Buffer;
29
+ // timestamp is used only for peercoin but it is no longer necessary anymore
25
30
  timestamp?: Buffer;
31
+ // nVersionGroupId is used only for Zcash, different version of Zcash has different nVersionGroupId
32
+ // refer to https://github.com/zcash/zcash/blob/master/src/primitives/transaction.h for more details
26
33
  nVersionGroupId?: Buffer;
34
+ // nExpiryHeight is used only for Decred and Zcash and ZenCash.
35
+ // It sets the block height after which transactions will be removed
36
+ // from the mempool if they have not been mined
37
+ // refer to https://zips.z.cash/zip-0203 for more details
27
38
  nExpiryHeight?: Buffer;
39
+ // extraData is used only for Zcash and ZenCash and komodo
28
40
  extraData?: Buffer;
29
41
  }
30
42