@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/README.md +48 -1
- package/dist/cover.d.ts +2 -2
- package/dist/cover.d.ts.map +1 -1
- package/dist/cover.js +5 -2
- package/dist/cover.js.map +1 -1
- package/dist/credits.d.ts +9 -9
- package/dist/credits.d.ts.map +1 -1
- package/dist/credits.js +8 -5
- package/dist/credits.js.map +1 -1
- package/dist/execute.d.ts +13 -1
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +8 -2
- package/dist/execute.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/publication.d.ts +207 -0
- package/dist/publication.d.ts.map +1 -0
- package/dist/publication.js +666 -0
- package/dist/publication.js.map +1 -0
- package/dist/recording-extensions.d.ts +2 -2
- package/dist/recording-extensions.d.ts.map +1 -1
- package/dist/recording-extensions.js +8 -5
- package/dist/recording-extensions.js.map +1 -1
- package/dist/release-extensions.d.ts +2 -2
- package/dist/release-extensions.d.ts.map +1 -1
- package/dist/release-extensions.js +10 -7
- package/dist/release-extensions.js.map +1 -1
- package/dist/vault.d.ts +7 -1
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +8 -0
- package/dist/vault.js.map +1 -1
- package/package.json +5 -1
- package/src/cover.ts +9 -4
- package/src/credits.ts +18 -14
- package/src/execute.ts +17 -4
- package/src/index.ts +1 -0
- package/src/publication.ts +949 -0
- package/src/recording-extensions.ts +12 -8
- package/src/release-extensions.ts +14 -9
- package/src/vault.ts +20 -2
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:
|
|
374
|
+
compositionId: ObjectInput;
|
|
371
375
|
/** The `Party` being credited. */
|
|
372
|
-
partyId:
|
|
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: [
|
|
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:
|
|
424
|
+
recordingId: ObjectInput;
|
|
421
425
|
/** The `Party` being credited. */
|
|
422
|
-
partyId:
|
|
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: [
|
|
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:
|
|
475
|
+
recordingId: ObjectInput;
|
|
472
476
|
/** The `Party` to designate. Must already be credited on the recording. */
|
|
473
|
-
partyId:
|
|
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: [
|
|
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: [
|
|
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:
|
|
526
|
+
releaseId: ObjectInput;
|
|
523
527
|
/** The `Party` being credited. */
|
|
524
|
-
partyId:
|
|
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: [
|
|
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
|
-
|
|
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(
|
|
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<
|
|
38
|
-
|
|
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
|