@arcadiasystems/morse-sdk 0.3.0 → 0.4.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/dist/codecs.d.ts +3 -7
  3. package/dist/codecs.d.ts.map +1 -1
  4. package/dist/codecs.js +3 -11
  5. package/dist/codecs.js.map +1 -1
  6. package/dist/config.d.ts +9 -9
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +13 -10
  9. package/dist/config.js.map +1 -1
  10. package/dist/errors.d.ts +2 -2
  11. package/dist/errors.d.ts.map +1 -1
  12. package/dist/errors.format.js +1 -2
  13. package/dist/errors.format.js.map +1 -1
  14. package/dist/errors.js +29 -27
  15. package/dist/errors.js.map +1 -1
  16. package/dist/index.d.ts +5 -5
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +4 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/ops/index.d.ts +2 -3
  21. package/dist/ops/index.d.ts.map +1 -1
  22. package/dist/ops/index.js +2 -3
  23. package/dist/ops/index.js.map +1 -1
  24. package/dist/ops/recipient-file-from-bytes.d.ts +123 -0
  25. package/dist/ops/recipient-file-from-bytes.d.ts.map +1 -0
  26. package/dist/ops/recipient-file-from-bytes.js +142 -0
  27. package/dist/ops/recipient-file-from-bytes.js.map +1 -0
  28. package/dist/ops/recipient-file.d.ts +114 -0
  29. package/dist/ops/recipient-file.d.ts.map +1 -0
  30. package/dist/ops/recipient-file.js +151 -0
  31. package/dist/ops/recipient-file.js.map +1 -0
  32. package/dist/ptb/recipient-file.d.ts +82 -0
  33. package/dist/ptb/recipient-file.d.ts.map +1 -0
  34. package/dist/ptb/recipient-file.js +148 -0
  35. package/dist/ptb/recipient-file.js.map +1 -0
  36. package/dist/read/index.d.ts +2 -2
  37. package/dist/read/index.d.ts.map +1 -1
  38. package/dist/read/index.js +2 -2
  39. package/dist/read/index.js.map +1 -1
  40. package/dist/read/recipient-file-events.d.ts +65 -0
  41. package/dist/read/recipient-file-events.d.ts.map +1 -0
  42. package/dist/read/recipient-file-events.js +172 -0
  43. package/dist/read/recipient-file-events.js.map +1 -0
  44. package/dist/read/recipient-files-reader.d.ts +27 -0
  45. package/dist/read/recipient-files-reader.d.ts.map +1 -0
  46. package/dist/read/recipient-files-reader.js +170 -0
  47. package/dist/read/recipient-files-reader.js.map +1 -0
  48. package/dist/seal/adapter.d.ts +20 -19
  49. package/dist/seal/adapter.d.ts.map +1 -1
  50. package/dist/seal/adapter.js +9 -3
  51. package/dist/seal/adapter.js.map +1 -1
  52. package/dist/seal/default-adapter.d.ts +5 -5
  53. package/dist/seal/default-adapter.d.ts.map +1 -1
  54. package/dist/seal/default-adapter.js +13 -22
  55. package/dist/seal/default-adapter.js.map +1 -1
  56. package/dist/seal/index.d.ts +2 -2
  57. package/dist/seal/index.d.ts.map +1 -1
  58. package/dist/seal/index.js +1 -1
  59. package/dist/seal/index.js.map +1 -1
  60. package/dist/seal/recipient-file-identity.d.ts +53 -0
  61. package/dist/seal/recipient-file-identity.d.ts.map +1 -0
  62. package/dist/seal/recipient-file-identity.js +87 -0
  63. package/dist/seal/recipient-file-identity.js.map +1 -0
  64. package/dist/types.d.ts +43 -59
  65. package/dist/types.d.ts.map +1 -1
  66. package/dist/types.js +1 -1
  67. package/dist/types.js.map +1 -1
  68. package/dist/wallets/keypair-adapter.d.ts.map +1 -1
  69. package/dist/wallets/keypair-adapter.js +1 -2
  70. package/dist/wallets/keypair-adapter.js.map +1 -1
  71. package/package.json +1 -1
  72. package/dist/ops/allowlist.d.ts +0 -79
  73. package/dist/ops/allowlist.d.ts.map +0 -1
  74. package/dist/ops/allowlist.js +0 -122
  75. package/dist/ops/allowlist.js.map +0 -1
  76. package/dist/ops/file-from-bytes.d.ts +0 -84
  77. package/dist/ops/file-from-bytes.d.ts.map +0 -1
  78. package/dist/ops/file-from-bytes.js +0 -133
  79. package/dist/ops/file-from-bytes.js.map +0 -1
  80. package/dist/ops/file.d.ts +0 -88
  81. package/dist/ops/file.d.ts.map +0 -1
  82. package/dist/ops/file.js +0 -142
  83. package/dist/ops/file.js.map +0 -1
  84. package/dist/ptb/allowlist.d.ts +0 -65
  85. package/dist/ptb/allowlist.d.ts.map +0 -1
  86. package/dist/ptb/allowlist.js +0 -75
  87. package/dist/ptb/allowlist.js.map +0 -1
  88. package/dist/ptb/file.d.ts +0 -58
  89. package/dist/ptb/file.d.ts.map +0 -1
  90. package/dist/ptb/file.js +0 -108
  91. package/dist/ptb/file.js.map +0 -1
  92. package/dist/read/files-events.d.ts +0 -87
  93. package/dist/read/files-events.d.ts.map +0 -1
  94. package/dist/read/files-events.js +0 -194
  95. package/dist/read/files-events.js.map +0 -1
  96. package/dist/read/files-reader.d.ts +0 -59
  97. package/dist/read/files-reader.d.ts.map +0 -1
  98. package/dist/read/files-reader.js +0 -247
  99. package/dist/read/files-reader.js.map +0 -1
  100. package/dist/seal/allowlist-identity.d.ts +0 -36
  101. package/dist/seal/allowlist-identity.d.ts.map +0 -1
  102. package/dist/seal/allowlist-identity.js +0 -81
  103. package/dist/seal/allowlist-identity.js.map +0 -1
