@misofm/sdk 0.1.1 → 0.2.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.
Files changed (171) hide show
  1. package/README.md +138 -10
  2. package/dist/catalog.d.ts +30 -0
  3. package/dist/catalog.d.ts.map +1 -1
  4. package/dist/catalog.js +60 -1
  5. package/dist/catalog.js.map +1 -1
  6. package/dist/contracts/composition_credits/composition_credits.d.ts +181 -0
  7. package/dist/contracts/composition_credits/composition_credits.d.ts.map +1 -0
  8. package/dist/contracts/composition_credits/composition_credits.js +109 -0
  9. package/dist/contracts/composition_credits/composition_credits.js.map +1 -0
  10. package/dist/contracts/composition_credits/composition_party_role.d.ts +119 -0
  11. package/dist/contracts/composition_credits/composition_party_role.d.ts.map +1 -0
  12. package/dist/contracts/composition_credits/composition_party_role.js +139 -0
  13. package/dist/contracts/composition_credits/composition_party_role.js.map +1 -0
  14. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts +24 -0
  15. package/dist/contracts/composition_credits/deps/miso_credit/credit.d.ts.map +1 -0
  16. package/dist/contracts/composition_credits/deps/miso_credit/credit.js +23 -0
  17. package/dist/contracts/composition_credits/deps/miso_credit/credit.js.map +1 -0
  18. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts +37 -0
  19. package/dist/contracts/composition_credits/deps/sui/vec_map.d.ts.map +1 -0
  20. package/dist/contracts/composition_credits/deps/sui/vec_map.js +28 -0
  21. package/dist/contracts/composition_credits/deps/sui/vec_map.js.map +1 -0
  22. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts +87 -0
  23. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.d.ts.map +1 -0
  24. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js +80 -0
  25. package/dist/contracts/composition_royalty_pool/composition_royalty_pool.js.map +1 -0
  26. package/dist/contracts/cover_art/cover_art.d.ts +85 -0
  27. package/dist/contracts/cover_art/cover_art.d.ts.map +1 -0
  28. package/dist/contracts/cover_art/cover_art.js +68 -0
  29. package/dist/contracts/cover_art/cover_art.js.map +1 -0
  30. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts +52 -0
  31. package/dist/contracts/cover_art/deps/ori/walrus_data.d.ts.map +1 -0
  32. package/dist/contracts/cover_art/deps/ori/walrus_data.js +37 -0
  33. package/dist/contracts/cover_art/deps/ori/walrus_data.js.map +1 -0
  34. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts +24 -0
  35. package/dist/contracts/recording_credits/deps/miso_credit/credit.d.ts.map +1 -0
  36. package/dist/contracts/recording_credits/deps/miso_credit/credit.js +23 -0
  37. package/dist/contracts/recording_credits/deps/miso_credit/credit.js.map +1 -0
  38. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts +37 -0
  39. package/dist/contracts/recording_credits/deps/sui/vec_map.d.ts.map +1 -0
  40. package/dist/contracts/recording_credits/deps/sui/vec_map.js +28 -0
  41. package/dist/contracts/recording_credits/deps/sui/vec_map.js.map +1 -0
  42. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts +21 -0
  43. package/dist/contracts/recording_credits/deps/sui/vec_set.d.ts.map +1 -0
  44. package/dist/contracts/recording_credits/deps/sui/vec_set.js +20 -0
  45. package/dist/contracts/recording_credits/deps/sui/vec_set.js.map +1 -0
  46. package/dist/contracts/recording_credits/recording_credits.d.ts +2313 -0
  47. package/dist/contracts/recording_credits/recording_credits.d.ts.map +1 -0
  48. package/dist/contracts/recording_credits/recording_credits.js +270 -0
  49. package/dist/contracts/recording_credits/recording_credits.js.map +1 -0
  50. package/dist/contracts/recording_credits/recording_party_role.d.ts +1174 -0
  51. package/dist/contracts/recording_credits/recording_party_role.d.ts.map +1 -0
  52. package/dist/contracts/recording_credits/recording_party_role.js +692 -0
  53. package/dist/contracts/recording_credits/recording_party_role.js.map +1 -0
  54. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts +90 -0
  55. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.d.ts.map +1 -0
  56. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js +80 -0
  57. package/dist/contracts/recording_royalty_pool/recording_royalty_pool.js.map +1 -0
  58. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts +52 -0
  59. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.d.ts.map +1 -0
  60. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js +37 -0
  61. package/dist/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.js.map +1 -0
  62. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts +46 -0
  63. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.d.ts.map +1 -0
  64. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js +21 -0
  65. package/dist/contracts/release_cover_art/deps/cover_art/cover_art.js.map +1 -0
  66. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts +33 -0
  67. package/dist/contracts/release_cover_art/deps/per_track/per_track.d.ts.map +1 -0
  68. package/dist/contracts/release_cover_art/deps/per_track/per_track.js +32 -0
  69. package/dist/contracts/release_cover_art/deps/per_track/per_track.js.map +1 -0
  70. package/dist/contracts/release_cover_art/release_cover_art.d.ts +300 -0
  71. package/dist/contracts/release_cover_art/release_cover_art.d.ts.map +1 -0
  72. package/dist/contracts/release_cover_art/release_cover_art.js +168 -0
  73. package/dist/contracts/release_cover_art/release_cover_art.js.map +1 -0
  74. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts +24 -0
  75. package/dist/contracts/release_credits/deps/miso_credit/credit.d.ts.map +1 -0
  76. package/dist/contracts/release_credits/deps/miso_credit/credit.js +23 -0
  77. package/dist/contracts/release_credits/deps/miso_credit/credit.js.map +1 -0
  78. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts +37 -0
  79. package/dist/contracts/release_credits/deps/sui/vec_map.d.ts.map +1 -0
  80. package/dist/contracts/release_credits/deps/sui/vec_map.js +28 -0
  81. package/dist/contracts/release_credits/deps/sui/vec_map.js.map +1 -0
  82. package/dist/contracts/release_credits/release_credits.d.ts +142 -0
  83. package/dist/contracts/release_credits/release_credits.d.ts.map +1 -0
  84. package/dist/contracts/release_credits/release_credits.js +108 -0
  85. package/dist/contracts/release_credits/release_credits.js.map +1 -0
  86. package/dist/contracts/release_credits/release_party_role.d.ts +58 -0
  87. package/dist/contracts/release_credits/release_party_role.d.ts.map +1 -0
  88. package/dist/contracts/release_credits/release_party_role.js +66 -0
  89. package/dist/contracts/release_credits/release_party_role.js.map +1 -0
  90. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts +18 -0
  91. package/dist/contracts/royalty_pool/deps/std/type_name.d.ts.map +1 -0
  92. package/dist/contracts/royalty_pool/deps/std/type_name.js +20 -0
  93. package/dist/contracts/royalty_pool/deps/std/type_name.js.map +1 -0
  94. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts +13 -0
  95. package/dist/contracts/royalty_pool/deps/sui/balance.d.ts.map +1 -0
  96. package/dist/contracts/royalty_pool/deps/sui/balance.js +15 -0
  97. package/dist/contracts/royalty_pool/deps/sui/balance.js.map +1 -0
  98. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts +37 -0
  99. package/dist/contracts/royalty_pool/deps/sui/vec_map.d.ts.map +1 -0
  100. package/dist/contracts/royalty_pool/deps/sui/vec_map.js +28 -0
  101. package/dist/contracts/royalty_pool/deps/sui/vec_map.js.map +1 -0
  102. package/dist/contracts/royalty_pool/pool.d.ts +358 -0
  103. package/dist/contracts/royalty_pool/pool.d.ts.map +1 -0
  104. package/dist/contracts/royalty_pool/pool.js +352 -0
  105. package/dist/contracts/royalty_pool/pool.js.map +1 -0
  106. package/dist/contracts/royalty_pool/stake.d.ts +202 -0
  107. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -0
  108. package/dist/contracts/royalty_pool/stake.js +197 -0
  109. package/dist/contracts/royalty_pool/stake.js.map +1 -0
  110. package/dist/contracts.d.ts +16 -0
  111. package/dist/contracts.d.ts.map +1 -0
  112. package/dist/contracts.js +29 -0
  113. package/dist/contracts.js.map +1 -0
  114. package/dist/cover.d.ts +48 -0
  115. package/dist/cover.d.ts.map +1 -0
  116. package/dist/cover.js +68 -0
  117. package/dist/cover.js.map +1 -0
  118. package/dist/credits.d.ts +171 -0
  119. package/dist/credits.d.ts.map +1 -0
  120. package/dist/credits.js +362 -0
  121. package/dist/credits.js.map +1 -0
  122. package/dist/extensions/royalty-pool.d.ts +32 -0
  123. package/dist/extensions/royalty-pool.d.ts.map +1 -0
  124. package/dist/extensions/royalty-pool.js +33 -0
  125. package/dist/extensions/royalty-pool.js.map +1 -0
  126. package/dist/index.d.ts +4 -0
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +17 -3
  129. package/dist/index.js.map +1 -1
  130. package/dist/internal.d.ts +4 -0
  131. package/dist/internal.d.ts.map +1 -0
  132. package/dist/internal.js +18 -0
  133. package/dist/internal.js.map +1 -0
  134. package/dist/release-graph.d.ts.map +1 -1
  135. package/dist/release-graph.js +5 -4
  136. package/dist/release-graph.js.map +1 -1
  137. package/package.json +14 -2
  138. package/src/catalog.ts +118 -0
  139. package/src/contracts/composition_credits/composition_credits.ts +169 -0
  140. package/src/contracts/composition_credits/composition_party_role.ts +189 -0
  141. package/src/contracts/composition_credits/deps/miso_credit/credit.ts +27 -0
  142. package/src/contracts/composition_credits/deps/sui/vec_map.ts +33 -0
  143. package/src/contracts/composition_royalty_pool/composition_royalty_pool.ts +135 -0
  144. package/src/contracts/cover_art/cover_art.ts +99 -0
  145. package/src/contracts/cover_art/deps/ori/walrus_data.ts +36 -0
  146. package/src/contracts/recording_credits/deps/miso_credit/credit.ts +27 -0
  147. package/src/contracts/recording_credits/deps/sui/vec_map.ts +33 -0
  148. package/src/contracts/recording_credits/deps/sui/vec_set.ts +21 -0
  149. package/src/contracts/recording_credits/recording_credits.ts +458 -0
  150. package/src/contracts/recording_credits/recording_party_role.ts +1041 -0
  151. package/src/contracts/recording_royalty_pool/recording_royalty_pool.ts +138 -0
  152. package/src/contracts/release_cover_art/deps/0x340057f2174fb59e4626742dd2b46c662237837b6187450cb59e4976ce7eac78/walrus_data.ts +36 -0
  153. package/src/contracts/release_cover_art/deps/cover_art/cover_art.ts +23 -0
  154. package/src/contracts/release_cover_art/deps/per_track/per_track.ts +36 -0
  155. package/src/contracts/release_cover_art/release_cover_art.ts +251 -0
  156. package/src/contracts/release_credits/deps/miso_credit/credit.ts +27 -0
  157. package/src/contracts/release_credits/deps/sui/vec_map.ts +33 -0
  158. package/src/contracts/release_credits/release_credits.ts +156 -0
  159. package/src/contracts/release_credits/release_party_role.ts +87 -0
  160. package/src/contracts/royalty_pool/deps/std/type_name.ts +22 -0
  161. package/src/contracts/royalty_pool/deps/sui/balance.ts +17 -0
  162. package/src/contracts/royalty_pool/deps/sui/vec_map.ts +33 -0
  163. package/src/contracts/royalty_pool/pool.ts +577 -0
  164. package/src/contracts/royalty_pool/stake.ts +317 -0
  165. package/src/contracts.ts +33 -0
  166. package/src/cover.ts +140 -0
  167. package/src/credits.ts +665 -0
  168. package/src/extensions/royalty-pool.ts +90 -0
  169. package/src/index.ts +19 -3
  170. package/src/internal.ts +19 -0
  171. package/src/release-graph.ts +5 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misofm/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Typed query helpers and transaction builders for the Miso platform layer on Sui \u2014 pressings, listings, records, and opinionated work publishing.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -64,6 +64,18 @@
