@ledgerhq/live-common 34.55.0-nightly.20251223024125 → 34.55.0-nightly.20251225024217
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/e2e/enum/Account.d.ts +15 -16
- package/lib/e2e/enum/Account.d.ts.map +1 -1
- package/lib/e2e/enum/Account.js +93 -100
- package/lib/e2e/enum/Account.js.map +1 -1
- package/lib/e2e/enum/Addresses.d.ts +12 -0
- package/lib/e2e/enum/Addresses.d.ts.map +1 -0
- package/lib/e2e/enum/Addresses.js +16 -0
- package/lib/e2e/enum/Addresses.js.map +1 -0
- package/lib/e2e/enum/AppInfos.d.ts +1 -0
- package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib/e2e/enum/AppInfos.js +1 -0
- package/lib/e2e/enum/AppInfos.js.map +1 -1
- package/lib/e2e/enum/Currency.d.ts +1 -0
- package/lib/e2e/enum/Currency.d.ts.map +1 -1
- package/lib/e2e/enum/Currency.js +1 -0
- package/lib/e2e/enum/Currency.js.map +1 -1
- package/lib/e2e/families/algorand.d.ts.map +1 -1
- package/lib/e2e/families/algorand.js +3 -0
- package/lib/e2e/families/algorand.js.map +1 -1
- package/lib/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib/e2e/families/bitcoin.js +6 -0
- package/lib/e2e/families/bitcoin.js.map +1 -1
- package/lib/e2e/families/cardano.d.ts.map +1 -1
- package/lib/e2e/families/cardano.js +3 -0
- package/lib/e2e/families/cardano.js.map +1 -1
- package/lib/e2e/families/cosmos.d.ts.map +1 -1
- package/lib/e2e/families/cosmos.js +3 -0
- package/lib/e2e/families/cosmos.js.map +1 -1
- package/lib/e2e/families/evm.d.ts.map +1 -1
- package/lib/e2e/families/evm.js +3 -0
- package/lib/e2e/families/evm.js.map +1 -1
- package/lib/e2e/families/polkadot.d.ts.map +1 -1
- package/lib/e2e/families/polkadot.js +3 -0
- package/lib/e2e/families/polkadot.js.map +1 -1
- package/lib/e2e/families/solana.d.ts.map +1 -1
- package/lib/e2e/families/solana.js +3 -0
- package/lib/e2e/families/solana.js.map +1 -1
- package/lib/e2e/families/stellar.d.ts.map +1 -1
- package/lib/e2e/families/stellar.js +3 -0
- package/lib/e2e/families/stellar.js.map +1 -1
- package/lib/e2e/families/tron.d.ts.map +1 -1
- package/lib/e2e/families/tron.js +3 -0
- package/lib/e2e/families/tron.js.map +1 -1
- package/lib/e2e/families/xrp.d.ts.map +1 -1
- package/lib/e2e/families/xrp.js +3 -0
- package/lib/e2e/families/xrp.js.map +1 -1
- package/lib/e2e/index.d.ts +9 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/models/Transaction.d.ts +1 -0
- package/lib/e2e/models/Transaction.d.ts.map +1 -1
- package/lib/e2e/models/Transaction.js +1 -0
- package/lib/e2e/models/Transaction.js.map +1 -1
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +10 -3
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/e2e/swap.d.ts.map +1 -1
- package/lib/e2e/swap.js +5 -1
- package/lib/e2e/swap.js.map +1 -1
- package/lib/families/cosmos/datasets/cosmos.d.ts.map +1 -1
- package/lib/families/cosmos/datasets/cosmos.js +66 -18
- package/lib/families/cosmos/datasets/cosmos.js.map +1 -1
- package/lib/families/filecoin/common.d.ts +0 -5
- package/lib/families/filecoin/common.d.ts.map +1 -1
- package/lib/families/filecoin/common.js +1 -8
- package/lib/families/filecoin/common.js.map +1 -1
- package/lib/families/filecoin/setup.d.ts.map +1 -1
- package/lib/families/filecoin/setup.js +5 -17
- package/lib/families/filecoin/setup.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +10 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.d.ts +15 -16
- package/lib-es/e2e/enum/Account.d.ts.map +1 -1
- package/lib-es/e2e/enum/Account.js +92 -98
- package/lib-es/e2e/enum/Account.js.map +1 -1
- package/lib-es/e2e/enum/Addresses.d.ts +12 -0
- package/lib-es/e2e/enum/Addresses.d.ts.map +1 -0
- package/lib-es/e2e/enum/Addresses.js +13 -0
- package/lib-es/e2e/enum/Addresses.js.map +1 -0
- package/lib-es/e2e/enum/AppInfos.d.ts +1 -0
- package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
- package/lib-es/e2e/enum/AppInfos.js +1 -0
- package/lib-es/e2e/enum/AppInfos.js.map +1 -1
- package/lib-es/e2e/enum/Currency.d.ts +1 -0
- package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
- package/lib-es/e2e/enum/Currency.js +1 -0
- package/lib-es/e2e/enum/Currency.js.map +1 -1
- package/lib-es/e2e/families/algorand.d.ts.map +1 -1
- package/lib-es/e2e/families/algorand.js +3 -0
- package/lib-es/e2e/families/algorand.js.map +1 -1
- package/lib-es/e2e/families/bitcoin.d.ts.map +1 -1
- package/lib-es/e2e/families/bitcoin.js +6 -0
- package/lib-es/e2e/families/bitcoin.js.map +1 -1
- package/lib-es/e2e/families/cardano.d.ts.map +1 -1
- package/lib-es/e2e/families/cardano.js +3 -0
- package/lib-es/e2e/families/cardano.js.map +1 -1
- package/lib-es/e2e/families/cosmos.d.ts.map +1 -1
- package/lib-es/e2e/families/cosmos.js +3 -0
- package/lib-es/e2e/families/cosmos.js.map +1 -1
- package/lib-es/e2e/families/evm.d.ts.map +1 -1
- package/lib-es/e2e/families/evm.js +3 -0
- package/lib-es/e2e/families/evm.js.map +1 -1
- package/lib-es/e2e/families/polkadot.d.ts.map +1 -1
- package/lib-es/e2e/families/polkadot.js +3 -0
- package/lib-es/e2e/families/polkadot.js.map +1 -1
- package/lib-es/e2e/families/solana.d.ts.map +1 -1
- package/lib-es/e2e/families/solana.js +3 -0
- package/lib-es/e2e/families/solana.js.map +1 -1
- package/lib-es/e2e/families/stellar.d.ts.map +1 -1
- package/lib-es/e2e/families/stellar.js +3 -0
- package/lib-es/e2e/families/stellar.js.map +1 -1
- package/lib-es/e2e/families/tron.d.ts.map +1 -1
- package/lib-es/e2e/families/tron.js +3 -0
- package/lib-es/e2e/families/tron.js.map +1 -1
- package/lib-es/e2e/families/xrp.d.ts.map +1 -1
- package/lib-es/e2e/families/xrp.js +3 -0
- package/lib-es/e2e/families/xrp.js.map +1 -1
- package/lib-es/e2e/index.d.ts +9 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/models/Transaction.d.ts +1 -0
- package/lib-es/e2e/models/Transaction.d.ts.map +1 -1
- package/lib-es/e2e/models/Transaction.js +1 -0
- package/lib-es/e2e/models/Transaction.js.map +1 -1
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +10 -3
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/e2e/swap.d.ts.map +1 -1
- package/lib-es/e2e/swap.js +5 -1
- package/lib-es/e2e/swap.js.map +1 -1
- package/lib-es/families/cosmos/datasets/cosmos.d.ts.map +1 -1
- package/lib-es/families/cosmos/datasets/cosmos.js +67 -19
- package/lib-es/families/cosmos/datasets/cosmos.js.map +1 -1
- package/lib-es/families/filecoin/common.d.ts +0 -5
- package/lib-es/families/filecoin/common.d.ts.map +1 -1
- package/lib-es/families/filecoin/common.js +0 -5
- package/lib-es/families/filecoin/common.js.map +1 -1
- package/lib-es/families/filecoin/setup.d.ts.map +1 -1
- package/lib-es/families/filecoin/setup.js +5 -17
- package/lib-es/families/filecoin/setup.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +10 -0
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/package.json +75 -75
- package/src/e2e/enum/Account.ts +152 -396
- package/src/e2e/enum/Addresses.ts +11 -0
- package/src/e2e/enum/AppInfos.ts +2 -0
- package/src/e2e/enum/Currency.ts +2 -0
- package/src/e2e/families/algorand.ts +3 -0
- package/src/e2e/families/bitcoin.ts +6 -0
- package/src/e2e/families/cardano.ts +3 -0
- package/src/e2e/families/cosmos.ts +3 -0
- package/src/e2e/families/evm.ts +3 -0
- package/src/e2e/families/polkadot.ts +3 -0
- package/src/e2e/families/solana.ts +3 -0
- package/src/e2e/families/stellar.ts +3 -0
- package/src/e2e/families/tron.ts +3 -0
- package/src/e2e/families/xrp.ts +3 -1
- package/src/e2e/models/Transaction.ts +2 -0
- package/src/e2e/speculos.ts +10 -3
- package/src/e2e/swap.ts +7 -1
- package/src/families/cosmos/datasets/cosmos.ts +71 -18
- package/src/families/filecoin/common.ts +0 -6
- package/src/families/filecoin/setup.ts +6 -27
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +3 -3
- package/src/featureFlags/defaultFeatures.ts +10 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export enum Addresses {
|
|
2
|
+
BTC_NATIVE_SEGWIT_1 = "bc1q550hm43wj0jq949xwsw67kwzz0t3wy60y3gfax",
|
|
3
|
+
SANCTIONED_ETHEREUM = "0x04DBA1194ee10112fE6C3207C0687DEf0e78baCf",
|
|
4
|
+
ETH_2 = "0xa1baa625c5E6A9304cB7AcD86d2fee6B710eC3eB",
|
|
5
|
+
ETH_OTHER_SEED = "0xce12D0A5cFf4A88ECab96ff8923215Dff366127b",
|
|
6
|
+
SOL_OTHER_SEED = "DLVArScX1BQEr7gZSSpHMGMq7HKKFKdFF82Cs6PvEKVC",
|
|
7
|
+
SOL_GIGA_2_ATA_ADDRESS = "8nnwXo313DXWcE3kBR54gDKDmcySeGVjYRztbCAPzxev",
|
|
8
|
+
SOL_WIF_2_ATA_ADDRESS = "PXFuX7GdgVpPnuXwQSkjt3jihZZCjcxy8G5fsQa1NBn",
|
|
9
|
+
SWAP_HISTORY_SOL_FROM = "9MQyG8qo6i616yApRoRVMXYerGV4swwtd2bDETC3RCWB",
|
|
10
|
+
SWAP_HISTORY_ETH_TO = "0x4BE2E2B8872AA298D6d123b9211B53E41f611566",
|
|
11
|
+
}
|
package/src/e2e/enum/AppInfos.ts
CHANGED
package/src/e2e/enum/Currency.ts
CHANGED
|
@@ -199,6 +199,8 @@ export class Currency {
|
|
|
199
199
|
|
|
200
200
|
static readonly SUI = new Currency("Sui", "SUI", "sui", AppInfos.SUI, [Network.SUI]);
|
|
201
201
|
|
|
202
|
+
static readonly BASE = new Currency("Base", "ETH", "base", AppInfos.BASE, [Network.BASE]);
|
|
203
|
+
|
|
202
204
|
static readonly SUI_USDC = new Currency(
|
|
203
205
|
"USD Coin",
|
|
204
206
|
"USDC",
|
|
@@ -15,6 +15,9 @@ export const sendAlgorand = withDeviceController(
|
|
|
15
15
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
16
16
|
expect(isAmountCorrect).toBeTruthy();
|
|
17
17
|
|
|
18
|
+
if (!tx.accountToCredit.address) {
|
|
19
|
+
throw new Error("Recipient address is not set");
|
|
20
|
+
}
|
|
18
21
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
19
22
|
expect(isAddressCorrect).toBeTruthy();
|
|
20
23
|
|
|
@@ -17,6 +17,9 @@ export const sendBTCBasedCoin = withDeviceController(
|
|
|
17
17
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
18
18
|
expect(isAmountCorrect).toBeTruthy();
|
|
19
19
|
|
|
20
|
+
if (!tx.accountToCredit.address) {
|
|
21
|
+
throw new Error("Recipient address is not set");
|
|
22
|
+
}
|
|
20
23
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
21
24
|
expect(isAddressCorrect).toBeTruthy();
|
|
22
25
|
|
|
@@ -42,6 +45,9 @@ export const sendBTC = withDeviceController(
|
|
|
42
45
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
43
46
|
expect(isAmountCorrect).toBeTruthy();
|
|
44
47
|
|
|
48
|
+
if (!tx.accountToCredit.address) {
|
|
49
|
+
throw new Error("Recipient address is not set");
|
|
50
|
+
}
|
|
45
51
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
46
52
|
expect(isAddressCorrect).toBeTruthy();
|
|
47
53
|
|
|
@@ -14,6 +14,9 @@ import { withDeviceController } from "../deviceInteraction/DeviceController";
|
|
|
14
14
|
type ActionType = "both" | "right" | "tap" | "swipe" | "confirm" | "hold";
|
|
15
15
|
|
|
16
16
|
function validateTransactionData(tx: Transaction, events: string[]) {
|
|
17
|
+
if (!tx.accountToCredit.address) {
|
|
18
|
+
throw new Error("Recipient address is not set");
|
|
19
|
+
}
|
|
17
20
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
18
21
|
expect(isAddressCorrect).toBeTruthy();
|
|
19
22
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
@@ -33,6 +33,9 @@ export const sendCosmos = withDeviceController(
|
|
|
33
33
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
34
34
|
expect(isAmountCorrect).toBeTruthy();
|
|
35
35
|
|
|
36
|
+
if (!tx.accountToCredit.address) {
|
|
37
|
+
throw new Error("Recipient address is not set");
|
|
38
|
+
}
|
|
36
39
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
37
40
|
expect(isAddressCorrect).toBeTruthy();
|
|
38
41
|
|
package/src/e2e/families/evm.ts
CHANGED
|
@@ -16,6 +16,9 @@ function validateTransactionData(tx: Transaction, events: string[]) {
|
|
|
16
16
|
const isENSNameCorrect = containsSubstringInEvent(tx.accountToCredit.ensName, events);
|
|
17
17
|
expect(isENSNameCorrect).toBeTruthy();
|
|
18
18
|
} else {
|
|
19
|
+
if (!tx.accountToCredit.address) {
|
|
20
|
+
throw new Error("Recipient address is not set");
|
|
21
|
+
}
|
|
19
22
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
20
23
|
expect(isAddressCorrect).toBeTruthy();
|
|
21
24
|
}
|
|
@@ -15,6 +15,9 @@ export const sendPolkadot = withDeviceController(
|
|
|
15
15
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
16
16
|
expect(isAmountCorrect).toBeTruthy();
|
|
17
17
|
|
|
18
|
+
if (!tx.accountToCredit.address) {
|
|
19
|
+
throw new Error("Recipient address is not set");
|
|
20
|
+
}
|
|
18
21
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
19
22
|
expect(isAddressCorrect).toBeTruthy();
|
|
20
23
|
|
|
@@ -33,6 +33,9 @@ export const sendSolana = withDeviceController(
|
|
|
33
33
|
expect(isAmountCorrect).toBeTruthy();
|
|
34
34
|
|
|
35
35
|
if (process.env.SPECULOS_DEVICE !== Device.LNS.name) {
|
|
36
|
+
if (!tx.accountToCredit.address) {
|
|
37
|
+
throw new Error("Recipient address is not set");
|
|
38
|
+
}
|
|
36
39
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
37
40
|
expect(isAddressCorrect).toBeTruthy();
|
|
38
41
|
}
|
|
@@ -15,6 +15,9 @@ export const sendStellar = withDeviceController(
|
|
|
15
15
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
16
16
|
expect(isAmountCorrect).toBeTruthy();
|
|
17
17
|
|
|
18
|
+
if (!tx.accountToCredit.address) {
|
|
19
|
+
throw new Error("Recipient address is not set");
|
|
20
|
+
}
|
|
18
21
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
19
22
|
expect(isAddressCorrect).toBeTruthy();
|
|
20
23
|
|
package/src/e2e/families/tron.ts
CHANGED
|
@@ -15,6 +15,9 @@ export const sendTron = withDeviceController(
|
|
|
15
15
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
16
16
|
expect(isAmountCorrect).toBeTruthy();
|
|
17
17
|
|
|
18
|
+
if (!tx.accountToCredit.address) {
|
|
19
|
+
throw new Error("Recipient address is not set");
|
|
20
|
+
}
|
|
18
21
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
19
22
|
expect(isAddressCorrect).toBeTruthy();
|
|
20
23
|
|
package/src/e2e/families/xrp.ts
CHANGED
|
@@ -14,7 +14,9 @@ export const sendXRP = withDeviceController(
|
|
|
14
14
|
const events = await getSendEvents(tx);
|
|
15
15
|
const isAmountCorrect = containsSubstringInEvent(tx.amount, events);
|
|
16
16
|
expect(isAmountCorrect).toBeTruthy();
|
|
17
|
-
|
|
17
|
+
if (!tx.accountToCredit.address) {
|
|
18
|
+
throw new Error("Recipient address is not set");
|
|
19
|
+
}
|
|
18
20
|
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events);
|
|
19
21
|
expect(isAddressCorrect).toBeTruthy();
|
|
20
22
|
|
package/src/e2e/speculos.ts
CHANGED
|
@@ -349,6 +349,14 @@ export const specs: Specs = {
|
|
|
349
349
|
},
|
|
350
350
|
dependency: "",
|
|
351
351
|
},
|
|
352
|
+
Base: {
|
|
353
|
+
currency: getCryptoCurrencyById("base"),
|
|
354
|
+
appQuery: {
|
|
355
|
+
model: getSpeculosModel(),
|
|
356
|
+
appName: "Ethereum",
|
|
357
|
+
},
|
|
358
|
+
dependency: "",
|
|
359
|
+
},
|
|
352
360
|
};
|
|
353
361
|
|
|
354
362
|
export async function startSpeculos(
|
|
@@ -814,16 +822,15 @@ export async function signSendTransaction(tx: Transaction) {
|
|
|
814
822
|
const currencyName = tx.accountToDebit.currency;
|
|
815
823
|
switch (currencyName) {
|
|
816
824
|
case Currency.sepETH:
|
|
825
|
+
case Currency.BASE:
|
|
817
826
|
case Currency.POL:
|
|
818
827
|
case Currency.ETH:
|
|
828
|
+
case Currency.ETH_USDT:
|
|
819
829
|
await sendEVM(tx);
|
|
820
830
|
break;
|
|
821
831
|
case Currency.BTC:
|
|
822
832
|
await sendBTC(tx);
|
|
823
833
|
break;
|
|
824
|
-
case Currency.ETH_USDT:
|
|
825
|
-
await sendEVM(tx);
|
|
826
|
-
break;
|
|
827
834
|
case Currency.DOGE:
|
|
828
835
|
case Currency.BCH:
|
|
829
836
|
await sendBTCBasedCoin(tx);
|
package/src/e2e/swap.ts
CHANGED
|
@@ -4,6 +4,12 @@ import axios from "axios";
|
|
|
4
4
|
|
|
5
5
|
export async function getMinimumSwapAmount(AccountFrom: Account, AccountTo: Account) {
|
|
6
6
|
try {
|
|
7
|
+
const addressFrom = AccountFrom.address || AccountFrom.parentAccount?.address;
|
|
8
|
+
|
|
9
|
+
if (!addressFrom) {
|
|
10
|
+
throw new Error("No address available from accounts when requesting minimum swap amount.");
|
|
11
|
+
}
|
|
12
|
+
|
|
7
13
|
const requestConfig = {
|
|
8
14
|
method: "GET",
|
|
9
15
|
url: "https://swap-stg.ledger-test.com/v5/quote",
|
|
@@ -11,7 +17,7 @@ export async function getMinimumSwapAmount(AccountFrom: Account, AccountTo: Acco
|
|
|
11
17
|
from: AccountFrom.currency.id,
|
|
12
18
|
to: AccountTo.currency.id,
|
|
13
19
|
amountFrom: 0.0001,
|
|
14
|
-
addressFrom
|
|
20
|
+
addressFrom,
|
|
15
21
|
fiatForCounterValue: "USD",
|
|
16
22
|
slippage: 1,
|
|
17
23
|
networkFees: 0.001,
|
|
@@ -4,11 +4,14 @@ import {
|
|
|
4
4
|
InvalidAddressBecauseDestinationIsAlsoSource,
|
|
5
5
|
NotEnoughBalance,
|
|
6
6
|
AmountRequired,
|
|
7
|
+
RecommendUndelegation,
|
|
7
8
|
} from "@ledgerhq/errors";
|
|
8
9
|
import invariant from "invariant";
|
|
9
10
|
import type { CosmosAccount, Transaction } from "@ledgerhq/coin-cosmos/types/index";
|
|
10
11
|
import { AccountRaw, CurrenciesData } from "@ledgerhq/types-live";
|
|
11
12
|
import { fromTransactionRaw } from "@ledgerhq/coin-cosmos/transaction";
|
|
13
|
+
import { CosmosTooManyRedelegations } from "@ledgerhq/coin-cosmos/errors";
|
|
14
|
+
import { COSMOS_MAX_REDELEGATIONS } from "@ledgerhq/coin-cosmos/logic";
|
|
12
15
|
|
|
13
16
|
const dataset: CurrenciesData<Transaction> = {
|
|
14
17
|
FIXME_ignoreAccountFields: ["cosmosResources", "operationsCount", "operations"],
|
|
@@ -99,15 +102,26 @@ const dataset: CurrenciesData<Transaction> = {
|
|
|
99
102
|
memo: null,
|
|
100
103
|
mode: "send",
|
|
101
104
|
}),
|
|
102
|
-
expectedStatus: account => {
|
|
105
|
+
expectedStatus: (account, t) => {
|
|
103
106
|
const { cosmosResources } = account as CosmosAccount;
|
|
104
107
|
if (!cosmosResources) throw new Error("Should exist because it's cosmos");
|
|
105
|
-
const
|
|
108
|
+
const estimatedFees = t.fees || new BigNumber(0);
|
|
109
|
+
const spendableBalance = account.balance.minus(
|
|
106
110
|
cosmosResources.unbondingBalance.plus(cosmosResources.delegatedBalance),
|
|
107
111
|
);
|
|
112
|
+
const amount = BigNumber.max(0, spendableBalance.minus(estimatedFees));
|
|
113
|
+
const totalSpent = amount.plus(estimatedFees);
|
|
114
|
+
const errors: Record<string, Error> = {};
|
|
115
|
+
const warnings: Record<string, Error> = {};
|
|
116
|
+
if (amount.lte(0)) {
|
|
117
|
+
errors.amount = new NotEnoughBalance();
|
|
118
|
+
}
|
|
119
|
+
if (cosmosResources.delegations.length > 0) {
|
|
120
|
+
warnings.amount = new RecommendUndelegation();
|
|
121
|
+
}
|
|
108
122
|
return {
|
|
109
|
-
errors
|
|
110
|
-
warnings
|
|
123
|
+
errors,
|
|
124
|
+
warnings,
|
|
111
125
|
totalSpent,
|
|
112
126
|
};
|
|
113
127
|
},
|
|
@@ -131,12 +145,23 @@ const dataset: CurrenciesData<Transaction> = {
|
|
|
131
145
|
const { cosmosResources } = account as CosmosAccount;
|
|
132
146
|
if (!cosmosResources) throw new Error("Should exist because it's cosmos");
|
|
133
147
|
invariant(t.memo === "test", "Should have a memo");
|
|
134
|
-
const
|
|
148
|
+
const estimatedFees = t.fees || new BigNumber(0);
|
|
149
|
+
const spendableBalance = account.balance.minus(
|
|
135
150
|
cosmosResources.unbondingBalance.plus(cosmosResources.delegatedBalance),
|
|
136
151
|
);
|
|
152
|
+
const amount = BigNumber.max(0, spendableBalance.minus(estimatedFees));
|
|
153
|
+
const totalSpent = amount.plus(estimatedFees);
|
|
154
|
+
const errors: Record<string, Error> = {};
|
|
155
|
+
const warnings: Record<string, Error> = {};
|
|
156
|
+
if (amount.lte(0)) {
|
|
157
|
+
errors.amount = new NotEnoughBalance();
|
|
158
|
+
}
|
|
159
|
+
if (cosmosResources.delegations.length > 0) {
|
|
160
|
+
warnings.amount = new RecommendUndelegation();
|
|
161
|
+
}
|
|
137
162
|
return {
|
|
138
|
-
errors
|
|
139
|
-
warnings
|
|
163
|
+
errors,
|
|
164
|
+
warnings,
|
|
140
165
|
totalSpent,
|
|
141
166
|
};
|
|
142
167
|
},
|
|
@@ -171,8 +196,16 @@ const dataset: CurrenciesData<Transaction> = {
|
|
|
171
196
|
}),
|
|
172
197
|
expectedStatus: (a, t) => {
|
|
173
198
|
invariant(t.memo === "Ledger Live", "Should have a memo");
|
|
199
|
+
const { cosmosResources } = a as CosmosAccount;
|
|
200
|
+
const errors: Record<string, Error> = {};
|
|
201
|
+
if (
|
|
202
|
+
cosmosResources &&
|
|
203
|
+
cosmosResources.redelegations.length >= COSMOS_MAX_REDELEGATIONS
|
|
204
|
+
) {
|
|
205
|
+
errors.redelegation = new CosmosTooManyRedelegations();
|
|
206
|
+
}
|
|
174
207
|
return {
|
|
175
|
-
errors
|
|
208
|
+
errors,
|
|
176
209
|
warnings: {},
|
|
177
210
|
};
|
|
178
211
|
},
|
|
@@ -190,11 +223,21 @@ const dataset: CurrenciesData<Transaction> = {
|
|
|
190
223
|
],
|
|
191
224
|
sourceValidator: "cosmosvaloper1sd4tl9aljmmezzudugs7zlaya7pg2895ws8tfs",
|
|
192
225
|
}),
|
|
193
|
-
expectedStatus: {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
226
|
+
expectedStatus: a => {
|
|
227
|
+
const { cosmosResources } = a as CosmosAccount;
|
|
228
|
+
const errors: Record<string, Error> = {};
|
|
229
|
+
if (
|
|
230
|
+
cosmosResources &&
|
|
231
|
+
cosmosResources.redelegations.length >= COSMOS_MAX_REDELEGATIONS
|
|
232
|
+
) {
|
|
233
|
+
errors.redelegation = new CosmosTooManyRedelegations();
|
|
234
|
+
} else {
|
|
235
|
+
errors.amount = new AmountRequired();
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
errors,
|
|
239
|
+
warnings: {},
|
|
240
|
+
};
|
|
198
241
|
},
|
|
199
242
|
},
|
|
200
243
|
{
|
|
@@ -210,11 +253,21 @@ const dataset: CurrenciesData<Transaction> = {
|
|
|
210
253
|
],
|
|
211
254
|
sourceValidator: "cosmosvaloper1sd4tl9aljmmezzudugs7zlaya7pg2895ws8tfs",
|
|
212
255
|
}),
|
|
213
|
-
expectedStatus: {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
256
|
+
expectedStatus: a => {
|
|
257
|
+
const { cosmosResources } = a as CosmosAccount;
|
|
258
|
+
const errors: Record<string, Error> = {};
|
|
259
|
+
if (
|
|
260
|
+
cosmosResources &&
|
|
261
|
+
cosmosResources.redelegations.length >= COSMOS_MAX_REDELEGATIONS
|
|
262
|
+
) {
|
|
263
|
+
errors.redelegation = new CosmosTooManyRedelegations();
|
|
264
|
+
} else {
|
|
265
|
+
errors.redelegation = new InvalidAddressBecauseDestinationIsAlsoSource();
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
errors,
|
|
269
|
+
warnings: {},
|
|
270
|
+
};
|
|
218
271
|
},
|
|
219
272
|
},
|
|
220
273
|
{
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export const isNoErrorReturnCode = (code: number) => code === 0x9000;
|
|
2
|
-
|
|
3
1
|
export const getPath = (path: string) => (path && path.substr(0, 2) !== "m/" ? `m/${path}` : path);
|
|
4
|
-
|
|
5
|
-
export const isError = (r: { return_code: number; error_message: string }) => {
|
|
6
|
-
if (!isNoErrorReturnCode(r.return_code)) throw new Error(`${r.return_code} - ${r.error_message}`);
|
|
7
|
-
};
|
|
@@ -2,43 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
import { createBridges } from "@ledgerhq/coin-filecoin/index";
|
|
4
4
|
import Transport from "@ledgerhq/hw-transport";
|
|
5
|
-
import FilecoinApp from "@zondax/ledger-filecoin";
|
|
5
|
+
import { FilecoinApp } from "@zondax/ledger-filecoin";
|
|
6
6
|
import filecoinResolver from "@ledgerhq/coin-filecoin/signer/index";
|
|
7
7
|
import { signMessage } from "@ledgerhq/coin-filecoin/hw-signMessage";
|
|
8
8
|
import type { Account, Bridge } from "@ledgerhq/types-live";
|
|
9
9
|
import makeCliTools from "@ledgerhq/coin-filecoin/test/cli";
|
|
10
10
|
import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
|
|
11
11
|
import { Resolver } from "../../hw/getAddress/types";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
Transaction,
|
|
15
|
-
FilecoinGetAddrResponse,
|
|
16
|
-
FilecoinSignature,
|
|
17
|
-
FilecoinSigner,
|
|
18
|
-
} from "./types";
|
|
19
|
-
import { getPath, isError } from "./common";
|
|
12
|
+
import { TransactionStatus, Transaction, FilecoinSigner } from "./types";
|
|
13
|
+
import { getPath } from "./common";
|
|
20
14
|
|
|
21
15
|
const createSigner: CreateSigner<FilecoinSigner> = (transport: Transport) => {
|
|
22
16
|
const filecoin = new FilecoinApp(transport);
|
|
23
17
|
return {
|
|
24
|
-
showAddressAndPubKey:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return r;
|
|
29
|
-
},
|
|
30
|
-
getAddressAndPubKey: async (path: string): Promise<FilecoinGetAddrResponse> => {
|
|
31
|
-
const r = await filecoin.getAddressAndPubKey(getPath(path));
|
|
32
|
-
isError(r);
|
|
33
|
-
|
|
34
|
-
return r;
|
|
35
|
-
},
|
|
36
|
-
sign: async (path: string, message: Uint8Array): Promise<FilecoinSignature> => {
|
|
37
|
-
const r = await filecoin.sign(getPath(path), message);
|
|
38
|
-
isError(r);
|
|
39
|
-
|
|
40
|
-
return r;
|
|
41
|
-
},
|
|
18
|
+
showAddressAndPubKey: (path: string) => filecoin.showAddressAndPubKey(getPath(path)),
|
|
19
|
+
getAddressAndPubKey: (path: string) => filecoin.getAddressAndPubKey(getPath(path)),
|
|
20
|
+
sign: (path: string, message: Uint8Array) => filecoin.sign(getPath(path), Buffer.from(message)),
|
|
42
21
|
};
|
|
43
22
|
};
|
|
44
23
|
|
|
@@ -160,7 +160,7 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
160
160
|
"delegation": {
|
|
161
161
|
"delegated": "334045080",
|
|
162
162
|
"nodeId": 18,
|
|
163
|
-
"pendingReward": "
|
|
163
|
+
"pendingReward": "102735",
|
|
164
164
|
},
|
|
165
165
|
"isAutoTokenAssociationEnabled": false,
|
|
166
166
|
"maxAutomaticTokenAssociations": 0,
|
|
@@ -188,12 +188,12 @@ exports[`hedera currency bridge scanAccounts hedera seed 1 1`] = `
|
|
|
188
188
|
"type": "TokenAccountRaw",
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
"balance": "
|
|
191
|
+
"balance": "40011",
|
|
192
192
|
"id": "js:2:hedera:0.0.8313485:hederaBip44+hedera%2Ferc20%2Fbonzo~!underscore!~atoken~!underscore!~usdc~!underscore!~0xb7687538c7f4cad022d5e97cc778d0b46457c5db",
|
|
193
193
|
"operationsCount": 4,
|
|
194
194
|
"parentId": "js:2:hedera:0.0.8313485:hederaBip44",
|
|
195
195
|
"pendingOperations": [],
|
|
196
|
-
"spendableBalance": "
|
|
196
|
+
"spendableBalance": "40011",
|
|
197
197
|
"swapHistory": [],
|
|
198
198
|
"tokenId": "hedera/erc20/bonzo_atoken_usdc_0xb7687538c7f4cad022d5e97cc778d0b46457c5db",
|
|
199
199
|
"type": "TokenAccountRaw",
|
|
@@ -585,6 +585,7 @@ export const DEFAULT_FEATURES: Features = {
|
|
|
585
585
|
manager: true,
|
|
586
586
|
accounts: true,
|
|
587
587
|
settings: true,
|
|
588
|
+
onboarding: true,
|
|
588
589
|
postOnboarding: true,
|
|
589
590
|
},
|
|
590
591
|
},
|
|
@@ -600,6 +601,8 @@ export const DEFAULT_FEATURES: Features = {
|
|
|
600
601
|
},
|
|
601
602
|
lwmLedgerSyncOptimisation: DEFAULT_FEATURE,
|
|
602
603
|
lwdLedgerSyncOptimisation: DEFAULT_FEATURE,
|
|
604
|
+
lwmNewWordingOptInNotificationsDrawer: DEFAULT_FEATURE,
|
|
605
|
+
lwmOptimizeOptInNotificationsToOptOutUsers: DEFAULT_FEATURE,
|
|
603
606
|
lldNanoSUpsellBanners: {
|
|
604
607
|
...DEFAULT_FEATURE,
|
|
605
608
|
params: {
|
|
@@ -740,7 +743,6 @@ export const DEFAULT_FEATURES: Features = {
|
|
|
740
743
|
lldRebornABtest: DEFAULT_FEATURE,
|
|
741
744
|
llmRebornABtest: DEFAULT_FEATURE,
|
|
742
745
|
lifiSolana: DEFAULT_FEATURE,
|
|
743
|
-
|
|
744
746
|
llmAnimatedSplashScreen: {
|
|
745
747
|
enabled: true,
|
|
746
748
|
params: {
|
|
@@ -748,6 +750,13 @@ export const DEFAULT_FEATURES: Features = {
|
|
|
748
750
|
android: true,
|
|
749
751
|
},
|
|
750
752
|
},
|
|
753
|
+
llmOnboardingEnableSync: initFeature({
|
|
754
|
+
enabled: false,
|
|
755
|
+
params: {
|
|
756
|
+
nanos: false,
|
|
757
|
+
touchscreens: false,
|
|
758
|
+
},
|
|
759
|
+
}),
|
|
751
760
|
};
|
|
752
761
|
|
|
753
762
|
// Firebase SDK treat JSON values as strings
|