@misofm/sdk 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/client.d.ts +11 -22
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -32
- package/dist/client.js.map +1 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts +4 -2
- package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts.map +1 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.js +3 -2
- package/dist/contracts/composition_routed_stake/composition_routed_stake.js.map +1 -1
- package/dist/contracts/genre/genre.d.ts +6 -17
- package/dist/contracts/genre/genre.d.ts.map +1 -1
- package/dist/contracts/genre/genre.js +4 -18
- package/dist/contracts/genre/genre.js.map +1 -1
- package/dist/contracts/miso_pressing/certificate.d.ts +37 -26
- package/dist/contracts/miso_pressing/certificate.d.ts.map +1 -1
- package/dist/contracts/miso_pressing/certificate.js +41 -24
- package/dist/contracts/miso_pressing/certificate.js.map +1 -1
- package/dist/contracts/miso_pressing/listing.d.ts +3 -18
- package/dist/contracts/miso_pressing/listing.d.ts.map +1 -1
- package/dist/contracts/miso_pressing/listing.js +3 -18
- package/dist/contracts/miso_pressing/listing.js.map +1 -1
- package/dist/contracts/miso_pressing/pressing.d.ts +6 -37
- package/dist/contracts/miso_pressing/pressing.d.ts.map +1 -1
- package/dist/contracts/miso_pressing/pressing.js +6 -43
- package/dist/contracts/miso_pressing/pressing.js.map +1 -1
- package/dist/contracts/routed_stake/routed_stake.d.ts +0 -14
- package/dist/contracts/routed_stake/routed_stake.d.ts.map +1 -1
- package/dist/contracts/routed_stake/routed_stake.js +0 -14
- package/dist/contracts/routed_stake/routed_stake.js.map +1 -1
- package/dist/contracts/royalty_pool/pool.d.ts +0 -14
- package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/pool.js +0 -14
- package/dist/contracts/royalty_pool/pool.js.map +1 -1
- package/dist/contracts/royalty_pool/stake.d.ts +0 -13
- package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/stake.js +0 -14
- package/dist/contracts/royalty_pool/stake.js.map +1 -1
- package/dist/contracts/vault/vault.d.ts +0 -13
- package/dist/contracts/vault/vault.d.ts.map +1 -1
- package/dist/contracts/vault/vault.js +0 -14
- package/dist/contracts/vault/vault.js.map +1 -1
- package/dist/contracts.d.ts +0 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +0 -1
- package/dist/contracts.js.map +1 -1
- package/dist/cover.d.ts +1 -1
- package/dist/cover.js +1 -1
- package/dist/deployments.d.ts +3 -23
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js.map +1 -1
- package/dist/pressing.d.ts +0 -3
- package/dist/pressing.d.ts.map +1 -1
- package/dist/pressing.js +1 -1
- package/dist/pressing.js.map +1 -1
- package/dist/read/artist.d.ts +2 -3
- package/dist/read/artist.d.ts.map +1 -1
- package/dist/read/artist.js +8 -53
- package/dist/read/artist.js.map +1 -1
- package/dist/read/catalog.js +3 -3
- package/dist/read/catalog.js.map +1 -1
- package/dist/read/client.d.ts +3 -3
- package/dist/read/client.d.ts.map +1 -1
- package/dist/read/client.js +4 -10
- package/dist/read/client.js.map +1 -1
- package/dist/read/config.d.ts +3 -23
- package/dist/read/config.d.ts.map +1 -1
- package/dist/read/config.js.map +1 -1
- package/dist/read/index.d.ts +2 -2
- package/dist/read/index.d.ts.map +1 -1
- package/dist/read/index.js +3 -3
- package/dist/read/index.js.map +1 -1
- package/dist/read/receipts.js +1 -1
- package/dist/read/receipts.js.map +1 -1
- package/dist/read/types.d.ts +0 -11
- package/dist/read/types.d.ts.map +1 -1
- package/dist/read/wallet.js +9 -10
- package/dist/read/wallet.js.map +1 -1
- package/dist/release-extensions.d.ts +4 -10
- package/dist/release-extensions.d.ts.map +1 -1
- package/dist/release-extensions.js +6 -19
- package/dist/release-extensions.js.map +1 -1
- package/dist/release-graph.d.ts.map +1 -1
- package/dist/release-graph.js +7 -1
- package/dist/release-graph.js.map +1 -1
- package/dist/vault.d.ts +1 -1
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +1 -0
- package/dist/vault.js.map +1 -1
- package/package.json +6 -12
- package/src/client.ts +21 -60
- package/src/contracts/composition_routed_stake/composition_routed_stake.ts +7 -4
- package/src/contracts/genre/genre.ts +7 -30
- package/src/contracts/miso_pressing/certificate.ts +64 -29
- package/src/contracts/miso_pressing/listing.ts +4 -33
- package/src/contracts/miso_pressing/pressing.ts +6 -61
- package/src/contracts/routed_stake/routed_stake.ts +0 -27
- package/src/contracts/royalty_pool/pool.ts +0 -27
- package/src/contracts/royalty_pool/stake.ts +0 -26
- package/src/contracts/vault/vault.ts +0 -26
- package/src/contracts.ts +0 -1
- package/src/cover.ts +1 -1
- package/src/deployments.ts +3 -23
- package/src/pressing.ts +1 -4
- package/src/read/artist.ts +9 -66
- package/src/read/catalog.ts +3 -3
- package/src/read/client.ts +6 -13
- package/src/read/config.ts +4 -24
- package/src/read/index.ts +2 -4
- package/src/read/receipts.ts +1 -1
- package/src/read/types.ts +0 -12
- package/src/read/wallet.ts +9 -9
- package/src/release-extensions.ts +6 -29
- package/src/release-graph.ts +7 -1
- package/src/vault.ts +2 -1
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.d.ts +0 -52
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.d.ts.map +0 -1
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.js +0 -37
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.js.map +0 -1
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.d.ts +0 -91
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.d.ts.map +0 -1
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.js +0 -91
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.js.map +0 -1
- package/src/contracts/release_snapshot_bundle/deps/ori/walrus_data.ts +0 -36
- package/src/contracts/release_snapshot_bundle/release_snapshot_bundle.ts +0 -124
|
@@ -332,33 +332,6 @@ export function sweep(options: SweepOptions) {
|
|
|
332
332
|
typeArguments: options.typeArguments
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
|
-
export interface IdArguments {
|
|
336
|
-
self: RawTransactionArgument<string>;
|
|
337
|
-
}
|
|
338
|
-
export interface IdOptions {
|
|
339
|
-
package?: string;
|
|
340
|
-
arguments: IdArguments | [
|
|
341
|
-
self: RawTransactionArgument<string>
|
|
342
|
-
];
|
|
343
|
-
typeArguments: [
|
|
344
|
-
string,
|
|
345
|
-
string
|
|
346
|
-
];
|
|
347
|
-
}
|
|
348
|
-
export function id(options: IdOptions) {
|
|
349
|
-
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
350
|
-
const argumentsTypes = [
|
|
351
|
-
null
|
|
352
|
-
] satisfies (string | null)[];
|
|
353
|
-
const parameterNames = ["self"];
|
|
354
|
-
return (tx: Transaction) => tx.moveCall({
|
|
355
|
-
package: packageAddress,
|
|
356
|
-
module: 'routed_stake',
|
|
357
|
-
function: 'id',
|
|
358
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
359
|
-
typeArguments: options.typeArguments
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
335
|
export interface HasStakeArguments {
|
|
363
336
|
self: RawTransactionArgument<string>;
|
|
364
337
|
}
|
|
@@ -412,33 +412,6 @@ export function pendingRewards(options: PendingRewardsOptions) {
|
|
|
412
412
|
typeArguments: options.typeArguments
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
|
-
export interface IdArguments {
|
|
416
|
-
self: RawTransactionArgument<string>;
|
|
417
|
-
}
|
|
418
|
-
export interface IdOptions {
|
|
419
|
-
package?: string;
|
|
420
|
-
arguments: IdArguments | [
|
|
421
|
-
self: RawTransactionArgument<string>
|
|
422
|
-
];
|
|
423
|
-
typeArguments: [
|
|
424
|
-
string,
|
|
425
|
-
string
|
|
426
|
-
];
|
|
427
|
-
}
|
|
428
|
-
export function id(options: IdOptions) {
|
|
429
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
430
|
-
const argumentsTypes = [
|
|
431
|
-
null
|
|
432
|
-
] satisfies (string | null)[];
|
|
433
|
-
const parameterNames = ["self"];
|
|
434
|
-
return (tx: Transaction) => tx.moveCall({
|
|
435
|
-
package: packageAddress,
|
|
436
|
-
module: 'pool',
|
|
437
|
-
function: 'id',
|
|
438
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
439
|
-
typeArguments: options.typeArguments
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
415
|
export interface BalanceArguments {
|
|
443
416
|
self: RawTransactionArgument<string>;
|
|
444
417
|
}
|
|
@@ -108,32 +108,6 @@ export function destroy(options: DestroyOptions) {
|
|
|
108
108
|
typeArguments: options.typeArguments
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
export interface IdArguments {
|
|
112
|
-
self: RawTransactionArgument<string>;
|
|
113
|
-
}
|
|
114
|
-
export interface IdOptions {
|
|
115
|
-
package?: string;
|
|
116
|
-
arguments: IdArguments | [
|
|
117
|
-
self: RawTransactionArgument<string>
|
|
118
|
-
];
|
|
119
|
-
typeArguments: [
|
|
120
|
-
string
|
|
121
|
-
];
|
|
122
|
-
}
|
|
123
|
-
export function id(options: IdOptions) {
|
|
124
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
125
|
-
const argumentsTypes = [
|
|
126
|
-
null
|
|
127
|
-
] satisfies (string | null)[];
|
|
128
|
-
const parameterNames = ["self"];
|
|
129
|
-
return (tx: Transaction) => tx.moveCall({
|
|
130
|
-
package: packageAddress,
|
|
131
|
-
module: 'stake',
|
|
132
|
-
function: 'id',
|
|
133
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
134
|
-
typeArguments: options.typeArguments
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
111
|
export interface BalanceArguments {
|
|
138
112
|
self: RawTransactionArgument<string>;
|
|
139
113
|
}
|
|
@@ -314,32 +314,6 @@ export function putBack<Cap extends BcsType<any>>(options: PutBackOptions<Cap>)
|
|
|
314
314
|
typeArguments: options.typeArguments
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
export interface IdArguments {
|
|
318
|
-
self: RawTransactionArgument<string>;
|
|
319
|
-
}
|
|
320
|
-
export interface IdOptions {
|
|
321
|
-
package?: string;
|
|
322
|
-
arguments: IdArguments | [
|
|
323
|
-
self: RawTransactionArgument<string>
|
|
324
|
-
];
|
|
325
|
-
typeArguments: [
|
|
326
|
-
string
|
|
327
|
-
];
|
|
328
|
-
}
|
|
329
|
-
export function id(options: IdOptions) {
|
|
330
|
-
const packageAddress = options.package ?? '@local-pkg/vault';
|
|
331
|
-
const argumentsTypes = [
|
|
332
|
-
null
|
|
333
|
-
] satisfies (string | null)[];
|
|
334
|
-
const parameterNames = ["self"];
|
|
335
|
-
return (tx: Transaction) => tx.moveCall({
|
|
336
|
-
package: packageAddress,
|
|
337
|
-
module: 'vault',
|
|
338
|
-
function: 'id',
|
|
339
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
340
|
-
typeArguments: options.typeArguments
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
317
|
export interface VaultIdArguments {
|
|
344
318
|
self: RawTransactionArgument<string>;
|
|
345
319
|
}
|
package/src/contracts.ts
CHANGED
|
@@ -34,7 +34,6 @@ export * as releaseDspLink from "./contracts/release_dsp_link/release_dsp_link.t
|
|
|
34
34
|
export * as releaseGenre from "./contracts/release_genre/release_genre.ts";
|
|
35
35
|
export * as releaseKind from "./contracts/release_kind/release_kind.ts";
|
|
36
36
|
export * as releaseRevenueDistributor from "./contracts/release_revenue_distributor/release_revenue_distributor.ts";
|
|
37
|
-
export * as releaseSnapshotBundle from "./contracts/release_snapshot_bundle/release_snapshot_bundle.ts";
|
|
38
37
|
export * as recordingAdvisory from "./contracts/recording_advisory/recording_advisory.ts";
|
|
39
38
|
export * as recordingLanguage from "./contracts/recording_language/recording_language.ts";
|
|
40
39
|
export * as recordingMasterReference from "./contracts/recording_master_reference/recording_master_reference.ts";
|
package/src/cover.ts
CHANGED
|
@@ -162,7 +162,7 @@ function toCoverImageRef(wd: ParsedWalrusData): CoverImageRef {
|
|
|
162
162
|
* Reads a release's album-level cover (the `release_cover_art` extension), or
|
|
163
163
|
* `null` if no cover is attached. Derives the `ExtensionKey` dynamic field on the
|
|
164
164
|
* release, parses the `ReleaseCoverArt`, and returns the still (+ optional
|
|
165
|
-
* animation) as normalized Walrus refs for
|
|
165
|
+
* animation) as normalized Walrus refs for release displays.
|
|
166
166
|
*/
|
|
167
167
|
export async function getReleaseCover(
|
|
168
168
|
client: ClientWithCoreApi,
|
package/src/deployments.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
|
+
MisoDeployment,
|
|
5
6
|
MisoNetwork,
|
|
6
|
-
MisoProtocolDeployment,
|
|
7
7
|
} from "@misonetwork/sdk/deployments";
|
|
8
8
|
|
|
9
9
|
/** Complete on-chain identity used by the Miso platform SDK on one network. */
|
|
10
10
|
export interface MisoPlatformDeployment {
|
|
11
|
-
/** The protocol deployment this platform
|
|
12
|
-
readonly protocol:
|
|
11
|
+
/** The complete protocol and Party deployment this platform build targets. */
|
|
12
|
+
readonly protocol: MisoDeployment;
|
|
13
13
|
readonly packages: {
|
|
14
14
|
readonly pressing: string;
|
|
15
15
|
readonly record: string;
|
|
@@ -41,7 +41,6 @@ export interface MisoPlatformDeployment {
|
|
|
41
41
|
readonly releaseKind: string;
|
|
42
42
|
/** Vault plugin that routes Release revenue into Recording addresses. */
|
|
43
43
|
readonly releaseRevenueDistributorPlugin: string;
|
|
44
|
-
readonly releaseSnapshotBundle: string;
|
|
45
44
|
readonly recordingAdvisory: string;
|
|
46
45
|
readonly recordingLanguage: string;
|
|
47
46
|
readonly recordingMasterReference: string;
|
|
@@ -50,29 +49,10 @@ export interface MisoPlatformDeployment {
|
|
|
50
49
|
readonly ori: string;
|
|
51
50
|
};
|
|
52
51
|
readonly objects: {
|
|
53
|
-
readonly recordSettings: string;
|
|
54
52
|
readonly releaseRegistry: string;
|
|
55
53
|
/** Shared parent used to derive canonical Genre object ids. */
|
|
56
54
|
readonly genreRegistry: string;
|
|
57
55
|
};
|
|
58
|
-
/** PartyOS packages used by the composed artist and wallet reads. */
|
|
59
|
-
readonly party: {
|
|
60
|
-
readonly partyPackageId: string;
|
|
61
|
-
readonly partyProfilePackageId: string;
|
|
62
|
-
readonly countryCodePackageId: string;
|
|
63
|
-
readonly languageCodePackageId: string;
|
|
64
|
-
readonly partyMediaPackageId: string;
|
|
65
|
-
readonly partyRolesPackageId: string;
|
|
66
|
-
readonly partyTagsPackageId: string;
|
|
67
|
-
readonly partyGenrePackageId: string;
|
|
68
|
-
readonly partyCtaPackageId: string;
|
|
69
|
-
readonly partyPlatformLinkPackageId: string;
|
|
70
|
-
readonly partySocialPackageId: string;
|
|
71
|
-
readonly partyMusicPackageId: string;
|
|
72
|
-
readonly partyProLinkPackageId: string;
|
|
73
|
-
readonly partyFeaturedDropPackageId: string;
|
|
74
|
-
readonly genrePackageId: string;
|
|
75
|
-
};
|
|
76
56
|
readonly legacy: {
|
|
77
57
|
readonly releaseCoverArtPackages: readonly string[];
|
|
78
58
|
};
|
package/src/pressing.ts
CHANGED
|
@@ -365,9 +365,6 @@ export interface BuyRecordParams {
|
|
|
365
365
|
amount: U64Input;
|
|
366
366
|
/** The listing's `Currency` type, e.g. `0x2::sui::SUI`. */
|
|
367
367
|
currencyType: string;
|
|
368
|
-
/** The `miso_record` `Settings` shared object — it must authorize `miso_pressing`'s
|
|
369
|
-
* `MintWitness`, or the mint aborts. */
|
|
370
|
-
settingsId: string;
|
|
371
368
|
/** Where to send the pressed `Record` (usually the buyer). */
|
|
372
369
|
recipient: string;
|
|
373
370
|
misoPressingPackageId: string;
|
|
@@ -412,7 +409,7 @@ export function buyRecord(p: BuyRecordParams): TxThunk {
|
|
|
412
409
|
const record = tx.add(
|
|
413
410
|
listing.buy({
|
|
414
411
|
package: pkg,
|
|
415
|
-
arguments: [listingId, pressingId, payment
|
|
412
|
+
arguments: [listingId, pressingId, payment],
|
|
416
413
|
typeArguments: [p.currencyType],
|
|
417
414
|
}),
|
|
418
415
|
);
|
package/src/read/artist.ts
CHANGED
|
@@ -4,26 +4,22 @@
|
|
|
4
4
|
// Artist reads: a `Party` plus every extension attached to its UID.
|
|
5
5
|
//
|
|
6
6
|
// The artist page is the clearest case for this whole layer. Its data lives in
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// `PartyEditSheet`). Here they are one call, resolved once, cached once.
|
|
7
|
+
// separate dynamic fields, each its own package and read — party, profile, ctas,
|
|
8
|
+
// genres, links, roles, and tags. Here they are one call, resolved once, cached
|
|
9
|
+
// once.
|
|
11
10
|
//
|
|
12
|
-
// `roles
|
|
11
|
+
// `roles` and `tags` are opt-in via `include`.
|
|
13
12
|
|
|
14
13
|
import { resolveGenreNames } from "./genres.ts";
|
|
15
|
-
import { getReleaseResources } from "./catalog.ts";
|
|
16
|
-
import { getPressing } from "../pressing.ts";
|
|
17
14
|
import type { MisoClient } from "./client.ts";
|
|
18
15
|
import type {
|
|
19
16
|
ArtistProfile,
|
|
20
|
-
FeaturedRelease,
|
|
21
17
|
PartyMember,
|
|
22
18
|
PartySummary,
|
|
23
19
|
} from "./types.ts";
|
|
24
20
|
|
|
25
21
|
/** Optional sub-resources — read only when asked for. */
|
|
26
|
-
export type ArtistInclude = "roles" | "tags"
|
|
22
|
+
export type ArtistInclude = "roles" | "tags";
|
|
27
23
|
|
|
28
24
|
export interface GetArtistOptions {
|
|
29
25
|
include?: readonly ArtistInclude[];
|
|
@@ -45,7 +41,7 @@ export async function getArtistProfile(
|
|
|
45
41
|
options: GetArtistOptions = {},
|
|
46
42
|
): Promise<ArtistProfile> {
|
|
47
43
|
const include = new Set(options.include ?? []);
|
|
48
|
-
const { party } = client.sui;
|
|
44
|
+
const { party } = client.sui.miso;
|
|
49
45
|
|
|
50
46
|
const [profile, ctas, genreIds, links, roles, tags, entity] =
|
|
51
47
|
await Promise.all([
|
|
@@ -62,15 +58,12 @@ export async function getArtistProfile(
|
|
|
62
58
|
party.getPartyById(partyId),
|
|
63
59
|
]);
|
|
64
60
|
|
|
65
|
-
const [genres, members
|
|
61
|
+
const [genres, members] = await Promise.all([
|
|
66
62
|
resolveGenreNames(client, genreIds),
|
|
67
63
|
resolveMembers(
|
|
68
64
|
client,
|
|
69
65
|
entity.kind === "group" ? (entity.members ?? []) : [],
|
|
70
66
|
),
|
|
71
|
-
include.has("featured")
|
|
72
|
-
? resolveFeaturedRelease(client, partyId, entity.name).catch(() => null)
|
|
73
|
-
: Promise.resolve(undefined),
|
|
74
67
|
]);
|
|
75
68
|
|
|
76
69
|
return {
|
|
@@ -92,7 +85,6 @@ export async function getArtistProfile(
|
|
|
92
85
|
members,
|
|
93
86
|
...(roles !== undefined ? { roles } : {}),
|
|
94
87
|
...(tags !== undefined ? { tags } : {}),
|
|
95
|
-
...(featured !== undefined ? { featured } : {}),
|
|
96
88
|
avatarUrl: partyAvatarUrl(client.config.apiBaseUrl, entity.id),
|
|
97
89
|
};
|
|
98
90
|
}
|
|
@@ -103,7 +95,7 @@ async function resolveMembers(
|
|
|
103
95
|
memberIds: readonly string[],
|
|
104
96
|
): Promise<PartyMember[]> {
|
|
105
97
|
if (memberIds.length === 0) return [];
|
|
106
|
-
const parties = await client.sui.party
|
|
98
|
+
const parties = await client.sui.miso.party
|
|
107
99
|
.getPartiesByIds([...memberIds])
|
|
108
100
|
.catch(() => ({}) as Record<string, undefined>);
|
|
109
101
|
return memberIds.flatMap((id) => {
|
|
@@ -118,58 +110,9 @@ export async function getPartySummaries(
|
|
|
118
110
|
ids: readonly string[],
|
|
119
111
|
): Promise<PartySummary[]> {
|
|
120
112
|
if (ids.length === 0) return [];
|
|
121
|
-
const parties = await client.sui.party.getPartiesByIds([...ids]);
|
|
113
|
+
const parties = await client.sui.miso.party.getPartiesByIds([...ids]);
|
|
122
114
|
return ids.flatMap((id) => {
|
|
123
115
|
const p = parties[id];
|
|
124
116
|
return p ? [{ id, name: p.name, kind: p.kind }] : [];
|
|
125
117
|
});
|
|
126
118
|
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* The party's pinned pressing, resolved through to its release and cover.
|
|
130
|
-
* `null` — a successful empty — when nothing is pinned or the pin is dangling
|
|
131
|
-
* (the pressing id was invalid or was never opened).
|
|
132
|
-
*/
|
|
133
|
-
async function resolveFeaturedRelease(
|
|
134
|
-
client: MisoClient,
|
|
135
|
-
partyId: string,
|
|
136
|
-
fallbackArtist?: string,
|
|
137
|
-
): Promise<FeaturedRelease | null> {
|
|
138
|
-
const pressingId = await client.sui.party.getFeaturedDrop(partyId);
|
|
139
|
-
if (!pressingId) return null;
|
|
140
|
-
|
|
141
|
-
const pressing = await getPressing(client.protocol, pressingId, client.config.protocol.pressing);
|
|
142
|
-
if (!pressing) return null;
|
|
143
|
-
|
|
144
|
-
const [resources, entity] = await Promise.all([
|
|
145
|
-
getReleaseResources(client, pressing.releaseId, ["cover", "credits"]),
|
|
146
|
-
fallbackArtist === undefined
|
|
147
|
-
? client.sui.party.getPartyById(partyId)
|
|
148
|
-
: Promise.resolve(null),
|
|
149
|
-
]);
|
|
150
|
-
const { release, cover, credits } = resources;
|
|
151
|
-
|
|
152
|
-
// The artist line prefers the release's own PRIMARY credits and falls back to
|
|
153
|
-
// the party whose page this is — a release with no credits set still shows an
|
|
154
|
-
// artist, which is the behavior the featured card has always had.
|
|
155
|
-
const primary = (credits ?? [])
|
|
156
|
-
.filter((c) => c.roles.includes("Primary"))
|
|
157
|
-
.map((c) => c.displayName);
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
pressingId,
|
|
161
|
-
releaseId: pressing.releaseId,
|
|
162
|
-
title: release.title,
|
|
163
|
-
artist: primary.length
|
|
164
|
-
? primary.join(", ")
|
|
165
|
-
: (fallbackArtist ?? entity?.name ?? ""),
|
|
166
|
-
coverUrl: cover?.still.url ?? null,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export async function getFeaturedRelease(
|
|
171
|
-
client: MisoClient,
|
|
172
|
-
partyId: string,
|
|
173
|
-
): Promise<FeaturedRelease | null> {
|
|
174
|
-
return resolveFeaturedRelease(client, partyId);
|
|
175
|
-
}
|
package/src/read/catalog.ts
CHANGED
|
@@ -317,7 +317,7 @@ export async function getReleaseDetail(
|
|
|
317
317
|
client.protocol,
|
|
318
318
|
client.graphql,
|
|
319
319
|
recordingIds,
|
|
320
|
-
client.config.
|
|
320
|
+
client.config.deployment.miso,
|
|
321
321
|
),
|
|
322
322
|
options.include?.includes("trackCredits")
|
|
323
323
|
? getTrackCreditsForRecordingIds(client, recordingIds)
|
|
@@ -345,13 +345,13 @@ async function getTrackCreditsForRecordingIds(
|
|
|
345
345
|
client: MisoClient,
|
|
346
346
|
recordingIds: readonly string[],
|
|
347
347
|
): Promise<Record<string, TrackCredits>> {
|
|
348
|
-
const { compositionCredits, recordingCredits
|
|
348
|
+
const { compositionCredits, recordingCredits } = client.config.protocol;
|
|
349
349
|
const tracks = await getTrackCreditsByRecordingIds(
|
|
350
350
|
client.protocol,
|
|
351
351
|
client.graphql,
|
|
352
352
|
recordingIds,
|
|
353
353
|
{
|
|
354
|
-
misoPackageId: miso,
|
|
354
|
+
misoPackageId: client.config.deployment.miso,
|
|
355
355
|
compositionCreditsPackageId: compositionCredits,
|
|
356
356
|
recordingCreditsPackageId: recordingCredits,
|
|
357
357
|
},
|
package/src/read/client.ts
CHANGED
|
@@ -13,18 +13,12 @@
|
|
|
13
13
|
// It also carries the resolved `MisoConfig`, so a read function takes ONE argument
|
|
14
14
|
// and never has a package id threaded through its signature.
|
|
15
15
|
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// @mysten/sui. Those copies are structurally identical but nominally distinct
|
|
19
|
-
// (private class fields), so TypeScript refuses the assignment even though the
|
|
20
|
-
// runtime object is the same one. miso-app solved this with a cast at each call
|
|
21
|
-
// site (`lib/pressing.ts:25`, `lib/party.ts:55`); here it happens ONCE, and
|
|
22
|
-
// nothing downstream of this file casts anything.
|
|
16
|
+
// Party now shares the same network SDK registration and deployment as protocol
|
|
17
|
+
// core, so every read hangs off one `sui.miso` namespace.
|
|
23
18
|
|
|
24
19
|
import { SuiGrpcClient } from "@mysten/sui/grpc";
|
|
25
20
|
import { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
26
|
-
import type
|
|
27
|
-
import { party, type PartyClient } from "@misonetwork/miso-party/client";
|
|
21
|
+
import { miso, type MisoProtocolClient } from "@misonetwork/sdk/client";
|
|
28
22
|
import { misoConfig, networkFrom, type MisoConfig, type MisoConfigOverrides, type Network } from "./config.ts";
|
|
29
23
|
|
|
30
24
|
function definedOverrides<T extends object>(value: T): Partial<T> {
|
|
@@ -44,8 +38,8 @@ export type ProtocolGraphQLClient = SuiGraphQLClient;
|
|
|
44
38
|
|
|
45
39
|
export interface MisoClient {
|
|
46
40
|
config: MisoConfig;
|
|
47
|
-
/** gRPC data plane,
|
|
48
|
-
sui: SuiGrpcClient & {
|
|
41
|
+
/** gRPC data plane, including Party at `sui.miso.party`. */
|
|
42
|
+
sui: SuiGrpcClient & { miso: MisoProtocolClient };
|
|
49
43
|
/** The same client, typed for the protocol SDK's read helpers. */
|
|
50
44
|
protocol: ProtocolClient;
|
|
51
45
|
/** GraphQL RPC, typed for the protocol SDK's type-discovery queries. */
|
|
@@ -82,8 +76,7 @@ export function createMisoClient(options: CreateMisoClientOptions = {}): MisoCli
|
|
|
82
76
|
const grpc = new SuiGrpcClient({ baseUrl: config.grpcUrl, network: config.network });
|
|
83
77
|
const graphqlRaw = new SuiGraphQLClient({ url: config.graphqlUrl, network: config.network });
|
|
84
78
|
|
|
85
|
-
const
|
|
86
|
-
const sui = grpc.$extend(registration);
|
|
79
|
+
const sui = grpc.$extend(miso({ deployment: config.deployment }));
|
|
87
80
|
|
|
88
81
|
return {
|
|
89
82
|
config,
|
package/src/read/config.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// republished. A read client must receive a complete verified configuration from
|
|
12
12
|
// its caller; silently retaining the old ABI would be unsafe.
|
|
13
13
|
|
|
14
|
+
import type { MisoDeployment } from "@misonetwork/sdk/deployments";
|
|
15
|
+
|
|
14
16
|
export type Network = "testnet" | "mainnet";
|
|
15
17
|
|
|
16
18
|
/** Missing defaults to Testnet for local development; invalid values fail closed. */
|
|
@@ -22,14 +24,10 @@ export function networkFrom(value: string | undefined): Network {
|
|
|
22
24
|
|
|
23
25
|
/** Package ids for the miso protocol core and the extensions the read layer touches. */
|
|
24
26
|
export interface ProtocolIds {
|
|
25
|
-
/** `miso` core — Composition / Recording / Release, and the origin of every derived admin cap. */
|
|
26
|
-
miso: string;
|
|
27
27
|
/** `miso_pressing` — permanent Pressing runs and per-currency Listings. */
|
|
28
28
|
pressing: string;
|
|
29
29
|
/** `miso_record` package — the exact owner/type namespace for `record::Record`. */
|
|
30
30
|
record: string;
|
|
31
|
-
/** `miso_record` shared `Settings` object — the mint witness authorizer. */
|
|
32
|
-
recordSettings: string;
|
|
33
31
|
/** `release_cover_art` — the release cover extension. */
|
|
34
32
|
releaseCoverArt: string;
|
|
35
33
|
/** `composition_credits` / `recording_credits` / `release_credits` extensions. */
|
|
@@ -40,25 +38,6 @@ export interface ProtocolIds {
|
|
|
40
38
|
credit: string;
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
/** Package ids for PartyOS core and every party extension the artist page reads. */
|
|
44
|
-
export interface PartyIds {
|
|
45
|
-
partyPackageId: string;
|
|
46
|
-
partyProfilePackageId: string;
|
|
47
|
-
countryCodePackageId: string;
|
|
48
|
-
languageCodePackageId: string;
|
|
49
|
-
partyMediaPackageId: string;
|
|
50
|
-
partyRolesPackageId: string;
|
|
51
|
-
partyTagsPackageId: string;
|
|
52
|
-
partyGenrePackageId: string;
|
|
53
|
-
partyCtaPackageId: string;
|
|
54
|
-
partyPlatformLinkPackageId: string;
|
|
55
|
-
partySocialPackageId: string;
|
|
56
|
-
partyMusicPackageId: string;
|
|
57
|
-
partyProLinkPackageId: string;
|
|
58
|
-
partyFeaturedDropPackageId: string;
|
|
59
|
-
genrePackageId: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
41
|
/** The currency the app prices records in, and where test dollars come from. */
|
|
63
42
|
export interface MoneyIds {
|
|
64
43
|
/** Coin type balances, listings, and purchases are denominated in. */
|
|
@@ -68,8 +47,9 @@ export interface MoneyIds {
|
|
|
68
47
|
|
|
69
48
|
export interface MisoConfig {
|
|
70
49
|
network: Network;
|
|
50
|
+
/** Complete package set used by the integrated `client.miso` SDK. */
|
|
51
|
+
deployment: MisoDeployment;
|
|
71
52
|
protocol: ProtocolIds;
|
|
72
|
-
party: PartyIds;
|
|
73
53
|
money: MoneyIds;
|
|
74
54
|
/** Sui gRPC-web endpoint the data plane reads through. */
|
|
75
55
|
grpcUrl: string;
|
package/src/read/index.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
//
|
|
6
6
|
// One place that knows how to turn Sui objects into the things Miso talks about:
|
|
7
7
|
// a pressing, a release, an artist, a library, a receipt. It composes
|
|
8
|
-
// @misonetwork/
|
|
9
|
-
//
|
|
8
|
+
// @misonetwork/sdk, owns the per-network id manifest, and returns view types that
|
|
9
|
+
// survive JSON.
|
|
10
10
|
//
|
|
11
11
|
// Browser- and server-compatible. The HTTP API is a thin cached transport over
|
|
12
12
|
// this same surface; direct clients can use it without going through the API.
|
|
@@ -24,7 +24,6 @@ export type {
|
|
|
24
24
|
DiscoverSale,
|
|
25
25
|
MoneyIds,
|
|
26
26
|
Network,
|
|
27
|
-
PartyIds,
|
|
28
27
|
ProtocolIds,
|
|
29
28
|
} from "./config.ts";
|
|
30
29
|
|
|
@@ -52,7 +51,6 @@ export type { ReleaseResources } from "./catalog.ts";
|
|
|
52
51
|
|
|
53
52
|
export {
|
|
54
53
|
getArtistProfile,
|
|
55
|
-
getFeaturedRelease,
|
|
56
54
|
getPartySummaries,
|
|
57
55
|
partyAvatarUrl,
|
|
58
56
|
} from "./artist.ts";
|
package/src/read/receipts.ts
CHANGED
|
@@ -268,7 +268,7 @@ async function compositionRatesByRecording(client: MisoClient, recordingIds: str
|
|
|
268
268
|
const addresses = await getWorkAddressesByShareTypes(
|
|
269
269
|
client.graphql,
|
|
270
270
|
{ compositions: shareTypes, recordings: [] },
|
|
271
|
-
client.config.
|
|
271
|
+
client.config.deployment.miso,
|
|
272
272
|
);
|
|
273
273
|
const compositionIds = Object.values(addresses.compositions).filter((id): id is string => !!id);
|
|
274
274
|
const compositions = await getCompositionsByIds(client.protocol, compositionIds);
|
package/src/read/types.ts
CHANGED
|
@@ -261,22 +261,10 @@ export interface ArtistProfile {
|
|
|
261
261
|
/** Present only when requested via `include` — the owner-editor fields. */
|
|
262
262
|
roles?: string[];
|
|
263
263
|
tags?: string[];
|
|
264
|
-
/** Present only when requested via `include`; null means nothing is pinned. */
|
|
265
|
-
featured?: FeaturedRelease | null;
|
|
266
264
|
/** Public avatar URL (miso-api R2 lane; may 404 when unset). */
|
|
267
265
|
avatarUrl: string;
|
|
268
266
|
}
|
|
269
267
|
|
|
270
|
-
/** A party's pinned Pressing, fully resolved. Null when nothing is pinned. */
|
|
271
|
-
export interface FeaturedRelease {
|
|
272
|
-
pressingId: string;
|
|
273
|
-
releaseId: string;
|
|
274
|
-
title: string;
|
|
275
|
-
/** The party whose page this is — shown as the release's artist. */
|
|
276
|
-
artist: string;
|
|
277
|
-
coverUrl: string | null;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
268
|
/** The minimal party projection used for lists (`?ids=`). */
|
|
281
269
|
export interface PartySummary {
|
|
282
270
|
id: string;
|
package/src/read/wallet.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
// than be reimplemented by every browser, Worker, server, or native client.
|
|
12
12
|
|
|
13
13
|
import { normalizeSuiAddress } from "@mysten/sui/utils";
|
|
14
|
-
import { contracts as partyContracts } from "@misonetwork/miso-party";
|
|
15
14
|
import {
|
|
15
|
+
contracts as networkContracts,
|
|
16
16
|
getCompositionByShareType,
|
|
17
17
|
getOwnedReleaseAdminCaps,
|
|
18
18
|
getRecordingByShareType,
|
|
@@ -110,7 +110,7 @@ export async function getOwnedRecords(client: MisoClient, owner: string): Promis
|
|
|
110
110
|
* authoritative in a way that remembering created parties client-side is not.
|
|
111
111
|
*/
|
|
112
112
|
export async function getOwnedParties(client: MisoClient, owner: string): Promise<OwnedParty[]> {
|
|
113
|
-
const capType = `${client.config.
|
|
113
|
+
const capType = `${client.config.deployment.misoParty}::party::PartyAdminCap`;
|
|
114
114
|
|
|
115
115
|
// One page of 50 caps is plenty for launch-scale artists; paginate if labels
|
|
116
116
|
// ever start hitting the cap.
|
|
@@ -123,7 +123,7 @@ export async function getOwnedParties(client: MisoClient, owner: string): Promis
|
|
|
123
123
|
|
|
124
124
|
const caps = objects.flatMap((obj) => {
|
|
125
125
|
try {
|
|
126
|
-
const cap =
|
|
126
|
+
const cap = networkContracts.party.PartyAdminCap.parse(obj.content);
|
|
127
127
|
return [{ capId: obj.objectId, partyId: cap.party_id }];
|
|
128
128
|
} catch {
|
|
129
129
|
return [];
|
|
@@ -131,7 +131,7 @@ export async function getOwnedParties(client: MisoClient, owner: string): Promis
|
|
|
131
131
|
});
|
|
132
132
|
if (caps.length === 0) return [];
|
|
133
133
|
|
|
134
|
-
const parties = await client.sui.party.getPartiesByIds(caps.map((c) => c.partyId));
|
|
134
|
+
const parties = await client.sui.miso.party.getPartiesByIds(caps.map((c) => c.partyId));
|
|
135
135
|
return caps.flatMap(({ capId, partyId }) => {
|
|
136
136
|
const p = parties[partyId];
|
|
137
137
|
return p ? [{ partyId, capId, name: p.name, kind: p.kind }] : [];
|
|
@@ -157,13 +157,13 @@ export async function getPendingMemberships(
|
|
|
157
157
|
const invitations = await Promise.all(
|
|
158
158
|
individuals.map(async (member) => ({
|
|
159
159
|
member,
|
|
160
|
-
groupIds: await client.sui.party.getPendingMemberships(member.partyId),
|
|
160
|
+
groupIds: await client.sui.miso.party.getPendingMemberships(member.partyId),
|
|
161
161
|
})),
|
|
162
162
|
);
|
|
163
163
|
const groupIds = [...new Set(invitations.flatMap(({ groupIds }) => groupIds))];
|
|
164
164
|
if (groupIds.length === 0) return [];
|
|
165
165
|
|
|
166
|
-
const groups = await client.sui.party.getPartiesByIds(groupIds);
|
|
166
|
+
const groups = await client.sui.miso.party.getPartiesByIds(groupIds);
|
|
167
167
|
return invitations.flatMap(({ member, groupIds }) =>
|
|
168
168
|
groupIds.flatMap((groupId): PendingMembership[] => {
|
|
169
169
|
const group = groups[groupId];
|
|
@@ -203,7 +203,7 @@ async function ownedGenericCaps(client: MisoClient, owner: string, capType: stri
|
|
|
203
203
|
* `release_id` directly.
|
|
204
204
|
*/
|
|
205
205
|
export async function getOwnedWorks(client: MisoClient, owner: string): Promise<OwnedWork[]> {
|
|
206
|
-
const miso = client.config.
|
|
206
|
+
const miso = client.config.deployment.miso;
|
|
207
207
|
|
|
208
208
|
const [compCaps, recCaps, relCaps] = await Promise.all([
|
|
209
209
|
ownedGenericCaps(client, owner, `${miso}::composition::CompositionAdminCap`),
|
|
@@ -257,7 +257,7 @@ export async function getOwnedWorks(client: MisoClient, owner: string): Promise<
|
|
|
257
257
|
|
|
258
258
|
/** Classify a cap by its on-chain type, then resolve the work behind it. */
|
|
259
259
|
export async function getWorkByCap(client: MisoClient, capId: string): Promise<WorkDetail | null> {
|
|
260
|
-
const miso = client.config.
|
|
260
|
+
const miso = client.config.deployment.miso;
|
|
261
261
|
|
|
262
262
|
let type: string;
|
|
263
263
|
let json: Record<string, unknown> | null;
|
|
@@ -355,7 +355,7 @@ function isAddressOwner(owner: unknown, address: string): boolean {
|
|
|
355
355
|
* stays hidden rather than being offered and then rejected on submit.
|
|
356
356
|
*/
|
|
357
357
|
export async function ownsParty(client: MisoClient, address: string, partyId: string): Promise<Ownership> {
|
|
358
|
-
const capId = client.sui.party.derivePartyAdminCapId(partyId);
|
|
358
|
+
const capId = client.sui.miso.party.derivePartyAdminCapId(partyId);
|
|
359
359
|
const isOwner = await client.protocol.core
|
|
360
360
|
.getObject({ objectId: capId })
|
|
361
361
|
.then(({ object }) => isAddressOwner(object?.owner, address))
|