@misofm/sdk 0.11.0 → 0.12.1
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 +18 -37
- package/dist/client.d.ts +13 -16
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +21 -22
- 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/party_wallet/party_wallet.d.ts +214 -0
- package/dist/contracts/party_wallet/party_wallet.d.ts.map +1 -0
- package/dist/contracts/party_wallet/party_wallet.js +214 -0
- package/dist/contracts/party_wallet/party_wallet.js.map +1 -0
- package/dist/contracts/party_wallet/witness.d.ts +6 -0
- package/dist/contracts/party_wallet/witness.d.ts.map +1 -0
- package/dist/contracts/party_wallet/witness.js +8 -0
- package/dist/contracts/party_wallet/witness.js.map +1 -0
- 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 +6 -13
- package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/stake.js +6 -14
- package/dist/contracts/royalty_pool/stake.js.map +1 -1
- package/dist/contracts/vault/vault.d.ts +2 -14
- package/dist/contracts/vault/vault.d.ts.map +1 -1
- package/dist/contracts/vault/vault.js +2 -15
- package/dist/contracts/vault/vault.js.map +1 -1
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +1 -0
- 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 +84 -27
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +46 -5
- 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 -2
- package/dist/release-extensions.d.ts.map +1 -1
- package/dist/release-extensions.js +6 -4
- 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 +7 -13
- package/src/client.ts +31 -31
- 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/party_wallet/party_wallet.ts +350 -0
- package/src/contracts/party_wallet/witness.ts +7 -0
- 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 +8 -28
- package/src/contracts/vault/vault.ts +2 -27
- package/src/contracts.ts +1 -0
- package/src/cover.ts +1 -1
- package/src/deployments.ts +55 -27
- 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 -4
- package/src/release-graph.ts +7 -1
- package/src/vault.ts +2 -1
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))
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// intent aggregates these concerns, but every value is written by its own
|
|
6
6
|
// independently deployed extension package.
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { deriveObjectID } from "@mysten/sui/utils";
|
|
9
9
|
import type {
|
|
10
10
|
Transaction,
|
|
11
11
|
TransactionArgument,
|
|
@@ -91,14 +91,16 @@ export function assertCanonicalGenreName(name: string): void {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
/** Derive the immutable Genre object
|
|
95
|
-
|
|
94
|
+
/** Derive the immutable Genre object address for a canonical vocabulary name.
|
|
95
|
+
* `genrePackageId` must be the genre package's defining (original publish)
|
|
96
|
+
* address — the on-chain derivation hashes type names with defining IDs. */
|
|
97
|
+
export function deriveGenreAddress(
|
|
96
98
|
genreRegistryId: string,
|
|
97
99
|
genrePackageId: string,
|
|
98
100
|
canonicalName: string,
|
|
99
101
|
): string {
|
|
100
102
|
assertCanonicalGenreName(canonicalName);
|
|
101
|
-
return
|
|
103
|
+
return deriveObjectID(
|
|
102
104
|
genreRegistryId,
|
|
103
105
|
`${genrePackageId}::genre::GenreKey`,
|
|
104
106
|
genre.GenreKey.serialize([canonicalName]).toBytes(),
|
package/src/release-graph.ts
CHANGED
|
@@ -157,7 +157,13 @@ export function publishReleaseGraph(params: PublishReleaseGraphParams): (tx: Tra
|
|
|
157
157
|
type: "0x2::object::ID",
|
|
158
158
|
elements: ordered.map((t) =>
|
|
159
159
|
isFresh(t)
|
|
160
|
-
? tx.
|
|
160
|
+
? tx.moveCall({
|
|
161
|
+
target: "0x2::object::id",
|
|
162
|
+
typeArguments: [
|
|
163
|
+
`${pkg}::recording::Recording<${recTypeArgs(t.recordingIndex).join(",")}>`,
|
|
164
|
+
],
|
|
165
|
+
arguments: [requiredAt(recs, t.recordingIndex, "fresh recording").work],
|
|
166
|
+
})
|
|
161
167
|
: tx.pure.id(t.recordingId),
|
|
162
168
|
),
|
|
163
169
|
});
|
package/src/vault.ts
CHANGED
|
@@ -597,7 +597,7 @@ export function registerCompositionRoutedStake(
|
|
|
597
597
|
/** Unregister a routed stake after pending rewards have been swept. */
|
|
598
598
|
export function unregisterCompositionRoutedStake(
|
|
599
599
|
tx: Transaction,
|
|
600
|
-
params:
|
|
600
|
+
params: ManageCompositionRoutedStakeParams,
|
|
601
601
|
): void {
|
|
602
602
|
tx.add(
|
|
603
603
|
compositionRoutedStake.unregister({
|
|
@@ -610,6 +610,7 @@ export function unregisterCompositionRoutedStake(
|
|
|
610
610
|
arguments: [
|
|
611
611
|
params.vault,
|
|
612
612
|
params.composition,
|
|
613
|
+
params.recording,
|
|
613
614
|
params.routedStake,
|
|
614
615
|
params.royaltyPool,
|
|
615
616
|
params.vaultAdminCap,
|