@mysten/walrus 0.0.1 → 0.0.3

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.
@@ -289,3 +289,108 @@ export declare const StorageConfirmation: BcsType<{
289
289
  }>;
290
290
  };
291
291
  }>;
292
+ export declare const TestnetSystemStateInnerV1: BcsType<{
293
+ committee: {
294
+ members: {
295
+ public_key: {
296
+ bytes: number[];
297
+ };
298
+ weight: number;
299
+ node_id: string;
300
+ }[];
301
+ n_shards: number;
302
+ epoch: number;
303
+ total_aggregated_key: {
304
+ bytes: number[];
305
+ };
306
+ };
307
+ total_capacity_size: string;
308
+ used_capacity_size: string;
309
+ storage_price_per_unit_size: string;
310
+ write_price_per_unit_size: string;
311
+ future_accounting: {
312
+ current_index: number;
313
+ length: number;
314
+ ring_buffer: {
315
+ epoch: number;
316
+ used_capacity: string;
317
+ rewards_to_distribute: {
318
+ value: string;
319
+ };
320
+ }[];
321
+ };
322
+ event_blob_certification_state: {
323
+ latest_certified_blob: {
324
+ blob_id: string;
325
+ ending_checkpoint_sequence_number: string;
326
+ } | null;
327
+ aggregate_weight_per_blob: {
328
+ contents: {
329
+ key: string;
330
+ value: number;
331
+ }[];
332
+ };
333
+ };
334
+ deny_list_sizes: {
335
+ id: {
336
+ id: string;
337
+ };
338
+ };
339
+ }, {
340
+ committee: {
341
+ members: Iterable<{
342
+ public_key: {
343
+ bytes: Iterable<number> & {
344
+ length: number;
345
+ };
346
+ };
347
+ weight: number;
348
+ node_id: string | Uint8Array<ArrayBufferLike>;
349
+ }> & {
350
+ length: number;
351
+ };
352
+ n_shards: number;
353
+ epoch: number;
354
+ total_aggregated_key: {
355
+ bytes: Iterable<number> & {
356
+ length: number;
357
+ };
358
+ };
359
+ };
360
+ total_capacity_size: string | number | bigint;
361
+ used_capacity_size: string | number | bigint;
362
+ storage_price_per_unit_size: string | number | bigint;
363
+ write_price_per_unit_size: string | number | bigint;
364
+ future_accounting: {
365
+ current_index: number;
366
+ length: number;
367
+ ring_buffer: Iterable<{
368
+ epoch: number;
369
+ used_capacity: string | number | bigint;
370
+ rewards_to_distribute: {
371
+ value: string | number | bigint;
372
+ };
373
+ }> & {
374
+ length: number;
375
+ };
376
+ };
377
+ event_blob_certification_state: {
378
+ latest_certified_blob: {
379
+ blob_id: string | number | bigint;
380
+ ending_checkpoint_sequence_number: string | number | bigint;
381
+ } | null | undefined;
382
+ aggregate_weight_per_blob: {
383
+ contents: Iterable<{
384
+ key: string | number | bigint;
385
+ value: number;
386
+ }> & {
387
+ length: number;
388
+ };
389
+ };
390
+ };
391
+ deny_list_sizes: {
392
+ id: {
393
+ id: string | Uint8Array<ArrayBufferLike>;
394
+ };
395
+ };
396
+ }>;
@@ -32,12 +32,18 @@ __export(bcs_exports, {
32
32
  SliverPair: () => SliverPair,
33
33
  StorageConfirmation: () => StorageConfirmation,
34
34
  StorageConfirmationBody: () => StorageConfirmationBody,
35
+ TestnetSystemStateInnerV1: () => TestnetSystemStateInnerV1,
35
36
  blobIdFromBytes: () => blobIdFromBytes,
36
37
  blobIdFromInt: () => blobIdFromInt,
37
38
  blobIdToInt: () => blobIdToInt
38
39
  });
39
40
  module.exports = __toCommonJS(bcs_exports);
40
41
  var import_bcs = require("@mysten/sui/bcs");
