@t2000/cli 10.25.0 → 10.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -29311,10 +29311,19 @@ var RESOLVE_NAME_QUERY = `query ResolveSuins($name: String!) {
|
|
|
29311
29311
|
}`;
|
|
29312
29312
|
var SUI_ADDRESS_REGEX = /^0x[a-fA-F0-9]{1,64}$/i;
|
|
29313
29313
|
var SUINS_NAME_REGEX = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.sui$/;
|
|
29314
|
+
var AUDRIC_HANDLE_RE = /^([a-z0-9-]+)@audric$/i;
|
|
29315
|
+
function canonicalizeRecipientInput(raw) {
|
|
29316
|
+
const trimmed = raw.trim();
|
|
29317
|
+
const m = AUDRIC_HANDLE_RE.exec(trimmed);
|
|
29318
|
+
if (m) {
|
|
29319
|
+
return `${m[1].toLowerCase()}.audric.sui`;
|
|
29320
|
+
}
|
|
29321
|
+
return trimmed;
|
|
29322
|
+
}
|
|
29314
29323
|
var InvalidAddressError = class extends Error {
|
|
29315
29324
|
constructor(raw) {
|
|
29316
29325
|
super(
|
|
29317
|
-
`"${raw}" isn't a valid Sui address or SuiNS name. Pass a 0x-prefixed hex address (e.g. 0x40cd\u20263e62)
|
|
29326
|
+
`"${raw}" isn't a valid Sui address or SuiNS name. Pass a 0x-prefixed hex address (e.g. 0x40cd\u20263e62), a SuiNS name ending in .sui (e.g. alex.sui), or a Passport handle (e.g. alex@audric).`
|
|
29318
29327
|
);
|
|
29319
29328
|
this.raw = raw;
|
|
29320
29329
|
this.name = "InvalidAddressError";
|
|
@@ -29338,10 +29347,10 @@ var SuinsRpcError = class extends Error {
|
|
|
29338
29347
|
};
|
|
29339
29348
|
function looksLikeSuiNs(value) {
|
|
29340
29349
|
if (!value) return false;
|
|
29341
|
-
return SUINS_NAME_REGEX.test(value
|
|
29350
|
+
return SUINS_NAME_REGEX.test(canonicalizeRecipientInput(value).toLowerCase());
|
|
29342
29351
|
}
|
|
29343
29352
|
async function resolveSuinsViaRpc(rawName, ctx = {}) {
|
|
29344
|
-
const name = rawName
|
|
29353
|
+
const name = canonicalizeRecipientInput(rawName).toLowerCase();
|
|
29345
29354
|
if (!SUINS_NAME_REGEX.test(name)) {
|
|
29346
29355
|
throw new InvalidAddressError(rawName);
|
|
29347
29356
|
}
|
|
@@ -30403,7 +30412,7 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
30403
30412
|
* with the live execute path (never resolve the same input two ways).
|
|
30404
30413
|
*/
|
|
30405
30414
|
async resolveRecipient(input) {
|
|
30406
|
-
const trimmed = input
|
|
30415
|
+
const trimmed = canonicalizeRecipientInput(input);
|
|
30407
30416
|
if (SUI_ADDRESS_REGEX.test(trimmed)) {
|
|
30408
30417
|
return { address: trimmed.toLowerCase() };
|
|
30409
30418
|
}
|
|
@@ -30427,7 +30436,7 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
30427
30436
|
}
|
|
30428
30437
|
throw new T2000Error(
|
|
30429
30438
|
"INVALID_ADDRESS",
|
|
30430
|
-
`Cannot resolve recipient "${input}". Provide a 0x address
|
|
30439
|
+
`Cannot resolve recipient "${input}". Provide a 0x address, a .sui name, or a Passport handle (name@audric).`
|
|
30431
30440
|
);
|
|
30432
30441
|
}
|
|
30433
30442
|
async balance() {
|