@mysten/walrus 1.0.4 → 1.1.1
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/CHANGELOG.md +28 -0
- package/README.md +52 -0
- package/dist/client.d.mts +108 -36
- package/dist/client.d.mts.map +1 -1
- package/dist/client.mjs +177 -345
- package/dist/client.mjs.map +1 -1
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +2 -1
- package/dist/constants.mjs.map +1 -1
- package/dist/contracts/utils/index.d.mts.map +1 -1
- package/dist/contracts/utils/index.mjs.map +1 -1
- package/dist/contracts/walrus/blob.d.mts +12 -12
- package/dist/contracts/walrus/blob.d.mts.map +1 -1
- package/dist/contracts/walrus/storage_node.d.mts +8 -8
- package/dist/contracts/walrus/storage_node.d.mts.map +1 -1
- package/dist/error.d.mts.map +1 -1
- package/dist/files/blob.d.mts.map +1 -1
- package/dist/files/file.d.mts.map +1 -1
- package/dist/files/readers/blob.d.mts.map +1 -1
- package/dist/files/readers/quilt-file.d.mts +0 -1
- package/dist/files/readers/quilt-file.d.mts.map +1 -1
- package/dist/files/readers/quilt.d.mts.map +1 -1
- package/dist/flows/write-blob.mjs +227 -0
- package/dist/flows/write-blob.mjs.map +1 -0
- package/dist/flows/write-files.mjs +112 -0
- package/dist/flows/write-files.mjs.map +1 -0
- package/dist/index.d.mts +3 -2
- package/dist/storage-node/client.d.mts.map +1 -1
- package/dist/storage-node/client.mjs +14 -0
- package/dist/storage-node/client.mjs.map +1 -1
- package/dist/storage-node/error.d.mts.map +1 -1
- package/dist/storage-node/types.d.mts +2 -1
- package/dist/storage-node/types.d.mts.map +1 -1
- package/dist/storage-node/utils.d.mts.map +1 -1
- package/dist/types.d.mts +82 -30
- package/dist/types.d.mts.map +1 -1
- package/dist/upload-relay/client.d.mts.map +1 -1
- package/dist/utils/bcs.d.mts +1 -2
- package/dist/utils/bcs.d.mts.map +1 -1
- package/dist/utils/bcs.mjs +14 -1
- package/dist/utils/bcs.mjs.map +1 -1
- package/dist/utils/quilts.d.mts +0 -1
- package/dist/utils/quilts.d.mts.map +1 -1
- package/docs/index.md +174 -129
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","names":["#fetch","#timeout","#onError","#request","error"],"sources":["../../src/storage-node/client.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BlobMetadata, BlobMetadataWithId, SliverData } from '../utils/bcs.js';\nimport {\n\tConnectionTimeoutError,\n\tStorageNodeAPIError,\n\tStorageNodeError,\n\tUserAbortError,\n} from './error.js';\nimport type {\n\tGetBlobMetadataRequestInput,\n\tGetBlobMetadataResponse,\n\tGetBlobStatusRequestInput,\n\tGetBlobStatusResponse,\n\tGetDeletableBlobConfirmationRequestInput,\n\tGetDeletableBlobConfirmationResponse,\n\tGetPermanentBlobConfirmationRequestInput,\n\tGetPermanentBlobConfirmationResponse,\n\tGetSliverRequestInput,\n\tGetSliverResponse,\n\tRawGetBlobStatusResponse,\n\tStoreBlobMetadataRequestInput,\n\tStoreBlobMetadataResponse,\n\tStoreSliverRequestInput,\n\tStoreSliverResponse,\n} from './types.js';\nimport { mergeHeaders } from './utils.js';\n\nexport type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;\n\nexport type StorageNodeClientOptions = {\n\t/**\n\t * An optional custom fetch function.\n\t *\n\t * If not provided, defaults to the global `fetch` function (`globalThis.fetch`).\n\t *\n\t * @default globalThis.fetch\n\t */\n\tfetch?: Fetch;\n\n\t/**\n\t * An optional timeout for requests.\n\t * @default 30_000ms (30 seconds)\n\t */\n\ttimeout?: number;\n\n\t/**\n\t * Callback for individual network errors.\n\t */\n\tonError?: (error: Error) => void;\n};\n\nexport type RequestOptions = {\n\tnodeUrl: string;\n\ttimeout?: number;\n\theaders?: ReturnType<typeof mergeHeaders>;\n} & Omit<RequestInit, 'headers'>;\n\nexport class StorageNodeClient {\n\t#fetch: Fetch;\n\t#timeout: number;\n\t#onError?: (error: Error) => void;\n\tconstructor({ fetch: overriddenFetch, timeout, onError }: StorageNodeClientOptions = {}) {\n\t\tthis.#fetch = overriddenFetch ?? globalThis.fetch;\n\t\tthis.#timeout = timeout ?? 30_000;\n\t\tthis.#onError = onError;\n\t}\n\n\t/**\n\t * Gets the metadata associated with a Walrus blob.\n\t */\n\tasync getBlobMetadata(\n\t\t{ blobId }: GetBlobMetadataRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetBlobMetadataResponse> {\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/metadata`, {\n\t\t\t...options,\n\t\t\theaders: mergeHeaders({ Accept: 'application/octet-stream' }, options.headers),\n\t\t});\n\n\t\tconst bcsBytes = await response.arrayBuffer();\n\t\treturn BlobMetadataWithId.parse(new Uint8Array(bcsBytes));\n\t}\n\n\t/**\n\t * Gets the status associated with a Walrus blob.\n\t */\n\tasync getBlobStatus(\n\t\t{ blobId }: GetBlobStatusRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetBlobStatusResponse> {\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/status`, options);\n\n\t\tconst json: RawGetBlobStatusResponse = await response.json();\n\t\tconst blobStatus = json.success.data;\n\n\t\tif (blobStatus === 'nonexistent') {\n\t\t\treturn { type: 'nonexistent' };\n\t\t}\n\n\t\tif ('invalid' in blobStatus) {\n\t\t\treturn {\n\t\t\t\ttype: 'invalid',\n\t\t\t\t...blobStatus.invalid,\n\t\t\t};\n\t\t}\n\n\t\tif ('permanent' in blobStatus) {\n\t\t\treturn {\n\t\t\t\ttype: 'permanent',\n\t\t\t\t...blobStatus.permanent,\n\t\t\t};\n\t\t}\n\n\t\tif ('deletable' in blobStatus) {\n\t\t\treturn {\n\t\t\t\ttype: 'deletable',\n\t\t\t\t...blobStatus.deletable,\n\t\t\t};\n\t\t}\n\n\t\tthrow new StorageNodeError(`Unknown blob status received: ${blobStatus}`);\n\t}\n\n\t/**\n\t * Stores the metadata associated with a registered Walrus blob at this storage\n\t * node. This is a pre-requisite for storing the encoded slivers of the blob. The\n\t * ID of the blob must first be registered on Sui, after which storing the metadata\n\t * becomes possible.\n\t *\n\t * This endpoint may return an error if the node has not yet received the\n\t * registration event from the chain.\n\t */\n\tasync storeBlobMetadata(\n\t\t{ blobId, metadata }: StoreBlobMetadataRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<StoreBlobMetadataResponse> {\n\t\tconst isBcsInput = typeof metadata === 'object' && 'V1' in metadata;\n\t\tconst body = isBcsInput ? BlobMetadata.serialize(metadata).toBytes() : metadata;\n\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/metadata`, {\n\t\t\t...options,\n\t\t\tmethod: 'PUT',\n\t\t\tbody: body as Uint8Array<ArrayBuffer>,\n\t\t\theaders: mergeHeaders({ 'Content-Type': 'application/octet-stream' }, options.headers),\n\t\t});\n\n\t\tconst json: StoreBlobMetadataResponse = await response.json();\n\t\treturn json;\n\t}\n\n\t/**\n\t * Gets the primary or secondary sliver identified by the specified blob ID and\n\t * index. The index should represent a sliver that is assigned to be stored at one\n\t * of the shards managed by this storage node during this epoch.\n\t */\n\tasync getSliver(\n\t\t{ blobId, sliverPairIndex, sliverType }: GetSliverRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetSliverResponse> {\n\t\tconst response = await this.#request(\n\t\t\t`/v1/blobs/${blobId}/slivers/${sliverPairIndex}/${sliverType}`,\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\theaders: mergeHeaders({ Accept: 'application/octet-stream' }, options.headers),\n\t\t\t},\n\t\t);\n\n\t\tconst bcsBytes = await response.arrayBuffer();\n\t\treturn new Uint8Array(bcsBytes);\n\t}\n\n\t/**\n\t * Stores a primary or secondary blob sliver at the storage node.\n\t */\n\tasync storeSliver(\n\t\t{ blobId, sliverPairIndex, sliverType, sliver }: StoreSliverRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<StoreSliverResponse> {\n\t\tconst isBcsInput = typeof sliver === 'object' && 'symbols' in sliver;\n\t\tconst body = isBcsInput ? SliverData.serialize(sliver).toBytes() : sliver;\n\n\t\tconst response = await this.#request(\n\t\t\t`/v1/blobs/${blobId}/slivers/${sliverPairIndex}/${sliverType}`,\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tmethod: 'PUT',\n\t\t\t\tbody: body as Uint8Array<ArrayBuffer>,\n\t\t\t\theaders: mergeHeaders({ 'Content-Type': 'application/octet-stream' }, options.headers),\n\t\t\t},\n\t\t);\n\n\t\tconst json: StoreSliverResponse = await response.json();\n\t\treturn json;\n\t}\n\n\t/**\n\t * Gets a signed storage confirmation from this storage node, indicating that all shards\n\t * assigned to this storage node for the current epoch have stored their respective slivers.\n\t */\n\tasync getDeletableBlobConfirmation(\n\t\t{ blobId, objectId }: GetDeletableBlobConfirmationRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetDeletableBlobConfirmationResponse> {\n\t\tconst response = await this.#request(\n\t\t\t`/v1/blobs/${blobId}/confirmation/deletable/${objectId}`,\n\t\t\toptions,\n\t\t);\n\n\t\tconst json: GetDeletableBlobConfirmationResponse = await response.json();\n\t\treturn json;\n\t}\n\n\t/**\n\t * Gets a signed storage confirmation from this storage node, indicating that all shards\n\t * assigned to this storage node for the current epoch have stored their respective slivers.\n\t */\n\tasync getPermanentBlobConfirmation(\n\t\t{ blobId }: GetPermanentBlobConfirmationRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetPermanentBlobConfirmationResponse> {\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/confirmation/permanent`, options);\n\n\t\tconst json: GetPermanentBlobConfirmationResponse = await response.json();\n\t\treturn json;\n\t}\n\n\tasync #request(path: string, options: RequestOptions) {\n\t\tconst { nodeUrl, signal, timeout, ...init } = options;\n\n\t\tif (signal?.aborted) {\n\t\t\tthrow new UserAbortError();\n\t\t}\n\n\t\tconst timeoutSignal = AbortSignal.timeout(timeout ?? this.#timeout);\n\n\t\tlet response: Response | undefined;\n\n\t\ttry {\n\t\t\tconst fetch = this.#fetch;\n\t\t\tresponse = await fetch(`${nodeUrl}${path}`, {\n\t\t\t\t...init,\n\t\t\t\tsignal: signal ? AbortSignal.any([timeoutSignal, signal]) : timeoutSignal,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (signal?.aborted) {\n\t\t\t\tthrow new UserAbortError();\n\t\t\t}\n\n\t\t\tif (error instanceof Error && error.name === 'AbortError') {\n\t\t\t\tconst error = new ConnectionTimeoutError();\n\t\t\t\tthis.#onError?.(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthis.#onError?.(error as Error);\n\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tconst errorText = await response.text().catch((reason) => reason);\n\t\t\tconst errorJSON = safeParseJSON(errorText);\n\t\t\tconst errorMessage = errorJSON ? undefined : errorText;\n\t\t\tconst error = StorageNodeAPIError.generate(response.status, errorJSON, errorMessage);\n\t\t\tthis.#onError?.(error);\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn response;\n\t}\n}\n\nfunction safeParseJSON(value: string) {\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"],"mappings":";;;;;AA2DA,IAAa,oBAAb,MAA+B;CAC9B;CACA;CACA;CACA,YAAY,EAAE,OAAO,iBAAiB,SAAS,YAAsC,EAAE,EAAE;AACxF,QAAKA,QAAS,mBAAmB,WAAW;AAC5C,QAAKC,UAAW,WAAW;AAC3B,QAAKC,UAAW;;;;;CAMjB,MAAM,gBACL,EAAE,UACF,SACmC;EAMnC,MAAM,WAAW,OALA,MAAM,MAAKC,QAAS,aAAa,OAAO,YAAY;GACpE,GAAG;GACH,SAAS,aAAa,EAAE,QAAQ,4BAA4B,EAAE,QAAQ,QAAQ;GAC9E,CAAC,EAE8B,aAAa;AAC7C,SAAO,mBAAmB,MAAM,IAAI,WAAW,SAAS,CAAC;;;;;CAM1D,MAAM,cACL,E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KAAK,MAAM,MAAM;SACjB;AACP"}
|
|
1
|
+
{"version":3,"file":"client.mjs","names":["#fetch","#timeout","#onError","#request","error"],"sources":["../../src/storage-node/client.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BlobMetadata, BlobMetadataWithId, SliverData } from '../utils/bcs.js';\nimport {\n\tConnectionTimeoutError,\n\tStorageNodeAPIError,\n\tStorageNodeError,\n\tUserAbortError,\n} from './error.js';\nimport type {\n\tGetBlobMetadataRequestInput,\n\tGetBlobMetadataResponse,\n\tGetBlobStatusRequestInput,\n\tGetBlobStatusResponse,\n\tGetDeletableBlobConfirmationRequestInput,\n\tGetDeletableBlobConfirmationResponse,\n\tGetPermanentBlobConfirmationRequestInput,\n\tGetPermanentBlobConfirmationResponse,\n\tGetSliverRequestInput,\n\tGetSliverResponse,\n\tRawGetBlobStatusResponse,\n\tStoreBlobMetadataRequestInput,\n\tStoreBlobMetadataResponse,\n\tStoreSliverRequestInput,\n\tStoreSliverResponse,\n\tStoredOnNodeStatus,\n\tStoredOnNodeStatusResponse,\n} from './types.js';\nimport { mergeHeaders } from './utils.js';\n\nexport type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;\n\nexport type StorageNodeClientOptions = {\n\t/**\n\t * An optional custom fetch function.\n\t *\n\t * If not provided, defaults to the global `fetch` function (`globalThis.fetch`).\n\t *\n\t * @default globalThis.fetch\n\t */\n\tfetch?: Fetch;\n\n\t/**\n\t * An optional timeout for requests.\n\t * @default 30_000ms (30 seconds)\n\t */\n\ttimeout?: number;\n\n\t/**\n\t * Callback for individual network errors.\n\t */\n\tonError?: (error: Error) => void;\n};\n\nexport type RequestOptions = {\n\tnodeUrl: string;\n\ttimeout?: number;\n\theaders?: ReturnType<typeof mergeHeaders>;\n} & Omit<RequestInit, 'headers'>;\n\nexport class StorageNodeClient {\n\t#fetch: Fetch;\n\t#timeout: number;\n\t#onError?: (error: Error) => void;\n\tconstructor({ fetch: overriddenFetch, timeout, onError }: StorageNodeClientOptions = {}) {\n\t\tthis.#fetch = overriddenFetch ?? globalThis.fetch;\n\t\tthis.#timeout = timeout ?? 30_000;\n\t\tthis.#onError = onError;\n\t}\n\n\t/**\n\t * Gets the metadata associated with a Walrus blob.\n\t */\n\tasync getBlobMetadata(\n\t\t{ blobId }: GetBlobMetadataRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetBlobMetadataResponse> {\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/metadata`, {\n\t\t\t...options,\n\t\t\theaders: mergeHeaders({ Accept: 'application/octet-stream' }, options.headers),\n\t\t});\n\n\t\tconst bcsBytes = await response.arrayBuffer();\n\t\treturn BlobMetadataWithId.parse(new Uint8Array(bcsBytes));\n\t}\n\n\t/**\n\t * Gets the status associated with a Walrus blob.\n\t */\n\tasync getBlobStatus(\n\t\t{ blobId }: GetBlobStatusRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetBlobStatusResponse> {\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/status`, options);\n\n\t\tconst json: RawGetBlobStatusResponse = await response.json();\n\t\tconst blobStatus = json.success.data;\n\n\t\tif (blobStatus === 'nonexistent') {\n\t\t\treturn { type: 'nonexistent' };\n\t\t}\n\n\t\tif ('invalid' in blobStatus) {\n\t\t\treturn {\n\t\t\t\ttype: 'invalid',\n\t\t\t\t...blobStatus.invalid,\n\t\t\t};\n\t\t}\n\n\t\tif ('permanent' in blobStatus) {\n\t\t\treturn {\n\t\t\t\ttype: 'permanent',\n\t\t\t\t...blobStatus.permanent,\n\t\t\t};\n\t\t}\n\n\t\tif ('deletable' in blobStatus) {\n\t\t\treturn {\n\t\t\t\ttype: 'deletable',\n\t\t\t\t...blobStatus.deletable,\n\t\t\t};\n\t\t}\n\n\t\tthrow new StorageNodeError(`Unknown blob status received: ${blobStatus}`);\n\t}\n\n\t/**\n\t * Stores the metadata associated with a registered Walrus blob at this storage\n\t * node. This is a pre-requisite for storing the encoded slivers of the blob. The\n\t * ID of the blob must first be registered on Sui, after which storing the metadata\n\t * becomes possible.\n\t *\n\t * This endpoint may return an error if the node has not yet received the\n\t * registration event from the chain.\n\t */\n\tasync storeBlobMetadata(\n\t\t{ blobId, metadata }: StoreBlobMetadataRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<StoreBlobMetadataResponse> {\n\t\tconst isBcsInput = typeof metadata === 'object' && 'V1' in metadata;\n\t\tconst body = isBcsInput ? BlobMetadata.serialize(metadata).toBytes() : metadata;\n\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/metadata`, {\n\t\t\t...options,\n\t\t\tmethod: 'PUT',\n\t\t\tbody: body as Uint8Array<ArrayBuffer>,\n\t\t\theaders: mergeHeaders({ 'Content-Type': 'application/octet-stream' }, options.headers),\n\t\t});\n\n\t\tconst json: StoreBlobMetadataResponse = await response.json();\n\t\treturn json;\n\t}\n\n\t/**\n\t * Gets the primary or secondary sliver identified by the specified blob ID and\n\t * index. The index should represent a sliver that is assigned to be stored at one\n\t * of the shards managed by this storage node during this epoch.\n\t */\n\tasync getSliver(\n\t\t{ blobId, sliverPairIndex, sliverType }: GetSliverRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetSliverResponse> {\n\t\tconst response = await this.#request(\n\t\t\t`/v1/blobs/${blobId}/slivers/${sliverPairIndex}/${sliverType}`,\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\theaders: mergeHeaders({ Accept: 'application/octet-stream' }, options.headers),\n\t\t\t},\n\t\t);\n\n\t\tconst bcsBytes = await response.arrayBuffer();\n\t\treturn new Uint8Array(bcsBytes);\n\t}\n\n\t/**\n\t * Stores a primary or secondary blob sliver at the storage node.\n\t */\n\tasync storeSliver(\n\t\t{ blobId, sliverPairIndex, sliverType, sliver }: StoreSliverRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<StoreSliverResponse> {\n\t\tconst isBcsInput = typeof sliver === 'object' && 'symbols' in sliver;\n\t\tconst body = isBcsInput ? SliverData.serialize(sliver).toBytes() : sliver;\n\n\t\tconst response = await this.#request(\n\t\t\t`/v1/blobs/${blobId}/slivers/${sliverPairIndex}/${sliverType}`,\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\tmethod: 'PUT',\n\t\t\t\tbody: body as Uint8Array<ArrayBuffer>,\n\t\t\t\theaders: mergeHeaders({ 'Content-Type': 'application/octet-stream' }, options.headers),\n\t\t\t},\n\t\t);\n\n\t\tconst json: StoreSliverResponse = await response.json();\n\t\treturn json;\n\t}\n\n\t/**\n\t * Gets a signed storage confirmation from this storage node, indicating that all shards\n\t * assigned to this storage node for the current epoch have stored their respective slivers.\n\t */\n\tasync getDeletableBlobConfirmation(\n\t\t{ blobId, objectId }: GetDeletableBlobConfirmationRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetDeletableBlobConfirmationResponse> {\n\t\tconst response = await this.#request(\n\t\t\t`/v1/blobs/${blobId}/confirmation/deletable/${objectId}`,\n\t\t\toptions,\n\t\t);\n\n\t\tconst json: GetDeletableBlobConfirmationResponse = await response.json();\n\t\treturn json;\n\t}\n\n\t/**\n\t * Gets a signed storage confirmation from this storage node, indicating that all shards\n\t * assigned to this storage node for the current epoch have stored their respective slivers.\n\t */\n\tasync getPermanentBlobConfirmation(\n\t\t{ blobId }: GetPermanentBlobConfirmationRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<GetPermanentBlobConfirmationResponse> {\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/confirmation/permanent`, options);\n\n\t\tconst json: GetPermanentBlobConfirmationResponse = await response.json();\n\t\treturn json;\n\t}\n\n\t/**\n\t * Gets the storage status of a sliver at this storage node.\n\t * Returns whether the sliver is stored, buffered (pending registration), or nonexistent.\n\t */\n\tasync getSliverStatus(\n\t\t{ blobId, sliverPairIndex, sliverType }: GetSliverRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<StoredOnNodeStatus> {\n\t\tconst response = await this.#request(\n\t\t\t`/v1/blobs/${blobId}/slivers/${sliverPairIndex}/${sliverType}/status`,\n\t\t\toptions,\n\t\t);\n\n\t\tconst json: StoredOnNodeStatusResponse = await response.json();\n\t\treturn json.success.data;\n\t}\n\n\t/**\n\t * Gets the storage status of blob metadata at this storage node.\n\t * Returns whether the metadata is stored, buffered (pending registration), or nonexistent.\n\t */\n\tasync getMetadataStatus(\n\t\t{ blobId }: GetBlobMetadataRequestInput,\n\t\toptions: RequestOptions,\n\t): Promise<StoredOnNodeStatus> {\n\t\tconst response = await this.#request(`/v1/blobs/${blobId}/metadata/status`, options);\n\n\t\tconst json: StoredOnNodeStatusResponse = await response.json();\n\t\treturn json.success.data;\n\t}\n\n\tasync #request(path: string, options: RequestOptions) {\n\t\tconst { nodeUrl, signal, timeout, ...init } = options;\n\n\t\tif (signal?.aborted) {\n\t\t\tthrow new UserAbortError();\n\t\t}\n\n\t\tconst timeoutSignal = AbortSignal.timeout(timeout ?? this.#timeout);\n\n\t\tlet response: Response | undefined;\n\n\t\ttry {\n\t\t\tconst fetch = this.#fetch;\n\t\t\tresponse = await fetch(`${nodeUrl}${path}`, {\n\t\t\t\t...init,\n\t\t\t\tsignal: signal ? AbortSignal.any([timeoutSignal, signal]) : timeoutSignal,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (signal?.aborted) {\n\t\t\t\tthrow new UserAbortError();\n\t\t\t}\n\n\t\t\tif (error instanceof Error && error.name === 'AbortError') {\n\t\t\t\tconst error = new ConnectionTimeoutError();\n\t\t\t\tthis.#onError?.(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthis.#onError?.(error as Error);\n\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tconst errorText = await response.text().catch((reason) => reason);\n\t\t\tconst errorJSON = safeParseJSON(errorText);\n\t\t\tconst errorMessage = errorJSON ? undefined : errorText;\n\t\t\tconst error = StorageNodeAPIError.generate(response.status, errorJSON, errorMessage);\n\t\t\tthis.#onError?.(error);\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn response;\n\t}\n}\n\nfunction safeParseJSON(value: string) {\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"],"mappings":";;;;;AA6DA,IAAa,oBAAb,MAA+B;CAC9B;CACA;CACA;CACA,YAAY,EAAE,OAAO,iBAAiB,SAAS,YAAsC,EAAE,EAAE;AACxF,QAAKA,QAAS,mBAAmB,WAAW;AAC5C,QAAKC,UAAW,WAAW;AAC3B,QAAKC,UAAW;;;;;CAMjB,MAAM,gBACL,EAAE,UACF,SACmC;EAMnC,MAAM,WAAW,OALA,MAAM,MAAKC,QAAS,aAAa,OAAO,YAAY;GACpE,GAAG;GACH,SAAS,aAAa,EAAE,QAAQ,4BAA4B,EAAE,QAAQ,QAAQ;GAC9E,CAAC,EAE8B,aAAa;AAC7C,SAAO,mBAAmB,MAAM,IAAI,WAAW,SAAS,CAAC;;;;;CAM1D,MAAM,cACL,EAAE,UACF,SACiC;EAIjC,MAAM,cADiC,OAFtB,MAAM,MAAKA,QAAS,aAAa,OAAO,UAAU,QAAQ,EAErB,MAAM,EACpC,QAAQ;AAEhC,MAAI,eAAe,cAClB,QAAO,EAAE,MAAM,eAAe;AAG/B,MAAI,aAAa,WAChB,QAAO;GACN,MAAM;GACN,GAAG,WAAW;GACd;AAGF,MAAI,eAAe,WAClB,QAAO;GACN,MAAM;GACN,GAAG,WAAW;GACd;AAGF,MAAI,eAAe,WAClB,QAAO;GACN,MAAM;GACN,GAAG,WAAW;GACd;AAGF,QAAM,IAAI,iBAAiB,iCAAiC,aAAa;;;;;;;;;;;CAY1E,MAAM,kBACL,EAAE,QAAQ,YACV,SACqC;EAErC,MAAM,OADa,OAAO,aAAa,YAAY,QAAQ,WACjC,aAAa,UAAU,SAAS,CAAC,SAAS,GAAG;AAUvE,SADwC,OAPvB,MAAM,MAAKA,QAAS,aAAa,OAAO,YAAY;GACpE,GAAG;GACH,QAAQ;GACF;GACN,SAAS,aAAa,EAAE,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AClD,QAAQ;;CAGrB,OAAMA,QAAS,MAAc,SAAyB;EACrD,MAAM,EAAE,SAAS,QAAQ,SAAS,GAAG,SAAS;AAE9C,MAAI,QAAQ,QACX,OAAM,IAAI,gBAAgB;EAG3B,MAAM,gBAAgB,YAAY,QAAQ,WAAW,MAAKF,QAAS;EAEnE,IAAI;AAEJ,MAAI;GACH,MAAM,QAAQ,MAAKD;AACnB,cAAW,MAAM,MAAM,GAAG,UAAU,QAAQ;IAC3C,GAAG;IACH,QAAQ,SAAS,YAAY,IAAI,CAAC,eAAe,OAAO,CAAC,GAAG;IAC5D,CAAC;WACM,OAAO;AACf,OAAI,QAAQ,QACX,OAAM,IAAI,gBAAgB;AAG3B,OAAI,iBAAiB,SAAS,MAAM,SAAS,cAAc;IAC1D,MAAMI,UAAQ,IAAI,wBAAwB;AAC1C,UAAKF,UAAWE,QAAM;AACtB,UAAMA;;AAGP,SAAKF,UAAW,MAAe;AAE/B,SAAM;;AAGP,MAAI,CAAC,SAAS,IAAI;GACjB,MAAM,YAAY,MAAM,SAAS,MAAM,CAAC,OAAO,WAAW,OAAO;GACjE,MAAM,YAAY,cAAc,UAAU;GAC1C,MAAM,eAAe,YAAY,SAAY;GAC7C,MAAM,QAAQ,oBAAoB,SAAS,SAAS,QAAQ,WAAW,aAAa;AACpF,SAAKA,UAAW,MAAM;AACtB,SAAM;;AAGP,SAAO;;;AAIT,SAAS,cAAc,OAAe;AACrC,KAAI;AACH,SAAO,KAAK,MAAM,MAAM;SACjB;AACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.mts","names":[],"sources":["../../src/storage-node/error.ts"],"
|
|
1
|
+
{"version":3,"file":"error.d.mts","names":[],"sources":["../../src/storage-node/error.ts"],"mappings":";cAGa,gBAAA,SAAyB,KAAA;AAAA,cAEzB,mBAAA,0HAGH,gBAAA;EAAA;EAL4B;EAAA,SAO5B,MAAA,EAAQ,OAAA;EALL;EAAA,SAQH,KAAA,EAAO,MAAA;cAEJ,MAAA,EAAQ,OAAA,EAAS,KAAA,EAAO,MAAA,EAAQ,OAAA;EAAA,OAwBrC,QAAA,CACN,MAAA,sBACA,aAAA,sBACA,OAAA,uBACE,mBAAA;AAAA;AAAA,cA6CS,cAAA,SAAuB,mBAAA;;IACrB;EAAA;IAAa,OAAA;EAAA;AAAA;AAAA,cAKf,eAAA,SAAwB,mBAAA;;IACtB;EAAA;IAAa,OAAA;EAAA;AAAA;AAAA,cAKf,sBAAA,SAA+B,mBAAA;;IAC7B;EAAA;IAAa,OAAA;EAAA;AAAA;AAAA,cAKf,eAAA,SAAwB,mBAAA;EAAA,OAC7B,QAAA,CACN,MAAA,OACA,aAAA,sBACA,OAAA,uBACE,mBAAA;AAAA;AAAA,cAkBS,sBAAA,SAA+B,mBAAA;cAC/B,KAAA,sBAA2B,OAAA;AAAA;AAAA,cAK3B,mBAAA,SAA4B,mBAAA;AAAA,cAE5B,qBAAA,SAA8B,mBAAA;AAAA,cAE9B,aAAA,SAAsB,mBAAA;AAAA,cAEtB,aAAA,SAAsB,mBAAA;AAAA,cAEtB,wBAAA,SAAiC,mBAAA;AAAA,cAEjC,cAAA,SAAuB,mBAAA;AAAA,cAEvB,uBAAA,SAAgC,mBAAA;AAAA,cAEhC,mBAAA,SAA4B,mBAAA"}
|
|
@@ -68,6 +68,7 @@ type StoreSliverResponse = {
|
|
|
68
68
|
data: string;
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
|
+
type StoredOnNodeStatus = 'Nonexistent' | 'Buffered' | 'Stored';
|
|
71
72
|
//#endregion
|
|
72
|
-
export { BlobStatus, GetSliverResponse, StorageConfirmation, StoreBlobMetadataRequestInput, StoreBlobMetadataResponse, StoreSliverRequestInput, StoreSliverResponse, Uploadable };
|
|
73
|
+
export { BlobStatus, GetSliverResponse, StorageConfirmation, StoreBlobMetadataRequestInput, StoreBlobMetadataResponse, StoreSliverRequestInput, StoreSliverResponse, StoredOnNodeStatus, Uploadable };
|
|
73
74
|
//# sourceMappingURL=types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/storage-node/types.ts"],"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/storage-node/types.ts"],"mappings":";;;KAOY,UAAA;AAAA,KAEA,UAAA,UAAoB,UAAA,CAAW,UAAA;AAAA,KAE/B,UAAA,GAAa,UAAA,GAAa,WAAA,GAAc,cAAA,GAAiB,IAAA;AAAA,KAEzD,mBAAA;EACX,iBAAA;EACA,SAAA;AAAA;AAAA,KASW,UAAA;EACP,IAAA;AAAA;EACC,IAAA;AAAA,IAAoB,iBAAA;EACpB,IAAA;AAAA,IAAsB,mBAAA;EACtB,IAAA;AAAA,IAAsB,mBAAA;AAAA,KAehB,iBAAA;EACX,OAAA;IACC,KAAA,EAAO,WAAA;EAAA;AAAA;AAAA,KAIG,mBAAA;EACX,SAAA;IACC,eAAA,EAAiB,eAAA;IACjB,QAAA;IACA,WAAA;IACA,WAAA,EAAa,WAAA;IACb,qBAAA;EAAA;AAAA;AAAA,KAIU,mBAAA;EACX,SAAA;IACC,eAAA,EAAiB,eAAA;IACjB,qBAAA;EAAA;AAAA;AAAA,KAIU,eAAA;EACX,qBAAA;EACA,yBAAA;AAAA;AAAA,KAGW,WAAA;EACX,QAAA;EACA,QAAA;AAAA;AAAA,KASW,6BAAA;EACX,MAAA;EACA,QAAA,EAAU,UAAA,UAAoB,YAAA,CAAa,WAAA;AAAA;AAAA,KAGhC,yBAAA;EACX,OAAA;IACC,IAAA;IACA,IAAA;EAAA;AAAA;AAAA,KASU,iBAAA,GAAoB,UAAA;AAAA,KAEpB,uBAAA;EACX,MAAA;EACA,MAAA,EAAQ,UAAA,UAAoB,UAAA,CAAW,WAAA;EACvC,UAAA,EAAY,UAAA;EACZ,eAAA;AAAA;AAAA,KAEW,mBAAA;EACX,OAAA;IACC,IAAA;IACA,IAAA;EAAA;AAAA;AAAA,KA+BU,kBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/storage-node/utils.ts"],"
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../../src/storage-node/utils.ts"],"mappings":";KAGY,WAAA,GAAc,MAAA,0CAAgD,WAAA;AAAA,iBAE1D,YAAA,CAAA,GAAgB,OAAA,GAAU,WAAA,kBAA6B,OAAA"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
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";
|
|
11
11
|
|
|
12
12
|
//#region src/types.d.ts
|
|
13
|
-
|
|
14
13
|
/**
|
|
15
14
|
* Configuration for the Walrus package on sui
|
|
16
15
|
*
|
|
@@ -108,7 +107,9 @@ type CertifyBlobOptions = {
|
|
|
108
107
|
confirmations: (StorageConfirmation | null)[];
|
|
109
108
|
certificate?: never;
|
|
110
109
|
} | {
|
|
111
|
-
certificate
|
|
110
|
+
/** A certificate from the upload relay or combined confirmations.
|
|
111
|
+
* Accepts either a ProtocolMessageCertificate object or a BCS-encoded base64 string. */
|
|
112
|
+
certificate: ProtocolMessageCertificate | string;
|
|
112
113
|
confirmations?: never;
|
|
113
114
|
});
|
|
114
115
|
type DeletableConfirmationOptions = {
|
|
@@ -135,7 +136,8 @@ interface GetSecondarySliverOptions extends WalrusClientRequestOptions {
|
|
|
135
136
|
type GetVerifiedBlobStatusOptions = ReadBlobOptions;
|
|
136
137
|
type ComputeBlobMetadataOptions = {
|
|
137
138
|
bytes: Uint8Array;
|
|
138
|
-
numShards?: number;
|
|
139
|
+
numShards?: number; /** Provide a nonce from a prior encode to ensure deterministic resume. If omitted, a random nonce is generated. */
|
|
140
|
+
nonce?: Uint8Array;
|
|
139
141
|
};
|
|
140
142
|
interface SliversForNode {
|
|
141
143
|
primary: {
|
|
@@ -181,17 +183,21 @@ type WriteBlobToUploadRelayOptions = {
|
|
|
181
183
|
deletable: boolean;
|
|
182
184
|
encodingType?: EncodingType;
|
|
183
185
|
} & WalrusClientRequestOptions;
|
|
184
|
-
|
|
185
|
-
blob: Uint8Array;
|
|
186
|
+
interface WriteBlobBaseOptions {
|
|
186
187
|
deletable: boolean;
|
|
187
188
|
/** The number of epochs the blob should be stored for. */
|
|
188
189
|
epochs: number;
|
|
189
|
-
signer
|
|
190
|
-
/** Where the blob should be transferred to after it is registered. Defaults to the signer address. */
|
|
190
|
+
/** Where the blob should be transferred to after it is registered. Defaults to the signer address. */
|
|
191
191
|
owner?: string;
|
|
192
192
|
/** The attributes to write for the blob. */
|
|
193
193
|
attributes?: Record<string, string | null>;
|
|
194
|
-
}
|
|
194
|
+
}
|
|
195
|
+
interface WriteBlobOptions extends WriteBlobBaseOptions, WalrusClientRequestOptions {
|
|
196
|
+
blob: Uint8Array;
|
|
197
|
+
signer: Signer;
|
|
198
|
+
onStep?: (step: WriteBlobStep) => void | Promise<void>;
|
|
199
|
+
resume?: WriteBlobStep;
|
|
200
|
+
}
|
|
195
201
|
interface WriteQuiltOptions extends Omit<WriteBlobOptions, 'blob'> {
|
|
196
202
|
blobs: {
|
|
197
203
|
contents: Uint8Array;
|
|
@@ -202,59 +208,105 @@ interface WriteQuiltOptions extends Omit<WriteBlobOptions, 'blob'> {
|
|
|
202
208
|
interface WriteFilesOptions extends Omit<WriteBlobOptions, 'blob'> {
|
|
203
209
|
files: WalrusFile[];
|
|
204
210
|
}
|
|
211
|
+
type WriteBlobStep = WriteBlobStepEncoded | WriteBlobStepRegistered | WriteBlobStepUploaded | WriteBlobStepCertified;
|
|
212
|
+
interface WriteBlobStepEncoded {
|
|
213
|
+
step: 'encoded';
|
|
214
|
+
blobId: string;
|
|
215
|
+
rootHash: string;
|
|
216
|
+
unencodedSize: number;
|
|
217
|
+
nonce?: string;
|
|
218
|
+
}
|
|
219
|
+
interface WriteBlobStepRegistered {
|
|
220
|
+
step: 'registered';
|
|
221
|
+
blobId: string;
|
|
222
|
+
blobObjectId: string;
|
|
223
|
+
txDigest: string;
|
|
224
|
+
nonce?: string;
|
|
225
|
+
}
|
|
226
|
+
interface WriteBlobStepUploaded {
|
|
227
|
+
step: 'uploaded';
|
|
228
|
+
blobId: string;
|
|
229
|
+
blobObjectId: string;
|
|
230
|
+
txDigest?: string;
|
|
231
|
+
certificate: string;
|
|
232
|
+
}
|
|
233
|
+
interface WriteBlobStepCertified {
|
|
234
|
+
step: 'certified';
|
|
235
|
+
blobId: string;
|
|
236
|
+
blobObjectId: string;
|
|
237
|
+
blobObject: (typeof Blob)['$inferType'];
|
|
238
|
+
}
|
|
205
239
|
interface WriteFilesFlowOptions {
|
|
206
240
|
files: WalrusFile[];
|
|
241
|
+
resume?: WriteBlobStep;
|
|
207
242
|
}
|
|
208
|
-
interface WriteFilesFlowRegisterOptions extends
|
|
243
|
+
interface WriteFilesFlowRegisterOptions extends WriteBlobBaseOptions {
|
|
209
244
|
owner: string;
|
|
210
245
|
}
|
|
211
246
|
interface WriteFilesFlowUploadOptions {
|
|
212
|
-
digest
|
|
247
|
+
digest?: string;
|
|
248
|
+
}
|
|
249
|
+
interface WriteFilesFlowRunOptions extends WriteBlobBaseOptions, WalrusClientRequestOptions {
|
|
250
|
+
signer: Signer;
|
|
213
251
|
}
|
|
214
252
|
interface WriteFilesFlow {
|
|
215
|
-
encode: () => Promise<
|
|
253
|
+
encode: () => Promise<WriteBlobStepEncoded>;
|
|
216
254
|
register: (options: WriteFilesFlowRegisterOptions) => Transaction;
|
|
217
|
-
upload: (options
|
|
255
|
+
upload: (options?: WriteFilesFlowUploadOptions) => Promise<WriteBlobStepUploaded>;
|
|
218
256
|
certify: () => Transaction;
|
|
219
257
|
listFiles: () => Promise<{
|
|
220
258
|
id: string;
|
|
221
259
|
blobId: string;
|
|
222
260
|
blobObject: (typeof Blob)['$inferType'];
|
|
223
261
|
}[]>;
|
|
262
|
+
executeRegister: (options: WriteFilesFlowRegisterOptions & {
|
|
263
|
+
signer: Signer;
|
|
264
|
+
}) => Promise<WriteBlobStepRegistered>;
|
|
265
|
+
executeCertify: (options: {
|
|
266
|
+
signer: Signer;
|
|
267
|
+
}) => Promise<WriteBlobStepCertified>;
|
|
268
|
+
run: (options: WriteFilesFlowRunOptions) => AsyncIterable<WriteBlobStep>;
|
|
224
269
|
}
|
|
225
270
|
interface WriteBlobFlowOptions {
|
|
226
271
|
blob: Uint8Array;
|
|
272
|
+
resume?: WriteBlobStep;
|
|
227
273
|
}
|
|
228
|
-
interface WriteBlobFlowRegisterOptions extends
|
|
274
|
+
interface WriteBlobFlowRegisterOptions extends WriteBlobBaseOptions {
|
|
229
275
|
owner: string;
|
|
230
276
|
}
|
|
231
|
-
interface WriteBlobFlowUploadOptions {
|
|
232
|
-
digest
|
|
277
|
+
interface WriteBlobFlowUploadOptions extends WalrusClientRequestOptions {
|
|
278
|
+
digest?: string;
|
|
279
|
+
/** Override the deletable flag when resuming without a prior register step. */
|
|
280
|
+
deletable?: boolean;
|
|
281
|
+
}
|
|
282
|
+
interface WriteBlobFlowRunOptions extends WriteBlobBaseOptions, WalrusClientRequestOptions {
|
|
283
|
+
signer: Signer;
|
|
233
284
|
}
|
|
234
285
|
interface WriteBlobFlow {
|
|
235
|
-
encode: () => Promise<
|
|
286
|
+
encode: () => Promise<WriteBlobStepEncoded>;
|
|
236
287
|
register: (options: WriteBlobFlowRegisterOptions) => Transaction;
|
|
237
|
-
upload: (options
|
|
288
|
+
upload: (options?: WriteBlobFlowUploadOptions) => Promise<WriteBlobStepUploaded>;
|
|
238
289
|
certify: () => Transaction;
|
|
239
|
-
getBlob: () => Promise<
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}>;
|
|
290
|
+
getBlob: () => Promise<WriteBlobStepCertified>;
|
|
291
|
+
executeRegister: (options: WriteBlobFlowRegisterOptions & {
|
|
292
|
+
signer: Signer;
|
|
293
|
+
}) => Promise<WriteBlobStepRegistered>;
|
|
294
|
+
executeCertify: (options: {
|
|
295
|
+
signer: Signer;
|
|
296
|
+
}) => Promise<WriteBlobStepCertified>;
|
|
297
|
+
run: (options: WriteBlobFlowRunOptions) => AsyncIterable<WriteBlobStep>;
|
|
243
298
|
}
|
|
244
299
|
interface DeleteBlobOptions {
|
|
245
300
|
blobObjectId: string;
|
|
246
301
|
}
|
|
247
302
|
type ExtendBlobOptions = {
|
|
248
|
-
blobObjectId: string;
|
|
249
|
-
/** optionally specify a WAL coin pay for the registration. This will consume WAL from the signer by default. */
|
|
303
|
+
blobObjectId: string; /** optionally specify a WAL coin pay for the registration. This will consume WAL from the signer by default. */
|
|
250
304
|
walCoin?: TransactionObjectArgument;
|
|
251
305
|
} & ({
|
|
252
|
-
/** The number of epochs the blob should be stored for. */
|
|
253
|
-
epochs: number;
|
|
306
|
+
/** The number of epochs the blob should be stored for. */epochs: number;
|
|
254
307
|
endEpoch?: never;
|
|
255
308
|
} | {
|
|
256
|
-
/** The new end epoch for the storage period of the blob. */
|
|
257
|
-
endEpoch: number;
|
|
309
|
+
/** The new end epoch for the storage period of the blob. */endEpoch: number;
|
|
258
310
|
epochs?: never;
|
|
259
311
|
});
|
|
260
312
|
type WriteBlobAttributesOptions = {
|
|
@@ -273,5 +325,5 @@ interface ProtocolMessageCertificate {
|
|
|
273
325
|
signature: Uint8Array;
|
|
274
326
|
}
|
|
275
327
|
//#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 };
|
|
328
|
+
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
329
|
//# sourceMappingURL=types.d.mts.map
|
package/dist/types.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;;;AAyBA;;;UAAiB,mBAAA;EAEhB;EAAA,cAAA;EAGA;EADA,aAAA;EACA,WAAA;AAAA;AAAA,KAGI,4BAAA;EAEF,OAAA;EACA,aAAA,GAAgB,mBAAA;AAAA;EAGhB,OAAA;EACA,aAAA,EAAe,mBAAA;AAAA;AAAA,KAGN,WAAA;EAET,KAAA;AAAA;EAGA,MAAA;IACC,IAAA;IACA,aAAA;EAAA;AAAA;AAAA,KAIQ,oBAAA;EACX,OAAA;EACA,GAAA;EACA,IAAA,EAAM,WAAA;AAAA;AAAA,UAGU,iBAAA,SAA0B,wBAAA;EAC1C,OAAA,UAEG,oBAAA;IAEA,GAAA;EAAA;AAAA;AAAA,UAIM,sBAAA;EACT,wBAAA,GAA2B,wBAAA;EAC3B,OAAA;EACA,WAAA,GAAc,iBAAA;AAAA;;AAZf;;;;KAoBY,kBAAA,GAAqB,sBAAA,GAChC,4BAAA;EACC,SAAA,EAAW,iBAAA;AAAA;AAAA,KAGD,aAAA,oBAAiC,sBAAA;EAC5C,aAAA,GAAgB,mBAAA;EAChB,IAAA,GAAO,IAAA;AAAA;AAAA,K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|
|
|
1
|
-
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/upload-relay/client.ts"],"
|
|
1
|
+
{"version":3,"file":"client.d.mts","names":[],"sources":["../../src/upload-relay/client.ts"],"mappings":";;;KAcY,KAAA,IAAS,GAAA,EAAK,WAAA,EAAa,IAAA,GAAO,WAAA,KAAgB,OAAA,CAAQ,QAAA;AAAA,KAE1D,wBAAA;EACX,IAAA;;;;;;;;EAQA,KAAA,GAAQ,KAAA;EAXY;;;;EAiBpB,OAAA;EAjB6E;;AAE9E;EAoBC,OAAA,IAAW,KAAA,EAAO,KAAA;AAAA"}
|
package/dist/utils/bcs.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import * as _mysten_sui_bcs0 from "@mysten/sui/bcs";
|
|
|
3
3
|
import { BcsType } from "@mysten/sui/bcs";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/bcs.d.ts
|
|
6
|
-
|
|
7
6
|
declare const BlobMetadata: _mysten_sui_bcs0.BcsEnum<{
|
|
8
7
|
V1: _mysten_sui_bcs0.BcsStruct<{
|
|
9
8
|
encoding_type: BcsType<_mysten_bcs5.EnumOutputShapeWithKeys<{
|
|
@@ -45,7 +44,7 @@ declare const QuiltPatchV1: _mysten_sui_bcs0.BcsStruct<{
|
|
|
45
44
|
identifier: BcsType<string, string, "string">;
|
|
46
45
|
tags: BcsType<{
|
|
47
46
|
[k: string]: string;
|
|
48
|
-
},
|
|
47
|
+
}, Map<string, string> | Record<string, string>, "Map<string, string>">;
|
|
49
48
|
}, string>;
|
|
50
49
|
//#endregion
|
|
51
50
|
export { BlobMetadata, QuiltPatchV1, blobIdFromInt, blobIdToInt };
|
package/dist/utils/bcs.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bcs.d.mts","names":[],"sources":["../../src/utils/bcs.ts"],"
|
|
1
|
+
{"version":3,"file":"bcs.d.mts","names":[],"sources":["../../src/utils/bcs.ts"],"mappings":";;;;;cAyCa,YAAA,mBAAY,OAAA;;2BAEvB,YAAA,CAAA,uBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOc,aAAA,CAAc,MAAA;AAAA,iBAcd,WAAA,CAAY,MAAA;AAAA,cA4Ff,YAAA,mBAAY,SAAA"}
|
package/dist/utils/bcs.mjs
CHANGED
|
@@ -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
|
package/dist/utils/bcs.mjs.map
CHANGED
|
@@ -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,QAA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ACtE,SAAS,IAAI,IAAI;CACjB,QAAQ,IAAI,KAAK;CACjB,MAAM,IAAI,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":";;;A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,YAAY,KAAK;CAC/D,CAAC;AAEF,MAAa,eAAe,IAAI,OAAO,gBAAgB;CACtD,UAAU,IAAI,KAAK;CACnB,YAAY,IAAI,QAAQ;CACxB,MAAM;CACN,CAAC;AAEF,MAAa,eAAe,IAAI,OAAO,gBAAgB,EACtD,SAAS,IAAI,OAAO,aAAa,EACjC,CAAC;AAEF,MAAa,eAAe,IAAI,OAAO,gBAAgB;CACtD,SAAS;CACT,SAAS,IAAI,OAAO,wBAAwB;EAC3C,SAAS,IAAI,IAAI;EACjB,YAAY,IAAI,KAAK;EACrB,UAAU,IAAI,KAAK;EACnB,CAAC;CACF,CAAC;AAEF,MAAa,uBAAuB,IAAI,OAAO,wBAAwB;CACtE,SAAS,IAAI,IAAI;CACjB,QAAQ,IAAI,KAAK;CACjB,MAAM,IAAI,IAAI;CACd,CAAC;AAEF,MAAa,iBAAiB,IAAI,OAAO,eAAe;CACvD,SAAS,IAAI,OAAO,IAAI,KAAK,CAAC;CAC9B,mBAAmB,IAAI,YAAY;CACnC,WAAW,IAAI,YAAY;CAC3B,CAAC;AAEF,SAAgB,2BAA2B,QAAgB;CAC1D,MAAM,OAAO,eAAe,WAAW,OAAO;AAC9C,QAAO;EACN,SAAS,KAAK;EACd,mBAAmB,IAAI,WAAW,KAAK,kBAAkB;EACzD,WAAW,IAAI,WAAW,KAAK,UAAU;EACzC"}
|
package/dist/utils/quilts.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quilts.d.mts","names":[],"sources":["../../src/utils/quilts.ts"],"
|
|
1
|
+
{"version":3,"file":"quilts.d.mts","names":[],"sources":["../../src/utils/quilts.ts"],"mappings":";;;;UA8HiB,kBAAA;EAChB,KAAA;IACC,QAAA,EAAU,UAAA;IACV,UAAA;IACA,IAAA,GAAO,MAAA;EAAA;EAER,SAAA;EACA,YAAA,GAAe,YAAA;AAAA;AAAA,iBAGA,WAAA,CAAA;EAAc,KAAA;EAAO,SAAA;EAAW;AAAA,GAAgB,kBAAA;;;qBASvC,YAAA,CAAa,WAAA;MAAgB,UAAA;IAAA;EAAA;AAAA"}
|