@misofm/sdk 0.11.0 → 0.12.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.
Files changed (109) hide show
  1. package/README.md +8 -6
  2. package/dist/client.d.ts +10 -16
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +16 -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/routed_stake/routed_stake.d.ts +0 -14
  27. package/dist/contracts/routed_stake/routed_stake.d.ts.map +1 -1
  28. package/dist/contracts/routed_stake/routed_stake.js +0 -14
  29. package/dist/contracts/routed_stake/routed_stake.js.map +1 -1
  30. package/dist/contracts/royalty_pool/pool.d.ts +0 -14
  31. package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
  32. package/dist/contracts/royalty_pool/pool.js +0 -14
  33. package/dist/contracts/royalty_pool/pool.js.map +1 -1
  34. package/dist/contracts/royalty_pool/stake.d.ts +0 -13
  35. package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
  36. package/dist/contracts/royalty_pool/stake.js +0 -14
  37. package/dist/contracts/royalty_pool/stake.js.map +1 -1
  38. package/dist/contracts/vault/vault.d.ts +0 -13
  39. package/dist/contracts/vault/vault.d.ts.map +1 -1
  40. package/dist/contracts/vault/vault.js +0 -14
  41. package/dist/contracts/vault/vault.js.map +1 -1
  42. package/dist/cover.d.ts +1 -1
  43. package/dist/cover.js +1 -1
  44. package/dist/deployments.d.ts +3 -22
  45. package/dist/deployments.d.ts.map +1 -1
  46. package/dist/deployments.js.map +1 -1
  47. package/dist/pressing.d.ts +0 -3
  48. package/dist/pressing.d.ts.map +1 -1
  49. package/dist/pressing.js +1 -1
  50. package/dist/pressing.js.map +1 -1
  51. package/dist/read/artist.d.ts +2 -3
  52. package/dist/read/artist.d.ts.map +1 -1
  53. package/dist/read/artist.js +8 -53
  54. package/dist/read/artist.js.map +1 -1
  55. package/dist/read/catalog.js +3 -3
  56. package/dist/read/catalog.js.map +1 -1
  57. package/dist/read/client.d.ts +3 -3
  58. package/dist/read/client.d.ts.map +1 -1
  59. package/dist/read/client.js +4 -10
  60. package/dist/read/client.js.map +1 -1
  61. package/dist/read/config.d.ts +3 -23
  62. package/dist/read/config.d.ts.map +1 -1
  63. package/dist/read/config.js.map +1 -1
  64. package/dist/read/index.d.ts +2 -2
  65. package/dist/read/index.d.ts.map +1 -1
  66. package/dist/read/index.js +3 -3
  67. package/dist/read/index.js.map +1 -1
  68. package/dist/read/receipts.js +1 -1
  69. package/dist/read/receipts.js.map +1 -1
  70. package/dist/read/types.d.ts +0 -11
  71. package/dist/read/types.d.ts.map +1 -1
  72. package/dist/read/wallet.js +9 -10
  73. package/dist/read/wallet.js.map +1 -1
  74. package/dist/release-extensions.d.ts +4 -2
  75. package/dist/release-extensions.d.ts.map +1 -1
  76. package/dist/release-extensions.js +6 -4
  77. package/dist/release-extensions.js.map +1 -1
  78. package/dist/release-graph.d.ts.map +1 -1
  79. package/dist/release-graph.js +7 -1
  80. package/dist/release-graph.js.map +1 -1
  81. package/dist/vault.d.ts +1 -1
  82. package/dist/vault.d.ts.map +1 -1
  83. package/dist/vault.js +1 -0
  84. package/dist/vault.js.map +1 -1
  85. package/package.json +6 -12
  86. package/src/client.ts +21 -31
  87. package/src/contracts/composition_routed_stake/composition_routed_stake.ts +7 -4
  88. package/src/contracts/genre/genre.ts +7 -30
  89. package/src/contracts/miso_pressing/certificate.ts +64 -29
  90. package/src/contracts/miso_pressing/listing.ts +4 -33
  91. package/src/contracts/miso_pressing/pressing.ts +6 -61
  92. package/src/contracts/routed_stake/routed_stake.ts +0 -27
  93. package/src/contracts/royalty_pool/pool.ts +0 -27
  94. package/src/contracts/royalty_pool/stake.ts +0 -26
  95. package/src/contracts/vault/vault.ts +0 -26
  96. package/src/cover.ts +1 -1
  97. package/src/deployments.ts +3 -22
  98. package/src/pressing.ts +1 -4
  99. package/src/read/artist.ts +9 -66
  100. package/src/read/catalog.ts +3 -3
  101. package/src/read/client.ts +6 -13
  102. package/src/read/config.ts +4 -24
  103. package/src/read/index.ts +2 -4
  104. package/src/read/receipts.ts +1 -1
  105. package/src/read/types.ts +0 -12
  106. package/src/read/wallet.ts +9 -9
  107. package/src/release-extensions.ts +6 -4
  108. package/src/release-graph.ts +7 -1
  109. 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";
