@misofm/sdk 0.11.0 → 0.12.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 (125) hide show
  1. package/README.md +18 -37
  2. package/dist/client.d.ts +13 -16
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +21 -22
  5. package/dist/client.js.map +1 -1
  6. package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts +4 -2
  7. package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts.map +1 -1
  8. package/dist/contracts/composition_routed_stake/composition_routed_stake.js +3 -2
  9. package/dist/contracts/composition_routed_stake/composition_routed_stake.js.map +1 -1
  10. package/dist/contracts/genre/genre.d.ts +6 -17
  11. package/dist/contracts/genre/genre.d.ts.map +1 -1
  12. package/dist/contracts/genre/genre.js +4 -18
  13. package/dist/contracts/genre/genre.js.map +1 -1
  14. package/dist/contracts/miso_pressing/certificate.d.ts +37 -26
  15. package/dist/contracts/miso_pressing/certificate.d.ts.map +1 -1
  16. package/dist/contracts/miso_pressing/certificate.js +41 -24
  17. package/dist/contracts/miso_pressing/certificate.js.map +1 -1
  18. package/dist/contracts/miso_pressing/listing.d.ts +3 -18
  19. package/dist/contracts/miso_pressing/listing.d.ts.map +1 -1
  20. package/dist/contracts/miso_pressing/listing.js +3 -18
  21. package/dist/contracts/miso_pressing/listing.js.map +1 -1
  22. package/dist/contracts/miso_pressing/pressing.d.ts +6 -37
  23. package/dist/contracts/miso_pressing/pressing.d.ts.map +1 -1
  24. package/dist/contracts/miso_pressing/pressing.js +6 -43
  25. package/dist/contracts/miso_pressing/pressing.js.map +1 -1
  26. package/dist/contracts/party_wallet/party_wallet.d.ts +214 -0
  27. package/dist/contracts/party_wallet/party_wallet.d.ts.map +1 -0
  28. package/dist/contracts/party_wallet/party_wallet.js +214 -0
  29. package/dist/contracts/party_wallet/party_wallet.js.map +1 -0
  30. package/dist/contracts/party_wallet/witness.d.ts +6 -0
  31. package/dist/contracts/party_wallet/witness.d.ts.map +1 -0
  32. package/dist/contracts/party_wallet/witness.js +8 -0
  33. package/dist/contracts/party_wallet/witness.js.map +1 -0
  34. package/dist/contracts/routed_stake/routed_stake.d.ts +0 -14
  35. package/dist/contracts/routed_stake/routed_stake.d.ts.map +1 -1
  36. package/dist/contracts/routed_stake/routed_stake.js +0 -14
  37. package/dist/contracts/routed_stake/routed_stake.js.map +1 -1
  38. package/dist/contracts/royalty_pool/pool.d.ts +0 -14
  39. package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
  40. package/dist/contracts/royalty_pool/pool.js +0 -14
  41. package/dist/contracts/royalty_pool/pool.js.map +1 -1
  42. package/dist/contracts/royalty_pool/stake.d.ts +6 -13
  43. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
  44. package/dist/contracts/royalty_pool/stake.js +6 -14
  45. package/dist/contracts/royalty_pool/stake.js.map +1 -1
  46. package/dist/contracts/vault/vault.d.ts +2 -14
  47. package/dist/contracts/vault/vault.d.ts.map +1 -1
  48. package/dist/contracts/vault/vault.js +2 -15
  49. package/dist/contracts/vault/vault.js.map +1 -1
  50. package/dist/contracts.d.ts +1 -0
  51. package/dist/contracts.d.ts.map +1 -1
  52. package/dist/contracts.js +1 -0
  53. package/dist/contracts.js.map +1 -1
  54. package/dist/cover.d.ts +1 -1
  55. package/dist/cover.js +1 -1
  56. package/dist/deployments.d.ts +84 -27
  57. package/dist/deployments.d.ts.map +1 -1
  58. package/dist/deployments.js +46 -5
  59. package/dist/deployments.js.map +1 -1
  60. package/dist/pressing.d.ts +0 -3
  61. package/dist/pressing.d.ts.map +1 -1
  62. package/dist/pressing.js +1 -1
  63. package/dist/pressing.js.map +1 -1
  64. package/dist/read/artist.d.ts +2 -3
  65. package/dist/read/artist.d.ts.map +1 -1
  66. package/dist/read/artist.js +8 -53
  67. package/dist/read/artist.js.map +1 -1
  68. package/dist/read/catalog.js +3 -3
  69. package/dist/read/catalog.js.map +1 -1
  70. package/dist/read/client.d.ts +3 -3
  71. package/dist/read/client.d.ts.map +1 -1
  72. package/dist/read/client.js +4 -10
  73. package/dist/read/client.js.map +1 -1
  74. package/dist/read/config.d.ts +3 -23
  75. package/dist/read/config.d.ts.map +1 -1
  76. package/dist/read/config.js.map +1 -1
  77. package/dist/read/index.d.ts +2 -2
  78. package/dist/read/index.d.ts.map +1 -1
  79. package/dist/read/index.js +3 -3
  80. package/dist/read/index.js.map +1 -1
  81. package/dist/read/receipts.js +1 -1
  82. package/dist/read/receipts.js.map +1 -1
  83. package/dist/read/types.d.ts +0 -11
  84. package/dist/read/types.d.ts.map +1 -1
  85. package/dist/read/wallet.js +9 -10
  86. package/dist/read/wallet.js.map +1 -1
  87. package/dist/release-extensions.d.ts +4 -2
  88. package/dist/release-extensions.d.ts.map +1 -1
  89. package/dist/release-extensions.js +6 -4
  90. package/dist/release-extensions.js.map +1 -1
  91. package/dist/release-graph.d.ts.map +1 -1
  92. package/dist/release-graph.js +7 -1
  93. package/dist/release-graph.js.map +1 -1
  94. package/dist/vault.d.ts +1 -1
  95. package/dist/vault.d.ts.map +1 -1
  96. package/dist/vault.js +1 -0
  97. package/dist/vault.js.map +1 -1
  98. package/package.json +7 -13
  99. package/src/client.ts +31 -31
  100. package/src/contracts/composition_routed_stake/composition_routed_stake.ts +7 -4
  101. package/src/contracts/genre/genre.ts +7 -30
  102. package/src/contracts/miso_pressing/certificate.ts +64 -29
  103. package/src/contracts/miso_pressing/listing.ts +4 -33
  104. package/src/contracts/miso_pressing/pressing.ts +6 -61
  105. package/src/contracts/party_wallet/party_wallet.ts +350 -0
  106. package/src/contracts/party_wallet/witness.ts +7 -0
  107. package/src/contracts/routed_stake/routed_stake.ts +0 -27
  108. package/src/contracts/royalty_pool/pool.ts +0 -27
  109. package/src/contracts/royalty_pool/stake.ts +8 -28
  110. package/src/contracts/vault/vault.ts +2 -27
  111. package/src/contracts.ts +1 -0
  112. package/src/cover.ts +1 -1
  113. package/src/deployments.ts +55 -27
  114. package/src/pressing.ts +1 -4
  115. package/src/read/artist.ts +9 -66
  116. package/src/read/catalog.ts +3 -3
  117. package/src/read/client.ts +6 -13
  118. package/src/read/config.ts +4 -24
  119. package/src/read/index.ts +2 -4
  120. package/src/read/receipts.ts +1 -1
  121. package/src/read/types.ts +0 -12
  122. package/src/read/wallet.ts +9 -9
  123. package/src/release-extensions.ts +6 -4
  124. package/src/release-graph.ts +7 -1
  125. package/src/vault.ts +2 -1
