@ledgerhq/live-common 34.45.0-nightly.2 → 34.45.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.
- package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib/__tests__/test-helpers/bridge.js +1 -3
- package/lib/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/index.js +2 -4
- package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +4 -4
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +10 -10
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/bridge/generic-alpaca/broadcast.d.ts +1 -1
- package/lib/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.d.ts +9 -17
- package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/createTransaction.js +10 -36
- package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +0 -9
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +37 -66
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +15 -27
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +1 -5
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +5 -28
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +13 -64
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +5 -38
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts +0 -2
- package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/signTransaction.js +1 -8
- package/lib/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/types.d.ts +0 -3
- package/lib/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +46 -70
- package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.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/tests/signOperation.test.js +22 -25
- package/lib/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts +1 -36
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +14 -130
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
- package/lib/bridge/generic-alpaca/{tests/utils.test.js → utils.test.js} +1 -1
- package/lib/bridge/generic-alpaca/utils.test.js.map +1 -0
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +4 -5
- package/lib/bridge/impl.js.map +1 -1
- package/lib/e2e/enum/Account.js +4 -4
- package/lib/e2e/enum/Account.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/AppInfos.js +1 -1
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +3 -3
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/speculos.js +2 -2
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/exchange/index.d.ts.map +1 -1
- package/lib/exchange/index.js +0 -1
- package/lib/exchange/index.js.map +1 -1
- package/lib/families/canton/bridge.integration.test.d.ts +2 -0
- package/lib/families/canton/bridge.integration.test.d.ts.map +1 -0
- package/lib/families/canton/bridge.integration.test.js +7 -0
- package/lib/families/canton/bridge.integration.test.js.map +1 -0
- package/lib/families/stellar/bridge/logic.d.ts +1 -1
- package/lib/families/stellar/bridge/logic.d.ts.map +1 -1
- package/lib/families/stellar/bridge/logic.js +1 -1
- package/lib/families/stellar/bridge/logic.js.map +1 -1
- package/lib/families/stellar/bridge/mock.js +2 -2
- package/lib/families/stellar/bridge/mock.js.map +1 -1
- package/lib/families/stellar/setup.d.ts +6 -3
- package/lib/families/stellar/setup.d.ts.map +1 -1
- package/lib/families/stellar/setup.js +12 -3
- package/lib/families/stellar/setup.js.map +1 -1
- package/lib/families/xrp/bridge/mock.js +2 -2
- package/lib/families/xrp/bridge/mock.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +2 -4
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/generated/bridge/js.d.ts +1 -0
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +14 -12
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/transaction.d.ts +1 -1
- package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.js +14 -229
- package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.js.map +1 -1
- package/lib/modularDrawer/enums.d.ts +1 -0
- package/lib/modularDrawer/enums.d.ts.map +1 -1
- package/lib/modularDrawer/enums.js +1 -0
- package/lib/modularDrawer/enums.js.map +1 -1
- package/lib/modularDrawer/useModularDrawerVisibility.d.ts +1 -7
- package/lib/modularDrawer/useModularDrawerVisibility.d.ts.map +1 -1
- package/lib/modularDrawer/useModularDrawerVisibility.js +2 -18
- package/lib/modularDrawer/useModularDrawerVisibility.js.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.d.ts.map +1 -1
- package/lib-es/__tests__/test-helpers/bridge.js +1 -3
- package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/accountBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/index.js +2 -4
- package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +4 -4
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +10 -10
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts +9 -17
- package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/createTransaction.js +9 -35
- package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +0 -9
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +37 -66
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +15 -27
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +1 -5
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +4 -26
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +13 -61
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js +6 -39
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts +0 -2
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js +0 -6
- package/lib-es/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/types.d.ts +0 -3
- package/lib-es/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +46 -70
- package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.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/tests/signOperation.test.js +22 -25
- package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts +1 -36
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +14 -130
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
- package/lib-es/bridge/generic-alpaca/{tests/utils.test.js → utils.test.js} +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -0
- package/lib-es/bridge/impl.d.ts.map +1 -1
- package/lib-es/bridge/impl.js +4 -5
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/e2e/enum/Account.js +4 -4
- package/lib-es/e2e/enum/Account.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/AppInfos.js +1 -1
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +3 -3
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/speculos.js +2 -2
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/exchange/index.d.ts.map +1 -1
- package/lib-es/exchange/index.js +0 -1
- package/lib-es/exchange/index.js.map +1 -1
- package/lib-es/families/canton/bridge.integration.test.d.ts +2 -0
- package/lib-es/families/canton/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/families/canton/bridge.integration.test.js +5 -0
- package/lib-es/families/canton/bridge.integration.test.js.map +1 -0
- package/lib-es/families/stellar/bridge/logic.d.ts +1 -1
- package/lib-es/families/stellar/bridge/logic.d.ts.map +1 -1
- package/lib-es/families/stellar/bridge/logic.js +1 -1
- package/lib-es/families/stellar/bridge/logic.js.map +1 -1
- package/lib-es/families/stellar/bridge/mock.js +2 -2
- package/lib-es/families/stellar/bridge/mock.js.map +1 -1
- package/lib-es/families/stellar/setup.d.ts +6 -3
- package/lib-es/families/stellar/setup.d.ts.map +1 -1
- package/lib-es/families/stellar/setup.js +10 -2
- package/lib-es/families/stellar/setup.js.map +1 -1
- package/lib-es/families/xrp/bridge/mock.js +2 -2
- package/lib-es/families/xrp/bridge/mock.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +2 -4
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/generated/bridge/js.d.ts +1 -0
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +2 -0
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/generated/transaction.d.ts +1 -1
- package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.js +14 -229
- package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.js.map +1 -1
- package/lib-es/modularDrawer/enums.d.ts +1 -0
- package/lib-es/modularDrawer/enums.d.ts.map +1 -1
- package/lib-es/modularDrawer/enums.js +1 -0
- package/lib-es/modularDrawer/enums.js.map +1 -1
- package/lib-es/modularDrawer/useModularDrawerVisibility.d.ts +1 -7
- package/lib-es/modularDrawer/useModularDrawerVisibility.d.ts.map +1 -1
- package/lib-es/modularDrawer/useModularDrawerVisibility.js +2 -18
- package/lib-es/modularDrawer/useModularDrawerVisibility.js.map +1 -1
- package/package.json +70 -71
- package/src/__tests__/test-helpers/bridge.ts +1 -3
- package/src/bridge/generic-alpaca/accountBridge.ts +4 -1
- package/src/bridge/generic-alpaca/alpaca/index.ts +2 -7
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +22 -17
- package/src/bridge/generic-alpaca/broadcast.ts +4 -1
- package/src/bridge/generic-alpaca/createTransaction.ts +18 -48
- package/src/bridge/generic-alpaca/currencyBridge.ts +1 -1
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +4 -13
- package/src/bridge/generic-alpaca/getAccountShape.ts +46 -84
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +22 -46
- package/src/bridge/generic-alpaca/prepareTransaction.ts +7 -41
- package/src/bridge/generic-alpaca/signOperation.ts +18 -85
- package/src/bridge/generic-alpaca/signer/index.ts +7 -43
- package/src/bridge/generic-alpaca/signer/signTransaction.ts +0 -11
- package/src/bridge/generic-alpaca/signer/types.ts +0 -1
- package/src/bridge/generic-alpaca/tests/estimateMaxSpendable.test.ts +47 -72
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +1 -1
- package/src/bridge/generic-alpaca/tests/signOperation.test.ts +26 -28
- package/src/bridge/generic-alpaca/{tests/utils.test.ts → utils.test.ts} +1 -1
- package/src/bridge/generic-alpaca/utils.ts +18 -158
- package/src/bridge/impl.ts +4 -5
- package/src/e2e/enum/Account.ts +4 -4
- package/src/e2e/enum/AppInfos.ts +1 -1
- package/src/e2e/enum/Currency.ts +13 -3
- package/src/e2e/speculos.ts +2 -2
- package/src/exchange/index.ts +0 -1
- package/src/families/canton/bridge.integration.test.ts +6 -0
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +2009 -202
- package/src/families/stellar/bridge/logic.ts +1 -1
- package/src/families/stellar/bridge/mock.ts +2 -2
- package/src/families/stellar/setup.ts +22 -2
- package/src/families/xrp/bridge/mock.ts +2 -2
- package/src/featureFlags/defaultFeatures.ts +2 -4
- package/src/generated/bridge/js.ts +2 -0
- package/src/modularDrawer/__test__/useModularDrawerVisibility.test.ts +14 -345
- package/src/modularDrawer/enums.ts +1 -0
- package/src/modularDrawer/useModularDrawerVisibility.ts +2 -26
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts +0 -17
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +0 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.js +0 -75
- package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +0 -1
- package/lib/bridge/generic-alpaca/tests/utils.test.d.ts.map +0 -1
- package/lib/bridge/generic-alpaca/tests/utils.test.js.map +0 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +0 -17
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +0 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +0 -65
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +0 -1
- package/lib-es/bridge/generic-alpaca/tests/utils.test.d.ts.map +0 -1
- package/lib-es/bridge/generic-alpaca/tests/utils.test.js.map +0 -1
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +0 -110
- /package/lib/bridge/generic-alpaca/{tests/utils.test.d.ts → utils.test.d.ts} +0 -0
- /package/lib-es/bridge/generic-alpaca/{tests/utils.test.d.ts → utils.test.d.ts} +0 -0
@@ -1 +1 @@
|
|
1
|
-
export * from "@ledgerhq/coin-stellar/logic";
|
1
|
+
export * from "@ledgerhq/coin-stellar/bridge/logic";
|
@@ -1,17 +1,37 @@
|
|
1
1
|
// Goal of this file is to inject all necessary device/signer dependency to coin-modules
|
2
|
+
import { createBridges } from "@ledgerhq/coin-stellar/bridge/index";
|
2
3
|
import makeCliTools from "@ledgerhq/coin-stellar/test/cli";
|
4
|
+
import { StellarCoinConfig } from "@ledgerhq/coin-stellar/config";
|
3
5
|
import stellarResolver from "@ledgerhq/coin-stellar/signer/index";
|
6
|
+
import type {
|
7
|
+
StellarAccount,
|
8
|
+
Transaction,
|
9
|
+
TransactionStatus,
|
10
|
+
} from "@ledgerhq/coin-stellar/types/index";
|
11
|
+
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
|
4
12
|
import Stellar from "@ledgerhq/hw-app-str";
|
5
13
|
import Transport from "@ledgerhq/hw-transport";
|
6
|
-
import {
|
14
|
+
import type { Bridge } from "@ledgerhq/types-live";
|
15
|
+
import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
|
16
|
+
import { getCurrencyConfiguration } from "../../config";
|
7
17
|
import { Resolver } from "../../hw/getAddress/types";
|
8
18
|
|
9
19
|
const createSigner: CreateSigner<Stellar> = (transport: Transport) => {
|
10
20
|
return new Stellar(transport);
|
11
21
|
};
|
12
22
|
|
23
|
+
const stellar = getCryptoCurrencyById("stellar");
|
24
|
+
function getCurrencyConfig(): StellarCoinConfig {
|
25
|
+
return getCurrencyConfiguration(stellar);
|
26
|
+
}
|
27
|
+
|
28
|
+
const bridge: Bridge<Transaction, StellarAccount, TransactionStatus> = createBridges(
|
29
|
+
executeWithSigner(createSigner),
|
30
|
+
getCurrencyConfig,
|
31
|
+
);
|
32
|
+
|
13
33
|
const resolver: Resolver = createResolver(createSigner, stellarResolver);
|
14
34
|
|
15
35
|
const cliTools = makeCliTools();
|
16
36
|
|
17
|
-
export { cliTools, resolver };
|
37
|
+
export { bridge, cliTools, resolver };
|
@@ -33,13 +33,13 @@ export function addNotCreatedRippleMockAddress(addr: string) {
|
|
33
33
|
notCreatedAddresses.push(addr);
|
34
34
|
}
|
35
35
|
|
36
|
-
const defaultGetFees = (a: Account, t: any) => t.
|
36
|
+
const defaultGetFees = (a: Account, t: any) => t.fee || new BigNumber(0);
|
37
37
|
|
38
38
|
const createTransaction = (): Transaction => ({
|
39
39
|
family: "xrp",
|
40
40
|
amount: new BigNumber(0),
|
41
41
|
recipient: "",
|
42
|
-
|
42
|
+
fee: new BigNumber(10),
|
43
43
|
feeCustomUnit: getCryptoCurrencyById("ripple").units[1],
|
44
44
|
tag: undefined,
|
45
45
|
networkInfo: null,
|
@@ -616,9 +616,8 @@ export const DEFAULT_FEATURES: Features = {
|
|
616
616
|
...DEFAULT_FEATURE,
|
617
617
|
params: {
|
618
618
|
add_account: true,
|
619
|
+
earn_flow: true,
|
619
620
|
live_app: true,
|
620
|
-
live_apps_allowlist: [],
|
621
|
-
live_apps_blocklist: [],
|
622
621
|
receive_flow: true,
|
623
622
|
send_flow: true,
|
624
623
|
enableModularization: false,
|
@@ -629,9 +628,8 @@ export const DEFAULT_FEATURES: Features = {
|
|
629
628
|
...DEFAULT_FEATURE,
|
630
629
|
params: {
|
631
630
|
add_account: true,
|
631
|
+
earn_flow: true,
|
632
632
|
live_app: true,
|
633
|
-
live_apps_allowlist: [],
|
634
|
-
live_apps_blocklist: [],
|
635
633
|
receive_flow: true,
|
636
634
|
send_flow: true,
|
637
635
|
enableModularization: false,
|
@@ -16,6 +16,7 @@ import { bridge as near } from "../../families/near/setup";
|
|
16
16
|
import { bridge as polkadot } from "../../families/polkadot/setup";
|
17
17
|
import { bridge as solana } from "../../families/solana/setup";
|
18
18
|
import { bridge as stacks } from "../../families/stacks/setup";
|
19
|
+
import { bridge as stellar } from "../../families/stellar/setup";
|
19
20
|
import { bridge as tezos } from "../../families/tezos/setup";
|
20
21
|
import { bridge as ton } from "../../families/ton/setup";
|
21
22
|
import { bridge as tron } from "../../families/tron/setup";
|
@@ -42,6 +43,7 @@ export default {
|
|
42
43
|
polkadot,
|
43
44
|
solana,
|
44
45
|
stacks,
|
46
|
+
stellar,
|
45
47
|
tezos,
|
46
48
|
ton,
|
47
49
|
tron,
|
@@ -29,9 +29,7 @@ describe("useModularDrawerVisibility", () => {
|
|
29
29
|
},
|
30
30
|
);
|
31
31
|
|
32
|
-
expect(
|
33
|
-
result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
|
34
|
-
).toBe(false);
|
32
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
|
35
33
|
});
|
36
34
|
|
37
35
|
it("should return false if the location param is not set", () => {
|
@@ -49,9 +47,7 @@ describe("useModularDrawerVisibility", () => {
|
|
49
47
|
},
|
50
48
|
);
|
51
49
|
|
52
|
-
expect(
|
53
|
-
result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
|
54
|
-
).toBe(false);
|
50
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
|
55
51
|
});
|
56
52
|
|
57
53
|
it("should return the correct visibility for each location", () => {
|
@@ -60,6 +56,7 @@ describe("useModularDrawerVisibility", () => {
|
|
60
56
|
enabled: true,
|
61
57
|
params: {
|
62
58
|
[ModularDrawerLocation.ADD_ACCOUNT]: true,
|
59
|
+
[ModularDrawerLocation.EARN_FLOW]: false,
|
63
60
|
},
|
64
61
|
},
|
65
62
|
};
|
@@ -74,15 +71,9 @@ describe("useModularDrawerVisibility", () => {
|
|
74
71
|
},
|
75
72
|
);
|
76
73
|
|
77
|
-
expect(
|
78
|
-
|
79
|
-
).toBe(
|
80
|
-
expect(
|
81
|
-
result.current.isModularDrawerVisible({
|
82
|
-
location: ModularDrawerLocation.LIVE_APP,
|
83
|
-
liveAppId: "earn",
|
84
|
-
}),
|
85
|
-
).toBe(false);
|
74
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(true);
|
75
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.EARN_FLOW)).toBe(false);
|
76
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.LIVE_APP)).toBe(false);
|
86
77
|
});
|
87
78
|
});
|
88
79
|
|
@@ -105,9 +96,7 @@ describe("useModularDrawerVisibility", () => {
|
|
105
96
|
},
|
106
97
|
);
|
107
98
|
|
108
|
-
expect(
|
109
|
-
result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
|
110
|
-
).toBe(false);
|
99
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
|
111
100
|
});
|
112
101
|
|
113
102
|
it("should return false if the location param is not set", () => {
|
@@ -125,9 +114,7 @@ describe("useModularDrawerVisibility", () => {
|
|
125
114
|
},
|
126
115
|
);
|
127
116
|
|
128
|
-
expect(
|
129
|
-
result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
|
130
|
-
).toBe(false);
|
117
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
|
131
118
|
});
|
132
119
|
|
133
120
|
it("should return the correct visibility for each location", () => {
|
@@ -136,6 +123,7 @@ describe("useModularDrawerVisibility", () => {
|
|
136
123
|
enabled: true,
|
137
124
|
params: {
|
138
125
|
[ModularDrawerLocation.ADD_ACCOUNT]: false,
|
126
|
+
[ModularDrawerLocation.EARN_FLOW]: true,
|
139
127
|
[ModularDrawerLocation.RECEIVE_FLOW]: true,
|
140
128
|
},
|
141
129
|
},
|
@@ -151,330 +139,11 @@ describe("useModularDrawerVisibility", () => {
|
|
151
139
|
},
|
152
140
|
);
|
153
141
|
|
154
|
-
expect(
|
155
|
-
|
156
|
-
).toBe(
|
157
|
-
expect(
|
158
|
-
|
159
|
-
).toBe(true);
|
160
|
-
expect(
|
161
|
-
result.current.isModularDrawerVisible({
|
162
|
-
location: ModularDrawerLocation.LIVE_APP,
|
163
|
-
liveAppId: "earn",
|
164
|
-
}),
|
165
|
-
).toBe(false);
|
166
|
-
expect(
|
167
|
-
result.current.isModularDrawerVisible({ location: ModularDrawerLocation.SEND_FLOW }),
|
168
|
-
).toBe(false);
|
169
|
-
});
|
170
|
-
});
|
171
|
-
|
172
|
-
describe("Live app whitelist and blacklist logic", () => {
|
173
|
-
describe("lldModularDrawer", () => {
|
174
|
-
it("should return false if live_app location is not enabled", () => {
|
175
|
-
const mockedFeatures = {
|
176
|
-
lldModularDrawer: {
|
177
|
-
enabled: true,
|
178
|
-
params: {
|
179
|
-
[ModularDrawerLocation.LIVE_APP]: false,
|
180
|
-
live_apps_allowlist: ["earn"],
|
181
|
-
live_apps_blocklist: [],
|
182
|
-
},
|
183
|
-
},
|
184
|
-
};
|
185
|
-
|
186
|
-
const { result } = renderHook(
|
187
|
-
() =>
|
188
|
-
useModularDrawerVisibility({
|
189
|
-
modularDrawerFeatureFlagKey: "lldModularDrawer",
|
190
|
-
}),
|
191
|
-
{
|
192
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
193
|
-
},
|
194
|
-
);
|
195
|
-
|
196
|
-
expect(
|
197
|
-
result.current.isModularDrawerVisible({
|
198
|
-
location: ModularDrawerLocation.LIVE_APP,
|
199
|
-
liveAppId: "earn",
|
200
|
-
}),
|
201
|
-
).toBe(false);
|
202
|
-
});
|
203
|
-
|
204
|
-
it("should return true for whitelisted apps when whitelist is provided", () => {
|
205
|
-
const mockedFeatures = {
|
206
|
-
lldModularDrawer: {
|
207
|
-
enabled: true,
|
208
|
-
params: {
|
209
|
-
[ModularDrawerLocation.LIVE_APP]: true,
|
210
|
-
live_apps_allowlist: ["earn", "swap"],
|
211
|
-
live_apps_blocklist: [],
|
212
|
-
},
|
213
|
-
},
|
214
|
-
};
|
215
|
-
|
216
|
-
const { result } = renderHook(
|
217
|
-
() =>
|
218
|
-
useModularDrawerVisibility({
|
219
|
-
modularDrawerFeatureFlagKey: "lldModularDrawer",
|
220
|
-
}),
|
221
|
-
{
|
222
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
223
|
-
},
|
224
|
-
);
|
225
|
-
|
226
|
-
expect(
|
227
|
-
result.current.isModularDrawerVisible({
|
228
|
-
location: ModularDrawerLocation.LIVE_APP,
|
229
|
-
liveAppId: "earn",
|
230
|
-
}),
|
231
|
-
).toBe(true);
|
232
|
-
|
233
|
-
expect(
|
234
|
-
result.current.isModularDrawerVisible({
|
235
|
-
location: ModularDrawerLocation.LIVE_APP,
|
236
|
-
liveAppId: "swap",
|
237
|
-
}),
|
238
|
-
).toBe(true);
|
239
|
-
});
|
240
|
-
|
241
|
-
it("should return false for non-whitelisted apps when whitelist is provided", () => {
|
242
|
-
const mockedFeatures = {
|
243
|
-
lldModularDrawer: {
|
244
|
-
enabled: true,
|
245
|
-
params: {
|
246
|
-
[ModularDrawerLocation.LIVE_APP]: true,
|
247
|
-
live_apps_allowlist: ["earn"],
|
248
|
-
live_apps_blocklist: [],
|
249
|
-
},
|
250
|
-
},
|
251
|
-
};
|
252
|
-
|
253
|
-
const { result } = renderHook(
|
254
|
-
() =>
|
255
|
-
useModularDrawerVisibility({
|
256
|
-
modularDrawerFeatureFlagKey: "lldModularDrawer",
|
257
|
-
}),
|
258
|
-
{
|
259
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
260
|
-
},
|
261
|
-
);
|
262
|
-
|
263
|
-
expect(
|
264
|
-
result.current.isModularDrawerVisible({
|
265
|
-
location: ModularDrawerLocation.LIVE_APP,
|
266
|
-
liveAppId: "swap",
|
267
|
-
}),
|
268
|
-
).toBe(false);
|
269
|
-
|
270
|
-
expect(
|
271
|
-
result.current.isModularDrawerVisible({
|
272
|
-
location: ModularDrawerLocation.LIVE_APP,
|
273
|
-
liveAppId: "unknown-app",
|
274
|
-
}),
|
275
|
-
).toBe(false);
|
276
|
-
});
|
277
|
-
|
278
|
-
it("should return false for blacklisted apps", () => {
|
279
|
-
const mockedFeatures = {
|
280
|
-
lldModularDrawer: {
|
281
|
-
enabled: true,
|
282
|
-
params: {
|
283
|
-
[ModularDrawerLocation.LIVE_APP]: true,
|
284
|
-
live_apps_allowlist: [],
|
285
|
-
live_apps_blocklist: ["blocked-app", "another-blocked-app"],
|
286
|
-
},
|
287
|
-
},
|
288
|
-
};
|
289
|
-
|
290
|
-
const { result } = renderHook(
|
291
|
-
() =>
|
292
|
-
useModularDrawerVisibility({
|
293
|
-
modularDrawerFeatureFlagKey: "lldModularDrawer",
|
294
|
-
}),
|
295
|
-
{
|
296
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
297
|
-
},
|
298
|
-
);
|
299
|
-
|
300
|
-
expect(
|
301
|
-
result.current.isModularDrawerVisible({
|
302
|
-
location: ModularDrawerLocation.LIVE_APP,
|
303
|
-
liveAppId: "blocked-app",
|
304
|
-
}),
|
305
|
-
).toBe(false);
|
306
|
-
|
307
|
-
expect(
|
308
|
-
result.current.isModularDrawerVisible({
|
309
|
-
location: ModularDrawerLocation.LIVE_APP,
|
310
|
-
liveAppId: "another-blocked-app",
|
311
|
-
}),
|
312
|
-
).toBe(false);
|
313
|
-
});
|
314
|
-
|
315
|
-
it("should return true for non-blacklisted apps when no whitelist is provided", () => {
|
316
|
-
const mockedFeatures = {
|
317
|
-
lldModularDrawer: {
|
318
|
-
enabled: true,
|
319
|
-
params: {
|
320
|
-
[ModularDrawerLocation.LIVE_APP]: true,
|
321
|
-
live_apps_allowlist: [],
|
322
|
-
live_apps_blocklist: ["blocked-app"],
|
323
|
-
},
|
324
|
-
},
|
325
|
-
};
|
326
|
-
|
327
|
-
const { result } = renderHook(
|
328
|
-
() =>
|
329
|
-
useModularDrawerVisibility({
|
330
|
-
modularDrawerFeatureFlagKey: "lldModularDrawer",
|
331
|
-
}),
|
332
|
-
{
|
333
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
334
|
-
},
|
335
|
-
);
|
336
|
-
|
337
|
-
expect(
|
338
|
-
result.current.isModularDrawerVisible({
|
339
|
-
location: ModularDrawerLocation.LIVE_APP,
|
340
|
-
liveAppId: "allowed-app",
|
341
|
-
}),
|
342
|
-
).toBe(true);
|
343
|
-
|
344
|
-
expect(
|
345
|
-
result.current.isModularDrawerVisible({
|
346
|
-
location: ModularDrawerLocation.LIVE_APP,
|
347
|
-
liveAppId: "earn",
|
348
|
-
}),
|
349
|
-
).toBe(true);
|
350
|
-
});
|
351
|
-
|
352
|
-
it("should prioritize blacklist over whitelist", () => {
|
353
|
-
const mockedFeatures = {
|
354
|
-
lldModularDrawer: {
|
355
|
-
enabled: true,
|
356
|
-
params: {
|
357
|
-
[ModularDrawerLocation.LIVE_APP]: true,
|
358
|
-
live_apps_allowlist: ["earn", "swap"],
|
359
|
-
live_apps_blocklist: ["swap"],
|
360
|
-
},
|
361
|
-
},
|
362
|
-
};
|
363
|
-
|
364
|
-
const { result } = renderHook(
|
365
|
-
() =>
|
366
|
-
useModularDrawerVisibility({
|
367
|
-
modularDrawerFeatureFlagKey: "lldModularDrawer",
|
368
|
-
}),
|
369
|
-
{
|
370
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
371
|
-
},
|
372
|
-
);
|
373
|
-
|
374
|
-
expect(
|
375
|
-
result.current.isModularDrawerVisible({
|
376
|
-
location: ModularDrawerLocation.LIVE_APP,
|
377
|
-
liveAppId: "earn",
|
378
|
-
}),
|
379
|
-
).toBe(true);
|
380
|
-
|
381
|
-
expect(
|
382
|
-
result.current.isModularDrawerVisible({
|
383
|
-
location: ModularDrawerLocation.LIVE_APP,
|
384
|
-
liveAppId: "swap",
|
385
|
-
}),
|
386
|
-
).toBe(false);
|
387
|
-
});
|
388
|
-
|
389
|
-
it("should handle missing whitelist and blacklist arrays", () => {
|
390
|
-
const mockedFeatures = {
|
391
|
-
lldModularDrawer: {
|
392
|
-
enabled: true,
|
393
|
-
params: {
|
394
|
-
[ModularDrawerLocation.LIVE_APP]: true,
|
395
|
-
},
|
396
|
-
},
|
397
|
-
};
|
398
|
-
|
399
|
-
const { result } = renderHook(
|
400
|
-
() =>
|
401
|
-
useModularDrawerVisibility({
|
402
|
-
modularDrawerFeatureFlagKey: "lldModularDrawer",
|
403
|
-
}),
|
404
|
-
{
|
405
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
406
|
-
},
|
407
|
-
);
|
408
|
-
|
409
|
-
expect(
|
410
|
-
result.current.isModularDrawerVisible({
|
411
|
-
location: ModularDrawerLocation.LIVE_APP,
|
412
|
-
liveAppId: "any-app",
|
413
|
-
}),
|
414
|
-
).toBe(true);
|
415
|
-
});
|
416
|
-
});
|
417
|
-
|
418
|
-
describe("llmModularDrawer", () => {
|
419
|
-
it("should return true for whitelisted apps", () => {
|
420
|
-
const mockedFeatures = {
|
421
|
-
llmModularDrawer: {
|
422
|
-
enabled: true,
|
423
|
-
params: {
|
424
|
-
[ModularDrawerLocation.LIVE_APP]: true,
|
425
|
-
live_apps_allowlist: ["earn", "swap"],
|
426
|
-
live_apps_blocklist: [],
|
427
|
-
},
|
428
|
-
},
|
429
|
-
};
|
430
|
-
|
431
|
-
const { result } = renderHook(
|
432
|
-
() =>
|
433
|
-
useModularDrawerVisibility({
|
434
|
-
modularDrawerFeatureFlagKey: "llmModularDrawer",
|
435
|
-
}),
|
436
|
-
{
|
437
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
438
|
-
},
|
439
|
-
);
|
440
|
-
|
441
|
-
expect(
|
442
|
-
result.current.isModularDrawerVisible({
|
443
|
-
location: ModularDrawerLocation.LIVE_APP,
|
444
|
-
liveAppId: "earn",
|
445
|
-
}),
|
446
|
-
).toBe(true);
|
447
|
-
});
|
448
|
-
|
449
|
-
it("should return false for blacklisted apps even if whitelisted", () => {
|
450
|
-
const mockedFeatures = {
|
451
|
-
llmModularDrawer: {
|
452
|
-
enabled: true,
|
453
|
-
params: {
|
454
|
-
[ModularDrawerLocation.LIVE_APP]: true,
|
455
|
-
live_apps_allowlist: ["earn", "swap"],
|
456
|
-
live_apps_blocklist: ["swap"],
|
457
|
-
},
|
458
|
-
},
|
459
|
-
};
|
460
|
-
|
461
|
-
const { result } = renderHook(
|
462
|
-
() =>
|
463
|
-
useModularDrawerVisibility({
|
464
|
-
modularDrawerFeatureFlagKey: "llmModularDrawer",
|
465
|
-
}),
|
466
|
-
{
|
467
|
-
wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
|
468
|
-
},
|
469
|
-
);
|
470
|
-
|
471
|
-
expect(
|
472
|
-
result.current.isModularDrawerVisible({
|
473
|
-
location: ModularDrawerLocation.LIVE_APP,
|
474
|
-
liveAppId: "swap",
|
475
|
-
}),
|
476
|
-
).toBe(false);
|
477
|
-
});
|
142
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
|
143
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.EARN_FLOW)).toBe(true);
|
144
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.RECEIVE_FLOW)).toBe(true);
|
145
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.LIVE_APP)).toBe(false);
|
146
|
+
expect(result.current.isModularDrawerVisible(ModularDrawerLocation.SEND_FLOW)).toBe(false);
|
478
147
|
});
|
479
148
|
});
|
480
149
|
});
|
@@ -4,10 +4,6 @@ import { ModularDrawerLocation } from "./enums";
|
|
4
4
|
|
5
5
|
type ModularDrawerFeatureFlagKey = "lldModularDrawer" | "llmModularDrawer";
|
6
6
|
|
7
|
-
export type ModularDrawerVisibleParams =
|
8
|
-
| { location: ModularDrawerLocation.LIVE_APP; liveAppId: string }
|
9
|
-
| { location: Exclude<ModularDrawerLocation, ModularDrawerLocation.LIVE_APP> };
|
10
|
-
|
11
7
|
export function useModularDrawerVisibility({
|
12
8
|
modularDrawerFeatureFlagKey,
|
13
9
|
}: {
|
@@ -16,29 +12,9 @@ export function useModularDrawerVisibility({
|
|
16
12
|
const featureModularDrawer = useFeature(modularDrawerFeatureFlagKey);
|
17
13
|
|
18
14
|
const isModularDrawerVisible = useCallback(
|
19
|
-
(
|
15
|
+
(location: ModularDrawerLocation) => {
|
20
16
|
if (!featureModularDrawer?.enabled) return false;
|
21
|
-
|
22
|
-
if (params.location === ModularDrawerLocation.LIVE_APP) {
|
23
|
-
const isLiveAppEnabled = featureModularDrawer.params?.[params.location] ?? false;
|
24
|
-
if (!isLiveAppEnabled) return false;
|
25
|
-
|
26
|
-
const { liveAppId } = params;
|
27
|
-
const allowed = featureModularDrawer.params?.live_apps_allowlist ?? [];
|
28
|
-
const blocked = featureModularDrawer.params?.live_apps_blocklist ?? [];
|
29
|
-
|
30
|
-
if (allowed.length > 0 && !allowed.includes(liveAppId)) {
|
31
|
-
return false;
|
32
|
-
}
|
33
|
-
|
34
|
-
if (blocked.includes(liveAppId)) {
|
35
|
-
return false;
|
36
|
-
}
|
37
|
-
|
38
|
-
return true;
|
39
|
-
}
|
40
|
-
|
41
|
-
return featureModularDrawer.params?.[params.location] ?? false;
|
17
|
+
return featureModularDrawer.params?.[location] ?? false;
|
42
18
|
},
|
43
19
|
[featureModularDrawer],
|
44
20
|
);
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
-
import type { Operation, SyncConfig, TokenAccount } from "@ledgerhq/types-live";
|
3
|
-
import { AssetInfo, Balance } from "@ledgerhq/coin-framework/api/types";
|
4
|
-
export interface OperationCommon extends Operation {
|
5
|
-
extra: Record<string, any>;
|
6
|
-
}
|
7
|
-
export declare const getAssetIdFromTokenId: (tokenId: string) => string;
|
8
|
-
export declare const getAssetIdFromAsset: (asset: AssetInfo) => string;
|
9
|
-
export declare function buildSubAccounts({ currency, accountId, assetsBalance, syncConfig, operations, }: {
|
10
|
-
currency: CryptoCurrency;
|
11
|
-
accountId: string;
|
12
|
-
assetsBalance: Balance[];
|
13
|
-
syncConfig: SyncConfig;
|
14
|
-
operations: OperationCommon[];
|
15
|
-
}): TokenAccount[] | undefined;
|
16
|
-
export declare function findToken(currency: CryptoCurrency, balance: Balance): TokenCurrency | undefined;
|
17
|
-
//# sourceMappingURL=buildSubAccounts.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"buildSubAccounts.d.ts","sourceRoot":"","sources":["../../../src/bridge/generic-alpaca/buildSubAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAGxE,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,YAAa,MAAM,KAAG,MAA+B,CAAC;AAExF,eAAO,MAAM,mBAAmB,UAAW,SAAS,WAG5C,CAAC;AA8CT,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B,GAAG,YAAY,EAAE,GAAG,SAAS,CA6B7B;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAE/F"}
|
@@ -1,75 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.findToken = exports.buildSubAccounts = exports.getAssetIdFromAsset = exports.getAssetIdFromTokenId = void 0;
|
7
|
-
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
8
|
-
const index_1 = require("@ledgerhq/coin-framework/account/index");
|
9
|
-
const operation_1 = require("@ledgerhq/coin-framework/operation");
|
10
|
-
const cryptoassets_1 = require("@ledgerhq/cryptoassets");
|
11
|
-
const tokens_1 = require("@ledgerhq/cryptoassets/tokens");
|
12
|
-
const getAssetIdFromTokenId = (tokenId) => tokenId.split("/")[2];
|
13
|
-
exports.getAssetIdFromTokenId = getAssetIdFromTokenId;
|
14
|
-
const getAssetIdFromAsset = (asset) => asset.type !== "native" && "assetReference" in asset && "assetOwner" in asset
|
15
|
-
? `${asset.assetReference}:${asset.assetOwner}`
|
16
|
-
: "";
|
17
|
-
exports.getAssetIdFromAsset = getAssetIdFromAsset;
|
18
|
-
function buildTokenAccount({ parentAccountId, assetBalance, token, operations, }) {
|
19
|
-
const assetId = (0, exports.getAssetIdFromTokenId)(token.id);
|
20
|
-
const id = `${parentAccountId}+${assetId}`;
|
21
|
-
const balance = new bignumber_js_1.default(assetBalance.value.toString() || "0");
|
22
|
-
// TODO: recheck this logic
|
23
|
-
const spendableBalance = new bignumber_js_1.default(assetBalance.value.toString()).minus(new bignumber_js_1.default(assetBalance.locked?.toString() || "0"));
|
24
|
-
const tokenOperations = operations.map(op => ({
|
25
|
-
...op,
|
26
|
-
id: (0, operation_1.encodeOperationId)(id, op.hash, op.extra?.ledgerOpType),
|
27
|
-
accountId: id,
|
28
|
-
type: op.extra?.ledgerOpType,
|
29
|
-
value: op.extra?.assetAmount ? new bignumber_js_1.default(op.extra?.assetAmount) : op.value,
|
30
|
-
}));
|
31
|
-
return {
|
32
|
-
type: "TokenAccount",
|
33
|
-
id,
|
34
|
-
parentId: parentAccountId,
|
35
|
-
token,
|
36
|
-
operationsCount: operations.length,
|
37
|
-
operations: tokenOperations,
|
38
|
-
pendingOperations: [],
|
39
|
-
balance,
|
40
|
-
spendableBalance: spendableBalance,
|
41
|
-
swapHistory: [],
|
42
|
-
creationDate: operations.length > 0 ? operations[operations.length - 1].date : new Date(),
|
43
|
-
balanceHistoryCache: index_1.emptyHistoryCache, // calculated in the jsHelpers
|
44
|
-
};
|
45
|
-
}
|
46
|
-
function buildSubAccounts({ currency, accountId, assetsBalance, syncConfig, operations, }) {
|
47
|
-
const { blacklistedTokenIds = [] } = syncConfig;
|
48
|
-
const allTokens = (0, cryptoassets_1.listTokensForCryptoCurrency)(currency);
|
49
|
-
if (allTokens.length === 0 || assetsBalance.length === 0) {
|
50
|
-
return undefined;
|
51
|
-
}
|
52
|
-
const tokenAccounts = [];
|
53
|
-
assetsBalance
|
54
|
-
.filter(b => b.asset.type !== "native") // NOTE: this could be removed, keeping here while fixing things up
|
55
|
-
.map(balance => {
|
56
|
-
const token = findToken(currency, balance);
|
57
|
-
// NOTE: for future tokens, will need to check over currencyName/standard(erc20,trc10,trc20, etc)/id
|
58
|
-
if (token && !blacklistedTokenIds.includes(token.id)) {
|
59
|
-
tokenAccounts.push(buildTokenAccount({
|
60
|
-
parentAccountId: accountId,
|
61
|
-
assetBalance: balance,
|
62
|
-
token,
|
63
|
-
operations: operations.filter(op => op.extra.assetReference === balance.asset?.["assetReference"] &&
|
64
|
-
op.extra.assetOwner === balance.asset?.["assetOwner"]),
|
65
|
-
}));
|
66
|
-
}
|
67
|
-
});
|
68
|
-
return tokenAccounts;
|
69
|
-
}
|
70
|
-
exports.buildSubAccounts = buildSubAccounts;
|
71
|
-
function findToken(currency, balance) {
|
72
|
-
return (0, tokens_1.findTokenById)(`${currency.family}/asset/${(0, exports.getAssetIdFromAsset)(balance.asset)}`);
|
73
|
-
}
|
74
|
-
exports.findToken = findToken;
|
75
|
-
//# sourceMappingURL=buildSubAccounts.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"buildSubAccounts.js","sourceRoot":"","sources":["../../../src/bridge/generic-alpaca/buildSubAccounts.ts"],"names":[],"mappings":"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"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../../src/bridge/generic-alpaca/tests/utils.test.ts"],"names":[],"mappings":""}
|