@@ -110,7 +111,7 @@ import {
110
111
  type MisoPlatformDeployment,
111
112
  } from "./deployments.ts";
112
113
  import {
113
- deriveGenreId,
114
+ deriveGenreAddress,
114
115
  setReleaseDescription,
115
116
  setReleaseDspLinks,
116
117
  setReleaseGenres,
@@ -171,11 +172,6 @@ export interface MisoOptions<Name extends string = "miso"> {
171
172
  export interface MisoPlatformConfig {
172
173
  /** The published `miso_pressing` package. */
173
174
  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
175
  /**
180
176
  * The `@misonetwork/sdk` protocol package (miso core). Required for the
181
177
  * publish builders (`publishComposition`, `publishRecording`,
@@ -223,7 +219,7 @@ export interface MisoPlatformConfig {
223
219
 
224
220
  /** Params with the ids this client already knows dropped from the call site. */
225
221
  type DistributiveOmit<T, Keys extends PropertyKey> = T extends unknown ? Omit<T, Keys> : never;
226
- type Configured<T> = DistributiveOmit<T, "misoPressingPackageId" | "settingsId">;
222
+ type Configured<T> = DistributiveOmit<T, "misoPressingPackageId">;
227
223
 
228
224
  /** Publish-builder params with the protocol/minato ids this client already knows dropped. */
229
225
  type ConfiguredPublish<T> = DistributiveOmit<T, "misoPackageId" | "minatoPackageId">;
@@ -290,18 +286,18 @@ export class MisoPlatformClient {
290
286
  this.deployment = deployment;
291
287
  }
292
288
 
293
- get packageId(): string {
294
- return this.#config.packageId;
295
- }
296
-
297
- #settings(): string {
298
- const { settingsId } = this.#config;
299
- if (!settingsId) {
289
+ /** Party identity and profile APIs, backed by the network SDK. */
290
+ get party(): PartyProtocolClient {
291
+ if (!this.protocol) {
300
292
  throw new Error(
301
- "misoPlatform: `settingsId` is required to build a purchase pass it to misoPlatform({ settingsId }).",
293
+ "misoPlatform: Party APIs require the complete platform deployment. Use miso({ deployment }).",
302
294
  );
303
295
  }
304
- return settingsId;
296
+ return this.protocol.party;
297
+ }
298
+
299
+ get packageId(): string {
300
+ return this.#config.packageId;
305
301
  }
306
302
 
307
303
  #misoPackageId(): string {
@@ -381,7 +377,7 @@ export class MisoPlatformClient {
381
377
  sale: (releaseId: string, currencyType: string) =>
382
378
  deriveSaleIds(releaseId, currencyType, this.packageId),
383
379
  genre: (canonicalName: string) =>
384
- deriveGenreId(
380
+ deriveGenreAddress(
385
381
  this.#requiredConfig("genreRegistryId", "genre id derivation"),
386
382
  this.#requiredConfig("genrePackageId", "genre id derivation"),
387
383
  canonicalName,
@@ -394,7 +390,6 @@ export class MisoPlatformClient {
394
390
  buyRecord: (p: Configured<BuyRecordParams>): TxThunk =>
395
391
  buyRecord({
396
392
  ...p,
397
- settingsId: this.#settings(),
398
393
  misoPressingPackageId: this.packageId,
399
394
  }),
400
395
  openPressing: (p: Configured<OpenPressingParams>): TxThunk =>
@@ -548,10 +543,10 @@ export class MisoPlatformClient {
548
543
  /** Generated Move-call bindings, for commands this facade doesn't wrap. */
549
544
  get call() {
550
545
  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),
546
+ listing: bindModulePackage(listingContract, this.packageId, ["newFixedPrice", "newFloorPrice", "newEnabledState", "newDisabledState", "buy", "setState", "setPrice", "deriveId", "hasListing", "releaseId", "pressingId", "price", "state", "isLive", "amount"] as const),
547
+ pressing: bindModulePackage(pressingContract, this.packageId, ["newScheduledState", "newActiveState", "newPausedState", "setState", "deriveId", "releaseId", "supply", "isSelling", "pressingAdminCapPressingId"] as const),
553
548
  genre: this.#config.genrePackageId
554
- ? bindModulePackage(genreContract, this.#config.genrePackageId, ["deriveGenreId", "id"] as const)
549
+ ? bindModulePackage(genreContract, this.#config.genrePackageId, ["deriveAddress"] as const)
555
550
  : undefined,
556
551
  releaseDescription: this.#config.releaseDescriptionPackageId
557
552
  ? bindModulePackage(
@@ -589,7 +584,7 @@ export class MisoPlatformClient {
589
584
  )
590
585
  : undefined,
591
586
  vault: this.#config.vaultPackageId
592
- ? bindModulePackage(vaultContract, this.#config.vaultPackageId, ["share", "id", "vaultId", "authorizedPluginsId", "authorizedPluginCount", "isPluginAuthorized"] as const)
587
+ ? bindModulePackage(vaultContract, this.#config.vaultPackageId, ["share", "vaultId", "authorizedPluginsId", "authorizedPluginCount", "isPluginAuthorized"] as const)
593
588
  : undefined,
594
589
  compositionRoyaltyPool: this.#config.compositionRoyaltyPoolPluginPackageId
595
590
  ? bindModulePackage(
@@ -613,10 +608,10 @@ export class MisoPlatformClient {
613
608
  )
614
609
  : undefined,
615
610
  routedStake: this.#config.routedStakePackageId
616
- ? bindModulePackage(routedStakeContract, this.#config.routedStakePackageId, ["share", "register", "unregister", "sweep", "unstake", "restake", "id"] as const)
611
+ ? bindModulePackage(routedStakeContract, this.#config.routedStakePackageId, ["share", "register", "unregister", "sweep", "unstake", "restake", "derivedAddress"] as const)
617
612
  : undefined,
618
613
  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)
614
+ ? bindModulePackage(royaltyPoolContract, this.#config.royaltyPoolPackageId, ["share", "deposit", "redeemAndDeposit", "receiveAndDeposit", "registerStake", "unregisterStake", "claimRewards", "pendingRewards", "stakedShares", "cumulativeRewardPerShare", "cumulativeDeposits", "derivedAddress", "assertDerivedFrom"] as const)
620
615
  : undefined,
621
616
  recordingAdvisory: this.#config.recordingAdvisoryPackageId
622
617
  ? bindModulePackage(recordingAdvisoryContract, this.#config.recordingAdvisoryPackageId, ["explicit", "notExplicit", "cleaned", "setRating", "unsetRating", "hasRating", "isExplicit", "isNotExplicit", "isCleaned"] as const)
@@ -689,8 +684,7 @@ export function miso<const Name extends string = "miso">(
689
684
  client,
690
685
  {
691
686
  packageId: deployment.packages.pressing,
692
- settingsId: deployment.objects.recordSettings,
693
- misoPackageId: deployment.protocol.packageId,
687
+ misoPackageId: deployment.protocol.miso,
694
688
  minatoPackageId: deployment.packages.minato,
695
689
  releaseRegistryId: deployment.objects.releaseRegistry,
696
690
  releaseKindPackageId: deployment.packages.releaseKind,
@@ -730,10 +724,6 @@ export function miso<const Name extends string = "miso">(
730
724
  /**
731
725
  * @deprecated Prefer zero-config `miso()`, which registers the complete facade
732
726
  * 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
727
  */
738
728
  export function misoPlatform(config: MisoPlatformConfig) {
739
729
  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
  }
@@ -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
  }