@misofm/musicos 0.1.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 (103) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +75 -0
  3. package/dist/client.d.ts +309 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +216 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/contracts/musicos/composition.d.ts +195 -0
  8. package/dist/contracts/musicos/composition.d.ts.map +1 -0
  9. package/dist/contracts/musicos/composition.js +195 -0
  10. package/dist/contracts/musicos/composition.js.map +1 -0
  11. package/dist/contracts/musicos/deps/bps/bps.d.ts +17 -0
  12. package/dist/contracts/musicos/deps/bps/bps.d.ts.map +1 -0
  13. package/dist/contracts/musicos/deps/bps/bps.js +19 -0
  14. package/dist/contracts/musicos/deps/bps/bps.js.map +1 -0
  15. package/dist/contracts/musicos/recording.d.ts +238 -0
  16. package/dist/contracts/musicos/recording.d.ts.map +1 -0
  17. package/dist/contracts/musicos/recording.js +232 -0
  18. package/dist/contracts/musicos/recording.js.map +1 -0
  19. package/dist/contracts/musicos/release.d.ts +298 -0
  20. package/dist/contracts/musicos/release.d.ts.map +1 -0
  21. package/dist/contracts/musicos/release.js +298 -0
  22. package/dist/contracts/musicos/release.js.map +1 -0
  23. package/dist/contracts/musicos/track.d.ts +193 -0
  24. package/dist/contracts/musicos/track.d.ts.map +1 -0
  25. package/dist/contracts/musicos/track.js +197 -0
  26. package/dist/contracts/musicos/track.js.map +1 -0
  27. package/dist/contracts/utils/index.d.ts +104 -0
  28. package/dist/contracts/utils/index.d.ts.map +1 -0
  29. package/dist/contracts/utils/index.js +272 -0
  30. package/dist/contracts/utils/index.js.map +1 -0
  31. package/dist/contracts.d.ts +9 -0
  32. package/dist/contracts.d.ts.map +1 -0
  33. package/dist/contracts.js +14 -0
  34. package/dist/contracts.js.map +1 -0
  35. package/dist/deployments.d.ts +60 -0
  36. package/dist/deployments.d.ts.map +1 -0
  37. package/dist/deployments.js +109 -0
  38. package/dist/deployments.js.map +1 -0
  39. package/dist/events.d.ts +16 -0
  40. package/dist/events.d.ts.map +1 -0
  41. package/dist/events.js +25 -0
  42. package/dist/events.js.map +1 -0
  43. package/dist/execute.d.ts +49 -0
  44. package/dist/execute.d.ts.map +1 -0
  45. package/dist/execute.js +110 -0
  46. package/dist/execute.js.map +1 -0
  47. package/dist/index.d.ts +13 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +20 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/internal.d.ts +17 -0
  52. package/dist/internal.d.ts.map +1 -0
  53. package/dist/internal.js +46 -0
  54. package/dist/internal.js.map +1 -0
  55. package/dist/numeric.d.ts +5 -0
  56. package/dist/numeric.d.ts.map +1 -0
  57. package/dist/numeric.js +21 -0
  58. package/dist/numeric.js.map +1 -0
  59. package/dist/packages.d.ts +67 -0
  60. package/dist/packages.d.ts.map +1 -0
  61. package/dist/packages.js +85 -0
  62. package/dist/packages.js.map +1 -0
  63. package/dist/parsers.d.ts +9 -0
  64. package/dist/parsers.d.ts.map +1 -0
  65. package/dist/parsers.js +40 -0
  66. package/dist/parsers.js.map +1 -0
  67. package/dist/queries.d.ts +178 -0
  68. package/dist/queries.d.ts.map +1 -0
  69. package/dist/queries.js +611 -0
  70. package/dist/queries.js.map +1 -0
  71. package/dist/transactions.d.ts +136 -0
  72. package/dist/transactions.d.ts.map +1 -0
  73. package/dist/transactions.js +145 -0
  74. package/dist/transactions.js.map +1 -0
  75. package/dist/types.d.ts +194 -0
  76. package/dist/types.d.ts.map +1 -0
  77. package/dist/types.js +4 -0
  78. package/dist/types.js.map +1 -0
  79. package/dist/view.d.ts +22 -0
  80. package/dist/view.d.ts.map +1 -0
  81. package/dist/view.js +42 -0
  82. package/dist/view.js.map +1 -0
  83. package/package.json +119 -0
  84. package/src/client.ts +341 -0
  85. package/src/contracts/musicos/composition.ts +280 -0
  86. package/src/contracts/musicos/deps/bps/bps.ts +22 -0
  87. package/src/contracts/musicos/recording.ts +308 -0
  88. package/src/contracts/musicos/release.ts +409 -0
  89. package/src/contracts/musicos/track.ts +255 -0
  90. package/src/contracts/utils/index.ts +428 -0
  91. package/src/contracts.ts +29 -0
  92. package/src/deployments.ts +166 -0
  93. package/src/events.ts +30 -0
  94. package/src/execute.ts +137 -0
  95. package/src/index.ts +21 -0
  96. package/src/internal.ts +78 -0
  97. package/src/numeric.ts +25 -0
  98. package/src/packages.ts +117 -0
  99. package/src/parsers.ts +66 -0
  100. package/src/queries.ts +928 -0
  101. package/src/transactions.ts +305 -0
  102. package/src/types.ts +222 -0
  103. package/src/view.ts +65 -0
