@misofm/sdk 0.12.4 → 0.14.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 (60) hide show
  1. package/README.md +50 -3
  2. package/dist/contracts/genre/genre.d.ts +8 -15
  3. package/dist/contracts/genre/genre.d.ts.map +1 -1
  4. package/dist/contracts/genre/genre.js +9 -15
  5. package/dist/contracts/genre/genre.js.map +1 -1
  6. package/dist/cover.d.ts +2 -2
  7. package/dist/cover.d.ts.map +1 -1
  8. package/dist/cover.js +5 -2
  9. package/dist/cover.js.map +1 -1
  10. package/dist/credits.d.ts +9 -9
  11. package/dist/credits.d.ts.map +1 -1
  12. package/dist/credits.js +8 -5
  13. package/dist/credits.js.map +1 -1
  14. package/dist/deployments.d.ts +8 -8
  15. package/dist/deployments.js +4 -4
  16. package/dist/execute.d.ts +13 -1
  17. package/dist/execute.d.ts.map +1 -1
  18. package/dist/execute.js +8 -2
  19. package/dist/execute.js.map +1 -1
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/publication.d.ts +207 -0
  25. package/dist/publication.d.ts.map +1 -0
  26. package/dist/publication.js +666 -0
  27. package/dist/publication.js.map +1 -0
  28. package/dist/recording-extensions.d.ts +2 -2
  29. package/dist/recording-extensions.d.ts.map +1 -1
  30. package/dist/recording-extensions.js +8 -5
  31. package/dist/recording-extensions.js.map +1 -1
  32. package/dist/release-extensions.d.ts +2 -2
  33. package/dist/release-extensions.d.ts.map +1 -1
  34. package/dist/release-extensions.js +10 -7
  35. package/dist/release-extensions.js.map +1 -1
  36. package/dist/share.d.ts +4 -3
  37. package/dist/share.d.ts.map +1 -1
  38. package/dist/share.js +4 -3
  39. package/dist/share.js.map +1 -1
  40. package/dist/transactions.d.ts +1 -0
  41. package/dist/transactions.d.ts.map +1 -1
  42. package/dist/transactions.js +1 -0
  43. package/dist/transactions.js.map +1 -1
  44. package/dist/vault.d.ts +7 -1
  45. package/dist/vault.d.ts.map +1 -1
  46. package/dist/vault.js +8 -0
  47. package/dist/vault.js.map +1 -1
  48. package/package.json +7 -3
  49. package/src/contracts/genre/genre.ts +9 -17
  50. package/src/cover.ts +9 -4
  51. package/src/credits.ts +18 -14
  52. package/src/deployments.ts +4 -4
  53. package/src/execute.ts +17 -4
  54. package/src/index.ts +1 -0
  55. package/src/publication.ts +949 -0
  56. package/src/recording-extensions.ts +12 -8
  57. package/src/release-extensions.ts +14 -9
  58. package/src/share.ts +7 -4
  59. package/src/transactions.ts +1 -0
  60. package/src/vault.ts +20 -2
@@ -3,21 +3,25 @@
3
3
 
4
4
  /** Cap-authorized builders for data-only Recording metadata extensions. */
5
5
 
6
- import type { TransactionArgument } from "@mysten/sui/transactions";
6
+ import type { Transaction, TransactionArgument, TransactionObjectArgument } from "@mysten/sui/transactions";
7
7
  import type { TxThunk } from "./transactions.ts";
8
- import { invokeWithAdminCap, type AdminCapAuthority } from "./vault.ts";
8
+ import { invokeWithAdminCap, type AdminCapAuthority, type ObjectInput } from "./vault.ts";
9
9
  import * as advisory from "./contracts/recording_advisory/recording_advisory.ts";
10
10
  import * as language from "./contracts/recording_language/recording_language.ts";
11
11
  import * as masterReference from "./contracts/recording_master_reference/recording_master_reference.ts";
12
12
  import * as preview from "./contracts/recording_preview/recording_preview.ts";
13
13
 
14
14
  export interface RecordingExtensionTarget {
15
- readonly recordingId: string;
15
+ readonly recordingId: ObjectInput;
16
16
  readonly authority: AdminCapAuthority;
17
17
  readonly recordingShareType: string;
18
18
  readonly compositionShareType: string;
19
19
  }
20
20
 
21
+ function object(tx: Transaction, value: ObjectInput): TransactionObjectArgument {
22
+ return typeof value === "string" ? tx.object(value) : value;
23
+ }
24
+
21
25
  type Rating = "Explicit" | "NotExplicit" | "Cleaned";
