@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/dist/client.js
ADDED
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { miso as protocolMiso, } from "@misofm/protocol/client";
|
|
4
|
+
import * as recordContract from "@misofm/protocol/contracts/miso_record/record";
|
|
5
|
+
import * as pressingContract from "@misofm/protocol/contracts/miso_record/pressing";
|
|
6
|
+
import * as listingContract from "@misofm/protocol/contracts/miso_record_shop/listing";
|
|
7
|
+
import * as genreContract from "@misofm/protocol/contracts/genre/genre";
|
|
8
|
+
import * as releaseDescriptionContract from "@misofm/protocol/contracts/release_description/release_description";
|
|
9
|
+
import * as releaseDspLinkContract from "@misofm/protocol/contracts/release_dsp_link/release_dsp_link";
|
|
10
|
+
import * as releaseGenreContract from "@misofm/protocol/contracts/release_genre/release_genre";
|
|
11
|
+
import * as releaseKindContract from "@misofm/protocol/contracts/release_kind/release_kind";
|
|
12
|
+
import * as releaseRevenueDistributorContract from "@misofm/protocol/contracts/release_revenue_distributor/release_revenue_distributor";
|
|
13
|
+
import * as vaultContract from "@misofm/protocol/contracts/vault/vault";
|
|
14
|
+
import * as compositionRoyaltyPoolContract from "@misofm/protocol/contracts/composition_royalty_pool/composition_royalty_pool";
|
|
15
|
+
import * as recordingRoyaltyPoolContract from "@misofm/protocol/contracts/recording_royalty_pool/recording_royalty_pool";
|
|
16
|
+
import * as partyWalletContract from "@misofm/protocol/contracts/party_wallet/party_wallet";
|
|
17
|
+
import * as compositionRoutedStakeContract from "@misofm/protocol/contracts/composition_routed_stake/composition_routed_stake";
|
|
18
|
+
import * as compositionRoyaltyPoolPluginContract from "@misofm/protocol/contracts/composition_royalty_pool_plugin/composition_royalty_pool_plugin";
|
|
19
|
+
import * as recordingRoyaltyPoolPluginContract from "@misofm/protocol/contracts/recording_royalty_pool_plugin/recording_royalty_pool_plugin";
|
|
20
|
+
import * as releaseRevenueDistributorPluginContract from "@misofm/protocol/contracts/release_revenue_distributor_plugin/release_revenue_distributor_plugin";
|
|
21
|
+
import * as routedStakeContract from "@misofm/protocol/contracts/routed_stake/routed_stake";
|
|
22
|
+
import * as royaltyPoolContract from "@misofm/protocol/contracts/royalty_pool/pool";
|
|
23
|
+
import * as recordingAdvisoryContract from "@misofm/protocol/contracts/recording_advisory/recording_advisory";
|
|
24
|
+
import * as recordingLanguageContract from "@misofm/protocol/contracts/recording_language/recording_language";
|
|
25
|
+
import * as recordingMasterReferenceContract from "@misofm/protocol/contracts/recording_master_reference/recording_master_reference";
|
|
26
|
+
import * as recordingStreamingTranscodeContract from "@misofm/protocol/contracts/recording_streaming_transcode/recording_streaming_transcode";
|
|
27
|
+
import * as recordingPreviewContract from "@misofm/protocol/contracts/recording_preview/recording_preview";
|
|
28
|
+
import * as vaultActions from "./vault.js";
|
|
29
|
+
import * as coverArtContract from "@misofm/protocol/contracts/cover_art/cover_art";
|
|
30
|
+
import * as releaseCoverArtContract from "@misofm/protocol/contracts/release_cover_art/release_cover_art";
|
|
31
|
+
import * as releaseCreditsContract from "@misofm/protocol/contracts/release_credits/release_credits";
|
|
32
|
+
import { authorizeRecordShop, deriveListingId, derivePressingAdminCapId, derivePressingId, deriveRecordId, deriveSaleIds, getListing, getPressing, getRecord, getSale, openListing, openPressing, purchaseRecord, revokeRecordShop, setListingPrice, setListingState, } from "./pressing.js";
|
|
33
|
+
import { publishShareCurrency, initializeShareCurrency, publishComposition, publishRecording, publishCompositionAndRecording, publishRelease, } from "./transactions.js";
|
|
34
|
+
import * as share from "./share.js";
|
|
35
|
+
import { publishReleaseGraph, } from "./release-graph.js";
|
|
36
|
+
import { getMisoPlatformDeployment, requireOperationsDeployment, requireRecordSalesDeployment, } from "./deployments.js";
|
|
37
|
+
import { immutableSnapshot } from "./internal.js";
|
|
38
|
+
import { deriveGenreAddress, setReleaseDescription, setReleaseDspLinks, setReleaseGenres, setReleaseKind, } from "./release-extensions.js";
|
|
39
|
+
import { setRecordingStreamingTranscode, unsetRecordingStreamingTranscode, } from "./recording-extensions.js";
|
|
40
|
+
import { addReleaseCredit } from "./credits.js";
|
|
41
|
+
import { setReleaseCover, setReleaseTrackCover, } from "./cover.js";
|
|
42
|
+
import { executeViaExecutor as executePlatformViaExecutor, } from "./execute.js";
|
|
43
|
+
/**
|
|
44
|
+
* Bind an explicit safe subset of a generated module to one immutable package.
|
|
45
|
+
* Callers cannot supply or override `package`; reference-returning, UID-only,
|
|
46
|
+
* and package-internal constructors never appear in this executable facade.
|
|
47
|
+
*/
|
|
48
|
+
function bindModulePackage(mod, pkg, available) {
|
|
49
|
+
const out = {};
|
|
50
|
+
for (const key of available) {
|
|
51
|
+
const value = mod[key];
|
|
52
|
+
out[String(key)] =
|
|
53
|
+
typeof value === "function"
|
|
54
|
+
? (options) => value({ ...options, package: pkg })
|
|
55
|
+
: value;
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/** Keep synchronous, client-bound surfaces unusable until the endpoint's exact
|
|
60
|
+
* ledger has been validated. The underlying standalone builders remain pure. */
|
|
61
|
+
function requireReadyOnFunctions(surface, requireReady, namespace) {
|
|
62
|
+
return new Proxy(surface, {
|
|
63
|
+
get(target, property, receiver) {
|
|
64
|
+
const value = Reflect.get(target, property, receiver);
|
|
65
|
+
if (typeof value !== "function")
|
|
66
|
+
return value;
|
|
67
|
+
return (...args) => {
|
|
68
|
+
requireReady(`${namespace}.${String(property)}`);
|
|
69
|
+
return Reflect.apply(value, target, args);
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function requireReadyOnModuleFunctions(surface, requireReady, namespace) {
|
|
75
|
+
return new Proxy(surface, {
|
|
76
|
+
get(target, property, receiver) {
|
|
77
|
+
const value = Reflect.get(target, property, receiver);
|
|
78
|
+
if (!value || typeof value !== "object")
|
|
79
|
+
return value;
|
|
80
|
+
return requireReadyOnFunctions(value, requireReady, `${namespace}.${String(property)}`);
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export class MisoNetworkMismatchError extends Error {
|
|
85
|
+
clientNetwork;
|
|
86
|
+
deploymentNetwork;
|
|
87
|
+
name = "MisoNetworkMismatchError";
|
|
88
|
+
constructor(clientNetwork, deploymentNetwork) {
|
|
89
|
+
super(`@misofm/platform: client network "${clientNetwork}" does not match deployment network "${deploymentNetwork}"`);
|
|
90
|
+
this.clientNetwork = clientNetwork;
|
|
91
|
+
this.deploymentNetwork = deploymentNetwork;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export class MisoChainIdentifierMismatchError extends Error {
|
|
95
|
+
actual;
|
|
96
|
+
expected;
|
|
97
|
+
name = "MisoChainIdentifierMismatchError";
|
|
98
|
+
constructor(actual, expected) {
|
|
99
|
+
super(`@misofm/platform: endpoint chain identifier "${actual}" does not match deployment chain identifier "${expected}"`);
|
|
100
|
+
this.actual = actual;
|
|
101
|
+
this.expected = expected;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export class MisoClientNotReadyError extends Error {
|
|
105
|
+
operation;
|
|
106
|
+
name = "MisoClientNotReadyError";
|
|
107
|
+
constructor(operation) {
|
|
108
|
+
super(`@misofm/platform: ${operation} requires an exact-chain validation lifecycle; call and await client.miso.ready() first`);
|
|
109
|
+
this.operation = operation;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export class MisoPlatformClient {
|
|
113
|
+
#client;
|
|
114
|
+
#config;
|
|
115
|
+
#protocol;
|
|
116
|
+
#chainIdentifier;
|
|
117
|
+
/** Bundled/custom deployment selected for the full facade, when available. */
|
|
118
|
+
deployment;
|
|
119
|
+
#readyState = "unvalidated";
|
|
120
|
+
#readyPromise;
|
|
121
|
+
constructor(client, config, protocol, deployment) {
|
|
122
|
+
const configSnapshot = immutableSnapshot(config);
|
|
123
|
+
const deploymentSnapshot = deployment
|
|
124
|
+
? immutableSnapshot(deployment)
|
|
125
|
+
: undefined;
|
|
126
|
+
this.#client = client;
|
|
127
|
+
this.#config = configSnapshot;
|
|
128
|
+
if (configSnapshot.operations?.status === "available") {
|
|
129
|
+
requireOperationsDeployment(configSnapshot.operations);
|
|
130
|
+
}
|
|
131
|
+
// A pressing-only facade must not implicitly register a fail-closed core
|
|
132
|
+
// extension. Supply a core deployment/misoPackageId when `protocol` is
|
|
133
|
+
// needed; otherwise this remains a safe, independent pressing client.
|
|
134
|
+
this.#protocol =
|
|
135
|
+
protocol ??
|
|
136
|
+
(configSnapshot.misoPackageId
|
|
137
|
+
? protocolMiso({
|
|
138
|
+
deployment: { packageId: configSnapshot.misoPackageId },
|
|
139
|
+
}).register(client)
|
|
140
|
+
: undefined);
|
|
141
|
+
this.deployment = deploymentSnapshot;
|
|
142
|
+
this.#chainIdentifier =
|
|
143
|
+
deploymentSnapshot?.chainIdentifier ?? configSnapshot.chainIdentifier;
|
|
144
|
+
}
|
|
145
|
+
/** Permissionless protocol APIs bound to the same validated ledger. */
|
|
146
|
+
get protocol() {
|
|
147
|
+
if (!this.#protocol)
|
|
148
|
+
return undefined;
|
|
149
|
+
this.#requireReady("protocol APIs");
|
|
150
|
+
return this.#protocol;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Memoized exact-ledger readiness gate. Registration already rejects a
|
|
154
|
+
* synchronous network-label mismatch; this Core API read protects every
|
|
155
|
+
* client-bound write surface from a mislabeled or custom endpoint.
|
|
156
|
+
*/
|
|
157
|
+
ready() {
|
|
158
|
+
if (!this.#readyPromise) {
|
|
159
|
+
this.#readyState = "validating";
|
|
160
|
+
this.#readyPromise = (async () => {
|
|
161
|
+
try {
|
|
162
|
+
if (!this.#chainIdentifier) {
|
|
163
|
+
throw new Error("misoPlatform: chain readiness requires a complete deployment or an explicit `chainIdentifier`.");
|
|
164
|
+
}
|
|
165
|
+
const { chainIdentifier } = await this.#client.core.getChainIdentifier();
|
|
166
|
+
if (chainIdentifier !== this.#chainIdentifier) {
|
|
167
|
+
throw new MisoChainIdentifierMismatchError(chainIdentifier, this.#chainIdentifier);
|
|
168
|
+
}
|
|
169
|
+
this.#readyState = "ready";
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
this.#readyState = "failed";
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
})();
|
|
176
|
+
}
|
|
177
|
+
return this.#readyPromise;
|
|
178
|
+
}
|
|
179
|
+
/** Compatibility hook; prefer `await client.miso.ready()`. */
|
|
180
|
+
async validateChainIdentifier() {
|
|
181
|
+
await this.ready();
|
|
182
|
+
return this.#chainIdentifier;
|
|
183
|
+
}
|
|
184
|
+
#requireReady(operation) {
|
|
185
|
+
// Capability availability remains the first fail-closed boundary. This
|
|
186
|
+
// keeps an unavailable deployment from masquerading as a mere lifecycle
|
|
187
|
+
// error while still preventing configured builders from running pre-ready.
|
|
188
|
+
if (operation === "ids.pressing" ||
|
|
189
|
+
operation === "ids.pressingAdminCap" ||
|
|
190
|
+
operation === "ids.record" ||
|
|
191
|
+
operation === "ids.listing" ||
|
|
192
|
+
operation === "ids.sale" ||
|
|
193
|
+
operation === "tx.purchaseRecord" ||
|
|
194
|
+
operation === "tx.openPressing" ||
|
|
195
|
+
operation === "tx.openListing" ||
|
|
196
|
+
operation === "tx.authorizeRecordShop" ||
|
|
197
|
+
operation === "tx.revokeRecordShop" ||
|
|
198
|
+
operation === "tx.setListingPrice" ||
|
|
199
|
+
operation === "tx.setListingState") {
|
|
200
|
+
this.#recordSales();
|
|
201
|
+
}
|
|
202
|
+
if (operation === "ids.vault" || operation === "ids.vaultAdminCap") {
|
|
203
|
+
this.#operations();
|
|
204
|
+
}
|
|
205
|
+
if (this.#readyState !== "ready") {
|
|
206
|
+
throw new MisoClientNotReadyError(operation);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** Party identity and profile APIs, backed by the network SDK. */
|
|
210
|
+
get party() {
|
|
211
|
+
if (!this.#protocol) {
|
|
212
|
+
throw new Error("misoPlatform: Party APIs require the complete platform deployment. Use miso({ deployment }).");
|
|
213
|
+
}
|
|
214
|
+
this.#requireReady("party APIs");
|
|
215
|
+
return this.#protocol.party;
|
|
216
|
+
}
|
|
217
|
+
#recordSales() {
|
|
218
|
+
return requireRecordSalesDeployment(this.#config.recordSales ?? {
|
|
219
|
+
status: "unavailable",
|
|
220
|
+
reason: "this client was configured without Record and Record Shop package IDs",
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
#operations() {
|
|
224
|
+
return requireOperationsDeployment(this.#config.operations);
|
|
225
|
+
}
|
|
226
|
+
#availableOperations() {
|
|
227
|
+
return this.#config.operations?.status === "available"
|
|
228
|
+
? requireOperationsDeployment(this.#config.operations)
|
|
229
|
+
: undefined;
|
|
230
|
+
}
|
|
231
|
+
get recordPackageId() {
|
|
232
|
+
return this.#recordSales().recordPackageId;
|
|
233
|
+
}
|
|
234
|
+
get recordShopPackageId() {
|
|
235
|
+
return this.#recordSales().recordShopPackageId;
|
|
236
|
+
}
|
|
237
|
+
#misoPackageId() {
|
|
238
|
+
const { misoPackageId } = this.#config;
|
|
239
|
+
if (!misoPackageId) {
|
|
240
|
+
throw new Error("misoPlatform: `misoPackageId` is required for the publish builders " +
|
|
241
|
+
"(publishComposition, publishRecording, publishCompositionAndRecording, publishRelease) — pass it to misoPlatform({ misoPackageId }).");
|
|
242
|
+
}
|
|
243
|
+
return misoPackageId;
|
|
244
|
+
}
|
|
245
|
+
#minatoPackageId() {
|
|
246
|
+
const { minatoPackageId } = this.#config;
|
|
247
|
+
if (!minatoPackageId) {
|
|
248
|
+
throw new Error("misoPlatform: `minatoPackageId` is required for the publish builders that disperse shares " +
|
|
249
|
+
"(publishComposition, publishRecording, publishCompositionAndRecording) — pass it to misoPlatform({ minatoPackageId }).");
|
|
250
|
+
}
|
|
251
|
+
return minatoPackageId;
|
|
252
|
+
}
|
|
253
|
+
#releaseRegistryId() {
|
|
254
|
+
const { releaseRegistryId: id } = this.#config;
|
|
255
|
+
if (!id) {
|
|
256
|
+
throw new Error("misoPlatform: `releaseRegistryId` is required to build a release.");
|
|
257
|
+
}
|
|
258
|
+
return id;
|
|
259
|
+
}
|
|
260
|
+
#requiredConfig(field, operation) {
|
|
261
|
+
const value = this.#config[field];
|
|
262
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
263
|
+
throw new Error(`misoPlatform: \`${String(field)}\` is required for ${operation}.`);
|
|
264
|
+
}
|
|
265
|
+
return value;
|
|
266
|
+
}
|
|
267
|
+
// ── Reads ─────────────────────────────────────────────────────────────────
|
|
268
|
+
/** The run itself, or `null` if this release has never opened one. */
|
|
269
|
+
async getPressing(pressingId) {
|
|
270
|
+
await this.ready();
|
|
271
|
+
return getPressing(this.#client, pressingId, this.recordPackageId);
|
|
272
|
+
}
|
|
273
|
+
/** One currency's offer, or `null` if the run does not sell in it. */
|
|
274
|
+
async getListing(listingId) {
|
|
275
|
+
await this.ready();
|
|
276
|
+
return getListing(this.#client, listingId, this.recordShopPackageId);
|
|
277
|
+
}
|
|
278
|
+
/** One concrete purchased Record, including immutable purchase provenance. */
|
|
279
|
+
async getRecord(recordId) {
|
|
280
|
+
await this.ready();
|
|
281
|
+
return getRecord(this.#client, recordId, this.recordPackageId);
|
|
282
|
+
}
|
|
283
|
+
/** Run + one currency's offer in a single round trip, by address math. */
|
|
284
|
+
async getSale(p) {
|
|
285
|
+
await this.ready();
|
|
286
|
+
return getSale(this.#client, {
|
|
287
|
+
...p,
|
|
288
|
+
recordPackageId: this.recordPackageId,
|
|
289
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
// ── Address math ──────────────────────────────────────────────────────────
|
|
293
|
+
ids = requireReadyOnFunctions({
|
|
294
|
+
pressing: (releaseId, edition) => derivePressingId(releaseId, edition, this.recordPackageId),
|
|
295
|
+
pressingAdminCap: (pressingId) => derivePressingAdminCapId(pressingId, this.recordPackageId),
|
|
296
|
+
record: (pressingId, number) => deriveRecordId(pressingId, number, this.recordPackageId),
|
|
297
|
+
listing: (pressingId, currencyType) => deriveListingId(pressingId, currencyType, this.recordShopPackageId),
|
|
298
|
+
sale: (releaseId, edition, currencyType) => deriveSaleIds(releaseId, edition, currencyType, this.recordPackageId, this.recordShopPackageId),
|
|
299
|
+
vault: (capId, capType) => vaultActions.deriveVaultId({
|
|
300
|
+
vaultRegistryId: this.#operations().vault.registryId,
|
|
301
|
+
capId,
|
|
302
|
+
capType,
|
|
303
|
+
vaultPackageId: this.#operations().vault.packageId,
|
|
304
|
+
}),
|
|
305
|
+
vaultAdminCap: (vaultId) => vaultActions.deriveVaultAdminCapId(vaultId, this.#operations().vault.packageId),
|
|
306
|
+
genre: (canonicalName) => deriveGenreAddress(this.#requiredConfig("genreRegistryId", "genre id derivation"), this.#requiredConfig("genrePackageId", "genre id derivation"), canonicalName),
|
|
307
|
+
}, (operation) => this.#requireReady(operation), "ids");
|
|
308
|
+
// ── Transaction builders ──────────────────────────────────────────────────
|
|
309
|
+
/** Client-bound builders require a successful `await client.miso.ready()`.
|
|
310
|
+
* Standalone exports remain pure for explicitly managed offline workflows. */
|
|
311
|
+
tx = requireReadyOnFunctions({
|
|
312
|
+
purchaseRecord: (p) => purchaseRecord({
|
|
313
|
+
...p,
|
|
314
|
+
recordPackageId: this.recordPackageId,
|
|
315
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
316
|
+
}),
|
|
317
|
+
openPressing: (p) => openPressing({
|
|
318
|
+
...p,
|
|
319
|
+
recordPackageId: this.recordPackageId,
|
|
320
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
321
|
+
}),
|
|
322
|
+
openListing: (p) => openListing({ ...p, recordShopPackageId: this.recordShopPackageId }),
|
|
323
|
+
authorizeRecordShop: (p) => authorizeRecordShop({
|
|
324
|
+
...p,
|
|
325
|
+
recordPackageId: this.recordPackageId,
|
|
326
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
327
|
+
}),
|
|
328
|
+
revokeRecordShop: (p) => revokeRecordShop({
|
|
329
|
+
...p,
|
|
330
|
+
recordPackageId: this.recordPackageId,
|
|
331
|
+
recordShopPackageId: this.recordShopPackageId,
|
|
332
|
+
}),
|
|
333
|
+
setListingPrice: (p) => setListingPrice({ ...p, recordShopPackageId: this.recordShopPackageId }),
|
|
334
|
+
setListingState: (p) => setListingState({ ...p, recordShopPackageId: this.recordShopPackageId }),
|
|
335
|
+
// Publishing (protocol works + minato share economics) — package-id-free
|
|
336
|
+
// builders pass through unchanged; the rest bind this client's
|
|
337
|
+
// `misoPackageId`/`minatoPackageId`, throwing at call time if either is
|
|
338
|
+
// missing (kept optional on the client so a sell-only client, e.g. a
|
|
339
|
+
// storefront that never mints new works, doesn't need to carry them).
|
|
340
|
+
publishShareCurrency,
|
|
341
|
+
initializeShareCurrency,
|
|
342
|
+
publishComposition: (p) => publishComposition({
|
|
343
|
+
...p,
|
|
344
|
+
misoPackageId: this.#misoPackageId(),
|
|
345
|
+
minatoPackageId: this.#minatoPackageId(),
|
|
346
|
+
}),
|
|
347
|
+
publishRecording: (p) => publishRecording({
|
|
348
|
+
...p,
|
|
349
|
+
misoPackageId: this.#misoPackageId(),
|
|
350
|
+
minatoPackageId: this.#minatoPackageId(),
|
|
351
|
+
}),
|
|
352
|
+
publishCompositionAndRecording: (p) => publishCompositionAndRecording({
|
|
353
|
+
...p,
|
|
354
|
+
misoPackageId: this.#misoPackageId(),
|
|
355
|
+
minatoPackageId: this.#minatoPackageId(),
|
|
356
|
+
}),
|
|
357
|
+
publishRelease: (p) => {
|
|
358
|
+
return publishRelease({
|
|
359
|
+
...p,
|
|
360
|
+
misoPackageId: this.#misoPackageId(),
|
|
361
|
+
releaseRegistryId: this.#releaseRegistryId(),
|
|
362
|
+
});
|
|
363
|
+
},
|
|
364
|
+
publishReleaseGraph: (p) => {
|
|
365
|
+
return publishReleaseGraph({
|
|
366
|
+
...p,
|
|
367
|
+
misoPackageId: this.#misoPackageId(),
|
|
368
|
+
minatoPackageId: this.#minatoPackageId(),
|
|
369
|
+
});
|
|
370
|
+
},
|
|
371
|
+
setReleaseKind: (p) => setReleaseKind({
|
|
372
|
+
...p,
|
|
373
|
+
releaseKindPackageId: this.#requiredConfig("releaseKindPackageId", "setReleaseKind"),
|
|
374
|
+
}),
|
|
375
|
+
setReleaseDescription: (p) => setReleaseDescription({
|
|
376
|
+
...p,
|
|
377
|
+
releaseDescriptionPackageId: this.#requiredConfig("releaseDescriptionPackageId", "setReleaseDescription"),
|
|
378
|
+
}),
|
|
379
|
+
setReleaseGenres: (p) => setReleaseGenres({
|
|
380
|
+
...p,
|
|
381
|
+
releaseGenrePackageId: this.#requiredConfig("releaseGenrePackageId", "setReleaseGenres"),
|
|
382
|
+
}),
|
|
383
|
+
setReleaseDspLinks: (p) => setReleaseDspLinks({
|
|
384
|
+
...p,
|
|
385
|
+
releaseDspLinkPackageId: this.#requiredConfig("releaseDspLinkPackageId", "setReleaseDspLinks"),
|
|
386
|
+
}),
|
|
387
|
+
addReleaseCredit: (p) => addReleaseCredit({
|
|
388
|
+
...p,
|
|
389
|
+
releaseCreditsPackageId: this.#requiredConfig("releaseCreditsPackageId", "addReleaseCredit"),
|
|
390
|
+
misoCreditPackageId: this.#requiredConfig("misoCreditPackageId", "addReleaseCredit"),
|
|
391
|
+
}),
|
|
392
|
+
setReleaseCover: (p) => setReleaseCover({
|
|
393
|
+
...p,
|
|
394
|
+
coverArtPackageId: this.#requiredConfig("coverArtPackageId", "setReleaseCover"),
|
|
395
|
+
releaseCoverArtPackageId: this.#requiredConfig("releaseCoverArtPackageId", "setReleaseCover"),
|
|
396
|
+
oriPackageId: this.#requiredConfig("oriPackageId", "setReleaseCover"),
|
|
397
|
+
}),
|
|
398
|
+
setReleaseTrackCover: (p) => setReleaseTrackCover({
|
|
399
|
+
...p,
|
|
400
|
+
coverArtPackageId: this.#requiredConfig("coverArtPackageId", "setReleaseTrackCover"),
|
|
401
|
+
releaseCoverArtPackageId: this.#requiredConfig("releaseCoverArtPackageId", "setReleaseTrackCover"),
|
|
402
|
+
oriPackageId: this.#requiredConfig("oriPackageId", "setReleaseTrackCover"),
|
|
403
|
+
}),
|
|
404
|
+
setRecordingStreamingTranscode: (p) => setRecordingStreamingTranscode({
|
|
405
|
+
...p,
|
|
406
|
+
recordingStreamingTranscodePackageId: this.#requiredConfig("recordingStreamingTranscodePackageId", "setRecordingStreamingTranscode"),
|
|
407
|
+
oriPackageId: this.#requiredConfig("oriPackageId", "setRecordingStreamingTranscode"),
|
|
408
|
+
}),
|
|
409
|
+
unsetRecordingStreamingTranscode: (p) => unsetRecordingStreamingTranscode({
|
|
410
|
+
...p,
|
|
411
|
+
recordingStreamingTranscodePackageId: this.#requiredConfig("recordingStreamingTranscodePackageId", "unsetRecordingStreamingTranscode"),
|
|
412
|
+
}),
|
|
413
|
+
}, (operation) => this.#requireReady(operation), "tx");
|
|
414
|
+
/**
|
|
415
|
+
* Vault-aware builders and parsers. These take explicit object ids because a
|
|
416
|
+
* VaultAdminCap is owner-held while the Vault is shared; package ids can come
|
|
417
|
+
* from the deployment config or be supplied for private deployments.
|
|
418
|
+
*/
|
|
419
|
+
get vault() {
|
|
420
|
+
if (!this.#availableOperations())
|
|
421
|
+
return undefined;
|
|
422
|
+
this.#requireReady("vault builders");
|
|
423
|
+
return vaultActions;
|
|
424
|
+
}
|
|
425
|
+
// ── Share currency provisioning (executes; Signer pattern) ─────────────────
|
|
426
|
+
/** Publishes + initializes a fresh share currency (two txs). */
|
|
427
|
+
async createShareCurrency(signer, params) {
|
|
428
|
+
await this.ready();
|
|
429
|
+
return share.createShareCurrency(this.#client, signer, params);
|
|
430
|
+
}
|
|
431
|
+
/** Execute a composed platform PTB only after exact-ledger validation. */
|
|
432
|
+
async executeViaExecutor(executor, ...thunks) {
|
|
433
|
+
await this.ready();
|
|
434
|
+
return executePlatformViaExecutor(executor, ...thunks);
|
|
435
|
+
}
|
|
436
|
+
// ── Generated layer ───────────────────────────────────────────────────────
|
|
437
|
+
/** Generated Move-call bindings, for commands this facade doesn't wrap. */
|
|
438
|
+
get call() {
|
|
439
|
+
const sales = this.#config.recordSales?.status === "available"
|
|
440
|
+
? this.#config.recordSales
|
|
441
|
+
: undefined;
|
|
442
|
+
const operations = this.#availableOperations();
|
|
443
|
+
return requireReadyOnModuleFunctions({
|
|
444
|
+
record: sales
|
|
445
|
+
? bindModulePackage(recordContract, sales.recordPackageId, [
|
|
446
|
+
"destroy",
|
|
447
|
+
"releaseId",
|
|
448
|
+
"pressingId",
|
|
449
|
+
"edition",
|
|
450
|
+
"number",
|
|
451
|
+
"purchaseCurrency",
|
|
452
|
+
"purchasePrice",
|
|
453
|
+
"purchasedBy",
|
|
454
|
+
"purchasedTimestampMs",
|
|
455
|
+
"deriveAddress",
|
|
456
|
+
])
|
|
457
|
+
: undefined,
|
|
458
|
+
listing: sales
|
|
459
|
+
? bindModulePackage(listingContract, sales.recordShopPackageId, [
|
|
460
|
+
"fixed",
|
|
461
|
+
"floor",
|
|
462
|
+
"enabled",
|
|
463
|
+
"disabled",
|
|
464
|
+
"setState",
|
|
465
|
+
"setPrice",
|
|
466
|
+
"purchase",
|
|
467
|
+
"deriveAddress",
|
|
468
|
+
"releaseId",
|
|
469
|
+
"pressingId",
|
|
470
|
+
"pricing",
|
|
471
|
+
"price",
|
|
472
|
+
"state",
|
|
473
|
+
"isEnabled",
|
|
474
|
+
"isDisabled",
|
|
475
|
+
"isFixed",
|
|
476
|
+
"isFloor",
|
|
477
|
+
])
|
|
478
|
+
: undefined,
|
|
479
|
+
pressing: sales
|
|
480
|
+
? bindModulePackage(pressingContract, sales.recordPackageId, [
|
|
481
|
+
"authorizeDistributor",
|
|
482
|
+
"revokeDistributor",
|
|
483
|
+
"deriveAddress",
|
|
484
|
+
"deriveAdminCapAddress",
|
|
485
|
+
"releaseId",
|
|
486
|
+
"edition",
|
|
487
|
+
"supply",
|
|
488
|
+
"maxSupply",
|
|
489
|
+
"distributors",
|
|
490
|
+
"isDistributorAuthorized",
|
|
491
|
+
"pressingId",
|
|
492
|
+
])
|
|
493
|
+
: undefined,
|
|
494
|
+
genre: this.#config.genrePackageId
|
|
495
|
+
? bindModulePackage(genreContract, this.#config.genrePackageId, [
|
|
496
|
+
"deriveAddress",
|
|
497
|
+
])
|
|
498
|
+
: undefined,
|
|
499
|
+
releaseDescription: this.#config.releaseDescriptionPackageId
|
|
500
|
+
? bindModulePackage(releaseDescriptionContract, this.#config.releaseDescriptionPackageId, ["setDescription", "clearDescription", "hasDescription"])
|
|
501
|
+
: undefined,
|
|
502
|
+
releaseDspLink: this.#config.releaseDspLinkPackageId
|
|
503
|
+
? bindModulePackage(releaseDspLinkContract, this.#config.releaseDspLinkPackageId, [
|
|
504
|
+
"platform",
|
|
505
|
+
"platformSpotify",
|
|
506
|
+
"platformAppleMusic",
|
|
507
|
+
"platformAmazonMusic",
|
|
508
|
+
"platformBandcamp",
|
|
509
|
+
"platformDeezer",
|
|
510
|
+
"platformSoundcloud",
|
|
511
|
+
"platformTidal",
|
|
512
|
+
"platformYoutubeMusic",
|
|
513
|
+
"newSpotify",
|
|
514
|
+
"newAppleMusicAlbum",
|
|
515
|
+
"newAppleMusicTrack",
|
|
516
|
+
"newAmazonMusicAlbum",
|
|
517
|
+
"newAmazonMusicTrack",
|
|
518
|
+
"newBandcamp",
|
|
519
|
+
"newDeezer",
|
|
520
|
+
"newSoundcloud",
|
|
521
|
+
"newTidal",
|
|
522
|
+
"newYoutubeMusic",
|
|
523
|
+
"setReleaseLink",
|
|
524
|
+
"clearReleaseLink",
|
|
525
|
+
"setTrackLink",
|
|
526
|
+
"clearTrackLink",
|
|
527
|
+
"clearTrackLinks",
|
|
528
|
+
"hasReleaseLink",
|
|
529
|
+
])
|
|
530
|
+
: undefined,
|
|
531
|
+
releaseGenre: this.#config.releaseGenrePackageId
|
|
532
|
+
? bindModulePackage(releaseGenreContract, this.#config.releaseGenrePackageId, [
|
|
533
|
+
"setPrimaryGenre",
|
|
534
|
+
"addSecondaryGenre",
|
|
535
|
+
"removeSecondaryGenre",
|
|
536
|
+
"setTrackPrimaryGenre",
|
|
537
|
+
"unsetTrackPrimaryGenre",
|
|
538
|
+
"hasGenre",
|
|
539
|
+
])
|
|
540
|
+
: undefined,
|
|
541
|
+
releaseKind: this.#config.releaseKindPackageId
|
|
542
|
+
? bindModulePackage(releaseKindContract, this.#config.releaseKindPackageId, ["setKind", "unsetKind", "hasKind"])
|
|
543
|
+
: undefined,
|
|
544
|
+
releaseRevenueDistributor: operations
|
|
545
|
+
? bindModulePackage(releaseRevenueDistributorContract, operations.actions.releaseRevenueDistributor, [
|
|
546
|
+
"redeemAndDistribute",
|
|
547
|
+
"redeemAllAndDistribute",
|
|
548
|
+
"receiveAndDistribute",
|
|
549
|
+
])
|
|
550
|
+
: undefined,
|
|
551
|
+
releaseRevenueDistributorPlugin: operations
|
|
552
|
+
? bindModulePackage(releaseRevenueDistributorPluginContract, operations.plugins.releaseRevenueDistributor, [
|
|
553
|
+
"install",
|
|
554
|
+
"uninstall",
|
|
555
|
+
"redeemAllAndDistribute",
|
|
556
|
+
"receiveAndDistribute",
|
|
557
|
+
"isInstalled",
|
|
558
|
+
])
|
|
559
|
+
: undefined,
|
|
560
|
+
vault: operations
|
|
561
|
+
? bindModulePackage(vaultContract, operations.vault.packageId, [
|
|
562
|
+
"share",
|
|
563
|
+
"withdrawCap",
|
|
564
|
+
"restoreCap",
|
|
565
|
+
"derivedAddress",
|
|
566
|
+
"capId",
|
|
567
|
+
"isActive",
|
|
568
|
+
"authorizedPlugins",
|
|
569
|
+
"isPluginAuthorized",
|
|
570
|
+
])
|
|
571
|
+
: undefined,
|
|
572
|
+
compositionRoyaltyPool: operations
|
|
573
|
+
? bindModulePackage(compositionRoyaltyPoolContract, operations.actions.compositionRoyaltyPool, ["newPool", "receiveAndDeposit", "redeemAndDeposit", "poolAddress"])
|
|
574
|
+
: undefined,
|
|
575
|
+
compositionRoyaltyPoolPlugin: operations
|
|
576
|
+
? bindModulePackage(compositionRoyaltyPoolPluginContract, operations.plugins.compositionRoyaltyPool, [
|
|
577
|
+
"install",
|
|
578
|
+
"uninstall",
|
|
579
|
+
"receiveAndDeposit",
|
|
580
|
+
"redeemAndDeposit",
|
|
581
|
+
"isInstalled",
|
|
582
|
+
])
|
|
583
|
+
: undefined,
|
|
584
|
+
recordingRoyaltyPool: operations
|
|
585
|
+
? bindModulePackage(recordingRoyaltyPoolContract, operations.actions.recordingRoyaltyPool, ["newPool", "receiveAndDeposit", "redeemAndDeposit", "poolAddress"])
|
|
586
|
+
: undefined,
|
|
587
|
+
recordingRoyaltyPoolPlugin: operations
|
|
588
|
+
? bindModulePackage(recordingRoyaltyPoolPluginContract, operations.plugins.recordingRoyaltyPool, [
|
|
589
|
+
"install",
|
|
590
|
+
"uninstall",
|
|
591
|
+
"receiveAndDeposit",
|
|
592
|
+
"redeemAndDeposit",
|
|
593
|
+
"isInstalled",
|
|
594
|
+
])
|
|
595
|
+
: undefined,
|
|
596
|
+
partyWallet: operations
|
|
597
|
+
? bindModulePackage(partyWalletContract, operations.actions.partyWallet, ["receive", "receiveBalance", "redeemBalance", "inboxAddress"])
|
|
598
|
+
: undefined,
|
|
599
|
+
compositionRoutedStake: operations
|
|
600
|
+
? bindModulePackage(compositionRoutedStakeContract, operations.actions.compositionRoutedStake, ["createStake", "register", "unregister", "unstake", "restake", "stakeAddress"])
|
|
601
|
+
: undefined,
|
|
602
|
+
routedStake: this.#config.routedStakePackageId
|
|
603
|
+
? bindModulePackage(routedStakeContract, this.#config.routedStakePackageId, [
|
|
604
|
+
"share",
|
|
605
|
+
"register",
|
|
606
|
+
"unregister",
|
|
607
|
+
"sweep",
|
|
608
|
+
"unstake",
|
|
609
|
+
"restake",
|
|
610
|
+
"derivedAddress",
|
|
611
|
+
])
|
|
612
|
+
: undefined,
|
|
613
|
+
royaltyPool: this.#config.royaltyPoolPackageId
|
|
614
|
+
? bindModulePackage(royaltyPoolContract, this.#config.royaltyPoolPackageId, [
|
|
615
|
+
"share",
|
|
616
|
+
"deposit",
|
|
617
|
+
"sweepAndDeposit",
|
|
618
|
+
"receiveAndDeposit",
|
|
619
|
+
"registerStake",
|
|
620
|
+
"unregisterStake",
|
|
621
|
+
"claimRewards",
|
|
622
|
+
"pendingRewards",
|
|
623
|
+
"stakedShares",
|
|
624
|
+
"cumulativeRewardPerShare",
|
|
625
|
+
"cumulativeDeposits",
|
|
626
|
+
"derivedAddress",
|
|
627
|
+
"assertDerivedFrom",
|
|
628
|
+
])
|
|
629
|
+
: undefined,
|
|
630
|
+
recordingAdvisory: this.#config.recordingAdvisoryPackageId
|
|
631
|
+
? bindModulePackage(recordingAdvisoryContract, this.#config.recordingAdvisoryPackageId, [
|
|
632
|
+
"explicit",
|
|
633
|
+
"notExplicit",
|
|
634
|
+
"cleaned",
|
|
635
|
+
"setRating",
|
|
636
|
+
"unsetRating",
|
|
637
|
+
"hasRating",
|
|
638
|
+
"isExplicit",
|
|
639
|
+
"isNotExplicit",
|
|
640
|
+
"isCleaned",
|
|
641
|
+
])
|
|
642
|
+
: undefined,
|
|
643
|
+
recordingLanguage: this.#config.recordingLanguagePackageId
|
|
644
|
+
? bindModulePackage(recordingLanguageContract, this.#config.recordingLanguagePackageId, [
|
|
645
|
+
"setLanguages",
|
|
646
|
+
"setInstrumental",
|
|
647
|
+
"unsetLanguages",
|
|
648
|
+
"hasLanguages",
|
|
649
|
+
"isInstrumental",
|
|
650
|
+
])
|
|
651
|
+
: undefined,
|
|
652
|
+
recordingMasterReference: this.#config.recordingMasterReferencePackageId
|
|
653
|
+
? bindModulePackage(recordingMasterReferenceContract, this.#config.recordingMasterReferencePackageId, [
|
|
654
|
+
"setMasterReference",
|
|
655
|
+
"unsetMasterReference",
|
|
656
|
+
"hasMasterReference",
|
|
657
|
+
])
|
|
658
|
+
: undefined,
|
|
659
|
+
recordingStreamingTranscode: this.#config.recordingStreamingTranscodePackageId
|
|
660
|
+
? bindModulePackage(recordingStreamingTranscodeContract, this.#config.recordingStreamingTranscodePackageId, [
|
|
661
|
+
"setStreamingTranscode",
|
|
662
|
+
"unsetStreamingTranscode",
|
|
663
|
+
"hasStreamingTranscode",
|
|
664
|
+
])
|
|
665
|
+
: undefined,
|
|
666
|
+
recordingPreview: this.#config.recordingPreviewPackageId
|
|
667
|
+
? bindModulePackage(recordingPreviewContract, this.#config.recordingPreviewPackageId, ["setPreview", "unsetPreview", "hasPreview"])
|
|
668
|
+
: undefined,
|
|
669
|
+
coverArt: this.#config.coverArtPackageId
|
|
670
|
+
? bindModulePackage(coverArtContract, this.#config.coverArtPackageId, [])
|
|
671
|
+
: undefined,
|
|
672
|
+
releaseCoverArt: this.#config.releaseCoverArtPackageId
|
|
673
|
+
? bindModulePackage(releaseCoverArtContract, this.#config.releaseCoverArtPackageId, [
|
|
674
|
+
"setCover",
|
|
675
|
+
"unsetCover",
|
|
676
|
+
"setTrackCover",
|
|
677
|
+
"unsetTrackCover",
|
|
678
|
+
"hasCoverArt",
|
|
679
|
+
])
|
|
680
|
+
: undefined,
|
|
681
|
+
releaseCredits: this.#config.releaseCreditsPackageId
|
|
682
|
+
? bindModulePackage(releaseCreditsContract, this.#config.releaseCreditsPackageId, ["addCredit", "removeCredit", "hasCredits"])
|
|
683
|
+
: undefined,
|
|
684
|
+
}, (operation) => this.#requireReady(operation), "call");
|
|
685
|
+
}
|
|
686
|
+
/** Generated BCS definitions, for parsing objects or events yourself. */
|
|
687
|
+
bcs = {
|
|
688
|
+
Record: recordContract.Record,
|
|
689
|
+
Pressing: pressingContract.Pressing,
|
|
690
|
+
PressingAdminCap: pressingContract.PressingAdminCap,
|
|
691
|
+
Listing: listingContract.Listing,
|
|
692
|
+
Pricing: listingContract.Pricing,
|
|
693
|
+
ListingState: listingContract.State,
|
|
694
|
+
RecordCreatedEvent: recordContract.RecordCreatedEvent,
|
|
695
|
+
RecordDestroyedEvent: recordContract.RecordDestroyedEvent,
|
|
696
|
+
PressingCreatedEvent: pressingContract.PressingCreatedEvent,
|
|
697
|
+
DistributorAuthorizedEvent: pressingContract.DistributorAuthorizedEvent,
|
|
698
|
+
DistributorRevokedEvent: pressingContract.DistributorRevokedEvent,
|
|
699
|
+
RecordPurchasedEvent: pressingContract.RecordPurchasedEvent,
|
|
700
|
+
ListingCreatedEvent: listingContract.ListingCreatedEvent,
|
|
701
|
+
ListingPriceChangedEvent: listingContract.ListingPriceChangedEvent,
|
|
702
|
+
ListingStateChangedEvent: listingContract.ListingStateChangedEvent,
|
|
703
|
+
RecordSoldEvent: listingContract.RecordSoldEvent,
|
|
704
|
+
VaultAdminCap: vaultContract.VaultAdminCap,
|
|
705
|
+
VaultRegistry: vaultContract.VaultRegistry,
|
|
706
|
+
VaultKey: vaultContract.VaultKey,
|
|
707
|
+
VaultAdminCapKey: vaultContract.VaultAdminCapKey,
|
|
708
|
+
VaultCreatedEvent: vaultContract.VaultCreatedEvent,
|
|
709
|
+
VaultCapabilityWithdrawnEvent: vaultContract.VaultCapabilityWithdrawnEvent,
|
|
710
|
+
VaultCapabilityRestoredEvent: vaultContract.VaultCapabilityRestoredEvent,
|
|
711
|
+
PartyObjectReceivedEvent: partyWalletContract.ObjectReceivedEvent,
|
|
712
|
+
PartyCoinsReceivedEvent: partyWalletContract.CoinsReceivedEvent,
|
|
713
|
+
PartyFundsRedeemedEvent: partyWalletContract.FundsRedeemedEvent,
|
|
714
|
+
ReleaseTrackRevenueDistributedEvent: releaseRevenueDistributorContract.ReleaseTrackRevenueDistributedEvent,
|
|
715
|
+
ReleaseRevenueDistributedEvent: releaseRevenueDistributorContract.ReleaseRevenueDistributedEvent,
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
/** The full Miso client exposed by `@misofm/platform`. */
|
|
719
|
+
export { MisoPlatformClient as MisoClient };
|
|
720
|
+
/**
|
|
721
|
+
* Registers the complete Miso facade at `client.miso`.
|
|
722
|
+
*
|
|
723
|
+
* Platform operations live directly on `client.miso`; the lower-level
|
|
724
|
+
* permissionless protocol SDK is available at `client.miso.protocol`.
|
|
725
|
+
*/
|
|
726
|
+
export function miso(options = {}) {
|
|
727
|
+
const name = (options.name ?? "miso");
|
|
728
|
+
return {
|
|
729
|
+
name,
|
|
730
|
+
register: (client) => {
|
|
731
|
+
const deployment = immutableSnapshot(options.deployment ?? getMisoPlatformDeployment(client.network));
|
|
732
|
+
if (deployment.network !== client.network) {
|
|
733
|
+
throw new MisoNetworkMismatchError(client.network, deployment.network);
|
|
734
|
+
}
|
|
735
|
+
const protocol = protocolMiso({
|
|
736
|
+
deployment: deployment.protocol,
|
|
737
|
+
graphqlClient: options.graphqlClient,
|
|
738
|
+
}).register(client);
|
|
739
|
+
return new MisoPlatformClient(client, {
|
|
740
|
+
recordSales: deployment.recordSales,
|
|
741
|
+
misoPackageId: deployment.protocol.miso,
|
|
742
|
+
minatoPackageId: deployment.packages.minato,
|
|
743
|
+
releaseRegistryId: deployment.objects.releaseRegistry,
|
|
744
|
+
releaseKindPackageId: deployment.packages.releaseKind,
|
|
745
|
+
releaseDescriptionPackageId: deployment.packages.releaseDescription,
|
|
746
|
+
releaseGenrePackageId: deployment.packages.releaseGenre,
|
|
747
|
+
releaseDspLinkPackageId: deployment.packages.releaseDspLink,
|
|
748
|
+
recordingAdvisoryPackageId: deployment.packages.recordingAdvisory,
|
|
749
|
+
recordingLanguagePackageId: deployment.packages.recordingLanguage,
|
|
750
|
+
recordingMasterReferencePackageId: deployment.packages.recordingMasterReference,
|
|
751
|
+
recordingStreamingTranscodePackageId: deployment.packages.recordingStreamingTranscode,
|
|
752
|
+
recordingPreviewPackageId: deployment.packages.recordingPreview,
|
|
753
|
+
operations: deployment.operations,
|
|
754
|
+
royaltyPoolPackageId: deployment.packages.royaltyPool,
|
|
755
|
+
routedStakePackageId: deployment.packages.routedStake,
|
|
756
|
+
releaseCreditsPackageId: deployment.packages.releaseCredits,
|
|
757
|
+
misoCreditPackageId: deployment.packages.credit,
|
|
758
|
+
coverArtPackageId: deployment.packages.coverArt,
|
|
759
|
+
releaseCoverArtPackageId: deployment.packages.releaseCoverArt,
|
|
760
|
+
genrePackageId: deployment.packages.genre,
|
|
761
|
+
genreRegistryId: deployment.objects.genreRegistry,
|
|
762
|
+
oriPackageId: deployment.packages.ori,
|
|
763
|
+
}, protocol, deployment);
|
|
764
|
+
},
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* @deprecated Prefer zero-config `miso()`, which registers the complete facade
|
|
769
|
+
* at `client.miso` and exposes the protocol layer at `client.miso.protocol`.
|
|
770
|
+
*/
|
|
771
|
+
export function misoPlatform(config) {
|
|
772
|
+
return {
|
|
773
|
+
name: "misoPlatform",
|
|
774
|
+
register: (client) => {
|
|
775
|
+
const configSnapshot = immutableSnapshot(config);
|
|
776
|
+
if (configSnapshot.network && configSnapshot.network !== client.network) {
|
|
777
|
+
throw new MisoNetworkMismatchError(client.network, configSnapshot.network);
|
|
778
|
+
}
|
|
779
|
+
const protocol = configSnapshot.misoPackageId
|
|
780
|
+
? protocolMiso({
|
|
781
|
+
deployment: { packageId: configSnapshot.misoPackageId },
|
|
782
|
+
}).register(client)
|
|
783
|
+
: undefined;
|
|
784
|
+
return new MisoPlatformClient(client, configSnapshot, protocol);
|
|
785
|
+
},
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
//# sourceMappingURL=client.js.map
|