@mysten/walrus 1.0.3 → 1.1.0

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/dist/types.d.mts CHANGED
@@ -1,10 +1,10 @@
1
+ import { StorageNodeInfo } from "./contracts/walrus/storage_node.mjs";
1
2
  import { BlobMetadata } from "./utils/bcs.mjs";
2
3
  import { StorageConfirmation, StoreBlobMetadataRequestInput, StoreSliverRequestInput, Uploadable } from "./storage-node/types.mjs";
3
- import { Blob } from "./contracts/walrus/blob.mjs";
4
- import { StorageNodeInfo } from "./contracts/walrus/storage_node.mjs";
5
4
  import { RequestOptions, StorageNodeClientOptions } from "./storage-node/client.mjs";
6
5
  import { UploadRelayClientOptions } from "./upload-relay/client.mjs";
7
6
  import { WalrusFile } from "./files/file.mjs";
7
+ import { Blob } from "./contracts/walrus/blob.mjs";
8
8
  import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
9
9
  import { ClientWithCoreApi } from "@mysten/sui/client";
10
10
  import { Signer } from "@mysten/sui/cryptography";
@@ -108,7 +108,9 @@ type CertifyBlobOptions = {
108
108
  confirmations: (StorageConfirmation | null)[];
109
109
  certificate?: never;
110
110
  } | {
111
- certificate: ProtocolMessageCertificate;
111
+ /** A certificate from the upload relay or combined confirmations.
112
+ * Accepts either a ProtocolMessageCertificate object or a BCS-encoded base64 string. */
113
+ certificate: ProtocolMessageCertificate | string;
112
114
  confirmations?: never;
113
115
  });
