@ledgerhq/live-cli 24.24.0-nightly.5 → 24.24.0-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 +353 -325
- package/package.json +2 -2
package/lib/cli.js
CHANGED
|
@@ -513744,7 +513744,7 @@ var require_package7 = __commonJS({
|
|
|
513744
513744
|
module2.exports = {
|
|
513745
513745
|
name: "@ledgerhq/live-common",
|
|
513746
513746
|
description: "Common ground for the Ledger Live apps",
|
|
513747
|
-
version: "34.49.0-nightly.
|
|
513747
|
+
version: "34.49.0-nightly.6",
|
|
513748
513748
|
repository: {
|
|
513749
513749
|
type: "git",
|
|
513750
513750
|
url: "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -514079,7 +514079,7 @@ var require_package8 = __commonJS({
|
|
|
514079
514079
|
"package.json"(exports2, module2) {
|
|
514080
514080
|
module2.exports = {
|
|
514081
514081
|
name: "@ledgerhq/live-cli",
|
|
514082
|
-
version: "24.24.0-nightly.
|
|
514082
|
+
version: "24.24.0-nightly.6",
|
|
514083
514083
|
description: "ledger-live CLI version",
|
|
514084
514084
|
repository: {
|
|
514085
514085
|
type: "git",
|
|
@@ -618909,6 +618909,339 @@ function combine3(tx, signature4) {
|
|
|
618909
618909
|
}).serialized;
|
|
618910
618910
|
}
|
|
618911
618911
|
|
|
618912
|
+
// ../../libs/coin-modules/coin-evm/lib-es/abis/sei.abi.json
|
|
618913
|
+
var sei_abi_default = [
|
|
618914
|
+
{
|
|
618915
|
+
inputs: [{ internalType: "string", name: "valAddress", type: "string" }],
|
|
618916
|
+
name: "delegate",
|
|
618917
|
+
outputs: [{ internalType: "bool", name: "success", type: "bool" }],
|
|
618918
|
+
stateMutability: "payable",
|
|
618919
|
+
type: "function"
|
|
618920
|
+
},
|
|
618921
|
+
{
|
|
618922
|
+
inputs: [
|
|
618923
|
+
{ internalType: "string", name: "srcAddress", type: "string" },
|
|
618924
|
+
{ internalType: "string", name: "dstAddress", type: "string" },
|
|
618925
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
618926
|
+
],
|
|
618927
|
+
name: "redelegate",
|
|
618928
|
+
outputs: [{ internalType: "bool", name: "success", type: "bool" }],
|
|
618929
|
+
stateMutability: "nonpayable",
|
|
618930
|
+
type: "function"
|
|
618931
|
+
},
|
|
618932
|
+
{
|
|
618933
|
+
inputs: [
|
|
618934
|
+
{ internalType: "string", name: "valAddress", type: "string" },
|
|
618935
|
+
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
618936
|
+
],
|
|
618937
|
+
name: "undelegate",
|
|
618938
|
+
outputs: [{ internalType: "bool", name: "success", type: "bool" }],
|
|
618939
|
+
stateMutability: "nonpayable",
|
|
618940
|
+
type: "function"
|
|
618941
|
+
},
|
|
618942
|
+
{
|
|
618943
|
+
inputs: [
|
|
618944
|
+
{ internalType: "address", name: "delegator", type: "address" },
|
|
618945
|
+
{ internalType: "string", name: "valAddress", type: "string" }
|
|
618946
|
+
],
|
|
618947
|
+
name: "delegation",
|
|
618948
|
+
outputs: [
|
|
618949
|
+
{
|
|
618950
|
+
components: [
|
|
618951
|
+
{
|
|
618952
|
+
components: [
|
|
618953
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
618954
|
+
{ internalType: "string", name: "denom", type: "string" }
|
|
618955
|
+
],
|
|
618956
|
+
internalType: "struct Balance",
|
|
618957
|
+
name: "balance",
|
|
618958
|
+
type: "tuple"
|
|
618959
|
+
},
|
|
618960
|
+
{
|
|
618961
|
+
components: [
|
|
618962
|
+
{ internalType: "string", name: "delegator_address", type: "string" },
|
|
618963
|
+
{ internalType: "uint256", name: "shares", type: "uint256" },
|
|
618964
|
+
{ internalType: "uint256", name: "decimals", type: "uint256" },
|
|
618965
|
+
{ internalType: "string", name: "validator_address", type: "string" }
|
|
618966
|
+
],
|
|
618967
|
+
internalType: "struct DelegationDetails",
|
|
618968
|
+
name: "delegation",
|
|
618969
|
+
type: "tuple"
|
|
618970
|
+
}
|
|
618971
|
+
],
|
|
618972
|
+
internalType: "struct Delegation",
|
|
618973
|
+
name: "",
|
|
618974
|
+
type: "tuple"
|
|
618975
|
+
}
|
|
618976
|
+
],
|
|
618977
|
+
stateMutability: "view",
|
|
618978
|
+
type: "function"
|
|
618979
|
+
}
|
|
618980
|
+
];
|
|
618981
|
+
|
|
618982
|
+
// ../../libs/coin-modules/coin-evm/lib-es/abis/celo.abi.json
|
|
618983
|
+
var celo_abi_default = [
|
|
618984
|
+
{
|
|
618985
|
+
inputs: [
|
|
618986
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
618987
|
+
{ internalType: "uint256", name: "value", type: "uint256" }
|
|
618988
|
+
],
|
|
618989
|
+
name: "delegateGovernanceVotes",
|
|
618990
|
+
outputs: [],
|
|
618991
|
+
stateMutability: "nonpayable",
|
|
618992
|
+
type: "function"
|
|
618993
|
+
},
|
|
618994
|
+
{
|
|
618995
|
+
inputs: [
|
|
618996
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
618997
|
+
{ internalType: "uint256", name: "value", type: "uint256" }
|
|
618998
|
+
],
|
|
618999
|
+
name: "revokeDelegatedGovernanceVotes",
|
|
619000
|
+
outputs: [],
|
|
619001
|
+
stateMutability: "nonpayable",
|
|
619002
|
+
type: "function"
|
|
619003
|
+
},
|
|
619004
|
+
{
|
|
619005
|
+
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
619006
|
+
name: "getAccountTotalLockedGold",
|
|
619007
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
619008
|
+
stateMutability: "view",
|
|
619009
|
+
type: "function"
|
|
619010
|
+
},
|
|
619011
|
+
{
|
|
619012
|
+
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
619013
|
+
name: "getTotalPendingWithdrawals",
|
|
619014
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
619015
|
+
stateMutability: "view",
|
|
619016
|
+
type: "function"
|
|
619017
|
+
}
|
|
619018
|
+
];
|
|
619019
|
+
|
|
619020
|
+
// ../../libs/coin-modules/coin-evm/lib-es/staking/abis.js
|
|
619021
|
+
var STAKING_ABIS = {
|
|
619022
|
+
// Sei EVM staking contract
|
|
619023
|
+
sei_network_evm: sei_abi_default,
|
|
619024
|
+
// Celo staking contract
|
|
619025
|
+
celo: celo_abi_default
|
|
619026
|
+
};
|
|
619027
|
+
var getStakingABI = (currencyId) => {
|
|
619028
|
+
return STAKING_ABIS[currencyId];
|
|
619029
|
+
};
|
|
619030
|
+
|
|
619031
|
+
// ../../libs/coin-modules/coin-evm/lib-es/staking/encoder.js
|
|
619032
|
+
var encodeStakingData = (encodeParams2) => {
|
|
619033
|
+
const { currencyId, operation, config: config4, params } = encodeParams2;
|
|
619034
|
+
const abi = getStakingABI(currencyId);
|
|
619035
|
+
if (!abi) {
|
|
619036
|
+
throw new Error(`No ABI found for staking currency: ${currencyId}`);
|
|
619037
|
+
}
|
|
619038
|
+
const functionName = config4.functions[operation];
|
|
619039
|
+
if (!functionName) {
|
|
619040
|
+
throw new Error(`Operation '${operation}' not supported for currency: ${currencyId}`);
|
|
619041
|
+
}
|
|
619042
|
+
const iface = new ethers_exports.Interface(abi);
|
|
619043
|
+
return iface.encodeFunctionData(functionName, params);
|
|
619044
|
+
};
|
|
619045
|
+
var decodeStakingResult = (currencyId, operation, config4, result2) => {
|
|
619046
|
+
const abi = getStakingABI(currencyId);
|
|
619047
|
+
if (!abi) {
|
|
619048
|
+
throw new Error(`No ABI found for staking currency: ${currencyId}`);
|
|
619049
|
+
}
|
|
619050
|
+
const functionName = config4.functions[operation];
|
|
619051
|
+
if (!functionName) {
|
|
619052
|
+
throw new Error(`Operation '${operation}' not supported for currency: ${currencyId}`);
|
|
619053
|
+
}
|
|
619054
|
+
const iface = new ethers_exports.Interface(abi);
|
|
619055
|
+
return iface.decodeFunctionResult(functionName, result2);
|
|
619056
|
+
};
|
|
619057
|
+
|
|
619058
|
+
// ../../libs/coin-modules/coin-evm/lib-es/staking/transactionData.js
|
|
619059
|
+
var STAKING_PROTOCOLS = {
|
|
619060
|
+
sei_network_evm: {
|
|
619061
|
+
delegate: (recipient) => [recipient],
|
|
619062
|
+
undelegate: (recipient, amount) => [recipient, amount],
|
|
619063
|
+
redelegate: (recipient, amount, sourceValidator) => {
|
|
619064
|
+
if (!sourceValidator)
|
|
619065
|
+
throw new Error("SEI redelegate requires sourceValidator");
|
|
619066
|
+
return [sourceValidator, recipient, amount];
|
|
619067
|
+
},
|
|
619068
|
+
getStakedBalance: (_recipient, _amount, sourceValidator, delegator) => {
|
|
619069
|
+
if (!delegator || !sourceValidator) {
|
|
619070
|
+
throw new Error("SEI getStakedBalance requires delegator and validator");
|
|
619071
|
+
}
|
|
619072
|
+
return [delegator, sourceValidator];
|
|
619073
|
+
}
|
|
619074
|
+
},
|
|
619075
|
+
celo: {
|
|
619076
|
+
delegate: (recipient, amount) => [recipient, amount],
|
|
619077
|
+
undelegate: (recipient, amount) => [recipient, amount],
|
|
619078
|
+
redelegate: () => {
|
|
619079
|
+
throw new Error("Celo does not support redelegate");
|
|
619080
|
+
},
|
|
619081
|
+
getStakedBalance: (recipient) => [recipient],
|
|
619082
|
+
getUnstakedBalance: (recipient) => [recipient]
|
|
619083
|
+
}
|
|
619084
|
+
};
|
|
619085
|
+
var buildTransactionParams = (currencyId, transactionType, recipient, amount, sourceValidator, delegator) => {
|
|
619086
|
+
const protocol = STAKING_PROTOCOLS[currencyId];
|
|
619087
|
+
if (!protocol) {
|
|
619088
|
+
throw new Error(`Unsupported staking currency: ${currencyId}`);
|
|
619089
|
+
}
|
|
619090
|
+
const operation = protocol[transactionType];
|
|
619091
|
+
if (!operation) {
|
|
619092
|
+
throw new Error(`Unsupported transaction type for ${currencyId}: ${transactionType}`);
|
|
619093
|
+
}
|
|
619094
|
+
return operation(recipient, amount, sourceValidator, delegator);
|
|
619095
|
+
};
|
|
619096
|
+
|
|
619097
|
+
// ../../libs/coin-modules/coin-evm/lib-es/staking/validators.js
|
|
619098
|
+
var seiValidatorApi = {
|
|
619099
|
+
fetchValidators: async (config4) => {
|
|
619100
|
+
const { baseUrl, validatorsEndpoint } = config4;
|
|
619101
|
+
if (!baseUrl)
|
|
619102
|
+
return [];
|
|
619103
|
+
try {
|
|
619104
|
+
const { data: data12 } = await lib_es_default({
|
|
619105
|
+
url: `${baseUrl}${validatorsEndpoint}`,
|
|
619106
|
+
method: "GET"
|
|
619107
|
+
});
|
|
619108
|
+
return Array.isArray(data12?.validators) ? data12.validators.map((v34) => v34?.operator_address).filter((addr) => typeof addr === "string") : [];
|
|
619109
|
+
} catch (error) {
|
|
619110
|
+
console.error("Failed to fetch SEI validators", {
|
|
619111
|
+
error: error instanceof Error ? error.message : String(error),
|
|
619112
|
+
baseUrl
|
|
619113
|
+
});
|
|
619114
|
+
return [];
|
|
619115
|
+
}
|
|
619116
|
+
}
|
|
619117
|
+
};
|
|
619118
|
+
var getValidatorApi = (currencyId) => {
|
|
619119
|
+
switch (currencyId) {
|
|
619120
|
+
case "sei_network_evm":
|
|
619121
|
+
return seiValidatorApi;
|
|
619122
|
+
default:
|
|
619123
|
+
return void 0;
|
|
619124
|
+
}
|
|
619125
|
+
};
|
|
619126
|
+
var getValidators2 = async (currencyId, apiConfig) => {
|
|
619127
|
+
const api7 = getValidatorApi(currencyId);
|
|
619128
|
+
return api7 && apiConfig ? api7.fetchValidators(apiConfig) : [];
|
|
619129
|
+
};
|
|
619130
|
+
|
|
619131
|
+
// ../../libs/coin-modules/coin-evm/lib-es/staking/fetchers.js
|
|
619132
|
+
var createStakingFetcher = (getValidatorsFn) => {
|
|
619133
|
+
return async (address3, config4, currency24) => {
|
|
619134
|
+
const validators7 = await getValidatorsFn(config4, currency24);
|
|
619135
|
+
const logPrefix = currency24.id === "sei_network_evm" ? "SEI" : "CELO";
|
|
619136
|
+
return getStakesForValidators(address3, config4, currency24, validators7, logPrefix);
|
|
619137
|
+
};
|
|
619138
|
+
};
|
|
619139
|
+
var STAKING_CONFIG = {
|
|
619140
|
+
sei_network_evm: {
|
|
619141
|
+
fetcher: createStakingFetcher(async (config4, currency24) => await getValidators2(currency24.id, config4.apiConfig))
|
|
619142
|
+
},
|
|
619143
|
+
celo: {
|
|
619144
|
+
fetcher: createStakingFetcher(async (config4) => [config4.contractAddress])
|
|
619145
|
+
}
|
|
619146
|
+
};
|
|
619147
|
+
var AMOUNT_EXTRACTORS = {
|
|
619148
|
+
sei_network_evm: (decoded) => {
|
|
619149
|
+
const delegation = extractSeiDelegation(decoded);
|
|
619150
|
+
return getSeiDelegationAmount(delegation);
|
|
619151
|
+
},
|
|
619152
|
+
celo: getCeloAmount
|
|
619153
|
+
};
|
|
619154
|
+
var getAmountFromDecoded = (currencyId, decoded) => {
|
|
619155
|
+
const extractor = AMOUNT_EXTRACTORS[currencyId];
|
|
619156
|
+
return extractor ? extractor(decoded) : 0n;
|
|
619157
|
+
};
|
|
619158
|
+
var createStakeFromContract = async (stakingContract) => {
|
|
619159
|
+
const { currency: currency24, config: config4, address: address3, currencyId, validatorAddress } = stakingContract;
|
|
619160
|
+
return withApi(currency24, async (rpcProvider) => {
|
|
619161
|
+
try {
|
|
619162
|
+
const params = buildTransactionParams(currencyId, "getStakedBalance", address3, 0n, validatorAddress, address3);
|
|
619163
|
+
const encodedData = encodeStakingData({
|
|
619164
|
+
currencyId,
|
|
619165
|
+
operation: "getStakedBalance",
|
|
619166
|
+
config: config4,
|
|
619167
|
+
params
|
|
619168
|
+
});
|
|
619169
|
+
const result2 = await rpcProvider.call({
|
|
619170
|
+
to: config4.contractAddress,
|
|
619171
|
+
data: encodedData
|
|
619172
|
+
});
|
|
619173
|
+
const decoded = decodeStakingResult(currencyId, "getStakedBalance", config4, result2);
|
|
619174
|
+
const amount = getAmountFromDecoded(currencyId, decoded);
|
|
619175
|
+
if (amount === 0n) {
|
|
619176
|
+
return null;
|
|
619177
|
+
}
|
|
619178
|
+
return {
|
|
619179
|
+
uid: `${config4.contractAddress}-${validatorAddress}-${address3}`,
|
|
619180
|
+
address: address3,
|
|
619181
|
+
delegate: validatorAddress,
|
|
619182
|
+
state: "active",
|
|
619183
|
+
asset: {
|
|
619184
|
+
type: "native",
|
|
619185
|
+
name: currency24.name,
|
|
619186
|
+
unit: currency24.units[0]
|
|
619187
|
+
},
|
|
619188
|
+
amount,
|
|
619189
|
+
details: {
|
|
619190
|
+
contractAddress: config4.contractAddress,
|
|
619191
|
+
validator: validatorAddress
|
|
619192
|
+
}
|
|
619193
|
+
};
|
|
619194
|
+
} catch (error) {
|
|
619195
|
+
console.error("Staking fetch failed", error);
|
|
619196
|
+
return null;
|
|
619197
|
+
}
|
|
619198
|
+
});
|
|
619199
|
+
};
|
|
619200
|
+
var getStakesForValidators = async (address3, config4, currency24, validators7, logPrefix = "Staking") => {
|
|
619201
|
+
if (validators7.length === 0) {
|
|
619202
|
+
console.error(`No validators available for ${logPrefix}`, { currencyId: currency24.id });
|
|
619203
|
+
return [];
|
|
619204
|
+
}
|
|
619205
|
+
const stakePromises = validators7.map((validator2) => createStakeFromContract({
|
|
619206
|
+
address: address3,
|
|
619207
|
+
config: config4,
|
|
619208
|
+
currencyId: currency24.id,
|
|
619209
|
+
currency: currency24,
|
|
619210
|
+
validatorAddress: validator2
|
|
619211
|
+
}).catch((error) => {
|
|
619212
|
+
console.error(`Failed to fetch ${logPrefix} stake for validator`, {
|
|
619213
|
+
validator: validator2,
|
|
619214
|
+
currencyId: currency24.id,
|
|
619215
|
+
address: address3,
|
|
619216
|
+
error: error instanceof Error ? error.message : String(error)
|
|
619217
|
+
});
|
|
619218
|
+
return null;
|
|
619219
|
+
}));
|
|
619220
|
+
const results2 = await Promise.allSettled(stakePromises);
|
|
619221
|
+
const stakes = [];
|
|
619222
|
+
results2.forEach((result2) => {
|
|
619223
|
+
if (result2.status === "fulfilled" && result2.value) {
|
|
619224
|
+
stakes.push(result2.value);
|
|
619225
|
+
}
|
|
619226
|
+
});
|
|
619227
|
+
return stakes;
|
|
619228
|
+
};
|
|
619229
|
+
|
|
619230
|
+
// ../../libs/coin-modules/coin-evm/lib-es/logic/getStakes.js
|
|
619231
|
+
var getStakes = async (currency24, address3) => {
|
|
619232
|
+
const contractConfig = STAKING_CONTRACTS[currency24.id];
|
|
619233
|
+
if (!contractConfig) {
|
|
619234
|
+
return { items: [] };
|
|
619235
|
+
}
|
|
619236
|
+
try {
|
|
619237
|
+
const stakingStrategy = STAKING_CONFIG[currency24.id];
|
|
619238
|
+
const stakes = await stakingStrategy?.fetcher(address3, contractConfig, currency24) || [];
|
|
619239
|
+
return { items: stakes };
|
|
619240
|
+
} catch {
|
|
619241
|
+
return { items: [] };
|
|
619242
|
+
}
|
|
619243
|
+
};
|
|
619244
|
+
|
|
618912
619245
|
// ../../libs/coin-modules/coin-evm/lib-es/logic/getBalance.js
|
|
618913
619246
|
var TOKEN_BALANCE_BATCH_SIZE = 10;
|
|
618914
619247
|
async function getBalance3(currency24, address3) {
|
|
@@ -618928,7 +619261,21 @@ async function getNativeBalance(currency24, address3, nodeApi) {
|
|
|
618928
619261
|
};
|
|
618929
619262
|
}
|
|
618930
619263
|
async function getTokenBalances(currency24, address3, nodeApi, explorerApi2) {
|
|
618931
|
-
const
|
|
619264
|
+
const balances = [];
|
|
619265
|
+
const [stakingResult, tokenOperationsResult] = await Promise.allSettled([
|
|
619266
|
+
getStakes(currency24, address3),
|
|
619267
|
+
explorerApi2.getLastOperations(currency24, address3, `js:2:${currency24.id}:${address3}:`, 0)
|
|
619268
|
+
]);
|
|
619269
|
+
if (stakingResult.status === "fulfilled") {
|
|
619270
|
+
stakingResult.value.items.forEach((stake) => {
|
|
619271
|
+
balances.push({
|
|
619272
|
+
value: stake.amount,
|
|
619273
|
+
asset: stake.asset,
|
|
619274
|
+
stake
|
|
619275
|
+
});
|
|
619276
|
+
});
|
|
619277
|
+
}
|
|
619278
|
+
const lastTokenOperations = tokenOperationsResult.status === "fulfilled" ? tokenOperationsResult.value.lastTokenOperations : [];
|
|
618932
619279
|
const contracts = /* @__PURE__ */ new Set();
|
|
618933
619280
|
const assets = /* @__PURE__ */ new Map();
|
|
618934
619281
|
for (const operation of lastTokenOperations) {
|
|
@@ -618950,7 +619297,6 @@ async function getTokenBalances(currency24, address3, nodeApi, explorerApi2) {
|
|
|
618950
619297
|
});
|
|
618951
619298
|
}
|
|
618952
619299
|
}
|
|
618953
|
-
const balances = [];
|
|
618954
619300
|
const contractsArray = Array.from(contracts);
|
|
618955
619301
|
for (let i54 = 0; i54 < contractsArray.length; i54 += TOKEN_BALANCE_BATCH_SIZE) {
|
|
618956
619302
|
const chunk5 = contractsArray.slice(i54, i54 + TOKEN_BALANCE_BATCH_SIZE);
|
|
@@ -619368,324 +619714,6 @@ function getAssetFromToken(currency24, token, owner) {
|
|
|
619368
619714
|
};
|
|
619369
619715
|
}
|
|
619370
619716
|
|
|
619371
|
-
// ../../libs/coin-modules/coin-evm/lib-es/abis/sei.abi.json
|
|
619372
|
-
var sei_abi_default = [
|
|
619373
|
-
{
|
|
619374
|
-
inputs: [{ internalType: "string", name: "valAddress", type: "string" }],
|
|
619375
|
-
name: "delegate",
|
|
619376
|
-
outputs: [{ internalType: "bool", name: "success", type: "bool" }],
|
|
619377
|
-
stateMutability: "payable",
|
|
619378
|
-
type: "function"
|
|
619379
|
-
},
|
|
619380
|
-
{
|
|
619381
|
-
inputs: [
|
|
619382
|
-
{ internalType: "string", name: "srcAddress", type: "string" },
|
|
619383
|
-
{ internalType: "string", name: "dstAddress", type: "string" },
|
|
619384
|
-
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
619385
|
-
],
|
|
619386
|
-
name: "redelegate",
|
|
619387
|
-
outputs: [{ internalType: "bool", name: "success", type: "bool" }],
|
|
619388
|
-
stateMutability: "nonpayable",
|
|
619389
|
-
type: "function"
|
|
619390
|
-
},
|
|
619391
|
-
{
|
|
619392
|
-
inputs: [
|
|
619393
|
-
{ internalType: "string", name: "valAddress", type: "string" },
|
|
619394
|
-
{ internalType: "uint256", name: "amount", type: "uint256" }
|
|
619395
|
-
],
|
|
619396
|
-
name: "undelegate",
|
|
619397
|
-
outputs: [{ internalType: "bool", name: "success", type: "bool" }],
|
|
619398
|
-
stateMutability: "nonpayable",
|
|
619399
|
-
type: "function"
|
|
619400
|
-
},
|
|
619401
|
-
{
|
|
619402
|
-
inputs: [
|
|
619403
|
-
{ internalType: "address", name: "delegator", type: "address" },
|
|
619404
|
-
{ internalType: "string", name: "valAddress", type: "string" }
|
|
619405
|
-
],
|
|
619406
|
-
name: "delegation",
|
|
619407
|
-
outputs: [
|
|
619408
|
-
{
|
|
619409
|
-
components: [
|
|
619410
|
-
{
|
|
619411
|
-
components: [
|
|
619412
|
-
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
619413
|
-
{ internalType: "string", name: "denom", type: "string" }
|
|
619414
|
-
],
|
|
619415
|
-
internalType: "struct Balance",
|
|
619416
|
-
name: "balance",
|
|
619417
|
-
type: "tuple"
|
|
619418
|
-
},
|
|
619419
|
-
{
|
|
619420
|
-
components: [
|
|
619421
|
-
{ internalType: "string", name: "delegator_address", type: "string" },
|
|
619422
|
-
{ internalType: "uint256", name: "shares", type: "uint256" },
|
|
619423
|
-
{ internalType: "uint256", name: "decimals", type: "uint256" },
|
|
619424
|
-
{ internalType: "string", name: "validator_address", type: "string" }
|
|
619425
|
-
],
|
|
619426
|
-
internalType: "struct DelegationDetails",
|
|
619427
|
-
name: "delegation",
|
|
619428
|
-
type: "tuple"
|
|
619429
|
-
}
|
|
619430
|
-
],
|
|
619431
|
-
internalType: "struct Delegation",
|
|
619432
|
-
name: "",
|
|
619433
|
-
type: "tuple"
|
|
619434
|
-
}
|
|
619435
|
-
],
|
|
619436
|
-
stateMutability: "view",
|
|
619437
|
-
type: "function"
|
|
619438
|
-
}
|
|
619439
|
-
];
|
|
619440
|
-
|
|
619441
|
-
// ../../libs/coin-modules/coin-evm/lib-es/abis/celo.abi.json
|
|
619442
|
-
var celo_abi_default = [
|
|
619443
|
-
{
|
|
619444
|
-
inputs: [
|
|
619445
|
-
{ internalType: "address", name: "account", type: "address" },
|
|
619446
|
-
{ internalType: "uint256", name: "value", type: "uint256" }
|
|
619447
|
-
],
|
|
619448
|
-
name: "delegateGovernanceVotes",
|
|
619449
|
-
outputs: [],
|
|
619450
|
-
stateMutability: "nonpayable",
|
|
619451
|
-
type: "function"
|
|
619452
|
-
},
|
|
619453
|
-
{
|
|
619454
|
-
inputs: [
|
|
619455
|
-
{ internalType: "address", name: "account", type: "address" },
|
|
619456
|
-
{ internalType: "uint256", name: "value", type: "uint256" }
|
|
619457
|
-
],
|
|
619458
|
-
name: "revokeDelegatedGovernanceVotes",
|
|
619459
|
-
outputs: [],
|
|
619460
|
-
stateMutability: "nonpayable",
|
|
619461
|
-
type: "function"
|
|
619462
|
-
},
|
|
619463
|
-
{
|
|
619464
|
-
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
619465
|
-
name: "getAccountTotalLockedGold",
|
|
619466
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
619467
|
-
stateMutability: "view",
|
|
619468
|
-
type: "function"
|
|
619469
|
-
},
|
|
619470
|
-
{
|
|
619471
|
-
inputs: [{ internalType: "address", name: "account", type: "address" }],
|
|
619472
|
-
name: "getTotalPendingWithdrawals",
|
|
619473
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
619474
|
-
stateMutability: "view",
|
|
619475
|
-
type: "function"
|
|
619476
|
-
}
|
|
619477
|
-
];
|
|
619478
|
-
|
|
619479
|
-
// ../../libs/coin-modules/coin-evm/lib-es/staking/abis.js
|
|
619480
|
-
var STAKING_ABIS = {
|
|
619481
|
-
// Sei EVM staking contract
|
|
619482
|
-
sei_network_evm: sei_abi_default,
|
|
619483
|
-
// Celo staking contract
|
|
619484
|
-
celo: celo_abi_default
|
|
619485
|
-
};
|
|
619486
|
-
var getStakingABI = (currencyId) => {
|
|
619487
|
-
return STAKING_ABIS[currencyId];
|
|
619488
|
-
};
|
|
619489
|
-
|
|
619490
|
-
// ../../libs/coin-modules/coin-evm/lib-es/staking/encoder.js
|
|
619491
|
-
var encodeStakingData = (encodeParams2) => {
|
|
619492
|
-
const { currencyId, operation, config: config4, params } = encodeParams2;
|
|
619493
|
-
const abi = getStakingABI(currencyId);
|
|
619494
|
-
if (!abi) {
|
|
619495
|
-
throw new Error(`No ABI found for staking currency: ${currencyId}`);
|
|
619496
|
-
}
|
|
619497
|
-
const functionName = config4.functions[operation];
|
|
619498
|
-
if (!functionName) {
|
|
619499
|
-
throw new Error(`Operation '${operation}' not supported for currency: ${currencyId}`);
|
|
619500
|
-
}
|
|
619501
|
-
const iface = new ethers_exports.Interface(abi);
|
|
619502
|
-
return iface.encodeFunctionData(functionName, params);
|
|
619503
|
-
};
|
|
619504
|
-
var decodeStakingResult = (currencyId, operation, config4, result2) => {
|
|
619505
|
-
const abi = getStakingABI(currencyId);
|
|
619506
|
-
if (!abi) {
|
|
619507
|
-
throw new Error(`No ABI found for staking currency: ${currencyId}`);
|
|
619508
|
-
}
|
|
619509
|
-
const functionName = config4.functions[operation];
|
|
619510
|
-
if (!functionName) {
|
|
619511
|
-
throw new Error(`Operation '${operation}' not supported for currency: ${currencyId}`);
|
|
619512
|
-
}
|
|
619513
|
-
const iface = new ethers_exports.Interface(abi);
|
|
619514
|
-
return iface.decodeFunctionResult(functionName, result2);
|
|
619515
|
-
};
|
|
619516
|
-
|
|
619517
|
-
// ../../libs/coin-modules/coin-evm/lib-es/staking/transactionData.js
|
|
619518
|
-
var STAKING_PROTOCOLS = {
|
|
619519
|
-
sei_network_evm: {
|
|
619520
|
-
delegate: (recipient) => [recipient],
|
|
619521
|
-
undelegate: (recipient, amount) => [recipient, amount],
|
|
619522
|
-
redelegate: (recipient, amount, sourceValidator) => {
|
|
619523
|
-
if (!sourceValidator)
|
|
619524
|
-
throw new Error("SEI redelegate requires sourceValidator");
|
|
619525
|
-
return [sourceValidator, recipient, amount];
|
|
619526
|
-
},
|
|
619527
|
-
getStakedBalance: (_recipient, _amount, sourceValidator, delegator) => {
|
|
619528
|
-
if (!delegator || !sourceValidator) {
|
|
619529
|
-
throw new Error("SEI getStakedBalance requires delegator and validator");
|
|
619530
|
-
}
|
|
619531
|
-
return [delegator, sourceValidator];
|
|
619532
|
-
}
|
|
619533
|
-
},
|
|
619534
|
-
celo: {
|
|
619535
|
-
delegate: (recipient, amount) => [recipient, amount],
|
|
619536
|
-
undelegate: (recipient, amount) => [recipient, amount],
|
|
619537
|
-
redelegate: () => {
|
|
619538
|
-
throw new Error("Celo does not support redelegate");
|
|
619539
|
-
},
|
|
619540
|
-
getStakedBalance: (recipient) => [recipient],
|
|
619541
|
-
getUnstakedBalance: (recipient) => [recipient]
|
|
619542
|
-
}
|
|
619543
|
-
};
|
|
619544
|
-
var buildTransactionParams = (currencyId, transactionType, recipient, amount, sourceValidator, delegator) => {
|
|
619545
|
-
const protocol = STAKING_PROTOCOLS[currencyId];
|
|
619546
|
-
if (!protocol) {
|
|
619547
|
-
throw new Error(`Unsupported staking currency: ${currencyId}`);
|
|
619548
|
-
}
|
|
619549
|
-
const operation = protocol[transactionType];
|
|
619550
|
-
if (!operation) {
|
|
619551
|
-
throw new Error(`Unsupported transaction type for ${currencyId}: ${transactionType}`);
|
|
619552
|
-
}
|
|
619553
|
-
return operation(recipient, amount, sourceValidator, delegator);
|
|
619554
|
-
};
|
|
619555
|
-
|
|
619556
|
-
// ../../libs/coin-modules/coin-evm/lib-es/staking/validators.js
|
|
619557
|
-
var seiValidatorApi = {
|
|
619558
|
-
fetchValidators: async (config4) => {
|
|
619559
|
-
const { baseUrl, validatorsEndpoint } = config4;
|
|
619560
|
-
if (!baseUrl)
|
|
619561
|
-
return [];
|
|
619562
|
-
try {
|
|
619563
|
-
const { data: data12 } = await lib_es_default({
|
|
619564
|
-
url: `${baseUrl}${validatorsEndpoint}`,
|
|
619565
|
-
method: "GET"
|
|
619566
|
-
});
|
|
619567
|
-
return Array.isArray(data12?.validators) ? data12.validators.map((v34) => v34?.operator_address).filter((addr) => typeof addr === "string") : [];
|
|
619568
|
-
} catch (error) {
|
|
619569
|
-
console.error("Failed to fetch SEI validators", {
|
|
619570
|
-
error: error instanceof Error ? error.message : String(error),
|
|
619571
|
-
baseUrl
|
|
619572
|
-
});
|
|
619573
|
-
return [];
|
|
619574
|
-
}
|
|
619575
|
-
}
|
|
619576
|
-
};
|
|
619577
|
-
var getValidatorApi = (currencyId) => {
|
|
619578
|
-
switch (currencyId) {
|
|
619579
|
-
case "sei_network_evm":
|
|
619580
|
-
return seiValidatorApi;
|
|
619581
|
-
default:
|
|
619582
|
-
return void 0;
|
|
619583
|
-
}
|
|
619584
|
-
};
|
|
619585
|
-
var getValidators2 = async (currencyId, apiConfig) => {
|
|
619586
|
-
const api7 = getValidatorApi(currencyId);
|
|
619587
|
-
return api7 && apiConfig ? api7.fetchValidators(apiConfig) : [];
|
|
619588
|
-
};
|
|
619589
|
-
|
|
619590
|
-
// ../../libs/coin-modules/coin-evm/lib-es/staking/fetchers.js
|
|
619591
|
-
var createStakingFetcher = (getValidatorsFn) => {
|
|
619592
|
-
return async (address3, config4, currency24) => {
|
|
619593
|
-
const validators7 = await getValidatorsFn(config4, currency24);
|
|
619594
|
-
const logPrefix = currency24.id === "sei_network_evm" ? "SEI" : "CELO";
|
|
619595
|
-
return getStakesForValidators(address3, config4, currency24, validators7, logPrefix);
|
|
619596
|
-
};
|
|
619597
|
-
};
|
|
619598
|
-
var STAKING_CONFIG = {
|
|
619599
|
-
sei_network_evm: {
|
|
619600
|
-
fetcher: createStakingFetcher(async (config4, currency24) => await getValidators2(currency24.id, config4.apiConfig))
|
|
619601
|
-
},
|
|
619602
|
-
celo: {
|
|
619603
|
-
fetcher: createStakingFetcher(async (config4) => [config4.contractAddress])
|
|
619604
|
-
}
|
|
619605
|
-
};
|
|
619606
|
-
var AMOUNT_EXTRACTORS = {
|
|
619607
|
-
sei_network_evm: (decoded) => {
|
|
619608
|
-
const delegation = extractSeiDelegation(decoded);
|
|
619609
|
-
return getSeiDelegationAmount(delegation);
|
|
619610
|
-
},
|
|
619611
|
-
celo: getCeloAmount
|
|
619612
|
-
};
|
|
619613
|
-
var getAmountFromDecoded = (currencyId, decoded) => {
|
|
619614
|
-
const extractor = AMOUNT_EXTRACTORS[currencyId];
|
|
619615
|
-
return extractor ? extractor(decoded) : 0n;
|
|
619616
|
-
};
|
|
619617
|
-
var createStakeFromContract = async (stakingContract) => {
|
|
619618
|
-
const { currency: currency24, config: config4, address: address3, currencyId, validatorAddress } = stakingContract;
|
|
619619
|
-
return withApi(currency24, async (rpcProvider) => {
|
|
619620
|
-
try {
|
|
619621
|
-
const params = buildTransactionParams(currencyId, "getStakedBalance", address3, 0n, validatorAddress, address3);
|
|
619622
|
-
const encodedData = encodeStakingData({
|
|
619623
|
-
currencyId,
|
|
619624
|
-
operation: "getStakedBalance",
|
|
619625
|
-
config: config4,
|
|
619626
|
-
params
|
|
619627
|
-
});
|
|
619628
|
-
const result2 = await rpcProvider.call({
|
|
619629
|
-
to: config4.contractAddress,
|
|
619630
|
-
data: encodedData
|
|
619631
|
-
});
|
|
619632
|
-
const decoded = decodeStakingResult(currencyId, "getStakedBalance", config4, result2);
|
|
619633
|
-
const amount = getAmountFromDecoded(currencyId, decoded);
|
|
619634
|
-
if (amount === 0n) {
|
|
619635
|
-
return null;
|
|
619636
|
-
}
|
|
619637
|
-
return {
|
|
619638
|
-
uid: `${config4.contractAddress}-${validatorAddress}-${address3}`,
|
|
619639
|
-
address: address3,
|
|
619640
|
-
delegate: validatorAddress,
|
|
619641
|
-
state: "active",
|
|
619642
|
-
asset: {
|
|
619643
|
-
type: "native",
|
|
619644
|
-
name: currency24.name,
|
|
619645
|
-
unit: currency24.units[0]
|
|
619646
|
-
},
|
|
619647
|
-
amount,
|
|
619648
|
-
details: {
|
|
619649
|
-
contractAddress: config4.contractAddress,
|
|
619650
|
-
validator: validatorAddress
|
|
619651
|
-
}
|
|
619652
|
-
};
|
|
619653
|
-
} catch (error) {
|
|
619654
|
-
console.error("Staking fetch failed", error);
|
|
619655
|
-
return null;
|
|
619656
|
-
}
|
|
619657
|
-
});
|
|
619658
|
-
};
|
|
619659
|
-
var getStakesForValidators = async (address3, config4, currency24, validators7, logPrefix = "Staking") => {
|
|
619660
|
-
if (validators7.length === 0) {
|
|
619661
|
-
console.error(`No validators available for ${logPrefix}`, { currencyId: currency24.id });
|
|
619662
|
-
return [];
|
|
619663
|
-
}
|
|
619664
|
-
const stakePromises = validators7.map((validator2) => createStakeFromContract({
|
|
619665
|
-
address: address3,
|
|
619666
|
-
config: config4,
|
|
619667
|
-
currencyId: currency24.id,
|
|
619668
|
-
currency: currency24,
|
|
619669
|
-
validatorAddress: validator2
|
|
619670
|
-
}).catch((error) => {
|
|
619671
|
-
console.error(`Failed to fetch ${logPrefix} stake for validator`, {
|
|
619672
|
-
validator: validator2,
|
|
619673
|
-
currencyId: currency24.id,
|
|
619674
|
-
address: address3,
|
|
619675
|
-
error: error instanceof Error ? error.message : String(error)
|
|
619676
|
-
});
|
|
619677
|
-
return null;
|
|
619678
|
-
}));
|
|
619679
|
-
const results2 = await Promise.allSettled(stakePromises);
|
|
619680
|
-
const stakes = [];
|
|
619681
|
-
results2.forEach((result2) => {
|
|
619682
|
-
if (result2.status === "fulfilled" && result2.value) {
|
|
619683
|
-
stakes.push(result2.value);
|
|
619684
|
-
}
|
|
619685
|
-
});
|
|
619686
|
-
return stakes;
|
|
619687
|
-
};
|
|
619688
|
-
|
|
619689
619717
|
// ../../libs/coin-modules/coin-evm/lib-es/bridge/getTransactionStatus.js
|
|
619690
619718
|
init_lib_es();
|
|
619691
619719
|
|
|
@@ -837540,7 +837568,7 @@ var queryTransactionsByDigest = async (params) => {
|
|
|
837540
837568
|
}
|
|
837541
837569
|
return responses;
|
|
837542
837570
|
};
|
|
837543
|
-
var
|
|
837571
|
+
var getStakes2 = (address3) => withApi2(async (api7) => api7.getStakes({ owner: address3 }).then((delegations) => delegations.flatMap((delegation) => toStakes(address3, delegation))));
|
|
837544
837572
|
var toStakes = (address3, delegation) => delegation.stakes.map((stake) => {
|
|
837545
837573
|
const { deposited, rewarded } = toStakeAmounts(stake);
|
|
837546
837574
|
return {
|
|
@@ -837601,7 +837629,7 @@ var network_default3 = {
|
|
|
837601
837629
|
paymentInfo: paymentInfo3,
|
|
837602
837630
|
createTransaction: createTransaction26,
|
|
837603
837631
|
executeTransactionBlock,
|
|
837604
|
-
getStakes
|
|
837632
|
+
getStakes: getStakes2
|
|
837605
837633
|
};
|
|
837606
837634
|
|
|
837607
837635
|
// ../../libs/coin-modules/coin-sui/lib-es/logic/craftTransaction.js
|
|
@@ -851177,7 +851205,7 @@ var appConfig = {
|
|
|
851177
851205
|
config_nanoapp_celo: {
|
|
851178
851206
|
type: "object",
|
|
851179
851207
|
default: {
|
|
851180
|
-
minVersion: "1.
|
|
851208
|
+
minVersion: "1.4.0"
|
|
851181
851209
|
}
|
|
851182
851210
|
},
|
|
851183
851211
|
config_nanoapp_cardano_ada: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/live-cli",
|
|
3
|
-
"version": "24.24.0-nightly.
|
|
3
|
+
"version": "24.24.0-nightly.6",
|
|
4
4
|
"description": "ledger-live CLI version",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"ts-node": "10.9.2",
|
|
58
58
|
"tsup": "7.3.0",
|
|
59
59
|
"@ledgerhq/types-cryptoassets": "^7.27.0-nightly.1",
|
|
60
|
-
"@ledgerhq/types-live": "^6.85.0-nightly.
|
|
60
|
+
"@ledgerhq/types-live": "^6.85.0-nightly.4"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"directory": "dist"
|