@ledgerhq/live-common 21.31.0 → 21.32.3

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 (143) hide show
  1. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.d.ts +2 -0
  2. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.d.ts.map +1 -0
  3. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.js +100 -0
  4. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.js.map +1 -0
  5. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js +0 -10
  6. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js.map +1 -1
  7. package/lib/api/Ethereum.d.ts.map +1 -1
  8. package/lib/api/Ethereum.js +1 -0
  9. package/lib/api/Ethereum.js.map +1 -1
  10. package/lib/apps/logic.d.ts.map +1 -1
  11. package/lib/apps/logic.js +7 -5
  12. package/lib/apps/logic.js.map +1 -1
  13. package/lib/apps/polyfill.d.ts.map +1 -1
  14. package/lib/apps/polyfill.js +1 -0
  15. package/lib/apps/polyfill.js.map +1 -1
  16. package/lib/bot/engine.d.ts.map +1 -1
  17. package/lib/bot/engine.js +3 -0
  18. package/lib/bot/engine.js.map +1 -1
  19. package/lib/errors.d.ts +3 -0
  20. package/lib/errors.d.ts.map +1 -1
  21. package/lib/errors.js +3 -2
  22. package/lib/errors.js.map +1 -1
  23. package/lib/exchange/platform/transfer/index.d.ts.map +1 -1
  24. package/lib/exchange/platform/transfer/index.js +15 -1
  25. package/lib/exchange/platform/transfer/index.js.map +1 -1
  26. package/lib/families/algorand/buildTransaction.d.ts +2 -2
  27. package/lib/families/algorand/buildTransaction.d.ts.map +1 -1
  28. package/lib/families/algorand/buildTransaction.js +13 -19
  29. package/lib/families/algorand/buildTransaction.js.map +1 -1
  30. package/lib/families/algorand/js-getFeesForTransaction.js +4 -6
  31. package/lib/families/algorand/js-getFeesForTransaction.js.map +1 -1
  32. package/lib/families/algorand/js-signOperation.js +3 -7
  33. package/lib/families/algorand/js-signOperation.js.map +1 -1
  34. package/lib/families/algorand/js-synchronization.d.ts.map +1 -1
  35. package/lib/families/algorand/js-synchronization.js +1 -0
  36. package/lib/families/algorand/js-synchronization.js.map +1 -1
  37. package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
  38. package/lib/families/bitcoin/js-signOperation.js +3 -5
  39. package/lib/families/bitcoin/js-signOperation.js.map +1 -1
  40. package/lib/families/bitcoin/js-synchronisation.js +4 -4
  41. package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
  42. package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts +4 -3
  43. package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts.map +1 -1
  44. package/lib/families/bitcoin/wallet-btc/crypto/base.js +8 -7
  45. package/lib/families/bitcoin/wallet-btc/crypto/base.js.map +1 -1
  46. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.d.ts +1 -1
  47. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.d.ts.map +1 -1
  48. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js +3 -7
  49. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js.map +1 -1
  50. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts +3 -4
  51. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts.map +1 -1
  52. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js +27 -53
  53. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js.map +1 -1
  54. package/lib/families/bitcoin/wallet-btc/crypto/decred.d.ts +1 -1
  55. package/lib/families/bitcoin/wallet-btc/crypto/decred.d.ts.map +1 -1
  56. package/lib/families/bitcoin/wallet-btc/crypto/decred.js +2 -7
  57. package/lib/families/bitcoin/wallet-btc/crypto/decred.js.map +1 -1
  58. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts +1 -6
  59. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts.map +1 -1
  60. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js +0 -51
  61. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js.map +1 -1
  62. package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts +1 -0
  63. package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts.map +1 -1
  64. package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts +3 -4
  65. package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts.map +1 -1
  66. package/lib/families/bitcoin/wallet-btc/crypto/zec.js +26 -17
  67. package/lib/families/bitcoin/wallet-btc/crypto/zec.js.map +1 -1
  68. package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts +3 -4
  69. package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts.map +1 -1
  70. package/lib/families/bitcoin/wallet-btc/crypto/zen.js +33 -24
  71. package/lib/families/bitcoin/wallet-btc/crypto/zen.js.map +1 -1
  72. package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts.map +1 -1
  73. package/lib/families/bitcoin/wallet-btc/explorer/index.js +20 -0
  74. package/lib/families/bitcoin/wallet-btc/explorer/index.js.map +1 -1
  75. package/lib/families/bitcoin/wallet-btc/storage/types.d.ts +0 -1
  76. package/lib/families/bitcoin/wallet-btc/storage/types.d.ts.map +1 -1
  77. package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -1
  78. package/lib/families/celo/speculos-deviceActions.js +1 -2
  79. package/lib/families/celo/speculos-deviceActions.js.map +1 -1
  80. package/lib/families/ethereum/signOperation.d.ts.map +1 -1
  81. package/lib/families/ethereum/signOperation.js +26 -15
  82. package/lib/families/ethereum/signOperation.js.map +1 -1
  83. package/lib/families/ethereum/specs.d.ts.map +1 -1
  84. package/lib/families/ethereum/specs.js +2 -4
  85. package/lib/families/ethereum/specs.js.map +1 -1
  86. package/lib/families/ethereum/transaction.d.ts +4 -1
  87. package/lib/families/ethereum/transaction.d.ts.map +1 -1
  88. package/lib/families/ethereum/transaction.js +15 -27
  89. package/lib/families/ethereum/transaction.js.map +1 -1
  90. package/lib/families/solana/api/chain/instruction/token/types.d.ts +1 -1
  91. package/lib/families/solana/specs.js +1 -1
  92. package/lib/families/solana/specs.js.map +1 -1
  93. package/lib/families/tezos/bakers.whitelist-default.d.ts.map +1 -1
  94. package/lib/families/tezos/bakers.whitelist-default.js +1 -1
  95. package/lib/families/tezos/bakers.whitelist-default.js.map +1 -1
  96. package/lib/families/tezos/bridge/js.d.ts.map +1 -1
  97. package/lib/families/tezos/bridge/js.js +2 -1
  98. package/lib/families/tezos/bridge/js.js.map +1 -1
  99. package/lib/families/tezos/test-specifics.d.ts.map +1 -1
  100. package/lib/families/tezos/test-specifics.js +1 -0
  101. package/lib/families/tezos/test-specifics.js.map +1 -1
  102. package/lib/families/tron/synchronisation.test.js +1 -0
  103. package/lib/families/tron/synchronisation.test.js.map +1 -1
  104. package/lib/load/speculos.d.ts +7 -0
  105. package/lib/load/speculos.d.ts.map +1 -1
  106. package/lib/load/speculos.js +27 -11
  107. package/lib/load/speculos.js.map +1 -1
  108. package/package.json +21 -21
  109. package/src/__tests__/__snapshots__/all.libcore.ts.snap +0 -23
  110. package/src/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.ts +47 -0
  111. package/src/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.ts +0 -11
  112. package/src/api/Ethereum.ts +1 -0
  113. package/src/apps/logic.ts +6 -3
  114. package/src/apps/polyfill.ts +1 -0
  115. package/src/bot/engine.ts +3 -0
  116. package/src/errors.ts +3 -0
  117. package/src/exchange/platform/transfer/index.ts +21 -1
  118. package/src/families/algorand/buildTransaction.ts +4 -8
  119. package/src/families/algorand/js-getFeesForTransaction.ts +1 -1
  120. package/src/families/algorand/js-signOperation.ts +2 -2
  121. package/src/families/algorand/js-synchronization.ts +1 -0
  122. package/src/families/bitcoin/js-signOperation.ts +3 -5
  123. package/src/families/bitcoin/js-synchronisation.ts +4 -4
  124. package/src/families/bitcoin/wallet-btc/crypto/base.ts +31 -18
  125. package/src/families/bitcoin/wallet-btc/crypto/bitcoin.ts +3 -17
  126. package/src/families/bitcoin/wallet-btc/crypto/bitcoincash.ts +5 -39
  127. package/src/families/bitcoin/wallet-btc/crypto/decred.ts +2 -15
  128. package/src/families/bitcoin/wallet-btc/crypto/litecoin.ts +1 -71
  129. package/src/families/bitcoin/wallet-btc/crypto/types.ts +7 -0
  130. package/src/families/bitcoin/wallet-btc/crypto/zec.ts +4 -22
  131. package/src/families/bitcoin/wallet-btc/crypto/zen.ts +4 -22
  132. package/src/families/bitcoin/wallet-btc/explorer/index.ts +20 -0
  133. package/src/families/bitcoin/wallet-btc/storage/types.ts +0 -1
  134. package/src/families/celo/speculos-deviceActions.ts +0 -1
  135. package/src/families/ethereum/signOperation.ts +21 -20
  136. package/src/families/ethereum/specs.ts +0 -2
  137. package/src/families/ethereum/transaction.ts +10 -24
  138. package/src/families/solana/specs.ts +1 -1
  139. package/src/families/tezos/bakers.whitelist-default.ts +0 -2
  140. package/src/families/tezos/bridge/js.ts +6 -1
  141. package/src/families/tezos/test-specifics.ts +1 -0
  142. package/src/families/tron/synchronisation.test.ts +2 -0
  143. package/src/load/speculos.ts +23 -10
