@t2000/cli 0.22.22 → 0.22.24
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 +1 -10
- package/dist/{ccip-3TXHQUZ5.js → ccip-JEEJV65M.js} +3 -3
- package/dist/{chunk-3W7OQGNS.js → chunk-3XUF7GM3.js} +21 -42
- package/dist/chunk-3XUF7GM3.js.map +1 -0
- package/dist/chunk-77SWBATH.js +204 -0
- package/dist/chunk-77SWBATH.js.map +1 -0
- package/dist/{chunk-ML6HST4W.js → chunk-A5X4KG7U.js} +1878 -341
- package/dist/chunk-A5X4KG7U.js.map +1 -0
- package/dist/{chunk-ZNF5QSAT.js → chunk-BPTNEFB5.js} +33491 -24904
- package/dist/chunk-BPTNEFB5.js.map +1 -0
- package/dist/{chunk-VREOXJUB.js → chunk-EEPD7SHV.js} +15455 -14941
- package/dist/chunk-EEPD7SHV.js.map +1 -0
- package/dist/{chunk-AB65Y674.js → chunk-V7PXDEKG.js} +2 -2
- package/dist/chunk-V7PXDEKG.js.map +1 -0
- package/dist/chunk-XOAZJ42V.js +4016 -0
- package/dist/chunk-XOAZJ42V.js.map +1 -0
- package/dist/client-CK5OR2TP.js +746 -0
- package/dist/client-CK5OR2TP.js.map +1 -0
- package/dist/{client-SYS6Z5RX.js → client-R3NRAXMD.js} +5715 -2933
- package/dist/client-R3NRAXMD.js.map +1 -0
- package/dist/{dist-73ESA7QZ.js → dist-MJOXMRDV.js} +135 -4259
- package/dist/dist-MJOXMRDV.js.map +1 -0
- package/dist/{dist-IANNA5N7.js → dist-TWST5EWE.js} +11 -27
- package/dist/{esm-IQVNJILX.js → esm-QBJBHFZA.js} +11 -11
- package/dist/esm-QBJBHFZA.js.map +1 -0
- package/dist/index.js +125 -284
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-3W7OQGNS.js.map +0 -1
- package/dist/chunk-AB65Y674.js.map +0 -1
- package/dist/chunk-H66DC3S3.js +0 -1908
- package/dist/chunk-H66DC3S3.js.map +0 -1
- package/dist/chunk-IHPSFXUW.js +0 -5002
- package/dist/chunk-IHPSFXUW.js.map +0 -1
- package/dist/chunk-ML6HST4W.js.map +0 -1
- package/dist/chunk-VREOXJUB.js.map +0 -1
- package/dist/chunk-ZNF5QSAT.js.map +0 -1
- package/dist/client-4DBCJNJO.js +0 -117
- package/dist/client-4DBCJNJO.js.map +0 -1
- package/dist/client-SYS6Z5RX.js.map +0 -1
- package/dist/dist-73ESA7QZ.js.map +0 -1
- package/dist/esm-IQVNJILX.js.map +0 -1
- /package/dist/{ccip-3TXHQUZ5.js.map → ccip-JEEJV65M.js.map} +0 -0
- /package/dist/{dist-IANNA5N7.js.map → dist-TWST5EWE.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
ContactManager,
|
|
9
9
|
INVESTMENT_ASSETS,
|
|
10
|
-
MIST_PER_SUI,
|
|
11
10
|
STABLE_ASSETS,
|
|
12
11
|
SUPPORTED_ASSETS,
|
|
13
12
|
SafeguardEnforcer,
|
|
@@ -16,14 +15,13 @@ import {
|
|
|
16
15
|
formatUsd,
|
|
17
16
|
getGasStatus,
|
|
18
17
|
keypairFromPrivateKey,
|
|
19
|
-
listSentinels,
|
|
20
18
|
saveKey,
|
|
21
19
|
truncateAddress,
|
|
22
20
|
walletExists
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-BPTNEFB5.js";
|
|
22
|
+
import "./chunk-V7PXDEKG.js";
|
|
23
|
+
import "./chunk-XOAZJ42V.js";
|
|
24
|
+
import "./chunk-3XUF7GM3.js";
|
|
27
25
|
import {
|
|
28
26
|
__commonJS,
|
|
29
27
|
__require,
|
|
@@ -4471,17 +4469,23 @@ function getNestedValue(obj, path) {
|
|
|
4471
4469
|
}
|
|
4472
4470
|
return current;
|
|
4473
4471
|
}
|
|
4472
|
+
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
4474
4473
|
function setNestedValue(obj, path, value) {
|
|
4475
4474
|
const parts = path.split(".");
|
|
4475
|
+
if (parts.some((p) => UNSAFE_KEYS.has(p))) return;
|
|
4476
|
+
const sanitized = parts.map((p) => p.replace(/[^a-zA-Z0-9_]/g, ""));
|
|
4476
4477
|
let current = obj;
|
|
4477
|
-
for (let i = 0; i <
|
|
4478
|
-
const part =
|
|
4479
|
-
if (!
|
|
4478
|
+
for (let i = 0; i < sanitized.length - 1; i++) {
|
|
4479
|
+
const part = sanitized[i];
|
|
4480
|
+
if (!part) return;
|
|
4481
|
+
if (!Object.hasOwn(current, part) || typeof current[part] !== "object" || current[part] === null) {
|
|
4480
4482
|
current[part] = {};
|
|
4481
4483
|
}
|
|
4482
4484
|
current = current[part];
|
|
4483
4485
|
}
|
|
4484
|
-
|
|
4486
|
+
const key = sanitized[sanitized.length - 1];
|
|
4487
|
+
if (!key) return;
|
|
4488
|
+
current[key] = value;
|
|
4485
4489
|
}
|
|
4486
4490
|
function loadConfig() {
|
|
4487
4491
|
try {
|
|
@@ -4607,7 +4611,7 @@ function registerConfig(program3) {
|
|
|
4607
4611
|
});
|
|
4608
4612
|
}
|
|
4609
4613
|
|
|
4610
|
-
// ../../node_modules/.pnpm/@hono+node-server@1.19.11_hono@4.12.
|
|
4614
|
+
// ../../node_modules/.pnpm/@hono+node-server@1.19.11_hono@4.12.9/node_modules/@hono/node-server/dist/index.mjs
|
|
4611
4615
|
import { createServer as createServerHTTP } from "http";
|
|
4612
4616
|
import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
|
|
4613
4617
|
import { Http2ServerRequest } from "http2";
|
|
@@ -5178,7 +5182,7 @@ var serve = (options, listeningListener) => {
|
|
|
5178
5182
|
return server;
|
|
5179
5183
|
};
|
|
5180
5184
|
|
|
5181
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
5185
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/compose.js
|
|
5182
5186
|
var compose = (middleware, onError, onNotFound) => {
|
|
5183
5187
|
return (context, next) => {
|
|
5184
5188
|
let index = -1;
|
|
@@ -5222,10 +5226,10 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
5222
5226
|
};
|
|
5223
5227
|
};
|
|
5224
5228
|
|
|
5225
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
5229
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/request/constants.js
|
|
5226
5230
|
var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
|
|
5227
5231
|
|
|
5228
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
5232
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/body.js
|
|
5229
5233
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
5230
5234
|
const { all = false, dot = false } = options;
|
|
5231
5235
|
const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
|
|
@@ -5280,6 +5284,9 @@ var handleParsingAllValues = (form, key, value) => {
|
|
|
5280
5284
|
}
|
|
5281
5285
|
};
|
|
5282
5286
|
var handleParsingNestedValues = (form, key, value) => {
|
|
5287
|
+
if (/(?:^|\.)__proto__\./.test(key)) {
|
|
5288
|
+
return;
|
|
5289
|
+
}
|
|
5283
5290
|
let nestedForm = form;
|
|
5284
5291
|
const keys = key.split(".");
|
|
5285
5292
|
keys.forEach((key2, index) => {
|
|
@@ -5294,7 +5301,7 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
5294
5301
|
});
|
|
5295
5302
|
};
|
|
5296
5303
|
|
|
5297
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
5304
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/url.js
|
|
5298
5305
|
var splitPath = (path) => {
|
|
5299
5306
|
const paths = path.split("/");
|
|
5300
5307
|
if (paths[0] === "") {
|
|
@@ -5498,7 +5505,7 @@ var getQueryParams = (url, key) => {
|
|
|
5498
5505
|
};
|
|
5499
5506
|
var decodeURIComponent_ = decodeURIComponent;
|
|
5500
5507
|
|
|
5501
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
5508
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/request.js
|
|
5502
5509
|
var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
|
|
5503
5510
|
var HonoRequest = class {
|
|
5504
5511
|
/**
|
|
@@ -5579,7 +5586,7 @@ var HonoRequest = class {
|
|
|
5579
5586
|
return headerData;
|
|
5580
5587
|
}
|
|
5581
5588
|
async parseBody(options) {
|
|
5582
|
-
return
|
|
5589
|
+
return parseBody(this, options);
|
|
5583
5590
|
}
|
|
5584
5591
|
#cachedBody = (key) => {
|
|
5585
5592
|
const { bodyCache, raw: raw2 } = this;
|
|
@@ -5766,7 +5773,7 @@ var HonoRequest = class {
|
|
|
5766
5773
|
}
|
|
5767
5774
|
};
|
|
5768
5775
|
|
|
5769
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
5776
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/html.js
|
|
5770
5777
|
var HtmlEscapedCallbackPhase = {
|
|
5771
5778
|
Stringify: 1,
|
|
5772
5779
|
BeforeStream: 2,
|
|
@@ -5808,7 +5815,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
5808
5815
|
}
|
|
5809
5816
|
};
|
|
5810
5817
|
|
|
5811
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
5818
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/context.js
|
|
5812
5819
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
5813
5820
|
var setDefaultContentType = (contentType, headers) => {
|
|
5814
5821
|
return {
|
|
@@ -6215,7 +6222,7 @@ var Context = class {
|
|
|
6215
6222
|
};
|
|
6216
6223
|
};
|
|
6217
6224
|
|
|
6218
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
6225
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router.js
|
|
6219
6226
|
var METHOD_NAME_ALL = "ALL";
|
|
6220
6227
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
6221
6228
|
var METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
@@ -6223,10 +6230,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
|
|
|
6223
6230
|
var UnsupportedPathError = class extends Error {
|
|
6224
6231
|
};
|
|
6225
6232
|
|
|
6226
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
6233
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/constants.js
|
|
6227
6234
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
6228
6235
|
|
|
6229
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
6236
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/hono-base.js
|
|
6230
6237
|
var notFoundHandler = (c) => {
|
|
6231
6238
|
return c.text("404 Not Found", 404);
|
|
6232
6239
|
};
|
|
@@ -6597,7 +6604,7 @@ var Hono = class _Hono {
|
|
|
6597
6604
|
};
|
|
6598
6605
|
};
|
|
6599
6606
|
|
|
6600
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
6607
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
6601
6608
|
var emptyParam = [];
|
|
6602
6609
|
function match(method, path) {
|
|
6603
6610
|
const matchers = this.buildAllMatchers();
|
|
@@ -6618,7 +6625,7 @@ function match(method, path) {
|
|
|
6618
6625
|
return match2(method, path);
|
|
6619
6626
|
}
|
|
6620
6627
|
|
|
6621
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
6628
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
6622
6629
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
6623
6630
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
6624
6631
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -6726,7 +6733,7 @@ var Node = class _Node {
|
|
|
6726
6733
|
}
|
|
6727
6734
|
};
|
|
6728
6735
|
|
|
6729
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
6736
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
6730
6737
|
var Trie = class {
|
|
6731
6738
|
#context = { varIndex: 0 };
|
|
6732
6739
|
#root = new Node();
|
|
@@ -6782,7 +6789,7 @@ var Trie = class {
|
|
|
6782
6789
|
}
|
|
6783
6790
|
};
|
|
6784
6791
|
|
|
6785
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
6792
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
6786
6793
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
6787
6794
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
6788
6795
|
function buildWildcardRegExp(path) {
|
|
@@ -6961,7 +6968,7 @@ var RegExpRouter = class {
|
|
|
6961
6968
|
}
|
|
6962
6969
|
};
|
|
6963
6970
|
|
|
6964
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
6971
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/smart-router/router.js
|
|
6965
6972
|
var SmartRouter = class {
|
|
6966
6973
|
name = "SmartRouter";
|
|
6967
6974
|
#routers = [];
|
|
@@ -7016,7 +7023,7 @@ var SmartRouter = class {
|
|
|
7016
7023
|
}
|
|
7017
7024
|
};
|
|
7018
7025
|
|
|
7019
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
7026
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/trie-router/node.js
|
|
7020
7027
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
7021
7028
|
var hasChildren = (children) => {
|
|
7022
7029
|
for (const _ in children) {
|
|
@@ -7191,7 +7198,7 @@ var Node2 = class _Node2 {
|
|
|
7191
7198
|
}
|
|
7192
7199
|
};
|
|
7193
7200
|
|
|
7194
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
7201
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/router/trie-router/router.js
|
|
7195
7202
|
var TrieRouter = class {
|
|
7196
7203
|
name = "TrieRouter";
|
|
7197
7204
|
#node;
|
|
@@ -7213,7 +7220,7 @@ var TrieRouter = class {
|
|
|
7213
7220
|
}
|
|
7214
7221
|
};
|
|
7215
7222
|
|
|
7216
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
7223
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/hono.js
|
|
7217
7224
|
var Hono2 = class extends Hono {
|
|
7218
7225
|
/**
|
|
7219
7226
|
* Creates an instance of the Hono class.
|
|
@@ -7228,7 +7235,7 @@ var Hono2 = class extends Hono {
|
|
|
7228
7235
|
}
|
|
7229
7236
|
};
|
|
7230
7237
|
|
|
7231
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
7238
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/middleware/cors/index.js
|
|
7232
7239
|
var cors = (options) => {
|
|
7233
7240
|
const defaults = {
|
|
7234
7241
|
origin: "*",
|
|
@@ -7243,6 +7250,9 @@ var cors = (options) => {
|
|
|
7243
7250
|
const findAllowOrigin = ((optsOrigin) => {
|
|
7244
7251
|
if (typeof optsOrigin === "string") {
|
|
7245
7252
|
if (optsOrigin === "*") {
|
|
7253
|
+
if (opts.credentials) {
|
|
7254
|
+
return (origin) => origin || null;
|
|
7255
|
+
}
|
|
7246
7256
|
return () => optsOrigin;
|
|
7247
7257
|
} else {
|
|
7248
7258
|
return (origin) => optsOrigin === origin ? origin : null;
|
|
@@ -7277,7 +7287,7 @@ var cors = (options) => {
|
|
|
7277
7287
|
set("Access-Control-Expose-Headers", opts.exposeHeaders.join(","));
|
|
7278
7288
|
}
|
|
7279
7289
|
if (c.req.method === "OPTIONS") {
|
|
7280
|
-
if (opts.origin !== "*") {
|
|
7290
|
+
if (opts.origin !== "*" || opts.credentials) {
|
|
7281
7291
|
set("Vary", "Origin");
|
|
7282
7292
|
}
|
|
7283
7293
|
if (opts.maxAge != null) {
|
|
@@ -7307,7 +7317,7 @@ var cors = (options) => {
|
|
|
7307
7317
|
});
|
|
7308
7318
|
}
|
|
7309
7319
|
await next();
|
|
7310
|
-
if (opts.origin !== "*") {
|
|
7320
|
+
if (opts.origin !== "*" || opts.credentials) {
|
|
7311
7321
|
c.header("Vary", "Origin", { append: true });
|
|
7312
7322
|
}
|
|
7313
7323
|
};
|
|
@@ -7319,7 +7329,7 @@ import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSy
|
|
|
7319
7329
|
import { join as join3 } from "path";
|
|
7320
7330
|
import { homedir as homedir5 } from "os";
|
|
7321
7331
|
|
|
7322
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
7332
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/utils/stream.js
|
|
7323
7333
|
var StreamingApi = class {
|
|
7324
7334
|
writer;
|
|
7325
7335
|
encoder;
|
|
@@ -7396,7 +7406,7 @@ var StreamingApi = class {
|
|
|
7396
7406
|
}
|
|
7397
7407
|
};
|
|
7398
7408
|
|
|
7399
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
7409
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/helper/streaming/utils.js
|
|
7400
7410
|
var isOldBunVersion = () => {
|
|
7401
7411
|
const version = typeof Bun !== "undefined" ? Bun.version : void 0;
|
|
7402
7412
|
if (version === void 0) {
|
|
@@ -7407,7 +7417,7 @@ var isOldBunVersion = () => {
|
|
|
7407
7417
|
return result;
|
|
7408
7418
|
};
|
|
7409
7419
|
|
|
7410
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
7420
|
+
// ../../node_modules/.pnpm/hono@4.12.9/node_modules/hono/dist/helper/streaming/sse.js
|
|
7411
7421
|
var SSEStreamingApi = class extends StreamingApi {
|
|
7412
7422
|
constructor(writable, readable) {
|
|
7413
7423
|
super(writable, readable);
|
|
@@ -7860,7 +7870,7 @@ function registerLock(program3) {
|
|
|
7860
7870
|
});
|
|
7861
7871
|
program3.command("unlock").description("Unlock agent \u2014 resume operations").action(async () => {
|
|
7862
7872
|
try {
|
|
7863
|
-
const { T2000: T20003 } = await import("./dist-
|
|
7873
|
+
const { T2000: T20003 } = await import("./dist-TWST5EWE.js");
|
|
7864
7874
|
const MAX_ATTEMPTS2 = 3;
|
|
7865
7875
|
let pin;
|
|
7866
7876
|
for (let attempt = 1; attempt <= MAX_ATTEMPTS2; attempt++) {
|
|
@@ -7911,161 +7921,26 @@ function registerLock(program3) {
|
|
|
7911
7921
|
});
|
|
7912
7922
|
}
|
|
7913
7923
|
|
|
7914
|
-
// src/commands/sentinel.ts
|
|
7915
|
-
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
7916
|
-
function formatSui(mist) {
|
|
7917
|
-
return (Number(mist) / Number(MIST_PER_SUI)).toFixed(2);
|
|
7918
|
-
}
|
|
7919
|
-
function registerSentinel(program3) {
|
|
7920
|
-
const sentinel = program3.command("sentinel").description("Interact with Sui Sentinel \u2014 attack AI agents, earn bounties");
|
|
7921
|
-
sentinel.command("list").description("List active sentinels with prize pools").action(async () => {
|
|
7922
|
-
try {
|
|
7923
|
-
const pin = await resolvePin();
|
|
7924
|
-
const agent = await T2000.create({ pin });
|
|
7925
|
-
const sentinels = await agent.sentinelList();
|
|
7926
|
-
if (isJsonMode()) {
|
|
7927
|
-
printJson(sentinels.map((s) => ({
|
|
7928
|
-
...s,
|
|
7929
|
-
attackFee: s.attackFee.toString(),
|
|
7930
|
-
prizePool: s.prizePool.toString()
|
|
7931
|
-
})));
|
|
7932
|
-
return;
|
|
7933
|
-
}
|
|
7934
|
-
if (sentinels.length === 0) {
|
|
7935
|
-
printBlank();
|
|
7936
|
-
printInfo("No active sentinels found.");
|
|
7937
|
-
printBlank();
|
|
7938
|
-
return;
|
|
7939
|
-
}
|
|
7940
|
-
printHeader("Active Sentinels");
|
|
7941
|
-
sentinels.forEach((s) => {
|
|
7942
|
-
const pool = `${formatSui(s.prizePool)} SUI`.padEnd(12);
|
|
7943
|
-
const fee = `${formatSui(s.attackFee)} SUI`.padEnd(12);
|
|
7944
|
-
printLine(` ${s.name}`);
|
|
7945
|
-
printLine(` ${import_picocolors11.default.dim(`Pool: ${pool}Fee: ${fee}Attacks: ${s.totalAttacks}`)}`);
|
|
7946
|
-
printLine(` ${import_picocolors11.default.dim(s.objectId)}`);
|
|
7947
|
-
printBlank();
|
|
7948
|
-
});
|
|
7949
|
-
printBlank();
|
|
7950
|
-
printInfo(`${sentinels.length} active sentinel${sentinels.length === 1 ? "" : "s"}`);
|
|
7951
|
-
printBlank();
|
|
7952
|
-
} catch (error) {
|
|
7953
|
-
handleError(error);
|
|
7954
|
-
}
|
|
7955
|
-
});
|
|
7956
|
-
sentinel.command("info").description("Show details for a sentinel").argument("<id>", "Sentinel object ID").action(async (id) => {
|
|
7957
|
-
try {
|
|
7958
|
-
const pin = await resolvePin();
|
|
7959
|
-
const agent = await T2000.create({ pin });
|
|
7960
|
-
const s = await agent.sentinelInfo(id);
|
|
7961
|
-
if (isJsonMode()) {
|
|
7962
|
-
printJson({
|
|
7963
|
-
...s,
|
|
7964
|
-
attackFee: s.attackFee.toString(),
|
|
7965
|
-
prizePool: s.prizePool.toString()
|
|
7966
|
-
});
|
|
7967
|
-
return;
|
|
7968
|
-
}
|
|
7969
|
-
printHeader(s.name);
|
|
7970
|
-
printKeyValue("Object ID", s.objectId);
|
|
7971
|
-
printKeyValue("Agent ID", s.id);
|
|
7972
|
-
printKeyValue("Model", s.model);
|
|
7973
|
-
printKeyValue("State", s.state);
|
|
7974
|
-
printKeyValue("Attack Fee", `${formatSui(s.attackFee)} SUI`);
|
|
7975
|
-
printKeyValue("Prize Pool", `${formatSui(s.prizePool)} SUI`);
|
|
7976
|
-
printKeyValue("Total Attacks", String(s.totalAttacks));
|
|
7977
|
-
printKeyValue("Breaches", String(s.successfulBreaches));
|
|
7978
|
-
if (s.systemPrompt) {
|
|
7979
|
-
printBlank();
|
|
7980
|
-
printKeyValue("System Prompt", "");
|
|
7981
|
-
printLine(` ${import_picocolors11.default.dim(s.systemPrompt.slice(0, 500))}`);
|
|
7982
|
-
}
|
|
7983
|
-
printBlank();
|
|
7984
|
-
} catch (error) {
|
|
7985
|
-
handleError(error);
|
|
7986
|
-
}
|
|
7987
|
-
});
|
|
7988
|
-
sentinel.command("attack").description("Attack a sentinel with a prompt (costs SUI)").argument("<id>", "Sentinel object ID").argument("[prompt]", "Attack prompt").option("--fee <sui>", "Override attack fee in SUI").option("--key <path>", "Key file path").action(async (id, prompt, opts) => {
|
|
7989
|
-
try {
|
|
7990
|
-
if (!prompt) {
|
|
7991
|
-
throw new Error('Prompt is required. Usage: t2000 sentinel attack <id> "your prompt"');
|
|
7992
|
-
}
|
|
7993
|
-
const pin = await resolvePin();
|
|
7994
|
-
const agent = await T2000.create({ pin, keyPath: opts.key });
|
|
7995
|
-
const feeMist = opts.fee ? BigInt(Math.round(parseFloat(opts.fee) * Number(MIST_PER_SUI))) : void 0;
|
|
7996
|
-
if (isJsonMode()) {
|
|
7997
|
-
const result2 = await agent.sentinelAttack(id, prompt, feeMist);
|
|
7998
|
-
printJson({
|
|
7999
|
-
...result2,
|
|
8000
|
-
verdict: {
|
|
8001
|
-
...result2.verdict
|
|
8002
|
-
}
|
|
8003
|
-
});
|
|
8004
|
-
return;
|
|
8005
|
-
}
|
|
8006
|
-
printBlank();
|
|
8007
|
-
printLine(` ${import_picocolors11.default.dim("\u23F3")} Requesting attack...`);
|
|
8008
|
-
const result = await agent.sentinelAttack(id, prompt, feeMist);
|
|
8009
|
-
printBlank();
|
|
8010
|
-
if (result.won) {
|
|
8011
|
-
printSuccess(`BREACHED! (score: ${result.verdict.score}/100)`);
|
|
8012
|
-
} else {
|
|
8013
|
-
printError(`DEFENDED (score: ${result.verdict.score}/100)`);
|
|
8014
|
-
}
|
|
8015
|
-
printBlank();
|
|
8016
|
-
printKeyValue("Agent", result.verdict.agentResponse.slice(0, 200));
|
|
8017
|
-
printKeyValue("Jury", result.verdict.juryResponse.slice(0, 200));
|
|
8018
|
-
if (result.verdict.funResponse) {
|
|
8019
|
-
printKeyValue("Fun", result.verdict.funResponse.slice(0, 200));
|
|
8020
|
-
}
|
|
8021
|
-
printBlank();
|
|
8022
|
-
printKeyValue("Fee Paid", `${result.feePaid} SUI`);
|
|
8023
|
-
printKeyValue("Request Tx", explorerUrl(result.requestTx));
|
|
8024
|
-
printKeyValue("Settle Tx", explorerUrl(result.settleTx));
|
|
8025
|
-
printBlank();
|
|
8026
|
-
} catch (error) {
|
|
8027
|
-
handleError(error);
|
|
8028
|
-
}
|
|
8029
|
-
});
|
|
8030
|
-
}
|
|
8031
|
-
|
|
8032
7924
|
// src/commands/earn.ts
|
|
8033
|
-
var
|
|
8034
|
-
function mistToSui(mist) {
|
|
8035
|
-
return Number(mist) / Number(MIST_PER_SUI);
|
|
8036
|
-
}
|
|
8037
|
-
function bestTarget(sentinels) {
|
|
8038
|
-
const withPool = sentinels.filter((s) => s.prizePool > 0n && s.attackFee > 0n);
|
|
8039
|
-
if (withPool.length === 0) return void 0;
|
|
8040
|
-
return withPool.sort((a, b) => {
|
|
8041
|
-
const ratioA = Number(a.prizePool) / Number(a.attackFee);
|
|
8042
|
-
const ratioB = Number(b.prizePool) / Number(b.attackFee);
|
|
8043
|
-
return ratioB - ratioA;
|
|
8044
|
-
})[0];
|
|
8045
|
-
}
|
|
7925
|
+
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
8046
7926
|
function registerEarn(program3) {
|
|
8047
|
-
program3.command("earn").description("Show all earning opportunities \u2014 savings yield +
|
|
7927
|
+
program3.command("earn").description("Show all earning opportunities \u2014 savings yield + investment yield").option("--key <path>", "Key file path").action(async (opts) => {
|
|
8048
7928
|
try {
|
|
8049
7929
|
const pin = await resolvePin();
|
|
8050
7930
|
const agent = await T2000.create({ pin, keyPath: opts.key });
|
|
8051
|
-
const [positionsResult, portfolioResult, ratesResult
|
|
7931
|
+
const [positionsResult, portfolioResult, ratesResult] = await Promise.allSettled([
|
|
8052
7932
|
agent.positions(),
|
|
8053
7933
|
agent.getPortfolio(),
|
|
8054
|
-
agent.allRates("USDC")
|
|
8055
|
-
listSentinels()
|
|
7934
|
+
agent.allRates("USDC")
|
|
8056
7935
|
]);
|
|
8057
7936
|
const posData = positionsResult.status === "fulfilled" ? positionsResult.value : null;
|
|
8058
7937
|
const portfolio = portfolioResult.status === "fulfilled" ? portfolioResult.value : null;
|
|
8059
7938
|
const ratesData = ratesResult.status === "fulfilled" ? ratesResult.value : null;
|
|
8060
|
-
const agents = sentinels.status === "fulfilled" ? sentinels.value : null;
|
|
8061
7939
|
const savePositions = posData?.positions.filter((p) => p.type === "save") ?? [];
|
|
8062
7940
|
const totalSaved = savePositions.reduce((s, p) => s + p.amount, 0);
|
|
8063
7941
|
const earningInvestments = portfolio?.positions.filter((p) => p.earning && p.currentValue > 0) ?? [];
|
|
8064
7942
|
const bestSaveApy = ratesData?.length ? Math.max(...ratesData.map((r) => r.rates.saveApy)) : 0;
|
|
8065
7943
|
if (isJsonMode()) {
|
|
8066
|
-
const best = agents ? bestTarget(agents) : void 0;
|
|
8067
|
-
const totalPool = agents ? agents.reduce((sum, s) => sum + mistToSui(s.prizePool), 0) : 0;
|
|
8068
|
-
const cheapest = agents ? Math.min(...agents.map((s) => mistToSui(s.attackFee))) : 0;
|
|
8069
7944
|
printJson({
|
|
8070
7945
|
savings: savePositions.map((p) => ({
|
|
8071
7946
|
protocol: p.protocol,
|
|
@@ -8085,24 +7960,12 @@ function registerEarn(program3) {
|
|
|
8085
7960
|
value: p.currentValue,
|
|
8086
7961
|
protocol: p.earningProtocol,
|
|
8087
7962
|
apy: p.earningApy
|
|
8088
|
-
}))
|
|
8089
|
-
sentinel: agents ? {
|
|
8090
|
-
activeSentinels: agents.length,
|
|
8091
|
-
totalPrizePool: Number(totalPool.toFixed(2)),
|
|
8092
|
-
cheapestFee: Number(cheapest.toFixed(2)),
|
|
8093
|
-
bestTarget: best ? {
|
|
8094
|
-
name: best.name,
|
|
8095
|
-
objectId: best.objectId,
|
|
8096
|
-
prizePool: mistToSui(best.prizePool),
|
|
8097
|
-
attackFee: mistToSui(best.attackFee),
|
|
8098
|
-
ratio: Number((Number(best.prizePool) / Number(best.attackFee)).toFixed(1))
|
|
8099
|
-
} : null
|
|
8100
|
-
} : null
|
|
7963
|
+
}))
|
|
8101
7964
|
});
|
|
8102
7965
|
return;
|
|
8103
7966
|
}
|
|
8104
7967
|
printHeader("Earning Opportunities");
|
|
8105
|
-
printLine(
|
|
7968
|
+
printLine(import_picocolors11.default.bold("SAVINGS") + import_picocolors11.default.dim(" \u2014 Passive Yield"));
|
|
8106
7969
|
printDivider();
|
|
8107
7970
|
if (savePositions.length > 0) {
|
|
8108
7971
|
for (const pos of savePositions) {
|
|
@@ -8111,7 +7974,7 @@ function registerEarn(program3) {
|
|
|
8111
7974
|
if (dailyYield > 1e-4) {
|
|
8112
7975
|
const dailyStr = dailyYield < 0.01 ? `$${dailyYield.toFixed(4)}` : formatUsd(dailyYield);
|
|
8113
7976
|
const monthlyStr = dailyYield * 30 < 0.01 ? `$${(dailyYield * 30).toFixed(4)}` : formatUsd(dailyYield * 30);
|
|
8114
|
-
printLine(
|
|
7977
|
+
printLine(import_picocolors11.default.dim(` ~${dailyStr}/day \xB7 ~${monthlyStr}/month`));
|
|
8115
7978
|
}
|
|
8116
7979
|
}
|
|
8117
7980
|
if (savePositions.length > 1) {
|
|
@@ -8126,7 +7989,7 @@ function registerEarn(program3) {
|
|
|
8126
7989
|
const example = 100;
|
|
8127
7990
|
const daily = example * bestSaveApy / 100 / 365;
|
|
8128
7991
|
const monthly = daily * 30;
|
|
8129
|
-
printLine(
|
|
7992
|
+
printLine(import_picocolors11.default.dim(` Save $${example} \u2192 ~$${daily.toFixed(2)}/day \xB7 ~$${monthly.toFixed(2)}/month`));
|
|
8130
7993
|
printBlank();
|
|
8131
7994
|
printInfo("No savings yet \u2014 run `t2000 save <amount>` to start");
|
|
8132
7995
|
} else if (posData) {
|
|
@@ -8136,7 +7999,7 @@ function registerEarn(program3) {
|
|
|
8136
7999
|
}
|
|
8137
8000
|
if (earningInvestments.length > 0) {
|
|
8138
8001
|
printBlank();
|
|
8139
|
-
printLine(
|
|
8002
|
+
printLine(import_picocolors11.default.bold("INVESTMENTS") + import_picocolors11.default.dim(" \u2014 Earning Yield"));
|
|
8140
8003
|
printDivider();
|
|
8141
8004
|
let totalInvestValue = 0;
|
|
8142
8005
|
for (const pos of earningInvestments) {
|
|
@@ -8149,7 +8012,7 @@ function registerEarn(program3) {
|
|
|
8149
8012
|
if (dailyYield > 1e-4) {
|
|
8150
8013
|
const dailyStr = dailyYield < 0.01 ? `$${dailyYield.toFixed(4)}` : formatUsd(dailyYield);
|
|
8151
8014
|
const monthlyStr = dailyYield * 30 < 0.01 ? `$${(dailyYield * 30).toFixed(4)}` : formatUsd(dailyYield * 30);
|
|
8152
|
-
printLine(
|
|
8015
|
+
printLine(import_picocolors11.default.dim(` ~${dailyStr}/day \xB7 ~${monthlyStr}/month`));
|
|
8153
8016
|
}
|
|
8154
8017
|
totalInvestValue += pos.currentValue;
|
|
8155
8018
|
}
|
|
@@ -8159,31 +8022,10 @@ function registerEarn(program3) {
|
|
|
8159
8022
|
}
|
|
8160
8023
|
}
|
|
8161
8024
|
printBlank();
|
|
8162
|
-
printLine(
|
|
8025
|
+
printLine(import_picocolors11.default.bold("Quick Actions"));
|
|
8163
8026
|
printDivider();
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
const cheapest = Math.min(...agents.map((s) => mistToSui(s.attackFee)));
|
|
8167
|
-
const best = bestTarget(agents);
|
|
8168
|
-
printKeyValue("Active", `${agents.length} sentinels`);
|
|
8169
|
-
printKeyValue("Prize Pools", `${totalPool.toFixed(2)} SUI available`);
|
|
8170
|
-
printKeyValue("Cheapest Fee", `${cheapest.toFixed(2)} SUI`);
|
|
8171
|
-
if (best) {
|
|
8172
|
-
const ratio = (Number(best.prizePool) / Number(best.attackFee)).toFixed(1);
|
|
8173
|
-
printKeyValue("Best Target", `${best.name} \u2014 ${mistToSui(best.prizePool).toFixed(2)} SUI pool (${ratio}x ratio)`);
|
|
8174
|
-
}
|
|
8175
|
-
} else if (agents) {
|
|
8176
|
-
printInfo("No active bounties right now");
|
|
8177
|
-
} else {
|
|
8178
|
-
printInfo("Sentinel data unavailable");
|
|
8179
|
-
}
|
|
8180
|
-
printBlank();
|
|
8181
|
-
printLine(import_picocolors12.default.bold("Quick Actions"));
|
|
8182
|
-
printDivider();
|
|
8183
|
-
printLine(` ${import_picocolors12.default.dim("t2000 save <amount> [asset]")} Save stablecoins for yield`);
|
|
8184
|
-
printLine(` ${import_picocolors12.default.dim("t2000 invest earn <asset>")} Earn yield on investments`);
|
|
8185
|
-
printLine(` ${import_picocolors12.default.dim("t2000 sentinel list")} Browse sentinel bounties`);
|
|
8186
|
-
printLine(` ${import_picocolors12.default.dim("t2000 sentinel attack <id>")} Attack a sentinel`);
|
|
8027
|
+
printLine(` ${import_picocolors11.default.dim("t2000 save <amount> [asset]")} Save stablecoins for yield`);
|
|
8028
|
+
printLine(` ${import_picocolors11.default.dim("t2000 invest earn <asset>")} Earn yield on investments`);
|
|
8187
8029
|
printBlank();
|
|
8188
8030
|
} catch (error) {
|
|
8189
8031
|
handleError(error);
|
|
@@ -8192,7 +8034,7 @@ function registerEarn(program3) {
|
|
|
8192
8034
|
}
|
|
8193
8035
|
|
|
8194
8036
|
// src/commands/rebalance.ts
|
|
8195
|
-
var
|
|
8037
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
8196
8038
|
function registerRebalance(program3) {
|
|
8197
8039
|
program3.command("rebalance").description("Optimize yield \u2014 move savings to the best rate across protocols and stablecoins").option("--key <path>", "Key file path").option("--dry-run", "Show what would happen without executing").option("--min-diff <pct>", "Minimum APY difference to trigger (default: 0.5)", "0.5").option("--max-break-even <days>", "Max break-even days for cross-asset moves (default: 30)", "30").action(async (opts) => {
|
|
8198
8040
|
try {
|
|
@@ -8219,24 +8061,24 @@ function registerRebalance(program3) {
|
|
|
8219
8061
|
const diff = plan.newApy - plan.currentApy;
|
|
8220
8062
|
if (diff < minYieldDiff) {
|
|
8221
8063
|
printInfo(`Already optimized \u2014 ${plan.currentApy.toFixed(2)}% APY on ${plan.fromProtocol}`);
|
|
8222
|
-
printLine(
|
|
8223
|
-
printLine(
|
|
8064
|
+
printLine(import_picocolors12.default.dim(` Best available: ${plan.newApy.toFixed(2)}% (${displayAsset(plan.toAsset)} on ${plan.toProtocol})`));
|
|
8065
|
+
printLine(import_picocolors12.default.dim(` Difference: ${diff.toFixed(2)}% (below ${minYieldDiff}% threshold)`));
|
|
8224
8066
|
} else if (plan.breakEvenDays > maxBreakEven && plan.estimatedSwapCost > 0) {
|
|
8225
8067
|
printInfo(`Skipped \u2014 break-even of ${plan.breakEvenDays} days exceeds ${maxBreakEven}-day limit`);
|
|
8226
|
-
printLine(
|
|
8068
|
+
printLine(import_picocolors12.default.dim(` ${displayAsset(plan.fromAsset)} on ${plan.fromProtocol} (${plan.currentApy.toFixed(2)}%) \u2192 ${displayAsset(plan.toAsset)} on ${plan.toProtocol} (${plan.newApy.toFixed(2)}%)`));
|
|
8227
8069
|
} else {
|
|
8228
8070
|
printInfo("Already at the best rate. Nothing to rebalance.");
|
|
8229
8071
|
}
|
|
8230
8072
|
printBlank();
|
|
8231
8073
|
return;
|
|
8232
8074
|
}
|
|
8233
|
-
printLine(
|
|
8075
|
+
printLine(import_picocolors12.default.bold("Rebalance Plan"));
|
|
8234
8076
|
printDivider();
|
|
8235
8077
|
printKeyValue("From", `${displayAsset(plan.fromAsset)} on ${plan.fromProtocol} (${plan.currentApy.toFixed(2)}% APY)`);
|
|
8236
8078
|
printKeyValue("To", `${displayAsset(plan.toAsset)} on ${plan.toProtocol} (${plan.newApy.toFixed(2)}% APY)`);
|
|
8237
8079
|
printKeyValue("Amount", formatUsd(plan.amount));
|
|
8238
8080
|
printBlank();
|
|
8239
|
-
printLine(
|
|
8081
|
+
printLine(import_picocolors12.default.bold("Economics"));
|
|
8240
8082
|
printDivider();
|
|
8241
8083
|
printKeyValue("APY Gain", `+${(plan.newApy - plan.currentApy).toFixed(2)}%`);
|
|
8242
8084
|
printKeyValue("Annual Gain", `${formatUsd(plan.annualGain)}/year`);
|
|
@@ -8246,7 +8088,7 @@ function registerRebalance(program3) {
|
|
|
8246
8088
|
}
|
|
8247
8089
|
printBlank();
|
|
8248
8090
|
if (plan.steps.length > 0) {
|
|
8249
|
-
printLine(
|
|
8091
|
+
printLine(import_picocolors12.default.bold("Steps"));
|
|
8250
8092
|
printDivider();
|
|
8251
8093
|
for (let i = 0; i < plan.steps.length; i++) {
|
|
8252
8094
|
const step = plan.steps[i];
|
|
@@ -8262,8 +8104,8 @@ function registerRebalance(program3) {
|
|
|
8262
8104
|
printBlank();
|
|
8263
8105
|
}
|
|
8264
8106
|
if (opts.dryRun) {
|
|
8265
|
-
printLine(
|
|
8266
|
-
printLine(
|
|
8107
|
+
printLine(import_picocolors12.default.bold(import_picocolors12.default.yellow("DRY RUN \u2014 Preview only, no transactions executed")));
|
|
8108
|
+
printLine(import_picocolors12.default.dim(" Run `t2000 rebalance` to execute."));
|
|
8267
8109
|
printBlank();
|
|
8268
8110
|
return;
|
|
8269
8111
|
}
|
|
@@ -8286,7 +8128,7 @@ function displayAsset(asset) {
|
|
|
8286
8128
|
}
|
|
8287
8129
|
|
|
8288
8130
|
// src/commands/exchange.ts
|
|
8289
|
-
var
|
|
8131
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
8290
8132
|
function resolveAssetName(input) {
|
|
8291
8133
|
const upper = input.toUpperCase();
|
|
8292
8134
|
for (const key of Object.keys(SUPPORTED_ASSETS)) {
|
|
@@ -8297,7 +8139,7 @@ function resolveAssetName(input) {
|
|
|
8297
8139
|
function registerExchange(program3) {
|
|
8298
8140
|
program3.command("exchange <amount> <from> <to>").description('[deprecated \u2014 use "swap" instead] Exchange between tokens').option("--key <path>", "Key file path").option("--slippage <pct>", "Max slippage percentage (default: 3)", "3").action(async (amount, from, to, opts) => {
|
|
8299
8141
|
try {
|
|
8300
|
-
console.error(
|
|
8142
|
+
console.error(import_picocolors13.default.yellow(' \u26A0 "exchange" is deprecated. Use "swap" instead: t2000 swap %s %s %s'), amount, from, to);
|
|
8301
8143
|
const pin = await resolvePin();
|
|
8302
8144
|
const agent = await T2000.create({ pin, keyPath: opts.key });
|
|
8303
8145
|
const parsedAmount = parseFloat(amount);
|
|
@@ -8312,7 +8154,7 @@ function registerExchange(program3) {
|
|
|
8312
8154
|
printJson(result);
|
|
8313
8155
|
return;
|
|
8314
8156
|
}
|
|
8315
|
-
console.log(
|
|
8157
|
+
console.log(import_picocolors13.default.green(" \u2713 Swapped. Tx: %s"), result.tx);
|
|
8316
8158
|
} catch (error) {
|
|
8317
8159
|
handleError(error);
|
|
8318
8160
|
}
|
|
@@ -8494,7 +8336,7 @@ function registerMcp(program3) {
|
|
|
8494
8336
|
mcp.command("start", { isDefault: true }).description("Start MCP server (stdio transport)").option("--key <path>", "Key file path").action(async (opts) => {
|
|
8495
8337
|
let mod;
|
|
8496
8338
|
try {
|
|
8497
|
-
mod = await import("./dist-
|
|
8339
|
+
mod = await import("./dist-MJOXMRDV.js");
|
|
8498
8340
|
} catch {
|
|
8499
8341
|
console.error(
|
|
8500
8342
|
"MCP server not installed. Run:\n npm install -g @t2000/mcp"
|
|
@@ -8645,15 +8487,15 @@ function registerContacts(program3) {
|
|
|
8645
8487
|
}
|
|
8646
8488
|
|
|
8647
8489
|
// src/commands/invest.ts
|
|
8648
|
-
var
|
|
8490
|
+
var import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
8649
8491
|
function registerInvest(program3) {
|
|
8650
8492
|
const investCmd = program3.command("invest").description("Investment strategies, DCA, and yield earning");
|
|
8651
8493
|
investCmd.command("buy <amount> <asset>").description('[deprecated \u2014 use "buy" instead] Buy an asset').option("--key <path>", "Key file path").option("--slippage <pct>", "Max slippage percent", "3").action(async (amount, asset, opts) => {
|
|
8652
8494
|
try {
|
|
8653
|
-
console.error(
|
|
8495
|
+
console.error(import_picocolors14.default.yellow(` \u26A0 "invest buy" is deprecated. Use: t2000 buy ${amount} ${asset}`));
|
|
8654
8496
|
const parsed = parseFloat(amount);
|
|
8655
8497
|
if (isNaN(parsed) || parsed <= 0 || !isFinite(parsed)) {
|
|
8656
|
-
console.error(
|
|
8498
|
+
console.error(import_picocolors14.default.red(" \u2717 Amount must be greater than $0"));
|
|
8657
8499
|
process.exitCode = 1;
|
|
8658
8500
|
return;
|
|
8659
8501
|
}
|
|
@@ -8680,12 +8522,12 @@ function registerInvest(program3) {
|
|
|
8680
8522
|
});
|
|
8681
8523
|
investCmd.command("sell <amount> <asset>").description('[deprecated \u2014 use "sell" instead] Sell an asset').option("--key <path>", "Key file path").option("--slippage <pct>", "Max slippage percent", "3").action(async (amount, asset, opts) => {
|
|
8682
8524
|
try {
|
|
8683
|
-
console.error(
|
|
8525
|
+
console.error(import_picocolors14.default.yellow(` \u26A0 "invest sell" is deprecated. Use: t2000 sell ${amount} ${asset}`));
|
|
8684
8526
|
const isAll = amount.toLowerCase() === "all";
|
|
8685
8527
|
if (!isAll) {
|
|
8686
8528
|
const parsed = parseFloat(amount);
|
|
8687
8529
|
if (isNaN(parsed) || parsed <= 0 || !isFinite(parsed)) {
|
|
8688
|
-
console.error(
|
|
8530
|
+
console.error(import_picocolors14.default.red(" \u2717 Amount must be greater than $0"));
|
|
8689
8531
|
process.exitCode = 1;
|
|
8690
8532
|
return;
|
|
8691
8533
|
}
|
|
@@ -8707,7 +8549,7 @@ function registerInvest(program3) {
|
|
|
8707
8549
|
printSuccess(`Sold ${formatAssetAmount(result.amount, sym)} ${sym} at ${formatUsd(result.price)}`);
|
|
8708
8550
|
printKeyValue("Proceeds", formatUsd(result.usdValue));
|
|
8709
8551
|
if (result.realizedPnL !== void 0) {
|
|
8710
|
-
const pnlColor = result.realizedPnL >= 0 ?
|
|
8552
|
+
const pnlColor = result.realizedPnL >= 0 ? import_picocolors14.default.green : import_picocolors14.default.red;
|
|
8711
8553
|
const pnlSign = result.realizedPnL >= 0 ? "+" : "";
|
|
8712
8554
|
printKeyValue("Realized P&L", pnlColor(`${pnlSign}${formatUsd(result.realizedPnL)}`));
|
|
8713
8555
|
}
|
|
@@ -8835,9 +8677,9 @@ function registerInvest(program3) {
|
|
|
8835
8677
|
printSeparator();
|
|
8836
8678
|
for (const [key, def] of Object.entries(all)) {
|
|
8837
8679
|
const allocs = Object.entries(def.allocations).map(([a, p]) => `${a} ${p}%`).join(", ");
|
|
8838
|
-
const tag = def.custom ?
|
|
8680
|
+
const tag = def.custom ? import_picocolors14.default.dim(" (custom)") : "";
|
|
8839
8681
|
printKeyValue(key, `${allocs}${tag}`);
|
|
8840
|
-
printLine(` ${
|
|
8682
|
+
printLine(` ${import_picocolors14.default.dim(def.description)}`);
|
|
8841
8683
|
}
|
|
8842
8684
|
printSeparator();
|
|
8843
8685
|
const hasPositions = Object.keys(all).some((k) => agent.portfolio.hasStrategyPositions(k));
|
|
@@ -8853,7 +8695,7 @@ function registerInvest(program3) {
|
|
|
8853
8695
|
try {
|
|
8854
8696
|
const parsed = parseFloat(amount);
|
|
8855
8697
|
if (isNaN(parsed) || parsed <= 0) {
|
|
8856
|
-
console.error(
|
|
8698
|
+
console.error(import_picocolors14.default.red(" \u2717 Amount must be greater than $0"));
|
|
8857
8699
|
process.exitCode = 1;
|
|
8858
8700
|
return;
|
|
8859
8701
|
}
|
|
@@ -8887,7 +8729,7 @@ function registerInvest(program3) {
|
|
|
8887
8729
|
printKeyValue("Tx", explorerUrl(txDigests[0]));
|
|
8888
8730
|
} else {
|
|
8889
8731
|
for (const buy of result.buys) {
|
|
8890
|
-
printLine(` ${
|
|
8732
|
+
printLine(` ${import_picocolors14.default.dim(`${buy.asset}: ${explorerUrl(buy.tx)}`)}`);
|
|
8891
8733
|
}
|
|
8892
8734
|
}
|
|
8893
8735
|
}
|
|
@@ -8909,18 +8751,18 @@ function registerInvest(program3) {
|
|
|
8909
8751
|
printSuccess(`Sold all ${name} strategy positions`);
|
|
8910
8752
|
printSeparator();
|
|
8911
8753
|
for (const sell of result.sells) {
|
|
8912
|
-
const pnlColor = sell.realizedPnL >= 0 ?
|
|
8754
|
+
const pnlColor = sell.realizedPnL >= 0 ? import_picocolors14.default.green : import_picocolors14.default.red;
|
|
8913
8755
|
const pnlSign = sell.realizedPnL >= 0 ? "+" : "";
|
|
8914
8756
|
printKeyValue(sell.asset, `${formatAssetAmount(sell.amount, sell.asset)} \u2192 ${formatUsd(sell.usdValue)} ${pnlColor(`${pnlSign}${formatUsd(sell.realizedPnL)}`)}`);
|
|
8915
8757
|
}
|
|
8916
8758
|
if (result.failed && result.failed.length > 0) {
|
|
8917
8759
|
for (const f of result.failed) {
|
|
8918
|
-
console.error(
|
|
8760
|
+
console.error(import_picocolors14.default.yellow(` \u26A0 ${f.asset}: ${f.reason}`));
|
|
8919
8761
|
}
|
|
8920
8762
|
}
|
|
8921
8763
|
printSeparator();
|
|
8922
8764
|
printKeyValue("Total proceeds", formatUsd(result.totalProceeds));
|
|
8923
|
-
const rpnlColor = result.realizedPnL >= 0 ?
|
|
8765
|
+
const rpnlColor = result.realizedPnL >= 0 ? import_picocolors14.default.green : import_picocolors14.default.red;
|
|
8924
8766
|
const rpnlSign = result.realizedPnL >= 0 ? "+" : "";
|
|
8925
8767
|
printKeyValue("Realized P&L", rpnlColor(`${rpnlSign}${formatUsd(result.realizedPnL)}`));
|
|
8926
8768
|
printBlank();
|
|
@@ -8947,8 +8789,8 @@ function registerInvest(program3) {
|
|
|
8947
8789
|
const target = status.definition.allocations[pos.asset] ?? 0;
|
|
8948
8790
|
const actual = status.currentWeights[pos.asset] ?? 0;
|
|
8949
8791
|
const drift = actual - target;
|
|
8950
|
-
const driftColor = Math.abs(drift) > 3 ?
|
|
8951
|
-
const pnlColor = pos.unrealizedPnL >= 0 ?
|
|
8792
|
+
const driftColor = Math.abs(drift) > 3 ? import_picocolors14.default.yellow : import_picocolors14.default.dim;
|
|
8793
|
+
const pnlColor = pos.unrealizedPnL >= 0 ? import_picocolors14.default.green : import_picocolors14.default.red;
|
|
8952
8794
|
const pnlSign = pos.unrealizedPnL >= 0 ? "+" : "";
|
|
8953
8795
|
printKeyValue(
|
|
8954
8796
|
pos.asset,
|
|
@@ -8979,7 +8821,7 @@ function registerInvest(program3) {
|
|
|
8979
8821
|
printSuccess(`Rebalanced ${name} strategy`);
|
|
8980
8822
|
printSeparator();
|
|
8981
8823
|
for (const t of result.trades) {
|
|
8982
|
-
const action = t.action === "buy" ?
|
|
8824
|
+
const action = t.action === "buy" ? import_picocolors14.default.green("BUY") : import_picocolors14.default.red("SELL");
|
|
8983
8825
|
printKeyValue(t.asset, `${action} ${formatUsd(t.usdAmount)} (${formatAssetAmount(t.amount, t.asset)})`);
|
|
8984
8826
|
}
|
|
8985
8827
|
printSeparator();
|
|
@@ -8996,7 +8838,7 @@ function registerInvest(program3) {
|
|
|
8996
8838
|
for (const pair of opts.alloc) {
|
|
8997
8839
|
const [asset, pctStr] = pair.split(":");
|
|
8998
8840
|
if (!asset || !pctStr) {
|
|
8999
|
-
console.error(
|
|
8841
|
+
console.error(import_picocolors14.default.red(` \u2717 Invalid allocation: '${pair}'. Use ASSET:PCT format (e.g. SUI:60)`));
|
|
9000
8842
|
process.exitCode = 1;
|
|
9001
8843
|
return;
|
|
9002
8844
|
}
|
|
@@ -9023,7 +8865,7 @@ function registerInvest(program3) {
|
|
|
9023
8865
|
const pin = await resolvePin();
|
|
9024
8866
|
const agent = await T2000.create({ pin, keyPath: opts.key });
|
|
9025
8867
|
if (agent.portfolio.hasStrategyPositions(name.toLowerCase())) {
|
|
9026
|
-
console.error(
|
|
8868
|
+
console.error(import_picocolors14.default.red(` \u2717 Strategy '${name}' has open positions. Sell first: t2000 invest strategy sell ${name}`));
|
|
9027
8869
|
process.exitCode = 1;
|
|
9028
8870
|
return;
|
|
9029
8871
|
}
|
|
@@ -9044,12 +8886,12 @@ function registerInvest(program3) {
|
|
|
9044
8886
|
try {
|
|
9045
8887
|
const parsed = parseFloat(amount);
|
|
9046
8888
|
if (isNaN(parsed) || parsed < 1) {
|
|
9047
|
-
console.error(
|
|
8889
|
+
console.error(import_picocolors14.default.red(" \u2717 Amount must be at least $1"));
|
|
9048
8890
|
process.exitCode = 1;
|
|
9049
8891
|
return;
|
|
9050
8892
|
}
|
|
9051
8893
|
if (!["daily", "weekly", "monthly"].includes(frequency)) {
|
|
9052
|
-
console.error(
|
|
8894
|
+
console.error(import_picocolors14.default.red(" \u2717 Frequency must be daily, weekly, or monthly"));
|
|
9053
8895
|
process.exitCode = 1;
|
|
9054
8896
|
return;
|
|
9055
8897
|
}
|
|
@@ -9059,7 +8901,7 @@ function registerInvest(program3) {
|
|
|
9059
8901
|
const isStrategy = target ? target.toLowerCase() in allStrategies : false;
|
|
9060
8902
|
const isAsset = target ? target.toUpperCase() in INVESTMENT_ASSETS : false;
|
|
9061
8903
|
if (target && !isStrategy && !isAsset) {
|
|
9062
|
-
console.error(
|
|
8904
|
+
console.error(import_picocolors14.default.red(` \u2717 '${target}' is not a valid strategy or asset`));
|
|
9063
8905
|
process.exitCode = 1;
|
|
9064
8906
|
return;
|
|
9065
8907
|
}
|
|
@@ -9106,9 +8948,9 @@ function registerInvest(program3) {
|
|
|
9106
8948
|
printSeparator();
|
|
9107
8949
|
for (const s of status.schedules) {
|
|
9108
8950
|
const target = s.strategy ?? s.asset ?? "?";
|
|
9109
|
-
const statusTag = s.enabled ?
|
|
8951
|
+
const statusTag = s.enabled ? import_picocolors14.default.green("active") : import_picocolors14.default.dim("paused");
|
|
9110
8952
|
printKeyValue(s.id, `${formatUsd(s.amount)} ${s.frequency} \u2192 ${target} ${statusTag}`);
|
|
9111
|
-
printLine(` ${
|
|
8953
|
+
printLine(` ${import_picocolors14.default.dim(`Next: ${new Date(s.nextRun).toLocaleDateString()} \xB7 Runs: ${s.runCount} \xB7 Total: ${formatUsd(s.totalInvested)}`)}`);
|
|
9112
8954
|
}
|
|
9113
8955
|
printSeparator();
|
|
9114
8956
|
if (status.pendingRuns.length > 0) {
|
|
@@ -9151,7 +8993,7 @@ function registerInvest(program3) {
|
|
|
9151
8993
|
}
|
|
9152
8994
|
if (result.skipped.length > 0) {
|
|
9153
8995
|
for (const skip of result.skipped) {
|
|
9154
|
-
printLine(` ${
|
|
8996
|
+
printLine(` ${import_picocolors14.default.yellow("\u26A0")} Skipped ${skip.scheduleId}: ${skip.reason}`);
|
|
9155
8997
|
}
|
|
9156
8998
|
}
|
|
9157
8999
|
printBlank();
|
|
@@ -9178,21 +9020,21 @@ function registerInvest(program3) {
|
|
|
9178
9020
|
}
|
|
9179
9021
|
|
|
9180
9022
|
// src/commands/portfolio.ts
|
|
9181
|
-
var
|
|
9023
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
9182
9024
|
function printPositionLine(pos, rewardKeys) {
|
|
9183
9025
|
if (pos.currentPrice === 0 && pos.totalAmount > 0) {
|
|
9184
9026
|
printKeyValue(
|
|
9185
9027
|
pos.asset,
|
|
9186
|
-
`${formatAssetAmount(pos.totalAmount, pos.asset)} Avg: ${formatUsd(pos.avgPrice)} Now: ${
|
|
9028
|
+
`${formatAssetAmount(pos.totalAmount, pos.asset)} Avg: ${formatUsd(pos.avgPrice)} Now: ${import_picocolors15.default.yellow("unavailable")}`
|
|
9187
9029
|
);
|
|
9188
9030
|
} else {
|
|
9189
|
-
const pnlColor = pos.unrealizedPnL >= 0 ?
|
|
9031
|
+
const pnlColor = pos.unrealizedPnL >= 0 ? import_picocolors15.default.green : import_picocolors15.default.red;
|
|
9190
9032
|
const pnlSign = pos.unrealizedPnL >= 0 ? "+" : "";
|
|
9191
9033
|
let yieldSuffix = "";
|
|
9192
9034
|
if (pos.earning && pos.earningApy) {
|
|
9193
9035
|
const hasRewards = rewardKeys?.has(`${pos.earningProtocol}:${pos.asset}`);
|
|
9194
|
-
const rewardTag = hasRewards ? ` ${
|
|
9195
|
-
yieldSuffix = ` ${
|
|
9036
|
+
const rewardTag = hasRewards ? ` ${import_picocolors15.default.yellow("+rewards")}` : "";
|
|
9037
|
+
yieldSuffix = ` ${import_picocolors15.default.cyan(`${pos.earningApy.toFixed(1)}% APY (${pos.earningProtocol})`)}${rewardTag}`;
|
|
9196
9038
|
}
|
|
9197
9039
|
printKeyValue(
|
|
9198
9040
|
pos.asset,
|
|
@@ -9233,19 +9075,19 @@ function registerPortfolio(program3) {
|
|
|
9233
9075
|
stratLabel = def.name;
|
|
9234
9076
|
} catch {
|
|
9235
9077
|
}
|
|
9236
|
-
printLine(` ${
|
|
9078
|
+
printLine(` ${import_picocolors15.default.bold(import_picocolors15.default.cyan(`\u25B8 ${stratLabel}`))}`);
|
|
9237
9079
|
printSeparator();
|
|
9238
9080
|
for (const pos of positions) {
|
|
9239
9081
|
printPositionLine(pos, rewardKeys);
|
|
9240
9082
|
}
|
|
9241
9083
|
const stratValue = positions.reduce((s, p) => s + p.currentValue, 0);
|
|
9242
|
-
printLine(` ${
|
|
9084
|
+
printLine(` ${import_picocolors15.default.dim(`Subtotal: ${formatUsd(stratValue)}`)}`);
|
|
9243
9085
|
printBlank();
|
|
9244
9086
|
}
|
|
9245
9087
|
}
|
|
9246
9088
|
if (hasDirectPositions) {
|
|
9247
9089
|
if (hasStrategyPositions) {
|
|
9248
|
-
printLine(` ${
|
|
9090
|
+
printLine(` ${import_picocolors15.default.bold(import_picocolors15.default.cyan("\u25B8 Direct"))}`);
|
|
9249
9091
|
}
|
|
9250
9092
|
printSeparator();
|
|
9251
9093
|
for (const pos of portfolio.positions) {
|
|
@@ -9253,21 +9095,21 @@ function registerPortfolio(program3) {
|
|
|
9253
9095
|
}
|
|
9254
9096
|
if (hasStrategyPositions) {
|
|
9255
9097
|
const directValue = portfolio.positions.reduce((s, p) => s + p.currentValue, 0);
|
|
9256
|
-
printLine(` ${
|
|
9098
|
+
printLine(` ${import_picocolors15.default.dim(`Subtotal: ${formatUsd(directValue)}`)}`);
|
|
9257
9099
|
}
|
|
9258
9100
|
}
|
|
9259
9101
|
printSeparator();
|
|
9260
9102
|
const hasPriceUnavailable = portfolio.positions.some((p) => p.currentPrice === 0 && p.totalAmount > 0);
|
|
9261
9103
|
if (hasPriceUnavailable) {
|
|
9262
|
-
printInfo(
|
|
9104
|
+
printInfo(import_picocolors15.default.yellow("\u26A0 Price data unavailable for some assets. Values may be inaccurate."));
|
|
9263
9105
|
}
|
|
9264
9106
|
printKeyValue("Total invested", formatUsd(portfolio.totalInvested));
|
|
9265
9107
|
printKeyValue("Current value", formatUsd(portfolio.totalValue));
|
|
9266
|
-
const upnlColor = portfolio.unrealizedPnL >= 0 ?
|
|
9108
|
+
const upnlColor = portfolio.unrealizedPnL >= 0 ? import_picocolors15.default.green : import_picocolors15.default.red;
|
|
9267
9109
|
const upnlSign = portfolio.unrealizedPnL >= 0 ? "+" : "";
|
|
9268
9110
|
printKeyValue("Unrealized P&L", upnlColor(`${upnlSign}${formatUsd(portfolio.unrealizedPnL)} (${upnlSign}${portfolio.unrealizedPnLPct.toFixed(1)}%)`));
|
|
9269
9111
|
if (portfolio.realizedPnL !== 0) {
|
|
9270
|
-
const rpnlColor = portfolio.realizedPnL >= 0 ?
|
|
9112
|
+
const rpnlColor = portfolio.realizedPnL >= 0 ? import_picocolors15.default.green : import_picocolors15.default.red;
|
|
9271
9113
|
const rpnlSign = portfolio.realizedPnL >= 0 ? "+" : "";
|
|
9272
9114
|
printKeyValue("Realized P&L", rpnlColor(`${rpnlSign}${formatUsd(portfolio.realizedPnL)}`));
|
|
9273
9115
|
}
|
|
@@ -9279,7 +9121,7 @@ function registerPortfolio(program3) {
|
|
|
9279
9121
|
}
|
|
9280
9122
|
|
|
9281
9123
|
// src/commands/claimRewards.ts
|
|
9282
|
-
var
|
|
9124
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
9283
9125
|
function registerClaimRewards(program3) {
|
|
9284
9126
|
program3.command("claim-rewards").description("Claim pending protocol rewards").option("--key <path>", "Key file path").action(async (opts) => {
|
|
9285
9127
|
try {
|
|
@@ -9292,20 +9134,20 @@ function registerClaimRewards(program3) {
|
|
|
9292
9134
|
}
|
|
9293
9135
|
printBlank();
|
|
9294
9136
|
if (result.rewards.length === 0) {
|
|
9295
|
-
printLine(` ${
|
|
9137
|
+
printLine(` ${import_picocolors16.default.dim("No rewards to claim")}`);
|
|
9296
9138
|
printBlank();
|
|
9297
9139
|
return;
|
|
9298
9140
|
}
|
|
9299
9141
|
const protocols = [...new Set(result.rewards.map((r) => r.protocol))];
|
|
9300
|
-
printLine(` ${
|
|
9142
|
+
printLine(` ${import_picocolors16.default.green("\u2713")} Claimed and converted rewards to USDC`);
|
|
9301
9143
|
printSeparator();
|
|
9302
9144
|
const received = result.usdcReceived;
|
|
9303
9145
|
if (received >= 0.01) {
|
|
9304
|
-
printKeyValue("Received", `${
|
|
9146
|
+
printKeyValue("Received", `${import_picocolors16.default.green(formatUsd(received))} USDC`);
|
|
9305
9147
|
} else if (received > 0) {
|
|
9306
|
-
printKeyValue("Received", `${
|
|
9148
|
+
printKeyValue("Received", `${import_picocolors16.default.green("< $0.01")} USDC`);
|
|
9307
9149
|
} else {
|
|
9308
|
-
printKeyValue("Received", `${
|
|
9150
|
+
printKeyValue("Received", `${import_picocolors16.default.dim("< $0.01 USDC (rewards are still accruing)")}`);
|
|
9309
9151
|
}
|
|
9310
9152
|
printKeyValue("Source", protocols.join(", "));
|
|
9311
9153
|
if (result.tx) {
|
|
@@ -9319,7 +9161,7 @@ function registerClaimRewards(program3) {
|
|
|
9319
9161
|
}
|
|
9320
9162
|
|
|
9321
9163
|
// src/commands/gas.ts
|
|
9322
|
-
var
|
|
9164
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
9323
9165
|
function registerGas(program3) {
|
|
9324
9166
|
program3.command("gas").description("Check gas station status and wallet gas balance").option("--key <path>", "Key file path").action(async (opts) => {
|
|
9325
9167
|
try {
|
|
@@ -9341,36 +9183,36 @@ function registerGas(program3) {
|
|
|
9341
9183
|
}
|
|
9342
9184
|
printHeader("Gas Status");
|
|
9343
9185
|
if (gasStatus) {
|
|
9344
|
-
const cbStatus = gasStatus.circuitBreaker ?
|
|
9186
|
+
const cbStatus = gasStatus.circuitBreaker ? import_picocolors17.default.red("TRIPPED \u2014 sponsorship paused") : import_picocolors17.default.green("OK");
|
|
9345
9187
|
printKeyValue("Gas Station", cbStatus);
|
|
9346
9188
|
printKeyValue("SUI Price (TWAP)", `$${gasStatus.suiPrice.toFixed(4)}`);
|
|
9347
9189
|
if (gasStatus.bootstrapRemaining !== void 0) {
|
|
9348
9190
|
printKeyValue("Bootstrap", `${gasStatus.bootstrapUsed}/10 used (${gasStatus.bootstrapRemaining} remaining)`);
|
|
9349
9191
|
}
|
|
9350
9192
|
} else {
|
|
9351
|
-
printKeyValue("Gas Station",
|
|
9193
|
+
printKeyValue("Gas Station", import_picocolors17.default.red("unreachable"));
|
|
9352
9194
|
const reason = status.status === "rejected" ? status.reason : "unknown";
|
|
9353
|
-
printLine(` ${
|
|
9195
|
+
printLine(` ${import_picocolors17.default.dim(reason instanceof Error ? reason.message : String(reason))}`);
|
|
9354
9196
|
}
|
|
9355
9197
|
printDivider();
|
|
9356
9198
|
if (balData) {
|
|
9357
9199
|
const suiBal = balData.gasReserve.sui;
|
|
9358
|
-
const suiColor = suiBal < 0.05 ?
|
|
9200
|
+
const suiColor = suiBal < 0.05 ? import_picocolors17.default.red : import_picocolors17.default.green;
|
|
9359
9201
|
printKeyValue("SUI (gas)", suiColor(`${suiBal.toFixed(4)} SUI`));
|
|
9360
9202
|
if (suiBal < 0.05) {
|
|
9361
|
-
printLine(` ${
|
|
9203
|
+
printLine(` ${import_picocolors17.default.yellow("\u26A0")} Below gas threshold (0.05 SUI) \u2014 transactions will need sponsorship`);
|
|
9362
9204
|
}
|
|
9363
9205
|
printKeyValue("Available", `$${balData.available.toFixed(2)}`);
|
|
9364
9206
|
} else {
|
|
9365
|
-
printKeyValue("Wallet",
|
|
9207
|
+
printKeyValue("Wallet", import_picocolors17.default.dim("could not fetch balances"));
|
|
9366
9208
|
}
|
|
9367
9209
|
printBlank();
|
|
9368
9210
|
if (gasStatus && !gasStatus.circuitBreaker && (balData?.gasReserve.sui ?? 0) >= 0.05) {
|
|
9369
|
-
printLine(` ${
|
|
9211
|
+
printLine(` ${import_picocolors17.default.green("\u2713")} Gas is healthy \u2014 transactions should succeed`);
|
|
9370
9212
|
} else if (gasStatus && !gasStatus.circuitBreaker) {
|
|
9371
|
-
printLine(` ${
|
|
9213
|
+
printLine(` ${import_picocolors17.default.yellow("\u26A0")} Low SUI but gas station is online \u2014 sponsorship available`);
|
|
9372
9214
|
} else {
|
|
9373
|
-
printLine(` ${
|
|
9215
|
+
printLine(` ${import_picocolors17.default.red("\u2717")} Gas station issues detected \u2014 fund wallet with SUI directly`);
|
|
9374
9216
|
printInfo("Send SUI to your address: t2000 address");
|
|
9375
9217
|
}
|
|
9376
9218
|
printBlank();
|
|
@@ -9421,7 +9263,6 @@ Examples:
|
|
|
9421
9263
|
registerServe(program3);
|
|
9422
9264
|
registerPay(program3);
|
|
9423
9265
|
registerLock(program3);
|
|
9424
|
-
registerSentinel(program3);
|
|
9425
9266
|
registerEarn(program3);
|
|
9426
9267
|
registerRebalance(program3);
|
|
9427
9268
|
registerSwap(program3);
|