@ledgerhq/live-common 34.47.0-nightly.1 → 34.47.0-nightly.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bridge/crypto-assets/cal-integration.d.ts +4 -0
- package/lib/bridge/crypto-assets/cal-integration.d.ts.map +1 -0
- package/lib/bridge/crypto-assets/cal-integration.js +26 -0
- package/lib/bridge/crypto-assets/cal-integration.js.map +1 -0
- package/lib/bridge/crypto-assets/cal-integration.test.d.ts +2 -0
- package/lib/bridge/crypto-assets/cal-integration.test.d.ts.map +1 -0
- package/lib/bridge/crypto-assets/cal-integration.test.js +45 -0
- package/lib/bridge/crypto-assets/cal-integration.test.js.map +1 -0
- package/lib/bridge/crypto-assets/cal-store.d.ts +14 -0
- package/lib/bridge/crypto-assets/cal-store.d.ts.map +1 -0
- package/lib/bridge/crypto-assets/cal-store.js +42 -0
- package/lib/bridge/crypto-assets/cal-store.js.map +1 -0
- package/lib/bridge/crypto-assets/cal-store.test.d.ts +2 -0
- package/lib/bridge/crypto-assets/cal-store.test.d.ts.map +1 -0
- package/lib/bridge/crypto-assets/cal-store.test.js +70 -0
- package/lib/bridge/crypto-assets/cal-store.test.js.map +1 -0
- package/lib/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib/bridge/crypto-assets/index.js +4 -0
- package/lib/bridge/crypto-assets/index.js.map +1 -1
- package/lib/bridge/crypto-assets/index.test.js +36 -0
- package/lib/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts +2 -3
- package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.js +3 -12
- package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +4 -4
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +1 -0
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +1 -0
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/families/tezos.d.ts.map +1 -1
- package/lib/e2e/families/tezos.js +2 -0
- package/lib/e2e/families/tezos.js.map +1 -1
- package/lib/e2e/index.d.ts +4 -4
- package/lib/exchange/platform/transfer/completeExchange.d.ts.map +1 -1
- package/lib/exchange/platform/transfer/completeExchange.js +3 -5
- package/lib/exchange/platform/transfer/completeExchange.js.map +1 -1
- package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib/exchange/swap/completeExchange.js +5 -2
- package/lib/exchange/swap/completeExchange.js.map +1 -1
- package/lib/exchange/swap/initSwap.d.ts.map +1 -1
- package/lib/exchange/swap/initSwap.js +5 -2
- package/lib/exchange/swap/initSwap.js.map +1 -1
- package/lib/families/solana/setup.d.ts.map +1 -1
- package/lib/families/solana/setup.js +9 -0
- package/lib/families/solana/setup.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -1
- 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/modularDrawer/__mocks__/dada.mock.d.ts +3336 -0
- package/lib/modularDrawer/__mocks__/dada.mock.d.ts.map +1 -0
- package/lib/modularDrawer/__mocks__/dada.mock.js +3879 -0
- package/lib/modularDrawer/__mocks__/dada.mock.js.map +1 -0
- package/lib/modularDrawer/utils/getLoadingStatus.d.ts +9 -0
- package/lib/modularDrawer/utils/getLoadingStatus.d.ts.map +1 -0
- package/lib/modularDrawer/utils/getLoadingStatus.js +18 -0
- package/lib/modularDrawer/utils/getLoadingStatus.js.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-integration.d.ts +4 -0
- package/lib-es/bridge/crypto-assets/cal-integration.d.ts.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-integration.js +21 -0
- package/lib-es/bridge/crypto-assets/cal-integration.js.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts +2 -0
- package/lib-es/bridge/crypto-assets/cal-integration.test.d.ts.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-integration.test.js +43 -0
- package/lib-es/bridge/crypto-assets/cal-integration.test.js.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-store.d.ts +14 -0
- package/lib-es/bridge/crypto-assets/cal-store.d.ts.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-store.js +38 -0
- package/lib-es/bridge/crypto-assets/cal-store.js.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-store.test.d.ts +2 -0
- package/lib-es/bridge/crypto-assets/cal-store.test.d.ts.map +1 -0
- package/lib-es/bridge/crypto-assets/cal-store.test.js +68 -0
- package/lib-es/bridge/crypto-assets/cal-store.test.js.map +1 -0
- package/lib-es/bridge/crypto-assets/index.d.ts.map +1 -1
- package/lib-es/bridge/crypto-assets/index.js +4 -0
- package/lib-es/bridge/crypto-assets/index.js.map +1 -1
- package/lib-es/bridge/crypto-assets/index.test.js +36 -0
- package/lib-es/bridge/crypto-assets/index.test.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +2 -3
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +2 -9
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +3 -3
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +1 -0
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +1 -0
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/families/tezos.d.ts.map +1 -1
- package/lib-es/e2e/families/tezos.js +2 -0
- package/lib-es/e2e/families/tezos.js.map +1 -1
- package/lib-es/e2e/index.d.ts +4 -4
- package/lib-es/exchange/platform/transfer/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/platform/transfer/completeExchange.js +3 -2
- package/lib-es/exchange/platform/transfer/completeExchange.js.map +1 -1
- package/lib-es/exchange/swap/completeExchange.d.ts.map +1 -1
- package/lib-es/exchange/swap/completeExchange.js +5 -2
- package/lib-es/exchange/swap/completeExchange.js.map +1 -1
- package/lib-es/exchange/swap/initSwap.d.ts.map +1 -1
- package/lib-es/exchange/swap/initSwap.js +5 -2
- package/lib-es/exchange/swap/initSwap.js.map +1 -1
- package/lib-es/families/solana/setup.d.ts.map +1 -1
- package/lib-es/families/solana/setup.js +9 -0
- package/lib-es/families/solana/setup.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -1
- 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/modularDrawer/__mocks__/dada.mock.d.ts +3336 -0
- package/lib-es/modularDrawer/__mocks__/dada.mock.d.ts.map +1 -0
- package/lib-es/modularDrawer/__mocks__/dada.mock.js +3876 -0
- package/lib-es/modularDrawer/__mocks__/dada.mock.js.map +1 -0
- package/lib-es/modularDrawer/utils/getLoadingStatus.d.ts +9 -0
- package/lib-es/modularDrawer/utils/getLoadingStatus.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/getLoadingStatus.js +14 -0
- package/lib-es/modularDrawer/utils/getLoadingStatus.js.map +1 -0
- package/package.json +45 -45
- package/src/bridge/crypto-assets/cal-integration.test.ts +53 -0
- package/src/bridge/crypto-assets/cal-integration.ts +23 -0
- package/src/bridge/crypto-assets/cal-store.test.ts +93 -0
- package/src/bridge/crypto-assets/cal-store.ts +46 -0
- package/src/bridge/crypto-assets/index.test.ts +47 -0
- package/src/bridge/crypto-assets/index.ts +5 -0
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +1 -1
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +3 -11
- package/src/bridge/generic-alpaca/getAccountShape.ts +3 -4
- package/src/e2e/enum/DeviceLabels.ts +1 -0
- package/src/e2e/families/tezos.ts +2 -0
- package/src/exchange/platform/transfer/completeExchange.ts +3 -2
- package/src/exchange/swap/completeExchange.ts +5 -2
- package/src/exchange/swap/initSwap.ts +5 -4
- package/src/families/solana/setup.ts +9 -0
- package/src/featureFlags/defaultFeatures.ts +1 -1
- package/src/modularDrawer/__mocks__/dada.mock.ts +3890 -0
- package/src/modularDrawer/utils/getLoadingStatus.ts +24 -0
@@ -2,8 +2,22 @@ import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
|
2
2
|
import { getCryptoAssetsStore, setCryptoAssetsStore } from ".";
|
3
3
|
import * as legacy from "@ledgerhq/cryptoassets/tokens";
|
4
4
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
5
|
+
import * as calIntegration from "./cal-integration";
|
5
6
|
|
6
7
|
describe("Testing CryptoAssetStore", () => {
|
8
|
+
let isCALIntegrationEnabledSpy: jest.SpyInstance;
|
9
|
+
let getCALStoreSpy: jest.SpyInstance;
|
10
|
+
|
11
|
+
beforeEach(() => {
|
12
|
+
isCALIntegrationEnabledSpy = jest
|
13
|
+
.spyOn(calIntegration, "isCALIntegrationEnabled")
|
14
|
+
.mockReturnValue(false);
|
15
|
+
getCALStoreSpy = jest.spyOn(calIntegration, "getCALStore");
|
16
|
+
});
|
17
|
+
|
18
|
+
afterEach(() => {
|
19
|
+
jest.restoreAllMocks();
|
20
|
+
});
|
7
21
|
it("should return the default methods from cryptoassets libs when feature flag does not exists", () => {
|
8
22
|
LiveConfig.setConfig({
|
9
23
|
some_other_feature: {
|
@@ -68,4 +82,37 @@ describe("Testing CryptoAssetStore", () => {
|
|
68
82
|
const store = getCryptoAssetsStore();
|
69
83
|
expect(store).toBe(newStore);
|
70
84
|
});
|
85
|
+
|
86
|
+
it("should return CAL store when CAL integration is enabled", () => {
|
87
|
+
isCALIntegrationEnabledSpy.mockReturnValue(true);
|
88
|
+
|
89
|
+
const mockCALStore = {} as unknown as CryptoAssetsStore;
|
90
|
+
getCALStoreSpy.mockReturnValue(mockCALStore);
|
91
|
+
|
92
|
+
const store = getCryptoAssetsStore();
|
93
|
+
|
94
|
+
expect(isCALIntegrationEnabledSpy).toHaveBeenCalled();
|
95
|
+
expect(getCALStoreSpy).toHaveBeenCalled();
|
96
|
+
expect(store).toBe(mockCALStore);
|
97
|
+
});
|
98
|
+
|
99
|
+
it("should prioritize CAL integration over feature flags", () => {
|
100
|
+
isCALIntegrationEnabledSpy.mockReturnValue(true);
|
101
|
+
|
102
|
+
LiveConfig.setConfig({
|
103
|
+
feature_cal_lazy_loading: {
|
104
|
+
type: "boolean",
|
105
|
+
default: true,
|
106
|
+
},
|
107
|
+
});
|
108
|
+
|
109
|
+
const mockCALStore = {} as unknown as CryptoAssetsStore;
|
110
|
+
getCALStoreSpy.mockReturnValue(mockCALStore);
|
111
|
+
|
112
|
+
const store = getCryptoAssetsStore();
|
113
|
+
|
114
|
+
expect(store).toBe(mockCALStore);
|
115
|
+
expect(isCALIntegrationEnabledSpy).toHaveBeenCalled();
|
116
|
+
expect(getCALStoreSpy).toHaveBeenCalled();
|
117
|
+
});
|
71
118
|
});
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
2
2
|
import * as legacy from "@ledgerhq/cryptoassets/tokens";
|
3
3
|
import type { CryptoAssetsStore } from "@ledgerhq/types-live";
|
4
|
+
import { isCALIntegrationEnabled, getCALStore } from "./cal-integration";
|
4
5
|
|
5
6
|
const legacyStore: CryptoAssetsStore = {
|
6
7
|
findTokenByAddress: legacy.findTokenByAddress,
|
@@ -17,6 +18,10 @@ export function setCryptoAssetsStore(store: CryptoAssetsStore) {
|
|
17
18
|
}
|
18
19
|
|
19
20
|
export function getCryptoAssetsStore(): CryptoAssetsStore {
|
21
|
+
if (isCALIntegrationEnabled()) {
|
22
|
+
return getCALStore();
|
23
|
+
}
|
24
|
+
|
20
25
|
const featureEnabled =
|
21
26
|
LiveConfig.isConfigSet() && LiveConfig.getValueByKey("feature_cal_lazy_loading");
|
22
27
|
if (!featureEnabled) {
|
@@ -134,7 +134,7 @@ const buildGetSequence = (networkFamily: string) =>
|
|
134
134
|
const buildListOperations = networkFamily =>
|
135
135
|
async function listOperations(
|
136
136
|
address: string,
|
137
|
-
pagination: Pagination = { minHeight: 0 },
|
137
|
+
pagination: Pagination = { minHeight: 0, order: "asc" },
|
138
138
|
): Promise<[Operation<any>[], string]> {
|
139
139
|
const { data } = await network<{ operations: Operation<any>[] }, unknown>({
|
140
140
|
method: "GET",
|
@@ -5,7 +5,6 @@ import type { Operation, SyncConfig, TokenAccount } from "@ledgerhq/types-live";
|
|
5
5
|
import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
|
6
6
|
import { listTokensForCryptoCurrency } from "@ledgerhq/cryptoassets";
|
7
7
|
import { AssetInfo, Balance } from "@ledgerhq/coin-framework/api/types";
|
8
|
-
import { findTokenById } from "@ledgerhq/cryptoassets/tokens";
|
9
8
|
|
10
9
|
export interface OperationCommon extends Operation {
|
11
10
|
extra: Record<string, any>;
|
@@ -13,11 +12,6 @@ export interface OperationCommon extends Operation {
|
|
13
12
|
|
14
13
|
export const getAssetIdFromTokenId = (tokenId: string): string => tokenId.split("/")[2];
|
15
14
|
|
16
|
-
export const getAssetIdFromAsset = (asset: AssetInfo) =>
|
17
|
-
asset.type !== "native" && "assetReference" in asset && "assetOwner" in asset
|
18
|
-
? `${asset.assetReference}:${asset.assetOwner}`
|
19
|
-
: "";
|
20
|
-
|
21
15
|
function buildTokenAccount({
|
22
16
|
parentAccountId,
|
23
17
|
assetBalance,
|
@@ -68,12 +62,14 @@ export function buildSubAccounts({
|
|
68
62
|
assetsBalance,
|
69
63
|
syncConfig,
|
70
64
|
operations,
|
65
|
+
getTokenFromAsset,
|
71
66
|
}: {
|
72
67
|
currency: CryptoCurrency;
|
73
68
|
accountId: string;
|
74
69
|
assetsBalance: Balance[];
|
75
70
|
syncConfig: SyncConfig;
|
76
71
|
operations: OperationCommon[];
|
72
|
+
getTokenFromAsset?: (asset: AssetInfo) => TokenCurrency | undefined;
|
77
73
|
}): TokenAccount[] | undefined {
|
78
74
|
const { blacklistedTokenIds = [] } = syncConfig;
|
79
75
|
const allTokens = listTokensForCryptoCurrency(currency);
|
@@ -85,7 +81,7 @@ export function buildSubAccounts({
|
|
85
81
|
assetsBalance
|
86
82
|
.filter(b => b.asset.type !== "native") // NOTE: this could be removed, keeping here while fixing things up
|
87
83
|
.map(balance => {
|
88
|
-
const token =
|
84
|
+
const token = getTokenFromAsset && getTokenFromAsset(balance.asset);
|
89
85
|
// NOTE: for future tokens, will need to check over currencyName/standard(erc20,trc10,trc20, etc)/id
|
90
86
|
if (token && !blacklistedTokenIds.includes(token.id)) {
|
91
87
|
tokenAccounts.push(
|
@@ -104,7 +100,3 @@ export function buildSubAccounts({
|
|
104
100
|
});
|
105
101
|
return tokenAccounts;
|
106
102
|
}
|
107
|
-
|
108
|
-
export function findToken(currency: CryptoCurrency, balance: Balance): TokenCurrency | undefined {
|
109
|
-
return findTokenById(`${currency.family}/asset/${getAssetIdFromAsset(balance.asset)}`);
|
110
|
-
}
|
@@ -4,7 +4,6 @@ import BigNumber from "bignumber.js";
|
|
4
4
|
import { getAlpacaApi } from "./alpaca";
|
5
5
|
import { adaptCoreOperationToLiveOperation, extractBalance } from "./utils";
|
6
6
|
import { inferSubOperations } from "@ledgerhq/coin-framework/serialization";
|
7
|
-
import { findToken } from "./buildSubAccounts";
|
8
7
|
import { buildSubAccounts, OperationCommon } from "./buildSubAccounts";
|
9
8
|
|
10
9
|
export function genericGetAccountShape(network: string, kind: string): GetAccountShape {
|
@@ -33,8 +32,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
33
32
|
|
34
33
|
const assetsBalance = balanceRes
|
35
34
|
.filter(b => b.asset.type !== "native")
|
36
|
-
.filter(b =>
|
37
|
-
|
35
|
+
.filter(b => alpacaApi.getTokenFromAsset && alpacaApi.getTokenFromAsset(b.asset));
|
38
36
|
const nativeBalance = BigInt(nativeAsset?.value ?? "0");
|
39
37
|
|
40
38
|
const spendableBalance = BigInt(nativeBalance - BigInt(nativeAsset?.locked ?? "0"));
|
@@ -43,7 +41,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
43
41
|
const lastPagingToken = oldOps[0]?.extra?.pagingToken || "";
|
44
42
|
|
45
43
|
const blockHeight = oldOps.length ? (oldOps[0].blockHeight ?? 0) + 1 : 0;
|
46
|
-
const paginationParams: any = { minHeight: blockHeight };
|
44
|
+
const paginationParams: any = { minHeight: blockHeight, order: "asc" };
|
47
45
|
if (lastPagingToken) {
|
48
46
|
paginationParams.lastPagingToken = lastPagingToken;
|
49
47
|
}
|
@@ -72,6 +70,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
72
70
|
assetsBalance,
|
73
71
|
syncConfig,
|
74
72
|
operations: assetOperations,
|
73
|
+
getTokenFromAsset: alpacaApi.getTokenFromAsset,
|
75
74
|
}) || [];
|
76
75
|
|
77
76
|
const operationsWithSubs = mergedOps.map(op => {
|
@@ -3,6 +3,8 @@ import { DeviceLabels } from "../enum/DeviceLabels";
|
|
3
3
|
|
4
4
|
export async function delegateTezos() {
|
5
5
|
await waitFor(DeviceLabels.REVIEW_OPERATION);
|
6
|
+
await pressUntilTextFound(DeviceLabels.ACCEPT_RISK);
|
7
|
+
await pressBoth();
|
6
8
|
await pressUntilTextFound(DeviceLabels.ACCEPT);
|
7
9
|
await pressBoth();
|
8
10
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import secp256k1 from "secp256k1";
|
1
|
+
import { secp256k1 } from "@noble/curves/secp256k1";
|
2
2
|
import { firstValueFrom, from, Observable } from "rxjs";
|
3
3
|
import { TransportStatusError, WrongDeviceForAccount } from "@ledgerhq/errors";
|
4
4
|
|
@@ -187,7 +187,8 @@ function convertSignature(signature: string, exchangeType: ExchangeTypes): Buffe
|
|
187
187
|
return Buffer.from(base64Signature, "base64");
|
188
188
|
}
|
189
189
|
if (exchangeType === ExchangeTypes.Sell) return Buffer.from(signature, "hex");
|
190
|
-
|
190
|
+
const sig = secp256k1.Signature.fromCompact(Buffer.from(signature, "hex"));
|
191
|
+
return Buffer.from(sig.toDERRawBytes());
|
191
192
|
}
|
192
193
|
|
193
194
|
export default completeExchange;
|
@@ -14,7 +14,7 @@ import { getDefaultAccountName } from "@ledgerhq/live-wallet/accountName";
|
|
14
14
|
import { log } from "@ledgerhq/logs";
|
15
15
|
import BigNumber from "bignumber.js";
|
16
16
|
import { Observable } from "rxjs";
|
17
|
-
import secp256k1 from "secp256k1";
|
17
|
+
import { secp256k1 } from "@noble/curves/secp256k1";
|
18
18
|
import { getCurrencyExchangeConfig } from "../";
|
19
19
|
import { getAccountCurrency, getMainAccount } from "../../account";
|
20
20
|
import { getAccountBridge } from "../../bridge";
|
@@ -271,7 +271,10 @@ const completeExchange = (
|
|
271
271
|
function convertSignature(signature: string, exchangeType: ExchangeTypes): Buffer {
|
272
272
|
return exchangeType === ExchangeTypes.SwapNg
|
273
273
|
? base64UrlDecode(signature)
|
274
|
-
:
|
274
|
+
: (() => {
|
275
|
+
const sig = secp256k1.Signature.fromCompact(Buffer.from(signature, "hex"));
|
276
|
+
return Buffer.from(sig.toDERRawBytes());
|
277
|
+
})();
|
275
278
|
}
|
276
279
|
|
277
280
|
function base64UrlDecode(base64Url: string): Buffer {
|
@@ -14,7 +14,7 @@ import { log } from "@ledgerhq/logs";
|
|
14
14
|
import { BigNumber } from "bignumber.js";
|
15
15
|
import invariant from "invariant";
|
16
16
|
import { firstValueFrom, from, Observable } from "rxjs";
|
17
|
-
import secp256k1 from "secp256k1";
|
17
|
+
import { secp256k1 } from "@noble/curves/secp256k1";
|
18
18
|
import { getCurrencyExchangeConfig } from "../";
|
19
19
|
import { getAccountCurrency, getMainAccount } from "../../account";
|
20
20
|
import { getAccountBridge } from "../../bridge";
|
@@ -184,9 +184,10 @@ const initSwap = (input: InitSwapInput): Observable<SwapRequestEvent> => {
|
|
184
184
|
|
185
185
|
await swap.processTransaction(Buffer.from(swapResult.binaryPayload, "hex"), estimatedFees);
|
186
186
|
if (unsubscribed) return;
|
187
|
-
const goodSign = <Buffer>(
|
188
|
-
secp256k1.
|
189
|
-
|
187
|
+
const goodSign = <Buffer>(() => {
|
188
|
+
const sig = secp256k1.Signature.fromCompact(Buffer.from(swapResult.signature, "hex"));
|
189
|
+
return Buffer.from(sig.toDERRawBytes());
|
190
|
+
})();
|
190
191
|
await swap.checkTransactionSignature(goodSign);
|
191
192
|
if (unsubscribed) return;
|
192
193
|
const mainPayoutCurrency = getAccountCurrency(payoutAccount);
|
@@ -19,6 +19,8 @@ import { SolanaCoinConfig } from "@ledgerhq/coin-solana/config";
|
|
19
19
|
import { getCryptoCurrencyById } from "../../currencies";
|
20
20
|
import { signMessage } from "@ledgerhq/coin-solana/hw-signMessage";
|
21
21
|
import { LegacySignerSolana } from "@ledgerhq/live-signer-solana";
|
22
|
+
import { setShouldSkipTokenLoading } from "@ledgerhq/coin-solana/preload";
|
23
|
+
import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
|
22
24
|
import { getCryptoAssetsStore } from "../../bridge/crypto-assets";
|
23
25
|
|
24
26
|
const createSigner: CreateSigner<SolanaSigner> = (transport: Transport) =>
|
@@ -28,6 +30,13 @@ const getCurrencyConfig = () => {
|
|
28
30
|
return getCurrencyConfiguration<SolanaCoinConfig>(getCryptoCurrencyById("solana"));
|
29
31
|
};
|
30
32
|
|
33
|
+
try {
|
34
|
+
const isCALLazyLoadingEnabled = LiveConfig.getValueByKey("feature_cal_lazy_loading");
|
35
|
+
setShouldSkipTokenLoading(Boolean(isCALLazyLoadingEnabled));
|
36
|
+
} catch (error) {
|
37
|
+
setShouldSkipTokenLoading(false);
|
38
|
+
}
|
39
|
+
|
31
40
|
const bridge: Bridge<Transaction, SolanaAccount, TransactionStatus> = createBridges(
|
32
41
|
executeWithSigner(createSigner),
|
33
42
|
getCurrencyConfig,
|
@@ -108,6 +108,7 @@ export const DEFAULT_FEATURES: Features = {
|
|
108
108
|
postOnboardingAssetsTransfer: DEFAULT_FEATURE,
|
109
109
|
counterValue: DEFAULT_FEATURE,
|
110
110
|
mockFeature: DEFAULT_FEATURE,
|
111
|
+
calLedgerService: DEFAULT_FEATURE,
|
111
112
|
ptxServiceCtaExchangeDrawer: DEFAULT_FEATURE,
|
112
113
|
ptxServiceCtaScreens: DEFAULT_FEATURE,
|
113
114
|
ptxSwapReceiveTRC20WithoutTrx: DEFAULT_FEATURE,
|
@@ -625,7 +626,6 @@ export const DEFAULT_FEATURES: Features = {
|
|
625
626
|
},
|
626
627
|
},
|
627
628
|
lldModularDrawerBackendData: DEFAULT_FEATURE,
|
628
|
-
llmModularDrawerBackendData: DEFAULT_FEATURE,
|
629
629
|
llmModularDrawer: {
|
630
630
|
...DEFAULT_FEATURE,
|
631
631
|
params: {
|