42
+ var import_bls_aggregate = require("../contracts/bls_aggregate.js");
43
+ var import_vec_map = require("../contracts/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.js");
44
+ var import_event_blob = require("../contracts/event_blob.js");
45
+ var import_extended_field = require("../contracts/extended_field.js");
46
+ var import_storage_accounting = require("../contracts/storage_accounting.js");
41
47
  const MerkleNode = import_bcs.bcs.enum("MerkleNode", {
42
48
  Empty: null,
43
49
  Digest: import_bcs.bcs.bytes(32)
@@ -134,4 +140,18 @@ const StorageConfirmationBody = import_bcs.bcs.struct("StorageConfirmationBody",
134
140
  blobType: BlobPersistenceType
135
141
  });
136
142
  const StorageConfirmation = ProtocolMessage(StorageConfirmationBody);
143
+ const TestnetEventBlobCertificationState = import_bcs.bcs.struct("EventBlobCertificationState", {
144
+ latest_certified_blob: import_bcs.bcs.option((0, import_event_blob.EventBlob)()),
145
+ aggregate_weight_per_blob: (0, import_vec_map.VecMap)(import_bcs.bcs.u256(), import_bcs.bcs.u16())
146
+ });
147
+ const TestnetSystemStateInnerV1 = import_bcs.bcs.struct("SystemStateInnerV1", {
148
+ committee: (0, import_bls_aggregate.BlsCommittee)(),
149
+ total_capacity_size: import_bcs.bcs.u64(),
150
+ used_capacity_size: import_bcs.bcs.u64(),
151
+ storage_price_per_unit_size: import_bcs.bcs.u64(),
152
+ write_price_per_unit_size: import_bcs.bcs.u64(),
153
+ future_accounting: (0, import_storage_accounting.FutureAccountingRingBuffer)(),
154
+ event_blob_certification_state: TestnetEventBlobCertificationState,
155
+ deny_list_sizes: (0, import_extended_field.ExtendedField)()
156
+ });
137
157
  //# sourceMappingURL=bcs.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/bcs.ts"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { BcsType } from '@mysten/sui/bcs';\nimport { bcs } from '@mysten/sui/bcs';\n\nconst MerkleNode = bcs.enum('MerkleNode', {\n\tEmpty: null,\n\tDigest: bcs.bytes(32),\n});\n\nconst SliverPairMetadata = bcs.struct('SliverPairMetadata', {\n\tprimary_hash: MerkleNode,\n\tsecondary_hash: MerkleNode,\n});\n\nexport const EncodingType = bcs\n\t.enum('EncodingType', {\n\t\tRedStuff: null,\n\t\tRS2: null,\n\t})\n\t.transform({\n\t\tinput: (\n\t\t\tencodingType:\n\t\t\t\t| { RedStuff: boolean | object | null }\n\t\t\t\t| { RS2: boolean | object | null }\n\t\t\t\t| 'RedStuff'\n\t\t\t\t| 'RS2',\n\t\t) =>\n\t\t\ttypeof encodingType === 'string'\n\t\t\t\t? ({ [encodingType]: null } as Exclude<typeof encodingType, string>)\n\t\t\t\t: encodingType,\n\t\toutput: (encodingType) => encodingType,\n\t});\n\nexport const BlobMetadataV1 = bcs.struct('BlobMetadataV1', {\n\tencoding_type: EncodingType,\n\tunencoded_length: bcs.u64(),\n\thashes: bcs.vector(SliverPairMetadata),\n});\n\nexport const BlobMetadata = bcs.enum('BlobMetadata', {\n\tV1: BlobMetadataV1,\n});\n\nexport const BlobId = bcs.u256().transform({\n\tinput: (blobId: string | bigint) => (typeof blobId === 'string' ? blobIdToInt(blobId) : blobId),\n\toutput: (id: string) => blobIdFromInt(id),\n});\n\nexport function blobIdFromInt(blobId: bigint | string): string {\n\treturn bcs\n\t\t.u256()\n\t\t.serialize(blobId)\n\t\t.toBase64()\n\t\t.replace(/=*$/, '')\n\t\t.replaceAll('+', '-')\n\t\t.replaceAll('/', '_');\n}\n\nexport function blobIdFromBytes(blobId: Uint8Array): string {\n\treturn blobIdFromInt(bcs.u256().parse(blobId));\n}\n\nexport function blobIdToInt(blobId: string): bigint {\n\treturn BigInt(bcs.u256().fromBase64(blobId.replaceAll('-', '+').replaceAll('_', '/')));\n}\n\nexport const BlobMetadataWithId = bcs.struct('BlobMetadataWithId', {\n\tblob_id: BlobId,\n\tmetadata: BlobMetadata,\n});\n\nconst Symbols = bcs.struct('Symbols', {\n\tdata: bcs.vector(bcs.u8()),\n\tsymbol_size: bcs.u16(),\n});\n\nexport const SliverData = bcs.struct('SliverData', {\n\tsymbols: Symbols,\n\tindex: bcs.u16(),\n});\n\nexport const Sliver = bcs.enum('Sliver', {\n\tPrimary: SliverData,\n\tSecondary: SliverData,\n});\n\nexport const SliverPair = bcs.struct('SliverPair', {\n\tprimary: SliverData,\n\tsecondary: SliverData,\n});\n\nexport enum IntentType {\n\tPROOF_OF_POSSESSION_MSG = 0,\n\tBLOB_CERT_MSG = 1,\n\tINVALID_BLOB_ID_MSG = 2,\n\tSYNC_SHARD_MSG = 3,\n}\n\nexport const Intent = bcs\n\t.struct('Intent', {\n\t\ttype: bcs.u8().transform({\n\t\t\tinput: (type: IntentType) => type,\n\t\t\toutput: (type: number) => type as IntentType,\n\t\t}),\n\t\tversion: bcs.u8(),\n\t\tappId: bcs.u8(),\n\t})\n\t.transform({\n\t\tinput: (intent: IntentType) => ({\n\t\t\ttype: intent,\n\t\t\tversion: 0,\n\t\t\tappId: 3,\n\t\t}),\n\t\toutput: (intent) => intent.type,\n\t});\n\nexport function ProtocolMessage<T extends BcsType<any>>(messageContents: T) {\n\treturn bcs.struct(`ProtocolMessage<${messageContents.name}>`, {\n\t\tintent: Intent,\n\t\tepoch: bcs.u32(),\n\t\tmessageContents,\n\t});\n}\n\nexport const BlobPersistenceType = bcs.enum('BlobPersistenceType', {\n\tPermanent: null,\n\tDeletable: bcs.struct('Deletable', {\n\t\tobjectId: bcs.Address,\n\t}),\n});\nexport const StorageConfirmationBody = bcs.struct('StorageConfirmationBody', {\n\tblobId: BlobId,\n\tblobType: BlobPersistenceType,\n});\n\nexport const StorageConfirmation = ProtocolMessage(StorageConfirmationBody);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iBAAoB;AAEpB,MAAM,aAAa,eAAI,KAAK,cAAc;AAAA,EACzC,OAAO;AAAA,EACP,QAAQ,eAAI,MAAM,EAAE;AACrB,CAAC;AAED,MAAM,qBAAqB,eAAI,OAAO,sBAAsB;AAAA,EAC3D,cAAc;AAAA,EACd,gBAAgB;AACjB,CAAC;AAEM,MAAM,eAAe,eAC1B,KAAK,gBAAgB;AAAA,EACrB,UAAU;AAAA,EACV,KAAK;AACN,CAAC,EACA,UAAU;AAAA,EACV,OAAO,CACN,iBAMA,OAAO,iBAAiB,WACpB,EAAE,CAAC,YAAY,GAAG,KAAK,IACxB;AAAA,EACJ,QAAQ,CAAC,iBAAiB;AAC3B,CAAC;AAEK,MAA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,aAAL,kBAAKA,gBAAL;AACN,EAAAA,wBAAA,6BAA0B,KAA1B;AACA,EAAAA,wBAAA,mBAAgB,KAAhB;AACA,EAAAA,wBAAA,yBAAsB,KAAtB;AACA,EAAAA,wBAAA,oBAAiB,KAAjB;AAJW,SAAAA;AAAA,GAAA;AAOL,MAAM,SAAS,eACpB,OAAO,UAAU;AAAA,EACjB,MAAM,eAAI,GAAG,EAAE,UAAU;AAAA,IACxB,OAAO,CAAC,SAAqB;AAAA,IAC7B,QAAQ,CAAC,SAAiB;AAAA,EAC3B,CAAC;AAAA,EACD,SAAS,eAAI,GAAG;AAAA,EAChB,OAAO,eAAI,GAAG;AACf,CAAC,EACA,UAAU;AAAA,EACV,OAAO,CAAC,YAAwB;AAAA,IAC/B,MAAM;AAAA,IACN,SAAS;AAAA,IACT,OAAO;AAAA,EACR;AAAA,EACA,QAAQ,CAAC,WAAW,OAAO;AAC5B,CAAC;AAEK,SAAS,gBAAwC,iBAAoB;AAC3E,SAAO,eAAI,OAAO,mBAAmB,gBAAgB,IAAI,KAAK;AAAA,IAC7D,QAAQ;AAAA,IACR,OAAO,eAAI,IAAI;AAAA,IACf;AAAA,EACD,CAAC;AACF;AAEO,MAAM,sBAAsB,eAAI,KAAK,uBAAuB;AAAA,EAClE,WAAW;AAAA,EACX,WAAW,eAAI,OAAO,aAAa;AAAA,IAClC,UAAU,eAAI;AAAA,EACf,CAAC;AACF,CAAC;AACM,MAAM,0BAA0B,eAAI,OAAO,2BAA2B;AAAA,EAC5E,QAAQ;AAAA,EACR,UAAU;AACX,CAAC;AAEM,MAAM,sBAAsB,gBAAgB,uBAAuB;",
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { BcsType } from '@mysten/sui/bcs';\nimport { bcs } from '@mysten/sui/bcs';\n\nimport { BlsCommittee } from '../contracts/bls_aggregate.js';\nimport { VecMap } from '../contracts/deps/0x0000000000000000000000000000000000000000000000000000000000000002/vec_map.js';\nimport { EventBlob } from '../contracts/event_blob.js';\nimport { ExtendedField } from '../contracts/extended_field.js';\nimport { FutureAccountingRingBuffer } from '../contracts/storage_accounting.js';\n\nconst MerkleNode = bcs.enum('MerkleNode', {\n\tEmpty: null,\n\tDigest: bcs.bytes(32),\n});\n\nconst SliverPairMetadata = bcs.struct('SliverPairMetadata', {\n\tprimary_hash: MerkleNode,\n\tsecondary_hash: MerkleNode,\n});\n\nexport const EncodingType = bcs\n\t.enum('EncodingType', {\n\t\tRedStuff: null,\n\t\tRS2: null,\n\t})\n\t.transform({\n\t\tinput: (\n\t\t\tencodingType:\n\t\t\t\t| { RedStuff: boolean | object | null }\n\t\t\t\t| { RS2: boolean | object | null }\n\t\t\t\t| 'RedStuff'\n\t\t\t\t| 'RS2',\n\t\t) =>\n\t\t\ttypeof encodingType === 'string'\n\t\t\t\t? ({ [encodingType]: null } as Exclude<typeof encodingType, string>)\n\t\t\t\t: encodingType,\n\t\toutput: (encodingType) => encodingType,\n\t});\n\nexport const BlobMetadataV1 = bcs.struct('BlobMetadataV1', {\n\tencoding_type: EncodingType,\n\tunencoded_length: bcs.u64(),\n\thashes: bcs.vector(SliverPairMetadata),\n});\n\nexport const BlobMetadata = bcs.enum('BlobMetadata', {\n\tV1: BlobMetadataV1,\n});\n\nexport const BlobId = bcs.u256().transform({\n\tinput: (blobId: string | bigint) => (typeof blobId === 'string' ? blobIdToInt(blobId) : blobId),\n\toutput: (id: string) => blobIdFromInt(id),\n});\n\nexport function blobIdFromInt(blobId: bigint | string): string {\n\treturn bcs\n\t\t.u256()\n\t\t.serialize(blobId)\n\t\t.toBase64()\n\t\t.replace(/=*$/, '')\n\t\t.replaceAll('+', '-')\n\t\t.replaceAll('/', '_');\n}\n\nexport function blobIdFromBytes(blobId: Uint8Array): string {\n\treturn blobIdFromInt(bcs.u256().parse(blobId));\n}\n\nexport function blobIdToInt(blobId: string): bigint {\n\treturn BigInt(bcs.u256().fromBase64(blobId.replaceAll('-', '+').replaceAll('_', '/')));\n}\n\nexport const BlobMetadataWithId = bcs.struct('BlobMetadataWithId', {\n\tblob_id: BlobId,\n\tmetadata: BlobMetadata,\n});\n\nconst Symbols = bcs.struct('Symbols', {\n\tdata: bcs.vector(bcs.u8()),\n\tsymbol_size: bcs.u16(),\n});\n\nexport const SliverData = bcs.struct('SliverData', {\n\tsymbols: Symbols,\n\tindex: bcs.u16(),\n});\n\nexport const Sliver = bcs.enum('Sliver', {\n\tPrimary: SliverData,\n\tSecondary: SliverData,\n});\n\nexport const SliverPair = bcs.struct('SliverPair', {\n\tprimary: SliverData,\n\tsecondary: SliverData,\n});\n\nexport enum IntentType {\n\tPROOF_OF_POSSESSION_MSG = 0,\n\tBLOB_CERT_MSG = 1,\n\tINVALID_BLOB_ID_MSG = 2,\n\tSYNC_SHARD_MSG = 3,\n}\n\nexport const Intent = bcs\n\t.struct('Intent', {\n\t\ttype: bcs.u8().transform({\n\t\t\tinput: (type: IntentType) => type,\n\t\t\toutput: (type: number) => type as IntentType,\n\t\t}),\n\t\tversion: bcs.u8(),\n\t\tappId: bcs.u8(),\n\t})\n\t.transform({\n\t\tinput: (intent: IntentType) => ({\n\t\t\ttype: intent,\n\t\t\tversion: 0,\n\t\t\tappId: 3,\n\t\t}),\n\t\toutput: (intent) => intent.type,\n\t});\n\nexport function ProtocolMessage<T extends BcsType<any>>(messageContents: T) {\n\treturn bcs.struct(`ProtocolMessage<${messageContents.name}>`, {\n\t\tintent: Intent,\n\t\tepoch: bcs.u32(),\n\t\tmessageContents,\n\t});\n}\n\nexport const BlobPersistenceType = bcs.enum('BlobPersistenceType', {\n\tPermanent: null,\n\tDeletable: bcs.struct('Deletable', {\n\t\tobjectId: bcs.Address,\n\t}),\n});\nexport const StorageConfirmationBody = bcs.struct('StorageConfirmationBody', {\n\tblobId: BlobId,\n\tblobType: BlobPersistenceType,\n});\n\nexport const StorageConfirmation = ProtocolMessage(StorageConfirmationBody);\n\n// TODO: Remove these once testnet is updated\nconst TestnetEventBlobCertificationState = bcs.struct('EventBlobCertificationState', {\n\tlatest_certified_blob: bcs.option(EventBlob()),\n\taggregate_weight_per_blob: VecMap(bcs.u256(), bcs.u16()),\n});\nexport const TestnetSystemStateInnerV1 = bcs.struct('SystemStateInnerV1', {\n\tcommittee: BlsCommittee(),\n\ttotal_capacity_size: bcs.u64(),\n\tused_capacity_size: bcs.u64(),\n\tstorage_price_per_unit_size: bcs.u64(),\n\twrite_price_per_unit_size: bcs.u64(),\n\tfuture_accounting: FutureAccountingRingBuffer(),\n\tevent_blob_certification_state: TestnetEventBlobCertificationState,\n\tdeny_list_sizes: ExtendedField(),\n});\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,iBAAoB;AAEpB,2BAA6B;AAC7B,qBAAuB;AACvB,wBAA0B;AAC1B,4BAA8B;AAC9B,gCAA2C;AAE3C,MAAM,aAAa,eAAI,KAAK,cAAc;AAAA,EACzC,OAAO;AAAA,EACP,QAAQ,eAAI,MAAM,EAAE;AACrB,CAAC;AAED,MAAM,qBAAqB,eAAI,OAAO,sBAAsB;AAAA,EAC3D,cAAc;AAAA,EACd,gBAAgB;AACjB,CAAC;AAEM,MAAM,eAAe,eAC1B,KAAK,gBAAgB;AAAA,EACrB,UAAU;AAAA,EACV,KAAK;AACN,CAAC,EACA,UAAU;AAAA,EACV,OAAO,CACN,iBAMA,OAAO,iBAAiB,WACpB,EAAE,CAAC,YAAY,GAAG,KAAK,IACxB;AAAA,EACJ,QAAQ,CAAC,iBAAiB;AAC3B,CAAC;AAEK,MAAM,iBAAiB,eAAI,OAAO,kBAAkB;AAAA,EAC1D,eAAe;AAAA,EACf,kBAAkB,eAAI,IAAI;AAAA,EAC1B,QAAQ,eAAI,OAAO,kBAAkB;AACtC,CAAC;AAEM,MAA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,EACnC,uBAAmB,sDAA2B;AAAA,EAC9C,gCAAgC;AAAA,EAChC,qBAAiB,qCAAc;AAChC,CAAC;",
6
6
  "names": ["IntentType"]
7
7
  }