package/src/client.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  // Two things this buys over calling the bare functions:
15
15
  //
16
16
  // IDS ARE CONFIGURED ONCE. Every builder and reader below needs the pressing
17
- // package id, and half of them need the record `Settings` too. Threading those
17
+ // package id. Threading those
18
18
  // through 20 call sites is how an app ends up publishing against one package and
19
19
  // reading against another.
20
20
  //
@@ -36,6 +36,7 @@ import {
36
36
  miso as protocolMiso,
37
37
  type MisoProtocolClient,
38
38
  } from "@misonetwork/sdk/client";
39
+ import type { PartyProtocolClient } from "@misonetwork/sdk/party";
39
40
 
40
41
  import * as listingContract from "./contracts/miso_pressing/listing.ts";
41
42
  import * as pressingContract from "./contracts/miso_pressing/pressing.ts";
@@ -48,6 +49,7 @@ import * as releaseRevenueDistributorContract from "./contracts/release_revenue_
48
49
  import * as vaultContract from "./contracts/vault/vault.ts";
49
50
  import * as compositionRoyaltyPoolContract from "./contracts/composition_royalty_pool/composition_royalty_pool.ts";
50
51
  import * as recordingRoyaltyPoolContract from "./contracts/recording_royalty_pool/recording_royalty_pool.ts";
52
+ import * as partyWalletContract from "./contracts/party_wallet/party_wallet.ts";
51
53
  import * as compositionRoutedStakeContract from "./contracts/composition_routed_stake/composition_routed_stake.ts";
52
54
  import * as routedStakeContract from "./contracts/routed_stake/routed_stake.ts";
53
55
  import * as royaltyPoolContract from "./contracts/royalty_pool/pool.ts";
@@ -110,7 +112,7 @@ import {
110
112
  type MisoPlatformDeployment,
111
113
  } from "./deployments.ts";
