@ledgerhq/live-common 21.4.1-btcjs.4 → 21.5.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 (169) hide show
  1. package/lib/account/addAccounts.d.ts.map +1 -1
  2. package/lib/account/addAccounts.js +1 -2
  3. package/lib/account/addAccounts.js.map +1 -1
  4. package/lib/account/support.d.ts.map +1 -1
  5. package/lib/account/support.js +1 -24
  6. package/lib/account/support.js.map +1 -1
  7. package/lib/api/explorerConfig/index.js +15 -15
  8. package/lib/apps/polyfill.d.ts.map +1 -1
  9. package/lib/apps/polyfill.js +5 -0
  10. package/lib/apps/polyfill.js.map +1 -1
  11. package/lib/bridge/jsHelpers.d.ts +1 -6
  12. package/lib/bridge/jsHelpers.d.ts.map +1 -1
  13. package/lib/bridge/jsHelpers.js +3 -11
  14. package/lib/bridge/jsHelpers.js.map +1 -1
  15. package/lib/env.js +2 -2
  16. package/lib/families/bitcoin/account.d.ts.map +1 -1
  17. package/lib/families/bitcoin/account.js +2 -3
  18. package/lib/families/bitcoin/account.js.map +1 -1
  19. package/lib/families/bitcoin/datasets/bitcoin.js +6 -6
  20. package/lib/families/bitcoin/datasets/bitcoin.js.map +1 -1
  21. package/lib/families/bitcoin/datasets/litecoin.js +3 -3
  22. package/lib/families/bitcoin/datasets/litecoin.js.map +1 -1
  23. package/lib/families/bitcoin/serialization.d.ts +2 -2
  24. package/lib/families/bitcoin/serialization.d.ts.map +1 -1
  25. package/lib/families/bitcoin/serialization.js +4 -8
  26. package/lib/families/bitcoin/serialization.js.map +1 -1
  27. package/lib/families/bitcoin/specs.d.ts.map +1 -1
  28. package/lib/families/bitcoin/specs.js +5 -8
  29. package/lib/families/bitcoin/specs.js.map +1 -1
  30. package/lib/families/bitcoin/speculos-deviceActions.js +2 -2
  31. package/lib/families/bitcoin/speculos-deviceActions.js.map +1 -1
  32. package/lib/families/bitcoin/test-dataset.js +1 -1
  33. package/lib/families/bitcoin/test-dataset.js.map +1 -1
  34. package/lib/families/bitcoin/transaction.d.ts +3 -3
  35. package/lib/families/bitcoin/transaction.d.ts.map +1 -1
  36. package/lib/families/bitcoin/transaction.js +61 -64
  37. package/lib/families/bitcoin/transaction.js.map +1 -1
  38. package/lib/families/bitcoin/types.d.ts +36 -66
  39. package/lib/families/bitcoin/types.d.ts.map +1 -1
  40. package/lib/families/bitcoin/types.js +1 -16
  41. package/lib/families/bitcoin/types.js.map +1 -1
  42. package/lib/families/crypto_org/logic.d.ts +1 -1
  43. package/lib/families/crypto_org/logic.js +7 -7
  44. package/lib/families/elrond/js-getTransactionStatus.d.ts.map +1 -1
  45. package/lib/families/elrond/js-getTransactionStatus.js +3 -0
  46. package/lib/families/elrond/js-getTransactionStatus.js.map +1 -1
  47. package/lib/families/elrond/js-signOperation.d.ts.map +1 -1
  48. package/lib/families/elrond/js-signOperation.js +10 -7
  49. package/lib/families/elrond/js-signOperation.js.map +1 -1
  50. package/lib/generated/bridge/js.d.ts +0 -4
  51. package/lib/generated/bridge/js.d.ts.map +1 -1
  52. package/lib/generated/bridge/js.js +18 -20
  53. package/lib/generated/bridge/js.js.map +1 -1
  54. package/lib/hw/actions/initSwap.js +2 -2
  55. package/lib/hw/actions/initSwap.js.map +1 -1
  56. package/lib/migrations/accounts-dataset.d.ts.map +1 -1
  57. package/lib/migrations/accounts-dataset.js +2 -4
  58. package/lib/migrations/accounts-dataset.js.map +1 -1
  59. package/lib/migrations/accounts.d.ts.map +1 -1
  60. package/lib/migrations/accounts.js +0 -17
  61. package/lib/migrations/accounts.js.map +1 -1
  62. package/lib/mock/account.d.ts.map +1 -1
  63. package/lib/mock/account.js +1 -2
  64. package/lib/mock/account.js.map +1 -1
  65. package/package.json +22 -22
  66. package/src/__tests__/__snapshots__/all.libcore.ts.snap +43 -6
  67. package/src/account/addAccounts.ts +1 -2
  68. package/src/account/support.ts +1 -24
  69. package/src/api/explorerConfig/index.ts +15 -15
  70. package/src/apps/polyfill.ts +5 -0
  71. package/src/bridge/jsHelpers.ts +2 -22
  72. package/src/env.ts +2 -2
  73. package/src/families/bitcoin/account.ts +1 -2
  74. package/src/families/bitcoin/datasets/bitcoin.ts +6 -6
  75. package/src/families/bitcoin/datasets/litecoin.ts +6 -6
  76. package/src/families/bitcoin/serialization.ts +0 -6
  77. package/src/families/bitcoin/specs.ts +2 -5
  78. package/src/families/bitcoin/speculos-deviceActions.ts +1 -1
  79. package/src/families/bitcoin/test-dataset.ts +1 -1
  80. package/src/families/bitcoin/transaction.ts +93 -98
  81. package/src/families/bitcoin/types.ts +37 -95
  82. package/src/families/crypto_org/logic.ts +6 -6
  83. package/src/families/elrond/js-getTransactionStatus.ts +5 -0
  84. package/src/families/elrond/js-signOperation.ts +1 -0
  85. package/src/generated/bridge/js.ts +0 -3
  86. package/src/hw/actions/initSwap.ts +2 -2
  87. package/src/migrations/accounts-dataset.ts +0 -3
  88. package/src/migrations/accounts.ts +0 -18
  89. package/src/mock/account.ts +0 -2
  90. package/lib/families/bitcoin/bridge/js.d.ts +0 -8
  91. package/lib/families/bitcoin/bridge/js.d.ts.map +0 -1
  92. package/lib/families/bitcoin/bridge/js.js +0 -149
  93. package/lib/families/bitcoin/bridge/js.js.map +0 -1
  94. package/lib/families/bitcoin/cache.d.ts +0 -28
  95. package/lib/families/bitcoin/cache.d.ts.map +0 -1
  96. package/lib/families/bitcoin/cache.js +0 -109
  97. package/lib/families/bitcoin/cache.js.map +0 -1
  98. package/lib/families/bitcoin/getAccountNetworkInfo.d.ts +0 -6
  99. package/lib/families/bitcoin/getAccountNetworkInfo.d.ts.map +0 -1
  100. package/lib/families/bitcoin/getAccountNetworkInfo.js +0 -124
  101. package/lib/families/bitcoin/getAccountNetworkInfo.js.map +0 -1
  102. package/lib/families/bitcoin/getAccountNetworkInfo.test.d.ts +0 -2
  103. package/lib/families/bitcoin/getAccountNetworkInfo.test.d.ts.map +0 -1
  104. package/lib/families/bitcoin/getAccountNetworkInfo.test.js +0 -71
  105. package/lib/families/bitcoin/getAccountNetworkInfo.test.js.map +0 -1
  106. package/lib/families/bitcoin/js-broadcast.d.ts +0 -11
  107. package/lib/families/bitcoin/js-broadcast.d.ts.map +0 -1
  108. package/lib/families/bitcoin/js-broadcast.js +0 -80
  109. package/lib/families/bitcoin/js-broadcast.js.map +0 -1
  110. package/lib/families/bitcoin/js-buildTransaction.d.ts +0 -5
  111. package/lib/families/bitcoin/js-buildTransaction.d.ts.map +0 -1
  112. package/lib/families/bitcoin/js-buildTransaction.js +0 -106
  113. package/lib/families/bitcoin/js-buildTransaction.js.map +0 -1
  114. package/lib/families/bitcoin/js-createTransaction.d.ts +0 -9
  115. package/lib/families/bitcoin/js-createTransaction.d.ts.map +0 -1
  116. package/lib/families/bitcoin/js-createTransaction.js +0 -27
  117. package/lib/families/bitcoin/js-createTransaction.js.map +0 -1
  118. package/lib/families/bitcoin/js-estimateMaxSpendable.d.ts +0 -15
  119. package/lib/families/bitcoin/js-estimateMaxSpendable.d.ts.map +0 -1
  120. package/lib/families/bitcoin/js-estimateMaxSpendable.js +0 -95
  121. package/lib/families/bitcoin/js-estimateMaxSpendable.js.map +0 -1
  122. package/lib/families/bitcoin/js-getFeesForTransaction.d.ts +0 -26
  123. package/lib/families/bitcoin/js-getFeesForTransaction.d.ts.map +0 -1
  124. package/lib/families/bitcoin/js-getFeesForTransaction.js +0 -100
  125. package/lib/families/bitcoin/js-getFeesForTransaction.js.map +0 -1
  126. package/lib/families/bitcoin/js-getTransactionStatus.d.ts +0 -5
  127. package/lib/families/bitcoin/js-getTransactionStatus.d.ts.map +0 -1
  128. package/lib/families/bitcoin/js-getTransactionStatus.js +0 -131
  129. package/lib/families/bitcoin/js-getTransactionStatus.js.map +0 -1
  130. package/lib/families/bitcoin/js-prepareTransaction.d.ts +0 -5
  131. package/lib/families/bitcoin/js-prepareTransaction.d.ts.map +0 -1
  132. package/lib/families/bitcoin/js-prepareTransaction.js +0 -80
  133. package/lib/families/bitcoin/js-prepareTransaction.js.map +0 -1
  134. package/lib/families/bitcoin/js-signOperation.d.ts +0 -10
  135. package/lib/families/bitcoin/js-signOperation.d.ts.map +0 -1
  136. package/lib/families/bitcoin/js-signOperation.js +0 -212
  137. package/lib/families/bitcoin/js-signOperation.js.map +0 -1
  138. package/lib/families/bitcoin/js-synchronisation.d.ts +0 -10
  139. package/lib/families/bitcoin/js-synchronisation.d.ts.map +0 -1
  140. package/lib/families/bitcoin/js-synchronisation.js +0 -411
  141. package/lib/families/bitcoin/js-synchronisation.js.map +0 -1
  142. package/lib/families/bitcoin/logic.d.ts +0 -34
  143. package/lib/families/bitcoin/logic.d.ts.map +0 -1
  144. package/lib/families/bitcoin/logic.js +0 -283
  145. package/lib/families/bitcoin/logic.js.map +0 -1
  146. package/lib/families/bitcoin/networks.d.ts +0 -3
  147. package/lib/families/bitcoin/networks.d.ts.map +0 -1
  148. package/lib/families/bitcoin/networks.js +0 -379
  149. package/lib/families/bitcoin/networks.js.map +0 -1
  150. package/lib/families/bitcoin/wallet.d.ts +0 -6
  151. package/lib/families/bitcoin/wallet.d.ts.map +0 -1
  152. package/lib/families/bitcoin/wallet.js +0 -66
  153. package/lib/families/bitcoin/wallet.js.map +0 -1
  154. package/src/families/bitcoin/bridge/js.ts +0 -76
  155. package/src/families/bitcoin/cache.ts +0 -76
  156. package/src/families/bitcoin/getAccountNetworkInfo.test.ts +0 -27
  157. package/src/families/bitcoin/getAccountNetworkInfo.ts +0 -61
  158. package/src/families/bitcoin/js-broadcast.ts +0 -30
  159. package/src/families/bitcoin/js-buildTransaction.ts +0 -57
  160. package/src/families/bitcoin/js-createTransaction.ts +0 -27
  161. package/src/families/bitcoin/js-estimateMaxSpendable.ts +0 -36
  162. package/src/families/bitcoin/js-getFeesForTransaction.ts +0 -59
  163. package/src/families/bitcoin/js-getTransactionStatus.ts +0 -118
  164. package/src/families/bitcoin/js-prepareTransaction.ts +0 -35
  165. package/src/families/bitcoin/js-signOperation.ts +0 -164
  166. package/src/families/bitcoin/js-synchronisation.ts +0 -362
  167. package/src/families/bitcoin/logic.ts +0 -243
  168. package/src/families/bitcoin/networks.ts +0 -360
  169. package/src/families/bitcoin/wallet.ts +0 -21
