@t2000/cli 1.23.0 → 1.23.1

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.
@@ -22466,35 +22466,6 @@ async function vt(e, n) {
22466
22466
  );
22467
22467
  return await De(e, t, n);
22468
22468
  }
22469
- function wt(e) {
22470
- const n = /* @__PURE__ */ new Map();
22471
- e.forEach((r) => {
22472
- const t = r.assetId, a = r.option, s = `${t}-${a}-${r.rewardCoinType}-${r.market}`;
22473
- n.has(s) ? n.get(s).total += r.userClaimableReward : n.set(s, {
22474
- assetId: t,
22475
- rewardType: a,
22476
- coinType: r.rewardCoinType,
22477
- total: Number(r.userClaimableReward),
22478
- market: r.market
22479
- });
22480
- });
22481
- const o = /* @__PURE__ */ new Map();
22482
- for (const { assetId: r, rewardType: t, coinType: a, total: s, market: i } of n.values()) {
22483
- const c = `${r}-${t}-${i}`;
22484
- o.has(c) || o.set(c, { assetId: r, rewardType: t, market: i, rewards: /* @__PURE__ */ new Map() });
22485
- const u = o.get(c);
22486
- u.rewards.set(a, (u.rewards.get(a) || 0) + s);
22487
- }
22488
- return Array.from(o.values()).map((r) => ({
22489
- assetId: r.assetId,
22490
- rewardType: r.rewardType,
22491
- market: r.market,
22492
- rewards: Array.from(r.rewards.entries()).map(([t, a]) => ({
22493
- coinType: t,
22494
- available: a.toFixed(6)
22495
- }))
22496
- }));
22497
- }
22498
22469
  async function Ct(e, n, o) {
22499
22470
  const r = await R({
22500
22471
  ...o,
@@ -22670,6 +22641,7 @@ async function Ct(e, n, o) {
22670
22641
  return a;
22671
22642
  }
22672
22643
  init_errors();
22644
+ init_token_registry();
22673
22645
  var MIN_HEALTH_FACTOR = 1.5;
22674
22646
  function sdkOptions(client) {
22675
22647
  return { env: "prod", client, cacheTime: 0, disableCache: true };
@@ -23044,24 +23016,8 @@ async function getPendingRewards(client, address) {
23044
23016
  );
23045
23017
  }
23046
23018
  if (!rewards || rewards.length === 0) return [];
23047
- const summary = wt(rewards);
23048
- const result = [];
23049
- for (const s of summary) {
23050
- for (const rw of s.rewards) {
23051
- const available = Number(rw.available);
23052
- if (available <= 0) continue;
23053
- const symbol = rw.coinType.split("::").pop() ?? "UNKNOWN";
23054
- result.push({
23055
- protocol: "navi",
23056
- asset: String(s.assetId),
23057
- coinType: rw.coinType,
23058
- symbol,
23059
- amount: available,
23060
- estimatedValueUsd: 0
23061
- });
23062
- }
23063
- }
23064
- return result;
23019
+ const claimable = rewards.filter((r) => Number(r.userClaimableReward) > 0);
23020
+ return aggregateClaimableRewards(claimable);
23065
23021
  }
23066
23022
  async function addClaimRewardsToTx(tx, client, address) {
23067
23023
  let rewards;
@@ -23111,7 +23067,8 @@ function aggregateClaimableRewards(claimable) {
23111
23067
  for (const c of claimable) {
23112
23068
  const coinType = c.rewardCoinType;
23113
23069
  if (!coinType) continue;
23114
- const symbol = coinType.split("::").pop() ?? "REWARD";
23070
+ const meta = getCoinMeta(coinType);
23071
+ const symbol = meta?.symbol ?? coinType.split("::").pop() ?? "REWARD";
23115
23072
  const amount = Number(c.userClaimableReward);
23116
23073
  if (!Number.isFinite(amount) || amount <= 0) continue;
23117
23074
  const existing = aggregated.get(coinType);
@@ -25529,7 +25486,9 @@ export {
25529
25486
  extractTxCommands,
25530
25487
  getRates,
25531
25488
  getPendingRewards,
25489
+ addClaimRewardsToTx,
25532
25490
  buildClaimRewardsTx,
25491
+ aggregateClaimableRewards,
25533
25492
  ProtocolRegistry,
25534
25493
  naviDescriptor,
25535
25494
  allDescriptors,
@@ -25582,4 +25541,4 @@ axios/dist/node/axios.cjs:
25582
25541
  @scure/bip39/index.js:
25583
25542
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
25584
25543
  */
25585
- //# sourceMappingURL=chunk-JKL4VB6Z.js.map
25544
+ //# sourceMappingURL=chunk-IR2QGWUU.js.map