@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.
- package/README.md +49 -2
- package/dist/contracts/miso_pressing/certificate.d.ts +1 -1
- package/dist/contracts/miso_pressing/certificate.d.ts.map +1 -1
- package/dist/contracts/miso_pressing/certificate.js +1 -1
- package/dist/contracts/miso_pressing/certificate.js.map +1 -1
- package/dist/contracts/miso_pressing/listing.d.ts +5 -5
- package/dist/contracts/miso_pressing/listing.js +5 -5
- package/dist/contracts/miso_pressing/pressing.d.ts +10 -10
- package/dist/contracts/miso_pressing/pressing.js +7 -7
- package/dist/contracts/routed_stake/deps/royalty_pool/stake.d.ts +6 -0
- package/dist/contracts/routed_stake/deps/royalty_pool/stake.d.ts.map +1 -1
- package/dist/contracts/routed_stake/deps/royalty_pool/stake.js +6 -0
- package/dist/contracts/routed_stake/deps/royalty_pool/stake.js.map +1 -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/pressing.d.ts +6 -6
- package/dist/pressing.js +4 -4
- 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/read/catalog.d.ts +3 -3
- package/dist/read/catalog.js +3 -3
- package/dist/read/receipts.d.ts +2 -2
- package/dist/read/receipts.js +2 -2
- 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 +6 -2
- package/src/contracts/miso_pressing/certificate.ts +1 -1
- package/src/contracts/miso_pressing/listing.ts +5 -5
- package/src/contracts/miso_pressing/pressing.ts +7 -7
- package/src/contracts/routed_stake/deps/royalty_pool/stake.ts +8 -2
- 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/pressing.ts +6 -6
- package/src/publication.ts +949 -0
- package/src/read/catalog.ts +3 -3
- package/src/read/receipts.ts +2 -2
- package/src/recording-extensions.ts +12 -8
- package/src/release-extensions.ts +14 -9
- 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
|
|
42
|
-
*
|
|
43
|
-
*
|
|
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
|
|
77
|
-
*
|
|
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
|
|
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
|
|
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:
|
|
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: [
|
|
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: [
|
|
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:
|
|
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
|
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`
|
|
185
|
-
* trustless
|
|
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
|
-
*
|
|
522
|
-
*
|
|
523
|
-
*
|
|
524
|
-
*
|
|
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,
|