@t2000/sdk 4.3.1 → 5.0.0
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/README.md +3 -3
- package/dist/browser.cjs +42 -112
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +4 -4
- package/dist/browser.d.ts +4 -4
- package/dist/browser.js +43 -102
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +670 -6651
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -541
- package/dist/index.d.ts +29 -541
- package/dist/index.js +673 -6626
- package/dist/index.js.map +1 -1
- package/dist/types-CgZWnHhs.d.cts +1214 -0
- package/dist/types-CgZWnHhs.d.ts +1214 -0
- package/package.json +1 -13
- package/dist/adapters/descriptors.cjs +0 -48
- package/dist/adapters/descriptors.cjs.map +0 -1
- package/dist/adapters/descriptors.d.cts +0 -3
- package/dist/adapters/descriptors.d.ts +0 -3
- package/dist/adapters/descriptors.js +0 -45
- package/dist/adapters/descriptors.js.map +0 -1
- package/dist/adapters/index.cjs +0 -4815
- package/dist/adapters/index.cjs.map +0 -1
- package/dist/adapters/index.d.cts +0 -91
- package/dist/adapters/index.d.ts +0 -91
- package/dist/adapters/index.js +0 -4810
- package/dist/adapters/index.js.map +0 -1
- package/dist/descriptors-DqIb4AnV.d.cts +0 -134
- package/dist/descriptors-DqIb4AnV.d.ts +0 -134
- package/dist/types-CFV4VcJJ.d.cts +0 -667
- package/dist/types-Ch0zVUpC.d.cts +0 -727
- package/dist/types-Ch0zVUpC.d.ts +0 -727
- package/dist/types-DqRLGfOC.d.ts +0 -667
package/dist/browser.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, b as MaxWithdrawResult, O as OVERLAY_FEE_RATE, c as OverlayFeeConfig, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, j as SwapRouteResult, T as TransactionLeg, k as TransactionRecord, W as WithdrawResult, l as buildSwapTx, m as findSwapRoute } from './types-Ch0zVUpC.cjs';
|
|
1
|
+
export { B as BalanceResponse, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, D as DEFAULT_NETWORK, e as DEFAULT_SAFEGUARD_CONFIG, f as DepositInfo, E as ETH_TYPE, g as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, O as OVERLAY_FEE_RATE, k as OverlayFeeConfig, P as PayOptions, l as PayResult, S as STABLE_ASSETS, m as SUI_DECIMALS, n as SUI_TYPE, o as SUPPORTED_ASSETS, p as SafeguardConfig, q as SafeguardError, r as SafeguardErrorDetails, s as SafeguardRule, t as SendResult, u as SimulationResult, v as StableAsset, w as SuiHolding, x as SuiRpcTxBlock, y as SupportedAsset, z as SwapRouteResult, T as T2000Error, A as T2000ErrorCode, F as T2000ErrorData, H as T2000_OVERLAY_FEE_WALLET, J as TOKEN_MAP, Q as TransactionLeg, R as TransactionRecord, U as TransactionSigner, V as TxDirection, W as TxMetadata, X as USDC_DECIMALS, Y as USDC_TYPE, Z as USDE_TYPE, _ as USDSUI_TYPE, $ as USDT_TYPE, a0 as WAL_TYPE, a1 as WBTC_TYPE, a2 as ZkLoginProof, a3 as ZkLoginSigner, a4 as buildSwapTx, a5 as classifyAction, a6 as classifyLabel, a7 as classifyTransaction, a8 as executeTx, a9 as extractAllUserLegs, aa as extractTransferDetails, ab as extractTxCommands, ac as extractTxSender, ad as fallbackLabel, ae as findSwapRoute, af as formatAssetAmount, ag as formatSui, ah as formatUsd, ai as getDecimals, aj as getDecimalsForCoinType, ak as mapMoveAbortCode, al as mapWalletError, am as mistToSui, an as parseSuiRpcTx, ao as payWithMpp, ap as rawToStable, aq as rawToUsdc, ar as refineLendingLabel, as as resolveSymbol, at as resolveTokenType, au as stableToRaw, av as suiToMist, aw as truncateAddress, ax as usdcToRaw, ay as validateAddress } from './types-CgZWnHhs.cjs';
|
|
3
2
|
import '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import '@mysten/sui/jsonRpc';
|
|
5
|
-
import '@mysten/sui/transactions';
|
|
6
3
|
import '@mysten/sui/grpc';
|
|
4
|
+
import '@mysten/sui/client';
|
|
5
|
+
import '@mysten/sui/transactions';
|
|
7
6
|
import '@cetusprotocol/aggregator-sdk';
|
|
7
|
+
import '@mysten/sui/jsonRpc';
|
|
8
8
|
|
|
9
9
|
/** Cross-platform (Node + browser) base64 helpers. */
|
|
10
10
|
declare function toBase64(bytes: Uint8Array): string;
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { A as AssetRates, B as BalanceResponse, a as BorrowResult, C as ClaimRewardsResult, D as DepositInfo, E as EarningsResult, F as FundStatusResult, G as GasReserve, H as HealthFactorResult, M as MaxBorrowResult, b as MaxWithdrawResult, O as OVERLAY_FEE_RATE, c as OverlayFeeConfig, P as PayOptions, d as PayResult, e as PendingReward, f as PositionEntry, g as PositionsResult, R as RatesResult, h as RepayResult, S as SaveResult, i as SendResult, j as SwapRouteResult, T as TransactionLeg, k as TransactionRecord, W as WithdrawResult, l as buildSwapTx, m as findSwapRoute } from './types-Ch0zVUpC.js';
|
|
1
|
+
export { B as BalanceResponse, C as CLOCK_ID, a as COIN_REGISTRY, b as ClassifyBalanceChange, c as ClassifyResult, d as CoinMeta, D as DEFAULT_NETWORK, e as DEFAULT_SAFEGUARD_CONFIG, f as DepositInfo, E as ETH_TYPE, g as ExtractedTransfer, G as GAS_RESERVE_MIN, I as IKA_TYPE, K as KNOWN_TARGETS, h as KeypairSigner, L as LABEL_PATTERNS, i as LOFI_TYPE, M as MANIFEST_TYPE, j as MIST_PER_SUI, N as NAVX_TYPE, O as OVERLAY_FEE_RATE, k as OverlayFeeConfig, P as PayOptions, l as PayResult, S as STABLE_ASSETS, m as SUI_DECIMALS, n as SUI_TYPE, o as SUPPORTED_ASSETS, p as SafeguardConfig, q as SafeguardError, r as SafeguardErrorDetails, s as SafeguardRule, t as SendResult, u as SimulationResult, v as StableAsset, w as SuiHolding, x as SuiRpcTxBlock, y as SupportedAsset, z as SwapRouteResult, T as T2000Error, A as T2000ErrorCode, F as T2000ErrorData, H as T2000_OVERLAY_FEE_WALLET, J as TOKEN_MAP, Q as TransactionLeg, R as TransactionRecord, U as TransactionSigner, V as TxDirection, W as TxMetadata, X as USDC_DECIMALS, Y as USDC_TYPE, Z as USDE_TYPE, _ as USDSUI_TYPE, $ as USDT_TYPE, a0 as WAL_TYPE, a1 as WBTC_TYPE, a2 as ZkLoginProof, a3 as ZkLoginSigner, a4 as buildSwapTx, a5 as classifyAction, a6 as classifyLabel, a7 as classifyTransaction, a8 as executeTx, a9 as extractAllUserLegs, aa as extractTransferDetails, ab as extractTxCommands, ac as extractTxSender, ad as fallbackLabel, ae as findSwapRoute, af as formatAssetAmount, ag as formatSui, ah as formatUsd, ai as getDecimals, aj as getDecimalsForCoinType, ak as mapMoveAbortCode, al as mapWalletError, am as mistToSui, an as parseSuiRpcTx, ao as payWithMpp, ap as rawToStable, aq as rawToUsdc, ar as refineLendingLabel, as as resolveSymbol, at as resolveTokenType, au as stableToRaw, av as suiToMist, aw as truncateAddress, ax as usdcToRaw, ay as validateAddress } from './types-CgZWnHhs.js';
|
|
3
2
|
import '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import '@mysten/sui/jsonRpc';
|
|
5
|
-
import '@mysten/sui/transactions';
|
|
6
3
|
import '@mysten/sui/grpc';
|
|
4
|
+
import '@mysten/sui/client';
|
|
5
|
+
import '@mysten/sui/transactions';
|
|
7
6
|
import '@cetusprotocol/aggregator-sdk';
|
|
7
|
+
import '@mysten/sui/jsonRpc';
|
|
8
8
|
|
|
9
9
|
/** Cross-platform (Node + browser) base64 helpers. */
|
|
10
10
|
declare function toBase64(bytes: Uint8Array): string;
|
package/dist/browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '@mysten/sui/jsonRpc';
|
|
2
1
|
import '@mysten/sui/grpc';
|
|
2
|
+
import '@mysten/sui/graphql';
|
|
3
3
|
import { normalizeSuiAddress, isValidSuiAddress } from '@mysten/sui/utils';
|
|
4
4
|
import { AggregatorClient, Env } from '@cetusprotocol/aggregator-sdk';
|
|
5
5
|
import 'bn.js';
|
|
@@ -104,21 +104,6 @@ var init_errors = __esm({
|
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
// src/token-registry.ts
|
|
107
|
-
function isTier1(coinType) {
|
|
108
|
-
const meta = BY_TYPE.get(coinType);
|
|
109
|
-
return meta?.tier === 1;
|
|
110
|
-
}
|
|
111
|
-
function isTier2(coinType) {
|
|
112
|
-
const meta = BY_TYPE.get(coinType);
|
|
113
|
-
return meta?.tier === 2;
|
|
114
|
-
}
|
|
115
|
-
function isSupported(coinType) {
|
|
116
|
-
const meta = BY_TYPE.get(coinType);
|
|
117
|
-
return meta?.tier !== void 0;
|
|
118
|
-
}
|
|
119
|
-
function getTier(coinType) {
|
|
120
|
-
return BY_TYPE.get(coinType)?.tier;
|
|
121
|
-
}
|
|
122
107
|
function getDecimalsForCoinType(coinType) {
|
|
123
108
|
const direct = BY_TYPE.get(coinType);
|
|
124
109
|
if (direct) return direct.decimals;
|
|
@@ -151,25 +136,25 @@ var COIN_REGISTRY, BY_TYPE, TOKEN_MAP, SUI_TYPE, USDC_TYPE, USDT_TYPE, USDSUI_TY
|
|
|
151
136
|
var init_token_registry = __esm({
|
|
152
137
|
"src/token-registry.ts"() {
|
|
153
138
|
COIN_REGISTRY = {
|
|
154
|
-
// ──
|
|
155
|
-
USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC"
|
|
156
|
-
// ──
|
|
157
|
-
SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI"
|
|
158
|
-
wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC"
|
|
159
|
-
ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH"
|
|
160
|
-
GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 9, symbol: "GOLD"
|
|
161
|
-
DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP"
|
|
162
|
-
WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL"
|
|
163
|
-
NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS"
|
|
164
|
-
IKA: { type: "0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA", decimals: 9, symbol: "IKA"
|
|
165
|
-
CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS"
|
|
166
|
-
NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX"
|
|
167
|
-
vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI"
|
|
168
|
-
haSUI: { type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI", decimals: 9, symbol: "haSUI"
|
|
169
|
-
afSUI: { type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", decimals: 9, symbol: "afSUI"
|
|
170
|
-
LOFI: { type: "0xf22da9a24ad027cccb5f2d496cbe91de953d363513db08a3a734d361c7c17503::LOFI::LOFI", decimals: 9, symbol: "LOFI"
|
|
171
|
-
MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST"
|
|
172
|
-
// ──
|
|
139
|
+
// ── Settlement stable ─────────────────────────────────────────────────
|
|
140
|
+
USDC: { type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC", decimals: 6, symbol: "USDC" },
|
|
141
|
+
// ── Common swap assets (symbol ergonomics — any coin type still swaps) ─
|
|
142
|
+
SUI: { type: "0x2::sui::SUI", decimals: 9, symbol: "SUI" },
|
|
143
|
+
wBTC: { type: "0x0041f9f9344cac094454cd574e333c4fdb132d7bcc9379bcd4aab485b2a63942::wbtc::WBTC", decimals: 8, symbol: "wBTC" },
|
|
144
|
+
ETH: { type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", decimals: 8, symbol: "ETH" },
|
|
145
|
+
GOLD: { type: "0x9d297676e7a4b771ab023291377b2adfaa4938fb9080b8d12430e4b108b836a9::xaum::XAUM", decimals: 9, symbol: "GOLD" },
|
|
146
|
+
DEEP: { type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", decimals: 6, symbol: "DEEP" },
|
|
147
|
+
WAL: { type: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL", decimals: 9, symbol: "WAL" },
|
|
148
|
+
NS: { type: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", decimals: 6, symbol: "NS" },
|
|
149
|
+
IKA: { type: "0x7262fb2f7a3a14c888c438a3cd9b912469a58cf60f367352c46584262e8299aa::ika::IKA", decimals: 9, symbol: "IKA" },
|
|
150
|
+
CETUS: { type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS", decimals: 9, symbol: "CETUS" },
|
|
151
|
+
NAVX: { type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", decimals: 9, symbol: "NAVX" },
|
|
152
|
+
vSUI: { type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", decimals: 9, symbol: "vSUI" },
|
|
153
|
+
haSUI: { type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI", decimals: 9, symbol: "haSUI" },
|
|
154
|
+
afSUI: { type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI", decimals: 9, symbol: "afSUI" },
|
|
155
|
+
LOFI: { type: "0xf22da9a24ad027cccb5f2d496cbe91de953d363513db08a3a734d361c7c17503::LOFI::LOFI", decimals: 9, symbol: "LOFI" },
|
|
156
|
+
MANIFEST: { type: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST", decimals: 9, symbol: "MANIFEST" },
|
|
157
|
+
// ── Other stables (display / classification) ──────────────────────────
|
|
173
158
|
USDT: { type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT", decimals: 6, symbol: "USDT" },
|
|
174
159
|
USDe: { type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE", decimals: 6, symbol: "USDe" },
|
|
175
160
|
USDSUI: { type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI", decimals: 6, symbol: "USDsui" }
|
|
@@ -273,19 +258,21 @@ async function executeTx(client, signer, buildTx, options = {}) {
|
|
|
273
258
|
tx.setSender(signer.getAddress());
|
|
274
259
|
const txBytes = await tx.build({ client: options.buildClient ?? client });
|
|
275
260
|
const { signature } = await signer.signTransaction(txBytes);
|
|
276
|
-
const result = await client.
|
|
277
|
-
|
|
278
|
-
signature,
|
|
279
|
-
|
|
261
|
+
const result = await client.core.executeTransaction({
|
|
262
|
+
transaction: txBytes,
|
|
263
|
+
signatures: [signature],
|
|
264
|
+
include: { effects: true }
|
|
280
265
|
});
|
|
281
|
-
|
|
282
|
-
|
|
266
|
+
const txn = result.$kind === "Transaction" ? result.Transaction : result.FailedTransaction;
|
|
267
|
+
await client.core.waitForTransaction({ digest: txn.digest });
|
|
268
|
+
const effects = txn.effects ?? void 0;
|
|
269
|
+
const gasUsed = effects?.gasUsed;
|
|
283
270
|
let gasCostSui = 0;
|
|
284
271
|
if (gasUsed) {
|
|
285
272
|
const total = BigInt(gasUsed.computationCost) + BigInt(gasUsed.storageCost) - BigInt(gasUsed.storageRebate);
|
|
286
273
|
gasCostSui = Number(total) / 1e9;
|
|
287
274
|
}
|
|
288
|
-
return { digest:
|
|
275
|
+
return { digest: txn.digest, gasCostSui, effects };
|
|
289
276
|
}
|
|
290
277
|
|
|
291
278
|
// src/wallet/pay.ts
|
|
@@ -356,9 +343,6 @@ init_errors();
|
|
|
356
343
|
var MIST_PER_SUI = 1000000000n;
|
|
357
344
|
var SUI_DECIMALS = 9;
|
|
358
345
|
var USDC_DECIMALS = 6;
|
|
359
|
-
var BPS_DENOMINATOR = 10000n;
|
|
360
|
-
var SAVE_FEE_BPS = 10n;
|
|
361
|
-
var BORROW_FEE_BPS = 5n;
|
|
362
346
|
var CLOCK_ID = "0x6";
|
|
363
347
|
var SUPPORTED_ASSETS = {
|
|
364
348
|
USDC: {
|
|
@@ -417,7 +401,6 @@ var SUPPORTED_ASSETS = {
|
|
|
417
401
|
}
|
|
418
402
|
};
|
|
419
403
|
var STABLE_ASSETS = ["USDC", "USDsui"];
|
|
420
|
-
var ALL_NAVI_ASSETS = Object.keys(SUPPORTED_ASSETS);
|
|
421
404
|
({
|
|
422
405
|
USDC: SUPPORTED_ASSETS.USDC.type,
|
|
423
406
|
USDsui: SUPPORTED_ASSETS.USDsui.type
|
|
@@ -581,8 +564,13 @@ function extractAllUserLegs(changes, sender) {
|
|
|
581
564
|
}
|
|
582
565
|
return legs;
|
|
583
566
|
}
|
|
584
|
-
|
|
585
|
-
|
|
567
|
+
function buildRecord(args) {
|
|
568
|
+
const { digest, moveCallTargets, commandTypes, balanceChanges, timestampMs, gasCost, address } = args;
|
|
569
|
+
const legs = extractAllUserLegs(balanceChanges, address);
|
|
570
|
+
const { amount, asset, recipient, direction } = extractTransferDetails(balanceChanges, address);
|
|
571
|
+
const { action, label } = classifyTransaction(moveCallTargets, commandTypes, balanceChanges, address);
|
|
572
|
+
return { digest, action, label, legs, amount, asset, recipient, direction, timestamp: timestampMs, gasCost };
|
|
573
|
+
}
|
|
586
574
|
function parseSuiRpcTx(tx, address) {
|
|
587
575
|
return parseTxRecord(tx, address);
|
|
588
576
|
}
|
|
@@ -603,27 +591,15 @@ function parseTxRecord(tx, address) {
|
|
|
603
591
|
const gasUsed = tx.effects?.gasUsed;
|
|
604
592
|
const gasCost = gasUsed ? (Number(gasUsed.computationCost) + Number(gasUsed.storageCost) - Number(gasUsed.storageRebate)) / 1e9 : void 0;
|
|
605
593
|
const { moveCallTargets, commandTypes } = extractCommands(tx.transaction);
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
const { amount, asset, recipient, direction } = extractTransferDetails(balanceChanges, address);
|
|
609
|
-
const { action, label } = classifyTransaction(
|
|
594
|
+
return buildRecord({
|
|
595
|
+
digest: tx.digest,
|
|
610
596
|
moveCallTargets,
|
|
611
597
|
commandTypes,
|
|
612
|
-
balanceChanges,
|
|
598
|
+
balanceChanges: tx.balanceChanges ?? [],
|
|
599
|
+
timestampMs: Number(tx.timestampMs ?? 0),
|
|
600
|
+
gasCost,
|
|
613
601
|
address
|
|
614
|
-
);
|
|
615
|
-
return {
|
|
616
|
-
digest: tx.digest,
|
|
617
|
-
action,
|
|
618
|
-
label,
|
|
619
|
-
legs,
|
|
620
|
-
amount,
|
|
621
|
-
asset,
|
|
622
|
-
recipient,
|
|
623
|
-
direction,
|
|
624
|
-
timestamp: Number(tx.timestampMs ?? 0),
|
|
625
|
-
gasCost
|
|
626
|
-
};
|
|
602
|
+
});
|
|
627
603
|
}
|
|
628
604
|
function extractCommands(txBlock) {
|
|
629
605
|
const result = { moveCallTargets: [], commandTypes: [] };
|
|
@@ -705,37 +681,6 @@ function fromBase64(b64) {
|
|
|
705
681
|
return bytes;
|
|
706
682
|
}
|
|
707
683
|
|
|
708
|
-
// src/protocols/protocolFee.ts
|
|
709
|
-
var FEE_RATES = {
|
|
710
|
-
save: SAVE_FEE_BPS,
|
|
711
|
-
borrow: BORROW_FEE_BPS,
|
|
712
|
-
// Swap uses Cetus's overlay-fee mechanism (taken from output by the aggregator
|
|
713
|
-
// and transferred to `overlayFee.receiver`). We list the rate here for display
|
|
714
|
-
// / quote calculations only — `addFeeTransfer` is NOT called for swaps.
|
|
715
|
-
swap: 10n
|
|
716
|
-
// 0.1%
|
|
717
|
-
};
|
|
718
|
-
function calculateFee(operation, amount) {
|
|
719
|
-
const bps = FEE_RATES[operation];
|
|
720
|
-
const feeAmount = amount * Number(bps) / Number(BPS_DENOMINATOR);
|
|
721
|
-
const rawAmount = stableToRaw(feeAmount, USDC_DECIMALS);
|
|
722
|
-
return {
|
|
723
|
-
amount: feeAmount,
|
|
724
|
-
asset: "USDC",
|
|
725
|
-
rate: Number(bps) / Number(BPS_DENOMINATOR),
|
|
726
|
-
rawAmount
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
function addFeeTransfer(tx, paymentCoin, feeBps, receiver, amount, decimals = USDC_DECIMALS) {
|
|
730
|
-
if (feeBps <= 0n) return;
|
|
731
|
-
if (amount <= 0) return;
|
|
732
|
-
const feeAmount = amount * Number(feeBps) / Number(BPS_DENOMINATOR);
|
|
733
|
-
const rawFee = stableToRaw(feeAmount, decimals);
|
|
734
|
-
if (rawFee <= 0n) return;
|
|
735
|
-
const [feeCoin] = tx.splitCoins(paymentCoin, [tx.pure.u64(rawFee)]);
|
|
736
|
-
tx.transferObjects([feeCoin], tx.pure.address(receiver));
|
|
737
|
-
}
|
|
738
|
-
|
|
739
684
|
// src/protocols/cetus-swap.ts
|
|
740
685
|
init_token_registry();
|
|
741
686
|
init_token_registry();
|
|
@@ -838,10 +783,6 @@ function buildMessage(rule, details) {
|
|
|
838
783
|
}
|
|
839
784
|
|
|
840
785
|
// src/safeguards/types.ts
|
|
841
|
-
var OUTBOUND_OPS = /* @__PURE__ */ new Set([
|
|
842
|
-
"send",
|
|
843
|
-
"pay"
|
|
844
|
-
]);
|
|
845
786
|
var DEFAULT_SAFEGUARD_CONFIG = {
|
|
846
787
|
locked: false,
|
|
847
788
|
maxPerTx: 0,
|
|
@@ -853,6 +794,6 @@ var DEFAULT_SAFEGUARD_CONFIG = {
|
|
|
853
794
|
// src/browser.ts
|
|
854
795
|
init_token_registry();
|
|
855
796
|
|
|
856
|
-
export {
|
|
797
|
+
export { CLOCK_ID, COIN_REGISTRY, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, ETH_TYPE, GAS_RESERVE_MIN, IKA_TYPE, KNOWN_TARGETS, KeypairSigner, LABEL_PATTERNS, LOFI_TYPE, MANIFEST_TYPE, MIST_PER_SUI, NAVX_TYPE, OVERLAY_FEE_RATE, STABLE_ASSETS, SUI_DECIMALS, SUI_TYPE, SUPPORTED_ASSETS, SafeguardError, T2000Error, T2000_OVERLAY_FEE_WALLET, TOKEN_MAP, USDC_DECIMALS, USDC_TYPE, USDE_TYPE, USDSUI_TYPE, USDT_TYPE, WAL_TYPE, WBTC_TYPE, ZkLoginSigner, buildSwapTx, classifyAction, classifyLabel, classifyTransaction, executeTx, extractAllUserLegs, extractTransferDetails, extractTxCommands, extractTxSender, fallbackLabel, findSwapRoute, formatAssetAmount, formatSui, formatUsd, fromBase64, getDecimals, getDecimalsForCoinType, mapMoveAbortCode, mapWalletError, mistToSui, parseSuiRpcTx, payWithMpp, rawToStable, rawToUsdc, refineLendingLabel, resolveSymbol, resolveTokenType, stableToRaw, suiToMist, toBase64, truncateAddress, usdcToRaw, validateAddress };
|
|
857
798
|
//# sourceMappingURL=browser.js.map
|
|
858
799
|
//# sourceMappingURL=browser.js.map
|