bulletin-deploy 0.5.3 → 0.5.5

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 CHANGED
@@ -43,6 +43,9 @@ bulletin-deploy ./dist my-app00.dot
43
43
 
44
44
  # Custom RPC endpoint
45
45
  bulletin-deploy --rpc wss://custom-bulletin.example.com ./dist my-app00.dot
46
+
47
+ # Deploy and publish to the Playground remix registry
48
+ bulletin-deploy --playground ./dist my-app00.dot
46
49
  ```
47
50
 
48
51
  ### All options
@@ -50,9 +53,24 @@ bulletin-deploy --rpc wss://custom-bulletin.example.com ./dist my-app00.dot
50
53
  ```
51
54
  Options:
52
55
  --rpc wss://... Bulletin RPC (or set BULLETIN_RPC env var)
56
+ --mnemonic "..." DotNS owner mnemonic (or set MNEMONIC env var)
57
+ --playground Publish to the Playground remix registry
58
+ --pool-size N Number of pool accounts (default: 10)
53
59
  --help Show help
54
60
  ```
55
61
 
62
+ ### Playground registry
63
+
64
+ By default, deploys only upload to Bulletin storage and register the DotNS domain. The **Playground remix registry** is an on-chain app directory that makes your deploy visible in [Polkadot Playground](https://playground.polkadot.cloud).
65
+
66
+ To publish to it, pass `--playground`:
67
+
68
+ ```bash
69
+ bulletin-deploy --playground ./dist my-app.dot
70
+ ```
71
+
72
+ This requires `cdm.json` in your project root (shipped with bulletin-deploy) and a git remote origin.
73
+
56
74
  ## GitHub Actions
57
75
 
58
76
  1. Copy `workflows/deploy-on-pr.yml` to your repo's `.github/workflows/` directory
@@ -74,12 +92,33 @@ const result = await deploy("./dist", "my-app00.dot");
74
92
  console.log(result.cid, result.domainName);
75
93
  ```
76
94
 
95
+ ## Domain Names and Proof of Personhood
96
+
97
+ DotNS domain names are classified by the PopOracle contract on Asset Hub. The classification determines what level of **Proof of Personhood (PoP)** is required to register:
98
+
99
+ | Domain pattern | Example | Required PoP |
100
+ |---|---|---|
101
+ | Name with trailing digits | `my-app00.dot` | **None** — open to all |
102
+ | Base name (no trailing digits) | `my-app.dot` | **Full** — requires `ProofOfPersonhoodFull` |
103
+
104
+ On **testnets** (Paseo, Westend, local devnets), bulletin-deploy automatically self-grants `ProofOfPersonhoodFull` before registration — no configuration needed. Both base names and names with trailing digits just work:
105
+
106
+ ```bash
107
+ bulletin-deploy ./dist my-app.dot # base name — auto-grants Full PoP
108
+ bulletin-deploy ./dist my-app00.dot # trailing digits — no PoP needed
109
+ ```
110
+
111
+ On **mainnet** (Polkadot Hub, Kusama Hub), PoP cannot be self-granted. You must have a verified account. Set `DOTNS_STATUS=none` explicitly or leave it unset (mainnet defaults to `none`).
112
+
113
+ If you see **"Requires Full Personhood verification"**, the deploy will fail early with an actionable error message before any gas is spent on commitment transactions.
114
+
77
115
  ## Environment Variables
78
116
 
79
117
  | Variable | Default | Description |
80
118
  |---|---|---|
81
119
  | `BULLETIN_RPC` | `wss://paseo-bulletin-rpc.polkadot.io` | Bulletin chain WebSocket RPC |
82
120
  | `BULLETIN_DEPLOY_TELEMETRY` | `1` (enabled) | Set to `0` to disable Sentry telemetry |
121
+ | `DOTNS_STATUS` | `full` (testnet) / `none` (mainnet) | PoP level to self-grant before registration: `none`, `lite`, or `full` |
83
122
  | `IPFS_CID` | _(none)_ | Skip storage, use pre-existing CID |
84
123
 
85
124
  ## How It Works
@@ -128,6 +167,7 @@ Dashboard: https://polkadot-community-foundation.sentry.io/dashboards/92523/
128
167
 
129
168
  | Error | Solution |
130
169
  |---|---|
170
+ | `Requires Full Personhood verification` | Auto-handled on testnets (v0.5.4+). On mainnet, your account needs verified PoP status. |
131
171
  | `Payment` or authorization error | Pool account needs storage authorization — auto-authorization should handle this |
