bulletin-deploy 0.6.5-rc.0 → 0.6.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/cdm.json CHANGED
@@ -13,8 +13,8 @@
13
13
  "contracts": {
14
14
  "acc2c3b5e912b762": {
15
15
  "@example/playground-registry": {
16
- "version": 5,
17
- "address": "0x150dCe6077E4546151919bF1d202419fe1131d9b",
16
+ "version": 6,
17
+ "address": "0x279585Cb8E8971e34520A3ebbda3E0C4D77C3d97",
18
18
  "abi": [
19
19
  {
20
20
  "type": "constructor",
@@ -121,7 +121,17 @@
121
121
  "outputs": [
122
122
  {
123
123
  "name": "",
124
- "type": "string"
124
+ "type": "tuple",
125
+ "components": [
126
+ {
127
+ "name": "isSome",
128
+ "type": "bool"
129
+ },
130
+ {
131
+ "name": "value",
132
+ "type": "string"
133
+ }
134
+ ]
125
135
  }
126
136
  ],
127
137
  "stateMutability": "view"
@@ -159,7 +169,17 @@
159
169
  "outputs": [
160
170
  {
161
171
  "name": "",
162
- "type": "string"
172
+ "type": "tuple",
173
+ "components": [
174
+ {
175
+ "name": "isSome",
176
+ "type": "bool"
177
+ },
178
+ {
179
+ "name": "value",
180
+ "type": "string"
181
+ }
182
+ ]
163
183
  }
164
184
  ],
165
185
  "stateMutability": "view"
@@ -221,7 +241,7 @@
221
241
  "stateMutability": "view"
222
242
  }
223
243
  ],
224
- "metadataCid": "bafk2bzaceaic2pcafqerskl6qxrhh7kylyqysnblynku4znebh4uinkbvihgg"
244
+ "metadataCid": "bafk2bzaceck7veaix4ttzyd6bmwlssgycrrlgilpat2c272nczzlrgnqy6fze"
225
245
  }
226
246
  }
227
247
  }
@@ -55,16 +55,16 @@ async function fetchPoolAuthorizations(api, accounts) {
55
55
  );
56
56
  return results;
57
57
  }
