@ledgerhq/live-common 34.0.0-next.1 → 34.0.0-next.10

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 (106) hide show
  1. package/lib/exchange/swap/api/v5/fetchRates.d.ts.map +1 -1
  2. package/lib/exchange/swap/api/v5/fetchRates.js +2 -1
  3. package/lib/exchange/swap/api/v5/fetchRates.js.map +1 -1
  4. package/lib/exchange/swap/const/blockchain.d.ts +2 -0
  5. package/lib/exchange/swap/const/blockchain.d.ts.map +1 -0
  6. package/lib/exchange/swap/const/blockchain.js +5 -0
  7. package/lib/exchange/swap/const/blockchain.js.map +1 -0
  8. package/lib/exchange/swap/const/timeout.d.ts +4 -0
  9. package/lib/exchange/swap/const/timeout.d.ts.map +1 -1
  10. package/lib/exchange/swap/const/timeout.js +5 -1
  11. package/lib/exchange/swap/const/timeout.js.map +1 -1
  12. package/lib/exchange/swap/hooks/useSwapTransaction.d.ts +10 -8
  13. package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
  14. package/lib/exchange/swap/hooks/useSwapTransaction.js +4 -2
  15. package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
  16. package/lib/exchange/swap/hooks/v5/useProviderRates.d.ts +3 -1
  17. package/lib/exchange/swap/hooks/v5/useProviderRates.d.ts.map +1 -1
  18. package/lib/exchange/swap/hooks/v5/useProviderRates.js +18 -6
  19. package/lib/exchange/swap/hooks/v5/useProviderRates.js.map +1 -1
  20. package/lib/exchange/swap/types.d.ts +1 -1
  21. package/lib/exchange/swap/types.d.ts.map +1 -1
  22. package/lib/families/solana/js-preload.d.ts.map +1 -1
  23. package/lib/families/solana/js-preload.js +2 -1
  24. package/lib/families/solana/js-preload.js.map +1 -1
  25. package/lib/families/solana/js-preload.test.d.ts +2 -0
  26. package/lib/families/solana/js-preload.test.d.ts.map +1 -0
  27. package/lib/families/solana/js-preload.test.js +9 -0
  28. package/lib/families/solana/js-preload.test.js.map +1 -0
  29. package/lib/families/stellar/api/horizon.d.ts +7 -7
  30. package/lib/families/stellar/api/horizon.d.ts.map +1 -1
  31. package/lib/families/stellar/api/horizon.js +9 -22
  32. package/lib/families/stellar/api/horizon.js.map +1 -1
  33. package/lib/families/stellar/bridge.integration.test.js +2 -2
  34. package/lib/families/stellar/js-buildTransaction.d.ts +2 -2
  35. package/lib/families/stellar/js-buildTransaction.d.ts.map +1 -1
  36. package/lib/families/stellar/js-buildTransaction.js +1 -1
  37. package/lib/families/stellar/js-buildTransaction.js.map +1 -1
  38. package/lib/families/stellar/js-signOperation.js +1 -1
  39. package/lib/families/stellar/js-signOperation.js.map +1 -1
  40. package/lib/families/stellar/logic.d.ts +3 -3
  41. package/lib/families/stellar/logic.d.ts.map +1 -1
  42. package/lib/families/stellar/logic.js +2 -2
  43. package/lib/families/stellar/logic.js.map +1 -1
  44. package/lib/families/stellar/types.d.ts +2 -2
  45. package/lib/families/stellar/types.d.ts.map +1 -1
  46. package/lib-es/exchange/swap/api/v5/fetchRates.d.ts.map +1 -1
  47. package/lib-es/exchange/swap/api/v5/fetchRates.js +2 -1
  48. package/lib-es/exchange/swap/api/v5/fetchRates.js.map +1 -1
  49. package/lib-es/exchange/swap/const/blockchain.d.ts +2 -0
  50. package/lib-es/exchange/swap/const/blockchain.d.ts.map +1 -0
  51. package/lib-es/exchange/swap/const/blockchain.js +2 -0
  52. package/lib-es/exchange/swap/const/blockchain.js.map +1 -0
  53. package/lib-es/exchange/swap/const/timeout.d.ts +4 -0
  54. package/lib-es/exchange/swap/const/timeout.d.ts.map +1 -1
  55. package/lib-es/exchange/swap/const/timeout.js +4 -0
  56. package/lib-es/exchange/swap/const/timeout.js.map +1 -1
  57. package/lib-es/exchange/swap/hooks/useSwapTransaction.d.ts +10 -8
  58. package/lib-es/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
  59. package/lib-es/exchange/swap/hooks/useSwapTransaction.js +4 -2
  60. package/lib-es/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
  61. package/lib-es/exchange/swap/hooks/v5/useProviderRates.d.ts +3 -1
  62. package/lib-es/exchange/swap/hooks/v5/useProviderRates.d.ts.map +1 -1
  63. package/lib-es/exchange/swap/hooks/v5/useProviderRates.js +18 -6
  64. package/lib-es/exchange/swap/hooks/v5/useProviderRates.js.map +1 -1
  65. package/lib-es/exchange/swap/types.d.ts +1 -1
  66. package/lib-es/exchange/swap/types.d.ts.map +1 -1
  67. package/lib-es/families/solana/js-preload.d.ts.map +1 -1
  68. package/lib-es/families/solana/js-preload.js +2 -1
  69. package/lib-es/families/solana/js-preload.js.map +1 -1
  70. package/lib-es/families/solana/js-preload.test.d.ts +2 -0
  71. package/lib-es/families/solana/js-preload.test.d.ts.map +1 -0
  72. package/lib-es/families/solana/js-preload.test.js +7 -0
  73. package/lib-es/families/solana/js-preload.test.js.map +1 -0
  74. package/lib-es/families/stellar/api/horizon.d.ts +7 -7
  75. package/lib-es/families/stellar/api/horizon.d.ts.map +1 -1
  76. package/lib-es/families/stellar/api/horizon.js +9 -22
  77. package/lib-es/families/stellar/api/horizon.js.map +1 -1
  78. package/lib-es/families/stellar/bridge.integration.test.js +2 -2
  79. package/lib-es/families/stellar/js-buildTransaction.d.ts +2 -2
  80. package/lib-es/families/stellar/js-buildTransaction.d.ts.map +1 -1
  81. package/lib-es/families/stellar/js-buildTransaction.js +1 -1
  82. package/lib-es/families/stellar/js-buildTransaction.js.map +1 -1
  83. package/lib-es/families/stellar/js-signOperation.js +1 -1
  84. package/lib-es/families/stellar/js-signOperation.js.map +1 -1
  85. package/lib-es/families/stellar/logic.d.ts +3 -3
  86. package/lib-es/families/stellar/logic.d.ts.map +1 -1
  87. package/lib-es/families/stellar/logic.js +2 -2
  88. package/lib-es/families/stellar/logic.js.map +1 -1
  89. package/lib-es/families/stellar/types.d.ts +2 -2
  90. package/lib-es/families/stellar/types.d.ts.map +1 -1
  91. package/package.json +4 -4
  92. package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +0 -1
  93. package/src/exchange/swap/api/v5/fetchRates.ts +5 -2
  94. package/src/exchange/swap/const/blockchain.ts +1 -0
  95. package/src/exchange/swap/const/timeout.ts +5 -0
  96. package/src/exchange/swap/hooks/useSwapTransaction.ts +18 -12
  97. package/src/exchange/swap/hooks/v5/useProviderRates.ts +7 -3
  98. package/src/exchange/swap/types.ts +1 -1
  99. package/src/families/solana/js-preload.test.ts +14 -0
  100. package/src/families/solana/js-preload.ts +2 -1
  101. package/src/families/stellar/api/horizon.ts +13 -27
  102. package/src/families/stellar/bridge.integration.test.ts +2 -2
  103. package/src/families/stellar/js-buildTransaction.ts +1 -1
  104. package/src/families/stellar/js-signOperation.ts +1 -1
  105. package/src/families/stellar/logic.ts +6 -6
  106. package/src/families/stellar/types.ts +2 -2
