@t2000/cli 0.22.23 → 0.22.25

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 CHANGED
@@ -222,16 +222,7 @@ t2000 init
222
222
 
223
223
  | Command | Description |
224
224
  |---------|-------------|
225
- | `t2000 earn` | Show all earning opportunities — savings yield + sentinel bounties |
226
-
227
- ### Sentinel (Earn Bounties)
228
-
229
- | Command | Description |
230
- |---------|-------------|
231
- | `t2000 sentinel list` | List active sentinels with prize pools and fees |
232
- | `t2000 sentinel info <id>` | Show details for a specific sentinel |
233
- | `t2000 sentinel attack <id> [prompt]` | Attack a sentinel with an adversarial prompt (costs SUI) |
234
- | `t2000 sentinel attack <id> [prompt] --fee 0.5` | Override attack fee (default: sentinel's min fee) |
225
+ | `t2000 earn` | Show all earning opportunities — savings yield + investment yield |
235
226
 
236
227
  ### Contacts
237
228
 
@@ -36,7 +36,7 @@ import {
36
36
  isTransaction,
37
37
  normalizeTypeTag,
38
38
  suiBcs
39
- } from "./chunk-KHIL2KNW.js";
39
+ } from "./chunk-XOAZJ42V.js";
40
40
  import {
41
41
  HashMD,
42
42
  SHA512_IV,
@@ -13698,11 +13698,11 @@ var require_shams = __commonJS({
13698
13698
  return false;
13699
13699
  }
13700
13700
  if (typeof Object.getOwnPropertyDescriptor === "function") {
13701
- var descriptor5 = (
13701
+ var descriptor = (
13702
13702
  /** @type {PropertyDescriptor} */
13703
13703
  Object.getOwnPropertyDescriptor(obj2, sym)
13704
13704
  );
13705
- if (descriptor5.value !== symVal || descriptor5.enumerable !== true) {
13705
+ if (descriptor.value !== symVal || descriptor.enumerable !== true) {
13706
13706
  return false;
13707
13707
  }
13708
13708
  }
@@ -16318,28 +16318,28 @@ var require_axios = __commonJS({
16318
16318
  var reduceDescriptors2 = (obj2, reducer) => {
16319
16319
  const descriptors = Object.getOwnPropertyDescriptors(obj2);
16320
16320
  const reducedDescriptors = {};
16321
- forEach2(descriptors, (descriptor5, name) => {
16321
+ forEach2(descriptors, (descriptor, name) => {
16322
16322
  let ret;
16323
- if ((ret = reducer(descriptor5, name, obj2)) !== false) {
16324
- reducedDescriptors[name] = ret || descriptor5;
16323
+ if ((ret = reducer(descriptor, name, obj2)) !== false) {
16324
+ reducedDescriptors[name] = ret || descriptor;
16325
16325
  }
16326
16326
  });
16327
16327
  Object.defineProperties(obj2, reducedDescriptors);
16328
16328
  };
16329
16329
  var freezeMethods2 = (obj2) => {
16330
- reduceDescriptors2(obj2, (descriptor5, name) => {
16330
+ reduceDescriptors2(obj2, (descriptor, name) => {
16331
16331
  if (isFunction$1(obj2) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
16332
16332
  return false;
16333
16333
  }
16334
16334
  const value = obj2[name];
16335
16335
  if (!isFunction$1(value)) return;
16336
- descriptor5.enumerable = false;
16337
- if ("writable" in descriptor5) {
16338
- descriptor5.writable = false;
16336
+ descriptor.enumerable = false;
16337
+ if ("writable" in descriptor) {
16338
+ descriptor.writable = false;
16339
16339
  return;
16340
16340
  }
16341
- if (!descriptor5.set) {
16342
- descriptor5.set = () => {
16341
+ if (!descriptor.set) {
16342
+ descriptor.set = () => {
16343
16343
  throw Error("Can not rewrite read-only method '" + name + "'");
16344
16344
  };
16345
16345
  }
@@ -40798,9 +40798,6 @@ async function Ct(e, n, o) {
40798
40798
  return a;
40799
40799
  }
40800
40800
 
40801
- // ../sdk/dist/index.js
40802
- init_bcs();
40803
-
40804
40801
  // ../../node_modules/.pnpm/@cetusprotocol+aggregator-sdk@1.4.6_axios@1.13.6_typescript@5.9.3/node_modules/@cetusprotocol/aggregator-sdk/dist/index.js
40805
40802
  var import_json_bigint = __toESM(require_json_bigint(), 1);
40806
40803
  init_utils2();
@@ -41496,28 +41493,28 @@ var isRegExp = kindOfTest("RegExp");
41496
41493
  var reduceDescriptors = (obj2, reducer) => {
41497
41494
  const descriptors = Object.getOwnPropertyDescriptors(obj2);
41498
41495
  const reducedDescriptors = {};
41499
- forEach(descriptors, (descriptor5, name) => {
41496
+ forEach(descriptors, (descriptor, name) => {
41500
41497
  let ret;
41501
- if ((ret = reducer(descriptor5, name, obj2)) !== false) {
41502
- reducedDescriptors[name] = ret || descriptor5;
41498
+ if ((ret = reducer(descriptor, name, obj2)) !== false) {
41499
+ reducedDescriptors[name] = ret || descriptor;
41503
41500
  }
41504
41501
  });
41505
41502
  Object.defineProperties(obj2, reducedDescriptors);
41506
41503
  };
41507
41504
  var freezeMethods = (obj2) => {
41508
- reduceDescriptors(obj2, (descriptor5, name) => {
41505
+ reduceDescriptors(obj2, (descriptor, name) => {
41509
41506
  if (isFunction(obj2) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
41510
41507
  return false;
41511
41508
  }
41512
41509
  const value = obj2[name];
41513
41510
  if (!isFunction(value)) return;
41514
- descriptor5.enumerable = false;
41515
- if ("writable" in descriptor5) {
41516
- descriptor5.writable = false;
41511
+ descriptor.enumerable = false;
41512
+ if ("writable" in descriptor) {
41513
+ descriptor.writable = false;
41517
41514
  return;
41518
41515
  }
41519
- if (!descriptor5.set) {
41520
- descriptor5.set = () => {
41516
+ if (!descriptor.set) {
41517
+ descriptor.set = () => {
41521
41518
  throw Error("Can not rewrite read-only method '" + name + "'");
41522
41519
  };
41523
41520
  }
@@ -71845,18 +71842,6 @@ var PERPS_MARKETS = ["SUI-PERP"];
71845
71842
  var DEFAULT_MAX_LEVERAGE = 5;
71846
71843
  var DEFAULT_MAX_POSITION_SIZE = 1e3;
71847
71844
  var GAS_RESERVE_MIN = 0.05;
71848
- var SENTINEL = {
71849
- PACKAGE: "0x88b83f36dafcd5f6dcdcf1d2cb5889b03f61264ab3cee9cae35db7aa940a21b7",
71850
- AGENT_REGISTRY: "0xc47564f5f14c12b31e0dfa1a3dc99a6380a1edf8929c28cb0eaa3359c8db36ac",
71851
- ENCLAVE: "0xfb1261aeb9583514cb1341a548a5ec12d1231bd96af22215f1792617a93e1213",
71852
- PROTOCOL_CONFIG: "0x2fa4fa4a1dd0498612304635ff9334e1b922e78af325000e9d9c0e88adea459f",
71853
- TEE_API: "https://app.suisentinel.xyz/api/consume-prompt",
71854
- SENTINELS_API: "https://api.suisentinel.xyz/agents/mainnet",
71855
- RANDOM: "0x8",
71856
- MIN_FEE_MIST: 100000000n,
71857
- // 0.1 SUI
71858
- MAX_PROMPT_TOKENS: 600
71859
- };
71860
71845
  var T2000Error = class extends Error {
71861
71846
  code;
71862
71847
  data;
@@ -71904,6 +71889,8 @@ function mapMoveAbortCode(code) {
71904
71889
  1503: 'Withdrawal amount is invalid (zero or dust) \u2014 try a specific amount instead of "all"',
71905
71890
  1600: "Health factor too low \u2014 withdrawal would risk liquidation",
71906
71891
  1605: "Asset borrowing is disabled or at capacity on this protocol",
71892
+ // NAVI utils abort codes
71893
+ 46e3: "Insufficient balance to repay \u2014 withdraw some savings first to get cash",
71907
71894
  // Cetus DEX abort codes
71908
71895
  46001: "Swap failed \u2014 the DEX pool rejected the trade (liquidity or routing issue). Try again."
71909
71896
  };
@@ -72621,6 +72608,7 @@ async function buildWithdrawTx(client, address, amount, options = {}) {
72621
72608
  }
72622
72609
  async function addWithdrawToTx(tx, client, address, amount, options = {}) {
72623
72610
  const asset = options.asset ?? "USDC";
72611
+ const sponsored = options.sponsored ?? true;
72624
72612
  const assetInfo = resolveAssetInfo(asset);
72625
72613
  const posResult = await getPositions(client, address);
72626
72614
  const supply = posResult.positions.find(
@@ -72638,7 +72626,7 @@ async function addWithdrawToTx(tx, client, address, amount, options = {}) {
72638
72626
  });
72639
72627
  return { coin, effectiveAmount: 0 };
72640
72628
  }
72641
- await refreshOracle(tx, client, address);
72629
+ await refreshOracle(tx, client, address, { skipPythUpdate: sponsored });
72642
72630
  try {
72643
72631
  const coin = await Qe(tx, assetInfo.type, rawAmount, sdkOptions(client));
72644
72632
  return { coin, effectiveAmount };
@@ -72662,8 +72650,9 @@ async function addSaveToTx(tx, _client, _address, coin, options = {}) {
72662
72650
  }
72663
72651
  async function addRepayToTx(tx, client, address, coin, options = {}) {
72664
72652
  const asset = options.asset ?? "USDC";
72653
+ const sponsored = options.sponsored ?? true;
72665
72654
  const assetInfo = resolveAssetInfo(asset);
72666
- await refreshOracle(tx, client, address);
72655
+ await refreshOracle(tx, client, address, { skipPythUpdate: sponsored });
72667
72656
  try {
72668
72657
  await xe(tx, assetInfo.type, coin, { env: "prod" });
72669
72658
  } catch (err) {
@@ -72700,12 +72689,16 @@ async function buildRepayTx(client, address, amount, options = {}) {
72700
72689
  const asset = options.asset ?? "USDC";
72701
72690
  const assetInfo = resolveAssetInfo(asset);
72702
72691
  const coins = await fetchCoins(client, address, assetInfo.type);
72703
- if (coins.length === 0) throw new T2000Error("INSUFFICIENT_BALANCE", `No ${assetInfo.displayName} coins to repay with`);
72692
+ if (coins.length === 0) throw new T2000Error("INSUFFICIENT_BALANCE", `No ${assetInfo.displayName} coins to repay with. Withdraw some savings first to get cash.`);
72704
72693
  const totalBalance = coins.reduce((sum2, c) => sum2 + BigInt(c.balance), 0n);
72694
+ const rawRequested = Number(stableToRaw(amount, assetInfo.decimals));
72695
+ if (Number(totalBalance) < rawRequested && Number(totalBalance) < 1e3) {
72696
+ throw new T2000Error("INSUFFICIENT_BALANCE", `Not enough ${assetInfo.displayName} to repay (need $${amount.toFixed(2)}, wallet has ~$${(Number(totalBalance) / 10 ** assetInfo.decimals).toFixed(4)}). Withdraw some savings first.`);
72697
+ }
72705
72698
  const tx = new Transaction();
72706
72699
  tx.setSender(address);
72707
72700
  const coinObj = mergeCoins(tx, coins);
72708
- const rawAmount = Math.min(Number(stableToRaw(amount, assetInfo.decimals)), Number(totalBalance));
72701
+ const rawAmount = Math.min(rawRequested, Number(totalBalance));
72709
72702
  const [repayCoin] = tx.splitCoins(coinObj, [rawAmount]);
72710
72703
  await refreshOracle(tx, client, address, {
72711
72704
  skipPythUpdate: options.sponsored,
@@ -72822,206 +72815,6 @@ async function getFundStatus(client, address) {
72822
72815
  projectedMonthly: earnings.dailyEarning * 30
72823
72816
  };
72824
72817
  }
72825
- var descriptor = {
72826
- id: "sentinel",
72827
- name: "Sui Sentinel",
72828
- packages: [SENTINEL.PACKAGE],
72829
- actionMap: {
72830
- "sentinel::request_attack": "sentinel_attack",
72831
- "sentinel::consume_prompt": "sentinel_settle"
72832
- }
72833
- };
72834
- function mapAgent(raw) {
72835
- return {
72836
- id: raw.agent_id,
72837
- objectId: raw.agent_object_id,
72838
- name: raw.agent_name,
72839
- model: raw.model ?? "unknown",
72840
- systemPrompt: raw.prompt,
72841
- attackFee: BigInt(raw.cost_per_message),
72842
- prizePool: BigInt(raw.total_balance),
72843
- totalAttacks: raw.total_attacks,
72844
- successfulBreaches: raw.successful_breaches ?? 0,
72845
- state: raw.state
72846
- };
72847
- }
72848
- async function listSentinels() {
72849
- const res = await fetch(SENTINEL.SENTINELS_API);
72850
- if (!res.ok) {
72851
- throw new T2000Error("SENTINEL_API_ERROR", `Sentinel API returned ${res.status}`);
72852
- }
72853
- const data = await res.json();
72854
- if (!Array.isArray(data.agents)) {
72855
- throw new T2000Error("SENTINEL_API_ERROR", "Unexpected API response shape");
72856
- }
72857
- return data.agents.filter((a) => a.state === "active").map(mapAgent);
72858
- }
72859
- async function getSentinelInfo(client, sentinelObjectId) {
72860
- const agents = await listSentinels();
72861
- const match = agents.find((a) => a.objectId === sentinelObjectId || a.id === sentinelObjectId);
72862
- if (match) return match;
72863
- const obj2 = await client.getObject({
72864
- id: sentinelObjectId,
72865
- options: { showContent: true, showType: true }
72866
- });
72867
- if (!obj2.data) {
72868
- throw new T2000Error("SENTINEL_NOT_FOUND", `Sentinel ${sentinelObjectId} not found on-chain`);
72869
- }
72870
- const content = obj2.data.content;
72871
- if (!content || content.dataType !== "moveObject") {
72872
- throw new T2000Error("SENTINEL_NOT_FOUND", `Object ${sentinelObjectId} is not a Move object`);
72873
- }
72874
- const fields = content.fields;
72875
- return {
72876
- id: fields.id?.id ?? sentinelObjectId,
72877
- objectId: sentinelObjectId,
72878
- name: fields.name ?? "Unknown",
72879
- model: fields.model ?? "unknown",
72880
- systemPrompt: fields.system_prompt ?? "",
72881
- attackFee: BigInt(fields.cost_per_message ?? "0"),
72882
- prizePool: BigInt(fields.balance ?? "0"),
72883
- totalAttacks: Number(fields.total_attacks ?? "0"),
72884
- successfulBreaches: Number(fields.successful_breaches ?? "0"),
72885
- state: fields.state ?? "unknown"
72886
- };
72887
- }
72888
- async function requestAttack(client, signer, sentinelObjectId, feeMist) {
72889
- if (feeMist < SENTINEL.MIN_FEE_MIST) {
72890
- throw new T2000Error("INVALID_AMOUNT", `Attack fee must be at least 0.1 SUI (${SENTINEL.MIN_FEE_MIST} MIST)`);
72891
- }
72892
- const address = signer.getAddress();
72893
- const tx = new Transaction();
72894
- tx.setSender(address);
72895
- const [coin] = tx.splitCoins(tx.gas, [Number(feeMist)]);
72896
- const [attack2] = tx.moveCall({
72897
- target: `${SENTINEL.PACKAGE}::sentinel::request_attack`,
72898
- arguments: [
72899
- tx.object(SENTINEL.AGENT_REGISTRY),
72900
- tx.object(sentinelObjectId),
72901
- tx.object(SENTINEL.PROTOCOL_CONFIG),
72902
- coin,
72903
- tx.object(SENTINEL.RANDOM),
72904
- tx.object(CLOCK_ID)
72905
- ]
72906
- });
72907
- tx.transferObjects([attack2], address);
72908
- const built = await tx.build({ client });
72909
- const { signature } = await signer.signTransaction(built);
72910
- const result = await client.executeTransactionBlock({
72911
- transactionBlock: built,
72912
- signature,
72913
- options: { showObjectChanges: true, showEffects: true }
72914
- });
72915
- await client.waitForTransaction({ digest: result.digest });
72916
- const attackObj = result.objectChanges?.find(
72917
- (c) => c.type === "created" && c.objectType?.includes("::sentinel::Attack")
72918
- );
72919
- const attackObjectId = attackObj && "objectId" in attackObj ? attackObj.objectId : void 0;
72920
- if (!attackObjectId) {
72921
- throw new T2000Error("SENTINEL_TX_FAILED", "Attack object was not created \u2014 transaction may have failed");
72922
- }
72923
- return { attackObjectId, digest: result.digest };
72924
- }
72925
- async function submitPrompt(agentId, attackObjectId, prompt) {
72926
- const res = await fetch(SENTINEL.TEE_API, {
72927
- method: "POST",
72928
- headers: { "Content-Type": "application/json" },
72929
- body: JSON.stringify({
72930
- agent_id: agentId,
72931
- attack_object_id: attackObjectId,
72932
- message: prompt
72933
- })
72934
- });
72935
- if (!res.ok) {
72936
- const body = await res.text().catch(() => "");
72937
- throw new T2000Error("SENTINEL_TEE_ERROR", `TEE returned ${res.status}: ${body.slice(0, 200)}`);
72938
- }
72939
- const raw = await res.json();
72940
- const envelope = raw.response ?? raw;
72941
- const data = envelope.data ?? envelope;
72942
- const signature = raw.signature ?? data.signature;
72943
- const timestampMs = envelope.timestamp_ms ?? data.timestamp_ms;
72944
- if (typeof signature !== "string") {
72945
- throw new T2000Error("SENTINEL_TEE_ERROR", "TEE response missing signature");
72946
- }
72947
- return {
72948
- success: data.success ?? data.is_success,
72949
- score: data.score,
72950
- agentResponse: data.agent_response,
72951
- juryResponse: data.jury_response,
72952
- funResponse: data.fun_response ?? "",
72953
- signature,
72954
- timestampMs
72955
- };
72956
- }
72957
- async function settleAttack(client, signer, sentinelObjectId, attackObjectId, prompt, verdict) {
72958
- const sigBytes = Array.from(Buffer.from(verdict.signature.replace(/^0x/, ""), "hex"));
72959
- const address = signer.getAddress();
72960
- const tx = new Transaction();
72961
- tx.setSender(address);
72962
- tx.moveCall({
72963
- target: `${SENTINEL.PACKAGE}::sentinel::consume_prompt`,
72964
- arguments: [
72965
- tx.object(SENTINEL.AGENT_REGISTRY),
72966
- tx.object(SENTINEL.PROTOCOL_CONFIG),
72967
- tx.object(sentinelObjectId),
72968
- tx.pure.bool(verdict.success),
72969
- tx.pure.string(verdict.agentResponse),
72970
- tx.pure.string(verdict.juryResponse),
72971
- tx.pure.string(verdict.funResponse),
72972
- tx.pure.string(prompt),
72973
- tx.pure.u8(verdict.score),
72974
- tx.pure.u64(verdict.timestampMs),
72975
- tx.pure(suiBcs.vector(suiBcs.u8()).serialize(sigBytes)),
72976
- tx.object(SENTINEL.ENCLAVE),
72977
- tx.object(attackObjectId),
72978
- tx.object(CLOCK_ID)
72979
- ]
72980
- });
72981
- const built = await tx.build({ client });
72982
- const { signature } = await signer.signTransaction(built);
72983
- const result = await client.executeTransactionBlock({
72984
- transactionBlock: built,
72985
- signature,
72986
- options: { showEffects: true }
72987
- });
72988
- await client.waitForTransaction({ digest: result.digest });
72989
- const txSuccess = result.effects?.status?.status === "success";
72990
- return { digest: result.digest, success: txSuccess };
72991
- }
72992
- async function attack(client, signer, sentinelId, prompt, feeMist) {
72993
- const sentinel = await getSentinelInfo(client, sentinelId);
72994
- const fee = feeMist ?? sentinel.attackFee;
72995
- if (fee < SENTINEL.MIN_FEE_MIST) {
72996
- throw new T2000Error("INVALID_AMOUNT", `Attack fee must be at least 0.1 SUI`);
72997
- }
72998
- const { attackObjectId, digest: requestTx } = await requestAttack(
72999
- client,
73000
- signer,
73001
- sentinel.objectId,
73002
- fee
73003
- );
73004
- const verdict = await submitPrompt(sentinel.id, attackObjectId, prompt);
73005
- const { digest: settleTx } = await settleAttack(
73006
- client,
73007
- signer,
73008
- sentinel.objectId,
73009
- attackObjectId,
73010
- prompt,
73011
- verdict
73012
- );
73013
- const won = verdict.success && verdict.score >= 70;
73014
- return {
73015
- attackObjectId,
73016
- sentinelId: sentinel.id,
73017
- prompt,
73018
- verdict,
73019
- requestTx,
73020
- settleTx,
73021
- won,
73022
- feePaid: Number(fee) / Number(MIST_PER_SUI2)
73023
- };
73024
- }
73025
72818
  var ProtocolRegistry = class {
73026
72819
  lending = /* @__PURE__ */ new Map();
73027
72820
  swap = /* @__PURE__ */ new Map();
@@ -73165,7 +72958,8 @@ var ProtocolRegistry = class {
73165
72958
  return [...this.swap.values()];
73166
72959
  }
73167
72960
  };
73168
- var descriptor2 = {
72961
+ var SUILEND_PACKAGE = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
72962
+ var naviDescriptor = {
73169
72963
  id: "navi",
73170
72964
  name: "NAVI Protocol",
73171
72965
  packages: [],
@@ -73181,6 +72975,40 @@ var descriptor2 = {
73181
72975
  "incentive_v3::repay": "repay"
73182
72976
  }
73183
72977
  };
72978
+ var suilendDescriptor = {
72979
+ id: "suilend",
72980
+ name: "Suilend",
72981
+ packages: [SUILEND_PACKAGE],
72982
+ actionMap: {
72983
+ "lending_market::deposit_liquidity_and_mint_ctokens": "save",
72984
+ "lending_market::deposit_ctokens_into_obligation": "save",
72985
+ "lending_market::create_obligation": "save",
72986
+ "lending_market::withdraw_ctokens": "withdraw",
72987
+ "lending_market::redeem_ctokens_and_withdraw_liquidity": "withdraw",
72988
+ "lending_market::redeem_ctokens_and_withdraw_liquidity_request": "withdraw",
72989
+ "lending_market::fulfill_liquidity_request": "withdraw",
72990
+ "lending_market::unstake_sui_from_staker": "withdraw",
72991
+ "lending_market::borrow": "borrow",
72992
+ "lending_market::repay": "repay"
72993
+ }
72994
+ };
72995
+ var cetusDescriptor = {
72996
+ id: "cetus",
72997
+ name: "Cetus DEX",
72998
+ packages: [CETUS_PACKAGE],
72999
+ actionMap: {
73000
+ "router::swap": "swap",
73001
+ "router::swap_ab_bc": "swap",
73002
+ "router::swap_ab_cb": "swap",
73003
+ "router::swap_ba_bc": "swap",
73004
+ "router::swap_ba_cb": "swap"
73005
+ }
73006
+ };
73007
+ var allDescriptors = [
73008
+ naviDescriptor,
73009
+ suilendDescriptor,
73010
+ cetusDescriptor
73011
+ ];
73184
73012
  var NaviAdapter = class {
73185
73013
  id = "navi";
73186
73014
  name = "NAVI Protocol";
@@ -73458,18 +73286,6 @@ function fallbackQuote(fromAsset, amount, poolPrice) {
73458
73286
  const expectedOutput = fromAsset === "USDC" ? amount / poolPrice : amount * poolPrice;
73459
73287
  return { expectedOutput, priceImpact: 0, poolPrice };
73460
73288
  }
73461
- var descriptor3 = {
73462
- id: "cetus",
73463
- name: "Cetus DEX",
73464
- packages: [CETUS_PACKAGE],
73465
- actionMap: {
73466
- "router::swap": "swap",
73467
- "router::swap_ab_bc": "swap",
73468
- "router::swap_ab_cb": "swap",
73469
- "router::swap_ba_bc": "swap",
73470
- "router::swap_ba_cb": "swap"
73471
- }
73472
- };
73473
73289
  var CetusAdapter = class {
73474
73290
  id = "cetus";
73475
73291
  name = "Cetus";
@@ -73528,7 +73344,6 @@ var CetusAdapter = class {
73528
73344
  });
73529
73345
  }
73530
73346
  };
73531
- var SUILEND_PACKAGE = "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf";
73532
73347
  var MIN_HEALTH_FACTOR2 = 1.5;
73533
73348
  async function quietSuilend(fn) {
73534
73349
  const origLog = console.log;
@@ -73545,23 +73360,6 @@ async function quietSuilend(fn) {
73545
73360
  console.warn = origWarn;
73546
73361
  });
73547
73362
  }
73548
- var descriptor4 = {
73549
- id: "suilend",
73550
- name: "Suilend",
73551
- packages: [SUILEND_PACKAGE],
73552
- actionMap: {
73553
- "lending_market::deposit_liquidity_and_mint_ctokens": "save",
73554
- "lending_market::deposit_ctokens_into_obligation": "save",
73555
- "lending_market::create_obligation": "save",
73556
- "lending_market::withdraw_ctokens": "withdraw",
73557
- "lending_market::redeem_ctokens_and_withdraw_liquidity": "withdraw",
73558
- "lending_market::redeem_ctokens_and_withdraw_liquidity_request": "withdraw",
73559
- "lending_market::fulfill_liquidity_request": "withdraw",
73560
- "lending_market::unstake_sui_from_staker": "withdraw",
73561
- "lending_market::borrow": "borrow",
73562
- "lending_market::repay": "repay"
73563
- }
73564
- };
73565
73363
  var SuilendAdapter = class {
73566
73364
  id = "suilend";
73567
73365
  name = "Suilend";
@@ -74359,8 +74157,7 @@ async function resolveGas(client, signer, buildTx) {
74359
74157
  }
74360
74158
  var OUTBOUND_OPS = /* @__PURE__ */ new Set([
74361
74159
  "send",
74362
- "pay",
74363
- "sentinel"
74160
+ "pay"
74364
74161
  ]);
74365
74162
  var DEFAULT_SAFEGUARD_CONFIG = {
74366
74163
  locked: false,
@@ -75156,14 +74953,20 @@ var T2000 = class _T2000 extends import_index.default {
75156
74953
  const agent = new _T2000(keypair, client, void 0, DEFAULT_CONFIG_DIR);
75157
74954
  const address = agent.address();
75158
74955
  let sponsored = false;
74956
+ let usdcSponsored = false;
75159
74957
  if (options.sponsored !== false) {
75160
74958
  try {
75161
74959
  await callSponsorApi(address, options.name);
75162
74960
  sponsored = true;
75163
74961
  } catch {
75164
74962
  }
74963
+ try {
74964
+ await callUsdcSponsorApi(address);
74965
+ usdcSponsored = true;
74966
+ } catch {
74967
+ }
75165
74968
  }
75166
- return { agent, address, sponsored };
74969
+ return { agent, address, sponsored, usdcSponsored };
75167
74970
  }
75168
74971
  // -- Gas --
75169
74972
  /** SuiJsonRpcClient used by this agent — exposed for integrations. */
@@ -75186,7 +74989,7 @@ var T2000 = class _T2000 extends import_index.default {
75186
74989
  this.enforcer.assertNotLocked();
75187
74990
  this.enforcer.check({ operation: "pay", amount: options.maxPrice ?? 1 });
75188
74991
  const { Mppx } = await import("./client-R3NRAXMD.js");
75189
- const { sui } = await import("./client-I4SGZLVD.js");
74992
+ const { sui } = await import("./client-CK5OR2TP.js");
75190
74993
  const client = this.client;
75191
74994
  const signer = this._signer;
75192
74995
  const mppx = Mppx.create({
@@ -77624,17 +77427,6 @@ var T2000 = class _T2000 extends import_index.default {
77624
77427
  async fundStatus() {
77625
77428
  return getFundStatus(this.client, this._address);
77626
77429
  }
77627
- // -- Sentinel --
77628
- async sentinelList() {
77629
- return listSentinels();
77630
- }
77631
- async sentinelInfo(id) {
77632
- return getSentinelInfo(this.client, id);
77633
- }
77634
- async sentinelAttack(id, prompt, fee) {
77635
- this.enforcer.check({ operation: "sentinel", amount: fee ? Number(fee) / 1e9 : 0.1 });
77636
- return attack(this.client, this._signer, id, prompt, fee);
77637
- }
77638
77430
  // -- Helpers --
77639
77431
  async getFreeBalance(asset) {
77640
77432
  if (!(asset in INVESTMENT_ASSETS)) return Infinity;
@@ -77716,6 +77508,30 @@ async function callSponsorApi(address, name) {
77716
77508
  throw new T2000Error("SPONSOR_FAILED", "Sponsor API unavailable");
77717
77509
  }
77718
77510
  }
77511
+ async function callUsdcSponsorApi(address) {
77512
+ const res = await fetch(`${API_BASE_URL}/api/sponsor/usdc`, {
77513
+ method: "POST",
77514
+ headers: { "Content-Type": "application/json" },
77515
+ body: JSON.stringify({ address, source: "cli" })
77516
+ });
77517
+ if (res.status === 429) {
77518
+ const data = await res.json();
77519
+ if (data.challenge) {
77520
+ const proof = solveHashcash(data.challenge);
77521
+ const retry = await fetch(`${API_BASE_URL}/api/sponsor/usdc`, {
77522
+ method: "POST",
77523
+ headers: { "Content-Type": "application/json" },
77524
+ body: JSON.stringify({ address, source: "cli", proof })
77525
+ });
77526
+ if (!retry.ok) throw new T2000Error("USDC_SPONSOR_RATE_LIMITED", "USDC sponsor rate limited");
77527
+ return;
77528
+ }
77529
+ }
77530
+ if (res.status === 409) return;
77531
+ if (!res.ok) {
77532
+ throw new T2000Error("USDC_SPONSOR_FAILED", "USDC sponsor unavailable");
77533
+ }
77534
+ }
77719
77535
  async function simulateTransaction(client, tx, sender) {
77720
77536
  tx.setSender(sender);
77721
77537
  try {
@@ -77784,12 +77600,6 @@ function parseMoveAbort(errorStr) {
77784
77600
  }
77785
77601
  return { reason: errorStr };
77786
77602
  }
77787
- var allDescriptors = [
77788
- descriptor2,
77789
- descriptor4,
77790
- descriptor3,
77791
- descriptor
77792
- ];
77793
77603
 
77794
77604
  export {
77795
77605
  ZodOptional,
@@ -77810,7 +77620,6 @@ export {
77810
77620
  DEFAULT_MAX_LEVERAGE,
77811
77621
  DEFAULT_MAX_POSITION_SIZE,
77812
77622
  GAS_RESERVE_MIN,
77813
- SENTINEL,
77814
77623
  T2000Error,
77815
77624
  mapWalletError,
77816
77625
  mapMoveAbortCode,
@@ -77838,20 +77647,14 @@ export {
77838
77647
  calculateFee,
77839
77648
  addCollectFeeToTx,
77840
77649
  getRates,
77841
- descriptor,
77842
- listSentinels,
77843
- getSentinelInfo,
77844
- requestAttack,
77845
- submitPrompt,
77846
- settleAttack,
77847
- attack,
77848
77650
  ProtocolRegistry,
77849
- descriptor2,
77651
+ naviDescriptor,
77652
+ suilendDescriptor,
77653
+ cetusDescriptor,
77654
+ allDescriptors,
77850
77655
  NaviAdapter,
77851
77656
  getPoolPrice,
77852
- descriptor3,
77853
77657
  CetusAdapter,
77854
- descriptor4,
77855
77658
  SuilendAdapter,
77856
77659
  solveHashcash,
77857
77660
  getGasStatus,
@@ -77868,8 +77671,7 @@ export {
77868
77671
  AutoInvestManager,
77869
77672
  T2000,
77870
77673
  simulateTransaction,
77871
- throwIfSimulationFailed,
77872
- allDescriptors
77674
+ throwIfSimulationFailed
77873
77675
  };
77874
77676
  /*! Bundled license information:
77875
77677
 
@@ -77928,4 +77730,4 @@ lodash/lodash.js:
77928
77730
  *)
77929
77731
  *)
77930
77732
  */
77931
- //# sourceMappingURL=chunk-RN7Z6TWD.js.map
77733
+ //# sourceMappingURL=chunk-FM4762OE.js.map