@ledgerhq/live-common 34.46.0-nightly.3 → 34.46.0-nightly.5
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/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +6 -4
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +2 -2
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +12 -12
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +3 -4
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +1 -1
- package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts +0 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +0 -1
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/currencies/index.d.ts +1 -1
- package/lib/currencies/index.d.ts.map +1 -1
- package/lib/currencies/index.js +1 -2
- package/lib/currencies/index.js.map +1 -1
- package/lib/currencies/sortByMarketcap.test.js +2 -1
- package/lib/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib/domain/getTokensWithFunds.test.js +1 -1
- package/lib/domain/getTokensWithFunds.test.js.map +1 -1
- package/lib/e2e/enum/AppInfos.d.ts +1 -1
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/Provider.d.ts.map +1 -1
- package/lib/e2e/enum/Provider.js +2 -2
- package/lib/e2e/enum/Provider.js.map +1 -1
- package/lib/e2e/index.d.ts +3 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +3 -4
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/e2e/speculosCI.d.ts +4 -0
- package/lib/e2e/speculosCI.d.ts.map +1 -1
- package/lib/e2e/speculosCI.js +16 -6
- package/lib/e2e/speculosCI.js.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/families/evm/setup.d.ts.map +1 -1
- package/lib/families/evm/setup.js +9 -0
- package/lib/families/evm/setup.js.map +1 -1
- package/lib/families/hedera/constants.d.ts +2 -0
- package/lib/families/hedera/constants.d.ts.map +1 -0
- package/lib/families/hedera/constants.js +19 -0
- package/lib/families/hedera/constants.js.map +1 -0
- package/lib/families/hedera/setup.d.ts +5 -5
- package/lib/families/hedera/setup.d.ts.map +1 -1
- package/lib/families/hedera/setup.js.map +1 -1
- package/lib/families/solana/setup.d.ts.map +1 -1
- package/lib/families/solana/setup.js +2 -1
- package/lib/families/solana/setup.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/bridge/js.d.ts +1 -1
- package/lib/market/utils/countervalueFormatter.d.ts.map +1 -1
- package/lib/market/utils/countervalueFormatter.js.map +1 -1
- package/lib/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -1
- package/lib/modularDrawer/__mocks__/currencies.mock.js +7 -7
- package/lib/modularDrawer/__mocks__/currencies.mock.js.map +1 -1
- package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +1 -1
- package/lib/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -1
- package/lib/modularDrawer/data/entities/index.d.ts +68 -0
- package/lib/modularDrawer/data/entities/index.d.ts.map +1 -0
- package/lib/modularDrawer/data/entities/index.js +3 -0
- package/lib/modularDrawer/data/entities/index.js.map +1 -0
- package/lib/modularDrawer/data/state-manager/api.d.ts +152 -0
- package/lib/modularDrawer/data/state-manager/api.d.ts.map +1 -0
- package/lib/modularDrawer/data/state-manager/api.js +45 -0
- package/lib/modularDrawer/data/state-manager/api.js.map +1 -0
- package/lib/modularDrawer/hooks/__test__/useAssetsData.test.d.ts +5 -0
- package/lib/modularDrawer/hooks/__test__/useAssetsData.test.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/__test__/useAssetsData.test.js +120 -0
- package/lib/modularDrawer/hooks/__test__/useAssetsData.test.js.map +1 -0
- package/lib/modularDrawer/hooks/useAssetsData.d.ts +13 -0
- package/lib/modularDrawer/hooks/useAssetsData.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useAssetsData.js +31 -0
- package/lib/modularDrawer/hooks/useAssetsData.js.map +1 -0
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +2 -0
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +1 -0
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js +496 -0
- package/lib/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +1 -0
- package/lib/modularDrawer/utils/__tests__/currencyUtils.test.js +1 -1
- package/lib/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +1 -1
- package/lib/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +1 -1
- package/lib/modularDrawer/utils/calculateProviderTotal.d.ts +9 -0
- package/lib/modularDrawer/utils/calculateProviderTotal.d.ts.map +1 -0
- package/lib/modularDrawer/utils/calculateProviderTotal.js +23 -0
- package/lib/modularDrawer/utils/calculateProviderTotal.js.map +1 -0
- package/lib/modularDrawer/utils/counterValueFormatter.d.ts +14 -0
- package/lib/modularDrawer/utils/counterValueFormatter.d.ts.map +1 -0
- package/lib/modularDrawer/utils/counterValueFormatter.js +107 -0
- package/lib/modularDrawer/utils/counterValueFormatter.js.map +1 -0
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +11 -0
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -0
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +45 -0
- package/lib/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -0
- package/lib/modularDrawer/utils/getProviderCurrency.d.ts +3 -0
- package/lib/modularDrawer/utils/getProviderCurrency.d.ts.map +1 -0
- package/lib/modularDrawer/utils/getProviderCurrency.js +14 -0
- package/lib/modularDrawer/utils/getProviderCurrency.js.map +1 -0
- package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts +11 -0
- package/lib/modularDrawer/utils/groupAccountsByAsset.d.ts.map +1 -0
- package/lib/modularDrawer/utils/groupAccountsByAsset.js +32 -0
- package/lib/modularDrawer/utils/groupAccountsByAsset.js.map +1 -0
- package/lib/modularDrawer/utils/parseToBigNumber.d.ts +9 -0
- package/lib/modularDrawer/utils/parseToBigNumber.d.ts.map +1 -0
- package/lib/modularDrawer/utils/parseToBigNumber.js +24 -0
- package/lib/modularDrawer/utils/parseToBigNumber.js.map +1 -0
- package/lib/modularDrawer/utils/type.d.ts +21 -0
- package/lib/modularDrawer/utils/type.d.ts.map +1 -0
- package/lib/modularDrawer/utils/type.js +3 -0
- package/lib/modularDrawer/utils/type.js.map +1 -0
- package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js +1 -1
- package/lib/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +6 -4
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +2 -2
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +12 -12
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +3 -4
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +1 -1
- package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts +0 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +0 -1
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/currencies/index.d.ts +1 -1
- package/lib-es/currencies/index.d.ts.map +1 -1
- package/lib-es/currencies/index.js +1 -1
- package/lib-es/currencies/index.js.map +1 -1
- package/lib-es/currencies/sortByMarketcap.test.js +2 -1
- package/lib-es/currencies/sortByMarketcap.test.js.map +1 -1
- package/lib-es/domain/getTokensWithFunds.test.js +1 -1
- package/lib-es/domain/getTokensWithFunds.test.js.map +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -1
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/Provider.d.ts.map +1 -1
- package/lib-es/e2e/enum/Provider.js +2 -2
- package/lib-es/e2e/enum/Provider.js.map +1 -1
- package/lib-es/e2e/index.d.ts +3 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +3 -4
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/e2e/speculosCI.d.ts +4 -0
- package/lib-es/e2e/speculosCI.d.ts.map +1 -1
- package/lib-es/e2e/speculosCI.js +14 -5
- package/lib-es/e2e/speculosCI.js.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/families/evm/setup.d.ts.map +1 -1
- package/lib-es/families/evm/setup.js +9 -0
- package/lib-es/families/evm/setup.js.map +1 -1
- package/lib-es/families/hedera/constants.d.ts +2 -0
- package/lib-es/families/hedera/constants.d.ts.map +1 -0
- package/lib-es/families/hedera/constants.js +3 -0
- package/lib-es/families/hedera/constants.js.map +1 -0
- package/lib-es/families/hedera/setup.d.ts +5 -5
- package/lib-es/families/hedera/setup.d.ts.map +1 -1
- package/lib-es/families/hedera/setup.js.map +1 -1
- package/lib-es/families/solana/setup.d.ts.map +1 -1
- package/lib-es/families/solana/setup.js +2 -1
- package/lib-es/families/solana/setup.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -0
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.d.ts +1 -1
- package/lib-es/market/utils/countervalueFormatter.d.ts.map +1 -1
- package/lib-es/market/utils/countervalueFormatter.js.map +1 -1
- package/lib-es/modularDrawer/__mocks__/currencies.mock.d.ts.map +1 -1
- package/lib-es/modularDrawer/__mocks__/currencies.mock.js +1 -1
- package/lib-es/modularDrawer/__mocks__/currencies.mock.js.map +1 -1
- package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js +1 -1
- package/lib-es/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.js.map +1 -1
- package/lib-es/modularDrawer/data/entities/index.d.ts +68 -0
- package/lib-es/modularDrawer/data/entities/index.d.ts.map +1 -0
- package/lib-es/modularDrawer/data/entities/index.js +2 -0
- package/lib-es/modularDrawer/data/entities/index.js.map +1 -0
- package/lib-es/modularDrawer/data/state-manager/api.d.ts +152 -0
- package/lib-es/modularDrawer/data/state-manager/api.d.ts.map +1 -0
- package/lib-es/modularDrawer/data/state-manager/api.js +42 -0
- package/lib-es/modularDrawer/data/state-manager/api.js.map +1 -0
- package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.d.ts +5 -0
- package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.js +118 -0
- package/lib-es/modularDrawer/hooks/__test__/useAssetsData.test.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts +13 -0
- package/lib-es/modularDrawer/hooks/useAssetsData.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useAssetsData.js +27 -0
- package/lib-es/modularDrawer/hooks/useAssetsData.js.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts +2 -0
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js +494 -0
- package/lib-es/modularDrawer/utils/__tests__/counterValueFormatter.test.js.map +1 -0
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js +1 -1
- package/lib-es/modularDrawer/utils/__tests__/currencyUtils.test.js.map +1 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js +1 -1
- package/lib-es/modularDrawer/utils/__tests__/haveOneCommonProvider.test.js.map +1 -1
- package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts +9 -0
- package/lib-es/modularDrawer/utils/calculateProviderTotal.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/calculateProviderTotal.js +16 -0
- package/lib-es/modularDrawer/utils/calculateProviderTotal.js.map +1 -0
- package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts +14 -0
- package/lib-es/modularDrawer/utils/counterValueFormatter.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/counterValueFormatter.js +103 -0
- package/lib-es/modularDrawer/utils/counterValueFormatter.js.map +1 -0
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts +11 -0
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js +41 -0
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValueByAssets.js.map +1 -0
- package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts +3 -0
- package/lib-es/modularDrawer/utils/getProviderCurrency.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/getProviderCurrency.js +10 -0
- package/lib-es/modularDrawer/utils/getProviderCurrency.js.map +1 -0
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts +11 -0
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.js +25 -0
- package/lib-es/modularDrawer/utils/groupAccountsByAsset.js.map +1 -0
- package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts +9 -0
- package/lib-es/modularDrawer/utils/parseToBigNumber.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/parseToBigNumber.js +17 -0
- package/lib-es/modularDrawer/utils/parseToBigNumber.js.map +1 -0
- package/lib-es/modularDrawer/utils/type.d.ts +21 -0
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/type.js +2 -0
- package/lib-es/modularDrawer/utils/type.js.map +1 -0
- package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js +1 -1
- package/lib-es/utils/__tests__/getAccountTuplesForCurrency.test.js.map +1 -1
- package/package.json +72 -70
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +11 -5
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +2 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +20 -16
- package/src/bridge/generic-alpaca/signOperation.ts +3 -2
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +1 -1
- package/src/bridge/generic-alpaca/utils.ts +0 -2
- package/src/currencies/index.ts +0 -1
- package/src/currencies/sortByMarketcap.test.ts +2 -1
- package/src/domain/getTokensWithFunds.test.ts +1 -1
- package/src/e2e/enum/AppInfos.ts +1 -1
- package/src/e2e/enum/Provider.ts +2 -2
- package/src/e2e/speculos.ts +3 -4
- package/src/e2e/speculosCI.ts +18 -6
- package/src/families/evm/setup.ts +9 -0
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +464 -1135
- package/src/families/hedera/constants.ts +2 -0
- package/src/families/hedera/setup.ts +7 -3
- package/src/families/solana/setup.ts +2 -0
- package/src/featureFlags/defaultFeatures.ts +1 -0
- package/src/market/utils/countervalueFormatter.ts +0 -1
- package/src/modularDrawer/__mocks__/currencies.mock.ts +1 -1
- package/src/modularDrawer/__mocks__/useGroupedCurrenciesByProvider.mock.ts +1 -1
- package/src/modularDrawer/data/entities/index.ts +79 -0
- package/src/modularDrawer/data/state-manager/api.ts +62 -0
- package/src/modularDrawer/hooks/__test__/useAssetsData.test.ts +139 -0
- package/src/modularDrawer/hooks/useAssetsData.ts +36 -0
- package/src/modularDrawer/utils/__tests__/counterValueFormatter.test.ts +549 -0
- package/src/modularDrawer/utils/__tests__/currencyUtils.test.ts +1 -1
- package/src/modularDrawer/utils/__tests__/haveOneCommonProvider.test.ts +2 -2
- package/src/modularDrawer/utils/calculateProviderTotal.ts +23 -0
- package/src/modularDrawer/utils/counterValueFormatter.ts +165 -0
- package/src/modularDrawer/utils/getBalanceAndFiatValueByAssets.ts +76 -0
- package/src/modularDrawer/utils/getProviderCurrency.ts +13 -0
- package/src/modularDrawer/utils/groupAccountsByAsset.ts +51 -0
- package/src/modularDrawer/utils/parseToBigNumber.ts +17 -0
- package/src/modularDrawer/utils/type.ts +22 -0
- package/src/utils/__tests__/getAccountTuplesForCurrency.test.ts +1 -1
@@ -19,18 +19,24 @@ export function genericEstimateMaxSpendable(
|
|
19
19
|
...transaction,
|
20
20
|
amount: mainAccount.spendableBalance,
|
21
21
|
useAllAmount: true,
|
22
|
-
fees: transaction?.fees ? BigInt(transaction.fees.toString()) : 0n,
|
23
22
|
};
|
24
|
-
|
25
|
-
|
26
|
-
)
|
23
|
+
|
24
|
+
let fees = transaction?.fees;
|
25
|
+
if (transaction?.fees === null || transaction?.fees === undefined) {
|
26
|
+
fees = (
|
27
|
+
await getAlpacaApi(network, kind).estimateFees(
|
28
|
+
transactionToIntent(mainAccount, draftTransaction),
|
29
|
+
)
|
30
|
+
).value;
|
31
|
+
}
|
27
32
|
const { amount } = await getAlpacaApi(network, kind).validateIntent(
|
28
33
|
transactionToIntent(account, { ...draftTransaction }),
|
34
|
+
{ value: transaction?.fees ? BigInt(transaction.fees.toString()) : 0n },
|
29
35
|
);
|
30
36
|
if (network === "stellar") {
|
31
37
|
return amount > 0 ? new BigNumber(amount.toString()) : new BigNumber(0);
|
32
38
|
}
|
33
|
-
const bnFee = BigNumber(fees.
|
39
|
+
const bnFee = BigNumber(fees.toString());
|
34
40
|
return BigNumber.max(0, account.spendableBalance.minus(bnFee));
|
35
41
|
};
|
36
42
|
}
|
@@ -3,6 +3,7 @@ import { AccountAwaitingSendPendingOperations } from "@ledgerhq/errors";
|
|
3
3
|
import BigNumber from "bignumber.js";
|
4
4
|
import { getAlpacaApi } from "./alpaca";
|
5
5
|
import { transactionToIntent } from "./utils";
|
6
|
+
// import { FeeEstimation } from "@ledgerhq/coin-framework/api/types";
|
6
7
|
|
7
8
|
// => alpaca validateIntent
|
8
9
|
export function genericGetTransactionStatus(
|
@@ -26,7 +27,6 @@ export function genericGetTransactionStatus(
|
|
26
27
|
mode: transaction?.mode,
|
27
28
|
recipient: transaction.recipient,
|
28
29
|
amount: transaction.amount ?? new BigNumber(0),
|
29
|
-
fees: transaction.fees ? BigInt(transaction.fees.toString()) : 0n,
|
30
30
|
useAllAmount: !!transaction.useAllAmount,
|
31
31
|
assetReference: transaction.assetReference || "",
|
32
32
|
assetOwner: transaction.assetOwner || "",
|
@@ -46,6 +46,7 @@ export function genericGetTransactionStatus(
|
|
46
46
|
|
47
47
|
const { errors, warnings, estimatedFees, amount, totalSpent } = await alpacaApi.validateIntent(
|
48
48
|
transactionToIntent(account, draftTransaction),
|
49
|
+
{ value: transaction.fees ? BigInt(transaction.fees.toString()) : 0n },
|
49
50
|
);
|
50
51
|
|
51
52
|
return Promise.resolve({
|
@@ -2,7 +2,7 @@ import { Account, AccountBridge, TransactionCommon } from "@ledgerhq/types-live"
|
|
2
2
|
import { getAlpacaApi } from "./alpaca";
|
3
3
|
import { transactionToIntent } from "./utils";
|
4
4
|
import BigNumber from "bignumber.js";
|
5
|
-
import {
|
5
|
+
import { FeeEstimation } from "@ledgerhq/coin-framework/api/types";
|
6
6
|
|
7
7
|
function bnEq(a: BigNumber | null | undefined, b: BigNumber | null | undefined): boolean {
|
8
8
|
return !a && !b ? true : !a || !b ? false : a.eq(b);
|
@@ -16,31 +16,35 @@ export function genericPrepareTransaction(
|
|
16
16
|
account,
|
17
17
|
transaction: TransactionCommon & {
|
18
18
|
fees: BigNumber | null | undefined;
|
19
|
+
customFees?: FeeEstimation;
|
19
20
|
assetReference?: string;
|
20
21
|
assetOwner?: string;
|
21
22
|
subAccountId?: string;
|
22
|
-
networkInfo?: NetworkInfo | null;
|
23
23
|
},
|
24
24
|
) => {
|
25
25
|
const [assetReference, assetOwner] = getAssetInfos(transaction);
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
26
|
+
|
27
|
+
let fees = transaction.customFees?.parameters?.fees || null;
|
28
|
+
if (fees === null) {
|
29
|
+
fees = (
|
30
|
+
await getAlpacaApi(network, kind).estimateFees(
|
31
|
+
transactionToIntent(account, {
|
32
|
+
...transaction,
|
33
|
+
}),
|
34
|
+
)
|
35
|
+
).value;
|
36
|
+
}
|
37
|
+
|
38
|
+
if (!bnEq(transaction.fees, new BigNumber(fees.toString()))) {
|
37
39
|
return {
|
38
40
|
...transaction,
|
39
|
-
fees: new BigNumber(fees.
|
41
|
+
fees: new BigNumber(fees.toString()),
|
40
42
|
assetReference,
|
41
43
|
assetOwner,
|
42
|
-
|
43
|
-
|
44
|
+
customFees: {
|
45
|
+
parameters: {
|
46
|
+
fees: new BigNumber(fees.toString()),
|
47
|
+
},
|
44
48
|
},
|
45
49
|
};
|
46
50
|
}
|
@@ -95,7 +95,6 @@ export const genericSignOperation =
|
|
95
95
|
const draftTransaction = {
|
96
96
|
recipient: transaction.recipient,
|
97
97
|
amount: transaction.amount ?? 0,
|
98
|
-
fees: fees,
|
99
98
|
useAllAmount: !!transaction.useAllAmount,
|
100
99
|
assetReference: transaction?.["assetReference"] || "",
|
101
100
|
assetOwner: transaction?.["assetOwner"] || "",
|
@@ -103,6 +102,7 @@ export const genericSignOperation =
|
|
103
102
|
};
|
104
103
|
const { amount } = await getAlpacaApi(network, kind).validateIntent(
|
105
104
|
transactionToIntent(account, draftTransaction),
|
105
|
+
{ value: fees },
|
106
106
|
);
|
107
107
|
transaction.amount = new BigNumber(amount.toString());
|
108
108
|
}
|
@@ -110,7 +110,7 @@ export const genericSignOperation =
|
|
110
110
|
const derivationPath = account.freshAddressPath;
|
111
111
|
const { publicKey } = (await signer.getAddress(derivationPath)) as Result;
|
112
112
|
|
113
|
-
let transactionIntent = transactionToIntent(account, { ...transaction
|
113
|
+
let transactionIntent = transactionToIntent(account, { ...transaction });
|
114
114
|
transactionIntent.senderPublicKey = publicKey;
|
115
115
|
|
116
116
|
// Enrich with memo and asset information
|
@@ -125,6 +125,7 @@ export const genericSignOperation =
|
|
125
125
|
/* Craft unsigned blob via Alpaca */
|
126
126
|
const unsigned: string = await getAlpacaApi(network, kind).craftTransaction(
|
127
127
|
transactionIntent,
|
128
|
+
{ value: fees },
|
128
129
|
);
|
129
130
|
|
130
131
|
/* Notify UI that the device is now showing the tx */
|
@@ -47,7 +47,7 @@ describe("genericPrepareTransaction", () => {
|
|
47
47
|
expect((result as any).fees.toString()).toBe(newFee.toString());
|
48
48
|
expect(transactionToIntent).toHaveBeenCalledWith(
|
49
49
|
account,
|
50
|
-
expect.objectContaining(
|
50
|
+
expect.objectContaining(baseTransaction),
|
51
51
|
);
|
52
52
|
});
|
53
53
|
|
@@ -94,7 +94,6 @@ export function transactionToIntent(
|
|
94
94
|
assetOwner?: string;
|
95
95
|
assetReference?: string;
|
96
96
|
mode?: string;
|
97
|
-
fees?: bigint | null | undefined;
|
98
97
|
memoType?: string;
|
99
98
|
memoValue?: string;
|
100
99
|
useAllAmount?: boolean;
|
@@ -114,7 +113,6 @@ export function transactionToIntent(
|
|
114
113
|
}
|
115
114
|
}
|
116
115
|
const res: TransactionIntent & { memo?: { type: string; value?: string } } = {
|
117
|
-
fees: transaction?.fees ? transaction.fees : null,
|
118
116
|
type: transactionType,
|
119
117
|
sender: account.freshAddress,
|
120
118
|
recipient: transaction.recipient,
|
package/src/currencies/index.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import { sortCurrenciesByIds } from "./sortByMarketcap";
|
2
|
-
import {
|
2
|
+
import { listCryptoCurrencies, listTokens } from ".";
|
3
3
|
import { getBTCValues } from "@ledgerhq/live-countervalues/mock";
|
4
4
|
import { CURRENCIES_LIST, IDS } from "./mock";
|
5
5
|
import { setCryptoAssetsStore as setCryptoAssetsStoreForCoinFramework } from "@ledgerhq/coin-framework/crypto-assets/index";
|
6
6
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
7
|
+
import { findCurrencyByTicker } from "@ledgerhq/live-countervalues/findCurrencyByTicker";
|
7
8
|
|
8
9
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
9
10
|
setCryptoAssetsStoreForCoinFramework({
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { genAccount } from "@ledgerhq/coin-framework/lib/mocks/account";
|
2
|
-
import { getCryptoCurrencyById } from "
|
2
|
+
import { getCryptoCurrencyById } from "../currencies/index";
|
3
3
|
import { Account } from "@ledgerhq/types-live";
|
4
4
|
import BigNumber from "bignumber.js";
|
5
5
|
import { getTokensWithFunds } from "./getTokensWithFunds";
|
package/src/e2e/enum/AppInfos.ts
CHANGED
package/src/e2e/enum/Provider.ts
CHANGED
@@ -16,8 +16,8 @@ export class Provider {
|
|
16
16
|
static readonly LIFI = new Provider("lifi", "LI.FI", false, true, false);
|
17
17
|
static readonly CIC = new Provider("cic", "CIC", false, true, true);
|
18
18
|
static readonly COINBASE = new Provider("coinbase", "Coinbase", false, true, true);
|
19
|
-
static readonly KILN = new Provider("
|
20
|
-
static readonly STADER_LABS = new Provider("stader", "Stader Labs", false, true, true);
|
19
|
+
static readonly KILN = new Provider("kiln_pooling", "Kiln staking Pool", false, true, true);
|
20
|
+
static readonly STADER_LABS = new Provider("stader-eth", "Stader Labs", false, true, true);
|
21
21
|
static readonly LIDO = new Provider("lido", "Lido", false, true, true);
|
22
22
|
static readonly TRANSAK = new Provider("transak", "Transak", false, true, true);
|
23
23
|
|
package/src/e2e/speculos.ts
CHANGED
@@ -14,13 +14,13 @@ import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
14
14
|
import axios, { AxiosError, AxiosResponse } from "axios";
|
15
15
|
import { getEnv } from "@ledgerhq/live-env";
|
16
16
|
import { getCryptoCurrencyById } from "../currencies";
|
17
|
-
import { DeviceLabels } from "
|
17
|
+
import { DeviceLabels } from "./enum/DeviceLabels";
|
18
18
|
import { Account } from "./enum/Account";
|
19
19
|
import { Device as CryptoWallet } from "./enum/Device";
|
20
20
|
import { Currency } from "./enum/Currency";
|
21
21
|
import expect from "expect";
|
22
22
|
import { sendBTCBasedCoin } from "./families/bitcoin";
|
23
|
-
import { sendEVM, sendEvmNFT } from "
|
23
|
+
import { sendEVM, sendEvmNFT } from "./families/evm";
|
24
24
|
import { sendPolkadot } from "./families/polkadot";
|
25
25
|
import { sendAlgorand } from "./families/algorand";
|
26
26
|
import { sendTron } from "./families/tron";
|
@@ -385,13 +385,12 @@ export async function startSpeculos(
|
|
385
385
|
onSpeculosDeviceCreated,
|
386
386
|
};
|
387
387
|
try {
|
388
|
-
|
388
|
+
return isSpeculosRemote
|
389
389
|
? await createSpeculosDeviceCI(deviceParams)
|
390
390
|
: await createSpeculosDevice(deviceParams).then(device => {
|
391
391
|
invariant(device.ports.apiPort, "[E2E] Speculos apiPort is not defined");
|
392
392
|
return { id: device.id, port: device.ports.apiPort };
|
393
393
|
});
|
394
|
-
return device;
|
395
394
|
} catch (e: unknown) {
|
396
395
|
console.error(e);
|
397
396
|
log("engine", `test ${testName} failed with ${String(e)}`);
|
package/src/e2e/speculosCI.ts
CHANGED
@@ -21,6 +21,14 @@ function uniqueId(): string {
|
|
21
21
|
return timestamp + randomString;
|
22
22
|
}
|
23
23
|
|
24
|
+
function slugify(name: string): string {
|
25
|
+
return name
|
26
|
+
.toLowerCase()
|
27
|
+
.trim()
|
28
|
+
.replace(/[^a-z0-9]+/g, "-")
|
29
|
+
.replace(/^-+|-+$/g, "");
|
30
|
+
}
|
31
|
+
|
24
32
|
/**
|
25
33
|
* Helper function to make API requests with error handling
|
26
34
|
*/
|
@@ -58,10 +66,14 @@ async function githubApiRequest<T = unknown>({
|
|
58
66
|
}
|
59
67
|
}
|
60
68
|
|
61
|
-
function waitForSpeculosReady(
|
69
|
+
export function waitForSpeculosReady(
|
70
|
+
deviceId: string,
|
71
|
+
{ interval = 2_000, timeout = 150_000 } = {},
|
72
|
+
) {
|
62
73
|
return new Promise((resolve, reject) => {
|
63
74
|
const startTime = Date.now();
|
64
75
|
let currentRequest: ReturnType<typeof https.get> | null = null;
|
76
|
+
const url = getSpeculosAddress(deviceId);
|
65
77
|
|
66
78
|
function cleanup() {
|
67
79
|
if (currentRequest) {
|
@@ -151,22 +163,22 @@ function createStartPayload(deviceParams: DeviceParams, runId: string) {
|
|
151
163
|
export async function createSpeculosDeviceCI(
|
152
164
|
deviceParams: DeviceParams,
|
153
165
|
): Promise<SpeculosDevice | undefined> {
|
166
|
+
const runId = `${slugify(deviceParams.appName)}-${uniqueId()}`;
|
154
167
|
try {
|
155
|
-
const runId = uniqueId();
|
156
|
-
console.warn("Creating remote speculos:", runId);
|
157
168
|
const data = createStartPayload(deviceParams, runId);
|
158
169
|
await githubApiRequest({ urlSuffix: START_WORKFLOW_ID, data });
|
159
|
-
await waitForSpeculosReady(getSpeculosAddress(runId));
|
160
|
-
|
161
170
|
return {
|
162
171
|
id: runId,
|
163
172
|
port: speculosPort,
|
164
173
|
};
|
165
174
|
} catch (e: unknown) {
|
166
|
-
console.error(e);
|
167
175
|
console.warn(
|
168
176
|
`Creating remote speculos ${deviceParams.appName}:${deviceParams.appVersion} failed with ${String(e)}`,
|
169
177
|
);
|
178
|
+
return {
|
179
|
+
id: runId,
|
180
|
+
port: 0,
|
181
|
+
};
|
170
182
|
}
|
171
183
|
}
|
172
184
|
|
@@ -21,6 +21,15 @@ import { type DeviceManagementKit } from "@ledgerhq/device-management-kit";
|
|
21
21
|
import { DmkSignerEth, LegacySignerEth } from "@ledgerhq/live-signer-evm";
|
22
22
|
import { EvmSigner } from "@ledgerhq/coin-evm/types/signer";
|
23
23
|
import { getCryptoAssetsStore } from "../../bridge/crypto-assets";
|
24
|
+
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
25
|
+
import { setShouldSkipTokenLoading } from "@ledgerhq/coin-evm/bridge/preload";
|
26
|
+
|
27
|
+
try {
|
28
|
+
const isCALLazyLoadingEnabled = LiveConfig.getValueByKey("feature_cal_lazy_loading") === "true";
|
29
|
+
setShouldSkipTokenLoading(Boolean(isCALLazyLoadingEnabled));
|
30
|
+
} catch (error) {
|
31
|
+
setShouldSkipTokenLoading(false);
|
32
|
+
}
|
24
33
|
|
25
34
|
const createSigner: CreateSigner<EvmSigner> = (transport: Transport) => {
|
26
35
|
if (isDmkTransport(transport)) {
|