@@ -8,15 +8,15 @@ import bs58check from "bs58check";
8
8
  import coininfo from "coininfo";
9
9
  import { InvalidAddress } from "@ledgerhq/errors";
10
10
  import { DerivationModes } from "../types";
11
- import { ICrypto } from "./types";
12
11
  import Base from "./base";
13
12
 
14
- class Zen implements ICrypto {
13
+ class Zen extends Base {
15
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
15
  network: any;
17
16
 
18
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
18
  constructor({ network }: { network: any }) {
19
+ super({ network });
20
20
  // refer to https://github.com/HorizenOfficial/zen/blob/master/src/chainparams.cpp for the blockchain params
21
21
  this.network = network;
22
22
  this.network.versions = {
@@ -67,26 +67,13 @@ class Zen implements ICrypto {
67
67
  return this.baddrToTaddr(bs58check.encode(Buffer.from(baddr)));
68
68
  }
69
69
 
70
- getAddress(
70
+ customGetAddress(
71
71
  derivationMode: string,
72
72
  xpub: string,
73
73
  account: number,
74
74
  index: number
75
75
  ): string {
76
- if (
77
- Base.addressCache[
78
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
79
- ]
80
- ) {
81
- return Base.addressCache[
82
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
83
- ];
84
- }
85
- const address = this.getLegacyAddress(xpub, account, index);
86
- Base.addressCache[
87
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
88
- ] = address;
89
- return address;
76
+ return this.getLegacyAddress(xpub, account, index);
90
77
  }
91
78
 
92
79
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -122,11 +109,6 @@ class Zen implements ICrypto {
122
109
  (res[1] === 0x89 || res[1] === 0x96)
123
110
  );
124
111
  }
125
-
126
- // eslint-disable-next-line
127
- isTaprootAddress(address: string): boolean {
128
- return false;
129
- }
130
112
  }
131
113
 
132
114
  export default Zen;
@@ -239,6 +239,12 @@ class BitcoinLikeExplorer extends EventEmitter implements IExplorer {
239
239
  // @ts-ignore
240
240
  // eslint-disable-next-line no-param-reassign
241
241
  delete tx.confirmations;
242
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
243
+ // @ts-ignore
244
+ delete tx.id;
245
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
246
+ // @ts-ignore
247
+ delete tx.lock_time;
242
248
 
243
249
  // eslint-disable-next-line no-param-reassign
244
250
  tx.account = address.account;
@@ -246,7 +252,21 @@ class BitcoinLikeExplorer extends EventEmitter implements IExplorer {
246
252
  tx.index = address.index;
247
253
  // eslint-disable-next-line no-param-reassign
248
254
  tx.address = address.address;
255
+ tx.inputs.forEach((input) => {
256
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
257
+ // @ts-ignore
258
+ delete input.txinwitness;
259
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
260
+ // @ts-ignore
261
+ delete input.script_signature;
262
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
263
+ // @ts-ignore
264
+ delete input.input_index;
265
+ });
249
266
  tx.outputs.forEach((output) => {
267
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
268
+ // @ts-ignore
269
+ delete output.script_hex;
250
270
  // eslint-disable-next-line no-param-reassign
251
271
  output.output_hash = tx.hash;
252
272
  // eslint-disable-next-line no-param-reassign
@@ -24,7 +24,6 @@ export interface Output {
24
24
  address: string;
25
25
  output_hash: string;
26
26
  output_index: number;
27
- script_hex: string;
28
27
  block_height: number | null;
29
28
  // TODO Write tests for RBF unconfirmed outputs
30
29
  rbf: boolean;
@@ -34,7 +34,6 @@ const acceptTransaction: DeviceAction<Transaction, any> = deviceActionFlow({
34
34
  {
35
35
  title: "Max Fees",
36
36
  button: "Rr",
37
- expectedValue: () => "CELO",
38
37
  },
39
38
  {
40
39
  title: "No Gateway Fee",
@@ -2,6 +2,7 @@ import invariant from "invariant";
2
2
  import { Observable, from, of } from "rxjs";
3
3
  import { mergeMap } from "rxjs/operators";
4
4
  import eip55 from "eip55";
5
+ import { encode } from "rlp";
5
6
  import { BigNumber } from "bignumber.js";
6
7
  import { log } from "@ledgerhq/logs";
7
8
  import { FeeNotLoaded } from "@ledgerhq/errors";
@@ -17,6 +18,7 @@ import { modes } from "./modules";
17
18
  import { isNFTActive } from "../../nft";
18
19
  import { getEnv } from "../../env";
19
20
  import { LoadConfig } from "@ledgerhq/hw-app-eth/lib/services/types";
21
+ import { Transaction as EthereumTx } from "@ethereumjs/tx";
20
22
  export const signOperation = ({
21
23
  account,
22
24
  deviceId,
@@ -54,18 +56,16 @@ export const signOperation = ({
54
56
  throw new FeeNotLoaded();
55
57
  }
56
58
 
57
- const { tx, fillTransactionDataResult } = buildEthereumTx(
58
- account,
59
- transaction,
60
- nonce
61
- );
62
- const to = eip55.encode("0x" + tx.to.toString("hex"));
59
+ const { ethTxObject, tx, common, fillTransactionDataResult } =
60
+ buildEthereumTx(account, transaction, nonce);
61
+ const to = eip55.encode((tx.to || "").toString());
63
62
  const value = new BigNumber(
64
63
  "0x" + (tx.value.toString("hex") || "0")
65
64
  );
66
-
67
- const txHex = tx.serialize().toString("hex");
68
-
65
+ // rawData Format: `rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])`
66
+ const rawData = tx.raw();
67
+ rawData[6] = Buffer.from([common.chainIdBN().toNumber()]);
68
+ const txHex = Buffer.from(encode(rawData)).toString("hex");
69
69
  const loadConfig: LoadConfig = {};
70
70
  if (isNFTActive(account.currency)) {
71
71
  loadConfig.nftExplorerBaseURL =
@@ -106,26 +106,27 @@ export const signOperation = ({
106
106
  }
107
107
  }
108
108
 
109
- o.next({
110
- type: "device-signature-requested",
111
- });
109
+ o.next({ type: "device-signature-requested" });
112
110
  const result = await eth.signTransaction(
113
111
  freshAddressPath,
114
112
  txHex,
115
113
  resolution
116
114
  );
117
115
  if (cancelled) return;
118
- o.next({
119
- type: "device-signature-granted",
120
- });
116
+ o.next({ type: "device-signature-granted" });
121
117
  // Second, we re-set some tx fields from the device signature
122
- const v = result.v;
118
+ const v = `0x${result.v}`;
119
+ const r = `0x${result.r}`;
120
+ const s = `0x${result.s}`;
121
+
122
+ const signedTx = new EthereumTx(
123
+ { ...ethTxObject, v, r, s },
124
+ { common }
125
+ );
123
126
 
124
- tx.v = Buffer.from(v, "hex");
125
- tx.r = Buffer.from(result.r, "hex");
126
- tx.s = Buffer.from(result.s, "hex");
127
127
  // Generate the signature ready to be broadcasted
128
- const signature = `0x${tx.serialize().toString("hex")}`;
128
+ const signature = `0x${signedTx.serialize().toString("hex")}`;
129
+
129
130
  // build optimistic operation
130
131
  const txHash = ""; // resolved at broadcast time
131
132
 
@@ -118,7 +118,6 @@ const ethereum: AppSpec<Transaction> = {
118
118
  appQuery: {
119
119
  model: DeviceModelId.nanoS,
120
120
  appName: "Ethereum",
121
- appVersion: "1.5.0-rc3",
122
121
  },
123
122
  testTimeout: 4 * 60 * 1000,
124
123
  transactionCheck: ({ maxSpendable }) => {
@@ -380,7 +379,6 @@ const ethereumRopsten: AppSpec<Transaction> = {
380
379
  appQuery: {
381
380
  model: DeviceModelId.nanoS,
382
381
  appName: "Ethereum",
383
- appVersion: "1.5.0-rc3",
384
382
  },
385
383
  testTimeout: 2 * 60 * 1000,
386
384
  transactionCheck: ({ maxSpendable }) => {
@@ -6,8 +6,8 @@ import type {
6
6
  TransactionRaw,
7
7
  EthereumGasLimitRequest,
8
8
  } from "./types";
9
- import Common from "ethereumjs-common";
10
- import { Transaction as EthereumTx } from "ethereumjs-tx";
9
+ import Common from "@ethereumjs/common";
10
+ import { Transaction as EthereumTx } from "@ethereumjs/tx";
11
11
  import eip55 from "eip55";
12
12
  import {
13
13
  InvalidAddress,
@@ -196,23 +196,18 @@ function getEthereumjsTxCommon(currency) {
196
196
  `currency ${currency.id} did not set ethereumLikeInfo`
197
197
  );
198
198
  if (ethereumLikeInfo.chainId === 1) {
199
- return new Common(
200
- // $FlowFixMe
201
- ethereumLikeInfo.baseChain || "mainnet",
202
- // $FlowFixMe
203
- ethereumLikeInfo.hardfork || "petersburg"
204
- );
199
+ return new Common({
200
+ chain: ethereumLikeInfo.baseChain || "mainnet",
201
+ hardfork: ethereumLikeInfo.hardfork || "petersburg",
202
+ });
205
203
  }
206
204
  return Common.forCustomChain(
207
- // $FlowFixMe
208
205
  ethereumLikeInfo.baseChain || "mainnet",
209
206
  {
210
207
  name: currency.ticker,
211
208
  chainId: ethereumLikeInfo.chainId,
212
- // $FlowFixMe
213
209
  networkId: ethereumLikeInfo.networkId || ethereumLikeInfo.chainId,
214
210
  },
215
- // $FlowFixMe
216
211
  ethereumLikeInfo.hardfork || "petersburg"
217
212
  );
218
213
  }
@@ -239,8 +234,6 @@ export function buildEthereumTx(
239
234
  "only token accounts expected"
240
235
  );
241
236
  const common = getEthereumjsTxCommon(currency);
242
- invariant(common, `common not found for currency ${currency.name}`);
243
- // FIXME: make sure it doesn't break
244
237
  if (!common) {
245
238
  throw new Error(`common not found for currency ${currency.name}`);
246
239
  }
@@ -258,18 +251,11 @@ export function buildEthereumTx(
258
251
  ethTxObject
259
252
  );
260
253
  log("ethereum", "buildEthereumTx", ethTxObject);
261
- const tx = new EthereumTx(ethTxObject, {
262
- common,
263
- });
264
- // these will be filled by device signature
265
- tx.raw[6] = Buffer.from([common.chainId()]); // v
266
-
267
- tx.raw[7] = Buffer.from([]); // r
268
-
269
- tx.raw[8] = Buffer.from([]); // s
270
-
254
+ const tx = new EthereumTx(ethTxObject, { common });
271
255
  return {
272
256
  tx,
257
+ common,
258
+ ethTxObject,
273
259
  fillTransactionDataResult,
274
260
  };
275
261
  }
@@ -294,7 +280,7 @@ export function inferEthereumGasLimitRequest(
294
280
  }
295
281
 
296
282
  if (to) {
297
- r.to = "0x" + to.toString("hex");
283
+ r.to = to.toString();
298
284
  }
299
285
 
300
286
  if (data) {
@@ -12,7 +12,7 @@ const solana: AppSpec<Transaction> = {
12
12
  name: "Solana",
13
13
  appQuery: {
14
14
  model: DeviceModelId.nanoS,
15
- firmware: "<2",
15
+ firmware: "2",
16
16
  appName: "solana",
17
17
  },
18
18
  currency: getCryptoCurrencyById("solana"),
@@ -17,8 +17,6 @@ tz1RCFbB9GpALpsZtu6J58sb74dm8qe6XBzv
17
17
  tz1dbfppLAAxXZNtf2SDps7rch3qfUznKSoK
18
18
  tz1Q8QkSBS63ZQnH3fBTiAMPes9R666Rn6Sc
19
19
  tz2FCNBrERXtaTtNX6iimR1UJ5JSDxvdHM93
20
- tz1Vyuu4EJ5Nym4JcrfRLnp3hpaq1DSEp1Ke
21
- tz1S1Aew75hMrPUymqenKfHo8FspppXKpW7h
22
20
  tz1SohptP53wDPZhzTWzDUFAUcWF6DMBpaJV
23
21
  tz1P2Po7YM526ughEsRbY4oR9zaUPDZjxFrb
24
22
  tz1KzSC1J9aBxKp7u8TUnpN8L7S65PBRkgdF
@@ -1,6 +1,10 @@
1
1
  // @flow
2
2
  import { BigNumber } from "bignumber.js";
3
- import { TezosToolkit, DEFAULT_FEE } from "@taquito/taquito";
3
+ import {
4
+ TezosToolkit,
5
+ DEFAULT_FEE,
6
+ DEFAULT_STORAGE_LIMIT,
7
+ } from "@taquito/taquito";
4
8
  import {
5
9
  AmountRequired,
6
10
  NotEnoughBalance,
@@ -201,6 +205,7 @@ const prepareTransaction = async (
201
205
  mutez: true,
202
206
  to: transaction.recipient,
203
207
  amount: amount.toNumber(),
208
+ storageLimit: DEFAULT_STORAGE_LIMIT.ORIGINATION, // https://github.com/TezTech/eztz/blob/master/PROTO_003_FEES.md for originating an account
204
209
  });
205
210
  break;
206
211
  case "delegate":
@@ -4,6 +4,7 @@ import { loadAccountDelegation, listBakers } from "./bakers";
4
4
  import whitelist from "./bakers.whitelist-default";
5
5
  export default () => {
6
6
  describe("tezos bakers", () => {
7
+ // FIXME Flaky test that will fail every time a Tezos baker is discontinued
7
8
  test("getting the bakers", async () => {
8
9
  const list = await listBakers(whitelist);
9
10
  expect(list.map((o) => o.address)).toEqual(whitelist);
@@ -6,6 +6,8 @@ import { defaultTronResources } from "./utils";
6
6
  import bridge from "./bridge/js";
7
7
  import { Account } from "../../types";
8
8
 
9
+ jest.setTimeout(30000);
10
+
9
11
  const tron = getCryptoCurrencyById("tron");
10
12
  const defaultSyncConfig = {
11
13
  paginationConfig: {},
@@ -412,7 +412,13 @@ function parseAppSearch(query: string):
412
412
  };
413
413
  }
414
414
 
415
- async function openImplicitSpeculos(query: string) {
415
+ export async function createImplicitSpeculos(query: string): Promise<{
416
+ device: {
417
+ transport: SpeculosTransport;
418
+ id: string;
419
+ };
420
+ appCandidate: AppCandidate;
421
+ } | null> {
416
422
  const coinapps = getEnv("COINAPPS");
417
423
  invariant(coinapps, "COINAPPS folder is missing!");
418
424
  const seed = getEnv("SEED");
@@ -438,16 +444,23 @@ async function openImplicitSpeculos(query: string) {
438
444
  "speculos",
439
445
  "using app " + formatAppCandidate(appCandidate as AppCandidate)
440
446
  );
441
- const device = appCandidate
442
- ? await createSpeculosDevice({
443
- ...appCandidate,
444
- coinapps,
445
- appName,
446
- dependency,
447
- seed,
448
- })
447
+ return appCandidate
448
+ ? {
449
+ device: await createSpeculosDevice({
450
+ ...appCandidate,
451
+ coinapps,
452
+ appName,
453
+ dependency,
454
+ seed,
455
+ }),
456
+ appCandidate,
457
+ }
449
458
  : null;
450
- return device?.transport;
459
+ }
460
+
461
+ async function openImplicitSpeculos(query: string) {
462
+ const r = await createImplicitSpeculos(query);
463
+ return r?.device.transport;
451
464
  }
452
465
 
453
466
  registerTransportModule({