@misofm/sdk 0.2.0 → 0.3.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 +37 -5
- package/dist/catalog.d.ts +30 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +60 -1
- package/dist/catalog.js.map +1 -1
- package/dist/contracts/miso_drop/drop.d.ts +550 -0
- package/dist/contracts/miso_drop/drop.d.ts.map +1 -0
- package/dist/contracts/miso_drop/drop.js +523 -0
- package/dist/contracts/miso_drop/drop.js.map +1 -0
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +3 -0
- package/dist/contracts.js.map +1 -1
- package/dist/credits.d.ts.map +1 -1
- package/dist/credits.js +4 -2
- package/dist/credits.js.map +1 -1
- package/dist/drop.d.ts +120 -0
- package/dist/drop.d.ts.map +1 -0
- package/dist/drop.js +152 -0
- package/dist/drop.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/read/artist.d.ts +24 -0
- package/dist/read/artist.d.ts.map +1 -0
- package/dist/read/artist.js +114 -0
- package/dist/read/artist.js.map +1 -0
- package/dist/read/catalog.d.ts +63 -0
- package/dist/read/catalog.d.ts.map +1 -0
- package/dist/read/catalog.js +252 -0
- package/dist/read/catalog.js.map +1 -0
- package/dist/read/client.d.ts +36 -0
- package/dist/read/client.d.ts.map +1 -0
- package/dist/read/client.js +46 -0
- package/dist/read/client.js.map +1 -0
- package/dist/read/config.d.ts +83 -0
- package/dist/read/config.d.ts.map +1 -0
- package/dist/read/config.js +76 -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 +12 -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 +56 -0
- package/dist/read/internal/scalars.js.map +1 -0
- package/dist/read/internal/walrus.d.ts +4 -0
- package/dist/read/internal/walrus.d.ts.map +1 -0
- package/dist/read/internal/walrus.js +23 -0
- package/dist/read/internal/walrus.js.map +1 -0
- package/dist/read/receipts.d.ts +22 -0
- package/dist/read/receipts.d.ts.map +1 -0
- package/dist/read/receipts.js +233 -0
- package/dist/read/receipts.js.map +1 -0
- package/dist/read/types.d.ts +279 -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 +58 -0
- package/dist/read/wallet.d.ts.map +1 -0
- package/dist/read/wallet.js +325 -0
- package/dist/read/wallet.js.map +1 -0
- package/dist/read/works.d.ts +31 -0
- package/dist/read/works.d.ts.map +1 -0
- package/dist/read/works.js +106 -0
- package/dist/read/works.js.map +1 -0
- package/package.json +16 -3
- package/src/catalog.ts +118 -0
- package/src/contracts/miso_drop/drop.ts +798 -0
- package/src/contracts.ts +4 -0
- package/src/credits.ts +26 -12
- package/src/drop.ts +266 -0
- package/src/index.ts +5 -0
- package/src/read/artist.ts +136 -0
- package/src/read/catalog.ts +293 -0
- package/src/read/client.ts +79 -0
- package/src/read/config.ts +164 -0
- package/src/read/genres.ts +37 -0
- package/src/read/index.ts +53 -0
- package/src/read/internal/scalars.ts +57 -0
- package/src/read/internal/walrus.ts +32 -0
- package/src/read/receipts.ts +266 -0
- package/src/read/types.ts +361 -0
- package/src/read/wallet.ts +360 -0
- package/src/read/works.ts +164 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// The view types every Miso read returns.
|
|
5
|
+
//
|
|
6
|
+
// ONE RULE GOVERNS THIS FILE: these shapes must survive `JSON.stringify`.
|
|
7
|
+
//
|
|
8
|
+
// The protocol SDK hands back `bigint` for every u64/u128 (`DropView.price.amount`,
|
|
9
|
+
// `quantitySold`, timestamps, balances). `JSON.stringify` THROWS on a bigint, so a
|
|
10
|
+
// view type that carries one cannot cross an HTTP boundary — it would work in the
|
|
11
|
+
// browser-direct world these shapes came from and fail the moment an API serves
|
|
12
|
+
// them. Every such field is therefore a DECIMAL STRING here, converted once at the
|
|
13
|
+
// SDK edge (`u64()` in ./internal/scalars.ts). Consumers that need arithmetic
|
|
14
|
+
// re-widen with `BigInt(...)`; consumers that only display it already have the
|
|
15
|
+
// string they wanted.
|
|
16
|
+
//
|
|
17
|
+
// Timestamps are the exception worth naming: `*AtMs` fields are `number`, not
|
|
18
|
+
// string, because they are milliseconds — comfortably inside Number.MAX_SAFE_INTEGER
|
|
19
|
+
// and immediately useful to `new Date()`.
|
|
20
|
+
|
|
21
|
+
// ── Catalog ──────────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
/** Lifecycle state shared by compositions, recordings, and releases. */
|
|
24
|
+
export type WorkState = { type: "Initialized" } | { type: "Published"; timestampMs: number };
|
|
25
|
+
|
|
26
|
+
/** A cover image's location on Walrus, plus the URL to fetch it from. */
|
|
27
|
+
export interface CoverImage {
|
|
28
|
+
kind: "blob" | "quiltPatch";
|
|
29
|
+
/** Aggregator URL for the image — the only field a renderer needs. */
|
|
30
|
+
url: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface Cover {
|
|
34
|
+
still: CoverImage;
|
|
35
|
+
animated: CoverImage | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A credited party on a work. */
|
|
39
|
+
export interface Credit {
|
|
40
|
+
partyId: string;
|
|
41
|
+
displayName: string;
|
|
42
|
+
/** Role labels, e.g. `"Producer (Lead)"`, `"Instrumentalist: Guitar"`. */
|
|
43
|
+
roles: string[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A recording's credits. The artist-id lists are separate from `credits` because
|
|
48
|
+
* "primary" and "featured" are billing positions the recording asserts about a
|
|
49
|
+
* party, not roles the party performed — a producer can be a featured artist. UI
|
|
50
|
+
* badges the names by intersecting the two.
|
|
51
|
+
*/
|
|
52
|
+
export interface TrackCredits {
|
|
53
|
+
credits: Credit[];
|
|
54
|
+
primaryArtistIds: string[];
|
|
55
|
+
featuredArtistIds: string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** One track as a tracklist renders it. */
|
|
59
|
+
export interface TrackView {
|
|
60
|
+
/** Display number — `"1"`, or `"1.2"` (disc.track) on a multi-disc set. */
|
|
61
|
+
no: string;
|
|
62
|
+
title: string;
|
|
63
|
+
recordingId: string;
|
|
64
|
+
/** This track's share of the release's revenue, in basis points. */
|
|
65
|
+
splitBps: number;
|
|
66
|
+
/** 1-based disc this track sits on. */
|
|
67
|
+
disc: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A release with everything a page renders: metadata, cover, credits, tracklist. */
|
|
71
|
+
export interface ReleaseDetail {
|
|
72
|
+
id: string;
|
|
73
|
+
title: string;
|
|
74
|
+
subtitle: string | null;
|
|
75
|
+
state: WorkState;
|
|
76
|
+
/** Publish time (ms), or null while unpublished. */
|
|
77
|
+
publishedAtMs: number | null;
|
|
78
|
+
cover: Cover | null;
|
|
79
|
+
credits: Credit[];
|
|
80
|
+
/** The release's primary artists in chain order — its artist line. */
|
|
81
|
+
primaryArtists: string[];
|
|
82
|
+
discCount: number;
|
|
83
|
+
tracks: TrackView[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Pricing policy: pay exactly `amount` (fixed), or at least `amount` (floor). */
|
|
87
|
+
export interface Price {
|
|
88
|
+
kind: "fixed" | "floor";
|
|
89
|
+
/** Base units, decimal string (see the file header). */
|
|
90
|
+
amount: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Symbol + decimals for a pressing's currency, resolved from its coin type. */
|
|
94
|
+
export interface Currency {
|
|
95
|
+
/** Full Move coin type, or null when the drop's type tag was unreadable. */
|
|
96
|
+
type: string | null;
|
|
97
|
+
symbol: string;
|
|
98
|
+
decimals: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A pressing (a record sale) as the buy page and shelf tiles read it. */
|
|
102
|
+
export interface PressingView {
|
|
103
|
+
id: string;
|
|
104
|
+
releaseId: string;
|
|
105
|
+
edition: number;
|
|
106
|
+
price: Price;
|
|
107
|
+
currency: Currency;
|
|
108
|
+
/** Copies sold so far, decimal string. */
|
|
109
|
+
quantitySold: string;
|
|
110
|
+
/** Null = uncapped (an open edition). Decimal string otherwise. */
|
|
111
|
+
maxSupply: string | null;
|
|
112
|
+
startTimestampMs: number;
|
|
113
|
+
/** Null = evergreen. */
|
|
114
|
+
endTimestampMs: number | null;
|
|
115
|
+
/** Derived: `quantitySold >= maxSupply`. Always false for an open edition. */
|
|
116
|
+
soldOut: boolean;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Everything the pressing buy page renders. */
|
|
120
|
+
export interface PressingDetail {
|
|
121
|
+
pressing: PressingView;
|
|
122
|
+
release: ReleaseDetail;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** One tile on the Discover shelf. */
|
|
126
|
+
export interface DiscoverItem {
|
|
127
|
+
pressing: PressingView;
|
|
128
|
+
releaseId: string;
|
|
129
|
+
title: string;
|
|
130
|
+
/** Primary artists, joined for display. Empty when no credits are set. */
|
|
131
|
+
artist: string;
|
|
132
|
+
coverUrl: string | null;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** A record's parent release — the album-resolution read. Immutable per record. */
|
|
136
|
+
export interface RecordAlbum {
|
|
137
|
+
recordId: string;
|
|
138
|
+
/** Null when the record object carries no release id. */
|
|
139
|
+
releaseId: string | null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** The confirmation preview shown when an owner pastes a pressing id to pin. */
|
|
143
|
+
export interface DropPreview {
|
|
144
|
+
pressingId: string;
|
|
145
|
+
currency: Currency;
|
|
146
|
+
title: string;
|
|
147
|
+
subtitle: string | null;
|
|
148
|
+
coverUrl: string | null;
|
|
149
|
+
price: Price;
|
|
150
|
+
trackCount: number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ── Artist ───────────────────────────────────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
export interface PartyMember {
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Every external platform the party link extensions know how to build a URL for,
|
|
162
|
+
* spanning social, music, and professional payloads. Enumerated rather than left
|
|
163
|
+
* as `string` so a renderer's icon/label switch is exhaustive at compile time —
|
|
164
|
+
* adding a platform on-chain should break the UI that has no icon for it.
|
|
165
|
+
*/
|
|
166
|
+
export type PlatformKey =
|
|
167
|
+
// Social (party_social)
|
|
168
|
+
| "x"
|
|
169
|
+
| "instagram"
|
|
170
|
+
| "threads"
|
|
171
|
+
| "tiktok"
|
|
172
|
+
| "youtube"
|
|
173
|
+
| "discord"
|
|
174
|
+
| "telegram"
|
|
175
|
+
| "reddit"
|
|
176
|
+
| "twitch"
|
|
177
|
+
| "facebook"
|
|
178
|
+
// Music (party_music)
|
|
179
|
+
| "spotify"
|
|
180
|
+
| "bandcamp"
|
|
181
|
+
| "soundcloud"
|
|
182
|
+
| "appleMusic"
|
|
183
|
+
| "deezer"
|
|
184
|
+
| "tidal"
|
|
185
|
+
| "amazonMusic"
|
|
186
|
+
| "audiomack"
|
|
187
|
+
// Professional / industry (party_pro_link)
|
|
188
|
+
| "website"
|
|
189
|
+
| "bookingPage"
|
|
190
|
+
| "managementPage"
|
|
191
|
+
| "publisherPage"
|
|
192
|
+
| "labelPage"
|
|
193
|
+
| "epk"
|
|
194
|
+
| "patreon"
|
|
195
|
+
| "substack"
|
|
196
|
+
| "kofi";
|
|
197
|
+
|
|
198
|
+
export interface PartyLink {
|
|
199
|
+
platform: PlatformKey;
|
|
200
|
+
/** The platform-native identifier stored on-chain (handle / id / subdomain / URL). */
|
|
201
|
+
value: string;
|
|
202
|
+
/** Public profile URL, rebuilt from `value`. */
|
|
203
|
+
url: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface PartyCta {
|
|
207
|
+
label: string;
|
|
208
|
+
url: string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** An artist page: the party plus every extension attached to it. */
|
|
212
|
+
export interface ArtistProfile {
|
|
213
|
+
id: string;
|
|
214
|
+
kind: "individual" | "group";
|
|
215
|
+
name: string;
|
|
216
|
+
createdAtMs: number;
|
|
217
|
+
bioShort: string | null;
|
|
218
|
+
bioLong: string | null;
|
|
219
|
+
/** ISO 3166-1 alpha-2, e.g. "GB". */
|
|
220
|
+
country: string | null;
|
|
221
|
+
/** ISO 639-1 codes, e.g. ["en"]. */
|
|
222
|
+
languages: string[];
|
|
223
|
+
/** Genre DISPLAY names, already humanized from the on-chain `HIP_HOP` form. */
|
|
224
|
+
genres: string[];
|
|
225
|
+
links: PartyLink[];
|
|
226
|
+
ctas: PartyCta[];
|
|
227
|
+
/** Group parties only — members with names resolved. Empty for individuals. */
|
|
228
|
+
members: PartyMember[];
|
|
229
|
+
/** Present only when requested via `include` — the owner-editor fields. */
|
|
230
|
+
roles?: string[];
|
|
231
|
+
tags?: string[];
|
|
232
|
+
/** Public avatar URL (miso-api R2 lane; may 404 when unset). */
|
|
233
|
+
avatarUrl: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** A party's pinned pressing, fully resolved. Null when nothing is pinned. */
|
|
237
|
+
export interface FeaturedRelease {
|
|
238
|
+
pressingId: string;
|
|
239
|
+
releaseId: string;
|
|
240
|
+
title: string;
|
|
241
|
+
/** The party whose page this is — shown as the release's artist. */
|
|
242
|
+
artist: string;
|
|
243
|
+
coverUrl: string | null;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** The minimal party projection used for lists (`?ids=`). */
|
|
247
|
+
export interface PartySummary {
|
|
248
|
+
id: string;
|
|
249
|
+
name: string;
|
|
250
|
+
kind: "individual" | "group";
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// ── Wallet-scoped ────────────────────────────────────────────────────────────
|
|
254
|
+
|
|
255
|
+
/** A record the wallet holds. */
|
|
256
|
+
export interface OwnedRecord {
|
|
257
|
+
/** Canonical object id — the `recordId` route param. */
|
|
258
|
+
id: string;
|
|
259
|
+
/** Full on-chain type, e.g. `0xfc2b51…::record::Record`. */
|
|
260
|
+
type: string;
|
|
261
|
+
releaseId: string | null;
|
|
262
|
+
/** Copy / edition number, when the struct exposes one. */
|
|
263
|
+
number: number | null;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** A party the wallet administers (holds the `PartyAdminCap` for). */
|
|
267
|
+
export interface OwnedParty {
|
|
268
|
+
partyId: string;
|
|
269
|
+
capId: string;
|
|
270
|
+
name: string;
|
|
271
|
+
kind: "individual" | "group";
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export type WorkKind = "composition" | "recording" | "release";
|
|
275
|
+
|
|
276
|
+
/** A work the wallet administers, as the studio catalog lists it. */
|
|
277
|
+
export interface OwnedWork {
|
|
278
|
+
/** The ADMIN CAP object id — the catalog's routing key. */
|
|
279
|
+
capId: string;
|
|
280
|
+
kind: WorkKind;
|
|
281
|
+
workId: string;
|
|
282
|
+
title: string;
|
|
283
|
+
/** Lifecycle state tag: "Initialized" | "Published". */
|
|
284
|
+
state: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Everything the work detail page shows beyond the list row. */
|
|
288
|
+
export interface WorkDetail extends OwnedWork {
|
|
289
|
+
subtitle?: string;
|
|
290
|
+
/** Composition only — royalty rate in basis points. */
|
|
291
|
+
royaltyRateBps?: number;
|
|
292
|
+
/** Composition / recording only — the share token type tag. */
|
|
293
|
+
shareType?: string;
|
|
294
|
+
/** Release only. */
|
|
295
|
+
discCount?: number;
|
|
296
|
+
trackCount?: number;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** A wallet's spendable balance in one currency. */
|
|
300
|
+
export interface Balance {
|
|
301
|
+
address: string;
|
|
302
|
+
coinType: string;
|
|
303
|
+
/** Base units, decimal string. Totals coin objects AND the address balance. */
|
|
304
|
+
balance: string;
|
|
305
|
+
decimals: number;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** Whether a wallet controls a thing. `null` for a check that could not be made. */
|
|
309
|
+
export interface Ownership {
|
|
310
|
+
address: string;
|
|
311
|
+
/** The object the check was about (party id or record id). */
|
|
312
|
+
objectId: string;
|
|
313
|
+
isOwner: boolean;
|
|
314
|
+
/** Party checks only — the derived `PartyAdminCap` id owner-gated writes need. */
|
|
315
|
+
capId?: string;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// ── Receipts ─────────────────────────────────────────────────────────────────
|
|
319
|
+
|
|
320
|
+
/** The sale itself, as the chain recorded it. */
|
|
321
|
+
export interface RecordSale {
|
|
322
|
+
dropId: string;
|
|
323
|
+
releaseId: string;
|
|
324
|
+
edition: number;
|
|
325
|
+
/** The `Record` object minted to the buyer. */
|
|
326
|
+
recordId: string;
|
|
327
|
+
/** This copy's number in the edition's run (1-based), decimal string. */
|
|
328
|
+
number: string;
|
|
329
|
+
/** What the buyer actually paid, in the currency's base units. */
|
|
330
|
+
paid: string;
|
|
331
|
+
buyer: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** One track's share of the paid amount, and how that share splits again. */
|
|
335
|
+
export interface TrackRoyalty {
|
|
336
|
+
no: string;
|
|
337
|
+
title: string;
|
|
338
|
+
recordingId: string;
|
|
339
|
+
splitBps: number;
|
|
340
|
+
/** Base units attributable to this track. */
|
|
341
|
+
amount: string;
|
|
342
|
+
/**
|
|
343
|
+
* `amount` split between the composition and the recording. Both null when the
|
|
344
|
+
* composition's royalty rate could not be resolved — the breakdown then stops
|
|
345
|
+
* at the track level rather than guessing.
|
|
346
|
+
*/
|
|
347
|
+
composition: string | null;
|
|
348
|
+
recording: string | null;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export interface PurchaseReceipt {
|
|
352
|
+
sale: RecordSale;
|
|
353
|
+
/** The pressing/release the copy came from — cover, title, tracklist. */
|
|
354
|
+
detail: PressingDetail;
|
|
355
|
+
/**
|
|
356
|
+
* The drop's list price. Differs from `sale.paid` when the buyer paid over a
|
|
357
|
+
* floor price, or when the price changed in a later edition.
|
|
358
|
+
*/
|
|
359
|
+
price: string;
|
|
360
|
+
tracks: TrackRoyalty[];
|
|
361
|
+
}
|