@misofm/sdk 0.12.3 → 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.
Files changed (67) hide show
  1. package/README.md +49 -2
  2. package/dist/contracts/miso_pressing/certificate.d.ts +1 -1
  3. package/dist/contracts/miso_pressing/certificate.d.ts.map +1 -1
  4. package/dist/contracts/miso_pressing/certificate.js +1 -1
  5. package/dist/contracts/miso_pressing/certificate.js.map +1 -1
  6. package/dist/contracts/miso_pressing/listing.d.ts +5 -5
  7. package/dist/contracts/miso_pressing/listing.js +5 -5
  8. package/dist/contracts/miso_pressing/pressing.d.ts +10 -10
  9. package/dist/contracts/miso_pressing/pressing.js +7 -7
  10. package/dist/contracts/routed_stake/deps/royalty_pool/stake.d.ts +6 -0
  11. package/dist/contracts/routed_stake/deps/royalty_pool/stake.d.ts.map +1 -1
  12. package/dist/contracts/routed_stake/deps/royalty_pool/stake.js +6 -0
  13. package/dist/contracts/routed_stake/deps/royalty_pool/stake.js.map +1 -1
  14. package/dist/cover.d.ts +2 -2
  15. package/dist/cover.d.ts.map +1 -1
  16. package/dist/cover.js +5 -2
  17. package/dist/cover.js.map +1 -1
  18. package/dist/credits.d.ts +9 -9
  19. package/dist/credits.d.ts.map +1 -1
  20. package/dist/credits.js +8 -5
  21. package/dist/credits.js.map +1 -1
  22. package/dist/execute.d.ts +13 -1
  23. package/dist/execute.d.ts.map +1 -1
  24. package/dist/execute.js +8 -2
  25. package/dist/execute.js.map +1 -1
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +1 -0
  29. package/dist/index.js.map +1 -1
  30. package/dist/pressing.d.ts +6 -6
  31. package/dist/pressing.js +4 -4
  32. package/dist/publication.d.ts +207 -0
  33. package/dist/publication.d.ts.map +1 -0
  34. package/dist/publication.js +666 -0
  35. package/dist/publication.js.map +1 -0
  36. package/dist/read/catalog.d.ts +3 -3
  37. package/dist/read/catalog.js +3 -3
  38. package/dist/read/receipts.d.ts +2 -2
  39. package/dist/read/receipts.js +2 -2
  40. package/dist/recording-extensions.d.ts +2 -2
  41. package/dist/recording-extensions.d.ts.map +1 -1
  42. package/dist/recording-extensions.js +8 -5
  43. package/dist/recording-extensions.js.map +1 -1
  44. package/dist/release-extensions.d.ts +2 -2
  45. package/dist/release-extensions.d.ts.map +1 -1
  46. package/dist/release-extensions.js +10 -7
  47. package/dist/release-extensions.js.map +1 -1
  48. package/dist/vault.d.ts +7 -1
  49. package/dist/vault.d.ts.map +1 -1
  50. package/dist/vault.js +8 -0
  51. package/dist/vault.js.map +1 -1
  52. package/package.json +6 -2
  53. package/src/contracts/miso_pressing/certificate.ts +1 -1
  54. package/src/contracts/miso_pressing/listing.ts +5 -5
  55. package/src/contracts/miso_pressing/pressing.ts +7 -7
  56. package/src/contracts/routed_stake/deps/royalty_pool/stake.ts +8 -2
  57. package/src/cover.ts +9 -4
  58. package/src/credits.ts +18 -14
  59. package/src/execute.ts +17 -4
  60. package/src/index.ts +1 -0
  61. package/src/pressing.ts +6 -6
  62. package/src/publication.ts +949 -0
  63. package/src/read/catalog.ts +3 -3
  64. package/src/read/receipts.ts +2 -2
  65. package/src/recording-extensions.ts +12 -8
  66. package/src/release-extensions.ts +14 -9
  67. package/src/vault.ts +20 -2
@@ -38,9 +38,9 @@
38
38
  * Nothing here is ever destroyed, sealed, or wound down — deleting a pressing
39
39
  * would strand its whole derived subtree, so there is no destructor at all. The
40
40
  * run's lifecycle is `Scheduled → Active → Paused → Active`: it opens itself at
