@parity/dotns-cli 0.6.9 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/cli.js +19 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -446,8 +446,10 @@ dotns --password test-password store get mykey --account default
|
|
|
446
446
|
dotns --password test-password store set mykey "my value" --account default
|
|
447
447
|
dotns --password test-password store delete mykey --account default
|
|
448
448
|
|
|
449
|
-
# List the .dot names in your Label Store
|
|
449
|
+
# List the .dot names in your Label Store (second-level names only by default;
|
|
450
|
+
# add --all to include subdomains), and cached CIDs
|
|
450
451
|
dotns --password test-password store names --account default
|
|
452
|
+
dotns --password test-password store names --all --account default
|
|
451
453
|
dotns --password test-password store cids --account default
|
|
452
454
|
|
|
453
455
|
# Settle any pending names from the PoP controller into your Label Store
|
package/dist/cli.js
CHANGED
|
@@ -275718,6 +275718,9 @@ function asLabel(name10) {
|
|
|
275718
275718
|
const raw = name10.trim().toLowerCase();
|
|
275719
275719
|
return raw.endsWith(".dot") ? raw.slice(0, -4) : raw;
|
|
275720
275720
|
}
|
|
275721
|
+
function isSecondLevelDotName(name10) {
|
|
275722
|
+
return asLabel(name10).split(".").filter(Boolean).length === 1;
|
|
275723
|
+
}
|
|
275721
275724
|
var CANONICAL_LABEL_REGEX = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
|
|
275722
275725
|
function isCanonicalLabel(label) {
|
|
275723
275726
|
return label.length > 0 && label.length <= 63 && CANONICAL_LABEL_REGEX.test(label);
|
|
@@ -277996,7 +277999,7 @@ function attachStoreCommands(root) {
|
|
|
277996
277999
|
handleCommandError2(error2, cmd);
|
|
277997
278000
|
}
|
|
277998
278001
|
});
|
|
277999
|
-
const listCommand = storeCommand.command("list").description("List all values in your
|
|
278002
|
+
const listCommand = storeCommand.command("list").description("List all values in your UserStore").option("--json", "Output result as JSON", false);
|
|
278000
278003
|
addAuthOptions(listCommand).action(async (options2, cmd) => {
|
|
278001
278004
|
try {
|
|
278002
278005
|
const merged = { ...options2 ?? {}, ...getAuthOptions(cmd) };
|
|
@@ -278015,13 +278018,14 @@ function attachStoreCommands(root) {
|
|
|
278015
278018
|
handleCommandError2(error2, cmd);
|
|
278016
278019
|
}
|
|
278017
278020
|
});
|
|
278018
|
-
const namesCommand = storeCommand.command("names").description("List
|
|
278021
|
+
const namesCommand = storeCommand.command("names").description("List .dot names in your LabelStore (second-level names only by default)").option("--all", "Include subdomains (default: only second-level .dot names)", false).option("--json", "Output result as JSON", false);
|
|
278019
278022
|
addAuthOptions(namesCommand).action(async (options2, cmd) => {
|
|
278020
278023
|
try {
|
|
278021
278024
|
const merged = { ...options2 ?? {}, ...getAuthOptions(cmd) };
|
|
278022
278025
|
const jsonOutput = getJsonFlag(cmd);
|
|
278023
278026
|
const { clientWrapper, account, evmAddress } = await maybeQuiet(jsonOutput, () => prepareReadOnlyContext(merged));
|
|
278024
|
-
const
|
|
278027
|
+
const allNames = await listStoreNames(clientWrapper, account.address, evmAddress);
|
|
278028
|
+
const names = options2.all ? allNames : allNames.filter(isSecondLevelDotName);
|
|
278025
278029
|
if (jsonOutput) {
|
|
278026
278030
|
console.log(JSON.stringify({ names }));
|
|
278027
278031
|
} else {
|
|
@@ -278282,8 +278286,7 @@ async function claimWithdrawal(clientWrapper, originSubstrateAddress, signer, sp
|
|
|
278282
278286
|
async function listRefunds(clientWrapper, originSubstrateAddress, recipient, offset, limit, spinner) {
|
|
278283
278287
|
spinner.start(`Reading refund ledger for ${source_default.white(recipient)}`);
|
|
278284
278288
|
const total = await performContractCall(clientWrapper, originSubstrateAddress, CONTRACTS.DOTNS_NAME_ESCROW, DOTNS_NAME_ESCROW_ABI, "pendingRefundCount", [recipient]);
|
|
278285
|
-
const ids = await performContractCall(clientWrapper, originSubstrateAddress, CONTRACTS.DOTNS_NAME_ESCROW, DOTNS_NAME_ESCROW_ABI, "
|
|
278286
|
-
const entries = await performContractCall(clientWrapper, originSubstrateAddress, CONTRACTS.DOTNS_NAME_ESCROW, DOTNS_NAME_ESCROW_ABI, "pendingRefunds", [recipient, BigInt(offset), BigInt(limit)]);
|
|
278289
|
+
const [ids, entries] = await performContractCall(clientWrapper, originSubstrateAddress, CONTRACTS.DOTNS_NAME_ESCROW, DOTNS_NAME_ESCROW_ABI, "pendingRefunds", [recipient, BigInt(offset), BigInt(limit)]);
|
|
278287
278290
|
spinner.succeed(`Found ${source_default.yellow(total.toString())} entries; page returned ${entries.length}.`);
|
|
278288
278291
|
return {
|
|
278289
278292
|
recipient,
|
|
@@ -278323,6 +278326,11 @@ init_storeManagement();
|
|
|
278323
278326
|
init_formatting();
|
|
278324
278327
|
var DEFAULT_REFUND_PAGE_SIZE = 50;
|
|
278325
278328
|
var MAX_REFUND_PAGE_SIZE = 200;
|
|
278329
|
+
async function resolveRecipientOption(jsonOutput, context, recipientOption) {
|
|
278330
|
+
if (!recipientOption)
|
|
278331
|
+
return context.evmAddress;
|
|
278332
|
+
return maybeQuiet(jsonOutput, () => resolveTransferRecipient(context.clientWrapper, context.account.address, recipientOption));
|
|
278333
|
+
}
|
|
278326
278334
|
function parsePositiveBigInt(value3, label) {
|
|
278327
278335
|
if (!/^\d+$/.test(value3.trim())) {
|
|
278328
278336
|
throw new Error(`${label} must be a non-negative decimal integer`);
|
|
@@ -278368,13 +278376,13 @@ function attachEscrowCommands(root) {
|
|
|
278368
278376
|
handleCommandError(jsonOutput, error2);
|
|
278369
278377
|
}
|
|
278370
278378
|
});
|
|
278371
|
-
const balanceCommand = escrowCommand.command("balance").description("Show the caller's claimable pull-payment balance").option("--recipient <address>", "Recipient EVM address (defaults to caller)").option("--json", "Output result as JSON (suppresses all other output)", false);
|
|
278379
|
+
const balanceCommand = escrowCommand.command("balance").description("Show the caller's claimable pull-payment balance").option("--recipient <address>", "Recipient EVM address, SS58 address, or .dot label (defaults to caller)").option("--json", "Output result as JSON (suppresses all other output)", false);
|
|
278372
278380
|
addAuthOptions(balanceCommand).action(async (options2, command) => {
|
|
278373
278381
|
const jsonOutput = getJsonFlag(command);
|
|
278374
278382
|
try {
|
|
278375
278383
|
const mergedOptions = getMergedOptions(command, options2);
|
|
278376
278384
|
const context = await maybeQuiet(jsonOutput, () => prepareReadOnlyContext(mergedOptions));
|
|
278377
|
-
const recipient =
|
|
278385
|
+
const recipient = await resolveRecipientOption(jsonOutput, context, options2.recipient);
|
|
278378
278386
|
if (!jsonOutput)
|
|
278379
278387
|
console.log(source_default.bold(`
|
|
278380
278388
|
▶ Escrow balance
|
|
@@ -278392,13 +278400,13 @@ function attachEscrowCommands(root) {
|
|
|
278392
278400
|
handleCommandError(jsonOutput, error2);
|
|
278393
278401
|
}
|
|
278394
278402
|
});
|
|
278395
|
-
const positionsCommand = escrowCommand.command("positions").description("List all escrow positions for the caller and the total locked").option("--recipient <address>", "Recipient EVM address (defaults to caller)").option("--json", "Output result as JSON (suppresses all other output)", false);
|
|
278403
|
+
const positionsCommand = escrowCommand.command("positions").description("List all escrow positions for the caller and the total locked").option("--recipient <address>", "Recipient EVM address, SS58 address, or .dot label (defaults to caller)").option("--json", "Output result as JSON (suppresses all other output)", false);
|
|
278396
278404
|
addAuthOptions(positionsCommand).action(async (options2, command) => {
|
|
278397
278405
|
const jsonOutput = getJsonFlag(command);
|
|
278398
278406
|
try {
|
|
278399
278407
|
const mergedOptions = getMergedOptions(command, options2);
|
|
278400
278408
|
const context = await maybeQuiet(jsonOutput, () => prepareReadOnlyContext(mergedOptions));
|
|
278401
|
-
const recipient =
|
|
278409
|
+
const recipient = await resolveRecipientOption(jsonOutput, context, options2.recipient);
|
|
278402
278410
|
if (!jsonOutput)
|
|
278403
278411
|
console.log(source_default.bold(`
|
|
278404
278412
|
▶ Escrow positions
|
|
@@ -278521,7 +278529,7 @@ function attachEscrowCommands(root) {
|
|
|
278521
278529
|
}
|
|
278522
278530
|
});
|
|
278523
278531
|
const refundsCommand = escrowCommand.command("refunds").description("Inspect and claim entries from the time-locked refund ledger");
|
|
278524
|
-
const refundsListCommand = refundsCommand.command("list").description("List pending refund entries for the caller (or a specified recipient)").option("--recipient <address>", "Recipient EVM address (defaults to caller)").option("--offset <n>", "Page offset", "0").option("--limit <n>", `Page size (max ${MAX_REFUND_PAGE_SIZE})`, String(DEFAULT_REFUND_PAGE_SIZE)).option("--json", "Output result as JSON (suppresses all other output)", false);
|
|
278532
|
+
const refundsListCommand = refundsCommand.command("list").description("List pending refund entries for the caller (or a specified recipient)").option("--recipient <address>", "Recipient EVM address, SS58 address, or .dot label (defaults to caller)").option("--offset <n>", "Page offset", "0").option("--limit <n>", `Page size (max ${MAX_REFUND_PAGE_SIZE})`, String(DEFAULT_REFUND_PAGE_SIZE)).option("--json", "Output result as JSON (suppresses all other output)", false);
|
|
278525
278533
|
addAuthOptions(refundsListCommand).action(async (options2, command) => {
|
|
278526
278534
|
const jsonOutput = getJsonFlag(command);
|
|
278527
278535
|
try {
|
|
@@ -278534,7 +278542,7 @@ function attachEscrowCommands(root) {
|
|
|
278534
278542
|
if (!Number.isInteger(limit) || limit < 1 || limit > MAX_REFUND_PAGE_SIZE) {
|
|
278535
278543
|
throw new Error(`limit must be between 1 and ${MAX_REFUND_PAGE_SIZE}`);
|
|
278536
278544
|
}
|
|
278537
|
-
const recipient =
|
|
278545
|
+
const recipient = await resolveRecipientOption(jsonOutput, context, options2.recipient);
|
|
278538
278546
|
if (!jsonOutput)
|
|
278539
278547
|
console.log(source_default.bold(`
|
|
278540
278548
|
▶ Refund ledger
|