64
64
  "types": "./dist/catalog.d.ts",
65
65
  "default": "./dist/catalog.js"
66
66
  },
67
+ "./credits": {
68
+ "types": "./dist/credits.d.ts",
69
+ "default": "./dist/credits.js"
70
+ },
71
+ "./cover": {
72
+ "types": "./dist/cover.d.ts",
73
+ "default": "./dist/cover.js"
74
+ },
75
+ "./extensions/royalty-pool": {
76
+ "types": "./dist/extensions/royalty-pool.d.ts",
77
+ "default": "./dist/extensions/royalty-pool.js"
78
+ },
67
79
  "./package.json": "./package.json"
68
80
  },
69
81
  "files": [
@@ -93,7 +105,7 @@
93
105
  "typescript": "^5"
94
106
  },
95
107
  "dependencies": {
96
- "@misonetwork/sdk": "^0.2.2"
108
+ "@misonetwork/sdk": "^0.3.1"
97
109
  },
98
110
  "main": "./dist/index.js"
99
111
  }
package/src/catalog.ts CHANGED
@@ -14,10 +14,128 @@
14
14
  import type { ClientWithCoreApi } from "@mysten/sui/client";
15
15
  import type { SuiGraphQLClient } from "@mysten/sui/graphql";
16
16
  import {
17
+ getCompositionAddressByShareType,
17
18
  getOwnedRecordingAdminCaps,
18
19
  getRecordingByShareType,
20
+ getRecordingShareTypes,
21
+ getReleaseById,
19
22
  type Recording,
20
23
  } from "@misonetwork/sdk";