41
- * its drop moment (no artist transaction, and nobody can buy early), and after
42
- * that the artist stops and starts it at will. The first transition is real, not
43
- * computed — the first sale past the start rewrites `Scheduled` to `Active` inside
41
+ * its scheduled start (no artist transaction, and nobody can buy early), then the
42
+ * artist stops and starts it at will. The first transition is real, not computed —
43
+ * the first sale past the start rewrites `Scheduled` to `Active` inside
44
44
  * `mint_next`, which is why `Scheduled` only ever describes a run still waiting.
45
45
  * Below it, each listing's `Enabled | Disabled` governs one currency. A run that
46
46
  * is paused or not yet open sells in no currency, whatever the listings say.
@@ -73,8 +73,8 @@ export const PressingKey = new MoveTuple({ name: `${$moduleName}::PressingKey`,
73
73
  export const PressingAdminCapKey = new MoveTuple({ name: `${$moduleName}::PressingAdminCapKey`, fields: [bcs.bool()] });
74
74
  /**
75
75
  * Whether the run sells, over every currency at once. The lifecycle runs
76
- * `Scheduled → Active → Paused → Active`: a pressing opens itself at its drop
77
- * moment, then the artist stops and starts it at will.
76
+ * `Scheduled → Active → Paused → Active`: a pressing opens itself at its scheduled
77
+ * start, then the artist stops and starts it at will.
78
78
  */
79
79
  export const PressingState = new MoveEnum({ name: `${$moduleName}::PressingState`, fields: {
80
80
  /**
@@ -85,7 +85,7 @@ export const PressingState = new MoveEnum({ name: `${$moduleName}::PressingState
85
85
  * `Active` (in `mint_next`, before any sales logic), so a run reads `Scheduled`
86
86
  * only while it is still waiting. Between the start and that first sale the run
87
87
  * already sells — `is_selling` answers against the clock — so nobody has to go
88
- * first for the drop to be open.
88
+ * first for the Pressing to be open.
89
89
  *
90
90
  * Consequence worth knowing: once the transition fires the start time is gone from
91
91
  * the object. `PressingOpenedEvent` and `PressingStateChangedEvent` carry it, so
@@ -190,7 +190,7 @@ export interface NewOptions {
190
190
  ];
191
191
  }
192
192
  /**
193
- * Open a release's pressing in `state` — `Scheduled` for a drop moment, `Active`
193
+ * Open a release's pressing in `state` — `Scheduled` for a future start, `Active`
194
194
  * to sell immediately, `Paused` to set it up quietly. Returns it unshared, so the
195
195
  * same transaction can list it (`listing::new`) before `share` puts it on chain,
196
196
  * plus the cap that governs it from here on. Neither value has `drop`, so neither
@@ -5,16 +5,22 @@
5
5
 
6
6
  /**
7
7
  * A position holding share tokens registered against a `RoyaltyPool`.
8
- *
8
+ *
9
9
  * Stakes are owned objects with an immutable balance — to increase a holder's
10
10
  * total staked amount, mint additional Stake objects rather than modify an
11
11
  * existing one. This mirrors Sui's native staking model.
12
- *
12
+ *
13
13
  * Each stake tracks the royalty pools it is currently registered with via an
14
14
  * inline `VecMap<TypeName, Registration>`, keyed by the pool's `Currency`
15
15
  * `TypeName`. The stake cannot be destroyed while any registrations remain. Pool
16
16
  * registrations are mutated by `royalty_pool::pool` through the package-private
17
17
  * accessors below.
18
+ *
19
+ * Custody warning: `pool::claim_rewards` pays accrued rewards to the _caller_, and
20
+ * `Stake` is `key + store` — a bare shared stake (or one wrapped in a shared
21
+ * object that hands out `&mut`) is drainable by anyone. Stakes must stay
22
+ * address-owned, or wrapped by a contract that pins the reward route (e.g.
23
+ * `routed_stake`); the pool cannot enforce this itself.
18
24
  */
19
25
 
20
26
  import { MoveStruct } from '../../../utils/index.js';
package/src/cover.ts CHANGED
@@ -17,8 +17,9 @@
17
17
  import type { ClientWithCoreApi } from "@mysten/sui/client";
18
18
  import { bcs } from "@mysten/sui/bcs";
19
19
  import { deriveDynamicFieldID } from "@mysten/sui/utils";
20
+ import type { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
20
21
  import type { TxThunk } from "./transactions.ts";
21
- import { asU64, directAdminCap, invokeWithAdminCap, type AdminCapAuthority, type U64Input } from "./vault.ts";
22
+ import { asU64, directAdminCap, invokeWithAdminCap, type AdminCapAuthority, type ObjectInput, type U64Input } from "./vault.ts";
22
23
  import { OPTION_NONE, OPTION_SOME } from "./internal.ts";
23
24
  import * as coverArt from "./contracts/cover_art/cover_art.ts";
24
25
  import * as releaseCoverArt from "./contracts/release_cover_art/release_cover_art.ts";
@@ -34,7 +35,7 @@ function releaseAuthorityOf(input: ReleaseAuthorityInput): AdminCapAuthority {
34
35
 
35
36
  interface SetReleaseCoverParamsBase {
36
37
  /** The `Release` object to attach the cover to. */
37
- releaseId: string;
38
+ releaseId: ObjectInput;
38
39
  /** Walrus blob id of the still cover image, as `u256` (decimal string or bigint). */
39
40
  stillBlobId: bigint | string;
40
41
  /** Optional animated-cover Walrus blob id (`u256`); omit for a still-only cover. */
@@ -46,6 +47,10 @@ interface SetReleaseCoverParamsBase {
46
47
  /** `ori` package (home of `walrus_data::new_blob` / the `WalrusData` type). */
47
48
  oriPackageId: string;
48
49
  }
50
+
51
+ function object(tx: Transaction, value: ObjectInput): TransactionObjectArgument {
52
+ return typeof value === "string" ? tx.object(value) : value;
53
+ }
49
54
  export type SetReleaseCoverParams = SetReleaseCoverParamsBase & ReleaseAuthorityInput;
50
55
 
51
56
  export type SetReleaseTrackCoverParams = SetReleaseCoverParams & {
@@ -85,7 +90,7 @@ export function setReleaseCover(p: SetReleaseCoverParams): TxThunk {
85
90
  const cover = buildCover(tx, p);
86
91
  invokeWithAdminCap(tx, releaseAuthorityOf(p), {
87
92
  target: `${p.releaseCoverArtPackageId}::release_cover_art::set_cover`,
88
- arguments: [tx.object(p.releaseId), cover],
93
+ arguments: [object(tx, p.releaseId), cover],
89
94
  adminCapIndex: 1,
90
95
  });
91
96
  };
@@ -97,7 +102,7 @@ export function setReleaseTrackCover(p: SetReleaseTrackCoverParams): TxThunk {
97
102
  const cover = buildCover(tx, p);
98
103
  invokeWithAdminCap(tx, releaseAuthorityOf(p), {
99
104
  target: `${p.releaseCoverArtPackageId}::release_cover_art::set_track_cover`,
100
- arguments: [tx.object(p.releaseId), tx.pure.u64(asU64("trackIndex", p.trackIndex)), cover],
105
+ arguments: [object(tx, p.releaseId), tx.pure.u64(asU64("trackIndex", p.trackIndex)), cover],
101
106
  adminCapIndex: 1,
102
107
  });
103
108
  };
package/src/credits.ts CHANGED
@@ -44,7 +44,11 @@ import * as recordingCredits from "./contracts/recording_credits/recording_credi
44
44
  import * as recordingPartyRole from "./contracts/recording_credits/recording_party_role.ts";
45
45
  import * as releaseCredits from "./contracts/release_credits/release_credits.ts";
46
46
  import * as releasePartyRole from "./contracts/release_credits/release_party_role.ts";
47
- import { directAdminCap, invokeWithAdminCap, type AdminCapAuthority } from "./vault.ts";
47
+ import { directAdminCap, invokeWithAdminCap, type AdminCapAuthority, type ObjectInput } from "./vault.ts";
48
+
49
+ function object(tx: Transaction, value: ObjectInput): TransactionObjectArgument {
50
+ return typeof value === "string" ? tx.object(value) : value;
51
+ }
48
52
 
49
53
  type CompositionAuthorityInput =
50
54
  | { readonly authority: AdminCapAuthority; readonly compositionAdminCapId?: never }
@@ -367,9 +371,9 @@ function buildCredit(
367
371
 
368
372
  interface AttachCompositionCreditParamsBase {
369
373
  /** The `Composition` object to credit on. */
370
- compositionId: string;
374
+ compositionId: ObjectInput;
371
375
  /** The `Party` being credited. */
372
- partyId: string;
376
+ partyId: ObjectInput;
373
377
  /** Human-readable name for the credit (≤200 bytes, non-empty). */
374
378
  displayName: string;
375
379
  /** 1–5 writing roles; duplicates are rejected on-chain. */
@@ -409,7 +413,7 @@ export function attachCompositionCredit(
409
413
  invokeWithAdminCap(tx, compositionAuthorityOf(p), {
410
414
  target: `${p.compositionCreditsPackageId}::composition_credits::add_credit`,
411
415
  typeArguments: [p.compositionShareType],
412
- arguments: [tx.object(p.compositionId), tx.object(p.partyId), credit],
416
+ arguments: [object(tx, p.compositionId), object(tx, p.partyId), credit],
413
417
  adminCapIndex: 1,
414
418
  });
415
419
  };
@@ -417,9 +421,9 @@ export function attachCompositionCredit(
417
421
 
418
422
  interface AttachRecordingCreditParamsBase {
419
423
  /** The `Recording` object to credit on. */
420
- recordingId: string;
424
+ recordingId: ObjectInput;
421
425
  /** The `Party` being credited. */
422
- partyId: string;
426
+ partyId: ObjectInput;
423
427
  /** Human-readable name for the credit (≤200 bytes, non-empty). */
424
428
  displayName: string;
425
429
  /** 1–10 production/performance roles; duplicates are rejected on-chain. */
@@ -460,7 +464,7 @@ export function attachRecordingCredit(p: AttachRecordingCreditParams): TxThunk {
460
464
  invokeWithAdminCap(tx, recordingAuthorityOf(p), {
461
465
  target: `${p.recordingCreditsPackageId}::recording_credits::add_credit`,
462
466
  typeArguments: [p.recordingShareType, p.compositionShareType],
463
- arguments: [tx.object(p.recordingId), tx.object(p.partyId), credit],
467
+ arguments: [object(tx, p.recordingId), object(tx, p.partyId), credit],
464
468
  adminCapIndex: 1,
465
469
  });
466
470
  };
@@ -468,9 +472,9 @@ export function attachRecordingCredit(p: AttachRecordingCreditParams): TxThunk {
468
472
 
469
473
  interface AddRecordingArtistParamsBase {
470
474
  /** The `Recording` object. */
471
- recordingId: string;
475
+ recordingId: ObjectInput;
472
476
  /** The `Party` to designate. Must already be credited on the recording. */
473
- partyId: string;
477
+ partyId: ObjectInput;
474
478
  /** The recording's own share coin type (the `RecordingShare` phantom). */
475
479
  recordingShareType: string;
476
480
  /** The parent composition's share coin type (the `CompositionShare` phantom). */
@@ -493,7 +497,7 @@ export function addRecordingPrimaryArtist(
493
497
  invokeWithAdminCap(tx, recordingAuthorityOf(p), {
494
498
  target: `${p.recordingCreditsPackageId}::recording_credits::add_primary_artist`,
495
499
  typeArguments: [p.recordingShareType, p.compositionShareType],
496
- arguments: [tx.object(p.recordingId), tx.object(p.partyId)],
500
+ arguments: [object(tx, p.recordingId), object(tx, p.partyId)],
497
501
  adminCapIndex: 1,
498
502
  });
499
503
  };
@@ -511,7 +515,7 @@ export function addRecordingFeaturedArtist(
511
515
  invokeWithAdminCap(tx, recordingAuthorityOf(p), {
512
516
  target: `${p.recordingCreditsPackageId}::recording_credits::add_featured_artist`,
513
517
  typeArguments: [p.recordingShareType, p.compositionShareType],
514
- arguments: [tx.object(p.recordingId), tx.object(p.partyId)],
518
+ arguments: [object(tx, p.recordingId), object(tx, p.partyId)],
515
519
  adminCapIndex: 1,
516
520
  });
517
521
  };
@@ -519,9 +523,9 @@ export function addRecordingFeaturedArtist(
519
523
 
520
524
  interface AddReleaseCreditParamsBase {
521
525
  /** The `Release` object to credit on. */
522
- releaseId: string;
526
+ releaseId: ObjectInput;
523
527
  /** The `Party` being credited. */
524
- partyId: string;
528
+ partyId: ObjectInput;
525
529
  /** Human-readable name for the credit (≤200 bytes, non-empty). */
526
530
  displayName: string;
527
531
  /** The single billing role: `"Primary"` or `"Featured"`. */
@@ -552,7 +556,7 @@ export function addReleaseCredit(p: AddReleaseCreditParams): TxThunk {
552
556
  );
553
557
  invokeWithAdminCap(tx, releaseAuthorityOf(p), {
554
558
  target: `${p.releaseCreditsPackageId}::release_credits::add_credit`,
555
- arguments: [tx.object(p.releaseId), tx.object(p.partyId), credit],
559
+ arguments: [object(tx, p.releaseId), object(tx, p.partyId), credit],
556
560
  adminCapIndex: 1,
557
561
  });
558
562
  };
package/src/execute.ts CHANGED
@@ -18,7 +18,14 @@ import type { TxThunk } from "./transactions.ts";
18
18
  // surface available through this platform-layer entry point as well.
19
19
  export * from "@misonetwork/sdk/execute";
20
20
 
21
- type FullInclude = typeof FULL_INCLUDE;
21
+ /** Publication execution also needs lifecycle events to associate same-typed
22
+ * objects (notably several new Parties and Vaults) with their manifest refs. */
23
+ export const PLATFORM_FULL_INCLUDE = { ...FULL_INCLUDE, events: true } as const;
24
+ type PlatformFullInclude = typeof PLATFORM_FULL_INCLUDE;
25
+
26
+ export interface PlatformExecResult extends ExecResult {
27
+ events: SuiClientTypes.Event[];
28
+ }
22
29
 
23
30
  /**
24
31
  * Builds a transaction from thunks and executes it through the parallel executor,
@@ -32,8 +39,14 @@ type FullInclude = typeof FULL_INCLUDE;
32
39
  * job (e.g. a resumable checkpoint that reconciles against on-chain state). A Move
33
40
  * abort RESOLVES as a `FailedTransaction`, so `toExecResult` surfaces it too.
34
41
  */
35
- export async function executeViaExecutor(executor: ParallelTransactionExecutor, ...thunks: TxThunk[]): Promise<ExecResult> {
42
+ export async function executeViaExecutor(
43
+ executor: ParallelTransactionExecutor,
44
+ ...thunks: TxThunk[]
45
+ ): Promise<PlatformExecResult> {
36
46
  const tx = await buildTx(...thunks);
37
- const res: SuiClientTypes.TransactionResult<FullInclude> = await executor.executeTransaction(tx, FULL_INCLUDE);
38
- return toExecResult(res);
47
+ const res: SuiClientTypes.TransactionResult<PlatformFullInclude> =
48
+ await executor.executeTransaction(tx, PLATFORM_FULL_INCLUDE);
49
+ const base = toExecResult(res);
50
+ if (res.$kind !== "Transaction") throw new Error("unreachable: toExecResult accepted a failed transaction");
51
+ return { ...base, events: res.Transaction.events ?? [] };
39
52
  }
package/src/index.ts CHANGED
@@ -44,6 +44,7 @@ export * from "./execute.ts";
44
44
  export * from "./share.ts";
45
45
  export * from "./share-template.ts";
46
46
  export * from "./release-graph.ts";
47
+ export * from "./publication.ts";
47
48
  export * from "./catalog.ts";
48
49
 
49
50
  // High-level, JSON-safe platform projections used directly by clients and by
package/src/pressing.ts CHANGED
@@ -181,8 +181,8 @@ export interface OpenPressingParams {
181
181
  /** Currencies to open the run in. May be empty — listings can be added later with
182
182
  * {@link openListing} — but a run with no listings sells nothing. */
183
183
  listings: ListingTerms[];
184
- /** Run state at open. Defaults to `active` (sell immediately); `scheduled` is the
185
- * trustless drop moment, and needs no later transaction to open. */
184
+ /** Run state at open. Defaults to `active` (sell immediately); `scheduled` sets a
185
+ * trustless opening time and needs no later transaction to open. */
186
186
  state?: PressingRunState;
187
187
  /** Where to send the minted `PressingAdminCap` (usually the artist or their vault). */
188
188
  adminCapRecipient: string;
@@ -518,10 +518,10 @@ function variant<T extends string>(
518
518
  /**
519
519
  * Fetches and parses a `Pressing`, or `null` if the release has never opened one.
520
520
  *
521
- * NOTE: like the old drop reader, this deliberately deviates from the core-getter
522
- * convention in `./queries.ts` (throw on missing object). A pressing's address is
523
- * computable for ANY release, so probing one that was never opened is a normal state,
524
- * not a broken reference — absence is `null` and only transport failures throw.
521
+ * This deliberately deviates from the core-getter convention in `./queries.ts`
522
+ * (throw on missing object). A Pressing's address is computable for any release, so
523
+ * probing one that was never opened is a normal state, not a broken reference —
524
+ * absence is `null` and only transport failures throw.
525
525
  */
526
526
  export async function getPressing(
527
527
  client: ClientWithCoreApi,