@misonetwork/sdk 0.4.0 → 0.5.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 (60) hide show
  1. package/README.md +97 -503
  2. package/dist/client.d.ts +3 -55
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +1 -52
  5. package/dist/client.js.map +1 -1
  6. package/dist/contracts/miso/release.d.ts +34 -31
  7. package/dist/contracts/miso/release.d.ts.map +1 -1
  8. package/dist/contracts/miso/release.js +32 -29
  9. package/dist/contracts/miso/release.js.map +1 -1
  10. package/dist/contracts/miso/track.d.ts +66 -22
  11. package/dist/contracts/miso/track.d.ts.map +1 -1
  12. package/dist/contracts/miso/track.js +65 -20
  13. package/dist/contracts/miso/track.js.map +1 -1
  14. package/dist/contracts/utils/index.d.ts +44 -0
  15. package/dist/contracts/utils/index.d.ts.map +1 -1
  16. package/dist/contracts/utils/index.js +104 -2
  17. package/dist/contracts/utils/index.js.map +1 -1
  18. package/dist/contracts.d.ts +0 -1
  19. package/dist/contracts.d.ts.map +1 -1
  20. package/dist/contracts.js +0 -1
  21. package/dist/contracts.js.map +1 -1
  22. package/dist/internal.d.ts +0 -7
  23. package/dist/internal.d.ts.map +1 -1
  24. package/dist/internal.js +0 -22
  25. package/dist/internal.js.map +1 -1
  26. package/dist/parsers.d.ts +1 -4
  27. package/dist/parsers.d.ts.map +1 -1
  28. package/dist/parsers.js +0 -24
  29. package/dist/parsers.js.map +1 -1
  30. package/dist/queries.d.ts +2 -5
  31. package/dist/queries.d.ts.map +1 -1
  32. package/dist/queries.js +8 -45
  33. package/dist/queries.js.map +1 -1
  34. package/dist/transactions.d.ts +10 -71
  35. package/dist/transactions.d.ts.map +1 -1
  36. package/dist/transactions.js +15 -72
  37. package/dist/transactions.js.map +1 -1
  38. package/dist/types.d.ts +3 -40
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/view.d.ts +7 -7
  41. package/dist/view.d.ts.map +1 -1
  42. package/dist/view.js +9 -9
  43. package/dist/view.js.map +1 -1
  44. package/package.json +4 -4
  45. package/src/client.ts +3 -78
  46. package/src/contracts/miso/release.ts +39 -36
  47. package/src/contracts/miso/track.ts +81 -23
  48. package/src/contracts/utils/index.ts +156 -4
  49. package/src/contracts.ts +0 -1
  50. package/src/internal.ts +0 -24
  51. package/src/parsers.ts +0 -35
  52. package/src/queries.ts +11 -59
  53. package/src/transactions.ts +20 -112
  54. package/src/types.ts +3 -53
  55. package/src/view.ts +13 -13
  56. package/dist/contracts/miso/deal.d.ts +0 -184
  57. package/dist/contracts/miso/deal.d.ts.map +0 -1
  58. package/dist/contracts/miso/deal.js +0 -184
  59. package/dist/contracts/miso/deal.js.map +0 -1
  60. package/src/contracts/miso/deal.ts +0 -257
