@t2000/sdk 0.13.0 → 0.14.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/README.md +37 -9
- package/dist/adapters/index.cjs +21 -4
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.js +21 -4
- package/dist/adapters/index.js.map +1 -1
- package/dist/{index-Dd4EvUGr.d.cts → index-B14ZyQZt.d.cts} +226 -129
- package/dist/{index-Dd4EvUGr.d.ts → index-B14ZyQZt.d.ts} +226 -129
- package/dist/index.cjs +408 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -57
- package/dist/index.d.ts +134 -57
- package/dist/index.js +402 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { T as T2000Options, S as SendResult, B as BalanceResponse, a as TransactionRecord, D as DepositInfo, L as LendingAdapter, b as SwapAdapter, c as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, d as BorrowResult, R as RepayResult, e as MaxBorrowResult, H as HealthFactorResult, f as SwapResult, P as PositionsResult,
|
|
5
|
-
export { A as AdapterCapability,
|
|
4
|
+
import { I as InvestmentTrade, T as T2000Options, S as SendResult, B as BalanceResponse, a as TransactionRecord, D as DepositInfo, L as LendingAdapter, b as SwapAdapter, c as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, d as BorrowResult, R as RepayResult, e as MaxBorrowResult, H as HealthFactorResult, f as SwapResult, g as InvestResult, P as PortfolioResult, h as PositionsResult, i as RatesResult, j as LendingRates, k as RebalanceResult, E as EarningsResult, F as FundStatusResult, l as SentinelAgent, m as SentinelAttackResult, G as GasMethod } from './index-B14ZyQZt.cjs';
|
|
5
|
+
export { A as AdapterCapability, n as AdapterPositions, o as AdapterTxResult, p as AssetRates, C as CetusAdapter, q as GasReserve, r as HealthInfo, s as InvestmentPosition, N as NaviAdapter, t as PerpsAdapter, u as PerpsPosition, v as PositionEntry, w as PositionSide, x as ProtocolDescriptor, y as ProtocolRegistry, z as RebalanceStep, J as SentinelVerdict, K as SuilendAdapter, O as SwapQuote, Q as TradePositionsResult, U as TradeResult, V as allDescriptors, X as cetusDescriptor, Y as getSentinelInfo, Z as listSentinels, _ as naviDescriptor, $ as requestAttack, a0 as sentinelAttack, a1 as sentinelDescriptor, a2 as settleAttack, a3 as submitPrompt, a4 as suilendDescriptor } from './index-B14ZyQZt.cjs';
|
|
6
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
|
|
8
|
-
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'SWAP_FAILED' | 'SLIPPAGE_EXCEEDED' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SENTINEL_API_ERROR' | 'SENTINEL_NOT_FOUND' | 'SENTINEL_TX_FAILED' | 'SENTINEL_TEE_ERROR' | 'SAFEGUARD_BLOCKED' | 'UNKNOWN';
|
|
8
|
+
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'SWAP_FAILED' | 'SLIPPAGE_EXCEEDED' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SENTINEL_API_ERROR' | 'SENTINEL_NOT_FOUND' | 'SENTINEL_TX_FAILED' | 'SENTINEL_TEE_ERROR' | 'SAFEGUARD_BLOCKED' | 'INSUFFICIENT_INVESTMENT' | 'INVESTMENT_LOCKED' | 'MARKET_NOT_SUPPORTED' | 'LEVERAGE_EXCEEDED' | 'POSITION_SIZE_EXCEEDED' | 'BLUEFIN_AUTH_FAILED' | 'BLUEFIN_API_ERROR' | 'POSITION_NOT_FOUND' | 'UNKNOWN';
|
|
9
9
|
interface T2000ErrorData {
|
|
10
10
|
reason?: string;
|
|
11
11
|
[key: string]: unknown;
|
|
@@ -25,18 +25,109 @@ declare class T2000Error extends Error {
|
|
|
25
25
|
declare function mapWalletError(error: unknown): T2000Error;
|
|
26
26
|
declare function mapMoveAbortCode(code: number): string;
|
|
27
27
|
|
|
28
|
+
declare const MIST_PER_SUI = 1000000000n;
|
|
29
|
+
declare const SUI_DECIMALS = 9;
|
|
30
|
+
declare const USDC_DECIMALS = 6;
|
|
31
|
+
declare const BPS_DENOMINATOR = 10000n;
|
|
32
|
+
declare const CLOCK_ID = "0x6";
|
|
33
|
+
declare const SUPPORTED_ASSETS: {
|
|
34
|
+
readonly USDC: {
|
|
35
|
+
readonly type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
36
|
+
readonly decimals: 6;
|
|
37
|
+
readonly symbol: "USDC";
|
|
38
|
+
readonly displayName: "USDC";
|
|
39
|
+
};
|
|
40
|
+
readonly USDT: {
|
|
41
|
+
readonly type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT";
|
|
42
|
+
readonly decimals: 6;
|
|
43
|
+
readonly symbol: "USDT";
|
|
44
|
+
readonly displayName: "suiUSDT";
|
|
45
|
+
};
|
|
46
|
+
readonly USDe: {
|
|
47
|
+
readonly type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE";
|
|
48
|
+
readonly decimals: 6;
|
|
49
|
+
readonly symbol: "USDe";
|
|
50
|
+
readonly displayName: "suiUSDe";
|
|
51
|
+
};
|
|
52
|
+
readonly USDsui: {
|
|
53
|
+
readonly type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI";
|
|
54
|
+
readonly decimals: 6;
|
|
55
|
+
readonly symbol: "USDsui";
|
|
56
|
+
readonly displayName: "USDsui";
|
|
57
|
+
};
|
|
58
|
+
readonly SUI: {
|
|
59
|
+
readonly type: "0x2::sui::SUI";
|
|
60
|
+
readonly decimals: 9;
|
|
61
|
+
readonly symbol: "SUI";
|
|
62
|
+
readonly displayName: "SUI";
|
|
63
|
+
};
|
|
64
|
+
readonly BTC: {
|
|
65
|
+
readonly type: "0xaafb102dd0902f5055cadecd687fb5b71ca82ef0e0285d90afde828ec58ca96b::btc::BTC";
|
|
66
|
+
readonly decimals: 8;
|
|
67
|
+
readonly symbol: "BTC";
|
|
68
|
+
readonly displayName: "Bitcoin";
|
|
69
|
+
};
|
|
70
|
+
readonly ETH: {
|
|
71
|
+
readonly type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
|
|
72
|
+
readonly decimals: 8;
|
|
73
|
+
readonly symbol: "ETH";
|
|
74
|
+
readonly displayName: "Ethereum";
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
|
|
78
|
+
declare const DEFAULT_NETWORK: "mainnet";
|
|
79
|
+
declare const INVESTMENT_ASSETS: {
|
|
80
|
+
readonly SUI: {
|
|
81
|
+
readonly type: "0x2::sui::SUI";
|
|
82
|
+
readonly decimals: 9;
|
|
83
|
+
readonly symbol: "SUI";
|
|
84
|
+
readonly displayName: "SUI";
|
|
85
|
+
};
|
|
86
|
+
readonly BTC: {
|
|
87
|
+
readonly type: "0xaafb102dd0902f5055cadecd687fb5b71ca82ef0e0285d90afde828ec58ca96b::btc::BTC";
|
|
88
|
+
readonly decimals: 8;
|
|
89
|
+
readonly symbol: "BTC";
|
|
90
|
+
readonly displayName: "Bitcoin";
|
|
91
|
+
};
|
|
92
|
+
readonly ETH: {
|
|
93
|
+
readonly type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
|
|
94
|
+
readonly decimals: 8;
|
|
95
|
+
readonly symbol: "ETH";
|
|
96
|
+
readonly displayName: "Ethereum";
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
type InvestmentAsset = keyof typeof INVESTMENT_ASSETS;
|
|
100
|
+
declare const PERPS_MARKETS: readonly ["SUI-PERP"];
|
|
101
|
+
type PerpsMarket = (typeof PERPS_MARKETS)[number];
|
|
102
|
+
declare const DEFAULT_MAX_LEVERAGE = 5;
|
|
103
|
+
declare const DEFAULT_MAX_POSITION_SIZE = 1000;
|
|
104
|
+
declare const GAS_RESERVE_MIN = 0.05;
|
|
105
|
+
declare const SENTINEL: {
|
|
106
|
+
readonly PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7";
|
|
107
|
+
readonly AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac";
|
|
108
|
+
readonly ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213";
|
|
109
|
+
readonly PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f";
|
|
110
|
+
readonly TEE_API: "https://app.suisentinel.xyz/api/consume-prompt";
|
|
111
|
+
readonly SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet";
|
|
112
|
+
readonly RANDOM: "0x8";
|
|
113
|
+
readonly MIN_FEE_MIST: 100000000n;
|
|
114
|
+
readonly MAX_PROMPT_TOKENS: 600;
|
|
115
|
+
};
|
|
116
|
+
|
|
28
117
|
interface SafeguardConfig {
|
|
29
118
|
locked: boolean;
|
|
30
119
|
maxPerTx: number;
|
|
31
120
|
maxDailySend: number;
|
|
32
121
|
dailyUsed: number;
|
|
33
122
|
dailyResetDate: string;
|
|
123
|
+
maxLeverage?: number;
|
|
124
|
+
maxPositionSize?: number;
|
|
34
125
|
}
|
|
35
126
|
interface TxMetadata {
|
|
36
|
-
operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'sentinel';
|
|
127
|
+
operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'sentinel' | 'invest' | 'trade';
|
|
37
128
|
amount?: number;
|
|
38
129
|
}
|
|
39
|
-
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "sentinel" | "send" | "exchange" | "rebalance" | "pay">;
|
|
130
|
+
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "sentinel" | "send" | "exchange" | "rebalance" | "pay" | "invest" | "trade">;
|
|
40
131
|
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
41
132
|
|
|
42
133
|
declare class SafeguardEnforcer {
|
|
@@ -81,6 +172,28 @@ declare class ContactManager {
|
|
|
81
172
|
private validateName;
|
|
82
173
|
}
|
|
83
174
|
|
|
175
|
+
interface StoredPosition {
|
|
176
|
+
totalAmount: number;
|
|
177
|
+
costBasis: number;
|
|
178
|
+
avgPrice: number;
|
|
179
|
+
trades: InvestmentTrade[];
|
|
180
|
+
}
|
|
181
|
+
declare class PortfolioManager {
|
|
182
|
+
private data;
|
|
183
|
+
private readonly filePath;
|
|
184
|
+
private readonly dir;
|
|
185
|
+
constructor(configDir?: string);
|
|
186
|
+
private load;
|
|
187
|
+
private save;
|
|
188
|
+
recordBuy(trade: InvestmentTrade): void;
|
|
189
|
+
recordSell(trade: InvestmentTrade): number;
|
|
190
|
+
getPosition(asset: string): StoredPosition | undefined;
|
|
191
|
+
getPositions(): Array<{
|
|
192
|
+
asset: string;
|
|
193
|
+
} & StoredPosition>;
|
|
194
|
+
getRealizedPnL(): number;
|
|
195
|
+
}
|
|
196
|
+
|
|
84
197
|
interface T2000Events {
|
|
85
198
|
balanceChange: (event: {
|
|
86
199
|
asset: string;
|
|
@@ -123,6 +236,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
123
236
|
private readonly registry;
|
|
124
237
|
readonly enforcer: SafeguardEnforcer;
|
|
125
238
|
readonly contacts: ContactManager;
|
|
239
|
+
readonly portfolio: PortfolioManager;
|
|
126
240
|
private constructor();
|
|
127
241
|
private static createDefaultRegistry;
|
|
128
242
|
static create(options?: T2000Options): Promise<T2000>;
|
|
@@ -189,6 +303,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
189
303
|
to: string;
|
|
190
304
|
amount: number;
|
|
191
305
|
maxSlippage?: number;
|
|
306
|
+
_bypassInvestmentGuard?: boolean;
|
|
192
307
|
}): Promise<SwapResult>;
|
|
193
308
|
exchangeQuote(params: {
|
|
194
309
|
from: string;
|
|
@@ -203,6 +318,17 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
203
318
|
rate: number;
|
|
204
319
|
};
|
|
205
320
|
}>;
|
|
321
|
+
investBuy(params: {
|
|
322
|
+
asset: InvestmentAsset;
|
|
323
|
+
usdAmount: number;
|
|
324
|
+
maxSlippage?: number;
|
|
325
|
+
}): Promise<InvestResult>;
|
|
326
|
+
investSell(params: {
|
|
327
|
+
asset: InvestmentAsset;
|
|
328
|
+
usdAmount: number | 'all';
|
|
329
|
+
maxSlippage?: number;
|
|
330
|
+
}): Promise<InvestResult>;
|
|
331
|
+
getPortfolio(): Promise<PortfolioResult>;
|
|
206
332
|
positions(): Promise<PositionsResult>;
|
|
207
333
|
rates(): Promise<RatesResult>;
|
|
208
334
|
allRates(asset?: string): Promise<{
|
|
@@ -226,61 +352,11 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
226
352
|
sentinelList(): Promise<SentinelAgent[]>;
|
|
227
353
|
sentinelInfo(id: string): Promise<SentinelAgent>;
|
|
228
354
|
sentinelAttack(id: string, prompt: string, fee?: bigint): Promise<SentinelAttackResult>;
|
|
355
|
+
private getFreeBalance;
|
|
229
356
|
private resolveLending;
|
|
230
357
|
private emitBalanceChange;
|
|
231
358
|
}
|
|
232
359
|
|
|
233
|
-
declare const MIST_PER_SUI = 1000000000n;
|
|
234
|
-
declare const SUI_DECIMALS = 9;
|
|
235
|
-
declare const USDC_DECIMALS = 6;
|
|
236
|
-
declare const BPS_DENOMINATOR = 10000n;
|
|
237
|
-
declare const CLOCK_ID = "0x6";
|
|
238
|
-
declare const SUPPORTED_ASSETS: {
|
|
239
|
-
readonly USDC: {
|
|
240
|
-
readonly type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
241
|
-
readonly decimals: 6;
|
|
242
|
-
readonly symbol: "USDC";
|
|
243
|
-
readonly displayName: "USDC";
|
|
244
|
-
};
|
|
245
|
-
readonly USDT: {
|
|
246
|
-
readonly type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT";
|
|
247
|
-
readonly decimals: 6;
|
|
248
|
-
readonly symbol: "USDT";
|
|
249
|
-
readonly displayName: "suiUSDT";
|
|
250
|
-
};
|
|
251
|
-
readonly USDe: {
|
|
252
|
-
readonly type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE";
|
|
253
|
-
readonly decimals: 6;
|
|
254
|
-
readonly symbol: "USDe";
|
|
255
|
-
readonly displayName: "suiUSDe";
|
|
256
|
-
};
|
|
257
|
-
readonly USDsui: {
|
|
258
|
-
readonly type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI";
|
|
259
|
-
readonly decimals: 6;
|
|
260
|
-
readonly symbol: "USDsui";
|
|
261
|
-
readonly displayName: "USDsui";
|
|
262
|
-
};
|
|
263
|
-
readonly SUI: {
|
|
264
|
-
readonly type: "0x2::sui::SUI";
|
|
265
|
-
readonly decimals: 9;
|
|
266
|
-
readonly symbol: "SUI";
|
|
267
|
-
readonly displayName: "SUI";
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
|
|
271
|
-
declare const DEFAULT_NETWORK: "mainnet";
|
|
272
|
-
declare const SENTINEL: {
|
|
273
|
-
readonly PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7";
|
|
274
|
-
readonly AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac";
|
|
275
|
-
readonly ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213";
|
|
276
|
-
readonly PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f";
|
|
277
|
-
readonly TEE_API: "https://app.suisentinel.xyz/api/consume-prompt";
|
|
278
|
-
readonly SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet";
|
|
279
|
-
readonly RANDOM: "0x8";
|
|
280
|
-
readonly MIN_FEE_MIST: 100000000n;
|
|
281
|
-
readonly MAX_PROMPT_TOKENS: 600;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
360
|
declare function validateAddress(address: string): string;
|
|
285
361
|
declare function truncateAddress(address: string): string;
|
|
286
362
|
|
|
@@ -293,6 +369,7 @@ declare function rawToStable(raw: bigint, decimals: number): number;
|
|
|
293
369
|
declare function getDecimals(asset: SupportedAsset): number;
|
|
294
370
|
declare function formatUsd(amount: number): string;
|
|
295
371
|
declare function formatSui(amount: number): string;
|
|
372
|
+
declare function formatAssetAmount(amount: number, asset: string): string;
|
|
296
373
|
|
|
297
374
|
declare function generateKeypair(): Ed25519Keypair;
|
|
298
375
|
declare function keypairFromPrivateKey(privateKey: string): Ed25519Keypair;
|
|
@@ -401,4 +478,4 @@ interface GasStatusResponse {
|
|
|
401
478
|
}
|
|
402
479
|
declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
|
|
403
480
|
|
|
404
|
-
export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CLOCK_ID, type Contact, ContactManager, type ContactMap, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PositionsResult, type ProtocolFeeInfo, RatesResult, RebalanceResult, RepayResult, SENTINEL, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, SentinelAgent, SentinelAttackResult, type SimulationResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TxMetadata, USDC_DECIMALS, WithdrawResult, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getPoolPrice, getRates, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
|
481
|
+
export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CLOCK_ID, type Contact, ContactManager, type ContactMap, DEFAULT_MAX_LEVERAGE, DEFAULT_MAX_POSITION_SIZE, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, INVESTMENT_ASSETS, InvestResult, type InvestmentAsset, InvestmentTrade, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PERPS_MARKETS, type PerpsMarket, PortfolioManager, PortfolioResult, PositionsResult, type ProtocolFeeInfo, RatesResult, RebalanceResult, RepayResult, SENTINEL, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, SentinelAgent, SentinelAttackResult, type SimulationResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TxMetadata, USDC_DECIMALS, WithdrawResult, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getPoolPrice, getRates, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3';
|
|
2
2
|
import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
|
|
3
3
|
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
4
|
-
import { T as T2000Options, S as SendResult, B as BalanceResponse, a as TransactionRecord, D as DepositInfo, L as LendingAdapter, b as SwapAdapter, c as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, d as BorrowResult, R as RepayResult, e as MaxBorrowResult, H as HealthFactorResult, f as SwapResult, P as PositionsResult,
|
|
5
|
-
export { A as AdapterCapability,
|
|
4
|
+
import { I as InvestmentTrade, T as T2000Options, S as SendResult, B as BalanceResponse, a as TransactionRecord, D as DepositInfo, L as LendingAdapter, b as SwapAdapter, c as SaveResult, W as WithdrawResult, M as MaxWithdrawResult, d as BorrowResult, R as RepayResult, e as MaxBorrowResult, H as HealthFactorResult, f as SwapResult, g as InvestResult, P as PortfolioResult, h as PositionsResult, i as RatesResult, j as LendingRates, k as RebalanceResult, E as EarningsResult, F as FundStatusResult, l as SentinelAgent, m as SentinelAttackResult, G as GasMethod } from './index-B14ZyQZt.js';
|
|
5
|
+
export { A as AdapterCapability, n as AdapterPositions, o as AdapterTxResult, p as AssetRates, C as CetusAdapter, q as GasReserve, r as HealthInfo, s as InvestmentPosition, N as NaviAdapter, t as PerpsAdapter, u as PerpsPosition, v as PositionEntry, w as PositionSide, x as ProtocolDescriptor, y as ProtocolRegistry, z as RebalanceStep, J as SentinelVerdict, K as SuilendAdapter, O as SwapQuote, Q as TradePositionsResult, U as TradeResult, V as allDescriptors, X as cetusDescriptor, Y as getSentinelInfo, Z as listSentinels, _ as naviDescriptor, $ as requestAttack, a0 as sentinelAttack, a1 as sentinelDescriptor, a2 as settleAttack, a3 as submitPrompt, a4 as suilendDescriptor } from './index-B14ZyQZt.js';
|
|
6
6
|
import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
|
|
7
7
|
|
|
8
|
-
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'SWAP_FAILED' | 'SLIPPAGE_EXCEEDED' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SENTINEL_API_ERROR' | 'SENTINEL_NOT_FOUND' | 'SENTINEL_TX_FAILED' | 'SENTINEL_TEE_ERROR' | 'SAFEGUARD_BLOCKED' | 'UNKNOWN';
|
|
8
|
+
type T2000ErrorCode = 'INSUFFICIENT_BALANCE' | 'INSUFFICIENT_GAS' | 'INVALID_ADDRESS' | 'INVALID_AMOUNT' | 'WALLET_NOT_FOUND' | 'WALLET_LOCKED' | 'WALLET_EXISTS' | 'SPONSOR_FAILED' | 'SPONSOR_RATE_LIMITED' | 'GAS_STATION_UNAVAILABLE' | 'GAS_FEE_EXCEEDED' | 'SIMULATION_FAILED' | 'TRANSACTION_FAILED' | 'ASSET_NOT_SUPPORTED' | 'SWAP_FAILED' | 'SLIPPAGE_EXCEEDED' | 'HEALTH_FACTOR_TOO_LOW' | 'WITHDRAW_WOULD_LIQUIDATE' | 'NO_COLLATERAL' | 'PROTOCOL_PAUSED' | 'PROTOCOL_UNAVAILABLE' | 'RPC_ERROR' | 'RPC_UNREACHABLE' | 'SPONSOR_UNAVAILABLE' | 'AUTO_TOPUP_FAILED' | 'PRICE_EXCEEDS_LIMIT' | 'UNSUPPORTED_NETWORK' | 'PAYMENT_EXPIRED' | 'DUPLICATE_PAYMENT' | 'FACILITATOR_REJECTION' | 'CONTACT_NOT_FOUND' | 'INVALID_CONTACT_NAME' | 'FACILITATOR_TIMEOUT' | 'SENTINEL_API_ERROR' | 'SENTINEL_NOT_FOUND' | 'SENTINEL_TX_FAILED' | 'SENTINEL_TEE_ERROR' | 'SAFEGUARD_BLOCKED' | 'INSUFFICIENT_INVESTMENT' | 'INVESTMENT_LOCKED' | 'MARKET_NOT_SUPPORTED' | 'LEVERAGE_EXCEEDED' | 'POSITION_SIZE_EXCEEDED' | 'BLUEFIN_AUTH_FAILED' | 'BLUEFIN_API_ERROR' | 'POSITION_NOT_FOUND' | 'UNKNOWN';
|
|
9
9
|
interface T2000ErrorData {
|
|
10
10
|
reason?: string;
|
|
11
11
|
[key: string]: unknown;
|
|
@@ -25,18 +25,109 @@ declare class T2000Error extends Error {
|
|
|
25
25
|
declare function mapWalletError(error: unknown): T2000Error;
|
|
26
26
|
declare function mapMoveAbortCode(code: number): string;
|
|
27
27
|
|
|
28
|
+
declare const MIST_PER_SUI = 1000000000n;
|
|
29
|
+
declare const SUI_DECIMALS = 9;
|
|
30
|
+
declare const USDC_DECIMALS = 6;
|
|
31
|
+
declare const BPS_DENOMINATOR = 10000n;
|
|
32
|
+
declare const CLOCK_ID = "0x6";
|
|
33
|
+
declare const SUPPORTED_ASSETS: {
|
|
34
|
+
readonly USDC: {
|
|
35
|
+
readonly type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
36
|
+
readonly decimals: 6;
|
|
37
|
+
readonly symbol: "USDC";
|
|
38
|
+
readonly displayName: "USDC";
|
|
39
|
+
};
|
|
40
|
+
readonly USDT: {
|
|
41
|
+
readonly type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT";
|
|
42
|
+
readonly decimals: 6;
|
|
43
|
+
readonly symbol: "USDT";
|
|
44
|
+
readonly displayName: "suiUSDT";
|
|
45
|
+
};
|
|
46
|
+
readonly USDe: {
|
|
47
|
+
readonly type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE";
|
|
48
|
+
readonly decimals: 6;
|
|
49
|
+
readonly symbol: "USDe";
|
|
50
|
+
readonly displayName: "suiUSDe";
|
|
51
|
+
};
|
|
52
|
+
readonly USDsui: {
|
|
53
|
+
readonly type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI";
|
|
54
|
+
readonly decimals: 6;
|
|
55
|
+
readonly symbol: "USDsui";
|
|
56
|
+
readonly displayName: "USDsui";
|
|
57
|
+
};
|
|
58
|
+
readonly SUI: {
|
|
59
|
+
readonly type: "0x2::sui::SUI";
|
|
60
|
+
readonly decimals: 9;
|
|
61
|
+
readonly symbol: "SUI";
|
|
62
|
+
readonly displayName: "SUI";
|
|
63
|
+
};
|
|
64
|
+
readonly BTC: {
|
|
65
|
+
readonly type: "0xaafb102dd0902f5055cadecd687fb5b71ca82ef0e0285d90afde828ec58ca96b::btc::BTC";
|
|
66
|
+
readonly decimals: 8;
|
|
67
|
+
readonly symbol: "BTC";
|
|
68
|
+
readonly displayName: "Bitcoin";
|
|
69
|
+
};
|
|
70
|
+
readonly ETH: {
|
|
71
|
+
readonly type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
|
|
72
|
+
readonly decimals: 8;
|
|
73
|
+
readonly symbol: "ETH";
|
|
74
|
+
readonly displayName: "Ethereum";
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
|
|
78
|
+
declare const DEFAULT_NETWORK: "mainnet";
|
|
79
|
+
declare const INVESTMENT_ASSETS: {
|
|
80
|
+
readonly SUI: {
|
|
81
|
+
readonly type: "0x2::sui::SUI";
|
|
82
|
+
readonly decimals: 9;
|
|
83
|
+
readonly symbol: "SUI";
|
|
84
|
+
readonly displayName: "SUI";
|
|
85
|
+
};
|
|
86
|
+
readonly BTC: {
|
|
87
|
+
readonly type: "0xaafb102dd0902f5055cadecd687fb5b71ca82ef0e0285d90afde828ec58ca96b::btc::BTC";
|
|
88
|
+
readonly decimals: 8;
|
|
89
|
+
readonly symbol: "BTC";
|
|
90
|
+
readonly displayName: "Bitcoin";
|
|
91
|
+
};
|
|
92
|
+
readonly ETH: {
|
|
93
|
+
readonly type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH";
|
|
94
|
+
readonly decimals: 8;
|
|
95
|
+
readonly symbol: "ETH";
|
|
96
|
+
readonly displayName: "Ethereum";
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
type InvestmentAsset = keyof typeof INVESTMENT_ASSETS;
|
|
100
|
+
declare const PERPS_MARKETS: readonly ["SUI-PERP"];
|
|
101
|
+
type PerpsMarket = (typeof PERPS_MARKETS)[number];
|
|
102
|
+
declare const DEFAULT_MAX_LEVERAGE = 5;
|
|
103
|
+
declare const DEFAULT_MAX_POSITION_SIZE = 1000;
|
|
104
|
+
declare const GAS_RESERVE_MIN = 0.05;
|
|
105
|
+
declare const SENTINEL: {
|
|
106
|
+
readonly PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7";
|
|
107
|
+
readonly AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac";
|
|
108
|
+
readonly ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213";
|
|
109
|
+
readonly PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f";
|
|
110
|
+
readonly TEE_API: "https://app.suisentinel.xyz/api/consume-prompt";
|
|
111
|
+
readonly SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet";
|
|
112
|
+
readonly RANDOM: "0x8";
|
|
113
|
+
readonly MIN_FEE_MIST: 100000000n;
|
|
114
|
+
readonly MAX_PROMPT_TOKENS: 600;
|
|
115
|
+
};
|
|
116
|
+
|
|
28
117
|
interface SafeguardConfig {
|
|
29
118
|
locked: boolean;
|
|
30
119
|
maxPerTx: number;
|
|
31
120
|
maxDailySend: number;
|
|
32
121
|
dailyUsed: number;
|
|
33
122
|
dailyResetDate: string;
|
|
123
|
+
maxLeverage?: number;
|
|
124
|
+
maxPositionSize?: number;
|
|
34
125
|
}
|
|
35
126
|
interface TxMetadata {
|
|
36
|
-
operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'sentinel';
|
|
127
|
+
operation: 'send' | 'save' | 'withdraw' | 'borrow' | 'repay' | 'exchange' | 'rebalance' | 'pay' | 'sentinel' | 'invest' | 'trade';
|
|
37
128
|
amount?: number;
|
|
38
129
|
}
|
|
39
|
-
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "sentinel" | "send" | "exchange" | "rebalance" | "pay">;
|
|
130
|
+
declare const OUTBOUND_OPS: Set<"save" | "borrow" | "withdraw" | "repay" | "sentinel" | "send" | "exchange" | "rebalance" | "pay" | "invest" | "trade">;
|
|
40
131
|
declare const DEFAULT_SAFEGUARD_CONFIG: SafeguardConfig;
|
|
41
132
|
|
|
42
133
|
declare class SafeguardEnforcer {
|
|
@@ -81,6 +172,28 @@ declare class ContactManager {
|
|
|
81
172
|
private validateName;
|
|
82
173
|
}
|
|
83
174
|
|
|
175
|
+
interface StoredPosition {
|
|
176
|
+
totalAmount: number;
|
|
177
|
+
costBasis: number;
|
|
178
|
+
avgPrice: number;
|
|
179
|
+
trades: InvestmentTrade[];
|
|
180
|
+
}
|
|
181
|
+
declare class PortfolioManager {
|
|
182
|
+
private data;
|
|
183
|
+
private readonly filePath;
|
|
184
|
+
private readonly dir;
|
|
185
|
+
constructor(configDir?: string);
|
|
186
|
+
private load;
|
|
187
|
+
private save;
|
|
188
|
+
recordBuy(trade: InvestmentTrade): void;
|
|
189
|
+
recordSell(trade: InvestmentTrade): number;
|
|
190
|
+
getPosition(asset: string): StoredPosition | undefined;
|
|
191
|
+
getPositions(): Array<{
|
|
192
|
+
asset: string;
|
|
193
|
+
} & StoredPosition>;
|
|
194
|
+
getRealizedPnL(): number;
|
|
195
|
+
}
|
|
196
|
+
|
|
84
197
|
interface T2000Events {
|
|
85
198
|
balanceChange: (event: {
|
|
86
199
|
asset: string;
|
|
@@ -123,6 +236,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
123
236
|
private readonly registry;
|
|
124
237
|
readonly enforcer: SafeguardEnforcer;
|
|
125
238
|
readonly contacts: ContactManager;
|
|
239
|
+
readonly portfolio: PortfolioManager;
|
|
126
240
|
private constructor();
|
|
127
241
|
private static createDefaultRegistry;
|
|
128
242
|
static create(options?: T2000Options): Promise<T2000>;
|
|
@@ -189,6 +303,7 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
189
303
|
to: string;
|
|
190
304
|
amount: number;
|
|
191
305
|
maxSlippage?: number;
|
|
306
|
+
_bypassInvestmentGuard?: boolean;
|
|
192
307
|
}): Promise<SwapResult>;
|
|
193
308
|
exchangeQuote(params: {
|
|
194
309
|
from: string;
|
|
@@ -203,6 +318,17 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
203
318
|
rate: number;
|
|
204
319
|
};
|
|
205
320
|
}>;
|
|
321
|
+
investBuy(params: {
|
|
322
|
+
asset: InvestmentAsset;
|
|
323
|
+
usdAmount: number;
|
|
324
|
+
maxSlippage?: number;
|
|
325
|
+
}): Promise<InvestResult>;
|
|
326
|
+
investSell(params: {
|
|
327
|
+
asset: InvestmentAsset;
|
|
328
|
+
usdAmount: number | 'all';
|
|
329
|
+
maxSlippage?: number;
|
|
330
|
+
}): Promise<InvestResult>;
|
|
331
|
+
getPortfolio(): Promise<PortfolioResult>;
|
|
206
332
|
positions(): Promise<PositionsResult>;
|
|
207
333
|
rates(): Promise<RatesResult>;
|
|
208
334
|
allRates(asset?: string): Promise<{
|
|
@@ -226,61 +352,11 @@ declare class T2000 extends EventEmitter<T2000Events> {
|
|
|
226
352
|
sentinelList(): Promise<SentinelAgent[]>;
|
|
227
353
|
sentinelInfo(id: string): Promise<SentinelAgent>;
|
|
228
354
|
sentinelAttack(id: string, prompt: string, fee?: bigint): Promise<SentinelAttackResult>;
|
|
355
|
+
private getFreeBalance;
|
|
229
356
|
private resolveLending;
|
|
230
357
|
private emitBalanceChange;
|
|
231
358
|
}
|
|
232
359
|
|
|
233
|
-
declare const MIST_PER_SUI = 1000000000n;
|
|
234
|
-
declare const SUI_DECIMALS = 9;
|
|
235
|
-
declare const USDC_DECIMALS = 6;
|
|
236
|
-
declare const BPS_DENOMINATOR = 10000n;
|
|
237
|
-
declare const CLOCK_ID = "0x6";
|
|
238
|
-
declare const SUPPORTED_ASSETS: {
|
|
239
|
-
readonly USDC: {
|
|
240
|
-
readonly type: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC";
|
|
241
|
-
readonly decimals: 6;
|
|
242
|
-
readonly symbol: "USDC";
|
|
243
|
-
readonly displayName: "USDC";
|
|
244
|
-
};
|
|
245
|
-
readonly USDT: {
|
|
246
|
-
readonly type: "0x375f70cf2ae4c00bf37117d0c85a2c71545e6ee05c4a5c7d282cd66a4504b068::usdt::USDT";
|
|
247
|
-
readonly decimals: 6;
|
|
248
|
-
readonly symbol: "USDT";
|
|
249
|
-
readonly displayName: "suiUSDT";
|
|
250
|
-
};
|
|
251
|
-
readonly USDe: {
|
|
252
|
-
readonly type: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE";
|
|
253
|
-
readonly decimals: 6;
|
|
254
|
-
readonly symbol: "USDe";
|
|
255
|
-
readonly displayName: "suiUSDe";
|
|
256
|
-
};
|
|
257
|
-
readonly USDsui: {
|
|
258
|
-
readonly type: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI";
|
|
259
|
-
readonly decimals: 6;
|
|
260
|
-
readonly symbol: "USDsui";
|
|
261
|
-
readonly displayName: "USDsui";
|
|
262
|
-
};
|
|
263
|
-
readonly SUI: {
|
|
264
|
-
readonly type: "0x2::sui::SUI";
|
|
265
|
-
readonly decimals: 9;
|
|
266
|
-
readonly symbol: "SUI";
|
|
267
|
-
readonly displayName: "SUI";
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
type SupportedAsset = keyof typeof SUPPORTED_ASSETS;
|
|
271
|
-
declare const DEFAULT_NETWORK: "mainnet";
|
|
272
|
-
declare const SENTINEL: {
|
|
273
|
-
readonly PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7";
|
|
274
|
-
readonly AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac";
|
|
275
|
-
readonly ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213";
|
|
276
|
-
readonly PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f";
|
|
277
|
-
readonly TEE_API: "https://app.suisentinel.xyz/api/consume-prompt";
|
|
278
|
-
readonly SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet";
|
|
279
|
-
readonly RANDOM: "0x8";
|
|
280
|
-
readonly MIN_FEE_MIST: 100000000n;
|
|
281
|
-
readonly MAX_PROMPT_TOKENS: 600;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
360
|
declare function validateAddress(address: string): string;
|
|
285
361
|
declare function truncateAddress(address: string): string;
|
|
286
362
|
|
|
@@ -293,6 +369,7 @@ declare function rawToStable(raw: bigint, decimals: number): number;
|
|
|
293
369
|
declare function getDecimals(asset: SupportedAsset): number;
|
|
294
370
|
declare function formatUsd(amount: number): string;
|
|
295
371
|
declare function formatSui(amount: number): string;
|
|
372
|
+
declare function formatAssetAmount(amount: number, asset: string): string;
|
|
296
373
|
|
|
297
374
|
declare function generateKeypair(): Ed25519Keypair;
|
|
298
375
|
declare function keypairFromPrivateKey(privateKey: string): Ed25519Keypair;
|
|
@@ -401,4 +478,4 @@ interface GasStatusResponse {
|
|
|
401
478
|
}
|
|
402
479
|
declare function getGasStatus(address?: string): Promise<GasStatusResponse>;
|
|
403
480
|
|
|
404
|
-
export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CLOCK_ID, type Contact, ContactManager, type ContactMap, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PositionsResult, type ProtocolFeeInfo, RatesResult, RebalanceResult, RepayResult, SENTINEL, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, SentinelAgent, SentinelAttackResult, type SimulationResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TxMetadata, USDC_DECIMALS, WithdrawResult, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getPoolPrice, getRates, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|
|
481
|
+
export { type AutoTopUpResult, BPS_DENOMINATOR, BalanceResponse, BorrowResult, CLOCK_ID, type Contact, ContactManager, type ContactMap, DEFAULT_MAX_LEVERAGE, DEFAULT_MAX_POSITION_SIZE, DEFAULT_NETWORK, DEFAULT_SAFEGUARD_CONFIG, DepositInfo, EarningsResult, type FeeOperation, FundStatusResult, GAS_RESERVE_MIN, type GasExecutionResult, GasMethod, type GasRequestType, type GasSponsorResponse, type GasStatusResponse, HealthFactorResult, INVESTMENT_ASSETS, InvestResult, type InvestmentAsset, InvestmentTrade, LendingAdapter, LendingRates, MIST_PER_SUI, MaxBorrowResult, MaxWithdrawResult, OUTBOUND_OPS, PERPS_MARKETS, type PerpsMarket, PortfolioManager, PortfolioResult, PositionsResult, type ProtocolFeeInfo, RatesResult, RebalanceResult, RepayResult, SENTINEL, SUI_DECIMALS, SUPPORTED_ASSETS, type SafeguardConfig, SafeguardEnforcer, SafeguardError, type SafeguardErrorDetails, type SafeguardRule, SaveResult, SendResult, SentinelAgent, SentinelAttackResult, type SimulationResult, type SupportedAsset, SwapAdapter, SwapResult, T2000, T2000Error, type T2000ErrorCode, type T2000ErrorData, T2000Options, TransactionRecord, type TxMetadata, USDC_DECIMALS, WithdrawResult, addCollectFeeToTx, calculateFee, executeAutoTopUp, executeWithGas, exportPrivateKey, formatAssetAmount, formatSui, formatUsd, generateKeypair, getAddress, getDecimals, getGasStatus, getPoolPrice, getRates, keypairFromPrivateKey, loadKey, mapMoveAbortCode, mapWalletError, mistToSui, rawToStable, rawToUsdc, saveKey, shouldAutoTopUp, simulateTransaction, solveHashcash, stableToRaw, suiToMist, throwIfSimulationFailed, truncateAddress, usdcToRaw, validateAddress, walletExists };
|