@arcadiasystems/morse-sdk 0.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.
Files changed (156) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +21 -0
  3. package/README.md +404 -0
  4. package/dist/clients.d.ts +12 -0
  5. package/dist/clients.d.ts.map +1 -0
  6. package/dist/clients.js +6 -0
  7. package/dist/clients.js.map +1 -0
  8. package/dist/codecs.d.ts +45 -0
  9. package/dist/codecs.d.ts.map +1 -0
  10. package/dist/codecs.js +132 -0
  11. package/dist/codecs.js.map +1 -0
  12. package/dist/compatibility.d.ts +22 -0
  13. package/dist/compatibility.d.ts.map +1 -0
  14. package/dist/compatibility.js +22 -0
  15. package/dist/compatibility.js.map +1 -0
  16. package/dist/config.d.ts +92 -0
  17. package/dist/config.d.ts.map +1 -0
  18. package/dist/config.js +85 -0
  19. package/dist/config.js.map +1 -0
  20. package/dist/errors.d.ts +101 -0
  21. package/dist/errors.d.ts.map +1 -0
  22. package/dist/errors.js +214 -0
  23. package/dist/errors.js.map +1 -0
  24. package/dist/index.d.ts +15 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +14 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/ops/cap.d.ts +79 -0
  29. package/dist/ops/cap.d.ts.map +1 -0
  30. package/dist/ops/cap.js +104 -0
  31. package/dist/ops/cap.js.map +1 -0
  32. package/dist/ops/collection.d.ts +50 -0
  33. package/dist/ops/collection.d.ts.map +1 -0
  34. package/dist/ops/collection.js +55 -0
  35. package/dist/ops/collection.js.map +1 -0
  36. package/dist/ops/entry-from-bytes.d.ts +129 -0
  37. package/dist/ops/entry-from-bytes.d.ts.map +1 -0
  38. package/dist/ops/entry-from-bytes.js +137 -0
  39. package/dist/ops/entry-from-bytes.js.map +1 -0
  40. package/dist/ops/entry.d.ts +173 -0
  41. package/dist/ops/entry.d.ts.map +1 -0
  42. package/dist/ops/entry.js +235 -0
  43. package/dist/ops/entry.js.map +1 -0
  44. package/dist/ops/index.d.ts +9 -0
  45. package/dist/ops/index.d.ts.map +1 -0
  46. package/dist/ops/index.js +9 -0
  47. package/dist/ops/index.js.map +1 -0
  48. package/dist/ops/internal.d.ts +21 -0
  49. package/dist/ops/internal.d.ts.map +1 -0
  50. package/dist/ops/internal.js +42 -0
  51. package/dist/ops/internal.js.map +1 -0
  52. package/dist/ops/publication.d.ts +74 -0
  53. package/dist/ops/publication.d.ts.map +1 -0
  54. package/dist/ops/publication.js +123 -0
  55. package/dist/ops/publication.js.map +1 -0
  56. package/dist/ptb/cap.d.ts +36 -0
  57. package/dist/ptb/cap.d.ts.map +1 -0
  58. package/dist/ptb/cap.js +44 -0
  59. package/dist/ptb/cap.js.map +1 -0
  60. package/dist/ptb/collection.d.ts +27 -0
  61. package/dist/ptb/collection.d.ts.map +1 -0
  62. package/dist/ptb/collection.js +33 -0
  63. package/dist/ptb/collection.js.map +1 -0
  64. package/dist/ptb/entry.d.ts +104 -0
  65. package/dist/ptb/entry.d.ts.map +1 -0
  66. package/dist/ptb/entry.js +155 -0
  67. package/dist/ptb/entry.js.map +1 -0
  68. package/dist/ptb/index.d.ts +9 -0
  69. package/dist/ptb/index.d.ts.map +1 -0
  70. package/dist/ptb/index.js +9 -0
  71. package/dist/ptb/index.js.map +1 -0
  72. package/dist/ptb/internal.d.ts +11 -0
  73. package/dist/ptb/internal.d.ts.map +1 -0
  74. package/dist/ptb/internal.js +12 -0
  75. package/dist/ptb/internal.js.map +1 -0
  76. package/dist/ptb/publication.d.ts +51 -0
  77. package/dist/ptb/publication.d.ts.map +1 -0
  78. package/dist/ptb/publication.js +61 -0
  79. package/dist/ptb/publication.js.map +1 -0
  80. package/dist/read/entry-bcs.d.ts +47 -0
  81. package/dist/read/entry-bcs.d.ts.map +1 -0
  82. package/dist/read/entry-bcs.js +36 -0
  83. package/dist/read/entry-bcs.js.map +1 -0
  84. package/dist/read/index.d.ts +5 -0
  85. package/dist/read/index.d.ts.map +1 -0
  86. package/dist/read/index.js +5 -0
  87. package/dist/read/index.js.map +1 -0
  88. package/dist/read/reader.d.ts +148 -0
  89. package/dist/read/reader.d.ts.map +1 -0
  90. package/dist/read/reader.js +403 -0
  91. package/dist/read/reader.js.map +1 -0
  92. package/dist/seal/adapter.d.ts +56 -0
  93. package/dist/seal/adapter.d.ts.map +1 -0
  94. package/dist/seal/adapter.js +7 -0
  95. package/dist/seal/adapter.js.map +1 -0
  96. package/dist/seal/default-adapter.d.ts +90 -0
  97. package/dist/seal/default-adapter.d.ts.map +1 -0
  98. package/dist/seal/default-adapter.js +187 -0
  99. package/dist/seal/default-adapter.js.map +1 -0
  100. package/dist/seal/identity.d.ts +31 -0
  101. package/dist/seal/identity.d.ts.map +1 -0
  102. package/dist/seal/identity.js +79 -0
  103. package/dist/seal/identity.js.map +1 -0
  104. package/dist/seal/index.d.ts +8 -0
  105. package/dist/seal/index.d.ts.map +1 -0
  106. package/dist/seal/index.js +7 -0
  107. package/dist/seal/index.js.map +1 -0
  108. package/dist/types.d.ts +160 -0
  109. package/dist/types.d.ts.map +1 -0
  110. package/dist/types.js +33 -0
  111. package/dist/types.js.map +1 -0
  112. package/dist/wallets/adapter.d.ts +34 -0
  113. package/dist/wallets/adapter.d.ts.map +1 -0
  114. package/dist/wallets/adapter.js +6 -0
  115. package/dist/wallets/adapter.js.map +1 -0
  116. package/dist/wallets/index.d.ts +7 -0
  117. package/dist/wallets/index.d.ts.map +1 -0
  118. package/dist/wallets/index.js +6 -0
  119. package/dist/wallets/index.js.map +1 -0
  120. package/dist/wallets/keypair-adapter.d.ts +31 -0
  121. package/dist/wallets/keypair-adapter.d.ts.map +1 -0
  122. package/dist/wallets/keypair-adapter.js +210 -0
  123. package/dist/wallets/keypair-adapter.js.map +1 -0
  124. package/dist/wallets/wallet-standard-signer.d.ts +118 -0
  125. package/dist/wallets/wallet-standard-signer.d.ts.map +1 -0
  126. package/dist/wallets/wallet-standard-signer.js +207 -0
  127. package/dist/wallets/wallet-standard-signer.js.map +1 -0
  128. package/dist/walrus/adapter.d.ts +91 -0
  129. package/dist/walrus/adapter.d.ts.map +1 -0
  130. package/dist/walrus/adapter.js +11 -0
  131. package/dist/walrus/adapter.js.map +1 -0
  132. package/dist/walrus/default-adapter.d.ts +104 -0
  133. package/dist/walrus/default-adapter.d.ts.map +1 -0
  134. package/dist/walrus/default-adapter.js +146 -0
  135. package/dist/walrus/default-adapter.js.map +1 -0
  136. package/dist/walrus/default-read-adapter.d.ts +89 -0
  137. package/dist/walrus/default-read-adapter.d.ts.map +1 -0
  138. package/dist/walrus/default-read-adapter.js +81 -0
  139. package/dist/walrus/default-read-adapter.js.map +1 -0
  140. package/dist/walrus/http-aggregator-read-adapter.d.ts +107 -0
  141. package/dist/walrus/http-aggregator-read-adapter.d.ts.map +1 -0
  142. package/dist/walrus/http-aggregator-read-adapter.js +174 -0
  143. package/dist/walrus/http-aggregator-read-adapter.js.map +1 -0
  144. package/dist/walrus/http-publisher-write-adapter.d.ts +97 -0
  145. package/dist/walrus/http-publisher-write-adapter.d.ts.map +1 -0
  146. package/dist/walrus/http-publisher-write-adapter.js +249 -0
  147. package/dist/walrus/http-publisher-write-adapter.js.map +1 -0
  148. package/dist/walrus/index.d.ts +11 -0
  149. package/dist/walrus/index.d.ts.map +1 -0
  150. package/dist/walrus/index.js +11 -0
  151. package/dist/walrus/index.js.map +1 -0
  152. package/dist/walrus/quilt-patch-id.d.ts +34 -0
  153. package/dist/walrus/quilt-patch-id.d.ts.map +1 -0
  154. package/dist/walrus/quilt-patch-id.js +103 -0
  155. package/dist/walrus/quilt-patch-id.js.map +1 -0
  156. package/package.json +72 -0
