@ledgerhq/live-cli 24.18.1-nightly.1 → 24.18.1-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/cli.js +14 -13
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -530269,7 +530269,7 @@ var require_package8 = __commonJS({
|
|
|
530269
530269
|
module2.exports = {
|
|
530270
530270
|
name: "@ledgerhq/live-common",
|
|
530271
530271
|
description: "Common ground for the Ledger Live apps",
|
|
530272
|
-
version: "34.33.0-nightly.
|
|
530272
|
+
version: "34.33.0-nightly.3",
|
|
530273
530273
|
repository: {
|
|
530274
530274
|
type: "git",
|
|
530275
530275
|
url: "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -537070,7 +537070,7 @@ var require_package9 = __commonJS({
|
|
|
537070
537070
|
"package.json"(exports2, module2) {
|
|
537071
537071
|
module2.exports = {
|
|
537072
537072
|
name: "@ledgerhq/live-cli",
|
|
537073
|
-
version: "24.18.1-nightly.
|
|
537073
|
+
version: "24.18.1-nightly.3",
|
|
537074
537074
|
description: "ledger-live CLI version",
|
|
537075
537075
|
repository: {
|
|
537076
537076
|
type: "git",
|
|
@@ -773359,7 +773359,7 @@ var estimateFeeAndSpendable = async (api8, account3, transaction) => {
|
|
|
773359
773359
|
function isTransferTx(tx) {
|
|
773360
773360
|
return !!tx && (tx.model.kind === "token.transfer" || tx.model.kind === "transfer");
|
|
773361
773361
|
}
|
|
773362
|
-
async function
|
|
773362
|
+
async function estimateTokenMaxSpendable(api8, account3, tx) {
|
|
773363
773363
|
if (isTransferTx(tx) && account3.extensions?.transferFee && account3.extensions.transferFee.feeBps > 0) {
|
|
773364
773364
|
const mint = await getMaybeTokenMint(account3.token.contractAddress, api8);
|
|
773365
773365
|
if (!mint || mint instanceof Error)
|
|
@@ -773383,7 +773383,7 @@ var estimateMaxSpendableWithAPI = async ({ account: account3, parentAccount, tra
|
|
|
773383
773383
|
case "Account":
|
|
773384
773384
|
return (await estimateFeeAndSpendable(api8, mainAccount, transaction)).spendable;
|
|
773385
773385
|
case "TokenAccount":
|
|
773386
|
-
return
|
|
773386
|
+
return estimateTokenMaxSpendable(api8, account3, transaction);
|
|
773387
773387
|
}
|
|
773388
773388
|
};
|
|
773389
773389
|
|
|
@@ -773541,7 +773541,7 @@ var deriveTokenTransferCommandDescriptor = async (mainAccount, tx, model, api8)
|
|
|
773541
773541
|
if (!tx.useAllAmount && tx.amount.lte(0)) {
|
|
773542
773542
|
errors.amount = new AmountRequired();
|
|
773543
773543
|
}
|
|
773544
|
-
const spendableBalance = await
|
|
773544
|
+
const spendableBalance = await estimateTokenMaxSpendable(api8, tokenAccount, tx);
|
|
773545
773545
|
const txAmount = tx.useAllAmount ? spendableBalance.toNumber() : tx.amount.toNumber();
|
|
773546
773546
|
if (!errors.amount && txAmount > spendableBalance.toNumber()) {
|
|
773547
773547
|
errors.amount = new NotEnoughBalance();
|
|
@@ -803800,12 +803800,14 @@ var getTrc20 = async (url4) => {
|
|
|
803800
803800
|
};
|
|
803801
803801
|
};
|
|
803802
803802
|
var defaultFetchParams = {
|
|
803803
|
-
|
|
803804
|
-
minTimestamp: 0
|
|
803803
|
+
limitPerCall: 100,
|
|
803804
|
+
minTimestamp: 0,
|
|
803805
|
+
order: "desc"
|
|
803805
803806
|
};
|
|
803806
803807
|
async function fetchTronAccountTxs(addr, shouldFetchMoreTxs, cacheTransactionInfoById, params) {
|
|
803807
|
-
const
|
|
803808
|
-
const
|
|
803808
|
+
const adjustedLimitPerCall = params.hintGlobalLimit ? Math.min(params.limitPerCall, params.hintGlobalLimit) : params.limitPerCall;
|
|
803809
|
+
const queryParams = `limit=${adjustedLimitPerCall}&min_timestamp=${params.minTimestamp}&order_by=block_timestamp,${params.order}`;
|
|
803810
|
+
const nativeTxs = (await getAllTransactions(`${getBaseApiUrl2()}/v1/accounts/${addr}/transactions?${queryParams}`, shouldFetchMoreTxs, getTransactions4(cacheTransactionInfoById))).filter(isTransactionTronAPI).filter((tx) => {
|
|
803809
803811
|
const hasInternalTxs = tx.txID && tx.internal_transactions && tx.internal_transactions.length > 0;
|
|
803810
803812
|
const isDuplicated = tx.tx_id;
|
|
803811
803813
|
const type5 = tx.raw_data.contract[0].type;
|
|
@@ -803814,8 +803816,7 @@ async function fetchTronAccountTxs(addr, shouldFetchMoreTxs, cacheTransactionInf
|
|
|
803814
803816
|
}
|
|
803815
803817
|
return !isDuplicated && !hasInternalTxs && type5 !== "TriggerSmartContract";
|
|
803816
803818
|
}).map((tx) => formatTrongridTxResponse(tx));
|
|
803817
|
-
const
|
|
803818
|
-
const trc20Txs = (await getAllTransactions(`${getBaseApiUrl2()}/v1/accounts/${addr}/transactions/trc20?${queryParamsTrc20Txs}&get_detail=true`, shouldFetchMoreTxs, getTrc20)).map((tx) => formatTrongridTrc20TxResponse(tx));
|
|
803819
|
+
const trc20Txs = (await getAllTransactions(`${getBaseApiUrl2()}/v1/accounts/${addr}/transactions/trc20?${queryParams}&get_detail=true`, shouldFetchMoreTxs, getTrc20)).map((tx) => formatTrongridTrc20TxResponse(tx));
|
|
803819
803820
|
const txInfos = (0, import_compact5.default)(nativeTxs.concat(trc20Txs)).sort((a62, b19) => b19.date.getTime() - a62.date.getTime());
|
|
803820
803821
|
return txInfos;
|
|
803821
803822
|
}
|
|
@@ -832933,8 +832934,8 @@ var solana = {
|
|
|
832933
832934
|
},
|
|
832934
832935
|
test: (input) => {
|
|
832935
832936
|
const { accountBeforeTransaction, account: account3, operation } = input;
|
|
832936
|
-
const
|
|
832937
|
-
botTest("operation value should be estimated max spendable", () => (0, import_expect15.default)(operation.value.toNumber()).toBe(
|
|
832937
|
+
const estimatedMaxSpendable = import_bignumber387.default.max(accountBeforeTransaction.spendableBalance.minus(SYSTEM_ACCOUNT_RENT_EXEMPT), 0).toNumber();
|
|
832938
|
+
botTest("operation value should be estimated max spendable", () => (0, import_expect15.default)(operation.value.toNumber()).toBe(estimatedMaxSpendable));
|
|
832938
832939
|
botTest("account spendableBalance should be zero", () => (0, import_expect15.default)(account3.spendableBalance.toNumber()).toBe(0));
|
|
832939
832940
|
expectCorrectBalanceChange2(input);
|
|
832940
832941
|
expectCorrectMemo(input);
|