22
26
  export interface SetRecordingAdvisoryParams extends RecordingExtensionTarget {
23
27
  readonly recordingAdvisoryPackageId: string;
@@ -34,7 +38,7 @@ export function setRecordingAdvisory(p: SetRecordingAdvisoryParams): TxThunk {
34
38
  invokeWithAdminCap(tx, p.authority, {
35
39
  target: `${p.recordingAdvisoryPackageId}::recording_advisory::set_rating`,
36
40
  typeArguments: [p.recordingShareType, p.compositionShareType],
37
- arguments: [tx.object(p.recordingId), rating],
41
+ arguments: [object(tx, p.recordingId), rating],
38
42
  adminCapIndex: 1,
39
43
  });
40
44
  };
@@ -51,7 +55,7 @@ export function setRecordingLanguages(p: SetRecordingLanguagesParams): TxThunk {
51
55
  invokeWithAdminCap(tx, p.authority, {
52
56
  target: `${p.recordingLanguagePackageId}::recording_language::set_languages`,
53
57
  typeArguments: [p.recordingShareType, p.compositionShareType],
54
- arguments: [tx.object(p.recordingId), p.languages],
58
+ arguments: [object(tx, p.recordingId), p.languages],
55
59
  adminCapIndex: 1,
56
60
  });
57
61
  };
@@ -62,7 +66,7 @@ export function setRecordingInstrumental(p: Omit<SetRecordingLanguagesParams, "l
62
66
  invokeWithAdminCap(tx, p.authority, {
63
67
  target: `${p.recordingLanguagePackageId}::recording_language::set_instrumental`,
64
68
  typeArguments: [p.recordingShareType, p.compositionShareType],
65
- arguments: [tx.object(p.recordingId)],
69
+ arguments: [object(tx, p.recordingId)],
66
70
  adminCapIndex: 1,
67
71
  });
68
72
  };
@@ -81,7 +85,7 @@ export function setRecordingMasterReference(p: SetRecordingMasterReferenceParams
81
85
  invokeWithAdminCap(tx, p.authority, {
82
86
  target: `${p.recordingMasterReferencePackageId}::recording_master_reference::set_master_reference`,
83
87
  typeArguments: [p.recordingShareType, p.compositionShareType],
84
- arguments: [tx.object(p.recordingId), p.reference],
88
+ arguments: [object(tx, p.recordingId), p.reference],
85
89
  adminCapIndex: 1,
86
90
  });
87
91
  };
@@ -95,7 +99,7 @@ export function setRecordingPreview(p: SetRecordingPreviewParams): TxThunk {
95
99
  invokeWithAdminCap(tx, p.authority, {
96
100
  target: `${p.recordingPreviewPackageId}::recording_preview::set_preview`,
97
101
  typeArguments: [p.recordingShareType, p.compositionShareType],
98
- arguments: [tx.object(p.recordingId), p.reference],
102
+ arguments: [object(tx, p.recordingId), p.reference],
99
103
  adminCapIndex: 1,
100
104
  });
101
105
  };
@@ -9,6 +9,7 @@ import { deriveObjectID } from "@mysten/sui/utils";
9
9
  import type {
10
10
  Transaction,
11
11
  TransactionArgument,
12
+ TransactionObjectArgument,
12
13
  } from "@mysten/sui/transactions";
13
14
  import type { TxThunk } from "./transactions.ts";
14
15
  import * as genre from "./contracts/genre/genre.ts";
@@ -16,13 +17,17 @@ import * as releaseDescription from "./contracts/release_description/release_des
16
17
  import * as releaseDspLink from "./contracts/release_dsp_link/release_dsp_link.ts";
17
18
  import * as releaseGenre from "./contracts/release_genre/release_genre.ts";
18
19
  import * as releaseKind from "./contracts/release_kind/release_kind.ts";
19
- import { asU64, directAdminCap, invokeWithAdminCap, type AdminCapAuthority, type U64Input } from "./vault.ts";
20
+ import { asU64, directAdminCap, invokeWithAdminCap, type AdminCapAuthority, type ObjectInput, type U64Input } from "./vault.ts";
21
+
22
+ function object(tx: Transaction, value: ObjectInput): TransactionObjectArgument {
23
+ return typeof value === "string" ? tx.object(value) : value;
24
+ }
20
25
 
21
26
  type ReleaseAuthorityInput =
22
27
  | { readonly authority: AdminCapAuthority; readonly releaseAdminCapId?: never }
23
28
  | { readonly authority?: never; readonly releaseAdminCapId: string };
24
29
  interface ReleaseExtensionTargetBase {
25
- releaseId: string;
30
+ releaseId: ObjectInput;
26
31
  }
27
32
  export type ReleaseExtensionTarget = ReleaseExtensionTargetBase & ReleaseAuthorityInput;
28
33
  function authority(p: ReleaseExtensionTarget): AdminCapAuthority {
@@ -48,7 +53,7 @@ export function setReleaseKind(p: SetReleaseKindParams): TxThunk {
48
53
  return (tx) => {
49
54
  invokeWithAdminCap(tx, authority(p), {
50
55
  target: `${p.releaseKindPackageId}::release_kind::set_kind`,
51
- arguments: [tx.object(p.releaseId), tx.pure.string(p.kind)],
56
+ arguments: [object(tx, p.releaseId), tx.pure.string(p.kind)],
52
57
  adminCapIndex: 1,
53
58
  });
54
59
  };
@@ -73,7 +78,7 @@ export function setReleaseDescription(p: SetReleaseDescriptionParams): TxThunk {
73
78
  return (tx) => {
74
79
  invokeWithAdminCap(tx, authority(p), {
75
80
  target: `${p.releaseDescriptionPackageId}::release_description::set_description`,
76
- arguments: [tx.object(p.releaseId), tx.pure.string(p.description)],
81
+ arguments: [object(tx, p.releaseId), tx.pure.string(p.description)],
77
82
  adminCapIndex: 1,
78
83
  });
79
84
  };
@@ -124,13 +129,13 @@ export function setReleaseGenres(p: SetReleaseGenresParams): TxThunk {
124
129
  return (tx) => {
125
130
  invokeWithAdminCap(tx, authority(p), {
126
131
  target: `${p.releaseGenrePackageId}::release_genre::set_primary_genre`,
127
- arguments: [tx.object(p.releaseId), tx.object(p.primaryGenreId)],
132
+ arguments: [object(tx, p.releaseId), tx.object(p.primaryGenreId)],
128
133
  adminCapIndex: 1,
129
134
  });
130
135
  for (const genreId of p.secondaryGenreIds ?? []) {
131
136
  invokeWithAdminCap(tx, authority(p), {
132
137
  target: `${p.releaseGenrePackageId}::release_genre::add_secondary_genre`,
133
- arguments: [tx.object(p.releaseId), tx.object(genreId)],
138
+ arguments: [object(tx, p.releaseId), tx.object(genreId)],
134
139
  adminCapIndex: 1,
135
140
  });
136
141
  }
@@ -138,7 +143,7 @@ export function setReleaseGenres(p: SetReleaseGenresParams): TxThunk {
138
143
  invokeWithAdminCap(tx, authority(p), {
139
144
  target: `${p.releaseGenrePackageId}::release_genre::set_track_primary_genre`,
140
145
  arguments: [
141
- tx.object(p.releaseId),
146
+ object(tx, p.releaseId),
142
147
  tx.pure.u64(asU64("trackIndex", assignment.trackIndex)),
143
148
  tx.object(assignment.genreId),
144
149
  ],
@@ -247,7 +252,7 @@ export function setReleaseDspLinks(p: SetReleaseDspLinksParams): TxThunk {
247
252
  const value = buildDspLink(tx, p.releaseDspLinkPackageId, link);
248
253
  invokeWithAdminCap(tx, authority(p), {
249
254
  target: `${p.releaseDspLinkPackageId}::release_dsp_link::set_release_link`,
250
- arguments: [tx.object(p.releaseId), value],
255
+ arguments: [object(tx, p.releaseId), value],
251
256
  adminCapIndex: 1,
252
257
  });
253
258
  }
@@ -255,7 +260,7 @@ export function setReleaseDspLinks(p: SetReleaseDspLinksParams): TxThunk {
255
260
  const value = buildDspLink(tx, p.releaseDspLinkPackageId, item.link);
256
261
  invokeWithAdminCap(tx, authority(p), {
257
262
  target: `${p.releaseDspLinkPackageId}::release_dsp_link::set_track_link`,
258
- arguments: [tx.object(p.releaseId), tx.pure.u64(asU64("trackIndex", item.trackIndex)), value],
263
+ arguments: [object(tx, p.releaseId), tx.pure.u64(asU64("trackIndex", item.trackIndex)), value],
259
264
  adminCapIndex: 1,
260
265
  });
261
266
  }
package/src/share.ts CHANGED
@@ -14,7 +14,9 @@
14
14
  // matters, and it is the same signer for all), so publishes are fungible: a whole
15
15
  // batch can be published — up to 5 `tx.publish` per PTB (the protocol's
16
16
  // `max_publish_or_upgrade_per_ptb` cap) — and run concurrently through a
17
- // `ParallelTransactionExecutor`. Initialization is likewise batched. The caller
17
+ // `ParallelTransactionExecutor`. Every Publish result is consumed immediately by
18
+ // `package::make_immutable` in that same PTB, so no share-package UpgradeCap is
19
+ // ever left with the publisher. Initialization is likewise batched. The caller
18
20
  // assigns packages to work slots and supplies per-package metadata, so each
19
21
  // currency still gets a descriptive, work-specific name.
20
22
 
@@ -104,7 +106,7 @@ export interface CreateShareCurrencyParams {
104
106
  treasuryCapRecipient?: string;
105
107
  }
106
108
 
107
- /** Publishes + initializes a fresh share currency in two sequential txs. */
109
+ /** Publishes an immutable package, then initializes a fresh share currency in a second tx. */
108
110
  export async function createShareCurrency(
109
111
  client: ClientWithCoreApi,
110
112
  signer: Signer,
@@ -151,8 +153,9 @@ function chunk<T>(items: T[], size: number): T[][] {
151
153
  }
152
154
 
153
155
  /**
154
- * Publishes `count` fresh share-currency packages, batched at ≤5 publishes per PTB
155
- * and run concurrently through the executor. Returns the published package ids
156
+ * Publishes `count` fresh, permanently immutable share-currency packages, batched
157
+ * at ≤5 publishes per PTB and run concurrently through the executor. Each publish
158
+ * consumes its UpgradeCap in the same PTB. Returns the published package ids
156
159
  * (fungible — order is not meaningful; the caller assigns them to work slots).
157
160
  */
158
161
  export async function publishShareCurrencies(
@@ -130,6 +130,7 @@ export interface PackageBytecode {
130
130
  digest: number[];
131
131
  }
132
132
 
133
+ /** Publish a share package and permanently destroy its UpgradeCap in the same PTB. */
133
134
  export function publishShareCurrency(bytecode: PackageBytecode): TxThunk {
134
135
  return (tx) => {
135
136
  const upgradeCap = tx.publish(bytecode);
package/src/vault.ts CHANGED
@@ -21,6 +21,7 @@ import { normalizeStructTag } from "@mysten/sui/utils";
21
21
  import * as vault from "./contracts/vault/vault.ts";
22
22
  import * as compositionRoyaltyPool from "./contracts/composition_royalty_pool/composition_royalty_pool.ts";
23
23
  import * as recordingRoyaltyPool from "./contracts/recording_royalty_pool/recording_royalty_pool.ts";
24
+ import * as partyWallet from "./contracts/party_wallet/party_wallet.ts";
24
25
  import * as compositionRoutedStake from "./contracts/composition_routed_stake/composition_routed_stake.ts";
25
26
  import * as releaseRevenueDistributor from "./contracts/release_revenue_distributor/release_revenue_distributor.ts";
26
27
  import * as routedStake from "./contracts/routed_stake/routed_stake.ts";
@@ -150,8 +151,8 @@ export interface CustodyNewAdminCapParams {
150
151
  readonly owner: string | TransactionArgument;
151
152
  /** Optional installation/configuration while the new Vault is still owned. */
152
153
  readonly configure?: (
153
- vaultObject: TransactionArgument,
154
- vaultAdminCapObject: TransactionArgument,
154
+ vaultObject: TransactionObjectArgument,
155
+ vaultAdminCapObject: TransactionObjectArgument,
155
156
  ) => void;
156
157
  }
157
158
 
@@ -360,6 +361,23 @@ export function installRecordingRoyaltyPoolPlugin(
360
361
  );
361
362
  }
362
363
 
364
+ /** Install the Party wallet plugin; its canonical witness stays internal. */
365
+ export function installPartyWalletPlugin(
366
+ tx: Transaction,
367
+ params: {
368
+ readonly vault: TransactionObjectArgument;
369
+ readonly vaultAdminCap: TransactionObjectArgument;
370
+ readonly pluginPackageId: string;
371
+ },
372
+ ): void {
373
+ tx.add(
374
+ partyWallet.install({
375
+ package: params.pluginPackageId,
376
+ arguments: [params.vault, params.vaultAdminCap],
377
+ }),
378
+ );
379
+ }
380
+
363
381
  export function uninstallRecordingRoyaltyPoolPlugin(
364
382
  tx: Transaction,
365
383
  params: RecordingRoyaltyPoolPluginParams,