@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
package/src/types.ts CHANGED
@@ -120,30 +120,6 @@ export interface RecordingAdminCap {
120
120
  shareType: string;
121
121
  }
122
122
 
123
- // ============================================================================
124
- // Deal
125
- // ============================================================================
126
-
127
- /**
128
- * A deal authorizing a recording's inclusion in a specific release. Created by
129
- * the recording's admin, held (transferably) by whoever assembles the release,
130
- * and consumed by `track::new`. The recording/composition identities ride on
131
- * the object's type parameters; the recording's object id is NOT stored.
132
- */
133
- export interface Deal {
134
- /** The object ID of the deal. */
135
- id: string;
136
- /** The exact release id this deal authorizes (a digest of the full tracklist + nonce). */
137
- releaseId: string;
138
- /** The agreed track split for this recording within the release. */
139
- trackSplitBps: BPS;
140
- /** The recording's share type (first type parameter of `Deal<R, C>`). */
141
- recordingShareType: string;
142
- /** The parent composition's share type (second type parameter of `Deal<R, C>`). */
143
- compositionShareType: string;
144
- }
145
-
146
- // ============================================================================
147
123
  // Track
148
124
  // ============================================================================
149
125
 
@@ -180,7 +156,7 @@ export type ReleaseState =
180
156
  * A release is a flat, ordered tracklist with per-track revenue distribution
181
157
  * configuration. Display grouping (discs, vinyl sides), cover art, and edition
182
158
  * naming live in extensions — the stored tracklist has the same shape as the
183
- * digest pre-image every deal consented to.
159
+ * digest pre-image every track consented to.
184
160
  *
185
161
  * State machine: Initialized -> Published (immutable after publish)
186
162
  */
