@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
package/dist/client.js ADDED
@@ -0,0 +1,216 @@
1
+ // Copyright (c) Miso Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { getMisoDeployment, normalizeMisoDeployment, normalizeMisoProtocolDeployment, protocolDeployment, } from "./deployments.js";
4
+ import { bindModulePackage, MisoPackageBindings, REF_RETURNING_CALLS } from "./packages.js";
5
+ import * as parsers from "./parsers.js";
6
+ import { eventParsers } from "./events.js";
7
+ import * as queries from "./queries.js";
8
+ import * as view from "./view.js";
9
+ // Generated call modules (type-safe Move calls) and BCS structs.
10
+ import * as composition from "./contracts/musicos/composition.js";
11
+ import * as recording from "./contracts/musicos/recording.js";
12
+ import * as release from "./contracts/musicos/release.js";
13
+ import * as track from "./contracts/musicos/track.js";
14
+ function isFullDeployment(deployment) {
15
+ return "musicos" in deployment;
16
+ }
17
+ /**
18
+ * Creates a Miso client extension for use with `$extend()`.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const client = new SuiGrpcClient({ network: 'testnet' })
23
+ * .$extend(miso());
24
+ * const composition = await client.miso.getCompositionById('0x...');
25
+ * ```
26
+ */
27
+ export function miso(options = {}) {
28
+ const name = (options.name ?? "miso");
29
+ return {
30
+ name,
31
+ register: (client) => {
32
+ const supplied = options.deployment;
33
+ const packageDeployment = supplied && isFullDeployment(supplied)
34
+ ? normalizeMisoDeployment(supplied)
35
+ : !supplied && !options.misoPackageId
36
+ ? getMisoDeployment(client.network)
37
+ : undefined;
38
+ const deployment = supplied
39
+ ? isFullDeployment(supplied)
40
+ ? protocolDeployment(packageDeployment)
41
+ : normalizeMisoProtocolDeployment(supplied)
42
+ : options.misoPackageId
43
+ ? normalizeMisoProtocolDeployment({ packageId: options.misoPackageId })
44
+ : protocolDeployment(packageDeployment);
45
+ return new MisoProtocolClient(client, {
46
+ deployment,
47
+ packageDeployment,
48
+ graphqlClient: options.graphqlClient,
49
+ });
50
+ },
51
+ };
52
+ }
53
+ export class MisoProtocolClient {
54
+ #client;
55
+ #graphqlClient;
56
+ #deployment;
57
+ #packageDeployment;
58
+ constructor(client, options) {
59
+ this.#client = client;
60
+ this.#graphqlClient = options.graphqlClient;
61
+ this.#deployment = normalizeMisoProtocolDeployment(options.deployment);
62
+ this.#packageDeployment = options.packageDeployment
63
+ ? normalizeMisoDeployment(options.packageDeployment)
64
+ : undefined;
65
+ }
66
+ /** The exact deployment selected for this client. */
67
+ get deployment() {
68
+ return this.#deployment;
69
+ }
70
+ /**
71
+ * Complete package-bound calls and BCS codecs, available only when `miso()`
72
+ * was given a full fresh deployment manifest.
73
+ */
74
+ get packages() {
75
+ if (!this.#packageDeployment) {
76
+ throw new Error("@misofm/musicos: full package bindings require a complete MisoDeployment. " +
77
+ "Pass the verified post-publish manifest to miso({ deployment }).");
78
+ }
79
+ return new MisoPackageBindings(this.#packageDeployment);
80
+ }
81
+ get #misoPackageId() {
82
+ return this.#deployment.packageId;
83
+ }
84
+ // === Composition ===
85
+ async getCompositionById(compositionId) {
86
+ return queries.getCompositionById(this.#client, compositionId);
87
+ }
88
+ async getCompositionsByIds(ids) {
89
+ return queries.getCompositionsByIds(this.#client, ids);
90
+ }
91
+ async getWorksByIds(ids) {
92
+ return queries.getWorksByIds(this.#client, ids);
93
+ }
94
+ async getWorkAddressesByShareTypes(shareTypes) {
95
+ return queries.getWorkAddressesByShareTypes(this.#requireGraphQL(), shareTypes, this.#misoPackageId);
96
+ }
97
+ async getCompositionShareType(compositionId) {
98
+ return queries.getCompositionShareType(this.#client, compositionId);
99
+ }
100
+ async getCompositionByShareType(shareType) {
101
+ return queries.getCompositionByShareType(this.#client, this.#requireGraphQL(), shareType, this.#misoPackageId);
102
+ }
103
+ async getCompositionAdminCapById(adminCapId) {
104
+ return queries.getCompositionAdminCapById(this.#client, adminCapId);
105
+ }
106
+ async getOwnedCompositionAdminCaps(owner) {
107
+ return queries.getOwnedCompositionAdminCaps(this.#client, owner, this.#misoPackageId);
108
+ }
109
+ deriveCompositionAdminCapId(compositionId) {
110
+ return queries.deriveCompositionAdminCapId(compositionId, this.#misoPackageId);
111
+ }
112
+ // === Recording ===
113
+ async getRecordingById(recordingId) {
114
+ return queries.getRecordingById(this.#client, recordingId);
115
+ }
116
+ async getRecordingsByIds(ids) {
117
+ return queries.getRecordingsByIds(this.#client, ids);
118
+ }
119
+ async getRecordingShareType(recordingId) {
120
+ return queries.getRecordingShareType(this.#client, recordingId);
121
+ }
122
+ async getRecordingByShareType(shareType) {
123
+ return queries.getRecordingByShareType(this.#client, this.#requireGraphQL(), shareType, this.#misoPackageId);
124
+ }
125
+ async getRecordingAdminCapById(adminCapId) {
126
+ return queries.getRecordingAdminCapById(this.#client, adminCapId);
127
+ }
128
+ async getOwnedRecordingAdminCaps(owner) {
129
+ return queries.getOwnedRecordingAdminCaps(this.#client, owner, this.#misoPackageId);
130
+ }
131
+ deriveRecordingAdminCapId(recordingId) {
132
+ return queries.deriveRecordingAdminCapId(recordingId, this.#misoPackageId);
133
+ }
134
+ // === Release ===
135
+ async getReleaseById(releaseId) {
136
+ return queries.getReleaseById(this.#client, releaseId);
137
+ }
138
+ /** Read the shared canonical core `miso::release::ReleaseRegistry`. */
139
+ async getReleaseRegistryById(registryId) {
140
+ return queries.getReleaseRegistryById(this.#client, registryId);
141
+ }
142
+ async getReleasesByIds(ids) {
143
+ return queries.getReleasesByIds(this.#client, ids);
144
+ }
145
+ async getReleaseAdminCapById(adminCapId) {
146
+ return queries.getReleaseAdminCapById(this.#client, adminCapId);
147
+ }
148
+ deriveReleaseAdminCapId(releaseId) {
149
+ return queries.deriveReleaseAdminCapId(releaseId, this.#misoPackageId);
150
+ }
151
+ async getOwnedReleaseAdminCaps(owner) {
152
+ return queries.getOwnedReleaseAdminCaps(this.#client, owner, this.#misoPackageId);
153
+ }
154
+ // === Share Currency ===
155
+ async getShareCurrencyType(shareCurrencyId) {
156
+ return queries.getShareCurrencyType(this.#client, shareCurrencyId);
157
+ }
158
+ /**
159
+ * The `TreasuryCap<shareType>` owned by `owner`. Takes the share TYPE — if you
160
+ * hold only the `Currency` object id, resolve it first with
161
+ * {@link getShareCurrencyType}.
162
+ */
163
+ async getShareCurrencyTreasuryCap(shareType, owner) {
164
+ return queries.getShareCurrencyTreasuryCap(this.#client, shareType, owner);
165
+ }
166
+ // === Simulate-based reads (view) ===
167
+ get view() {
168
+ const client = this.#client;
169
+ const misoPackageId = this.#misoPackageId;
170
+ return {
171
+ deriveTargetReleaseId: (params) => view.deriveTargetReleaseId(client, misoPackageId, params),
172
+ };
173
+ }
174
+ // === Generated type-safe Move calls (for tx.add) ===
175
+ get call() {
176
+ const pkg = this.#misoPackageId;
177
+ return {
178
+ composition: bindModulePackage(composition, pkg, REF_RETURNING_CALLS.composition),
179
+ recording: bindModulePackage(recording, pkg, REF_RETURNING_CALLS.recording),
180
+ release: bindModulePackage(release, pkg, REF_RETURNING_CALLS.release),
181
+ track: bindModulePackage(track, pkg),
182
+ };
183
+ }
184
+ // === Generated BCS structs (for parsing object/event content) ===
185
+ get bcs() {
186
+ return {
187
+ Composition: composition.Composition,
188
+ Recording: recording.Recording,
189
+ Release: release.Release,
190
+ Track: track.Track,
191
+ CompositionPublishedEvent: composition.CompositionPublishedEvent,
192
+ RecordingPublishedEvent: recording.RecordingPublishedEvent,
193
+ ReleasePublishedEvent: release.ReleasePublishedEvent,
194
+ };
195
+ }
196
+ // === Event parsers ===
197
+ get parse() {
198
+ return {
199
+ compositionPublishedEvent: parsers.parseCompositionPublishedEvent,
200
+ recordingPublishedEvent: parsers.parseRecordingPublishedEvent,
201
+ compositionSharesGrantedEvent: parsers.parseCompositionSharesGrantedEvent,
202
+ releasePublishedEvent: parsers.parseReleasePublishedEvent,
203
+ releaseRegistryCreatedEvent: parsers.parseReleaseRegistryCreatedEvent,
204
+ events: eventParsers,
205
+ };
206
+ }
207
+ #requireGraphQL() {
208
+ if (!this.#graphqlClient) {
209
+ throw new Error("GraphQL client required. Pass graphqlClient to miso() options.");
210
+ }
211
+ return this.#graphqlClient;
212
+ }
213
+ }
214
+ /** @deprecated Prefer the layer-specific `MisoProtocolClient` name. */
215
+ export { MisoProtocolClient as MisoClient };
216
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAOtC,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,+BAA+B,EAC/B,kBAAkB,GAGnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAUlC,iEAAiE;AACjE,OAAO,KAAK,WAAW,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,OAAO,MAAM,gCAAgC,CAAC;AAC1D,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AAqBtD,SAAS,gBAAgB,CACvB,UAAmD;IAEnD,OAAO,SAAS,IAAI,UAAU,CAAC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9B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,yBAAyB,EAAE,WAAW,CAAC,yBAAyB;YAChE,uBAAuB,EAAE,SAAS,CAAC,uBAAuB;YAC1D,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;SACrD,CAAC;IACJ,CAAC;IAED,wBAAwB;IAExB,IAAI,KAAK;QACP,OAAO;YACL,yBAAyB,EAAE,OAAO,CAAC,8BAA8B;YACjE,uBAAuB,EAAE,OAAO,CAAC,4BAA4B;YAC7D,6BAA6B,EAC3B,OAAO,CAAC,kCAAkC;YAC5C,qBAAqB,EAAE,OAAO,CAAC,0BAA0B;YACzD,2BAA2B,EAAE,OAAO,CAAC,gCAAgC;YACrE,MAAM,EAAE,YAAY;SACrB,CAAC;IACJ,CAAC;IAED,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,uEAAuE;AACvE,OAAO,EAAE,kBAAkB,IAAI,UAAU,EAAE,CAAC"}
@@ -0,0 +1,195 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Represents a musical composition (song, instrumental work) in musicos.
6
+ * Compositions are the underlying written works that recordings are based on. Each
7
+ * composition has its own 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`)
14
+ * - Deterministic addresses via derived object pattern
15
+ *
16
+ * Attribution (credits) is intentionally NOT part of core: it is display-oriented,
17
+ * varies across platforms, and is never read by the economics. It lives in a
18
+ * first-party credits extension attached via `uid_mut`, so core takes no
19
+ * dependency on an identity package and core publish enforces no attribution.
20
+ *
21
+ * ### Lifecycle and trust model
22
+ *
23
+ * A composition is `key`-only with no `drop`: a fresh `Initialized` object cannot
24
+ * be transferred, wrapped, publicly shared, or discarded, and its only by-value
25
+ * consumer is `publish`. Create-and-publish is therefore atomic by construction —
26
+ * an `Initialized` composition cannot outlive its creating transaction, and every
27
+ * composition that exists on-chain is `Published` and shared. There is
28
+ * deliberately no keep function; staged building must fit one transaction.
29
+ *
30
+ * `uid_mut` works in any lifecycle state and is permanent root over ALL dynamic
31
+ * fields on the object — including fields attached by other extensions. "Immutable
32
+ * after publish" covers the embedded fields only; extension-layer data stays
33
+ * admin-mutable in perpetuity. This is the designed extension surface, and it is
34
+ * the one trust assumption that never expires: integrators should model the cap
35
+ * holder as able to mutate or delete any extension data, forever.
36
+ */
37
+ import { MoveEnum, MoveStruct, MoveTuple, type RawTransactionArgument } from '../utils/index.ts';
38
+ import { type Transaction } from '@mysten/sui/transactions';
39
+ /** Lifecycle state of a composition. */
40
+ export declare const CompositionState: MoveEnum<{
41
+ /** Composition is initialized but not published. */
42
+ Initialized: null;
43
+ /** Composition is published and immutable. Includes publication timestamp. */
44
+ Published: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
45
+ }, "@local-pkg/musicos::composition::CompositionState">;
46
+ export declare const Composition: MoveStruct<{
47
+ /** Unique identifier for this composition. */
48
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
49
+ /** Current lifecycle state. */
50
+ state: MoveEnum<{
51
+ /** Composition is initialized but not published. */
52
+ Initialized: null;
53
+ /** Composition is published and immutable. Includes publication timestamp. */
54
+ Published: import("@mysten/bcs").BcsType<string, string | number | bigint, "u64">;
55
+ }, "@local-pkg/musicos::composition::CompositionState">;
56
+ /** Primary title of the composition. */
57
+ title: import("@mysten/bcs").BcsType<string, string, "string">;
58
+ /** Royalty rate this composition earns from each recording's revenue. */
59
+ royalty_rate: MoveTuple<readonly [import("@mysten/bcs").BcsType<number, number, "u16">], "bps::bps::BPS">;
60
+ }, "@local-pkg/musicos::composition::Composition<phantom CompositionShare>">;
61
+ export declare const CompositionAdminCap: MoveStruct<{
62
+ /** Unique identifier for this capability. */
63
+ id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
64
+ }, "@local-pkg/musicos::composition::CompositionAdminCap<phantom CompositionShare>">;
65
+ export declare const CompositionAdminCapKey: MoveTuple<readonly [import("@mysten/bcs").BcsType<boolean, boolean, "bool">], "@local-pkg/musicos::composition::CompositionAdminCapKey">;
66
+ export declare const CompositionPublishedEvent: MoveStruct<{
67
+ composition_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
68
+ }, "@local-pkg/musicos::composition::CompositionPublishedEvent<phantom CompositionShare>">;
69
+ export interface NewArguments {
70
+ title: RawTransactionArgument<string>;
71
+ royaltyRateBps: RawTransactionArgument<number>;
72
+ shareCurrency: RawTransactionArgument<string>;
73
+ shareTreasuryCap: RawTransactionArgument<string>;
74
+ }
75
+ export interface NewOptions {
76
+ package?: string;
77
+ arguments: NewArguments | [
78
+ title: RawTransactionArgument<string>,
79
+ royaltyRateBps: RawTransactionArgument<number>,
80
+ shareCurrency: RawTransactionArgument<string>,
81
+ shareTreasuryCap: RawTransactionArgument<string>
82
+ ];
83
+ typeArguments: [
84
+ string
85
+ ];
86
+ }
87
+ /**
88
+ * Creates a new composition with the given title and royalty rate.
89
+ *
90
+ * The rate is set once, here, and is immutable for the composition's lifetime: it
91
+ * is a permanent standing offer that recorders and share buyers can price against
92
+ * without trusting the admin. The protocol imposes no opinion on it beyond the
93
+ * arithmetic bound of 100% (10000 bps, enforced by `bps::new`). There is no floor
94
+ * — 0% is permitted (e.g. a generative recording with no authored composition) —
95
+ * and no protocol ceiling: an uncompetitive rate simply attracts no recordings.
96
+ * What rate is reasonable is a client-side concern; per-deal deviations settle as
97
+ * voluntary share transfers after recording creation. Initializes share tokens
98
+ * (10M supply, 6 decimals) and returns:
99
+ *
100
+ * - The composition object
101
+ * - Admin capability for the owner
102
+ * - Initial share token balance
103
+ */
104
+ export declare function _new(options: NewOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
105
+ export interface PublishArguments {
106
+ self: RawTransactionArgument<string>;
107
+ _: RawTransactionArgument<string>;
108
+ }
109
+ export interface PublishOptions {
110
+ package?: string;
111
+ arguments: PublishArguments | [
112
+ self: RawTransactionArgument<string>,
113
+ _: RawTransactionArgument<string>
114
+ ];
115
+ typeArguments: [
116
+ string
117
+ ];
118
+ }
119
+ /**
120
+ * Publishes the composition, making its embedded fields immutable. Required State:
121
+ * Initialized
122
+ *
123
+ * Note: core enforces no attribution requirement — credits live in the credits
124
+ * extension and may be attached before or after publish via `uid_mut`.
125
+ */
126
+ export declare function publish(options: PublishOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
127
+ export interface TitleArguments {
128
+ self: RawTransactionArgument<string>;
129
+ }
130
+ export interface TitleOptions {
131
+ package?: string;
132
+ arguments: TitleArguments | [
133
+ self: RawTransactionArgument<string>
134
+ ];
135
+ typeArguments: [
136
+ string
137
+ ];
138
+ }
139
+ /** Returns the primary title. */
140
+ export declare function title(options: TitleOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
141
+ export interface RoyaltyRateArguments {
142
+ self: RawTransactionArgument<string>;
143
+ }
144
+ export interface RoyaltyRateOptions {
145
+ package?: string;
146
+ arguments: RoyaltyRateArguments | [
147
+ self: RawTransactionArgument<string>
148
+ ];
149
+ typeArguments: [
150
+ string
151
+ ];
152
+ }
153
+ /**
154
+ * Returns the royalty rate this composition earns from each recording. Immutable
155
+ * for the composition's lifetime — the value read here is, by construction, the
156
+ * value `recording::new` will apply.
157
+ */
158
+ export declare function royaltyRate(options: RoyaltyRateOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
159
+ export interface UidArguments {
160
+ self: RawTransactionArgument<string>;
161
+ }
162
+ export interface UidOptions {
163
+ package?: string;
164
+ arguments: UidArguments | [
165
+ self: RawTransactionArgument<string>
166
+ ];
167
+ typeArguments: [
168
+ string
169
+ ];
170
+ }
171
+ /** Returns a reference to the composition's UID for reading dynamic fields. */
172
+ export declare function uid(options: UidOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
173
+ export interface UidMutArguments {
174
+ self: RawTransactionArgument<string>;
175
+ _: RawTransactionArgument<string>;
176
+ }
177
+ export interface UidMutOptions {
178
+ package?: string;
179
+ arguments: UidMutArguments | [
180
+ self: RawTransactionArgument<string>,
181
+ _: RawTransactionArgument<string>
182
+ ];
183
+ typeArguments: [
184
+ string
185
+ ];
186
+ }
187
+ /**
188
+ * Returns a mutable reference to the composition's UID. Requires the admin
189
+ * capability. Works in any lifecycle state — dynamic fields are the extension
190
+ * surface and stay admin-mutable after publish; only the embedded fields are
191
+ * frozen. The reference is root over every dynamic field on the object, including
192
+ * fields attached by other extensions.
193
+ */
194
+ export declare function uidMut(options: UidMutOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
195
+ //# sourceMappingURL=composition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../../src/contracts/musicos/composition.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAA0B,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAGzH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,wCAAwC;AACxC,eAAO,MAAM,gBAAgB;IACrB,oDAAoD;;IAEpD,8EAA8E;;uDAE9E,CAAC;AACT,eAAO,MAAM,WAAW;IAChB,8CAA8C;;IAE9C,+BAA+B;;QAR/B,oDAAoD;;QAEpD,8EAA8E;;;IAQ9E,wCAAwC;;I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rC;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;KACT,CAAC;CACL;AACD;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,QAO7B,WAAW,0DAO1B"}
@@ -0,0 +1,195 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ /**
5
+ * Represents a musical composition (song, instrumental work) in musicos.
6
+ * Compositions are the underlying written works that recordings are based on. Each
7
+ * composition has its own 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`)
14
+ * - Deterministic addresses via derived object pattern
15
+ *
16
+ * Attribution (credits) is intentionally NOT part of core: it is display-oriented,
17
+ * varies across platforms, and is never read by the economics. It lives in a
18
+ * first-party credits extension attached via `uid_mut`, so core takes no
19
+ * dependency on an identity package and core publish enforces no attribution.
20
+ *
21
+ * ### Lifecycle and trust model
22
+ *
23
+ * A composition is `key`-only with no `drop`: a fresh `Initialized` object cannot
24
+ * be transferred, wrapped, publicly shared, or discarded, and its only by-value
25
+ * consumer is `publish`. Create-and-publish is therefore atomic by construction —
26
+ * an `Initialized` composition cannot outlive its creating transaction, and every
27
+ * composition that exists on-chain is `Published` and shared. There is
28
+ * deliberately no keep function; staged building must fit one transaction.
29
+ *
30
+ * `uid_mut` works in any lifecycle state and is permanent root over ALL dynamic
31
+ * fields on the object — including fields attached by other extensions. "Immutable
32
+ * after publish" covers the embedded fields only; extension-layer data stays
33
+ * admin-mutable in perpetuity. This is the designed extension surface, and it is
34
+ * the one trust assumption that never expires: integrators should model the cap
35
+ * holder as able to mutate or delete any extension data, forever.
36
+ */
37
+ import { MoveEnum, MoveStruct, MoveTuple, normalizeMoveArguments } from '../utils/index.js';
38
+ import { bcs } from '@mysten/sui/bcs';
39
+ import {} from '@mysten/sui/transactions';
40
+ import * as bps from './deps/bps/bps.js';
41
+ const $moduleName = '@local-pkg/musicos::composition';
42
+ /** Lifecycle state of a composition. */
43
+ export const CompositionState = new MoveEnum({ name: `${$moduleName}::CompositionState`, fields: {
44
+ /** Composition is initialized but not published. */
45
+ Initialized: null,
46
+ /** Composition is published and immutable. Includes publication timestamp. */
47
+ Published: bcs.u64()
48
+ } });
49
+ export const Composition = new MoveStruct({ name: `${$moduleName}::Composition<phantom CompositionShare>`, fields: {
50
+ /** Unique identifier for this composition. */
51
+ id: bcs.Address,
52
+ /** Current lifecycle state. */
53
+ state: CompositionState,
54
+ /** Primary title of the composition. */
55
+ title: bcs.string(),
56
+ /** Royalty rate this composition earns from each recording's revenue. */
57
+ royalty_rate: bps.BPS
58
+ } });
59
+ export const CompositionAdminCap = new MoveStruct({ name: `${$moduleName}::CompositionAdminCap<phantom CompositionShare>`, fields: {
60
+ /** Unique identifier for this capability. */
61
+ id: bcs.Address
62
+ } });
63
+ export const CompositionAdminCapKey = new MoveTuple({ name: `${$moduleName}::CompositionAdminCapKey`, fields: [bcs.bool()] });
64
+ export const CompositionPublishedEvent = new MoveStruct({ name: `${$moduleName}::CompositionPublishedEvent<phantom CompositionShare>`, fields: {
65
+ composition_id: bcs.Address
66
+ } });
67
+ /**
68
+ * Creates a new composition with the given title and royalty rate.
69
+ *
70
+ * The rate is set once, here, and is immutable for the composition's lifetime: it
71
+ * is a permanent standing offer that recorders and share buyers can price against
72
+ * without trusting the admin. The protocol imposes no opinion on it beyond the
73
+ * arithmetic bound of 100% (10000 bps, enforced by `bps::new`). There is no floor
74
+ * — 0% is permitted (e.g. a generative recording with no authored composition) —
75
+ * and no protocol ceiling: an uncompetitive rate simply attracts no recordings.
76
+ * What rate is reasonable is a client-side concern; per-deal deviations settle as
77
+ * voluntary share transfers after recording creation. Initializes share tokens
78
+ * (10M supply, 6 decimals) and returns:
79
+ *
80
+ * - The composition object
81
+ * - Admin capability for the owner
82
+ * - Initial share token balance
83
+ */
84
+ export function _new(options) {
85
+ const packageAddress = options.package ?? '@local-pkg/musicos';
86
+ const argumentsTypes = [
87
+ '0x1::string::String',
88
+ 'u16',
89
+ null,
90
+ null
91
+ ];
92
+ const parameterNames = ["title", "royaltyRateBps", "shareCurrency", "shareTreasuryCap"];
93
+ return (tx) => tx.moveCall({
94
+ package: packageAddress,
95
+ module: 'composition',
96
+ function: 'new',
97
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
98
+ typeArguments: options.typeArguments
99
+ });
100
+ }
101
+ /**
102
+ * Publishes the composition, making its embedded fields immutable. Required State:
103
+ * Initialized
104
+ *
105
+ * Note: core enforces no attribution requirement — credits live in the credits
106
+ * extension and may be attached before or after publish via `uid_mut`.
107
+ */
108
+ export function publish(options) {
109
+ const packageAddress = options.package ?? '@local-pkg/musicos';
110
+ const argumentsTypes = [
111
+ null,
112
+ null,
113
+ '0x2::clock::Clock'
114
+ ];
115
+ const parameterNames = ["self", "_"];
116
+ return (tx) => tx.moveCall({
117
+ package: packageAddress,
118
+ module: 'composition',
119
+ function: 'publish',
120
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
121
+ typeArguments: options.typeArguments
122
+ });
123
+ }
124
+ /** Returns the primary title. */
125
+ export function title(options) {
126
+ const packageAddress = options.package ?? '@local-pkg/musicos';
127
+ const argumentsTypes = [
128
+ null
129
+ ];
130
+ const parameterNames = ["self"];
131
+ return (tx) => tx.moveCall({
132
+ package: packageAddress,
133
+ module: 'composition',
134
+ function: 'title',
135
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
136
+ typeArguments: options.typeArguments
137
+ });
138
+ }
139
+ /**
140
+ * Returns the royalty rate this composition earns from each recording. Immutable
141
+ * for the composition's lifetime — the value read here is, by construction, the
142
+ * value `recording::new` will apply.
143
+ */
144
+ export function royaltyRate(options) {
145
+ const packageAddress = options.package ?? '@local-pkg/musicos';
146
+ const argumentsTypes = [
147
+ null
148
+ ];
149
+ const parameterNames = ["self"];
150
+ return (tx) => tx.moveCall({
151
+ package: packageAddress,
152
+ module: 'composition',
153
+ function: 'royalty_rate',
154
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
155
+ typeArguments: options.typeArguments
156
+ });
157
+ }
158
+ /** Returns a reference to the composition's UID for reading dynamic fields. */
159
+ export function uid(options) {
160
+ const packageAddress = options.package ?? '@local-pkg/musicos';
161
+ const argumentsTypes = [
162
+ null
163
+ ];
164
+ const parameterNames = ["self"];
165
+ return (tx) => tx.moveCall({
166
+ package: packageAddress,
167
+ module: 'composition',
168
+ function: 'uid',
169
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
170
+ typeArguments: options.typeArguments
171
+ });
172
+ }
173
+ /**
174
+ * Returns a mutable reference to the composition's UID. Requires the admin
175
+ * capability. Works in any lifecycle state — dynamic fields are the extension
176
+ * surface and stay admin-mutable after publish; only the embedded fields are
177
+ * frozen. The reference is root over every dynamic field on the object, including
178
+ * fields attached by other extensions.
179
+ */
180
+ export function uidMut(options) {
181
+ const packageAddress = options.package ?? '@local-pkg/musicos';
182
+ const argumentsTypes = [
183
+ null,
184
+ null
185
+ ];
186
+ const parameterNames = ["self", "_"];
187
+ return (tx) => tx.moveCall({
188
+ package: packageAddress,
189
+ module: 'composition',
190
+ function: 'uid_mut',
191
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
192
+ typeArguments: options.typeArguments
193
+ });
194
+ }
195
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.js","sourceRoot":"","sources":["../../../src/contracts/musicos/composition.ts"],"names":[],"mappings":"AAAA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D,MAAM,cAAc,GAAG;QACnB,IAAI;KACqB,CAAC;IAC9B,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAe,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC;QACpC,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC;QACpF,aAAa,EAAE,OAAO,CAAC,aAAa;KACvC,CAAC,CAAC;AACP,CAAC;AAeD;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,OAAsB;IACzC,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,IAAI,oBAAoB,CAAC;IAC/D,MAAM,cAAc,GAAG;QACnB,IAAI;QACJ,IAAI;KACqB,CAAC;IAC9B,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,CAAC,EAAe,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC;QACpC,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,SAAS;QACnB,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC;QACpF,aAAa,EAAE,OAAO,CAAC,aAAa;KACvC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,17 @@
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.ts';
16
+ export declare const BPS: MoveTuple<readonly [import("@mysten/bcs").BcsType<number, number, "u16">], "bps::bps::BPS">;
17
+ //# sourceMappingURL=bps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bps.d.ts","sourceRoot":"","sources":["../../../../../src/contracts/musicos/deps/bps/bps.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAIpD,eAAO,MAAM,GAAG,6FAAsE,CAAC"}