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