@ledgerhq/live-cli 24.18.4-nightly.5 → 24.18.4-nightly.6
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 +48 -46
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -530283,7 +530283,7 @@ var require_package8 = __commonJS({
|
|
|
530283
530283
|
module2.exports = {
|
|
530284
530284
|
name: "@ledgerhq/live-common",
|
|
530285
530285
|
description: "Common ground for the Ledger Live apps",
|
|
530286
|
-
version: "34.35.0-nightly.
|
|
530286
|
+
version: "34.35.0-nightly.6",
|
|
530287
530287
|
repository: {
|
|
530288
530288
|
type: "git",
|
|
530289
530289
|
url: "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -537083,7 +537083,7 @@ var require_package9 = __commonJS({
|
|
|
537083
537083
|
"package.json"(exports2, module2) {
|
|
537084
537084
|
module2.exports = {
|
|
537085
537085
|
name: "@ledgerhq/live-cli",
|
|
537086
|
-
version: "24.18.4-nightly.
|
|
537086
|
+
version: "24.18.4-nightly.6",
|
|
537087
537087
|
description: "ledger-live CLI version",
|
|
537088
537088
|
repository: {
|
|
537089
537089
|
type: "git",
|
|
@@ -581545,7 +581545,11 @@ var DIRECTION;
|
|
|
581545
581545
|
DIRECTION2["OUT"] = "OUT";
|
|
581546
581546
|
DIRECTION2["UNKNOWN"] = "UNKNOWN";
|
|
581547
581547
|
})(DIRECTION || (DIRECTION = {}));
|
|
581548
|
-
var
|
|
581548
|
+
var TOKEN_TYPE;
|
|
581549
|
+
(function(TOKEN_TYPE2) {
|
|
581550
|
+
TOKEN_TYPE2["COIN"] = "coin";
|
|
581551
|
+
TOKEN_TYPE2["FUNGIBLE_ASSET"] = "fungible_asset";
|
|
581552
|
+
})(TOKEN_TYPE || (TOKEN_TYPE = {}));
|
|
581549
581553
|
var DEFAULT_GAS = new import_bignumber52.default(200);
|
|
581550
581554
|
var DEFAULT_GAS_PRICE = new import_bignumber52.default(100);
|
|
581551
581555
|
|
|
@@ -581726,7 +581730,7 @@ var detectType = (address4, tx, value5) => {
|
|
|
581726
581730
|
return type4;
|
|
581727
581731
|
};
|
|
581728
581732
|
function transactionsToOperations(address4, txs) {
|
|
581729
|
-
const operations = [
|
|
581733
|
+
const operations = [];
|
|
581730
581734
|
return txs.reduce((acc, tx) => {
|
|
581731
581735
|
if (tx === null) {
|
|
581732
581736
|
return acc;
|
|
@@ -581763,19 +581767,17 @@ function transactionsToOperations(address4, txs) {
|
|
|
581763
581767
|
processRecipients(payload, address4, op, function_address);
|
|
581764
581768
|
if (op.type !== DIRECTION.UNKNOWN && coin_id !== null) {
|
|
581765
581769
|
if (coin_id === APTOS_ASSET_ID) {
|
|
581766
|
-
acc
|
|
581770
|
+
acc.push(op);
|
|
581767
581771
|
return acc;
|
|
581768
581772
|
}
|
|
581769
581773
|
const token = findTokenByAddressInCurrency(coin_id.toLowerCase(), "aptos");
|
|
581770
581774
|
if (token !== void 0) {
|
|
581771
|
-
|
|
581772
|
-
|
|
581773
|
-
|
|
581774
|
-
|
|
581775
|
-
|
|
581776
|
-
|
|
581777
|
-
});
|
|
581778
|
-
}
|
|
581775
|
+
op.asset = {
|
|
581776
|
+
type: "token",
|
|
581777
|
+
standard: token.tokenType,
|
|
581778
|
+
contractAddress: token.contractAddress
|
|
581779
|
+
};
|
|
581780
|
+
acc.push(op);
|
|
581779
581781
|
}
|
|
581780
581782
|
}
|
|
581781
581783
|
return acc;
|
|
@@ -594752,7 +594754,7 @@ var AptosAPI = class {
|
|
|
594752
594754
|
}
|
|
594753
594755
|
async listOperations(address4, pagination) {
|
|
594754
594756
|
const transactions3 = await this.getAccountInfo(address4, pagination.minHeight.toString());
|
|
594755
|
-
const
|
|
594757
|
+
const newOperations = transactionsToOperations(address4, transactions3.transactions);
|
|
594756
594758
|
return [newOperations, ""];
|
|
594757
594759
|
}
|
|
594758
594760
|
async fetchTransactions(address4, gt2) {
|
|
@@ -594820,7 +594822,7 @@ var AptosAPI = class {
|
|
|
594820
594822
|
}
|
|
594821
594823
|
});
|
|
594822
594824
|
return response.map((x23) => ({
|
|
594823
|
-
|
|
594825
|
+
contractAddress: x23.asset_type ?? "-",
|
|
594824
594826
|
amount: (0, import_bignumber57.default)(x23.amount)
|
|
594825
594827
|
}));
|
|
594826
594828
|
}
|
|
@@ -594859,44 +594861,44 @@ function normalizeTransactionOptions(options22) {
|
|
|
594859
594861
|
}
|
|
594860
594862
|
|
|
594861
594863
|
// ../../libs/coin-modules/coin-aptos/lib-es/logic/buildTransaction.js
|
|
594862
|
-
var buildTransaction = async (account3, transaction, aptosClient2) => {
|
|
594864
|
+
var buildTransaction = async (account3, transaction, aptosClient2, contractAddress, tokenType) => {
|
|
594863
594865
|
const subAccount = findSubAccountById(account3, transaction.subAccountId ?? "");
|
|
594864
|
-
const
|
|
594866
|
+
const payloadContracAddress = subAccount ? subAccount.token.contractAddress : contractAddress;
|
|
594867
|
+
const payloadTokenType = subAccount?.token?.tokenType ?? tokenType;
|
|
594868
|
+
const txPayload = getPayload({
|
|
594869
|
+
amount: transaction.amount,
|
|
594870
|
+
recipient: transaction.recipient,
|
|
594871
|
+
contractAddress: payloadContracAddress,
|
|
594872
|
+
tokenType: payloadTokenType
|
|
594873
|
+
});
|
|
594865
594874
|
const txOptions = normalizeTransactionOptions(transaction.options);
|
|
594866
594875
|
const tx = await aptosClient2.generateTransaction(account3.freshAddress, txPayload, txOptions);
|
|
594867
594876
|
return tx;
|
|
594868
594877
|
};
|
|
594869
|
-
var getPayload = (
|
|
594870
|
-
if (
|
|
594871
|
-
|
|
594872
|
-
|
|
594873
|
-
|
|
594874
|
-
|
|
594875
|
-
|
|
594876
|
-
|
|
594877
|
-
|
|
594878
|
-
|
|
594879
|
-
|
|
594880
|
-
|
|
594881
|
-
|
|
594882
|
-
|
|
594883
|
-
]
|
|
594884
|
-
};
|
|
594885
|
-
}
|
|
594886
|
-
if (tokenType === "coin") {
|
|
594887
|
-
return {
|
|
594888
|
-
function: `0x1::aptos_account::transfer_coins`,
|
|
594889
|
-
typeArguments: [tokenAccount.token.contractAddress],
|
|
594890
|
-
functionArguments: [transaction.recipient, transaction.amount.toString()]
|
|
594891
|
-
};
|
|
594892
|
-
}
|
|
594878
|
+
var getPayload = (args3) => {
|
|
594879
|
+
if (args3.tokenType !== void 0 && !isTokenType(args3.tokenType)) {
|
|
594880
|
+
throw new Error(`Token type ${args3.tokenType} not supported`);
|
|
594881
|
+
}
|
|
594882
|
+
if (args3.tokenType === TOKEN_TYPE.FUNGIBLE_ASSET) {
|
|
594883
|
+
return {
|
|
594884
|
+
function: "0x1::primary_fungible_store::transfer",
|
|
594885
|
+
typeArguments: ["0x1::fungible_asset::Metadata"],
|
|
594886
|
+
functionArguments: [args3.contractAddress, args3.recipient, args3.amount.toString()]
|
|
594887
|
+
};
|
|
594888
|
+
}
|
|
594889
|
+
let address4 = args3.contractAddress ?? "";
|
|
594890
|
+
if (address4 === "") {
|
|
594891
|
+
address4 = APTOS_ASSET_ID;
|
|
594893
594892
|
}
|
|
594894
594893
|
return {
|
|
594895
594894
|
function: "0x1::aptos_account::transfer_coins",
|
|
594896
|
-
typeArguments: [
|
|
594897
|
-
functionArguments: [
|
|
594895
|
+
typeArguments: [address4],
|
|
594896
|
+
functionArguments: [args3.recipient, args3.amount.toString()]
|
|
594898
594897
|
};
|
|
594899
594898
|
};
|
|
594899
|
+
var isTokenType = (value5) => {
|
|
594900
|
+
return Object.values(TOKEN_TYPE).includes(value5);
|
|
594901
|
+
};
|
|
594900
594902
|
var buildTransaction_default = buildTransaction;
|
|
594901
594903
|
|
|
594902
594904
|
// ../../libs/coin-modules/coin-aptos/lib-es/bridge/getFeesForTransaction.js
|
|
@@ -804716,13 +804718,13 @@ var estimateMaxSpendable19 = async ({ account: account3, parentAccount, transact
|
|
|
804716
804718
|
if (balance.eq(0))
|
|
804717
804719
|
return balance;
|
|
804718
804720
|
const accountInfo = await fetchAccountInfo(mainAccount.freshAddress);
|
|
804719
|
-
const
|
|
804721
|
+
const isTokenType2 = isTokenAccount(account3);
|
|
804720
804722
|
if (transaction && !transaction.subAccountId) {
|
|
804721
|
-
transaction.subAccountId =
|
|
804723
|
+
transaction.subAccountId = isTokenType2 ? account3.id : null;
|
|
804722
804724
|
}
|
|
804723
804725
|
let tokenAccountTxn = false;
|
|
804724
804726
|
let subAccount;
|
|
804725
|
-
if (
|
|
804727
|
+
if (isTokenType2) {
|
|
804726
804728
|
tokenAccountTxn = true;
|
|
804727
804729
|
subAccount = account3;
|
|
804728
804730
|
}
|