24
+ import {
25
+ getCompositionCredits,
26
+ getRecordingCredits,
27
+ type CreditView,
28
+ type RecordingCreditsView,
29
+ } from "./credits.ts";
30
+
31
+ export interface GetReleaseTrackCreditsOptions {
32
+ /** Core Miso package that defines Composition and Recording. */
33
+ misoPackageId: string;
34
+ /** Package that defines the composition_credits extension key. */
35
+ compositionCreditsPackageId: string;
36
+ /** Package that defines the recording_credits extension key. */
37
+ recordingCreditsPackageId: string;
38
+ }
39
+
40
+ export interface ReleaseTrackCredits {
41
+ compositionCredits: CreditView[];
42
+ recordingCredits: RecordingCreditsView;
43
+ }
44
+
45
+ const EMPTY_RECORDING_CREDITS: RecordingCreditsView = {
46
+ credits: [],
47
+ primaryArtistIds: [],
48
+ featuredArtistIds: [],
49
+ };
50
+
51
+ /**
52
+ * Composition and recording credits for every track on a release, keyed by
53
+ * recording id.
54
+ *
55
+ * The read follows the chain's actual object graph instead of release credits:
56
+ * Release -> Recording -> Composition. Recording credit fields and recording
57
+ * type parameters are fetched together for every track. Composition addresses
58
+ * are then resolved concurrently, deduplicated, and all composition credit
59
+ * fields are fetched concurrently as well.
60
+ */
61
+ export async function getReleaseTrackCredits(
62
+ client: ClientWithCoreApi,
63
+ graphqlClient: SuiGraphQLClient,
64
+ releaseId: string,
65
+ options: GetReleaseTrackCreditsOptions,
66
+ ): Promise<Record<string, ReleaseTrackCredits>> {
67
+ const release = await getReleaseById(client, releaseId);
68
+ return getTrackCreditsByRecordingIds(
69
+ client,
70
+ graphqlClient,
71
+ release.tracks.map((track) => track.recordingId),
72
+ options,
73
+ );
74
+ }
75
+
76
+ /**
77
+ * Composition and recording credits for the supplied recordings, keyed by
78
+ * recording id. This form is intended for consumers that already loaded a
79
+ * release and do not need to fetch it again.
80
+ */
81
+ export async function getTrackCreditsByRecordingIds(
82
+ client: ClientWithCoreApi,
83
+ graphqlClient: SuiGraphQLClient,
84
+ recordingIdsInput: readonly string[],
85
+ options: GetReleaseTrackCreditsOptions,
86
+ ): Promise<Record<string, ReleaseTrackCredits>> {
87
+ const recordingIds = [...new Set(recordingIdsInput)];
88
+
89
+ const recordingReads = await Promise.all(
90
+ recordingIds.map(async (recordingId) => {
91
+ const [recordingCredits, [, compositionShareType]] = await Promise.all([
92
+ getRecordingCredits(client, recordingId, options.recordingCreditsPackageId),
93
+ getRecordingShareTypes(client, recordingId),
94
+ ]);
95
+ return { recordingId, recordingCredits, compositionShareType };
96
+ }),
97
+ );
98
+
99
+ const compositionShareTypes = [...new Set(recordingReads.map((read) => read.compositionShareType))];
100
+ const compositionAddressEntries = await Promise.all(
101
+ compositionShareTypes.map(async (shareType) => {
102
+ const compositionId = await getCompositionAddressByShareType(
103
+ graphqlClient,
104
+ shareType,
105
+ options.misoPackageId,
106
+ );
107
+ if (!compositionId) throw new Error(`Composition not found for share type: ${shareType}`);
108
+ return [shareType, compositionId] as const;
109
+ }),
110
+ );
111
+ const compositionAddressByShareType = new Map(compositionAddressEntries);
112
+
113
+ const compositionIds = [...new Set(compositionAddressEntries.map(([, compositionId]) => compositionId))];
114
+ const compositionCreditEntries = await Promise.all(
115
+ compositionIds.map(async (compositionId) => {
116
+ const credits = await getCompositionCredits(
117
+ client,
118
+ compositionId,
119
+ options.compositionCreditsPackageId,
120
+ );
121
+ return [compositionId, credits ?? []] as const;
122
+ }),
123
+ );
124
+ const compositionCreditsById = new Map(compositionCreditEntries);
125
+
126
+ return Object.fromEntries(
127
+ recordingReads.map((read) => {
128
+ const compositionId = compositionAddressByShareType.get(read.compositionShareType)!;
129
+ return [
130
+ read.recordingId,
131
+ {
132
+ compositionCredits: compositionCreditsById.get(compositionId) ?? [],
133
+ recordingCredits: read.recordingCredits ?? EMPTY_RECORDING_CREDITS,
134
+ },
135
+ ];
136
+ }),
137
+ );
138
+ }
21
139
 
