@misonetwork/sdk 0.3.1 → 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.
- package/README.md +97 -503
- package/dist/client.d.ts +6 -55
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -52
- package/dist/client.js.map +1 -1
- package/dist/contracts/miso/release.d.ts +34 -31
- package/dist/contracts/miso/release.d.ts.map +1 -1
- package/dist/contracts/miso/release.js +32 -29
- package/dist/contracts/miso/release.js.map +1 -1
- package/dist/contracts/miso/track.d.ts +66 -22
- package/dist/contracts/miso/track.d.ts.map +1 -1
- package/dist/contracts/miso/track.js +65 -20
- package/dist/contracts/miso/track.js.map +1 -1
- package/dist/contracts/utils/index.d.ts +44 -0
- package/dist/contracts/utils/index.d.ts.map +1 -1
- package/dist/contracts/utils/index.js +104 -2
- package/dist/contracts/utils/index.js.map +1 -1
- package/dist/contracts.d.ts +0 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +0 -1
- package/dist/contracts.js.map +1 -1
- package/dist/internal.d.ts +0 -7
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +0 -22
- package/dist/internal.js.map +1 -1
- package/dist/parsers.d.ts +1 -4
- package/dist/parsers.d.ts.map +1 -1
- package/dist/parsers.js +0 -24
- package/dist/parsers.js.map +1 -1
- package/dist/queries.d.ts +31 -5
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +179 -56
- package/dist/queries.js.map +1 -1
- package/dist/transactions.d.ts +10 -71
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js +15 -72
- package/dist/transactions.js.map +1 -1
- package/dist/types.d.ts +3 -40
- package/dist/types.d.ts.map +1 -1
- package/dist/view.d.ts +7 -7
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +9 -9
- package/dist/view.js.map +1 -1
- package/package.json +4 -4
- package/src/client.ts +82 -89
- package/src/contracts/miso/release.ts +39 -36
- package/src/contracts/miso/track.ts +81 -23
- package/src/contracts/utils/index.ts +156 -4
- package/src/contracts.ts +0 -1
- package/src/internal.ts +0 -24
- package/src/parsers.ts +0 -35
- package/src/queries.ts +357 -83
- package/src/transactions.ts +20 -112
- package/src/types.ts +3 -53
- package/src/view.ts +13 -13
- package/dist/contracts/miso/deal.d.ts +0 -184
- package/dist/contracts/miso/deal.d.ts.map +0 -1
- package/dist/contracts/miso/deal.js +0 -184
- package/dist/contracts/miso/deal.js.map +0 -1
- package/src/contracts/miso/deal.ts +0 -257
package/src/transactions.ts
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
// Transaction builders. Every builder adds commands to a caller-owned
|
|
5
|
-
// `Transaction`, so flows compose in a single PTB
|
|
5
|
+
// `Transaction`, so flows compose in a single PTB.
|
|
6
6
|
// The `create*` primitives take the `Transaction` as their FIRST argument and
|
|
7
7
|
// return their by-value results, so those results can be threaded into later
|
|
8
|
-
// commands.
|
|
9
|
-
//
|
|
10
|
-
// codegen-generated, type-safe call functions.
|
|
8
|
+
// commands. Miso calls go through the codegen-generated, type-safe call
|
|
9
|
+
// functions.
|
|
11
10
|
//
|
|
12
11
|
// This module keeps the bare protocol PRIMITIVES only. The rule is: do the
|
|
13
12
|
// minimum the Move semantics FORCE, and return anything the caller could
|
|
14
13
|
// legitimately route elsewhere.
|
|
15
14
|
//
|
|
16
|
-
// `createComposition
|
|
15
|
+
// `createComposition` and `createRecording` each append a
|
|
17
16
|
// single `::new` and hand back its by-value results — never dispersing a share
|
|
18
17
|
// supply, publishing (sharing) the object, or routing an admin cap.
|
|
19
18
|
//
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
//
|
|
29
28
|
// The opinionated layers — track assembly, cap disposition, minato dispersal,
|
|
30
29
|
// the share-currency lifecycle — live in `@misofm/sdk`
|
|
31
|
-
// (`publishRelease`/`
|
|
30
|
+
// (`release_registry::new_release`, `publishRelease`/`publishReleaseGraph`,
|
|
32
31
|
// `finalizeComposition`/`finalizeRecording`/`finalizeRelease`,
|
|
33
32
|
// `publishComposition`/`publishRecording`/`publishCompositionAndRecording`,
|
|
34
33
|
// `share.ts`) as free functions taking `misoPackageId` explicitly. Those import
|
|
@@ -39,8 +38,7 @@ import { Transaction, type TransactionObjectArgument } from "@mysten/sui/transac
|
|
|
39
38
|
|
|
40
39
|
import * as composition from "./contracts/miso/composition.ts";
|
|
41
40
|
import * as recording from "./contracts/miso/recording.ts";
|
|
42
|
-
import * as
|
|
43
|
-
import * as release from "./contracts/miso/release.ts";
|
|
41
|
+
import * as track from "./contracts/miso/track.ts";
|
|
44
42
|
|
|
45
43
|
/** A thunk that adds commands to a transaction. May be async (resolves at build time). */
|
|
46
44
|
export type TxThunk = (tx: Transaction) => void | Promise<void>;
|
|
@@ -153,138 +151,48 @@ export function createRecording(tx: Transaction, params: CreateRecordingParams):
|
|
|
153
151
|
}
|
|
154
152
|
|
|
155
153
|
// ============================================================================
|
|
156
|
-
//
|
|
154
|
+
// Track
|
|
157
155
|
// ============================================================================
|
|
158
156
|
|
|
159
|
-
export interface
|
|
157
|
+
export interface CreateTrackParams {
|
|
160
158
|
recordingId: string;
|
|
161
159
|
recordingAdminCapId?: string;
|
|
162
160
|
recordingAdminCap?: TransactionObjectArgument;
|
|
163
|
-
/** Share type of the recording (the
|
|
161
|
+
/** Share type of the recording (the track's `RecordingShare` phantom). */
|
|
164
162
|
recordingShareType: string;
|
|
165
|
-
/** Share type of the parent composition (the
|
|
163
|
+
/** Share type of the parent composition (the track's `CompositionShare` phantom). */
|
|
166
164
|
compositionShareType: string;
|
|
167
|
-
|
|
165
|
+
targetReleaseId: string;
|
|
168
166
|
trackSplitBps: number;
|
|
169
167
|
misoPackageId: string;
|
|
170
168
|
}
|
|
171
169
|
|
|
172
170
|
/**
|
|
173
|
-
* PRIMITIVE. Appends `
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
* transaction. It is `key, store` with no `drop`, so it cannot be discarded, but
|
|
178
|
-
* it CAN go to either of two places, which is exactly why this does not choose:
|
|
179
|
-
*
|
|
180
|
-
* 1. `tx.transferObjects([deal], recipient)` — send it to whoever is
|
|
181
|
-
* assembling the release, for them to redeem later. This is the
|
|
182
|
-
* cross-party flow: a recording owner signs a deal for someone else's
|
|
183
|
-
* release.
|
|
184
|
-
* 2. straight into `track::new(deal, &recording)` in this same PTB — the
|
|
185
|
-
* same-party flow, where the deal is a transient authorization rather than
|
|
186
|
-
* something anyone holds. `@misofm/sdk`'s `publishReleaseGraph` does this.
|
|
187
|
-
*
|
|
188
|
-
* Both are legitimate, and picking one for the caller would make the other
|
|
189
|
-
* awkward, so the disposition stays with the caller. `@misofm/sdk` layers the
|
|
190
|
-
* opinionated flows on top.
|
|
171
|
+
* PRIMITIVE. Appends `track::new` and returns its by-value `Track`. A track has
|
|
172
|
+
* `drop, store`, so callers may leave it unused; to assemble a release, pass
|
|
173
|
+
* returned tracks to `tx.makeMoveVec({ type: `${misoPackageId}::track::Track`,
|
|
174
|
+
* elements })` and then call `release_registry::new_release` from `@misofm/sdk`.
|
|
191
175
|
*
|
|
192
176
|
* The `recordingAdminCap` may be passed as an on-chain object id
|
|
193
177
|
* (`recordingAdminCapId`) or as a PTB-local argument (`recordingAdminCap`) —
|
|
194
|
-
* the latter lets a
|
|
178
|
+
* the latter lets a track be created against a recording created earlier in the
|
|
195
179
|
* same transaction, before its cap has been transferred anywhere.
|
|
196
180
|
*/
|
|
197
|
-
export function
|
|
181
|
+
export function createTrack(tx: Transaction, params: CreateTrackParams): TransactionObjectArgument {
|
|
198
182
|
if (!params.recordingAdminCap && !params.recordingAdminCapId) {
|
|
199
|
-
throw new Error("
|
|
183
|
+
throw new Error("createTrack: recordingAdminCapId or recordingAdminCap required");
|
|
200
184
|
}
|
|
201
185
|
const adminCapArg = params.recordingAdminCap ?? tx.object(params.recordingAdminCapId!);
|
|
202
186
|
return tx.add(
|
|
203
|
-
|
|
187
|
+
track._new({
|
|
204
188
|
package: params.misoPackageId,
|
|
205
189
|
typeArguments: [params.recordingShareType, params.compositionShareType],
|
|
206
190
|
arguments: [
|
|
207
191
|
adminCapArg,
|
|
208
192
|
tx.object(params.recordingId),
|
|
209
|
-
tx.pure.id(params.
|
|
193
|
+
tx.pure.id(params.targetReleaseId),
|
|
210
194
|
tx.pure.u16(params.trackSplitBps),
|
|
211
195
|
],
|
|
212
196
|
}),
|
|
213
197
|
);
|
|
214
198
|
}
|
|
215
|
-
|
|
216
|
-
export interface RejectDealParams {
|
|
217
|
-
dealId: string;
|
|
218
|
-
/** Share type of the recording (the deal's `RecordingShare` phantom). */
|
|
219
|
-
recordingShareType: string;
|
|
220
|
-
/** Share type of the parent composition (the deal's `CompositionShare` phantom). */
|
|
221
|
-
compositionShareType: string;
|
|
222
|
-
misoPackageId: string;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/** Rejects (destroys) a deal without including it in a release. Emits `DealRejectedEvent`. */
|
|
226
|
-
export function rejectDeal(params: RejectDealParams): TxThunk {
|
|
227
|
-
return (tx) => {
|
|
228
|
-
tx.add(deal.reject({
|
|
229
|
-
package: params.misoPackageId,
|
|
230
|
-
typeArguments: [params.recordingShareType, params.compositionShareType],
|
|
231
|
-
arguments: [tx.object(params.dealId)],
|
|
232
|
-
}));
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// ============================================================================
|
|
237
|
-
// Release
|
|
238
|
-
// ============================================================================
|
|
239
|
-
|
|
240
|
-
/** The two by-value results of `release::new`, for threading onward in a PTB. */
|
|
241
|
-
export interface ReleaseParts {
|
|
242
|
-
release: TransactionObjectArgument;
|
|
243
|
-
adminCap: TransactionObjectArgument;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export interface CreateReleaseParams {
|
|
247
|
-
title: string;
|
|
248
|
-
/** u256 nonce as a decimal string (deterministic release id). */
|
|
249
|
-
nonce: string;
|
|
250
|
-
releaseRegistryId: string;
|
|
251
|
-
misoPackageId: string;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* PRIMITIVE. Appends `release::new` over a caller-built `vector<Track>` and
|
|
256
|
-
* returns its by-value results without publishing (sharing) the release or
|
|
257
|
-
* routing the admin cap — the caller decides what happens next. Mirrors
|
|
258
|
-
* {@link createComposition}/{@link createRecording}.
|
|
259
|
-
*
|
|
260
|
-
* `trackVec` is supplied by the caller because track assembly is the part that
|
|
261
|
-
* genuinely varies between release flows: from recording admin caps, from
|
|
262
|
-
* pre-made deals, or from a mix of fresh and existing recordings (see
|
|
263
|
-
* `@misofm/sdk`'s `publishRelease`/`publishReleaseFromDeals`/
|
|
264
|
-
* `publishReleaseGraph`).
|
|
265
|
-
*
|
|
266
|
-
* LIFECYCLE NOTE — the returned `Release` MUST be consumed by
|
|
267
|
-
* `release::publish` in this same transaction. `Release` is `key`-only with no
|
|
268
|
-
* `drop`, and `publish` is its only by-value consumer, so an `Initialized`
|
|
269
|
-
* release cannot be transferred, wrapped, shared, or discarded, and cannot
|
|
270
|
-
* outlive its creating transaction; the protocol deliberately provides no keep
|
|
271
|
-
* function. That is a same-PTB requirement, NOT a same-function one — pairing
|
|
272
|
-
* this with a later `finalizeRelease` command in the same `tx` satisfies it.
|
|
273
|
-
* (`Composition` and `Recording` carry the identical requirement, which is why
|
|
274
|
-
* all three primitives have the same shape.) The admin cap has no such
|
|
275
|
-
* constraint: `ReleaseAdminCap` is `key, store` and `publish` only borrows it,
|
|
276
|
-
* so it is an ordinary transferable value the caller routes as it sees fit.
|
|
277
|
-
*/
|
|
278
|
-
export function createRelease(
|
|
279
|
-
tx: Transaction,
|
|
280
|
-
params: CreateReleaseParams,
|
|
281
|
-
trackVec: TransactionObjectArgument,
|
|
282
|
-
): ReleaseParts {
|
|
283
|
-
const result = tx.add(
|
|
284
|
-
release._new({
|
|
285
|
-
package: params.misoPackageId,
|
|
286
|
-
arguments: [tx.pure.string(params.title), trackVec, tx.pure.u256(BigInt(params.nonce)), tx.object(params.releaseRegistryId)],
|
|
287
|
-
}),
|
|
288
|
-
);
|
|
289
|
-
return { release: result[0]!, adminCap: result[1]! };
|
|
290
|
-
}
|
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
|
|
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
|
|
201
|
-
*
|
|
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
|
|
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
|
|
24
|
-
|
|
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::
|
|
30
|
-
*
|
|
31
|
-
* front and threaded into the release
|
|
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
|
|
33
|
+
export async function deriveTargetReleaseId(
|
|
34
34
|
client: ClientWithCoreApi,
|
|
35
35
|
misoPackageId: string,
|
|
36
|
-
params:
|
|
36
|
+
params: DeriveTargetReleaseIdParams,
|
|
37
37
|
): Promise<string> {
|
|
38
38
|
if (params.recordingIds.length !== params.splitBps.length) {
|
|
39
|
-
throw new Error(`
|
|
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.
|
|
45
|
+
release.deriveTargetReleaseId({
|
|
46
46
|
package: misoPackageId,
|
|
47
|
-
arguments: [params.recordingIds, params.splitBps.map((v) => BigInt(v)), BigInt(params.nonce), params.
|
|
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(`
|
|
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("
|
|
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,EAA0B,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEpG,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,eAAO,MAAM,IAAI;IACT,uCAAuC;;IAEvC,qDAAqD;;IAErD,6DAA6D;;mFAE7D,CAAC;AACT,eAAO,MAAM,gBAAgB;IACrB,sBAAsB;;IAEtB,yDAAyD;;IAEzD,gCAAgC;;IAEhC,iDAAiD;;;+FAGjD,CAAC;AACT,eAAO,MAAM,iBAAiB;IACtB,sBAAsB;;IAEtB,gCAAgC;;gGAEhC,CAAC;AACT,eAAO,MAAM,iBAAiB;IACtB,sBAAsB;;IAEtB,gCAAgC;;gGAEhC,CAAC;AACT,MAAM,WAAW,YAAY;IACzB,CAAC,EAAE,sBAAsB,CAAC,MAAM,CA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