@t2000/cli 5.23.0 → 5.24.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 +2 -0
- package/dist/{chunk-X6ON6NN5.js → chunk-5MAY6SK7.js} +2 -2
- package/dist/{chunk-I2DCISQP.js → chunk-D3DUYZYR.js} +1 -20
- package/dist/{chunk-I2DCISQP.js.map → chunk-D3DUYZYR.js.map} +1 -1
- package/dist/{chunk-TP3M7BAU.js → chunk-JEIOQF6Q.js} +3 -3
- package/dist/{chunk-5AD7I65O.js → chunk-R6QER65C.js} +3 -3
- package/dist/{chunk-3TZXRO3E.js → chunk-UJGE644R.js} +5 -5
- package/dist/{dist-AFL7T3GQ.js → dist-4S52EVO3.js} +6 -6
- package/dist/{dist-TCGFVCLO.js → dist-57KQG4RN.js} +724 -145
- package/dist/{dist-TCGFVCLO.js.map → dist-57KQG4RN.js.map} +1 -1
- package/dist/{esm-ORCGSDY7.js → esm-ZKAIHFAJ.js} +2 -2
- package/dist/{grpc-CM6M7ZV3.js → grpc-G3RQE2L5.js} +4 -4
- package/dist/index.js +1038 -160
- package/dist/index.js.map +1 -1
- package/dist/{x402-YYM5ZJIK.js → x402-ALCPXKII.js} +4 -4
- package/package.json +3 -3
- /package/dist/{chunk-X6ON6NN5.js.map → chunk-5MAY6SK7.js.map} +0 -0
- /package/dist/{chunk-TP3M7BAU.js.map → chunk-JEIOQF6Q.js.map} +0 -0
- /package/dist/{chunk-5AD7I65O.js.map → chunk-R6QER65C.js.map} +0 -0
- /package/dist/{chunk-3TZXRO3E.js.map → chunk-UJGE644R.js.map} +0 -0
- /package/dist/{dist-AFL7T3GQ.js.map → dist-4S52EVO3.js.map} +0 -0
- /package/dist/{esm-ORCGSDY7.js.map → esm-ZKAIHFAJ.js.map} +0 -0
- /package/dist/{grpc-CM6M7ZV3.js.map → grpc-G3RQE2L5.js.map} +0 -0
- /package/dist/{x402-YYM5ZJIK.js.map → x402-ALCPXKII.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'module'; import { fileURLToPat
|
|
|
3
3
|
import {
|
|
4
4
|
AggregatorClient,
|
|
5
5
|
Env
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UJGE644R.js";
|
|
7
7
|
import {
|
|
8
8
|
BalanceChange,
|
|
9
9
|
BaseClient,
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
parseTransactionEffectsBcs,
|
|
17
17
|
transactionDataToGrpcTransaction,
|
|
18
18
|
transactionToGrpcJson
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-R6QER65C.js";
|
|
20
20
|
import {
|
|
21
21
|
Transaction,
|
|
22
22
|
coinWithBalance
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-JEIOQF6Q.js";
|
|
24
24
|
import {
|
|
25
25
|
ObjectError,
|
|
26
26
|
SUI_TYPE_ARG,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
fromBase64 as fromBase642,
|
|
32
32
|
suiBcs,
|
|
33
33
|
toBase64 as toBase642
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-5MAY6SK7.js";
|
|
35
35
|
import {
|
|
36
36
|
SIGNATURE_FLAG_TO_SCHEME,
|
|
37
37
|
SIGNATURE_SCHEME_TO_FLAG,
|
|
@@ -56,11 +56,9 @@ import {
|
|
|
56
56
|
bech32,
|
|
57
57
|
blake2b,
|
|
58
58
|
bytesToHex,
|
|
59
|
-
checkOpts,
|
|
60
59
|
clean,
|
|
61
60
|
concatBytes,
|
|
62
61
|
createHasher,
|
|
63
|
-
createView,
|
|
64
62
|
fromBase64,
|
|
65
63
|
fromHex,
|
|
66
64
|
hexToBytes,
|
|
@@ -68,7 +66,6 @@ import {
|
|
|
68
66
|
isValidNamedType,
|
|
69
67
|
isValidSuiAddress,
|
|
70
68
|
isValidSuiObjectId,
|
|
71
|
-
kdfInputToBytes,
|
|
72
69
|
normalizeStructTag,
|
|
73
70
|
normalizeSuiAddress,
|
|
74
71
|
oidNist,
|
|
@@ -82,7 +79,7 @@ import {
|
|
|
82
79
|
split,
|
|
83
80
|
toBase64,
|
|
84
81
|
toHex
|
|
85
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-D3DUYZYR.js";
|
|
86
83
|
import {
|
|
87
84
|
require_bn,
|
|
88
85
|
require_safer
|
|
@@ -17201,7 +17198,7 @@ var require_bitmapper = __commonJS({
|
|
|
17201
17198
|
function bitRetriever(data, depth) {
|
|
17202
17199
|
let leftOver = [];
|
|
17203
17200
|
let i = 0;
|
|
17204
|
-
function
|
|
17201
|
+
function split3() {
|
|
17205
17202
|
if (i === data.length) {
|
|
17206
17203
|
throw new Error("Ran out of data");
|
|
17207
17204
|
}
|
|
@@ -17244,7 +17241,7 @@ var require_bitmapper = __commonJS({
|
|
|
17244
17241
|
return {
|
|
17245
17242
|
get: function(count) {
|
|
17246
17243
|
while (leftOver.length < count) {
|
|
17247
|
-
|
|
17244
|
+
split3();
|
|
17248
17245
|
}
|
|
17249
17246
|
let returner = leftOver.slice(0, count);
|
|
17250
17247
|
leftOver = leftOver.slice(count);
|
|
@@ -23250,8 +23247,618 @@ var Ed25519PublicKey = class extends PublicKey {
|
|
|
23250
23247
|
}
|
|
23251
23248
|
};
|
|
23252
23249
|
|
|
23253
|
-
// ../../node_modules/.pnpm/@noble+hashes@2.0
|
|
23250
|
+
// ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/utils.js
|
|
23251
|
+
function isBytes2(a) {
|
|
23252
|
+
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
|
|
23253
|
+
}
|
|
23254
|
+
function anumber2(n, title = "") {
|
|
23255
|
+
if (typeof n !== "number") {
|
|
23256
|
+
const prefix = title && `"${title}" `;
|
|
23257
|
+
throw new TypeError(`${prefix}expected number, got ${typeof n}`);
|
|
23258
|
+
}
|
|
23259
|
+
if (!Number.isSafeInteger(n) || n < 0) {
|
|
23260
|
+
const prefix = title && `"${title}" `;
|
|
23261
|
+
throw new RangeError(`${prefix}expected integer >= 0, got ${n}`);
|
|
23262
|
+
}
|
|
23263
|
+
}
|
|
23264
|
+
function abytes2(value, length, title = "") {
|
|
23265
|
+
const bytes = isBytes2(value);
|
|
23266
|
+
const len = value?.length;
|
|
23267
|
+
const needsLen = length !== void 0;
|
|
23268
|
+
if (!bytes || needsLen && len !== length) {
|
|
23269
|
+
const prefix = title && `"${title}" `;
|
|
23270
|
+
const ofLen = needsLen ? ` of length ${length}` : "";
|
|
23271
|
+
const got = bytes ? `length=${len}` : `type=${typeof value}`;
|
|
23272
|
+
const message = prefix + "expected Uint8Array" + ofLen + ", got " + got;
|
|
23273
|
+
if (!bytes)
|
|
23274
|
+
throw new TypeError(message);
|
|
23275
|
+
throw new RangeError(message);
|
|
23276
|
+
}
|
|
23277
|
+
return value;
|
|
23278
|
+
}
|
|
23279
|
+
function ahash2(h) {
|
|
23280
|
+
if (typeof h !== "function" || typeof h.create !== "function")
|
|
23281
|
+
throw new TypeError("Hash must wrapped by utils.createHasher");
|
|
23282
|
+
anumber2(h.outputLen);
|
|
23283
|
+
anumber2(h.blockLen);
|
|
23284
|
+
if (h.outputLen < 1)
|
|
23285
|
+
throw new Error('"outputLen" must be >= 1');
|
|
23286
|
+
if (h.blockLen < 1)
|
|
23287
|
+
throw new Error('"blockLen" must be >= 1');
|
|
23288
|
+
}
|
|
23289
|
+
function aexists2(instance, checkFinished = true) {
|
|
23290
|
+
if (instance.destroyed)
|
|
23291
|
+
throw new Error("Hash instance has been destroyed");
|
|
23292
|
+
if (checkFinished && instance.finished)
|
|
23293
|
+
throw new Error("Hash#digest() has already been called");
|
|
23294
|
+
}
|
|
23295
|
+
function aoutput(out, instance) {
|
|
23296
|
+
abytes2(out, void 0, "digestInto() output");
|
|
23297
|
+
const min = instance.outputLen;
|
|
23298
|
+
if (out.length < min) {
|
|
23299
|
+
throw new RangeError('"digestInto() output" expected to be of length >=' + min);
|
|
23300
|
+
}
|
|
23301
|
+
}
|
|
23302
|
+
function clean2(...arrays) {
|
|
23303
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
23304
|
+
arrays[i].fill(0);
|
|
23305
|
+
}
|
|
23306
|
+
}
|
|
23307
|
+
function createView(arr) {
|
|
23308
|
+
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
23309
|
+
}
|
|
23310
|
+
function utf8ToBytes(str) {
|
|
23311
|
+
if (typeof str !== "string")
|
|
23312
|
+
throw new TypeError("string expected");
|
|
23313
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
23314
|
+
}
|
|
23315
|
+
function kdfInputToBytes(data, errorTitle = "") {
|
|
23316
|
+
if (typeof data === "string")
|
|
23317
|
+
return utf8ToBytes(data);
|
|
23318
|
+
return abytes2(data, void 0, errorTitle);
|
|
23319
|
+
}
|
|
23320
|
+
function checkOpts(defaults, opts) {
|
|
23321
|
+
if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]")
|
|
23322
|
+
throw new TypeError("options must be object or undefined");
|
|
23323
|
+
const merged = Object.assign(defaults, opts);
|
|
23324
|
+
return merged;
|
|
23325
|
+
}
|
|
23326
|
+
function createHasher2(hashCons, info = {}) {
|
|
23327
|
+
const hashC = (msg, opts) => hashCons(opts).update(msg).digest();
|
|
23328
|
+
const tmp = hashCons(void 0);
|
|
23329
|
+
hashC.outputLen = tmp.outputLen;
|
|
23330
|
+
hashC.blockLen = tmp.blockLen;
|
|
23331
|
+
hashC.canXOF = tmp.canXOF;
|
|
23332
|
+
hashC.create = (opts) => hashCons(opts);
|
|
23333
|
+
Object.assign(hashC, info);
|
|
23334
|
+
return Object.freeze(hashC);
|
|
23335
|
+
}
|
|
23336
|
+
var oidNist2 = (suffix) => ({
|
|
23337
|
+
// Current NIST hashAlgs suffixes used here fit in one DER subidentifier octet.
|
|
23338
|
+
// Larger suffix values would need base-128 OID encoding and a different length byte.
|
|
23339
|
+
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
|
|
23340
|
+
});
|
|
23341
|
+
|
|
23342
|
+
// ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/hmac.js
|
|
23254
23343
|
var _HMAC = class {
|
|
23344
|
+
oHash;
|
|
23345
|
+
iHash;
|
|
23346
|
+
blockLen;
|
|
23347
|
+
outputLen;
|
|
23348
|
+
canXOF = false;
|
|
23349
|
+
finished = false;
|
|
23350
|
+
destroyed = false;
|
|
23351
|
+
constructor(hash, key) {
|
|
23352
|
+
ahash2(hash);
|
|
23353
|
+
abytes2(key, void 0, "key");
|
|
23354
|
+
this.iHash = hash.create();
|
|
23355
|
+
if (typeof this.iHash.update !== "function")
|
|
23356
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
23357
|
+
this.blockLen = this.iHash.blockLen;
|
|
23358
|
+
this.outputLen = this.iHash.outputLen;
|
|
23359
|
+
const blockLen = this.blockLen;
|
|
23360
|
+
const pad = new Uint8Array(blockLen);
|
|
23361
|
+
pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
|
|
23362
|
+
for (let i = 0; i < pad.length; i++)
|
|
23363
|
+
pad[i] ^= 54;
|
|
23364
|
+
this.iHash.update(pad);
|
|
23365
|
+
this.oHash = hash.create();
|
|
23366
|
+
for (let i = 0; i < pad.length; i++)
|
|
23367
|
+
pad[i] ^= 54 ^ 92;
|
|
23368
|
+
this.oHash.update(pad);
|
|
23369
|
+
clean2(pad);
|
|
23370
|
+
}
|
|
23371
|
+
update(buf) {
|
|
23372
|
+
aexists2(this);
|
|
23373
|
+
this.iHash.update(buf);
|
|
23374
|
+
return this;
|
|
23375
|
+
}
|
|
23376
|
+
digestInto(out) {
|
|
23377
|
+
aexists2(this);
|
|
23378
|
+
aoutput(out, this);
|
|
23379
|
+
this.finished = true;
|
|
23380
|
+
const buf = out.subarray(0, this.outputLen);
|
|
23381
|
+
this.iHash.digestInto(buf);
|
|
23382
|
+
this.oHash.update(buf);
|
|
23383
|
+
this.oHash.digestInto(buf);
|
|
23384
|
+
this.destroy();
|
|
23385
|
+
}
|
|
23386
|
+
digest() {
|
|
23387
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
|
23388
|
+
this.digestInto(out);
|
|
23389
|
+
return out;
|
|
23390
|
+
}
|
|
23391
|
+
_cloneInto(to) {
|
|
23392
|
+
to ||= Object.create(Object.getPrototypeOf(this), {});
|
|
23393
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
23394
|
+
to = to;
|
|
23395
|
+
to.finished = finished;
|
|
23396
|
+
to.destroyed = destroyed;
|
|
23397
|
+
to.blockLen = blockLen;
|
|
23398
|
+
to.outputLen = outputLen;
|
|
23399
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
|
23400
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
|
23401
|
+
return to;
|
|
23402
|
+
}
|
|
23403
|
+
clone() {
|
|
23404
|
+
return this._cloneInto();
|
|
23405
|
+
}
|
|
23406
|
+
destroy() {
|
|
23407
|
+
this.destroyed = true;
|
|
23408
|
+
this.oHash.destroy();
|
|
23409
|
+
this.iHash.destroy();
|
|
23410
|
+
}
|
|
23411
|
+
};
|
|
23412
|
+
var hmac = /* @__PURE__ */ (() => {
|
|
23413
|
+
const hmac_ = ((hash, key, message) => new _HMAC(hash, key).update(message).digest());
|
|
23414
|
+
hmac_.create = (hash, key) => new _HMAC(hash, key);
|
|
23415
|
+
return hmac_;
|
|
23416
|
+
})();
|
|
23417
|
+
|
|
23418
|
+
// ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/pbkdf2.js
|
|
23419
|
+
function pbkdf2Init(hash, _password, _salt, _opts) {
|
|
23420
|
+
ahash2(hash);
|
|
23421
|
+
const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
|
|
23422
|
+
const { c, dkLen, asyncTick } = opts;
|
|
23423
|
+
anumber2(c, "c");
|
|
23424
|
+
anumber2(dkLen, "dkLen");
|
|
23425
|
+
anumber2(asyncTick, "asyncTick");
|
|
23426
|
+
if (c < 1)
|
|
23427
|
+
throw new Error("iterations (c) must be >= 1");
|
|
23428
|
+
if (dkLen < 1)
|
|
23429
|
+
throw new Error('"dkLen" must be >= 1');
|
|
23430
|
+
if (dkLen > (2 ** 32 - 1) * hash.outputLen)
|
|
23431
|
+
throw new Error("derived key too long");
|
|
23432
|
+
const password = kdfInputToBytes(_password, "password");
|
|
23433
|
+
const salt = kdfInputToBytes(_salt, "salt");
|
|
23434
|
+
const DK = new Uint8Array(dkLen);
|
|
23435
|
+
const PRF = hmac.create(hash, password);
|
|
23436
|
+
const PRFSalt = PRF._cloneInto().update(salt);
|
|
23437
|
+
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
|
23438
|
+
}
|
|
23439
|
+
function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
|
|
23440
|
+
PRF.destroy();
|
|
23441
|
+
PRFSalt.destroy();
|
|
23442
|
+
if (prfW)
|
|
23443
|
+
prfW.destroy();
|
|
23444
|
+
clean2(u);
|
|
23445
|
+
return DK;
|
|
23446
|
+
}
|
|
23447
|
+
function pbkdf2(hash, password, salt, opts) {
|
|
23448
|
+
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
|
|
23449
|
+
let prfW;
|
|
23450
|
+
const arr = new Uint8Array(4);
|
|
23451
|
+
const view = createView(arr);
|
|
23452
|
+
const u = new Uint8Array(PRF.outputLen);
|
|
23453
|
+
for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
|
|
23454
|
+
const Ti = DK.subarray(pos, pos + PRF.outputLen);
|
|
23455
|
+
view.setInt32(0, ti, false);
|
|
23456
|
+
(prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
|
|
23457
|
+
Ti.set(u.subarray(0, Ti.length));
|
|
23458
|
+
for (let ui = 1; ui < c; ui++) {
|
|
23459
|
+
PRF._cloneInto(prfW).update(u).digestInto(u);
|
|
23460
|
+
for (let i = 0; i < Ti.length; i++)
|
|
23461
|
+
Ti[i] ^= u[i];
|
|
23462
|
+
}
|
|
23463
|
+
}
|
|
23464
|
+
return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
|
|
23465
|
+
}
|
|
23466
|
+
|
|
23467
|
+
// ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/_md.js
|
|
23468
|
+
var HashMD2 = class {
|
|
23469
|
+
blockLen;
|
|
23470
|
+
outputLen;
|
|
23471
|
+
canXOF = false;
|
|
23472
|
+
padOffset;
|
|
23473
|
+
isLE;
|
|
23474
|
+
// For partial updates less than block size
|
|
23475
|
+
buffer;
|
|
23476
|
+
view;
|
|
23477
|
+
finished = false;
|
|
23478
|
+
length = 0;
|
|
23479
|
+
pos = 0;
|
|
23480
|
+
destroyed = false;
|
|
23481
|
+
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
23482
|
+
this.blockLen = blockLen;
|
|
23483
|
+
this.outputLen = outputLen;
|
|
23484
|
+
this.padOffset = padOffset;
|
|
23485
|
+
this.isLE = isLE;
|
|
23486
|
+
this.buffer = new Uint8Array(blockLen);
|
|
23487
|
+
this.view = createView(this.buffer);
|
|
23488
|
+
}
|
|
23489
|
+
update(data) {
|
|
23490
|
+
aexists2(this);
|
|
23491
|
+
abytes2(data);
|
|
23492
|
+
const { view, buffer, blockLen } = this;
|
|
23493
|
+
const len = data.length;
|
|
23494
|
+
for (let pos = 0; pos < len; ) {
|
|
23495
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
23496
|
+
if (take === blockLen) {
|
|
23497
|
+
const dataView = createView(data);
|
|
23498
|
+
for (; blockLen <= len - pos; pos += blockLen)
|
|
23499
|
+
this.process(dataView, pos);
|
|
23500
|
+
continue;
|
|
23501
|
+
}
|
|
23502
|
+
buffer.set(data.subarray(pos, pos + take), this.pos);
|
|
23503
|
+
this.pos += take;
|
|
23504
|
+
pos += take;
|
|
23505
|
+
if (this.pos === blockLen) {
|
|
23506
|
+
this.process(view, 0);
|
|
23507
|
+
this.pos = 0;
|
|
23508
|
+
}
|
|
23509
|
+
}
|
|
23510
|
+
this.length += data.length;
|
|
23511
|
+
this.roundClean();
|
|
23512
|
+
return this;
|
|
23513
|
+
}
|
|
23514
|
+
digestInto(out) {
|
|
23515
|
+
aexists2(this);
|
|
23516
|
+
aoutput(out, this);
|
|
23517
|
+
this.finished = true;
|
|
23518
|
+
const { buffer, view, blockLen, isLE } = this;
|
|
23519
|
+
let { pos } = this;
|
|
23520
|
+
buffer[pos++] = 128;
|
|
23521
|
+
clean2(this.buffer.subarray(pos));
|
|
23522
|
+
if (this.padOffset > blockLen - pos) {
|
|
23523
|
+
this.process(view, 0);
|
|
23524
|
+
pos = 0;
|
|
23525
|
+
}
|
|
23526
|
+
for (let i = pos; i < blockLen; i++)
|
|
23527
|
+
buffer[i] = 0;
|
|
23528
|
+
view.setBigUint64(blockLen - 8, BigInt(this.length * 8), isLE);
|
|
23529
|
+
this.process(view, 0);
|
|
23530
|
+
const oview = createView(out);
|
|
23531
|
+
const len = this.outputLen;
|
|
23532
|
+
if (len % 4)
|
|
23533
|
+
throw new Error("_sha2: outputLen must be aligned to 32bit");
|
|
23534
|
+
const outLen = len / 4;
|
|
23535
|
+
const state = this.get();
|
|
23536
|
+
if (outLen > state.length)
|
|
23537
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
23538
|
+
for (let i = 0; i < outLen; i++)
|
|
23539
|
+
oview.setUint32(4 * i, state[i], isLE);
|
|
23540
|
+
}
|
|
23541
|
+
digest() {
|
|
23542
|
+
const { buffer, outputLen } = this;
|
|
23543
|
+
this.digestInto(buffer);
|
|
23544
|
+
const res = buffer.slice(0, outputLen);
|
|
23545
|
+
this.destroy();
|
|
23546
|
+
return res;
|
|
23547
|
+
}
|
|
23548
|
+
_cloneInto(to) {
|
|
23549
|
+
to ||= new this.constructor();
|
|
23550
|
+
to.set(...this.get());
|
|
23551
|
+
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
|
23552
|
+
to.destroyed = destroyed;
|
|
23553
|
+
to.finished = finished;
|
|
23554
|
+
to.length = length;
|
|
23555
|
+
to.pos = pos;
|
|
23556
|
+
if (length % blockLen)
|
|
23557
|
+
to.buffer.set(buffer);
|
|
23558
|
+
return to;
|
|
23559
|
+
}
|
|
23560
|
+
clone() {
|
|
23561
|
+
return this._cloneInto();
|
|
23562
|
+
}
|
|
23563
|
+
};
|
|
23564
|
+
var SHA512_IV2 = /* @__PURE__ */ Uint32Array.from([
|
|
23565
|
+
1779033703,
|
|
23566
|
+
4089235720,
|
|
23567
|
+
3144134277,
|
|
23568
|
+
2227873595,
|
|
23569
|
+
1013904242,
|
|
23570
|
+
4271175723,
|
|
23571
|
+
2773480762,
|
|
23572
|
+
1595750129,
|
|
23573
|
+
1359893119,
|
|
23574
|
+
2917565137,
|
|
23575
|
+
2600822924,
|
|
23576
|
+
725511199,
|
|
23577
|
+
528734635,
|
|
23578
|
+
4215389547,
|
|
23579
|
+
1541459225,
|
|
23580
|
+
327033209
|
|
23581
|
+
]);
|
|
23582
|
+
|
|
23583
|
+
// ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/_u64.js
|
|
23584
|
+
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
23585
|
+
var _32n = /* @__PURE__ */ BigInt(32);
|
|
23586
|
+
function fromBig(n, le = false) {
|
|
23587
|
+
if (le)
|
|
23588
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
23589
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
23590
|
+
}
|
|
23591
|
+
function split2(lst, le = false) {
|
|
23592
|
+
const len = lst.length;
|
|
23593
|
+
let Ah = new Uint32Array(len);
|
|
23594
|
+
let Al = new Uint32Array(len);
|
|
23595
|
+
for (let i = 0; i < len; i++) {
|
|
23596
|
+
const { h, l } = fromBig(lst[i], le);
|
|
23597
|
+
[Ah[i], Al[i]] = [h, l];
|
|
23598
|
+
}
|
|
23599
|
+
return [Ah, Al];
|
|
23600
|
+
}
|
|
23601
|
+
var shrSH2 = (h, _l, s) => h >>> s;
|
|
23602
|
+
var shrSL2 = (h, l, s) => h << 32 - s | l >>> s;
|
|
23603
|
+
var rotrSH2 = (h, l, s) => h >>> s | l << 32 - s;
|
|
23604
|
+
var rotrSL2 = (h, l, s) => h << 32 - s | l >>> s;
|
|
23605
|
+
var rotrBH2 = (h, l, s) => h << 64 - s | l >>> s - 32;
|
|
23606
|
+
var rotrBL2 = (h, l, s) => h >>> s - 32 | l << 64 - s;
|
|
23607
|
+
function add2(Ah, Al, Bh, Bl) {
|
|
23608
|
+
const l = (Al >>> 0) + (Bl >>> 0);
|
|
23609
|
+
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
23610
|
+
}
|
|
23611
|
+
var add3L2 = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
23612
|
+
var add3H2 = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
23613
|
+
var add4L2 = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
23614
|
+
var add4H2 = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
23615
|
+
var add5L2 = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
23616
|
+
var add5H2 = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
23617
|
+
|
|
23618
|
+
// ../../node_modules/.pnpm/@noble+hashes@2.2.0/node_modules/@noble/hashes/sha2.js
|
|
23619
|
+
var K5122 = /* @__PURE__ */ (() => split2([
|
|
23620
|
+
"0x428a2f98d728ae22",
|
|
23621
|
+
"0x7137449123ef65cd",
|
|
23622
|
+
"0xb5c0fbcfec4d3b2f",
|
|
23623
|
+
"0xe9b5dba58189dbbc",
|
|
23624
|
+
"0x3956c25bf348b538",
|
|
23625
|
+
"0x59f111f1b605d019",
|
|
23626
|
+
"0x923f82a4af194f9b",
|
|
23627
|
+
"0xab1c5ed5da6d8118",
|
|
23628
|
+
"0xd807aa98a3030242",
|
|
23629
|
+
"0x12835b0145706fbe",
|
|
23630
|
+
"0x243185be4ee4b28c",
|
|
23631
|
+
"0x550c7dc3d5ffb4e2",
|
|
23632
|
+
"0x72be5d74f27b896f",
|
|
23633
|
+
"0x80deb1fe3b1696b1",
|
|
23634
|
+
"0x9bdc06a725c71235",
|
|
23635
|
+
"0xc19bf174cf692694",
|
|
23636
|
+
"0xe49b69c19ef14ad2",
|
|
23637
|
+
"0xefbe4786384f25e3",
|
|
23638
|
+
"0x0fc19dc68b8cd5b5",
|
|
23639
|
+
"0x240ca1cc77ac9c65",
|
|
23640
|
+
"0x2de92c6f592b0275",
|
|
23641
|
+
"0x4a7484aa6ea6e483",
|
|
23642
|
+
"0x5cb0a9dcbd41fbd4",
|
|
23643
|
+
"0x76f988da831153b5",
|
|
23644
|
+
"0x983e5152ee66dfab",
|
|
23645
|
+
"0xa831c66d2db43210",
|
|
23646
|
+
"0xb00327c898fb213f",
|
|
23647
|
+
"0xbf597fc7beef0ee4",
|
|
23648
|
+
"0xc6e00bf33da88fc2",
|
|
23649
|
+
"0xd5a79147930aa725",
|
|
23650
|
+
"0x06ca6351e003826f",
|
|
23651
|
+
"0x142929670a0e6e70",
|
|
23652
|
+
"0x27b70a8546d22ffc",
|
|
23653
|
+
"0x2e1b21385c26c926",
|
|
23654
|
+
"0x4d2c6dfc5ac42aed",
|
|
23655
|
+
"0x53380d139d95b3df",
|
|
23656
|
+
"0x650a73548baf63de",
|
|
23657
|
+
"0x766a0abb3c77b2a8",
|
|
23658
|
+
"0x81c2c92e47edaee6",
|
|
23659
|
+
"0x92722c851482353b",
|
|
23660
|
+
"0xa2bfe8a14cf10364",
|
|
23661
|
+
"0xa81a664bbc423001",
|
|
23662
|
+
"0xc24b8b70d0f89791",
|
|
23663
|
+
"0xc76c51a30654be30",
|
|
23664
|
+
"0xd192e819d6ef5218",
|
|
23665
|
+
"0xd69906245565a910",
|
|
23666
|
+
"0xf40e35855771202a",
|
|
23667
|
+
"0x106aa07032bbd1b8",
|
|
23668
|
+
"0x19a4c116b8d2d0c8",
|
|
23669
|
+
"0x1e376c085141ab53",
|
|
23670
|
+
"0x2748774cdf8eeb99",
|
|
23671
|
+
"0x34b0bcb5e19b48a8",
|
|
23672
|
+
"0x391c0cb3c5c95a63",
|
|
23673
|
+
"0x4ed8aa4ae3418acb",
|
|
23674
|
+
"0x5b9cca4f7763e373",
|
|
23675
|
+
"0x682e6ff3d6b2b8a3",
|
|
23676
|
+
"0x748f82ee5defb2fc",
|
|
23677
|
+
"0x78a5636f43172f60",
|
|
23678
|
+
"0x84c87814a1f0ab72",
|
|
23679
|
+
"0x8cc702081a6439ec",
|
|
23680
|
+
"0x90befffa23631e28",
|
|
23681
|
+
"0xa4506cebde82bde9",
|
|
23682
|
+
"0xbef9a3f7b2c67915",
|
|
23683
|
+
"0xc67178f2e372532b",
|
|
23684
|
+
"0xca273eceea26619c",
|
|
23685
|
+
"0xd186b8c721c0c207",
|
|
23686
|
+
"0xeada7dd6cde0eb1e",
|
|
23687
|
+
"0xf57d4f7fee6ed178",
|
|
23688
|
+
"0x06f067aa72176fba",
|
|
23689
|
+
"0x0a637dc5a2c898a6",
|
|
23690
|
+
"0x113f9804bef90dae",
|
|
23691
|
+
"0x1b710b35131c471b",
|
|
23692
|
+
"0x28db77f523047d84",
|
|
23693
|
+
"0x32caab7b40c72493",
|
|
23694
|
+
"0x3c9ebe0a15c9bebc",
|
|
23695
|
+
"0x431d67c49c100d4c",
|
|
23696
|
+
"0x4cc5d4becb3e42b6",
|
|
23697
|
+
"0x597f299cfc657e2a",
|
|
23698
|
+
"0x5fcb6fab3ad6faec",
|
|
23699
|
+
"0x6c44198c4a475817"
|
|
23700
|
+
].map((n) => BigInt(n))))();
|
|
23701
|
+
var SHA512_Kh2 = /* @__PURE__ */ (() => K5122[0])();
|
|
23702
|
+
var SHA512_Kl2 = /* @__PURE__ */ (() => K5122[1])();
|
|
23703
|
+
var SHA512_W_H2 = /* @__PURE__ */ new Uint32Array(80);
|
|
23704
|
+
var SHA512_W_L2 = /* @__PURE__ */ new Uint32Array(80);
|
|
23705
|
+
var SHA2_64B2 = class extends HashMD2 {
|
|
23706
|
+
constructor(outputLen) {
|
|
23707
|
+
super(128, outputLen, 16, false);
|
|
23708
|
+
}
|
|
23709
|
+
// prettier-ignore
|
|
23710
|
+
get() {
|
|
23711
|
+
const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
23712
|
+
return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];
|
|
23713
|
+
}
|
|
23714
|
+
// prettier-ignore
|
|
23715
|
+
set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {
|
|
23716
|
+
this.Ah = Ah | 0;
|
|
23717
|
+
this.Al = Al | 0;
|
|
23718
|
+
this.Bh = Bh | 0;
|
|
23719
|
+
this.Bl = Bl | 0;
|
|
23720
|
+
this.Ch = Ch | 0;
|
|
23721
|
+
this.Cl = Cl | 0;
|
|
23722
|
+
this.Dh = Dh | 0;
|
|
23723
|
+
this.Dl = Dl | 0;
|
|
23724
|
+
this.Eh = Eh | 0;
|
|
23725
|
+
this.El = El | 0;
|
|
23726
|
+
this.Fh = Fh | 0;
|
|
23727
|
+
this.Fl = Fl | 0;
|
|
23728
|
+
this.Gh = Gh | 0;
|
|
23729
|
+
this.Gl = Gl | 0;
|
|
23730
|
+
this.Hh = Hh | 0;
|
|
23731
|
+
this.Hl = Hl | 0;
|
|
23732
|
+
}
|
|
23733
|
+
process(view, offset) {
|
|
23734
|
+
for (let i = 0; i < 16; i++, offset += 4) {
|
|
23735
|
+
SHA512_W_H2[i] = view.getUint32(offset);
|
|
23736
|
+
SHA512_W_L2[i] = view.getUint32(offset += 4);
|
|
23737
|
+
}
|
|
23738
|
+
for (let i = 16; i < 80; i++) {
|
|
23739
|
+
const W15h = SHA512_W_H2[i - 15] | 0;
|
|
23740
|
+
const W15l = SHA512_W_L2[i - 15] | 0;
|
|
23741
|
+
const s0h = rotrSH2(W15h, W15l, 1) ^ rotrSH2(W15h, W15l, 8) ^ shrSH2(W15h, W15l, 7);
|
|
23742
|
+
const s0l = rotrSL2(W15h, W15l, 1) ^ rotrSL2(W15h, W15l, 8) ^ shrSL2(W15h, W15l, 7);
|
|
23743
|
+
const W2h = SHA512_W_H2[i - 2] | 0;
|
|
23744
|
+
const W2l = SHA512_W_L2[i - 2] | 0;
|
|
23745
|
+
const s1h = rotrSH2(W2h, W2l, 19) ^ rotrBH2(W2h, W2l, 61) ^ shrSH2(W2h, W2l, 6);
|
|
23746
|
+
const s1l = rotrSL2(W2h, W2l, 19) ^ rotrBL2(W2h, W2l, 61) ^ shrSL2(W2h, W2l, 6);
|
|
23747
|
+
const SUMl = add4L2(s0l, s1l, SHA512_W_L2[i - 7], SHA512_W_L2[i - 16]);
|
|
23748
|
+
const SUMh = add4H2(SUMl, s0h, s1h, SHA512_W_H2[i - 7], SHA512_W_H2[i - 16]);
|
|
23749
|
+
SHA512_W_H2[i] = SUMh | 0;
|
|
23750
|
+
SHA512_W_L2[i] = SUMl | 0;
|
|
23751
|
+
}
|
|
23752
|
+
let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;
|
|
23753
|
+
for (let i = 0; i < 80; i++) {
|
|
23754
|
+
const sigma1h = rotrSH2(Eh, El, 14) ^ rotrSH2(Eh, El, 18) ^ rotrBH2(Eh, El, 41);
|
|
23755
|
+
const sigma1l = rotrSL2(Eh, El, 14) ^ rotrSL2(Eh, El, 18) ^ rotrBL2(Eh, El, 41);
|
|
23756
|
+
const CHIh = Eh & Fh ^ ~Eh & Gh;
|
|
23757
|
+
const CHIl = El & Fl ^ ~El & Gl;
|
|
23758
|
+
const T1ll = add5L2(Hl, sigma1l, CHIl, SHA512_Kl2[i], SHA512_W_L2[i]);
|
|
23759
|
+
const T1h = add5H2(T1ll, Hh, sigma1h, CHIh, SHA512_Kh2[i], SHA512_W_H2[i]);
|
|
23760
|
+
const T1l = T1ll | 0;
|
|
23761
|
+
const sigma0h = rotrSH2(Ah, Al, 28) ^ rotrBH2(Ah, Al, 34) ^ rotrBH2(Ah, Al, 39);
|
|
23762
|
+
const sigma0l = rotrSL2(Ah, Al, 28) ^ rotrBL2(Ah, Al, 34) ^ rotrBL2(Ah, Al, 39);
|
|
23763
|
+
const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch;
|
|
23764
|
+
const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl;
|
|
23765
|
+
Hh = Gh | 0;
|
|
23766
|
+
Hl = Gl | 0;
|
|
23767
|
+
Gh = Fh | 0;
|
|
23768
|
+
Gl = Fl | 0;
|
|
23769
|
+
Fh = Eh | 0;
|
|
23770
|
+
Fl = El | 0;
|
|
23771
|
+
({ h: Eh, l: El } = add2(Dh | 0, Dl | 0, T1h | 0, T1l | 0));
|
|
23772
|
+
Dh = Ch | 0;
|
|
23773
|
+
Dl = Cl | 0;
|
|
23774
|
+
Ch = Bh | 0;
|
|
23775
|
+
Cl = Bl | 0;
|
|
23776
|
+
Bh = Ah | 0;
|
|
23777
|
+
Bl = Al | 0;
|
|
23778
|
+
const All = add3L2(T1l, sigma0l, MAJl);
|
|
23779
|
+
Ah = add3H2(All, T1h, sigma0h, MAJh);
|
|
23780
|
+
Al = All | 0;
|
|
23781
|
+
}
|
|
23782
|
+
({ h: Ah, l: Al } = add2(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));
|
|
23783
|
+
({ h: Bh, l: Bl } = add2(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));
|
|
23784
|
+
({ h: Ch, l: Cl } = add2(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));
|
|
23785
|
+
({ h: Dh, l: Dl } = add2(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));
|
|
23786
|
+
({ h: Eh, l: El } = add2(this.Eh | 0, this.El | 0, Eh | 0, El | 0));
|
|
23787
|
+
({ h: Fh, l: Fl } = add2(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));
|
|
23788
|
+
({ h: Gh, l: Gl } = add2(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));
|
|
23789
|
+
({ h: Hh, l: Hl } = add2(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));
|
|
23790
|
+
this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);
|
|
23791
|
+
}
|
|
23792
|
+
roundClean() {
|
|
23793
|
+
clean2(SHA512_W_H2, SHA512_W_L2);
|
|
23794
|
+
}
|
|
23795
|
+
destroy() {
|
|
23796
|
+
this.destroyed = true;
|
|
23797
|
+
clean2(this.buffer);
|
|
23798
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
23799
|
+
}
|
|
23800
|
+
};
|
|
23801
|
+
var _SHA5122 = class extends SHA2_64B2 {
|
|
23802
|
+
Ah = SHA512_IV2[0] | 0;
|
|
23803
|
+
Al = SHA512_IV2[1] | 0;
|
|
23804
|
+
Bh = SHA512_IV2[2] | 0;
|
|
23805
|
+
Bl = SHA512_IV2[3] | 0;
|
|
23806
|
+
Ch = SHA512_IV2[4] | 0;
|
|
23807
|
+
Cl = SHA512_IV2[5] | 0;
|
|
23808
|
+
Dh = SHA512_IV2[6] | 0;
|
|
23809
|
+
Dl = SHA512_IV2[7] | 0;
|
|
23810
|
+
Eh = SHA512_IV2[8] | 0;
|
|
23811
|
+
El = SHA512_IV2[9] | 0;
|
|
23812
|
+
Fh = SHA512_IV2[10] | 0;
|
|
23813
|
+
Fl = SHA512_IV2[11] | 0;
|
|
23814
|
+
Gh = SHA512_IV2[12] | 0;
|
|
23815
|
+
Gl = SHA512_IV2[13] | 0;
|
|
23816
|
+
Hh = SHA512_IV2[14] | 0;
|
|
23817
|
+
Hl = SHA512_IV2[15] | 0;
|
|
23818
|
+
constructor() {
|
|
23819
|
+
super(64);
|
|
23820
|
+
}
|
|
23821
|
+
};
|
|
23822
|
+
var sha5122 = /* @__PURE__ */ createHasher2(
|
|
23823
|
+
() => new _SHA5122(),
|
|
23824
|
+
/* @__PURE__ */ oidNist2(3)
|
|
23825
|
+
);
|
|
23826
|
+
|
|
23827
|
+
// ../../node_modules/.pnpm/@scure+bip39@2.2.0/node_modules/@scure/bip39/index.js
|
|
23828
|
+
function nfkd(str) {
|
|
23829
|
+
if (typeof str !== "string")
|
|
23830
|
+
throw new TypeError("invalid mnemonic type: " + typeof str);
|
|
23831
|
+
return str.normalize("NFKD");
|
|
23832
|
+
}
|
|
23833
|
+
function normalize(str) {
|
|
23834
|
+
const norm = nfkd(str);
|
|
23835
|
+
const words = norm.split(" ");
|
|
23836
|
+
if (![12, 15, 18, 21, 24].includes(words.length))
|
|
23837
|
+
throw new Error("Invalid mnemonic");
|
|
23838
|
+
return { nfkd: norm, words };
|
|
23839
|
+
}
|
|
23840
|
+
var psalt = (passphrase) => nfkd("mnemonic" + passphrase);
|
|
23841
|
+
function mnemonicToSeedSync(mnemonic, passphrase = "") {
|
|
23842
|
+
return pbkdf2(sha5122, normalize(mnemonic).nfkd, psalt(passphrase), {
|
|
23843
|
+
c: 2048,
|
|
23844
|
+
dkLen: 64
|
|
23845
|
+
});
|
|
23846
|
+
}
|
|
23847
|
+
|
|
23848
|
+
// ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/cryptography/mnemonics.mjs
|
|
23849
|
+
function isValidHardenedPath(path2) {
|
|
23850
|
+
if (!(/* @__PURE__ */ new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$")).test(path2)) return false;
|
|
23851
|
+
return true;
|
|
23852
|
+
}
|
|
23853
|
+
function mnemonicToSeed(mnemonics) {
|
|
23854
|
+
return mnemonicToSeedSync(mnemonics, "");
|
|
23855
|
+
}
|
|
23856
|
+
function mnemonicToSeedHex(mnemonics) {
|
|
23857
|
+
return toHex(mnemonicToSeed(mnemonics));
|
|
23858
|
+
}
|
|
23859
|
+
|
|
23860
|
+
// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/hmac.js
|
|
23861
|
+
var _HMAC2 = class {
|
|
23255
23862
|
oHash;
|
|
23256
23863
|
iHash;
|
|
23257
23864
|
blockLen;
|
|
@@ -23318,83 +23925,8 @@ var _HMAC = class {
|
|
|
23318
23925
|
this.iHash.destroy();
|
|
23319
23926
|
}
|
|
23320
23927
|
};
|
|
23321
|
-
var
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
|
-
// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/pbkdf2.js
|
|
23325
|
-
function pbkdf2Init(hash, _password, _salt, _opts) {
|
|
23326
|
-
ahash(hash);
|
|
23327
|
-
const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
|
|
23328
|
-
const { c, dkLen, asyncTick } = opts;
|
|
23329
|
-
anumber(c, "c");
|
|
23330
|
-
anumber(dkLen, "dkLen");
|
|
23331
|
-
anumber(asyncTick, "asyncTick");
|
|
23332
|
-
if (c < 1)
|
|
23333
|
-
throw new Error("iterations (c) must be >= 1");
|
|
23334
|
-
const password = kdfInputToBytes(_password, "password");
|
|
23335
|
-
const salt = kdfInputToBytes(_salt, "salt");
|
|
23336
|
-
const DK = new Uint8Array(dkLen);
|
|
23337
|
-
const PRF = hmac.create(hash, password);
|
|
23338
|
-
const PRFSalt = PRF._cloneInto().update(salt);
|
|
23339
|
-
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
|
23340
|
-
}
|
|
23341
|
-
function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) {
|
|
23342
|
-
PRF.destroy();
|
|
23343
|
-
PRFSalt.destroy();
|
|
23344
|
-
if (prfW)
|
|
23345
|
-
prfW.destroy();
|
|
23346
|
-
clean(u);
|
|
23347
|
-
return DK;
|
|
23348
|
-
}
|
|
23349
|
-
function pbkdf2(hash, password, salt, opts) {
|
|
23350
|
-
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash, password, salt, opts);
|
|
23351
|
-
let prfW;
|
|
23352
|
-
const arr = new Uint8Array(4);
|
|
23353
|
-
const view = createView(arr);
|
|
23354
|
-
const u = new Uint8Array(PRF.outputLen);
|
|
23355
|
-
for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) {
|
|
23356
|
-
const Ti = DK.subarray(pos, pos + PRF.outputLen);
|
|
23357
|
-
view.setInt32(0, ti, false);
|
|
23358
|
-
(prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u);
|
|
23359
|
-
Ti.set(u.subarray(0, Ti.length));
|
|
23360
|
-
for (let ui = 1; ui < c; ui++) {
|
|
23361
|
-
PRF._cloneInto(prfW).update(u).digestInto(u);
|
|
23362
|
-
for (let i = 0; i < Ti.length; i++)
|
|
23363
|
-
Ti[i] ^= u[i];
|
|
23364
|
-
}
|
|
23365
|
-
}
|
|
23366
|
-
return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
|
|
23367
|
-
}
|
|
23368
|
-
|
|
23369
|
-
// ../../node_modules/.pnpm/@scure+bip39@2.0.1/node_modules/@scure/bip39/index.js
|
|
23370
|
-
function nfkd(str) {
|
|
23371
|
-
if (typeof str !== "string")
|
|
23372
|
-
throw new TypeError("invalid mnemonic type: " + typeof str);
|
|
23373
|
-
return str.normalize("NFKD");
|
|
23374
|
-
}
|
|
23375
|
-
function normalize(str) {
|
|
23376
|
-
const norm = nfkd(str);
|
|
23377
|
-
const words = norm.split(" ");
|
|
23378
|
-
if (![12, 15, 18, 21, 24].includes(words.length))
|
|
23379
|
-
throw new Error("Invalid mnemonic");
|
|
23380
|
-
return { nfkd: norm, words };
|
|
23381
|
-
}
|
|
23382
|
-
var psalt = (passphrase) => nfkd("mnemonic" + passphrase);
|
|
23383
|
-
function mnemonicToSeedSync(mnemonic, passphrase = "") {
|
|
23384
|
-
return pbkdf2(sha512, normalize(mnemonic).nfkd, psalt(passphrase), { c: 2048, dkLen: 64 });
|
|
23385
|
-
}
|
|
23386
|
-
|
|
23387
|
-
// ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/cryptography/mnemonics.mjs
|
|
23388
|
-
function isValidHardenedPath(path2) {
|
|
23389
|
-
if (!(/* @__PURE__ */ new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$")).test(path2)) return false;
|
|
23390
|
-
return true;
|
|
23391
|
-
}
|
|
23392
|
-
function mnemonicToSeed(mnemonics) {
|
|
23393
|
-
return mnemonicToSeedSync(mnemonics, "");
|
|
23394
|
-
}
|
|
23395
|
-
function mnemonicToSeedHex(mnemonics) {
|
|
23396
|
-
return toHex(mnemonicToSeed(mnemonics));
|
|
23397
|
-
}
|
|
23928
|
+
var hmac2 = (hash, key, message) => new _HMAC2(hash, key).update(message).digest();
|
|
23929
|
+
hmac2.create = (hash, key) => new _HMAC2(hash, key);
|
|
23398
23930
|
|
|
23399
23931
|
// ../../node_modules/.pnpm/@mysten+sui@2.17.0_typescript@5.9.3/node_modules/@mysten/sui/dist/cryptography/signature.mjs
|
|
23400
23932
|
function toSerializedSignature({ signature, signatureScheme, publicKey }) {
|
|
@@ -23486,7 +24018,7 @@ var HARDENED_OFFSET = 2147483648;
|
|
|
23486
24018
|
var pathRegex = /* @__PURE__ */ new RegExp("^m(\\/[0-9]+')+$");
|
|
23487
24019
|
var replaceDerive = (val) => val.replace("'", "");
|
|
23488
24020
|
var getMasterKeyFromSeed = (seed) => {
|
|
23489
|
-
const I =
|
|
24021
|
+
const I = hmac2.create(sha512, new TextEncoder().encode(ED25519_CURVE)).update(fromHex(seed)).digest();
|
|
23490
24022
|
return {
|
|
23491
24023
|
key: I.slice(0, 32),
|
|
23492
24024
|
chainCode: I.slice(32)
|
|
@@ -23499,7 +24031,7 @@ var CKDPriv = ({ key, chainCode }, index) => {
|
|
|
23499
24031
|
data.set(new Uint8Array(1).fill(0));
|
|
23500
24032
|
data.set(key, 1);
|
|
23501
24033
|
data.set(new Uint8Array(indexBuffer, 0, indexBuffer.byteLength), key.length + 1);
|
|
23502
|
-
const I =
|
|
24034
|
+
const I = hmac2.create(sha512, chainCode).update(data).digest();
|
|
23503
24035
|
return {
|
|
23504
24036
|
key: I.slice(0, 32),
|
|
23505
24037
|
chainCode: I.slice(32)
|
|
@@ -23644,39 +24176,39 @@ import * as nc from "crypto";
|
|
|
23644
24176
|
var crypto2 = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
|
|
23645
24177
|
|
|
23646
24178
|
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js
|
|
23647
|
-
function
|
|
24179
|
+
function isBytes3(a) {
|
|
23648
24180
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
23649
24181
|
}
|
|
23650
|
-
function
|
|
24182
|
+
function anumber3(n) {
|
|
23651
24183
|
if (!Number.isSafeInteger(n) || n < 0)
|
|
23652
24184
|
throw new Error("positive integer expected, got " + n);
|
|
23653
24185
|
}
|
|
23654
|
-
function
|
|
23655
|
-
if (!
|
|
24186
|
+
function abytes3(b, ...lengths) {
|
|
24187
|
+
if (!isBytes3(b))
|
|
23656
24188
|
throw new Error("Uint8Array expected");
|
|
23657
24189
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
23658
24190
|
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
23659
24191
|
}
|
|
23660
|
-
function
|
|
24192
|
+
function ahash3(h) {
|
|
23661
24193
|
if (typeof h !== "function" || typeof h.create !== "function")
|
|
23662
24194
|
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
23663
|
-
|
|
23664
|
-
|
|
24195
|
+
anumber3(h.outputLen);
|
|
24196
|
+
anumber3(h.blockLen);
|
|
23665
24197
|
}
|
|
23666
|
-
function
|
|
24198
|
+
function aexists3(instance, checkFinished = true) {
|
|
23667
24199
|
if (instance.destroyed)
|
|
23668
24200
|
throw new Error("Hash instance has been destroyed");
|
|
23669
24201
|
if (checkFinished && instance.finished)
|
|
23670
24202
|
throw new Error("Hash#digest() has already been called");
|
|
23671
24203
|
}
|
|
23672
|
-
function
|
|
23673
|
-
|
|
24204
|
+
function aoutput2(out, instance) {
|
|
24205
|
+
abytes3(out);
|
|
23674
24206
|
const min = instance.outputLen;
|
|
23675
24207
|
if (out.length < min) {
|
|
23676
24208
|
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
23677
24209
|
}
|
|
23678
24210
|
}
|
|
23679
|
-
function
|
|
24211
|
+
function clean3(...arrays) {
|
|
23680
24212
|
for (let i = 0; i < arrays.length; i++) {
|
|
23681
24213
|
arrays[i].fill(0);
|
|
23682
24214
|
}
|
|
@@ -23684,7 +24216,7 @@ function clean2(...arrays) {
|
|
|
23684
24216
|
function createView2(arr) {
|
|
23685
24217
|
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
23686
24218
|
}
|
|
23687
|
-
function
|
|
24219
|
+
function rotr3(word, shift) {
|
|
23688
24220
|
return word << 32 - shift | word >>> shift;
|
|
23689
24221
|
}
|
|
23690
24222
|
var hasHexBuiltin = /* @__PURE__ */ (() => (
|
|
@@ -23693,7 +24225,7 @@ var hasHexBuiltin = /* @__PURE__ */ (() => (
|
|
|
23693
24225
|
))();
|
|
23694
24226
|
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
23695
24227
|
function bytesToHex2(bytes) {
|
|
23696
|
-
|
|
24228
|
+
abytes3(bytes);
|
|
23697
24229
|
if (hasHexBuiltin)
|
|
23698
24230
|
return bytes.toHex();
|
|
23699
24231
|
let hex = "";
|
|
@@ -23733,22 +24265,22 @@ function hexToBytes2(hex) {
|
|
|
23733
24265
|
}
|
|
23734
24266
|
return array;
|
|
23735
24267
|
}
|
|
23736
|
-
function
|
|
24268
|
+
function utf8ToBytes2(str) {
|
|
23737
24269
|
if (typeof str !== "string")
|
|
23738
24270
|
throw new Error("string expected");
|
|
23739
24271
|
return new Uint8Array(new TextEncoder().encode(str));
|
|
23740
24272
|
}
|
|
23741
24273
|
function toBytes(data) {
|
|
23742
24274
|
if (typeof data === "string")
|
|
23743
|
-
data =
|
|
23744
|
-
|
|
24275
|
+
data = utf8ToBytes2(data);
|
|
24276
|
+
abytes3(data);
|
|
23745
24277
|
return data;
|
|
23746
24278
|
}
|
|
23747
24279
|
function concatBytes2(...arrays) {
|
|
23748
24280
|
let sum = 0;
|
|
23749
24281
|
for (let i = 0; i < arrays.length; i++) {
|
|
23750
24282
|
const a = arrays[i];
|
|
23751
|
-
|
|
24283
|
+
abytes3(a);
|
|
23752
24284
|
sum += a.length;
|
|
23753
24285
|
}
|
|
23754
24286
|
const res = new Uint8Array(sum);
|
|
@@ -23761,7 +24293,7 @@ function concatBytes2(...arrays) {
|
|
|
23761
24293
|
}
|
|
23762
24294
|
var Hash = class {
|
|
23763
24295
|
};
|
|
23764
|
-
function
|
|
24296
|
+
function createHasher3(hashCons) {
|
|
23765
24297
|
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
23766
24298
|
const tmp = hashCons();
|
|
23767
24299
|
hashC.outputLen = tmp.outputLen;
|
|
@@ -23783,22 +24315,22 @@ function randomBytes2(bytesLength = 32) {
|
|
|
23783
24315
|
function setBigUint64(view, byteOffset, value, isLE) {
|
|
23784
24316
|
if (typeof view.setBigUint64 === "function")
|
|
23785
24317
|
return view.setBigUint64(byteOffset, value, isLE);
|
|
23786
|
-
const
|
|
24318
|
+
const _32n2 = BigInt(32);
|
|
23787
24319
|
const _u32_max = BigInt(4294967295);
|
|
23788
|
-
const wh = Number(value >>
|
|
24320
|
+
const wh = Number(value >> _32n2 & _u32_max);
|
|
23789
24321
|
const wl = Number(value & _u32_max);
|
|
23790
24322
|
const h = isLE ? 4 : 0;
|
|
23791
24323
|
const l = isLE ? 0 : 4;
|
|
23792
24324
|
view.setUint32(byteOffset + h, wh, isLE);
|
|
23793
24325
|
view.setUint32(byteOffset + l, wl, isLE);
|
|
23794
24326
|
}
|
|
23795
|
-
function
|
|
24327
|
+
function Chi3(a, b, c) {
|
|
23796
24328
|
return a & b ^ ~a & c;
|
|
23797
24329
|
}
|
|
23798
|
-
function
|
|
24330
|
+
function Maj3(a, b, c) {
|
|
23799
24331
|
return a & b ^ a & c ^ b & c;
|
|
23800
24332
|
}
|
|
23801
|
-
var
|
|
24333
|
+
var HashMD3 = class extends Hash {
|
|
23802
24334
|
constructor(blockLen, outputLen, padOffset, isLE) {
|
|
23803
24335
|
super();
|
|
23804
24336
|
this.finished = false;
|
|
@@ -23813,9 +24345,9 @@ var HashMD2 = class extends Hash {
|
|
|
23813
24345
|
this.view = createView2(this.buffer);
|
|
23814
24346
|
}
|
|
23815
24347
|
update(data) {
|
|
23816
|
-
|
|
24348
|
+
aexists3(this);
|
|
23817
24349
|
data = toBytes(data);
|
|
23818
|
-
|
|
24350
|
+
abytes3(data);
|
|
23819
24351
|
const { view, buffer, blockLen } = this;
|
|
23820
24352
|
const len = data.length;
|
|
23821
24353
|
for (let pos = 0; pos < len; ) {
|
|
@@ -23839,13 +24371,13 @@ var HashMD2 = class extends Hash {
|
|
|
23839
24371
|
return this;
|
|
23840
24372
|
}
|
|
23841
24373
|
digestInto(out) {
|
|
23842
|
-
|
|
23843
|
-
|
|
24374
|
+
aexists3(this);
|
|
24375
|
+
aoutput2(out, this);
|
|
23844
24376
|
this.finished = true;
|
|
23845
24377
|
const { buffer, view, blockLen, isLE } = this;
|
|
23846
24378
|
let { pos } = this;
|
|
23847
24379
|
buffer[pos++] = 128;
|
|
23848
|
-
|
|
24380
|
+
clean3(this.buffer.subarray(pos));
|
|
23849
24381
|
if (this.padOffset > blockLen - pos) {
|
|
23850
24382
|
this.process(view, 0);
|
|
23851
24383
|
pos = 0;
|
|
@@ -23888,7 +24420,7 @@ var HashMD2 = class extends Hash {
|
|
|
23888
24420
|
return this._cloneInto();
|
|
23889
24421
|
}
|
|
23890
24422
|
};
|
|
23891
|
-
var
|
|
24423
|
+
var SHA256_IV3 = /* @__PURE__ */ Uint32Array.from([
|
|
23892
24424
|
1779033703,
|
|
23893
24425
|
3144134277,
|
|
23894
24426
|
1013904242,
|
|
@@ -23967,17 +24499,17 @@ var SHA256_K = /* @__PURE__ */ Uint32Array.from([
|
|
|
23967
24499
|
3329325298
|
|
23968
24500
|
]);
|
|
23969
24501
|
var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
|
|
23970
|
-
var SHA256 = class extends
|
|
24502
|
+
var SHA256 = class extends HashMD3 {
|
|
23971
24503
|
constructor(outputLen = 32) {
|
|
23972
24504
|
super(64, outputLen, 8, false);
|
|
23973
|
-
this.A =
|
|
23974
|
-
this.B =
|
|
23975
|
-
this.C =
|
|
23976
|
-
this.D =
|
|
23977
|
-
this.E =
|
|
23978
|
-
this.F =
|
|
23979
|
-
this.G =
|
|
23980
|
-
this.H =
|
|
24505
|
+
this.A = SHA256_IV3[0] | 0;
|
|
24506
|
+
this.B = SHA256_IV3[1] | 0;
|
|
24507
|
+
this.C = SHA256_IV3[2] | 0;
|
|
24508
|
+
this.D = SHA256_IV3[3] | 0;
|
|
24509
|
+
this.E = SHA256_IV3[4] | 0;
|
|
24510
|
+
this.F = SHA256_IV3[5] | 0;
|
|
24511
|
+
this.G = SHA256_IV3[6] | 0;
|
|
24512
|
+
this.H = SHA256_IV3[7] | 0;
|
|
23981
24513
|
}
|
|
23982
24514
|
get() {
|
|
23983
24515
|
const { A, B, C, D, E, F, G, H } = this;
|
|
@@ -24000,16 +24532,16 @@ var SHA256 = class extends HashMD2 {
|
|
|
24000
24532
|
for (let i = 16; i < 64; i++) {
|
|
24001
24533
|
const W15 = SHA256_W[i - 15];
|
|
24002
24534
|
const W2 = SHA256_W[i - 2];
|
|
24003
|
-
const s0 =
|
|
24004
|
-
const s1 =
|
|
24535
|
+
const s0 = rotr3(W15, 7) ^ rotr3(W15, 18) ^ W15 >>> 3;
|
|
24536
|
+
const s1 = rotr3(W2, 17) ^ rotr3(W2, 19) ^ W2 >>> 10;
|
|
24005
24537
|
SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0;
|
|
24006
24538
|
}
|
|
24007
24539
|
let { A, B, C, D, E, F, G, H } = this;
|
|
24008
24540
|
for (let i = 0; i < 64; i++) {
|
|
24009
|
-
const sigma1 =
|
|
24010
|
-
const T1 = H + sigma1 +
|
|
24011
|
-
const sigma0 =
|
|
24012
|
-
const T2 = sigma0 +
|
|
24541
|
+
const sigma1 = rotr3(E, 6) ^ rotr3(E, 11) ^ rotr3(E, 25);
|
|
24542
|
+
const T1 = H + sigma1 + Chi3(E, F, G) + SHA256_K[i] + SHA256_W[i] | 0;
|
|
24543
|
+
const sigma0 = rotr3(A, 2) ^ rotr3(A, 13) ^ rotr3(A, 22);
|
|
24544
|
+
const T2 = sigma0 + Maj3(A, B, C) | 0;
|
|
24013
24545
|
H = G;
|
|
24014
24546
|
G = F;
|
|
24015
24547
|
F = E;
|
|
@@ -24030,14 +24562,14 @@ var SHA256 = class extends HashMD2 {
|
|
|
24030
24562
|
this.set(A, B, C, D, E, F, G, H);
|
|
24031
24563
|
}
|
|
24032
24564
|
roundClean() {
|
|
24033
|
-
|
|
24565
|
+
clean3(SHA256_W);
|
|
24034
24566
|
}
|
|
24035
24567
|
destroy() {
|
|
24036
24568
|
this.set(0, 0, 0, 0, 0, 0, 0, 0);
|
|
24037
|
-
|
|
24569
|
+
clean3(this.buffer);
|
|
24038
24570
|
}
|
|
24039
24571
|
};
|
|
24040
|
-
var sha2562 = /* @__PURE__ */
|
|
24572
|
+
var sha2562 = /* @__PURE__ */ createHasher3(() => new SHA256());
|
|
24041
24573
|
|
|
24042
24574
|
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/hmac.js
|
|
24043
24575
|
var HMAC = class extends Hash {
|
|
@@ -24045,7 +24577,7 @@ var HMAC = class extends Hash {
|
|
|
24045
24577
|
super();
|
|
24046
24578
|
this.finished = false;
|
|
24047
24579
|
this.destroyed = false;
|
|
24048
|
-
|
|
24580
|
+
ahash3(hash);
|
|
24049
24581
|
const key = toBytes(_key);
|
|
24050
24582
|
this.iHash = hash.create();
|
|
24051
24583
|
if (typeof this.iHash.update !== "function")
|
|
@@ -24062,16 +24594,16 @@ var HMAC = class extends Hash {
|
|
|
24062
24594
|
for (let i = 0; i < pad.length; i++)
|
|
24063
24595
|
pad[i] ^= 54 ^ 92;
|
|
24064
24596
|
this.oHash.update(pad);
|
|
24065
|
-
|
|
24597
|
+
clean3(pad);
|
|
24066
24598
|
}
|
|
24067
24599
|
update(buf) {
|
|
24068
|
-
|
|
24600
|
+
aexists3(this);
|
|
24069
24601
|
this.iHash.update(buf);
|
|
24070
24602
|
return this;
|
|
24071
24603
|
}
|
|
24072
24604
|
digestInto(out) {
|
|
24073
|
-
|
|
24074
|
-
|
|
24605
|
+
aexists3(this);
|
|
24606
|
+
abytes3(out, this.outputLen);
|
|
24075
24607
|
this.finished = true;
|
|
24076
24608
|
this.iHash.digestInto(out);
|
|
24077
24609
|
this.oHash.update(out);
|
|
@@ -24104,8 +24636,8 @@ var HMAC = class extends Hash {
|
|
|
24104
24636
|
this.iHash.destroy();
|
|
24105
24637
|
}
|
|
24106
24638
|
};
|
|
24107
|
-
var
|
|
24108
|
-
|
|
24639
|
+
var hmac3 = (hash, key, message) => new HMAC(hash, key).update(message).digest();
|
|
24640
|
+
hmac3.create = (hash, key) => new HMAC(hash, key);
|
|
24109
24641
|
|
|
24110
24642
|
// ../../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/utils.js
|
|
24111
24643
|
var _0n5 = /* @__PURE__ */ BigInt(0);
|
|
@@ -24118,7 +24650,7 @@ function _abool2(value, title = "") {
|
|
|
24118
24650
|
return value;
|
|
24119
24651
|
}
|
|
24120
24652
|
function _abytes2(value, length, title = "") {
|
|
24121
|
-
const bytes =
|
|
24653
|
+
const bytes = isBytes3(value);
|
|
24122
24654
|
const len = value?.length;
|
|
24123
24655
|
const needsLen = length !== void 0;
|
|
24124
24656
|
if (!bytes || needsLen && len !== length) {
|
|
@@ -24142,7 +24674,7 @@ function bytesToNumberBE2(bytes) {
|
|
|
24142
24674
|
return hexToNumber2(bytesToHex2(bytes));
|
|
24143
24675
|
}
|
|
24144
24676
|
function bytesToNumberLE2(bytes) {
|
|
24145
|
-
|
|
24677
|
+
abytes3(bytes);
|
|
24146
24678
|
return hexToNumber2(bytesToHex2(Uint8Array.from(bytes).reverse()));
|
|
24147
24679
|
}
|
|
24148
24680
|
function numberToBytesBE2(n, len) {
|
|
@@ -24159,7 +24691,7 @@ function ensureBytes(title, hex, expectedLength) {
|
|
|
24159
24691
|
} catch (e) {
|
|
24160
24692
|
throw new Error(title + " must be hex string or Uint8Array, cause: " + e);
|
|
24161
24693
|
}
|
|
24162
|
-
} else if (
|
|
24694
|
+
} else if (isBytes3(hex)) {
|
|
24163
24695
|
res = Uint8Array.from(hex);
|
|
24164
24696
|
} else {
|
|
24165
24697
|
throw new Error(title + " must be hex string or Uint8Array");
|
|
@@ -24482,7 +25014,7 @@ function FpLegendre2(Fp, n) {
|
|
|
24482
25014
|
}
|
|
24483
25015
|
function nLength2(n, nBitLength) {
|
|
24484
25016
|
if (nBitLength !== void 0)
|
|
24485
|
-
|
|
25017
|
+
anumber3(nBitLength);
|
|
24486
25018
|
const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length;
|
|
24487
25019
|
const nByteLength = Math.ceil(_nBitLength / 8);
|
|
24488
25020
|
return { nBitLength: _nBitLength, nByteLength };
|
|
@@ -25573,7 +26105,7 @@ function ecdh(Point, ecdhOpts = {}) {
|
|
|
25573
26105
|
return Object.freeze({ getPublicKey, getSharedSecret, keygen, Point, utils, lengths });
|
|
25574
26106
|
}
|
|
25575
26107
|
function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
25576
|
-
|
|
26108
|
+
ahash3(hash);
|
|
25577
26109
|
_validateObject(ecdsaOpts, {}, {
|
|
25578
26110
|
hmac: "function",
|
|
25579
26111
|
lowS: "boolean",
|
|
@@ -25582,7 +26114,7 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
25582
26114
|
bits2int_modN: "function"
|
|
25583
26115
|
});
|
|
25584
26116
|
const randomBytes3 = ecdsaOpts.randomBytes || randomBytes2;
|
|
25585
|
-
const
|
|
26117
|
+
const hmac4 = ecdsaOpts.hmac || ((key, ...msgs) => hmac3(hash, key, concatBytes2(...msgs)));
|
|
25586
26118
|
const { Fp, Fn } = Point;
|
|
25587
26119
|
const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn;
|
|
25588
26120
|
const { keygen, getPublicKey, getSharedSecret, utils, lengths } = ecdh(Point, ecdsaOpts);
|
|
@@ -25766,13 +26298,13 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
25766
26298
|
function sign(message, secretKey, opts = {}) {
|
|
25767
26299
|
message = ensureBytes("message", message);
|
|
25768
26300
|
const { seed, k2sig } = prepSig(message, secretKey, opts);
|
|
25769
|
-
const drbg = createHmacDrbg(hash.outputLen, Fn.BYTES,
|
|
26301
|
+
const drbg = createHmacDrbg(hash.outputLen, Fn.BYTES, hmac4);
|
|
25770
26302
|
const sig = drbg(seed, k2sig);
|
|
25771
26303
|
return sig;
|
|
25772
26304
|
}
|
|
25773
26305
|
function tryParsingSig(sg) {
|
|
25774
26306
|
let sig = void 0;
|
|
25775
|
-
const isHex = typeof sg === "string" ||
|
|
26307
|
+
const isHex = typeof sg === "string" || isBytes3(sg);
|
|
25776
26308
|
const isObj = !isHex && sg !== null && typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint";
|
|
25777
26309
|
if (!isHex && !isObj)
|
|
25778
26310
|
throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
|
|
@@ -27058,7 +27590,7 @@ async function pickSuiExactRequirements(response, network) {
|
|
|
27058
27590
|
}
|
|
27059
27591
|
async function payViaX402(args) {
|
|
27060
27592
|
const { signer, client, options, reqInit, requirements } = args;
|
|
27061
|
-
const { buildX402SignedPayment, X402_PAYMENT_HEADER, X402_PAYMENT_RESPONSE_HEADER } = await import("./x402-
|
|
27593
|
+
const { buildX402SignedPayment, X402_PAYMENT_HEADER, X402_PAYMENT_RESPONSE_HEADER } = await import("./x402-ALCPXKII.js");
|
|
27062
27594
|
const amountRaw = BigInt(requirements.maxAmountRequired);
|
|
27063
27595
|
const migrationGasSui = await ensureAddressBalanceCovers({
|
|
27064
27596
|
signer,
|
|
@@ -27139,7 +27671,7 @@ async function finalize(response, opts) {
|
|
|
27139
27671
|
return { status: response.status, body: body2, paid: opts.paid };
|
|
27140
27672
|
}
|
|
27141
27673
|
async function makeGrpcBuildClient(client) {
|
|
27142
|
-
const { SuiGrpcClient: SuiGrpcClient3 } = await import("./grpc-
|
|
27674
|
+
const { SuiGrpcClient: SuiGrpcClient3 } = await import("./grpc-G3RQE2L5.js");
|
|
27143
27675
|
const network = client.network === "testnet" ? "testnet" : "mainnet";
|
|
27144
27676
|
const baseUrl = network === "testnet" ? "https://fullnode.testnet.sui.io" : "https://fullnode.mainnet.sui.io";
|
|
27145
27677
|
return new SuiGrpcClient3({ baseUrl, network });
|
|
@@ -27167,7 +27699,7 @@ var ZkLoginSigner = class {
|
|
|
27167
27699
|
return this.userAddress;
|
|
27168
27700
|
}
|
|
27169
27701
|
async signTransaction(txBytes) {
|
|
27170
|
-
const { getZkLoginSignature } = await import("./esm-
|
|
27702
|
+
const { getZkLoginSignature } = await import("./esm-ZKAIHFAJ.js");
|
|
27171
27703
|
const ephSig = await this.ephemeralKeypair.signTransaction(txBytes);
|
|
27172
27704
|
return {
|
|
27173
27705
|
signature: getZkLoginSignature({
|
|
@@ -27178,7 +27710,7 @@ var ZkLoginSigner = class {
|
|
|
27178
27710
|
};
|
|
27179
27711
|
}
|
|
27180
27712
|
async signPersonalMessage(messageBytes) {
|
|
27181
|
-
const { getZkLoginSignature } = await import("./esm-
|
|
27713
|
+
const { getZkLoginSignature } = await import("./esm-ZKAIHFAJ.js");
|
|
27182
27714
|
const { signature: ephSig, bytes } = await this.ephemeralKeypair.signPersonalMessage(messageBytes);
|
|
27183
27715
|
return {
|
|
27184
27716
|
signature: getZkLoginSignature({
|
|
@@ -27661,7 +28193,7 @@ function resolveApiKey(apiKey) {
|
|
|
27661
28193
|
if (!key) {
|
|
27662
28194
|
throw new T2000Error(
|
|
27663
28195
|
"INVALID_KEY",
|
|
27664
|
-
"No Private API key. Pass `apiKey` or set T2000_API_KEY. Generate one at
|
|
28196
|
+
"No Private API key. Pass `apiKey` or set T2000_API_KEY. Generate one at agents.t2000.ai/manage (Pro/Max)."
|
|
27665
28197
|
);
|
|
27666
28198
|
}
|
|
27667
28199
|
return key;
|
|
@@ -32074,7 +32606,7 @@ function numOrUndef(v) {
|
|
|
32074
32606
|
}
|
|
32075
32607
|
function registerChat(program3) {
|
|
32076
32608
|
program3.command("chat").argument("<message...>", "Your prompt").description(
|
|
32077
|
-
"Chat with a model on the t2000 Private API (OpenAI-compatible, ZDR; a phala/* tier is GPU-TEE confidential). Needs an API key \u2014 generate one at
|
|
32609
|
+
"Chat with a model on the t2000 Private API (OpenAI-compatible, ZDR; a phala/* tier is GPU-TEE confidential). Needs an API key \u2014 generate one at agents.t2000.ai/manage, then pass --api-key or set T2000_API_KEY."
|
|
32078
32610
|
).option("--model <id>", `Model id (default ${DEFAULT_MODEL}; see \`t2 models\`)`, DEFAULT_MODEL).option("--system <text>", "System prompt").option("--max-tokens <n>", "Max output tokens").option("--temperature <t>", "Sampling temperature (0\u20132)").option("--no-stream", "Wait for the full response instead of streaming").option("--api-key <key>", "Private API key (or set T2000_API_KEY)").option("--api <url>", "API base URL (default https://api.t2000.ai/v1)").action(
|
|
32079
32611
|
async (messageParts, opts) => {
|
|
32080
32612
|
try {
|
|
@@ -32577,7 +33109,7 @@ function registerMcpStart(parent) {
|
|
|
32577
33109
|
parent.command("start", { isDefault: true }).description("Start MCP server (stdio transport \u2014 for AI client integration)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
|
|
32578
33110
|
let mod3;
|
|
32579
33111
|
try {
|
|
32580
|
-
mod3 = await import("./dist-
|
|
33112
|
+
mod3 = await import("./dist-57KQG4RN.js");
|
|
32581
33113
|
} catch {
|
|
32582
33114
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
32583
33115
|
process.exit(1);
|
|
@@ -33124,7 +33656,7 @@ Subcommands:
|
|
|
33124
33656
|
}
|
|
33125
33657
|
if (normalizeSuiAddress(owner) === normalizeSuiAddress(address)) {
|
|
33126
33658
|
throw new Error(
|
|
33127
|
-
"That's this agent's own address. Pass YOUR Passport address (the human owner) \u2014 e.g. the one shown in
|
|
33659
|
+
"That's this agent's own address. Pass YOUR Passport address (the human owner) \u2014 e.g. the one shown in agents.t2000.ai/manage."
|
|
33128
33660
|
);
|
|
33129
33661
|
}
|
|
33130
33662
|
const { digest } = await runSponsoredTx({
|
|
@@ -33545,6 +34077,346 @@ Subcommands:
|
|
|
33545
34077
|
);
|
|
33546
34078
|
}
|
|
33547
34079
|
|
|
34080
|
+
// src/commands/agents.ts
|
|
34081
|
+
var DEFAULT_API_BASE4 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
34082
|
+
async function getJson(url) {
|
|
34083
|
+
const res = await fetch(url, { headers: { accept: "application/json" } });
|
|
34084
|
+
if (!res.ok) {
|
|
34085
|
+
throw new Error(`Directory request failed (${res.status}).`);
|
|
34086
|
+
}
|
|
34087
|
+
return await res.json();
|
|
34088
|
+
}
|
|
34089
|
+
function firstLine(text, max = 76) {
|
|
34090
|
+
const line = (text ?? "").split("\n")[0]?.trim() ?? "";
|
|
34091
|
+
return line.length > max ? `${line.slice(0, max - 1)}\u2026` : line;
|
|
34092
|
+
}
|
|
34093
|
+
function registerAgents(program3) {
|
|
34094
|
+
program3.command("agents").argument("[address]", "Show one agent\u2019s full listing (profile + reputation)").description(
|
|
34095
|
+
"Browse the agent store (agents.t2000.ai): priced services from the live directory, or one agent\u2019s full listing. Buy with `t2 agent pay <address>`. [Agent Commerce]"
|
|
34096
|
+
).option("--category <category>", "Filter the list by store category").option("--all", "Include agents without a priced service").option("--limit <n>", "Max rows (default: all)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE4})`).action(
|
|
34097
|
+
async (address, opts) => {
|
|
34098
|
+
try {
|
|
34099
|
+
const base = opts.api ?? DEFAULT_API_BASE4;
|
|
34100
|
+
if (address) {
|
|
34101
|
+
const profile = await getJson(`${base}/agents/${address}`);
|
|
34102
|
+
if (isJsonMode()) {
|
|
34103
|
+
printJson(profile);
|
|
34104
|
+
return;
|
|
34105
|
+
}
|
|
34106
|
+
const rep = profile.reputation;
|
|
34107
|
+
printBlank();
|
|
34108
|
+
printHeader(profile.name ?? truncateAddress(profile.address));
|
|
34109
|
+
printKeyValue("Address", profile.address);
|
|
34110
|
+
if (profile.priceUsdc) {
|
|
34111
|
+
printKeyValue(
|
|
34112
|
+
"Price",
|
|
34113
|
+
`${formatUsd(Number.parseFloat(profile.priceUsdc))} / call${profile.category ? ` \xB7 ${profile.category}` : ""}`
|
|
34114
|
+
);
|
|
34115
|
+
}
|
|
34116
|
+
if (profile.description) {
|
|
34117
|
+
printKeyValue("About", firstLine(profile.description, 90));
|
|
34118
|
+
}
|
|
34119
|
+
if (rep) {
|
|
34120
|
+
printKeyValue(
|
|
34121
|
+
"Verified on the rail",
|
|
34122
|
+
`${rep.sales ?? 0} sold \xB7 ${rep.buyers ?? 0} buyer${(rep.buyers ?? 0) === 1 ? "" : "s"} \xB7 ${formatUsd(rep.volumeUsd ?? 0)} settled${typeof rep.deliveredRate === "number" ? ` \xB7 ${Math.round(rep.deliveredRate * 100)}% delivered` : ""}`
|
|
34123
|
+
);
|
|
34124
|
+
}
|
|
34125
|
+
printBlank();
|
|
34126
|
+
if (profile.priceUsdc) {
|
|
34127
|
+
printInfo(`Buy it: t2 agent pay ${profile.address}`);
|
|
34128
|
+
}
|
|
34129
|
+
printInfo(`Listing: https://agents.t2000.ai/${profile.address}`);
|
|
34130
|
+
printBlank();
|
|
34131
|
+
return;
|
|
34132
|
+
}
|
|
34133
|
+
const limit = Math.min(Number.parseInt(opts.limit ?? "100", 10) || 100, 100);
|
|
34134
|
+
const data = await getJson(
|
|
34135
|
+
`${base}/agents?limit=100`
|
|
34136
|
+
);
|
|
34137
|
+
let agents = (data.agents ?? []).filter((a) => a.active !== false);
|
|
34138
|
+
if (!opts.all) {
|
|
34139
|
+
agents = agents.filter((a) => a.service && a.priceUsdc);
|
|
34140
|
+
}
|
|
34141
|
+
if (opts.category) {
|
|
34142
|
+
const cat = opts.category.trim().toLowerCase();
|
|
34143
|
+
agents = agents.filter((a) => a.category?.toLowerCase() === cat);
|
|
34144
|
+
}
|
|
34145
|
+
agents = agents.slice(0, limit);
|
|
34146
|
+
if (isJsonMode()) {
|
|
34147
|
+
printJson({ total: data.total, shown: agents.length, agents });
|
|
34148
|
+
return;
|
|
34149
|
+
}
|
|
34150
|
+
printBlank();
|
|
34151
|
+
printHeader(
|
|
34152
|
+
`Agent store \u2014 ${agents.length} ${opts.all ? "agents" : "priced services"}${opts.category ? ` in ${opts.category}` : ""}`
|
|
34153
|
+
);
|
|
34154
|
+
for (const a of agents) {
|
|
34155
|
+
const price = a.priceUsdc ? formatUsd(Number.parseFloat(a.priceUsdc)).padStart(6) : " \u2014";
|
|
34156
|
+
printLine(
|
|
34157
|
+
` ${price} ${(a.name ?? truncateAddress(a.address)).padEnd(24).slice(0, 24)} ${a.category ?? ""}`
|
|
34158
|
+
);
|
|
34159
|
+
printLine(` ${a.address}`);
|
|
34160
|
+
}
|
|
34161
|
+
printBlank();
|
|
34162
|
+
printInfo("Detail: t2 agents <address> \xB7 Buy: t2 agent pay <address> (addresses above are complete)");
|
|
34163
|
+
printBlank();
|
|
34164
|
+
} catch (error) {
|
|
34165
|
+
handleError(error);
|
|
34166
|
+
}
|
|
34167
|
+
}
|
|
34168
|
+
);
|
|
34169
|
+
}
|
|
34170
|
+
|
|
34171
|
+
// src/commands/task/index.ts
|
|
34172
|
+
var DEFAULT_GATEWAY2 = process.env.T2000_GATEWAY_URL ?? "https://mpp.t2000.ai";
|
|
34173
|
+
async function getJson2(url) {
|
|
34174
|
+
const res = await fetch(url, { headers: { accept: "application/json" } });
|
|
34175
|
+
const json = await res.json().catch(() => ({}));
|
|
34176
|
+
if (!res.ok) {
|
|
34177
|
+
throw new Error(json.error ?? `Request failed (${res.status}).`);
|
|
34178
|
+
}
|
|
34179
|
+
return json;
|
|
34180
|
+
}
|
|
34181
|
+
async function postJson2(url, body2) {
|
|
34182
|
+
const res = await fetch(url, {
|
|
34183
|
+
method: "POST",
|
|
34184
|
+
headers: { "content-type": "application/json" },
|
|
34185
|
+
body: JSON.stringify(body2)
|
|
34186
|
+
});
|
|
34187
|
+
const json = await res.json().catch(() => ({}));
|
|
34188
|
+
if (!res.ok) {
|
|
34189
|
+
throw new Error(json.error ?? `Request failed (${res.status}).`);
|
|
34190
|
+
}
|
|
34191
|
+
return json;
|
|
34192
|
+
}
|
|
34193
|
+
function registerTask(program3) {
|
|
34194
|
+
const group = program3.command("task").description(
|
|
34195
|
+
"Earn from t2000 reward tasks and work (or post) community board tasks \u2014 all paid through the rail. [Agent Commerce]"
|
|
34196
|
+
);
|
|
34197
|
+
group.command("list").description("Live tasks: t2000 rewards (auto-verified) + the community board (poster-approved)").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).action(async (opts) => {
|
|
34198
|
+
try {
|
|
34199
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34200
|
+
const [rewards, board] = await Promise.all([
|
|
34201
|
+
getJson2(`${gateway}/tasks/stats`),
|
|
34202
|
+
getJson2(`${gateway}/tasks/board`)
|
|
34203
|
+
]);
|
|
34204
|
+
if (isJsonMode()) {
|
|
34205
|
+
printJson({ rewards: rewards.tasks, board: board.tasks });
|
|
34206
|
+
return;
|
|
34207
|
+
}
|
|
34208
|
+
printBlank();
|
|
34209
|
+
printHeader("t2000 reward tasks (auto-verified, one per wallet)");
|
|
34210
|
+
for (const t of rewards.tasks) {
|
|
34211
|
+
printLine(
|
|
34212
|
+
` ${formatUsd(t.rewardNetUsd).padStart(6)} ${t.id.padEnd(20)} ${t.kind.padEnd(8)} ${t.status === "live" ? "live" : "budget spent"}`
|
|
34213
|
+
);
|
|
34214
|
+
}
|
|
34215
|
+
printBlank();
|
|
34216
|
+
printHeader(`Community board (${board.tasks.length} live, poster approves)`);
|
|
34217
|
+
if (board.tasks.length === 0) {
|
|
34218
|
+
printLine(" (none live \u2014 post one: t2 task post --help)");
|
|
34219
|
+
}
|
|
34220
|
+
for (const t of board.tasks) {
|
|
34221
|
+
const days = Math.max(0, Math.ceil((Date.parse(t.expiresAt) - Date.now()) / 864e5));
|
|
34222
|
+
printLine(
|
|
34223
|
+
` ${formatUsd(t.rewardUsd).padStart(6)} ${t.title.slice(0, 44).padEnd(44)} ${t.remainingCompletions}/${t.maxCompletions} spots \xB7 ${days}d ${t.id}`
|
|
34224
|
+
);
|
|
34225
|
+
}
|
|
34226
|
+
printBlank();
|
|
34227
|
+
printInfo("Claim a reward: t2 task claim <task> \xB7 Work the board: t2 task submit <taskId>");
|
|
34228
|
+
printBlank();
|
|
34229
|
+
} catch (error) {
|
|
34230
|
+
handleError(error);
|
|
34231
|
+
}
|
|
34232
|
+
});
|
|
34233
|
+
group.command("claim").argument("<task>", "Reward task id (e.g. buy-sui, share-a-read) \u2014 see `t2 task list`").description("Claim a t2000 reward task (verified in one request; also retries automated tasks)").option("--tx <digest>", "Swap tx digest (buy-manifest / buy-sui)").option("--post <url>", "Your X post URL (X-proof tasks)").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
34234
|
+
async (task, opts) => {
|
|
34235
|
+
try {
|
|
34236
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34237
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
34238
|
+
const result = await postJson2(`${gateway}/tasks/claim`, {
|
|
34239
|
+
task,
|
|
34240
|
+
address: agent.address(),
|
|
34241
|
+
...opts.tx ? { txDigest: opts.tx } : {},
|
|
34242
|
+
...opts.post ? { postUrl: opts.post } : {}
|
|
34243
|
+
});
|
|
34244
|
+
if (isJsonMode()) {
|
|
34245
|
+
printJson(result);
|
|
34246
|
+
return;
|
|
34247
|
+
}
|
|
34248
|
+
printBlank();
|
|
34249
|
+
if (result.paid) {
|
|
34250
|
+
printSuccess(`Paid ${formatUsd(result.netUsd ?? 0)} to your agent.`);
|
|
34251
|
+
if (result.suiscan) {
|
|
34252
|
+
printKeyValue("Receipt", result.suiscan);
|
|
34253
|
+
}
|
|
34254
|
+
} else {
|
|
34255
|
+
printWarning(result.note ?? "Not paid.");
|
|
34256
|
+
}
|
|
34257
|
+
printBlank();
|
|
34258
|
+
} catch (error) {
|
|
34259
|
+
handleError(error);
|
|
34260
|
+
}
|
|
34261
|
+
}
|
|
34262
|
+
);
|
|
34263
|
+
group.command("post").description(
|
|
34264
|
+
"Post a community task \u2014 pays the FULL budget (reward \xD7 completions) into escrow via x402; auto-moderated at post time. SAVE the returned manageKey."
|
|
34265
|
+
).requiredOption("--title <text>", "What needs doing (8+ chars)").requiredOption("--description <text>", "Exactly what the worker must deliver + what proof (30+ chars)").requiredOption("--reward <usdc>", "Reward per approved completion ($0.01\u2013$50)").option("--completions <n>", "Max completions (default 1)", "1").option("--expiry-days <n>", "Days until unspent budget auto-refunds (default 7)", "7").option("--category <category>", "research | data | marketing | dev | creative | other", "other").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).option("--force", "Override spending limits for this call (see `t2 limit`)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
34266
|
+
async (opts) => {
|
|
34267
|
+
try {
|
|
34268
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34269
|
+
const reward = Number.parseFloat(opts.reward);
|
|
34270
|
+
const completions = Number.parseInt(opts.completions, 10);
|
|
34271
|
+
if (!Number.isFinite(reward) || reward <= 0) {
|
|
34272
|
+
throw new Error(`--reward must be a positive number (got "${opts.reward}").`);
|
|
34273
|
+
}
|
|
34274
|
+
const budget = Math.round(reward * completions * 1e6) / 1e6;
|
|
34275
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
34276
|
+
const result = await agent.pay({
|
|
34277
|
+
url: `${gateway}/tasks/board`,
|
|
34278
|
+
method: "POST",
|
|
34279
|
+
body: JSON.stringify({
|
|
34280
|
+
title: opts.title,
|
|
34281
|
+
description: opts.description,
|
|
34282
|
+
rewardUsd: reward,
|
|
34283
|
+
maxCompletions: completions,
|
|
34284
|
+
expiryDays: Number.parseInt(opts.expiryDays, 10),
|
|
34285
|
+
category: opts.category
|
|
34286
|
+
}),
|
|
34287
|
+
maxPrice: budget,
|
|
34288
|
+
force: opts.force
|
|
34289
|
+
});
|
|
34290
|
+
const body2 = result.body;
|
|
34291
|
+
if (isJsonMode()) {
|
|
34292
|
+
printJson(body2 ?? result);
|
|
34293
|
+
return;
|
|
34294
|
+
}
|
|
34295
|
+
printBlank();
|
|
34296
|
+
if (body2?.ok && body2.manageKey) {
|
|
34297
|
+
printSuccess(body2.moderation ?? "Task posted.");
|
|
34298
|
+
printKeyValue("Task", body2.task?.id ?? "\u2014");
|
|
34299
|
+
printKeyValue("Escrow", formatUsd(budget));
|
|
34300
|
+
printBlank();
|
|
34301
|
+
printWarning("SAVE THIS manageKey \u2014 shown once. It approves/rejects/closes this task:");
|
|
34302
|
+
printLine(` ${body2.manageKey}`);
|
|
34303
|
+
printBlank();
|
|
34304
|
+
printInfo(`Review: t2 task review ${body2.task?.id ?? "<taskId>"} --manage-key <key>`);
|
|
34305
|
+
} else {
|
|
34306
|
+
printWarning(
|
|
34307
|
+
`${body2?.error ?? "Posting failed."}${body2?.refunded ? " (Budget refunded.)" : ""}`
|
|
34308
|
+
);
|
|
34309
|
+
}
|
|
34310
|
+
printBlank();
|
|
34311
|
+
} catch (error) {
|
|
34312
|
+
handleError(error);
|
|
34313
|
+
}
|
|
34314
|
+
}
|
|
34315
|
+
);
|
|
34316
|
+
group.command("submit").argument("<taskId>", "Board task id (see `t2 task list`)").description("Submit proof of completion to a board task (one submission per wallet)").requiredOption("--proof <text>", "What you did + how the poster can verify it (10+ chars)").option("--url <url>", "Proof link (https)").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
34317
|
+
async (taskId, opts) => {
|
|
34318
|
+
try {
|
|
34319
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34320
|
+
const agent = await withAgent({ keyPath: opts.key });
|
|
34321
|
+
const result = await postJson2(
|
|
34322
|
+
`${gateway}/tasks/board/${taskId}/submit`,
|
|
34323
|
+
{
|
|
34324
|
+
address: agent.address(),
|
|
34325
|
+
proof: opts.proof,
|
|
34326
|
+
...opts.url ? { url: opts.url } : {}
|
|
34327
|
+
}
|
|
34328
|
+
);
|
|
34329
|
+
if (isJsonMode()) {
|
|
34330
|
+
printJson(result);
|
|
34331
|
+
return;
|
|
34332
|
+
}
|
|
34333
|
+
printBlank();
|
|
34334
|
+
printSuccess(result.note ?? "Submitted \u2014 the poster reviews next.");
|
|
34335
|
+
printBlank();
|
|
34336
|
+
} catch (error) {
|
|
34337
|
+
handleError(error);
|
|
34338
|
+
}
|
|
34339
|
+
}
|
|
34340
|
+
);
|
|
34341
|
+
group.command("review").argument("<taskId>", "Your board task id").description("List submissions on your board task (poster view \u2014 needs the manageKey)").requiredOption("--manage-key <key>", "The manageKey returned when you posted").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).action(async (taskId, opts) => {
|
|
34342
|
+
try {
|
|
34343
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34344
|
+
const result = await getJson2(`${gateway}/tasks/board/${taskId}?manageKey=${encodeURIComponent(opts.manageKey)}`);
|
|
34345
|
+
if (!result.posterView) {
|
|
34346
|
+
throw new Error(result.error ?? "manageKey not accepted for this task.");
|
|
34347
|
+
}
|
|
34348
|
+
if (isJsonMode()) {
|
|
34349
|
+
printJson(result);
|
|
34350
|
+
return;
|
|
34351
|
+
}
|
|
34352
|
+
const subs = result.submissions ?? [];
|
|
34353
|
+
printBlank();
|
|
34354
|
+
printHeader(`${result.task?.title ?? taskId} \u2014 ${subs.length} submission${subs.length === 1 ? "" : "s"}`);
|
|
34355
|
+
for (const s of subs) {
|
|
34356
|
+
printLine(` [${s.status.padEnd(8)}] ${s.id} ${truncateAddress(s.worker)}`);
|
|
34357
|
+
if (s.proof) {
|
|
34358
|
+
printLine(` ${s.proof.slice(0, 90)}`);
|
|
34359
|
+
}
|
|
34360
|
+
if (s.url) {
|
|
34361
|
+
printLine(` ${s.url}`);
|
|
34362
|
+
}
|
|
34363
|
+
}
|
|
34364
|
+
printBlank();
|
|
34365
|
+
printInfo(`Pay: t2 task approve ${taskId} --manage-key <key> --submissions <id,id,\u2026>`);
|
|
34366
|
+
printBlank();
|
|
34367
|
+
} catch (error) {
|
|
34368
|
+
handleError(error);
|
|
34369
|
+
}
|
|
34370
|
+
});
|
|
34371
|
+
group.command("approve").argument("<taskId>", "Your board task id").description("Approve (pay) or reject submissions on your board task \u2014 batch up to 50").requiredOption("--manage-key <key>", "The manageKey returned when you posted").requiredOption("--submissions <ids>", "Comma-separated submission ids").option("--reject", "Reject instead of approving").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).action(
|
|
34372
|
+
async (taskId, opts) => {
|
|
34373
|
+
try {
|
|
34374
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34375
|
+
const result = await postJson2(`${gateway}/tasks/board/${taskId}/approve`, {
|
|
34376
|
+
manageKey: opts.manageKey,
|
|
34377
|
+
submissionIds: opts.submissions.split(",").map((s) => s.trim()).filter(Boolean),
|
|
34378
|
+
action: opts.reject ? "reject" : "approve"
|
|
34379
|
+
});
|
|
34380
|
+
if (isJsonMode()) {
|
|
34381
|
+
printJson(result);
|
|
34382
|
+
return;
|
|
34383
|
+
}
|
|
34384
|
+
printBlank();
|
|
34385
|
+
for (const r of result.results ?? []) {
|
|
34386
|
+
if (r.status === "paid") {
|
|
34387
|
+
printSuccess(`${r.submissionId} paid${r.payoutTx ? ` (tx ${r.payoutTx.slice(0, 10)}\u2026)` : ""}`);
|
|
34388
|
+
} else if (r.error) {
|
|
34389
|
+
printWarning(`${r.submissionId}: ${r.error}`);
|
|
34390
|
+
} else {
|
|
34391
|
+
printLine(` ${r.submissionId}: ${r.status}`);
|
|
34392
|
+
}
|
|
34393
|
+
}
|
|
34394
|
+
printBlank();
|
|
34395
|
+
} catch (error) {
|
|
34396
|
+
handleError(error);
|
|
34397
|
+
}
|
|
34398
|
+
}
|
|
34399
|
+
);
|
|
34400
|
+
group.command("close").argument("<taskId>", "Your board task id").description("Close your board task early \u2014 the unspent budget refunds to your wallet").requiredOption("--manage-key <key>", "The manageKey returned when you posted").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).action(async (taskId, opts) => {
|
|
34401
|
+
try {
|
|
34402
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34403
|
+
const result = await postJson2(`${gateway}/tasks/board/${taskId}/close`, { manageKey: opts.manageKey });
|
|
34404
|
+
if (isJsonMode()) {
|
|
34405
|
+
printJson(result);
|
|
34406
|
+
return;
|
|
34407
|
+
}
|
|
34408
|
+
printBlank();
|
|
34409
|
+
printSuccess(`Task closed${result.refunded ? " \u2014 unspent budget refunded" : ""}.`);
|
|
34410
|
+
if (result.suiscan) {
|
|
34411
|
+
printKeyValue("Refund", result.suiscan);
|
|
34412
|
+
}
|
|
34413
|
+
printBlank();
|
|
34414
|
+
} catch (error) {
|
|
34415
|
+
handleError(error);
|
|
34416
|
+
}
|
|
34417
|
+
});
|
|
34418
|
+
}
|
|
34419
|
+
|
|
33548
34420
|
// src/program.ts
|
|
33549
34421
|
var require3 = createRequire2(import.meta.url);
|
|
33550
34422
|
var { version: CLI_VERSION2 } = require3("../package.json");
|
|
@@ -33566,6 +34438,10 @@ Examples:
|
|
|
33566
34438
|
$ t2 models List the Private API model catalog
|
|
33567
34439
|
$ t2 pay <url> --estimate Preview an x402 service's price + input schema (no payment)
|
|
33568
34440
|
$ t2 services search "image" Discover x402 services in the gateway catalog
|
|
34441
|
+
$ t2 agents Browse the agent store (agents.t2000.ai)
|
|
34442
|
+
$ t2 agent pay <address> Buy an agent's service (escrowed, auto-refund on failure)
|
|
34443
|
+
$ t2 task list Live reward tasks + the community board
|
|
34444
|
+
$ t2 task claim share-a-read --post <url> Claim an X-proof reward
|
|
33569
34445
|
$ t2 limit set --daily 100 Change the daily spend cap (default $100/day)
|
|
33570
34446
|
$ t2 mcp install Connect Claude / Cursor / Windsurf
|
|
33571
34447
|
$ t2 skills install Install skills as local SKILL.md files`);
|
|
@@ -33585,6 +34461,8 @@ Examples:
|
|
|
33585
34461
|
registerMcp(program3);
|
|
33586
34462
|
registerSkills(program3);
|
|
33587
34463
|
registerAgent(program3);
|
|
34464
|
+
registerAgents(program3);
|
|
34465
|
+
registerTask(program3);
|
|
33588
34466
|
return program3;
|
|
33589
34467
|
}
|
|
33590
34468
|
|