@t2000/sdk 0.21.5 → 0.21.7
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/index.cjs +19 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -313,6 +313,8 @@ var init_cetus_swap = __esm({
|
|
|
313
313
|
AUSD: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD",
|
|
314
314
|
BUCK: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK",
|
|
315
315
|
USDe: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE",
|
|
316
|
+
USDSUI: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI",
|
|
317
|
+
MANIFEST: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST",
|
|
316
318
|
NS: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS",
|
|
317
319
|
BLUB: "0xfa7ac3951fdca12c1b6d18eb19e1aa2fbc31e4d45773c8e45b4ded3ef8d83f8a::blub::BLUB",
|
|
318
320
|
SCA: "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA",
|
|
@@ -2347,7 +2349,23 @@ var T2000 = class _T2000 extends eventemitter3.EventEmitter {
|
|
|
2347
2349
|
const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
|
|
2348
2350
|
const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
|
|
2349
2351
|
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
2350
|
-
|
|
2352
|
+
let toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
2353
|
+
try {
|
|
2354
|
+
const txBlock = await this.client.getTransactionBlock({
|
|
2355
|
+
digest: gasResult.digest,
|
|
2356
|
+
options: { showBalanceChanges: true }
|
|
2357
|
+
});
|
|
2358
|
+
const changes = txBlock.balanceChanges ?? [];
|
|
2359
|
+
const received = changes.find(
|
|
2360
|
+
(c) => c.coinType === toType && BigInt(c.amount) > 0n && c.owner.AddressOwner === this._address
|
|
2361
|
+
);
|
|
2362
|
+
if (received) {
|
|
2363
|
+
const actual = Number(BigInt(received.amount)) / 10 ** toDecimals;
|
|
2364
|
+
if (actual > 0) toAmount = actual;
|
|
2365
|
+
}
|
|
2366
|
+
} catch (e) {
|
|
2367
|
+
console.warn("[swap] Could not parse on-chain balance changes, using route estimate:", e);
|
|
2368
|
+
}
|
|
2351
2369
|
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
2352
2370
|
return {
|
|
2353
2371
|
success: true,
|