@@ -0,0 +1,235 @@
1
+ /**
2
+ * High-level entry/revision ops. Non-encrypted, public access policy.
3
+ * Encrypted variants are exposed through a separate set of ops with their
4
+ * own args types.
5
+ *
6
+ * To surface the `u64` returned by Move (`entry_id` on add, `revision_id` on
7
+ * appends/publishes), each id-returning op simulates the PTB first to read
8
+ * the BCS-encoded return value, then signs and executes. Two RPC round-trips
9
+ * per call.
10
+ *
11
+ * Race-window caveat: there is a brief window between the simulate and the
12
+ * execute calls where another transaction can mutate the publication's
13
+ * shared state. In single-publisher write paths this window is narrow and
14
+ * the returned `entryId`/`revisionId` is reliable in practice. Under
15
+ * concurrent writes from multiple `PublisherCap` holders, the simulated
16
+ * id can be invalidated by an interleaving transaction; the SDK does not
17
+ * detect this and the returned id may be stale. Consumers running
18
+ * concurrent writers should treat the returned id as advisory and rely on
19
+ * `reader.listEntries(...)` for the authoritative entry set.
20
+ */
21
+ import { Transaction } from "@mysten/sui/transactions";
22
+ import { buildAddEncryptedEntry, buildAddEntry, buildAppendDraftRevision, buildAppendEncryptedDraftRevision, buildDeleteEntry, buildPublishDirect, buildPublishFromDraft, } from "../ptb/entry.js";
23
+ import { decodeU64ReturnValue } from "./internal.js";
24
+ /**
25
+ * Add a new entry to a collection with its first revision, given a
26
+ * pre-uploaded `blobObjectId`. For the typical "upload-then-add" flow,
27
+ * prefer `addEntryFromBytes`, which packs upload + addEntry into 2 wallet
28
+ * popups instead of 3. Use this lower-level form when reusing a blob across
29
+ * multiple entries (deduplication), decoupling upload time from publish
30
+ * time, or pre-uploading from a server.
31
+ *
32
+ * @throws {ContractAbortError} On Move abort.
33
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
34
+ */
35
+ export async function addEntry(adapter, config, args) {
36
+ const tx = new Transaction();
37
+ buildAddEntry(tx, {
38
+ packageId: config.packageId,
39
+ publication: args.publicationId,
40
+ publisherCap: args.publisherCapId,
41
+ collectionName: args.collectionName,
42
+ name: args.name,
43
+ blobObjectId: args.blobObjectId,
44
+ ...(args.quiltPatchId === undefined
45
+ ? {}
46
+ : { quiltPatchId: args.quiltPatchId }),
47
+ contentType: args.contentType,
48
+ });
49
+ const simulated = await adapter.simulateTransaction(tx, args.signal);
50
+ const entryId = decodeU64ReturnValue(simulated, 0, 0);
51
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
52
+ return {
53
+ digest: receipt.digest,
54
+ gasUsedMist: receipt.gasUsedMist,
55
+ entryId,
56
+ revisionId: 0,
57
+ };
58
+ }
59
+ /**
60
+ * Append a draft revision to an existing entry.
61
+ * @throws {ContractAbortError} On Move abort (e.g. entry not found surfaces as
62
+ * `module: "collection", reason: "EEntryNotFound"`).
63
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
64
+ */
65
+ export async function appendDraftRevision(adapter, config, args) {
66
+ const tx = new Transaction();
67
+ buildAppendDraftRevision(tx, {
68
+ packageId: config.packageId,
69
+ publication: args.publicationId,
70
+ publisherCap: args.publisherCapId,
71
+ collectionName: args.collectionName,
72
+ entryId: args.entryId,
73
+ blobObjectId: args.blobObjectId,
74
+ ...(args.quiltPatchId === undefined
75
+ ? {}
76
+ : { quiltPatchId: args.quiltPatchId }),
77
+ contentType: args.contentType,
78
+ });
79
+ const simulated = await adapter.simulateTransaction(tx, args.signal);
80
+ const revisionId = decodeU64ReturnValue(simulated, 0, 0);
81
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
82
+ return {
83
+ digest: receipt.digest,
84
+ gasUsedMist: receipt.gasUsedMist,
85
+ revisionId,
86
+ };
87
+ }
88
+ /**
89
+ * Promote a draft to public. Despite the name, this appends a *new* public
90
+ * revision; `draftRevisionId` is only used by the contract to validate that
91
+ * the draft exists. `blobObjectId`/`quiltPatchId` are the published content
92
+ * and may differ from the draft's.
93
+ * @throws {ContractAbortError} On Move abort.
94
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
95
+ */
96
+ export async function publishFromDraft(adapter, config, args) {
97
+ const tx = new Transaction();
98
+ buildPublishFromDraft(tx, {
99
+ packageId: config.packageId,
100
+ publication: args.publicationId,
101
+ publisherCap: args.publisherCapId,
102
+ collectionName: args.collectionName,
103
+ entryId: args.entryId,
104
+ draftRevisionId: args.draftRevisionId,
105
+ blobObjectId: args.blobObjectId,
106
+ ...(args.quiltPatchId === undefined
107
+ ? {}
108
+ : { quiltPatchId: args.quiltPatchId }),
109
+ contentType: args.contentType,
110
+ });
111
+ const simulated = await adapter.simulateTransaction(tx, args.signal);
112
+ const revisionId = decodeU64ReturnValue(simulated, 0, 0);
113
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
114
+ return {
115
+ digest: receipt.digest,
116
+ gasUsedMist: receipt.gasUsedMist,
117
+ revisionId,
118
+ };
119
+ }
120
+ /**
121
+ * Append a public, non-encrypted revision in one step (no draft).
122
+ * @throws {ContractAbortError} On Move abort.
123
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
124
+ */
125
+ export async function publishDirect(adapter, config, args) {
126
+ const tx = new Transaction();
127
+ buildPublishDirect(tx, {
128
+ packageId: config.packageId,
129
+ publication: args.publicationId,
130
+ publisherCap: args.publisherCapId,
131
+ collectionName: args.collectionName,
132
+ entryId: args.entryId,
133
+ blobObjectId: args.blobObjectId,
134
+ ...(args.quiltPatchId === undefined
135
+ ? {}
136
+ : { quiltPatchId: args.quiltPatchId }),
137
+ contentType: args.contentType,
138
+ });
139
+ const simulated = await adapter.simulateTransaction(tx, args.signal);
140
+ const revisionId = decodeU64ReturnValue(simulated, 0, 0);
141
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
142
+ return {
143
+ digest: receipt.digest,
144
+ gasUsedMist: receipt.gasUsedMist,
145
+ revisionId,
146
+ };
147
+ }
148
+ /**
149
+ * Delete an entry from a collection. No client-side preflight.
150
+ * @throws {ContractAbortError} On Move abort. Missing entry surfaces as
151
+ * `module: "collection", reason: "EEntryNotFound"`.
152
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
153
+ */
154
+ export async function deleteEntry(adapter, config, args) {
155
+ const tx = new Transaction();
156
+ buildDeleteEntry(tx, {
157
+ packageId: config.packageId,
158
+ publication: args.publicationId,
159
+ publisherCap: args.publisherCapId,
160
+ collectionName: args.collectionName,
161
+ entryId: args.entryId,
162
+ });
163
+ return adapter.signAndExecuteTransaction(tx, args.signal);
164
+ }
165
+ /**
166
+ * Add a new entry whose first revision is encrypted under the supplied
167
+ * `sealId` with the Publisher access policy, given pre-encrypted ciphertext
168
+ * already uploaded to Walrus. For the typical encrypt-upload-add flow,
169
+ * prefer `addEncryptedEntryFromBytes`, which handles encryption and 2-popup
170
+ * upload in a single call. Use this lower-level form when ciphertext
171
+ * already exists, you want to attach the same ciphertext to multiple
172
+ * entries, or you upload from a different process than the one calling
173
+ * this op.
174
+ *
175
+ * @throws {ContractAbortError} On Move abort.
176
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
177
+ */
178
+ export async function addEncryptedEntry(adapter, config, args) {
179
+ const tx = new Transaction();
180
+ buildAddEncryptedEntry(tx, {
181
+ packageId: config.packageId,
182
+ publication: args.publicationId,
183
+ publisherCap: args.publisherCapId,
184
+ collectionName: args.collectionName,
185
+ name: args.name,
186
+ blobObjectId: args.blobObjectId,
187
+ ...(args.quiltPatchId === undefined
188
+ ? {}
189
+ : { quiltPatchId: args.quiltPatchId }),
190
+ contentType: args.contentType,
191
+ sealId: args.sealId,
192
+ });
193
+ const simulated = await adapter.simulateTransaction(tx, args.signal);
194
+ const entryId = decodeU64ReturnValue(simulated, 0, 0);
195
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
196
+ return {
197
+ digest: receipt.digest,
198
+ gasUsedMist: receipt.gasUsedMist,
199
+ entryId,
200
+ revisionId: 0,
201
+ };
202
+ }
203
+ /**
204
+ * Append an encrypted draft revision to an existing entry. Each revision
205
+ * carries its own `sealId`; passing a different identity from the prior
206
+ * revision is valid on-chain.
207
+ *
208
+ * @throws {ContractAbortError} On Move abort.
209
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
210
+ */
211
+ export async function appendEncryptedDraftRevision(adapter, config, args) {
212
+ const tx = new Transaction();
213
+ buildAppendEncryptedDraftRevision(tx, {
214
+ packageId: config.packageId,
215
+ publication: args.publicationId,
216
+ publisherCap: args.publisherCapId,
217
+ collectionName: args.collectionName,
218
+ entryId: args.entryId,
219
+ blobObjectId: args.blobObjectId,
220
+ ...(args.quiltPatchId === undefined
221
+ ? {}
222
+ : { quiltPatchId: args.quiltPatchId }),
223
+ contentType: args.contentType,
224
+ sealId: args.sealId,
225
+ });
226
+ const simulated = await adapter.simulateTransaction(tx, args.signal);
227
+ const revisionId = decodeU64ReturnValue(simulated, 0, 0);
228
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
229
+ return {
230
+ digest: receipt.digest,
231
+ gasUsedMist: receipt.gasUsedMist,
232
+ revisionId,
233
+ };
234
+ }
235
+ //# sourceMappingURL=entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/ops/entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EACN,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,iCAAiC,EACjC,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,GACrB,MAAM,iBAAiB,CAAC;AAUzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAsBrD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC7B,OAAsB,EACtB,MAA0B,EAC1B,IAAkB;IAElB,MAAM,EAAE,GAAG,IAAI,WAAW,EAAE,CAAC;IAC7B,aAAa,CAAC,EAAE,EAAE;QACjB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,EAAE,IAAI,CAAC,aAAa;QAC/B,YAAY,EAAE,IAAI,CAAC,cAAc;QACjC,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS;YAClC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC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E,OAAO,CAAC,WAAW;QAChC,OAAO;QACP,UAAU,EAAE,CAAC;KACb,CAAC;AACH,CAAC;AAcD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CACjD,OAAsB,EACtB,MAA0B,EAC1B,IAAsC;IAEtC,MAAM,EAAE,GAAG,IAAI,WAAW,EAAE,CAAC;IAC7B,iCAAiC,CAAC,EAAE,EAAE;QACrC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,WAAW,EAAE,IAAI,CAAC,aAAa;QAC/B,YAAY,EAAE,IAAI,CAAC,cAAc;QACjC,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS;YAClC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;QACvC,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;KACnB,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,oBAAoB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,yBAAyB,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO;QACN,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,UAAU;KACV,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Public barrel for the high-level ops layer.
3
+ */
4
+ export { type DestroyPublisherCapArgs, type DestroyPublisherCapResult, destroyPublisherCap, type IssuePublisherCapArgs, type IssuePublisherCapResult, issuePublisherCap, type RevokePublisherCapArgs, type RevokePublisherCapResult, revokePublisherCap, type TransferPublisherCapArgs, type TransferPublisherCapResult, transferPublisherCap, } from "./cap.js";
5
+ export { type CreateCollectionArgs, type CreateCollectionResult, createCollection, type DeleteCollectionArgs, type DeleteCollectionResult, deleteCollection, } from "./collection.js";
6
+ export { type AddEncryptedEntryArgs, type AddEntryArgs, type AddEntryResult, type AppendDraftRevisionArgs, type AppendEncryptedDraftRevisionArgs, addEncryptedEntry, addEntry, appendDraftRevision, appendEncryptedDraftRevision, type DeleteEntryArgs, type DeleteEntryResult, deleteEntry, type PublishDirectArgs, type PublishFromDraftArgs, publishDirect, publishFromDraft, type RevisionAppendResult, } from "./entry.js";
7
+ export { type AddEncryptedEntryFromBytesArgs, type AddEntryFromBytesArgs, type AddEntryFromBytesResult, addEncryptedEntryFromBytes, addEntryFromBytes, type ProgressCallback, type ProgressEvent, } from "./entry-from-bytes.js";
8
+ export { type CreatePublicationArgs, type CreatePublicationResult, createPublication, type DeletePublicationArgs, type DeletePublicationResult, deletePublication, type PublicationConfig, type TransferOwnershipArgs, type TransferOwnershipResult, transferOwnership, } from "./publication.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ops/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,oBAAoB,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,gBAAgB,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,gCAAgC,EACrC,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,EACnB,4BAA4B,EAC5B,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,aAAa,EACb,gBAAgB,EAChB,KAAK,oBAAoB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,0BAA0B,EAC1B,iBAAiB,EACjB,KAAK,gBAAgB,EACrB,KAAK,aAAa,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,iBAAiB,GACjB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Public barrel for the high-level ops layer.
3
+ */
4
+ export { destroyPublisherCap, issuePublisherCap, revokePublisherCap, transferPublisherCap, } from "./cap.js";
5
+ export { createCollection, deleteCollection, } from "./collection.js";
6
+ export { addEncryptedEntry, addEntry, appendDraftRevision, appendEncryptedDraftRevision, deleteEntry, publishDirect, publishFromDraft, } from "./entry.js";
7
+ export { addEncryptedEntryFromBytes, addEntryFromBytes, } from "./entry-from-bytes.js";
8
+ export { createPublication, deletePublication, transferOwnership, } from "./publication.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ops/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGN,mBAAmB,EAGnB,iBAAiB,EAGjB,kBAAkB,EAGlB,oBAAoB,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAGN,gBAAgB,EAGhB,gBAAgB,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAMN,iBAAiB,EACjB,QAAQ,EACR,mBAAmB,EACnB,4BAA4B,EAG5B,WAAW,EAGX,aAAa,EACb,gBAAgB,GAEhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAIN,0BAA0B,EAC1B,iBAAiB,GAGjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGN,iBAAiB,EAGjB,iBAAiB,EAIjB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shared helpers for ops. Internal to `ops/`; not exported from `src/index.ts`.
3
+ */
4
+ import type { TxReceipt } from "../types.js";
5
+ import type { SimulationReturnValues } from "../wallets/adapter.js";
6
+ /**
7
+ * Find the object ID of the single created object whose type exactly matches
8
+ * `expectedType`. Used to extract typed handles from a transaction receipt.
9
+ *
10
+ * @throws {TransportError} If no created object matches the expected type.
11
+ */
12
+ export declare function findCreatedId(receipt: TxReceipt, expectedType: string): string;
13
+ /**
14
+ * Decode a `u64` return value from a simulated PTB. Validates the result is a
15
+ * safe JS integer; on overflow or shape mismatch, throws `TransportError`.
16
+ *
17
+ * @throws {TransportError} If the indices are out of range or the value
18
+ * exceeds `Number.MAX_SAFE_INTEGER`.
19
+ */
20
+ export declare function decodeU64ReturnValue(values: SimulationReturnValues, commandIndex: number, returnIndex: number): number;
21
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/ops/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,MAAM,GAClB,MAAM,CAUR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,sBAAsB,EAC9B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GACjB,MAAM,CAqBR"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Shared helpers for ops. Internal to `ops/`; not exported from `src/index.ts`.
3
+ */
4
+ import { bcs } from "@mysten/sui/bcs";
5
+ import { TransportError } from "../errors.js";
6
+ /**
7
+ * Find the object ID of the single created object whose type exactly matches
8
+ * `expectedType`. Used to extract typed handles from a transaction receipt.
9
+ *
10
+ * @throws {TransportError} If no created object matches the expected type.
11
+ */
12
+ export function findCreatedId(receipt, expectedType) {
13
+ const created = receipt.createdObjects.find((object) => object.objectType === expectedType);
14
+ if (!created) {
15
+ throw new TransportError(`Receipt is missing a created object of type ${expectedType}`);
16
+ }
17
+ return created.objectId;
18
+ }
19
+ /**
20
+ * Decode a `u64` return value from a simulated PTB. Validates the result is a
21
+ * safe JS integer; on overflow or shape mismatch, throws `TransportError`.
22
+ *
23
+ * @throws {TransportError} If the indices are out of range or the value
24
+ * exceeds `Number.MAX_SAFE_INTEGER`.
25
+ */
26
+ export function decodeU64ReturnValue(values, commandIndex, returnIndex) {
27
+ const command = values[commandIndex];
28
+ if (!command) {
29
+ throw new TransportError(`Simulation has no command at index ${commandIndex} (got ${values.length} commands)`);
30
+ }
31
+ const bytes = command[returnIndex];
32
+ if (!bytes) {
33
+ throw new TransportError(`Simulation command ${commandIndex} has no return value at index ${returnIndex} (got ${command.length} return values)`);
34
+ }
35
+ const decoded = bcs.u64().parse(bytes);
36
+ const asNumber = Number(decoded);
37
+ if (!Number.isSafeInteger(asNumber)) {
38
+ throw new TransportError(`Simulated u64 return value ${decoded} exceeds Number.MAX_SAFE_INTEGER`);
39
+ }
40
+ return asNumber;
41
+ }
42
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/ops/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC5B,OAAkB,EAClB,YAAoB;IAEpB,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAC1C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,KAAK,YAAY,CAC9C,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,cAAc,CACvB,+CAA+C,YAAY,EAAE,CAC7D,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,QAAQ,CAAC;AACzB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,MAA8B,EAC9B,YAAoB,EACpB,WAAmB;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IACrC,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,cAAc,CACvB,sCAAsC,YAAY,SAAS,MAAM,CAAC,MAAM,YAAY,CACpF,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,IAAI,cAAc,CACvB,sBAAsB,YAAY,iCAAiC,WAAW,SAAS,OAAO,CAAC,MAAM,iBAAiB,CACtH,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,cAAc,CACvB,8BAA8B,OAAO,kCAAkC,CACvE,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * High-level publication ops: build a PTB, sign and execute via the wallet
3
+ * adapter, parse the receipt into a typed result.
4
+ */
5
+ import type { MorsePackageConfig, NetworkConfig } from "../config.js";
6
+ import type { PublicationReader } from "../read/reader.js";
7
+ import type { OwnerCapId, PublicationId, PublisherCapId, SuiAddress } from "../types.js";
8
+ import type { WalletAdapter } from "../wallets/adapter.js";
9
+ /** Subset of `NetworkConfig` required by publication ops; adds `registryId` to `MorsePackageConfig`. */
10
+ export type PublicationConfig = MorsePackageConfig & Pick<NetworkConfig, "registryId">;
11
+ export interface CreatePublicationArgs {
12
+ readonly name: string;
13
+ readonly slug: string;
14
+ readonly signal?: AbortSignal;
15
+ }
16
+ export interface CreatePublicationResult {
17
+ readonly digest: string;
18
+ readonly gasUsedMist: bigint;
19
+ readonly publicationId: PublicationId;
20
+ readonly ownerCapId: OwnerCapId;
21
+ readonly publisherCapId: PublisherCapId;
22
+ }
23
+ /**
24
+ * Create a publication, share it, and transfer the resulting OwnerCap and
25
+ * the first PublisherCap to `adapter.address` — all in one atomic PTB. The
26
+ * caller can immediately use the returned `publisherCapId` for write ops
27
+ * and the `ownerCapId` for governance ops (issue/revoke caps, delete).
28
+ *
29
+ * Slug constraints (validated client-side and on-chain): non-empty,
30
+ * 1-64 chars, lowercase alphanumeric and hyphens, no leading or trailing
31
+ * hyphen. `ESlugAlreadyExists` aborts on collision with another active
32
+ * publication's slug.
33
+ *
34
+ * @throws {ValidationError} If `slug` violates the format rules.
35
+ * @throws {ContractAbortError} On Move abort (e.g. slug already taken).
36
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
37
+ */
38
+ export declare function createPublication(adapter: WalletAdapter, config: PublicationConfig, args: CreatePublicationArgs): Promise<CreatePublicationResult>;
39
+ export interface DeletePublicationArgs {
40
+ readonly publicationId: PublicationId;
41
+ readonly ownerCapId: OwnerCapId;
42
+ readonly signal?: AbortSignal;
43
+ }
44
+ export interface DeletePublicationResult {
45
+ readonly digest: string;
46
+ readonly gasUsedMist: bigint;
47
+ }
48
+ /**
49
+ * Delete a publication. The client-side collection check is best-effort
50
+ * pre-flight; a concurrent transaction can still add a collection between
51
+ * the reader call and the delete, in which case the on-chain `destroy_empty`
52
+ * abort surfaces as `ContractAbortError`.
53
+ * @throws {ValidationError} If the publication still has collections at read time.
54
+ * @throws {NotFoundError} If the publication does not exist.
55
+ * @throws {ContractAbortError} On Move abort.
56
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
57
+ */
58
+ export declare function deletePublication(reader: PublicationReader, adapter: WalletAdapter, config: PublicationConfig, args: DeletePublicationArgs): Promise<DeletePublicationResult>;
59
+ export interface TransferOwnershipArgs {
60
+ readonly ownerCapId: OwnerCapId;
61
+ readonly recipient: SuiAddress;
62
+ readonly signal?: AbortSignal;
63
+ }
64
+ export interface TransferOwnershipResult {
65
+ readonly digest: string;
66
+ readonly gasUsedMist: bigint;
67
+ }
68
+ /**
69
+ * Transfer the OwnerCap to a new address.
70
+ * @throws {ContractAbortError} On Move abort.
71
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
72
+ */
73
+ export declare function transferOwnership(adapter: WalletAdapter, config: PublicationConfig, args: TransferOwnershipArgs): Promise<TransferOwnershipResult>;
74
+ //# sourceMappingURL=publication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publication.d.ts","sourceRoot":"","sources":["../../src/ops/publication.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAStE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EACX,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qBAAqB,GACzB,OAAO,CAAC,uBAAuB,CAAC,CA0BlC;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACtC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,qBAAqB,GACzB,OAAO,CAAC,uBAAuB,CAAC,CAclC"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * High-level publication ops: build a PTB, sign and execute via the wallet
3
+ * adapter, parse the receipt into a typed result.
4
+ */
5
+ import { Transaction, } from "@mysten/sui/transactions";
6
+ import { toOwnerCapId, toPublicationId, toPublisherCapId } from "../codecs.js";
7
+ import { ValidationError } from "../errors.js";
8
+ import { buildCreatePublication, buildDeletePublication, buildSharePublication, buildTransferOwnerCap, buildTransferPublisherCap, } from "../ptb/publication.js";
9
+ import { findCreatedId } from "./internal.js";
10
+ const MAX_SLUG_LENGTH = 64;
11
+ const SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
12
+ /**
13
+ * Create a publication, share it, and transfer the resulting OwnerCap and
14
+ * the first PublisherCap to `adapter.address` — all in one atomic PTB. The
15
+ * caller can immediately use the returned `publisherCapId` for write ops
16
+ * and the `ownerCapId` for governance ops (issue/revoke caps, delete).
17
+ *
18
+ * Slug constraints (validated client-side and on-chain): non-empty,
19
+ * 1-64 chars, lowercase alphanumeric and hyphens, no leading or trailing
20
+ * hyphen. `ESlugAlreadyExists` aborts on collision with another active
21
+ * publication's slug.
22
+ *
23
+ * @throws {ValidationError} If `slug` violates the format rules.
24
+ * @throws {ContractAbortError} On Move abort (e.g. slug already taken).
25
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
26
+ */
27
+ export async function createPublication(adapter, config, args) {
28
+ validateSlug(args.slug);
29
+ const tx = new Transaction();
30
+ const created = buildCreatePublication(tx, {
31
+ packageId: config.packageId,
32
+ registryId: config.registryId,
33
+ name: args.name,
34
+ slug: args.slug,
35
+ });
36
+ // new_publication returns (Publication, OwnerCap, PublisherCap); all object results.
37
+ const publicationArg = created[0];
38
+ const ownerCapArg = created[1];
39
+ const publisherCapArg = created[2];
40
+ buildSharePublication(tx, {
41
+ packageId: config.packageId,
42
+ publication: publicationArg,
43
+ });
44
+ // Caps are key-only; tx.transferObjects requires `store`. Use the contract's
45
+ // typed transfer wrappers instead.
46
+ buildTransferOwnerCap(tx, {
47
+ packageId: config.packageId,
48
+ ownerCap: ownerCapArg,
49
+ recipient: adapter.address,
50
+ });
51
+ buildTransferPublisherCap(tx, {
52
+ packageId: config.packageId,
53
+ publisherCap: publisherCapArg,
54
+ recipient: adapter.address,
55
+ });
56
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
57
+ const typePrefix = config.originalPackageId ?? config.packageId;
58
+ return {
59
+ digest: receipt.digest,
60
+ gasUsedMist: receipt.gasUsedMist,
61
+ publicationId: toPublicationId(findCreatedId(receipt, `${typePrefix}::publication::Publication`)),
62
+ ownerCapId: toOwnerCapId(findCreatedId(receipt, `${typePrefix}::publication::OwnerCap`)),
63
+ publisherCapId: toPublisherCapId(findCreatedId(receipt, `${typePrefix}::publication::PublisherCap`)),
64
+ };
65
+ }
66
+ /**
67
+ * Delete a publication. The client-side collection check is best-effort
68
+ * pre-flight; a concurrent transaction can still add a collection between
69
+ * the reader call and the delete, in which case the on-chain `destroy_empty`
70
+ * abort surfaces as `ContractAbortError`.
71
+ * @throws {ValidationError} If the publication still has collections at read time.
72
+ * @throws {NotFoundError} If the publication does not exist.
73
+ * @throws {ContractAbortError} On Move abort.
74
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
75
+ */
76
+ export async function deletePublication(reader, adapter, config, args) {
77
+ const publication = await reader.getPublication(args.publicationId, args.signal);
78
+ if (publication.collections.length > 0) {
79
+ throw new ValidationError(`Cannot delete publication with ${publication.collections.length} collection(s); remove them first`, "publication.collections");
80
+ }
81
+ const tx = new Transaction();
82
+ buildDeletePublication(tx, {
83
+ packageId: config.packageId,
84
+ registryId: config.registryId,
85
+ publicationId: args.publicationId,
86
+ ownerCapId: args.ownerCapId,
87
+ });
88
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
89
+ return {
90
+ digest: receipt.digest,
91
+ gasUsedMist: receipt.gasUsedMist,
92
+ };
93
+ }
94
+ /**
95
+ * Transfer the OwnerCap to a new address.
96
+ * @throws {ContractAbortError} On Move abort.
97
+ * @throws {TransportError} On RPC, network, or response-parsing failure.
98
+ */
99
+ export async function transferOwnership(adapter, config, args) {
100
+ const tx = new Transaction();
101
+ buildTransferOwnerCap(tx, {
102
+ packageId: config.packageId,
103
+ ownerCap: args.ownerCapId,
104
+ recipient: args.recipient,
105
+ });
106
+ const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
107
+ return {
108
+ digest: receipt.digest,
109
+ gasUsedMist: receipt.gasUsedMist,
110
+ };
111
+ }
112
+ function validateSlug(slug) {
113
+ if (slug.length === 0) {
114
+ throw new ValidationError("Slug cannot be empty", "slug");
115
+ }
116
+ if (slug.length > MAX_SLUG_LENGTH) {
117
+ throw new ValidationError(`Slug exceeds maximum length of ${MAX_SLUG_LENGTH} characters`, "slug");
118
+ }
119
+ if (!SLUG_PATTERN.test(slug)) {
120
+ throw new ValidationError("Slug must contain only lowercase alphanumeric characters and hyphens, and cannot start or end with a hyphen", "slug");
121
+ }
122
+ }
123
+ //# sourceMappingURL=publication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publication.js","sourceRoot":"","sources":["../../src/ops/publication.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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I,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAe,CACxB,6GAA6G,EAC7G,MAAM,CACN,CAAC;IACH,CAAC;AACF,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * PTB builders for PublisherCap lifecycle Move calls. Internal to the SDK.
3
+ */
4
+ import type { Transaction, TransactionObjectArgument, TransactionResult } from "@mysten/sui/transactions";
5
+ import type { OwnerCapId, PackageId, PublicationId, PublisherCapId, SuiAddress } from "../types.js";
6
+ export interface BuildIssuePublisherCapArgs {
7
+ readonly packageId: PackageId;
8
+ readonly publicationId: PublicationId | TransactionObjectArgument;
9
+ readonly ownerCap: OwnerCapId | TransactionObjectArgument;
10
+ readonly holder: SuiAddress;
11
+ }
12
+ /**
13
+ * Add a `publication::issue_publisher_cap` call. Returns the result handle for
14
+ * the freshly-minted `PublisherCap`; caller is responsible for transferring it
15
+ * to the bound holder address (typically via `buildTransferPublisherCap`).
16
+ */
17
+ export declare function buildIssuePublisherCap(tx: Transaction, args: BuildIssuePublisherCapArgs): TransactionResult;
18
+ export interface BuildRevokePublisherCapArgs {
19
+ readonly packageId: PackageId;
20
+ readonly publicationId: PublicationId | TransactionObjectArgument;
21
+ readonly ownerCap: OwnerCapId | TransactionObjectArgument;
22
+ readonly publisherCapId: PublisherCapId;
23
+ }
24
+ /** Add a `publication::revoke_publisher_cap` call. Adds the cap ID to the denylist. */
25
+ export declare function buildRevokePublisherCap(tx: Transaction, args: BuildRevokePublisherCapArgs): TransactionResult;
26
+ export interface BuildDestroyPublisherCapArgs {
27
+ readonly packageId: PackageId;
28
+ readonly publicationId: PublicationId | TransactionObjectArgument;
29
+ readonly publisherCap: PublisherCapId | TransactionObjectArgument;
30
+ }
31
+ /**
32
+ * Add a `publication::destroy_publisher_cap` call. Consumes the cap; only the
33
+ * cap's bound holder may call this.
34
+ */
35
+ export declare function buildDestroyPublisherCap(tx: Transaction, args: BuildDestroyPublisherCapArgs): TransactionResult;
36
+ //# sourceMappingURL=cap.d.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,EACf,IAAI,EAAE,4BAA4B,GAChC,iBAAiB,CAQnB"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * PTB builders for PublisherCap lifecycle Move calls. Internal to the SDK.
3
+ */
4
+ import { resolveObjectArg } from "./internal.js";
5
+ /**
6
+ * Add a `publication::issue_publisher_cap` call. Returns the result handle for
7
+ * the freshly-minted `PublisherCap`; caller is responsible for transferring it
8
+ * to the bound holder address (typically via `buildTransferPublisherCap`).
9
+ */
10
+ export function buildIssuePublisherCap(tx, args) {
11
+ return tx.moveCall({
12
+ target: `${args.packageId}::publication::issue_publisher_cap`,
13
+ arguments: [
14
+ resolveObjectArg(tx, args.publicationId),
15
+ resolveObjectArg(tx, args.ownerCap),
16
+ tx.pure.address(args.holder),
17
+ ],
18
+ });
19
+ }
20
+ /** Add a `publication::revoke_publisher_cap` call. Adds the cap ID to the denylist. */
21
+ export function buildRevokePublisherCap(tx, args) {
22
+ return tx.moveCall({
23
+ target: `${args.packageId}::publication::revoke_publisher_cap`,
24
+ arguments: [
25
+ resolveObjectArg(tx, args.publicationId),
26
+ resolveObjectArg(tx, args.ownerCap),
27
+ tx.pure.id(args.publisherCapId),
28
+ ],
29
+ });
30
+ }
31
+ /**
32
+ * Add a `publication::destroy_publisher_cap` call. Consumes the cap; only the
33
+ * cap's bound holder may call this.
34
+ */
35
+ export function buildDestroyPublisherCap(tx, args) {
36
+ return tx.moveCall({
37
+ target: `${args.packageId}::publication::destroy_publisher_cap`,
38
+ arguments: [
39
+ resolveObjectArg(tx, args.publicationId),
40
+ resolveObjectArg(tx, args.publisherCap),
41
+ ],
42
+ });
43
+ }
44
+ //# sourceMappingURL=cap.js.map