@t2000/sdk 0.45.0 → 0.46.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.
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/browser.cjs +173 -93
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +167 -94
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +90 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +84 -20
- package/dist/index.js.map +1 -1
- package/dist/{token-registry-B3EV3AdW.d.ts → token-registry-C1UN5EFV.d.ts} +72 -2
- package/dist/{token-registry-BEvCPkp9.d.cts → token-registry-mycv_b90.d.cts} +72 -2
- package/dist/{types-DxNs-mLT.d.cts → types-DfwfwsAN.d.cts} +8 -0
- package/dist/{types-DxNs-mLT.d.ts → types-DfwfwsAN.d.ts} +8 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-DkKhitk_.cjs';
|
|
2
2
|
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DkKhitk_.cjs';
|
|
3
|
-
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-
|
|
3
|
+
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-DfwfwsAN.cjs';
|
|
4
4
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { L as LendingAdapter, a as LendingRates, b as AdapterPositions, A as AdapterCapability, H as HealthInfo, c as AdapterTxResult, P as PendingReward } from '../descriptors-DkKhitk_.js';
|
|
2
2
|
export { d as ProtocolDescriptor, e as allDescriptors, n as naviDescriptor } from '../descriptors-DkKhitk_.js';
|
|
3
|
-
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-
|
|
3
|
+
import { c as MaxWithdrawResult, M as MaxBorrowResult } from '../types-DfwfwsAN.js';
|
|
4
4
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
5
5
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
6
6
|
|
package/dist/browser.cjs
CHANGED
|
@@ -515,6 +515,172 @@ function truncateAddress(address) {
|
|
|
515
515
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
+
// src/token-registry.ts
|
|
519
|
+
var COIN_REGISTRY = {
|
|
520
|
+
// ── Tier 1 — Financial layer ──────────────────────────────────────────
|
|
521
|
+
USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC", tier: 1 },
|
|
522
|
+
// ── Tier 2 — Swap assets (15 tokens) ──────────────────────────────────
|
|
523
|
+
SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI", tier: 2 },
|
|
524
|
+
wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC", tier: 2 },
|
|
525
|
+
ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH", tier: 2 },
|
|
526
|
+
GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 9, symbol: "GOLD", tier: 2 },
|
|
527
|
+
DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP", tier: 2 },
|
|
528
|
+
WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL", tier: 2 },
|
|
529
|
+
NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS", tier: 2 },
|
|
530
|
+
IKA: { type: "0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA", decimals: 9, symbol: "IKA", tier: 2 },
|
|
531
|
+
CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS", tier: 2 },
|
|
532
|
+
NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX", tier: 2 },
|
|
533
|
+
vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI", tier: 2 },
|
|
534
|
+
haSUI: { type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI", decimals: 9, symbol: "haSUI", tier: 2 },
|
|
535
|
+
afSUI: { type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", decimals: 9, symbol: "afSUI", tier: 2 },
|
|
536
|
+
LOFI: { type: "0xf22da9a24ad027cccb5f2d496cbe91de953d363513db08a3a734d361c7c17503::LOFI::LOFI", decimals: 9, symbol: "LOFI", tier: 2 },
|
|
537
|
+
MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST", tier: 2 },
|
|
538
|
+
// ── Legacy — no tier, kept for display accuracy on existing positions ──
|
|
539
|
+
USDT: { type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT", decimals: 6, symbol: "USDT" },
|
|
540
|
+
USDe: { type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE", decimals: 6, symbol: "USDe" },
|
|
541
|
+
USDSUI: { type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI", decimals: 6, symbol: "USDsui" }
|
|
542
|
+
};
|
|
543
|
+
var BY_TYPE = /* @__PURE__ */ new Map();
|
|
544
|
+
for (const meta of Object.values(COIN_REGISTRY)) {
|
|
545
|
+
BY_TYPE.set(meta.type, meta);
|
|
546
|
+
}
|
|
547
|
+
function isTier1(coinType) {
|
|
548
|
+
const meta = BY_TYPE.get(coinType);
|
|
549
|
+
return meta?.tier === 1;
|
|
550
|
+
}
|
|
551
|
+
function isTier2(coinType) {
|
|
552
|
+
const meta = BY_TYPE.get(coinType);
|
|
553
|
+
return meta?.tier === 2;
|
|
554
|
+
}
|
|
555
|
+
function isSupported(coinType) {
|
|
556
|
+
const meta = BY_TYPE.get(coinType);
|
|
557
|
+
return meta?.tier !== void 0;
|
|
558
|
+
}
|
|
559
|
+
function getTier(coinType) {
|
|
560
|
+
return BY_TYPE.get(coinType)?.tier;
|
|
561
|
+
}
|
|
562
|
+
function getDecimalsForCoinType(coinType) {
|
|
563
|
+
const direct = BY_TYPE.get(coinType);
|
|
564
|
+
if (direct) return direct.decimals;
|
|
565
|
+
const suffix = coinType.split("::").slice(1).join("::").toUpperCase();
|
|
566
|
+
if (suffix) {
|
|
567
|
+
for (const meta of BY_TYPE.values()) {
|
|
568
|
+
const metaSuffix = meta.type.split("::").slice(1).join("::").toUpperCase();
|
|
569
|
+
if (metaSuffix === suffix) return meta.decimals;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return 9;
|
|
573
|
+
}
|
|
574
|
+
function resolveSymbol(coinType) {
|
|
575
|
+
const direct = BY_TYPE.get(coinType);
|
|
576
|
+
if (direct) return direct.symbol;
|
|
577
|
+
const suffix = coinType.split("::").slice(1).join("::").toUpperCase();
|
|
578
|
+
if (suffix) {
|
|
579
|
+
for (const meta of BY_TYPE.values()) {
|
|
580
|
+
const metaSuffix = meta.type.split("::").slice(1).join("::").toUpperCase();
|
|
581
|
+
if (metaSuffix === suffix) return meta.symbol;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return coinType.split("::").pop() ?? coinType;
|
|
585
|
+
}
|
|
586
|
+
var TOKEN_MAP = (() => {
|
|
587
|
+
const map = {};
|
|
588
|
+
for (const [name, meta] of Object.entries(COIN_REGISTRY)) {
|
|
589
|
+
map[name] = meta.type;
|
|
590
|
+
map[name.toUpperCase()] = meta.type;
|
|
591
|
+
}
|
|
592
|
+
return map;
|
|
593
|
+
})();
|
|
594
|
+
function resolveTokenType(nameOrType) {
|
|
595
|
+
if (nameOrType.includes("::")) return nameOrType;
|
|
596
|
+
return TOKEN_MAP[nameOrType] ?? TOKEN_MAP[nameOrType.toUpperCase()] ?? null;
|
|
597
|
+
}
|
|
598
|
+
var SUI_TYPE = COIN_REGISTRY.SUI.type;
|
|
599
|
+
var USDC_TYPE = COIN_REGISTRY.USDC.type;
|
|
600
|
+
var USDT_TYPE = COIN_REGISTRY.USDT.type;
|
|
601
|
+
var USDSUI_TYPE = COIN_REGISTRY.USDSUI.type;
|
|
602
|
+
var USDE_TYPE = COIN_REGISTRY.USDe.type;
|
|
603
|
+
var ETH_TYPE = COIN_REGISTRY.ETH.type;
|
|
604
|
+
var WBTC_TYPE = COIN_REGISTRY.wBTC.type;
|
|
605
|
+
var WAL_TYPE = COIN_REGISTRY.WAL.type;
|
|
606
|
+
var NAVX_TYPE = COIN_REGISTRY.NAVX.type;
|
|
607
|
+
var IKA_TYPE = COIN_REGISTRY.IKA.type;
|
|
608
|
+
var LOFI_TYPE = COIN_REGISTRY.LOFI.type;
|
|
609
|
+
var MANIFEST_TYPE = COIN_REGISTRY.MANIFEST.type;
|
|
610
|
+
|
|
611
|
+
// src/wallet/classify.ts
|
|
612
|
+
var KNOWN_TARGETS = [
|
|
613
|
+
[/::suilend|::obligation/, "lending"],
|
|
614
|
+
[/::navi|::lending_core|::incentive_v\d+|::oracle_pro/, "lending"],
|
|
615
|
+
[/::cetus|::pool/, "swap"],
|
|
616
|
+
[/::deepbook/, "swap"],
|
|
617
|
+
[/::transfer::public_transfer/, "send"]
|
|
618
|
+
];
|
|
619
|
+
var LABEL_PATTERNS = [
|
|
620
|
+
[/::pay(?:ment_kit|_kit)?::|::create_payment_link|::pay_link/, "payment_link"],
|
|
621
|
+
[/::create_invoice|::invoice::/, "invoice"],
|
|
622
|
+
[/::deposit|::supply|::mint_ctokens/, "deposit"],
|
|
623
|
+
[/::withdraw|::redeem|::redeem_ctokens/, "withdraw"],
|
|
624
|
+
[/::borrow/, "borrow"],
|
|
625
|
+
[/::repay/, "repay"],
|
|
626
|
+
[/::claim_reward|::claim::|::claim_incentive/, "claim"],
|
|
627
|
+
[/::stake/, "stake"],
|
|
628
|
+
[/::unstake|::burn::/, "unstake"],
|
|
629
|
+
[/::liquidate/, "liquidate"]
|
|
630
|
+
];
|
|
631
|
+
function resolveOwner(owner) {
|
|
632
|
+
if (typeof owner === "object" && owner.AddressOwner) return owner.AddressOwner;
|
|
633
|
+
if (typeof owner === "string") return owner;
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
function classifyAction(targets, commandTypes) {
|
|
637
|
+
for (const target of targets) {
|
|
638
|
+
for (const [pattern, label] of KNOWN_TARGETS) {
|
|
639
|
+
if (pattern.test(target)) return label;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
if (commandTypes.includes("TransferObjects") && !commandTypes.includes("MoveCall")) return "send";
|
|
643
|
+
return "transaction";
|
|
644
|
+
}
|
|
645
|
+
function fallbackLabel(targets) {
|
|
646
|
+
if (!targets.length) return "on-chain";
|
|
647
|
+
const first = targets[0];
|
|
648
|
+
const parts = first.split("::");
|
|
649
|
+
if (parts.length >= 2 && parts[1]) return parts[1].toLowerCase();
|
|
650
|
+
return "on-chain";
|
|
651
|
+
}
|
|
652
|
+
function classifyLabel(targets, commandTypes) {
|
|
653
|
+
for (const target of targets) {
|
|
654
|
+
for (const [pattern, label] of LABEL_PATTERNS) {
|
|
655
|
+
if (pattern.test(target)) return label;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
if (commandTypes.includes("TransferObjects") && !commandTypes.includes("MoveCall")) return "send";
|
|
659
|
+
return fallbackLabel(targets);
|
|
660
|
+
}
|
|
661
|
+
function refineLendingLabel(currentAction, currentLabel, moveCallTargets, changes, address) {
|
|
662
|
+
if (currentAction !== "lending") return currentLabel;
|
|
663
|
+
const labelMatchedSpecific = LABEL_PATTERNS.some(
|
|
664
|
+
([p]) => moveCallTargets.some((t) => p.test(t))
|
|
665
|
+
);
|
|
666
|
+
if (labelMatchedSpecific) return currentLabel;
|
|
667
|
+
const userNonSuiOutflow = changes.find(
|
|
668
|
+
(c) => resolveOwner(c.owner) === address && c.coinType !== SUI_TYPE && BigInt(c.amount) < 0n
|
|
669
|
+
);
|
|
670
|
+
if (userNonSuiOutflow) return "deposit";
|
|
671
|
+
const userNonSuiInflow = changes.find(
|
|
672
|
+
(c) => resolveOwner(c.owner) === address && c.coinType !== SUI_TYPE && BigInt(c.amount) > 0n
|
|
673
|
+
);
|
|
674
|
+
if (userNonSuiInflow) return "withdraw";
|
|
675
|
+
return currentLabel;
|
|
676
|
+
}
|
|
677
|
+
function classifyTransaction(moveCallTargets, commandTypes, balanceChanges, address) {
|
|
678
|
+
const action = classifyAction(moveCallTargets, commandTypes);
|
|
679
|
+
const baseLabel = classifyLabel(moveCallTargets, commandTypes);
|
|
680
|
+
const label = refineLendingLabel(action, baseLabel, moveCallTargets, balanceChanges, address);
|
|
681
|
+
return { action, label };
|
|
682
|
+
}
|
|
683
|
+
|
|
518
684
|
// src/utils/format.ts
|
|
519
685
|
function mistToSui(mist) {
|
|
520
686
|
return Number(mist) / Number(MIST_PER_SUI);
|
|
@@ -637,99 +803,6 @@ var DEFAULT_SAFEGUARD_CONFIG = {
|
|
|
637
803
|
dailyResetDate: ""
|
|
638
804
|
};
|
|
639
805
|
|
|
640
|
-
// src/token-registry.ts
|
|
641
|
-
var COIN_REGISTRY = {
|
|
642
|
-
// ── Tier 1 — Financial layer ──────────────────────────────────────────
|
|
643
|
-
USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC", tier: 1 },
|
|
644
|
-
// ── Tier 2 — Swap assets (15 tokens) ──────────────────────────────────
|
|
645
|
-
SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI", tier: 2 },
|
|
646
|
-
wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC", tier: 2 },
|
|
647
|
-
ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH", tier: 2 },
|
|
648
|
-
GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 9, symbol: "GOLD", tier: 2 },
|
|
649
|
-
DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP", tier: 2 },
|
|
650
|
-
WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL", tier: 2 },
|
|
651
|
-
NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS", tier: 2 },
|
|
652
|
-
IKA: { type: "0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA", decimals: 9, symbol: "IKA", tier: 2 },
|
|
653
|
-
CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS", tier: 2 },
|
|
654
|
-
NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX", tier: 2 },
|
|
655
|
-
vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI", tier: 2 },
|
|
656
|
-
haSUI: { type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI", decimals: 9, symbol: "haSUI", tier: 2 },
|
|
657
|
-
afSUI: { type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", decimals: 9, symbol: "afSUI", tier: 2 },
|
|
658
|
-
LOFI: { type: "0xf22da9a24ad027cccb5f2d496cbe91de953d363513db08a3a734d361c7c17503::LOFI::LOFI", decimals: 9, symbol: "LOFI", tier: 2 },
|
|
659
|
-
MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST", tier: 2 },
|
|
660
|
-
// ── Legacy — no tier, kept for display accuracy on existing positions ──
|
|
661
|
-
USDT: { type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT", decimals: 6, symbol: "USDT" },
|
|
662
|
-
USDe: { type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE", decimals: 6, symbol: "USDe" },
|
|
663
|
-
USDSUI: { type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI", decimals: 6, symbol: "USDsui" }
|
|
664
|
-
};
|
|
665
|
-
var BY_TYPE = /* @__PURE__ */ new Map();
|
|
666
|
-
for (const meta of Object.values(COIN_REGISTRY)) {
|
|
667
|
-
BY_TYPE.set(meta.type, meta);
|
|
668
|
-
}
|
|
669
|
-
function isTier1(coinType) {
|
|
670
|
-
const meta = BY_TYPE.get(coinType);
|
|
671
|
-
return meta?.tier === 1;
|
|
672
|
-
}
|
|
673
|
-
function isTier2(coinType) {
|
|
674
|
-
const meta = BY_TYPE.get(coinType);
|
|
675
|
-
return meta?.tier === 2;
|
|
676
|
-
}
|
|
677
|
-
function isSupported(coinType) {
|
|
678
|
-
const meta = BY_TYPE.get(coinType);
|
|
679
|
-
return meta?.tier !== void 0;
|
|
680
|
-
}
|
|
681
|
-
function getTier(coinType) {
|
|
682
|
-
return BY_TYPE.get(coinType)?.tier;
|
|
683
|
-
}
|
|
684
|
-
function getDecimalsForCoinType(coinType) {
|
|
685
|
-
const direct = BY_TYPE.get(coinType);
|
|
686
|
-
if (direct) return direct.decimals;
|
|
687
|
-
const suffix = coinType.split("::").slice(1).join("::").toUpperCase();
|
|
688
|
-
if (suffix) {
|
|
689
|
-
for (const meta of BY_TYPE.values()) {
|
|
690
|
-
const metaSuffix = meta.type.split("::").slice(1).join("::").toUpperCase();
|
|
691
|
-
if (metaSuffix === suffix) return meta.decimals;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
return 9;
|
|
695
|
-
}
|
|
696
|
-
function resolveSymbol(coinType) {
|
|
697
|
-
const direct = BY_TYPE.get(coinType);
|
|
698
|
-
if (direct) return direct.symbol;
|
|
699
|
-
const suffix = coinType.split("::").slice(1).join("::").toUpperCase();
|
|
700
|
-
if (suffix) {
|
|
701
|
-
for (const meta of BY_TYPE.values()) {
|
|
702
|
-
const metaSuffix = meta.type.split("::").slice(1).join("::").toUpperCase();
|
|
703
|
-
if (metaSuffix === suffix) return meta.symbol;
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return coinType.split("::").pop() ?? coinType;
|
|
707
|
-
}
|
|
708
|
-
var TOKEN_MAP = (() => {
|
|
709
|
-
const map = {};
|
|
710
|
-
for (const [name, meta] of Object.entries(COIN_REGISTRY)) {
|
|
711
|
-
map[name] = meta.type;
|
|
712
|
-
map[name.toUpperCase()] = meta.type;
|
|
713
|
-
}
|
|
714
|
-
return map;
|
|
715
|
-
})();
|
|
716
|
-
function resolveTokenType(nameOrType) {
|
|
717
|
-
if (nameOrType.includes("::")) return nameOrType;
|
|
718
|
-
return TOKEN_MAP[nameOrType] ?? TOKEN_MAP[nameOrType.toUpperCase()] ?? null;
|
|
719
|
-
}
|
|
720
|
-
var SUI_TYPE = COIN_REGISTRY.SUI.type;
|
|
721
|
-
var USDC_TYPE = COIN_REGISTRY.USDC.type;
|
|
722
|
-
var USDT_TYPE = COIN_REGISTRY.USDT.type;
|
|
723
|
-
var USDSUI_TYPE = COIN_REGISTRY.USDSUI.type;
|
|
724
|
-
var USDE_TYPE = COIN_REGISTRY.USDe.type;
|
|
725
|
-
var ETH_TYPE = COIN_REGISTRY.ETH.type;
|
|
726
|
-
var WBTC_TYPE = COIN_REGISTRY.wBTC.type;
|
|
727
|
-
var WAL_TYPE = COIN_REGISTRY.WAL.type;
|
|
728
|
-
var NAVX_TYPE = COIN_REGISTRY.NAVX.type;
|
|
729
|
-
var IKA_TYPE = COIN_REGISTRY.IKA.type;
|
|
730
|
-
var LOFI_TYPE = COIN_REGISTRY.LOFI.type;
|
|
731
|
-
var MANIFEST_TYPE = COIN_REGISTRY.MANIFEST.type;
|
|
732
|
-
|
|
733
806
|
exports.ALL_NAVI_ASSETS = ALL_NAVI_ASSETS;
|
|
734
807
|
exports.BPS_DENOMINATOR = BPS_DENOMINATOR;
|
|
735
808
|
exports.CLOCK_ID = CLOCK_ID;
|
|
@@ -739,7 +812,9 @@ exports.DEFAULT_SAFEGUARD_CONFIG = DEFAULT_SAFEGUARD_CONFIG;
|
|
|
739
812
|
exports.ETH_TYPE = ETH_TYPE;
|
|
740
813
|
exports.GAS_RESERVE_MIN = GAS_RESERVE_MIN;
|
|
741
814
|
exports.IKA_TYPE = IKA_TYPE;
|
|
815
|
+
exports.KNOWN_TARGETS = KNOWN_TARGETS;
|
|
742
816
|
exports.KeypairSigner = KeypairSigner;
|
|
817
|
+
exports.LABEL_PATTERNS = LABEL_PATTERNS;
|
|
743
818
|
exports.LOFI_TYPE = LOFI_TYPE;
|
|
744
819
|
exports.MANIFEST_TYPE = MANIFEST_TYPE;
|
|
745
820
|
exports.MIST_PER_SUI = MIST_PER_SUI;
|
|
@@ -762,8 +837,12 @@ exports.WBTC_TYPE = WBTC_TYPE;
|
|
|
762
837
|
exports.ZkLoginSigner = ZkLoginSigner;
|
|
763
838
|
exports.addCollectFeeToTx = addCollectFeeToTx;
|
|
764
839
|
exports.calculateFee = calculateFee;
|
|
840
|
+
exports.classifyAction = classifyAction;
|
|
841
|
+
exports.classifyLabel = classifyLabel;
|
|
842
|
+
exports.classifyTransaction = classifyTransaction;
|
|
765
843
|
exports.executeAutoTopUp = executeAutoTopUp;
|
|
766
844
|
exports.executeWithGas = executeWithGas;
|
|
845
|
+
exports.fallbackLabel = fallbackLabel;
|
|
767
846
|
exports.formatAssetAmount = formatAssetAmount;
|
|
768
847
|
exports.formatSui = formatSui;
|
|
769
848
|
exports.formatUsd = formatUsd;
|
|
@@ -780,6 +859,7 @@ exports.mapWalletError = mapWalletError;
|
|
|
780
859
|
exports.mistToSui = mistToSui;
|
|
781
860
|
exports.rawToStable = rawToStable;
|
|
782
861
|
exports.rawToUsdc = rawToUsdc;
|
|
862
|
+
exports.refineLendingLabel = refineLendingLabel;
|
|
783
863
|
exports.resolveSymbol = resolveSymbol;
|
|
784
864
|
exports.resolveTokenType = resolveTokenType;
|
|
785
865
|
exports.shouldAutoTopUp = shouldAutoTopUp;
|