@misofm/sdk 0.12.4 → 0.13.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.
@@ -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/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,