bulletin-deploy 0.6.2-rc.0 → 0.6.2

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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  captureWarning,
3
3
  withSpan
4
- } from "./chunk-CWGI2QOL.js";
4
+ } from "./chunk-OUE2NAOG.js";
5
5
 
6
6
  // src/dotns.ts
7
7
  import crypto from "crypto";
@@ -43,7 +43,6 @@ var CONTRACTS = {
43
43
  };
44
44
  var DECIMALS = 12n;
45
45
  var NATIVE_TO_ETH_RATIO = 1000000n;
46
- var CONNECTION_TIMEOUT_MS = 3e4;
47
46
  var OPERATION_TIMEOUT_MS = 3e5;
48
47
  var TX_TIMEOUT_MS = 9e4;
49
48
  var DEFAULT_MNEMONIC = "bottom drive obey lake curtain smoke basket hold race lonely fit walk";
@@ -402,15 +401,10 @@ var DotNS = class {
402
401
  this.substrateAddress = account.address;
403
402
  this.signer = getPolkadotSigner(account.publicKey, "Sr25519", async (input) => account.sign(input));
404
403
  }
405
- this.evmAddress = await withTimeout(
406
- this.clientWrapper.getEvmAddress(this.substrateAddress),
407
- CONNECTION_TIMEOUT_MS,
408
- `Connect to ${rpc}`
409
- );
404
+ this.evmAddress = await this.clientWrapper.getEvmAddress(this.substrateAddress);
405
+ this.connected = true;
410
406
  console.log(` SS58 Address: ${this.substrateAddress}`);
411
407
  console.log(` H160 Address: ${this.evmAddress}`);
412
- await this.clientWrapper.ensureAccountMapped(this.substrateAddress, this.signer);
413
- this.connected = true;
414
408
  return this;