58
- async function ensureAuthorized(api, address, bulletinRpc, label) {
58
+ async function ensureAuthorized(api, poolAccount, bulletinRpc) {
59
59
  const auth = await api.query.TransactionStorage.Authorizations.getValue(
60
- Enum("Account", address)
60
+ Enum("Account", poolAccount.address)
61
61
  );
62
62
  const txsRemaining = auth ? BigInt(auth.extent.transactions) : 0n;
63
63
  const bytesRemaining = auth ? auth.extent.bytes : 0n;
64
64
  if (txsRemaining >= TOPUP_THRESHOLD_TXS && bytesRemaining >= TOPUP_THRESHOLD_BYTES) {
65
65
  return;
66
66
  }
67
- console.log(` Auto-authorizing ${label ?? "account"} (${address.slice(0, 8)}...)...`);
67
+ console.log(` Auto-authorizing pool account ${poolAccount.index} (${poolAccount.address.slice(0, 8)}...)...`);
68
68
  const aliceClient = createClient(withPolkadotSdkCompat(getWsProvider(bulletinRpc)));
69
69
  const aliceApi = aliceClient.getUnsafeApi();
70
70
  try {
@@ -72,7 +72,7 @@ async function ensureAuthorized(api, address, bulletinRpc, label) {
72
72
  const alice = keyring.addFromUri("//Alice");
73
73
  const aliceSigner = getPolkadotSigner(alice.publicKey, "Sr25519", (data) => alice.sign(data));
74
74
  const tx = aliceApi.tx.TransactionStorage.authorize_account({
75
- who: address,
75
+ who: poolAccount.address,
76
76
  transactions: TOPUP_TRANSACTIONS,
77
77
  bytes: TOPUP_BYTES
78
78
  });
@@ -6,7 +6,7 @@ import * as path from "path";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "bulletin-deploy",
9
- version: "0.6.5-rc.0",
9
+ version: "0.6.5",
10
10
  private: false,
11
11
  repository: {
12
12
  type: "git",
@@ -87,7 +87,7 @@ function extractRepoSlug(url) {
87
87
  }
88
88
  function tryGitRemote() {
89
89
  try {
90
- return extractRepoSlug(execSync("git remote get-url origin", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim());
90
+ return extractRepoSlug(execSync("git remote get-url origin", { encoding: "utf-8" }).trim());
91
91
  } catch {
92
92
  return void 0;
93
93
  }
@@ -106,7 +106,7 @@ function resolveRepo(domain) {
106
106
  }
107
107
  function tryGitBranch() {
108
108
  try {
109
- return execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim();
109
+ return execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf-8" }).trim();
110
110
  } catch {
111
111
  return "unknown";
112
112
  }
@@ -4,13 +4,13 @@ import {
4
4
  TX_TIMEOUT_MS,
5
5
  fetchNonce,
6
6
  validateDomainLabel
7
- } from "./chunk-NXITLUZT.js";
7
+ } from "./chunk-S7ZSIIY4.js";
8
8
  import {
9
9
  derivePoolAccounts,
10
10
  ensureAuthorized,
11
11
  fetchPoolAuthorizations,
12
12
  selectAccount
13
- } from "./chunk-LGPTJYA3.js";
13
+ } from "./chunk-AIHW2WLO.js";
14
14
  import {
15
15
  VERSION,
16
16
  captureWarning,
@@ -18,7 +18,7 @@ import {
18
18
  setDeployAttribute,
19
19
  withDeploySpan,
20
20
  withSpan
21
- } from "./chunk-FHAEFLVV.js";
21
+ } from "./chunk-BR35ORSD.js";
22
22
 
23
23
  // src/deploy.ts
24
24
  import { Buffer } from "buffer";
@@ -59,8 +59,8 @@ var cdm_default = {
59
59
  contracts: {
60
60
  acc2c3b5e912b762: {
61
61
  "@example/playground-registry": {
62
- version: 5,
63
- address: "0x150dCe6077E4546151919bF1d202419fe1131d9b",
62
+ version: 6,
63
+ address: "0x279585Cb8E8971e34520A3ebbda3E0C4D77C3d97",
64
64
  abi: [
65
65
  {
66
66
  type: "constructor",
@@ -167,7 +167,17 @@ var cdm_default = {
167
167
  outputs: [
168
168
  {
169
169
  name: "",
170
- type: "string"
170
+ type: "tuple",
171
+ components: [
172
+ {
173
+ name: "isSome",
174
+ type: "bool"
175
+ },
176
+ {
177
+ name: "value",
178
+ type: "string"
179
+ }
180
+ ]
171
181
  }
172
182
  ],
173
183
  stateMutability: "view"
@@ -205,7 +215,17 @@ var cdm_default = {
205
215
  outputs: [
206
216
  {
207
217
  name: "",
208
- type: "string"
218
+ type: "tuple",
219
+ components: [
220
+ {
221
+ name: "isSome",
222
+ type: "bool"
223
+ },
224
+ {
225
+ name: "value",
226
+ type: "string"
227
+ }
228
+ ]
209
229
  }
210
230
  ],
211
231
  stateMutability: "view"
@@ -267,7 +287,7 @@ var cdm_default = {
267
287
  stateMutability: "view"
268
288
  }
269
289
  ],
270
- metadataCid: "bafk2bzaceaic2pcafqerskl6qxrhh7kylyqysnblynku4znebh4uinkbvihgg"
290
+ metadataCid: "bafk2bzaceck7veaix4ttzyd6bmwlssgycrrlgilpat2c272nczzlrgnqy6fze"
271
291
  }
272
292
  }
273
293
  }
@@ -281,7 +301,7 @@ var POOL_SIZE = DEFAULT_POOL_SIZE;
281
301
  var CHUNK_SIZE = 1 * 1024 * 1024;
282
302
  var MAX_FILE_SIZE = 8 * 1024 * 1024;
283
303
  var MAX_RECONNECTIONS = parseInt(process.env.BULLETIN_MAX_RECONNECTIONS ?? "3", 10);
284
- var CHUNK_TIMEOUT_MS = parseInt(process.env.BULLETIN_CHUNK_TIMEOUT_MS ?? "60000", 10);
304
+ var CHUNK_TIMEOUT_MS = 3e4;
285
305
  var RETRY_BASE_DELAY_MS = 2e3;
286
306
  var RETRY_MAX_DELAY_MS = 15e3;
287
307
  function isConnectionError(error) {
@@ -375,10 +395,10 @@ async function getProvider() {
375
395
  if (!selected) {
376
396
  const best = authorizations.reduce((a, b) => a.transactions > b.transactions ? a : b);
377
397
  console.log(` All pool accounts low on capacity, auto-authorizing account ${best.index}...`);
378
- await ensureAuthorized(unsafeApi, best.address, BULLETIN_RPC, `pool account ${best.index}`);
398
+ await ensureAuthorized(unsafeApi, best, BULLETIN_RPC);
379
399
  selected = best;
380
400
  } else {
381
- await ensureAuthorized(unsafeApi, selected.address, BULLETIN_RPC, `pool account ${selected.index}`);
401
+ await ensureAuthorized(unsafeApi, selected, BULLETIN_RPC);
382
402
  }
383
403
  console.log(` Using pool account ${selected.index}: ${selected.address}`);
384
404
  setDeployAttribute("deploy.signer.mode", "pool");
@@ -403,7 +423,7 @@ async function getDirectProvider(mnemonic) {
403
423
  const bytesRemaining = auth ? auth.extent.bytes : 0n;
404
424
  if (txsRemaining === 0n && bytesRemaining === 0n) {
405
425
  client.destroy();
406
- throw new Error(`Account ${ss58} is not authorized for Bulletin storage.`);
426
+ throw new Error(`Account ${ss58} is not authorized for Bulletin storage. Run 'bulletin-deploy --bootstrap --mnemonic "..."' or authorize the account on-chain first.`);
407
427
  }
408
428
  console.log(` Authorization: ${txsRemaining} txs, ${Number(bytesRemaining) / 1e6}MB remaining`);
409
429
  setDeployAttribute("deploy.signer.mode", "direct");
@@ -541,23 +561,6 @@ async function storeChunkedContent(chunks, { client: existingClient, unsafeApi:
541
561
  ss58 = provider.ss58;
542
562
  ownsClient = true;
543
563
  }
544
- const requiredTxs = BigInt(chunks.length + 1);
545
- const auth = await unsafeApi.query.TransactionStorage.Authorizations.getValue(
546
- Enum("Account", ss58)
547
- );
548
- const txsRemaining = auth ? BigInt(auth.extent.transactions) : 0n;
549
- const bytesRemaining = auth ? auth.extent.bytes : 0n;
550
- if (txsRemaining < requiredTxs || bytesRemaining < BigInt(totalBytes)) {
551
- console.log(`
552
- Account has insufficient authorization for this upload (need ${requiredTxs} txs / ${(totalBytes / 1e6).toFixed(1)}MB, have ${txsRemaining} txs / ${Number(bytesRemaining) / 1e6}MB)`);
553
- console.log(` Attempting to re-authorize with Alice...`);
554
- try {
555
- await ensureAuthorized(unsafeApi, ss58, BULLETIN_RPC);
556
- console.log(` Re-authorization successful`);
557
- } catch (e) {
558
- throw new Error(`Re-authorization failed: ${e.message}`);
559
- }
560
- }
561
564
  let reconnectionsUsed = 0;
562
565
  async function doReconnect() {
563
566
  if (!reconnect || reconnectionsUsed >= MAX_RECONNECTIONS) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  captureWarning,
3
3
  withSpan
4
- } from "./chunk-FHAEFLVV.js";
4
+ } from "./chunk-BR35ORSD.js";
5
5
 
6
6
  // src/dotns.ts
7
7
  import crypto from "crypto";
package/dist/deploy.js CHANGED
@@ -19,10 +19,10 @@ import {
19
19
  storeChunkedContent,
20
20
  storeDirectory,
21
21
  storeFile
22
- } from "./chunk-FBV763OM.js";
23
- import "./chunk-NXITLUZT.js";
24
- import "./chunk-LGPTJYA3.js";
25
- import "./chunk-FHAEFLVV.js";
22
+ } from "./chunk-QB7UH3NR.js";
23
+ import "./chunk-S7ZSIIY4.js";
24
+ import "./chunk-AIHW2WLO.js";
25
+ import "./chunk-BR35ORSD.js";
26
26
  import "./chunk-QGM4M3NI.js";
27
27
  export {
28
28
  DEFAULT_BULLETIN_RPC,
package/dist/dotns.js CHANGED
@@ -19,8 +19,8 @@ import {
19
19
  sanitizeDomainLabel,
20
20
  stripTrailingDigits,
21
21
  validateDomainLabel
22
- } from "./chunk-NXITLUZT.js";
23
- import "./chunk-FHAEFLVV.js";
22
+ } from "./chunk-S7ZSIIY4.js";
23
+ import "./chunk-BR35ORSD.js";
24
24
  import "./chunk-QGM4M3NI.js";
25
25
  export {
26
26
  CONNECTION_TIMEOUT_MS,
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  deploy
3
- } from "./chunk-FBV763OM.js";
3
+ } from "./chunk-QB7UH3NR.js";
4
4
  import {
5
5
  DotNS
6
- } from "./chunk-NXITLUZT.js";
6
+ } from "./chunk-S7ZSIIY4.js";
7
7
  import {
8
8
  bootstrapPool,
9
9
  derivePoolAccounts,
10
10
  ensureAuthorized,
11
11
  fetchPoolAuthorizations,
12
12
  selectAccount
13
- } from "./chunk-LGPTJYA3.js";
14
- import "./chunk-FHAEFLVV.js";
13
+ } from "./chunk-AIHW2WLO.js";
14
+ import "./chunk-BR35ORSD.js";
15
15
  import "./chunk-QGM4M3NI.js";
16
16
  export {
17
17
  DotNS,
package/dist/pool.d.ts CHANGED
@@ -14,7 +14,7 @@ interface PoolAuthorization extends PoolAccount {
14
14
  declare function derivePoolAccounts(poolSize?: number, mnemonic?: string): PoolAccount[];
15
15
  declare function selectAccount(authorizations: PoolAuthorization[]): PoolAuthorization | null;
16
16
  declare function fetchPoolAuthorizations(api: any, accounts: PoolAccount[]): Promise<PoolAuthorization[]>;
17
- declare function ensureAuthorized(api: any, address: string, bulletinRpc: string, label?: string): Promise<void>;
17
+ declare function ensureAuthorized(api: any, poolAccount: PoolAccount, bulletinRpc: string): Promise<void>;
18
18
  declare function bootstrapPool(bulletinRpc: string, poolSize?: number, mnemonic?: string): Promise<void>;
19
19
 
20
20
  export { type PoolAccount, type PoolAuthorization, bootstrapPool, derivePoolAccounts, ensureAuthorized, fetchPoolAuthorizations, selectAccount };
package/dist/pool.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  ensureAuthorized,
5
5
  fetchPoolAuthorizations,
6
6
  selectAccount
7
- } from "./chunk-LGPTJYA3.js";
7
+ } from "./chunk-AIHW2WLO.js";
8
8
  import "./chunk-QGM4M3NI.js";
9
9
  export {
10
10
  bootstrapPool,
package/dist/telemetry.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  setDeployAttribute,
9
9
  withDeploySpan,
10
10
  withSpan
11
- } from "./chunk-FHAEFLVV.js";
11
+ } from "./chunk-BR35ORSD.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.5-rc.0",
3
+ "version": "0.6.5",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",