@@ -1,257 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
-
5
-
6
- /**
7
- * Represents a deal authorizing a recording to be included in a release. Deals are
8
- * created by recording owners to grant permission for their recordings to appear
9
- * on specific releases with agreed-upon revenue splits.
10
- *
11
- * ### Flow:
12
- *
13
- * - A recording owner creates a `Deal` specifying the target release and track
14
- * split.
15
- * - The deal is consumed by `track::new` to create a track, transferring the
16
- * recording's authorization into the release.
17
- * - Deals can be destroyed if no longer needed.
18
- *
19
- * `Deal<RecordingShare, CompositionShare>` carries the recording's and
20
- * composition's identities as phantom type parameters rather than stored values —
21
- * a `Deal` is consumed one-to-one into a `Track` and is never collected, so it has
22
- * no reason to flatten to `TypeName`s early. The recording↔composition pairing is
23
- * type-enforced at `new` via the `Recording<RecordingShare, CompositionShare>`
24
- * argument — no ID is stored and no runtime assert is needed.
25
- *
26
- * A deal stores only what is genuinely release-specific and not carried by the
27
- * type parameters: the target `release_id` and the `track_split_bps`. The
28
- * recording is identified by the phantom, so no `recording_id` is stored —
29
- * `track::new` reads the recording's address from the matching `Recording` it is
30
- * handed (the phantoms force it to be the right one). Display metadata (title,
31
- * cover art) is _not_ duplicated here — it is derived from the recording.
32
- */
33
-
34
- import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
35
- import { bcs } from '@mysten/sui/bcs';
36
- import { type Transaction } from '@mysten/sui/transactions';
37
- import * as bps from './deps/bps/bps.js';
38
- const $moduleName = '@local-pkg/miso::deal';
39
- export const Deal = new MoveStruct({ name: `${$moduleName}::Deal<phantom RecordingShare, phantom CompositionShare>`, fields: {
40
- /** Unique identifier for this deal. */
41
- id: bcs.Address,
42
- /** ID of the target release this deal authorizes. */
43
- release_id: bcs.Address,
44
- /** Revenue split allocated to this track in basis points. */
45
- track_split_bps: bps.BPS
46
- } });
47
- export const DealCreatedEvent = new MoveStruct({ name: `${$moduleName}::DealCreatedEvent<phantom RecordingShare, phantom CompositionShare>`, fields: {
48
- /** ID of the deal. */
49
- deal_id: bcs.Address,
50
- /** ID of the recording whose inclusion is authorized. */
51
- recording_id: bcs.Address,
52
- /** ID of the target release. */
53
- release_id: bcs.Address,
54
- /** Track-level revenue split in basis points. */
55
- track_split_bps_value: bcs.u16(),
56
- created_by: bcs.Address
57
- } });
58
- export const DealAcceptedEvent = new MoveStruct({ name: `${$moduleName}::DealAcceptedEvent<phantom RecordingShare, phantom CompositionShare>`, fields: {
59
- /** ID of the deal. */
60
- deal_id: bcs.Address,
61
- /** ID of the target release. */
62
- release_id: bcs.Address
63
- } });
64
- export const DealRejectedEvent = new MoveStruct({ name: `${$moduleName}::DealRejectedEvent<phantom RecordingShare, phantom CompositionShare>`, fields: {
65
- /** ID of the deal. */
66
- deal_id: bcs.Address,
67
- /** ID of the target release. */
68
- release_id: bcs.Address
69
- } });
70
- export interface NewArguments {
71
- _: RawTransactionArgument<string>;
72
- recording: RawTransactionArgument<string>;
73
- releaseId: RawTransactionArgument<string>;
74
- trackSplitBpsValue: RawTransactionArgument<number>;
75
- }
76
- export interface NewOptions {
77
- package?: string;
78
- arguments: NewArguments | [
79
- _: RawTransactionArgument<string>,
80
- recording: RawTransactionArgument<string>,
81
- releaseId: RawTransactionArgument<string>,
82
- trackSplitBpsValue: RawTransactionArgument<number>
83
- ];
84
- typeArguments: [
85
- string,
86
- string
87
- ];
88
- }
89
- /**
90
- * Creates a new deal authorizing a recording for inclusion in a release. Requires
91
- * the recording admin capability.
92
- *
93
- * The composition is identified by the recording's `CompositionShare` phantom, so
94
- * the recording↔composition pairing is compile-time enforced — there is no
95
- * `Composition` argument and no runtime ID check.
96
- *
97
- * ### What signing a deal consents to
98
- *
99
- * `release_id` is derived from the release digest, so targeting it consents to
100
- * that release's exact economics and membership: the ordered list of
101
- * `(recording, split)` pairs and the creator's nonce, nothing more. The release's
102
- * title, artwork, credits, and display grouping are chosen by the release creator
103
- * — before or after this deal is signed — and are not bound by the digest.
104
- * Presentation is trusted and publicly attributable, not cryptographically
105
- * committed.
106
- *
107
- * The recording need not be `Published`: its admin can strike deals inside the
108
- * recording's own creating transaction (an `Initialized` recording cannot escape
109
- * that transaction, so across transactions deals always reference `Published`,
110
- * shared recordings).
111
- *
112
- * ### A transferred deal is out of its creator's hands
113
- *
114
- * A deal has no expiry and cannot be withdrawn by its creator: only the holder can
115
- * `reject` it, or accept it — at any future time — into exactly the consented
116
- * release via `track::new`. The digest binding confines a stale deal's blast
117
- * radius to that one release. Acceptance is itself provisional until the release
118
- * publishes: an accepted deal's track can be embedded in a release that never
119
- * publishes, with no extraction path — the deal is then consumed while the
120
- * recording never ships, and the recording admin's recourse is a new deal for a
121
- * new release.
122
- *
123
- * `recording` is deliberately unread (hence the `#[allow]`): it exists to
124
- * compile-time-bind the `RecordingShare`/`CompositionShare` phantom pairing.
125
- */
126
- export function _new(options: NewOptions) {
127
- const packageAddress = options.package ?? '@local-pkg/miso';
128
- const argumentsTypes = [
129
- null,
130
- null,
131
- '0x2::object::ID',
132
- 'u16'
133
- ] satisfies (string | null)[];
134
- const parameterNames = ["_", "recording", "releaseId", "trackSplitBpsValue"];
135
- return (tx: Transaction) => tx.moveCall({
136
- package: packageAddress,
137
- module: 'deal',
138
- function: 'new',
139
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
140
- typeArguments: options.typeArguments
141
- });
142
- }
143
- export interface RejectArguments {
144
- self: RawTransactionArgument<string>;
145
- }
146
- export interface RejectOptions {
147
- package?: string;
148
- arguments: RejectArguments | [
149
- self: RawTransactionArgument<string>
150
- ];
151
- typeArguments: [
152
- string,
153
- string
154
- ];
155
- }
156
- /**
157
- * Rejects the deal, destroying it without inclusion in a release. Used when the
158
- * holder declines or the negotiation falls through. Emits a `DealRejectedEvent`.
159
- */
160
- export function reject(options: RejectOptions) {
161
- const packageAddress = options.package ?? '@local-pkg/miso';
162
- const argumentsTypes = [
163
- null
164
- ] satisfies (string | null)[];
165
- const parameterNames = ["self"];
166
- return (tx: Transaction) => tx.moveCall({
167
- package: packageAddress,
168
- module: 'deal',
169
- function: 'reject',
170
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
171
- typeArguments: options.typeArguments
172
- });
173
- }
174
- export interface IdArguments {
175
- self: RawTransactionArgument<string>;
176
- }
177
- export interface IdOptions {
178
- package?: string;
179
- arguments: IdArguments | [
180
- self: RawTransactionArgument<string>
181
- ];
182
- typeArguments: [
183
- string,
184
- string
185
- ];
186
- }
187
- /** Returns the deal's object ID. */
188
- export function id(options: IdOptions) {
189
- const packageAddress = options.package ?? '@local-pkg/miso';
190
- const argumentsTypes = [
191
- null
192
- ] satisfies (string | null)[];
193
- const parameterNames = ["self"];
194
- return (tx: Transaction) => tx.moveCall({
195
- package: packageAddress,
196
- module: 'deal',
197
- function: 'id',
198
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
199
- typeArguments: options.typeArguments
200
- });
201
- }
202
- export interface ReleaseIdArguments {
203
- self: RawTransactionArgument<string>;
204
- }
205
- export interface ReleaseIdOptions {
206
- package?: string;
207
- arguments: ReleaseIdArguments | [
208
- self: RawTransactionArgument<string>
209
- ];
210
- typeArguments: [
211
- string,
212
- string
213
- ];
214
- }
215
- /** Returns the ID of the target release. */
216
- export function releaseId(options: ReleaseIdOptions) {
217
- const packageAddress = options.package ?? '@local-pkg/miso';
218
- const argumentsTypes = [
219
- null
220
- ] satisfies (string | null)[];
221
- const parameterNames = ["self"];
222
- return (tx: Transaction) => tx.moveCall({
223
- package: packageAddress,
224
- module: 'deal',
225
- function: 'release_id',
226
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
227
- typeArguments: options.typeArguments
228
- });
229
- }
230
- export interface TrackSplitBpsArguments {
231
- self: RawTransactionArgument<string>;
232
- }
233
- export interface TrackSplitBpsOptions {
234
- package?: string;
235
- arguments: TrackSplitBpsArguments | [
236
- self: RawTransactionArgument<string>
237
- ];
238
- typeArguments: [
239
- string,
240
- string
241
- ];
242
- }
243
- /** Returns the track's revenue split in basis points. */
244
- export function trackSplitBps(options: TrackSplitBpsOptions) {
245
- const packageAddress = options.package ?? '@local-pkg/miso';
246
- const argumentsTypes = [
247
- null
248
- ] satisfies (string | null)[];
249
- const parameterNames = ["self"];
250
- return (tx: Transaction) => tx.moveCall({
251
- package: packageAddress,
252
- module: 'deal',
253
- function: 'track_split_bps',
254
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
255
- typeArguments: options.typeArguments
256
- });
257
- }