@misonetwork/sdk 0.8.0 → 0.9.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 +39 -7
- package/dist/client.d.ts +3 -17
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +13 -0
- package/dist/client.js.map +1 -1
- package/dist/contracts/miso/composition.d.ts +0 -14
- package/dist/contracts/miso/composition.d.ts.map +1 -1
- package/dist/contracts/miso/composition.js +0 -15
- package/dist/contracts/miso/composition.js.map +1 -1
- package/dist/contracts/miso/recording.d.ts +0 -15
- package/dist/contracts/miso/recording.d.ts.map +1 -1
- package/dist/contracts/miso/recording.js +0 -15
- package/dist/contracts/miso/recording.js.map +1 -1
- package/dist/contracts/miso/release.d.ts +0 -11
- package/dist/contracts/miso/release.d.ts.map +1 -1
- package/dist/contracts/miso/release.js +0 -14
- package/dist/contracts/miso/release.js.map +1 -1
- package/dist/contracts/miso_party/deps/sui/vec_set.d.ts +21 -0
- package/dist/contracts/miso_party/deps/sui/vec_set.d.ts.map +1 -0
- package/dist/contracts/miso_party/deps/sui/vec_set.js +20 -0
- package/dist/contracts/miso_party/deps/sui/vec_set.js.map +1 -0
- package/dist/contracts/miso_party/party.d.ts +481 -0
- package/dist/contracts/miso_party/party.d.ts.map +1 -0
- package/dist/contracts/miso_party/party.js +527 -0
- package/dist/contracts/miso_party/party.js.map +1 -0
- package/dist/contracts/party_cta/party_cta.d.ts +120 -0
- package/dist/contracts/party_cta/party_cta.d.ts.map +1 -0
- package/dist/contracts/party_cta/party_cta.js +139 -0
- package/dist/contracts/party_cta/party_cta.js.map +1 -0
- package/dist/contracts/party_genre/party_genre.d.ts +117 -0
- package/dist/contracts/party_genre/party_genre.d.ts.map +1 -0
- package/dist/contracts/party_genre/party_genre.js +131 -0
- package/dist/contracts/party_genre/party_genre.js.map +1 -0
- package/dist/contracts/party_media/party_media.d.ts +86 -0
- package/dist/contracts/party_media/party_media.d.ts.map +1 -0
- package/dist/contracts/party_media/party_media.js +97 -0
- package/dist/contracts/party_media/party_media.js.map +1 -0
- package/dist/contracts/party_music/party_music.d.ts +209 -0
- package/dist/contracts/party_music/party_music.d.ts.map +1 -0
- package/dist/contracts/party_music/party_music.js +259 -0
- package/dist/contracts/party_music/party_music.js.map +1 -0
- package/dist/contracts/party_platform_link/party_platform_link.d.ts +89 -0
- package/dist/contracts/party_platform_link/party_platform_link.d.ts.map +1 -0
- package/dist/contracts/party_platform_link/party_platform_link.js +92 -0
- package/dist/contracts/party_platform_link/party_platform_link.js.map +1 -0
- package/dist/contracts/party_pro_link/party_pro_link.d.ts +233 -0
- package/dist/contracts/party_pro_link/party_pro_link.d.ts.map +1 -0
- package/dist/contracts/party_pro_link/party_pro_link.js +289 -0
- package/dist/contracts/party_pro_link/party_pro_link.js.map +1 -0
- package/dist/contracts/party_profile/deps/country_code/country_code.d.ts +15 -0
- package/dist/contracts/party_profile/deps/country_code/country_code.d.ts.map +1 -0
- package/dist/contracts/party_profile/deps/country_code/country_code.js +17 -0
- package/dist/contracts/party_profile/deps/country_code/country_code.js.map +1 -0
- package/dist/contracts/party_profile/deps/language_code/language_code.d.ts +6 -0
- package/dist/contracts/party_profile/deps/language_code/language_code.d.ts.map +1 -0
- package/dist/contracts/party_profile/deps/language_code/language_code.js +8 -0
- package/dist/contracts/party_profile/deps/language_code/language_code.js.map +1 -0
- package/dist/contracts/party_profile/party_profile.d.ts +133 -0
- package/dist/contracts/party_profile/party_profile.d.ts.map +1 -0
- package/dist/contracts/party_profile/party_profile.js +153 -0
- package/dist/contracts/party_profile/party_profile.js.map +1 -0
- package/dist/contracts/party_roles/party_roles.d.ts +201 -0
- package/dist/contracts/party_roles/party_roles.d.ts.map +1 -0
- package/dist/contracts/party_roles/party_roles.js +237 -0
- package/dist/contracts/party_roles/party_roles.js.map +1 -0
- package/dist/contracts/party_social/party_social.d.ts +258 -0
- package/dist/contracts/party_social/party_social.d.ts.map +1 -0
- package/dist/contracts/party_social/party_social.js +320 -0
- package/dist/contracts/party_social/party_social.js.map +1 -0
- package/dist/contracts/party_tags/party_tags.d.ts +116 -0
- package/dist/contracts/party_tags/party_tags.d.ts.map +1 -0
- package/dist/contracts/party_tags/party_tags.js +130 -0
- package/dist/contracts/party_tags/party_tags.js.map +1 -0
- package/dist/contracts/routed_stake/routed_stake.d.ts +0 -14
- package/dist/contracts/routed_stake/routed_stake.d.ts.map +1 -1
- package/dist/contracts/routed_stake/routed_stake.js +0 -14
- package/dist/contracts/routed_stake/routed_stake.js.map +1 -1
- package/dist/contracts/royalty_pool/pool.d.ts +0 -14
- package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/pool.js +0 -14
- package/dist/contracts/royalty_pool/pool.js.map +1 -1
- package/dist/contracts/royalty_pool/stake.d.ts +0 -13
- package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/stake.js +0 -14
- package/dist/contracts/royalty_pool/stake.js.map +1 -1
- package/dist/contracts.d.ts +13 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +14 -2
- package/dist/contracts.js.map +1 -1
- package/dist/deployments.d.ts +2 -2
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +16 -3
- package/dist/deployments.js.map +1 -1
- package/dist/events.d.ts +0 -14
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +0 -4
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/packages.d.ts +39 -4
- package/dist/packages.d.ts.map +1 -1
- package/dist/packages.js +39 -4
- package/dist/packages.js.map +1 -1
- package/dist/party/client.d.ts +233 -0
- package/dist/party/client.d.ts.map +1 -0
- package/dist/party/client.js +222 -0
- package/dist/party/client.js.map +1 -0
- package/dist/party/extensions/ctas.d.ts +19 -0
- package/dist/party/extensions/ctas.d.ts.map +1 -0
- package/dist/party/extensions/ctas.js +25 -0
- package/dist/party/extensions/ctas.js.map +1 -0
- package/dist/party/extensions/genres.d.ts +27 -0
- package/dist/party/extensions/genres.d.ts.map +1 -0
- package/dist/party/extensions/genres.js +31 -0
- package/dist/party/extensions/genres.js.map +1 -0
- package/dist/party/extensions/links.d.ts +65 -0
- package/dist/party/extensions/links.d.ts.map +1 -0
- package/dist/party/extensions/links.js +117 -0
- package/dist/party/extensions/links.js.map +1 -0
- package/dist/party/extensions/media.d.ts +36 -0
- package/dist/party/extensions/media.d.ts.map +1 -0
- package/dist/party/extensions/media.js +45 -0
- package/dist/party/extensions/media.js.map +1 -0
- package/dist/party/extensions/profile.d.ts +24 -0
- package/dist/party/extensions/profile.d.ts.map +1 -0
- package/dist/party/extensions/profile.js +48 -0
- package/dist/party/extensions/profile.js.map +1 -0
- package/dist/party/extensions/roles.d.ts +37 -0
- package/dist/party/extensions/roles.d.ts.map +1 -0
- package/dist/party/extensions/roles.js +46 -0
- package/dist/party/extensions/roles.js.map +1 -0
- package/dist/party/extensions/tags.d.ts +25 -0
- package/dist/party/extensions/tags.d.ts.map +1 -0
- package/dist/party/extensions/tags.js +25 -0
- package/dist/party/extensions/tags.js.map +1 -0
- package/dist/party/index.d.ts +12 -0
- package/dist/party/index.d.ts.map +1 -0
- package/dist/party/index.js +14 -0
- package/dist/party/index.js.map +1 -0
- package/dist/party/internal.d.ts +15 -0
- package/dist/party/internal.d.ts.map +1 -0
- package/dist/party/internal.js +103 -0
- package/dist/party/internal.js.map +1 -0
- package/dist/party/queries.d.ts +38 -0
- package/dist/party/queries.d.ts.map +1 -0
- package/dist/party/queries.js +232 -0
- package/dist/party/queries.js.map +1 -0
- package/dist/party/transactions.d.ts +74 -0
- package/dist/party/transactions.d.ts.map +1 -0
- package/dist/party/transactions.js +85 -0
- package/dist/party/transactions.js.map +1 -0
- package/dist/party/types.d.ts +54 -0
- package/dist/party/types.d.ts.map +1 -0
- package/dist/party/types.js +4 -0
- package/dist/party/types.js.map +1 -0
- package/package.json +6 -2
- package/src/client.ts +16 -0
- package/src/contracts/miso/composition.ts +0 -27
- package/src/contracts/miso/recording.ts +0 -28
- package/src/contracts/miso/release.ts +0 -23
- package/src/contracts/miso_party/deps/sui/vec_set.ts +21 -0
- package/src/contracts/miso_party/party.ts +797 -0
- package/src/contracts/party_cta/party_cta.ts +212 -0
- package/src/contracts/party_genre/party_genre.ts +199 -0
- package/src/contracts/party_media/party_media.ts +141 -0
- package/src/contracts/party_music/party_music.ts +405 -0
- package/src/contracts/party_platform_link/party_platform_link.ts +148 -0
- package/src/contracts/party_pro_link/party_pro_link.ts +453 -0
- package/src/contracts/party_profile/deps/country_code/country_code.ts +19 -0
- package/src/contracts/party_profile/deps/language_code/language_code.ts +7 -0
- package/src/contracts/party_profile/party_profile.ts +239 -0
- package/src/contracts/party_roles/party_roles.ts +363 -0
- package/src/contracts/party_social/party_social.ts +502 -0
- package/src/contracts/party_tags/party_tags.ts +198 -0
- package/src/contracts/routed_stake/routed_stake.ts +0 -27
- package/src/contracts/royalty_pool/pool.ts +0 -27
- package/src/contracts/royalty_pool/stake.ts +0 -26
- package/src/contracts.ts +15 -2
- package/src/deployments.ts +18 -3
- package/src/events.ts +0 -4
- package/src/index.ts +2 -0
- package/src/packages.ts +40 -8
- package/src/party/client.ts +283 -0
- package/src/party/extensions/ctas.ts +46 -0
- package/src/party/extensions/genres.ts +62 -0
- package/src/party/extensions/links.ts +185 -0
- package/src/party/extensions/media.ts +72 -0
- package/src/party/extensions/profile.ts +81 -0
- package/src/party/extensions/roles.ts +94 -0
- package/src/party/extensions/tags.ts +54 -0
- package/src/party/index.ts +14 -0
- package/src/party/internal.ts +119 -0
- package/src/party/queries.ts +303 -0
- package/src/party/transactions.ts +167 -0
- package/src/party/types.ts +95 -0
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.d.ts +0 -52
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.d.ts.map +0 -1
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.js +0 -37
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.js.map +0 -1
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.d.ts +0 -91
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.d.ts.map +0 -1
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.js +0 -91
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.js.map +0 -1
- package/src/contracts/release_snapshot_bundle/deps/ori/walrus_data.ts +0 -36
- package/src/contracts/release_snapshot_bundle/release_snapshot_bundle.ts +0 -124
|
@@ -332,33 +332,6 @@ export function sweep(options: SweepOptions) {
|
|
|
332
332
|
typeArguments: options.typeArguments
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
|
-
export interface IdArguments {
|
|
336
|
-
self: RawTransactionArgument<string>;
|
|
337
|
-
}
|
|
338
|
-
export interface IdOptions {
|
|
339
|
-
package?: string;
|
|
340
|
-
arguments: IdArguments | [
|
|
341
|
-
self: RawTransactionArgument<string>
|
|
342
|
-
];
|
|
343
|
-
typeArguments: [
|
|
344
|
-
string,
|
|
345
|
-
string
|
|
346
|
-
];
|
|
347
|
-
}
|
|
348
|
-
export function id(options: IdOptions) {
|
|
349
|
-
const packageAddress = options.package ?? '@local-pkg/routed_stake';
|
|
350
|
-
const argumentsTypes = [
|
|
351
|
-
null
|
|
352
|
-
] satisfies (string | null)[];
|
|
353
|
-
const parameterNames = ["self"];
|
|
354
|
-
return (tx: Transaction) => tx.moveCall({
|
|
355
|
-
package: packageAddress,
|
|
356
|
-
module: 'routed_stake',
|
|
357
|
-
function: 'id',
|
|
358
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
359
|
-
typeArguments: options.typeArguments
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
335
|
export interface HasStakeArguments {
|
|
363
336
|
self: RawTransactionArgument<string>;
|
|
364
337
|
}
|
|
@@ -412,33 +412,6 @@ export function pendingRewards(options: PendingRewardsOptions) {
|
|
|
412
412
|
typeArguments: options.typeArguments
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
|
-
export interface IdArguments {
|
|
416
|
-
self: RawTransactionArgument<string>;
|
|
417
|
-
}
|
|
418
|
-
export interface IdOptions {
|
|
419
|
-
package?: string;
|
|
420
|
-
arguments: IdArguments | [
|
|
421
|
-
self: RawTransactionArgument<string>
|
|
422
|
-
];
|
|
423
|
-
typeArguments: [
|
|
424
|
-
string,
|
|
425
|
-
string
|
|
426
|
-
];
|
|
427
|
-
}
|
|
428
|
-
export function id(options: IdOptions) {
|
|
429
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
430
|
-
const argumentsTypes = [
|
|
431
|
-
null
|
|
432
|
-
] satisfies (string | null)[];
|
|
433
|
-
const parameterNames = ["self"];
|
|
434
|
-
return (tx: Transaction) => tx.moveCall({
|
|
435
|
-
package: packageAddress,
|
|
436
|
-
module: 'pool',
|
|
437
|
-
function: 'id',
|
|
438
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
439
|
-
typeArguments: options.typeArguments
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
415
|
export interface BalanceArguments {
|
|
443
416
|
self: RawTransactionArgument<string>;
|
|
444
417
|
}
|
|
@@ -108,32 +108,6 @@ export function destroy(options: DestroyOptions) {
|
|
|
108
108
|
typeArguments: options.typeArguments
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
export interface IdArguments {
|
|
112
|
-
self: RawTransactionArgument<string>;
|
|
113
|
-
}
|
|
114
|
-
export interface IdOptions {
|
|
115
|
-
package?: string;
|
|
116
|
-
arguments: IdArguments | [
|
|
117
|
-
self: RawTransactionArgument<string>
|
|
118
|
-
];
|
|
119
|
-
typeArguments: [
|
|
120
|
-
string
|
|
121
|
-
];
|
|
122
|
-
}
|
|
123
|
-
export function id(options: IdOptions) {
|
|
124
|
-
const packageAddress = options.package ?? '@local-pkg/royalty_pool';
|
|
125
|
-
const argumentsTypes = [
|
|
126
|
-
null
|
|
127
|
-
] satisfies (string | null)[];
|
|
128
|
-
const parameterNames = ["self"];
|
|
129
|
-
return (tx: Transaction) => tx.moveCall({
|
|
130
|
-
package: packageAddress,
|
|
131
|
-
module: 'stake',
|
|
132
|
-
function: 'id',
|
|
133
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
134
|
-
typeArguments: options.typeArguments
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
111
|
export interface BalanceArguments {
|
|
138
112
|
self: RawTransactionArgument<string>;
|
|
139
113
|
}
|
package/src/contracts.ts
CHANGED
|
@@ -28,10 +28,11 @@ import * as rawRecordingPreview from "./contracts/recording_preview/recording_pr
|
|
|
28
28
|
import * as rawReleaseCoverArt from "./contracts/release_cover_art/release_cover_art.ts";
|
|
29
29
|
import * as rawReleaseCredits from "./contracts/release_credits/release_credits.ts";
|
|
30
30
|
import * as rawReleaseDescription from "./contracts/release_description/release_description.ts";
|
|
31
|
-
import * as rawReleaseSnapshotBundle from "./contracts/release_snapshot_bundle/release_snapshot_bundle.ts";
|
|
32
31
|
import * as rawRoyaltyPool from "./contracts/royalty_pool/pool.ts";
|
|
33
32
|
import * as rawRoyaltyStake from "./contracts/royalty_pool/stake.ts";
|
|
34
33
|
import * as rawRoutedStake from "./contracts/routed_stake/routed_stake.ts";
|
|
34
|
+
import * as rawParty from "./contracts/miso_party/party.ts";
|
|
35
|
+
import * as rawPartyProfile from "./contracts/party_profile/party_profile.ts";
|
|
35
36
|
|
|
36
37
|
// Protocol core (BCS codecs remain available; PTB-inaccessible references do not).
|
|
37
38
|
export const composition = withoutUnsafeCalls(rawComposition, ["title", "uid", "uidMut"] as const);
|
|
@@ -55,7 +56,6 @@ export const releaseDescription = withoutUnsafeCalls(rawReleaseDescription, ["de
|
|
|
55
56
|
export * as releaseDspLink from "./contracts/release_dsp_link/release_dsp_link.ts";
|
|
56
57
|
export * as releaseGenre from "./contracts/release_genre/release_genre.ts";
|
|
57
58
|
export * as releaseKind from "./contracts/release_kind/release_kind.ts";
|
|
58
|
-
export const releaseSnapshotBundle = withoutUnsafeCalls(rawReleaseSnapshotBundle, ["snapshotBundle"] as const);
|
|
59
59
|
|
|
60
60
|
// First-party generic primitives.
|
|
61
61
|
export const royaltyPool = withoutUnsafeCalls(rawRoyaltyPool, ["balance", "_new"] as const);
|
|
@@ -64,3 +64,16 @@ export const routedStake = withoutUnsafeCalls(
|
|
|
64
64
|
rawRoutedStake,
|
|
65
65
|
["stake", "_new", "register", "unregister", "unstake", "restake"] as const,
|
|
66
66
|
);
|
|
67
|
+
|
|
68
|
+
// Party core and extensions.
|
|
69
|
+
export const party = withoutUnsafeCalls(rawParty, ["groupMembers", "uid", "uidMut"] as const);
|
|
70
|
+
export * as partyCta from "./contracts/party_cta/party_cta.ts";
|
|
71
|
+
export * as partyGenre from "./contracts/party_genre/party_genre.ts";
|
|
72
|
+
export * as partyMedia from "./contracts/party_media/party_media.ts";
|
|
73
|
+
export * as partyMusic from "./contracts/party_music/party_music.ts";
|
|
74
|
+
export * as partyPlatformLink from "./contracts/party_platform_link/party_platform_link.ts";
|
|
75
|
+
export * as partyProLink from "./contracts/party_pro_link/party_pro_link.ts";
|
|
76
|
+
export const partyProfile = withoutUnsafeCalls(rawPartyProfile, ["profile"] as const);
|
|
77
|
+
export * as partyRoles from "./contracts/party_roles/party_roles.ts";
|
|
78
|
+
export * as partySocial from "./contracts/party_social/party_social.ts";
|
|
79
|
+
export * as partyTags from "./contracts/party_tags/party_tags.ts";
|
package/src/deployments.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { normalizeSuiAddress } from "@mysten/sui/utils";
|
|
|
7
7
|
export type MisoNetwork = "mainnet" | "testnet";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Every independently published package
|
|
10
|
+
* Every independently published package required by this SDK surface.
|
|
11
11
|
*
|
|
12
12
|
* These names are stable deployment-manifest keys, not Move module names. Their
|
|
13
13
|
* values are never inferred from source labels or a previous publish.
|
|
@@ -26,9 +26,22 @@ const CANONICAL_MISO_PACKAGE_NAMES = [
|
|
|
26
26
|
"releaseDspLink",
|
|
27
27
|
"releaseGenre",
|
|
28
28
|
"releaseKind",
|
|
29
|
-
"releaseSnapshotBundle",
|
|
30
29
|
"royaltyPool",
|
|
31
30
|
"routedStake",
|
|
31
|
+
"misoParty",
|
|
32
|
+
"partyCta",
|
|
33
|
+
"partyGenre",
|
|
34
|
+
"partyMedia",
|
|
35
|
+
"partyMusic",
|
|
36
|
+
"partyPlatformLink",
|
|
37
|
+
"partyProLink",
|
|
38
|
+
"partyProfile",
|
|
39
|
+
"partyRoles",
|
|
40
|
+
"partySocial",
|
|
41
|
+
"partyTags",
|
|
42
|
+
"countryCode",
|
|
43
|
+
"languageCode",
|
|
44
|
+
"genre",
|
|
32
45
|
] as const;
|
|
33
46
|
|
|
34
47
|
/** Public immutable copy; validation always uses the private canonical tuple. */
|
|
@@ -131,7 +144,9 @@ export function assertMisoDeployment(
|
|
|
131
144
|
deployment: unknown,
|
|
132
145
|
): asserts deployment is MisoDeployment {
|
|
133
146
|
if (!deployment || typeof deployment !== "object" || Array.isArray(deployment)) {
|
|
134
|
-
throw new Error(
|
|
147
|
+
throw new Error(
|
|
148
|
+
`@misonetwork/sdk: deployment must be an object with exactly ${CANONICAL_MISO_PACKAGE_NAMES.length} Miso package IDs.`,
|
|
149
|
+
);
|
|
135
150
|
}
|
|
136
151
|
const entries = deployment as Record<string, unknown>;
|
|
137
152
|
const keys = Object.keys(entries);
|
package/src/events.ts
CHANGED
|
@@ -20,7 +20,6 @@ import * as releaseDescription from "./contracts/release_description/release_des
|
|
|
20
20
|
import * as releaseDspLink from "./contracts/release_dsp_link/release_dsp_link.ts";
|
|
21
21
|
import * as releaseGenre from "./contracts/release_genre/release_genre.ts";
|
|
22
22
|
import * as releaseKind from "./contracts/release_kind/release_kind.ts";
|
|
23
|
-
import * as releaseSnapshotBundle from "./contracts/release_snapshot_bundle/release_snapshot_bundle.ts";
|
|
24
23
|
import * as release from "./contracts/miso/release.ts";
|
|
25
24
|
import * as royaltyPool from "./contracts/royalty_pool/pool.ts";
|
|
26
25
|
import * as royaltyStake from "./contracts/royalty_pool/stake.ts";
|
|
@@ -105,9 +104,6 @@ export const eventParsers = {
|
|
|
105
104
|
kindSet: decoder(releaseKind.KindSetEvent),
|
|
106
105
|
kindUnset: decoder(releaseKind.KindUnsetEvent),
|
|
107
106
|
},
|
|
108
|
-
releaseSnapshotBundle: {
|
|
109
|
-
bundleSet: decoder(releaseSnapshotBundle.SnapshotBundleSetEvent),
|
|
110
|
-
},
|
|
111
107
|
},
|
|
112
108
|
primitives: {
|
|
113
109
|
royaltyPool: {
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,8 @@ export * from "./view.ts";
|
|
|
15
15
|
export * from "./client.ts";
|
|
16
16
|
export * from "./deployments.ts";
|
|
17
17
|
export * from "./packages.ts";
|
|
18
|
+
export * as party from "./party/index.ts";
|
|
19
|
+
export type { PartyProtocolClient } from "./party/client.ts";
|
|
18
20
|
|
|
19
21
|
// Generated, ABI-bound bindings (BCS structs + type-safe Move calls).
|
|
20
22
|
export * as contracts from "./contracts.ts";
|
package/src/packages.ts
CHANGED
|
@@ -31,12 +31,23 @@ import * as releaseDescription from "./contracts/release_description/release_des
|
|
|
31
31
|
import * as releaseDspLink from "./contracts/release_dsp_link/release_dsp_link.ts";
|
|
32
32
|
import * as releaseGenre from "./contracts/release_genre/release_genre.ts";
|
|
33
33
|
import * as releaseKind from "./contracts/release_kind/release_kind.ts";
|
|
34
|
-
import * as releaseSnapshotBundle from "./contracts/release_snapshot_bundle/release_snapshot_bundle.ts";
|
|
35
34
|
|
|
36
35
|
import * as royaltyPool from "./contracts/royalty_pool/pool.ts";
|
|
37
36
|
import * as royaltyStake from "./contracts/royalty_pool/stake.ts";
|
|
38
37
|
import * as routedStake from "./contracts/routed_stake/routed_stake.ts";
|
|
39
38
|
|
|
39
|
+
import * as party from "./contracts/miso_party/party.ts";
|
|
40
|
+
import * as partyCta from "./contracts/party_cta/party_cta.ts";
|
|
41
|
+
import * as partyGenre from "./contracts/party_genre/party_genre.ts";
|
|
42
|
+
import * as partyMedia from "./contracts/party_media/party_media.ts";
|
|
43
|
+
import * as partyMusic from "./contracts/party_music/party_music.ts";
|
|
44
|
+
import * as partyPlatformLink from "./contracts/party_platform_link/party_platform_link.ts";
|
|
45
|
+
import * as partyProLink from "./contracts/party_pro_link/party_pro_link.ts";
|
|
46
|
+
import * as partyProfile from "./contracts/party_profile/party_profile.ts";
|
|
47
|
+
import * as partyRoles from "./contracts/party_roles/party_roles.ts";
|
|
48
|
+
import * as partySocial from "./contracts/party_social/party_social.ts";
|
|
49
|
+
import * as partyTags from "./contracts/party_tags/party_tags.ts";
|
|
50
|
+
|
|
40
51
|
type BoundMoveFunction<F> = F extends (options: infer Options) => infer Result
|
|
41
52
|
? Options extends { package?: unknown }
|
|
42
53
|
? (options: Omit<Options, "package">) => Result
|
|
@@ -97,7 +108,6 @@ export const REF_RETURNING_CALLS = {
|
|
|
97
108
|
releaseCoverArt: ["cover"],
|
|
98
109
|
releaseCredits: ["credits"],
|
|
99
110
|
releaseDescription: ["description"],
|
|
100
|
-
releaseSnapshotBundle: ["snapshotBundle"],
|
|
101
111
|
// `new` is emitted as `_new`; its `&mut UID` parent credential cannot be
|
|
102
112
|
// constructed by a caller-side PTB, so only authority-package code may use it.
|
|
103
113
|
royaltyPool: ["balance", "_new"],
|
|
@@ -106,6 +116,8 @@ export const REF_RETURNING_CALLS = {
|
|
|
106
116
|
// caller-provided PTB input. Only `share`, `sweep`, scalar reads and derives
|
|
107
117
|
// remain usable at this layer.
|
|
108
118
|
routedStake: ["stake", "_new", "register", "unregister", "unstake", "restake"],
|
|
119
|
+
party: ["groupMembers", "uid", "uidMut"],
|
|
120
|
+
partyProfile: ["profile"],
|
|
109
121
|
} as const;
|
|
110
122
|
|
|
111
123
|
/**
|
|
@@ -188,11 +200,6 @@ export class MisoPackageBindings {
|
|
|
188
200
|
releaseDspLink: bindModulePackage(releaseDspLink, d.releaseDspLink),
|
|
189
201
|
releaseGenre: bindModulePackage(releaseGenre, d.releaseGenre),
|
|
190
202
|
releaseKind: bindModulePackage(releaseKind, d.releaseKind),
|
|
191
|
-
releaseSnapshotBundle: bindModulePackage(
|
|
192
|
-
releaseSnapshotBundle,
|
|
193
|
-
d.releaseSnapshotBundle,
|
|
194
|
-
REF_RETURNING_CALLS.releaseSnapshotBundle,
|
|
195
|
-
),
|
|
196
203
|
},
|
|
197
204
|
primitives: {
|
|
198
205
|
royaltyPool: {
|
|
@@ -201,6 +208,19 @@ export class MisoPackageBindings {
|
|
|
201
208
|
},
|
|
202
209
|
routedStake: bindModulePackage(routedStake, d.routedStake, REF_RETURNING_CALLS.routedStake),
|
|
203
210
|
},
|
|
211
|
+
party: {
|
|
212
|
+
core: bindModulePackage(party, d.misoParty, REF_RETURNING_CALLS.party),
|
|
213
|
+
cta: bindModulePackage(partyCta, d.partyCta),
|
|
214
|
+
genre: bindModulePackage(partyGenre, d.partyGenre),
|
|
215
|
+
media: bindModulePackage(partyMedia, d.partyMedia),
|
|
216
|
+
music: bindModulePackage(partyMusic, d.partyMusic),
|
|
217
|
+
platformLink: bindModulePackage(partyPlatformLink, d.partyPlatformLink),
|
|
218
|
+
proLink: bindModulePackage(partyProLink, d.partyProLink),
|
|
219
|
+
profile: bindModulePackage(partyProfile, d.partyProfile, REF_RETURNING_CALLS.partyProfile),
|
|
220
|
+
roles: bindModulePackage(partyRoles, d.partyRoles),
|
|
221
|
+
social: bindModulePackage(partySocial, d.partySocial),
|
|
222
|
+
tags: bindModulePackage(partyTags, d.partyTags),
|
|
223
|
+
},
|
|
204
224
|
};
|
|
205
225
|
}
|
|
206
226
|
|
|
@@ -235,12 +255,24 @@ export class MisoPackageBindings {
|
|
|
235
255
|
releaseDspLink: codecsOnly(releaseDspLink),
|
|
236
256
|
releaseGenre: codecsOnly(releaseGenre),
|
|
237
257
|
releaseKind: codecsOnly(releaseKind),
|
|
238
|
-
releaseSnapshotBundle: codecsOnly(releaseSnapshotBundle),
|
|
239
258
|
},
|
|
240
259
|
primitives: {
|
|
241
260
|
royaltyPool: { pool: codecsOnly(royaltyPool), stake: codecsOnly(royaltyStake) },
|
|
242
261
|
routedStake: codecsOnly(routedStake),
|
|
243
262
|
},
|
|
263
|
+
party: {
|
|
264
|
+
core: codecsOnly(party),
|
|
265
|
+
cta: codecsOnly(partyCta),
|
|
266
|
+
genre: codecsOnly(partyGenre),
|
|
267
|
+
media: codecsOnly(partyMedia),
|
|
268
|
+
music: codecsOnly(partyMusic),
|
|
269
|
+
platformLink: codecsOnly(partyPlatformLink),
|
|
270
|
+
proLink: codecsOnly(partyProLink),
|
|
271
|
+
profile: codecsOnly(partyProfile),
|
|
272
|
+
roles: codecsOnly(partyRoles),
|
|
273
|
+
social: codecsOnly(partySocial),
|
|
274
|
+
tags: codecsOnly(partyTags),
|
|
275
|
+
},
|
|
244
276
|
};
|
|
245
277
|
}
|
|
246
278
|
}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// Party queries and transaction builders bound to the same complete deployment
|
|
5
|
+
// as `MisoProtocolClient`. Consumers reach this through `client.miso.party`.
|
|
6
|
+
|
|
7
|
+
import type { ClientWithCoreApi } from "@mysten/sui/client";
|
|
8
|
+
import type { MisoDeployment } from "../deployments.ts";
|
|
9
|
+
import type { TxThunk } from "./transactions.ts";
|
|
10
|
+
import * as queries from "./queries.ts";
|
|
11
|
+
import * as transactions from "./transactions.ts";
|
|
12
|
+
import * as profileExt from "./extensions/profile.ts";
|
|
13
|
+
import * as mediaExt from "./extensions/media.ts";
|
|
14
|
+
import * as rolesExt from "./extensions/roles.ts";
|
|
15
|
+
import * as tagsExt from "./extensions/tags.ts";
|
|
16
|
+
import * as genresExt from "./extensions/genres.ts";
|
|
17
|
+
import * as ctasExt from "./extensions/ctas.ts";
|
|
18
|
+
import * as linksExt from "./extensions/links.ts";
|
|
19
|
+
import type { Cta, Media, Party, PlatformKey, PlatformLink, Profile } from "./types.ts";
|
|
20
|
+
import * as partyMod from "../contracts/miso_party/party.ts";
|
|
21
|
+
import * as profileMod from "../contracts/party_profile/party_profile.ts";
|
|
22
|
+
import * as mediaMod from "../contracts/party_media/party_media.ts";
|
|
23
|
+
import * as rolesMod from "../contracts/party_roles/party_roles.ts";
|
|
24
|
+
import * as tagsMod from "../contracts/party_tags/party_tags.ts";
|
|
25
|
+
import * as ctaMod from "../contracts/party_cta/party_cta.ts";
|
|
26
|
+
import * as genreMod from "../contracts/party_genre/party_genre.ts";
|
|
27
|
+
import * as platformLinkMod from "../contracts/party_platform_link/party_platform_link.ts";
|
|
28
|
+
import * as socialMod from "../contracts/party_social/party_social.ts";
|
|
29
|
+
import * as musicMod from "../contracts/party_music/party_music.ts";
|
|
30
|
+
import * as proLinkMod from "../contracts/party_pro_link/party_pro_link.ts";
|
|
31
|
+
|
|
32
|
+
type BoundMoveFunction<F> = F extends (options: infer Options) => infer Result
|
|
33
|
+
? Options extends { package?: unknown }
|
|
34
|
+
? (options: Omit<Options, "package">) => Result
|
|
35
|
+
: F
|
|
36
|
+
: F;
|
|
37
|
+
type BoundModule<M extends object, Removed extends PropertyKey> = {
|
|
38
|
+
[Key in Exclude<keyof M, Removed>]: BoundMoveFunction<M[Key]>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** Defaults generated calls to one package and removes reference-returning calls. */
|
|
42
|
+
function bindModulePackage<M extends object, K extends readonly (keyof M)[]>(
|
|
43
|
+
mod: M,
|
|
44
|
+
pkg: string,
|
|
45
|
+
unavailable: K = [] as unknown as K,
|
|
46
|
+
): BoundModule<M, K[number]> {
|
|
47
|
+
const out: Record<string, unknown> = {};
|
|
48
|
+
for (const [key, value] of Object.entries({ ...mod })) {
|
|
49
|
+
if ((unavailable as readonly string[]).includes(key)) continue;
|
|
50
|
+
out[key] =
|
|
51
|
+
typeof value === "function"
|
|
52
|
+
? (options: { package?: string }) => (value as (o: unknown) => unknown)({ package: pkg, ...options })
|
|
53
|
+
: value;
|
|
54
|
+
}
|
|
55
|
+
return out as BoundModule<M, K[number]>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Package-bound Party client exposed at `client.miso.party`. */
|
|
59
|
+
export class PartyProtocolClient {
|
|
60
|
+
#client: ClientWithCoreApi;
|
|
61
|
+
#pkg: string;
|
|
62
|
+
#profilePkg: string;
|
|
63
|
+
#countryCodePkg: string;
|
|
64
|
+
#languageCodePkg: string;
|
|
65
|
+
#mediaPkg: string;
|
|
66
|
+
#rolesPkg: string;
|
|
67
|
+
#tagsPkg: string;
|
|
68
|
+
#partyGenrePkg: string;
|
|
69
|
+
#ctaPkg: string;
|
|
70
|
+
#platformLinkPkg: string;
|
|
71
|
+
#socialPkg: string;
|
|
72
|
+
#musicPkg: string;
|
|
73
|
+
#proLinkPkg: string;
|
|
74
|
+
#genrePkg: string;
|
|
75
|
+
|
|
76
|
+
constructor(client: ClientWithCoreApi, o: MisoDeployment) {
|
|
77
|
+
this.#client = client;
|
|
78
|
+
this.#pkg = o.misoParty;
|
|
79
|
+
this.#profilePkg = o.partyProfile;
|
|
80
|
+
this.#countryCodePkg = o.countryCode;
|
|
81
|
+
this.#languageCodePkg = o.languageCode;
|
|
82
|
+
this.#mediaPkg = o.partyMedia;
|
|
83
|
+
this.#rolesPkg = o.partyRoles;
|
|
84
|
+
this.#tagsPkg = o.partyTags;
|
|
85
|
+
this.#partyGenrePkg = o.partyGenre;
|
|
86
|
+
this.#ctaPkg = o.partyCta;
|
|
87
|
+
this.#platformLinkPkg = o.partyPlatformLink;
|
|
88
|
+
this.#socialPkg = o.partySocial;
|
|
89
|
+
this.#musicPkg = o.partyMusic;
|
|
90
|
+
this.#proLinkPkg = o.partyProLink;
|
|
91
|
+
this.#genrePkg = o.genre;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The `genre` vocabulary package id. Callers resolve `Genre` objects from it to
|
|
96
|
+
* pass to `tx.addGenre` (which takes a genre object id, not this package).
|
|
97
|
+
*/
|
|
98
|
+
get genrePackageId(): string {
|
|
99
|
+
return this.#genrePkg;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// === Queries ===
|
|
103
|
+
|
|
104
|
+
async getPartyById(partyId: string): Promise<Party> {
|
|
105
|
+
return queries.getPartyById(this.#client, partyId);
|
|
106
|
+
}
|
|
107
|
+
async getPartiesByIds(
|
|
108
|
+
partyIds: readonly string[],
|
|
109
|
+
): Promise<Partial<Record<string, Party>>> {
|
|
110
|
+
return queries.getPartiesByIds(this.#client, partyIds);
|
|
111
|
+
}
|
|
112
|
+
derivePartyAdminCapId(partyId: string): string {
|
|
113
|
+
return queries.derivePartyAdminCapId(partyId, this.#pkg);
|
|
114
|
+
}
|
|
115
|
+
async getProfile(partyId: string): Promise<Profile | null> {
|
|
116
|
+
return queries.getProfile(this.#client, partyId, this.#profilePkg);
|
|
117
|
+
}
|
|
118
|
+
async getMedia(partyId: string): Promise<Media | null> {
|
|
119
|
+
return queries.getMedia(this.#client, partyId, this.#mediaPkg);
|
|
120
|
+
}
|
|
121
|
+
/** The party's artist-type roles (display names). */
|
|
122
|
+
async getRoles(partyId: string): Promise<string[]> {
|
|
123
|
+
return queries.getRoles(this.#client, partyId, this.#rolesPkg);
|
|
124
|
+
}
|
|
125
|
+
/** The party's free-form tags. */
|
|
126
|
+
async getTags(partyId: string): Promise<string[]> {
|
|
127
|
+
return queries.getTags(this.#client, partyId, this.#tagsPkg);
|
|
128
|
+
}
|
|
129
|
+
/** The party's genre object ids. */
|
|
130
|
+
async getGenres(partyId: string): Promise<string[]> {
|
|
131
|
+
return queries.getGenres(this.#client, partyId, this.#partyGenrePkg);
|
|
132
|
+
}
|
|
133
|
+
/** The party's ordered CTA list (position is priority). */
|
|
134
|
+
async getCtas(partyId: string): Promise<Cta[]> {
|
|
135
|
+
return queries.getCtas(this.#client, partyId, this.#ctaPkg);
|
|
136
|
+
}
|
|
137
|
+
/** All external-platform links attached to the party (social, music, professional). */
|
|
138
|
+
async getLinks(partyId: string): Promise<PlatformLink[]> {
|
|
139
|
+
return queries.getLinks(this.#client, partyId);
|
|
140
|
+
}
|
|
141
|
+
/** Group ids a party belongs to (member-side membership records). */
|
|
142
|
+
async getMemberships(partyId: string): Promise<string[]> {
|
|
143
|
+
return queries.getMemberships(this.#client, partyId);
|
|
144
|
+
}
|
|
145
|
+
/** Member ids invited to a group but not yet accepted. */
|
|
146
|
+
async getPendingInvites(groupId: string): Promise<string[]> {
|
|
147
|
+
return queries.getPendingInvites(this.#client, groupId);
|
|
148
|
+
}
|
|
149
|
+
/** Group ids that have invited this party but are awaiting its response. */
|
|
150
|
+
async getPendingMemberships(partyId: string): Promise<string[]> {
|
|
151
|
+
return queries.getPendingMemberships(this.#client, partyId);
|
|
152
|
+
}
|
|
153
|
+
/** Whether a party is a member of a group. */
|
|
154
|
+
async isMember(memberId: string, groupId: string): Promise<boolean> {
|
|
155
|
+
return queries.isMember(this.#client, memberId, groupId, this.#pkg);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// === Transaction builders (thunks; package ids bound from the client) ===
|
|
159
|
+
|
|
160
|
+
get tx() {
|
|
161
|
+
const pkg = this.#pkg;
|
|
162
|
+
const profilePkg = this.#profilePkg;
|
|
163
|
+
const cc = this.#countryCodePkg;
|
|
164
|
+
const lc = this.#languageCodePkg;
|
|
165
|
+
const mediaPkg = this.#mediaPkg;
|
|
166
|
+
const rolesPkg = this.#rolesPkg;
|
|
167
|
+
const tagsPkg = this.#tagsPkg;
|
|
168
|
+
const ctaPkg = this.#ctaPkg;
|
|
169
|
+
const partyGenrePkg = this.#partyGenrePkg;
|
|
170
|
+
const linkIds: linksExt.LinkPackageIds = {
|
|
171
|
+
partyPlatformLinkPackageId: this.#platformLinkPkg,
|
|
172
|
+
partySocialPackageId: this.#socialPkg,
|
|
173
|
+
partyMusicPackageId: this.#musicPkg,
|
|
174
|
+
partyProLinkPackageId: this.#proLinkPkg,
|
|
175
|
+
};
|
|
176
|
+
return {
|
|
177
|
+
createIndividualParty: (p: Omit<transactions.CreatePartyParams, "partyPackageId">): TxThunk =>
|
|
178
|
+
transactions.createIndividualParty({ ...p, partyPackageId: pkg }),
|
|
179
|
+
createGroupParty: (p: Omit<transactions.CreatePartyParams, "partyPackageId">): TxThunk =>
|
|
180
|
+
transactions.createGroupParty({ ...p, partyPackageId: pkg }),
|
|
181
|
+
setName: (p: Omit<transactions.SetNameParams, "partyPackageId">): TxThunk =>
|
|
182
|
+
transactions.setName({ ...p, partyPackageId: pkg }),
|
|
183
|
+
inviteParty: (p: Omit<transactions.InvitePartyParams, "partyPackageId">): TxThunk =>
|
|
184
|
+
transactions.inviteParty({ ...p, partyPackageId: pkg }),
|
|
185
|
+
acceptInvite: (p: Omit<transactions.AcceptInviteParams, "partyPackageId">): TxThunk =>
|
|
186
|
+
transactions.acceptInvite({ ...p, partyPackageId: pkg }),
|
|
187
|
+
declineInvite: (p: Omit<transactions.DeclineInviteParams, "partyPackageId">): TxThunk =>
|
|
188
|
+
transactions.declineInvite({ ...p, partyPackageId: pkg }),
|
|
189
|
+
revokeInvite: (p: Omit<transactions.RevokeInviteParams, "partyPackageId">): TxThunk =>
|
|
190
|
+
transactions.revokeInvite({ ...p, partyPackageId: pkg }),
|
|
191
|
+
leaveGroup: (p: Omit<transactions.LeaveGroupParams, "partyPackageId">): TxThunk =>
|
|
192
|
+
transactions.leaveGroup({ ...p, partyPackageId: pkg }),
|
|
193
|
+
removeMember: (p: Omit<transactions.RemoveMemberParams, "partyPackageId">): TxThunk =>
|
|
194
|
+
transactions.removeMember({ ...p, partyPackageId: pkg }),
|
|
195
|
+
setProfile: (
|
|
196
|
+
p: Omit<profileExt.SetProfileParams, "partyProfilePackageId" | "countryCodePackageId" | "languageCodePackageId">,
|
|
197
|
+
): TxThunk =>
|
|
198
|
+
profileExt.setProfile({
|
|
199
|
+
...p,
|
|
200
|
+
partyProfilePackageId: profilePkg,
|
|
201
|
+
countryCodePackageId: cc,
|
|
202
|
+
languageCodePackageId: lc,
|
|
203
|
+
}),
|
|
204
|
+
clearProfile: (p: Omit<profileExt.ClearProfileParams, "partyProfilePackageId">): TxThunk =>
|
|
205
|
+
profileExt.clearProfile({ ...p, partyProfilePackageId: profilePkg }),
|
|
206
|
+
setMedia: (p: Omit<mediaExt.SetMediaParams, "partyMediaPackageId">): TxThunk =>
|
|
207
|
+
mediaExt.setMedia({ ...p, partyMediaPackageId: mediaPkg }),
|
|
208
|
+
clearMedia: (p: Omit<mediaExt.ClearMediaParams, "partyMediaPackageId">): TxThunk =>
|
|
209
|
+
mediaExt.clearMedia({ ...p, partyMediaPackageId: mediaPkg }),
|
|
210
|
+
// Roles
|
|
211
|
+
addRole: (p: Omit<rolesExt.AddRoleParams, "partyRolesPackageId">): TxThunk =>
|
|
212
|
+
rolesExt.addRole({ ...p, partyRolesPackageId: rolesPkg }),
|
|
213
|
+
removeRole: (p: Omit<rolesExt.RemoveRoleParams, "partyRolesPackageId">): TxThunk =>
|
|
214
|
+
rolesExt.removeRole({ ...p, partyRolesPackageId: rolesPkg }),
|
|
215
|
+
clearRoles: (p: Omit<rolesExt.ClearRolesParams, "partyRolesPackageId">): TxThunk =>
|
|
216
|
+
rolesExt.clearRoles({ ...p, partyRolesPackageId: rolesPkg }),
|
|
217
|
+
// Tags
|
|
218
|
+
addTag: (p: Omit<tagsExt.AddTagParams, "partyTagsPackageId">): TxThunk =>
|
|
219
|
+
tagsExt.addTag({ ...p, partyTagsPackageId: tagsPkg }),
|
|
220
|
+
removeTag: (p: Omit<tagsExt.RemoveTagParams, "partyTagsPackageId">): TxThunk =>
|
|
221
|
+
tagsExt.removeTag({ ...p, partyTagsPackageId: tagsPkg }),
|
|
222
|
+
clearTags: (p: Omit<tagsExt.ClearTagsParams, "partyTagsPackageId">): TxThunk =>
|
|
223
|
+
tagsExt.clearTags({ ...p, partyTagsPackageId: tagsPkg }),
|
|
224
|
+
// Genres
|
|
225
|
+
addGenre: (p: Omit<genresExt.AddGenreParams, "partyGenrePackageId">): TxThunk =>
|
|
226
|
+
genresExt.addGenre({ ...p, partyGenrePackageId: partyGenrePkg }),
|
|
227
|
+
removeGenre: (p: Omit<genresExt.RemoveGenreParams, "partyGenrePackageId">): TxThunk =>
|
|
228
|
+
genresExt.removeGenre({ ...p, partyGenrePackageId: partyGenrePkg }),
|
|
229
|
+
clearGenres: (p: Omit<genresExt.ClearGenresParams, "partyGenrePackageId">): TxThunk =>
|
|
230
|
+
genresExt.clearGenres({ ...p, partyGenrePackageId: partyGenrePkg }),
|
|
231
|
+
// CTAs
|
|
232
|
+
setCtas: (p: Omit<ctasExt.SetCtasParams, "partyCtaPackageId">): TxThunk =>
|
|
233
|
+
ctasExt.setCtas({ ...p, partyCtaPackageId: ctaPkg }),
|
|
234
|
+
clearCtas: (p: Omit<ctasExt.ClearCtasParams, "partyCtaPackageId">): TxThunk =>
|
|
235
|
+
ctasExt.clearCtas({ ...p, partyCtaPackageId: ctaPkg }),
|
|
236
|
+
// Platform links — generic (any platform) plus per-platform `set…`/`clear…`.
|
|
237
|
+
setLink: (platform: PlatformKey, p: linksExt.BoundSetLinkParams): TxThunk =>
|
|
238
|
+
linksExt.setLink(platform, { ...p, ...linkIds }),
|
|
239
|
+
clearLink: (platform: PlatformKey, p: linksExt.BoundClearLinkParams): TxThunk =>
|
|
240
|
+
linksExt.clearLink(platform, { ...p, ...linkIds }),
|
|
241
|
+
...linksExt.linkTxBuilders(linkIds),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// === Generated type-safe Move calls (for tx.add) ===
|
|
246
|
+
|
|
247
|
+
get call() {
|
|
248
|
+
return {
|
|
249
|
+
party: bindModulePackage(partyMod, this.#pkg, ["groupMembers", "uid", "uidMut"] as const),
|
|
250
|
+
profile: bindModulePackage(profileMod, this.#profilePkg, ["profile"] as const),
|
|
251
|
+
media: bindModulePackage(mediaMod, this.#mediaPkg),
|
|
252
|
+
roles: bindModulePackage(rolesMod, this.#rolesPkg),
|
|
253
|
+
tags: bindModulePackage(tagsMod, this.#tagsPkg),
|
|
254
|
+
cta: bindModulePackage(ctaMod, this.#ctaPkg),
|
|
255
|
+
genre: bindModulePackage(genreMod, this.#partyGenrePkg),
|
|
256
|
+
platformLink: bindModulePackage(platformLinkMod, this.#platformLinkPkg),
|
|
257
|
+
social: bindModulePackage(socialMod, this.#socialPkg),
|
|
258
|
+
music: bindModulePackage(musicMod, this.#musicPkg),
|
|
259
|
+
proLink: bindModulePackage(proLinkMod, this.#proLinkPkg),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// === Generated BCS structs (for parsing object/event content) ===
|
|
264
|
+
|
|
265
|
+
get bcs() {
|
|
266
|
+
return {
|
|
267
|
+
Party: partyMod.Party,
|
|
268
|
+
PartyAdminCap: partyMod.PartyAdminCap,
|
|
269
|
+
Profile: profileMod.Profile,
|
|
270
|
+
ProfileSetEvent: profileMod.ProfileSetEvent,
|
|
271
|
+
Media: mediaMod.Media,
|
|
272
|
+
MediaSetEvent: mediaMod.MediaSetEvent,
|
|
273
|
+
ArtistRole: rolesMod.ArtistRole,
|
|
274
|
+
RoleAddedEvent: rolesMod.RoleAddedEvent,
|
|
275
|
+
TagAddedEvent: tagsMod.TagAddedEvent,
|
|
276
|
+
Cta: ctaMod.Cta,
|
|
277
|
+
CtasSetEvent: ctaMod.CtasSetEvent,
|
|
278
|
+
GenreAddedEvent: genreMod.GenreAddedEvent,
|
|
279
|
+
LinkSetEvent: platformLinkMod.LinkSetEvent,
|
|
280
|
+
LinkClearedEvent: platformLinkMod.LinkClearedEvent,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) Miso Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// The `party_cta` extension: a party's ordered call-to-action list (Tickets,
|
|
5
|
+
// Merch, Newsletter, …). Each CTA is a `{ label, url }`; the whole list is written
|
|
6
|
+
// at once (position is priority). The builder constructs each `Cta` via `new_cta`
|
|
7
|
+
// and passes the vector to `set_ctas`.
|
|
8
|
+
|
|
9
|
+
import * as ctaMod from "../../contracts/party_cta/party_cta.ts";
|
|
10
|
+
import type { TxThunk } from "../transactions.ts";
|
|
11
|
+
import type { Cta } from "../types.ts";
|
|
12
|
+
|
|
13
|
+
export interface SetCtasParams {
|
|
14
|
+
partyId: string;
|
|
15
|
+
capId: string;
|
|
16
|
+
/** The ordered CTA list — position is priority. */
|
|
17
|
+
ctas: Cta[];
|
|
18
|
+
partyCtaPackageId: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Sets (or replaces) the party's ordered CTA list. */
|
|
22
|
+
export function setCtas(params: SetCtasParams): TxThunk {
|
|
23
|
+
return (tx) => {
|
|
24
|
+
const ctaType = `${params.partyCtaPackageId}::party_cta::Cta`;
|
|
25
|
+
const ctas = tx.makeMoveVec({
|
|
26
|
+
type: ctaType,
|
|
27
|
+
elements: params.ctas.map((c) =>
|
|
28
|
+
tx.add(ctaMod.newCta({ package: params.partyCtaPackageId, arguments: [c.label, c.url] })),
|
|
29
|
+
),
|
|
30
|
+
});
|
|
31
|
+
tx.add(ctaMod.setCtas({ package: params.partyCtaPackageId, arguments: [params.partyId, params.capId, ctas] }));
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface ClearCtasParams {
|
|
36
|
+
partyId: string;
|
|
37
|
+
capId: string;
|
|
38
|
+
partyCtaPackageId: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Removes the party's CTA list. No-op on-chain if none is set. */
|
|
42
|
+
export function clearCtas(params: ClearCtasParams): TxThunk {
|
|
43
|
+
return (tx) => {
|
|
44
|
+
tx.add(ctaMod.clearCtas({ package: params.partyCtaPackageId, arguments: [params.partyId, params.capId] }));
|
|
45
|
+
};
|
|
46
|
+
}
|