@ledgerhq/live-common 34.44.0-nightly.4 → 34.44.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/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +1 -3
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +0 -6
- package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib/device/use-cases/listAppsUseCase.test.js +2 -2
- package/lib/device/use-cases/listAppsUseCase.test.js.map +1 -1
- package/lib/e2e/index.d.ts +0 -2
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/exchange/swap/hooks/usePickDefaultAccount.test.js +10 -22
- package/lib/exchange/swap/hooks/usePickDefaultAccount.test.js.map +1 -1
- package/lib/exchange/swap/postSwapState.d.ts.map +1 -1
- package/lib/exchange/swap/postSwapState.js +4 -63
- package/lib/exchange/swap/postSwapState.js.map +1 -1
- package/lib/exchange/swap/setBroadcastTransaction.d.ts +1 -4
- package/lib/exchange/swap/setBroadcastTransaction.d.ts.map +1 -1
- package/lib/exchange/swap/setBroadcastTransaction.js +1 -7
- package/lib/exchange/swap/setBroadcastTransaction.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +0 -7
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +0 -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/hw/customLockScreenLoad.d.ts +9 -1
- package/lib/hw/customLockScreenLoad.d.ts.map +1 -1
- package/lib/hw/customLockScreenLoad.js +1 -5
- package/lib/hw/customLockScreenLoad.js.map +1 -1
- package/lib/modularDrawer/utils/index.d.ts +1 -2
- package/lib/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib/modularDrawer/utils/index.js +1 -3
- package/lib/modularDrawer/utils/index.js.map +1 -1
- package/lib/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib/wallet-api/Exchange/server.js +0 -10
- package/lib/wallet-api/Exchange/server.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +1 -3
- 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 +0 -6
- package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
- package/lib-es/device/use-cases/listAppsUseCase.test.js +1 -1
- package/lib-es/device/use-cases/listAppsUseCase.test.js.map +1 -1
- package/lib-es/e2e/index.d.ts +0 -2
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/exchange/swap/hooks/usePickDefaultAccount.test.js +9 -21
- package/lib-es/exchange/swap/hooks/usePickDefaultAccount.test.js.map +1 -1
- package/lib-es/exchange/swap/postSwapState.d.ts.map +1 -1
- package/lib-es/exchange/swap/postSwapState.js +4 -63
- package/lib-es/exchange/swap/postSwapState.js.map +1 -1
- package/lib-es/exchange/swap/setBroadcastTransaction.d.ts +1 -4
- package/lib-es/exchange/swap/setBroadcastTransaction.d.ts.map +1 -1
- package/lib-es/exchange/swap/setBroadcastTransaction.js +1 -7
- package/lib-es/exchange/swap/setBroadcastTransaction.js.map +1 -1
- package/lib-es/exchange/swap/types.d.ts +0 -7
- package/lib-es/exchange/swap/types.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +0 -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/hw/customLockScreenLoad.d.ts +9 -1
- package/lib-es/hw/customLockScreenLoad.d.ts.map +1 -1
- package/lib-es/hw/customLockScreenLoad.js +1 -5
- package/lib-es/hw/customLockScreenLoad.js.map +1 -1
- package/lib-es/modularDrawer/utils/index.d.ts +1 -2
- package/lib-es/modularDrawer/utils/index.d.ts.map +1 -1
- package/lib-es/modularDrawer/utils/index.js +1 -2
- package/lib-es/modularDrawer/utils/index.js.map +1 -1
- package/lib-es/wallet-api/Exchange/server.d.ts.map +1 -1
- package/lib-es/wallet-api/Exchange/server.js +0 -10
- package/lib-es/wallet-api/Exchange/server.js.map +1 -1
- package/package.json +74 -74
- package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +0 -10
- package/src/device/use-cases/listAppsUseCase.test.ts +1 -1
- package/src/exchange/swap/hooks/usePickDefaultAccount.test.ts +12 -25
- package/src/exchange/swap/postSwapState.ts +2 -97
- package/src/exchange/swap/setBroadcastTransaction.ts +0 -12
- package/src/exchange/swap/types.ts +0 -7
- package/src/featureFlags/defaultFeatures.ts +0 -1
- package/src/hw/customLockScreenLoad.ts +11 -7
- package/src/modularDrawer/utils/index.ts +1 -7
- package/src/wallet-api/Exchange/server.ts +0 -10
- package/lib/exchange/swap/hooks/wrapper.d.ts +0 -3
- package/lib/exchange/swap/hooks/wrapper.d.ts.map +0 -1
- package/lib/exchange/swap/hooks/wrapper.js +0 -40
- package/lib/exchange/swap/hooks/wrapper.js.map +0 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.d.ts +0 -20
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.d.ts.map +0 -1
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.js +0 -39
- package/lib/modularDrawer/utils/getBalanceAndFiatValue.js.map +0 -1
- package/lib-es/exchange/swap/hooks/wrapper.d.ts +0 -3
- package/lib-es/exchange/swap/hooks/wrapper.d.ts.map +0 -1
- package/lib-es/exchange/swap/hooks/wrapper.js +0 -13
- package/lib-es/exchange/swap/hooks/wrapper.js.map +0 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.d.ts +0 -20
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.d.ts.map +0 -1
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.js +0 -32
- package/lib-es/modularDrawer/utils/getBalanceAndFiatValue.js.map +0 -1
- package/src/exchange/swap/hooks/wrapper.tsx +0 -18
- package/src/modularDrawer/utils/getBalanceAndFiatValue.ts +0 -53
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ledgerhq/live-common",
|
3
3
|
"description": "Common ground for the Ledger Live apps",
|
4
|
-
"version": "34.44.0
|
4
|
+
"version": "34.44.0",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
@@ -106,11 +106,11 @@
|
|
106
106
|
"@dfinity/agent": "^0.21.0",
|
107
107
|
"@dfinity/candid": "^0.21.0",
|
108
108
|
"@dfinity/principal": "^0.15.6",
|
109
|
-
"@ledgerhq/device-management-kit": "0.0.0-
|
109
|
+
"@ledgerhq/device-management-kit": "0.0.0-io-revamp-20250711135456",
|
110
110
|
"@ledgerhq/live-app-sdk": "^0.8.1",
|
111
|
-
"@ledgerhq/wallet-api-client": "^1.9.
|
112
|
-
"@ledgerhq/wallet-api-core": "^1.21.
|
113
|
-
"@ledgerhq/wallet-api-server": "^1.10.
|
111
|
+
"@ledgerhq/wallet-api-client": "^1.9.0",
|
112
|
+
"@ledgerhq/wallet-api-core": "^1.21.0",
|
113
|
+
"@ledgerhq/wallet-api-server": "^1.10.0",
|
114
114
|
"@stricahq/typhonjs": "^3.0.0",
|
115
115
|
"@taquito/ledger-signer": "^22.0.0",
|
116
116
|
"@ton-community/ton-ledger": "^7.2.0",
|
@@ -162,76 +162,76 @@
|
|
162
162
|
"xstate": "^5.19.2",
|
163
163
|
"yargs": "^17.0.0",
|
164
164
|
"zod": "^3.22.4",
|
165
|
-
"@ledgerhq/coin-algorand": "^0.9.16
|
166
|
-
"@ledgerhq/coin-aptos": "^
|
167
|
-
"@ledgerhq/coin-bitcoin": "^0.20.0
|
168
|
-
"@ledgerhq/coin-canton": "^0.2.0
|
169
|
-
"@ledgerhq/coin-cardano": "^0.
|
170
|
-
"@ledgerhq/coin-casper": "^2.0.7
|
171
|
-
"@ledgerhq/coin-celo": "^1.1.14
|
172
|
-
"@ledgerhq/coin-cosmos": "^0.16.5
|
173
|
-
"@ledgerhq/coin-evm": "^2.26.0
|
174
|
-
"@ledgerhq/coin-filecoin": "^1.
|
175
|
-
"@ledgerhq/coin-framework": "^
|
176
|
-
"@ledgerhq/coin-hedera": "^1.
|
177
|
-
"@ledgerhq/coin-icon": "^0.11.3
|
178
|
-
"@ledgerhq/coin-internet_computer": "^1.7.16
|
179
|
-
"@ledgerhq/coin-mina": "^1.1.15
|
180
|
-
"@ledgerhq/coin-multiversx": "^0.4.16
|
181
|
-
"@ledgerhq/coin-near": "^0.
|
182
|
-
"@ledgerhq/coin-polkadot": "^6.6.0
|
183
|
-
"@ledgerhq/coin-solana": "^0.
|
184
|
-
"@ledgerhq/coin-stacks": "^0.8.16
|
185
|
-
"@ledgerhq/coin-stellar": "^
|
186
|
-
"@ledgerhq/coin-sui": "^0.9.0
|
187
|
-
"@ledgerhq/coin-tezos": "^
|
188
|
-
"@ledgerhq/coin-ton": "^0.13.5
|
189
|
-
"@ledgerhq/coin-tron": "^
|
190
|
-
"@ledgerhq/coin-vechain": "^2.
|
191
|
-
"@ledgerhq/coin-xrp": "^
|
192
|
-
"@ledgerhq/crypto-icons-ui": "^1.
|
193
|
-
"@ledgerhq/cryptoassets": "^13.24.0
|
194
|
-
"@ledgerhq/device-core": "^0.5.5
|
195
|
-
"@ledgerhq/devices": "8.4.
|
196
|
-
"@ledgerhq/errors": "^6.
|
197
|
-
"@ledgerhq/hw-app-algorand": "^6.31.
|
198
|
-
"@ledgerhq/hw-app-aptos": "^6.34.
|
199
|
-
"@ledgerhq/hw-app-btc": "^10.10.
|
200
|
-
"@ledgerhq/hw-app-celo": "^6.33.12
|
201
|
-
"@ledgerhq/hw-app-cosmos": "^6.32.
|
202
|
-
"@ledgerhq/hw-app-eth": "^6.45.14
|
203
|
-
"@ledgerhq/hw-app-exchange": "^0.11.
|
204
|
-
"@ledgerhq/hw-app-hedera": "^1.2.
|
205
|
-
"@ledgerhq/hw-app-icon": "^1.3.
|
206
|
-
"@ledgerhq/hw-app-multiversx": "^6.24.
|
207
|
-
"@ledgerhq/hw-app-near": "^6.31.
|
208
|
-
"@ledgerhq/hw-app-polkadot": "^6.34.
|
209
|
-
"@ledgerhq/hw-app-str": "^7.2.
|
165
|
+
"@ledgerhq/coin-algorand": "^0.9.16",
|
166
|
+
"@ledgerhq/coin-aptos": "^3.0.0",
|
167
|
+
"@ledgerhq/coin-bitcoin": "^0.20.0",
|
168
|
+
"@ledgerhq/coin-canton": "^0.2.0",
|
169
|
+
"@ledgerhq/coin-cardano": "^0.11.0",
|
170
|
+
"@ledgerhq/coin-casper": "^2.0.7",
|
171
|
+
"@ledgerhq/coin-celo": "^1.1.14",
|
172
|
+
"@ledgerhq/coin-cosmos": "^0.16.5",
|
173
|
+
"@ledgerhq/coin-evm": "^2.26.0",
|
174
|
+
"@ledgerhq/coin-filecoin": "^1.9.16",
|
175
|
+
"@ledgerhq/coin-framework": "^6.0.0",
|
176
|
+
"@ledgerhq/coin-hedera": "^1.9.2",
|
177
|
+
"@ledgerhq/coin-icon": "^0.11.3",
|
178
|
+
"@ledgerhq/coin-internet_computer": "^1.7.16",
|
179
|
+
"@ledgerhq/coin-mina": "^1.1.15",
|
180
|
+
"@ledgerhq/coin-multiversx": "^0.4.16",
|
181
|
+
"@ledgerhq/coin-near": "^0.11.16",
|
182
|
+
"@ledgerhq/coin-polkadot": "^6.6.0",
|
183
|
+
"@ledgerhq/coin-solana": "^0.30.0",
|
184
|
+
"@ledgerhq/coin-stacks": "^0.8.16",
|
185
|
+
"@ledgerhq/coin-stellar": "^6.0.0",
|
186
|
+
"@ledgerhq/coin-sui": "^0.9.0",
|
187
|
+
"@ledgerhq/coin-tezos": "^6.0.0",
|
188
|
+
"@ledgerhq/coin-ton": "^0.13.5",
|
189
|
+
"@ledgerhq/coin-tron": "^5.0.0",
|
190
|
+
"@ledgerhq/coin-vechain": "^2.8.0",
|
191
|
+
"@ledgerhq/coin-xrp": "^7.0.0",
|
192
|
+
"@ledgerhq/crypto-icons-ui": "^1.16.0",
|
193
|
+
"@ledgerhq/cryptoassets": "^13.24.0",
|
194
|
+
"@ledgerhq/device-core": "^0.5.5",
|
195
|
+
"@ledgerhq/devices": "8.4.8",
|
196
|
+
"@ledgerhq/errors": "^6.23.0",
|
197
|
+
"@ledgerhq/hw-app-algorand": "^6.31.4",
|
198
|
+
"@ledgerhq/hw-app-aptos": "^6.34.4",
|
199
|
+
"@ledgerhq/hw-app-btc": "^10.10.0",
|
200
|
+
"@ledgerhq/hw-app-celo": "^6.33.12",
|
201
|
+
"@ledgerhq/hw-app-cosmos": "^6.32.4",
|
202
|
+
"@ledgerhq/hw-app-eth": "^6.45.14",
|
203
|
+
"@ledgerhq/hw-app-exchange": "^0.11.0",
|
204
|
+
"@ledgerhq/hw-app-hedera": "^1.2.4",
|
205
|
+
"@ledgerhq/hw-app-icon": "^1.3.4",
|
206
|
+
"@ledgerhq/hw-app-multiversx": "^6.24.4",
|
207
|
+
"@ledgerhq/hw-app-near": "^6.31.4",
|
208
|
+
"@ledgerhq/hw-app-polkadot": "^6.34.4",
|
209
|
+
"@ledgerhq/hw-app-str": "^7.2.4",
|
210
210
|
"@ledgerhq/hw-app-sui": "^1.2.0",
|
211
|
-
"@ledgerhq/hw-app-tezos": "^6.31.
|
212
|
-
"@ledgerhq/hw-app-trx": "^6.31.
|
213
|
-
"@ledgerhq/hw-app-vet": "^0.5.12
|
214
|
-
"@ledgerhq/hw-app-xrp": "^6.32.
|
215
|
-
"@ledgerhq/hw-transport": "^6.31.
|
216
|
-
"@ledgerhq/hw-transport-mocker": "^6.29.
|
217
|
-
"@ledgerhq/ledger-cal-service": "^1.2.2
|
211
|
+
"@ledgerhq/hw-app-tezos": "^6.31.4",
|
212
|
+
"@ledgerhq/hw-app-trx": "^6.31.4",
|
213
|
+
"@ledgerhq/hw-app-vet": "^0.5.12",
|
214
|
+
"@ledgerhq/hw-app-xrp": "^6.32.2",
|
215
|
+
"@ledgerhq/hw-transport": "^6.31.8",
|
216
|
+
"@ledgerhq/hw-transport-mocker": "^6.29.8",
|
217
|
+
"@ledgerhq/ledger-cal-service": "^1.2.2",
|
218
218
|
"@ledgerhq/live-config": "^3.1.0",
|
219
|
-
"@ledgerhq/live-countervalues": "^0.6.0
|
220
|
-
"@ledgerhq/live-countervalues-react": "^0.
|
221
|
-
"@ledgerhq/live-dmk-shared": "^0.11.
|
222
|
-
"@ledgerhq/live-env": "^2.13.0
|
219
|
+
"@ledgerhq/live-countervalues": "^0.6.0",
|
220
|
+
"@ledgerhq/live-countervalues-react": "^0.3.0",
|
221
|
+
"@ledgerhq/live-dmk-shared": "^0.11.1",
|
222
|
+
"@ledgerhq/live-env": "^2.13.0",
|
223
223
|
"@ledgerhq/live-hooks": "0.1.0",
|
224
|
-
"@ledgerhq/live-network": "^2.0.14
|
225
|
-
"@ledgerhq/live-nft": "^0.8.16
|
224
|
+
"@ledgerhq/live-network": "^2.0.14",
|
225
|
+
"@ledgerhq/live-nft": "^0.8.16",
|
226
226
|
"@ledgerhq/live-promise": "^0.1.1",
|
227
|
-
"@ledgerhq/live-signer-evm": "^0.6.3
|
228
|
-
"@ledgerhq/live-signer-solana": "^0.5.1
|
229
|
-
"@ledgerhq/live-signer-canton": "^0.2.0
|
230
|
-
"@ledgerhq/live-wallet": "^0.12.0
|
227
|
+
"@ledgerhq/live-signer-evm": "^0.6.3",
|
228
|
+
"@ledgerhq/live-signer-solana": "^0.5.1",
|
229
|
+
"@ledgerhq/live-signer-canton": "^0.2.0",
|
230
|
+
"@ledgerhq/live-wallet": "^0.12.0",
|
231
231
|
"@ledgerhq/logs": "^6.13.0",
|
232
|
-
"@ledgerhq/speculos-transport": "^0.2.7
|
233
|
-
"@ledgerhq/wallet-api-acre-module": "^0.5.
|
234
|
-
"@ledgerhq/wallet-api-exchange-module": "^0.14.
|
232
|
+
"@ledgerhq/speculos-transport": "^0.2.7",
|
233
|
+
"@ledgerhq/wallet-api-acre-module": "^0.5.0",
|
234
|
+
"@ledgerhq/wallet-api-exchange-module": "^0.14.0"
|
235
235
|
},
|
236
236
|
"devDependencies": {
|
237
237
|
"@solana/web3.js": "1.95.4",
|
@@ -279,10 +279,10 @@
|
|
279
279
|
"undici": "6.19.2",
|
280
280
|
"uuid": "^8.3.2",
|
281
281
|
"ws": "7",
|
282
|
-
"@ledgerhq/device-react": "^0.2.40
|
283
|
-
"@ledgerhq/types-cryptoassets": "^7.
|
284
|
-
"@ledgerhq/types-devices": "^6.25.
|
285
|
-
"@ledgerhq/types-live": "^6.
|
282
|
+
"@ledgerhq/device-react": "^0.2.40",
|
283
|
+
"@ledgerhq/types-cryptoassets": "^7.25.0",
|
284
|
+
"@ledgerhq/types-devices": "^6.25.3",
|
285
|
+
"@ledgerhq/types-live": "^6.80.0"
|
286
286
|
},
|
287
287
|
"scripts": {
|
288
288
|
"build": "zx ./scripts/build-ts.mjs",
|
@@ -11,10 +11,6 @@ import {
|
|
11
11
|
TransactionValidation,
|
12
12
|
AccountInfo,
|
13
13
|
Api,
|
14
|
-
Cursor,
|
15
|
-
Page,
|
16
|
-
Stake,
|
17
|
-
Reward,
|
18
14
|
} from "@ledgerhq/coin-framework/api/index";
|
19
15
|
import network from "@ledgerhq/live-network";
|
20
16
|
|
@@ -196,10 +192,4 @@ export const getNetworkAlpacaApi = (networkFamily: string) =>
|
|
196
192
|
getBlockInfo(_height: number): Promise<BlockInfo> {
|
197
193
|
throw new Error("getBlockInfo is not supported");
|
198
194
|
},
|
199
|
-
getStakes(_address: string, _cursor?: Cursor): Promise<Page<Stake>> {
|
200
|
-
throw new Error("getStakes is not supported");
|
201
|
-
},
|
202
|
-
getRewards(_address: string, _cursor?: Cursor): Promise<Page<Reward>> {
|
203
|
-
throw new Error("getRewards is not supported");
|
204
|
-
},
|
205
195
|
}) satisfies Api<any>;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { listAppsUseCase } from "./listAppsUseCase";
|
2
2
|
import Transport from "@ledgerhq/hw-transport";
|
3
3
|
import { DeviceInfo } from "@ledgerhq/types-live";
|
4
|
-
import { HttpManagerApiRepository } from "
|
4
|
+
import { HttpManagerApiRepository } from "./screenSpecs";
|
5
5
|
|
6
6
|
const listAppsModule = jest.requireActual("../../apps/listApps");
|
7
7
|
|
@@ -2,16 +2,15 @@
|
|
2
2
|
* @jest-environment jsdom
|
3
3
|
*/
|
4
4
|
import "../../../__tests__/test-helpers/dom-polyfill";
|
5
|
-
|
6
|
-
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
7
|
-
import type { Account } from "@ledgerhq/types-live";
|
8
5
|
import { renderHook } from "@testing-library/react";
|
9
6
|
import BigNumber from "bignumber.js";
|
10
|
-
import { getCryptoCurrencyById, setSupportedCurrencies } from "../../../currencies";
|
11
|
-
import { genAccount } from "../../../mock/account";
|
12
|
-
import { usePickDefaultAccount } from "./usePickDefaultAccount";
|
13
|
-
import { Wrapper } from "./wrapper";
|
14
7
|
|
8
|
+
import { usePickDefaultAccount } from "./usePickDefaultAccount";
|
9
|
+
import { genAccount } from "../../../mock/account";
|
10
|
+
import { getCryptoCurrencyById } from "../../../currencies";
|
11
|
+
import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
12
|
+
import type { Account } from "@ledgerhq/types-live";
|
13
|
+
import { setSupportedCurrencies } from "../../../currencies";
|
15
14
|
setSupportedCurrencies(["ethereum"]);
|
16
15
|
|
17
16
|
function* accountGenerator(currency: CryptoCurrency): Generator<Account> {
|
@@ -40,9 +39,7 @@ describe("usePickDefaultAccount", () => {
|
|
40
39
|
test("do nothing when fromAccount is not null/undefined", () => {
|
41
40
|
const accounts: Account[] = [getEthAccount(), getBtcAccount()];
|
42
41
|
|
43
|
-
renderHook(() => usePickDefaultAccount(accounts, getEthAccount(), setFromAccount)
|
44
|
-
wrapper: Wrapper,
|
45
|
-
});
|
42
|
+
renderHook(() => usePickDefaultAccount(accounts, getEthAccount(), setFromAccount));
|
46
43
|
|
47
44
|
expect(setFromAccount).toHaveBeenCalledTimes(0);
|
48
45
|
});
|
@@ -55,9 +52,7 @@ describe("usePickDefaultAccount", () => {
|
|
55
52
|
{ ...getEthAccount(), disabled: true },
|
56
53
|
];
|
57
54
|
|
58
|
-
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount)
|
59
|
-
wrapper: Wrapper,
|
60
|
-
});
|
55
|
+
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount));
|
61
56
|
|
62
57
|
expect(setFromAccount).toHaveBeenCalledTimes(0);
|
63
58
|
});
|
@@ -68,9 +63,7 @@ describe("usePickDefaultAccount", () => {
|
|
68
63
|
|
69
64
|
const accounts: Account[] = [ethAccount, getBtcAccount()];
|
70
65
|
|
71
|
-
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount)
|
72
|
-
wrapper: Wrapper,
|
73
|
-
});
|
66
|
+
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount));
|
74
67
|
|
75
68
|
expect(setFromAccount).toHaveBeenCalledTimes(1);
|
76
69
|
expect(setFromAccount).toHaveBeenCalledWith(ethAccount);
|
@@ -88,9 +81,7 @@ describe("usePickDefaultAccount", () => {
|
|
88
81
|
{ ...getEthAccount(), disabled: true },
|
89
82
|
];
|
90
83
|
|
91
|
-
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount)
|
92
|
-
wrapper: Wrapper,
|
93
|
-
});
|
84
|
+
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount));
|
94
85
|
|
95
86
|
expect(setFromAccount).toHaveBeenCalledTimes(1);
|
96
87
|
expect(setFromAccount).toHaveBeenCalledWith(btcAccount);
|
@@ -119,9 +110,7 @@ describe("usePickDefaultAccount", () => {
|
|
119
110
|
ethAccount5,
|
120
111
|
];
|
121
112
|
|
122
|
-
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount)
|
123
|
-
wrapper: Wrapper,
|
124
|
-
});
|
113
|
+
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount));
|
125
114
|
|
126
115
|
expect(setFromAccount).toHaveBeenCalledTimes(1);
|
127
116
|
expect(setFromAccount).toHaveBeenCalledWith(ethAccount);
|
@@ -136,9 +125,7 @@ describe("usePickDefaultAccount", () => {
|
|
136
125
|
|
137
126
|
const accounts: Account[] = [{ ...getEthAccount(), disabled: true }, btcAccount, btcAccount2];
|
138
127
|
|
139
|
-
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount)
|
140
|
-
wrapper: Wrapper,
|
141
|
-
});
|
128
|
+
renderHook(() => usePickDefaultAccount(accounts, undefined, setFromAccount));
|
142
129
|
|
143
130
|
expect(setFromAccount).toHaveBeenCalledTimes(1);
|
144
131
|
expect(setFromAccount).toHaveBeenCalledWith(btcAccount);
|
@@ -1,60 +1,14 @@
|
|
1
|
-
import crypto from "crypto";
|
2
1
|
import network from "@ledgerhq/live-network";
|
3
2
|
import { mockPostSwapAccepted, mockPostSwapCancelled } from "./mock";
|
4
3
|
import type { PostSwapAccepted, PostSwapCancelled } from "./types";
|
5
4
|
import { isIntegrationTestEnv } from "./utils/isIntegrationTestEnv";
|
6
5
|
import { getSwapAPIBaseURL, getSwapUserIP } from ".";
|
7
6
|
|
8
|
-
function createSwapIntentHashes({
|
9
|
-
provider,
|
10
|
-
fromAccountId,
|
11
|
-
toAccountId,
|
12
|
-
amount,
|
13
|
-
}: {
|
14
|
-
provider: string;
|
15
|
-
fromAccountId?: string;
|
16
|
-
toAccountId?: string;
|
17
|
-
amount?: string;
|
18
|
-
}) {
|
19
|
-
// for example '2025-08-01' used to add a one day unique nonce to the swap intent hash
|
20
|
-
const currentday = new Date().toISOString().split("T")[0];
|
21
|
-
|
22
|
-
const swapIntentWithProvider = crypto
|
23
|
-
.createHash("sha256")
|
24
|
-
.update(
|
25
|
-
JSON.stringify({
|
26
|
-
provider,
|
27
|
-
fromAccountId,
|
28
|
-
toAccountId,
|
29
|
-
amount,
|
30
|
-
currentday,
|
31
|
-
}),
|
32
|
-
)
|
33
|
-
.digest("hex");
|
34
|
-
|
35
|
-
const swapIntentWithoutProvider = crypto
|
36
|
-
.createHash("sha256")
|
37
|
-
.update(
|
38
|
-
JSON.stringify({
|
39
|
-
fromAccountId,
|
40
|
-
toAccountId,
|
41
|
-
amount,
|
42
|
-
currentday,
|
43
|
-
}),
|
44
|
-
)
|
45
|
-
.digest("hex");
|
46
|
-
|
47
|
-
return { swapIntentWithProvider, swapIntentWithoutProvider };
|
48
|
-
}
|
49
|
-
|
50
7
|
export const postSwapAccepted: PostSwapAccepted = async ({
|
51
8
|
provider,
|
52
9
|
swapId = "",
|
53
10
|
transactionId,
|
54
11
|
swapAppVersion,
|
55
|
-
fromAccountId,
|
56
|
-
toAccountId,
|
57
|
-
amount,
|
58
12
|
...rest
|
59
13
|
}) => {
|
60
14
|
if (isIntegrationTestEnv())
|
@@ -67,14 +21,6 @@ export const postSwapAccepted: PostSwapAccepted = async ({
|
|
67
21
|
if (!swapId) {
|
68
22
|
return null;
|
69
23
|
}
|
70
|
-
|
71
|
-
const { swapIntentWithProvider, swapIntentWithoutProvider } = createSwapIntentHashes({
|
72
|
-
provider,
|
73
|
-
fromAccountId,
|
74
|
-
toAccountId,
|
75
|
-
amount,
|
76
|
-
});
|
77
|
-
|
78
24
|
try {
|
79
25
|
const ipHeader = getSwapUserIP();
|
80
26
|
const headers = {
|
@@ -85,7 +31,7 @@ export const postSwapAccepted: PostSwapAccepted = async ({
|
|
85
31
|
await network({
|
86
32
|
method: "POST",
|
87
33
|
url: `${getSwapAPIBaseURL()}/swap/accepted`,
|
88
|
-
data: { provider, swapId,
|
34
|
+
data: { provider, swapId, transactionId, ...rest },
|
89
35
|
...(Object.keys(headers).length > 0 ? { headers } : {}),
|
90
36
|
});
|
91
37
|
} catch (error) {
|
@@ -99,13 +45,6 @@ export const postSwapCancelled: PostSwapCancelled = async ({
|
|
99
45
|
provider,
|
100
46
|
swapId = "",
|
101
47
|
swapAppVersion,
|
102
|
-
fromAccountId,
|
103
|
-
toAccountId,
|
104
|
-
amount,
|
105
|
-
seedIdFrom,
|
106
|
-
seedIdTo,
|
107
|
-
refundAddress,
|
108
|
-
payoutAddress,
|
109
48
|
...rest
|
110
49
|
}) => {
|
111
50
|
if (isIntegrationTestEnv()) return mockPostSwapCancelled({ provider, swapId, ...rest });
|
@@ -118,22 +57,6 @@ export const postSwapCancelled: PostSwapCancelled = async ({
|
|
118
57
|
return null;
|
119
58
|
}
|
120
59
|
|
121
|
-
const { swapIntentWithProvider, swapIntentWithoutProvider } = createSwapIntentHashes({
|
122
|
-
provider,
|
123
|
-
fromAccountId,
|
124
|
-
toAccountId,
|
125
|
-
amount,
|
126
|
-
});
|
127
|
-
|
128
|
-
// Check if the refundAddress and payoutAddress match the account addresses, just to eliminate this supposition
|
129
|
-
const payloadAddressMatchAccountAddress =
|
130
|
-
fromAccountId &&
|
131
|
-
toAccountId &&
|
132
|
-
refundAddress &&
|
133
|
-
payoutAddress &&
|
134
|
-
fromAccountId.includes(refundAddress) &&
|
135
|
-
toAccountId.includes(payoutAddress);
|
136
|
-
|
137
60
|
try {
|
138
61
|
const ipHeader = getSwapUserIP();
|
139
62
|
const headers = {
|
@@ -141,28 +64,10 @@ export const postSwapCancelled: PostSwapCancelled = async ({
|
|
141
64
|
...(swapAppVersion ? { "x-swap-app-version": swapAppVersion } : {}),
|
142
65
|
};
|
143
66
|
|
144
|
-
const shouldIncludeAddresses =
|
145
|
-
rest.statusCode === "WrongDeviceForAccountPayout" ||
|
146
|
-
rest.statusCode === "WrongDeviceForAccountRefund";
|
147
|
-
|
148
|
-
const requestData = {
|
149
|
-
provider,
|
150
|
-
swapId,
|
151
|
-
swapIntentWithProvider,
|
152
|
-
swapIntentWithoutProvider,
|
153
|
-
payloadAddressMatchAccountAddress,
|
154
|
-
fromAccountId: shouldIncludeAddresses ? fromAccountId : undefined,
|
155
|
-
toAccountId: shouldIncludeAddresses ? toAccountId : undefined,
|
156
|
-
payloadRefundAddress: shouldIncludeAddresses ? refundAddress : undefined,
|
157
|
-
payloadPayoutAddress: shouldIncludeAddresses ? payoutAddress : undefined,
|
158
|
-
maybeSeedMatch: seedIdFrom === seedIdTo, // Only true if both accounts are from the same seed and from the same chain type
|
159
|
-
...rest,
|
160
|
-
};
|
161
|
-
|
162
67
|
await network({
|
163
68
|
method: "POST",
|
164
69
|
url: `${getSwapAPIBaseURL()}/swap/cancelled`,
|
165
|
-
data:
|
70
|
+
data: { provider, swapId, ...rest },
|
166
71
|
...(Object.keys(headers).length > 0 ? { headers } : {}),
|
167
72
|
});
|
168
73
|
} catch (error) {
|
@@ -12,9 +12,6 @@ export const setBroadcastTransaction = ({
|
|
12
12
|
hardwareWalletType,
|
13
13
|
swapType,
|
14
14
|
swapAppVersion,
|
15
|
-
fromAccountId,
|
16
|
-
toAccountId,
|
17
|
-
amount,
|
18
15
|
}: {
|
19
16
|
result: { operation: Operation | string; swapId: string };
|
20
17
|
provider: string;
|
@@ -23,9 +20,6 @@ export const setBroadcastTransaction = ({
|
|
23
20
|
hardwareWalletType?: DeviceModelId;
|
24
21
|
swapType?: TradeMethod;
|
25
22
|
swapAppVersion?: string;
|
26
|
-
fromAccountId?: string;
|
27
|
-
toAccountId?: string;
|
28
|
-
amount?: string;
|
29
23
|
}) => {
|
30
24
|
const { operation, swapId } = result;
|
31
25
|
|
@@ -45,9 +39,6 @@ export const setBroadcastTransaction = ({
|
|
45
39
|
hardwareWalletType,
|
46
40
|
swapType: swapType,
|
47
41
|
swapAppVersion,
|
48
|
-
fromAccountId,
|
49
|
-
toAccountId,
|
50
|
-
amount,
|
51
42
|
});
|
52
43
|
} else {
|
53
44
|
postSwapAccepted({
|
@@ -59,9 +50,6 @@ export const setBroadcastTransaction = ({
|
|
59
50
|
hardwareWalletType,
|
60
51
|
swapType,
|
61
52
|
swapAppVersion,
|
62
|
-
fromAccountId,
|
63
|
-
toAccountId,
|
64
|
-
amount,
|
65
53
|
});
|
66
54
|
}
|
67
55
|
};
|
@@ -200,13 +200,6 @@ type SwapStateRequest = {
|
|
200
200
|
hardwareWalletType: DeviceModelId;
|
201
201
|
swapType: TradeMethod;
|
202
202
|
swapAppVersion?: string;
|
203
|
-
fromAccountId?: string;
|
204
|
-
toAccountId?: string;
|
205
|
-
amount?: string;
|
206
|
-
seedIdFrom?: string;
|
207
|
-
seedIdTo?: string;
|
208
|
-
refundAddress?: string;
|
209
|
-
payoutAddress?: string;
|
210
203
|
}>;
|
211
204
|
|
212
205
|
export type SwapStateAcceptedRequest = SwapStateRequest & {
|
@@ -19,7 +19,7 @@ import customLockScreenFetchSize from "./customLockScreenFetchSize";
|
|
19
19
|
import customLockScreenFetchHash from "./customLockScreenFetchHash";
|
20
20
|
import { gzip } from "pako";
|
21
21
|
import { CLSSupportedDeviceModelId } from "../device/use-cases/isCustomLockScreenSupported";
|
22
|
-
import { getScreenSpecs
|
22
|
+
import { getScreenSpecs } from "../device/use-cases/screenSpecs";
|
23
23
|
import { DeviceDisconnectedWhileSendingError } from "@ledgerhq/device-management-kit";
|
24
24
|
import { withTransport } from "../deviceSDK/transports/core";
|
25
25
|
|
@@ -60,6 +60,15 @@ export type LoadimageResult = {
|
|
60
60
|
imageSize: number;
|
61
61
|
};
|
62
62
|
|
63
|
+
type ScreenSpecs = {
|
64
|
+
width: number;
|
65
|
+
height: number;
|
66
|
+
paddingTop: number;
|
67
|
+
paddingBottom: number;
|
68
|
+
paddingLeft: number;
|
69
|
+
paddingRight: number;
|
70
|
+
};
|
71
|
+
|
63
72
|
export type LoadImageRequest = {
|
64
73
|
hexImage: string; // When provided, will skip the backup if it matches the hash.
|
65
74
|
padImage?: boolean;
|
@@ -259,11 +268,6 @@ function padHexImage(hexImage: string, screenSpecs: ScreenSpecs): string {
|
|
259
268
|
return result;
|
260
269
|
}
|
261
270
|
|
262
|
-
const bitsPerPixelToBppIndicator: Record<ScreenSpecs["bitsPerPixel"], number> = {
|
263
|
-
1: 0,
|
264
|
-
4: 2,
|
265
|
-
};
|
266
|
-
|
267
271
|
export async function generateCustomLockScreenImageFormat(
|
268
272
|
hexImage: string,
|
269
273
|
compressImage: boolean,
|
@@ -272,7 +276,7 @@ export async function generateCustomLockScreenImageFormat(
|
|
272
276
|
) {
|
273
277
|
const width = screenSpecs.width;
|
274
278
|
const height = screenSpecs.height;
|
275
|
-
const bpp =
|
279
|
+
const bpp = 2; // value for 4 bits per pixel
|
276
280
|
const compression = compressImage ? 1 : 0;
|
277
281
|
|
278
282
|
const header = Buffer.alloc(8);
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
2
|
import { CurrenciesByProviderId } from "../../deposit/type";
|
3
3
|
import { haveOneCommonProvider } from "./haveOneCommonProvider";
|
4
|
-
import { getBalanceAndFiatValue } from "./getBalanceAndFiatValue";
|
5
4
|
|
6
5
|
function isCorrespondingCurrency(
|
7
6
|
elem: CryptoOrTokenCurrency,
|
@@ -28,9 +27,4 @@ const getEffectiveCurrency = (
|
|
28
27
|
return provider.currenciesByNetwork.find(elem => currencyIds.includes(elem.id)) ?? currency;
|
29
28
|
};
|
30
29
|
|
31
|
-
export {
|
32
|
-
isCorrespondingCurrency,
|
33
|
-
getEffectiveCurrency,
|
34
|
-
haveOneCommonProvider,
|
35
|
-
getBalanceAndFiatValue,
|
36
|
-
};
|
30
|
+
export { isCorrespondingCurrency, getEffectiveCurrency, haveOneCommonProvider };
|
@@ -571,9 +571,6 @@ export const handlers = ({
|
|
571
571
|
targetCurrencyId: toCurrency?.id,
|
572
572
|
hardwareWalletType: deviceInfo?.modelId as DeviceModelId,
|
573
573
|
swapAppVersion,
|
574
|
-
fromAccountId: fromAccount.id,
|
575
|
-
toAccountId: toAccount?.id,
|
576
|
-
amount: amountExpectedTo.toString(),
|
577
574
|
});
|
578
575
|
|
579
576
|
resolve({ operationHash, swapId });
|
@@ -590,13 +587,6 @@ export const handlers = ({
|
|
590
587
|
hardwareWalletType: deviceInfo?.modelId as DeviceModelId,
|
591
588
|
swapType: quoteId ? "fixed" : "float",
|
592
589
|
swapAppVersion,
|
593
|
-
fromAccountId: fromAccount.id,
|
594
|
-
toAccountId: toAccount?.id,
|
595
|
-
refundAddress,
|
596
|
-
payoutAddress,
|
597
|
-
amount: amountExpectedTo.toString(),
|
598
|
-
seedIdFrom: mainFromAccount.seedIdentifier,
|
599
|
-
seedIdTo: toParentAccount?.seedIdentifier || (toAccount as Account)?.seedIdentifier,
|
600
590
|
});
|
601
591
|
|
602
592
|
reject(error);
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../../src/exchange/swap/hooks/wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAGvC,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAcrD,CAAC"}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.Wrapper = void 0;
|
27
|
-
const react_1 = __importStar(require("react"));
|
28
|
-
const live_countervalues_react_1 = require("@ledgerhq/live-countervalues-react");
|
29
|
-
const Wrapper = ({ children }) => {
|
30
|
-
const bridge = (0, react_1.useMemo)(() => ({
|
31
|
-
setError: () => { },
|
32
|
-
setIds: () => { },
|
33
|
-
setLoading: () => { },
|
34
|
-
useIds: () => [],
|
35
|
-
useLastUpdated: () => 0,
|
36
|
-
}), []);
|
37
|
-
return (react_1.default.createElement(live_countervalues_react_1.CountervaluesMarketcapProvider, { bridge: bridge }, children));
|
38
|
-
};
|
39
|
-
exports.Wrapper = Wrapper;
|
40
|
-
//# sourceMappingURL=wrapper.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../../src/exchange/swap/hooks/wrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,iFAAoF;AAE7E,MAAM,OAAO,GAAsC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzE,MAAM,MAAM,GAAG,IAAA,eAAO,EACpB,GAAG,EAAE,CAAC,CAAC;QACL,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;QAClB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;QAChB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;QACpB,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE;QAChB,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;KACxB,CAAC,EACF,EAAE,CACH,CAAC;IACF,OAAO,CACL,8BAAC,yDAA8B,IAAC,MAAM,EAAE,MAAM,IAAG,QAAQ,CAAkC,CAC5F,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,OAAO,WAclB"}
|