112
114
  import {
113
- deriveGenreId,
115
+ deriveGenreAddress,
114
116
  setReleaseDescription,
115
117
  setReleaseDspLinks,
116
118
  setReleaseGenres,
@@ -171,11 +173,6 @@ export interface MisoOptions<Name extends string = "miso"> {
171
173
  export interface MisoPlatformConfig {
172
174
  /** The published `miso_pressing` package. */
173
175
  packageId: string;
174
- /**
175
- * The `miso_record` shared `Settings` that authorizes `miso_pressing`'s
176
- * `MintWitness`. Required to buy; optional if this client only ever reads.
177
- */
178
- settingsId?: string;
179
176
  /**
180
177
  * The `@misonetwork/sdk` protocol package (miso core). Required for the
181
178
  * publish builders (`publishComposition`, `publishRecording`,
@@ -207,6 +204,7 @@ export interface MisoPlatformConfig {
207
204
  /** Vault plugins, deliberately separate from data-extension package ids. */
208
205
  compositionRoyaltyPoolPluginPackageId?: string;
209
206
  recordingRoyaltyPoolPluginPackageId?: string;
207
+ partyWalletPluginPackageId?: string;
210
208
  compositionRoutedStakePluginPackageId?: string;
211
209
  routedStakePackageId?: string;
212
210
  releaseRevenueDistributorPluginPackageId?: string;
@@ -223,7 +221,7 @@ export interface MisoPlatformConfig {
223
221
 
224
222
  /** Params with the ids this client already knows dropped from the call site. */
225
223
  type DistributiveOmit<T, Keys extends PropertyKey> = T extends unknown ? Omit<T, Keys> : never;
226
- type Configured<T> = DistributiveOmit<T, "misoPressingPackageId" | "settingsId">;
224
+ type Configured<T> = DistributiveOmit<T, "misoPressingPackageId">;
227
225
 
228
226
  /** Publish-builder params with the protocol/minato ids this client already knows dropped. */
229
227
  type ConfiguredPublish<T> = DistributiveOmit<T, "misoPackageId" | "minatoPackageId">;
@@ -290,18 +288,18 @@ export class MisoPlatformClient {
290
288
  this.deployment = deployment;
291
289
  }
292
290
 
293
- get packageId(): string {
294
- return this.#config.packageId;
295
- }
296
-
297
- #settings(): string {
298
- const { settingsId } = this.#config;
299
- if (!settingsId) {
291
+ /** Party identity and profile APIs, backed by the network SDK. */
292
+ get party(): PartyProtocolClient {
293
+ if (!this.protocol) {
300
294
  throw new Error(
301
- "misoPlatform: `settingsId` is required to build a purchase pass it to misoPlatform({ settingsId }).",
295
+ "misoPlatform: Party APIs require the complete platform deployment. Use miso({ deployment }).",
302
296
  );
303
297
  }
304
- return settingsId;
298
+ return this.protocol.party;
299
+ }
300
+
301
+ get packageId(): string {
302
+ return this.#config.packageId;
305
303
  }
306
304
 
307
305
  #misoPackageId(): string {
@@ -381,7 +379,7 @@ export class MisoPlatformClient {
381
379
  sale: (releaseId: string, currencyType: string) =>
382
380
  deriveSaleIds(releaseId, currencyType, this.packageId),
383
381
  genre: (canonicalName: string) =>
384
- deriveGenreId(
382
+ deriveGenreAddress(
385
383
  this.#requiredConfig("genreRegistryId", "genre id derivation"),
386
384
  this.#requiredConfig("genrePackageId", "genre id derivation"),
387
385
  canonicalName,
@@ -394,7 +392,6 @@ export class MisoPlatformClient {
394
392
  buyRecord: (p: Configured<BuyRecordParams>): TxThunk =>
395
393
  buyRecord({
396
394
  ...p,
397
- settingsId: this.#settings(),
398
395
  misoPressingPackageId: this.packageId,
399
396
  }),
400
397
  openPressing: (p: Configured<OpenPressingParams>): TxThunk =>
@@ -548,10 +545,10 @@ export class MisoPlatformClient {
548
545
  /** Generated Move-call bindings, for commands this facade doesn't wrap. */
549
546
  get call() {
550
547
  return {
551
- listing: bindModulePackage(listingContract, this.packageId, ["newFixedPrice", "newFloorPrice", "newEnabledState", "newDisabledState", "buy", "setState", "setPrice", "deriveId", "hasListing", "id", "releaseId", "pressingId", "price", "state", "isLive", "amount"] as const),
552
- pressing: bindModulePackage(pressingContract, this.packageId, ["newScheduledState", "newActiveState", "newPausedState", "setState", "deriveId", "id", "releaseId", "supply", "isSelling", "pressingAdminCapPressingId", "verifyRecord"] as const),
548
+ listing: bindModulePackage(listingContract, this.packageId, ["newFixedPrice", "newFloorPrice", "newEnabledState", "newDisabledState", "buy", "setState", "setPrice", "deriveId", "hasListing", "releaseId", "pressingId", "price", "state", "isLive", "amount"] as const),
549
+ pressing: bindModulePackage(pressingContract, this.packageId, ["newScheduledState", "newActiveState", "newPausedState", "setState", "deriveId", "releaseId", "supply", "isSelling", "pressingAdminCapPressingId"] as const),
553
550
  genre: this.#config.genrePackageId
554
- ? bindModulePackage(genreContract, this.#config.genrePackageId, ["deriveGenreId", "id"] as const)
551
+ ? bindModulePackage(genreContract, this.#config.genrePackageId, ["deriveAddress"] as const)
555
552
  : undefined,
556
553
  releaseDescription: this.#config.releaseDescriptionPackageId
557
554
  ? bindModulePackage(
@@ -589,7 +586,7 @@ export class MisoPlatformClient {
589
586
  )
590
587
  : undefined,
591
588
  vault: this.#config.vaultPackageId
592
- ? bindModulePackage(vaultContract, this.#config.vaultPackageId, ["share", "id", "vaultId", "authorizedPluginsId", "authorizedPluginCount", "isPluginAuthorized"] as const)
589
+ ? bindModulePackage(vaultContract, this.#config.vaultPackageId, ["share", "vaultId", "authorizedPluginsId", "authorizedPluginCount", "isPluginAuthorized"] as const)
593
590
  : undefined,
594
591
  compositionRoyaltyPool: this.#config.compositionRoyaltyPoolPluginPackageId
595
592
  ? bindModulePackage(
@@ -605,6 +602,13 @@ export class MisoPlatformClient {
605
602
  ["install", "uninstall", "initializePool", "receiveAndDeposit", "redeemAndDeposit", "isInstalled", "poolAddress"] as const,
606
603
  )
607
604
  : undefined,
605
+ partyWallet: this.#config.partyWalletPluginPackageId
606
+ ? bindModulePackage(
607
+ partyWalletContract,
608
+ this.#config.partyWalletPluginPackageId,
609
+ ["install", "uninstall", "receiveObject", "receiveObjects", "receiveCoins", "redeemCoin", "isInstalled", "inboxAddress", "settledFunds"] as const,
610
+ )
611
+ : undefined,
608
612
  compositionRoutedStake: this.#config.compositionRoutedStakePluginPackageId
609
613
  ? bindModulePackage(
610
614
  compositionRoutedStakeContract,
@@ -613,10 +617,10 @@ export class MisoPlatformClient {
613
617
  )
614
618
  : undefined,
615
619
  routedStake: this.#config.routedStakePackageId
616
- ? bindModulePackage(routedStakeContract, this.#config.routedStakePackageId, ["share", "register", "unregister", "sweep", "unstake", "restake", "id"] as const)
620
+ ? bindModulePackage(routedStakeContract, this.#config.routedStakePackageId, ["share", "register", "unregister", "sweep", "unstake", "restake", "derivedAddress"] as const)
617
621
  : undefined,
618
622
  royaltyPool: this.#config.royaltyPoolPackageId
619
- ? bindModulePackage(royaltyPoolContract, this.#config.royaltyPoolPackageId, ["share", "deposit", "redeemAndDeposit", "receiveAndDeposit", "registerStake", "unregisterStake", "claimRewards", "pendingRewards", "id", "stakedShares", "cumulativeRewardPerShare", "cumulativeDeposits", "derivedAddress", "assertDerivedFrom"] as const)
623
+ ? bindModulePackage(royaltyPoolContract, this.#config.royaltyPoolPackageId, ["share", "deposit", "redeemAndDeposit", "receiveAndDeposit", "registerStake", "unregisterStake", "claimRewards", "pendingRewards", "stakedShares", "cumulativeRewardPerShare", "cumulativeDeposits", "derivedAddress", "assertDerivedFrom"] as const)
620
624
  : undefined,
621
625
  recordingAdvisory: this.#config.recordingAdvisoryPackageId
622
626
  ? bindModulePackage(recordingAdvisoryContract, this.#config.recordingAdvisoryPackageId, ["explicit", "notExplicit", "cleaned", "setRating", "unsetRating", "hasRating", "isExplicit", "isNotExplicit", "isCleaned"] as const)
@@ -689,8 +693,7 @@ export function miso<const Name extends string = "miso">(
689
693
  client,
690
694
  {
691
695
  packageId: deployment.packages.pressing,
692
- settingsId: deployment.objects.recordSettings,
693
- misoPackageId: deployment.protocol.packageId,
696
+ misoPackageId: deployment.protocol.miso,
694
697
  minatoPackageId: deployment.packages.minato,
695
698
  releaseRegistryId: deployment.objects.releaseRegistry,
696
699
  releaseKindPackageId: deployment.packages.releaseKind,
@@ -707,6 +710,7 @@ export function miso<const Name extends string = "miso">(
707
710
  deployment.packages.compositionRoyaltyPoolPlugin,
708
711
  recordingRoyaltyPoolPluginPackageId:
709
712
  deployment.packages.recordingRoyaltyPoolPlugin,
713
+ partyWalletPluginPackageId: deployment.packages.partyWalletPlugin,
710
714
  compositionRoutedStakePluginPackageId:
711
715
  deployment.packages.compositionRoutedStakePlugin,
712
716
  routedStakePackageId: deployment.packages.routedStake,
@@ -730,10 +734,6 @@ export function miso<const Name extends string = "miso">(
730
734
  /**
731
735
  * @deprecated Prefer zero-config `miso()`, which registers the complete facade
732
736
  * at `client.miso` and exposes the protocol layer at `client.miso.protocol`.
733
- *
734
- * `settingsId` is optional so a read-only client (an indexer, a catalog page) can
735
- * skip it; asking to build a purchase without it throws rather than sending a
736
- * transaction against the wrong `Settings`.
737
737
  */
738
738
  export function misoPlatform(config: MisoPlatformConfig) {
739
739
  return {
@@ -78,7 +78,7 @@ export function uninstall(options: UninstallOptions) {
78
78
  export interface CreateStakeArguments {
79
79
  vault: RawTransactionArgument<string>;
80
80
  composition: RawTransactionArgument<string>;
81
- Recording: RawTransactionArgument<string>;
81
+ recording: RawTransactionArgument<string>;
82
82
  vaultAdminCap: RawTransactionArgument<string>;
83
83
  value: RawTransactionArgument<number | bigint>;
84
84
  }
@@ -87,7 +87,7 @@ export interface CreateStakeOptions {
87
87
  arguments: CreateStakeArguments | [
88
88
  vault: RawTransactionArgument<string>,
89
89
  composition: RawTransactionArgument<string>,
90
- Recording: RawTransactionArgument<string>,
90
+ recording: RawTransactionArgument<string>,
91
91
  vaultAdminCap: RawTransactionArgument<string>,
92
92
  value: RawTransactionArgument<number | bigint>
93
93
  ];
@@ -110,7 +110,7 @@ export function createStake(options: CreateStakeOptions) {
110
110
  null,
111
111
  'u64'
112
112
  ] satisfies (string | null)[];
113
- const parameterNames = ["vault", "composition", "Recording", "vaultAdminCap", "value"];
113
+ const parameterNames = ["vault", "composition", "recording", "vaultAdminCap", "value"];
114
114
  return (tx: Transaction) => tx.moveCall({
115
115
  package: packageAddress,
116
116
  module: 'composition_routed_stake',
@@ -169,6 +169,7 @@ export function register(options: RegisterOptions) {
169
169
  export interface UnregisterArguments {
170
170
  vault: RawTransactionArgument<string>;
171
171
  composition: RawTransactionArgument<string>;
172
+ recording: RawTransactionArgument<string>;
172
173
  routed: RawTransactionArgument<string>;
173
174
  pool: RawTransactionArgument<string>;
174
175
  vaultAdminCap: RawTransactionArgument<string>;
@@ -178,6 +179,7 @@ export interface UnregisterOptions {
178
179
  arguments: UnregisterArguments | [
179
180
  vault: RawTransactionArgument<string>,
180
181
  composition: RawTransactionArgument<string>,
182
+ recording: RawTransactionArgument<string>,
181
183
  routed: RawTransactionArgument<string>,
182
184
  pool: RawTransactionArgument<string>,
183
185
  vaultAdminCap: RawTransactionArgument<string>
@@ -196,9 +198,10 @@ export function unregister(options: UnregisterOptions) {
196
198
  null,
197
199
  null,
198
200
  null,
201
+ null,
199
202
  null
200
203
  ] satisfies (string | null)[];
201
- const parameterNames = ["vault", "composition", "routed", "pool", "vaultAdminCap"];
204
+ const parameterNames = ["vault", "composition", "recording", "routed", "pool", "vaultAdminCap"];
202
205
  return (tx: Transaction) => tx.moveCall({
203
206
  package: packageAddress,
204
207
  module: 'composition_routed_stake',
@@ -74,22 +74,22 @@ export function _new(options: NewOptions) {
74
74
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
75
75
  });
76
76
  }
77
- export interface DeriveGenreIdArguments {
77
+ export interface DeriveAddressArguments {
78
78
  self: RawTransactionArgument<string>;
79
79
  name: RawTransactionArgument<string>;
80
80
  }
81
- export interface DeriveGenreIdOptions {
81
+ export interface DeriveAddressOptions {
82
82
  package?: string;
83
- arguments: DeriveGenreIdArguments | [
83
+ arguments: DeriveAddressArguments | [
84
84
  self: RawTransactionArgument<string>,
85
85
  name: RawTransactionArgument<string>
86
86
  ];
87
87
  }
88
88
  /**
89
- * Derives the object id a `Genre` with the given name would have, without creating
90
- * it. Lets clients resolve/check a genre id offline.
89
+ * Derives the address a `Genre` with the given name would have, without creating
90
+ * it. Lets clients resolve/check a genre address offline.
91
91
  */
92
- export function deriveGenreId(options: DeriveGenreIdOptions) {
92
+ export function deriveAddress(options: DeriveAddressOptions) {
93
93
  const packageAddress = options.package ?? '@local-pkg/genre';
94
94
  const argumentsTypes = [
95
95
  null,
@@ -99,30 +99,7 @@ export function deriveGenreId(options: DeriveGenreIdOptions) {
99
99
  return (tx: Transaction) => tx.moveCall({
100
100
  package: packageAddress,
101
101
  module: 'genre',
102
- function: 'derive_genre_id',
103
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
104
- });
105
- }
106
- export interface IdArguments {
107
- self: RawTransactionArgument<string>;
108
- }
109
- export interface IdOptions {
110
- package?: string;
111
- arguments: IdArguments | [
112
- self: RawTransactionArgument<string>
113
- ];
114
- }
115
- /** Returns the genre's object id. */
116
- export function id(options: IdOptions) {
117
- const packageAddress = options.package ?? '@local-pkg/genre';
118
- const argumentsTypes = [
119
- null
120
- ] satisfies (string | null)[];
121
- const parameterNames = ["self"];
122
- return (tx: Transaction) => tx.moveCall({
123
- package: packageAddress,
124
- module: 'genre',
125
- function: 'id',
102
+ function: 'derive_address',
126
103
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
127
104
  });
128
105
  }
@@ -4,60 +4,51 @@
4
4
 
5
5
 
6
6
  /**
7
- * The pressing's certificate on a record.
7
+ * Immutable provenance for a record pressed by `miso_pressing`.
8
8
  *
9
- * One struct holds everything the sale fixed about a copy: where it sits in the
10
- * run, and what was paid for it. These were two dynamic fields — a certificate and
11
- * a receipt and separating them bought nothing: both are written once, in the
12
- * same transaction, by the same call, and neither is meaningful without the other.
13
- *
14
- * A serial is only meaningful inside the sequence that issued it — a different
15
- * production package counts from 1 again — so the number never travels alone. It
16
- * does not need to carry its pressing's id to say which sequence it means: a
17
- * release has exactly one pressing, at a derived address, so
18
- * `pressing::derive_id( record.release_id())` recomputes it from the record
19
- * itself. Storing it would be storing a value that is pure arithmetic on values
20
- * already present.
9
+ * `Certificate` is embedded in `Record<Certificate>`, never attached as a dynamic
10
+ * field. Its private fields and package-only constructor mean an external package
11
+ * cannot construct this certificate or mint the trusted record specialization.
21
12
  */
22
13
 
23
- import { MoveTuple, MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
14
+ import { MoveStruct, normalizeMoveArguments } from '../utils/index.js';
24
15
  import { bcs } from '@mysten/sui/bcs';
25
16
  import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
26
17
  import * as type_name from './deps/std/type_name.js';
27
18
  const $moduleName = '@local-pkg/miso_pressing::certificate';
28
- export const CertificateKey = new MoveTuple({ name: `${$moduleName}::CertificateKey`, fields: [bcs.bool()] });
29
19
  export const Certificate = new MoveStruct({ name: `${$moduleName}::Certificate`, fields: {
20
+ /** The object whose derived-UID namespace issued this record. */
21
+ parent_id: bcs.Address,
30
22
  /** Position in the pressing's run (1-based). */
31
23
  number: bcs.u64(),
24
+ /** The transaction sender that purchased the record from its listing. */
25
+ purchased_by: bcs.Address,
32
26
  /** The currency type the buyer paid in. */
33
27
  purchase_currency: type_name.TypeName,
34
28
  /** The exact amount paid. Under a floor price this includes any tip above it. */
35
- purchase_price: bcs.u64()
29
+ purchase_price: bcs.u64(),
30
+ /** The timestamp stamped from the shared Clock on the pressing path. */
31
+ created_at_ms: bcs.u64()
36
32
  } });
37
- export interface OfArguments {
38
- record: RawTransactionArgument<string>;
33
+ export interface ParentIdArguments {
34
+ self: TransactionArgument;
39
35
  }
40
- export interface OfOptions {
36
+ export interface ParentIdOptions {
41
37
  package?: string;
42
- arguments: OfArguments | [
43
- record: RawTransactionArgument<string>
38
+ arguments: ParentIdArguments | [
39
+ self: TransactionArgument
44
40
  ];
45
41
  }
46
- /**
47
- * The certificate on `record`, or `none` for a record minted by some other
48
- * package. The only way to read the field, since only this module can construct
49
- * its key.
50
- */
51
- export function _of(options: OfOptions) {
42
+ export function parentId(options: ParentIdOptions) {
52
43
  const packageAddress = options.package ?? '@local-pkg/miso_pressing';
53
44
  const argumentsTypes = [
54
45
  null
55
46
  ] satisfies (string | null)[];
56
- const parameterNames = ["record"];
47
+ const parameterNames = ["self"];
57
48
  return (tx: Transaction) => tx.moveCall({
58
49
  package: packageAddress,
59
50
  module: 'certificate',
60
- function: 'of',
51
+ function: 'parent_id',
61
52
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
62
53
  });
63
54
  }
@@ -83,6 +74,28 @@ export function number(options: NumberOptions) {
83
74
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
84
75
  });
85
76
  }
77
+ export interface PurchasedByArguments {
78
+ self: TransactionArgument;
79
+ }
80
+ export interface PurchasedByOptions {
81
+ package?: string;
82
+ arguments: PurchasedByArguments | [
83
+ self: TransactionArgument
84
+ ];
85
+ }
86
+ export function purchasedBy(options: PurchasedByOptions) {
87
+ const packageAddress = options.package ?? '@local-pkg/miso_pressing';
88
+ const argumentsTypes = [
89
+ null
90
+ ] satisfies (string | null)[];
91
+ const parameterNames = ["self"];
92
+ return (tx: Transaction) => tx.moveCall({
93
+ package: packageAddress,
94
+ module: 'certificate',
95
+ function: 'purchased_by',
96
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
97
+ });
98
+ }
86
99
  export interface PurchaseCurrencyArguments {
87
100
  self: TransactionArgument;
88
101
  }
@@ -126,4 +139,26 @@ export function purchasePrice(options: PurchasePriceOptions) {
126
139
  function: 'purchase_price',
127
140
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
128
141
  });
142
+ }
143
+ export interface CreatedAtMsArguments {
144
+ self: TransactionArgument;
145
+ }
146
+ export interface CreatedAtMsOptions {
147
+ package?: string;
148
+ arguments: CreatedAtMsArguments | [
149
+ self: TransactionArgument
150
+ ];
151
+ }
152
+ export function createdAtMs(options: CreatedAtMsOptions) {
153
+ const packageAddress = options.package ?? '@local-pkg/miso_pressing';
154
+ const argumentsTypes = [
155
+ null
156
+ ] satisfies (string | null)[];
157
+ const parameterNames = ["self"];
158
+ return (tx: Transaction) => tx.moveCall({
159
+ package: packageAddress,
160
+ module: 'certificate',
161
+ function: 'created_at_ms',
162
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
163
+ });
129
164
  }
@@ -250,15 +250,13 @@ export interface BuyArguments {
250
250
  self: RawTransactionArgument<string>;
251
251
  pressing: RawTransactionArgument<string>;
252
252
  payment: TransactionArgument;
253
- settings: RawTransactionArgument<string>;
254
253
  }
255
254
  export interface BuyOptions {
256
255
  package?: string;
257
256
  arguments: BuyArguments | [
258
257
  self: RawTransactionArgument<string>,
259
258
  pressing: RawTransactionArgument<string>,
260
- payment: TransactionArgument,
261
- settings: RawTransactionArgument<string>
259
+ payment: TransactionArgument
262
260
  ];
263
261
  typeArguments: [
264
262
  string
@@ -273,8 +271,8 @@ export interface BuyOptions {
273
271
  * address — under `Floor`, anything above the floor is kept as a tip, not
274
272
  * refunded. The record's number is the pressing's next 1-based value, shared with
275
273
  * every other currency selling the same run, and its UID is derived off the
276
- * pressing. The sale's terms ride out on the record's `Certificate`. `settings`
277
- * must authorize this package's `MintWitness`.
274
+ * pressing. The sale's transaction sender and terms are embedded in the record's
275
+ * `Certificate`.
278
276
  *
279
277
  * Both switches must be open: this listing `Enabled`, checked here, and the run
280
278
  * selling at this moment, checked in `pressing::mint_next`.
@@ -285,10 +283,9 @@ export function buy(options: BuyOptions) {
285
283
  null,
286
284
  null,
287
285
  null,
288
- null,
289
286
  '0x2::clock::Clock'
290
287
  ] satisfies (string | null)[];
291
- const parameterNames = ["self", "pressing", "payment", "settings"];
288
+ const parameterNames = ["self", "pressing", "payment"];
292
289
  return (tx: Transaction) => tx.moveCall({
293
290
  package: packageAddress,
294
291
  module: 'listing',
@@ -431,32 +428,6 @@ export function hasListing(options: HasListingOptions) {
431
428
  typeArguments: options.typeArguments
432
429
  });
433
430
  }
434
- export interface IdArguments {
435
- self: RawTransactionArgument<string>;
436
- }
437
- export interface IdOptions {
438
- package?: string;
439
- arguments: IdArguments | [
440
- self: RawTransactionArgument<string>
441
- ];
442
- typeArguments: [
443
- string
444
- ];
445
- }
446
- export function id(options: IdOptions) {
447
- const packageAddress = options.package ?? '@local-pkg/miso_pressing';
448
- const argumentsTypes = [
449
- null
450
- ] satisfies (string | null)[];
451
- const parameterNames = ["self"];
452
- return (tx: Transaction) => tx.moveCall({
453
- package: packageAddress,
454
- module: 'listing',
455
- function: 'id',
456
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
457
- typeArguments: options.typeArguments
458
- });
459
- }
460
431
  export interface ReleaseIdArguments {
461
432
  self: RawTransactionArgument<string>;
462
433
  }
@@ -30,8 +30,8 @@
30
30
  * and no stored set of listings: a listing either exists at its derived address or
31
31
  * it does not (`listing::has_listing`), and `ListingOpenedEvent<Currency>`
32
32
  * enumerates them for an indexer. It also makes the number sequence gap-free for
33
- * free, and every record verifiable against its pressing from chain state alone
34
- * (`verify_record`).
33
+ * free, and every record verifiable against its pressing from chain state alone by
34
+ * comparing the certificate and derived address.
35
35
  *
36
36
  * # Starting and stopping is state, never teardown
37
37
  *
@@ -60,20 +60,17 @@
60
60
  * yields `release::uid_mut`, and `balance::withdraw_funds_from_object` is gated on
61
61
  * `&mut UID` alone — so the release cap can withdraw the sales revenue that `buy`
62
62
  * forwards to the release's address. Under one cap, "may reprice a listing" and
63
- * "may take the money" would be the same grant. The pressing cap is the routine
64
- * one, safe to delegate to whoever runs the shop; the release cap stays with the
65
- * rightsholder.
63
+ * "may take the money" would be the same grant. The caps may be held together. If
64
+ * separated, the pressing cap remains issuance authority: it controls listing
65
+ * creation, price, and availability, but cannot withdraw revenue.
66
66
  */
67
67
 
68
- import { MoveTuple, MoveStruct, MoveEnum, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
68
+ import { MoveTuple, MoveEnum, MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
69
69
  import { bcs } from '@mysten/sui/bcs';
70
70
  import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
71
71
  const $moduleName = '@local-pkg/miso_pressing::pressing';
72
72
  export const PressingKey = new MoveTuple({ name: `${$moduleName}::PressingKey`, fields: [bcs.bool()] });
73
73
  export const PressingAdminCapKey = new MoveTuple({ name: `${$moduleName}::PressingAdminCapKey`, fields: [bcs.bool()] });
74
- export const MintWitness = new MoveStruct({ name: `${$moduleName}::MintWitness`, fields: {
75
- dummy_field: bcs.bool()
76
- } });
77
74
  /**
78
75
  * Whether the run sells, over every currency at once. The lifecycle runs
79
76
  * `Scheduled → Active → Paused → Active`: a pressing opens itself at its drop
@@ -301,28 +298,6 @@ export function deriveId(options: DeriveIdOptions) {
301
298
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
302
299
  });
303
300
  }
304
- export interface IdArguments {
305
- self: RawTransactionArgument<string>;
306
- }
307
- export interface IdOptions {
308
- package?: string;
309
- arguments: IdArguments | [
310
- self: RawTransactionArgument<string>
311
- ];
312
- }
313
- export function id(options: IdOptions) {
314
- const packageAddress = options.package ?? '@local-pkg/miso_pressing';
315
- const argumentsTypes = [
316
- null
317
- ] satisfies (string | null)[];
318
- const parameterNames = ["self"];
319
- return (tx: Transaction) => tx.moveCall({
320
- package: packageAddress,
321
- module: 'pressing',
322
- function: 'id',
323
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
324
- });
325
- }
326
301
  export interface ReleaseIdArguments {
327
302
  self: RawTransactionArgument<string>;
328
303
  }
@@ -421,34 +396,4 @@ export function pressingAdminCapPressingId(options: PressingAdminCapPressingIdOp
421
396
  function: 'pressing_admin_cap_pressing_id',
422
397
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
423
398
  });
424
- }
425
- export interface VerifyRecordArguments {
426
- record: RawTransactionArgument<string>;
427
- }
428
- export interface VerifyRecordOptions {
429
- package?: string;
430
- arguments: VerifyRecordArguments | [
431
- record: RawTransactionArgument<string>
432
- ];
433
- }
434
- /**
435
- * Whether `record` is genuinely the copy its certificate claims it is, checked
436
- * from chain state alone and without needing the `Pressing` object.
437
- *
438
- * The record must sit at exactly the address its certificate number derives to off
439
- * its release's pressing. The certificate is the readable form of what the address
440
- * already proves.
441
- */
442
- export function verifyRecord(options: VerifyRecordOptions) {
443
- const packageAddress = options.package ?? '@local-pkg/miso_pressing';
444
- const argumentsTypes = [
445
- null
446
- ] satisfies (string | null)[];
447
- const parameterNames = ["record"];
448
- return (tx: Transaction) => tx.moveCall({
449
- package: packageAddress,
450
- module: 'pressing',
451
- function: 'verify_record',
452
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
453
- });
454
399
  }