@misonetwork/sdk 0.3.1 → 0.5.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 +97 -503
- package/dist/client.d.ts +6 -55
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -52
- package/dist/client.js.map +1 -1
- package/dist/contracts/miso/release.d.ts +34 -31
- package/dist/contracts/miso/release.d.ts.map +1 -1
- package/dist/contracts/miso/release.js +32 -29
- package/dist/contracts/miso/release.js.map +1 -1
- package/dist/contracts/miso/track.d.ts +66 -22
- package/dist/contracts/miso/track.d.ts.map +1 -1
- package/dist/contracts/miso/track.js +65 -20
- package/dist/contracts/miso/track.js.map +1 -1
- package/dist/contracts/utils/index.d.ts +44 -0
- package/dist/contracts/utils/index.d.ts.map +1 -1
- package/dist/contracts/utils/index.js +104 -2
- package/dist/contracts/utils/index.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/internal.d.ts +0 -7
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +0 -22
- package/dist/internal.js.map +1 -1
- package/dist/parsers.d.ts +1 -4
- package/dist/parsers.d.ts.map +1 -1
- package/dist/parsers.js +0 -24
- package/dist/parsers.js.map +1 -1
- package/dist/queries.d.ts +31 -5
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +179 -56
- package/dist/queries.js.map +1 -1
- package/dist/transactions.d.ts +10 -71
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js +15 -72
- package/dist/transactions.js.map +1 -1
- package/dist/types.d.ts +3 -40
- package/dist/types.d.ts.map +1 -1
- package/dist/view.d.ts +7 -7
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js +9 -9
- package/dist/view.js.map +1 -1
- package/package.json +4 -4
- package/src/client.ts +82 -89
- package/src/contracts/miso/release.ts +39 -36
- package/src/contracts/miso/track.ts +81 -23
- package/src/contracts/utils/index.ts +156 -4
- package/src/contracts.ts +0 -1
- package/src/internal.ts +0 -24
- package/src/parsers.ts +0 -35
- package/src/queries.ts +357 -83
- package/src/transactions.ts +20 -112
- package/src/types.ts +3 -53
- package/src/view.ts +13 -13
- package/dist/contracts/miso/deal.d.ts +0 -184
- package/dist/contracts/miso/deal.d.ts.map +0 -1
- package/dist/contracts/miso/deal.js +0 -184
- package/dist/contracts/miso/deal.js.map +0 -1
- package/src/contracts/miso/deal.ts +0 -257
package/dist/client.d.ts
CHANGED
|
@@ -1,35 +1,22 @@
|
|
|
1
1
|
import type { ClientWithCoreApi, SuiClientRegistration } from "@mysten/sui/client";
|
|
2
2
|
import type { SuiGraphQLClient } from "@mysten/sui/graphql";
|
|
3
|
-
import type { TxThunk } from "./transactions.ts";
|
|
4
3
|
import * as parsers from "./parsers.ts";
|
|
5
|
-
import * as
|
|
4
|
+
import * as queries from "./queries.ts";
|
|
6
5
|
import * as view from "./view.ts";
|
|
7
|
-
import type { Composition, CompositionAdminCap,
|
|
6
|
+
import type { Composition, CompositionAdminCap, Recording, RecordingAdminCap, Release, ReleaseAdminCap } from "./types.ts";
|
|
8
7
|
import * as composition from "./contracts/miso/composition.ts";
|
|
9
8
|
import * as recording from "./contracts/miso/recording.ts";
|
|
10
9
|
import * as release from "./contracts/miso/release.ts";
|
|
11
|
-
import * as deal from "./contracts/miso/deal.ts";
|
|
12
10
|
import * as track from "./contracts/miso/track.ts";
|
|
13
11
|
export interface MisoOptions<Name extends string = "miso"> {
|
|
14
12
|
/** Name for the client extension. Defaults to "miso". */
|
|
15
13
|
name?: Name;
|
|
16
14
|
/** The Miso package ID. Required for type-based queries and derivation. */
|
|
17
15
|
misoPackageId: string;
|
|
18
|
-
/**
|
|
19
|
-
* The `ReleaseRegistry` object ID for this deployment.
|
|
20
|
-
*
|
|
21
|
-
* Created once in `release::init` and shared, so it is FIXED for the lifetime
|
|
22
|
-
* of a published package — deployment config, not runtime state. Supply it
|
|
23
|
-
* (alongside `misoPackageId`, from the same deployment manifest) and
|
|
24
|
-
* `getReleaseRegistry()` needs no network call at all. Omit it and the SDK
|
|
25
|
-
* falls back to a GraphQL scan, which is why this is worth configuring.
|
|
26
|
-
*/
|
|
27
|
-
releaseRegistryId?: string;
|
|
28
16
|
/**
|
|
29
17
|
* Optional GraphQL client, required ONLY for the global type-discovery reads
|
|
30
18
|
* the Core API cannot express: `getCompositionByShareType`,
|
|
31
|
-
* `getRecordingByShareType
|
|
32
|
-
* `releaseRegistryId` is not configured. Everything else — including every
|
|
19
|
+
* `getRecordingByShareType`. Everything else — including every
|
|
33
20
|
* `getOwned*AdminCaps` — goes over the Core API.
|
|
34
21
|
*/
|
|
35
22
|
graphqlClient?: SuiGraphQLClient;
|
|
@@ -50,6 +37,8 @@ export declare class MisoClient {
|
|
|
50
37
|
constructor(client: ClientWithCoreApi, options: Omit<MisoOptions, "name">);
|
|
51
38
|
getCompositionById(compositionId: string): Promise<Composition>;
|
|
52
39
|
getCompositionsByIds(ids: string[]): Promise<Record<string, Composition>>;
|
|
40
|
+
getWorksByIds(ids: queries.WorkIds): Promise<queries.WorksById>;
|
|
41
|
+
getWorkAddressesByShareTypes(shareTypes: queries.WorkShareTypes): Promise<queries.WorkAddressesByShareType>;
|
|
53
42
|
getCompositionShareType(compositionId: string): Promise<string>;
|
|
54
43
|
getCompositionByShareType(shareType: string): Promise<Composition>;
|
|
55
44
|
getCompositionAdminCapById(adminCapId: string): Promise<CompositionAdminCap>;
|
|
@@ -62,22 +51,11 @@ export declare class MisoClient {
|
|
|
62
51
|
getRecordingAdminCapById(adminCapId: string): Promise<RecordingAdminCap>;
|
|
63
52
|
getOwnedRecordingAdminCaps(owner: string): Promise<RecordingAdminCap[]>;
|
|
64
53
|
deriveRecordingAdminCapId(recordingId: string): string;
|
|
65
|
-
getDealById(dealId: string): Promise<Deal>;
|
|
66
54
|
getReleaseById(releaseId: string): Promise<Release>;
|
|
67
55
|
getReleasesByIds(ids: string[]): Promise<Record<string, Release>>;
|
|
68
56
|
getReleaseAdminCapById(adminCapId: string): Promise<ReleaseAdminCap>;
|
|
69
57
|
deriveReleaseAdminCapId(releaseId: string): string;
|
|
70
58
|
getOwnedReleaseAdminCaps(owner: string): Promise<ReleaseAdminCap[]>;
|
|
71
|
-
/**
|
|
72
|
-
* The deployment's `ReleaseRegistry` object ID.
|
|
73
|
-
*
|
|
74
|
-
* Returns the configured `releaseRegistryId` with no network call. Only when
|
|
75
|
-
* it was not configured does this fall back to a GraphQL scan — a one-time
|
|
76
|
-
* bootstrap for a fresh deployment whose id you have not recorded yet. Prefer
|
|
77
|
-
* configuring it: the registry is created once in `release::init` and never
|
|
78
|
-
* changes, so scanning for it on every call is pure overhead.
|
|
79
|
-
*/
|
|
80
|
-
getReleaseRegistry(): Promise<string>;
|
|
81
59
|
getShareCurrencyType(shareCurrencyId: string): Promise<string>;
|
|
82
60
|
/**
|
|
83
61
|
* The `TreasuryCap<shareType>` owned by `owner`. Takes the share TYPE — if you
|
|
@@ -85,17 +63,13 @@ export declare class MisoClient {
|
|
|
85
63
|
* {@link getShareCurrencyType}.
|
|
86
64
|
*/
|
|
87
65
|
getShareCurrencyTreasuryCap(shareType: string, owner: string): Promise<string>;
|
|
88
|
-
get tx(): {
|
|
89
|
-
rejectDeal: (params: Omit<transactions.RejectDealParams, "misoPackageId">) => TxThunk;
|
|
90
|
-
};
|
|
91
66
|
get view(): {
|
|
92
|
-
|
|
67
|
+
deriveTargetReleaseId: (params: view.DeriveTargetReleaseIdParams) => Promise<string>;
|
|
93
68
|
};
|
|
94
69
|
get call(): {
|
|
95
70
|
composition: typeof composition;
|
|
96
71
|
recording: typeof recording;
|
|
97
72
|
release: typeof release;
|
|
98
|
-
deal: typeof deal;
|
|
99
73
|
track: typeof track;
|
|
100
74
|
};
|
|
101
75
|
get bcs(): {
|
|
@@ -140,11 +114,6 @@ export declare class MisoClient {
|
|
|
140
114
|
length: number;
|
|
141
115
|
}, string>;
|
|
142
116
|
}, "@local-pkg/miso::release::Release">;
|
|
143
|
-
Deal: import("./contracts/utils/index.ts").MoveStruct<{
|
|
144
|
-
id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
145
|
-
release_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
146
|
-
track_split_bps: import("./contracts/utils/index.ts").MoveTuple<readonly [import("@mysten/bcs").BcsType<number, number, "u16">], "bps::bps::BPS">;
|
|
147
|
-
}, "@local-pkg/miso::deal::Deal<phantom RecordingShare, phantom CompositionShare>">;
|
|
148
117
|
Track: import("./contracts/utils/index.ts").MoveStruct<{
|
|
149
118
|
state: import("./contracts/utils/index.ts").MoveEnum<{
|
|
150
119
|
Unassigned: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
@@ -168,30 +137,12 @@ export declare class MisoClient {
|
|
|
168
137
|
ReleasePublishedEvent: import("./contracts/utils/index.ts").MoveStruct<{
|
|
169
138
|
release_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
170
139
|
}, "@local-pkg/miso::release::ReleasePublishedEvent">;
|
|
171
|
-
DealCreatedEvent: import("./contracts/utils/index.ts").MoveStruct<{
|
|
172
|
-
deal_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
173
|
-
recording_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
174
|
-
release_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
175
|
-
track_split_bps_value: import("@mysten/bcs").BcsType<number, number, "u16">;
|
|
176
|
-
created_by: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
177
|
-
}, "@local-pkg/miso::deal::DealCreatedEvent<phantom RecordingShare, phantom CompositionShare>">;
|
|
178
|
-
DealAcceptedEvent: import("./contracts/utils/index.ts").MoveStruct<{
|
|
179
|
-
deal_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
180
|
-
release_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
181
|
-
}, "@local-pkg/miso::deal::DealAcceptedEvent<phantom RecordingShare, phantom CompositionShare>">;
|
|
182
|
-
DealRejectedEvent: import("./contracts/utils/index.ts").MoveStruct<{
|
|
183
|
-
deal_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
184
|
-
release_id: import("@mysten/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
185
|
-
}, "@local-pkg/miso::deal::DealRejectedEvent<phantom RecordingShare, phantom CompositionShare>">;
|
|
186
140
|
};
|
|
187
141
|
get parse(): {
|
|
188
142
|
compositionPublishedEvent: typeof parsers.parseCompositionPublishedEvent;
|
|
189
143
|
compositionRoyaltySetEvent: typeof parsers.parseCompositionRoyaltySetEvent;
|
|
190
144
|
recordingPublishedEvent: typeof parsers.parseRecordingPublishedEvent;
|
|
191
145
|
releasePublishedEvent: typeof parsers.parseReleasePublishedEvent;
|
|
192
|
-
dealCreatedEvent: typeof parsers.parseDealCreatedEvent;
|
|
193
|
-
dealAcceptedEvent: typeof parsers.parseDealAcceptedEvent;
|
|
194
|
-
dealRejectedEvent: typeof parsers.parseDealRejectedEvent;
|
|
195
146
|
};
|
|
196
147
|
}
|
|
197
148
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,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IAGjE,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAG1E,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAG5C,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IASnE,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAGpE;;;;OAIG;IACG,2BAA2B,CAC/B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC;IAMlB,IAAI,IAAI;wCAI4B,IAAI,CAAC,2BAA2B;MAGnE;IAID,IAAI,IAAI;;;;;MAQP;IAID,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWN;IAID,IAAI,KAAK;;;;;MAOR;CAUF"}
|
package/dist/client.js
CHANGED
|
@@ -2,22 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import * as parsers from "./parsers.js";
|
|
4
4
|
import * as queries from "./queries.js";
|
|
5
|
-
import * as transactions from "./transactions.js";
|
|
6
5
|
import * as view from "./view.js";
|
|
7
6
|
// Generated call modules (type-safe Move calls) and BCS structs.
|
|
8
7
|
import * as composition from "./contracts/miso/composition.js";
|
|
9
8
|
import * as recording from "./contracts/miso/recording.js";
|
|
10
9
|
import * as release from "./contracts/miso/release.js";
|
|
11
|
-
import * as deal from "./contracts/miso/deal.js";
|
|
12
10
|
import * as track from "./contracts/miso/track.js";
|
|
13
|
-
/**
|
|
14
|
-
* Wraps a builder so the client's `misoPackageId` is injected, dropping it from
|
|
15
|
-
* the caller's params. Explicit call-sites (the free functions in
|
|
16
|
-
* `./transactions`) remain available for full control.
|
|
17
|
-
*/
|
|
18
|
-
function bindPackages(fn, misoPackageId) {
|
|
19
|
-
return (params) => fn({ misoPackageId, ...params });
|
|
20
|
-
}
|
|
21
11
|
/** Defaults `options.package` to `pkg` for every call-function in a generated module. */
|
|
22
12
|
function bindModulePackage(mod, pkg) {
|
|
23
13
|
const out = {};
|
|
@@ -50,12 +40,10 @@ export class MisoClient {
|
|
|
50
40
|
#client;
|
|
51
41
|
#graphqlClient;
|
|
52
42
|
#misoPackageId;
|
|
53
|
-
#releaseRegistryId;
|
|
54
43
|
constructor(client, options) {
|
|
55
44
|
this.#client = client;
|
|
56
45
|
this.#graphqlClient = options.graphqlClient;
|
|
57
46
|
this.#misoPackageId = options.misoPackageId;
|
|
58
|
-
this.#releaseRegistryId = options.releaseRegistryId;
|
|
59
47
|
}
|
|
60
48
|
// === Composition ===
|
|
61
49
|
async getCompositionById(compositionId) {
|
|
@@ -64,6 +52,12 @@ export class MisoClient {
|
|
|
64
52
|
async getCompositionsByIds(ids) {
|
|
65
53
|
return queries.getCompositionsByIds(this.#client, ids);
|
|
66
54
|
}
|
|
55
|
+
async getWorksByIds(ids) {
|
|
56
|
+
return queries.getWorksByIds(this.#client, ids);
|
|
57
|
+
}
|
|
58
|
+
async getWorkAddressesByShareTypes(shareTypes) {
|
|
59
|
+
return queries.getWorkAddressesByShareTypes(this.#requireGraphQL(), shareTypes, this.#misoPackageId);
|
|
60
|
+
}
|
|
67
61
|
async getCompositionShareType(compositionId) {
|
|
68
62
|
return queries.getCompositionShareType(this.#client, compositionId);
|
|
69
63
|
}
|
|
@@ -101,10 +95,6 @@ export class MisoClient {
|
|
|
101
95
|
deriveRecordingAdminCapId(recordingId) {
|
|
102
96
|
return queries.deriveRecordingAdminCapId(recordingId, this.#misoPackageId);
|
|
103
97
|
}
|
|
104
|
-
// === Deal ===
|
|
105
|
-
async getDealById(dealId) {
|
|
106
|
-
return queries.getDealById(this.#client, dealId);
|
|
107
|
-
}
|
|
108
98
|
// === Release ===
|
|
109
99
|
async getReleaseById(releaseId) {
|
|
110
100
|
return queries.getReleaseById(this.#client, releaseId);
|
|
@@ -121,20 +111,6 @@ export class MisoClient {
|
|
|
121
111
|
async getOwnedReleaseAdminCaps(owner) {
|
|
122
112
|
return queries.getOwnedReleaseAdminCaps(this.#client, owner, this.#misoPackageId);
|
|
123
113
|
}
|
|
124
|
-
/**
|
|
125
|
-
* The deployment's `ReleaseRegistry` object ID.
|
|
126
|
-
*
|
|
127
|
-
* Returns the configured `releaseRegistryId` with no network call. Only when
|
|
128
|
-
* it was not configured does this fall back to a GraphQL scan — a one-time
|
|
129
|
-
* bootstrap for a fresh deployment whose id you have not recorded yet. Prefer
|
|
130
|
-
* configuring it: the registry is created once in `release::init` and never
|
|
131
|
-
* changes, so scanning for it on every call is pure overhead.
|
|
132
|
-
*/
|
|
133
|
-
async getReleaseRegistry() {
|
|
134
|
-
if (this.#releaseRegistryId)
|
|
135
|
-
return this.#releaseRegistryId;
|
|
136
|
-
return queries.getReleaseRegistry(this.#requireGraphQL(), this.#misoPackageId);
|
|
137
|
-
}
|
|
138
114
|
// === Share Currency ===
|
|
139
115
|
async getShareCurrencyType(shareCurrencyId) {
|
|
140
116
|
return queries.getShareCurrencyType(this.#client, shareCurrencyId);
|
|
@@ -147,25 +123,12 @@ export class MisoClient {
|
|
|
147
123
|
async getShareCurrencyTreasuryCap(shareType, owner) {
|
|
148
124
|
return queries.getShareCurrencyTreasuryCap(this.#client, shareType, owner);
|
|
149
125
|
}
|
|
150
|
-
// === Transaction builders (thunks) ===
|
|
151
|
-
// Only the `(params) => TxThunk` builders bind here. The primitives that take
|
|
152
|
-
// a `Transaction` directly and return values (`createComposition`,
|
|
153
|
-
// `createRecording`, `createRelease`, `createDeal`) are free functions by
|
|
154
|
-
// design — they thread results into a caller-owned PTB, so there is nothing
|
|
155
|
-
// to bind. Import them from the package root and pass `misoPackageId`
|
|
156
|
-
// explicitly.
|
|
157
|
-
get tx() {
|
|
158
|
-
const miso = this.#misoPackageId;
|
|
159
|
-
return {
|
|
160
|
-
rejectDeal: bindPackages(transactions.rejectDeal, miso),
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
126
|
// === Simulate-based reads (view) ===
|
|
164
127
|
get view() {
|
|
165
128
|
const client = this.#client;
|
|
166
129
|
const misoPackageId = this.#misoPackageId;
|
|
167
130
|
return {
|
|
168
|
-
|
|
131
|
+
deriveTargetReleaseId: (params) => view.deriveTargetReleaseId(client, misoPackageId, params),
|
|
169
132
|
};
|
|
170
133
|
}
|
|
171
134
|
// === Generated type-safe Move calls (for tx.add) ===
|
|
@@ -175,7 +138,6 @@ export class MisoClient {
|
|
|
175
138
|
composition: bindModulePackage(composition, pkg),
|
|
176
139
|
recording: bindModulePackage(recording, pkg),
|
|
177
140
|
release: bindModulePackage(release, pkg),
|
|
178
|
-
deal: bindModulePackage(deal, pkg),
|
|
179
141
|
track: bindModulePackage(track, pkg),
|
|
180
142
|
};
|
|
181
143
|
}
|
|
@@ -185,15 +147,11 @@ export class MisoClient {
|
|
|
185
147
|
Composition: composition.Composition,
|
|
186
148
|
Recording: recording.Recording,
|
|
187
149
|
Release: release.Release,
|
|
188
|
-
Deal: deal.Deal,
|
|
189
150
|
Track: track.Track,
|
|
190
151
|
CompositionPublishedEvent: composition.CompositionPublishedEvent,
|
|
191
152
|
CompositionRoyaltySetEvent: composition.CompositionRoyaltySetEvent,
|
|
192
153
|
RecordingPublishedEvent: recording.RecordingPublishedEvent,
|
|
193
154
|
ReleasePublishedEvent: release.ReleasePublishedEvent,
|
|
194
|
-
DealCreatedEvent: deal.DealCreatedEvent,
|
|
195
|
-
DealAcceptedEvent: deal.DealAcceptedEvent,
|
|
196
|
-
DealRejectedEvent: deal.DealRejectedEvent,
|
|
197
155
|
};
|
|
198
156
|
}
|
|
199
157
|
// === Event parsers ===
|
|
@@ -203,9 +161,6 @@ export class MisoClient {
|
|
|
203
161
|
compositionRoyaltySetEvent: parsers.parseCompositionRoyaltySetEvent,
|
|
204
162
|
recordingPublishedEvent: parsers.parseRecordingPublishedEvent,
|
|
205
163
|
releasePublishedEvent: parsers.parseReleasePublishedEvent,
|
|
206
|
-
dealCreatedEvent: parsers.parseDealCreatedEvent,
|
|
207
|
-
dealAcceptedEvent: parsers.parseDealAcceptedEvent,
|
|
208
|
-
dealRejectedEvent: parsers.parseDealRejectedEvent,
|
|
209
164
|
};
|
|
210
165
|
}
|
|
211
166
|
#requireGraphQL() {
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAOtC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAUlC,iEAAiE;AACjE,OAAO,KAAK,WAAW,MAAM,iCAAiC,CAAC;AAC/D,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,2BAA2B,CAAC;AAgBnD,yFAAyF;AACzF,SAAS,iBAAiB,CAAmB,GAAM,EAAE,GAAW;IAC9D,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC;QACtD,GAAG,CAAC,GAAG,CAAC;YACN,OAAO,KAAK,KAAK,UAAU;gBACzB,CAAC,CAAC,CAAC,OAA6B,EAAE,EAAE,CAC/B,KAAiC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC;gBACpE,CAAC,CAAC,KAAK,CAAC;IACd,CAAC;IACD,OAAO,GAAQ,CAAC;AAClB,CAAC;A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E,OAAO,CAAC,+BAA+B;YACnE,uBAAuB,EAAE,OAAO,CAAC,4BAA4B;YAC7D,qBAAqB,EAAE,OAAO,CAAC,0BAA0B;SAC1D,CAAC;IACJ,CAAC;IAED,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -36,14 +36,22 @@
|
|
|
36
36
|
*
|
|
37
37
|
* ### Consent scope
|
|
38
38
|
*
|
|
39
|
-
* The release digest — and therefore the derived release id every `
|
|
40
|
-
* to — binds the economics and membership of the release: the ordered
|
|
41
|
-
* `(recording, split)` pairs and the creator's nonce. It deliberately
|
|
42
|
-
* nothing else. The title — the one embedded field outside the digest — and
|
|
39
|
+
* The release digest — and therefore the derived release id every `Track` commits
|
|
40
|
+
* to at creation — binds the economics and membership of the release: the ordered
|
|
41
|
+
* list of `(recording, split)` pairs and the creator's nonce. It deliberately
|
|
42
|
+
* binds nothing else. The title — the one embedded field outside the digest — and
|
|
43
43
|
* everything in the extension layer (artwork, credits, display grouping) are
|
|
44
|
-
* chosen by the release creator, before or after
|
|
45
|
-
* and publicly attributable rather than cryptographically committed. See
|
|
46
|
-
* `
|
|
44
|
+
* chosen by the release creator, before or after tracks are created, and are
|
|
45
|
+
* trusted and publicly attributable rather than cryptographically committed. See
|
|
46
|
+
* `track::new` for the signer-side statement of this boundary.
|
|
47
|
+
*
|
|
48
|
+
* The derived id commits to a `(parent, digest)` pair, not the digest alone — so
|
|
49
|
+
* targeting an id also consents to that namespace's liveness. If the parent object
|
|
50
|
+
* is deleted, or its `&mut UID` becomes permanently unreachable, the release can
|
|
51
|
+
* never exist and every track or offer targeting it is stranded — the same
|
|
52
|
+
* blast-radius class as a release that simply never publishes. A coordinator meant
|
|
53
|
+
* to serve as the default parent namespace should therefore be shared and
|
|
54
|
+
* undeletable.
|
|
47
55
|
*
|
|
48
56
|
* ### Lifecycle and trust model
|
|
49
57
|
*
|
|
@@ -62,9 +70,8 @@
|
|
|
62
70
|
* the one trust assumption that never expires: integrators should model the cap
|
|
63
71
|
* holder as able to mutate or delete any extension data, forever.
|
|
64
72
|
*/
|
|
65
|
-
import {
|
|
73
|
+
import { MoveEnum, MoveStruct, MoveTuple, type RawTransactionArgument } from '../utils/index.js';
|
|
66
74
|
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
67
|
-
export declare const RELEASE: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">], "@local-pkg/miso::release::RELEASE">;
|
|
68
75
|
/** Lifecycle state of a release. */
|
|
69
76
|
export declare const ReleaseState: MoveEnum<{
|
|
70
77
|
/** Release is initialized but not yet published. */
|
|
@@ -85,8 +92,8 @@ export declare const Release: MoveStruct<{
|
|
|
85
92
|
/** Title of the release. */
|
|
86
93
|
title: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
87
94
|
/**
|
|
88
|
-
* The ordered tracklist. Same shape as the digest pre-image every
|
|
89
|
-
* to; display grouping lives in the metadata extension.
|
|
95
|
+
* The ordered tracklist. Same shape as the digest pre-image every track's creator
|
|
96
|
+
* consented to; display grouping lives in the metadata extension.
|
|
90
97
|
*/
|
|
91
98
|
tracks: import("@mysten/sui/bcs").BcsType<{
|
|
92
99
|
state: import("@mysten/bcs").EnumOutputShapeWithKeys<{
|
|
@@ -109,9 +116,6 @@ export declare const Release: MoveStruct<{
|
|
|
109
116
|
export declare const ReleaseKey: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
|
|
110
117
|
length: number;
|
|
111
118
|
}, string>], "@local-pkg/miso::release::ReleaseKey">;
|
|
112
|
-
export declare const ReleaseRegistry: MoveStruct<{
|
|
113
|
-
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
114
|
-
}, "@local-pkg/miso::release::ReleaseRegistry">;
|
|
115
119
|
export declare const ReleaseAdminCap: MoveStruct<{
|
|
116
120
|
/** Unique identifier for this capability. */
|
|
117
121
|
id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
@@ -119,10 +123,6 @@ export declare const ReleaseAdminCap: MoveStruct<{
|
|
|
119
123
|
release_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
120
124
|
}, "@local-pkg/miso::release::ReleaseAdminCap">;
|
|
121
125
|
export declare const ReleaseAdminCapKey: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">], "@local-pkg/miso::release::ReleaseAdminCapKey">;
|
|
122
|
-
export declare const ReleaseRegistryCreatedEvent: MoveStruct<{
|
|
123
|
-
registry_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
124
|
-
created_by: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
125
|
-
}, "@local-pkg/miso::release::ReleaseRegistryCreatedEvent">;
|
|
126
126
|
export declare const ReleasePublishedEvent: MoveStruct<{
|
|
127
127
|
release_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
128
128
|
}, "@local-pkg/miso::release::ReleasePublishedEvent">;
|
|
@@ -130,7 +130,7 @@ export interface NewArguments {
|
|
|
130
130
|
title: RawTransactionArgument<string>;
|
|
131
131
|
tracks: TransactionArgument;
|
|
132
132
|
nonce: RawTransactionArgument<number | bigint>;
|
|
133
|
-
|
|
133
|
+
parent: RawTransactionArgument<string>;
|
|
134
134
|
}
|
|
135
135
|
export interface NewOptions {
|
|
136
136
|
package?: string;
|
|
@@ -138,12 +138,15 @@ export interface NewOptions {
|
|
|
138
138
|
title: RawTransactionArgument<string>,
|
|
139
139
|
tracks: TransactionArgument,
|
|
140
140
|
nonce: RawTransactionArgument<number | bigint>,
|
|
141
|
-
|
|
141
|
+
parent: RawTransactionArgument<string>
|
|
142
142
|
];
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
|
-
* Creates a new release with the given configuration.
|
|
146
|
-
*
|
|
145
|
+
* Creates a new release with the given configuration. Claims the release's UID as
|
|
146
|
+
* a derived child of `parent`, keyed by the release digest (see the module doc's
|
|
147
|
+
* "Consent scope" section) — so contention is per-parent, and which object serves
|
|
148
|
+
* as parent is entirely the caller's choice. Returns the release and admin
|
|
149
|
+
* capability.
|
|
147
150
|
*/
|
|
148
151
|
export declare function _new(options: NewOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
149
152
|
export interface PublishArguments {
|
|
@@ -178,27 +181,27 @@ export interface AuthorizeOptions {
|
|
|
178
181
|
}
|
|
179
182
|
/** Verifies that the admin capability matches this release. */
|
|
180
183
|
export declare function authorize(options: AuthorizeOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
181
|
-
export interface
|
|
184
|
+
export interface DeriveTargetReleaseIdArguments {
|
|
182
185
|
recordingIds: RawTransactionArgument<Array<string>>;
|
|
183
186
|
trackSplitValues: RawTransactionArgument<Array<number | bigint>>;
|
|
184
187
|
nonce: RawTransactionArgument<number | bigint>;
|
|
185
|
-
|
|
188
|
+
parent: RawTransactionArgument<string>;
|
|
186
189
|
}
|
|
187
|
-
export interface
|
|
190
|
+
export interface DeriveTargetReleaseIdOptions {
|
|
188
191
|
package?: string;
|
|
189
|
-
arguments:
|
|
192
|
+
arguments: DeriveTargetReleaseIdArguments | [
|
|
190
193
|
recordingIds: RawTransactionArgument<Array<string>>,
|
|
191
194
|
trackSplitValues: RawTransactionArgument<Array<number | bigint>>,
|
|
192
195
|
nonce: RawTransactionArgument<number | bigint>,
|
|
193
|
-
|
|
196
|
+
parent: RawTransactionArgument<string>
|
|
194
197
|
];
|
|
195
198
|
}
|
|
196
199
|
/**
|
|
197
|
-
* Derives the release ID that `new()` would produce for the given inputs
|
|
198
|
-
* creating the object. This is the on-chain equivalent of the
|
|
199
|
-
* `deriveReleaseId()` function.
|
|
200
|
+
* Derives the target release ID that `new()` would produce for the given inputs
|
|
201
|
+
* and parent, without creating the object. This is the on-chain equivalent of the
|
|
202
|
+
* client-side `deriveReleaseId()` function.
|
|
200
203
|
*/
|
|
201
|
-
export declare function
|
|
204
|
+
export declare function deriveTargetReleaseId(options: DeriveTargetReleaseIdOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
202
205
|
export interface IdArguments {
|
|
203
206
|
self: RawTransactionArgument<string>;
|
|
204
207
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/contracts/miso/release.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/contracts/miso/release.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAA0B,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEzH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGtF,oCAAoC;AACpC,eAAO,MAAM,YAAY;IACjB,oDAAoD;;IAEpD,0EAA0E;;4CAE1E,CAAC;AACT,eAAO,MAAM,OAAO;IACZ,0CAA0C;;IAE1C,+BAA+B;;QAR/B,oDAAoD;;QAEpD,0EAA0E;;;IAQ1E,4BAA4B;;IAE5B;;;OAGG;;;;;;;;;;;;;;;;;;uCAEH,CAAC;AACT,eAAO,MAAM,UAAU;;oDAAwF,CAAC;AAChH,eAAO,MAAM,eAAe;IACpB,6CAA6C;;IAE7C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,MAAM,CAAC;IACjB,SAAS,EAAE,YAAY,GAAG;QACtB,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACvC,CAAC;CACL;AACD,2EAA2E;AAC3E,wBAAgB,GAAG,CAAC,OAAO,EAAE,UAAU,IAM3B,IAAI,WAAW,0DAM1B;AACD,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACrC,GAAG,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;CACvC;AACD,MAAM,WAAW,aAAa;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,GAAG;QACzB,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;QACpC,GAAG,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACtC,CAAC;CACL;AACD;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,IAOjC,IAAI,WAAW,0DAM1B"}
|
|
@@ -36,14 +36,22 @@
|
|
|
36
36
|
*
|
|
37
37
|
* ### Consent scope
|
|
38
38
|
*
|
|
39
|
-
* The release digest — and therefore the derived release id every `
|
|
40
|
-
* to — binds the economics and membership of the release: the ordered
|
|
41
|
-
* `(recording, split)` pairs and the creator's nonce. It deliberately
|
|
42
|
-
* nothing else. The title — the one embedded field outside the digest — and
|
|
39
|
+
* The release digest — and therefore the derived release id every `Track` commits
|
|
40
|
+
* to at creation — binds the economics and membership of the release: the ordered
|
|
41
|
+
* list of `(recording, split)` pairs and the creator's nonce. It deliberately
|
|
42
|
+
* binds nothing else. The title — the one embedded field outside the digest — and
|
|
43
43
|
* everything in the extension layer (artwork, credits, display grouping) are
|
|
44
|
-
* chosen by the release creator, before or after
|
|
45
|
-
* and publicly attributable rather than cryptographically committed. See
|
|
46
|
-
* `
|
|
44
|
+
* chosen by the release creator, before or after tracks are created, and are
|
|
45
|
+
* trusted and publicly attributable rather than cryptographically committed. See
|
|
46
|
+
* `track::new` for the signer-side statement of this boundary.
|
|
47
|
+
*
|
|
48
|
+
* The derived id commits to a `(parent, digest)` pair, not the digest alone — so
|
|
49
|
+
* targeting an id also consents to that namespace's liveness. If the parent object
|
|
50
|
+
* is deleted, or its `&mut UID` becomes permanently unreachable, the release can
|
|
51
|
+
* never exist and every track or offer targeting it is stranded — the same
|
|
52
|
+
* blast-radius class as a release that simply never publishes. A coordinator meant
|
|
53
|
+
* to serve as the default parent namespace should therefore be shared and
|
|
54
|
+
* undeletable.
|
|
47
55
|
*
|
|
48
56
|
* ### Lifecycle and trust model
|
|
49
57
|
*
|
|
@@ -62,12 +70,11 @@
|
|
|
62
70
|
* the one trust assumption that never expires: integrators should model the cap
|
|
63
71
|
* holder as able to mutate or delete any extension data, forever.
|
|
64
72
|
*/
|
|
65
|
-
import {
|
|
73
|
+
import { MoveEnum, MoveStruct, MoveTuple, normalizeMoveArguments } from '../utils/index.js';
|
|
66
74
|
import { bcs } from '@mysten/sui/bcs';
|
|
67
75
|
import {} from '@mysten/sui/transactions';
|
|
68
76
|
import * as track from './track.js';
|
|
69
77
|
const $moduleName = '@local-pkg/miso::release';
|
|
70
|
-
export const RELEASE = new MoveTuple({ name: `${$moduleName}::RELEASE`, fields: [bcs.bool()] });
|
|
71
78
|
/** Lifecycle state of a release. */
|
|
72
79
|
export const ReleaseState = new MoveEnum({ name: `${$moduleName}::ReleaseState`, fields: {
|
|
73
80
|
/** Release is initialized but not yet published. */
|
|
@@ -83,15 +90,12 @@ export const Release = new MoveStruct({ name: `${$moduleName}::Release`, fields:
|
|
|
83
90
|
/** Title of the release. */
|
|
84
91
|
title: bcs.string(),
|
|
85
92
|
/**
|
|
86
|
-
* The ordered tracklist. Same shape as the digest pre-image every
|
|
87
|
-
* to; display grouping lives in the metadata extension.
|
|
93
|
+
* The ordered tracklist. Same shape as the digest pre-image every track's creator
|
|
94
|
+
* consented to; display grouping lives in the metadata extension.
|
|
88
95
|
*/
|
|
89
96
|
tracks: bcs.vector(track.Track)
|
|
90
97
|
} });
|
|
91
98
|
export const ReleaseKey = new MoveTuple({ name: `${$moduleName}::ReleaseKey`, fields: [bcs.vector(bcs.u8())] });
|
|
92
|
-
export const ReleaseRegistry = new MoveStruct({ name: `${$moduleName}::ReleaseRegistry`, fields: {
|
|
93
|
-
id: bcs.Address
|
|
94
|
-
} });
|
|
95
99
|
export const ReleaseAdminCap = new MoveStruct({ name: `${$moduleName}::ReleaseAdminCap`, fields: {
|
|
96
100
|
/** Unique identifier for this capability. */
|
|
97
101
|
id: bcs.Address,
|
|
@@ -99,16 +103,15 @@ export const ReleaseAdminCap = new MoveStruct({ name: `${$moduleName}::ReleaseAd
|
|
|
99
103
|
release_id: bcs.Address
|
|
100
104
|
} });
|
|
101
105
|
export const ReleaseAdminCapKey = new MoveTuple({ name: `${$moduleName}::ReleaseAdminCapKey`, fields: [bcs.bool()] });
|
|
102
|
-
export const ReleaseRegistryCreatedEvent = new MoveStruct({ name: `${$moduleName}::ReleaseRegistryCreatedEvent`, fields: {
|
|
103
|
-
registry_id: bcs.Address,
|
|
104
|
-
created_by: bcs.Address
|
|
105
|
-
} });
|
|
106
106
|
export const ReleasePublishedEvent = new MoveStruct({ name: `${$moduleName}::ReleasePublishedEvent`, fields: {
|
|
107
107
|
release_id: bcs.Address
|
|
108
108
|
} });
|
|
109
109
|
/**
|
|
110
|
-
* Creates a new release with the given configuration.
|
|
111
|
-
*
|
|
110
|
+
* Creates a new release with the given configuration. Claims the release's UID as
|
|
111
|
+
* a derived child of `parent`, keyed by the release digest (see the module doc's
|
|
112
|
+
* "Consent scope" section) — so contention is per-parent, and which object serves
|
|
113
|
+
* as parent is entirely the caller's choice. Returns the release and admin
|
|
114
|
+
* capability.
|
|
112
115
|
*/
|
|
113
116
|
export function _new(options) {
|
|
114
117
|
const packageAddress = options.package ?? '@local-pkg/miso';
|
|
@@ -116,9 +119,9 @@ export function _new(options) {
|
|
|
116
119
|
'0x1::string::String',
|
|
117
120
|
'vector<null>',
|
|
118
121
|
'u256',
|
|
119
|
-
|
|
122
|
+
'0x2::object::ID'
|
|
120
123
|
];
|
|
121
|
-
const parameterNames = ["title", "tracks", "nonce", "
|
|
124
|
+
const parameterNames = ["title", "tracks", "nonce", "parent"];
|
|
122
125
|
return (tx) => tx.moveCall({
|
|
123
126
|
package: packageAddress,
|
|
124
127
|
module: 'release',
|
|
@@ -164,23 +167,23 @@ export function authorize(options) {
|
|
|
164
167
|
});
|
|
165
168
|
}
|
|
166
169
|
/**
|
|
167
|
-
* Derives the release ID that `new()` would produce for the given inputs
|
|
168
|
-
* creating the object. This is the on-chain equivalent of the
|
|
169
|
-
* `deriveReleaseId()` function.
|
|
170
|
+
* Derives the target release ID that `new()` would produce for the given inputs
|
|
171
|
+
* and parent, without creating the object. This is the on-chain equivalent of the
|
|
172
|
+
* client-side `deriveReleaseId()` function.
|
|
170
173
|
*/
|
|
171
|
-
export function
|
|
174
|
+
export function deriveTargetReleaseId(options) {
|
|
172
175
|
const packageAddress = options.package ?? '@local-pkg/miso';
|
|
173
176
|
const argumentsTypes = [
|
|
174
177
|
'vector<0x2::object::ID>',
|
|
175
178
|
'vector<u64>',
|
|
176
179
|
'u256',
|
|
177
|
-
|
|
180
|
+
'0x2::object::ID'
|
|
178
181
|
];
|
|
179
|
-
const parameterNames = ["recordingIds", "trackSplitValues", "nonce", "
|
|
182
|
+
const parameterNames = ["recordingIds", "trackSplitValues", "nonce", "parent"];
|
|
180
183
|
return (tx) => tx.moveCall({
|
|
181
184
|
package: packageAddress,
|
|
182
185
|
module: 'release',
|
|
183
|
-
function: '
|
|
186
|
+
function: 'derive_target_release_id',
|
|
184
187
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
185
188
|
});
|
|
186
189
|
}
|