@misofm/platform 0.0.0 → 0.18.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/LICENSE +201 -0
- package/README.md +686 -3
- package/dist/auth.d.ts +73 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +193 -0
- package/dist/auth.js.map +1 -0
- package/dist/catalog.d.ts +48 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +92 -0
- package/dist/catalog.js.map +1 -0
- package/dist/client.d.ts +462 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +788 -0
- package/dist/client.js.map +1 -0
- package/dist/contracts.d.ts +34 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +49 -0
- package/dist/contracts.js.map +1 -0
- package/dist/cover.d.ts +69 -0
- package/dist/cover.d.ts.map +1 -0
- package/dist/cover.js +132 -0
- package/dist/cover.js.map +1 -0
- package/dist/credits.d.ts +200 -0
- package/dist/credits.d.ts.map +1 -0
- package/dist/credits.js +465 -0
- package/dist/credits.js.map +1 -0
- package/dist/deployments.d.ts +224 -0
- package/dist/deployments.d.ts.map +1 -0
- package/dist/deployments.js +177 -0
- package/dist/deployments.js.map +1 -0
- package/dist/execute.d.ts +30 -0
- package/dist/execute.d.ts.map +1 -0
- package/dist/execute.js +31 -0
- package/dist/execute.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +13 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +41 -0
- package/dist/internal.js.map +1 -0
- package/dist/mix.d.ts +144 -0
- package/dist/mix.d.ts.map +1 -0
- package/dist/mix.js +656 -0
- package/dist/mix.js.map +1 -0
- package/dist/pressing.d.ts +137 -0
- package/dist/pressing.d.ts.map +1 -0
- package/dist/pressing.js +390 -0
- package/dist/pressing.js.map +1 -0
- package/dist/publication.d.ts +216 -0
- package/dist/publication.d.ts.map +1 -0
- package/dist/publication.js +872 -0
- package/dist/publication.js.map +1 -0
- package/dist/queries.d.ts +2 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +8 -0
- package/dist/queries.js.map +1 -0
- package/dist/read/artist.d.ts +18 -0
- package/dist/read/artist.d.ts.map +1 -0
- package/dist/read/artist.js +86 -0
- package/dist/read/artist.js.map +1 -0
- package/dist/read/catalog.d.ts +93 -0
- package/dist/read/catalog.d.ts.map +1 -0
- package/dist/read/catalog.js +441 -0
- package/dist/read/catalog.js.map +1 -0
- package/dist/read/client.d.ts +37 -0
- package/dist/read/client.d.ts.map +1 -0
- package/dist/read/client.js +50 -0
- package/dist/read/client.js.map +1 -0
- package/dist/read/config.d.ts +68 -0
- package/dist/read/config.d.ts.map +1 -0
- package/dist/read/config.js +63 -0
- package/dist/read/config.js.map +1 -0
- package/dist/read/genres.d.ts +7 -0
- package/dist/read/genres.d.ts.map +1 -0
- package/dist/read/genres.js +38 -0
- package/dist/read/genres.js.map +1 -0
- package/dist/read/index.d.ts +14 -0
- package/dist/read/index.d.ts.map +1 -0
- package/dist/read/index.js +23 -0
- package/dist/read/index.js.map +1 -0
- package/dist/read/internal/scalars.d.ts +23 -0
- package/dist/read/internal/scalars.d.ts.map +1 -0
- package/dist/read/internal/scalars.js +57 -0
- package/dist/read/internal/scalars.js.map +1 -0
- package/dist/read/internal/walrus.d.ts +6 -0
- package/dist/read/internal/walrus.d.ts.map +1 -0
- package/dist/read/internal/walrus.js +29 -0
- package/dist/read/internal/walrus.js.map +1 -0
- package/dist/read/receipts.d.ts +41 -0
- package/dist/read/receipts.d.ts.map +1 -0
- package/dist/read/receipts.js +398 -0
- package/dist/read/receipts.js.map +1 -0
- package/dist/read/types.d.ts +328 -0
- package/dist/read/types.d.ts.map +1 -0
- package/dist/read/types.js +21 -0
- package/dist/read/types.js.map +1 -0
- package/dist/read/wallet.d.ts +74 -0
- package/dist/read/wallet.d.ts.map +1 -0
- package/dist/read/wallet.js +578 -0
- package/dist/read/wallet.js.map +1 -0
- package/dist/read/works.d.ts +29 -0
- package/dist/read/works.d.ts.map +1 -0
- package/dist/read/works.js +191 -0
- package/dist/read/works.js.map +1 -0
- package/dist/recording-extensions.d.ts +62 -0
- package/dist/recording-extensions.d.ts.map +1 -0
- package/dist/recording-extensions.js +159 -0
- package/dist/recording-extensions.js.map +1 -0
- package/dist/release-extensions.d.ts +93 -0
- package/dist/release-extensions.d.ts.map +1 -0
- package/dist/release-extensions.js +190 -0
- package/dist/release-extensions.js.map +1 -0
- package/dist/release-graph.d.ts +65 -0
- package/dist/release-graph.d.ts.map +1 -0
- package/dist/release-graph.js +136 -0
- package/dist/release-graph.js.map +1 -0
- package/dist/share-template.d.ts +3 -0
- package/dist/share-template.d.ts.map +1 -0
- package/dist/share-template.js +46 -0
- package/dist/share-template.js.map +1 -0
- package/dist/share.d.ts +67 -0
- package/dist/share.d.ts.map +1 -0
- package/dist/share.js +157 -0
- package/dist/share.js.map +1 -0
- package/dist/transactions.d.ts +216 -0
- package/dist/transactions.d.ts.map +1 -0
- package/dist/transactions.js +314 -0
- package/dist/transactions.js.map +1 -0
- package/dist/vault.d.ts +364 -0
- package/dist/vault.d.ts.map +1 -0
- package/dist/vault.js +507 -0
- package/dist/vault.js.map +1 -0
- package/package.json +145 -5
- package/src/auth.ts +275 -0
- package/src/catalog.ts +189 -0
- package/src/client.ts +1320 -0
- package/src/contracts.ts +54 -0
- package/src/cover.ts +240 -0
- package/src/credits.ts +906 -0
- package/src/deployments.ts +357 -0
- package/src/execute.ts +52 -0
- package/src/index.ts +69 -0
- package/src/internal.ts +46 -0
- package/src/mix.ts +910 -0
- package/src/pressing.ts +705 -0
- package/src/publication.ts +1214 -0
- package/src/queries.ts +9 -0
- package/src/read/artist.ts +118 -0
- package/src/read/catalog.ts +668 -0
- package/src/read/client.ts +87 -0
- package/src/read/config.ts +138 -0
- package/src/read/genres.ts +37 -0
- package/src/read/index.ts +85 -0
- package/src/read/internal/scalars.ts +59 -0
- package/src/read/internal/walrus.ts +42 -0
- package/src/read/receipts.ts +476 -0
- package/src/read/types.ts +415 -0
- package/src/read/wallet.ts +687 -0
- package/src/read/works.ts +297 -0
- package/src/recording-extensions.ts +256 -0
- package/src/release-extensions.ts +311 -0
- package/src/release-graph.ts +219 -0
- package/src/share-template.ts +55 -0
- package/src/share.ts +261 -0
- package/src/transactions.ts +542 -0
- package/src/vault.ts +1009 -0
package/src/client.ts
ADDED
|
@@ -0,0 +1,1320 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// The client extension — Sui's recommended shape for an SDK
|
|
5
|
+
// (https://sdk.mystenlabs.com/sui/sdk-building). Register it once and the
|
|
6
|
+
// platform layer hangs off whatever client you already have:
|
|
7
|
+
//
|
|
8
|
+
// const client = new SuiGrpcClient({ network, baseUrl }).$extend(miso());
|
|
9
|
+
//
|
|
10
|
+
// await client.miso.getSale({ releaseId, edition, currencyType });
|
|
11
|
+
// await client.miso.protocol.getReleaseById(releaseId);
|
|
12
|
+
// tx.add(client.miso.tx.purchaseRecord({ releaseId, edition, currencyType,
|
|
13
|
+
// paymentAmount, expectedPricing, recipient }));
|
|
14
|
+
//
|
|
15
|
+
// Two things this buys over calling the bare functions:
|
|
16
|
+
//
|
|
17
|
+
// IDS ARE CONFIGURED ONCE. Every builder and reader below needs the pressing
|
|
18
|
+
// package id. Threading those
|
|
19
|
+
// through 20 call sites is how an app ends up publishing against one package and
|
|
20
|
+
// reading against another.
|
|
21
|
+
//
|
|
22
|
+
// IT COMPOSES. `register` takes the transport-agnostic `ClientWithCoreApi`, never
|
|
23
|
+
// a concrete client, so this works on gRPC, GraphQL, or JSON-RPC — and the
|
|
24
|
+
// builders stay thunks, so a platform call and a protocol call go in the same PTB.
|
|
25
|
+
//
|
|
26
|
+
// Namespaces follow the guide's convention: top-level methods read and parse,
|
|
27
|
+
// `tx` builds transactions without executing, `bcs` exposes the generated struct
|
|
28
|
+
// definitions, `ids` is the address math that replaces a registry.
|
|
29
|
+
|
|
30
|
+
import type {
|
|
31
|
+
ClientWithCoreApi,
|
|
32
|
+
SuiClientRegistration,
|
|
33
|
+
} from "@mysten/sui/client";
|
|
34
|
+
import type {} from "@mysten/bcs";
|
|
35
|
+
import type { Signer } from "@mysten/sui/cryptography";
|
|
36
|
+
import type { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
37
|
+
import type { ParallelTransactionExecutor } from "@mysten/sui/transactions";
|
|
38
|
+
import {
|
|
39
|
+
miso as protocolMiso,
|
|
40
|
+
type MisoProtocolClient,
|
|
41
|
+
} from "@misofm/protocol/client";
|
|
42
|
+
import type { PartyProtocolClient } from "@misofm/protocol/party";
|
|
43
|
+
|
|
44
|
+
import * as recordContract from "@misofm/protocol/contracts/miso_record/record";
|
|
45
|
+
import * as pressingContract from "@misofm/protocol/contracts/miso_record/pressing";
|
|
46
|
+
import * as listingContract from "@misofm/protocol/contracts/miso_record_shop/listing";
|
|
47
|
+
import * as genreContract from "@misofm/protocol/contracts/genre/genre";
|
|
48
|
+
import * as releaseDescriptionContract from "@misofm/protocol/contracts/release_description/release_description";
|
|
49
|
+
import * as releaseDspLinkContract from "@misofm/protocol/contracts/release_dsp_link/release_dsp_link";
|
|
50
|
+
import * as releaseGenreContract from "@misofm/protocol/contracts/release_genre/release_genre";
|
|
51
|
+
import * as releaseKindContract from "@misofm/protocol/contracts/release_kind/release_kind";
|
|
52
|
+
import * as releaseRevenueDistributorContract from "@misofm/protocol/contracts/release_revenue_distributor/release_revenue_distributor";
|
|
53
|
+
import * as vaultContract from "@misofm/protocol/contracts/vault/vault";
|
|
54
|
+
import * as compositionRoyaltyPoolContract from "@misofm/protocol/contracts/composition_royalty_pool/composition_royalty_pool";
|
|
55
|
+
import * as recordingRoyaltyPoolContract from "@misofm/protocol/contracts/recording_royalty_pool/recording_royalty_pool";
|
|
56
|
+
import * as partyWalletContract from "@misofm/protocol/contracts/party_wallet/party_wallet";
|
|
57
|
+
import * as compositionRoutedStakeContract from "@misofm/protocol/contracts/composition_routed_stake/composition_routed_stake";
|
|
58
|
+
import * as compositionRoyaltyPoolPluginContract from "@misofm/protocol/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin";
|
|
59
|
+
import * as recordingRoyaltyPoolPluginContract from "@misofm/protocol/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin";
|
|
60
|
+
import * as releaseRevenueDistributorPluginContract from "@misofm/protocol/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin";
|
|
61
|
+
import * as routedStakeContract from "@misofm/protocol/contracts/routed_stake/routed_stake";
|
|
62
|
+
import * as royaltyPoolContract from "@misofm/protocol/contracts/royalty_pool/pool";
|
|
63
|
+
import * as recordingAdvisoryContract from "@misofm/protocol/contracts/recording_advisory/recording_advisory";
|
|
64
|
+
import * as recordingLanguageContract from "@misofm/protocol/contracts/recording_language/recording_language";
|
|
65
|
+
import * as recordingMasterReferenceContract from "@misofm/protocol/contracts/recording_master_reference/recording_master_reference";
|
|
66
|
+
import * as recordingStreamingTranscodeContract from "@misofm/protocol/contracts/recording_streaming_transcode/recording_streaming_transcode";
|
|
67
|
+
import * as recordingPreviewContract from "@misofm/protocol/contracts/recording_preview/recording_preview";
|
|
68
|
+
import * as vaultActions from "./vault.ts";
|
|
69
|
+
import * as coverArtContract from "@misofm/protocol/contracts/cover_art/cover_art";
|
|
70
|
+
import * as releaseCoverArtContract from "@misofm/protocol/contracts/release_cover_art/release_cover_art";
|
|
71
|
+
import * as releaseCreditsContract from "@misofm/protocol/contracts/release_credits/release_credits";
|
|
72
|
+
import {
|
|
73
|
+
authorizeRecordShop,
|
|
74
|
+
deriveListingId,
|
|
75
|
+
derivePressingAdminCapId,
|
|
76
|
+
derivePressingId,
|
|
77
|
+
deriveRecordId,
|
|
78
|
+
deriveSaleIds,
|
|
79
|
+
getListing,
|
|
80
|
+
getPressing,
|
|
81
|
+
getRecord,
|
|
82
|
+
getSale,
|
|
83
|
+
openListing,
|
|
84
|
+
openPressing,
|
|
85
|
+
purchaseRecord,
|
|
86
|
+
revokeRecordShop,
|
|
87
|
+
setListingPrice,
|
|
88
|
+
setListingState,
|
|
89
|
+
} from "./pressing.ts";
|
|
90
|
+
import type {
|
|
91
|
+
GetSaleParams,
|
|
92
|
+
ListingView,
|
|
93
|
+
OpenListingParams,
|
|
94
|
+
OpenPressingParams,
|
|
95
|
+
PressingAdministrationParams,
|
|
96
|
+
PressingView,
|
|
97
|
+
PurchaseRecordParams,
|
|
98
|
+
RecordView,
|
|
99
|
+
SetListingPriceParams,
|
|
100
|
+
SetListingStateParams,
|
|
101
|
+
} from "./pressing.ts";
|
|
102
|
+
import {
|
|
103
|
+
publishShareCurrency,
|
|
104
|
+
initializeShareCurrency,
|
|
105
|
+
publishComposition,
|
|
106
|
+
publishRecording,
|
|
107
|
+
publishCompositionAndRecording,
|
|
108
|
+
publishRelease,
|
|
109
|
+
} from "./transactions.ts";
|
|
110
|
+
import type {
|
|
111
|
+
TxThunk,
|
|
112
|
+
PublishCompositionParams,
|
|
113
|
+
PublishRecordingParams,
|
|
114
|
+
PublishCompositionAndRecordingParams,
|
|
115
|
+
PublishReleaseParams,
|
|
116
|
+
} from "./transactions.ts";
|
|
117
|
+
import * as share from "./share.ts";
|
|
118
|
+
import {
|
|
119
|
+
publishReleaseGraph,
|
|
120
|
+
type PublishReleaseGraphParams,
|
|
121
|
+
} from "./release-graph.ts";
|
|
122
|
+
import {
|
|
123
|
+
getMisoPlatformDeployment,
|
|
124
|
+
requireOperationsDeployment,
|
|
125
|
+
requireRecordSalesDeployment,
|
|
126
|
+
type MisoPlatformDeployment,
|
|
127
|
+
type OperationsDeployment,
|
|
128
|
+
type RecordSalesDeployment,
|
|
129
|
+
} from "./deployments.ts";
|
|
130
|
+
import { immutableSnapshot } from "./internal.ts";
|
|
131
|
+
import {
|
|
132
|
+
deriveGenreAddress,
|
|
133
|
+
setReleaseDescription,
|
|
134
|
+
setReleaseDspLinks,
|
|
135
|
+
setReleaseGenres,
|
|
136
|
+
setReleaseKind,
|
|
137
|
+
type SetReleaseDescriptionParams,
|
|
138
|
+
type SetReleaseDspLinksParams,
|
|
139
|
+
type SetReleaseGenresParams,
|
|
140
|
+
type SetReleaseKindParams,
|
|
141
|
+
} from "./release-extensions.ts";
|
|
142
|
+
import {
|
|
143
|
+
setRecordingStreamingTranscode,
|
|
144
|
+
unsetRecordingStreamingTranscode,
|
|
145
|
+
type SetRecordingStreamingTranscodeParams,
|
|
146
|
+
type UnsetRecordingStreamingTranscodeParams,
|
|
147
|
+
} from "./recording-extensions.ts";
|
|
148
|
+
import { addReleaseCredit, type AddReleaseCreditParams } from "./credits.ts";
|
|
149
|
+
import {
|
|
150
|
+
setReleaseCover,
|
|
151
|
+
setReleaseTrackCover,
|
|
152
|
+
type SetReleaseCoverParams,
|
|
153
|
+
type SetReleaseTrackCoverParams,
|
|
154
|
+
} from "./cover.ts";
|
|
155
|
+
import {
|
|
156
|
+
executeViaExecutor as executePlatformViaExecutor,
|
|
157
|
+
type PlatformExecResult,
|
|
158
|
+
} from "./execute.ts";
|
|
159
|
+
|
|
160
|
+
type BoundMoveFunction<F> = F extends (options: infer Options) => infer Result
|
|
161
|
+
? Options extends { package?: unknown }
|
|
162
|
+
? (options: Omit<Options, "package">) => Result
|
|
163
|
+
: F
|
|
164
|
+
: F;
|
|
165
|
+
type BoundModule<M extends object, Available extends readonly (keyof M)[]> = {
|
|
166
|
+
[Key in Available[number]]: BoundMoveFunction<M[Key]>;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Bind an explicit safe subset of a generated module to one immutable package.
|
|
171
|
+
* Callers cannot supply or override `package`; reference-returning, UID-only,
|
|
172
|
+
* and package-internal constructors never appear in this executable facade.
|
|
173
|
+
*/
|
|
174
|
+
function bindModulePackage<M extends object, K extends readonly (keyof M)[]>(
|
|
175
|
+
mod: M,
|
|
176
|
+
pkg: string,
|
|
177
|
+
available: K,
|
|
178
|
+
): BoundModule<M, K> {
|
|
179
|
+
const out: Record<string, unknown> = {};
|
|
180
|
+
for (const key of available) {
|
|
181
|
+
const value = (mod as Record<PropertyKey, unknown>)[key];
|
|
182
|
+
out[String(key)] =
|
|
183
|
+
typeof value === "function"
|
|
184
|
+
? (options: { package?: string }) =>
|
|
185
|
+
(value as (o: unknown) => unknown)({ ...options, package: pkg })
|
|
186
|
+
: value;
|
|
187
|
+
}
|
|
188
|
+
return out as BoundModule<M, K>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Keep synchronous, client-bound surfaces unusable until the endpoint's exact
|
|
192
|
+
* ledger has been validated. The underlying standalone builders remain pure. */
|
|
193
|
+
function requireReadyOnFunctions<T extends object>(
|
|
194
|
+
surface: T,
|
|
195
|
+
requireReady: (operation: string) => void,
|
|
196
|
+
namespace: string,
|
|
197
|
+
): T {
|
|
198
|
+
return new Proxy(surface, {
|
|
199
|
+
get(target, property, receiver) {
|
|
200
|
+
const value = Reflect.get(target, property, receiver) as unknown;
|
|
201
|
+
if (typeof value !== "function") return value;
|
|
202
|
+
return (...args: unknown[]) => {
|
|
203
|
+
requireReady(`${namespace}.${String(property)}`);
|
|
204
|
+
return Reflect.apply(value, target, args);
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function requireReadyOnModuleFunctions<T extends object>(
|
|
211
|
+
surface: T,
|
|
212
|
+
requireReady: (operation: string) => void,
|
|
213
|
+
namespace: string,
|
|
214
|
+
): T {
|
|
215
|
+
return new Proxy(surface, {
|
|
216
|
+
get(target, property, receiver) {
|
|
217
|
+
const value = Reflect.get(target, property, receiver) as unknown;
|
|
218
|
+
if (!value || typeof value !== "object") return value;
|
|
219
|
+
return requireReadyOnFunctions(
|
|
220
|
+
value,
|
|
221
|
+
requireReady,
|
|
222
|
+
`${namespace}.${String(property)}`,
|
|
223
|
+
);
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface MisoOptions<Name extends string = "miso"> {
|
|
229
|
+
/** Name for the client extension. Defaults to `miso`. */
|
|
230
|
+
name?: Name;
|
|
231
|
+
/** Complete custom deployment; omit to select the bundled client network. */
|
|
232
|
+
deployment?: MisoPlatformDeployment;
|
|
233
|
+
/** Required only by protocol methods that perform global type discovery. */
|
|
234
|
+
graphqlClient?: SuiGraphQLClient;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export class MisoNetworkMismatchError extends Error {
|
|
238
|
+
override readonly name = "MisoNetworkMismatchError";
|
|
239
|
+
constructor(
|
|
240
|
+
readonly clientNetwork: string,
|
|
241
|
+
readonly deploymentNetwork: string,
|
|
242
|
+
) {
|
|
243
|
+
super(
|
|
244
|
+
`@misofm/platform: client network "${clientNetwork}" does not match deployment network "${deploymentNetwork}"`,
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export class MisoChainIdentifierMismatchError extends Error {
|
|
250
|
+
override readonly name = "MisoChainIdentifierMismatchError";
|
|
251
|
+
constructor(
|
|
252
|
+
readonly actual: string,
|
|
253
|
+
readonly expected: string,
|
|
254
|
+
) {
|
|
255
|
+
super(
|
|
256
|
+
`@misofm/platform: endpoint chain identifier "${actual}" does not match deployment chain identifier "${expected}"`,
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export class MisoClientNotReadyError extends Error {
|
|
262
|
+
override readonly name = "MisoClientNotReadyError";
|
|
263
|
+
constructor(readonly operation: string) {
|
|
264
|
+
super(
|
|
265
|
+
`@misofm/platform: ${operation} requires an exact-chain validation lifecycle; call and await client.miso.ready() first`,
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface MisoPlatformConfig {
|
|
271
|
+
/** Exact client network label for deprecated `misoPlatform()` registration. */
|
|
272
|
+
network?: string;
|
|
273
|
+
/** Exact ledger identifier required by deprecated `misoPlatform().ready()`. */
|
|
274
|
+
chainIdentifier?: string;
|
|
275
|
+
/** Finalized immutable Record + Record Shop identities, or an explicit
|
|
276
|
+
* unavailable legacy state that makes every sales API fail closed. */
|
|
277
|
+
recordSales?: RecordSalesDeployment;
|
|
278
|
+
/**
|
|
279
|
+
* The `@misofm/protocol` protocol package (miso core). Required for the
|
|
280
|
+
* publish builders (`publishComposition`, `publishRecording`,
|
|
281
|
+
* `publishCompositionAndRecording`) — optional if this client only ever
|
|
282
|
+
* sells pressed records.
|
|
283
|
+
*/
|
|
284
|
+
misoPackageId?: string;
|
|
285
|
+
/**
|
|
286
|
+
* The minato share-disperse package. Bound into the publish builders so
|
|
287
|
+
* callers don't repeat it; required alongside `misoPackageId` for the same
|
|
288
|
+
* builders (they disperse shares via minato).
|
|
289
|
+
*/
|
|
290
|
+
minatoPackageId?: string;
|
|
291
|
+
/** The shared core `miso::release::ReleaseRegistry` object. */
|
|
292
|
+
releaseRegistryId?: string;
|
|
293
|
+
/** Release metadata/discovery extension package ids. */
|
|
294
|
+
releaseKindPackageId?: string;
|
|
295
|
+
releaseDescriptionPackageId?: string;
|
|
296
|
+
releaseGenrePackageId?: string;
|
|
297
|
+
releaseDspLinkPackageId?: string;
|
|
298
|
+
recordingAdvisoryPackageId?: string;
|
|
299
|
+
recordingLanguagePackageId?: string;
|
|
300
|
+
recordingMasterReferencePackageId?: string;
|
|
301
|
+
recordingStreamingTranscodePackageId?: string;
|
|
302
|
+
recordingPreviewPackageId?: string;
|
|
303
|
+
/** Structurally complete Vault/Action/plugin identity set. */
|
|
304
|
+
operations?: OperationsDeployment;
|
|
305
|
+
/** Generic royalty-pool value package used by pool and routed-stake helpers. */
|
|
306
|
+
royaltyPoolPackageId?: string;
|
|
307
|
+
routedStakePackageId?: string;
|
|
308
|
+
releaseCreditsPackageId?: string;
|
|
309
|
+
misoCreditPackageId?: string;
|
|
310
|
+
coverArtPackageId?: string;
|
|
311
|
+
releaseCoverArtPackageId?: string;
|
|
312
|
+
/** Curated genre vocabulary package and its shared derivation parent. */
|
|
313
|
+
genrePackageId?: string;
|
|
314
|
+
genreRegistryId?: string;
|
|
315
|
+
/** External ori package used to create WalrusData values. */
|
|
316
|
+
oriPackageId?: string;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** Params with the ids this client already knows dropped from the call site. */
|
|
320
|
+
type DistributiveOmit<T, Keys extends PropertyKey> = T extends unknown
|
|
321
|
+
? Omit<T, Keys>
|
|
322
|
+
: never;
|
|
323
|
+
type Configured<T> = DistributiveOmit<
|
|
324
|
+
T,
|
|
325
|
+
"recordPackageId" | "recordShopPackageId"
|
|
326
|
+
>;
|
|
327
|
+
|
|
328
|
+
/** Publish-builder params with the protocol/minato ids this client already knows dropped. */
|
|
329
|
+
type ConfiguredPublish<T> = DistributiveOmit<
|
|
330
|
+
T,
|
|
331
|
+
"misoPackageId" | "minatoPackageId"
|
|
332
|
+
>;
|
|
333
|
+
|
|
334
|
+
/** Release-builder params with this client's core, share, and registry ids dropped. */
|
|
335
|
+
type ConfiguredRelease<T> = DistributiveOmit<
|
|
336
|
+
T,
|
|
337
|
+
"misoPackageId" | "minatoPackageId" | "releaseRegistryId"
|
|
338
|
+
>;
|
|
339
|
+
|
|
340
|
+
type ConfiguredReleaseKind = DistributiveOmit<
|
|
341
|
+
SetReleaseKindParams,
|
|
342
|
+
"releaseKindPackageId"
|
|
343
|
+
>;
|
|
344
|
+
type ConfiguredReleaseDescription = DistributiveOmit<
|
|
345
|
+
SetReleaseDescriptionParams,
|
|
346
|
+
"releaseDescriptionPackageId"
|
|
347
|
+
>;
|
|
348
|
+
type ConfiguredReleaseGenres = DistributiveOmit<
|
|
349
|
+
SetReleaseGenresParams,
|
|
350
|
+
"releaseGenrePackageId"
|
|
351
|
+
>;
|
|
352
|
+
type ConfiguredReleaseDspLinks = DistributiveOmit<
|
|
353
|
+
SetReleaseDspLinksParams,
|
|
354
|
+
"releaseDspLinkPackageId"
|
|
355
|
+
>;
|
|
356
|
+
type ConfiguredReleaseCredit = DistributiveOmit<
|
|
357
|
+
AddReleaseCreditParams,
|
|
358
|
+
"releaseCreditsPackageId" | "misoCreditPackageId"
|
|
359
|
+
>;
|
|
360
|
+
type ConfiguredReleaseCover = DistributiveOmit<
|
|
361
|
+
SetReleaseCoverParams,
|
|
362
|
+
"coverArtPackageId" | "releaseCoverArtPackageId" | "oriPackageId"
|
|
363
|
+
>;
|
|
364
|
+
type ConfiguredReleaseTrackCover = DistributiveOmit<
|
|
365
|
+
SetReleaseTrackCoverParams,
|
|
366
|
+
"coverArtPackageId" | "releaseCoverArtPackageId" | "oriPackageId"
|
|
367
|
+
>;
|
|
368
|
+
type ConfiguredRecordingStreamingTranscode = DistributiveOmit<
|
|
369
|
+
SetRecordingStreamingTranscodeParams,
|
|
370
|
+
"recordingStreamingTranscodePackageId" | "oriPackageId"
|
|
371
|
+
>;
|
|
372
|
+
type ConfiguredUnsetRecordingStreamingTranscode = DistributiveOmit<
|
|
373
|
+
UnsetRecordingStreamingTranscodeParams,
|
|
374
|
+
"recordingStreamingTranscodePackageId"
|
|
375
|
+
>;
|
|
376
|
+
|
|
377
|
+
/** Whole-graph params with this client's package ids dropped. */
|
|
378
|
+
export type ConfiguredReleaseGraphParams = Omit<
|
|
379
|
+
PublishReleaseGraphParams,
|
|
380
|
+
"misoPackageId" | "minatoPackageId"
|
|
381
|
+
>;
|
|
382
|
+
|
|
383
|
+
export class MisoPlatformClient {
|
|
384
|
+
readonly #client: ClientWithCoreApi;
|
|
385
|
+
readonly #config: MisoPlatformConfig;
|
|
386
|
+
readonly #protocol?: MisoProtocolClient;
|
|
387
|
+
readonly #chainIdentifier?: string;
|
|
388
|
+
/** Bundled/custom deployment selected for the full facade, when available. */
|
|
389
|
+
readonly deployment?: MisoPlatformDeployment;
|
|
390
|
+
#readyState: "unvalidated" | "validating" | "ready" | "failed" =
|
|
391
|
+
"unvalidated";
|
|
392
|
+
#readyPromise?: Promise<void>;
|
|
393
|
+
|
|
394
|
+
constructor(
|
|
395
|
+
client: ClientWithCoreApi,
|
|
396
|
+
config: MisoPlatformConfig,
|
|
397
|
+
protocol?: MisoProtocolClient,
|
|
398
|
+
deployment?: MisoPlatformDeployment,
|
|
399
|
+
) {
|
|
400
|
+
const configSnapshot = immutableSnapshot(config);
|
|
401
|
+
const deploymentSnapshot = deployment
|
|
402
|
+
? immutableSnapshot(deployment)
|
|
403
|
+
: undefined;
|
|
404
|
+
this.#client = client;
|
|
405
|
+
this.#config = configSnapshot;
|
|
406
|
+
if (configSnapshot.operations?.status === "available") {
|
|
407
|
+
requireOperationsDeployment(configSnapshot.operations);
|
|
408
|
+
}
|
|
409
|
+
// A pressing-only facade must not implicitly register a fail-closed core
|
|
410
|
+
// extension. Supply a core deployment/misoPackageId when `protocol` is
|
|
411
|
+
// needed; otherwise this remains a safe, independent pressing client.
|
|
412
|
+
this.#protocol =
|
|
413
|
+
protocol ??
|
|
414
|
+
(configSnapshot.misoPackageId
|
|
415
|
+
? protocolMiso({
|
|
416
|
+
deployment: { packageId: configSnapshot.misoPackageId },
|
|
417
|
+
}).register(client)
|
|
418
|
+
: undefined);
|
|
419
|
+
this.deployment = deploymentSnapshot;
|
|
420
|
+
this.#chainIdentifier =
|
|
421
|
+
deploymentSnapshot?.chainIdentifier ?? configSnapshot.chainIdentifier;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/** Permissionless protocol APIs bound to the same validated ledger. */
|
|
425
|
+
get protocol(): MisoProtocolClient | undefined {
|
|
426
|
+
if (!this.#protocol) return undefined;
|
|
427
|
+
this.#requireReady("protocol APIs");
|
|
428
|
+
return this.#protocol;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Memoized exact-ledger readiness gate. Registration already rejects a
|
|
433
|
+
* synchronous network-label mismatch; this Core API read protects every
|
|
434
|
+
* client-bound write surface from a mislabeled or custom endpoint.
|
|
435
|
+
*/
|
|
436
|
+
ready(): Promise<void> {
|
|
437
|
+
if (!this.#readyPromise) {
|
|
438
|
+
this.#readyState = "validating";
|
|
439
|
+
this.#readyPromise = (async () => {
|
|
440
|
+
try {
|
|
441
|
+
if (!this.#chainIdentifier) {
|
|
442
|
+
throw new Error(
|
|
443
|
+
"misoPlatform: chain readiness requires a complete deployment or an explicit `chainIdentifier`.",
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
const { chainIdentifier } =
|
|
447
|
+
await this.#client.core.getChainIdentifier();
|
|
448
|
+
if (chainIdentifier !== this.#chainIdentifier) {
|
|
449
|
+
throw new MisoChainIdentifierMismatchError(
|
|
450
|
+
chainIdentifier,
|
|
451
|
+
this.#chainIdentifier,
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
this.#readyState = "ready";
|
|
455
|
+
} catch (error) {
|
|
456
|
+
this.#readyState = "failed";
|
|
457
|
+
throw error;
|
|
458
|
+
}
|
|
459
|
+
})();
|
|
460
|
+
}
|
|
461
|
+
return this.#readyPromise;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** Compatibility hook; prefer `await client.miso.ready()`. */
|
|
465
|
+
async validateChainIdentifier(): Promise<string> {
|
|
466
|
+
await this.ready();
|
|
467
|
+
return this.#chainIdentifier!;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
#requireReady(operation: string): void {
|
|
471
|
+
// Capability availability remains the first fail-closed boundary. This
|
|
472
|
+
// keeps an unavailable deployment from masquerading as a mere lifecycle
|
|
473
|
+
// error while still preventing configured builders from running pre-ready.
|
|
474
|
+
if (
|
|
475
|
+
operation === "ids.pressing" ||
|
|
476
|
+
operation === "ids.pressingAdminCap" ||
|
|
477
|
+
operation === "ids.record" ||
|
|
478
|
+
operation === "ids.listing" ||
|
|
479
|
+
operation === "ids.sale" ||
|
|
480
|
+
operation === "tx.purchaseRecord" ||
|
|
481
|
+
operation === "tx.openPressing" ||
|
|
482
|
+
operation === "tx.openListing" ||
|
|
483
|
+
operation === "tx.authorizeRecordShop" ||
|
|
484
|
+
operation === "tx.revokeRecordShop" ||
|
|
485
|
+
operation === "tx.setListingPrice" ||
|
|
486
|
+
operation === "tx.setListingState"
|
|
487
|
+
) {
|
|
488
|
+
this.#recordSales();
|
|
489
|
+
}
|
|
490
|
+
if (operation === "ids.vault" || operation === "ids.vaultAdminCap") {
|
|
491
|
+
this.#operations();
|
|
492
|
+
}
|
|
493
|
+
if (this.#readyState !== "ready") {
|
|
494
|
+
throw new MisoClientNotReadyError(operation);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/** Party identity and profile APIs, backed by the network SDK. */
|
|
499
|
+
get party(): PartyProtocolClient {
|
|
500
|
+
if (!this.#protocol) {
|
|
501
|
+
throw new Error(
|
|
502
|
+
"misoPlatform: Party APIs require the complete platform deployment. Use miso({ deployment }).",
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
this.#requireReady("party APIs");
|
|
506
|
+
return this.#protocol.party;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
#recordSales() {
|
|
510
|
+
return requireRecordSalesDeployment(
|
|
511
|
+
this.#config.recordSales ?? {
|
|
512
|
+
status: "unavailable",
|
|
513
|
+
reason:
|
|
514
|
+
"this client was configured without Record and Record Shop package IDs",
|
|
515
|
+
},
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
#operations() {
|
|
520
|
+
return requireOperationsDeployment(this.#config.operations);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
#availableOperations() {
|
|
524
|
+
return this.#config.operations?.status === "available"
|
|
525
|
+
? requireOperationsDeployment(this.#config.operations)
|
|
526
|
+
: undefined;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
get recordPackageId(): string {
|
|
530
|
+
return this.#recordSales().recordPackageId;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
get recordShopPackageId(): string {
|
|
534
|
+
return this.#recordSales().recordShopPackageId;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
#misoPackageId(): string {
|
|
538
|
+
const { misoPackageId } = this.#config;
|
|
539
|
+
if (!misoPackageId) {
|
|
540
|
+
throw new Error(
|
|
541
|
+
"misoPlatform: `misoPackageId` is required for the publish builders " +
|
|
542
|
+
"(publishComposition, publishRecording, publishCompositionAndRecording, publishRelease) — pass it to misoPlatform({ misoPackageId }).",
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
return misoPackageId;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
#minatoPackageId(): string {
|
|
549
|
+
const { minatoPackageId } = this.#config;
|
|
550
|
+
if (!minatoPackageId) {
|
|
551
|
+
throw new Error(
|
|
552
|
+
"misoPlatform: `minatoPackageId` is required for the publish builders that disperse shares " +
|
|
553
|
+
"(publishComposition, publishRecording, publishCompositionAndRecording) — pass it to misoPlatform({ minatoPackageId }).",
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
return minatoPackageId;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
#releaseRegistryId(): string {
|
|
560
|
+
const { releaseRegistryId: id } = this.#config;
|
|
561
|
+
if (!id) {
|
|
562
|
+
throw new Error(
|
|
563
|
+
"misoPlatform: `releaseRegistryId` is required to build a release.",
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
return id;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
#requiredConfig(field: keyof MisoPlatformConfig, operation: string): string {
|
|
570
|
+
const value = this.#config[field];
|
|
571
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
572
|
+
throw new Error(
|
|
573
|
+
`misoPlatform: \`${String(field)}\` is required for ${operation}.`,
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
return value;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// ── Reads ─────────────────────────────────────────────────────────────────
|
|
580
|
+
|
|
581
|
+
/** The run itself, or `null` if this release has never opened one. */
|
|
582
|
+
async getPressing(pressingId: string): Promise<PressingView | null> {
|
|
583
|
+
await this.ready();
|
|
584
|
+
return getPressing(this.#client, pressingId, this.recordPackageId);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/** One currency's offer, or `null` if the run does not sell in it. */
|
|
588
|
+
async getListing(listingId: string): Promise<ListingView | null> {
|
|
589
|
+
await this.ready();
|
|
590
|
+
return getListing(this.#client, listingId, this.recordShopPackageId);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/** One concrete purchased Record, including immutable purchase provenance. */
|
|
594
|
+
async getRecord(recordId: string): Promise<RecordView | null> {
|
|
595
|
+
await this.ready();
|
|
596
|
+
return getRecord(this.#client, recordId, this.recordPackageId);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/** Run + one currency's offer in a single round trip, by address math. */
|
|
600
|
+
async getSale(p: Configured<GetSaleParams>): Promise<{
|
|
601
|
+
pressing: PressingView | null;
|
|
602
|
+
listing: ListingView | null;
|
|
603
|
+
}> {
|
|
604
|
+
await this.ready();
|
|
605
|
+
return getSale(this.#client, {
|
|
606
|
+
...p,
|
|
607
|
+
recordPackageId: this.recordPackageId,
|
|
608
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// ── Address math ──────────────────────────────────────────────────────────
|
|
613
|
+
|
|
614
|
+
readonly ids = requireReadyOnFunctions({
|
|
615
|
+
pressing: (releaseId: string, edition: number) =>
|
|
616
|
+
derivePressingId(releaseId, edition, this.recordPackageId),
|
|
617
|
+
pressingAdminCap: (pressingId: string) =>
|
|
618
|
+
derivePressingAdminCapId(pressingId, this.recordPackageId),
|
|
619
|
+
record: (pressingId: string, number: number) =>
|
|
620
|
+
deriveRecordId(pressingId, number, this.recordPackageId),
|
|
621
|
+
listing: (pressingId: string, currencyType: string) =>
|
|
622
|
+
deriveListingId(pressingId, currencyType, this.recordShopPackageId),
|
|
623
|
+
sale: (releaseId: string, edition: number, currencyType: string) =>
|
|
624
|
+
deriveSaleIds(
|
|
625
|
+
releaseId,
|
|
626
|
+
edition,
|
|
627
|
+
currencyType,
|
|
628
|
+
this.recordPackageId,
|
|
629
|
+
this.recordShopPackageId,
|
|
630
|
+
),
|
|
631
|
+
vault: (capId: string, capType: string) =>
|
|
632
|
+
vaultActions.deriveVaultId({
|
|
633
|
+
vaultRegistryId: this.#operations().vault.registryId,
|
|
634
|
+
capId,
|
|
635
|
+
capType,
|
|
636
|
+
vaultPackageId: this.#operations().vault.packageId,
|
|
637
|
+
}),
|
|
638
|
+
vaultAdminCap: (vaultId: string) =>
|
|
639
|
+
vaultActions.deriveVaultAdminCapId(
|
|
640
|
+
vaultId,
|
|
641
|
+
this.#operations().vault.packageId,
|
|
642
|
+
),
|
|
643
|
+
genre: (canonicalName: string) =>
|
|
644
|
+
deriveGenreAddress(
|
|
645
|
+
this.#requiredConfig("genreRegistryId", "genre id derivation"),
|
|
646
|
+
this.#requiredConfig("genrePackageId", "genre id derivation"),
|
|
647
|
+
canonicalName,
|
|
648
|
+
),
|
|
649
|
+
}, (operation) => this.#requireReady(operation), "ids");
|
|
650
|
+
|
|
651
|
+
// ── Transaction builders ──────────────────────────────────────────────────
|
|
652
|
+
|
|
653
|
+
/** Client-bound builders require a successful `await client.miso.ready()`.
|
|
654
|
+
* Standalone exports remain pure for explicitly managed offline workflows. */
|
|
655
|
+
readonly tx = requireReadyOnFunctions({
|
|
656
|
+
purchaseRecord: (p: Configured<PurchaseRecordParams>): TxThunk =>
|
|
657
|
+
purchaseRecord({
|
|
658
|
+
...p,
|
|
659
|
+
recordPackageId: this.recordPackageId,
|
|
660
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
661
|
+
}),
|
|
662
|
+
openPressing: (p: Configured<OpenPressingParams>): TxThunk =>
|
|
663
|
+
openPressing({
|
|
664
|
+
...p,
|
|
665
|
+
recordPackageId: this.recordPackageId,
|
|
666
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
667
|
+
}),
|
|
668
|
+
openListing: (p: Configured<OpenListingParams>): TxThunk =>
|
|
669
|
+
openListing({ ...p, recordShopPackageId: this.recordShopPackageId }),
|
|
670
|
+
authorizeRecordShop: (
|
|
671
|
+
p: Configured<PressingAdministrationParams>,
|
|
672
|
+
): TxThunk =>
|
|
673
|
+
authorizeRecordShop({
|
|
674
|
+
...p,
|
|
675
|
+
recordPackageId: this.recordPackageId,
|
|
676
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
677
|
+
}),
|
|
678
|
+
revokeRecordShop: (p: Configured<PressingAdministrationParams>): TxThunk =>
|
|
679
|
+
revokeRecordShop({
|
|
680
|
+
...p,
|
|
681
|
+
recordPackageId: this.recordPackageId,
|
|
682
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
683
|
+
}),
|
|
684
|
+
setListingPrice: (p: Configured<SetListingPriceParams>): TxThunk =>
|
|
685
|
+
setListingPrice({ ...p, recordShopPackageId: this.recordShopPackageId }),
|
|
686
|
+
setListingState: (p: Configured<SetListingStateParams>): TxThunk =>
|
|
687
|
+
setListingState({ ...p, recordShopPackageId: this.recordShopPackageId }),
|
|
688
|
+
|
|
689
|
+
// Publishing (protocol works + minato share economics) — package-id-free
|
|
690
|
+
// builders pass through unchanged; the rest bind this client's
|
|
691
|
+
// `misoPackageId`/`minatoPackageId`, throwing at call time if either is
|
|
692
|
+
// missing (kept optional on the client so a sell-only client, e.g. a
|
|
693
|
+
// storefront that never mints new works, doesn't need to carry them).
|
|
694
|
+
publishShareCurrency,
|
|
695
|
+
initializeShareCurrency,
|
|
696
|
+
publishComposition: (
|
|
697
|
+
p: ConfiguredPublish<PublishCompositionParams>,
|
|
698
|
+
): TxThunk =>
|
|
699
|
+
publishComposition({
|
|
700
|
+
...p,
|
|
701
|
+
misoPackageId: this.#misoPackageId(),
|
|
702
|
+
minatoPackageId: this.#minatoPackageId(),
|
|
703
|
+
}),
|
|
704
|
+
publishRecording: (p: ConfiguredPublish<PublishRecordingParams>): TxThunk =>
|
|
705
|
+
publishRecording({
|
|
706
|
+
...p,
|
|
707
|
+
misoPackageId: this.#misoPackageId(),
|
|
708
|
+
minatoPackageId: this.#minatoPackageId(),
|
|
709
|
+
}),
|
|
710
|
+
publishCompositionAndRecording: (
|
|
711
|
+
p: ConfiguredPublish<PublishCompositionAndRecordingParams>,
|
|
712
|
+
): TxThunk =>
|
|
713
|
+
publishCompositionAndRecording({
|
|
714
|
+
...p,
|
|
715
|
+
misoPackageId: this.#misoPackageId(),
|
|
716
|
+
minatoPackageId: this.#minatoPackageId(),
|
|
717
|
+
}),
|
|
718
|
+
publishRelease: (p: ConfiguredRelease<PublishReleaseParams>): TxThunk => {
|
|
719
|
+
return publishRelease({
|
|
720
|
+
...p,
|
|
721
|
+
misoPackageId: this.#misoPackageId(),
|
|
722
|
+
releaseRegistryId: this.#releaseRegistryId(),
|
|
723
|
+
});
|
|
724
|
+
},
|
|
725
|
+
publishReleaseGraph: (p: ConfiguredReleaseGraphParams): TxThunk => {
|
|
726
|
+
return publishReleaseGraph({
|
|
727
|
+
...p,
|
|
728
|
+
misoPackageId: this.#misoPackageId(),
|
|
729
|
+
minatoPackageId: this.#minatoPackageId(),
|
|
730
|
+
});
|
|
731
|
+
},
|
|
732
|
+
setReleaseKind: (p: ConfiguredReleaseKind): TxThunk =>
|
|
733
|
+
setReleaseKind({
|
|
734
|
+
...p,
|
|
735
|
+
releaseKindPackageId: this.#requiredConfig(
|
|
736
|
+
"releaseKindPackageId",
|
|
737
|
+
"setReleaseKind",
|
|
738
|
+
),
|
|
739
|
+
}),
|
|
740
|
+
setReleaseDescription: (p: ConfiguredReleaseDescription): TxThunk =>
|
|
741
|
+
setReleaseDescription({
|
|
742
|
+
...p,
|
|
743
|
+
releaseDescriptionPackageId: this.#requiredConfig(
|
|
744
|
+
"releaseDescriptionPackageId",
|
|
745
|
+
"setReleaseDescription",
|
|
746
|
+
),
|
|
747
|
+
}),
|
|
748
|
+
setReleaseGenres: (p: ConfiguredReleaseGenres): TxThunk =>
|
|
749
|
+
setReleaseGenres({
|
|
750
|
+
...p,
|
|
751
|
+
releaseGenrePackageId: this.#requiredConfig(
|
|
752
|
+
"releaseGenrePackageId",
|
|
753
|
+
"setReleaseGenres",
|
|
754
|
+
),
|
|
755
|
+
}),
|
|
756
|
+
setReleaseDspLinks: (p: ConfiguredReleaseDspLinks): TxThunk =>
|
|
757
|
+
setReleaseDspLinks({
|
|
758
|
+
...p,
|
|
759
|
+
releaseDspLinkPackageId: this.#requiredConfig(
|
|
760
|
+
"releaseDspLinkPackageId",
|
|
761
|
+
"setReleaseDspLinks",
|
|
762
|
+
),
|
|
763
|
+
}),
|
|
764
|
+
addReleaseCredit: (p: ConfiguredReleaseCredit): TxThunk =>
|
|
765
|
+
addReleaseCredit({
|
|
766
|
+
...p,
|
|
767
|
+
releaseCreditsPackageId: this.#requiredConfig(
|
|
768
|
+
"releaseCreditsPackageId",
|
|
769
|
+
"addReleaseCredit",
|
|
770
|
+
),
|
|
771
|
+
misoCreditPackageId: this.#requiredConfig(
|
|
772
|
+
"misoCreditPackageId",
|
|
773
|
+
"addReleaseCredit",
|
|
774
|
+
),
|
|
775
|
+
}),
|
|
776
|
+
setReleaseCover: (p: ConfiguredReleaseCover): TxThunk =>
|
|
777
|
+
setReleaseCover({
|
|
778
|
+
...p,
|
|
779
|
+
coverArtPackageId: this.#requiredConfig(
|
|
780
|
+
"coverArtPackageId",
|
|
781
|
+
"setReleaseCover",
|
|
782
|
+
),
|
|
783
|
+
releaseCoverArtPackageId: this.#requiredConfig(
|
|
784
|
+
"releaseCoverArtPackageId",
|
|
785
|
+
"setReleaseCover",
|
|
786
|
+
),
|
|
787
|
+
oriPackageId: this.#requiredConfig("oriPackageId", "setReleaseCover"),
|
|
788
|
+
}),
|
|
789
|
+
setReleaseTrackCover: (p: ConfiguredReleaseTrackCover): TxThunk =>
|
|
790
|
+
setReleaseTrackCover({
|
|
791
|
+
...p,
|
|
792
|
+
coverArtPackageId: this.#requiredConfig(
|
|
793
|
+
"coverArtPackageId",
|
|
794
|
+
"setReleaseTrackCover",
|
|
795
|
+
),
|
|
796
|
+
releaseCoverArtPackageId: this.#requiredConfig(
|
|
797
|
+
"releaseCoverArtPackageId",
|
|
798
|
+
"setReleaseTrackCover",
|
|
799
|
+
),
|
|
800
|
+
oriPackageId: this.#requiredConfig(
|
|
801
|
+
"oriPackageId",
|
|
802
|
+
"setReleaseTrackCover",
|
|
803
|
+
),
|
|
804
|
+
}),
|
|
805
|
+
setRecordingStreamingTranscode: (
|
|
806
|
+
p: ConfiguredRecordingStreamingTranscode,
|
|
807
|
+
): TxThunk =>
|
|
808
|
+
setRecordingStreamingTranscode({
|
|
809
|
+
...p,
|
|
810
|
+
recordingStreamingTranscodePackageId: this.#requiredConfig(
|
|
811
|
+
"recordingStreamingTranscodePackageId",
|
|
812
|
+
"setRecordingStreamingTranscode",
|
|
813
|
+
),
|
|
814
|
+
oriPackageId: this.#requiredConfig(
|
|
815
|
+
"oriPackageId",
|
|
816
|
+
"setRecordingStreamingTranscode",
|
|
817
|
+
),
|
|
818
|
+
}),
|
|
819
|
+
unsetRecordingStreamingTranscode: (
|
|
820
|
+
p: ConfiguredUnsetRecordingStreamingTranscode,
|
|
821
|
+
): TxThunk =>
|
|
822
|
+
unsetRecordingStreamingTranscode({
|
|
823
|
+
...p,
|
|
824
|
+
recordingStreamingTranscodePackageId: this.#requiredConfig(
|
|
825
|
+
"recordingStreamingTranscodePackageId",
|
|
826
|
+
"unsetRecordingStreamingTranscode",
|
|
827
|
+
),
|
|
828
|
+
}),
|
|
829
|
+
}, (operation) => this.#requireReady(operation), "tx");
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Vault-aware builders and parsers. These take explicit object ids because a
|
|
833
|
+
* VaultAdminCap is owner-held while the Vault is shared; package ids can come
|
|
834
|
+
* from the deployment config or be supplied for private deployments.
|
|
835
|
+
*/
|
|
836
|
+
get vault(): typeof vaultActions | undefined {
|
|
837
|
+
if (!this.#availableOperations()) return undefined;
|
|
838
|
+
this.#requireReady("vault builders");
|
|
839
|
+
return vaultActions;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
// ── Share currency provisioning (executes; Signer pattern) ─────────────────
|
|
843
|
+
|
|
844
|
+
/** Publishes + initializes a fresh share currency (two txs). */
|
|
845
|
+
async createShareCurrency(
|
|
846
|
+
signer: Signer,
|
|
847
|
+
params: share.CreateShareCurrencyParams,
|
|
848
|
+
): Promise<share.ShareCurrency> {
|
|
849
|
+
await this.ready();
|
|
850
|
+
return share.createShareCurrency(this.#client, signer, params);
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/** Execute a composed platform PTB only after exact-ledger validation. */
|
|
854
|
+
async executeViaExecutor(
|
|
855
|
+
executor: ParallelTransactionExecutor,
|
|
856
|
+
...thunks: TxThunk[]
|
|
857
|
+
): Promise<PlatformExecResult> {
|
|
858
|
+
await this.ready();
|
|
859
|
+
return executePlatformViaExecutor(executor, ...thunks);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// ── Generated layer ───────────────────────────────────────────────────────
|
|
863
|
+
|
|
864
|
+
/** Generated Move-call bindings, for commands this facade doesn't wrap. */
|
|
865
|
+
get call() {
|
|
866
|
+
const sales =
|
|
867
|
+
this.#config.recordSales?.status === "available"
|
|
868
|
+
? this.#config.recordSales
|
|
869
|
+
: undefined;
|
|
870
|
+
const operations = this.#availableOperations();
|
|
871
|
+
return requireReadyOnModuleFunctions({
|
|
872
|
+
record: sales
|
|
873
|
+
? bindModulePackage(recordContract, sales.recordPackageId, [
|
|
874
|
+
"destroy",
|
|
875
|
+
"releaseId",
|
|
876
|
+
"pressingId",
|
|
877
|
+
"edition",
|
|
878
|
+
"number",
|
|
879
|
+
"purchaseCurrency",
|
|
880
|
+
"purchasePrice",
|
|
881
|
+
"purchasedBy",
|
|
882
|
+
"purchasedTimestampMs",
|
|
883
|
+
"deriveAddress",
|
|
884
|
+
] as const)
|
|
885
|
+
: undefined,
|
|
886
|
+
listing: sales
|
|
887
|
+
? bindModulePackage(listingContract, sales.recordShopPackageId, [
|
|
888
|
+
"fixed",
|
|
889
|
+
"floor",
|
|
890
|
+
"enabled",
|
|
891
|
+
"disabled",
|
|
892
|
+
"setState",
|
|
893
|
+
"setPrice",
|
|
894
|
+
"purchase",
|
|
895
|
+
"deriveAddress",
|
|
896
|
+
"releaseId",
|
|
897
|
+
"pressingId",
|
|
898
|
+
"pricing",
|
|
899
|
+
"price",
|
|
900
|
+
"state",
|
|
901
|
+
"isEnabled",
|
|
902
|
+
"isDisabled",
|
|
903
|
+
"isFixed",
|
|
904
|
+
"isFloor",
|
|
905
|
+
] as const)
|
|
906
|
+
: undefined,
|
|
907
|
+
pressing: sales
|
|
908
|
+
? bindModulePackage(pressingContract, sales.recordPackageId, [
|
|
909
|
+
"authorizeDistributor",
|
|
910
|
+
"revokeDistributor",
|
|
911
|
+
"deriveAddress",
|
|
912
|
+
"deriveAdminCapAddress",
|
|
913
|
+
"releaseId",
|
|
914
|
+
"edition",
|
|
915
|
+
"supply",
|
|
916
|
+
"maxSupply",
|
|
917
|
+
"distributors",
|
|
918
|
+
"isDistributorAuthorized",
|
|
919
|
+
"pressingId",
|
|
920
|
+
] as const)
|
|
921
|
+
: undefined,
|
|
922
|
+
genre: this.#config.genrePackageId
|
|
923
|
+
? bindModulePackage(genreContract, this.#config.genrePackageId, [
|
|
924
|
+
"deriveAddress",
|
|
925
|
+
] as const)
|
|
926
|
+
: undefined,
|
|
927
|
+
releaseDescription: this.#config.releaseDescriptionPackageId
|
|
928
|
+
? bindModulePackage(
|
|
929
|
+
releaseDescriptionContract,
|
|
930
|
+
this.#config.releaseDescriptionPackageId,
|
|
931
|
+
["setDescription", "clearDescription", "hasDescription"],
|
|
932
|
+
)
|
|
933
|
+
: undefined,
|
|
934
|
+
releaseDspLink: this.#config.releaseDspLinkPackageId
|
|
935
|
+
? bindModulePackage(
|
|
936
|
+
releaseDspLinkContract,
|
|
937
|
+
this.#config.releaseDspLinkPackageId,
|
|
938
|
+
[
|
|
939
|
+
"platform",
|
|
940
|
+
"platformSpotify",
|
|
941
|
+
"platformAppleMusic",
|
|
942
|
+
"platformAmazonMusic",
|
|
943
|
+
"platformBandcamp",
|
|
944
|
+
"platformDeezer",
|
|
945
|
+
"platformSoundcloud",
|
|
946
|
+
"platformTidal",
|
|
947
|
+
"platformYoutubeMusic",
|
|
948
|
+
"newSpotify",
|
|
949
|
+
"newAppleMusicAlbum",
|
|
950
|
+
"newAppleMusicTrack",
|
|
951
|
+
"newAmazonMusicAlbum",
|
|
952
|
+
"newAmazonMusicTrack",
|
|
953
|
+
"newBandcamp",
|
|
954
|
+
"newDeezer",
|
|
955
|
+
"newSoundcloud",
|
|
956
|
+
"newTidal",
|
|
957
|
+
"newYoutubeMusic",
|
|
958
|
+
"setReleaseLink",
|
|
959
|
+
"clearReleaseLink",
|
|
960
|
+
"setTrackLink",
|
|
961
|
+
"clearTrackLink",
|
|
962
|
+
"clearTrackLinks",
|
|
963
|
+
"hasReleaseLink",
|
|
964
|
+
] as const,
|
|
965
|
+
)
|
|
966
|
+
: undefined,
|
|
967
|
+
releaseGenre: this.#config.releaseGenrePackageId
|
|
968
|
+
? bindModulePackage(
|
|
969
|
+
releaseGenreContract,
|
|
970
|
+
this.#config.releaseGenrePackageId,
|
|
971
|
+
[
|
|
972
|
+
"setPrimaryGenre",
|
|
973
|
+
"addSecondaryGenre",
|
|
974
|
+
"removeSecondaryGenre",
|
|
975
|
+
"setTrackPrimaryGenre",
|
|
976
|
+
"unsetTrackPrimaryGenre",
|
|
977
|
+
"hasGenre",
|
|
978
|
+
] as const,
|
|
979
|
+
)
|
|
980
|
+
: undefined,
|
|
981
|
+
releaseKind: this.#config.releaseKindPackageId
|
|
982
|
+
? bindModulePackage(
|
|
983
|
+
releaseKindContract,
|
|
984
|
+
this.#config.releaseKindPackageId,
|
|
985
|
+
["setKind", "unsetKind", "hasKind"] as const,
|
|
986
|
+
)
|
|
987
|
+
: undefined,
|
|
988
|
+
releaseRevenueDistributor: operations
|
|
989
|
+
? bindModulePackage(
|
|
990
|
+
releaseRevenueDistributorContract,
|
|
991
|
+
operations.actions.releaseRevenueDistributor,
|
|
992
|
+
[
|
|
993
|
+
"redeemAndDistribute",
|
|
994
|
+
"redeemAllAndDistribute",
|
|
995
|
+
"receiveAndDistribute",
|
|
996
|
+
] as const,
|
|
997
|
+
)
|
|
998
|
+
: undefined,
|
|
999
|
+
releaseRevenueDistributorPlugin: operations
|
|
1000
|
+
? bindModulePackage(
|
|
1001
|
+
releaseRevenueDistributorPluginContract,
|
|
1002
|
+
operations.plugins.releaseRevenueDistributor,
|
|
1003
|
+
[
|
|
1004
|
+
"install",
|
|
1005
|
+
"uninstall",
|
|
1006
|
+
"redeemAllAndDistribute",
|
|
1007
|
+
"receiveAndDistribute",
|
|
1008
|
+
"isInstalled",
|
|
1009
|
+
] as const,
|
|
1010
|
+
)
|
|
1011
|
+
: undefined,
|
|
1012
|
+
vault: operations
|
|
1013
|
+
? bindModulePackage(vaultContract, operations.vault.packageId, [
|
|
1014
|
+
"share",
|
|
1015
|
+
"withdrawCap",
|
|
1016
|
+
"restoreCap",
|
|
1017
|
+
"derivedAddress",
|
|
1018
|
+
"capId",
|
|
1019
|
+
"isActive",
|
|
1020
|
+
"authorizedPlugins",
|
|
1021
|
+
"isPluginAuthorized",
|
|
1022
|
+
] as const)
|
|
1023
|
+
: undefined,
|
|
1024
|
+
compositionRoyaltyPool: operations
|
|
1025
|
+
? bindModulePackage(
|
|
1026
|
+
compositionRoyaltyPoolContract,
|
|
1027
|
+
operations.actions.compositionRoyaltyPool,
|
|
1028
|
+
["newPool", "receiveAndDeposit", "redeemAndDeposit", "poolAddress"] as const,
|
|
1029
|
+
)
|
|
1030
|
+
: undefined,
|
|
1031
|
+
compositionRoyaltyPoolPlugin: operations
|
|
1032
|
+
? bindModulePackage(
|
|
1033
|
+
compositionRoyaltyPoolPluginContract,
|
|
1034
|
+
operations.plugins.compositionRoyaltyPool,
|
|
1035
|
+
[
|
|
1036
|
+
"install",
|
|
1037
|
+
"uninstall",
|
|
1038
|
+
"receiveAndDeposit",
|
|
1039
|
+
"redeemAndDeposit",
|
|
1040
|
+
"isInstalled",
|
|
1041
|
+
] as const,
|
|
1042
|
+
)
|
|
1043
|
+
: undefined,
|
|
1044
|
+
recordingRoyaltyPool: operations
|
|
1045
|
+
? bindModulePackage(
|
|
1046
|
+
recordingRoyaltyPoolContract,
|
|
1047
|
+
operations.actions.recordingRoyaltyPool,
|
|
1048
|
+
["newPool", "receiveAndDeposit", "redeemAndDeposit", "poolAddress"] as const,
|
|
1049
|
+
)
|
|
1050
|
+
: undefined,
|
|
1051
|
+
recordingRoyaltyPoolPlugin: operations
|
|
1052
|
+
? bindModulePackage(
|
|
1053
|
+
recordingRoyaltyPoolPluginContract,
|
|
1054
|
+
operations.plugins.recordingRoyaltyPool,
|
|
1055
|
+
[
|
|
1056
|
+
"install",
|
|
1057
|
+
"uninstall",
|
|
1058
|
+
"receiveAndDeposit",
|
|
1059
|
+
"redeemAndDeposit",
|
|
1060
|
+
"isInstalled",
|
|
1061
|
+
] as const,
|
|
1062
|
+
)
|
|
1063
|
+
: undefined,
|
|
1064
|
+
partyWallet: operations
|
|
1065
|
+
? bindModulePackage(
|
|
1066
|
+
partyWalletContract,
|
|
1067
|
+
operations.actions.partyWallet,
|
|
1068
|
+
["receive", "receiveBalance", "redeemBalance", "inboxAddress"] as const,
|
|
1069
|
+
)
|
|
1070
|
+
: undefined,
|
|
1071
|
+
compositionRoutedStake: operations
|
|
1072
|
+
? bindModulePackage(
|
|
1073
|
+
compositionRoutedStakeContract,
|
|
1074
|
+
operations.actions.compositionRoutedStake,
|
|
1075
|
+
["createStake", "register", "unregister", "unstake", "restake", "stakeAddress"] as const,
|
|
1076
|
+
)
|
|
1077
|
+
: undefined,
|
|
1078
|
+
routedStake: this.#config.routedStakePackageId
|
|
1079
|
+
? bindModulePackage(
|
|
1080
|
+
routedStakeContract,
|
|
1081
|
+
this.#config.routedStakePackageId,
|
|
1082
|
+
[
|
|
1083
|
+
"share",
|
|
1084
|
+
"register",
|
|
1085
|
+
"unregister",
|
|
1086
|
+
"sweep",
|
|
1087
|
+
"unstake",
|
|
1088
|
+
"restake",
|
|
1089
|
+
"derivedAddress",
|
|
1090
|
+
] as const,
|
|
1091
|
+
)
|
|
1092
|
+
: undefined,
|
|
1093
|
+
royaltyPool: this.#config.royaltyPoolPackageId
|
|
1094
|
+
? bindModulePackage(
|
|
1095
|
+
royaltyPoolContract,
|
|
1096
|
+
this.#config.royaltyPoolPackageId,
|
|
1097
|
+
[
|
|
1098
|
+
"share",
|
|
1099
|
+
"deposit",
|
|
1100
|
+
"sweepAndDeposit",
|
|
1101
|
+
"receiveAndDeposit",
|
|
1102
|
+
"registerStake",
|
|
1103
|
+
"unregisterStake",
|
|
1104
|
+
"claimRewards",
|
|
1105
|
+
"pendingRewards",
|
|
1106
|
+
"stakedShares",
|
|
1107
|
+
"cumulativeRewardPerShare",
|
|
1108
|
+
"cumulativeDeposits",
|
|
1109
|
+
"derivedAddress",
|
|
1110
|
+
"assertDerivedFrom",
|
|
1111
|
+
] as const,
|
|
1112
|
+
)
|
|
1113
|
+
: undefined,
|
|
1114
|
+
recordingAdvisory: this.#config.recordingAdvisoryPackageId
|
|
1115
|
+
? bindModulePackage(
|
|
1116
|
+
recordingAdvisoryContract,
|
|
1117
|
+
this.#config.recordingAdvisoryPackageId,
|
|
1118
|
+
[
|
|
1119
|
+
"explicit",
|
|
1120
|
+
"notExplicit",
|
|
1121
|
+
"cleaned",
|
|
1122
|
+
"setRating",
|
|
1123
|
+
"unsetRating",
|
|
1124
|
+
"hasRating",
|
|
1125
|
+
"isExplicit",
|
|
1126
|
+
"isNotExplicit",
|
|
1127
|
+
"isCleaned",
|
|
1128
|
+
] as const,
|
|
1129
|
+
)
|
|
1130
|
+
: undefined,
|
|
1131
|
+
recordingLanguage: this.#config.recordingLanguagePackageId
|
|
1132
|
+
? bindModulePackage(
|
|
1133
|
+
recordingLanguageContract,
|
|
1134
|
+
this.#config.recordingLanguagePackageId,
|
|
1135
|
+
[
|
|
1136
|
+
"setLanguages",
|
|
1137
|
+
"setInstrumental",
|
|
1138
|
+
"unsetLanguages",
|
|
1139
|
+
"hasLanguages",
|
|
1140
|
+
"isInstrumental",
|
|
1141
|
+
] as const,
|
|
1142
|
+
)
|
|
1143
|
+
: undefined,
|
|
1144
|
+
recordingMasterReference: this.#config.recordingMasterReferencePackageId
|
|
1145
|
+
? bindModulePackage(
|
|
1146
|
+
recordingMasterReferenceContract,
|
|
1147
|
+
this.#config.recordingMasterReferencePackageId,
|
|
1148
|
+
[
|
|
1149
|
+
"setMasterReference",
|
|
1150
|
+
"unsetMasterReference",
|
|
1151
|
+
"hasMasterReference",
|
|
1152
|
+
] as const,
|
|
1153
|
+
)
|
|
1154
|
+
: undefined,
|
|
1155
|
+
recordingStreamingTranscode: this.#config.recordingStreamingTranscodePackageId
|
|
1156
|
+
? bindModulePackage(
|
|
1157
|
+
recordingStreamingTranscodeContract,
|
|
1158
|
+
this.#config.recordingStreamingTranscodePackageId,
|
|
1159
|
+
[
|
|
1160
|
+
"setStreamingTranscode",
|
|
1161
|
+
"unsetStreamingTranscode",
|
|
1162
|
+
"hasStreamingTranscode",
|
|
1163
|
+
] as const,
|
|
1164
|
+
)
|
|
1165
|
+
: undefined,
|
|
1166
|
+
recordingPreview: this.#config.recordingPreviewPackageId
|
|
1167
|
+
? bindModulePackage(
|
|
1168
|
+
recordingPreviewContract,
|
|
1169
|
+
this.#config.recordingPreviewPackageId,
|
|
1170
|
+
["setPreview", "unsetPreview", "hasPreview"] as const,
|
|
1171
|
+
)
|
|
1172
|
+
: undefined,
|
|
1173
|
+
coverArt: this.#config.coverArtPackageId
|
|
1174
|
+
? bindModulePackage(
|
|
1175
|
+
coverArtContract,
|
|
1176
|
+
this.#config.coverArtPackageId,
|
|
1177
|
+
[] as const,
|
|
1178
|
+
)
|
|
1179
|
+
: undefined,
|
|
1180
|
+
releaseCoverArt: this.#config.releaseCoverArtPackageId
|
|
1181
|
+
? bindModulePackage(
|
|
1182
|
+
releaseCoverArtContract,
|
|
1183
|
+
this.#config.releaseCoverArtPackageId,
|
|
1184
|
+
[
|
|
1185
|
+
"setCover",
|
|
1186
|
+
"unsetCover",
|
|
1187
|
+
"setTrackCover",
|
|
1188
|
+
"unsetTrackCover",
|
|
1189
|
+
"hasCoverArt",
|
|
1190
|
+
] as const,
|
|
1191
|
+
)
|
|
1192
|
+
: undefined,
|
|
1193
|
+
releaseCredits: this.#config.releaseCreditsPackageId
|
|
1194
|
+
? bindModulePackage(
|
|
1195
|
+
releaseCreditsContract,
|
|
1196
|
+
this.#config.releaseCreditsPackageId,
|
|
1197
|
+
["addCredit", "removeCredit", "hasCredits"] as const,
|
|
1198
|
+
)
|
|
1199
|
+
: undefined,
|
|
1200
|
+
}, (operation) => this.#requireReady(operation), "call");
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/** Generated BCS definitions, for parsing objects or events yourself. */
|
|
1204
|
+
readonly bcs = {
|
|
1205
|
+
Record: recordContract.Record,
|
|
1206
|
+
Pressing: pressingContract.Pressing,
|
|
1207
|
+
PressingAdminCap: pressingContract.PressingAdminCap,
|
|
1208
|
+
Listing: listingContract.Listing,
|
|
1209
|
+
Pricing: listingContract.Pricing,
|
|
1210
|
+
ListingState: listingContract.State,
|
|
1211
|
+
RecordCreatedEvent: recordContract.RecordCreatedEvent,
|
|
1212
|
+
RecordDestroyedEvent: recordContract.RecordDestroyedEvent,
|
|
1213
|
+
PressingCreatedEvent: pressingContract.PressingCreatedEvent,
|
|
1214
|
+
DistributorAuthorizedEvent: pressingContract.DistributorAuthorizedEvent,
|
|
1215
|
+
DistributorRevokedEvent: pressingContract.DistributorRevokedEvent,
|
|
1216
|
+
RecordPurchasedEvent: pressingContract.RecordPurchasedEvent,
|
|
1217
|
+
ListingCreatedEvent: listingContract.ListingCreatedEvent,
|
|
1218
|
+
ListingPriceChangedEvent: listingContract.ListingPriceChangedEvent,
|
|
1219
|
+
ListingStateChangedEvent: listingContract.ListingStateChangedEvent,
|
|
1220
|
+
RecordSoldEvent: listingContract.RecordSoldEvent,
|
|
1221
|
+
VaultAdminCap: vaultContract.VaultAdminCap,
|
|
1222
|
+
VaultRegistry: vaultContract.VaultRegistry,
|
|
1223
|
+
VaultKey: vaultContract.VaultKey,
|
|
1224
|
+
VaultAdminCapKey: vaultContract.VaultAdminCapKey,
|
|
1225
|
+
VaultCreatedEvent: vaultContract.VaultCreatedEvent,
|
|
1226
|
+
VaultCapabilityWithdrawnEvent: vaultContract.VaultCapabilityWithdrawnEvent,
|
|
1227
|
+
VaultCapabilityRestoredEvent: vaultContract.VaultCapabilityRestoredEvent,
|
|
1228
|
+
PartyObjectReceivedEvent: partyWalletContract.ObjectReceivedEvent,
|
|
1229
|
+
PartyCoinsReceivedEvent: partyWalletContract.CoinsReceivedEvent,
|
|
1230
|
+
PartyFundsRedeemedEvent: partyWalletContract.FundsRedeemedEvent,
|
|
1231
|
+
ReleaseTrackRevenueDistributedEvent:
|
|
1232
|
+
releaseRevenueDistributorContract.ReleaseTrackRevenueDistributedEvent,
|
|
1233
|
+
ReleaseRevenueDistributedEvent:
|
|
1234
|
+
releaseRevenueDistributorContract.ReleaseRevenueDistributedEvent,
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
/** The full Miso client exposed by `@misofm/platform`. */
|
|
1239
|
+
export { MisoPlatformClient as MisoClient };
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* Registers the complete Miso facade at `client.miso`.
|
|
1243
|
+
*
|
|
1244
|
+
* Platform operations live directly on `client.miso`; the lower-level
|
|
1245
|
+
* permissionless protocol SDK is available at `client.miso.protocol`.
|
|
1246
|
+
*/
|
|
1247
|
+
export function miso<const Name extends string = "miso">(
|
|
1248
|
+
options: MisoOptions<Name> = {},
|
|
1249
|
+
): SuiClientRegistration<ClientWithCoreApi, Name, MisoPlatformClient> {
|
|
1250
|
+
const name = (options.name ?? "miso") as Name;
|
|
1251
|
+
return {
|
|
1252
|
+
name,
|
|
1253
|
+
register: (client: ClientWithCoreApi) => {
|
|
1254
|
+
const deployment = immutableSnapshot(
|
|
1255
|
+
options.deployment ?? getMisoPlatformDeployment(client.network),
|
|
1256
|
+
);
|
|
1257
|
+
if (deployment.network !== client.network) {
|
|
1258
|
+
throw new MisoNetworkMismatchError(client.network, deployment.network);
|
|
1259
|
+
}
|
|
1260
|
+
const protocol = protocolMiso({
|
|
1261
|
+
deployment: deployment.protocol,
|
|
1262
|
+
graphqlClient: options.graphqlClient,
|
|
1263
|
+
}).register(client);
|
|
1264
|
+
return new MisoPlatformClient(
|
|
1265
|
+
client,
|
|
1266
|
+
{
|
|
1267
|
+
recordSales: deployment.recordSales,
|
|
1268
|
+
misoPackageId: deployment.protocol.miso,
|
|
1269
|
+
minatoPackageId: deployment.packages.minato,
|
|
1270
|
+
releaseRegistryId: deployment.objects.releaseRegistry,
|
|
1271
|
+
releaseKindPackageId: deployment.packages.releaseKind,
|
|
1272
|
+
releaseDescriptionPackageId: deployment.packages.releaseDescription,
|
|
1273
|
+
releaseGenrePackageId: deployment.packages.releaseGenre,
|
|
1274
|
+
releaseDspLinkPackageId: deployment.packages.releaseDspLink,
|
|
1275
|
+
recordingAdvisoryPackageId: deployment.packages.recordingAdvisory,
|
|
1276
|
+
recordingLanguagePackageId: deployment.packages.recordingLanguage,
|
|
1277
|
+
recordingMasterReferencePackageId:
|
|
1278
|
+
deployment.packages.recordingMasterReference,
|
|
1279
|
+
recordingStreamingTranscodePackageId:
|
|
1280
|
+
deployment.packages.recordingStreamingTranscode,
|
|
1281
|
+
recordingPreviewPackageId: deployment.packages.recordingPreview,
|
|
1282
|
+
operations: deployment.operations,
|
|
1283
|
+
royaltyPoolPackageId: deployment.packages.royaltyPool,
|
|
1284
|
+
routedStakePackageId: deployment.packages.routedStake,
|
|
1285
|
+
releaseCreditsPackageId: deployment.packages.releaseCredits,
|
|
1286
|
+
misoCreditPackageId: deployment.packages.credit,
|
|
1287
|
+
coverArtPackageId: deployment.packages.coverArt,
|
|
1288
|
+
releaseCoverArtPackageId: deployment.packages.releaseCoverArt,
|
|
1289
|
+
genrePackageId: deployment.packages.genre,
|
|
1290
|
+
genreRegistryId: deployment.objects.genreRegistry,
|
|
1291
|
+
oriPackageId: deployment.packages.ori,
|
|
1292
|
+
},
|
|
1293
|
+
protocol,
|
|
1294
|
+
deployment,
|
|
1295
|
+
);
|
|
1296
|
+
},
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* @deprecated Prefer zero-config `miso()`, which registers the complete facade
|
|
1302
|
+
* at `client.miso` and exposes the protocol layer at `client.miso.protocol`.
|
|
1303
|
+
*/
|
|
1304
|
+
export function misoPlatform(config: MisoPlatformConfig) {
|
|
1305
|
+
return {
|
|
1306
|
+
name: "misoPlatform" as const,
|
|
1307
|
+
register: (client: ClientWithCoreApi) => {
|
|
1308
|
+
const configSnapshot = immutableSnapshot(config);
|
|
1309
|
+
if (configSnapshot.network && configSnapshot.network !== client.network) {
|
|
1310
|
+
throw new MisoNetworkMismatchError(client.network, configSnapshot.network);
|
|
1311
|
+
}
|
|
1312
|
+
const protocol = configSnapshot.misoPackageId
|
|
1313
|
+
? protocolMiso({
|
|
1314
|
+
deployment: { packageId: configSnapshot.misoPackageId },
|
|
1315
|
+
}).register(client)
|
|
1316
|
+
: undefined;
|
|
1317
|
+
return new MisoPlatformClient(client, configSnapshot, protocol);
|
|
1318
|
+
},
|
|
1319
|
+
};
|
|
1320
|
+
}
|