@@ -2,7 +2,7 @@ import type { Signer } from '@mysten/sui/cryptography';
2
2
  import { Transaction } from '@mysten/sui/transactions';
3
3
  import { Blob } from './contracts/blob.js';
4
4
  import type { BlobStatus } from './storage-node/types.js';
5
- import type { CertifyBlobOptions, DeleteBlobOptions, ExtendBlobOptions, GetBlobMetadataOptions, GetSliversOptions, GetStorageConfirmationOptions, GetVerifiedBlobStatusOptions, ReadBlobOptions, RegisterBlobOptions, SliversForNode, StorageWithSizeOptions, WalrusClientConfig, WalrusPackageConfig, WriteBlobAttributesOptions, WriteBlobOptions, WriteEncodedBlobOptions, WriteMetadataOptions, WriteSliverOptions, WriteSliversToNodeOptions } from './types.js';
5
+ import type { CertifyBlobOptions, DeleteBlobOptions, ExtendBlobOptions, GetBlobMetadataOptions, GetSliversOptions, GetStorageConfirmationOptions, GetVerifiedBlobStatusOptions, ReadBlobOptions, RegisterBlobOptions, SliversForNode, StorageWithSizeOptions, WalrusClientConfig, WalrusPackageConfig, WriteBlobAttributesOptions, WriteBlobOptions, WriteEncodedBlobOptions, WriteEncodedBlobToNodesOptions, WriteMetadataOptions, WriteSliverOptions, WriteSliversToNodeOptions } from './types.js';
6
6
  export declare class WalrusClient {
7
7
  #private;
8
8
  packageConfig: WalrusPackageConfig;
@@ -559,6 +559,15 @@ export declare class WalrusClient {
559
559
  * ```
560
560
  */
561
561
  writeSliversToNode({ blobId, slivers, signal }: WriteSliversToNodeOptions): Promise<void>;
562
+ /**
563
+ * Write a blob to all storage nodes
564
+ *
565
+ * @usage
566
+ * ```ts
567
+ * await client.writeEncodedBlobToNodes({ blob, deletable, epochs, signer });
568
+ * ```
569
+ */
570
+ writeEncodedBlobToNodes({ blobId, metadata, sliversByNode, signal, ...options }: WriteEncodedBlobToNodesOptions): Promise<(import("./storage-node/types.js").StorageConfirmation | null)[]>;
562
571
  /**
563
572
  * Write encoded blob to a storage node
564
573
  *
@@ -35,7 +35,13 @@ import {
35
35
  } from "./error.js";
36
36
  import { StorageNodeClient } from "./storage-node/client.js";
37
37
  import { LegallyUnavailableError, NotFoundError, UserAbortError } from "./storage-node/error.js";
38
- import { blobIdToInt, IntentType, SliverData, StorageConfirmation } from "./utils/bcs.js";
38
+ import {
39
+ blobIdToInt,
40
+ IntentType,
41
+ SliverData,
42
+ StorageConfirmation,
43
+ TestnetSystemStateInnerV1
44
+ } from "./utils/bcs.js";
39
45
  import {
40
46
  chunk,
41
47
  encodedBlobLength,
@@ -108,7 +114,7 @@ class WalrusClient {
108
114
  const systemState = await __privateGet(this, _objectLoader).loadFieldObject(
109
115
  this.packageConfig.systemObjectId,
110
116
  { type: "u64", value: (await this.systemObject()).version },
111
- SystemStateInnerV1()
117
+ this.packageConfig.systemObjectId === TESTNET_WALRUS_PACKAGE_CONFIG.systemObjectId ? TestnetSystemStateInnerV1 : SystemStateInnerV1()
112
118
  );
113
119
  return systemState;
114
120
  }
@@ -974,6 +980,48 @@ class WalrusClient {
974
980
  throw error;
975
981
  });
976
982
  }
983
+ /**
984
+ * Write a blob to all storage nodes
985
+ *
986
+ * @usage
987
+ * ```ts
988
+ * await client.writeEncodedBlobToNodes({ blob, deletable, epochs, signer });
989
+ * ```
990
+ */
991
+ async writeEncodedBlobToNodes({
992
+ blobId,
993
+ metadata,
994
+ sliversByNode,
995
+ signal,
996
+ ...options
997
+ }) {
998
+ const systemState = await this.systemState();
999
+ const committee = await __privateMethod(this, _WalrusClient_instances, getActiveCommittee_fn).call(this);
1000
+ const controller = new AbortController();
1001
+ let failures = 0;
1002
+ const confirmations = await Promise.all(
1003
+ sliversByNode.map((slivers, nodeIndex) => {
1004
+ return this.writeEncodedBlobToNode({
1005
+ blobId,
1006
+ nodeIndex,
1007
+ metadata,
1008
+ slivers,
1009
+ signal: signal ? AbortSignal.any([controller.signal, signal]) : controller.signal,
1010
+ ...options
1011
+ }).catch(() => {
1012
+ failures += committee.nodes[nodeIndex].shardIndices.length;
1013
+ if (isAboveValidity(failures, systemState.committee.n_shards)) {
1014
+ controller.abort();
1015
+ throw new NotEnoughBlobConfirmationsError(
1016
+ `Too many failures while writing blob ${blobId} to nodes`
1017
+ );
1018
+ }
1019
+ return null;
1020
+ });
1021
+ })
1022
+ );
1023
+ return confirmations;
1024
+ }
977
1025
  /**
978
1026
  * Write encoded blob to a storage node
979
1027
  *
@@ -1020,8 +1068,6 @@ class WalrusClient {
1020
1068
  owner,
1021
1069
  attributes
1022
1070
  }) {
1023
- const systemState = await this.systemState();
1024
- const committee = await __privateMethod(this, _WalrusClient_instances, getActiveCommittee_fn).call(this);
1025
1071
  const { sliversByNode, blobId, metadata, rootHash } = await this.encodeBlob(blob);
1026
1072
  const suiBlobObject = await this.executeRegisterBlobTransaction({
1027
1073
  signer,
@@ -1033,31 +1079,15 @@ class WalrusClient {
1033
1079
  owner,
1034
1080
  attributes
1035
1081
  });
1036
- const controller = new AbortController();
1037
1082
  const blobObjectId = suiBlobObject.blob.id.id;
1038
- let failures = 0;
1039
- const confirmations = await Promise.all(
1040
- sliversByNode.map((slivers, nodeIndex) => {
1041
- return this.writeEncodedBlobToNode({
1042
- blobId,
1043
- nodeIndex,
1044
- metadata,
1045
- slivers,
1046
- deletable,
1047
- objectId: blobObjectId,
1048
- signal: signal ? AbortSignal.any([controller.signal, signal]) : controller.signal
1049
- }).catch(() => {
1050
- failures += committee.nodes[nodeIndex].shardIndices.length;
1051
- if (isAboveValidity(failures, systemState.committee.n_shards)) {
1052
- controller.abort();
1053
- throw new NotEnoughBlobConfirmationsError(
1054
- `Too many failures while writing blob ${blobId} to nodes`
1055
- );
1056
- }
1057
- return null;
1058
- });
1059
- })
1060
- );
1083
+ const confirmations = await this.writeEncodedBlobToNodes({
1084
+ blobId,
1085
+ metadata,
1086
+ sliversByNode,
1087
+ deletable,
1088
+ objectId: blobObjectId,
1089
+ signal
1090
+ });
1061
1091
  await this.executeCertifyBlobTransaction({
1062
1092
  signer,
1063
1093
  blobId,