415
409
  } catch (e) {
416
410
  lastError = e;
@@ -618,7 +612,10 @@ var DotNS = class {
618
612
  }
619
613
  async register(label, options = {}) {
620
614
  return withSpan("deploy.dotns.register", `2a. register ${label}.dot`, {}, async () => {
621
- const explicitStatus = options.status || process.env.DOTNS_STATUS;
615
+ const MAINNET_RPC_PATTERNS = ["polkadot-asset-hub-rpc.polkadot.io", "kusama-asset-hub-rpc.polkadot.io", "polkadothub-rpc.com/mainnet"];
616
+ const isMainnet = this.rpc && MAINNET_RPC_PATTERNS.some((p) => this.rpc.includes(p));
617
+ const statusDefault = isMainnet ? "none" : "full";
618
+ const status = parseProofOfPersonhoodStatus(options.status || process.env.DOTNS_STATUS || statusDefault);
622
619
  const reverse = options.reverse ?? (process.env.DOTNS_REVERSE ?? "false").toLowerCase() === "true";
623
620
  if (!this.connected) await this.connect(options);
624
621
  label = validateDomainLabel(label);
@@ -626,22 +623,17 @@ var DotNS = class {
626
623
  this.classifyName(label),
627
624
  this.ensureNotRegistered(label)
628
625
  ]);
626
+ await this.setUserPopStatus(status);
627
+ const userStatus = await this.getUserPopStatus();
629
628
  const requiredStatus = classification.requiredStatus;
630
629
  if (requiredStatus === ProofOfPersonhoodStatus.Reserved) {
631
630
  throw new Error(classification.message);
632
631
  }
633
- if (requiredStatus !== ProofOfPersonhoodStatus.NoStatus || explicitStatus) {
634
- const targetStatus = explicitStatus ? parseProofOfPersonhoodStatus(explicitStatus) : requiredStatus;
635
- if (targetStatus !== ProofOfPersonhoodStatus.NoStatus) {
636
- await this.setUserPopStatus(targetStatus);
637
- }
638
- const userStatus = await this.getUserPopStatus();
639
- if (requiredStatus === ProofOfPersonhoodStatus.ProofOfPersonhoodFull && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodFull) {
640
- throw new Error("Requires Full Personhood verification. Set DOTNS_STATUS=full or use a domain with trailing digits (e.g. my-app00.dot)");
641
- }
642
- if (requiredStatus === ProofOfPersonhoodStatus.ProofOfPersonhoodLite && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodLite && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodFull) {
643
- throw new Error("Requires Personhood Lite verification. Set DOTNS_STATUS=lite or DOTNS_STATUS=full");
644
- }
632
+ if (requiredStatus === ProofOfPersonhoodStatus.ProofOfPersonhoodFull && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodFull) {
633
+ throw new Error("Requires Full Personhood verification. Set DOTNS_STATUS=full or use a domain with trailing digits (e.g. my-app00.dot)");
634
+ }
635
+ if (requiredStatus === ProofOfPersonhoodStatus.ProofOfPersonhoodLite && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodLite && userStatus !== ProofOfPersonhoodStatus.ProofOfPersonhoodFull) {
636
+ throw new Error("Requires Personhood Lite verification. Set DOTNS_STATUS=lite or DOTNS_STATUS=full");
645
637
  }
646
638
  const { commitment, registration } = await this.generateCommitment(label, reverse);
647
639
  await withSpan("deploy.dotns.submit-commitment", "2a-i. submit-commitment", {}, () => this.submitCommitment(commitment));
@@ -670,7 +662,6 @@ export {
670
662
  CONTRACTS,
671
663
  DECIMALS,
672
664
  NATIVE_TO_ETH_RATIO,
673
- CONNECTION_TIMEOUT_MS,
674
665
  OPERATION_TIMEOUT_MS,
675
666
  TX_TIMEOUT_MS,
676
667
  DEFAULT_MNEMONIC,
@@ -3,7 +3,7 @@ import {
3
3
  DotNS,
4
4
  TX_TIMEOUT_MS,
5
5
  fetchNonce
6
- } from "./chunk-ZUKSPFW3.js";
6
+ } from "./chunk-3I7SHB4A.js";
7
7
  import {
8
8
  derivePoolAccounts,
9
9
  ensureAuthorized,
@@ -17,13 +17,12 @@ import {
17
17
  setDeployAttribute,
18
18
  withDeploySpan,
19
19
  withSpan
20
- } from "./chunk-CWGI2QOL.js";
20
+ } from "./chunk-OUE2NAOG.js";
21
21
 
22
22
  // src/deploy.ts
23
23
  import { Buffer } from "buffer";
24
24
  import * as fs from "fs";
25
25
  import * as path from "path";
26
- import { fileURLToPath } from "url";
27
26
  import { execSync } from "child_process";
28
27
  import { sha256 } from "@noble/hashes/sha256";
29
28
  import { blake2b } from "@noble/hashes/blake2b";
@@ -42,6 +41,238 @@ import { createCdm } from "@dotdm/cdm";
42
41
  import { getPolkadotSigner } from "polkadot-api/signer";
43
42
  import { sr25519CreateDerive } from "@polkadot-labs/hdkd";
44
43
  import { mnemonicToEntropy, entropyToMiniSecret, ss58Address } from "@polkadot-labs/hdkd-helpers";
44
+
45
+ // cdm.json
46
+ var cdm_default = {
47
+ targets: {
48
+ acc2c3b5e912b762: {
49
+ "asset-hub": "wss://asset-hub-paseo-rpc.n.dwellir.com",
50
+ bulletin: "https://paseo-ipfs.polkadot.io/ipfs"
51
+ }
52
+ },
53
+ dependencies: {
54
+ acc2c3b5e912b762: {
55
+ "@example/playground-registry": "latest"
56
+ }
57
+ },
58
+ contracts: {
59
+ acc2c3b5e912b762: {
60
+ "@example/playground-registry": {
61
+ version: 5,
62
+ address: "0x150dCe6077E4546151919bF1d202419fe1131d9b",
63
+ abi: [
64
+ {
65
+ type: "constructor",
66
+ inputs: [],
67
+ stateMutability: "nonpayable"
68
+ },
69
+ {
70
+ type: "function",
71
+ name: "publish",
72
+ inputs: [
73
+ {
74
+ name: "domain",
75
+ type: "string"
76
+ },
77
+ {
78
+ name: "metadata_uri",
79
+ type: "string"
80
+ }
81
+ ],
82
+ outputs: [],
83
+ stateMutability: "nonpayable"
84
+ },
85
+ {
86
+ type: "function",
87
+ name: "unpublish",
88
+ inputs: [
89
+ {
90
+ name: "domain",
91
+ type: "string"
92
+ }
93
+ ],
94
+ outputs: [],
95
+ stateMutability: "nonpayable"
96
+ },
97
+ {
98
+ type: "function",
99
+ name: "rateApp",
100
+ inputs: [
101
+ {
102
+ name: "domain",
103
+ type: "string"
104
+ },
105
+ {
106
+ name: "rating",
107
+ type: "uint8"
108
+ },
109
+ {
110
+ name: "comment_uri",
111
+ type: "string"
112
+ }
113
+ ],
114
+ outputs: [],
115
+ stateMutability: "nonpayable"
116
+ },
117
+ {
118
+ type: "function",
119
+ name: "removeRating",
120
+ inputs: [
121
+ {
122
+ name: "domain",
123
+ type: "string"
124
+ },
125
+ {
126
+ name: "reviewer",
127
+ type: "address"
128
+ }
129
+ ],
130
+ outputs: [],
131
+ stateMutability: "nonpayable"
132
+ },
133
+ {
134
+ type: "function",
135
+ name: "getContextId",
136
+ inputs: [],
137
+ outputs: [
138
+ {
139
+ name: "",
140
+ type: "bytes32"
141
+ }
142
+ ],
143
+ stateMutability: "view"
144
+ },
145
+ {
146
+ type: "function",
147
+ name: "getAppCount",
148
+ inputs: [],
149
+ outputs: [
150
+ {
151
+ name: "",
152
+ type: "uint32"
153
+ }
154
+ ],
155
+ stateMutability: "view"
156
+ },
157
+ {
158
+ type: "function",
159
+ name: "getDomainAt",
160
+ inputs: [
161
+ {
162
+ name: "index",
163
+ type: "uint32"
164
+ }
165
+ ],
166
+ outputs: [
167
+ {
168
+ name: "",
169
+ type: "string"
170
+ }
171
+ ],
172
+ stateMutability: "view"
173
+ },
174
+ {
175
+ type: "function",
176
+ name: "getOwnerAppCount",
177
+ inputs: [
178
+ {
179
+ name: "owner",
180
+ type: "address"
181
+ }
182
+ ],
183
+ outputs: [
184
+ {
185
+ name: "",
186
+ type: "uint32"
187
+ }
188
+ ],
189
+ stateMutability: "view"
190
+ },
191
+ {
192
+ type: "function",
193
+ name: "getOwnerDomainAt",
194
+ inputs: [
195
+ {
196
+ name: "owner",
197
+ type: "address"
198
+ },
199
+ {
200
+ name: "index",
201
+ type: "uint32"
202
+ }
203
+ ],
204
+ outputs: [
205
+ {
206
+ name: "",
207
+ type: "string"
208
+ }
209
+ ],
210
+ stateMutability: "view"
211
+ },
212
+ {
213
+ type: "function",
214
+ name: "getSudo",
215
+ inputs: [],
216
+ outputs: [
217
+ {
218
+ name: "",
219
+ type: "address"
220
+ }
221
+ ],
222
+ stateMutability: "view"
223
+ },
224
+ {
225
+ type: "function",
226
+ name: "getMetadataUri",
227
+ inputs: [
228
+ {
229
+ name: "domain",
230
+ type: "string"
231
+ }
232
+ ],
233
+ outputs: [
234
+ {
235
+ name: "",
236
+ type: "tuple",
237
+ components: [
238
+ {
239
+ name: "isSome",
240
+ type: "bool"
241
+ },
242
+ {
243
+ name: "value",
244
+ type: "string"
245
+ }
246
+ ]
247
+ }
248
+ ],
249
+ stateMutability: "view"
250
+ },
251
+ {
252
+ type: "function",
253
+ name: "getOwner",
254
+ inputs: [
255
+ {
256
+ name: "domain",
257
+ type: "string"
258
+ }
259
+ ],
260
+ outputs: [
261
+ {
262
+ name: "",
263
+ type: "address"
264
+ }
265
+ ],
266
+ stateMutability: "view"
267
+ }
268
+ ],
269
+ metadataCid: "bafk2bzaceaic2pcafqerskl6qxrhh7kylyqysnblynku4znebh4uinkbvihgg"
270
+ }
271
+ }
272
+ }
273
+ };
274
+
275
+ // src/deploy.ts
45
276
  var DEFAULT_BULLETIN_RPC = "wss://paseo-bulletin-rpc.polkadot.io";
46
277
  var DEFAULT_POOL_SIZE = 10;
47
278
  var BULLETIN_RPC = DEFAULT_BULLETIN_RPC;
@@ -49,8 +280,6 @@ var POOL_SIZE = DEFAULT_POOL_SIZE;
49
280
  var CHUNK_SIZE = 1 * 1024 * 1024;
50
281
  var MAX_FILE_SIZE = 8 * 1024 * 1024;
51
282
  var CID_CONFIG = { version: 1, codec: 85, hashCode: 18, hashLength: 32 };
52
- var __dirname = path.dirname(fileURLToPath(import.meta.url));
53
- var CDM_JSON_PATH = path.resolve(__dirname, "..", "cdm.json");
54
283
  function getGitRemoteUrl() {
55
284
  try {
56
285
  const raw = execSync("git remote get-url origin", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
@@ -536,10 +765,6 @@ async function deploy(content, domainName = null, options = {}) {
536
765
  console.log("=".repeat(60));
537
766
  await withSpan("deploy.registry", "3. registry", { "deploy.domain": name }, async () => {
538
767
  const repoUrl = getGitRemoteUrl();
539
- if (!fs.existsSync(CDM_JSON_PATH)) {
540
- console.log("\n Skipping registry: cdm.json not found");
541
- return;
542
- }
543
768
  const metadata = {};
544
769
  if (repoUrl) metadata.repository = repoUrl;
545
770
  console.log(`
@@ -548,12 +773,11 @@ async function deploy(content, domainName = null, options = {}) {
548
773
  console.log(` Uploading metadata to Bulletin...`);
549
774
  const metadataCid = await storeFile(metadataBytes, provider);
550
775
  console.log(` Metadata CID: ${metadataCid}`);
551
- const cdmJson = JSON.parse(fs.readFileSync(CDM_JSON_PATH, "utf-8"));
552
776
  const { signer, origin } = options.signer && options.signerAddress ? { signer: options.signer, origin: options.signerAddress } : getRegistrySigner(options.mnemonic);
553
777
  console.log(` Publishing to registry as ${origin}...`);
554
778
  const MAX_REGISTRY_RETRIES = 3;
555
779
  for (let attempt = 1; attempt <= MAX_REGISTRY_RETRIES; attempt++) {
556
- const cdm = createCdm(cdmJson, { defaultSigner: signer, defaultOrigin: origin });
780
+ const cdm = createCdm(cdm_default, { defaultSigner: signer, defaultOrigin: origin });
557
781
  try {
558
782
  const registry = cdm.getContract("@example/playground-registry");
559
783
  const result = await registry.publish.tx(`${name}.dot`, metadataCid);
@@ -2,10 +2,69 @@
2
2
  import { execSync } from "child_process";
3
3
  import * as fs from "fs";
4
4
  import * as path from "path";
5
- import { fileURLToPath } from "url";
6
- var __dirname = path.dirname(fileURLToPath(import.meta.url));
7
- var pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf-8"));
8
- var VERSION = pkg.version;
5
+
6
+ // package.json
7
+ var package_default = {
8
+ name: "bulletin-deploy",
9
+ version: "0.6.2",
10
+ private: false,
11
+ repository: {
12
+ type: "git",
13
+ url: "https://github.com/paritytech/bulletin-deploy.git"
14
+ },
15
+ publishConfig: {
16
+ registry: "https://registry.npmjs.org",
17
+ access: "public"
18
+ },
19
+ type: "module",
20
+ main: "./dist/index.js",
21
+ types: "./dist/index.d.ts",
22
+ bin: {
23
+ "bulletin-deploy": "./bin/bulletin-deploy"
24
+ },
25
+ exports: {
26
+ ".": {
27
+ types: "./dist/index.d.ts",
28
+ import: "./dist/index.js"
29
+ }
30
+ },
31
+ files: [
32
+ "dist",
33
+ "bin",
34
+ "cdm.json"
35
+ ],
36
+ scripts: {
37
+ build: "tsup src/index.ts src/deploy.ts src/dotns.ts src/pool.ts src/telemetry.ts --format esm --dts --clean --target node22",
38
+ test: "npm run build && node --test test/test.js",
39
+ benchmark: "npm run build && node benchmark.js"
40
+ },
41
+ dependencies: {
42
+ "@dotdm/cdm": "^0.5.1",
43
+ "@ipld/dag-pb": "^4.1.3",
44
+ "@noble/hashes": "^1.7.2",
45
+ "@polkadot-api/substrate-bindings": "^0.16.5",
46
+ "@polkadot-labs/hdkd": "^0.0.25",
47
+ "@polkadot-labs/hdkd-helpers": "^0.0.26",
48
+ "@polkadot/keyring": "^13.0.0",
49
+ "@polkadot/util-crypto": "^13.0.0",
50
+ "@sentry/node": "^9.14.0",
51
+ "ipfs-unixfs": "^11.2.0",
52
+ multiformats: "^13.4.1",
53
+ "polkadot-api": "^1.23.1",
54
+ viem: "^2.30.5"
55
+ },
56
+ devDependencies: {
57
+ "@types/node": "^22.0.0",
58
+ tsup: "^8.5.0",
59
+ typescript: "^5.9.3"
60
+ },
61
+ engines: {
62
+ node: ">=22"
63
+ }
64
+ };
65
+
66
+ // src/telemetry.ts
67
+ var VERSION = package_default.version;
9
68
  var DEFAULT_DSN = "https://e021c025d79c4c3ade2862a11f13c40b@o4509440811401216.ingest.de.sentry.io/4511093597405264";
10
69
  var DISABLED = process.env.BULLETIN_DEPLOY_TELEMETRY === "0";
11
70
  var Sentry = null;
@@ -35,8 +94,8 @@ function tryGitRemote() {
35
94
  }
36
95
  function tryPackageJsonRepo() {
37
96
  try {
38
- const pkg2 = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
39
- const repo = typeof pkg2.repository === "string" ? pkg2.repository : pkg2.repository?.url;
97
+ const pkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
98
+ const repo = typeof pkg.repository === "string" ? pkg.repository : pkg.repository?.url;
40
99
  if (repo) return extractRepoSlug(repo);
41
100
  } catch {
42
101
  }
package/dist/deploy.js CHANGED
@@ -18,10 +18,10 @@ import {
18
18
  storeChunkedContent,
19
19
  storeDirectory,
20
20
  storeFile
21
- } from "./chunk-TVC74Y6P.js";
22
- import "./chunk-ZUKSPFW3.js";
21
+ } from "./chunk-72ZGQO3T.js";
22
+ import "./chunk-3I7SHB4A.js";
23
23
  import "./chunk-AIHW2WLO.js";
24
- import "./chunk-CWGI2QOL.js";
24
+ import "./chunk-OUE2NAOG.js";
25
25
  import "./chunk-QGM4M3NI.js";
26
26
  export {
27
27
  DEFAULT_BULLETIN_RPC,
package/dist/dotns.d.ts CHANGED
@@ -30,7 +30,6 @@ declare const CONTRACTS: {
30
30
  };
31
31
  declare const DECIMALS: bigint;
32
32
  declare const NATIVE_TO_ETH_RATIO: bigint;
33
- declare const CONNECTION_TIMEOUT_MS: number;
34
33
  declare const OPERATION_TIMEOUT_MS: number;
35
34
  declare const TX_TIMEOUT_MS: number;
36
35
  declare const DEFAULT_MNEMONIC: string;
@@ -116,4 +115,4 @@ declare class DotNS {
116
115
  }
117
116
  declare const dotns: DotNS;
118
117
 
119
- export { CONNECTION_TIMEOUT_MS, CONTRACTS, DECIMALS, DEFAULT_MNEMONIC, DOT_NODE, DotNS, type DotNSConnectOptions, NATIVE_TO_ETH_RATIO, OPERATION_TIMEOUT_MS, type OwnershipResult, type PriceValidationResult, ProofOfPersonhoodStatus, RPC_ENDPOINTS, TX_TIMEOUT_MS, computeDomainTokenId, convertWeiToNative, countTrailingDigits, dotns, fetchNonce, parseProofOfPersonhoodStatus, sanitizeDomainLabel, stripTrailingDigits, validateDomainLabel };
118
+ export { CONTRACTS, DECIMALS, DEFAULT_MNEMONIC, DOT_NODE, DotNS, type DotNSConnectOptions, NATIVE_TO_ETH_RATIO, OPERATION_TIMEOUT_MS, type OwnershipResult, type PriceValidationResult, ProofOfPersonhoodStatus, RPC_ENDPOINTS, TX_TIMEOUT_MS, computeDomainTokenId, convertWeiToNative, countTrailingDigits, dotns, fetchNonce, parseProofOfPersonhoodStatus, sanitizeDomainLabel, stripTrailingDigits, validateDomainLabel };
package/dist/dotns.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import {
2
- CONNECTION_TIMEOUT_MS,
3
2
  CONTRACTS,
4
3
  DECIMALS,
5
4
  DEFAULT_MNEMONIC,
@@ -19,11 +18,10 @@ import {
19
18
  sanitizeDomainLabel,
20
19
  stripTrailingDigits,
21
20
  validateDomainLabel
22
- } from "./chunk-ZUKSPFW3.js";
23
- import "./chunk-CWGI2QOL.js";
21
+ } from "./chunk-3I7SHB4A.js";
22
+ import "./chunk-OUE2NAOG.js";
24
23
  import "./chunk-QGM4M3NI.js";
25
24
  export {
26
- CONNECTION_TIMEOUT_MS,
27
25
  CONTRACTS,
28
26
  DECIMALS,
29
27
  DEFAULT_MNEMONIC,
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  deploy
3
- } from "./chunk-TVC74Y6P.js";
3
+ } from "./chunk-72ZGQO3T.js";
4
4
  import {
5
5
  DotNS
6
- } from "./chunk-ZUKSPFW3.js";
6
+ } from "./chunk-3I7SHB4A.js";
7
7
  import {
8
8
  bootstrapPool,
9
9
  derivePoolAccounts,
@@ -11,7 +11,7 @@ import {
11
11
  fetchPoolAuthorizations,
12
12
  selectAccount
13
13
  } from "./chunk-AIHW2WLO.js";
14
- import "./chunk-CWGI2QOL.js";
14
+ import "./chunk-OUE2NAOG.js";
15
15
  import "./chunk-QGM4M3NI.js";
16
16
  export {
17
17
  DotNS,
package/dist/telemetry.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  setDeployAttribute,
9
9
  withDeploySpan,
10
10
  withSpan
11
- } from "./chunk-CWGI2QOL.js";
11
+ } from "./chunk-OUE2NAOG.js";
12
12
  import "./chunk-QGM4M3NI.js";
13
13
  export {
14
14
  VERSION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bulletin-deploy",
3
- "version": "0.6.2-rc.0",
3
+ "version": "0.6.2",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",