@@ -1,243 +0,0 @@
1
- import cashaddr from "cashaddrjs";
2
- import bchaddr from "bchaddrjs";
3
- import { isValidAddress } from "@ledgerhq/wallet-btc";
4
- import { RecipientRequired, InvalidAddress } from "@ledgerhq/errors";
5
- import type { Account, CryptoCurrency, CryptoCurrencyIds } from "./../../types";
6
- import type {
7
- BitcoinOutput,
8
- BitcoinResources,
9
- Transaction,
10
- NetworkInfo,
11
- UtxoStrategy,
12
- CoreBitcoinLikeOutput,
13
- CoreBitcoinLikeInput,
14
- BitcoinInput,
15
- } from "./types";
16
- import { libcoreAmountToBigNumber } from "../../libcore/buildBigNumber";
17
-
18
- // correspond ~ to min relay fees but determined empirically for a tx to be accepted by network
19
- const minFees = {
20
- bitcoin: 1000,
21
- bitcoin_gold: 1000,
22
- pivx: 2000,
23
- stakenet: 1000,
24
- stealthcoin: 2000,
25
- qtum: 4000,
26
- stratis: 2000,
27
- vertcoin: 2000,
28
- viacoin: 2000,
29
- peercoin: 2000,
30
- };
31
- export const getMinRelayFee = (currency: CryptoCurrency): number =>
32
- minFees[currency.id] || 0;
33
- export const inferFeePerByte = (t: Transaction, networkInfo: NetworkInfo) => {
34
- if (t.feesStrategy) {
35
- const speed = networkInfo.feeItems.items.find(
36
- (item) => t.feesStrategy === item.speed
37
- );
38
-
39
- if (!speed) {
40
- return networkInfo.feeItems.defaultFeePerByte;
41
- }
42
-
43
- return speed.feePerByte;
44
- }
45
-
46
- return t.feePerByte || networkInfo.feeItems.defaultFeePerByte;
47
- };
48
- export const isValidRecipient = async (params: {
49
- currency: CryptoCurrency;
50
- recipient: string;
51
- }): Promise<Error | null | undefined> => {
52
- if (!params.recipient) {
53
- return Promise.reject(new RecipientRequired(""));
54
- }
55
- const valid = isValidAddress(params.recipient);
56
- if (!valid) {
57
- return Promise.reject(
58
- new InvalidAddress("Invalid address for currency " + params.currency.name)
59
- );
60
- }
61
- return Promise.resolve(null);
62
- };
63
- export function isChangeOutput(output: BitcoinOutput): boolean {
64
- if (!output.path) return false;
65
- const p = output.path.split("/");
66
- return p[p.length - 2] === "1";
67
- }
68
-
69
- type UTXOStatus =
70
- | {
71
- excluded: true;
72
- reason: "pickUnconfirmedRBF" | "userExclusion";
73
- }
74
- | {
75
- excluded: false;
76
- };
77
- export const getUTXOStatus = (
78
- utxo: BitcoinOutput,
79
- utxoStrategy: UtxoStrategy
80
- ): UTXOStatus => {
81
- if (!utxoStrategy.pickUnconfirmedRBF && utxo.rbf && !utxo.blockHeight) {
82
- return {
83
- excluded: true,
84
- reason: "pickUnconfirmedRBF",
85
- };
86
- }
87
-
88
- if (
89
- utxoStrategy.excludeUTXOs.some(
90
- (u) => u.hash === utxo.hash && u.outputIndex === utxo.outputIndex
91
- )
92
- ) {
93
- return {
94
- excluded: true,
95
- reason: "userExclusion",
96
- };
97
- }
98
-
99
- return {
100
- excluded: false,
101
- };
102
- };
103
-
104
- const bchExplicit = (str: string): string => {
105
- const explicit = str.includes(":") ? str : "bitcoincash:" + str;
106
-
107
- try {
108
- const { type } = cashaddr.decode(explicit);
109
- if (type === "P2PKH") return explicit;
110
- } catch (e) {
111
- // ignore errors
112
- }
113
-
114
- return str;
115
- };
116
-
117
- type CoinLogic = {
118
- hasExtraData?: boolean;
119
- hasExpiryHeight?: boolean;
120
- getAdditionals?: (arg0: { transaction: Transaction }) => string[];
121
- asExplicitTransactionRecipient?: (arg0: string) => string;
122
- onScreenTransactionRecipient?: (arg0: string) => string;
123
- postBuildBitcoinResources?: (
124
- arg0: Account,
125
- arg1?: BitcoinResources
126
- ) => BitcoinResources;
127
- syncReplaceAddress?: (addr: string) => string;
128
- injectGetAddressParams?: (arg0: Account) => any;
129
- };
130
-
131
- const bchToCashaddrAddressWithoutPrefix = (recipient) =>
132
- recipient ? bchaddr.toCashAddress(recipient).split(":")[1] : recipient;
133
-
134
- export const perCoinLogic: Record<
135
- CryptoCurrencyIds,
136
- CoinLogic | null | undefined
137
- > = {
138
- zencash: {
139
- hasExtraData: true, // FIXME (legacy) investigate why we need this here and drop
140
- },
141
- zcash: {
142
- hasExtraData: true,
143
- hasExpiryHeight: true,
144
- getAdditionals: () => ["sapling"], // FIXME (legacy) drop in ledgerjs. we always use sapling now for zcash & kmd
145
- },
146
- komodo: {
147
- hasExtraData: true,
148
- hasExpiryHeight: true,
149
- getAdditionals: () => ["sapling"], // FIXME (legacy) drop in ledgerjs. we always use sapling now for zcash & kmd
150
- },
151
- decred: {
152
- hasExpiryHeight: true,
153
- },
154
- bitcoin_gold: {
155
- getAdditionals: () => ["bip143"],
156
- },
157
- bitcoin_cash: {
158
- getAdditionals: ({ transaction }) => {
159
- const additionals = ["bip143"];
160
-
161
- if (bchExplicit(transaction.recipient).startsWith("bitcoincash:")) {
162
- additionals.push("cashaddr");
163
- }
164
-
165
- return additionals;
166
- },
167
- // Due to minimal support, we need to return the explicit format of bitcoincash:.. if it's a P2PKH
168
- asExplicitTransactionRecipient: bchExplicit,
169
- // to represent what happens on the device, which do not display the bitcoincash: prefix
170
- onScreenTransactionRecipient: (str: string): string => {
171
- const prefix = "bitcoincash:";
172
- return str.startsWith(prefix) ? str.slice(prefix.length) : str;
173
- },
174
- syncReplaceAddress: (addr) => bchToCashaddrAddressWithoutPrefix(addr),
175
- injectGetAddressParams: () => ({
176
- forceFormat: "cashaddr",
177
- }),
178
- },
179
- };
180
-
181
- // TODO vvvvv DEPRECATED, TO BE REMOVED vvvvv
182
-
183
- export async function parseBitcoinInput(
184
- input: CoreBitcoinLikeInput
185
- ): Promise<BitcoinInput> {
186
- const address = await input.getAddress();
187
- const rawValue = await input.getValue();
188
- const value = rawValue ? await libcoreAmountToBigNumber(rawValue) : null;
189
- const previousTxHash = await input.getPreviousTxHash();
190
- const previousOutputIndex = await input.getPreviousOutputIndex();
191
- return {
192
- address,
193
- value,
194
- previousTxHash,
195
- previousOutputIndex,
196
- };
197
- }
198
-
199
- export async function parseBitcoinOutput(
200
- output: CoreBitcoinLikeOutput
201
- ): Promise<BitcoinOutput> {
202
- let blockHeight = await output.getBlockHeight();
203
-
204
- if (!blockHeight || blockHeight < 0) {
205
- blockHeight = undefined;
206
- }
207
-
208
- const hash = await output.getTransactionHash();
209
- const outputIndex = await output.getOutputIndex();
210
- const address = await output.getAddress();
211
- const derivationPath = await output.getDerivationPath();
212
- let path;
213
-
214
- if (derivationPath) {
215
- const isDerivationPathNull = await derivationPath.isNull();
216
-
217
- if (!isDerivationPathNull) {
218
- path = await derivationPath.toString();
219
- }
220
- }
221
-
222
- const value = await libcoreAmountToBigNumber(await output.getValue());
223
- const rbf = false; // this is unsafe to generically call this at the moment. libcore segfault.
224
-
225
- return {
226
- hash,
227
- outputIndex,
228
- blockHeight,
229
- address,
230
- isChange: false,
231
- path,
232
- value,
233
- rbf,
234
- };
235
- }
236
-
237
- export async function parseBitcoinUTXO(
238
- output: CoreBitcoinLikeOutput
239
- ): Promise<BitcoinOutput> {
240
- const utxo = await parseBitcoinOutput(output);
241
- utxo.rbf = await output.isReplaceable();
242
- return utxo;
243
- }
@@ -1,360 +0,0 @@
1
- import { BigNumber } from "bignumber.js";
2
- import type { BitcoinLikeNetworkParameters } from "./types";
3
- import { BitcoinLikeFeePolicy, BitcoinLikeSigHashType } from "./types";
4
-
5
- // TODO Custom parameters from libcore -- not used yet
6
- /*
7
- const BIP115_PARAMETERS = {
8
- blockHash: "9ec9845acb02fab24e1c0368b3b517c1a4488fba97f0e3459ac053ea01000000",
9
- blockHeight: {0xC0,0x1F,0x02};
10
- };
11
- //Zcash overwinter
12
- const ZIP143_PARAMETERS = {
13
- 3,
14
- {0x80},
15
- {0x03, 0xC4, 0x82, 0x70},
16
- 347500
17
- };
18
- //Zcash Sapling (starting from block 419200)
19
- const ZIP_SAPLING_PARAMETERS = {
20
- 4,
21
- {0x80},
22
- {0x89, 0x2F, 0x20, 0x85},
23
- 419200
24
- };
25
- */
26
-
27
- export const getNetworkParameters = (
28
- networkName: string
29
- ): BitcoinLikeNetworkParameters => {
30
- if (networkName === "bitcoin") {
31
- return {
32
- identifier: "btc",
33
- P2PKHVersion: Buffer.from([0x00]),
34
- P2SHVersion: Buffer.from([0x05]),
35
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
36
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
37
- dustAmount: new BigNumber(546),
38
- messagePrefix: "Bitcoin signed message:\n",
39
- usesTimestampedTransaction: false,
40
- timestampDelay: new BigNumber(0),
41
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
42
- additionalBIPs: [],
43
- };
44
- } else if (networkName === "bitcoin_testnet") {
45
- return {
46
- identifier: "btc_testnet",
47
- P2PKHVersion: Buffer.from([0x6f]),
48
- P2SHVersion: Buffer.from([0xc4]),
49
- xpubVersion: Buffer.from([0x04, 0x35, 0x87, 0xcf]),
50
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
51
- dustAmount: new BigNumber(546),
52
- messagePrefix: "Bitcoin signed Message:\n",
53
- usesTimestampedTransaction: false,
54
- timestampDelay: new BigNumber(0),
55
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
56
- additionalBIPs: [],
57
- };
58
- } else if (networkName === "bitcoin_cash") {
59
- return {
60
- identifier: "abc",
61
- P2PKHVersion: Buffer.from([0x00]),
62
- P2SHVersion: Buffer.from([0x05]),
63
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
64
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
65
- dustAmount: new BigNumber(5430),
66
- messagePrefix: "Bitcoin signed Message:\n",
67
- usesTimestampedTransaction: false,
68
- timestampDelay: new BigNumber(0),
69
- sigHash:
70
- BitcoinLikeSigHashType.SIGHASH_ALL |
71
- BitcoinLikeSigHashType.SIGHASH_FORKID,
72
- additionalBIPs: [],
73
- };
74
- } else if (networkName === "bitcoin_gold") {
75
- return {
76
- identifier: "btg",
77
- P2PKHVersion: Buffer.from([0x26]),
78
- P2SHVersion: Buffer.from([0x17]),
79
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
80
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
81
- dustAmount: new BigNumber(5430),
82
- messagePrefix: "Bitcoin gold signed Message:\n",
83
- usesTimestampedTransaction: false,
84
- timestampDelay: new BigNumber(0),
85
- sigHash:
86
- BitcoinLikeSigHashType.SIGHASH_ALL |
87
- BitcoinLikeSigHashType.SIGHASH_FORKID,
88
- additionalBIPs: [],
89
- };
90
- } else if (networkName === "zcash") {
91
- return {
92
- identifier: "zec",
93
- P2PKHVersion: Buffer.from([0x1c, 0xb8]),
94
- P2SHVersion: Buffer.from([0x1c, 0xbd]),
95
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
96
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
97
- dustAmount: new BigNumber(10000),
98
- messagePrefix: "Zcash Signed Message:\n",
99
- usesTimestampedTransaction: false,
100
- timestampDelay: new BigNumber(0),
101
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
102
- additionalBIPs: ["ZIP"],
103
- };
104
- } else if (networkName === "zencash") {
105
- return {
106
- identifier: "zen",
107
- P2PKHVersion: Buffer.from([0x20, 0x89]),
108
- P2SHVersion: Buffer.from([0x20, 0x96]),
109
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
110
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
111
- dustAmount: new BigNumber(10000),
112
- messagePrefix: "Zencash Signed Message:\n",
113
- usesTimestampedTransaction: false,
114
- timestampDelay: new BigNumber(0),
115
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
116
- additionalBIPs: ["BIP115"],
117
- };
118
- } else if (networkName === "litecoin") {
119
- return {
120
- identifier: "ltc",
121
- P2PKHVersion: Buffer.from([0x30]),
122
- P2SHVersion: Buffer.from([0x32]),
123
- xpubVersion: Buffer.from([0x01, 0x9d, 0xa4, 0x62]),
124
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
125
- dustAmount: new BigNumber(10000),
126
- messagePrefix: "Litecoin Signed Message:\n",
127
- usesTimestampedTransaction: false,
128
- timestampDelay: new BigNumber(0),
129
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
130
- additionalBIPs: [],
131
- };
132
- } else if (networkName === "peercoin") {
133
- return {
134
- identifier: "ppc",
135
- P2PKHVersion: Buffer.from([0x37]),
136
- P2SHVersion: Buffer.from([0x75]),
137
- xpubVersion: Buffer.from([0xe6, 0xe8, 0xe9, 0xe5]),
138
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
139
- dustAmount: new BigNumber(10000),
140
- messagePrefix: "PPCoin Signed Message:\n",
141
- usesTimestampedTransaction: true,
142
- timestampDelay: new BigNumber(0),
143
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
144
- additionalBIPs: [],
145
- };
146
- } else if (networkName === "digibyte") {
147
- return {
148
- identifier: "dgb",
149
- P2PKHVersion: Buffer.from([0x1e]),
150
- P2SHVersion: Buffer.from([0x3f]),
151
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
152
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
153
- dustAmount: new BigNumber(10000),
154
- messagePrefix: "DigiByte Signed Message:\n",
155
- usesTimestampedTransaction: false,
156
- timestampDelay: new BigNumber(0),
157
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
158
- additionalBIPs: [],
159
- };
160
- } else if (networkName === "hcash") {
161
- return {
162
- identifier: "hsr",
163
- P2PKHVersion: Buffer.from([0x28]),
164
- P2SHVersion: Buffer.from([0x78]),
165
- xpubVersion: Buffer.from([0x04, 0x88, 0xc2, 0x1e]),
166
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
167
- dustAmount: new BigNumber(10000),
168
- messagePrefix: "HShare Signed Message:\n",
169
- usesTimestampedTransaction: true,
170
- timestampDelay: new BigNumber(0),
171
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
172
- additionalBIPs: [],
173
- };
174
- } else if (networkName === "qtum") {
175
- return {
176
- identifier: "qtum",
177
- P2PKHVersion: Buffer.from([0x3a]),
178
- P2SHVersion: Buffer.from([0x32]),
179
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
180
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
181
- dustAmount: new BigNumber(10000),
182
- messagePrefix: "Qtum Signed Message:\n",
183
- usesTimestampedTransaction: false,
184
- timestampDelay: new BigNumber(0),
185
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
186
- additionalBIPs: [],
187
- };
188
- } else if (networkName === "stealthcoin") {
189
- return {
190
- identifier: "xst",
191
- P2PKHVersion: Buffer.from([0x3e]),
192
- P2SHVersion: Buffer.from([0x55]),
193
- xpubVersion: Buffer.from([0x8f, 0x62, 0x4b, 0x66]),
194
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
195
- dustAmount: new BigNumber(10000),
196
- messagePrefix: "StealthCoin Signed Message:\n",
197
- usesTimestampedTransaction: false,
198
- // Used to depend on "version", cf. https://github.com/LedgerHQ/lib-ledger-core/blob/fc9d762b83fc2b269d072b662065747a64ab2816/core/src/wallet/bitcoin/networks.cpp#L250
199
- timestampDelay: new BigNumber(15),
200
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
201
- additionalBIPs: [],
202
- };
203
- } else if (networkName === "vertcoin") {
204
- return {
205
- identifier: "vtc",
206
- P2PKHVersion: Buffer.from([0x47]),
207
- P2SHVersion: Buffer.from([0x05]),
208
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
209
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
210
- dustAmount: new BigNumber(10000),
211
- messagePrefix: "VertCoin Signed Message:\n",
212
- usesTimestampedTransaction: false,
213
- timestampDelay: new BigNumber(0),
214
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
215
- additionalBIPs: [],
216
- };
217
- } else if (networkName === "viacoin") {
218
- return {
219
- identifier: "via",
220
- P2PKHVersion: Buffer.from([0x47]),
221
- P2SHVersion: Buffer.from([0x21]),
222
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
223
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
224
- dustAmount: new BigNumber(10000),
225
- messagePrefix: "ViaCoin Signed Message:\n",
226
- usesTimestampedTransaction: false,
227
- timestampDelay: new BigNumber(0),
228
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
229
- additionalBIPs: [],
230
- };
231
- } else if (networkName === "dash") {
232
- return {
233
- identifier: "dash",
234
- P2PKHVersion: Buffer.from([0x4c]),
235
- P2SHVersion: Buffer.from([0x01]),
236
- xpubVersion: Buffer.from([0x02, 0xfe, 0x52, 0xf8]),
237
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
238
- dustAmount: new BigNumber(10000),
239
- messagePrefix: "DarkCoin Signed Message:\n",
240
- usesTimestampedTransaction: false,
241
- timestampDelay: new BigNumber(0),
242
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
243
- additionalBIPs: [],
244
- };
245
- } else if (networkName === "dogecoin") {
246
- return {
247
- identifier: "doge",
248
- P2PKHVersion: Buffer.from([0x1e]),
249
- P2SHVersion: Buffer.from([0x16]),
250
- xpubVersion: Buffer.from([0x02, 0xfa, 0xca, 0xfd]),
251
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
252
- dustAmount: new BigNumber(10000),
253
- messagePrefix: "DogeCoin Signed Message:\n",
254
- usesTimestampedTransaction: false,
255
- timestampDelay: new BigNumber(0),
256
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
257
- additionalBIPs: [],
258
- };
259
- } else if (networkName === "stratis") {
260
- return {
261
- identifier: "strat",
262
- P2PKHVersion: Buffer.from([0x3f]),
263
- P2SHVersion: Buffer.from([0x7d]),
264
- xpubVersion: Buffer.from([0x04, 0x88, 0xc2, 0x1e]),
265
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
266
- dustAmount: new BigNumber(10000),
267
- messagePrefix: "Stratis Signed Message:\n",
268
- usesTimestampedTransaction: true,
269
- timestampDelay: new BigNumber(15),
270
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
271
- additionalBIPs: [],
272
- };
273
- } else if (networkName === "komodo") {
274
- return {
275
- identifier: "kmd",
276
- P2PKHVersion: Buffer.from([0x3c]),
277
- P2SHVersion: Buffer.from([0x55]),
278
- xpubVersion: Buffer.from([0xf9, 0xee, 0xe4, 0x8d]),
279
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
280
- dustAmount: new BigNumber(10000),
281
- messagePrefix: "Komodo Signed Message:\n",
282
- usesTimestampedTransaction: false,
283
- timestampDelay: new BigNumber(0),
284
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
285
- additionalBIPs: [],
286
- };
287
- } else if (networkName === "poswallet") {
288
- return {
289
- identifier: "posw",
290
- P2PKHVersion: Buffer.from([0x37]),
291
- P2SHVersion: Buffer.from([0x55]),
292
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
293
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
294
- dustAmount: new BigNumber(10000),
295
- messagePrefix: "PosWallet Signed Message:\n",
296
- usesTimestampedTransaction: true,
297
- timestampDelay: new BigNumber(0),
298
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
299
- additionalBIPs: [],
300
- };
301
- } else if (networkName === "pivx") {
302
- return {
303
- identifier: "pivx",
304
- P2PKHVersion: Buffer.from([0x1e]),
305
- P2SHVersion: Buffer.from([0x0d]),
306
- xpubVersion: Buffer.from([0x02, 0x2d, 0x25, 0x33]),
307
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
308
- dustAmount: new BigNumber(10000),
309
- messagePrefix: "DarkNet Signed Message:\n",
310
- usesTimestampedTransaction: false,
311
- timestampDelay: new BigNumber(0),
312
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
313
- additionalBIPs: [],
314
- };
315
- } else if (networkName === "clubcoin") {
316
- return {
317
- identifier: "club",
318
- P2PKHVersion: Buffer.from([0x1c]),
319
- P2SHVersion: Buffer.from([0x55]),
320
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
321
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
322
- dustAmount: new BigNumber(10000),
323
- messagePrefix: "Clubcoin Signed Message:\n",
324
- usesTimestampedTransaction: true,
325
- timestampDelay: new BigNumber(0),
326
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
327
- additionalBIPs: [],
328
- };
329
- } else if (networkName === "decred") {
330
- return {
331
- identifier: "dcr",
332
- P2PKHVersion: Buffer.from([0x07, 0x3f]),
333
- P2SHVersion: Buffer.from([0x07, 0x1a]),
334
- xpubVersion: Buffer.from([0x02, 0xfd, 0xa9, 0x26]),
335
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
336
- dustAmount: new BigNumber(10000),
337
- messagePrefix: "Decred Signed Message:\n",
338
- usesTimestampedTransaction: false,
339
- timestampDelay: new BigNumber(0),
340
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
341
- additionalBIPs: [],
342
- };
343
- } else if (networkName === "stakenet") {
344
- return {
345
- identifier: "xsn",
346
- P2PKHVersion: Buffer.from([0x4c]),
347
- P2SHVersion: Buffer.from([0x10]),
348
- xpubVersion: Buffer.from([0x04, 0x88, 0xb2, 0x1e]),
349
- feePolicy: BitcoinLikeFeePolicy.PER_BYTE,
350
- dustAmount: new BigNumber(10000),
351
- messagePrefix: "Stakenet Signed Message:\n",
352
- usesTimestampedTransaction: false,
353
- timestampDelay: new BigNumber(0),
354
- sigHash: BitcoinLikeSigHashType.SIGHASH_ALL,
355
- additionalBIPs: [],
356
- };
357
- }
358
-
359
- throw new Error("No network parameters set for " + networkName);
360
- };