bulletin-deploy 0.6.1 → 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";
@@ -3,7 +3,7 @@ import {
3
3
  DotNS,
4
4
  TX_TIMEOUT_MS,
5
5
  fetchNonce
6
- } from "./chunk-5Q26TR27.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-MMJR6Z2H.js";
22
- import "./chunk-5Q26TR27.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.js CHANGED
@@ -18,8 +18,8 @@ import {
18
18
  sanitizeDomainLabel,
19
19
  stripTrailingDigits,
20
20
  validateDomainLabel
21
- } from "./chunk-5Q26TR27.js";
22
- import "./chunk-CWGI2QOL.js";
21
+ } from "./chunk-3I7SHB4A.js";
22
+ import "./chunk-OUE2NAOG.js";
23
23
  import "./chunk-QGM4M3NI.js";
24
24
  export {
25
25
  CONTRACTS,
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  deploy
3
- } from "./chunk-MMJR6Z2H.js";
3
+ } from "./chunk-72ZGQO3T.js";
4
4
  import {
5
5
  DotNS
6
- } from "./chunk-5Q26TR27.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.1",
3
+ "version": "0.6.2",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",