@@ -1,5 +1,5 @@
1
1
  import invariant from "invariant";
2
- import { Memo, Operation as StellarSdkOperation, xdr } from "@stellar/stellar-sdk";
2
+ import { Memo, Operation as StellarSdkOperation, xdr } from "stellar-sdk";
3
3
  import { AmountRequired, FeeNotLoaded, NetworkDown } from "@ledgerhq/errors";
4
4
  import type { Account } from "@ledgerhq/types-live";
5
5
  import type { Transaction } from "./types";
@@ -86,7 +86,7 @@ const signOperation: SignOperationFnSignature<Transaction> = ({ account, deviceI
86
86
  }
87
87
 
88
88
  const unsigned = await buildTransaction(account, transaction);
89
- const unsignedPayload: Buffer = Buffer.from(unsigned.signatureBase());
89
+ const unsignedPayload = unsigned.signatureBase();
90
90
  // Sign by device
91
91
  const hwApp = new Stellar(transport);
92
92
  const { signature } = await hwApp.signTransaction(
@@ -2,7 +2,7 @@ import type { CacheRes } from "@ledgerhq/live-network/cache";
2
2
  import { makeLRUCache } from "@ledgerhq/live-network/cache";
3
3
  import type { Account, OperationType, TokenAccount } from "@ledgerhq/types-live";
4
4
  import { BigNumber } from "bignumber.js";
5
- import { Horizon, StrKey, MuxedAccount } from "@stellar/stellar-sdk";
5
+ import { ServerApi, StrKey, MuxedAccount } from "stellar-sdk";
6
6
  import { findSubAccountById } from "../../account";
7
7
  import { getCryptoCurrencyById, parseCurrencyUnit } from "../../currencies";
8
8
  import { encodeOperationId } from "../../operation";
@@ -25,13 +25,13 @@ export const STELLAR_BURN_ADDRESS = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
25
25
 
26
26
  const currency = getCryptoCurrencyById("stellar");
27
27
 
28
- const getMinimumBalance = (account: Horizon.ServerApi.AccountRecord): BigNumber => {
28
+ const getMinimumBalance = (account: ServerApi.AccountRecord): BigNumber => {
29
29
  return parseCurrencyUnit(currency.units[0], getReservedBalance(account).toString());
30
30
  };
31
31
 
32
32
  export const getAccountSpendableBalance = async (
33
33
  balance: BigNumber,
34
- account: Horizon.ServerApi.AccountRecord,
34
+ account: ServerApi.AccountRecord,
35
35
  ): Promise<BigNumber> => {
36
36
  const minimumBalance = getMinimumBalance(account);
37
37
  const { recommendedFee } = await fetchBaseFee();
@@ -69,14 +69,14 @@ export const getBalanceId = (balance: BalanceAsset): string | null => {
69
69
  }
70
70
  };
71
71
 
72
- export const getReservedBalance = (account: Horizon.ServerApi.AccountRecord): BigNumber => {
72
+ export const getReservedBalance = (account: ServerApi.AccountRecord): BigNumber => {
73
73
  const numOfSponsoringEntries = Number(account.num_sponsoring);
74
74
  const numOfSponsoredEntries = Number(account.num_sponsored);
75
75
 
76
76
  const nativeAsset = account.balances?.find(b => b.asset_type === "native") as BalanceAsset;
77
77
 
78
78
  const amountInOffers = new BigNumber(nativeAsset?.selling_liabilities || 0);
79
- const numOfEntries = new BigNumber(account.subentry_count || 0);
79
+ const numOfEntries = new BigNumber(account.subentry_count);
80
80
 
81
81
  return new BigNumber(BASE_RESERVE_MIN_COUNT)
82
82
  .plus(numOfEntries)
@@ -201,7 +201,7 @@ export const formatOperation = async (
201
201
 
202
202
  const getValue = (
203
203
  operation: RawOperation,
204
- transaction: Horizon.ServerApi.TransactionRecord,
204
+ transaction: ServerApi.TransactionRecord,
205
205
  type: OperationType,
206
206
  ): BigNumber => {
207
207
  let value = new BigNumber(0);
@@ -1,4 +1,4 @@
1
- import { Horizon } from "@stellar/stellar-sdk";
1
+ import { ServerApi } from "stellar-sdk";
2
2
  import type { BigNumber } from "bignumber.js";
3
3
  import type {
4
4
  Operation,
@@ -73,7 +73,7 @@ export type BalanceAsset = {
73
73
  liquidity_pool_id?: string;
74
74
  };
75
75
 
76
- export type RawOperation = Horizon.ServerApi.OperationRecord & {
76
+ export type RawOperation = ServerApi.OperationRecord & {
77
77
  asset_code?: string;
78
78
  asset_issuer?: string;
79
79
  from?: string;