@heyamiko/amiko-cli 0.6.8 → 0.6.9
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/dist/index.js +365 -1090
- package/package.json +1 -1
- package/skills/SKILL.md +7 -6
package/dist/index.js
CHANGED
|
@@ -5167,7 +5167,7 @@ function _legacyHelperNormPriv(Fn, allowedPrivateKeyLengths, wrapPrivateKey) {
|
|
|
5167
5167
|
}
|
|
5168
5168
|
try {
|
|
5169
5169
|
num = Fn.fromBytes(bytes);
|
|
5170
|
-
} catch (
|
|
5170
|
+
} catch (error2) {
|
|
5171
5171
|
throw new Error(`invalid private key: expected ui8a of size ${expected}, got ${typeof key}`);
|
|
5172
5172
|
}
|
|
5173
5173
|
}
|
|
@@ -5663,7 +5663,7 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
|
|
|
5663
5663
|
try {
|
|
5664
5664
|
normPrivateKeyToScalar(privateKey);
|
|
5665
5665
|
return true;
|
|
5666
|
-
} catch (
|
|
5666
|
+
} catch (error2) {
|
|
5667
5667
|
return false;
|
|
5668
5668
|
}
|
|
5669
5669
|
},
|
|
@@ -5804,7 +5804,7 @@ function ecdsa(Point, ecdsaOpts, curveOpts = {}) {
|
|
|
5804
5804
|
_sig = Signature.fromCompact(sg);
|
|
5805
5805
|
}
|
|
5806
5806
|
P2 = Point.fromHex(publicKey);
|
|
5807
|
-
} catch (
|
|
5807
|
+
} catch (error2) {
|
|
5808
5808
|
return false;
|
|
5809
5809
|
}
|
|
5810
5810
|
if (!_sig)
|
|
@@ -6361,7 +6361,7 @@ function schnorrVerify(signature, message, publicKey) {
|
|
|
6361
6361
|
if (R.is0() || !hasEven(y3) || x3 !== r4)
|
|
6362
6362
|
return false;
|
|
6363
6363
|
return true;
|
|
6364
|
-
} catch (
|
|
6364
|
+
} catch (error2) {
|
|
6365
6365
|
return false;
|
|
6366
6366
|
}
|
|
6367
6367
|
}
|
|
@@ -11875,7 +11875,7 @@ var require_edwards = __commonJS((exports) => {
|
|
|
11875
11875
|
A3 = Point2.fromHex(publicKey, zip215);
|
|
11876
11876
|
R = Point2.fromHex(sig.slice(0, len), zip215);
|
|
11877
11877
|
SB = G.multiplyUnsafe(s3);
|
|
11878
|
-
} catch (
|
|
11878
|
+
} catch (error2) {
|
|
11879
11879
|
return false;
|
|
11880
11880
|
}
|
|
11881
11881
|
if (!zip215 && A3.isSmallOrder())
|
|
@@ -16446,11 +16446,11 @@ var require_lib = __commonJS((exports) => {
|
|
|
16446
16446
|
} else {
|
|
16447
16447
|
serializeStruct(schema, value, writer);
|
|
16448
16448
|
}
|
|
16449
|
-
} catch (
|
|
16450
|
-
if (
|
|
16451
|
-
|
|
16449
|
+
} catch (error2) {
|
|
16450
|
+
if (error2 instanceof BorshError) {
|
|
16451
|
+
error2.addToFieldPath(fieldName);
|
|
16452
16452
|
}
|
|
16453
|
-
throw
|
|
16453
|
+
throw error2;
|
|
16454
16454
|
}
|
|
16455
16455
|
}
|
|
16456
16456
|
function serializeStruct(schema, obj, writer) {
|
|
@@ -16522,11 +16522,11 @@ var require_lib = __commonJS((exports) => {
|
|
|
16522
16522
|
return map;
|
|
16523
16523
|
}
|
|
16524
16524
|
return deserializeStruct(schema, fieldType, reader);
|
|
16525
|
-
} catch (
|
|
16526
|
-
if (
|
|
16527
|
-
|
|
16525
|
+
} catch (error2) {
|
|
16526
|
+
if (error2 instanceof BorshError) {
|
|
16527
|
+
error2.addToFieldPath(fieldName);
|
|
16528
16528
|
}
|
|
16529
|
-
throw
|
|
16529
|
+
throw error2;
|
|
16530
16530
|
}
|
|
16531
16531
|
}
|
|
16532
16532
|
function deserializeStruct(schema, classType, reader) {
|
|
@@ -20679,14 +20679,14 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
20679
20679
|
const tuples = run(value, struct2, options);
|
|
20680
20680
|
const tuple2 = shiftIterator(tuples);
|
|
20681
20681
|
if (tuple2[0]) {
|
|
20682
|
-
const
|
|
20682
|
+
const error2 = new StructError(tuple2[0], function* () {
|
|
20683
20683
|
for (const t3 of tuples) {
|
|
20684
20684
|
if (t3[0]) {
|
|
20685
20685
|
yield t3[0];
|
|
20686
20686
|
}
|
|
20687
20687
|
}
|
|
20688
20688
|
});
|
|
20689
|
-
return [
|
|
20689
|
+
return [error2, undefined];
|
|
20690
20690
|
} else {
|
|
20691
20691
|
const v3 = tuple2[1];
|
|
20692
20692
|
return [undefined, v3];
|
|
@@ -21076,11 +21076,11 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
21076
21076
|
schema: null,
|
|
21077
21077
|
coercer(value, ctx) {
|
|
21078
21078
|
for (const S2 of Structs) {
|
|
21079
|
-
const [
|
|
21079
|
+
const [error2, coerced] = S2.validate(value, {
|
|
21080
21080
|
coerce: true,
|
|
21081
21081
|
mask: ctx.mask
|
|
21082
21082
|
});
|
|
21083
|
-
if (!
|
|
21083
|
+
if (!error2) {
|
|
21084
21084
|
return coerced;
|
|
21085
21085
|
}
|
|
21086
21086
|
}
|
|
@@ -22111,26 +22111,26 @@ var require_tr46 = __commonJS((exports, module) => {
|
|
|
22111
22111
|
};
|
|
22112
22112
|
}
|
|
22113
22113
|
var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/;
|
|
22114
|
-
function validateLabel(
|
|
22115
|
-
if (
|
|
22116
|
-
|
|
22114
|
+
function validateLabel(label2, processing_option) {
|
|
22115
|
+
if (label2.substr(0, 4) === "xn--") {
|
|
22116
|
+
label2 = punycode.toUnicode(label2);
|
|
22117
22117
|
processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL;
|
|
22118
22118
|
}
|
|
22119
|
-
var
|
|
22120
|
-
if (normalize(
|
|
22121
|
-
|
|
22119
|
+
var error2 = false;
|
|
22120
|
+
if (normalize(label2) !== label2 || label2[3] === "-" && label2[4] === "-" || label2[0] === "-" || label2[label2.length - 1] === "-" || label2.indexOf(".") !== -1 || label2.search(combiningMarksRegex) === 0) {
|
|
22121
|
+
error2 = true;
|
|
22122
22122
|
}
|
|
22123
|
-
var len = countSymbols(
|
|
22123
|
+
var len = countSymbols(label2);
|
|
22124
22124
|
for (var i5 = 0;i5 < len; ++i5) {
|
|
22125
|
-
var status = findStatus(
|
|
22125
|
+
var status = findStatus(label2.codePointAt(i5));
|
|
22126
22126
|
if (processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid" || processing === PROCESSING_OPTIONS.NONTRANSITIONAL && status[1] !== "valid" && status[1] !== "deviation") {
|
|
22127
|
-
|
|
22127
|
+
error2 = true;
|
|
22128
22128
|
break;
|
|
22129
22129
|
}
|
|
22130
22130
|
}
|
|
22131
22131
|
return {
|
|
22132
|
-
label:
|
|
22133
|
-
error:
|
|
22132
|
+
label: label2,
|
|
22133
|
+
error: error2
|
|
22134
22134
|
};
|
|
22135
22135
|
}
|
|
22136
22136
|
function processing(domain_name, useSTD3, processing_option) {
|
|
@@ -23763,8 +23763,8 @@ var require_lib3 = __commonJS((exports, module) => {
|
|
|
23763
23763
|
this.timeout = timeout;
|
|
23764
23764
|
if (body instanceof Stream) {
|
|
23765
23765
|
body.on("error", function(err) {
|
|
23766
|
-
const
|
|
23767
|
-
_this[INTERNALS].error =
|
|
23766
|
+
const error2 = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err);
|
|
23767
|
+
_this[INTERNALS].error = error2;
|
|
23768
23768
|
});
|
|
23769
23769
|
}
|
|
23770
23770
|
}
|
|
@@ -24496,14 +24496,14 @@ var require_lib3 = __commonJS((exports, module) => {
|
|
|
24496
24496
|
const signal = request.signal;
|
|
24497
24497
|
let response = null;
|
|
24498
24498
|
const abort = function abort2() {
|
|
24499
|
-
let
|
|
24500
|
-
reject(
|
|
24499
|
+
let error2 = new AbortError("The user aborted a request.");
|
|
24500
|
+
reject(error2);
|
|
24501
24501
|
if (request.body && request.body instanceof Stream.Readable) {
|
|
24502
|
-
destroyStream(request.body,
|
|
24502
|
+
destroyStream(request.body, error2);
|
|
24503
24503
|
}
|
|
24504
24504
|
if (!response || !response.body)
|
|
24505
24505
|
return;
|
|
24506
|
-
response.body.emit("error",
|
|
24506
|
+
response.body.emit("error", error2);
|
|
24507
24507
|
};
|
|
24508
24508
|
if (signal && signal.aborted) {
|
|
24509
24509
|
abort();
|
|
@@ -25691,14 +25691,14 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25691
25691
|
}
|
|
25692
25692
|
const buf = this.consume(2);
|
|
25693
25693
|
if ((buf[0] & 48) !== 0) {
|
|
25694
|
-
const
|
|
25695
|
-
cb(
|
|
25694
|
+
const error2 = this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3");
|
|
25695
|
+
cb(error2);
|
|
25696
25696
|
return;
|
|
25697
25697
|
}
|
|
25698
25698
|
const compressed = (buf[0] & 64) === 64;
|
|
25699
25699
|
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
|
25700
|
-
const
|
|
25701
|
-
cb(
|
|
25700
|
+
const error2 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
25701
|
+
cb(error2);
|
|
25702
25702
|
return;
|
|
25703
25703
|
}
|
|
25704
25704
|
this._fin = (buf[0] & 128) === 128;
|
|
@@ -25706,42 +25706,42 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25706
25706
|
this._payloadLength = buf[1] & 127;
|
|
25707
25707
|
if (this._opcode === 0) {
|
|
25708
25708
|
if (compressed) {
|
|
25709
|
-
const
|
|
25710
|
-
cb(
|
|
25709
|
+
const error2 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
25710
|
+
cb(error2);
|
|
25711
25711
|
return;
|
|
25712
25712
|
}
|
|
25713
25713
|
if (!this._fragmented) {
|
|
25714
|
-
const
|
|
25715
|
-
cb(
|
|
25714
|
+
const error2 = this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
25715
|
+
cb(error2);
|
|
25716
25716
|
return;
|
|
25717
25717
|
}
|
|
25718
25718
|
this._opcode = this._fragmented;
|
|
25719
25719
|
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
25720
25720
|
if (this._fragmented) {
|
|
25721
|
-
const
|
|
25722
|
-
cb(
|
|
25721
|
+
const error2 = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
25722
|
+
cb(error2);
|
|
25723
25723
|
return;
|
|
25724
25724
|
}
|
|
25725
25725
|
this._compressed = compressed;
|
|
25726
25726
|
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
25727
25727
|
if (!this._fin) {
|
|
25728
|
-
const
|
|
25729
|
-
cb(
|
|
25728
|
+
const error2 = this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN");
|
|
25729
|
+
cb(error2);
|
|
25730
25730
|
return;
|
|
25731
25731
|
}
|
|
25732
25732
|
if (compressed) {
|
|
25733
|
-
const
|
|
25734
|
-
cb(
|
|
25733
|
+
const error2 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
|
|
25734
|
+
cb(error2);
|
|
25735
25735
|
return;
|
|
25736
25736
|
}
|
|
25737
25737
|
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
25738
|
-
const
|
|
25739
|
-
cb(
|
|
25738
|
+
const error2 = this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");
|
|
25739
|
+
cb(error2);
|
|
25740
25740
|
return;
|
|
25741
25741
|
}
|
|
25742
25742
|
} else {
|
|
25743
|
-
const
|
|
25744
|
-
cb(
|
|
25743
|
+
const error2 = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
|
|
25744
|
+
cb(error2);
|
|
25745
25745
|
return;
|
|
25746
25746
|
}
|
|
25747
25747
|
if (!this._fin && !this._fragmented)
|
|
@@ -25749,13 +25749,13 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25749
25749
|
this._masked = (buf[1] & 128) === 128;
|
|
25750
25750
|
if (this._isServer) {
|
|
25751
25751
|
if (!this._masked) {
|
|
25752
|
-
const
|
|
25753
|
-
cb(
|
|
25752
|
+
const error2 = this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK");
|
|
25753
|
+
cb(error2);
|
|
25754
25754
|
return;
|
|
25755
25755
|
}
|
|
25756
25756
|
} else if (this._masked) {
|
|
25757
|
-
const
|
|
25758
|
-
cb(
|
|
25757
|
+
const error2 = this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK");
|
|
25758
|
+
cb(error2);
|
|
25759
25759
|
return;
|
|
25760
25760
|
}
|
|
25761
25761
|
if (this._payloadLength === 126)
|
|
@@ -25781,8 +25781,8 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25781
25781
|
const buf = this.consume(8);
|
|
25782
25782
|
const num2 = buf.readUInt32BE(0);
|
|
25783
25783
|
if (num2 > Math.pow(2, 53 - 32) - 1) {
|
|
25784
|
-
const
|
|
25785
|
-
cb(
|
|
25784
|
+
const error2 = this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");
|
|
25785
|
+
cb(error2);
|
|
25786
25786
|
return;
|
|
25787
25787
|
}
|
|
25788
25788
|
this._payloadLength = num2 * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
@@ -25792,8 +25792,8 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25792
25792
|
if (this._payloadLength && this._opcode < 8) {
|
|
25793
25793
|
this._totalPayloadLength += this._payloadLength;
|
|
25794
25794
|
if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
|
|
25795
|
-
const
|
|
25796
|
-
cb(
|
|
25795
|
+
const error2 = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
|
|
25796
|
+
cb(error2);
|
|
25797
25797
|
return;
|
|
25798
25798
|
}
|
|
25799
25799
|
}
|
|
@@ -25845,8 +25845,8 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25845
25845
|
if (buf.length) {
|
|
25846
25846
|
this._messageLength += buf.length;
|
|
25847
25847
|
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
25848
|
-
const
|
|
25849
|
-
cb(
|
|
25848
|
+
const error2 = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
|
|
25849
|
+
cb(error2);
|
|
25850
25850
|
return;
|
|
25851
25851
|
}
|
|
25852
25852
|
this._fragments.push(buf);
|
|
@@ -25892,8 +25892,8 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25892
25892
|
} else {
|
|
25893
25893
|
const buf = concat2(fragments, messageLength);
|
|
25894
25894
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
25895
|
-
const
|
|
25896
|
-
cb(
|
|
25895
|
+
const error2 = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
|
|
25896
|
+
cb(error2);
|
|
25897
25897
|
return;
|
|
25898
25898
|
}
|
|
25899
25899
|
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
@@ -25918,14 +25918,14 @@ var require_receiver = __commonJS((exports, module) => {
|
|
|
25918
25918
|
} else {
|
|
25919
25919
|
const code = data.readUInt16BE(0);
|
|
25920
25920
|
if (!isValidStatusCode(code)) {
|
|
25921
|
-
const
|
|
25922
|
-
cb(
|
|
25921
|
+
const error2 = this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE");
|
|
25922
|
+
cb(error2);
|
|
25923
25923
|
return;
|
|
25924
25924
|
}
|
|
25925
25925
|
const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
|
|
25926
25926
|
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
25927
|
-
const
|
|
25928
|
-
cb(
|
|
25927
|
+
const error2 = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
|
|
25928
|
+
cb(error2);
|
|
25929
25929
|
return;
|
|
25930
25930
|
}
|
|
25931
25931
|
this._loop = false;
|
|
@@ -26415,10 +26415,10 @@ var require_event_target = __commonJS((exports, module) => {
|
|
|
26415
26415
|
callListener(handler, this, event);
|
|
26416
26416
|
};
|
|
26417
26417
|
} else if (type === "error") {
|
|
26418
|
-
wrapper = function onError(
|
|
26418
|
+
wrapper = function onError(error2) {
|
|
26419
26419
|
const event = new ErrorEvent("error", {
|
|
26420
|
-
error:
|
|
26421
|
-
message:
|
|
26420
|
+
error: error2,
|
|
26421
|
+
message: error2.message
|
|
26422
26422
|
});
|
|
26423
26423
|
event[kTarget] = this;
|
|
26424
26424
|
callListener(handler, this, event);
|
|
@@ -27429,7 +27429,7 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
27429
27429
|
if (!duplex.push(data))
|
|
27430
27430
|
ws.pause();
|
|
27431
27431
|
});
|
|
27432
|
-
ws.once("error", function
|
|
27432
|
+
ws.once("error", function error2(err) {
|
|
27433
27433
|
if (duplex.destroyed)
|
|
27434
27434
|
return;
|
|
27435
27435
|
terminateOnDestroy = false;
|
|
@@ -27447,7 +27447,7 @@ var require_stream = __commonJS((exports, module) => {
|
|
|
27447
27447
|
return;
|
|
27448
27448
|
}
|
|
27449
27449
|
let called = false;
|
|
27450
|
-
ws.once("error", function
|
|
27450
|
+
ws.once("error", function error2(err2) {
|
|
27451
27451
|
called = true;
|
|
27452
27452
|
callback(err2);
|
|
27453
27453
|
});
|
|
@@ -28669,9 +28669,9 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
28669
28669
|
params: params || undefined,
|
|
28670
28670
|
id: rpc_id
|
|
28671
28671
|
};
|
|
28672
|
-
this.socket.send(this.dataPack.encode(message), ws_opts, (
|
|
28673
|
-
if (
|
|
28674
|
-
return reject(
|
|
28672
|
+
this.socket.send(this.dataPack.encode(message), ws_opts, (error2) => {
|
|
28673
|
+
if (error2)
|
|
28674
|
+
return reject(error2);
|
|
28675
28675
|
this.queue[rpc_id] = { promise: [resolve2, reject] };
|
|
28676
28676
|
if (timeout) {
|
|
28677
28677
|
this.queue[rpc_id].timeout = setTimeout(() => {
|
|
@@ -28700,9 +28700,9 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
28700
28700
|
method,
|
|
28701
28701
|
params
|
|
28702
28702
|
};
|
|
28703
|
-
this.socket.send(this.dataPack.encode(message), (
|
|
28704
|
-
if (
|
|
28705
|
-
return reject(
|
|
28703
|
+
this.socket.send(this.dataPack.encode(message), (error2) => {
|
|
28704
|
+
if (error2)
|
|
28705
|
+
return reject(error2);
|
|
28706
28706
|
resolve2();
|
|
28707
28707
|
});
|
|
28708
28708
|
});
|
|
@@ -28795,7 +28795,7 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
28795
28795
|
this.queue[message.id].promise[0](message.result);
|
|
28796
28796
|
delete this.queue[message.id];
|
|
28797
28797
|
});
|
|
28798
|
-
this.socket.addEventListener("error", (
|
|
28798
|
+
this.socket.addEventListener("error", (error2) => this.emit("error", error2));
|
|
28799
28799
|
this.socket.addEventListener("close", ({ code, reason }) => {
|
|
28800
28800
|
if (this.ready)
|
|
28801
28801
|
setTimeout(() => this.emit("close", code, reason), 0);
|
|
@@ -28833,7 +28833,7 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
28833
28833
|
else
|
|
28834
28834
|
socket._id = uuid.v1();
|
|
28835
28835
|
socket["_authenticated"] = false;
|
|
28836
|
-
socket.on("error", (
|
|
28836
|
+
socket.on("error", (error2) => this.emit("socket-error", socket, error2));
|
|
28837
28837
|
socket.on("close", () => {
|
|
28838
28838
|
this.namespaces[ns].clients.delete(socket._id);
|
|
28839
28839
|
for (const event of Object.keys(this.namespaces[ns].events)) {
|
|
@@ -28849,7 +28849,7 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
28849
28849
|
this.emit("connection", socket, request);
|
|
28850
28850
|
return this._handleRPC(socket, ns);
|
|
28851
28851
|
});
|
|
28852
|
-
this.wss.on("error", (
|
|
28852
|
+
this.wss.on("error", (error2) => this.emit("error", error2));
|
|
28853
28853
|
}
|
|
28854
28854
|
register(name, fn, ns = "/") {
|
|
28855
28855
|
if (!this.namespaces[ns])
|
|
@@ -28988,8 +28988,8 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
28988
28988
|
this.wss.close();
|
|
28989
28989
|
this.emit("close");
|
|
28990
28990
|
resolve2();
|
|
28991
|
-
} catch (
|
|
28992
|
-
reject(
|
|
28991
|
+
} catch (error2) {
|
|
28992
|
+
reject(error2);
|
|
28993
28993
|
}
|
|
28994
28994
|
});
|
|
28995
28995
|
}
|
|
@@ -29005,10 +29005,10 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
29005
29005
|
let parsedData;
|
|
29006
29006
|
try {
|
|
29007
29007
|
parsedData = this.dataPack.decode(data);
|
|
29008
|
-
} catch (
|
|
29008
|
+
} catch (error2) {
|
|
29009
29009
|
return socket.send(this.dataPack.encode({
|
|
29010
29010
|
jsonrpc: "2.0",
|
|
29011
|
-
error: createError(-32700,
|
|
29011
|
+
error: createError(-32700, error2.toString()),
|
|
29012
29012
|
id: null
|
|
29013
29013
|
}), msg_options);
|
|
29014
29014
|
}
|
|
@@ -29154,22 +29154,22 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
29154
29154
|
}
|
|
29155
29155
|
try {
|
|
29156
29156
|
response = await this.namespaces[ns].rpc_methods[message.method].fn(message.params, socket_id);
|
|
29157
|
-
} catch (
|
|
29157
|
+
} catch (error2) {
|
|
29158
29158
|
if (!message.id)
|
|
29159
29159
|
return;
|
|
29160
|
-
if (
|
|
29160
|
+
if (error2 instanceof Error)
|
|
29161
29161
|
return {
|
|
29162
29162
|
jsonrpc: "2.0",
|
|
29163
29163
|
error: {
|
|
29164
29164
|
code: -32000,
|
|
29165
|
-
message:
|
|
29166
|
-
data:
|
|
29165
|
+
message: error2.name,
|
|
29166
|
+
data: error2.message
|
|
29167
29167
|
},
|
|
29168
29168
|
id: message.id
|
|
29169
29169
|
};
|
|
29170
29170
|
return {
|
|
29171
29171
|
jsonrpc: "2.0",
|
|
29172
|
-
error:
|
|
29172
|
+
error: error2,
|
|
29173
29173
|
id: message.id
|
|
29174
29174
|
};
|
|
29175
29175
|
}
|
|
@@ -29213,13 +29213,13 @@ var require_dist3 = __commonJS((exports) => {
|
|
|
29213
29213
|
[-32700, "Parse error"]
|
|
29214
29214
|
]);
|
|
29215
29215
|
function createError(code, details) {
|
|
29216
|
-
const
|
|
29216
|
+
const error2 = {
|
|
29217
29217
|
code,
|
|
29218
29218
|
message: RPC_ERRORS.get(code) || "Internal Server Error"
|
|
29219
29219
|
};
|
|
29220
29220
|
if (details)
|
|
29221
|
-
|
|
29222
|
-
return
|
|
29221
|
+
error2["data"] = details;
|
|
29222
|
+
return error2;
|
|
29223
29223
|
}
|
|
29224
29224
|
var Client = class extends CommonClient {
|
|
29225
29225
|
constructor(address = "ws://localhost:8080", {
|
|
@@ -29674,7 +29674,7 @@ var require_weierstrass = __commonJS((exports) => {
|
|
|
29674
29674
|
}
|
|
29675
29675
|
try {
|
|
29676
29676
|
num2 = Fn.fromBytes(bytes);
|
|
29677
|
-
} catch (
|
|
29677
|
+
} catch (error2) {
|
|
29678
29678
|
throw new Error(`invalid private key: expected ui8a of size ${expected}, got ${typeof key}`);
|
|
29679
29679
|
}
|
|
29680
29680
|
}
|
|
@@ -30175,7 +30175,7 @@ var require_weierstrass = __commonJS((exports) => {
|
|
|
30175
30175
|
try {
|
|
30176
30176
|
normPrivateKeyToScalar(privateKey);
|
|
30177
30177
|
return true;
|
|
30178
|
-
} catch (
|
|
30178
|
+
} catch (error2) {
|
|
30179
30179
|
return false;
|
|
30180
30180
|
}
|
|
30181
30181
|
},
|
|
@@ -30316,7 +30316,7 @@ var require_weierstrass = __commonJS((exports) => {
|
|
|
30316
30316
|
_sig = Signature.fromCompact(sg);
|
|
30317
30317
|
}
|
|
30318
30318
|
P2 = Point2.fromHex(publicKey);
|
|
30319
|
-
} catch (
|
|
30319
|
+
} catch (error2) {
|
|
30320
30320
|
return false;
|
|
30321
30321
|
}
|
|
30322
30322
|
if (!_sig)
|
|
@@ -30685,7 +30685,7 @@ var require_secp256k1 = __commonJS((exports) => {
|
|
|
30685
30685
|
if (R.is0() || !hasEven2(y3) || x3 !== r4)
|
|
30686
30686
|
return false;
|
|
30687
30687
|
return true;
|
|
30688
|
-
} catch (
|
|
30688
|
+
} catch (error2) {
|
|
30689
30689
|
return false;
|
|
30690
30690
|
}
|
|
30691
30691
|
}
|
|
@@ -32782,8 +32782,8 @@ class Ed25519Program {
|
|
|
32782
32782
|
signature: signature2,
|
|
32783
32783
|
instructionIndex
|
|
32784
32784
|
});
|
|
32785
|
-
} catch (
|
|
32786
|
-
throw new Error(`Error creating instruction; ${
|
|
32785
|
+
} catch (error2) {
|
|
32786
|
+
throw new Error(`Error creating instruction; ${error2}`);
|
|
32787
32787
|
}
|
|
32788
32788
|
}
|
|
32789
32789
|
}
|
|
@@ -32794,8 +32794,8 @@ class Secp256k1Program {
|
|
|
32794
32794
|
assert(publicKey2.length === PUBLIC_KEY_BYTES, `Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey2.length} bytes`);
|
|
32795
32795
|
try {
|
|
32796
32796
|
return buffer.Buffer.from(sha3.keccak_256(toBuffer(publicKey2))).slice(-ETHEREUM_ADDRESS_BYTES);
|
|
32797
|
-
} catch (
|
|
32798
|
-
throw new Error(`Error constructing Ethereum address: ${
|
|
32797
|
+
} catch (error2) {
|
|
32798
|
+
throw new Error(`Error constructing Ethereum address: ${error2}`);
|
|
32799
32799
|
}
|
|
32800
32800
|
}
|
|
32801
32801
|
static createInstructionWithPublicKey(params) {
|
|
@@ -32878,8 +32878,8 @@ class Secp256k1Program {
|
|
|
32878
32878
|
recoveryId,
|
|
32879
32879
|
instructionIndex
|
|
32880
32880
|
});
|
|
32881
|
-
} catch (
|
|
32882
|
-
throw new Error(`Error creating instruction; ${
|
|
32881
|
+
} catch (error2) {
|
|
32882
|
+
throw new Error(`Error creating instruction; ${error2}`);
|
|
32883
32883
|
}
|
|
32884
32884
|
}
|
|
32885
32885
|
}
|
|
@@ -37867,8 +37867,8 @@ var util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
|
37867
37867
|
get error() {
|
|
37868
37868
|
if (this._error)
|
|
37869
37869
|
return this._error;
|
|
37870
|
-
const
|
|
37871
|
-
this._error =
|
|
37870
|
+
const error2 = new ZodError(ctx.common.issues);
|
|
37871
|
+
this._error = error2;
|
|
37872
37872
|
return this._error;
|
|
37873
37873
|
}
|
|
37874
37874
|
};
|
|
@@ -38060,8 +38060,8 @@ var init_lib = __esm(() => {
|
|
|
38060
38060
|
return issue.message;
|
|
38061
38061
|
};
|
|
38062
38062
|
const fieldErrors = { _errors: [] };
|
|
38063
|
-
const processError = (
|
|
38064
|
-
for (const issue of
|
|
38063
|
+
const processError = (error2) => {
|
|
38064
|
+
for (const issue of error2.issues) {
|
|
38065
38065
|
if (issue.code === "invalid_union") {
|
|
38066
38066
|
issue.unionErrors.map(processError);
|
|
38067
38067
|
} else if (issue.code === "invalid_return_type") {
|
|
@@ -38118,8 +38118,8 @@ var init_lib = __esm(() => {
|
|
|
38118
38118
|
}
|
|
38119
38119
|
};
|
|
38120
38120
|
ZodError.create = (issues) => {
|
|
38121
|
-
const
|
|
38122
|
-
return
|
|
38121
|
+
const error2 = new ZodError(issues);
|
|
38122
|
+
return error2;
|
|
38123
38123
|
};
|
|
38124
38124
|
overrideErrorMap = errorMap;
|
|
38125
38125
|
EMPTY_PATH = [];
|
|
@@ -40053,7 +40053,7 @@ var init_lib = __esm(() => {
|
|
|
40053
40053
|
});
|
|
40054
40054
|
return INVALID;
|
|
40055
40055
|
}
|
|
40056
|
-
function makeArgsIssue(args,
|
|
40056
|
+
function makeArgsIssue(args, error2) {
|
|
40057
40057
|
return makeIssue({
|
|
40058
40058
|
data: args,
|
|
40059
40059
|
path: ctx.path,
|
|
@@ -40065,11 +40065,11 @@ var init_lib = __esm(() => {
|
|
|
40065
40065
|
].filter((x4) => !!x4),
|
|
40066
40066
|
issueData: {
|
|
40067
40067
|
code: ZodIssueCode.invalid_arguments,
|
|
40068
|
-
argumentsError:
|
|
40068
|
+
argumentsError: error2
|
|
40069
40069
|
}
|
|
40070
40070
|
});
|
|
40071
40071
|
}
|
|
40072
|
-
function makeReturnsIssue(returns,
|
|
40072
|
+
function makeReturnsIssue(returns, error2) {
|
|
40073
40073
|
return makeIssue({
|
|
40074
40074
|
data: returns,
|
|
40075
40075
|
path: ctx.path,
|
|
@@ -40081,7 +40081,7 @@ var init_lib = __esm(() => {
|
|
|
40081
40081
|
].filter((x4) => !!x4),
|
|
40082
40082
|
issueData: {
|
|
40083
40083
|
code: ZodIssueCode.invalid_return_type,
|
|
40084
|
-
returnTypeError:
|
|
40084
|
+
returnTypeError: error2
|
|
40085
40085
|
}
|
|
40086
40086
|
});
|
|
40087
40087
|
}
|
|
@@ -40090,15 +40090,15 @@ var init_lib = __esm(() => {
|
|
|
40090
40090
|
if (this._def.returns instanceof ZodPromise) {
|
|
40091
40091
|
const me = this;
|
|
40092
40092
|
return OK(async function(...args) {
|
|
40093
|
-
const
|
|
40093
|
+
const error2 = new ZodError([]);
|
|
40094
40094
|
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e4) => {
|
|
40095
|
-
|
|
40096
|
-
throw
|
|
40095
|
+
error2.addIssue(makeArgsIssue(args, e4));
|
|
40096
|
+
throw error2;
|
|
40097
40097
|
});
|
|
40098
40098
|
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
40099
40099
|
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e4) => {
|
|
40100
|
-
|
|
40101
|
-
throw
|
|
40100
|
+
error2.addIssue(makeReturnsIssue(result, e4));
|
|
40101
|
+
throw error2;
|
|
40102
40102
|
});
|
|
40103
40103
|
return parsedReturns;
|
|
40104
40104
|
});
|
|
@@ -43448,7 +43448,7 @@ function weierstrassPoints(opts) {
|
|
|
43448
43448
|
let num2;
|
|
43449
43449
|
try {
|
|
43450
43450
|
num2 = typeof key === "bigint" ? key : bytesToNumberBE2(ensureBytes2("private key", key, nByteLength));
|
|
43451
|
-
} catch (
|
|
43451
|
+
} catch (error2) {
|
|
43452
43452
|
throw new Error("invalid private key, expected hex or " + nByteLength + " bytes, got " + typeof key);
|
|
43453
43453
|
}
|
|
43454
43454
|
if (wrapPrivateKey)
|
|
@@ -43898,7 +43898,7 @@ function weierstrass2(curveDef) {
|
|
|
43898
43898
|
try {
|
|
43899
43899
|
normPrivateKeyToScalar(privateKey);
|
|
43900
43900
|
return true;
|
|
43901
|
-
} catch (
|
|
43901
|
+
} catch (error2) {
|
|
43902
43902
|
return false;
|
|
43903
43903
|
}
|
|
43904
43904
|
},
|
|
@@ -44037,7 +44037,7 @@ function weierstrass2(curveDef) {
|
|
|
44037
44037
|
_sig = Signature.fromCompact(sg);
|
|
44038
44038
|
}
|
|
44039
44039
|
P2 = Point2.fromHex(publicKey2);
|
|
44040
|
-
} catch (
|
|
44040
|
+
} catch (error2) {
|
|
44041
44041
|
return false;
|
|
44042
44042
|
}
|
|
44043
44043
|
if (!_sig)
|
|
@@ -44442,9 +44442,9 @@ async function parseCredentialPublicKey(response) {
|
|
|
44442
44442
|
}, true, ["verify"]);
|
|
44443
44443
|
const publicKey2 = new Uint8Array(await crypto.subtle.exportKey("raw", cryptoKey));
|
|
44444
44444
|
return from3(publicKey2);
|
|
44445
|
-
} catch (
|
|
44446
|
-
if (
|
|
44447
|
-
throw
|
|
44445
|
+
} catch (error2) {
|
|
44446
|
+
if (error2.message !== "Permission denied to access object")
|
|
44447
|
+
throw error2;
|
|
44448
44448
|
const data = new Uint8Array(response.attestationObject);
|
|
44449
44449
|
const coordinateLength = 32;
|
|
44450
44450
|
const cborPrefix = 88;
|
|
@@ -44500,9 +44500,9 @@ async function createCredential(options) {
|
|
|
44500
44500
|
publicKey: publicKey2,
|
|
44501
44501
|
raw: credential
|
|
44502
44502
|
};
|
|
44503
|
-
} catch (
|
|
44503
|
+
} catch (error2) {
|
|
44504
44504
|
throw new CredentialCreationFailedError({
|
|
44505
|
-
cause:
|
|
44505
|
+
cause: error2
|
|
44506
44506
|
});
|
|
44507
44507
|
}
|
|
44508
44508
|
}
|
|
@@ -44627,9 +44627,9 @@ async function sign4(options) {
|
|
|
44627
44627
|
signature: signature2,
|
|
44628
44628
|
raw: credential
|
|
44629
44629
|
};
|
|
44630
|
-
} catch (
|
|
44630
|
+
} catch (error2) {
|
|
44631
44631
|
throw new CredentialRequestFailedError({
|
|
44632
|
-
cause:
|
|
44632
|
+
cause: error2
|
|
44633
44633
|
});
|
|
44634
44634
|
}
|
|
44635
44635
|
}
|
|
@@ -44777,10 +44777,10 @@ var init_request = __esm(() => {
|
|
|
44777
44777
|
}
|
|
44778
44778
|
};
|
|
44779
44779
|
RpcRequestError = class RpcRequestError extends BaseError {
|
|
44780
|
-
constructor({ body, error:
|
|
44780
|
+
constructor({ body, error: error2, url }) {
|
|
44781
44781
|
super("RPC Request failed.", {
|
|
44782
|
-
cause:
|
|
44783
|
-
details:
|
|
44782
|
+
cause: error2,
|
|
44783
|
+
details: error2.message,
|
|
44784
44784
|
metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`],
|
|
44785
44785
|
name: "RpcRequestError"
|
|
44786
44786
|
});
|
|
@@ -44796,8 +44796,8 @@ var init_request = __esm(() => {
|
|
|
44796
44796
|
writable: true,
|
|
44797
44797
|
value: undefined
|
|
44798
44798
|
});
|
|
44799
|
-
this.code =
|
|
44800
|
-
this.data =
|
|
44799
|
+
this.code = error2.code;
|
|
44800
|
+
this.data = error2.data;
|
|
44801
44801
|
}
|
|
44802
44802
|
};
|
|
44803
44803
|
TimeoutError = class TimeoutError extends BaseError {
|
|
@@ -45476,8 +45476,8 @@ async function wait(time) {
|
|
|
45476
45476
|
function withRetry(fn, { delay: delay_ = 100, retryCount = 2, shouldRetry = () => true } = {}) {
|
|
45477
45477
|
return new Promise((resolve2, reject) => {
|
|
45478
45478
|
const attemptRetry = async ({ count = 0 } = {}) => {
|
|
45479
|
-
const retry = async ({ error:
|
|
45480
|
-
const delay = typeof delay_ === "function" ? delay_({ count, error:
|
|
45479
|
+
const retry = async ({ error: error2 }) => {
|
|
45480
|
+
const delay = typeof delay_ === "function" ? delay_({ count, error: error2 }) : delay_;
|
|
45481
45481
|
if (delay)
|
|
45482
45482
|
await wait(delay);
|
|
45483
45483
|
attemptRetry({ count: count + 1 });
|
|
@@ -45580,45 +45580,45 @@ function buildRequest(request, options = {}) {
|
|
|
45580
45580
|
}
|
|
45581
45581
|
}
|
|
45582
45582
|
}, {
|
|
45583
|
-
delay: ({ count, error:
|
|
45584
|
-
if (
|
|
45585
|
-
const retryAfter =
|
|
45583
|
+
delay: ({ count, error: error2 }) => {
|
|
45584
|
+
if (error2 && error2 instanceof HttpRequestError) {
|
|
45585
|
+
const retryAfter = error2?.headers?.get("Retry-After");
|
|
45586
45586
|
if (retryAfter?.match(/\d/))
|
|
45587
45587
|
return Number.parseInt(retryAfter) * 1000;
|
|
45588
45588
|
}
|
|
45589
45589
|
return ~~(1 << count) * retryDelay;
|
|
45590
45590
|
},
|
|
45591
45591
|
retryCount,
|
|
45592
|
-
shouldRetry: ({ error:
|
|
45592
|
+
shouldRetry: ({ error: error2 }) => shouldRetry(error2)
|
|
45593
45593
|
}), { enabled: dedupe, id: requestId });
|
|
45594
45594
|
};
|
|
45595
45595
|
}
|
|
45596
|
-
function shouldRetry(
|
|
45597
|
-
if ("code" in
|
|
45598
|
-
if (
|
|
45596
|
+
function shouldRetry(error2) {
|
|
45597
|
+
if ("code" in error2 && typeof error2.code === "number") {
|
|
45598
|
+
if (error2.code === -1)
|
|
45599
45599
|
return true;
|
|
45600
|
-
if (
|
|
45600
|
+
if (error2.code === LimitExceededRpcError.code)
|
|
45601
45601
|
return true;
|
|
45602
|
-
if (
|
|
45602
|
+
if (error2.code === InternalRpcError.code)
|
|
45603
45603
|
return true;
|
|
45604
45604
|
return false;
|
|
45605
45605
|
}
|
|
45606
|
-
if (
|
|
45607
|
-
if (
|
|
45606
|
+
if (error2 instanceof HttpRequestError && error2.status) {
|
|
45607
|
+
if (error2.status === 403)
|
|
45608
45608
|
return true;
|
|
45609
|
-
if (
|
|
45609
|
+
if (error2.status === 408)
|
|
45610
45610
|
return true;
|
|
45611
|
-
if (
|
|
45611
|
+
if (error2.status === 413)
|
|
45612
45612
|
return true;
|
|
45613
|
-
if (
|
|
45613
|
+
if (error2.status === 429)
|
|
45614
45614
|
return true;
|
|
45615
|
-
if (
|
|
45615
|
+
if (error2.status === 500)
|
|
45616
45616
|
return true;
|
|
45617
|
-
if (
|
|
45617
|
+
if (error2.status === 502)
|
|
45618
45618
|
return true;
|
|
45619
|
-
if (
|
|
45619
|
+
if (error2.status === 503)
|
|
45620
45620
|
return true;
|
|
45621
|
-
if (
|
|
45621
|
+
if (error2.status === 504)
|
|
45622
45622
|
return true;
|
|
45623
45623
|
return false;
|
|
45624
45624
|
}
|
|
@@ -45710,13 +45710,13 @@ function http(url, config = {}) {
|
|
|
45710
45710
|
body: body2
|
|
45711
45711
|
})
|
|
45712
45712
|
];
|
|
45713
|
-
const [{ error:
|
|
45713
|
+
const [{ error: error2, result }] = await fn(body);
|
|
45714
45714
|
if (raw)
|
|
45715
|
-
return { error:
|
|
45716
|
-
if (
|
|
45715
|
+
return { error: error2, result };
|
|
45716
|
+
if (error2)
|
|
45717
45717
|
throw new RpcRequestError({
|
|
45718
45718
|
body,
|
|
45719
|
-
error:
|
|
45719
|
+
error: error2,
|
|
45720
45720
|
url: url_
|
|
45721
45721
|
});
|
|
45722
45722
|
return result;
|
|
@@ -47918,17 +47918,17 @@ async function localBatchGatewayRequest(parameters) {
|
|
|
47918
47918
|
result: [failures, responses]
|
|
47919
47919
|
});
|
|
47920
47920
|
}
|
|
47921
|
-
function encodeError(
|
|
47922
|
-
if (
|
|
47921
|
+
function encodeError(error2) {
|
|
47922
|
+
if (error2.name === "HttpRequestError" && error2.status)
|
|
47923
47923
|
return encodeErrorResult({
|
|
47924
47924
|
abi: batchGatewayAbi,
|
|
47925
47925
|
errorName: "HttpError",
|
|
47926
|
-
args: [
|
|
47926
|
+
args: [error2.status, error2.shortMessage]
|
|
47927
47927
|
});
|
|
47928
47928
|
return encodeErrorResult({
|
|
47929
47929
|
abi: [solidityError],
|
|
47930
47930
|
errorName: "Error",
|
|
47931
|
-
args: ["shortMessage" in
|
|
47931
|
+
args: ["shortMessage" in error2 ? error2.shortMessage : error2.message]
|
|
47932
47932
|
});
|
|
47933
47933
|
}
|
|
47934
47934
|
var localBatchGatewayUrl = "x-batch-gateway:true";
|
|
@@ -47941,14 +47941,14 @@ var init_localBatchGatewayRequest = __esm(() => {
|
|
|
47941
47941
|
});
|
|
47942
47942
|
|
|
47943
47943
|
// node_modules/viem/_esm/utils/ens/encodedLabelToLabelhash.js
|
|
47944
|
-
function encodedLabelToLabelhash(
|
|
47945
|
-
if (
|
|
47944
|
+
function encodedLabelToLabelhash(label2) {
|
|
47945
|
+
if (label2.length !== 66)
|
|
47946
47946
|
return null;
|
|
47947
|
-
if (
|
|
47947
|
+
if (label2.indexOf("[") !== 0)
|
|
47948
47948
|
return null;
|
|
47949
|
-
if (
|
|
47949
|
+
if (label2.indexOf("]") !== 65)
|
|
47950
47950
|
return null;
|
|
47951
|
-
const hash2 = `0x${
|
|
47951
|
+
const hash2 = `0x${label2.slice(1, 65)}`;
|
|
47952
47952
|
if (!isHex(hash2))
|
|
47953
47953
|
return null;
|
|
47954
47954
|
return hash2;
|
|
@@ -47981,11 +47981,11 @@ function encodeLabelhash(hash2) {
|
|
|
47981
47981
|
}
|
|
47982
47982
|
|
|
47983
47983
|
// node_modules/viem/_esm/utils/ens/labelhash.js
|
|
47984
|
-
function labelhash(
|
|
47984
|
+
function labelhash(label2) {
|
|
47985
47985
|
const result = new Uint8Array(32).fill(0);
|
|
47986
|
-
if (!
|
|
47986
|
+
if (!label2)
|
|
47987
47987
|
return bytesToHex2(result);
|
|
47988
|
-
return encodedLabelToLabelhash(
|
|
47988
|
+
return encodedLabelToLabelhash(label2) || keccak256(stringToBytes(label2));
|
|
47989
47989
|
}
|
|
47990
47990
|
var init_labelhash = __esm(() => {
|
|
47991
47991
|
init_toBytes();
|
|
@@ -48032,8 +48032,8 @@ function getAction(client, actionFn, name) {
|
|
|
48032
48032
|
|
|
48033
48033
|
// node_modules/viem/_esm/utils/errors/getContractError.js
|
|
48034
48034
|
function getContractError(err, { abi, address, args, docsPath: docsPath5, functionName, sender }) {
|
|
48035
|
-
const
|
|
48036
|
-
const { code, data, details, message, shortMessage } =
|
|
48035
|
+
const error2 = err instanceof RawContractError ? err : err instanceof BaseError ? err.walk((err2) => ("data" in err2)) || err.walk() : {};
|
|
48036
|
+
const { code, data, details, message, shortMessage } = error2;
|
|
48037
48037
|
const cause = (() => {
|
|
48038
48038
|
if (err instanceof AbiDecodingZeroDataError)
|
|
48039
48039
|
return new ContractFunctionZeroDataError({ functionName });
|
|
@@ -48042,7 +48042,7 @@ function getContractError(err, { abi, address, args, docsPath: docsPath5, functi
|
|
|
48042
48042
|
abi,
|
|
48043
48043
|
data: typeof data === "object" ? data.data : data,
|
|
48044
48044
|
functionName,
|
|
48045
|
-
message:
|
|
48045
|
+
message: error2 instanceof RpcRequestError ? details : shortMessage ?? message
|
|
48046
48046
|
});
|
|
48047
48047
|
}
|
|
48048
48048
|
return err;
|
|
@@ -48965,7 +48965,7 @@ async function offchainLookup(client, { blockNumber, blockTag, data, to }) {
|
|
|
48965
48965
|
}
|
|
48966
48966
|
}
|
|
48967
48967
|
async function ccipRequest({ data, sender, urls }) {
|
|
48968
|
-
let
|
|
48968
|
+
let error2 = new Error("An unknown error occurred.");
|
|
48969
48969
|
for (let i15 = 0;i15 < urls.length; i15++) {
|
|
48970
48970
|
const url = urls[i15];
|
|
48971
48971
|
const method = url.includes("{data}") ? "GET" : "POST";
|
|
@@ -48984,7 +48984,7 @@ async function ccipRequest({ data, sender, urls }) {
|
|
|
48984
48984
|
result = await response.text();
|
|
48985
48985
|
}
|
|
48986
48986
|
if (!response.ok) {
|
|
48987
|
-
|
|
48987
|
+
error2 = new HttpRequestError({
|
|
48988
48988
|
body,
|
|
48989
48989
|
details: result?.error ? stringify(result.error) : response.statusText,
|
|
48990
48990
|
headers: response.headers,
|
|
@@ -48994,7 +48994,7 @@ async function ccipRequest({ data, sender, urls }) {
|
|
|
48994
48994
|
continue;
|
|
48995
48995
|
}
|
|
48996
48996
|
if (!isHex(result)) {
|
|
48997
|
-
|
|
48997
|
+
error2 = new OffchainLookupResponseMalformedError({
|
|
48998
48998
|
result,
|
|
48999
48999
|
url
|
|
49000
49000
|
});
|
|
@@ -49002,14 +49002,14 @@ async function ccipRequest({ data, sender, urls }) {
|
|
|
49002
49002
|
}
|
|
49003
49003
|
return result;
|
|
49004
49004
|
} catch (err) {
|
|
49005
|
-
|
|
49005
|
+
error2 = new HttpRequestError({
|
|
49006
49006
|
body,
|
|
49007
49007
|
details: err.message,
|
|
49008
49008
|
url
|
|
49009
49009
|
});
|
|
49010
49010
|
}
|
|
49011
49011
|
}
|
|
49012
|
-
throw
|
|
49012
|
+
throw error2;
|
|
49013
49013
|
}
|
|
49014
49014
|
var offchainLookupSignature = "0x556f1830", offchainLookupAbiItem;
|
|
49015
49015
|
var init_ccip2 = __esm(() => {
|
|
@@ -49233,8 +49233,8 @@ function toDeploylessCallViaFactoryData(parameters) {
|
|
|
49233
49233
|
function getRevertErrorData(err) {
|
|
49234
49234
|
if (!(err instanceof BaseError))
|
|
49235
49235
|
return;
|
|
49236
|
-
const
|
|
49237
|
-
return typeof
|
|
49236
|
+
const error2 = err.walk();
|
|
49237
|
+
return typeof error2?.data === "object" ? error2.data?.data : error2.data;
|
|
49238
49238
|
}
|
|
49239
49239
|
var init_call = __esm(() => {
|
|
49240
49240
|
init_exports();
|
|
@@ -49275,8 +49275,8 @@ async function readContract(client, parameters) {
|
|
|
49275
49275
|
functionName,
|
|
49276
49276
|
data: data || "0x"
|
|
49277
49277
|
});
|
|
49278
|
-
} catch (
|
|
49279
|
-
throw getContractError(
|
|
49278
|
+
} catch (error2) {
|
|
49279
|
+
throw getContractError(error2, {
|
|
49280
49280
|
abi,
|
|
49281
49281
|
address,
|
|
49282
49282
|
args,
|
|
@@ -49408,8 +49408,8 @@ async function isImageUri(uri) {
|
|
|
49408
49408
|
return contentType?.startsWith("image/");
|
|
49409
49409
|
}
|
|
49410
49410
|
return false;
|
|
49411
|
-
} catch (
|
|
49412
|
-
if (typeof
|
|
49411
|
+
} catch (error2) {
|
|
49412
|
+
if (typeof error2 === "object" && typeof error2.response !== "undefined") {
|
|
49413
49413
|
return false;
|
|
49414
49414
|
}
|
|
49415
49415
|
if (!globalThis.hasOwnProperty("Image"))
|
|
@@ -50702,9 +50702,9 @@ async function estimateContractGas(client, parameters) {
|
|
|
50702
50702
|
...request
|
|
50703
50703
|
});
|
|
50704
50704
|
return gas;
|
|
50705
|
-
} catch (
|
|
50705
|
+
} catch (error2) {
|
|
50706
50706
|
const account = request.account ? parseAccount2(request.account) : undefined;
|
|
50707
|
-
throw getContractError(
|
|
50707
|
+
throw getContractError(error2, {
|
|
50708
50708
|
abi,
|
|
50709
50709
|
address,
|
|
50710
50710
|
args,
|
|
@@ -51123,11 +51123,11 @@ async function getEip712Domain(client, parameters) {
|
|
|
51123
51123
|
fields
|
|
51124
51124
|
};
|
|
51125
51125
|
} catch (e7) {
|
|
51126
|
-
const
|
|
51127
|
-
if (
|
|
51126
|
+
const error2 = e7;
|
|
51127
|
+
if (error2.name === "ContractFunctionExecutionError" && error2.cause.name === "ContractFunctionZeroDataError") {
|
|
51128
51128
|
throw new Eip712DomainNotFoundError({ address });
|
|
51129
51129
|
}
|
|
51130
|
-
throw
|
|
51130
|
+
throw error2;
|
|
51131
51131
|
}
|
|
51132
51132
|
}
|
|
51133
51133
|
var abi;
|
|
@@ -51414,7 +51414,7 @@ async function multicall(client, parameters) {
|
|
|
51414
51414
|
}
|
|
51415
51415
|
];
|
|
51416
51416
|
} catch (err) {
|
|
51417
|
-
const
|
|
51417
|
+
const error2 = getContractError(err, {
|
|
51418
51418
|
abi: abi2,
|
|
51419
51419
|
address,
|
|
51420
51420
|
args,
|
|
@@ -51423,7 +51423,7 @@ async function multicall(client, parameters) {
|
|
|
51423
51423
|
sender: account
|
|
51424
51424
|
});
|
|
51425
51425
|
if (!allowFailure)
|
|
51426
|
-
throw
|
|
51426
|
+
throw error2;
|
|
51427
51427
|
chunkedCalls[currentChunk] = [
|
|
51428
51428
|
...chunkedCalls[currentChunk],
|
|
51429
51429
|
{
|
|
@@ -51477,7 +51477,7 @@ async function multicall(client, parameters) {
|
|
|
51477
51477
|
});
|
|
51478
51478
|
results.push(allowFailure ? { result: result2, status: "success" } : result2);
|
|
51479
51479
|
} catch (err) {
|
|
51480
|
-
const
|
|
51480
|
+
const error2 = getContractError(err, {
|
|
51481
51481
|
abi: abi2,
|
|
51482
51482
|
address,
|
|
51483
51483
|
args,
|
|
@@ -51485,8 +51485,8 @@ async function multicall(client, parameters) {
|
|
|
51485
51485
|
functionName
|
|
51486
51486
|
});
|
|
51487
51487
|
if (!allowFailure)
|
|
51488
|
-
throw
|
|
51489
|
-
results.push({ error:
|
|
51488
|
+
throw error2;
|
|
51489
|
+
results.push({ error: error2, result: undefined, status: "failure" });
|
|
51490
51490
|
}
|
|
51491
51491
|
}
|
|
51492
51492
|
}
|
|
@@ -51554,17 +51554,17 @@ async function simulateBlocks(client, parameters) {
|
|
|
51554
51554
|
data,
|
|
51555
51555
|
functionName
|
|
51556
51556
|
}) : null;
|
|
51557
|
-
const
|
|
51557
|
+
const error2 = (() => {
|
|
51558
51558
|
if (status === "success")
|
|
51559
51559
|
return;
|
|
51560
|
-
let
|
|
51560
|
+
let error3 = undefined;
|
|
51561
51561
|
if (call2.error?.data === "0x")
|
|
51562
|
-
|
|
51562
|
+
error3 = new AbiDecodingZeroDataError;
|
|
51563
51563
|
else if (call2.error)
|
|
51564
|
-
|
|
51565
|
-
if (!
|
|
51564
|
+
error3 = new RawContractError(call2.error);
|
|
51565
|
+
if (!error3)
|
|
51566
51566
|
return;
|
|
51567
|
-
return getContractError(
|
|
51567
|
+
return getContractError(error3, {
|
|
51568
51568
|
abi: abi2 ?? [],
|
|
51569
51569
|
address: to ?? "0x",
|
|
51570
51570
|
args,
|
|
@@ -51579,17 +51579,17 @@ async function simulateBlocks(client, parameters) {
|
|
|
51579
51579
|
...status === "success" ? {
|
|
51580
51580
|
result: result2
|
|
51581
51581
|
} : {
|
|
51582
|
-
error:
|
|
51582
|
+
error: error2
|
|
51583
51583
|
}
|
|
51584
51584
|
};
|
|
51585
51585
|
})
|
|
51586
51586
|
}));
|
|
51587
51587
|
} catch (e7) {
|
|
51588
51588
|
const cause = e7;
|
|
51589
|
-
const
|
|
51590
|
-
if (
|
|
51589
|
+
const error2 = getNodeError(cause, {});
|
|
51590
|
+
if (error2 instanceof UnknownNodeError)
|
|
51591
51591
|
throw cause;
|
|
51592
|
-
throw
|
|
51592
|
+
throw error2;
|
|
51593
51593
|
}
|
|
51594
51594
|
}
|
|
51595
51595
|
var init_simulateBlocks = __esm(() => {
|
|
@@ -53567,8 +53567,8 @@ async function simulateContract(client, parameters) {
|
|
|
53567
53567
|
account
|
|
53568
53568
|
}
|
|
53569
53569
|
};
|
|
53570
|
-
} catch (
|
|
53571
|
-
throw getContractError(
|
|
53570
|
+
} catch (error2) {
|
|
53571
|
+
throw getContractError(error2, {
|
|
53572
53572
|
abi: abi2,
|
|
53573
53573
|
address,
|
|
53574
53574
|
args,
|
|
@@ -53660,16 +53660,16 @@ async function verifyHash2(client, parameters) {
|
|
|
53660
53660
|
};
|
|
53661
53661
|
const { data } = await getAction(client, call, "call")(args);
|
|
53662
53662
|
return hexToBool(data ?? "0x0");
|
|
53663
|
-
} catch (
|
|
53663
|
+
} catch (error2) {
|
|
53664
53664
|
try {
|
|
53665
53665
|
const verified = isAddressEqual(getAddress(address), await recoverAddress({ hash: hash2, signature: signature2 }));
|
|
53666
53666
|
if (verified)
|
|
53667
53667
|
return true;
|
|
53668
53668
|
} catch {}
|
|
53669
|
-
if (
|
|
53669
|
+
if (error2 instanceof CallExecutionError) {
|
|
53670
53670
|
return false;
|
|
53671
53671
|
}
|
|
53672
|
-
throw
|
|
53672
|
+
throw error2;
|
|
53673
53673
|
}
|
|
53674
53674
|
}
|
|
53675
53675
|
var init_verifyHash = __esm(() => {
|
|
@@ -53869,8 +53869,8 @@ function watchBlockNumber(client, { emitOnBegin = false, emitMissed = false, onB
|
|
|
53869
53869
|
emit.onBlockNumber(blockNumber, prevBlockNumber);
|
|
53870
53870
|
prevBlockNumber = blockNumber;
|
|
53871
53871
|
},
|
|
53872
|
-
onError(
|
|
53873
|
-
emit.onError?.(
|
|
53872
|
+
onError(error2) {
|
|
53873
|
+
emit.onError?.(error2);
|
|
53874
53874
|
}
|
|
53875
53875
|
});
|
|
53876
53876
|
unsubscribe = unsubscribe_;
|
|
@@ -53986,7 +53986,7 @@ async function waitForTransactionReceipt(client, parameters) {
|
|
|
53986
53986
|
}), {
|
|
53987
53987
|
delay: retryDelay,
|
|
53988
53988
|
retryCount,
|
|
53989
|
-
shouldRetry: ({ error:
|
|
53989
|
+
shouldRetry: ({ error: error2 }) => error2 instanceof BlockNotFoundError
|
|
53990
53990
|
});
|
|
53991
53991
|
retrying = false;
|
|
53992
53992
|
const replacementTransaction = block.transactions.find(({ from: from8, nonce }) => from8 === replacedTransaction.from && nonce === replacedTransaction.nonce);
|
|
@@ -54133,8 +54133,8 @@ function watchBlocks(client, { blockTag = client.experimental_blockTag ?? "lates
|
|
|
54133
54133
|
emitFetched = false;
|
|
54134
54134
|
prevBlock = block;
|
|
54135
54135
|
},
|
|
54136
|
-
onError(
|
|
54137
|
-
onError?.(
|
|
54136
|
+
onError(error2) {
|
|
54137
|
+
onError?.(error2);
|
|
54138
54138
|
}
|
|
54139
54139
|
});
|
|
54140
54140
|
unsubscribe = unsubscribe_;
|
|
@@ -54311,8 +54311,8 @@ function watchContractEvent(client, parameters) {
|
|
|
54311
54311
|
emit.onLogs([formatted]);
|
|
54312
54312
|
}
|
|
54313
54313
|
},
|
|
54314
|
-
onError(
|
|
54315
|
-
emit.onError?.(
|
|
54314
|
+
onError(error2) {
|
|
54315
|
+
emit.onError?.(error2);
|
|
54316
54316
|
}
|
|
54317
54317
|
});
|
|
54318
54318
|
unsubscribe = unsubscribe_;
|
|
@@ -54486,8 +54486,8 @@ function watchEvent(client, { address, args, batch = true, event, events, fromBl
|
|
|
54486
54486
|
onLogs([formatted]);
|
|
54487
54487
|
}
|
|
54488
54488
|
},
|
|
54489
|
-
onError(
|
|
54490
|
-
onError?.(
|
|
54489
|
+
onError(error2) {
|
|
54490
|
+
onError?.(error2);
|
|
54491
54491
|
}
|
|
54492
54492
|
});
|
|
54493
54493
|
unsubscribe = unsubscribe_;
|
|
@@ -54572,8 +54572,8 @@ function watchPendingTransactions(client, { batch = true, onError, onTransaction
|
|
|
54572
54572
|
const transaction = data.result;
|
|
54573
54573
|
onTransactions([transaction]);
|
|
54574
54574
|
},
|
|
54575
|
-
onError(
|
|
54576
|
-
onError?.(
|
|
54575
|
+
onError(error2) {
|
|
54576
|
+
onError?.(error2);
|
|
54577
54577
|
}
|
|
54578
54578
|
});
|
|
54579
54579
|
unsubscribe = unsubscribe_;
|
|
@@ -58872,10 +58872,10 @@ var init_util = __esm(() => {
|
|
|
58872
58872
|
});
|
|
58873
58873
|
|
|
58874
58874
|
// node_modules/mppx/node_modules/zod/v4/core/errors.js
|
|
58875
|
-
function flattenError(
|
|
58875
|
+
function flattenError(error2, mapper = (issue2) => issue2.message) {
|
|
58876
58876
|
const fieldErrors = {};
|
|
58877
58877
|
const formErrors = [];
|
|
58878
|
-
for (const sub of
|
|
58878
|
+
for (const sub of error2.issues) {
|
|
58879
58879
|
if (sub.path.length > 0) {
|
|
58880
58880
|
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
58881
58881
|
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
@@ -58885,10 +58885,10 @@ function flattenError(error3, mapper = (issue2) => issue2.message) {
|
|
|
58885
58885
|
}
|
|
58886
58886
|
return { formErrors, fieldErrors };
|
|
58887
58887
|
}
|
|
58888
|
-
function formatError(
|
|
58888
|
+
function formatError(error2, mapper = (issue2) => issue2.message) {
|
|
58889
58889
|
const fieldErrors = { _errors: [] };
|
|
58890
|
-
const processError = (
|
|
58891
|
-
for (const issue2 of
|
|
58890
|
+
const processError = (error3) => {
|
|
58891
|
+
for (const issue2 of error3.issues) {
|
|
58892
58892
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
58893
58893
|
issue2.errors.map((issues) => processError({ issues }));
|
|
58894
58894
|
} else if (issue2.code === "invalid_key") {
|
|
@@ -58915,14 +58915,14 @@ function formatError(error3, mapper = (issue2) => issue2.message) {
|
|
|
58915
58915
|
}
|
|
58916
58916
|
}
|
|
58917
58917
|
};
|
|
58918
|
-
processError(
|
|
58918
|
+
processError(error2);
|
|
58919
58919
|
return fieldErrors;
|
|
58920
58920
|
}
|
|
58921
|
-
function treeifyError(
|
|
58921
|
+
function treeifyError(error2, mapper = (issue2) => issue2.message) {
|
|
58922
58922
|
const result = { errors: [] };
|
|
58923
|
-
const processError = (
|
|
58923
|
+
const processError = (error3, path = []) => {
|
|
58924
58924
|
var _a, _b;
|
|
58925
|
-
for (const issue2 of
|
|
58925
|
+
for (const issue2 of error3.issues) {
|
|
58926
58926
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
58927
58927
|
issue2.errors.map((issues) => processError({ issues }, issue2.path));
|
|
58928
58928
|
} else if (issue2.code === "invalid_key") {
|
|
@@ -58957,7 +58957,7 @@ function treeifyError(error3, mapper = (issue2) => issue2.message) {
|
|
|
58957
58957
|
}
|
|
58958
58958
|
}
|
|
58959
58959
|
};
|
|
58960
|
-
processError(
|
|
58960
|
+
processError(error2);
|
|
58961
58961
|
return result;
|
|
58962
58962
|
}
|
|
58963
58963
|
function toDotPath(_path) {
|
|
@@ -58978,9 +58978,9 @@ function toDotPath(_path) {
|
|
|
58978
58978
|
}
|
|
58979
58979
|
return segs.join("");
|
|
58980
58980
|
}
|
|
58981
|
-
function prettifyError(
|
|
58981
|
+
function prettifyError(error2) {
|
|
58982
58982
|
const lines = [];
|
|
58983
|
-
const issues = [...
|
|
58983
|
+
const issues = [...error2.issues].sort((a18, b9) => (a18.path ?? []).length - (b9.path ?? []).length);
|
|
58984
58984
|
for (const issue2 of issues) {
|
|
58985
58985
|
lines.push(`✖ ${issue2.message}`);
|
|
58986
58986
|
if (issue2.path?.length)
|
|
@@ -61827,10 +61827,10 @@ var init_schemas = __esm(() => {
|
|
|
61827
61827
|
// node_modules/mppx/node_modules/zod/v4/locales/ar.js
|
|
61828
61828
|
function ar_default() {
|
|
61829
61829
|
return {
|
|
61830
|
-
localeError:
|
|
61830
|
+
localeError: error2()
|
|
61831
61831
|
};
|
|
61832
61832
|
}
|
|
61833
|
-
var
|
|
61833
|
+
var error2 = () => {
|
|
61834
61834
|
const Sizable = {
|
|
61835
61835
|
string: { unit: "حرف", verb: "أن يحوي" },
|
|
61836
61836
|
file: { unit: "بايت", verb: "أن يحوي" },
|
|
@@ -61937,10 +61937,10 @@ var init_ar = __esm(() => {
|
|
|
61937
61937
|
// node_modules/mppx/node_modules/zod/v4/locales/az.js
|
|
61938
61938
|
function az_default() {
|
|
61939
61939
|
return {
|
|
61940
|
-
localeError:
|
|
61940
|
+
localeError: error3()
|
|
61941
61941
|
};
|
|
61942
61942
|
}
|
|
61943
|
-
var
|
|
61943
|
+
var error3 = () => {
|
|
61944
61944
|
const Sizable = {
|
|
61945
61945
|
string: { unit: "simvol", verb: "olmalıdır" },
|
|
61946
61946
|
file: { unit: "bayt", verb: "olmalıdır" },
|
|
@@ -62061,10 +62061,10 @@ function getBelarusianPlural(count, one, few, many) {
|
|
|
62061
62061
|
}
|
|
62062
62062
|
function be_default() {
|
|
62063
62063
|
return {
|
|
62064
|
-
localeError:
|
|
62064
|
+
localeError: error4()
|
|
62065
62065
|
};
|
|
62066
62066
|
}
|
|
62067
|
-
var
|
|
62067
|
+
var error4 = () => {
|
|
62068
62068
|
const Sizable = {
|
|
62069
62069
|
string: {
|
|
62070
62070
|
unit: {
|
|
@@ -62206,10 +62206,10 @@ var init_be = __esm(() => {
|
|
|
62206
62206
|
// node_modules/mppx/node_modules/zod/v4/locales/bg.js
|
|
62207
62207
|
function bg_default() {
|
|
62208
62208
|
return {
|
|
62209
|
-
localeError:
|
|
62209
|
+
localeError: error5()
|
|
62210
62210
|
};
|
|
62211
62211
|
}
|
|
62212
|
-
var
|
|
62212
|
+
var error5 = () => {
|
|
62213
62213
|
const Sizable = {
|
|
62214
62214
|
string: { unit: "символа", verb: "да съдържа" },
|
|
62215
62215
|
file: { unit: "байта", verb: "да съдържа" },
|
|
@@ -62330,10 +62330,10 @@ var init_bg = __esm(() => {
|
|
|
62330
62330
|
// node_modules/mppx/node_modules/zod/v4/locales/ca.js
|
|
62331
62331
|
function ca_default() {
|
|
62332
62332
|
return {
|
|
62333
|
-
localeError:
|
|
62333
|
+
localeError: error6()
|
|
62334
62334
|
};
|
|
62335
62335
|
}
|
|
62336
|
-
var
|
|
62336
|
+
var error6 = () => {
|
|
62337
62337
|
const Sizable = {
|
|
62338
62338
|
string: { unit: "caràcters", verb: "contenir" },
|
|
62339
62339
|
file: { unit: "bytes", verb: "contenir" },
|
|
@@ -62441,10 +62441,10 @@ var init_ca = __esm(() => {
|
|
|
62441
62441
|
// node_modules/mppx/node_modules/zod/v4/locales/cs.js
|
|
62442
62442
|
function cs_default() {
|
|
62443
62443
|
return {
|
|
62444
|
-
localeError:
|
|
62444
|
+
localeError: error7()
|
|
62445
62445
|
};
|
|
62446
62446
|
}
|
|
62447
|
-
var
|
|
62447
|
+
var error7 = () => {
|
|
62448
62448
|
const Sizable = {
|
|
62449
62449
|
string: { unit: "znaků", verb: "mít" },
|
|
62450
62450
|
file: { unit: "bajtů", verb: "mít" },
|
|
@@ -62556,10 +62556,10 @@ var init_cs = __esm(() => {
|
|
|
62556
62556
|
// node_modules/mppx/node_modules/zod/v4/locales/da.js
|
|
62557
62557
|
function da_default() {
|
|
62558
62558
|
return {
|
|
62559
|
-
localeError:
|
|
62559
|
+
localeError: error8()
|
|
62560
62560
|
};
|
|
62561
62561
|
}
|
|
62562
|
-
var
|
|
62562
|
+
var error8 = () => {
|
|
62563
62563
|
const Sizable = {
|
|
62564
62564
|
string: { unit: "tegn", verb: "havde" },
|
|
62565
62565
|
file: { unit: "bytes", verb: "havde" },
|
|
@@ -62675,10 +62675,10 @@ var init_da = __esm(() => {
|
|
|
62675
62675
|
// node_modules/mppx/node_modules/zod/v4/locales/de.js
|
|
62676
62676
|
function de_default() {
|
|
62677
62677
|
return {
|
|
62678
|
-
localeError:
|
|
62678
|
+
localeError: error9()
|
|
62679
62679
|
};
|
|
62680
62680
|
}
|
|
62681
|
-
var
|
|
62681
|
+
var error9 = () => {
|
|
62682
62682
|
const Sizable = {
|
|
62683
62683
|
string: { unit: "Zeichen", verb: "zu haben" },
|
|
62684
62684
|
file: { unit: "Bytes", verb: "zu haben" },
|
|
@@ -62787,10 +62787,10 @@ var init_de = __esm(() => {
|
|
|
62787
62787
|
// node_modules/mppx/node_modules/zod/v4/locales/en.js
|
|
62788
62788
|
function en_default() {
|
|
62789
62789
|
return {
|
|
62790
|
-
localeError:
|
|
62790
|
+
localeError: error10()
|
|
62791
62791
|
};
|
|
62792
62792
|
}
|
|
62793
|
-
var
|
|
62793
|
+
var error10 = () => {
|
|
62794
62794
|
const Sizable = {
|
|
62795
62795
|
string: { unit: "characters", verb: "to have" },
|
|
62796
62796
|
file: { unit: "bytes", verb: "to have" },
|
|
@@ -62897,10 +62897,10 @@ var init_en = __esm(() => {
|
|
|
62897
62897
|
// node_modules/mppx/node_modules/zod/v4/locales/eo.js
|
|
62898
62898
|
function eo_default() {
|
|
62899
62899
|
return {
|
|
62900
|
-
localeError:
|
|
62900
|
+
localeError: error11()
|
|
62901
62901
|
};
|
|
62902
62902
|
}
|
|
62903
|
-
var
|
|
62903
|
+
var error11 = () => {
|
|
62904
62904
|
const Sizable = {
|
|
62905
62905
|
string: { unit: "karaktrojn", verb: "havi" },
|
|
62906
62906
|
file: { unit: "bajtojn", verb: "havi" },
|
|
@@ -63010,10 +63010,10 @@ var init_eo = __esm(() => {
|
|
|
63010
63010
|
// node_modules/mppx/node_modules/zod/v4/locales/es.js
|
|
63011
63011
|
function es_default() {
|
|
63012
63012
|
return {
|
|
63013
|
-
localeError:
|
|
63013
|
+
localeError: error12()
|
|
63014
63014
|
};
|
|
63015
63015
|
}
|
|
63016
|
-
var
|
|
63016
|
+
var error12 = () => {
|
|
63017
63017
|
const Sizable = {
|
|
63018
63018
|
string: { unit: "caracteres", verb: "tener" },
|
|
63019
63019
|
file: { unit: "bytes", verb: "tener" },
|
|
@@ -63146,10 +63146,10 @@ var init_es = __esm(() => {
|
|
|
63146
63146
|
// node_modules/mppx/node_modules/zod/v4/locales/fa.js
|
|
63147
63147
|
function fa_default() {
|
|
63148
63148
|
return {
|
|
63149
|
-
localeError:
|
|
63149
|
+
localeError: error13()
|
|
63150
63150
|
};
|
|
63151
63151
|
}
|
|
63152
|
-
var
|
|
63152
|
+
var error13 = () => {
|
|
63153
63153
|
const Sizable = {
|
|
63154
63154
|
string: { unit: "کاراکتر", verb: "داشته باشد" },
|
|
63155
63155
|
file: { unit: "بایت", verb: "داشته باشد" },
|
|
@@ -63264,10 +63264,10 @@ var init_fa = __esm(() => {
|
|
|
63264
63264
|
// node_modules/mppx/node_modules/zod/v4/locales/fi.js
|
|
63265
63265
|
function fi_default() {
|
|
63266
63266
|
return {
|
|
63267
|
-
localeError:
|
|
63267
|
+
localeError: error14()
|
|
63268
63268
|
};
|
|
63269
63269
|
}
|
|
63270
|
-
var
|
|
63270
|
+
var error14 = () => {
|
|
63271
63271
|
const Sizable = {
|
|
63272
63272
|
string: { unit: "merkkiä", subject: "merkkijonon" },
|
|
63273
63273
|
file: { unit: "tavua", subject: "tiedoston" },
|
|
@@ -63380,10 +63380,10 @@ var init_fi = __esm(() => {
|
|
|
63380
63380
|
// node_modules/mppx/node_modules/zod/v4/locales/fr.js
|
|
63381
63381
|
function fr_default() {
|
|
63382
63382
|
return {
|
|
63383
|
-
localeError:
|
|
63383
|
+
localeError: error15()
|
|
63384
63384
|
};
|
|
63385
63385
|
}
|
|
63386
|
-
var
|
|
63386
|
+
var error15 = () => {
|
|
63387
63387
|
const Sizable = {
|
|
63388
63388
|
string: { unit: "caractères", verb: "avoir" },
|
|
63389
63389
|
file: { unit: "octets", verb: "avoir" },
|
|
@@ -63492,10 +63492,10 @@ var init_fr = __esm(() => {
|
|
|
63492
63492
|
// node_modules/mppx/node_modules/zod/v4/locales/fr-CA.js
|
|
63493
63493
|
function fr_CA_default() {
|
|
63494
63494
|
return {
|
|
63495
|
-
localeError:
|
|
63495
|
+
localeError: error16()
|
|
63496
63496
|
};
|
|
63497
63497
|
}
|
|
63498
|
-
var
|
|
63498
|
+
var error16 = () => {
|
|
63499
63499
|
const Sizable = {
|
|
63500
63500
|
string: { unit: "caractères", verb: "avoir" },
|
|
63501
63501
|
file: { unit: "octets", verb: "avoir" },
|
|
@@ -63603,10 +63603,10 @@ var init_fr_CA = __esm(() => {
|
|
|
63603
63603
|
// node_modules/mppx/node_modules/zod/v4/locales/he.js
|
|
63604
63604
|
function he_default() {
|
|
63605
63605
|
return {
|
|
63606
|
-
localeError:
|
|
63606
|
+
localeError: error17()
|
|
63607
63607
|
};
|
|
63608
63608
|
}
|
|
63609
|
-
var
|
|
63609
|
+
var error17 = () => {
|
|
63610
63610
|
const TypeNames = {
|
|
63611
63611
|
string: { label: "מחרוזת", gender: "f" },
|
|
63612
63612
|
number: { label: "מספר", gender: "m" },
|
|
@@ -63800,10 +63800,10 @@ var init_he = __esm(() => {
|
|
|
63800
63800
|
// node_modules/mppx/node_modules/zod/v4/locales/hu.js
|
|
63801
63801
|
function hu_default() {
|
|
63802
63802
|
return {
|
|
63803
|
-
localeError:
|
|
63803
|
+
localeError: error18()
|
|
63804
63804
|
};
|
|
63805
63805
|
}
|
|
63806
|
-
var
|
|
63806
|
+
var error18 = () => {
|
|
63807
63807
|
const Sizable = {
|
|
63808
63808
|
string: { unit: "karakter", verb: "legyen" },
|
|
63809
63809
|
file: { unit: "byte", verb: "legyen" },
|
|
@@ -63922,10 +63922,10 @@ function withDefiniteArticle(word) {
|
|
|
63922
63922
|
}
|
|
63923
63923
|
function hy_default() {
|
|
63924
63924
|
return {
|
|
63925
|
-
localeError:
|
|
63925
|
+
localeError: error19()
|
|
63926
63926
|
};
|
|
63927
63927
|
}
|
|
63928
|
-
var
|
|
63928
|
+
var error19 = () => {
|
|
63929
63929
|
const Sizable = {
|
|
63930
63930
|
string: {
|
|
63931
63931
|
unit: {
|
|
@@ -64063,10 +64063,10 @@ var init_hy = __esm(() => {
|
|
|
64063
64063
|
// node_modules/mppx/node_modules/zod/v4/locales/id.js
|
|
64064
64064
|
function id_default() {
|
|
64065
64065
|
return {
|
|
64066
|
-
localeError:
|
|
64066
|
+
localeError: error20()
|
|
64067
64067
|
};
|
|
64068
64068
|
}
|
|
64069
|
-
var
|
|
64069
|
+
var error20 = () => {
|
|
64070
64070
|
const Sizable = {
|
|
64071
64071
|
string: { unit: "karakter", verb: "memiliki" },
|
|
64072
64072
|
file: { unit: "byte", verb: "memiliki" },
|
|
@@ -64173,10 +64173,10 @@ var init_id2 = __esm(() => {
|
|
|
64173
64173
|
// node_modules/mppx/node_modules/zod/v4/locales/is.js
|
|
64174
64174
|
function is_default() {
|
|
64175
64175
|
return {
|
|
64176
|
-
localeError:
|
|
64176
|
+
localeError: error21()
|
|
64177
64177
|
};
|
|
64178
64178
|
}
|
|
64179
|
-
var
|
|
64179
|
+
var error21 = () => {
|
|
64180
64180
|
const Sizable = {
|
|
64181
64181
|
string: { unit: "stafi", verb: "að hafa" },
|
|
64182
64182
|
file: { unit: "bæti", verb: "að hafa" },
|
|
@@ -64286,10 +64286,10 @@ var init_is = __esm(() => {
|
|
|
64286
64286
|
// node_modules/mppx/node_modules/zod/v4/locales/it.js
|
|
64287
64287
|
function it_default() {
|
|
64288
64288
|
return {
|
|
64289
|
-
localeError:
|
|
64289
|
+
localeError: error22()
|
|
64290
64290
|
};
|
|
64291
64291
|
}
|
|
64292
|
-
var
|
|
64292
|
+
var error22 = () => {
|
|
64293
64293
|
const Sizable = {
|
|
64294
64294
|
string: { unit: "caratteri", verb: "avere" },
|
|
64295
64295
|
file: { unit: "byte", verb: "avere" },
|
|
@@ -64398,10 +64398,10 @@ var init_it = __esm(() => {
|
|
|
64398
64398
|
// node_modules/mppx/node_modules/zod/v4/locales/ja.js
|
|
64399
64399
|
function ja_default() {
|
|
64400
64400
|
return {
|
|
64401
|
-
localeError:
|
|
64401
|
+
localeError: error23()
|
|
64402
64402
|
};
|
|
64403
64403
|
}
|
|
64404
|
-
var
|
|
64404
|
+
var error23 = () => {
|
|
64405
64405
|
const Sizable = {
|
|
64406
64406
|
string: { unit: "文字", verb: "である" },
|
|
64407
64407
|
file: { unit: "バイト", verb: "である" },
|
|
@@ -64509,10 +64509,10 @@ var init_ja = __esm(() => {
|
|
|
64509
64509
|
// node_modules/mppx/node_modules/zod/v4/locales/ka.js
|
|
64510
64510
|
function ka_default() {
|
|
64511
64511
|
return {
|
|
64512
|
-
localeError:
|
|
64512
|
+
localeError: error24()
|
|
64513
64513
|
};
|
|
64514
64514
|
}
|
|
64515
|
-
var
|
|
64515
|
+
var error24 = () => {
|
|
64516
64516
|
const Sizable = {
|
|
64517
64517
|
string: { unit: "სიმბოლო", verb: "უნდა შეიცავდეს" },
|
|
64518
64518
|
file: { unit: "ბაიტი", verb: "უნდა შეიცავდეს" },
|
|
@@ -64625,10 +64625,10 @@ var init_ka = __esm(() => {
|
|
|
64625
64625
|
// node_modules/mppx/node_modules/zod/v4/locales/km.js
|
|
64626
64626
|
function km_default() {
|
|
64627
64627
|
return {
|
|
64628
|
-
localeError:
|
|
64628
|
+
localeError: error25()
|
|
64629
64629
|
};
|
|
64630
64630
|
}
|
|
64631
|
-
var
|
|
64631
|
+
var error25 = () => {
|
|
64632
64632
|
const Sizable = {
|
|
64633
64633
|
string: { unit: "តួអក្សរ", verb: "គួរមាន" },
|
|
64634
64634
|
file: { unit: "បៃ", verb: "គួរមាន" },
|
|
@@ -64747,10 +64747,10 @@ var init_kh = __esm(() => {
|
|
|
64747
64747
|
// node_modules/mppx/node_modules/zod/v4/locales/ko.js
|
|
64748
64748
|
function ko_default() {
|
|
64749
64749
|
return {
|
|
64750
|
-
localeError:
|
|
64750
|
+
localeError: error26()
|
|
64751
64751
|
};
|
|
64752
64752
|
}
|
|
64753
|
-
var
|
|
64753
|
+
var error26 = () => {
|
|
64754
64754
|
const Sizable = {
|
|
64755
64755
|
string: { unit: "문자", verb: "to have" },
|
|
64756
64756
|
file: { unit: "바이트", verb: "to have" },
|
|
@@ -64872,12 +64872,12 @@ function getUnitTypeFromNumber(number2) {
|
|
|
64872
64872
|
}
|
|
64873
64873
|
function lt_default() {
|
|
64874
64874
|
return {
|
|
64875
|
-
localeError:
|
|
64875
|
+
localeError: error27()
|
|
64876
64876
|
};
|
|
64877
64877
|
}
|
|
64878
64878
|
var capitalizeFirstCharacter = (text) => {
|
|
64879
64879
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
64880
|
-
},
|
|
64880
|
+
}, error27 = () => {
|
|
64881
64881
|
const Sizable = {
|
|
64882
64882
|
string: {
|
|
64883
64883
|
unit: {
|
|
@@ -65068,10 +65068,10 @@ var init_lt = __esm(() => {
|
|
|
65068
65068
|
// node_modules/mppx/node_modules/zod/v4/locales/mk.js
|
|
65069
65069
|
function mk_default() {
|
|
65070
65070
|
return {
|
|
65071
|
-
localeError:
|
|
65071
|
+
localeError: error28()
|
|
65072
65072
|
};
|
|
65073
65073
|
}
|
|
65074
|
-
var
|
|
65074
|
+
var error28 = () => {
|
|
65075
65075
|
const Sizable = {
|
|
65076
65076
|
string: { unit: "знаци", verb: "да имаат" },
|
|
65077
65077
|
file: { unit: "бајти", verb: "да имаат" },
|
|
@@ -65181,10 +65181,10 @@ var init_mk = __esm(() => {
|
|
|
65181
65181
|
// node_modules/mppx/node_modules/zod/v4/locales/ms.js
|
|
65182
65182
|
function ms_default() {
|
|
65183
65183
|
return {
|
|
65184
|
-
localeError:
|
|
65184
|
+
localeError: error29()
|
|
65185
65185
|
};
|
|
65186
65186
|
}
|
|
65187
|
-
var
|
|
65187
|
+
var error29 = () => {
|
|
65188
65188
|
const Sizable = {
|
|
65189
65189
|
string: { unit: "aksara", verb: "mempunyai" },
|
|
65190
65190
|
file: { unit: "bait", verb: "mempunyai" },
|
|
@@ -65292,10 +65292,10 @@ var init_ms = __esm(() => {
|
|
|
65292
65292
|
// node_modules/mppx/node_modules/zod/v4/locales/nl.js
|
|
65293
65293
|
function nl_default() {
|
|
65294
65294
|
return {
|
|
65295
|
-
localeError:
|
|
65295
|
+
localeError: error30()
|
|
65296
65296
|
};
|
|
65297
65297
|
}
|
|
65298
|
-
var
|
|
65298
|
+
var error30 = () => {
|
|
65299
65299
|
const Sizable = {
|
|
65300
65300
|
string: { unit: "tekens", verb: "heeft" },
|
|
65301
65301
|
file: { unit: "bytes", verb: "heeft" },
|
|
@@ -65406,10 +65406,10 @@ var init_nl = __esm(() => {
|
|
|
65406
65406
|
// node_modules/mppx/node_modules/zod/v4/locales/no.js
|
|
65407
65407
|
function no_default() {
|
|
65408
65408
|
return {
|
|
65409
|
-
localeError:
|
|
65409
|
+
localeError: error31()
|
|
65410
65410
|
};
|
|
65411
65411
|
}
|
|
65412
|
-
var
|
|
65412
|
+
var error31 = () => {
|
|
65413
65413
|
const Sizable = {
|
|
65414
65414
|
string: { unit: "tegn", verb: "å ha" },
|
|
65415
65415
|
file: { unit: "bytes", verb: "å ha" },
|
|
@@ -65518,10 +65518,10 @@ var init_no = __esm(() => {
|
|
|
65518
65518
|
// node_modules/mppx/node_modules/zod/v4/locales/ota.js
|
|
65519
65519
|
function ota_default() {
|
|
65520
65520
|
return {
|
|
65521
|
-
localeError:
|
|
65521
|
+
localeError: error32()
|
|
65522
65522
|
};
|
|
65523
65523
|
}
|
|
65524
|
-
var
|
|
65524
|
+
var error32 = () => {
|
|
65525
65525
|
const Sizable = {
|
|
65526
65526
|
string: { unit: "harf", verb: "olmalıdır" },
|
|
65527
65527
|
file: { unit: "bayt", verb: "olmalıdır" },
|
|
@@ -65631,10 +65631,10 @@ var init_ota = __esm(() => {
|
|
|
65631
65631
|
// node_modules/mppx/node_modules/zod/v4/locales/ps.js
|
|
65632
65632
|
function ps_default() {
|
|
65633
65633
|
return {
|
|
65634
|
-
localeError:
|
|
65634
|
+
localeError: error33()
|
|
65635
65635
|
};
|
|
65636
65636
|
}
|
|
65637
|
-
var
|
|
65637
|
+
var error33 = () => {
|
|
65638
65638
|
const Sizable = {
|
|
65639
65639
|
string: { unit: "توکي", verb: "ولري" },
|
|
65640
65640
|
file: { unit: "بایټس", verb: "ولري" },
|
|
@@ -65749,10 +65749,10 @@ var init_ps = __esm(() => {
|
|
|
65749
65749
|
// node_modules/mppx/node_modules/zod/v4/locales/pl.js
|
|
65750
65750
|
function pl_default() {
|
|
65751
65751
|
return {
|
|
65752
|
-
localeError:
|
|
65752
|
+
localeError: error34()
|
|
65753
65753
|
};
|
|
65754
65754
|
}
|
|
65755
|
-
var
|
|
65755
|
+
var error34 = () => {
|
|
65756
65756
|
const Sizable = {
|
|
65757
65757
|
string: { unit: "znaków", verb: "mieć" },
|
|
65758
65758
|
file: { unit: "bajtów", verb: "mieć" },
|
|
@@ -65862,10 +65862,10 @@ var init_pl = __esm(() => {
|
|
|
65862
65862
|
// node_modules/mppx/node_modules/zod/v4/locales/pt.js
|
|
65863
65863
|
function pt_default() {
|
|
65864
65864
|
return {
|
|
65865
|
-
localeError:
|
|
65865
|
+
localeError: error35()
|
|
65866
65866
|
};
|
|
65867
65867
|
}
|
|
65868
|
-
var
|
|
65868
|
+
var error35 = () => {
|
|
65869
65869
|
const Sizable = {
|
|
65870
65870
|
string: { unit: "caracteres", verb: "ter" },
|
|
65871
65871
|
file: { unit: "bytes", verb: "ter" },
|
|
@@ -65989,10 +65989,10 @@ function getRussianPlural(count, one, few, many) {
|
|
|
65989
65989
|
}
|
|
65990
65990
|
function ru_default() {
|
|
65991
65991
|
return {
|
|
65992
|
-
localeError:
|
|
65992
|
+
localeError: error36()
|
|
65993
65993
|
};
|
|
65994
65994
|
}
|
|
65995
|
-
var
|
|
65995
|
+
var error36 = () => {
|
|
65996
65996
|
const Sizable = {
|
|
65997
65997
|
string: {
|
|
65998
65998
|
unit: {
|
|
@@ -66134,10 +66134,10 @@ var init_ru = __esm(() => {
|
|
|
66134
66134
|
// node_modules/mppx/node_modules/zod/v4/locales/sl.js
|
|
66135
66135
|
function sl_default() {
|
|
66136
66136
|
return {
|
|
66137
|
-
localeError:
|
|
66137
|
+
localeError: error37()
|
|
66138
66138
|
};
|
|
66139
66139
|
}
|
|
66140
|
-
var
|
|
66140
|
+
var error37 = () => {
|
|
66141
66141
|
const Sizable = {
|
|
66142
66142
|
string: { unit: "znakov", verb: "imeti" },
|
|
66143
66143
|
file: { unit: "bajtov", verb: "imeti" },
|
|
@@ -66247,10 +66247,10 @@ var init_sl = __esm(() => {
|
|
|
66247
66247
|
// node_modules/mppx/node_modules/zod/v4/locales/sv.js
|
|
66248
66248
|
function sv_default() {
|
|
66249
66249
|
return {
|
|
66250
|
-
localeError:
|
|
66250
|
+
localeError: error38()
|
|
66251
66251
|
};
|
|
66252
66252
|
}
|
|
66253
|
-
var
|
|
66253
|
+
var error38 = () => {
|
|
66254
66254
|
const Sizable = {
|
|
66255
66255
|
string: { unit: "tecken", verb: "att ha" },
|
|
66256
66256
|
file: { unit: "bytes", verb: "att ha" },
|
|
@@ -66361,10 +66361,10 @@ var init_sv = __esm(() => {
|
|
|
66361
66361
|
// node_modules/mppx/node_modules/zod/v4/locales/ta.js
|
|
66362
66362
|
function ta_default() {
|
|
66363
66363
|
return {
|
|
66364
|
-
localeError:
|
|
66364
|
+
localeError: error39()
|
|
66365
66365
|
};
|
|
66366
66366
|
}
|
|
66367
|
-
var
|
|
66367
|
+
var error39 = () => {
|
|
66368
66368
|
const Sizable = {
|
|
66369
66369
|
string: { unit: "எழுத்துக்கள்", verb: "கொண்டிருக்க வேண்டும்" },
|
|
66370
66370
|
file: { unit: "பைட்டுகள்", verb: "கொண்டிருக்க வேண்டும்" },
|
|
@@ -66475,10 +66475,10 @@ var init_ta = __esm(() => {
|
|
|
66475
66475
|
// node_modules/mppx/node_modules/zod/v4/locales/th.js
|
|
66476
66476
|
function th_default() {
|
|
66477
66477
|
return {
|
|
66478
|
-
localeError:
|
|
66478
|
+
localeError: error40()
|
|
66479
66479
|
};
|
|
66480
66480
|
}
|
|
66481
|
-
var
|
|
66481
|
+
var error40 = () => {
|
|
66482
66482
|
const Sizable = {
|
|
66483
66483
|
string: { unit: "ตัวอักษร", verb: "ควรมี" },
|
|
66484
66484
|
file: { unit: "ไบต์", verb: "ควรมี" },
|
|
@@ -66589,10 +66589,10 @@ var init_th = __esm(() => {
|
|
|
66589
66589
|
// node_modules/mppx/node_modules/zod/v4/locales/tr.js
|
|
66590
66590
|
function tr_default() {
|
|
66591
66591
|
return {
|
|
66592
|
-
localeError:
|
|
66592
|
+
localeError: error41()
|
|
66593
66593
|
};
|
|
66594
66594
|
}
|
|
66595
|
-
var
|
|
66595
|
+
var error41 = () => {
|
|
66596
66596
|
const Sizable = {
|
|
66597
66597
|
string: { unit: "karakter", verb: "olmalı" },
|
|
66598
66598
|
file: { unit: "bayt", verb: "olmalı" },
|
|
@@ -66698,10 +66698,10 @@ var init_tr = __esm(() => {
|
|
|
66698
66698
|
// node_modules/mppx/node_modules/zod/v4/locales/uk.js
|
|
66699
66699
|
function uk_default() {
|
|
66700
66700
|
return {
|
|
66701
|
-
localeError:
|
|
66701
|
+
localeError: error42()
|
|
66702
66702
|
};
|
|
66703
66703
|
}
|
|
66704
|
-
var
|
|
66704
|
+
var error42 = () => {
|
|
66705
66705
|
const Sizable = {
|
|
66706
66706
|
string: { unit: "символів", verb: "матиме" },
|
|
66707
66707
|
file: { unit: "байтів", verb: "матиме" },
|
|
@@ -66818,10 +66818,10 @@ var init_ua = __esm(() => {
|
|
|
66818
66818
|
// node_modules/mppx/node_modules/zod/v4/locales/ur.js
|
|
66819
66819
|
function ur_default() {
|
|
66820
66820
|
return {
|
|
66821
|
-
localeError:
|
|
66821
|
+
localeError: error43()
|
|
66822
66822
|
};
|
|
66823
66823
|
}
|
|
66824
|
-
var
|
|
66824
|
+
var error43 = () => {
|
|
66825
66825
|
const Sizable = {
|
|
66826
66826
|
string: { unit: "حروف", verb: "ہونا" },
|
|
66827
66827
|
file: { unit: "بائٹس", verb: "ہونا" },
|
|
@@ -66932,10 +66932,10 @@ var init_ur = __esm(() => {
|
|
|
66932
66932
|
// node_modules/mppx/node_modules/zod/v4/locales/uz.js
|
|
66933
66933
|
function uz_default() {
|
|
66934
66934
|
return {
|
|
66935
|
-
localeError:
|
|
66935
|
+
localeError: error44()
|
|
66936
66936
|
};
|
|
66937
66937
|
}
|
|
66938
|
-
var
|
|
66938
|
+
var error44 = () => {
|
|
66939
66939
|
const Sizable = {
|
|
66940
66940
|
string: { unit: "belgi", verb: "bo‘lishi kerak" },
|
|
66941
66941
|
file: { unit: "bayt", verb: "bo‘lishi kerak" },
|
|
@@ -67045,10 +67045,10 @@ var init_uz = __esm(() => {
|
|
|
67045
67045
|
// node_modules/mppx/node_modules/zod/v4/locales/vi.js
|
|
67046
67046
|
function vi_default() {
|
|
67047
67047
|
return {
|
|
67048
|
-
localeError:
|
|
67048
|
+
localeError: error45()
|
|
67049
67049
|
};
|
|
67050
67050
|
}
|
|
67051
|
-
var
|
|
67051
|
+
var error45 = () => {
|
|
67052
67052
|
const Sizable = {
|
|
67053
67053
|
string: { unit: "ký tự", verb: "có" },
|
|
67054
67054
|
file: { unit: "byte", verb: "có" },
|
|
@@ -67157,10 +67157,10 @@ var init_vi = __esm(() => {
|
|
|
67157
67157
|
// node_modules/mppx/node_modules/zod/v4/locales/zh-CN.js
|
|
67158
67158
|
function zh_CN_default() {
|
|
67159
67159
|
return {
|
|
67160
|
-
localeError:
|
|
67160
|
+
localeError: error46()
|
|
67161
67161
|
};
|
|
67162
67162
|
}
|
|
67163
|
-
var
|
|
67163
|
+
var error46 = () => {
|
|
67164
67164
|
const Sizable = {
|
|
67165
67165
|
string: { unit: "字符", verb: "包含" },
|
|
67166
67166
|
file: { unit: "字节", verb: "包含" },
|
|
@@ -67270,10 +67270,10 @@ var init_zh_CN = __esm(() => {
|
|
|
67270
67270
|
// node_modules/mppx/node_modules/zod/v4/locales/zh-TW.js
|
|
67271
67271
|
function zh_TW_default() {
|
|
67272
67272
|
return {
|
|
67273
|
-
localeError:
|
|
67273
|
+
localeError: error47()
|
|
67274
67274
|
};
|
|
67275
67275
|
}
|
|
67276
|
-
var
|
|
67276
|
+
var error47 = () => {
|
|
67277
67277
|
const Sizable = {
|
|
67278
67278
|
string: { unit: "字元", verb: "擁有" },
|
|
67279
67279
|
file: { unit: "位元組", verb: "擁有" },
|
|
@@ -67381,10 +67381,10 @@ var init_zh_TW = __esm(() => {
|
|
|
67381
67381
|
// node_modules/mppx/node_modules/zod/v4/locales/yo.js
|
|
67382
67382
|
function yo_default() {
|
|
67383
67383
|
return {
|
|
67384
|
-
localeError:
|
|
67384
|
+
localeError: error48()
|
|
67385
67385
|
};
|
|
67386
67386
|
}
|
|
67387
|
-
var
|
|
67387
|
+
var error48 = () => {
|
|
67388
67388
|
const Sizable = {
|
|
67389
67389
|
string: { unit: "àmi", verb: "ní" },
|
|
67390
67390
|
file: { unit: "bytes", verb: "ní" },
|
|
@@ -72089,6 +72089,9 @@ async function runOnboarding(argv) {
|
|
|
72089
72089
|
return true;
|
|
72090
72090
|
}
|
|
72091
72091
|
|
|
72092
|
+
// src/commands/wallet.ts
|
|
72093
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
72094
|
+
|
|
72092
72095
|
// node_modules/ora/index.js
|
|
72093
72096
|
import process9 from "node:process";
|
|
72094
72097
|
|
|
@@ -72971,9 +72974,6 @@ function ora(options) {
|
|
|
72971
72974
|
function mppBase() {
|
|
72972
72975
|
return trimBase(loadConfig().apiBase);
|
|
72973
72976
|
}
|
|
72974
|
-
function billingBase() {
|
|
72975
|
-
return trimBase(loadConfig().billingBase);
|
|
72976
|
-
}
|
|
72977
72977
|
function authHeaders() {
|
|
72978
72978
|
const config = loadConfig();
|
|
72979
72979
|
const headers = { "Content-Type": "application/json" };
|
|
@@ -72982,15 +72982,6 @@ function authHeaders() {
|
|
|
72982
72982
|
}
|
|
72983
72983
|
return headers;
|
|
72984
72984
|
}
|
|
72985
|
-
function creatorHeaders() {
|
|
72986
|
-
const config = loadConfig();
|
|
72987
|
-
const headers = { "Content-Type": "application/json" };
|
|
72988
|
-
const token = config.privyToken || config.creatorToken;
|
|
72989
|
-
if (token) {
|
|
72990
|
-
headers["Authorization"] = `Bearer ${token}`;
|
|
72991
|
-
}
|
|
72992
|
-
return headers;
|
|
72993
|
-
}
|
|
72994
72985
|
async function get(path) {
|
|
72995
72986
|
const res = await fetch(`${mppBase()}${path}`, { headers: authHeaders() });
|
|
72996
72987
|
if (!res.ok) {
|
|
@@ -72999,26 +72990,6 @@ async function get(path) {
|
|
|
72999
72990
|
}
|
|
73000
72991
|
return res.json();
|
|
73001
72992
|
}
|
|
73002
|
-
async function creatorPost(path, body) {
|
|
73003
|
-
const res = await fetch(`${billingBase()}${path}`, {
|
|
73004
|
-
method: "POST",
|
|
73005
|
-
headers: creatorHeaders(),
|
|
73006
|
-
body: body ? JSON.stringify(body) : undefined
|
|
73007
|
-
});
|
|
73008
|
-
if (!res.ok) {
|
|
73009
|
-
const text = await res.text().catch(() => "");
|
|
73010
|
-
throw new Error(`${res.status} ${res.statusText}: ${text}`);
|
|
73011
|
-
}
|
|
73012
|
-
return res.json();
|
|
73013
|
-
}
|
|
73014
|
-
async function creatorGet(path) {
|
|
73015
|
-
const res = await fetch(`${billingBase()}${path}`, { headers: creatorHeaders() });
|
|
73016
|
-
if (!res.ok) {
|
|
73017
|
-
const text = await res.text().catch(() => "");
|
|
73018
|
-
throw new Error(`${res.status} ${res.statusText}: ${text}`);
|
|
73019
|
-
}
|
|
73020
|
-
return res.json();
|
|
73021
|
-
}
|
|
73022
72993
|
async function bootstrapPrivyAccount(token, base = loadConfig().billingBase) {
|
|
73023
72994
|
const res = await fetch(`${trimBase(base)}/api/auth/bootstrap`, {
|
|
73024
72995
|
headers: {
|
|
@@ -73056,381 +73027,6 @@ function trimBase(base) {
|
|
|
73056
73027
|
return base.replace(/\/$/, "");
|
|
73057
73028
|
}
|
|
73058
73029
|
|
|
73059
|
-
// src/commands/browse.ts
|
|
73060
|
-
function siteUrl(agentSlug) {
|
|
73061
|
-
const config = loadConfig();
|
|
73062
|
-
return `${config.siteBase}/agents/${agentSlug}`;
|
|
73063
|
-
}
|
|
73064
|
-
function registerBrowseCommand(program2) {
|
|
73065
|
-
program2.command("browse").description("Browse marketplace agents").option("-c, --category <cat>", "Filter by category").option("-s, --sort <sort>", "Sort by: popular, newest, rating, revenue", "popular").option("-l, --limit <n>", "Max results", "20").option("-q, --search <query>", "Search by name, description, or tags").action(async (opts) => {
|
|
73066
|
-
const spinner = ora("Fetching agents...").start();
|
|
73067
|
-
try {
|
|
73068
|
-
const params = new URLSearchParams({
|
|
73069
|
-
limit: opts.limit,
|
|
73070
|
-
sort: opts.sort
|
|
73071
|
-
});
|
|
73072
|
-
if (opts.category)
|
|
73073
|
-
params.set("category", opts.category);
|
|
73074
|
-
const data = await get(`/v1/marketplace/listings?${params}`);
|
|
73075
|
-
spinner.stop();
|
|
73076
|
-
let agents = data.agents || data.listings || [];
|
|
73077
|
-
if (opts.search) {
|
|
73078
|
-
const q = opts.search.toLowerCase();
|
|
73079
|
-
agents = agents.filter((a) => a.name.toLowerCase().includes(q) || a.description.toLowerCase().includes(q) || a.tags?.some((t) => t.toLowerCase().includes(q)));
|
|
73080
|
-
}
|
|
73081
|
-
if (agents.length === 0) {
|
|
73082
|
-
console.log(dim("No agents found."));
|
|
73083
|
-
return;
|
|
73084
|
-
}
|
|
73085
|
-
console.log(heading(`Marketplace — ${agents.length} agents
|
|
73086
|
-
`));
|
|
73087
|
-
const rows = agents.map((a) => {
|
|
73088
|
-
const price = a.pricing?.per_message ?? a.price_per_message;
|
|
73089
|
-
const interactions = a.stats?.interactions ?? a.total_interactions ?? 0;
|
|
73090
|
-
const rating = a.stats?.rating ?? a.average_rating ?? 0;
|
|
73091
|
-
return [
|
|
73092
|
-
source_default.white.bold(a.name),
|
|
73093
|
-
source_default.dim(a.category),
|
|
73094
|
-
price != null ? usd(price) + dim("/msg") : dim("—"),
|
|
73095
|
-
interactions > 0 ? source_default.cyan(interactions.toLocaleString()) + dim(" uses") : dim("0"),
|
|
73096
|
-
rating > 0 ? source_default.yellow(`★ ${rating.toFixed(1)}`) : dim("—")
|
|
73097
|
-
];
|
|
73098
|
-
});
|
|
73099
|
-
rows.unshift([
|
|
73100
|
-
source_default.dim.underline("NAME"),
|
|
73101
|
-
source_default.dim.underline("CATEGORY"),
|
|
73102
|
-
source_default.dim.underline("PRICE"),
|
|
73103
|
-
source_default.dim.underline("USAGE"),
|
|
73104
|
-
source_default.dim.underline("RATING")
|
|
73105
|
-
]);
|
|
73106
|
-
console.log(table(rows));
|
|
73107
|
-
console.log("");
|
|
73108
|
-
console.log(dim("Tip: amiko info <agent> for details, or view online:"));
|
|
73109
|
-
console.log(dim(` ${loadConfig().siteBase}`));
|
|
73110
|
-
} catch (err) {
|
|
73111
|
-
spinner.stop();
|
|
73112
|
-
console.error(source_default.red(err instanceof Error ? err.message : "Failed to fetch agents"));
|
|
73113
|
-
process.exit(1);
|
|
73114
|
-
}
|
|
73115
|
-
});
|
|
73116
|
-
program2.command("info").description("Show details for a specific agent").argument("<agent>", "Agent ID or slug").action(async (agentId) => {
|
|
73117
|
-
const spinner = ora("Fetching agent...").start();
|
|
73118
|
-
try {
|
|
73119
|
-
let agent = null;
|
|
73120
|
-
try {
|
|
73121
|
-
agent = await get(`/v1/marketplace/listings/${agentId}`);
|
|
73122
|
-
} catch {
|
|
73123
|
-
const data = await get("/v1/marketplace/listings?limit=200");
|
|
73124
|
-
const agents = data.agents || data.listings || [];
|
|
73125
|
-
agent = agents.find((a) => a.agent_id === agentId || a.id === agentId || a.name.toLowerCase() === agentId.toLowerCase()) || null;
|
|
73126
|
-
}
|
|
73127
|
-
spinner.stop();
|
|
73128
|
-
if (!agent) {
|
|
73129
|
-
console.error(source_default.red(`Agent "${agentId}" not found.`));
|
|
73130
|
-
process.exit(1);
|
|
73131
|
-
}
|
|
73132
|
-
const priceMsg = agent.pricing?.per_message ?? agent.price_per_message;
|
|
73133
|
-
const priceTask = agent.pricing?.per_task ?? agent.price_per_task;
|
|
73134
|
-
const interactions = agent.stats?.interactions ?? agent.total_interactions ?? 0;
|
|
73135
|
-
const rating = agent.stats?.rating ?? agent.average_rating ?? 0;
|
|
73136
|
-
const revenue = agent.stats?.revenue ?? 0;
|
|
73137
|
-
const creator = agent.creator?.name ?? agent.creator_name ?? "Unknown";
|
|
73138
|
-
const slug = agent.agent_id || agentId;
|
|
73139
|
-
console.log(heading(agent.name));
|
|
73140
|
-
console.log(source_default.dim(agent.description) + `
|
|
73141
|
-
`);
|
|
73142
|
-
console.log(label("Agent ID", slug));
|
|
73143
|
-
console.log(label("Category", agent.category));
|
|
73144
|
-
console.log(label("Creator", creator));
|
|
73145
|
-
if (agent.creator?.wallet) {
|
|
73146
|
-
console.log(label("Wallet", truncAddr(agent.creator.wallet)));
|
|
73147
|
-
}
|
|
73148
|
-
console.log(label("Tags", agent.tags?.length > 0 ? agent.tags.join(", ") : dim("none")));
|
|
73149
|
-
console.log("");
|
|
73150
|
-
if (agent.capabilities && agent.capabilities.length > 0) {
|
|
73151
|
-
console.log(heading("Capabilities"));
|
|
73152
|
-
for (const cap of agent.capabilities) {
|
|
73153
|
-
console.log(` ${source_default.green("✓")} ${cap}`);
|
|
73154
|
-
}
|
|
73155
|
-
console.log("");
|
|
73156
|
-
}
|
|
73157
|
-
console.log(heading("Pricing"));
|
|
73158
|
-
if (priceMsg != null)
|
|
73159
|
-
console.log(label(" Per message", usd(priceMsg)));
|
|
73160
|
-
if (priceTask != null)
|
|
73161
|
-
console.log(label(" Per task", usd(priceTask)));
|
|
73162
|
-
if (priceMsg == null && priceTask == null)
|
|
73163
|
-
console.log(dim(" No pricing set"));
|
|
73164
|
-
console.log("");
|
|
73165
|
-
console.log(heading("Stats"));
|
|
73166
|
-
console.log(label(" Usage", `${interactions.toLocaleString()} paid uses`));
|
|
73167
|
-
console.log(label(" Rating", rating > 0 ? source_default.yellow(`★ ${rating.toFixed(1)}`) : dim("no ratings")));
|
|
73168
|
-
if (revenue > 0)
|
|
73169
|
-
console.log(label(" Revenue", usd(revenue)));
|
|
73170
|
-
if (agent.tars?.score) {
|
|
73171
|
-
console.log(label(" TARS", source_default.yellow(`★ ${Math.min(agent.tars.score, 5).toFixed(1)}`) + dim(` (${agent.tars.totalJobs ?? 0} jobs)`)));
|
|
73172
|
-
}
|
|
73173
|
-
console.log("");
|
|
73174
|
-
if (agent.example_prompts && agent.example_prompts.length > 0) {
|
|
73175
|
-
console.log(heading("Example prompts"));
|
|
73176
|
-
for (const p of agent.example_prompts) {
|
|
73177
|
-
console.log(dim(` "${p}"`));
|
|
73178
|
-
}
|
|
73179
|
-
console.log("");
|
|
73180
|
-
}
|
|
73181
|
-
console.log(heading("Quick start"));
|
|
73182
|
-
console.log(dim(` amiko call ${slug} "${agent.example_prompts?.[0] || "your message here"}"`));
|
|
73183
|
-
console.log(dim(` amiko call ${slug} -i`) + dim(" (interactive mode)"));
|
|
73184
|
-
console.log("");
|
|
73185
|
-
console.log(dim(` View online: ${siteUrl(slug)}`));
|
|
73186
|
-
} catch (err) {
|
|
73187
|
-
spinner.stop();
|
|
73188
|
-
console.error(source_default.red(err instanceof Error ? err.message : "Failed to fetch agent"));
|
|
73189
|
-
process.exit(1);
|
|
73190
|
-
}
|
|
73191
|
-
});
|
|
73192
|
-
}
|
|
73193
|
-
|
|
73194
|
-
// src/commands/call.ts
|
|
73195
|
-
import { createInterface as createInterface2 } from "node:readline";
|
|
73196
|
-
var TREASURY = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
|
|
73197
|
-
function extractResponse(data) {
|
|
73198
|
-
const text = data.response ?? data.result ?? data.content ?? data.message ?? data.text ?? data.output;
|
|
73199
|
-
if (typeof text === "string")
|
|
73200
|
-
return text;
|
|
73201
|
-
if (text != null)
|
|
73202
|
-
return JSON.stringify(text, null, 2);
|
|
73203
|
-
return JSON.stringify(data, null, 2);
|
|
73204
|
-
}
|
|
73205
|
-
function printPaymentFooter(txHash, amount, token, opts) {
|
|
73206
|
-
if (opts.raw)
|
|
73207
|
-
return;
|
|
73208
|
-
let footer = success(`Paid ${amount} ${token}`);
|
|
73209
|
-
if (txHash)
|
|
73210
|
-
footer += dim(` tx: ${txHash.slice(0, 16)}...`);
|
|
73211
|
-
console.log(footer);
|
|
73212
|
-
}
|
|
73213
|
-
async function readStdin() {
|
|
73214
|
-
if (process.stdin.isTTY)
|
|
73215
|
-
return null;
|
|
73216
|
-
const chunks = [];
|
|
73217
|
-
for await (const chunk of process.stdin) {
|
|
73218
|
-
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
73219
|
-
}
|
|
73220
|
-
const text = Buffer.concat(chunks).toString("utf-8").trim();
|
|
73221
|
-
return text || null;
|
|
73222
|
-
}
|
|
73223
|
-
async function getAmikoPrice() {
|
|
73224
|
-
try {
|
|
73225
|
-
const res = await fetch("https://api.jup.ag/price/v2?ids=AY1Ww6MxwC3cCiyrandHqLrp4FXvzgcwQTZpJ2FEpump");
|
|
73226
|
-
const data = await res.json();
|
|
73227
|
-
return parseFloat(data.data?.["AY1Ww6MxwC3cCiyrandHqLrp4FXvzgcwQTZpJ2FEpump"]?.price || "0");
|
|
73228
|
-
} catch {
|
|
73229
|
-
return 0;
|
|
73230
|
-
}
|
|
73231
|
-
}
|
|
73232
|
-
function usdToAmiko(usdAmount, amikoPrice) {
|
|
73233
|
-
if (amikoPrice <= 0)
|
|
73234
|
-
return "1";
|
|
73235
|
-
const tokens = Math.ceil(usdAmount / amikoPrice);
|
|
73236
|
-
return String(Math.max(tokens, 1));
|
|
73237
|
-
}
|
|
73238
|
-
async function payAndCall(params) {
|
|
73239
|
-
const { mppBase: mppBase2, billingBase: billingBase2, billingToken, solanaWallet, endpoint, message, onProgress } = params;
|
|
73240
|
-
onProgress?.("Fetching price...");
|
|
73241
|
-
let amount = "1";
|
|
73242
|
-
let token = "AMIKO";
|
|
73243
|
-
let chain = "solana";
|
|
73244
|
-
let wallet = solanaWallet;
|
|
73245
|
-
try {
|
|
73246
|
-
const specRes = await fetch(`${mppBase2}/openapi.json`);
|
|
73247
|
-
if (specRes.ok) {
|
|
73248
|
-
const spec = await specRes.json();
|
|
73249
|
-
const pathSpec = spec.paths?.[`/v1/agents/{agentId}/${endpoint}`];
|
|
73250
|
-
const methodSpec = pathSpec?.post;
|
|
73251
|
-
const usdPrice = parseFloat(methodSpec?.["x-payment-info"]?.price || methodSpec?.["x-payment-info"]?.minPrice || "0.01");
|
|
73252
|
-
if (usdPrice > 0) {
|
|
73253
|
-
const amikoPrice = await getAmikoPrice();
|
|
73254
|
-
amount = usdToAmiko(usdPrice, amikoPrice);
|
|
73255
|
-
onProgress?.(`Price: $${usdPrice.toFixed(4)} = ${amount} AMIKO`);
|
|
73256
|
-
}
|
|
73257
|
-
}
|
|
73258
|
-
} catch {}
|
|
73259
|
-
if (!solanaWallet && params.evmWallet) {
|
|
73260
|
-
wallet = params.evmWallet;
|
|
73261
|
-
token = "USDC";
|
|
73262
|
-
chain = "base";
|
|
73263
|
-
amount = "0.01";
|
|
73264
|
-
}
|
|
73265
|
-
onProgress?.(`Paying ${amount} ${token}...`);
|
|
73266
|
-
const transferRes = await fetch(`${billingBase2}/api/crossmint/wallets/${encodeURIComponent(wallet)}/transfer`, {
|
|
73267
|
-
method: "POST",
|
|
73268
|
-
headers: {
|
|
73269
|
-
"Content-Type": "application/json",
|
|
73270
|
-
Authorization: `Bearer ${billingToken}`
|
|
73271
|
-
},
|
|
73272
|
-
body: JSON.stringify({ to: TREASURY, amount, token, chain })
|
|
73273
|
-
});
|
|
73274
|
-
if (!transferRes.ok) {
|
|
73275
|
-
const err = await transferRes.json().catch(() => ({ error: "Transfer failed" }));
|
|
73276
|
-
throw new Error(err.error || `Payment failed: ${transferRes.status}`);
|
|
73277
|
-
}
|
|
73278
|
-
const transferData = await transferRes.json();
|
|
73279
|
-
const txHash = transferData.txHash;
|
|
73280
|
-
if (!txHash)
|
|
73281
|
-
throw new Error("Payment sent but no tx hash returned.");
|
|
73282
|
-
onProgress?.(`Calling agent...`);
|
|
73283
|
-
const res = await fetch(`${mppBase2}/v1/agents/${endpoint}`, {
|
|
73284
|
-
method: "POST",
|
|
73285
|
-
headers: {
|
|
73286
|
-
"Content-Type": "application/json",
|
|
73287
|
-
"X-Payment-Tx": txHash
|
|
73288
|
-
},
|
|
73289
|
-
body: JSON.stringify({ message })
|
|
73290
|
-
});
|
|
73291
|
-
return { res, txHash, amount, token };
|
|
73292
|
-
}
|
|
73293
|
-
async function callAgent(agentId, message, opts) {
|
|
73294
|
-
const config = loadConfig();
|
|
73295
|
-
const auth = resolveAuth(config);
|
|
73296
|
-
const mppBase2 = (config.apiBase || "https://mpp.amikomarkets.com").replace(/\/$/, "");
|
|
73297
|
-
const billingBase2 = auth.billingBase || "https://billing.heyamiko.com";
|
|
73298
|
-
const billingToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
73299
|
-
if (!billingToken) {
|
|
73300
|
-
console.error(error("Not authenticated. Check .amiko.json credentials."));
|
|
73301
|
-
process.exit(1);
|
|
73302
|
-
}
|
|
73303
|
-
const allWallets = auth.agentWallets || config.agentWallets || [];
|
|
73304
|
-
const solanaWallet = allWallets.find((w) => w.chain === "solana")?.address || "";
|
|
73305
|
-
const evmWallet = allWallets.find((w) => w.chain === "base" || w.chain === "evm" || w.chain === "tempo")?.address;
|
|
73306
|
-
if (!solanaWallet && !evmWallet) {
|
|
73307
|
-
console.error(error("No wallet found. Your twin needs a Solana or EVM wallet."));
|
|
73308
|
-
process.exit(1);
|
|
73309
|
-
}
|
|
73310
|
-
const endpoint = opts.task ? `${agentId}/tasks` : `${agentId}/chat`;
|
|
73311
|
-
const spinner = ora(`Calling ${agentId}...`).start();
|
|
73312
|
-
try {
|
|
73313
|
-
const { res, txHash, amount, token } = await payAndCall({
|
|
73314
|
-
mppBase: mppBase2,
|
|
73315
|
-
billingBase: billingBase2,
|
|
73316
|
-
billingToken,
|
|
73317
|
-
solanaWallet,
|
|
73318
|
-
evmWallet,
|
|
73319
|
-
endpoint,
|
|
73320
|
-
message,
|
|
73321
|
-
onProgress: (msg) => {
|
|
73322
|
-
spinner.text = msg;
|
|
73323
|
-
}
|
|
73324
|
-
});
|
|
73325
|
-
spinner.stop();
|
|
73326
|
-
if (!res.ok) {
|
|
73327
|
-
const text = await res.text().catch(() => "");
|
|
73328
|
-
console.error(error(`${res.status} ${text.slice(0, 300)}`));
|
|
73329
|
-
console.log(dim(`Payment tx: https://solscan.io/tx/${txHash}`));
|
|
73330
|
-
process.exit(1);
|
|
73331
|
-
}
|
|
73332
|
-
const data = await res.json();
|
|
73333
|
-
if (opts.raw) {
|
|
73334
|
-
console.log(JSON.stringify(data, null, 2));
|
|
73335
|
-
return;
|
|
73336
|
-
}
|
|
73337
|
-
console.log(extractResponse(data));
|
|
73338
|
-
console.log("");
|
|
73339
|
-
printPaymentFooter(txHash, amount, token, opts);
|
|
73340
|
-
} catch (err) {
|
|
73341
|
-
spinner.stop();
|
|
73342
|
-
console.error(error(err instanceof Error ? err.message : "Call failed"));
|
|
73343
|
-
process.exit(1);
|
|
73344
|
-
}
|
|
73345
|
-
}
|
|
73346
|
-
async function interactiveMode(agentId, opts) {
|
|
73347
|
-
const config = loadConfig();
|
|
73348
|
-
const auth = resolveAuth(config);
|
|
73349
|
-
const mppBase2 = (config.apiBase || "https://mpp.amikomarkets.com").replace(/\/$/, "");
|
|
73350
|
-
const billingBase2 = auth.billingBase || "https://billing.heyamiko.com";
|
|
73351
|
-
const billingToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
73352
|
-
const allWallets = auth.agentWallets || config.agentWallets || [];
|
|
73353
|
-
const solanaWallet = allWallets.find((w) => w.chain === "solana")?.address || "";
|
|
73354
|
-
const evmWallet = allWallets.find((w) => w.chain === "base" || w.chain === "evm")?.address;
|
|
73355
|
-
console.log(heading(`Interactive session with ${agentId}`));
|
|
73356
|
-
console.log(dim(`Payment: Crossmint wallet (${solanaWallet ? "Solana" : "EVM"})`));
|
|
73357
|
-
console.log(dim(`Type your messages. Ctrl+C or "exit" to quit.
|
|
73358
|
-
`));
|
|
73359
|
-
const rl = createInterface2({
|
|
73360
|
-
input: process.stdin,
|
|
73361
|
-
output: process.stdout,
|
|
73362
|
-
prompt: source_default.cyan("you › ")
|
|
73363
|
-
});
|
|
73364
|
-
rl.prompt();
|
|
73365
|
-
rl.on("line", async (line) => {
|
|
73366
|
-
const msg = line.trim();
|
|
73367
|
-
if (!msg) {
|
|
73368
|
-
rl.prompt();
|
|
73369
|
-
return;
|
|
73370
|
-
}
|
|
73371
|
-
if (msg === "exit" || msg === "quit" || msg === ".exit") {
|
|
73372
|
-
console.log(dim(`
|
|
73373
|
-
Session ended.`));
|
|
73374
|
-
rl.close();
|
|
73375
|
-
process.exit(0);
|
|
73376
|
-
}
|
|
73377
|
-
process.stdout.write(source_default.dim(" thinking..."));
|
|
73378
|
-
try {
|
|
73379
|
-
const endpoint = opts.task ? `${agentId}/tasks` : `${agentId}/chat`;
|
|
73380
|
-
const { res, txHash, amount, token } = await payAndCall({
|
|
73381
|
-
mppBase: mppBase2,
|
|
73382
|
-
billingBase: billingBase2,
|
|
73383
|
-
billingToken: billingToken || "",
|
|
73384
|
-
solanaWallet,
|
|
73385
|
-
evmWallet,
|
|
73386
|
-
endpoint,
|
|
73387
|
-
message: msg
|
|
73388
|
-
});
|
|
73389
|
-
process.stdout.write("\r" + " ".repeat(40) + "\r");
|
|
73390
|
-
if (!res.ok) {
|
|
73391
|
-
console.log(source_default.red(` Error: ${res.status} ${res.statusText}`));
|
|
73392
|
-
} else {
|
|
73393
|
-
const data = await res.json();
|
|
73394
|
-
if (opts.raw) {
|
|
73395
|
-
console.log(JSON.stringify(data, null, 2));
|
|
73396
|
-
} else {
|
|
73397
|
-
console.log(source_default.green("agent › ") + extractResponse(data));
|
|
73398
|
-
console.log(dim(` ${amount} ${token} · tx: ${txHash.slice(0, 12)}...`));
|
|
73399
|
-
}
|
|
73400
|
-
}
|
|
73401
|
-
} catch (err) {
|
|
73402
|
-
process.stdout.write("\r" + " ".repeat(40) + "\r");
|
|
73403
|
-
console.log(source_default.red(` ${err instanceof Error ? err.message : "Request failed"}`));
|
|
73404
|
-
}
|
|
73405
|
-
console.log("");
|
|
73406
|
-
rl.prompt();
|
|
73407
|
-
});
|
|
73408
|
-
rl.on("close", () => {
|
|
73409
|
-
process.exit(0);
|
|
73410
|
-
});
|
|
73411
|
-
}
|
|
73412
|
-
function registerCallCommand(program2) {
|
|
73413
|
-
program2.command("call").description("Call a paid agent service via Crossmint wallet payment").argument("<agent>", "Agent ID (e.g. titan-research)").argument("[message]", "Message to send (omit for interactive mode, or pipe from stdin)").option("--task", "Use task endpoint instead of chat").option("--raw", "Output raw JSON response").option("-i, --interactive", "Start interactive conversation mode").action(async (agentId, message, opts) => {
|
|
73414
|
-
if (!message && !opts.interactive) {
|
|
73415
|
-
const piped = await readStdin();
|
|
73416
|
-
if (piped)
|
|
73417
|
-
message = piped;
|
|
73418
|
-
}
|
|
73419
|
-
if (opts.interactive || !message && process.stdin.isTTY) {
|
|
73420
|
-
await interactiveMode(agentId, opts);
|
|
73421
|
-
return;
|
|
73422
|
-
}
|
|
73423
|
-
if (!message) {
|
|
73424
|
-
console.error(error("No message provided. Pass a message, pipe stdin, or use --interactive."));
|
|
73425
|
-
process.exit(1);
|
|
73426
|
-
}
|
|
73427
|
-
await callAgent(agentId, message, opts);
|
|
73428
|
-
});
|
|
73429
|
-
}
|
|
73430
|
-
|
|
73431
|
-
// src/commands/wallet.ts
|
|
73432
|
-
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
73433
|
-
|
|
73434
73030
|
// src/lib/tempo.ts
|
|
73435
73031
|
import { execFile, execFileSync as execFileSync2 } from "node:child_process";
|
|
73436
73032
|
import { existsSync as existsSync3 } from "node:fs";
|
|
@@ -73703,191 +73299,6 @@ Tip: add --open to auto-launch in browser.`));
|
|
|
73703
73299
|
});
|
|
73704
73300
|
}
|
|
73705
73301
|
|
|
73706
|
-
// src/commands/creator.ts
|
|
73707
|
-
function requireCreatorToken() {
|
|
73708
|
-
const config = loadConfig();
|
|
73709
|
-
const token = getPrivyToken(config);
|
|
73710
|
-
if (!token) {
|
|
73711
|
-
console.error(error("Not signed in."));
|
|
73712
|
-
console.log(dim("Check .amiko.json credentials."));
|
|
73713
|
-
process.exit(1);
|
|
73714
|
-
}
|
|
73715
|
-
return token;
|
|
73716
|
-
}
|
|
73717
|
-
function registerCreatorCommand(program2) {
|
|
73718
|
-
const cmd = program2.command("creator").description("Creator dashboard — manage listings and payouts");
|
|
73719
|
-
cmd.command("summary").description("Show creator earnings and listings summary").action(async () => {
|
|
73720
|
-
requireCreatorToken();
|
|
73721
|
-
const config = loadConfig();
|
|
73722
|
-
const spinner = ora("Loading creator dashboard...").start();
|
|
73723
|
-
try {
|
|
73724
|
-
const data = await creatorGet("/api/creator/summary");
|
|
73725
|
-
spinner.stop();
|
|
73726
|
-
console.log(heading(`Creator Dashboard
|
|
73727
|
-
`));
|
|
73728
|
-
console.log(heading("Earnings"));
|
|
73729
|
-
console.log(label(" Available", usd(data.earnings.available)));
|
|
73730
|
-
console.log(label(" Lifetime", usd(data.earnings.lifetime)));
|
|
73731
|
-
console.log(label(" Paid out", usd(data.earnings.paidOut)));
|
|
73732
|
-
console.log(label(" Status", data.earnings.eligible ? source_default.green("Eligible for payout") : dim("Not yet eligible")));
|
|
73733
|
-
console.log("");
|
|
73734
|
-
const published = data.agents.filter((a18) => a18.status === "published");
|
|
73735
|
-
const drafts = data.agents.filter((a18) => a18.status !== "published");
|
|
73736
|
-
console.log(heading(`Listings (${published.length} published, ${drafts.length} drafts)`));
|
|
73737
|
-
if (data.agents.length > 0) {
|
|
73738
|
-
const rows = data.agents.map((a18) => [
|
|
73739
|
-
source_default.white(a18.name),
|
|
73740
|
-
a18.status === "published" ? source_default.green("live") : source_default.yellow("draft"),
|
|
73741
|
-
dim(a18.category),
|
|
73742
|
-
`${(a18.stats?.interactions ?? 0).toLocaleString()} uses`,
|
|
73743
|
-
usd(a18.stats?.revenue ?? 0)
|
|
73744
|
-
]);
|
|
73745
|
-
rows.unshift([
|
|
73746
|
-
source_default.dim.underline("NAME"),
|
|
73747
|
-
source_default.dim.underline("STATUS"),
|
|
73748
|
-
source_default.dim.underline("CATEGORY"),
|
|
73749
|
-
source_default.dim.underline("USAGE"),
|
|
73750
|
-
source_default.dim.underline("REVENUE")
|
|
73751
|
-
]);
|
|
73752
|
-
console.log(table(rows));
|
|
73753
|
-
} else {
|
|
73754
|
-
console.log(dim(" No listings yet."));
|
|
73755
|
-
}
|
|
73756
|
-
console.log("");
|
|
73757
|
-
if (data.payouts.length > 0) {
|
|
73758
|
-
console.log(heading("Recent Payouts"));
|
|
73759
|
-
for (const p13 of data.payouts.slice(0, 5)) {
|
|
73760
|
-
const statusColor = p13.status === "completed" ? source_default.green : p13.status === "pending" ? source_default.yellow : source_default.dim;
|
|
73761
|
-
console.log(` ${usd(p13.amount)} ${statusColor(p13.status)} ${dim(new Date(p13.created_at).toLocaleDateString())}`);
|
|
73762
|
-
}
|
|
73763
|
-
}
|
|
73764
|
-
console.log("");
|
|
73765
|
-
console.log(dim(`View full dashboard: ${config.siteBase}/creator`));
|
|
73766
|
-
} catch (err) {
|
|
73767
|
-
spinner.stop();
|
|
73768
|
-
console.error(error(err instanceof Error ? err.message : "Failed to load dashboard"));
|
|
73769
|
-
process.exit(1);
|
|
73770
|
-
}
|
|
73771
|
-
});
|
|
73772
|
-
cmd.command("listings").description("List all your agent listings").action(async () => {
|
|
73773
|
-
requireCreatorToken();
|
|
73774
|
-
const config = loadConfig();
|
|
73775
|
-
const spinner = ora("Fetching listings...").start();
|
|
73776
|
-
try {
|
|
73777
|
-
const data = await creatorGet("/api/creator/summary");
|
|
73778
|
-
spinner.stop();
|
|
73779
|
-
if (data.agents.length === 0) {
|
|
73780
|
-
console.log(dim("No listings yet."));
|
|
73781
|
-
return;
|
|
73782
|
-
}
|
|
73783
|
-
console.log(heading(`Your Listings — ${data.agents.length} total
|
|
73784
|
-
`));
|
|
73785
|
-
for (const agent of data.agents) {
|
|
73786
|
-
const live = agent.status === "published";
|
|
73787
|
-
console.log(`${live ? source_default.green("●") : source_default.yellow("○")} ${source_default.white.bold(agent.name)} ${dim(`(${agent.agent_id})`)}`);
|
|
73788
|
-
console.log(dim(` ${agent.category} · ${(agent.stats?.interactions ?? 0).toLocaleString()} uses · ${usd(agent.stats?.revenue ?? 0)} revenue`));
|
|
73789
|
-
if (live)
|
|
73790
|
-
console.log(dim(` ${config.siteBase}/agents/${agent.agent_id}`));
|
|
73791
|
-
console.log("");
|
|
73792
|
-
}
|
|
73793
|
-
} catch (err) {
|
|
73794
|
-
spinner.stop();
|
|
73795
|
-
console.error(error(err instanceof Error ? err.message : "Failed"));
|
|
73796
|
-
process.exit(1);
|
|
73797
|
-
}
|
|
73798
|
-
});
|
|
73799
|
-
cmd.command("publish").description("Publish a draft listing").argument("<listingId>", "Listing ID to publish").action(async (listingId) => {
|
|
73800
|
-
requireCreatorToken();
|
|
73801
|
-
const config = loadConfig();
|
|
73802
|
-
const spinner = ora("Publishing listing...").start();
|
|
73803
|
-
try {
|
|
73804
|
-
await creatorPost(`/api/v1/agents/${listingId}/publish`);
|
|
73805
|
-
spinner.stop();
|
|
73806
|
-
console.log(success(`Published listing ${listingId}`));
|
|
73807
|
-
console.log(dim(`View: ${config.siteBase}/agents/${listingId}`));
|
|
73808
|
-
} catch (err) {
|
|
73809
|
-
spinner.stop();
|
|
73810
|
-
console.error(error(err instanceof Error ? err.message : "Failed to publish"));
|
|
73811
|
-
process.exit(1);
|
|
73812
|
-
}
|
|
73813
|
-
});
|
|
73814
|
-
cmd.command("payout").description("Request a payout of available earnings").action(async () => {
|
|
73815
|
-
requireCreatorToken();
|
|
73816
|
-
const spinner = ora("Requesting payout...").start();
|
|
73817
|
-
try {
|
|
73818
|
-
const data = await creatorPost("/api/creator/payouts/request");
|
|
73819
|
-
spinner.stop();
|
|
73820
|
-
if (data.paid) {
|
|
73821
|
-
console.log(success(`Payout sent: ${data.amount != null ? usd(data.amount) : ""}`));
|
|
73822
|
-
if (data.txHash)
|
|
73823
|
-
console.log(dim(`tx: ${data.txHash}`));
|
|
73824
|
-
} else {
|
|
73825
|
-
console.log(warn("No payout processed — balance may not be eligible yet."));
|
|
73826
|
-
}
|
|
73827
|
-
} catch (err) {
|
|
73828
|
-
spinner.stop();
|
|
73829
|
-
console.error(error(err instanceof Error ? err.message : "Payout failed"));
|
|
73830
|
-
process.exit(1);
|
|
73831
|
-
}
|
|
73832
|
-
});
|
|
73833
|
-
}
|
|
73834
|
-
|
|
73835
|
-
// src/commands/reputation.ts
|
|
73836
|
-
function renderStars(score) {
|
|
73837
|
-
const full = Math.floor(score);
|
|
73838
|
-
const half = score - full >= 0.5;
|
|
73839
|
-
const empty = 5 - full - (half ? 1 : 0);
|
|
73840
|
-
return source_default.yellow("★".repeat(full)) + (half ? source_default.yellow("½") : "") + source_default.dim("☆".repeat(empty));
|
|
73841
|
-
}
|
|
73842
|
-
function scoreTier(score) {
|
|
73843
|
-
if (score >= 4.5)
|
|
73844
|
-
return source_default.green("Excellent");
|
|
73845
|
-
if (score >= 3.5)
|
|
73846
|
-
return source_default.blue("Good");
|
|
73847
|
-
if (score >= 2.5)
|
|
73848
|
-
return source_default.yellow("Average");
|
|
73849
|
-
return source_default.dim("Developing");
|
|
73850
|
-
}
|
|
73851
|
-
function registerReputationCommand(program2) {
|
|
73852
|
-
program2.command("reputation").alias("rep").description("Look up TARS reputation for a wallet address").argument("[address]", "Wallet address (uses configured wallet if omitted)").action(async (address) => {
|
|
73853
|
-
const addr = address || loadConfig().wallet;
|
|
73854
|
-
if (!addr) {
|
|
73855
|
-
console.error(error("No address. Provide one or run: amiko config set wallet <address>"));
|
|
73856
|
-
process.exit(1);
|
|
73857
|
-
}
|
|
73858
|
-
const spinner = ora(`Looking up ${truncAddr(addr)}...`).start();
|
|
73859
|
-
try {
|
|
73860
|
-
const data = await get(`/v1/marketplace/reputation/${addr}`);
|
|
73861
|
-
spinner.stop();
|
|
73862
|
-
const tars = data.tars;
|
|
73863
|
-
console.log(heading("TARS Reputation"));
|
|
73864
|
-
console.log(label("Address", source_default.cyan(truncAddr(addr))));
|
|
73865
|
-
console.log("");
|
|
73866
|
-
if (tars.score > 0) {
|
|
73867
|
-
const displayScore = Math.min(tars.score, 5);
|
|
73868
|
-
const stars = renderStars(displayScore);
|
|
73869
|
-
const tier = scoreTier(displayScore);
|
|
73870
|
-
console.log(` ${source_default.white.bold(displayScore.toFixed(2))} ${stars} ${tier}`);
|
|
73871
|
-
console.log("");
|
|
73872
|
-
console.log(label(" Total jobs", tars.totalJobs.toLocaleString()));
|
|
73873
|
-
console.log(label(" Volume", usd(tars.totalVolume)));
|
|
73874
|
-
console.log(label(" Ratings", tars.feedbackCount.toString()));
|
|
73875
|
-
console.log(label(" Confidence", `${Math.round(tars.confidence * 100)}%`));
|
|
73876
|
-
console.log(label(" On-chain", tars.onChain ? source_default.green("verified") : dim("not yet")));
|
|
73877
|
-
console.log("");
|
|
73878
|
-
console.log(dim(` VWA = ${tars.scoreBps} bps (${(tars.scoreBps / 1e4).toFixed(2)} / 5.00)`));
|
|
73879
|
-
} else {
|
|
73880
|
-
console.log(dim(" No reputation data yet."));
|
|
73881
|
-
console.log(dim(" Score builds from verified MPP payments and feedback."));
|
|
73882
|
-
}
|
|
73883
|
-
} catch (err) {
|
|
73884
|
-
spinner.stop();
|
|
73885
|
-
console.error(error(err instanceof Error ? err.message : "Lookup failed"));
|
|
73886
|
-
process.exit(1);
|
|
73887
|
-
}
|
|
73888
|
-
});
|
|
73889
|
-
}
|
|
73890
|
-
|
|
73891
73302
|
// src/commands/config.ts
|
|
73892
73303
|
var VALID_KEYS = [
|
|
73893
73304
|
"apiBase",
|
|
@@ -74044,137 +73455,6 @@ function registerDiscoveryCommand(program2) {
|
|
|
74044
73455
|
});
|
|
74045
73456
|
}
|
|
74046
73457
|
|
|
74047
|
-
// src/commands/marketplace.ts
|
|
74048
|
-
function timeAgo(timestamp) {
|
|
74049
|
-
const seconds = Math.floor((Date.now() - new Date(timestamp).getTime()) / 1000);
|
|
74050
|
-
if (seconds < 60)
|
|
74051
|
-
return "just now";
|
|
74052
|
-
if (seconds < 3600)
|
|
74053
|
-
return `${Math.floor(seconds / 60)}m ago`;
|
|
74054
|
-
if (seconds < 86400)
|
|
74055
|
-
return `${Math.floor(seconds / 3600)}h ago`;
|
|
74056
|
-
return `${Math.floor(seconds / 86400)}d ago`;
|
|
74057
|
-
}
|
|
74058
|
-
function registerMarketplaceCommand(program2) {
|
|
74059
|
-
program2.command("activity").description("Show recent marketplace payment activity").option("-l, --limit <n>", "Number of entries", "20").option("-a, --agent <id>", "Filter by agent ID").action(async (opts) => {
|
|
74060
|
-
const spinner = ora("Fetching activity...").start();
|
|
74061
|
-
try {
|
|
74062
|
-
const data = await get(`/v1/marketplace/activity?limit=${opts.limit}`);
|
|
74063
|
-
spinner.stop();
|
|
74064
|
-
let items = data.activity || [];
|
|
74065
|
-
if (opts.agent) {
|
|
74066
|
-
const q4 = opts.agent.toLowerCase();
|
|
74067
|
-
items = items.filter((a18) => a18.service?.toLowerCase().includes(q4) || a18.agent_name?.toLowerCase().includes(q4));
|
|
74068
|
-
}
|
|
74069
|
-
if (items.length === 0) {
|
|
74070
|
-
console.log(dim("No recent activity."));
|
|
74071
|
-
return;
|
|
74072
|
-
}
|
|
74073
|
-
console.log(heading(`Recent Activity — ${items.length} payments
|
|
74074
|
-
`));
|
|
74075
|
-
const rows = items.map((item) => [
|
|
74076
|
-
source_default.white(item.agent_name || item.service),
|
|
74077
|
-
source_default.dim(truncAddr(item.client)),
|
|
74078
|
-
source_default.green(`$${item.amount.toFixed(4)}`),
|
|
74079
|
-
dim(timeAgo(item.timestamp))
|
|
74080
|
-
]);
|
|
74081
|
-
rows.unshift([
|
|
74082
|
-
source_default.dim.underline("AGENT"),
|
|
74083
|
-
source_default.dim.underline("CLIENT"),
|
|
74084
|
-
source_default.dim.underline("AMOUNT"),
|
|
74085
|
-
source_default.dim.underline("WHEN")
|
|
74086
|
-
]);
|
|
74087
|
-
console.log(table(rows));
|
|
74088
|
-
} catch (err) {
|
|
74089
|
-
spinner.stop();
|
|
74090
|
-
console.error(error(err instanceof Error ? err.message : "Failed to fetch activity"));
|
|
74091
|
-
process.exit(1);
|
|
74092
|
-
}
|
|
74093
|
-
});
|
|
74094
|
-
program2.command("leaderboard").alias("top").description("Show top creators by revenue or usage").option("-s, --sort <by>", "Sort by: revenue, usage, rating", "revenue").option("-l, --limit <n>", "Number of entries", "10").action(async (opts) => {
|
|
74095
|
-
const spinner = ora("Fetching leaderboard...").start();
|
|
74096
|
-
try {
|
|
74097
|
-
const data = await get(`/v1/marketplace/leaderboard?limit=${opts.limit}&sort=${opts.sort}`);
|
|
74098
|
-
spinner.stop();
|
|
74099
|
-
const entries = data.leaderboard || [];
|
|
74100
|
-
if (entries.length === 0) {
|
|
74101
|
-
console.log(dim("No leaderboard data yet."));
|
|
74102
|
-
return;
|
|
74103
|
-
}
|
|
74104
|
-
console.log(heading(`Creator Leaderboard — Top ${entries.length} by ${opts.sort}
|
|
74105
|
-
`));
|
|
74106
|
-
const rows = entries.map((e8) => {
|
|
74107
|
-
const medal = e8.rank === 1 ? source_default.yellow("1st") : e8.rank === 2 ? source_default.gray("2nd") : e8.rank === 3 ? source_default.hex("#CD7F32")("3rd") : dim(`${e8.rank}th`);
|
|
74108
|
-
const agentNames = e8.agents.map((a18) => a18.name).join(", ");
|
|
74109
|
-
return [
|
|
74110
|
-
medal,
|
|
74111
|
-
source_default.white.bold(e8.creator.name.length > 16 ? truncAddr(e8.creator.name) : e8.creator.name),
|
|
74112
|
-
source_default.green(usd(e8.stats.revenue)),
|
|
74113
|
-
source_default.cyan(e8.stats.interactions.toLocaleString()) + dim(" uses"),
|
|
74114
|
-
dim(`${e8.stats.agent_count} agents`),
|
|
74115
|
-
dim(agentNames.length > 40 ? agentNames.slice(0, 37) + "..." : agentNames)
|
|
74116
|
-
];
|
|
74117
|
-
});
|
|
74118
|
-
rows.unshift([
|
|
74119
|
-
source_default.dim.underline("#"),
|
|
74120
|
-
source_default.dim.underline("CREATOR"),
|
|
74121
|
-
source_default.dim.underline("REVENUE"),
|
|
74122
|
-
source_default.dim.underline("USAGE"),
|
|
74123
|
-
source_default.dim.underline("AGENTS"),
|
|
74124
|
-
source_default.dim.underline("TOP LISTINGS")
|
|
74125
|
-
]);
|
|
74126
|
-
console.log(table(rows));
|
|
74127
|
-
} catch (err) {
|
|
74128
|
-
spinner.stop();
|
|
74129
|
-
console.error(error(err instanceof Error ? err.message : "Failed to fetch leaderboard"));
|
|
74130
|
-
process.exit(1);
|
|
74131
|
-
}
|
|
74132
|
-
});
|
|
74133
|
-
program2.command("popular").description("Show trending/popular agents").option("-p, --period <period>", "Time period: day, week, month, all", "week").option("-l, --limit <n>", "Number of entries", "10").action(async (opts) => {
|
|
74134
|
-
const config = loadConfig();
|
|
74135
|
-
const spinner = ora("Fetching popular agents...").start();
|
|
74136
|
-
try {
|
|
74137
|
-
const data = await get(`/v1/marketplace/popular?limit=${opts.limit}&period=${opts.period}`);
|
|
74138
|
-
spinner.stop();
|
|
74139
|
-
const agents = data.popular || [];
|
|
74140
|
-
if (agents.length === 0) {
|
|
74141
|
-
console.log(dim("No data for this period."));
|
|
74142
|
-
return;
|
|
74143
|
-
}
|
|
74144
|
-
console.log(heading(`Popular — ${opts.period}
|
|
74145
|
-
`));
|
|
74146
|
-
const rows = agents.map((a18, i15) => {
|
|
74147
|
-
const price = a18.pricing?.per_message;
|
|
74148
|
-
const uses = a18.period_interactions ?? a18.stats?.interactions ?? 0;
|
|
74149
|
-
const rev = a18.period_revenue ?? a18.stats?.revenue ?? 0;
|
|
74150
|
-
return [
|
|
74151
|
-
dim(`${i15 + 1}.`),
|
|
74152
|
-
source_default.white.bold(a18.name),
|
|
74153
|
-
source_default.dim(a18.category),
|
|
74154
|
-
price != null ? usd(price) + dim("/msg") : dim("—"),
|
|
74155
|
-
source_default.cyan(uses.toLocaleString()) + dim(" uses"),
|
|
74156
|
-
rev > 0 ? source_default.green(usd(rev)) : dim("—")
|
|
74157
|
-
];
|
|
74158
|
-
});
|
|
74159
|
-
rows.unshift([
|
|
74160
|
-
source_default.dim.underline("#"),
|
|
74161
|
-
source_default.dim.underline("NAME"),
|
|
74162
|
-
source_default.dim.underline("CATEGORY"),
|
|
74163
|
-
source_default.dim.underline("PRICE"),
|
|
74164
|
-
source_default.dim.underline("USAGE"),
|
|
74165
|
-
source_default.dim.underline("REVENUE")
|
|
74166
|
-
]);
|
|
74167
|
-
console.log(table(rows));
|
|
74168
|
-
console.log("");
|
|
74169
|
-
console.log(dim(`View all: ${config.siteBase}`));
|
|
74170
|
-
} catch (err) {
|
|
74171
|
-
spinner.stop();
|
|
74172
|
-
console.error(error(err instanceof Error ? err.message : "Failed"));
|
|
74173
|
-
process.exit(1);
|
|
74174
|
-
}
|
|
74175
|
-
});
|
|
74176
|
-
}
|
|
74177
|
-
|
|
74178
73458
|
// src/commands/login.ts
|
|
74179
73459
|
import { createServer } from "node:http";
|
|
74180
73460
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
@@ -74442,9 +73722,9 @@ Run "amiko login" again to re-authenticate, or "amiko logout" to sign out.
|
|
|
74442
73722
|
const masked = config.apiKey.slice(0, 6) + "..." + config.apiKey.slice(-4);
|
|
74443
73723
|
console.log(label("API Key", masked));
|
|
74444
73724
|
}
|
|
74445
|
-
const
|
|
73725
|
+
const billingBase = auth.billingBase || config.billingBase;
|
|
74446
73726
|
console.log(label("MPP", config.apiBase));
|
|
74447
|
-
console.log(label("Billing",
|
|
73727
|
+
console.log(label("Billing", billingBase));
|
|
74448
73728
|
console.log(label("Site", config.siteBase));
|
|
74449
73729
|
if (auth.mode === "none") {
|
|
74450
73730
|
console.log("");
|
|
@@ -74998,8 +74278,8 @@ function registerConnectCommand(program2) {
|
|
|
74998
74278
|
const spinner3 = ora("Connecting with API key...").start();
|
|
74999
74279
|
try {
|
|
75000
74280
|
const config2 = loadConfig();
|
|
75001
|
-
const
|
|
75002
|
-
const res = await fetch(`${
|
|
74281
|
+
const billingBase = config2.billingBase || "https://billing.heyamiko.com";
|
|
74282
|
+
const res = await fetch(`${billingBase}/api/auth/bootstrap`, {
|
|
75003
74283
|
headers: { Authorization: `Bearer ${input}` }
|
|
75004
74284
|
});
|
|
75005
74285
|
if (!res.ok) {
|
|
@@ -75295,8 +74575,8 @@ function registerCreditsCommand(program2) {
|
|
|
75295
74575
|
console.error(error("Not authenticated. Check .amiko.json credentials."));
|
|
75296
74576
|
process.exit(1);
|
|
75297
74577
|
}
|
|
75298
|
-
const
|
|
75299
|
-
if (!
|
|
74578
|
+
const billingBase = auth.billingBase || "https://billing.heyamiko.com";
|
|
74579
|
+
if (!billingBase) {
|
|
75300
74580
|
spinner.stop();
|
|
75301
74581
|
console.error(error("Billing service not configured. Check billingBase in .amiko.json."));
|
|
75302
74582
|
process.exit(1);
|
|
@@ -75388,13 +74668,13 @@ function registerCreditsCommand(program2) {
|
|
|
75388
74668
|
console.error(error("EVM topup not supported yet. Use a Solana wallet with --token AMIKO, USDC, USDT, or SOL."));
|
|
75389
74669
|
process.exit(1);
|
|
75390
74670
|
}
|
|
75391
|
-
const
|
|
74671
|
+
const TREASURY = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
|
|
75392
74672
|
const spinner3 = ora("Transferring tokens to treasury...").start();
|
|
75393
74673
|
const transferRes = await fetch(`${auth.billingBase || "https://billing.heyamiko.com"}/api/crossmint/wallets/${encodeURIComponent(walletAddr)}/transfer`, {
|
|
75394
74674
|
method: "POST",
|
|
75395
74675
|
headers: authHeaders2,
|
|
75396
74676
|
body: JSON.stringify({
|
|
75397
|
-
to:
|
|
74677
|
+
to: TREASURY,
|
|
75398
74678
|
amount: tokenAmount.toFixed(6),
|
|
75399
74679
|
token,
|
|
75400
74680
|
chain: walletChain
|
|
@@ -75638,13 +74918,13 @@ function registerSwapCommand(program2) {
|
|
|
75638
74918
|
}
|
|
75639
74919
|
const swapSpinner = ora("Executing swap via Crossmint...").start();
|
|
75640
74920
|
const billingToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
75641
|
-
const
|
|
74921
|
+
const billingBase = auth.billingBase || "https://billing.heyamiko.com";
|
|
75642
74922
|
if (!billingToken) {
|
|
75643
74923
|
swapSpinner.stop();
|
|
75644
74924
|
console.error(error("No auth token available for swap"));
|
|
75645
74925
|
process.exit(1);
|
|
75646
74926
|
}
|
|
75647
|
-
const swapRes = await fetch(`${
|
|
74927
|
+
const swapRes = await fetch(`${billingBase}/api/crossmint/wallets/${encodeURIComponent(wallet)}/swap`, {
|
|
75648
74928
|
method: "POST",
|
|
75649
74929
|
headers: {
|
|
75650
74930
|
"Content-Type": "application/json",
|
|
@@ -75758,7 +75038,7 @@ function registerUpdateCommand(program2) {
|
|
|
75758
75038
|
}
|
|
75759
75039
|
|
|
75760
75040
|
// src/commands/search.ts
|
|
75761
|
-
var
|
|
75041
|
+
var TREASURY = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
|
|
75762
75042
|
function registerSearchCommand(program2) {
|
|
75763
75043
|
program2.command("search <query>").description("X Search — pays 1 AMIKO token per search").option("--raw", "Output raw JSON").option("--token <token>", "Payment token (AMIKO, USDC, SOL)", "AMIKO").action(async (query, opts) => {
|
|
75764
75044
|
const spinner = ora("X Search...").start();
|
|
@@ -75766,7 +75046,7 @@ function registerSearchCommand(program2) {
|
|
|
75766
75046
|
const config2 = loadConfig();
|
|
75767
75047
|
const auth = resolveAuth(config2);
|
|
75768
75048
|
const mppBase2 = (config2.apiBase || "https://mpp.amikomarkets.com").replace(/\/$/, "");
|
|
75769
|
-
const
|
|
75049
|
+
const billingBase = auth.billingBase || "https://billing.heyamiko.com";
|
|
75770
75050
|
const billingToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
75771
75051
|
if (auth.mode === "none" || !billingToken) {
|
|
75772
75052
|
spinner.stop();
|
|
@@ -75788,14 +75068,14 @@ function registerSearchCommand(program2) {
|
|
|
75788
75068
|
const token = payWithSolana ? opts.token || "AMIKO" : "USDC";
|
|
75789
75069
|
const amount2 = token === "AMIKO" ? "1" : "0.01";
|
|
75790
75070
|
spinner.text = `Paying ${amount2} ${token} (${chain})...`;
|
|
75791
|
-
const transferRes = await fetch(`${
|
|
75071
|
+
const transferRes = await fetch(`${billingBase}/api/crossmint/wallets/${encodeURIComponent(wallet)}/transfer`, {
|
|
75792
75072
|
method: "POST",
|
|
75793
75073
|
headers: {
|
|
75794
75074
|
"Content-Type": "application/json",
|
|
75795
75075
|
Authorization: `Bearer ${billingToken}`
|
|
75796
75076
|
},
|
|
75797
75077
|
body: JSON.stringify({
|
|
75798
|
-
to:
|
|
75078
|
+
to: TREASURY,
|
|
75799
75079
|
amount: amount2,
|
|
75800
75080
|
token,
|
|
75801
75081
|
chain
|
|
@@ -75865,7 +75145,7 @@ function registerSearchCommand(program2) {
|
|
|
75865
75145
|
}
|
|
75866
75146
|
|
|
75867
75147
|
// src/commands/image.ts
|
|
75868
|
-
var
|
|
75148
|
+
var TREASURY2 = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
|
|
75869
75149
|
function registerImageCommand(program2) {
|
|
75870
75150
|
program2.command("image <prompt>").alias("img").description("Generate an image — costs 5 AMIKO").option("--size <size>", "Image size: 1024x1024, 1024x1792, 1792x1024", "1024x1024").option("--quality <q>", "Quality: auto, low, medium, high (gpt-image-1) or standard, hd (dall-e-3)", "auto").option("--model <model>", "Model: gpt-image-1 or dall-e-3", "gpt-image-1").option("--background <bg>", "Background: transparent, opaque, auto (gpt-image-1 only)").option("--format <fmt>", "Output: png, webp, jpeg (gpt-image-1 only)", "png").option("--raw", "Output raw JSON").action(async (prompt2, opts) => {
|
|
75871
75151
|
const spinner = ora("Generating image...").start();
|
|
@@ -75873,7 +75153,7 @@ function registerImageCommand(program2) {
|
|
|
75873
75153
|
const config2 = loadConfig();
|
|
75874
75154
|
const auth = resolveAuth(config2);
|
|
75875
75155
|
const mppBase2 = (config2.apiBase || "https://mpp.amikomarkets.com").replace(/\/$/, "");
|
|
75876
|
-
const
|
|
75156
|
+
const billingBase = auth.billingBase || "https://billing.heyamiko.com";
|
|
75877
75157
|
const billingToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
75878
75158
|
if (!billingToken) {
|
|
75879
75159
|
spinner.stop();
|
|
@@ -75888,14 +75168,14 @@ function registerImageCommand(program2) {
|
|
|
75888
75168
|
process.exit(1);
|
|
75889
75169
|
}
|
|
75890
75170
|
spinner.text = "Paying 5 AMIKO...";
|
|
75891
|
-
const transferRes = await fetch(`${
|
|
75171
|
+
const transferRes = await fetch(`${billingBase}/api/crossmint/wallets/${encodeURIComponent(solanaWallet)}/transfer`, {
|
|
75892
75172
|
method: "POST",
|
|
75893
75173
|
headers: {
|
|
75894
75174
|
"Content-Type": "application/json",
|
|
75895
75175
|
Authorization: `Bearer ${billingToken}`
|
|
75896
75176
|
},
|
|
75897
75177
|
body: JSON.stringify({
|
|
75898
|
-
to:
|
|
75178
|
+
to: TREASURY2,
|
|
75899
75179
|
amount: "5",
|
|
75900
75180
|
token: "AMIKO",
|
|
75901
75181
|
chain: "solana"
|
|
@@ -75971,15 +75251,15 @@ function registerImageCommand(program2) {
|
|
|
75971
75251
|
}
|
|
75972
75252
|
|
|
75973
75253
|
// src/commands/amazon.ts
|
|
75974
|
-
var
|
|
75975
|
-
async function payAmiko(
|
|
75976
|
-
const res = await fetch(`${
|
|
75254
|
+
var TREASURY3 = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
|
|
75255
|
+
async function payAmiko(billingBase, billingToken, solanaWallet, amount2) {
|
|
75256
|
+
const res = await fetch(`${billingBase}/api/crossmint/wallets/${encodeURIComponent(solanaWallet)}/transfer`, {
|
|
75977
75257
|
method: "POST",
|
|
75978
75258
|
headers: {
|
|
75979
75259
|
"Content-Type": "application/json",
|
|
75980
75260
|
Authorization: `Bearer ${billingToken}`
|
|
75981
75261
|
},
|
|
75982
|
-
body: JSON.stringify({ to:
|
|
75262
|
+
body: JSON.stringify({ to: TREASURY3, amount: amount2, token: "AMIKO", chain: "solana" })
|
|
75983
75263
|
});
|
|
75984
75264
|
if (!res.ok) {
|
|
75985
75265
|
const err = await res.json().catch(() => ({ error: "Transfer failed" }));
|
|
@@ -75998,7 +75278,7 @@ function registerAmazonCommand(program2) {
|
|
|
75998
75278
|
const config2 = loadConfig();
|
|
75999
75279
|
const auth = resolveAuth(config2);
|
|
76000
75280
|
const mppBase2 = (config2.apiBase || "https://mpp.amikomarkets.com").replace(/\/$/, "");
|
|
76001
|
-
const
|
|
75281
|
+
const billingBase = auth.billingBase || "https://billing.heyamiko.com";
|
|
76002
75282
|
const billingToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
76003
75283
|
if (!billingToken) {
|
|
76004
75284
|
spinner.stop();
|
|
@@ -76013,7 +75293,7 @@ function registerAmazonCommand(program2) {
|
|
|
76013
75293
|
process.exit(1);
|
|
76014
75294
|
}
|
|
76015
75295
|
spinner.text = "Paying 1 AMIKO...";
|
|
76016
|
-
const txHash = await payAmiko(
|
|
75296
|
+
const txHash = await payAmiko(billingBase, billingToken, solanaWallet, "1");
|
|
76017
75297
|
spinner.text = "Searching Amazon...";
|
|
76018
75298
|
const params = new URLSearchParams({
|
|
76019
75299
|
q: `site:amazon.com ${query}`
|
|
@@ -76118,23 +75398,23 @@ function registerAmazonCommand(program2) {
|
|
|
76118
75398
|
}
|
|
76119
75399
|
|
|
76120
75400
|
// src/commands/services.ts
|
|
76121
|
-
var
|
|
75401
|
+
var TREASURY4 = "FPiZAf3jEnNfCwfvbv46jdPfHbmSepD4Q6iHiLJDQXvb";
|
|
76122
75402
|
var AMIKO_MINT = "AY1Ww6MxwC3cCiyrandHqLrp4FXvzgcwQTZpJ2FEpump";
|
|
76123
75403
|
var USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
76124
|
-
async function
|
|
75404
|
+
async function getAmikoPrice() {
|
|
76125
75405
|
const res = await fetch(`https://lite-api.jup.ag/swap/v1/quote?inputMint=${AMIKO_MINT}&outputMint=${USDC_MINT}&amount=${1e6}&slippageBps=100`);
|
|
76126
75406
|
if (!res.ok)
|
|
76127
75407
|
return 0;
|
|
76128
75408
|
const data = await res.json();
|
|
76129
75409
|
return parseFloat(data.outAmount) / 1e6;
|
|
76130
75410
|
}
|
|
76131
|
-
function
|
|
75411
|
+
function usdToAmiko(usd2, pricePerAmiko) {
|
|
76132
75412
|
if (pricePerAmiko <= 0)
|
|
76133
75413
|
return "1";
|
|
76134
|
-
const amount2 =
|
|
75414
|
+
const amount2 = usd2 / pricePerAmiko;
|
|
76135
75415
|
return Math.ceil(amount2 * 100) / 100 + "";
|
|
76136
75416
|
}
|
|
76137
|
-
async function
|
|
75417
|
+
async function payAndCall(mppBase2, method, path, billingBase, billingToken, solanaWallet, amountOrAuto, body, onProgress, token = "AMIKO") {
|
|
76138
75418
|
let amount2 = amountOrAuto;
|
|
76139
75419
|
if (amount2 === "auto") {
|
|
76140
75420
|
onProgress?.("Fetching price...");
|
|
@@ -76146,8 +75426,8 @@ async function payAndCall2(mppBase2, method, path, billingBase2, billingToken, s
|
|
|
76146
75426
|
const methodSpec = pathSpec?.[method.toLowerCase()];
|
|
76147
75427
|
const usdPrice = parseFloat(methodSpec?.["x-payment-info"]?.price || "0");
|
|
76148
75428
|
if (usdPrice > 0) {
|
|
76149
|
-
const amikoPrice = await
|
|
76150
|
-
amount2 =
|
|
75429
|
+
const amikoPrice = await getAmikoPrice();
|
|
75430
|
+
amount2 = usdToAmiko(usdPrice, amikoPrice);
|
|
76151
75431
|
onProgress?.(`Price: $${usdPrice.toFixed(4)} = ${amount2} AMIKO`);
|
|
76152
75432
|
} else {
|
|
76153
75433
|
amount2 = "1";
|
|
@@ -76160,14 +75440,14 @@ async function payAndCall2(mppBase2, method, path, billingBase2, billingToken, s
|
|
|
76160
75440
|
}
|
|
76161
75441
|
}
|
|
76162
75442
|
onProgress?.(`Paying ${amount2} AMIKO...`);
|
|
76163
|
-
const transferRes = await fetch(`${
|
|
75443
|
+
const transferRes = await fetch(`${billingBase}/api/crossmint/wallets/${encodeURIComponent(solanaWallet)}/transfer`, {
|
|
76164
75444
|
method: "POST",
|
|
76165
75445
|
headers: {
|
|
76166
75446
|
"Content-Type": "application/json",
|
|
76167
75447
|
Authorization: `Bearer ${billingToken}`
|
|
76168
75448
|
},
|
|
76169
75449
|
body: JSON.stringify({
|
|
76170
|
-
to:
|
|
75450
|
+
to: TREASURY4,
|
|
76171
75451
|
amount: amount2,
|
|
76172
75452
|
token,
|
|
76173
75453
|
chain: "solana"
|
|
@@ -76297,7 +75577,7 @@ async function callService(params) {
|
|
|
76297
75577
|
const config2 = loadConfig();
|
|
76298
75578
|
const auth = resolveAuth(config2);
|
|
76299
75579
|
const mppBase2 = (config2.apiBase || "https://mpp.amikomarkets.com").replace(/\/$/, "");
|
|
76300
|
-
const
|
|
75580
|
+
const billingBase = auth.billingBase || "https://billing.heyamiko.com";
|
|
76301
75581
|
const billingToken = auth.platformKey || auth.twinToken || auth.privyToken;
|
|
76302
75582
|
if (!billingToken) {
|
|
76303
75583
|
spinner.stop();
|
|
@@ -76313,7 +75593,7 @@ async function callService(params) {
|
|
|
76313
75593
|
}
|
|
76314
75594
|
const token = params.usdc ? "USDC" : "AMIKO";
|
|
76315
75595
|
const amount2 = params.usdc || params.amiko || "auto";
|
|
76316
|
-
const { res, txHash, amikoSpent } = await
|
|
75596
|
+
const { res, txHash, amikoSpent } = await payAndCall(mppBase2, params.method, params.path, billingBase, billingToken, solanaWallet, token === "USDC" ? amount2 : amount2, params.body, (msg) => {
|
|
76317
75597
|
spinner.text = msg;
|
|
76318
75598
|
});
|
|
76319
75599
|
if (params.usdc) {}
|
|
@@ -76356,7 +75636,7 @@ var didOnboard = await runOnboarding(process.argv);
|
|
|
76356
75636
|
if (didOnboard)
|
|
76357
75637
|
process.exit(0);
|
|
76358
75638
|
var program2 = new Command;
|
|
76359
|
-
program2.name("amiko").description("Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call
|
|
75639
|
+
program2.name("amiko").description("Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call MPP services").version(PKG_VERSION);
|
|
76360
75640
|
registerConnectCommand(program2);
|
|
76361
75641
|
registerCreditsCommand(program2);
|
|
76362
75642
|
registerSearchCommand(program2);
|
|
@@ -76364,13 +75644,8 @@ registerImageCommand(program2);
|
|
|
76364
75644
|
registerAmazonCommand(program2);
|
|
76365
75645
|
registerSwapCommand(program2);
|
|
76366
75646
|
registerBridgeCommand(program2);
|
|
76367
|
-
registerBrowseCommand(program2);
|
|
76368
|
-
registerCallCommand(program2);
|
|
76369
|
-
registerMarketplaceCommand(program2);
|
|
76370
|
-
registerCreatorCommand(program2);
|
|
76371
75647
|
registerWalletCommand(program2);
|
|
76372
75648
|
registerLoginCommand(program2);
|
|
76373
|
-
registerReputationCommand(program2);
|
|
76374
75649
|
registerConfigCommand(program2);
|
|
76375
75650
|
registerServicesCommand(program2);
|
|
76376
75651
|
registerDiscoveryCommand(program2);
|