Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/cli/abis/DotnsContentResolver.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/abis/DotnsNameEscrow.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/abis/DotnsNameWhitelist.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down
15 changes: 15 additions & 0 deletions packages/cli/abis/DotnsPopController.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down Expand Up @@ -1061,6 +1066,11 @@
}
]
},
{
"type": "error",
"name": "LiteNameAlreadyIssued",
"inputs": []
},
{
"type": "error",
"name": "NoActiveReservation",
Expand All @@ -1072,6 +1082,11 @@
}
]
},
{
"type": "error",
"name": "NotAuthorised",
"inputs": []
},
{
"type": "error",
"name": "NotHolder",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/abis/DotnsRegistrar.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "name",
"type": "string",
Expand Down Expand Up @@ -879,6 +884,27 @@
"name": "InvalidOwner",
"inputs": []
},
{
"type": "error",
"name": "LabelEntryConflict",
"inputs": [
{
"name": "store",
"type": "address",
"internalType": "address"
},
{
"name": "labelhash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "existing",
"type": "string",
"internalType": "string"
}
]
},
{
"type": "error",
"name": "NameNotAvailable",
Expand Down
26 changes: 26 additions & 0 deletions packages/cli/abis/DotnsRegistrarController.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down Expand Up @@ -629,6 +634,27 @@
"name": "InvalidLabel",
"inputs": []
},
{
"type": "error",
"name": "LabelEntryConflict",
"inputs": [
{
"name": "store",
"type": "address",
"internalType": "address"
},
{
"name": "labelhash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "existing",
"type": "string",
"internalType": "string"
}
]
},
{
"type": "error",
"name": "LabelTooShort",
Expand Down
31 changes: 31 additions & 0 deletions packages/cli/abis/DotnsRegistry.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down Expand Up @@ -221,6 +226,11 @@
"name": "owner",
"type": "address",
"internalType": "address"
},
{
"name": "persist",
"type": "bool",
"internalType": "bool"
}
]
}
Expand Down Expand Up @@ -463,6 +473,27 @@
"name": "InvalidLabel",
"inputs": []
},
{
"type": "error",
"name": "LabelEntryConflict",
"inputs": [
{
"name": "store",
"type": "address",
"internalType": "address"
},
{
"name": "labelhash",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "existing",
"type": "string",
"internalType": "string"
}
]
},
{
"type": "error",
"name": "NodeAlreadyOwned",
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/abis/DotnsResolver.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/abis/DotnsReverseResolver.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down Expand Up @@ -305,7 +310,7 @@
"internalType": "address"
},
{
"name": "tokenId",
"name": "node",
"type": "uint256",
"internalType": "uint256"
}
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/abis/PopRules.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initialOwner",
"type": "address",
"internalType": "address"
},
{
"name": "registry",
"type": "address",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@parity/dotns-cli",
"module": "index.ts",
"version": "0.9.1",
"version": "0.9.2",
"type": "module",
"private": true,
"license": "MIT",
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/cli/commands/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ function printRegistrationResult(result: RegistrationResult): void {
export type TransferDestinationKind = "evm" | "substrate" | "label";

export type RegisterActionOptions = RegistrationCommandOptions & {
/** Subname registration: index into the owner's Label Store (default true). */
persist?: boolean;
transfer?: boolean;
to?: string;
parent?: string;
Expand Down Expand Up @@ -380,7 +382,9 @@ export async function executeSubnameRegistration(
console.log(chalk.gray(" Owner: ") + chalk.white(ownerAddress));

const result = await step("Registering subname", async () =>
registerSubnode(session.ctx, sublabel, parentLabel, ownerAddress),
registerSubnode(session.ctx, sublabel, parentLabel, ownerAddress, {
persist: options.persist !== false,
}),
);
console.log(chalk.gray(" tx: ") + chalk.blue(result.txHash));

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/cli/commands/registerCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function attachRegisterCommand(root: Command) {
.requiredOption("-n, --name <label>", "Subname label to register")
.requiredOption("-p, --parent <label>", "Parent domain label (bare label, without the TLD)")
.option("-o, --owner <address>", "Owner address (EVM or Substrate, or label)")
.option("--no-persist", "Skip indexing the subname into the owner's Label Store (record only)")
.option("--json", "Output result as JSON (suppresses all other output)", false)
.action(async (options: any, cmd: any) => {
const jsonOutput = getJsonFlag(cmd);
Expand Down
9 changes: 9 additions & 0 deletions packages/cli/src/commands/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,17 @@ export type SubnameResult = {
txHash: Hex;
};

export type RegisterSubnodeOptions = {
/** Index the subname into the owner's Label Store (default true). */
persist?: boolean;
};

export async function registerSubnode(
ctx: DotnsContext,
sublabel: string,
parentLabel: string,
ownerAddress: Address,
opts: RegisterSubnodeOptions = {},
): Promise<SubnameResult> {
const subLabel = await normaliseName(ctx, sublabel);
const parent = await normaliseName(ctx, parentLabel);
Expand All @@ -594,6 +600,9 @@ export async function registerSubnode(
subLabel,
parentLabel: parent,
owner: ownerAddress,
// Index into the owner's LabelStore by default, so the name shows up in
// listings the way every other registration does.
persist: opts.persist ?? true,
};

const txHash = await write(
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ export type SubnodeRecord = {

/** Address that will own the new subnode */
owner: Address;

/** Whether the registry indexes the subname into the owner's LabelStore.
* When false only the ownership and resolver record is written. */
persist: boolean;
};

export type BaseNameReservation = {
Expand Down
Loading