22
140
  export interface GetAdministeredRecordingsOptions {
23
141
  /**
@@ -0,0 +1,169 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+
6
+ /**
7
+ * First-party credits extension for compositions.
8
+ *
9
+ * Attribution (writing credits) is display-oriented and varies across platforms,
10
+ * so it lives here as a dynamic field on the composition rather than in immutable
11
+ * core. The data is attached under `ExtensionKey()` via the composition's
12
+ * cap-gated `uid_mut`, so every mutation is authorized by the composition's admin
13
+ * and credits survive into any lifecycle state (they may be attached before or
14
+ * after the composition is published).
15
+ *
16
+ * This is Miso's canonical credits standard; because it is an extension, other
17
+ * parties may publish their own composition-credits standard against the same
18
+ * `Composition`. Credits are NOT read by the economics — they are attribution.
19
+ */
20
+
21
+ import { MoveTuple, MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
22
+ import { bcs } from '@mysten/sui/bcs';
23
+ import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
24
+ import * as vec_map from './deps/sui/vec_map.js';
25
+ import * as credit from './deps/miso_credit/credit.js';
26
+ import * as composition_party_role from './composition_party_role.js';
27
+ const $moduleName = '@local-pkg/composition_credits::composition_credits';
28
+ export const ExtensionKey = new MoveTuple({ name: `${$moduleName}::ExtensionKey`, fields: [bcs.bool()] });
29
+ export const CompositionCredits = new MoveStruct({ name: `${$moduleName}::CompositionCredits`, fields: {
30
+ /** Map of party IDs to their credit (display name + roles). */
31
+ credits: vec_map.VecMap(bcs.Address, credit.Credit(composition_party_role.CompositionPartyRole))
32
+ } });
33
+ export const CreditAddedEvent = new MoveStruct({ name: `${$moduleName}::CreditAddedEvent`, fields: {
34
+ composition_id: bcs.Address,
35
+ party_id: bcs.Address,
36
+ credit: credit.Credit(composition_party_role.CompositionPartyRole)
37
+ } });
38
+ export const CreditRemovedEvent = new MoveStruct({ name: `${$moduleName}::CreditRemovedEvent`, fields: {
39
+ composition_id: bcs.Address,
40
+ party_id: bcs.Address,
41
+ credit: credit.Credit(composition_party_role.CompositionPartyRole)
42
+ } });
43
+ export interface AddCreditArguments {
44
+ self: RawTransactionArgument<string>;
45
+ cap: RawTransactionArgument<string>;
46
+ party: RawTransactionArgument<string>;
47
+ credit: TransactionArgument;
48
+ }
49
+ export interface AddCreditOptions {
50
+ package?: string;
51
+ arguments: AddCreditArguments | [
52
+ self: RawTransactionArgument<string>,
53
+ cap: RawTransactionArgument<string>,
54
+ party: RawTransactionArgument<string>,
55
+ credit: TransactionArgument
56
+ ];
57
+ typeArguments: [
58
+ string
59
+ ];
60
+ }
61
+ /**
62
+ * Adds a credit for a party on the composition, lazily creating the credits record
63
+ * on first use. Each credit must have 1-5 roles, and a party may hold at most one
64
+ * credit. Requires the composition's admin capability.
65
+ */
66
+ export function addCredit(options: AddCreditOptions) {
67
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
68
+ const argumentsTypes = [
69
+ null,
70
+ null,
71
+ null,
72
+ null
73
+ ] satisfies (string | null)[];
74
+ const parameterNames = ["self", "cap", "party", "credit"];
75
+ return (tx: Transaction) => tx.moveCall({
76
+ package: packageAddress,
77
+ module: 'composition_credits',
78
+ function: 'add_credit',
79
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
80
+ typeArguments: options.typeArguments
81
+ });
82
+ }
83
+ export interface RemoveCreditArguments {
84
+ self: RawTransactionArgument<string>;
85
+ cap: RawTransactionArgument<string>;
86
+ partyId: RawTransactionArgument<string>;
87
+ }
88
+ export interface RemoveCreditOptions {
89
+ package?: string;
90
+ arguments: RemoveCreditArguments | [
91
+ self: RawTransactionArgument<string>,
92
+ cap: RawTransactionArgument<string>,
93
+ partyId: RawTransactionArgument<string>
94
+ ];
95
+ typeArguments: [
96
+ string
97
+ ];
98
+ }
99
+ /** Removes a party's credit. Requires the composition's admin capability. */
100
+ export function removeCredit(options: RemoveCreditOptions) {
101
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
102
+ const argumentsTypes = [
103
+ null,
104
+ null,
105
+ '0x2::object::ID'
106
+ ] satisfies (string | null)[];
107
+ const parameterNames = ["self", "cap", "partyId"];
108
+ return (tx: Transaction) => tx.moveCall({
109
+ package: packageAddress,
110
+ module: 'composition_credits',
111
+ function: 'remove_credit',
112
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
113
+ typeArguments: options.typeArguments
114
+ });
115
+ }
116
+ export interface HasCreditsArguments {
117
+ self: RawTransactionArgument<string>;
118
+ }
119
+ export interface HasCreditsOptions {
120
+ package?: string;
121
+ arguments: HasCreditsArguments | [
122
+ self: RawTransactionArgument<string>
123
+ ];
124
+ typeArguments: [
125
+ string
126
+ ];
127
+ }
128
+ /** Returns whether a credits record has been attached to this composition yet. */
129
+ export function hasCredits(options: HasCreditsOptions) {
130
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
131
+ const argumentsTypes = [
132
+ null
133
+ ] satisfies (string | null)[];
134
+ const parameterNames = ["self"];
135
+ return (tx: Transaction) => tx.moveCall({
136
+ package: packageAddress,
137
+ module: 'composition_credits',
138
+ function: 'has_credits',
139
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
140
+ typeArguments: options.typeArguments
141
+ });
142
+ }
143
+ export interface CreditsArguments {
144
+ self: RawTransactionArgument<string>;
145
+ }
146
+ export interface CreditsOptions {
147
+ package?: string;
148
+ arguments: CreditsArguments | [
149
+ self: RawTransactionArgument<string>
150
+ ];
151
+ typeArguments: [
152
+ string
153
+ ];
154
+ }
155
+ /** Returns the party-to-credit map. Aborts if no credits are attached. */
156
+ export function credits(options: CreditsOptions) {
157
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
158
+ const argumentsTypes = [
159
+ null
160
+ ] satisfies (string | null)[];
161
+ const parameterNames = ["self"];
162
+ return (tx: Transaction) => tx.moveCall({
163
+ package: packageAddress,
164
+ module: 'composition_credits',
165
+ function: 'credits',
166
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
167
+ typeArguments: options.typeArguments
168
+ });
169
+ }
@@ -0,0 +1,189 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+
6
+ /**
7
+ * Defines the roles that parties can hold on a composition. Compositions are the
8
+ * underlying musical works (melody + lyrics), and these roles represent the
9
+ * writing and adaptation contributions to them.
10
+ *
11
+ * ### Design
12
+ *
13
+ * `CompositionPartyRole` is a closed enum: variants can only be constructed and
14
+ * matched inside this module, so the `new_*_role` constructors are the external
15
+ * write-API and `name()` is the external read-API.
16
+ *
17
+ * - **No seniority axis.** Unlike recording roles, composition roles carry no
18
+ * level — a writer either contributed in a given capacity or did not.
19
+ * - **`Custom` is the escape hatch.** The canonical variants cover the common
20
+ * writing vocabulary; anything outside it is a `Custom(name)` whose name is
21
+ * validated. Prefer a canonical variant when one fits.
22
+ * - **`name()` is the canonical identifier**, returned as a stable PascalCase
23
+ * token (e.g. `"Songwriter"`). For `Custom`, `name()` returns the user-supplied
24
+ * string.
25
+ *
26
+ * These identifiers are Miso's own canonical vocabulary; any overlap with an
27
+ * external standard (e.g. DDEX) is coincidental, not a reproduction of it.
28
+ */
29
+
30
+ import { MoveEnum, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
31
+ import { bcs } from '@mysten/sui/bcs';
32
+ import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
33
+ const $moduleName = '@local-pkg/composition_credits::composition_party_role';
34
+ /** Represents a party's role on a composition. */
35
+ export const CompositionPartyRole = new MoveEnum({ name: `${$moduleName}::CompositionPartyRole`, fields: {
36
+ /** Adapted an existing work into this composition. */
37
+ Adapter: null,
38
+ /** Arranged the musical parts of the composition. */
39
+ Arranger: null,
40
+ /** Composed the music of the composition. */
41
+ Composer: null,
42
+ /** Wrote the lyrics of the composition. */
43
+ Lyricist: null,
44
+ /** Wrote both music and lyrics of the composition. */
45
+ Songwriter: null,
46
+ /** Translated the lyrics of the composition. */
47
+ Translator: null,
48
+ /**
49
+ * A user-defined role not covered by a canonical variant. Carries the role name
50
+ * (validated). An escape hatch — prefer a canonical variant when one fits.
51
+ */
52
+ Custom: bcs.string()
53
+ } });
54
+ export interface NewAdapterRoleOptions {
55
+ package?: string;
56
+ arguments?: [
57
+ ];
58
+ }
59
+ /** Creates a new Adapter role. */
60
+ export function newAdapterRole(options: NewAdapterRoleOptions = {}) {
61
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
62
+ return (tx: Transaction) => tx.moveCall({
63
+ package: packageAddress,
64
+ module: 'composition_party_role',
65
+ function: 'new_adapter_role',
66
+ });
67
+ }
68
+ export interface NewArrangerRoleOptions {
69
+ package?: string;
70
+ arguments?: [
71
+ ];
72
+ }
73
+ /** Creates a new Arranger role. */
74
+ export function newArrangerRole(options: NewArrangerRoleOptions = {}) {
75
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
76
+ return (tx: Transaction) => tx.moveCall({
77
+ package: packageAddress,
78
+ module: 'composition_party_role',
79
+ function: 'new_arranger_role',
80
+ });
81
+ }
82
+ export interface NewComposerRoleOptions {
83
+ package?: string;
84
+ arguments?: [
85
+ ];
86
+ }
87
+ /** Creates a new Composer role. */
88
+ export function newComposerRole(options: NewComposerRoleOptions = {}) {
89
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
90
+ return (tx: Transaction) => tx.moveCall({
91
+ package: packageAddress,
92
+ module: 'composition_party_role',
93
+ function: 'new_composer_role',
94
+ });
95
+ }
96
+ export interface NewLyricistRoleOptions {
97
+ package?: string;
98
+ arguments?: [
99
+ ];
100
+ }
101
+ /** Creates a new Lyricist role. */
102
+ export function newLyricistRole(options: NewLyricistRoleOptions = {}) {
103
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
104
+ return (tx: Transaction) => tx.moveCall({
105
+ package: packageAddress,
106
+ module: 'composition_party_role',
107
+ function: 'new_lyricist_role',
108
+ });
109
+ }
110
+ export interface NewSongwriterRoleOptions {
111
+ package?: string;
112
+ arguments?: [
113
+ ];
114
+ }
115
+ /** Creates a new Songwriter role. */
116
+ export function newSongwriterRole(options: NewSongwriterRoleOptions = {}) {
117
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
118
+ return (tx: Transaction) => tx.moveCall({
119
+ package: packageAddress,
120
+ module: 'composition_party_role',
121
+ function: 'new_songwriter_role',
122
+ });
123
+ }
124
+ export interface NewTranslatorRoleOptions {
125
+ package?: string;
126
+ arguments?: [
127
+ ];
128
+ }
129
+ /** Creates a new Translator role. */
130
+ export function newTranslatorRole(options: NewTranslatorRoleOptions = {}) {
131
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
132
+ return (tx: Transaction) => tx.moveCall({
133
+ package: packageAddress,
134
+ module: 'composition_party_role',
135
+ function: 'new_translator_role',
136
+ });
137
+ }
138
+ export interface NewCustomRoleArguments {
139
+ roleName: RawTransactionArgument<string>;
140
+ }
141
+ export interface NewCustomRoleOptions {
142
+ package?: string;
143
+ arguments: NewCustomRoleArguments | [
144
+ roleName: RawTransactionArgument<string>
145
+ ];
146
+ }
147
+ /**
148
+ * Creates a new Custom role with a user-defined name. The name freezes into
149
+ * credits, so it is validated here. Prefer a canonical variant when one fits.
150
+ */
151
+ export function newCustomRole(options: NewCustomRoleOptions) {
152
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
153
+ const argumentsTypes = [
154
+ '0x1::string::String'
155
+ ] satisfies (string | null)[];
156
+ const parameterNames = ["roleName"];
157
+ return (tx: Transaction) => tx.moveCall({
158
+ package: packageAddress,
159
+ module: 'composition_party_role',
160
+ function: 'new_custom_role',
161
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
162
+ });
163
+ }
164
+ export interface NameArguments {
165
+ self: TransactionArgument;
166
+ }
167
+ export interface NameOptions {
168
+ package?: string;
169
+ arguments: NameArguments | [
170
+ self: TransactionArgument
171
+ ];
172
+ }
173
+ /**
174
+ * Returns the canonical identifier of the role as a stable PascalCase token. For
175
+ * `Custom`, returns the user-supplied name.
176
+ */
177
+ export function name(options: NameOptions) {
178
+ const packageAddress = options.package ?? '@local-pkg/composition_credits';
179
+ const argumentsTypes = [
180
+ null
181
+ ] satisfies (string | null)[];
182
+ const parameterNames = ["self"];
183
+ return (tx: Transaction) => tx.moveCall({
184
+ package: packageAddress,
185
+ module: 'composition_party_role',
186
+ function: 'name',
187
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
188
+ });
189
+ }
@@ -0,0 +1,27 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+
6
+ /**
7
+ * Represents a party's credit on a work or activity. A credit pairs a display name
8
+ * with one or more roles, identifying how a party contributed to the work.
9
+ */
10
+
11
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
12
+ import { MoveStruct } from '../../../utils/index.js';
13
+ const $moduleName = 'miso_credit::credit';
14
+ /**
15
+ * A credit attributing roles to a party on a work. Generic over the role type to
16
+ * support domain-specific roles.
17
+ */
18
+ export function Credit<Role extends BcsType<any>>(...typeParameters: [
19
+ Role
20
+ ]) {
21
+ return new MoveStruct({ name: `${$moduleName}::Credit<${typeParameters[0].name as Role['name']}>`, fields: {
22
+ /** Human-readable name to display for this credit. */
23
+ display_name: bcs.string(),
24
+ /** Roles assigned to the credited party. */
25
+ roles: bcs.vector(typeParameters[0])
26
+ } });
27
+ }
@@ -0,0 +1,33 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ const $moduleName = '0x2::vec_map';
7
+ /** An entry in the map */
8
+ export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
9
+ K,
10
+ V
11
+ ]) {
12
+ return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
13
+ key: typeParameters[0],
14
+ value: typeParameters[1]
15
+ } });
16
+ }
17
+ /**
18
+ * A map data structure backed by a vector. The map is guaranteed not to contain
19
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
20
+ * insertion order. All operations are O(N) in the size of the map--the intention
21
+ * of this data structure is only to provide the convenience of programming against
22
+ * a map API. Large maps should use handwritten parent/child relationships instead.
23
+ * Maps that need sorted iteration rather than insertion order iteration should
24
+ * also be handwritten.
25
+ */
26
+ export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
27
+ K,
28
+ V
29
+ ]) {
30
+ return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`, fields: {
31
+ contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
32
+ } });
33
+ }