@@ -0,0 +1,19 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Basis-points arithmetic with a newtype wrapper.
6
+ *
7
+ * 1 bps = 0.01%. 10_000 bps = 100%.
8
+ *
9
+ * Storage-optimal: `BPS` stores a `u16` (2 bytes), the tightest width that fits
10
+ * the `[0, 10_000]` range. Apply functions cover every standard integer width
11
+ * (`u8` through `u256`). Arithmetic on `u8`–`u128` widens to the next-larger type
12
+ * before multiplying. `u256` uses quotient/remainder decomposition and is total
13
+ * over its entire input domain.
14
+ */
15
+ import { MoveTuple } from '../../../utils/index.js';
16
+ import { bcs } from '@mysten/sui/bcs';
17
+ const $moduleName = 'bps::bps';
18
+ export const BPS = new MoveTuple({ name: `${$moduleName}::BPS`, fields: [bcs.u16()] });
19
+ //# sourceMappingURL=bps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bps.js","sourceRoot":"","sources":["../../../../../src/contracts/musicos/deps/bps/bps.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,WAAW,GAAG,UAAU,CAAC;AAC/B,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,GAAG,WAAW,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC"}
@@ -0,0 +1,238 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Represents an audio recording of a composition in musicos. Recordings are the
6
+ * audio performances that are distributed and played. Each recording has its own
7
+ * share token for ownership distribution.
8
+ *
9
+ * ### Key Features:
10
+ *
11
+ * - Share token initialization with fixed supply (10M tokens, 6 decimals)
12
+ * - State machine: Initialized -> Published (embedded fields immutable after
13
+ * publish; dynamic fields remain extensible via `uid_mut`, e.g. masters, and
14
+ * credits/attribution attached by the credits extension)
15
+ * - Deterministic addresses via derived object pattern
16
+ *
17
+ * Attribution (credits, primary/featured artists) is intentionally NOT part of
18
+ * core: it is display-oriented, varies across platforms, and is never read by the
19
+ * economics. It lives in a first-party credits extension attached via `uid_mut`,
20
+ * so core takes no dependency on an identity package and core publish enforces no
21
+ * attribution.
22
+ *
23
+ * A recording carries no name of its own. Its display title is its composition's
24
+ * title, read by reference — composition titles are immutable, so an embedded copy
25
+ * would carry no information. Anything that names this particular take — "(Live)",
26
+ * "Radio Edit", a translated title — has more than one correct rendering, which
27
+ * makes it presentation, and presentation lives in the metadata extension, never
28
+ * in the frozen core. Core stores what a recording _is_; extensions describe it.
29
+ *
30
+ * ### Lifecycle and trust model
31
+ *
32
+ * A recording is `key`-only with no `drop`: a fresh `Initialized` object cannot be
33
+ * transferred, wrapped, publicly shared, or discarded, and its only by-value
34
+ * consumer is `publish`. Create-and-publish is therefore atomic by construction —
35
+ * an `Initialized` recording cannot outlive its creating transaction, and every
36
+ * recording that exists on-chain is `Published` and shared. There is deliberately
37
+ * no keep function; staged building must fit one transaction.
38
+ *
39
+ * `uid_mut` works in any lifecycle state and is permanent root over ALL dynamic
40
+ * fields on the object — including fields attached by other extensions. "Immutable
41
+ * after publish" covers the embedded fields only; extension-layer data stays
42
+ * admin-mutable in perpetuity. This is the designed extension surface, and it is
43
+ * the one trust assumption that never expires: integrators should model the cap
44
+ * holder as able to mutate or delete any extension data, forever.
45
+ *
46
+ * The recording carries its parent composition's identity two ways. The
47
+ * `CompositionShare` phantom type parameter is the durable identity (a share
48
+ * currency is published independently of musicos and survives a fresh republish,
49
+ * whereas an object ID does not) and makes the recording↔composition lineage
50
+ * compile-time enforced wherever the two meet. The embedded `composition_id` is
51
+ * the address-level handle: Move cannot chase a type (or an ID) to an object, so
52
+ * on-chain consumers holding only `&Recording` — or a bare `Track` — could not
53
+ * otherwise reach the composition at all. Both are set at creation and immutable,
54
+ * so they cannot diverge.
55
+ *
56
+ * A recording is its own freshly-created object (`object::new`), not a derived
57
+ * child of its composition: `recording::new` takes a read-only `&Composition`
58
+ * (only to read its royalty rate and id), so publishing recordings under a
59
+ * composition neither contends on the composition's shared-object version nor
60
+ * collides on a per-composition index.
61
+ */
62
+ import { MoveEnum, MoveStruct, MoveTuple, type RawTransactionArgument } from '../utils/index.ts';
63
+ import { type Transaction } from '@mysten/sui/transactions';
64
+ /** Lifecycle state of a recording. */
65
+ export declare const RecordingState: MoveEnum<{
66
+ /** Recording is being set up and can be modified. */
67
+ Initialized: null;
68
+ /** Recording is published and immutable. Includes publication timestamp. */
69
+ Published: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
70
+ }, "@local-pkg/musicos::recording::RecordingState">;
71
+ export declare const Recording: MoveStruct<{
72
+ /** Unique identifier for this recording. */
73
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
74
+ /** Current lifecycle state. */
75
+ state: MoveEnum<{
76
+ /** Recording is being set up and can be modified. */
77
+ Initialized: null;
78
+ /** Recording is published and immutable. Includes publication timestamp. */
79
+ Published: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
80
+ }, "@local-pkg/musicos::recording::RecordingState">;
81
+ /**
82
+ * Object ID of the parent composition. The address-level counterpart of the
83
+ * `CompositionShare` phantom, set from the `&Composition` passed to `new` (the
84
+ * shared phantom proves the pairing). An identity handle — not a revenue routing
85
+ * target: the composition is paid through its recording-share ownership, settled
86
+ * at creation.
87
+ */
88
+ composition_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
89
+ }, "@local-pkg/musicos::recording::Recording<phantom RecordingShare, phantom CompositionShare>">;
90
+ export declare const RecordingAdminCap: MoveStruct<{
91
+ /** Unique identifier for this capability. */
92
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
93
+ }, "@local-pkg/musicos::recording::RecordingAdminCap<phantom RecordingShare>">;
94
+ export declare const RecordingAdminCapKey: MoveTuple<readonly [import("@mysten/bcs").BcsType<boolean, boolean, "bool">], "@local-pkg/musicos::recording::RecordingAdminCapKey">;
95
+ export declare const RecordingPublishedEvent: MoveStruct<{
96
+ recording_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
97
+ }, "@local-pkg/musicos::recording::RecordingPublishedEvent<phantom RecordingShare, phantom CompositionShare>">;
98
+ export declare const CompositionSharesGrantedEvent: MoveStruct<{
99
+ recording_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
100
+ composition_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
101
+ /** Recording-share base units granted to the composition. */
102
+ value: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
103
+ /** The composition royalty rate applied at creation, in basis points. */
104
+ rate_bps: import("@mysten/bcs").BcsType<number, number, "u16">;
105
+ granted_by: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
106
+ }, "@local-pkg/musicos::recording::CompositionSharesGrantedEvent<phantom RecordingShare, phantom CompositionShare>">;
107
+ export interface NewArguments {
108
+ composition: RawTransactionArgument<string>;
109
+ shareCurrency: RawTransactionArgument<string>;
110
+ shareTreasuryCap: RawTransactionArgument<string>;
111
+ }
112
+ export interface NewOptions {
113
+ package?: string;
114
+ arguments: NewArguments | [
115
+ composition: RawTransactionArgument<string>,
116
+ shareCurrency: RawTransactionArgument<string>,
117
+ shareTreasuryCap: RawTransactionArgument<string>
118
+ ];
119
+ typeArguments: [
120
+ string,
121
+ string
122
+ ];
123
+ }
124
+ /**
125
+ * Creates a new recording for a composition.
126
+ *
127
+ * Initializes share tokens (10M supply, 6 decimals), then splits the composition's
128
+ * royalty-rate worth of those shares off the freshly minted supply and
129
+ * `send_funds`es them to the composition's address. This settles the composition's
130
+ * cut as cap-table ownership: the composition literally owns its share of the
131
+ * recording, so its claim on recording revenue is enforced by share ownership
132
+ * rather than by any revenue distributor choosing to honor a rate. What the
133
+ * composition owner then does with the shares (hold, stake, sell) is outside the
134
+ * protocol's scope.
135
+ *
136
+ * The composition's royalty rate is immutable, so the rate a recorder's client
137
+ * displayed is exactly the rate applied here — no slippage protection is needed or
138
+ * possible. Whether that rate is acceptable is the recorder's decision to make
139
+ * before calling; per-deal deviations settle as voluntary share transfers after
140
+ * creation.
141
+ *
142
+ * The composition need not be `Published`: within the composition's own creating
143
+ * transaction its creator can already mint recordings against it. Third parties
144
+ * only ever see `Published`, shared compositions (an `Initialized` one cannot
145
+ * escape its creating transaction), so indexers may observe a recording created
146
+ * "against an unpublished composition" only as an intra-transaction ordering,
147
+ * never across transactions.
148
+ *
149
+ * Returns:
150
+ *
151
+ * - The recording object (typed to its parent composition's `CompositionShare`)
152
+ * - Admin capability for the owner
153
+ * - The creator's remaining share balance (full supply minus the composition's
154
+ * cut)
155
+ */
156
+ export declare function _new(options: NewOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
157
+ export interface PublishArguments {
158
+ self: RawTransactionArgument<string>;
159
+ _: RawTransactionArgument<string>;
160
+ }
161
+ export interface PublishOptions {
162
+ package?: string;
163
+ arguments: PublishArguments | [
164
+ self: RawTransactionArgument<string>,
165
+ _: RawTransactionArgument<string>
166
+ ];
167
+ typeArguments: [
168
+ string,
169
+ string
170
+ ];
171
+ }
172
+ /**
173
+ * Publishes the recording, making its embedded fields immutable. Required State:
174
+ * Initialized
175
+ *
176
+ * Note: core enforces no attribution requirement — credits live in the credits
177
+ * extension and may be attached before or after publish via `uid_mut`.
178
+ */
179
+ export declare function publish(options: PublishOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
180
+ export interface CompositionIdArguments {
181
+ self: RawTransactionArgument<string>;
182
+ }
183
+ export interface CompositionIdOptions {
184
+ package?: string;
185
+ arguments: CompositionIdArguments | [
186
+ self: RawTransactionArgument<string>
187
+ ];
188
+ typeArguments: [
189
+ string,
190
+ string
191
+ ];
192
+ }
193
+ /**
194
+ * Returns the object ID of the parent composition. An identity/membership handle
195
+ * (the address-level counterpart of the `CompositionShare` phantom) — not a
196
+ * revenue routing target: the composition is paid via its recording-share
197
+ * ownership.
198
+ */
199
+ export declare function compositionId(options: CompositionIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
200
+ export interface UidArguments {
201
+ self: RawTransactionArgument<string>;
202
+ }
203
+ export interface UidOptions {
204
+ package?: string;
205
+ arguments: UidArguments | [
206
+ self: RawTransactionArgument<string>
207
+ ];
208
+ typeArguments: [
209
+ string,
210
+ string
211
+ ];
212
+ }
213
+ /** Returns a reference to the recording's UID for reading dynamic fields. */
214
+ export declare function uid(options: UidOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
215
+ export interface UidMutArguments {
216
+ self: RawTransactionArgument<string>;
217
+ _: RawTransactionArgument<string>;
218
+ }
219
+ export interface UidMutOptions {
220
+ package?: string;
221
+ arguments: UidMutArguments | [
222
+ self: RawTransactionArgument<string>,
223
+ _: RawTransactionArgument<string>
224
+ ];
225
+ typeArguments: [
226
+ string,
227
+ string
228
+ ];
229
+ }
230
+ /**
231
+ * Returns a mutable reference to the recording's UID. Requires the admin
232
+ * capability. Works in any lifecycle state — dynamic fields are the extension
233
+ * surface (e.g. masters, credits) and stay admin-mutable after publish; only the
234
+ * embedded fields are frozen. The reference is root over every dynamic field on
235
+ * the object, including fields attached by other extensions.
236
+ */
237
+ export declare function uidMut(options: UidMutOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
238
+ //# sourceMappingURL=recording.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recording.d.ts","sourceRoot":"","sources":["../../../src/contracts/musicos/recording.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAA0B,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGzH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,sCAAsC;AACtC,eAAO,MAAM,cAAc;IACnB,qDAAqD;;IAErD,4EAA4E;;mDAE5E,CAAC;AACT,eAAO,MAAM,SAAS;IACd,4CAA4C;;IAE5C,+BAA+B;;QAR/B,qDAAqD;;QAErD,4EAA4E;;;IAQ5E;;;;;;OAMG;;gGAEH,CAAC;AACT,eAAO,MAAM,iBAAiB;IACtB,6CAA6C;;8EAE7C,CAAC;AACT,eAAO,MAAM,oBAAoB,sIAAwF,CAAC;AAC1H,eAAO,MAAM,uBAAuB;;8GAE5B,CAAC;AACT,eAAO,MAAM,6BAA6B;;;IAGlC,6DAA6D;;IAE7D,yEAAyE;;;oHAGzE,CAAC;AACT,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC5C,aAAa,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC9C,gBAAgB,EAAE,s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AAC,OAAO,EAAE,oBAAoB,QAM3C,WAAW,0DAO1B;AACD,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;CACxC;AACD,MAAM,WAAW,UAAU;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,YAAY,GAAG;QACtB,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACvC,CAAC;IACF,aAAa,EAAE;QACX,MAAM;QACN,MAAM;KACT,CAAC;CACL;AACD,6EAA6E;AAC7E,wBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,QAMvB,WAAW,0DAO1B;AACD,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;CACrC;AACD,MAAM,WAAW,aAAa;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,GAAG;QACzB,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;QACpC,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACpC,CAAC;IACF,aAAa,EAAE;QACX,MAAM;QACN,MAAM;KACT,CAAC;CACL;AACD;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,QAO7B,WAAW,0DAO1B"}
@@ -0,0 +1,232 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Represents an audio recording of a composition in musicos. Recordings are the
6
+ * audio performances that are distributed and played. Each recording has its own
7
+ * share token for ownership distribution.
8
+ *
9
+ * ### Key Features:
10
+ *
11
+ * - Share token initialization with fixed supply (10M tokens, 6 decimals)
12
+ * - State machine: Initialized -> Published (embedded fields immutable after
13
+ * publish; dynamic fields remain extensible via `uid_mut`, e.g. masters, and
14
+ * credits/attribution attached by the credits extension)
15
+ * - Deterministic addresses via derived object pattern
16
+ *
17
+ * Attribution (credits, primary/featured artists) is intentionally NOT part of
18
+ * core: it is display-oriented, varies across platforms, and is never read by the
19
+ * economics. It lives in a first-party credits extension attached via `uid_mut`,
20
+ * so core takes no dependency on an identity package and core publish enforces no
21
+ * attribution.
22
+ *
23
+ * A recording carries no name of its own. Its display title is its composition's
24
+ * title, read by reference — composition titles are immutable, so an embedded copy
25
+ * would carry no information. Anything that names this particular take — "(Live)",
26
+ * "Radio Edit", a translated title — has more than one correct rendering, which
27
+ * makes it presentation, and presentation lives in the metadata extension, never
28
+ * in the frozen core. Core stores what a recording _is_; extensions describe it.
29
+ *
30
+ * ### Lifecycle and trust model
31
+ *
32
+ * A recording is `key`-only with no `drop`: a fresh `Initialized` object cannot be
33
+ * transferred, wrapped, publicly shared, or discarded, and its only by-value
34
+ * consumer is `publish`. Create-and-publish is therefore atomic by construction —
35
+ * an `Initialized` recording cannot outlive its creating transaction, and every
36
+ * recording that exists on-chain is `Published` and shared. There is deliberately
37
+ * no keep function; staged building must fit one transaction.
38
+ *
39
+ * `uid_mut` works in any lifecycle state and is permanent root over ALL dynamic
40
+ * fields on the object — including fields attached by other extensions. "Immutable
41
+ * after publish" covers the embedded fields only; extension-layer data stays
42
+ * admin-mutable in perpetuity. This is the designed extension surface, and it is
43
+ * the one trust assumption that never expires: integrators should model the cap
44
+ * holder as able to mutate or delete any extension data, forever.
45
+ *
46
+ * The recording carries its parent composition's identity two ways. The
47
+ * `CompositionShare` phantom type parameter is the durable identity (a share
48
+ * currency is published independently of musicos and survives a fresh republish,
49
+ * whereas an object ID does not) and makes the recording↔composition lineage
50
+ * compile-time enforced wherever the two meet. The embedded `composition_id` is
51
+ * the address-level handle: Move cannot chase a type (or an ID) to an object, so
52
+ * on-chain consumers holding only `&Recording` — or a bare `Track` — could not
53
+ * otherwise reach the composition at all. Both are set at creation and immutable,
54
+ * so they cannot diverge.
55
+ *
56
+ * A recording is its own freshly-created object (`object::new`), not a derived
57
+ * child of its composition: `recording::new` takes a read-only `&Composition`
58
+ * (only to read its royalty rate and id), so publishing recordings under a
59
+ * composition neither contends on the composition's shared-object version nor
60
+ * collides on a per-composition index.
61
+ */
62
+ import { MoveEnum, MoveStruct, MoveTuple, normalizeMoveArguments } from '../utils/index.js';
63
+ import { bcs } from '@mysten/sui/bcs';
64
+ import {} from '@mysten/sui/transactions';
65
+ const $moduleName = '@local-pkg/musicos::recording';
66
+ /** Lifecycle state of a recording. */
67
+ export const RecordingState = new MoveEnum({ name: `${$moduleName}::RecordingState`, fields: {
68
+ /** Recording is being set up and can be modified. */
69
+ Initialized: null,
70
+ /** Recording is published and immutable. Includes publication timestamp. */
71
+ Published: bcs.u64()
72
+ } });
73
+ export const Recording = new MoveStruct({ name: `${$moduleName}::Recording<phantom RecordingShare, phantom CompositionShare>`, fields: {
74
+ /** Unique identifier for this recording. */
75
+ id: bcs.Address,
76
+ /** Current lifecycle state. */
77
+ state: RecordingState,
78
+ /**
79
+ * Object ID of the parent composition. The address-level counterpart of the
80
+ * `CompositionShare` phantom, set from the `&Composition` passed to `new` (the
81
+ * shared phantom proves the pairing). An identity handle — not a revenue routing
82
+ * target: the composition is paid through its recording-share ownership, settled
83
+ * at creation.
84
+ */
85
+ composition_id: bcs.Address
86
+ } });
87
+ export const RecordingAdminCap = new MoveStruct({ name: `${$moduleName}::RecordingAdminCap<phantom RecordingShare>`, fields: {
88
+ /** Unique identifier for this capability. */
89
+ id: bcs.Address
90
+ } });
91
+ export const RecordingAdminCapKey = new MoveTuple({ name: `${$moduleName}::RecordingAdminCapKey`, fields: [bcs.bool()] });
92
+ export const RecordingPublishedEvent = new MoveStruct({ name: `${$moduleName}::RecordingPublishedEvent<phantom RecordingShare, phantom CompositionShare>`, fields: {
93
+ recording_id: bcs.Address
94
+ } });
95
+ export const CompositionSharesGrantedEvent = new MoveStruct({ name: `${$moduleName}::CompositionSharesGrantedEvent<phantom RecordingShare, phantom CompositionShare>`, fields: {
96
+ recording_id: bcs.Address,
97
+ composition_id: bcs.Address,
98
+ /** Recording-share base units granted to the composition. */
99
+ value: bcs.u64(),
100
+ /** The composition royalty rate applied at creation, in basis points. */
101
+ rate_bps: bcs.u16(),
102
+ granted_by: bcs.Address
103
+ } });
104
+ /**
105
+ * Creates a new recording for a composition.
106
+ *
107
+ * Initializes share tokens (10M supply, 6 decimals), then splits the composition's
108
+ * royalty-rate worth of those shares off the freshly minted supply and
109
+ * `send_funds`es them to the composition's address. This settles the composition's
110
+ * cut as cap-table ownership: the composition literally owns its share of the
111
+ * recording, so its claim on recording revenue is enforced by share ownership
112
+ * rather than by any revenue distributor choosing to honor a rate. What the
113
+ * composition owner then does with the shares (hold, stake, sell) is outside the
114
+ * protocol's scope.
115
+ *
116
+ * The composition's royalty rate is immutable, so the rate a recorder's client
117
+ * displayed is exactly the rate applied here — no slippage protection is needed or
118
+ * possible. Whether that rate is acceptable is the recorder's decision to make
119
+ * before calling; per-deal deviations settle as voluntary share transfers after
120
+ * creation.
121
+ *
122
+ * The composition need not be `Published`: within the composition's own creating
123
+ * transaction its creator can already mint recordings against it. Third parties
124
+ * only ever see `Published`, shared compositions (an `Initialized` one cannot
125
+ * escape its creating transaction), so indexers may observe a recording created
126
+ * "against an unpublished composition" only as an intra-transaction ordering,
127
+ * never across transactions.
128
+ *
129
+ * Returns:
130
+ *
131
+ * - The recording object (typed to its parent composition's `CompositionShare`)
132
+ * - Admin capability for the owner
133
+ * - The creator's remaining share balance (full supply minus the composition's
134
+ * cut)
135
+ */
136
+ export function _new(options) {
137
+ const packageAddress = options.package ?? '@local-pkg/musicos';
138
+ const argumentsTypes = [
139
+ null,
140
+ null,
141
+ null
142
+ ];
143
+ const parameterNames = ["composition", "shareCurrency", "shareTreasuryCap"];
144
+ return (tx) => tx.moveCall({
145
+ package: packageAddress,
146
+ module: 'recording',
147
+ function: 'new',
148
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
149
+ typeArguments: options.typeArguments
150
+ });
151
+ }
152
+ /**
153
+ * Publishes the recording, making its embedded fields immutable. Required State:
154
+ * Initialized
155
+ *
156
+ * Note: core enforces no attribution requirement — credits live in the credits
157
+ * extension and may be attached before or after publish via `uid_mut`.
158
+ */
159
+ export function publish(options) {
160
+ const packageAddress = options.package ?? '@local-pkg/musicos';
161
+ const argumentsTypes = [
162
+ null,
163
+ null,
164
+ '0x2::clock::Clock'
165
+ ];
166
+ const parameterNames = ["self", "_"];
167
+ return (tx) => tx.moveCall({
168
+ package: packageAddress,
169
+ module: 'recording',
170
+ function: 'publish',
171
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
172
+ typeArguments: options.typeArguments
173
+ });
174
+ }
175
+ /**
176
+ * Returns the object ID of the parent composition. An identity/membership handle
177
+ * (the address-level counterpart of the `CompositionShare` phantom) — not a
178
+ * revenue routing target: the composition is paid via its recording-share
179
+ * ownership.
180
+ */
181
+ export function compositionId(options) {
182
+ const packageAddress = options.package ?? '@local-pkg/musicos';
183
+ const argumentsTypes = [
184
+ null
185
+ ];
186
+ const parameterNames = ["self"];
187
+ return (tx) => tx.moveCall({
188
+ package: packageAddress,
189
+ module: 'recording',
190
+ function: 'composition_id',
191
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
192
+ typeArguments: options.typeArguments
193
+ });
194
+ }
195
+ /** Returns a reference to the recording's UID for reading dynamic fields. */
196
+ export function uid(options) {
197
+ const packageAddress = options.package ?? '@local-pkg/musicos';
198
+ const argumentsTypes = [
199
+ null
200
+ ];
201
+ const parameterNames = ["self"];
202
+ return (tx) => tx.moveCall({
203
+ package: packageAddress,
204
+ module: 'recording',
205
+ function: 'uid',
206
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
207
+ typeArguments: options.typeArguments
208
+ });
209
+ }
210
+ /**
211
+ * Returns a mutable reference to the recording's UID. Requires the admin
212
+ * capability. Works in any lifecycle state — dynamic fields are the extension
213
+ * surface (e.g. masters, credits) and stay admin-mutable after publish; only the
214
+ * embedded fields are frozen. The reference is root over every dynamic field on
215
+ * the object, including fields attached by other extensions.
216
+ */
217
+ export function uidMut(options) {
218
+ const packageAddress = options.package ?? '@local-pkg/musicos';
219
+ const argumentsTypes = [
220
+ null,
221
+ null
222
+ ];
223
+ const parameterNames = ["self", "_"];
224
+ return (tx) => tx.moveCall({
225
+ package: packageAddress,
226
+ module: 'recording',
227
+ function: 'uid_mut',
228
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
229
+ typeArguments: options.typeArguments
230
+ });
231
+ }
232
+ //# sourceMappingURL=recording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recording.js","sourceRoot":"","sources":["../../../src/contracts/musicos/recording.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,sBAAsB,EAA+B,MAAM,mBAAmB,CAAC;AACzH,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAoB,MAAM,0BAA0B,CAAC;AAC5D,MAAM,WAAW,GAAG,+BAA+B,CAAC;AACpD,sCAAsC;AACtC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,WAAW,kBAAkB,EAAE,MAAM,EAAE;QACrF,qDAAqD;QACrD,WAAW,EAAE,IAAI;QACjB,4EAA4E;QAC5E,SAAS,EAAE,GAAG,CAAC,GAAG,EAAE;KACvB,EAAE,CAAC,CAAC;AACT,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,WAAW,+DAA+D,EAAE,MAAM,EAAE;QAC/H,4CAA4C;QAC5C,EAAE,EAAE,GAAG,CAAC,OAAO;QACf,+BAA+B;QAC/B,KAAK,EAAE,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