132
172
  | `Stale` or dropped from best chain | Bulletin chain reorg. Automatic retry handles this. |
133
173
  | `IPFS CLI not installed` | Install Kubo: `brew install ipfs && ipfs init` |
@@ -13,6 +13,7 @@ for (let i = 0; i < args.length; i++) {
13
13
  else if (args[i] === "--pool-size") { flags.poolSize = parseInt(args[++i], 10); }
14
14
  else if (args[i] === "--mnemonic") { flags.mnemonic = args[++i]; }
15
15
  else if (args[i] === "--rpc") { flags.rpc = args[++i]; }
16
+ else if (args[i] === "--playground") { flags.playground = true; }
16
17
  else if (args[i] === "--help" || args[i] === "-h") { flags.help = true; }
17
18
  else { positional.push(args[i]); }
18
19
  }
@@ -26,6 +27,7 @@ Options:
26
27
  --mnemonic "..." DotNS owner mnemonic (or set MNEMONIC env var)
27
28
  --rpc wss://... Bulletin RPC (or set BULLETIN_RPC env var)
28
29
  --pool-size N Number of pool accounts (default: 10)
30
+ --playground Publish to the playground remix registry
29
31
  --help Show this help`);
30
32
  process.exit(0);
31
33
  }
@@ -44,7 +46,7 @@ try {
44
46
  if (!domain) { console.error("Error: domain required (e.g. my-app.dot)"); process.exit(1); }
45
47
  if (!fs.existsSync(buildDir)) { console.error(`Error: ${buildDir} does not exist`); process.exit(1); }
46
48
 
47
- const result = await deploy(buildDir, domain);
49
+ const result = await deploy(buildDir, domain, { playground: flags.playground });
48
50
 
49
51
  const output = process.env.GITHUB_OUTPUT;
50
52
  if (output) {
package/cdm.json CHANGED
@@ -13,8 +13,8 @@
13
13
  "contracts": {
14
14
  "acc2c3b5e912b762": {
15
15
  "@example/playground-registry": {
16
- "version": 2,
17
- "address": "0x7D97a3E87c0C2fe921E471D076b95975886CEAA8",
16
+ "version": 3,
17
+ "address": "0xF8304E5C17769A53E012f39c6990cC8a7AaBC6A5",
18
18
  "abi": [
19
19
  {
20
20
  "type": "constructor",
@@ -39,35 +39,58 @@
39
39
  },
40
40
  {
41
41
  "type": "function",
42
- "name": "getMetadataUri",
42
+ "name": "getAppCount",
43
+ "inputs": [],
44
+ "outputs": [
45
+ {
46
+ "name": "",
47
+ "type": "uint32"
48
+ }
49
+ ],
50
+ "stateMutability": "view"
51
+ },
52
+ {
53
+ "type": "function",
54
+ "name": "getDomainAt",
43
55
  "inputs": [
44
56
  {
45
- "name": "domain",
57
+ "name": "index",
58
+ "type": "uint32"
59
+ }
60
+ ],
61
+ "outputs": [
62
+ {
63
+ "name": "",
46
64
  "type": "string"
47
65
  }
48
66
  ],
67
+ "stateMutability": "view"
68
+ },
69
+ {
70
+ "type": "function",
71
+ "name": "getOwnerAppCount",
72
+ "inputs": [
73
+ {
74
+ "name": "owner",
75
+ "type": "address"
76
+ }
77
+ ],
49
78
  "outputs": [
50
79
  {
51
80
  "name": "",
52
- "type": "tuple",
53
- "components": [
54
- {
55
- "name": "isSome",
56
- "type": "bool"
57
- },
58
- {
59
- "name": "value",
60
- "type": "string"
61
- }
62
- ]
81
+ "type": "uint32"
63
82
  }
64
83
  ],
65
84
  "stateMutability": "view"
66
85
  },
67
86
  {
68
87
  "type": "function",
69
- "name": "getDomainAt",
88
+ "name": "getOwnerDomainAt",
70
89
  "inputs": [
90
+ {
91
+ "name": "owner",
92
+ "type": "address"
93
+ },
71
94
  {
72
95
  "name": "index",
73
96
  "type": "uint32"
@@ -83,7 +106,7 @@
83
106
  },
84
107
  {
85
108
  "type": "function",
86
- "name": "getOwner",
109
+ "name": "getMetadataUri",
87
110
  "inputs": [
88
111
  {
89
112
  "name": "domain",
@@ -93,25 +116,40 @@
93
116
  "outputs": [
94
117
  {
95
118
  "name": "",
96
- "type": "address"
119
+ "type": "tuple",
120
+ "components": [
121
+ {
122
+ "name": "isSome",
123
+ "type": "bool"
124
+ },
125
+ {
126
+ "name": "value",
127
+ "type": "string"
128
+ }
129
+ ]
97
130
  }
98
131
  ],
99
132
  "stateMutability": "view"
100
133
  },
101
134
  {
102
135
  "type": "function",
103
- "name": "getAppCount",
104
- "inputs": [],
136
+ "name": "getOwner",
137
+ "inputs": [
138
+ {
139
+ "name": "domain",
140
+ "type": "string"
141
+ }
142
+ ],
105
143
  "outputs": [
106
144
  {
107
145
  "name": "",
108
- "type": "uint32"
146
+ "type": "address"
109
147
  }
110
148
  ],
111
149
  "stateMutability": "view"
112
150
  }
113
151
  ],
114
- "metadataCid": "bafk2bzacecrjrmrgumcww7oc23rllfscbxpd2lxc6p2svb26c6e5tjvmr565s"
152
+ "metadataCid": "bafk2bzacebkch7cuoi77j5vkrkoplax4urywwga7ijamtd3pntv7xjgabhtgs"
115
153
  }
116
154
  }
117
155
  }
@@ -3,7 +3,7 @@ import {
3
3
  DotNS,
4
4
  TX_TIMEOUT_MS,
5
5
  fetchNonce
6
- } from "./chunk-W23LLCZF.js";
6
+ } from "./chunk-WQ74BM5S.js";
7
7
  import {
8
8
  derivePoolAccounts,
9
9
  ensureAuthorized,
@@ -360,7 +360,7 @@ async function storeDirectory(directoryPath) {
360
360
  });
361
361
  return { storageCid, ipfsCid };
362
362
  }
363
- async function deploy(content, domainName = null) {
363
+ async function deploy(content, domainName = null, options = {}) {
364
364
  initTelemetry();
365
365
  const randomSuffix = Math.floor(Math.random() * 100).toString().padStart(2, "0");
366
366
  const name = domainName ? domainName.replace(".dot", "") : `test-domain-${Date.now().toString(36)}${randomSuffix}`;
@@ -441,53 +441,52 @@ async function deploy(content, domainName = null) {
441
441
  await dotns.setContenthash(name, contenthashHex);
442
442
  dotns.disconnect();
443
443
  });
444
- console.log("\n" + "=".repeat(60));
445
- console.log("Registry");
446
- console.log("=".repeat(60));
447
- await withSpan("deploy.registry", "3. registry", { "deploy.domain": name }, async () => {
448
- const repoUrl = getGitRemoteUrl();
449
- if (!repoUrl) {
450
- console.log("\n Skipping registry: not a git repository (no remote origin found)");
451
- return;
452
- }
453
- if (!fs.existsSync(CDM_JSON_PATH)) {
454
- console.log("\n Skipping registry: cdm.json not found");
455
- return;
456
- }
457
- console.log(`
458
- Repository: ${repoUrl}`);
459
- const metadata = JSON.stringify({ repository: repoUrl });
460
- const metadataBytes = new Uint8Array(Buffer.from(metadata, "utf-8"));
461
- console.log(` Uploading metadata to Bulletin...`);
462
- const metadataCid = await storeFile(metadataBytes);
463
- console.log(` Metadata CID: ${metadataCid}`);
464
- const cdmJson = JSON.parse(fs.readFileSync(CDM_JSON_PATH, "utf-8"));
465
- const { signer, origin } = getRegistrySigner();
466
- console.log(` Publishing to registry as ${origin}...`);
467
- const MAX_REGISTRY_RETRIES = 3;
468
- for (let attempt = 1; attempt <= MAX_REGISTRY_RETRIES; attempt++) {
469
- const cdm = createCdm(cdmJson, { defaultSigner: signer, defaultOrigin: origin });
470
- try {
471
- const registry = cdm.getContract("@example/playground-registry");
472
- const result = await registry.publish.tx(`${name}.dot`, metadataCid);
473
- if (!result.ok) throw new Error("Registry publish transaction failed");
474
- console.log(` Tx: ${result.txHash}`);
475
- console.log(` Registered ${name}.dot in app registry!`);
476
- break;
477
- } catch (e) {
478
- if (attempt < MAX_REGISTRY_RETRIES) {
479
- captureWarning("Registry publish failed, retrying", { attempt, maxRetries: MAX_REGISTRY_RETRIES, error: e.message?.slice(0, 200) });
480
- console.log(` Attempt ${attempt} failed: ${e.message?.slice(0, 80)}`);
481
- console.log(` Retrying in 6s...`);
482
- await new Promise((r) => setTimeout(r, 6e3));
483
- continue;
444
+ if (options.playground) {
445
+ console.log("\n" + "=".repeat(60));
446
+ console.log("Playground Registry");
447
+ console.log("=".repeat(60));
448
+ await withSpan("deploy.registry", "3. registry", { "deploy.domain": name }, async () => {
449
+ const repoUrl = getGitRemoteUrl();
450
+ if (!fs.existsSync(CDM_JSON_PATH)) {
451
+ console.log("\n Skipping registry: cdm.json not found");
452
+ return;
453
+ }
454
+ const metadata = {};
455
+ if (repoUrl) metadata.repository = repoUrl;
456
+ console.log(`
457
+ Metadata: ${JSON.stringify(metadata)}`);
458
+ const metadataBytes = new Uint8Array(Buffer.from(JSON.stringify(metadata), "utf-8"));
459
+ console.log(` Uploading metadata to Bulletin...`);
460
+ const metadataCid = await storeFile(metadataBytes);
461
+ console.log(` Metadata CID: ${metadataCid}`);
462
+ const cdmJson = JSON.parse(fs.readFileSync(CDM_JSON_PATH, "utf-8"));
463
+ const { signer, origin } = getRegistrySigner();
464
+ console.log(` Publishing to registry as ${origin}...`);
465
+ const MAX_REGISTRY_RETRIES = 3;
466
+ for (let attempt = 1; attempt <= MAX_REGISTRY_RETRIES; attempt++) {
467
+ const cdm = createCdm(cdmJson, { defaultSigner: signer, defaultOrigin: origin });
468
+ try {
469
+ const registry = cdm.getContract("@example/playground-registry");
470
+ const result = await registry.publish.tx(`${name}.dot`, metadataCid);
471
+ if (!result.ok) throw new Error("Registry publish transaction failed");
472
+ console.log(` Tx: ${result.txHash}`);
473
+ console.log(` Registered ${name}.dot in playground registry!`);
474
+ break;
475
+ } catch (e) {
476
+ if (attempt < MAX_REGISTRY_RETRIES) {
477
+ captureWarning("Registry publish failed, retrying", { attempt, maxRetries: MAX_REGISTRY_RETRIES, error: e.message?.slice(0, 200) });
478
+ console.log(` Attempt ${attempt} failed: ${e.message?.slice(0, 80)}`);
479
+ console.log(` Retrying in 6s...`);
480
+ await new Promise((r) => setTimeout(r, 6e3));
481
+ continue;
482
+ }
483
+ throw e;
484
+ } finally {
485
+ cdm.destroy();
484
486
  }
485
- throw e;
486
- } finally {
487
- cdm.destroy();
488
487
  }
489
- }
490
- });
488
+ });
489
+ }
491
490
  console.log("\n" + "=".repeat(60));
492
491
  console.log("DEPLOYMENT COMPLETE!");
493
492
  console.log("=".repeat(60));
@@ -607,15 +607,29 @@ var DotNS = class {
607
607
  }
608
608
  async register(label, options = {}) {
609
609
  return withSpan("deploy.dotns.register", `2a. register ${label}.dot`, {}, async () => {
610
- const status = parseProofOfPersonhoodStatus(options.status || process.env.DOTNS_STATUS);
610
+ const MAINNET_RPC_PATTERNS = ["polkadot-asset-hub-rpc.polkadot.io", "kusama-asset-hub-rpc.polkadot.io", "polkadothub-rpc.com/mainnet"];
611
+ const isMainnet = this.rpc && MAINNET_RPC_PATTERNS.some((p) => this.rpc.includes(p));
612
+ const statusDefault = isMainnet ? "none" : "full";
613
+ const status = parseProofOfPersonhoodStatus(options.status || process.env.DOTNS_STATUS || statusDefault);
611
614
  const reverse = options.reverse ?? (process.env.DOTNS_REVERSE ?? "false").toLowerCase() === "true";
612
615
  if (!this.connected) await this.connect(options);
613
616
  label = validateDomainLabel(label);
614
- await Promise.all([
617
+ const [classification] = await Promise.all([
615
618
  this.classifyName(label),
616
- this.ensureNotRegistered(label),
617
- this.setUserPopStatus(status)
619
+ this.ensureNotRegistered(label)
618
620
  ]);
621
+ await this.setUserPopStatus(status);
622
+ const userStatus = await this.getUserPopStatus();
623
+ const requiredStatus = classification.requiredStatus;
624
+ if (requiredStatus === ProofOfPersonhoodStatus.Reserved) {
625
+ throw new Error(classification.message);
626
+ }
627
+ if (requiredStatus === ProofOfPersonhoodStatus.ProofOfPersonhoodFull && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodFull) {
628
+ throw new Error("Requires Full Personhood verification. Set DOTNS_STATUS=full or use a domain with trailing digits (e.g. my-app00.dot)");
629
+ }
630
+ if (requiredStatus === ProofOfPersonhoodStatus.ProofOfPersonhoodLite && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodLite && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodFull) {
631
+ throw new Error("Requires Personhood Lite verification. Set DOTNS_STATUS=lite or DOTNS_STATUS=full");
632
+ }
619
633
  const { commitment, registration } = await this.generateCommitment(label, reverse);
620
634
  await withSpan("deploy.dotns.submit-commitment", "2a-i. submit-commitment", {}, () => this.submitCommitment(commitment));
621
635
  await withSpan("deploy.dotns.wait-commitment-age", "2a-ii. wait-commitment-age", {}, () => this.waitForCommitmentAge());
package/dist/deploy.d.ts CHANGED
@@ -28,6 +28,9 @@ declare function storeDirectory(directoryPath: string): Promise<{
28
28
  storageCid: string;
29
29
  ipfsCid: string;
30
30
  }>;
31
- declare function deploy(content: DeployContent, domainName?: string | null): Promise<DeployResult>;
31
+ interface DeployOptions {
32
+ playground?: boolean;
33
+ }
34
+ declare function deploy(content: DeployContent, domainName?: string | null, options?: DeployOptions): Promise<DeployResult>;
32
35
 
33
- export { type DeployContent, type DeployResult, chunk, createCID, deploy, encodeContenthash, hasIPFS, merkleize, storeChunkedContent, storeDirectory, storeFile };
36
+ export { type DeployContent, type DeployOptions, type DeployResult, chunk, createCID, deploy, encodeContenthash, hasIPFS, merkleize, storeChunkedContent, storeDirectory, storeFile };
package/dist/deploy.js CHANGED
@@ -8,8 +8,8 @@ import {
8
8
  storeChunkedContent,
9
9
  storeDirectory,
10
10
  storeFile
11
- } from "./chunk-JF2UR7FV.js";
12
- import "./chunk-W23LLCZF.js";
11
+ } from "./chunk-RS62TJNH.js";
12
+ import "./chunk-WQ74BM5S.js";
13
13
  import "./chunk-RV7XBIIO.js";
14
14
  import "./chunk-2RURGSQW.js";
15
15
  import "./chunk-QGM4M3NI.js";
package/dist/dotns.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  sanitizeDomainLabel,
19
19
  stripTrailingDigits,
20
20
  validateDomainLabel
21
- } from "./chunk-W23LLCZF.js";
21
+ } from "./chunk-WQ74BM5S.js";
22
22
  import "./chunk-2RURGSQW.js";
23
23
  import "./chunk-QGM4M3NI.js";
24
24
  export {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { DeployContent, DeployResult, deploy } from './deploy.js';
1
+ export { DeployContent, DeployOptions, DeployResult, deploy } from './deploy.js';
2
2
  export { PoolAccount, PoolAuthorization, bootstrapPool, derivePoolAccounts, ensureAuthorized, fetchPoolAuthorizations, selectAccount } from './pool.js';
3
3
  export { DotNS, DotNSConnectOptions, OwnershipResult, PriceValidationResult } from './dotns.js';
4
4
  import 'multiformats/cid';
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  deploy
3
- } from "./chunk-JF2UR7FV.js";
3
+ } from "./chunk-RS62TJNH.js";
4
4
  import {
5
5
  DotNS
6
- } from "./chunk-W23LLCZF.js";
6
+ } from "./chunk-WQ74BM5S.js";
7
7
  import {
8
8
  bootstrapPool,
9
9
  derivePoolAccounts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulletin-deploy",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",