@t2000/sdk 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.
@@ -4021,35 +4021,6 @@ async function vt(e, n) {
4021
4021
  );
4022
4022
  return await De(e, t, n);
4023
4023
  }
4024
- function wt(e) {
4025
- const n = /* @__PURE__ */ new Map();
4026
- e.forEach((r) => {
4027
- const t = r.assetId, a = r.option, s = `${t}-${a}-${r.rewardCoinType}-${r.market}`;
4028
- n.has(s) ? n.get(s).total += r.userClaimableReward : n.set(s, {
4029
- assetId: t,
4030
- rewardType: a,
4031
- coinType: r.rewardCoinType,
4032
- total: Number(r.userClaimableReward),
4033
- market: r.market
4034
- });
4035
- });
4036
- const o = /* @__PURE__ */ new Map();
4037
- for (const { assetId: r, rewardType: t, coinType: a, total: s, market: i } of n.values()) {
4038
- const c = `${r}-${t}-${i}`;
4039
- o.has(c) || o.set(c, { assetId: r, rewardType: t, market: i, rewards: /* @__PURE__ */ new Map() });
4040
- const u = o.get(c);
4041
- u.rewards.set(a, (u.rewards.get(a) || 0) + s);
4042
- }
4043
- return Array.from(o.values()).map((r) => ({
4044
- assetId: r.assetId,
4045
- rewardType: r.rewardType,
4046
- market: r.market,
4047
- rewards: Array.from(r.rewards.entries()).map(([t, a]) => ({
4048
- coinType: t,
4049
- available: a.toFixed(6)
4050
- }))
4051
- }));
4052
- }
4053
4024
  async function Ct(e, n, o) {
4054
4025
  const r = await R({
4055
4026
  ...o,
@@ -4225,6 +4196,47 @@ async function Ct(e, n, o) {
4225
4196
  return a;
4226
4197
  }
4227
4198
 
4199
+ // src/token-registry.ts
4200
+ var COIN_REGISTRY = {
4201
+ // ── Tier 1 — Financial layer ──────────────────────────────────────────
4202
+ USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC", tier: 1 },
4203
+ // ── Tier 2 — Swap assets (15 tokens) ──────────────────────────────────
4204
+ SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI", tier: 2 },
4205
+ wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC", tier: 2 },
4206
+ ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH", tier: 2 },
4207
+ GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 9, symbol: "GOLD", tier: 2 },
4208
+ DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP", tier: 2 },
4209
+ WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL", tier: 2 },
4210
+ NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS", tier: 2 },
4211
+ IKA: { type: "0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA", decimals: 9, symbol: "IKA", tier: 2 },
4212
+ CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS", tier: 2 },
4213
+ NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX", tier: 2 },
4214
+ vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI", tier: 2 },
4215
+ haSUI: { type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI", decimals: 9, symbol: "haSUI", tier: 2 },
4216
+ afSUI: { type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", decimals: 9, symbol: "afSUI", tier: 2 },
4217
+ LOFI: { type: "0xf22da9a24ad027cccb5f2d496cbe91de953d363513db08a3a734d361c7c17503::LOFI::LOFI", decimals: 9, symbol: "LOFI", tier: 2 },
4218
+ MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST", tier: 2 },
4219
+ // ── Legacy — no tier, kept for display accuracy on existing positions ──
4220
+ USDT: { type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT", decimals: 6, symbol: "USDT" },
4221
+ USDe: { type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE", decimals: 6, symbol: "USDe" },
4222
+ USDSUI: { type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI", decimals: 6, symbol: "USDsui" }
4223
+ };
4224
+ var BY_TYPE = /* @__PURE__ */ new Map();
4225
+ for (const meta of Object.values(COIN_REGISTRY)) {
4226
+ BY_TYPE.set(meta.type, meta);
4227
+ }
4228
+ function getCoinMeta(coinType) {
4229
+ return BY_TYPE.get(coinType);
4230
+ }
4231
+ (() => {
4232
+ const map2 = {};
4233
+ for (const [name, meta] of Object.entries(COIN_REGISTRY)) {
4234
+ map2[name] = meta.type;
4235
+ map2[name.toUpperCase()] = meta.type;
4236
+ }
4237
+ return map2;
4238
+ })();
4239
+
4228
4240
  // src/protocols/navi.ts
4229
4241
  var MIN_HEALTH_FACTOR = 1.5;
4230
4242
  function sdkOptions(client) {
@@ -4600,24 +4612,8 @@ async function getPendingRewards(client, address) {
4600
4612
  );
4601
4613
  }
4602
4614
  if (!rewards || rewards.length === 0) return [];
4603
- const summary = wt(rewards);
4604
- const result = [];
4605
- for (const s of summary) {
4606
- for (const rw of s.rewards) {
4607
- const available = Number(rw.available);
4608
- if (available <= 0) continue;
4609
- const symbol = rw.coinType.split("::").pop() ?? "UNKNOWN";
4610
- result.push({
4611
- protocol: "navi",
4612
- asset: String(s.assetId),
4613
- coinType: rw.coinType,
4614
- symbol,
4615
- amount: available,
4616
- estimatedValueUsd: 0
4617
- });
4618
- }
4619
- }
4620
- return result;
4615
+ const claimable = rewards.filter((r) => Number(r.userClaimableReward) > 0);
4616
+ return aggregateClaimableRewards(claimable);
4621
4617
  }
4622
4618
  async function addClaimRewardsToTx(tx, client, address) {
4623
4619
  let rewards;
@@ -4661,7 +4657,8 @@ function aggregateClaimableRewards(claimable) {
4661
4657
  for (const c of claimable) {
4662
4658
  const coinType = c.rewardCoinType;
4663
4659
  if (!coinType) continue;
4664
- const symbol = coinType.split("::").pop() ?? "REWARD";
4660
+ const meta = getCoinMeta(coinType);
4661
+ const symbol = meta?.symbol ?? coinType.split("::").pop() ?? "REWARD";
4665
4662
  const amount = Number(c.userClaimableReward);
4666
4663
  if (!Number.isFinite(amount) || amount <= 0) continue;
4667
4664
  const existing = aggregated.get(coinType);