@t2000/cli 0.46.8 → 0.46.10

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.
@@ -65220,22 +65220,39 @@ async function addClaimRewardsToTx(tx, client, address) {
65220
65220
  (r) => Number(r.userClaimableReward) > 0
65221
65221
  );
65222
65222
  if (claimable.length === 0) return [];
65223
- const claimed = await Ct(tx, claimable, {
65223
+ await Ct(tx, claimable, {
65224
65224
  env: "prod",
65225
65225
  customCoinReceive: { type: "transfer", transfer: address }
65226
65226
  });
65227
- return claimed.map((c) => ({
65228
- protocol: "navi",
65229
- asset: "",
65230
- coinType: "",
65231
- symbol: "REWARD",
65232
- amount: 0,
65233
- estimatedValueUsd: 0
65234
- }));
65227
+ return aggregateClaimableRewards(claimable);
65235
65228
  } catch {
65236
65229
  return [];
65237
65230
  }
65238
65231
  }
65232
+ function aggregateClaimableRewards(claimable) {
65233
+ const aggregated = /* @__PURE__ */ new Map();
65234
+ for (const c of claimable) {
65235
+ const coinType = c.rewardCoinType;
65236
+ if (!coinType) continue;
65237
+ const symbol = coinType.split("::").pop() ?? "REWARD";
65238
+ const amount = Number(c.userClaimableReward);
65239
+ if (!Number.isFinite(amount) || amount <= 0) continue;
65240
+ const existing = aggregated.get(coinType);
65241
+ if (existing) {
65242
+ existing.amount += amount;
65243
+ } else {
65244
+ aggregated.set(coinType, {
65245
+ protocol: "navi",
65246
+ asset: String(c.assetId ?? ""),
65247
+ coinType,
65248
+ symbol,
65249
+ amount,
65250
+ estimatedValueUsd: 0
65251
+ });
65252
+ }
65253
+ }
65254
+ return Array.from(aggregated.values());
65255
+ }
65239
65256
  async function getEarnings(client, address) {
65240
65257
  const hf = await getHealthFactor(client, address);
65241
65258
  const rates = await getRates(client);
@@ -67559,4 +67576,4 @@ axios/dist/node/axios.cjs:
67559
67576
  @scure/bip39/index.js:
67560
67577
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
67561
67578
  */
67562
- //# sourceMappingURL=chunk-EGIY4JBI.js.map
67579
+ //# sourceMappingURL=chunk-PUT73QY7.js.map