114
116
  type DeletableConfirmationOptions = {
@@ -136,6 +138,8 @@ type GetVerifiedBlobStatusOptions = ReadBlobOptions;
136
138
  type ComputeBlobMetadataOptions = {
137
139
  bytes: Uint8Array;
138
140
  numShards?: number;
141
+ /** Provide a nonce from a prior encode to ensure deterministic resume. If omitted, a random nonce is generated. */
142
+ nonce?: Uint8Array;
139
143
  };
140
144
  interface SliversForNode {
141
145
  primary: {
@@ -181,17 +185,21 @@ type WriteBlobToUploadRelayOptions = {
181
185
  deletable: boolean;
182
186
  encodingType?: EncodingType;
183
187
  } & WalrusClientRequestOptions;
184
- type WriteBlobOptions = {
185
- blob: Uint8Array;
188
+ interface WriteBlobBaseOptions {
186
189
  deletable: boolean;
187
190
  /** The number of epochs the blob should be stored for. */
188
191
  epochs: number;
189
- signer: Signer;
190
- /** Where the blob should be transferred to after it is registered. Defaults to the signer address. */
192
+ /** Where the blob should be transferred to after it is registered. Defaults to the signer address. */
191
193
  owner?: string;
192
194
  /** The attributes to write for the blob. */
193
195
  attributes?: Record<string, string | null>;
194
- } & WalrusClientRequestOptions;
196
+ }
197
+ interface WriteBlobOptions extends WriteBlobBaseOptions, WalrusClientRequestOptions {
198
+ blob: Uint8Array;
199
+ signer: Signer;
200
+ onStep?: (step: WriteBlobStep) => void | Promise<void>;
201
+ resume?: WriteBlobStep;
202
+ }
195
203
  interface WriteQuiltOptions extends Omit<WriteBlobOptions, 'blob'> {
196
204
  blobs: {
197
205
  contents: Uint8Array;
@@ -202,44 +210,93 @@ interface WriteQuiltOptions extends Omit<WriteBlobOptions, 'blob'> {
202
210
  interface WriteFilesOptions extends Omit<WriteBlobOptions, 'blob'> {
203
211
  files: WalrusFile[];
204
212
  }
213
+ type WriteBlobStep = WriteBlobStepEncoded | WriteBlobStepRegistered | WriteBlobStepUploaded | WriteBlobStepCertified;
214
+ interface WriteBlobStepEncoded {
215
+ step: 'encoded';
216
+ blobId: string;
217
+ rootHash: string;
218
+ unencodedSize: number;
219
+ nonce?: string;
220
+ }
221
+ interface WriteBlobStepRegistered {
222
+ step: 'registered';
223
+ blobId: string;
224
+ blobObjectId: string;
225
+ txDigest: string;
226
+ nonce?: string;
227
+ }
228
+ interface WriteBlobStepUploaded {
229
+ step: 'uploaded';
230
+ blobId: string;
231
+ blobObjectId: string;
232
+ txDigest?: string;
233
+ certificate: string;
234
+ }
235
+ interface WriteBlobStepCertified {
236
+ step: 'certified';
237
+ blobId: string;
238
+ blobObjectId: string;
239
+ blobObject: (typeof Blob)['$inferType'];
240
+ }
205
241
  interface WriteFilesFlowOptions {
206
242
  files: WalrusFile[];
243
+ resume?: WriteBlobStep;
207
244
  }
208
- interface WriteFilesFlowRegisterOptions extends Omit<WriteBlobOptions, 'blob' | 'signer'> {
245
+ interface WriteFilesFlowRegisterOptions extends WriteBlobBaseOptions {
209
246
  owner: string;
210
247
  }
211
248
  interface WriteFilesFlowUploadOptions {
212
- digest: string;
249
+ digest?: string;
250
+ }
251
+ interface WriteFilesFlowRunOptions extends WriteBlobBaseOptions, WalrusClientRequestOptions {
252
+ signer: Signer;
213
253
  }
214
254
  interface WriteFilesFlow {
215
- encode: () => Promise<void>;
255
+ encode: () => Promise<WriteBlobStepEncoded>;
216
256
  register: (options: WriteFilesFlowRegisterOptions) => Transaction;
217
- upload: (options: WriteFilesFlowUploadOptions) => Promise<void>;
257
+ upload: (options?: WriteFilesFlowUploadOptions) => Promise<WriteBlobStepUploaded>;
218
258
  certify: () => Transaction;
219
259
  listFiles: () => Promise<{
220
260
  id: string;
221
261
  blobId: string;
222
262
  blobObject: (typeof Blob)['$inferType'];
223
263
  }[]>;
264
+ executeRegister: (options: WriteFilesFlowRegisterOptions & {
265
+ signer: Signer;
266
+ }) => Promise<WriteBlobStepRegistered>;
267
+ executeCertify: (options: {
268
+ signer: Signer;
269
+ }) => Promise<WriteBlobStepCertified>;
270
+ run: (options: WriteFilesFlowRunOptions) => AsyncIterable<WriteBlobStep>;
224
271
  }
225
272
  interface WriteBlobFlowOptions {
226
273
  blob: Uint8Array;
274
+ resume?: WriteBlobStep;
227
275
  }
228
- interface WriteBlobFlowRegisterOptions extends Omit<WriteBlobOptions, 'blob' | 'signer'> {
276
+ interface WriteBlobFlowRegisterOptions extends WriteBlobBaseOptions {
229
277
  owner: string;
230
278
  }
231
- interface WriteBlobFlowUploadOptions {
232
- digest: string;
279
+ interface WriteBlobFlowUploadOptions extends WalrusClientRequestOptions {
280
+ digest?: string;
281
+ /** Override the deletable flag when resuming without a prior register step. */
282
+ deletable?: boolean;
283
+ }
284
+ interface WriteBlobFlowRunOptions extends WriteBlobBaseOptions, WalrusClientRequestOptions {
285
+ signer: Signer;
233
286
  }
234
287
  interface WriteBlobFlow {
235
- encode: () => Promise<void>;
288
+ encode: () => Promise<WriteBlobStepEncoded>;
236
289
  register: (options: WriteBlobFlowRegisterOptions) => Transaction;
237
- upload: (options: WriteBlobFlowUploadOptions) => Promise<void>;
290
+ upload: (options?: WriteBlobFlowUploadOptions) => Promise<WriteBlobStepUploaded>;
238
291
  certify: () => Transaction;
239
- getBlob: () => Promise<{
240
- blobId: string;
241
- blobObject: (typeof Blob)['$inferType'];
242
- }>;
292
+ getBlob: () => Promise<WriteBlobStepCertified>;
293
+ executeRegister: (options: WriteBlobFlowRegisterOptions & {
294
+ signer: Signer;
295
+ }) => Promise<WriteBlobStepRegistered>;
296
+ executeCertify: (options: {
297
+ signer: Signer;
298
+ }) => Promise<WriteBlobStepCertified>;
299
+ run: (options: WriteBlobFlowRunOptions) => AsyncIterable<WriteBlobStep>;
243
300
  }
244
301
  interface DeleteBlobOptions {
245
302
  blobObjectId: string;
@@ -273,5 +330,5 @@ interface ProtocolMessageCertificate {
273
330
  signature: Uint8Array;
274
331
  }
275
332
  //#endregion
276
- export { CertifyBlobOptions, CommitteeInfo, ComputeBlobMetadataOptions, DeletableConfirmationOptions, DeleteBlobOptions, EncodingType, ExtendBlobOptions, GetBlobMetadataOptions, GetCertificationEpochOptions, GetSecondarySliverOptions, GetSliversOptions, GetStorageConfirmationOptions, GetVerifiedBlobStatusOptions, ProtocolMessageCertificate, ReadBlobOptions, RegisterBlobOptions, SliversForNode, StorageNode, StorageWithSizeOptions, TipStrategy, UploadRelayConfig, UploadRelayTipConfig, WalrusClientConfig, WalrusClientExtensionOptions, WalrusClientRequestOptions, WalrusOptions, WalrusPackageConfig, WriteBlobAttributesOptions, WriteBlobFlow, WriteBlobFlowOptions, WriteBlobFlowRegisterOptions, WriteBlobFlowUploadOptions, WriteBlobOptions, WriteBlobToUploadRelayOptions, WriteEncodedBlobOptions, WriteEncodedBlobToNodesOptions, WriteFilesFlow, WriteFilesFlowOptions, WriteFilesFlowRegisterOptions, WriteFilesFlowUploadOptions, WriteFilesOptions, WriteMetadataOptions, WriteQuiltOptions, WriteSliverOptions, WriteSliversToNodeOptions };
333
+ export { CertifyBlobOptions, CommitteeInfo, ComputeBlobMetadataOptions, DeletableConfirmationOptions, DeleteBlobOptions, EncodingType, ExtendBlobOptions, GetBlobMetadataOptions, GetCertificationEpochOptions, GetSecondarySliverOptions, GetSliversOptions, GetStorageConfirmationOptions, GetVerifiedBlobStatusOptions, ProtocolMessageCertificate, ReadBlobOptions, RegisterBlobOptions, SliversForNode, StorageNode, StorageWithSizeOptions, TipStrategy, UploadRelayConfig, UploadRelayTipConfig, WalrusClientConfig, WalrusClientExtensionOptions, WalrusClientRequestOptions, WalrusOptions, WalrusPackageConfig, WriteBlobAttributesOptions, WriteBlobBaseOptions, WriteBlobFlow, WriteBlobFlowOptions, WriteBlobFlowRegisterOptions, WriteBlobFlowRunOptions, WriteBlobFlowUploadOptions, WriteBlobOptions, WriteBlobStep, WriteBlobStepCertified, WriteBlobStepEncoded, WriteBlobStepRegistered, WriteBlobStepUploaded, WriteBlobToUploadRelayOptions, WriteEncodedBlobOptions, WriteEncodedBlobToNodesOptions, WriteFilesFlow, WriteFilesFlowOptions, WriteFilesFlowRegisterOptions, WriteFilesFlowRunOptions, WriteFilesFlowUploadOptions, WriteFilesOptions, WriteMetadataOptions, WriteQuiltOptions, WriteSliverOptions, WriteSliversToNodeOptions };
277
334
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;AAyBA;AAMC;AAYD;AAWY,UA7BK,mBAAA,CA6Be;EAMf;EASP,cAAA,EAAA,MAAA;EAWE;EAAqB,aAAA,EAAA,MAAA;EAChC,WAAA,CAAA,EAAA,MAAA,EAAA;;KAhDI,4BAA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SAAgC,sBAAsB;UAC9D;;UAGQ,aAAA;gBACF,QAAQ;sBACF,iCAAiC;qBAClC,+BAA+B,QAAQ;iBAC3C;iBACA,QAAQ;6BAGb;YAAyC;QAC9C,QAAQ;;YACuB;QAAa,QAAQ;iBAE1C,4BAA4B,cAAc;;UAGzC,iBAAA;;;KAIL,iBAAA;;;YAGD;;;;;;;;;;KAcC,0BAAA;cACC;;cAGE;;;;;;KASH,YAAA,GAAe,eAAe,YAAA,CAAa;UAEtC,0BAAA;;qBAEG;aACR"}
@@ -123,7 +123,20 @@ const QuiltPatchBlobHeader = bcs.struct("QuiltPatchBlobHeader", {
123
123
  length: bcs.u32(),
124
124
  mask: bcs.u8()
125
125
  });
126
+ const CertificateBcs = bcs.struct("Certificate", {
127
+ signers: bcs.vector(bcs.u16()),
128
+ serializedMessage: bcs.byteVector(),
129
+ signature: bcs.byteVector()
130
+ });
131
+ function parseCertificateFromBase64(base64) {
132
+ const cert = CertificateBcs.fromBase64(base64);
133
+ return {
134
+ signers: cert.signers,
135
+ serializedMessage: new Uint8Array(cert.serializedMessage),
136
+ signature: new Uint8Array(cert.signature)
137
+ };
138
+ }
126
139
 
127
140
  //#endregion
128
- export { BlobId, BlobMetadata, BlobMetadataWithId, Field, IntentType, QuiltIndexV1, QuiltPatchBlobHeader, QuiltPatchId, QuiltPatchTags, SliverData, StorageConfirmation, blobIdFromBytes, blobIdFromInt, blobIdToInt };
141
+ export { BlobId, BlobMetadata, BlobMetadataWithId, CertificateBcs, Field, IntentType, QuiltIndexV1, QuiltPatchBlobHeader, QuiltPatchId, QuiltPatchTags, SliverData, StorageConfirmation, blobIdFromBytes, blobIdFromInt, blobIdToInt, parseCertificateFromBase64 };
129
142
  //# sourceMappingURL=bcs.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"bcs.mjs","names":[],"sources":["../../src/utils/bcs.ts"],"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\tblobId: BlobId,\n\tmetadata: BlobMetadata,\n});\n\nconst Symbols = bcs.struct('Symbols', {\n\tdata: bcs.byteVector(),\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\nexport function Field<T0 extends BcsType<any>, T1 extends BcsType<any>>(\n\t...typeParameters: [T0, T1]\n) {\n\treturn bcs.struct('Field', {\n\t\tid: bcs.Address,\n\t\tname: typeParameters[0],\n\t\tvalue: typeParameters[1],\n\t});\n}\n\nexport const QuiltPatchTags = bcs.map(bcs.string(), bcs.string()).transform({\n\t// Accept both Record and Map as input, bcs.map() handles sorting automatically\n\tinput: (tags: Record<string, string> | Map<string, string>) =>\n\t\ttags instanceof Map ? tags : new Map(Object.entries(tags)),\n\toutput: (tags: Map<string, string>) => Object.fromEntries(tags),\n});\n\nexport const QuiltPatchV1 = bcs.struct('QuiltPatchV1', {\n\tendIndex: bcs.u16(),\n\tidentifier: bcs.string(),\n\ttags: QuiltPatchTags,\n});\n\nexport const QuiltIndexV1 = bcs.struct('QuiltIndexV1', {\n\tpatches: bcs.vector(QuiltPatchV1),\n});\n\nexport const QuiltPatchId = bcs.struct('QuiltPatchId', {\n\tquiltId: BlobId,\n\tpatchId: bcs.struct('InternalQuiltPatchId', {\n\t\tversion: bcs.u8(),\n\t\tstartIndex: bcs.u16(),\n\t\tendIndex: bcs.u16(),\n\t}),\n});\n\nexport const QuiltPatchBlobHeader = bcs.struct('QuiltPatchBlobHeader', {\n\tversion: bcs.u8(),\n\tlength: bcs.u32(),\n\tmask: bcs.u8(),\n});\n"],"mappings":";;;AAMA,MAAM,aAAa,IAAI,KAAK,cAAc;CACzC,OAAO;CACP,QAAQ,IAAI,MAAM,GAAG;CACrB,CAAC;AAEF,MAAM,qBAAqB,IAAI,OAAO,sBAAsB;CAC3D,cAAc;CACd,gBAAgB;CAChB,CAAC;AAEF,MAAa,eAAe,IAC1B,KAAK,gBAAgB;CACrB,UAAU;CACV,KAAK;CACL,CAAC,CACD,UAAU;CACV,QACC,iBAMA,OAAO,iBAAiB,WACpB,GAAG,eAAe,MAAM,GACzB;CACJ,SAAS,iBAAiB;CAC1B,CAAC;AAEH,MAAa,iBAAiB,IAAI,OAAO,kBAAkB;CAC1D,eAAe;CACf,kBAAkB,IAAI,KAAK;CAC3B,QAAQ,IAAI,OAAO,mBAAmB;CACtC,CAAC;AAEF,MAAa,eAAe,IAAI,KAA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I,IAAI;CACd,CAAC"}
1
+ {"version":3,"file":"bcs.mjs","names":[],"sources":["../../src/utils/bcs.ts"],"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\tblobId: BlobId,\n\tmetadata: BlobMetadata,\n});\n\nconst Symbols = bcs.struct('Symbols', {\n\tdata: bcs.byteVector(),\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\nexport function Field<T0 extends BcsType<any>, T1 extends BcsType<any>>(\n\t...typeParameters: [T0, T1]\n) {\n\treturn bcs.struct('Field', {\n\t\tid: bcs.Address,\n\t\tname: typeParameters[0],\n\t\tvalue: typeParameters[1],\n\t});\n}\n\nexport const QuiltPatchTags = bcs.map(bcs.string(), bcs.string()).transform({\n\t// Accept both Record and Map as input, bcs.map() handles sorting automatically\n\tinput: (tags: Record<string, string> | Map<string, string>) =>\n\t\ttags instanceof Map ? tags : new Map(Object.entries(tags)),\n\toutput: (tags: Map<string, string>) => Object.fromEntries(tags),\n});\n\nexport const QuiltPatchV1 = bcs.struct('QuiltPatchV1', {\n\tendIndex: bcs.u16(),\n\tidentifier: bcs.string(),\n\ttags: QuiltPatchTags,\n});\n\nexport const QuiltIndexV1 = bcs.struct('QuiltIndexV1', {\n\tpatches: bcs.vector(QuiltPatchV1),\n});\n\nexport const QuiltPatchId = bcs.struct('QuiltPatchId', {\n\tquiltId: BlobId,\n\tpatchId: bcs.struct('InternalQuiltPatchId', {\n\t\tversion: bcs.u8(),\n\t\tstartIndex: bcs.u16(),\n\t\tendIndex: bcs.u16(),\n\t}),\n});\n\nexport const QuiltPatchBlobHeader = bcs.struct('QuiltPatchBlobHeader', {\n\tversion: bcs.u8(),\n\tlength: bcs.u32(),\n\tmask: bcs.u8(),\n});\n\nexport const CertificateBcs = bcs.struct('Certificate', {\n\tsigners: bcs.vector(bcs.u16()),\n\tserializedMessage: bcs.byteVector(),\n\tsignature: bcs.byteVector(),\n});\n\nexport function parseCertificateFromBase64(base64: string) {\n\tconst cert = CertificateBcs.fromBase64(base64);\n\treturn {\n\t\tsigners: cert.signers,\n\t\tserializedMessage: new Uint8Array(cert.serializedMessage),\n\t\tsignature: new Uint8Array(cert.signature),\n\t};\n}\n"],"mappings":";;;AAMA,MAAM,aAAa,IAAI,KAAK,cAAc;CACzC,OAAO;CACP,QAAQ,IAAI,MAAM,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