@misofm/sdk 0.5.0 → 0.7.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 +13 -9
- package/dist/client.d.ts +17 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +22 -3
- package/dist/client.js.map +1 -1
- package/dist/contracts/release_registry/release_registry.d.ts +114 -0
- package/dist/contracts/release_registry/release_registry.d.ts.map +1 -0
- package/dist/contracts/release_registry/release_registry.js +119 -0
- package/dist/contracts/release_registry/release_registry.js.map +1 -0
- package/dist/contracts/royalty_pool/pool.d.ts +28 -2
- package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/pool.js +28 -2
- package/dist/contracts/royalty_pool/pool.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 +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +4 -1
- package/dist/contracts.js.map +1 -1
- package/dist/cover.d.ts +3 -6
- package/dist/cover.d.ts.map +1 -1
- package/dist/cover.js +7 -16
- package/dist/cover.js.map +1 -1
- package/dist/credits.d.ts.map +1 -1
- package/dist/credits.js +17 -43
- package/dist/credits.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/read/catalog.d.ts +2 -12
- package/dist/read/catalog.d.ts.map +1 -1
- package/dist/read/catalog.js +9 -24
- package/dist/read/catalog.js.map +1 -1
- package/dist/read/config.d.ts +3 -8
- package/dist/read/config.d.ts.map +1 -1
- package/dist/read/config.js +15 -50
- package/dist/read/config.js.map +1 -1
- package/dist/read/index.d.ts +1 -1
- package/dist/read/index.d.ts.map +1 -1
- package/dist/read/index.js +1 -1
- package/dist/read/index.js.map +1 -1
- package/dist/read/types.d.ts +10 -1
- package/dist/read/types.d.ts.map +1 -1
- package/dist/read/wallet.d.ts +13 -8
- package/dist/read/wallet.d.ts.map +1 -1
- package/dist/read/wallet.js +39 -38
- package/dist/read/wallet.js.map +1 -1
- package/dist/read/works.d.ts +2 -5
- package/dist/read/works.d.ts.map +1 -1
- package/dist/read/works.js +7 -37
- package/dist/read/works.js.map +1 -1
- package/dist/release-graph.d.ts +6 -19
- package/dist/release-graph.d.ts.map +1 -1
- package/dist/release-graph.js +29 -43
- package/dist/release-graph.js.map +1 -1
- package/dist/transactions.d.ts +12 -28
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js +23 -28
- package/dist/transactions.js.map +1 -1
- package/package.json +4 -4
- package/src/client.ts +33 -2
- package/src/contracts/release_registry/release_registry.ts +160 -0
- package/src/contracts/royalty_pool/pool.ts +28 -2
- package/src/contracts/utils/index.ts +156 -4
- package/src/contracts.ts +5 -1
- package/src/cover.ts +8 -19
- package/src/credits.ts +23 -63
- package/src/index.ts +3 -1
- package/src/read/catalog.ts +9 -29
- package/src/read/config.ts +18 -58
- package/src/read/index.ts +1 -1
- package/src/read/types.ts +11 -1
- package/src/read/wallet.ts +56 -38
- package/src/read/works.ts +5 -42
- package/src/release-graph.ts +40 -75
- package/src/transactions.ts +33 -62
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAE,WAAW,EAAE,KAAK,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAIL,KAAK,gBAAgB,EAGrB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,OAAO,EACb,MAAM,kBAAkB,CAAC;AAK1B,UAAU,YAAY;IACpB,OAAO,EAAE,yBAAyB,CAAC;IACnC,QAAQ,EAAE,yBAAy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AAG;QAAE,eAAe,EAAE,cAAc,EAAE,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9F,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,oCAAoC,GAAG,OAAO,CA2CpG;AAMD,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAGpF;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wEAAwE;IACxE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mFAAmF;IACnF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,gFAAgF;IAChF,wBAAwB,EAAE,MAAM,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAUD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CA2BpE"}
|
package/dist/transactions.js
CHANGED
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
// (`createComposition`/`createRecording`) — dispersing it to recipients via
|
|
15
15
|
// minato, publishing (sharing) the work, and transferring its admin cap is
|
|
16
16
|
// an opinion about economics;
|
|
17
|
-
// - minting a release is
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
17
|
+
// - minting a release is a platform primitive: core's `release::new` takes an
|
|
18
|
+
// unconstructible PTB `&mut UID`, so `release_registry::new_release` is the
|
|
19
|
+
// canonical client path. Choosing a track-assembly strategy, publishing
|
|
20
|
+
// (sharing) it, and picking a recipient for its `ReleaseAdminCap` is the
|
|
21
|
+
// opinion, so `finalizeRelease` / `publishRelease` live here.
|
|
21
22
|
//
|
|
22
23
|
// Every `finalize*` here MUST run in the same PTB as the `create*` that produced
|
|
23
24
|
// its parts — `Composition`, `Recording`, and `Release` are all `key`-only with
|
|
@@ -28,8 +29,9 @@
|
|
|
28
29
|
// Composes with `@misonetwork/sdk`'s calls in the same PTB (the
|
|
29
30
|
// transaction-thunk composition pattern, just crossing a package boundary now).
|
|
30
31
|
import { Transaction } from "@mysten/sui/transactions";
|
|
31
|
-
import { contracts, createComposition, createRecording,
|
|
32
|
-
|
|
32
|
+
import { contracts, createComposition, createRecording, } from "@misonetwork/sdk";
|
|
33
|
+
import * as releaseRegistry from "./contracts/release_registry/release_registry.js";
|
|
34
|
+
const { track, release } = contracts;
|
|
33
35
|
/**
|
|
34
36
|
* Splits a share `Balance` across `recipients` via `minato::disperse_balance`, then
|
|
35
37
|
* destroys the emptied balance. Exposed for consumers assembling custom share
|
|
@@ -185,7 +187,8 @@ export function publishCompositionAndRecording(params) {
|
|
|
185
187
|
* The opinionated finish for a release: publish (share) it and transfer its
|
|
186
188
|
* admin cap to `adminAddress`.
|
|
187
189
|
*
|
|
188
|
-
* MUST run in the same PTB as the `
|
|
190
|
+
* MUST run in the same PTB as the `release_registry::new_release` that produced
|
|
191
|
+
* these parts —
|
|
189
192
|
* `Release` is `key`-only with no `drop`, so an unpublished release cannot
|
|
190
193
|
* outlive its transaction. Splitting create from finalize is what lets a caller
|
|
191
194
|
* do something else with the cap (route it to a vault, hand it to another
|
|
@@ -200,37 +203,29 @@ function buildTrackVec(tx, misoPackageId, trackArgs) {
|
|
|
200
203
|
}
|
|
201
204
|
/**
|
|
202
205
|
* Convenience: publish a release end-to-end, assembling its tracklist from
|
|
203
|
-
* recording admin caps held by the sender
|
|
206
|
+
* recording admin caps held by the sender.
|
|
204
207
|
*/
|
|
205
208
|
export function publishRelease(params) {
|
|
206
209
|
return (tx) => {
|
|
207
|
-
const { misoPackageId } = params;
|
|
210
|
+
const { misoPackageId, releaseRegistryPackageId } = params;
|
|
208
211
|
const trackArgs = params.tracks.map((t) => {
|
|
209
212
|
const typeArguments = [t.recordingShareType, t.compositionShareType];
|
|
210
|
-
|
|
213
|
+
return tx.add(track._new({
|
|
211
214
|
package: misoPackageId,
|
|
212
215
|
typeArguments,
|
|
213
216
|
arguments: [tx.object(t.recordingAdminCapId), tx.object(t.recordingId), tx.pure.id(params.releaseId), tx.pure.u16(t.splitBps)],
|
|
214
217
|
}));
|
|
215
|
-
return tx.add(track._new({ package: misoPackageId, typeArguments, arguments: [dealArg, tx.object(t.recordingId)] }));
|
|
216
218
|
});
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const { misoPackageId } = params;
|
|
228
|
-
const trackArgs = params.deals.map((dl) => tx.add(track._new({
|
|
229
|
-
package: misoPackageId,
|
|
230
|
-
typeArguments: [dl.recordingShareType, dl.compositionShareType],
|
|
231
|
-
arguments: [tx.object(dl.dealId), tx.object(dl.recordingId)],
|
|
232
|
-
})));
|
|
233
|
-
const parts = createRelease(tx, { title: params.title, nonce: params.releaseNonce, releaseRegistryId: params.releaseRegistryId, misoPackageId }, buildTrackVec(tx, misoPackageId, trackArgs));
|
|
219
|
+
const created = tx.add(releaseRegistry.newRelease({
|
|
220
|
+
package: releaseRegistryPackageId,
|
|
221
|
+
arguments: [
|
|
222
|
+
tx.object(params.releaseRegistryId),
|
|
223
|
+
tx.pure.string(params.title),
|
|
224
|
+
buildTrackVec(tx, misoPackageId, trackArgs),
|
|
225
|
+
tx.pure.u256(BigInt(params.releaseNonce)),
|
|
226
|
+
],
|
|
227
|
+
}));
|
|
228
|
+
const parts = { release: created[0], adminCap: created[1] };
|
|
234
229
|
finalizeRelease(tx, { ...parts, adminAddress: params.adminAddress, misoPackageId });
|
|
235
230
|
};
|
|
236
231
|
}
|
package/dist/transactions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,6EAA6E;AAC7E,sEAAsE;AACtE,8EAA8E;AAC9E,wBAAwB;AACxB,EAAE;AACF,+EAA+E;AAC/E,uEAAuE;AACvE,sEAAsE;AACtE,uCAAuC;AACvC,EAAE;AACF,4DAA4D;AAC5D,gFAAgF;AAChF,+EAA+E;AAC/E,kCAAkC;AAClC
|
|
1
|
+
{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,sCAAsC;AAEtC,6EAA6E;AAC7E,sEAAsE;AACtE,8EAA8E;AAC9E,wBAAwB;AACxB,EAAE;AACF,+EAA+E;AAC/E,uEAAuE;AACvE,sEAAsE;AACtE,uCAAuC;AACvC,EAAE;AACF,4DAA4D;AAC5D,gFAAgF;AAChF,+EAA+E;AAC/E,kCAAkC;AAClC,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,6EAA6E;AAC7E,kEAAkE;AAClE,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,8EAA8E;AAC9E,8EAA8E;AAC9E,YAAY;AACZ,EAAE;AACF,gEAAgE;AAChE,gFAAgF;AAEhF,OAAO,EAAE,WAAW,EAAkC,MAAM,0BAA0B,CAAC;AACvF,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,GAOhB,MAA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AAC,GAAG,CACpB,eAAe,CAAC,UAAU,CAAC;YACzB,OAAO,EAAE,wBAAwB;YACjC,SAAS,EAAE;gBACT,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;gBACnC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;gBAC5B,aAAa,CAAC,EAAE,EAAE,aAAa,EAAE,SAAS,CAAC;gBAC3C,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;aAC1C;SACF,CAAC,CACH,CAAC;QACF,MAAM,KAAK,GAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAE,EAAE,CAAC;QAC5E,eAAe,CAAC,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC;IACtF,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@misofm/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Complete client SDK for the Miso platform on Sui \u2014 high-level reads, pressings, listings, records, and work publishing.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"package.json"
|
|
103
103
|
],
|
|
104
104
|
"scripts": {
|
|
105
|
-
"codegen": "sui-codegen generate",
|
|
105
|
+
"codegen": "sui-ts-codegen generate",
|
|
106
106
|
"typecheck": "tsc --noEmit",
|
|
107
107
|
"test": "bun test",
|
|
108
108
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -121,8 +121,8 @@
|
|
|
121
121
|
"typescript": "^5"
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
|
-
"@misonetwork/miso-party": "^0.
|
|
125
|
-
"@misonetwork/sdk": "^0.
|
|
124
|
+
"@misonetwork/miso-party": "^0.2.0",
|
|
125
|
+
"@misonetwork/sdk": "^0.5.0"
|
|
126
126
|
},
|
|
127
127
|
"main": "./dist/index.js"
|
|
128
128
|
}
|
package/src/client.ts
CHANGED
|
@@ -31,6 +31,7 @@ import type { Signer } from "@mysten/sui/cryptography";
|
|
|
31
31
|
|
|
32
32
|
import * as listingContract from "./contracts/miso_pressing/listing.ts";
|
|
33
33
|
import * as pressingContract from "./contracts/miso_pressing/pressing.ts";
|
|
34
|
+
import * as releaseRegistry from "./contracts/release_registry/release_registry.ts";
|
|
34
35
|
import {
|
|
35
36
|
buyRecord,
|
|
36
37
|
deriveListingId,
|
|
@@ -63,12 +64,14 @@ import {
|
|
|
63
64
|
publishComposition,
|
|
64
65
|
publishRecording,
|
|
65
66
|
publishCompositionAndRecording,
|
|
67
|
+
publishRelease,
|
|
66
68
|
} from "./transactions.ts";
|
|
67
69
|
import type {
|
|
68
70
|
TxThunk,
|
|
69
71
|
PublishCompositionParams,
|
|
70
72
|
PublishRecordingParams,
|
|
71
73
|
PublishCompositionAndRecordingParams,
|
|
74
|
+
PublishReleaseParams,
|
|
72
75
|
} from "./transactions.ts";
|
|
73
76
|
import * as share from "./share.ts";
|
|
74
77
|
|
|
@@ -93,6 +96,10 @@ export interface MisoPlatformConfig {
|
|
|
93
96
|
* builders (they disperse shares via minato).
|
|
94
97
|
*/
|
|
95
98
|
minatoPackageId?: string;
|
|
99
|
+
/** The published `release_registry` extension package used to mint releases. */
|
|
100
|
+
releaseRegistryPackageId?: string;
|
|
101
|
+
/** The one shared `ReleaseRegistry` object created by that package's `init`. */
|
|
102
|
+
releaseRegistryId?: string;
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
/** Params with the ids this client already knows dropped from the call site. */
|
|
@@ -101,6 +108,9 @@ type Configured<T> = Omit<T, "misoPressingPackageId" | "settingsId">;
|
|
|
101
108
|
/** Publish-builder params with the protocol/minato ids this client already knows dropped. */
|
|
102
109
|
type ConfiguredPublish<T> = Omit<T, "misoPackageId" | "minatoPackageId">;
|
|
103
110
|
|
|
111
|
+
/** Release-builder params with this client's core, share, and registry ids dropped. */
|
|
112
|
+
type ConfiguredRelease<T> = Omit<T, "misoPackageId" | "minatoPackageId" | "releaseRegistryPackageId" | "releaseRegistryId">;
|
|
113
|
+
|
|
104
114
|
export class MisoPlatformClient {
|
|
105
115
|
readonly #client: ClientWithCoreApi;
|
|
106
116
|
readonly #config: MisoPlatformConfig;
|
|
@@ -129,7 +139,7 @@ export class MisoPlatformClient {
|
|
|
129
139
|
if (!misoPackageId) {
|
|
130
140
|
throw new Error(
|
|
131
141
|
"misoPlatform: `misoPackageId` is required for the publish builders " +
|
|
132
|
-
"(publishComposition, publishRecording, publishCompositionAndRecording) — pass it to misoPlatform({ misoPackageId }).",
|
|
142
|
+
"(publishComposition, publishRecording, publishCompositionAndRecording, publishRelease) — pass it to misoPlatform({ misoPackageId }).",
|
|
133
143
|
);
|
|
134
144
|
}
|
|
135
145
|
return misoPackageId;
|
|
@@ -146,6 +156,16 @@ export class MisoPlatformClient {
|
|
|
146
156
|
return minatoPackageId;
|
|
147
157
|
}
|
|
148
158
|
|
|
159
|
+
#releaseRegistry(): { packageId: string; id: string } {
|
|
160
|
+
const { releaseRegistryPackageId: packageId, releaseRegistryId: id } = this.#config;
|
|
161
|
+
if (!packageId || !id) {
|
|
162
|
+
throw new Error(
|
|
163
|
+
"misoPlatform: `releaseRegistryPackageId` and `releaseRegistryId` are required to build a release — pass both to misoPlatform(...).",
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return { packageId, id };
|
|
167
|
+
}
|
|
168
|
+
|
|
149
169
|
// ── Reads ─────────────────────────────────────────────────────────────────
|
|
150
170
|
|
|
151
171
|
/** The run itself, or `null` if this release has never opened one. */
|
|
@@ -211,6 +231,15 @@ export class MisoPlatformClient {
|
|
|
211
231
|
publishRecording({ ...p, misoPackageId: this.#misoPackageId(), minatoPackageId: this.#minatoPackageId() }),
|
|
212
232
|
publishCompositionAndRecording: (p: ConfiguredPublish<PublishCompositionAndRecordingParams>): TxThunk =>
|
|
213
233
|
publishCompositionAndRecording({ ...p, misoPackageId: this.#misoPackageId(), minatoPackageId: this.#minatoPackageId() }),
|
|
234
|
+
publishRelease: (p: ConfiguredRelease<PublishReleaseParams>): TxThunk => {
|
|
235
|
+
const registry = this.#releaseRegistry();
|
|
236
|
+
return publishRelease({
|
|
237
|
+
...p,
|
|
238
|
+
misoPackageId: this.#misoPackageId(),
|
|
239
|
+
releaseRegistryPackageId: registry.packageId,
|
|
240
|
+
releaseRegistryId: registry.id,
|
|
241
|
+
});
|
|
242
|
+
},
|
|
214
243
|
};
|
|
215
244
|
|
|
216
245
|
// ── Share currency provisioning (executes; Signer pattern) ─────────────────
|
|
@@ -223,7 +252,7 @@ export class MisoPlatformClient {
|
|
|
223
252
|
// ── Generated layer ───────────────────────────────────────────────────────
|
|
224
253
|
|
|
225
254
|
/** Generated Move-call bindings, for commands this facade doesn't wrap. */
|
|
226
|
-
readonly call = { listing: listingContract, pressing: pressingContract };
|
|
255
|
+
readonly call = { listing: listingContract, pressing: pressingContract, releaseRegistry };
|
|
227
256
|
|
|
228
257
|
/** Generated BCS definitions, for parsing objects or events yourself. */
|
|
229
258
|
readonly bcs = {
|
|
@@ -231,6 +260,8 @@ export class MisoPlatformClient {
|
|
|
231
260
|
PressingAdminCap: pressingContract.PressingAdminCap,
|
|
232
261
|
Listing: listingContract.Listing,
|
|
233
262
|
Price: listingContract.Price,
|
|
263
|
+
ReleaseRegistry: releaseRegistry.ReleaseRegistry,
|
|
264
|
+
ReleaseRegistryCreatedEvent: releaseRegistry.ReleaseRegistryCreatedEvent,
|
|
234
265
|
};
|
|
235
266
|
}
|
|
236
267
|
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The recommended canonical parent namespace for `miso::release::new`.
|
|
8
|
+
*
|
|
9
|
+
* `miso::release::new` takes `parent: &mut UID` and derives every release's id
|
|
10
|
+
* from `(parent, digest)`: core is deliberately parent-agnostic and implements no
|
|
11
|
+
* coordination policy of its own (see the "Consent scope" section of
|
|
12
|
+
* `miso::release`'s module doc). This package supplies the one recommended parent
|
|
13
|
+
* — a shared, permissionless, undeletable `UID` — and is deliberately the _only_
|
|
14
|
+
* policy it implements: it neither gates who may assemble a release through it nor
|
|
15
|
+
* interprets what a `Track` means.
|
|
16
|
+
*
|
|
17
|
+
* ### One instance, ever
|
|
18
|
+
*
|
|
19
|
+
* The module exposes no constructor: the only `ReleaseRegistry` that can ever
|
|
20
|
+
* exist is the canonical one created and shared by package initialization. "The
|
|
21
|
+
* registry" is therefore unambiguous on-chain — the type itself names the
|
|
22
|
+
* namespace, not a config convention. Every `new_release` takes `&mut` on that one
|
|
23
|
+
* shared object, so release creation through it serializes per checkpoint; the
|
|
24
|
+
* ceiling is accepted — releases are rare events. Alternative namespaces are still
|
|
25
|
+
* possible, but they live in other packages: core is parent-agnostic, and any
|
|
26
|
+
* object exposing a `&mut UID` (a release escrow, for instance) can parent its own
|
|
27
|
+
* releases; ids derived under different parents never collide, by construction of
|
|
28
|
+
* `derive_address`.
|
|
29
|
+
*
|
|
30
|
+
* ### Liveness
|
|
31
|
+
*
|
|
32
|
+
* The canonical instance is shared at publish, and this module exposes no delete
|
|
33
|
+
* function and no `uid_mut`: its only capability is being a derivation parent.
|
|
34
|
+
* That undeletability is a consent guarantee, not an accident — a `Track`'s
|
|
35
|
+
* `target_release_id` commits to this namespace's liveness (see `miso::release`'s
|
|
36
|
+
* module doc), and a deletable parent would strand every track and offer that ever
|
|
37
|
+
* targeted it. Keeping the surface to exactly one capability is what makes that
|
|
38
|
+
* guarantee durable: there is nothing else here to reason about.
|
|
39
|
+
*
|
|
40
|
+
* ### Permissionless
|
|
41
|
+
*
|
|
42
|
+
* No capability gates `new_release`: anyone holding a fully-formed `vector<Track>`
|
|
43
|
+
* may assemble and claim a release through this registry. That is not a gap —
|
|
44
|
+
* consent already lives in the `Track`s themselves, each one minted by its
|
|
45
|
+
* recording's admin via cap-gated `miso::track::new` against this exact digest.
|
|
46
|
+
* Assembly is bookkeeping over consent already given, not a second authorization
|
|
47
|
+
* step.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
51
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
52
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
53
|
+
const $moduleName = '@local-pkg/release_registry::release_registry';
|
|
54
|
+
export const ReleaseRegistry = new MoveStruct({ name: `${$moduleName}::ReleaseRegistry`, fields: {
|
|
55
|
+
id: bcs.Address
|
|
56
|
+
} });
|
|
57
|
+
export const ReleaseRegistryCreatedEvent = new MoveStruct({ name: `${$moduleName}::ReleaseRegistryCreatedEvent`, fields: {
|
|
58
|
+
registry_id: bcs.Address,
|
|
59
|
+
created_by: bcs.Address
|
|
60
|
+
} });
|
|
61
|
+
export interface NewReleaseArguments {
|
|
62
|
+
self: RawTransactionArgument<string>;
|
|
63
|
+
title: RawTransactionArgument<string>;
|
|
64
|
+
tracks: TransactionArgument;
|
|
65
|
+
nonce: RawTransactionArgument<number | bigint>;
|
|
66
|
+
}
|
|
67
|
+
export interface NewReleaseOptions {
|
|
68
|
+
package?: string;
|
|
69
|
+
arguments: NewReleaseArguments | [
|
|
70
|
+
self: RawTransactionArgument<string>,
|
|
71
|
+
title: RawTransactionArgument<string>,
|
|
72
|
+
tracks: TransactionArgument,
|
|
73
|
+
nonce: RawTransactionArgument<number | bigint>
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Assembles a release by delegating to `miso::release::new` with this registry as
|
|
78
|
+
* parent. Returns the `(Release, ReleaseAdminCap)` pair rather than transferring
|
|
79
|
+
* or sharing either: the release is not on-chain-final until `release::publish`
|
|
80
|
+
* consumes it by value — typically later in the same PTB — and where the cap ends
|
|
81
|
+
* up is the caller's decision, not this function's.
|
|
82
|
+
*/
|
|
83
|
+
export function newRelease(options: NewReleaseOptions) {
|
|
84
|
+
const packageAddress = options.package ?? '@local-pkg/release_registry';
|
|
85
|
+
const argumentsTypes = [
|
|
86
|
+
null,
|
|
87
|
+
'0x1::string::String',
|
|
88
|
+
'vector<null>',
|
|
89
|
+
'u256'
|
|
90
|
+
] satisfies (string | null)[];
|
|
91
|
+
const parameterNames = ["self", "title", "tracks", "nonce"];
|
|
92
|
+
return (tx: Transaction) => tx.moveCall({
|
|
93
|
+
package: packageAddress,
|
|
94
|
+
module: 'release_registry',
|
|
95
|
+
function: 'new_release',
|
|
96
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export interface DeriveTargetReleaseIdArguments {
|
|
100
|
+
self: RawTransactionArgument<string>;
|
|
101
|
+
recordingIds: RawTransactionArgument<Array<string>>;
|
|
102
|
+
trackSplitValues: RawTransactionArgument<Array<number | bigint>>;
|
|
103
|
+
nonce: RawTransactionArgument<number | bigint>;
|
|
104
|
+
}
|
|
105
|
+
export interface DeriveTargetReleaseIdOptions {
|
|
106
|
+
package?: string;
|
|
107
|
+
arguments: DeriveTargetReleaseIdArguments | [
|
|
108
|
+
self: RawTransactionArgument<string>,
|
|
109
|
+
recordingIds: RawTransactionArgument<Array<string>>,
|
|
110
|
+
trackSplitValues: RawTransactionArgument<Array<number | bigint>>,
|
|
111
|
+
nonce: RawTransactionArgument<number | bigint>
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Derives the release id `new_release` would produce for the given inputs under
|
|
116
|
+
* this registry, without creating anything. Delegates to
|
|
117
|
+
* `miso::release::derive_target_release_id` with this registry's own id as parent.
|
|
118
|
+
*/
|
|
119
|
+
export function deriveTargetReleaseId(options: DeriveTargetReleaseIdOptions) {
|
|
120
|
+
const packageAddress = options.package ?? '@local-pkg/release_registry';
|
|
121
|
+
const argumentsTypes = [
|
|
122
|
+
null,
|
|
123
|
+
'vector<0x2::object::ID>',
|
|
124
|
+
'vector<u64>',
|
|
125
|
+
'u256'
|
|
126
|
+
] satisfies (string | null)[];
|
|
127
|
+
const parameterNames = ["self", "recordingIds", "trackSplitValues", "nonce"];
|
|
128
|
+
return (tx: Transaction) => tx.moveCall({
|
|
129
|
+
package: packageAddress,
|
|
130
|
+
module: 'release_registry',
|
|
131
|
+
function: 'derive_target_release_id',
|
|
132
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
export interface IdArguments {
|
|
136
|
+
self: RawTransactionArgument<string>;
|
|
137
|
+
}
|
|
138
|
+
export interface IdOptions {
|
|
139
|
+
package?: string;
|
|
140
|
+
arguments: IdArguments | [
|
|
141
|
+
self: RawTransactionArgument<string>
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Returns the registry's object id — the derivation parent that
|
|
146
|
+
* `derive_target_release_id` and `new_release` both commit to.
|
|
147
|
+
*/
|
|
148
|
+
export function id(options: IdOptions) {
|
|
149
|
+
const packageAddress = options.package ?? '@local-pkg/release_registry';
|
|
150
|
+
const argumentsTypes = [
|
|
151
|
+
null
|
|
152
|
+
] satisfies (string | null)[];
|
|
153
|
+
const parameterNames = ["self"];
|
|
154
|
+
return (tx: Transaction) => tx.moveCall({
|
|
155
|
+
package: packageAddress,
|
|
156
|
+
module: 'release_registry',
|
|
157
|
+
function: 'id',
|
|
158
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Accumulator-based royalty distribution pool for the protocol's share tokens.
|
|
8
8
|
*
|
|
9
9
|
* A `RoyaltyPool<Share, Currency>` is a derived object of any UID-bearing parent.
|
|
10
10
|
* Its address is deterministically derived from `(parent_id, Currency)` — at most
|
|
@@ -21,7 +21,33 @@
|
|
|
21
21
|
* transfers or balances credited to the pool's funds-accumulator. Both are
|
|
22
22
|
* permissionless: anyone who notices stuck funds can fold them in. The canonical
|
|
23
23
|
* funding path remains `deposit(balance)` from a higher-layer extension (e.g.
|
|
24
|
-
* `composition_royalty_distributor`) that pulls from the parent's address.
|
|
24
|
+
* `composition_royalty_distributor`) that pulls from the parent's address. Note
|
|
25
|
+
* the recovery valves run through `deposit`, which aborts while no shares are
|
|
26
|
+
* staked — and the pool has no other withdrawal path — so funds sent to the pool's
|
|
27
|
+
* address before the first registration stay locked until a stake registers.
|
|
28
|
+
* Payers should always target the parent's address, never the pool's.
|
|
29
|
+
*
|
|
30
|
+
* ### No activation delay (deliberate)
|
|
31
|
+
*
|
|
32
|
+
* Registration earns from the next deposit onward; there is no bonding or
|
|
33
|
+
* unbonding period (contrast Sui native staking's next-epoch activation). With the
|
|
34
|
+
* protocol's fixed-supply share token this is safe: a stake's take of any deposit
|
|
35
|
+
* is `v · s / S` with `S` (total registered) bounded by the share supply, so a
|
|
36
|
+
* continuously registered stake is guaranteed at least its pro-rata share of total
|
|
37
|
+
* supply on every deposit. Short-lived or just-in-time registrations can only
|
|
38
|
+
* compete for the _unregistered_ supply's drift — the designed incentive for being
|
|
39
|
+
* registered — never below any registered stake's floor.
|
|
40
|
+
*
|
|
41
|
+
* ### Precision
|
|
42
|
+
*
|
|
43
|
+
* The share token's shape is fixed at issuance by the protocol — exactly 10¹³ base
|
|
44
|
+
* units, 6 decimals, supply made immutable via `miso_share::share::initialize`
|
|
45
|
+
* (`make_supply_fixed`) — so `staked_shares ≤ 10¹³` objectively. A deposit of
|
|
46
|
+
* `value ≥ 1` base units therefore advances the accumulator by
|
|
47
|
+
* `value · PRECISION / staked_shares ≥ 10¹⁸ / 10¹³ = 10⁵`: the truncation-to-zero
|
|
48
|
+
* case that would permanently lock a deposit in the pool balance is impossible by
|
|
49
|
+
* construction, not by convention. Sub-base-unit claim residue (the remaining
|
|
50
|
+
* source of locked dust) is documented on `unregister_stake`.
|
|
25
51
|
*/
|
|
26
52
|
|
|
27
53
|
import { MoveStruct, MoveTuple, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|