@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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// Per-network on-chain identity: which packages the reads address, which objects
|
|
5
|
+
// they read, and which endpoints they read through. Every id that used to be a
|
|
6
|
+
// hard-coded constant inside miso-app (`lib/party.ts`, `lib/release.ts`,
|
|
7
|
+
// `lib/money.ts`, `lib/pressing.ts`) lives here instead, so a redeploy is a change
|
|
8
|
+
// in ONE file that every surface picks up.
|
|
9
|
+
//
|
|
10
|
+
// Testnet values are derived from the same verified deployment record exported
|
|
11
|
+
// by the platform SDK. Mainnet remains deliberately unavailable until a complete
|
|
12
|
+
// deployment is bundled for it.
|
|
13
|
+
import { getMisoPlatformDeployment } from "../deployments.js";
|
|
14
|
+
/** Missing defaults to Testnet for local development; invalid values fail closed. */
|
|
15
|
+
export function networkFrom(value) {
|
|
16
|
+
if (value === undefined || value === "testnet")
|
|
17
|
+
return "testnet";
|
|
18
|
+
if (value === "mainnet")
|
|
19
|
+
return "mainnet";
|
|
20
|
+
throw new Error(`@misofm/platform/read: unsupported network "${value}".`);
|
|
21
|
+
}
|
|
22
|
+
/** The config for `network`, derived from this SDK's verified deployment map. */
|
|
23
|
+
export function misoConfig(network, overrides = {}) {
|
|
24
|
+
const platform = getMisoPlatformDeployment(network);
|
|
25
|
+
const vaultPackageId = platform.operations.status === "available"
|
|
26
|
+
? platform.operations.vault.packageId
|
|
27
|
+
: platform.operations.legacy?.vaultPackageId;
|
|
28
|
+
if (!vaultPackageId) {
|
|
29
|
+
throw new Error(`@misofm/platform/read: no current or legacy Vault type metadata for "${network}".`);
|
|
30
|
+
}
|
|
31
|
+
const config = {
|
|
32
|
+
network,
|
|
33
|
+
deployment: platform.protocol,
|
|
34
|
+
recordSales: platform.recordSales,
|
|
35
|
+
protocol: {
|
|
36
|
+
// Read-only legacy type discovery does not make this package an
|
|
37
|
+
// executable operations ABI; client call surfaces remain fail closed.
|
|
38
|
+
vault: vaultPackageId,
|
|
39
|
+
releaseCoverArt: platform.packages.releaseCoverArt,
|
|
40
|
+
releaseKind: platform.packages.releaseKind,
|
|
41
|
+
recordingMasterReference: platform.packages.recordingMasterReference,
|
|
42
|
+
compositionCredits: platform.packages.compositionCredits,
|
|
43
|
+
recordingCredits: platform.packages.recordingCredits,
|
|
44
|
+
releaseCredits: platform.packages.releaseCredits,
|
|
45
|
+
credit: platform.packages.credit,
|
|
46
|
+
},
|
|
47
|
+
money: {
|
|
48
|
+
usdCoinType: "0x77774cb7b8cb5622b4ef2658101bf5f1e965418297fe874b683df8f760b6e749::fakeusd::FakeUsd",
|
|
49
|
+
usdDecimals: 6,
|
|
50
|
+
},
|
|
51
|
+
grpcUrl: "https://fullnode.testnet.sui.io",
|
|
52
|
+
graphqlUrl: "https://graphql.testnet.sui.io/graphql",
|
|
53
|
+
walrusAggregatorUrl: "https://aggregator.walrus-testnet.walrus.space",
|
|
54
|
+
apiBaseUrl: "https://api.testnet.miso.fm",
|
|
55
|
+
discoverSales: [],
|
|
56
|
+
};
|
|
57
|
+
return { ...config, ...stripUndefined(overrides) };
|
|
58
|
+
}
|
|
59
|
+
/** `{ a: undefined }` must not clobber a real default when spread. */
|
|
60
|
+
function stripUndefined(o) {
|
|
61
|
+
return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AAQ,CAAC,QAAQ,CAAC,WAAW;YAC1C,wBAAwB,EAAE,QAAQ,CAAC,QAAQ,CAAC,wBAAwB;YACpE,kBAAkB,EAAE,QAAQ,CAAC,QAAQ,CAAC,kBAAkB;YACxD,gBAAgB,EAAE,QAAQ,CAAC,QAAQ,CAAC,gBAAgB;YACpD,cAAc,EAAE,QAAQ,CAAC,QAAQ,CAAC,cAAc;YAChD,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;SACjC;QACD,KAAK,EAAE;YACL,WAAW,EACT,sFAAsF;YACxF,WAAW,EAAE,CAAC;SACf;QACD,OAAO,EAAE,iCAAiC;QAC1C,UAAU,EAAE,wCAAwC;QACpD,mBAAmB,EAAE,gDAAgD;QACrE,UAAU,EAAE,6BAA6B;QACzC,aAAa,EAAE,EAAE;KAClB,CAAC;IACF,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,sEAAsE;AACtE,SAAS,cAAc,CAAmB,CAAI;IAC5C,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAe,CAAC;AAChG,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MisoClient } from "./client.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve `Genre` object ids to display names. Best-effort: an id that fails to
|
|
4
|
+
* read is dropped rather than failing the artist page around it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveGenreNames(client: MisoClient, ids: string[]): Promise<string[]>;
|
|
7
|
+
//# sourceMappingURL=genres.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genres.d.ts","sourceRoot":"","sources":["../../src/read/genres.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAW9C;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAc5F"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// Genre name resolution. `party.getGenres` returns `Genre` OBJECT IDS; each Genre
|
|
5
|
+
// object carries a screaming-snake name ("HIP_HOP"). There is no id→name table
|
|
6
|
+
// anywhere off-chain, so the names are read from the objects and humanized.
|
|
7
|
+
/** "HIP_HOP" → "Hip Hop". */
|
|
8
|
+
function humanize(name) {
|
|
9
|
+
return name
|
|
10
|
+
.split("_")
|
|
11
|
+
.filter(Boolean)
|
|
12
|
+
.map((w) => w.charAt(0) + w.slice(1).toLowerCase())
|
|
13
|
+
.join(" ");
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve `Genre` object ids to display names. Best-effort: an id that fails to
|
|
17
|
+
* read is dropped rather than failing the artist page around it.
|
|
18
|
+
*/
|
|
19
|
+
export async function resolveGenreNames(client, ids) {
|
|
20
|
+
if (ids.length === 0)
|
|
21
|
+
return [];
|
|
22
|
+
try {
|
|
23
|
+
const { objects } = await client.protocol.core.getObjects({ objectIds: ids, include: { json: true } });
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const o of objects) {
|
|
26
|
+
if (o instanceof Error)
|
|
27
|
+
continue;
|
|
28
|
+
const name = o.json?.name;
|
|
29
|
+
if (typeof name === "string" && name)
|
|
30
|
+
out.push(humanize(name));
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=genres.js.map
|
|
@@ -0,0 +1 @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ACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { createMisoClient } from "./client.ts";
|
|
2
|
+
export type { MisoClient, CreateMisoClientOptions } from "./client.ts";
|
|
3
|
+
export { misoConfig, networkFrom } from "./config.ts";
|
|
4
|
+
export type { MisoConfig, MisoConfigOverrides, DiscoverSale, MoneyIds, Network, ProtocolIds, } from "./config.ts";
|
|
5
|
+
export { currencyInfo, getDiscoverShelf, getListingView, getPressingDetail, getPressingView, getPressingSaleDetail, getPressingPreview, getRecordAlbum, getReleaseDetail, getReleaseResources, getTrackCredits, getSaleDetail, primaryArtistNames, readReleaseCover, } from "./catalog.ts";
|
|
6
|
+
export type { GetRecordAlbumOptions, GetReleaseOptions, RecordAlbumInclude, ReleaseInclude, ReleaseResourceInclude, } from "./catalog.ts";
|
|
7
|
+
export type { ReleaseResources } from "./catalog.ts";
|
|
8
|
+
export { getArtistProfile, getPartySummaries, partyAvatarUrl, } from "./artist.ts";
|
|
9
|
+
export type { ArtistInclude, GetArtistOptions } from "./artist.ts";
|
|
10
|
+
export { resolveGenreNames } from "./genres.ts";
|
|
11
|
+
export { getBalance, getOwnedParties, getPendingMemberships, getOwnedRecords, getOwnedWorks, getWorkByCap, ownsParty, ownsRecord, } from "./wallet.ts";
|
|
12
|
+
export { breakdown, findRecordSale, findRecordSales, getPurchaseReceipt, getPurchaseReceipts, isRecordSoldEventType, recordSoldCurrencyType, } from "./receipts.ts";
|
|
13
|
+
export type * from "./types.ts";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/read/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EACL,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,mBAAmB,YAAY,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// @misofm/platform/read — Miso's high-level platform read surface.
|
|
5
|
+
//
|
|
6
|
+
// One place that knows how to turn Sui objects into the things Miso talks about:
|
|
7
|
+
// a pressing, a release, an artist, a library, a receipt. It composes
|
|
8
|
+
// @misofm/protocol, owns the per-network id manifest, and returns view types that
|
|
9
|
+
// survive JSON.
|
|
10
|
+
//
|
|
11
|
+
// Browser- and server-compatible. The HTTP API is a thin cached transport over
|
|
12
|
+
// this same surface; direct clients can use it without going through the API.
|
|
13
|
+
//
|
|
14
|
+
// const miso = createMisoClient({ network: "testnet" })
|
|
15
|
+
// const pressing = await getPressingDetail(miso, pressingId)
|
|
16
|
+
export { createMisoClient } from "./client.js";
|
|
17
|
+
export { misoConfig, networkFrom } from "./config.js";
|
|
18
|
+
export { currencyInfo, getDiscoverShelf, getListingView, getPressingDetail, getPressingView, getPressingSaleDetail, getPressingPreview, getRecordAlbum, getReleaseDetail, getReleaseResources, getTrackCredits, getSaleDetail, primaryArtistNames, readReleaseCover, } from "./catalog.js";
|
|
19
|
+
export { getArtistProfile, getPartySummaries, partyAvatarUrl, } from "./artist.js";
|
|
20
|
+
export { resolveGenreNames } from "./genres.js";
|
|
21
|
+
export { getBalance, getOwnedParties, getPendingMemberships, getOwnedRecords, getOwnedWorks, getWorkByCap, ownsParty, ownsRecord, } from "./wallet.js";
|
|
22
|
+
export { breakdown, findRecordSale, findRecordSales, getPurchaseReceipt, getPurchaseReceipts, isRecordSoldEventType, recordSoldCurrencyType, } from "./receipts.js";
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/read/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AACtC,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,iFAAiF;AACjF,sEAAsE;AACtE,kFAAkF;AAClF,gBAAgB;AAChB,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,EAAE;AACF,0DAA0D;AAC1D,+DAA+D;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAUtD,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAUtB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EACL,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,SAAS,EACT,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A u64/u128 as it may arrive off the wire, in BCS, or from a JSON projection. */
|
|
2
|
+
export type NumericLike = bigint | number | string | null | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Base-unit scalar → decimal string. Returns `"0"` for anything unreadable, which
|
|
5
|
+
* is the honest projection of "the chain gave us no number" for quantities and
|
|
6
|
+
* amounts. Use {@link u64OrNull} where absent must stay distinguishable from zero.
|
|
7
|
+
*/
|
|
8
|
+
export declare function u64(v: NumericLike): string;
|
|
9
|
+
/** Base-unit scalar → decimal string, or `null` when absent/unparseable. */
|
|
10
|
+
export declare function u64OrNull(v: NumericLike): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* A millisecond timestamp → `number`. Milliseconds stay numbers (they are far
|
|
13
|
+
* inside Number.MAX_SAFE_INTEGER and `new Date()` wants one), unlike token
|
|
14
|
+
* amounts which must not lose precision.
|
|
15
|
+
*/
|
|
16
|
+
export declare function msOrNull(v: NumericLike): number | null;
|
|
17
|
+
/** As {@link msOrNull}, defaulting to `0` (the epoch) when absent. */
|
|
18
|
+
export declare function ms(v: NumericLike): number;
|
|
19
|
+
/** A plain integer field (bps, edition, counts) → `number`, defaulting to `0`. */
|
|
20
|
+
export declare function int(v: NumericLike): number;
|
|
21
|
+
/** Integer comparison over two decimal strings — `a >= b` without going through Number. */
|
|
22
|
+
export declare function gte(a: string, b: string): boolean;
|
|
23
|
+
//# sourceMappingURL=scalars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalars.d.ts","sourceRoot":"","sources":["../../../src/read/internal/scalars.ts"],"names":[],"mappings":"AAOA,mFAAmF;AACnF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEtE;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAE1C;AAED,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAQvD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAKtD;AAED,sEAAsE;AACtE,wBAAgB,EAAE,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAEzC;AAED,kFAAkF;AAClF,wBAAgB,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAK1C;AAED,2FAA2F;AAC3F,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEjD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
//
|
|
4
|
+
// The bigint→JSON boundary. Every u64/u128 the protocol SDKs hand back arrives as
|
|
5
|
+
// a `bigint`, which `JSON.stringify` throws on; these convert once, here, so no
|
|
6
|
+
// view type can carry one out of the SDK (see the header of ../types.ts).
|
|
7
|
+
/**
|
|
8
|
+
* Base-unit scalar → decimal string. Returns `"0"` for anything unreadable, which
|
|
9
|
+
* is the honest projection of "the chain gave us no number" for quantities and
|
|
10
|
+
* amounts. Use {@link u64OrNull} where absent must stay distinguishable from zero.
|
|
11
|
+
*/
|
|
12
|
+
export function u64(v) {
|
|
13
|
+
return u64OrNull(v) ?? "0";
|
|
14
|
+
}
|
|
15
|
+
/** Base-unit scalar → decimal string, or `null` when absent/unparseable. */
|
|
16
|
+
export function u64OrNull(v) {
|
|
17
|
+
if (v == null)
|
|
18
|
+
return null;
|
|
19
|
+
if (typeof v === "bigint")
|
|
20
|
+
return v >= 0n ? v.toString() : null;
|
|
21
|
+
if (typeof v === "number") {
|
|
22
|
+
return Number.isSafeInteger(v) && v >= 0 ? BigInt(v).toString() : null;
|
|
23
|
+
}
|
|
24
|
+
const s = v.trim();
|
|
25
|
+
return /^\d+$/.test(s) ? BigInt(s).toString() : null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A millisecond timestamp → `number`. Milliseconds stay numbers (they are far
|
|
29
|
+
* inside Number.MAX_SAFE_INTEGER and `new Date()` wants one), unlike token
|
|
30
|
+
* amounts which must not lose precision.
|
|
31
|
+
*/
|
|
32
|
+
export function msOrNull(v) {
|
|
33
|
+
const s = u64OrNull(v);
|
|
34
|
+
if (s === null)
|
|
35
|
+
return null;
|
|
36
|
+
const n = Number(s);
|
|
37
|
+
return Number.isSafeInteger(n) ? n : null;
|
|
38
|
+
}
|
|
39
|
+
/** As {@link msOrNull}, defaulting to `0` (the epoch) when absent. */
|
|
40
|
+
export function ms(v) {
|
|
41
|
+
return msOrNull(v) ?? 0;
|
|
42
|
+
}
|
|
43
|
+
/** A plain integer field (bps, edition, counts) → `number`, defaulting to `0`. */
|
|
44
|
+
export function int(v) {
|
|
45
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
46
|
+
return Math.trunc(v);
|
|
47
|
+
if (typeof v === "bigint")
|
|
48
|
+
return Number(v);
|
|
49
|
+
if (typeof v === "string" && /^-?\d+$/.test(v.trim()))
|
|
50
|
+
return Number(v.trim());
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
/** Integer comparison over two decimal strings — `a >= b` without going through Number. */
|
|
54
|
+
export function gte(a, b) {
|
|
55
|
+
return BigInt(a) >= BigInt(b);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=scalars.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalars.js","sourceRoot":"","sources":["../../../src/read/internal/scalars.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AACtC,EAAE;AACF,kFAAkF;AAClF,gFAAgF;AAChF,0EAA0E;AAK1E;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,CAAc;IAChC,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;AAC7B,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,SAAS,CAAC,CAAc;IACtC,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAChE,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACzE,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACnB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC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|
+
export declare function walrusBlobReadUrl(aggregator: string, blobId: bigint | string): string;
|
|
4
|
+
/** Build Walrus's 37-byte quilt-patch id. All fields use BCS little-endian. */
|
|
5
|
+
export declare function quiltPatchId(quiltId: bigint | string, version: number, startIndex: number, endIndex: number): string;
|
|
6
|
+
//# sourceMappingURL=walrus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walrus.d.ts","sourceRoot":"","sources":["../../../src/read/internal/walrus.ts"],"names":[],"mappings":"AAaA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAE3D;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,MAAM,CAGR;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CASR"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
4
|
+
import { toBase64 } from "@mysten/sui/utils";
|
|
5
|
+
import { walrusBlobIdFromU256 } from "../../mix.js";
|
|
6
|
+
const u256 = bcs.u256();
|
|
7
|
+
function toBase64Url(bytes) {
|
|
8
|
+
return toBase64(bytes).replace(/=*$/, "").replaceAll("+", "-").replaceAll("/", "_");
|
|
9
|
+
}
|
|
10
|
+
export function u256ToB64Url(value) {
|
|
11
|
+
return walrusBlobIdFromU256(value);
|
|
12
|
+
}
|
|
13
|
+
/** Build a blob URL with Walrus's non-strict default made explicit. */
|
|
14
|
+
export function walrusBlobReadUrl(aggregator, blobId) {
|
|
15
|
+
const base = aggregator.replace(/\/$/, "");
|
|
16
|
+
return `${base}/v1/blobs/${u256ToB64Url(blobId)}?strict_consistency_check=false`;
|
|
17
|
+
}
|
|
18
|
+
/** Build Walrus's 37-byte quilt-patch id. All fields use BCS little-endian. */
|
|
19
|
+
export function quiltPatchId(quiltId, version, startIndex, endIndex) {
|
|
20
|
+
const bytes = new Uint8Array(37);
|
|
21
|
+
bytes.set(u256.serialize(BigInt(quiltId)).toBytes(), 0);
|
|
22
|
+
bytes[32] = version;
|
|
23
|
+
bytes[33] = startIndex & 0xff;
|
|
24
|
+
bytes[34] = (startIndex >> 8) & 0xff;
|
|
25
|
+
bytes[35] = endIndex & 0xff;
|
|
26
|
+
bytes[36] = (endIndex >> 8) & 0xff;
|
|
27
|
+
return toBase64Url(bytes);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=walrus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walrus.js","sourceRoot":"","sources":["../../../src/read/internal/walrus.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;AAExB,SAAS,WAAW,CAAC,KAAiB;IACpC,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAsB;IACjD,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,iBAAiB,CAC/B,UAAkB,EAClB,MAAuB;IAEvB,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC3C,OAAO,GAAG,IAAI,aAAa,YAAY,CAAC,MAAM,CAAC,iCAAiC,CAAC;AACnF,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,YAAY,CAC1B,OAAwB,EACxB,OAAe,EACf,UAAkB,EAClB,QAAgB;IAEhB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACjC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACxD,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IACrC,KAAK,CAAC,EAAE,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IACnC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { MisoClient } from "./client.ts";
|
|
2
|
+
import type { PressingDetail, PurchaseReceipt, RecordSale, TrackRoyalty } from "./types.ts";
|
|
3
|
+
export declare class MalformedRecordSoldEventError extends Error {
|
|
4
|
+
readonly name = "MalformedRecordSoldEventError";
|
|
5
|
+
}
|
|
6
|
+
/** Composition royalty rate (bps) per recording id. Sparse — an unresolved parent has no entry. */
|
|
7
|
+
type CompositionRates = Record<string, number | undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* Whether `eventType` is this deployment's `listing::RecordSoldEvent<Currency>`.
|
|
10
|
+
*
|
|
11
|
+
* Event BCS is structural, so a same-shaped event from another package must never
|
|
12
|
+
* be decoded as a Miso sale. Normalize both package/type tags and require exactly
|
|
13
|
+
* one (possibly nested) currency type argument.
|
|
14
|
+
*/
|
|
15
|
+
export declare function recordSoldCurrencyType(eventType: string, recordShopPackageId: string): string | null;
|
|
16
|
+
export declare function isRecordSoldEventType(eventType: string, recordShopPackageId: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The sale a transaction recorded, or null if it emitted none. BCS is the stable
|
|
19
|
+
* shape (a JSON projection's field names vary by transport), so it is tried first.
|
|
20
|
+
*/
|
|
21
|
+
export declare function findRecordSales(events: {
|
|
22
|
+
eventType: string;
|
|
23
|
+
bcs: Uint8Array;
|
|
24
|
+
json: Record<string, unknown> | null;
|
|
25
|
+
}[], recordShopPackageId: string): RecordSale[];
|
|
26
|
+
/** Select one canonical sale by its Record ID. Selection is always explicit. */
|
|
27
|
+
export declare function findRecordSale(events: Parameters<typeof findRecordSales>[0], recordShopPackageId: string, recordId: string): RecordSale | null;
|
|
28
|
+
/**
|
|
29
|
+
* Split `paid` across the release's tracks by their `splitBps`, then split each
|
|
30
|
+
* track's share between its composition and its recording. All BigInt — the same
|
|
31
|
+
* truncating integer math the on-chain royalty layer does, so the numbers shown
|
|
32
|
+
* are the numbers paid.
|
|
33
|
+
*/
|
|
34
|
+
export declare function breakdown(tracks: PressingDetail["release"]["tracks"], paid: string, compositionRates: CompositionRates): TrackRoyalty[];
|
|
35
|
+
/** Read and hydrate every canonical Record sale in transaction event order. */
|
|
36
|
+
export declare function getPurchaseReceipts(client: MisoClient, txDigest: string): Promise<PurchaseReceipt[]>;
|
|
37
|
+
/** Read one canonical receipt selected by its Record ID. Selection is mandatory:
|
|
38
|
+
* one transaction may purchase multiple Records from the same Pressing. */
|
|
39
|
+
export declare function getPurchaseReceipt(client: MisoClient, txDigest: string, recordId: string): Promise<PurchaseReceipt | null>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=receipts.d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