@@ -197,8 +173,8 @@ export interface Release {
197
173
 
198
174
  /**
199
175
  * Emitted once when a release is published. A pure pointer carrying only the
200
- * release's identity — an indexer fetches the full immutable object (discs,
201
- * tracks) by `releaseId`.
176
+ * release's identity — an indexer fetches the full immutable object by
177
+ * `releaseId`.
202
178
  */
203
179
  export interface ReleasePublishedEvent {
204
180
  releaseId: string;
@@ -216,29 +192,3 @@ export interface ReleaseAdminCap {
216
192
  /** The object ID of the Release this cap administers. */
217
193
  releaseId: string;
218
194
  }
219
-
220
- // ============================================================================
221
- // Deal Events
222
- // ============================================================================
223
-
224
- export interface DealCreatedEvent {
225
- dealId: string;
226
- releaseId: string;
227
- trackSplitBps: BPS;
228
- }
229
-
230
- /**
231
- * Emitted when a deal is accepted: consumed by `track::new` into a track for
232
- * its target release. Treat as provisional until the release publishes (in the
233
- * honest path both land in the same transaction).
234
- */
235
- export interface DealAcceptedEvent {
236
- dealId: string;
237
- releaseId: string;
238
- }
239
-
240
- /** Emitted when a deal is rejected: destroyed without inclusion in a release. Terminal. */
241
- export interface DealRejectedEvent {
242
- dealId: string;
243
- releaseId: string;
244
- }
package/src/view.ts CHANGED
@@ -11,7 +11,7 @@ import { bcs } from "@mysten/sui/bcs";
11
11
  import type { ClientWithCoreApi } from "@mysten/sui/client";
12
12
  import * as release from "./contracts/miso/release.ts";
13
13
 
14
- export interface DeriveReleaseIdParams {
14
+ export interface DeriveTargetReleaseIdParams {
15
15
  /** Sender for the simulation (any address; not charged). */
16
16
  sender: string;
17
17
  /** Recording object ids, in track order. */
@@ -20,40 +20,40 @@ export interface DeriveReleaseIdParams {
20
20
  splitBps: number[];
21
21
  /** The release nonce (u256 as a decimal string). */
22
22
  nonce: string;
23
- /** The shared ReleaseRegistry object id. */
24
- releaseRegistryId: string;
23
+ /** The derivation parent's object ID, e.g. an extension's shared ReleaseRegistry. */
24
+ parentId: string;
25
25
  }
26
26
 
27
27
  /**
28
28
  * Derives the release id the on-chain `release::new` will produce for these
29
- * inputs, via a `simulateTransaction` call to `release::derive_release_id`. The
30
- * deals embedded in a release must reference this exact id, so it is computed up
31
- * front and threaded into the release publish builder.
29
+ * inputs, via a `simulateTransaction` call to `release::derive_target_release_id`.
30
+ * Tracks embedded in a release must reference this exact ID, so it is computed
31
+ * up front and threaded into the extension-layer release builder.
32
32
  */
33
- export async function deriveReleaseId(
33
+ export async function deriveTargetReleaseId(
34
34
  client: ClientWithCoreApi,
35
35
  misoPackageId: string,
36
- params: DeriveReleaseIdParams,
36
+ params: DeriveTargetReleaseIdParams,
37
37
  ): Promise<string> {
38
38
  if (params.recordingIds.length !== params.splitBps.length) {
39
- throw new Error(`deriveReleaseId: recordingIds (${params.recordingIds.length}) and splitBps (${params.splitBps.length}) length mismatch.`);
39
+ throw new Error(`deriveTargetReleaseId: recordingIds (${params.recordingIds.length}) and splitBps (${params.splitBps.length}) length mismatch.`);
40
40
  }
41
41
 
42
42
  const tx = new Transaction();
43
43
  tx.setSender(params.sender);
44
44
  tx.add(
45
- release.deriveReleaseId({
45
+ release.deriveTargetReleaseId({
46
46
  package: misoPackageId,
47
- arguments: [params.recordingIds, params.splitBps.map((v) => BigInt(v)), BigInt(params.nonce), params.releaseRegistryId],
47
+ arguments: [params.recordingIds, params.splitBps.map((v) => BigInt(v)), BigInt(params.nonce), params.parentId],
48
48
  }),
49
49
  );
50
50
 
51
51
  // gRPC/Core equivalent of devInspect: simulate with per-command return values.
52
52
  const res = await client.core.simulateTransaction({ transaction: tx, include: { commandResults: true } });
53
53
  if (res.$kind !== "Transaction") {
54
- throw new Error(`derive_release_id simulation failed: ${JSON.stringify(res.FailedTransaction.status)}`);
54
+ throw new Error(`derive_target_release_id simulation failed: ${JSON.stringify(res.FailedTransaction.status)}`);
55
55
  }
56
56
  const returned = res.commandResults?.[0]?.returnValues?.[0]?.bcs;
57
- if (!returned) throw new Error("derive_release_id returned no value.");
57
+ if (!returned) throw new Error("derive_target_release_id returned no value.");
58
58
  return bcs.Address.parse(returned);
59
59
  }
@@ -1,184 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * Represents a deal authorizing a recording to be included in a release. Deals are
6
- * created by recording owners to grant permission for their recordings to appear
7
- * on specific releases with agreed-upon revenue splits.
8
- *
9
- * ### Flow:
10
- *
11
- * - A recording owner creates a `Deal` specifying the target release and track
12
- * split.
13
- * - The deal is consumed by `track::new` to create a track, transferring the
14
- * recording's authorization into the release.
15
- * - Deals can be destroyed if no longer needed.
16
- *
17
- * `Deal<RecordingShare, CompositionShare>` carries the recording's and
18
- * composition's identities as phantom type parameters rather than stored values —
19
- * a `Deal` is consumed one-to-one into a `Track` and is never collected, so it has
20
- * no reason to flatten to `TypeName`s early. The recording↔composition pairing is
21
- * type-enforced at `new` via the `Recording<RecordingShare, CompositionShare>`
22
- * argument — no ID is stored and no runtime assert is needed.
23
- *
24
- * A deal stores only what is genuinely release-specific and not carried by the
25
- * type parameters: the target `release_id` and the `track_split_bps`. The
26
- * recording is identified by the phantom, so no `recording_id` is stored —
27
- * `track::new` reads the recording's address from the matching `Recording` it is
28
- * handed (the phantoms force it to be the right one). Display metadata (title,
29
- * cover art) is _not_ duplicated here — it is derived from the recording.
30
- */
31
- import { MoveStruct, type RawTransactionArgument } from '../utils/index.js';
32
- import { type Transaction } from '@mysten/sui/transactions';
33
- export declare const Deal: MoveStruct<{
34
- /** Unique identifier for this deal. */
35
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
36
- /** ID of the target release this deal authorizes. */
37
- release_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
38
- /** Revenue split allocated to this track in basis points. */
39
- track_split_bps: import("../utils/index.js").MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<number, number, "u16">], "bps::bps::BPS">;
40
- }, "@local-pkg/miso::deal::Deal<phantom RecordingShare, phantom CompositionShare>">;
41
- export declare const DealCreatedEvent: MoveStruct<{
42
- /** ID of the deal. */
43
- deal_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
44
- /** ID of the recording whose inclusion is authorized. */
45
- recording_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
46
- /** ID of the target release. */
47
- release_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
48
- /** Track-level revenue split in basis points. */
49
- track_split_bps_value: import("@mysten/sui/bcs").BcsType<number, number, "u16">;
50
- created_by: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
51
- }, "@local-pkg/miso::deal::DealCreatedEvent<phantom RecordingShare, phantom CompositionShare>">;
52
- export declare const DealAcceptedEvent: MoveStruct<{
53
- /** ID of the deal. */
54
- deal_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
55
- /** ID of the target release. */
56
- release_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
57
- }, "@local-pkg/miso::deal::DealAcceptedEvent<phantom RecordingShare, phantom CompositionShare>">;
58
- export declare const DealRejectedEvent: MoveStruct<{
59
- /** ID of the deal. */
60
- deal_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
61
- /** ID of the target release. */
62
- release_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
63
- }, "@local-pkg/miso::deal::DealRejectedEvent<phantom RecordingShare, phantom CompositionShare>">;
64
- export interface NewArguments {
65
- _: RawTransactionArgument<string>;
66
- recording: RawTransactionArgument<string>;
67
- releaseId: RawTransactionArgument<string>;
68
- trackSplitBpsValue: RawTransactionArgument<number>;
69
- }
70
- export interface NewOptions {
71
- package?: string;
72
- arguments: NewArguments | [
73
- _: RawTransactionArgument<string>,
74
- recording: RawTransactionArgument<string>,
75
- releaseId: RawTransactionArgument<string>,
76
- trackSplitBpsValue: RawTransactionArgument<number>
77
- ];
78
- typeArguments: [
79
- string,
80
- string
81
- ];
82
- }
83
- /**
84
- * Creates a new deal authorizing a recording for inclusion in a release. Requires
85
- * the recording admin capability.
86
- *
87
- * The composition is identified by the recording's `CompositionShare` phantom, so
88
- * the recording↔composition pairing is compile-time enforced — there is no
89
- * `Composition` argument and no runtime ID check.
90
- *
91
- * ### What signing a deal consents to
92
- *
93
- * `release_id` is derived from the release digest, so targeting it consents to
94
- * that release's exact economics and membership: the ordered list of
95
- * `(recording, split)` pairs and the creator's nonce, nothing more. The release's
96
- * title, artwork, credits, and display grouping are chosen by the release creator
97
- * — before or after this deal is signed — and are not bound by the digest.
98
- * Presentation is trusted and publicly attributable, not cryptographically
99
- * committed.
100
- *
101
- * The recording need not be `Published`: its admin can strike deals inside the
102
- * recording's own creating transaction (an `Initialized` recording cannot escape
103
- * that transaction, so across transactions deals always reference `Published`,
104
- * shared recordings).
105
- *
106
- * ### A transferred deal is out of its creator's hands
107
- *
108
- * A deal has no expiry and cannot be withdrawn by its creator: only the holder can
109
- * `reject` it, or accept it — at any future time — into exactly the consented
110
- * release via `track::new`. The digest binding confines a stale deal's blast
111
- * radius to that one release. Acceptance is itself provisional until the release
112
- * publishes: an accepted deal's track can be embedded in a release that never
113
- * publishes, with no extraction path — the deal is then consumed while the
114
- * recording never ships, and the recording admin's recourse is a new deal for a
115
- * new release.
116
- *
117
- * `recording` is deliberately unread (hence the `#[allow]`): it exists to
118
- * compile-time-bind the `RecordingShare`/`CompositionShare` phantom pairing.
119
- */
120
- export declare function _new(options: NewOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
121
- export interface RejectArguments {
122
- self: RawTransactionArgument<string>;
123
- }
124
- export interface RejectOptions {
125
- package?: string;
126
- arguments: RejectArguments | [
127
- self: RawTransactionArgument<string>
128
- ];
129
- typeArguments: [
130
- string,
131
- string
132
- ];
133
- }
134
- /**
135
- * Rejects the deal, destroying it without inclusion in a release. Used when the
136
- * holder declines or the negotiation falls through. Emits a `DealRejectedEvent`.
137
- */
138
- export declare function reject(options: RejectOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
139
- export interface IdArguments {
140
- self: RawTransactionArgument<string>;
141
- }
142
- export interface IdOptions {
143
- package?: string;
144
- arguments: IdArguments | [
145
- self: RawTransactionArgument<string>
146
- ];
147
- typeArguments: [
148
- string,
149
- string
150
- ];
151
- }
152
- /** Returns the deal's object ID. */
153
- export declare function id(options: IdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
154
- export interface ReleaseIdArguments {
155
- self: RawTransactionArgument<string>;
156
- }
157
- export interface ReleaseIdOptions {
158
- package?: string;
159
- arguments: ReleaseIdArguments | [
160
- self: RawTransactionArgument<string>
161
- ];
162
- typeArguments: [
163
- string,
164
- string
165
- ];
166
- }
167
- /** Returns the ID of the target release. */
168
- export declare function releaseId(options: ReleaseIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
169
- export interface TrackSplitBpsArguments {
170
- self: RawTransactionArgument<string>;
171
- }
172
- export interface TrackSplitBpsOptions {
173
- package?: string;
174
- arguments: TrackSplitBpsArguments | [
175
- self: RawTransactionArgument<string>
176
- ];
177
- typeArguments: [
178
- string,
179
- string
180
- ];
181
- }
182
- /** Returns the track's revenue split in basis points. */
183
- export declare function trackSplitBps(options: TrackSplitBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
184
- //# sourceMappingURL=deal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deal.d.ts","sourceRoot":"","sources":["../../../src/contracts/miso/deal.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU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,CAAC;KACvC,CAAC;IACF,aAAa,EAAE;QACX,MAAM;QACN,MAAM;KACT,CAAC;CACL;AACD,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,IAM/C,IAAI,WAAW,0DAO1B"}
@@ -1,184 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * Represents a deal authorizing a recording to be included in a release. Deals are
6
- * created by recording owners to grant permission for their recordings to appear
7
- * on specific releases with agreed-upon revenue splits.
8
- *
9
- * ### Flow:
10
- *
11
- * - A recording owner creates a `Deal` specifying the target release and track
12
- * split.
13
- * - The deal is consumed by `track::new` to create a track, transferring the
14
- * recording's authorization into the release.
15
- * - Deals can be destroyed if no longer needed.
16
- *
17
- * `Deal<RecordingShare, CompositionShare>` carries the recording's and
18
- * composition's identities as phantom type parameters rather than stored values —
19
- * a `Deal` is consumed one-to-one into a `Track` and is never collected, so it has
20
- * no reason to flatten to `TypeName`s early. The recording↔composition pairing is
21
- * type-enforced at `new` via the `Recording<RecordingShare, CompositionShare>`
22
- * argument — no ID is stored and no runtime assert is needed.
23
- *
24
- * A deal stores only what is genuinely release-specific and not carried by the
25
- * type parameters: the target `release_id` and the `track_split_bps`. The
26
- * recording is identified by the phantom, so no `recording_id` is stored —
27
- * `track::new` reads the recording's address from the matching `Recording` it is
28
- * handed (the phantoms force it to be the right one). Display metadata (title,
29
- * cover art) is _not_ duplicated here — it is derived from the recording.
30
- */
31
- import { MoveStruct, normalizeMoveArguments } from '../utils/index.js';
32
- import { bcs } from '@mysten/sui/bcs';
33
- import {} from '@mysten/sui/transactions';
34
- import * as bps from './deps/bps/bps.js';
35
- const $moduleName = '@local-pkg/miso::deal';
36
- export const Deal = new MoveStruct({ name: `${$moduleName}::Deal<phantom RecordingShare, phantom CompositionShare>`, fields: {
37
- /** Unique identifier for this deal. */
38
- id: bcs.Address,
39
- /** ID of the target release this deal authorizes. */
40
- release_id: bcs.Address,
41
- /** Revenue split allocated to this track in basis points. */
42
- track_split_bps: bps.BPS
43
- } });
44
- export const DealCreatedEvent = new MoveStruct({ name: `${$moduleName}::DealCreatedEvent<phantom RecordingShare, phantom CompositionShare>`, fields: {
45
- /** ID of the deal. */
46
- deal_id: bcs.Address,
47
- /** ID of the recording whose inclusion is authorized. */
48
- recording_id: bcs.Address,
49
- /** ID of the target release. */
50
- release_id: bcs.Address,
51
- /** Track-level revenue split in basis points. */
52
- track_split_bps_value: bcs.u16(),
53
- created_by: bcs.Address
54
- } });
55
- export const DealAcceptedEvent = new MoveStruct({ name: `${$moduleName}::DealAcceptedEvent<phantom RecordingShare, phantom CompositionShare>`, fields: {
56
- /** ID of the deal. */
57
- deal_id: bcs.Address,
58
- /** ID of the target release. */
59
- release_id: bcs.Address
60
- } });
61
- export const DealRejectedEvent = new MoveStruct({ name: `${$moduleName}::DealRejectedEvent<phantom RecordingShare, phantom CompositionShare>`, fields: {
62
- /** ID of the deal. */
63
- deal_id: bcs.Address,
64
- /** ID of the target release. */
65
- release_id: bcs.Address
66
- } });
67
- /**
68
- * Creates a new deal authorizing a recording for inclusion in a release. Requires
69
- * the recording admin capability.
70
- *
71
- * The composition is identified by the recording's `CompositionShare` phantom, so
72
- * the recording↔composition pairing is compile-time enforced — there is no
73
- * `Composition` argument and no runtime ID check.
74
- *
75
- * ### What signing a deal consents to
76
- *
77
- * `release_id` is derived from the release digest, so targeting it consents to
78
- * that release's exact economics and membership: the ordered list of
79
- * `(recording, split)` pairs and the creator's nonce, nothing more. The release's
80
- * title, artwork, credits, and display grouping are chosen by the release creator
81
- * — before or after this deal is signed — and are not bound by the digest.
82
- * Presentation is trusted and publicly attributable, not cryptographically
83
- * committed.
84
- *
85
- * The recording need not be `Published`: its admin can strike deals inside the
86
- * recording's own creating transaction (an `Initialized` recording cannot escape
87
- * that transaction, so across transactions deals always reference `Published`,
88
- * shared recordings).
89
- *
90
- * ### A transferred deal is out of its creator's hands
91
- *
92
- * A deal has no expiry and cannot be withdrawn by its creator: only the holder can
93
- * `reject` it, or accept it — at any future time — into exactly the consented
94
- * release via `track::new`. The digest binding confines a stale deal's blast
95
- * radius to that one release. Acceptance is itself provisional until the release
96
- * publishes: an accepted deal's track can be embedded in a release that never
97
- * publishes, with no extraction path — the deal is then consumed while the
98
- * recording never ships, and the recording admin's recourse is a new deal for a
99
- * new release.
100
- *
101
- * `recording` is deliberately unread (hence the `#[allow]`): it exists to
102
- * compile-time-bind the `RecordingShare`/`CompositionShare` phantom pairing.
103
- */
104
- export function _new(options) {
105
- const packageAddress = options.package ?? '@local-pkg/miso';
106
- const argumentsTypes = [
107
- null,
108
- null,
109
- '0x2::object::ID',
110
- 'u16'
111
- ];
112
- const parameterNames = ["_", "recording", "releaseId", "trackSplitBpsValue"];
113
- return (tx) => tx.moveCall({
114
- package: packageAddress,
115
- module: 'deal',
116
- function: 'new',
117
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
118
- typeArguments: options.typeArguments
119
- });
120
- }
121
- /**
122
- * Rejects the deal, destroying it without inclusion in a release. Used when the
123
- * holder declines or the negotiation falls through. Emits a `DealRejectedEvent`.
124
- */
125
- export function reject(options) {
126
- const packageAddress = options.package ?? '@local-pkg/miso';
127
- const argumentsTypes = [
128
- null
129
- ];
130
- const parameterNames = ["self"];
131
- return (tx) => tx.moveCall({
132
- package: packageAddress,
133
- module: 'deal',
134
- function: 'reject',
135
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
136
- typeArguments: options.typeArguments
137
- });
138
- }
139
- /** Returns the deal's object ID. */
140
- export function id(options) {
141
- const packageAddress = options.package ?? '@local-pkg/miso';
142
- const argumentsTypes = [
143
- null
144
- ];
145
- const parameterNames = ["self"];
146
- return (tx) => tx.moveCall({
147
- package: packageAddress,
148
- module: 'deal',
149
- function: 'id',
150
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
151
- typeArguments: options.typeArguments
152
- });
153
- }
154
- /** Returns the ID of the target release. */
155
- export function releaseId(options) {
156
- const packageAddress = options.package ?? '@local-pkg/miso';
157
- const argumentsTypes = [
158
- null
159
- ];
160
- const parameterNames = ["self"];
161
- return (tx) => tx.moveCall({
162
- package: packageAddress,
163
- module: 'deal',
164
- function: 'release_id',
165
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
166
- typeArguments: options.typeArguments
167
- });
168
- }
169
- /** Returns the track's revenue split in basis points. */
170
- export function trackSplitBps(options) {
171
- const packageAddress = options.package ?? '@local-pkg/miso';
172
- const argumentsTypes = [
173
- null
174
- ];
175
- const parameterNames = ["self"];
176
- return (tx) => tx.moveCall({
177
- package: packageAddress,
178
- module: 'deal',
179
- function: 'track_split_bps',
180
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
181
- typeArguments: options.typeArguments
182
- });
183
- }
184
- //# sourceMappingURL=deal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deal.js","sourceRoot":"","sources":["../../../src/contracts/miso/deal.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAA+B,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAC5C,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,WAAW,0DAA0D,EAAE,MAAM,EAAE;QACrH,uCAAuC;QACvC,EAAE,EAAE,GAAG,CAAC,OAAO;QACf,qDAAqD;QACrD,UAAU,EAAE,GAAG,CAAC,OAAO;QACvB,6DAA6D;QAC7D,eAAe,EAAE,GAAG,CAAC,GAAG;KAC3B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