@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.
- package/lib/exchange/swap/api/v5/fetchRates.d.ts.map +1 -1
- package/lib/exchange/swap/api/v5/fetchRates.js +2 -1
- package/lib/exchange/swap/api/v5/fetchRates.js.map +1 -1
- package/lib/exchange/swap/const/blockchain.d.ts +2 -0
- package/lib/exchange/swap/const/blockchain.d.ts.map +1 -0
- package/lib/exchange/swap/const/blockchain.js +5 -0
- package/lib/exchange/swap/const/blockchain.js.map +1 -0
- package/lib/exchange/swap/const/timeout.d.ts +4 -0
- package/lib/exchange/swap/const/timeout.d.ts.map +1 -1
- package/lib/exchange/swap/const/timeout.js +5 -1
- package/lib/exchange/swap/const/timeout.js.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts +10 -8
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/useSwapTransaction.js +4 -2
- package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib/exchange/swap/hooks/v5/useProviderRates.d.ts +3 -1
- package/lib/exchange/swap/hooks/v5/useProviderRates.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/v5/useProviderRates.js +18 -6
- package/lib/exchange/swap/hooks/v5/useProviderRates.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +1 -1
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/families/solana/js-preload.d.ts.map +1 -1
- package/lib/families/solana/js-preload.js +2 -1
- package/lib/families/solana/js-preload.js.map +1 -1
- package/lib/families/solana/js-preload.test.d.ts +2 -0
- package/lib/families/solana/js-preload.test.d.ts.map +1 -0
- package/lib/families/solana/js-preload.test.js +9 -0
- package/lib/families/solana/js-preload.test.js.map +1 -0
- package/lib/families/stellar/api/horizon.d.ts +7 -7
- package/lib/families/stellar/api/horizon.d.ts.map +1 -1
- package/lib/families/stellar/api/horizon.js +9 -22
- package/lib/families/stellar/api/horizon.js.map +1 -1
- package/lib/families/stellar/bridge.integration.test.js +2 -2
- package/lib/families/stellar/js-buildTransaction.d.ts +2 -2
- package/lib/families/stellar/js-buildTransaction.d.ts.map +1 -1
- package/lib/families/stellar/js-buildTransaction.js +1 -1
- package/lib/families/stellar/js-buildTransaction.js.map +1 -1
- package/lib/families/stellar/js-signOperation.js +1 -1
- package/lib/families/stellar/js-signOperation.js.map +1 -1
- package/lib/families/stellar/logic.d.ts +3 -3
- package/lib/families/stellar/logic.d.ts.map +1 -1
- package/lib/families/stellar/logic.js +2 -2
- package/lib/families/stellar/logic.js.map +1 -1
- package/lib/families/stellar/types.d.ts +2 -2
- package/lib/families/stellar/types.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchRates.d.ts.map +1 -1
- package/lib-es/exchange/swap/api/v5/fetchRates.js +2 -1
- package/lib-es/exchange/swap/api/v5/fetchRates.js.map +1 -1
- package/lib-es/exchange/swap/const/blockchain.d.ts +2 -0
- package/lib-es/exchange/swap/const/blockchain.d.ts.map +1 -0
- package/lib-es/exchange/swap/const/blockchain.js +2 -0
- package/lib-es/exchange/swap/const/blockchain.js.map +1 -0
- package/lib-es/exchange/swap/const/timeout.d.ts +4 -0
- package/lib-es/exchange/swap/const/timeout.d.ts.map +1 -1
- package/lib-es/exchange/swap/const/timeout.js +4 -0
- package/lib-es/exchange/swap/const/timeout.js.map +1 -1
- package/lib-es/exchange/swap/hooks/useSwapTransaction.d.ts +10 -8
- package/lib-es/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/useSwapTransaction.js +4 -2
- package/lib-es/exchange/swap/hooks/useSwapTransaction.js.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useProviderRates.d.ts +3 -1
- package/lib-es/exchange/swap/hooks/v5/useProviderRates.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/v5/useProviderRates.js +18 -6
- package/lib-es/exchange/swap/hooks/v5/useProviderRates.js.map +1 -1
- package/lib-es/exchange/swap/types.d.ts +1 -1
- package/lib-es/exchange/swap/types.d.ts.map +1 -1
- package/lib-es/families/solana/js-preload.d.ts.map +1 -1
- package/lib-es/families/solana/js-preload.js +2 -1
- package/lib-es/families/solana/js-preload.js.map +1 -1
- package/lib-es/families/solana/js-preload.test.d.ts +2 -0
- package/lib-es/families/solana/js-preload.test.d.ts.map +1 -0
- package/lib-es/families/solana/js-preload.test.js +7 -0
- package/lib-es/families/solana/js-preload.test.js.map +1 -0
- package/lib-es/families/stellar/api/horizon.d.ts +7 -7
- package/lib-es/families/stellar/api/horizon.d.ts.map +1 -1
- package/lib-es/families/stellar/api/horizon.js +9 -22
- package/lib-es/families/stellar/api/horizon.js.map +1 -1
- package/lib-es/families/stellar/bridge.integration.test.js +2 -2
- package/lib-es/families/stellar/js-buildTransaction.d.ts +2 -2
- package/lib-es/families/stellar/js-buildTransaction.d.ts.map +1 -1
- package/lib-es/families/stellar/js-buildTransaction.js +1 -1
- package/lib-es/families/stellar/js-buildTransaction.js.map +1 -1
- package/lib-es/families/stellar/js-signOperation.js +1 -1
- package/lib-es/families/stellar/js-signOperation.js.map +1 -1
- package/lib-es/families/stellar/logic.d.ts +3 -3
- package/lib-es/families/stellar/logic.d.ts.map +1 -1
- package/lib-es/families/stellar/logic.js +2 -2
- package/lib-es/families/stellar/logic.js.map +1 -1
- package/lib-es/families/stellar/types.d.ts +2 -2
- package/lib-es/families/stellar/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +0 -1
- package/src/exchange/swap/api/v5/fetchRates.ts +5 -2
- package/src/exchange/swap/const/blockchain.ts +1 -0
- package/src/exchange/swap/const/timeout.ts +5 -0
- package/src/exchange/swap/hooks/useSwapTransaction.ts +18 -12
- package/src/exchange/swap/hooks/v5/useProviderRates.ts +7 -3
- package/src/exchange/swap/types.ts +1 -1
- package/src/families/solana/js-preload.test.ts +14 -0
- package/src/families/solana/js-preload.ts +2 -1
- package/src/families/stellar/api/horizon.ts +13 -27
- package/src/families/stellar/bridge.integration.test.ts +2 -2
- package/src/families/stellar/js-buildTransaction.ts +1 -1
- package/src/families/stellar/js-signOperation.ts +1 -1
- package/src/families/stellar/logic.ts +6 -6
- 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 "
|
|
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
|
|
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 {
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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:
|
|
204
|
+
transaction: ServerApi.TransactionRecord,
|
|
205
205
|
type: OperationType,
|
|
206
206
|
): BigNumber => {
|
|
207
207
|
let value = new BigNumber(0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 =
|
|
76
|
+
export type RawOperation = ServerApi.OperationRecord & {
|
|
77
77
|
asset_code?: string;
|
|
78
78
|
asset_issuer?: string;
|
|
79
79
|
from?: string;
|