@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.
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