@@ -1,133 +0,0 @@
1
- /**
2
- * High-level "upload + register" flows for the file module. Combines Walrus
3
- * upload with on-chain metadata registration in a single PTB so the user
4
- * sees one signing popup for the storage step plus one for the on-chain
5
- * write (rather than three separate popups).
6
- *
7
- * Mirrors `entry-from-bytes.ts`'s shape but targets `file::new_encrypted_file`
8
- * / `file::new_public_file` instead of `add_entry_to_collection`.
9
- */
10
- import { toEncryptedFileId } from "../codecs.js";
11
- import { TransportError, UncertifiedBlobError } from "../errors.js";
12
- import { buildNewEncryptedFile, buildNewPublicFile, buildShareFile, } from "../ptb/file.js";
13
- import { isWalrusFlowCapable } from "../walrus/adapter.js";
14
- import { findCreatedId } from "./internal.js";
15
- /**
16
- * Encrypt `plaintext` via Seal under the allowlist's identity, upload the
17
- * ciphertext to Walrus, and register an `EncryptedFile` metadata record in
18
- * one combined transaction. Two wallet popups: register_blob, then
19
- * certify_blob + new_encrypted_file + share_file.
20
- *
21
- * The caller supplies `sealId` rather than having the flow construct it,
22
- * so the decryption side can use the same identity bytes without an
23
- * implicit shared-secret round-trip. Build via:
24
- *
25
- * const nonce = crypto.getRandomValues(new Uint8Array(16));
26
- * const sealId = buildAllowlistSealId(allowlistId, nonce);
27
- *
28
- * Reuse the same nonce-derived sealId when decrypting (consumers can
29
- * recover it by reading the encrypted ciphertext header — Seal stores the
30
- * identity in the ciphertext envelope).
31
- *
32
- * @throws {SealError} If encryption fails (no popup yet).
33
- * @throws {UncertifiedBlobError} If the combined popup fails after upload
34
- * succeeded. The blob is on Walrus but uncertified; retry the full flow.
35
- * @throws {ContractAbortError} On Move abort during simulation.
36
- * @throws {TransportError} On RPC, network, or pre-upload failure.
37
- */
38
- export async function uploadEncryptedFileFromBytes(adapter, config, args) {
39
- assertFlowCapable(args.walrus);
40
- args.onProgress?.({ phase: "encrypting" });
41
- const { ciphertext } = await args.seal.encrypt(args.plaintext, {
42
- sealId: args.sealId,
43
- });
44
- args.onProgress?.({ phase: "uploading" });
45
- const upload = await args.walrus.startBlobUpload(ciphertext, args.upload);
46
- try {
47
- const tx = upload.certifyTransaction;
48
- const created = buildNewEncryptedFile(tx, {
49
- packageId: config.packageId,
50
- blobId: upload.blobId,
51
- blobObjectId: upload.blobObjectId,
52
- name: args.name,
53
- contentType: args.contentType,
54
- size: BigInt(args.plaintext.length),
55
- allowlistId: args.allowlistId,
56
- });
57
- buildShareFile(tx, {
58
- packageId: config.packageId,
59
- file: created,
60
- });
61
- args.onProgress?.({ phase: "submitting" });
62
- const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
63
- // See ops/allowlist.ts: file::EncryptedFile was introduced in v2.
64
- const typePrefix = config.packageId;
65
- const fileId = toEncryptedFileId(findCreatedId(receipt, `${typePrefix}::file::EncryptedFile`));
66
- args.onProgress?.({ phase: "complete" });
67
- return {
68
- digest: receipt.digest,
69
- gasUsedMist: receipt.gasUsedMist,
70
- fileId,
71
- blobId: upload.blobId,
72
- blobObjectId: upload.blobObjectId,
73
- };
74
- }
75
- catch (cause) {
76
- if (cause instanceof UncertifiedBlobError)
77
- throw cause;
78
- throw new UncertifiedBlobError(upload.blobObjectId, upload.blobId, {
79
- cause,
80
- });
81
- }
82
- }
83
- /**
84
- * Upload `bytes` to Walrus unencrypted and register a public `EncryptedFile`
85
- * metadata record (`encrypted: false`, `allowlistId: null`) in one combined
86
- * transaction. Two wallet popups; no Seal involvement.
87
- */
88
- export async function uploadPublicFileFromBytes(adapter, config, args) {
89
- assertFlowCapable(args.walrus);
90
- args.onProgress?.({ phase: "uploading" });
91
- const upload = await args.walrus.startBlobUpload(args.bytes, args.upload);
92
- try {
93
- const tx = upload.certifyTransaction;
94
- const created = buildNewPublicFile(tx, {
95
- packageId: config.packageId,
96
- blobId: upload.blobId,
97
- blobObjectId: upload.blobObjectId,
98
- name: args.name,
99
- contentType: args.contentType,
100
- size: BigInt(args.bytes.length),
101
- });
102
- buildShareFile(tx, {
103
- packageId: config.packageId,
104
- file: created,
105
- });
106
- args.onProgress?.({ phase: "submitting" });
107
- const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
108
- // See ops/allowlist.ts: file::EncryptedFile was introduced in v2.
109
- const typePrefix = config.packageId;
110
- const fileId = toEncryptedFileId(findCreatedId(receipt, `${typePrefix}::file::EncryptedFile`));
111
- args.onProgress?.({ phase: "complete" });
112
- return {
113
- digest: receipt.digest,
114
- gasUsedMist: receipt.gasUsedMist,
115
- fileId,
116
- blobId: upload.blobId,
117
- blobObjectId: upload.blobObjectId,
118
- };
119
- }
120
- catch (cause) {
121
- if (cause instanceof UncertifiedBlobError)
122
- throw cause;
123
- throw new UncertifiedBlobError(upload.blobObjectId, upload.blobId, {
124
- cause,
125
- });
126
- }
127
- }
128
- function assertFlowCapable(walrus) {
129
- if (!isWalrusFlowCapable(walrus)) {
130
- throw new TransportError("uploadEncryptedFileFromBytes / uploadPublicFileFromBytes require a WalrusWriteAdapter that implements WalrusFlowCapable (i.e. exposes startBlobUpload). The default DefaultWalrusWriteAdapter does. Custom adapters that do not implement the capability should compose walrus.uploadBlob + create_*_file (3 popups) instead.", { operation: "sdk.uploadFileFromBytes" });
131
- }
132
- }
133
- //# sourceMappingURL=file-from-bytes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-from-bytes.js","sourceRoot":"","sources":["../../src/ops/file-from-bytes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACN,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,GACd,MAAM,gBAAgB,CAAC;AAexB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAoC9C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CACjD,OAAsB,EACtB,MAA0B,EAC1B,IAAsC;IAEtC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE/B,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;IAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE;QAC9D,MAAM,EAAE,IAAI,CAAC,MAAM;KACnB,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE1E,IAAI,CA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,CAC/B,aAAa,CAAC,OAAO,EAAE,GAAG,UAAU,uBAAuB,CAAC,CAC5D,CAAC;QAEF,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QACzC,OAAO;YACN,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,MAAM;YACN,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,YAAY,EAAE,MAAM,CAAC,YAAY;SACjC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,KAAK,YAAY,oBAAoB;YAAE,MAAM,KAAK,CAAC;QACvD,MAAM,IAAI,oBAAoB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;YAClE,KAAK;SACL,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB,CACzB,MAA0B;IAE1B,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,cAAc,CACvB,+TAA+T,EAC/T,EAAE,SAAS,EAAE,yBAAyB,EAAE,CACxC,CAAC;IACH,CAAC;AACF,CAAC"}
@@ -1,88 +0,0 @@
1
- /**
2
- * High-level file ops: build a PTB, sign and execute via the wallet adapter,
3
- * parse the receipt into a typed result.
4
- *
5
- * Encrypted-file creation here registers the metadata record assuming the
6
- * encrypted bytes are already on Walrus. The all-in-one upload+register
7
- * flow is `uploadEncryptedFileFromBytes` in `file-from-bytes.ts`.
8
- */
9
- import type { MorsePackageConfig } from "../config.js";
10
- import type { AllowlistId, BlobObjectId, EncryptedFileId, SuiAddress, WalrusBlobId } from "../types.js";
11
- import type { WalletAdapter } from "../wallets/adapter.js";
12
- export interface CreateEncryptedFileArgs {
13
- readonly allowlistId: AllowlistId;
14
- readonly blobId: WalrusBlobId;
15
- readonly blobObjectId?: BlobObjectId;
16
- readonly name: string;
17
- readonly contentType: string;
18
- readonly size: bigint;
19
- readonly signal?: AbortSignal;
20
- }
21
- export interface CreateFileResult {
22
- readonly digest: string;
23
- readonly gasUsedMist: bigint;
24
- readonly fileId: EncryptedFileId;
25
- }
26
- /**
27
- * Register on-chain metadata for an encrypted file already uploaded to Walrus.
28
- * The bytes at `blobId` MUST be Seal-encrypted under an identity built from
29
- * `allowlistId` (see `buildAllowlistSealId`); otherwise consumers will fail
30
- * to decrypt. The SDK does not verify this binding.
31
- *
32
- * @throws {ValidationError} If `name` or `contentType` is empty or exceeds length limits.
33
- * @throws {ContractAbortError} On Move abort (e.g. empty blob_id).
34
- * @throws {TransportError} On RPC, network, or response-parsing failure.
35
- */
36
- export declare function createEncryptedFile(adapter: WalletAdapter, config: MorsePackageConfig, args: CreateEncryptedFileArgs): Promise<CreateFileResult>;
37
- export interface CreatePublicFileArgs {
38
- readonly blobId: WalrusBlobId;
39
- readonly blobObjectId?: BlobObjectId;
40
- readonly name: string;
41
- readonly contentType: string;
42
- readonly size: bigint;
43
- readonly signal?: AbortSignal;
44
- }
45
- /**
46
- * Register on-chain metadata for an unencrypted file. The bytes at `blobId`
47
- * are publicly readable via the Walrus aggregator.
48
- */
49
- export declare function createPublicFile(adapter: WalletAdapter, config: MorsePackageConfig, args: CreatePublicFileArgs): Promise<CreateFileResult>;
50
- export interface UpdateFileMetadataArgs {
51
- readonly fileId: EncryptedFileId;
52
- readonly name: string;
53
- readonly contentType: string;
54
- readonly signal?: AbortSignal;
55
- }
56
- export interface FileOpResult {
57
- readonly digest: string;
58
- readonly gasUsedMist: bigint;
59
- }
60
- /**
61
- * Update the file's `name` and `content_type`. Other fields are immutable
62
- * post-creation; create a new file record to swap the blob or change the
63
- * allowlist. Owner only (sender must equal `file.owner` on-chain).
64
- */
65
- export declare function updateFileMetadata(adapter: WalletAdapter, config: MorsePackageConfig, args: UpdateFileMetadataArgs): Promise<FileOpResult>;
66
- export interface TransferFileOwnershipArgs {
67
- readonly fileId: EncryptedFileId;
68
- readonly newOwner: SuiAddress;
69
- readonly signal?: AbortSignal;
70
- }
71
- /**
72
- * Transfer the metadata-mutation right to a new address. Decryption access
73
- * is governed separately by the file's allowlist; the new owner must be
74
- * added to that allowlist (and the previous owner removed, if desired) by
75
- * the Cap holder. The two operations can be composed in one PTB by the
76
- * caller if both rights need to move together.
77
- */
78
- export declare function transferFileOwnership(adapter: WalletAdapter, config: MorsePackageConfig, args: TransferFileOwnershipArgs): Promise<FileOpResult>;
79
- export interface DeleteFileArgs {
80
- readonly fileId: EncryptedFileId;
81
- readonly signal?: AbortSignal;
82
- }
83
- /**
84
- * Delete the on-chain metadata record. Does NOT delete the Walrus blob;
85
- * that follows the Walrus lease lifecycle independently.
86
- */
87
- export declare function deleteFile(adapter: WalletAdapter, config: MorsePackageConfig, args: DeleteFileArgs): Promise<FileOpResult>;
88
- //# sourceMappingURL=file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/ops/file.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAUvD,OAAO,KAAK,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,UAAU,EACV,YAAY,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB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AAC,CAYvB;AAED,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAC1C,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,yBAAyB,GAC7B,OAAO,CAAC,YAAY,CAAC,CASvB;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC/B,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,cAAc,GAClB,OAAO,CAAC,YAAY,CAAC,CAQvB"}
package/dist/ops/file.js DELETED
@@ -1,142 +0,0 @@
1
- /**
2
- * High-level file ops: build a PTB, sign and execute via the wallet adapter,
3
- * parse the receipt into a typed result.
4
- *
5
- * Encrypted-file creation here registers the metadata record assuming the
6
- * encrypted bytes are already on Walrus. The all-in-one upload+register
7
- * flow is `uploadEncryptedFileFromBytes` in `file-from-bytes.ts`.
8
- */
9
- import { Transaction, } from "@mysten/sui/transactions";
10
- import { toEncryptedFileId } from "../codecs.js";
11
- import { ValidationError } from "../errors.js";
12
- import { buildDeleteFile, buildNewEncryptedFile, buildNewPublicFile, buildShareFile, buildTransferFileOwnership, buildUpdateFileMetadata, } from "../ptb/file.js";
13
- import { findCreatedId } from "./internal.js";
14
- const MAX_FILE_NAME_LENGTH = 256;
15
- const MAX_CONTENT_TYPE_LENGTH = 255;
16
- /**
17
- * Register on-chain metadata for an encrypted file already uploaded to Walrus.
18
- * The bytes at `blobId` MUST be Seal-encrypted under an identity built from
19
- * `allowlistId` (see `buildAllowlistSealId`); otherwise consumers will fail
20
- * to decrypt. The SDK does not verify this binding.
21
- *
22
- * @throws {ValidationError} If `name` or `contentType` is empty or exceeds length limits.
23
- * @throws {ContractAbortError} On Move abort (e.g. empty blob_id).
24
- * @throws {TransportError} On RPC, network, or response-parsing failure.
25
- */
26
- export async function createEncryptedFile(adapter, config, args) {
27
- validateFileFields(args.name, args.contentType);
28
- const tx = new Transaction();
29
- const created = buildNewEncryptedFile(tx, {
30
- packageId: config.packageId,
31
- blobId: args.blobId,
32
- ...(args.blobObjectId === undefined
33
- ? {}
34
- : { blobObjectId: args.blobObjectId }),
35
- name: args.name,
36
- contentType: args.contentType,
37
- size: args.size,
38
- allowlistId: args.allowlistId,
39
- });
40
- const fileArg = created;
41
- buildShareFile(tx, { packageId: config.packageId, file: fileArg });
42
- const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
43
- // See ops/allowlist.ts: file::EncryptedFile was introduced in v2; type
44
- // identity is rooted at config.packageId, not originalPackageId.
45
- const typePrefix = config.packageId;
46
- return {
47
- digest: receipt.digest,
48
- gasUsedMist: receipt.gasUsedMist,
49
- fileId: toEncryptedFileId(findCreatedId(receipt, `${typePrefix}::file::EncryptedFile`)),
50
- };
51
- }
52
- /**
53
- * Register on-chain metadata for an unencrypted file. The bytes at `blobId`
54
- * are publicly readable via the Walrus aggregator.
55
- */
56
- export async function createPublicFile(adapter, config, args) {
57
- validateFileFields(args.name, args.contentType);
58
- const tx = new Transaction();
59
- const created = buildNewPublicFile(tx, {
60
- packageId: config.packageId,
61
- blobId: args.blobId,
62
- ...(args.blobObjectId === undefined
63
- ? {}
64
- : { blobObjectId: args.blobObjectId }),
65
- name: args.name,
66
- contentType: args.contentType,
67
- size: args.size,
68
- });
69
- const fileArg = created;
70
- buildShareFile(tx, { packageId: config.packageId, file: fileArg });
71
- const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
72
- // See ops/allowlist.ts: file::EncryptedFile was introduced in v2; type
73
- // identity is rooted at config.packageId, not originalPackageId.
74
- const typePrefix = config.packageId;
75
- return {
76
- digest: receipt.digest,
77
- gasUsedMist: receipt.gasUsedMist,
78
- fileId: toEncryptedFileId(findCreatedId(receipt, `${typePrefix}::file::EncryptedFile`)),
79
- };
80
- }
81
- /**
82
- * Update the file's `name` and `content_type`. Other fields are immutable
83
- * post-creation; create a new file record to swap the blob or change the
84
- * allowlist. Owner only (sender must equal `file.owner` on-chain).
85
- */
86
- export async function updateFileMetadata(adapter, config, args) {
87
- validateFileFields(args.name, args.contentType);
88
- const tx = new Transaction();
89
- buildUpdateFileMetadata(tx, {
90
- packageId: config.packageId,
91
- fileId: args.fileId,
92
- name: args.name,
93
- contentType: args.contentType,
94
- });
95
- const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
96
- return { digest: receipt.digest, gasUsedMist: receipt.gasUsedMist };
97
- }
98
- /**
99
- * Transfer the metadata-mutation right to a new address. Decryption access
100
- * is governed separately by the file's allowlist; the new owner must be
101
- * added to that allowlist (and the previous owner removed, if desired) by
102
- * the Cap holder. The two operations can be composed in one PTB by the
103
- * caller if both rights need to move together.
104
- */
105
- export async function transferFileOwnership(adapter, config, args) {
106
- const tx = new Transaction();
107
- buildTransferFileOwnership(tx, {
108
- packageId: config.packageId,
109
- fileId: args.fileId,
110
- newOwner: args.newOwner,
111
- });
112
- const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
113
- return { digest: receipt.digest, gasUsedMist: receipt.gasUsedMist };
114
- }
115
- /**
116
- * Delete the on-chain metadata record. Does NOT delete the Walrus blob;
117
- * that follows the Walrus lease lifecycle independently.
118
- */
119
- export async function deleteFile(adapter, config, args) {
120
- const tx = new Transaction();
121
- buildDeleteFile(tx, {
122
- packageId: config.packageId,
123
- fileId: args.fileId,
124
- });
125
- const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
126
- return { digest: receipt.digest, gasUsedMist: receipt.gasUsedMist };
127
- }
128
- function validateFileFields(name, contentType) {
129
- if (name.length === 0) {
130
- throw new ValidationError("File name cannot be empty", "name");
131
- }
132
- if (name.length > MAX_FILE_NAME_LENGTH) {
133
- throw new ValidationError(`File name exceeds ${MAX_FILE_NAME_LENGTH} chars`, "name");
134
- }
135
- if (contentType.length === 0) {
136
- throw new ValidationError("Content type cannot be empty", "contentType");
137
- }
138
- if (contentType.length > MAX_CONTENT_TYPE_LENGTH) {
139
- throw new ValidationError(`Content type exceeds ${MAX_CONTENT_TYPE_LENGTH} chars`, "contentType");
140
- }
141
- }
142
- //# sourceMappingURL=file.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/ops/file.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACN,WAAW,GAEX,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EACN,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,0BAA0B,EAC1B,uBAAuB,GACvB,MAAM,gBAAgB,CAAC;AASxB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAkBpC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,OAAsB,EACtB,MAA0B,EAC1B,IAA6B;IAE7B,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAEhD,MAAM,EAAE,GAAG,IAAI,WAAW,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,qBAAqB,CAAC,EAAE,EAAE;QACzC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS;YAClC,CAAC,CAAC,EAAE;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,EAAE,CAAC;QACxC,MAAM,IAAI,eAAe,CACxB,qBAAqB,oBAAoB,QAAQ,EACjD,MAAM,CACN,CAAC;IACH,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAe,CAAC,8BAA8B,EAAE,aAAa,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,GAAG,uBAAuB,EAAE,CAAC;QAClD,MAAM,IAAI,eAAe,CACxB,wBAAwB,uBAAuB,QAAQ,EACvD,aAAa,CACb,CAAC;IACH,CAAC;AACF,CAAC"}
@@ -1,65 +0,0 @@
1
- /**
2
- * PTB builders for `allowlist` module Move calls. Internal to the SDK;
3
- * `ops/allowlist.ts` composes these into single atomic transactions.
4
- */
5
- import type { Transaction, TransactionArgument, TransactionResult } from "@mysten/sui/transactions";
6
- import type { AllowlistCapId, AllowlistId, PackageId, SuiAddress } from "../types.js";
7
- export interface BuildNewAllowlistArgs {
8
- readonly packageId: PackageId;
9
- readonly name: string;
10
- }
11
- /**
12
- * Add an `allowlist::new_allowlist` call. The result destructures into
13
- * `[allowlist, cap]` in tuple order.
14
- */
15
- export declare function buildNewAllowlist(tx: Transaction, args: BuildNewAllowlistArgs): TransactionResult;
16
- export interface BuildShareAllowlistArgs {
17
- readonly packageId: PackageId;
18
- readonly allowlist: TransactionArgument;
19
- }
20
- /** Add an `allowlist::share_allowlist` call. Consumes the allowlist. */
21
- export declare function buildShareAllowlist(tx: Transaction, args: BuildShareAllowlistArgs): TransactionResult;
22
- export interface BuildTransferAllowlistCapArgs {
23
- readonly packageId: PackageId;
24
- readonly cap: TransactionArgument | AllowlistCapId;
25
- readonly recipient: SuiAddress;
26
- }
27
- /**
28
- * Add an `allowlist::transfer_cap` call. Use this instead of `tx.transferObjects`
29
- * because `Cap` is key-only (no `store`); the contract's typed transfer is the
30
- * only way to move it.
31
- */
32
- export declare function buildTransferAllowlistCap(tx: Transaction, args: BuildTransferAllowlistCapArgs): TransactionResult;
33
- export interface BuildAddMemberArgs {
34
- readonly packageId: PackageId;
35
- readonly allowlistId: AllowlistId;
36
- readonly capId: AllowlistCapId;
37
- readonly member: SuiAddress;
38
- }
39
- export declare function buildAddMember(tx: Transaction, args: BuildAddMemberArgs): TransactionResult;
40
- export interface BuildRemoveMemberArgs {
41
- readonly packageId: PackageId;
42
- readonly allowlistId: AllowlistId;
43
- readonly capId: AllowlistCapId;
44
- readonly member: SuiAddress;
45
- }
46
- export declare function buildRemoveMember(tx: Transaction, args: BuildRemoveMemberArgs): TransactionResult;
47
- export interface BuildDeleteAllowlistArgs {
48
- readonly packageId: PackageId;
49
- readonly allowlistId: AllowlistId;
50
- readonly capId: AllowlistCapId;
51
- }
52
- export declare function buildDeleteAllowlist(tx: Transaction, args: BuildDeleteAllowlistArgs): TransactionResult;
53
- export interface BuildSealApproveAllowlistArgs {
54
- readonly packageId: PackageId;
55
- readonly identity: Uint8Array;
56
- readonly allowlistId: AllowlistId;
57
- }
58
- /**
59
- * Add a dry-run-only `allowlist::seal_approve` call. Seal key servers execute
60
- * this against a dry-run of the PTB to decide whether to release decryption
61
- * key shares; the transaction is not submitted on-chain. The `identity` bytes
62
- * must be the same `SealId` used to encrypt the content.
63
- */
64
- export declare function buildSealApproveAllowlist(tx: Transaction, args: BuildSealApproveAllowlistArgs): TransactionResult;
65
- //# sourceMappingURL=allowlist.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"allowlist.d.ts","sourceRoot":"","sources":["../../src/ptb/allowlist.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACX,cAAc,EACd,WAAW,EACX,SAAS,EACT,UAAU,EACV,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAA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BAAqB,GACzB,iBAAiB,CASnB;AAED,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;CAC/B;AAED,wBAAgB,oBAAoB,CACnC,EAAE,EAAE,WAAW,EACf,IAAI,EAAE,wBAAwB,GAC5B,iBAAiB,CAKnB;AAED,MAAM,WAAW,6BAA6B;IAC7C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACxC,EAAE,EAAE,WAAW,EACf,IAAI,EAAE,6BAA6B,GACjC,iBAAiB,CAQnB"}
@@ -1,75 +0,0 @@
1
- /**
2
- * PTB builders for `allowlist` module Move calls. Internal to the SDK;
3
- * `ops/allowlist.ts` composes these into single atomic transactions.
4
- */
5
- /**
6
- * Add an `allowlist::new_allowlist` call. The result destructures into
7
- * `[allowlist, cap]` in tuple order.
8
- */
9
- export function buildNewAllowlist(tx, args) {
10
- return tx.moveCall({
11
- target: `${args.packageId}::allowlist::new_allowlist`,
12
- arguments: [tx.pure.string(args.name)],
13
- });
14
- }
15
- /** Add an `allowlist::share_allowlist` call. Consumes the allowlist. */
16
- export function buildShareAllowlist(tx, args) {
17
- return tx.moveCall({
18
- target: `${args.packageId}::allowlist::share_allowlist`,
19
- arguments: [args.allowlist],
20
- });
21
- }
22
- /**
23
- * Add an `allowlist::transfer_cap` call. Use this instead of `tx.transferObjects`
24
- * because `Cap` is key-only (no `store`); the contract's typed transfer is the
25
- * only way to move it.
26
- */
27
- export function buildTransferAllowlistCap(tx, args) {
28
- const cap = typeof args.cap === "string" ? tx.object(args.cap) : args.cap;
29
- return tx.moveCall({
30
- target: `${args.packageId}::allowlist::transfer_cap`,
31
- arguments: [cap, tx.pure.address(args.recipient)],
32
- });
33
- }
34
- export function buildAddMember(tx, args) {
35
- return tx.moveCall({
36
- target: `${args.packageId}::allowlist::add_member`,
37
- arguments: [
38
- tx.object(args.allowlistId),
39
- tx.object(args.capId),
40
- tx.pure.address(args.member),
41
- ],
42
- });
43
- }
44
- export function buildRemoveMember(tx, args) {
45
- return tx.moveCall({
46
- target: `${args.packageId}::allowlist::remove_member`,
47
- arguments: [
48
- tx.object(args.allowlistId),
49
- tx.object(args.capId),
50
- tx.pure.address(args.member),
51
- ],
52
- });
53
- }
54
- export function buildDeleteAllowlist(tx, args) {
55
- return tx.moveCall({
56
- target: `${args.packageId}::allowlist::delete_allowlist`,
57
- arguments: [tx.object(args.allowlistId), tx.object(args.capId)],
58
- });
59
- }
60
- /**
61
- * Add a dry-run-only `allowlist::seal_approve` call. Seal key servers execute
62
- * this against a dry-run of the PTB to decide whether to release decryption
63
- * key shares; the transaction is not submitted on-chain. The `identity` bytes
64
- * must be the same `SealId` used to encrypt the content.
65
- */
66
- export function buildSealApproveAllowlist(tx, args) {
67
- return tx.moveCall({
68
- target: `${args.packageId}::allowlist::seal_approve`,
69
- arguments: [
70
- tx.pure.vector("u8", Array.from(args.identity)),
71
- tx.object(args.allowlistId),
72
- ],
73
- });
74
- }
75
- //# sourceMappingURL=allowlist.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"allowlist.js","sourceRoot":"","sources":["../../src/ptb/allowlist.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAChC,EAAe,EACf,IAA2B;IAE3B,OAAO,EAAE,CAAC,QAAQ,CAAC;QAClB,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,4BAA4B;QACrD,SAAS,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACtC,CAAC,CAAC;AACJ,CAAC;AAOD,wEAA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AI,CAAC,WAAW,CAAC;YAC3B,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;YACrB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;SAC5B;KACD,CAAC,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,oBAAoB,CACnC,EAAe,EACf,IAA8B;IAE9B,OAAO,EAAE,CAAC,QAAQ,CAAC;QAClB,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,+BAA+B;QACxD,SAAS,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC/D,CAAC,CAAC;AACJ,CAAC;AAQD;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACxC,EAAe,EACf,IAAmC;IAEnC,OAAO,EAAE,CAAC,QAAQ,CAAC;QAClB,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,2BAA2B;QACpD,SAAS,EAAE;YACV,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/C,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;SAC3B;KACD,CAAC,CAAC;AACJ,CAAC"}
@@ -1,58 +0,0 @@
1
- /**
2
- * PTB builders for `file` module Move calls. Internal to the SDK;
3
- * `ops/file.ts` composes these into single atomic transactions.
4
- */
5
- import type { Transaction, TransactionArgument, TransactionResult } from "@mysten/sui/transactions";
6
- import type { AllowlistId, BlobObjectId, EncryptedFileId, PackageId, SuiAddress, WalrusBlobId } from "../types.js";
7
- export interface BuildNewEncryptedFileArgs {
8
- readonly packageId: PackageId;
9
- readonly blobId: WalrusBlobId;
10
- readonly blobObjectId?: BlobObjectId;
11
- readonly name: string;
12
- readonly contentType: string;
13
- readonly size: bigint;
14
- readonly allowlistId: AllowlistId;
15
- }
16
- /**
17
- * Add a `file::new_encrypted_file` call. Returns the new EncryptedFile as the
18
- * first result. The caller must follow with `share_file` to make it accessible
19
- * from any wallet.
20
- */
21
- export declare function buildNewEncryptedFile(tx: Transaction, args: BuildNewEncryptedFileArgs): TransactionResult;
22
- export interface BuildNewPublicFileArgs {
23
- readonly packageId: PackageId;
24
- readonly blobId: WalrusBlobId;
25
- readonly blobObjectId?: BlobObjectId;
26
- readonly name: string;
27
- readonly contentType: string;
28
- readonly size: bigint;
29
- }
30
- /**
31
- * Add a `file::new_public_file` call. Returns the new EncryptedFile (the
32
- * `encrypted` flag is false). Follow with `share_file`.
33
- */
34
- export declare function buildNewPublicFile(tx: Transaction, args: BuildNewPublicFileArgs): TransactionResult;
35
- export interface BuildShareFileArgs {
36
- readonly packageId: PackageId;
37
- readonly file: TransactionArgument;
38
- }
39
- export declare function buildShareFile(tx: Transaction, args: BuildShareFileArgs): TransactionResult;
40
- export interface BuildUpdateFileMetadataArgs {
41
- readonly packageId: PackageId;
42
- readonly fileId: EncryptedFileId;
43
- readonly name: string;
44
- readonly contentType: string;
45
- }
46
- export declare function buildUpdateFileMetadata(tx: Transaction, args: BuildUpdateFileMetadataArgs): TransactionResult;
47
- export interface BuildTransferFileOwnershipArgs {
48
- readonly packageId: PackageId;
49
- readonly fileId: EncryptedFileId;
50
- readonly newOwner: SuiAddress;
51
- }
52
- export declare function buildTransferFileOwnership(tx: Transaction, args: BuildTransferFileOwnershipArgs): TransactionResult;
53
- export interface BuildDeleteFileArgs {
54
- readonly packageId: PackageId;
55
- readonly fileId: EncryptedFileId;
56
- }
57
- export declare function buildDeleteFile(tx: Transaction, args: BuildDeleteFileArgs): TransactionResult;
58
- //# sourceMappingURL=file.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/ptb/file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,mBAAmB,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