@misofm/sdk 0.15.9 → 0.15.10

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.
@@ -6,38 +6,32 @@
6
6
  /**
7
7
  * Generic capability custody and plugin authorization.
8
8
  *
9
- * `Vault<Cap>` is a permanent, deterministically addressed shell that can hold one
10
- * exact capability in a Sui `Referent`. An authorized plugin receives the whole
11
- * capability temporarily, paired with a hot-potato `Borrow` receipt that forces
12
- * the same capability back into the same vault before the transaction can finish.
13
- * Plugin authorization is represented by a typed dynamic field in the vault's
14
- * `Bag`.
9
+ * `Vault<Cap>` holds a capability in a Sui `Referent`. An authorized plugin
10
+ * receives the whole capability temporarily, paired with a hot-potato `Borrow`
11
+ * receipt that forces the same capability back into the same vault before the
12
+ * transaction can finish. Plugin authorization is represented by a typed dynamic
13
+ * field in the vault's `Bag`.
15
14
  */
16
15
 
16
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
17
17
  import { MoveStruct, MoveTuple, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
18
- import { bcs, type BcsType } from '@mysten/sui/bcs';
19
18
  import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
20
19
  import * as borrow from './deps/sui/borrow.js';
21
20
  import * as bag from './deps/sui/bag.js';
22
21
  const $moduleName = '@local-pkg/vault::vault';
23
- export const VaultRegistry = new MoveStruct({ name: `${$moduleName}::VaultRegistry`, fields: {
24
- id: bcs.Address
25
- } });
26
22
  /**
27
23
  * Custodies one capability and the typed authorization records for plugins.
28
24
  *
29
- * `Vault` intentionally lacks `store`: only this module can share it, and no
30
- * production API can delete it. `cap_id` permanently binds the shell to the exact
31
- * capability from which its ID was derived. An empty Vault can only be restored
32
- * with that same capability object.
25
+ * `Vault` intentionally lacks `store`: only this module can share or destroy it.
26
+ * The wrapped capability is never exposed except through a hot-potato borrow that
27
+ * requires its exact return.
33
28
  */
34
29
  export function Vault<Cap extends BcsType<any>>(...typeParameters: [
35
30
  Cap
36
31
  ]) {
37
32
  return new MoveStruct({ name: `${$moduleName}::Vault<${typeParameters[0].name as Cap['name']}>`, fields: {
38
33
  id: bcs.Address,
39
- cap_id: bcs.Address,
40
- cap: bcs.option(borrow.Referent(typeParameters[0])),
34
+ cap: borrow.Referent(typeParameters[0]),
41
35
  authorized_plugins: bag.Bag
42
36
  } });
43
37
  }
@@ -45,16 +39,11 @@ export const VaultAdminCap = new MoveStruct({ name: `${$moduleName}::VaultAdminC
45
39
  id: bcs.Address,
46
40
  vault_id: bcs.Address
47
41
  } });
48
- export const VaultKey = new MoveTuple({ name: `${$moduleName}::VaultKey<phantom Cap>`, fields: [bcs.Address] });
49
- export const VaultAdminCapKey = new MoveTuple({ name: `${$moduleName}::VaultAdminCapKey`, fields: [bcs.bool()] });
50
42
  export const AuthorizedPluginKey = new MoveTuple({ name: `${$moduleName}::AuthorizedPluginKey<phantom Witness>`, fields: [bcs.bool()] });
51
- export const VaultRegistryCreatedEvent = new MoveStruct({ name: `${$moduleName}::VaultRegistryCreatedEvent`, fields: {
52
- registry_id: bcs.Address
53
- } });
54
43
  export const VaultCreatedEvent = new MoveStruct({ name: `${$moduleName}::VaultCreatedEvent<phantom Cap>`, fields: {
55
44
  vault_id: bcs.Address,
56
45
  vault_admin_cap_id: bcs.Address,
57
- cap_id: bcs.Address,
46
+ wrapped_cap_id: bcs.Address,
58
47
  authorized_plugins_id: bcs.Address
59
48
  } });
60
49
  export const PluginAuthorizedEvent = new MoveStruct({ name: `${$moduleName}::PluginAuthorizedEvent<phantom Cap, phantom Witness>`, fields: {
@@ -63,39 +52,29 @@ export const PluginAuthorizedEvent = new MoveStruct({ name: `${$moduleName}::Plu
63
52
  export const PluginRevokedEvent = new MoveStruct({ name: `${$moduleName}::PluginRevokedEvent<phantom Cap, phantom Witness>`, fields: {
64
53
  vault_id: bcs.Address
65
54
  } });
66
- export const VaultCapabilityWithdrawnEvent = new MoveStruct({ name: `${$moduleName}::VaultCapabilityWithdrawnEvent<phantom Cap>`, fields: {
55
+ export const VaultDestroyedEvent = new MoveStruct({ name: `${$moduleName}::VaultDestroyedEvent<phantom Cap>`, fields: {
67
56
  vault_id: bcs.Address,
68
- cap_id: bcs.Address
69
- } });
70
- export const VaultCapabilityRestoredEvent = new MoveStruct({ name: `${$moduleName}::VaultCapabilityRestoredEvent<phantom Cap>`, fields: {
71
- vault_id: bcs.Address,
72
- cap_id: bcs.Address
57
+ wrapped_cap_id: bcs.Address
73
58
  } });
74
59
  export interface NewArguments<Cap extends BcsType<any>> {
75
- registry: RawTransactionArgument<string>;
76
60
  cap: RawTransactionArgument<Cap>;
77
61
  }
78
62
  export interface NewOptions<Cap extends BcsType<any>> {
79
63
  package?: string;
80
64
  arguments: NewArguments<Cap> | [
81
- registry: RawTransactionArgument<string>,
82
65
  cap: RawTransactionArgument<Cap>
83
66
  ];
84
67
  typeArguments: [
85
68
  string
86
69
  ];
87
70
  }
88
- /**
89
- * Custody `cap` in its canonical permanent Vault and create the canonical
90
- * vault-specific administrator capability.
91
- */
71
+ /** Custody `cap` and create its vault-specific administrator capability. */
92
72
  export function _new<Cap extends BcsType<any>>(options: NewOptions<Cap>) {
93
73
  const packageAddress = options.package ?? '@local-pkg/vault';
94
74
  const argumentsTypes = [
95
- null,
96
75
  `${options.typeArguments[0]}`
97
76
  ] satisfies (string | null)[];
98
- const parameterNames = ["registry", "cap"];
77
+ const parameterNames = ["cap"];
99
78
  return (tx: Transaction) => tx.moveCall({
100
79
  package: packageAddress,
101
80
  module: 'vault',
@@ -131,46 +110,13 @@ export function share(options: ShareOptions) {
131
110
  typeArguments: options.typeArguments
132
111
  });
133
112
  }
134
- export interface TransferAdminCapArguments {
135
- adminCap: RawTransactionArgument<string>;
136
- recipient: RawTransactionArgument<string>;
137
- }
138
- export interface TransferAdminCapOptions {
139
- package?: string;
140
- arguments: TransferAdminCapArguments | [
141
- adminCap: RawTransactionArgument<string>,
142
- recipient: RawTransactionArgument<string>
143
- ];
144
- typeArguments: [
145
- string
146
- ];
147
- }
148
- /**
149
- * Transfer exclusive administration without exposing public freeze, share, or
150
- * wrapping operations for the VaultAdminCap.
151
- */
152
- export function transferAdminCap(options: TransferAdminCapOptions) {
153
- const packageAddress = options.package ?? '@local-pkg/vault';
154
- const argumentsTypes = [
155
- null,
156
- 'address'
157
- ] satisfies (string | null)[];
158
- const parameterNames = ["adminCap", "recipient"];
159
- return (tx: Transaction) => tx.moveCall({
160
- package: packageAddress,
161
- module: 'vault',
162
- function: 'transfer_admin_cap',
163
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
164
- typeArguments: options.typeArguments
165
- });
166
- }
167
- export interface WithdrawCapArguments {
113
+ export interface DestroyArguments {
168
114
  self: RawTransactionArgument<string>;
169
115
  adminCap: RawTransactionArgument<string>;
170
116
  }
171
- export interface WithdrawCapOptions {
117
+ export interface DestroyOptions {
172
118
  package?: string;
173
- arguments: WithdrawCapArguments | [
119
+ arguments: DestroyArguments | [
174
120
  self: RawTransactionArgument<string>,
175
121
  adminCap: RawTransactionArgument<string>
176
122
  ];
@@ -178,11 +124,8 @@ export interface WithdrawCapOptions {
178
124
  string
179
125
  ];
180
126
  }
181
- /**
182
- * Withdraw the exact capability while leaving its canonical Vault and
183
- * VaultAdminCap intact. Every plugin must be revoked first.
184
- */
185
- export function withdrawCap(options: WithdrawCapOptions) {
127
+ /** Destroy an empty vault and return the exact capability it custodied. */
128
+ export function destroy(options: DestroyOptions) {
186
129
  const packageAddress = options.package ?? '@local-pkg/vault';
187
130
  const argumentsTypes = [
188
131
  null,
@@ -192,43 +135,7 @@ export function withdrawCap(options: WithdrawCapOptions) {
192
135
  return (tx: Transaction) => tx.moveCall({
193
136
  package: packageAddress,
194
137
  module: 'vault',
195
- function: 'withdraw_cap',
196
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
197
- typeArguments: options.typeArguments
198
- });
199
- }
200
- export interface RestoreCapArguments<Cap extends BcsType<any>> {
201
- self: RawTransactionArgument<string>;
202
- adminCap: RawTransactionArgument<string>;
203
- cap: RawTransactionArgument<Cap>;
204
- }
205
- export interface RestoreCapOptions<Cap extends BcsType<any>> {
206
- package?: string;
207
- arguments: RestoreCapArguments<Cap> | [
208
- self: RawTransactionArgument<string>,
209
- adminCap: RawTransactionArgument<string>,
210
- cap: RawTransactionArgument<Cap>
211
- ];
212
- typeArguments: [
213
- string
214
- ];
215
- }
216
- /**
217
- * Restore the exact capability used to derive this permanent Vault. Restoring
218
- * always starts from a clean plugin-authorization slate.
219
- */
220
- export function restoreCap<Cap extends BcsType<any>>(options: RestoreCapOptions<Cap>) {
221
- const packageAddress = options.package ?? '@local-pkg/vault';
222
- const argumentsTypes = [
223
- null,
224
- null,
225
- `${options.typeArguments[0]}`
226
- ] satisfies (string | null)[];
227
- const parameterNames = ["self", "adminCap", "cap"];
228
- return (tx: Transaction) => tx.moveCall({
229
- package: packageAddress,
230
- module: 'vault',
231
- function: 'restore_cap',
138
+ function: 'destroy',
232
139
  arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
233
140
  typeArguments: options.typeArguments
234
141
  });
@@ -408,59 +315,6 @@ export function putBack<Cap extends BcsType<any>>(options: PutBackOptions<Cap>)
408
315
  typeArguments: options.typeArguments
409
316
  });
410
317
  }
411
- export interface VaultAddressArguments {
412
- registry: RawTransactionArgument<string>;
413
- capId: RawTransactionArgument<string>;
414
- }
415
- export interface VaultAddressOptions {
416
- package?: string;
417
- arguments: VaultAddressArguments | [
418
- registry: RawTransactionArgument<string>,
419
- capId: RawTransactionArgument<string>
420
- ];
421
- typeArguments: [
422
- string
423
- ];
424
- }
425
- /** Derive the canonical Vault address for `cap_id` in this registry. */
426
- export function vaultAddress(options: VaultAddressOptions) {
427
- const packageAddress = options.package ?? '@local-pkg/vault';
428
- const argumentsTypes = [
429
- null,
430
- '0x2::object::ID'
431
- ] satisfies (string | null)[];
432
- const parameterNames = ["registry", "capId"];
433
- return (tx: Transaction) => tx.moveCall({
434
- package: packageAddress,
435
- module: 'vault',
436
- function: 'vault_address',
437
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
438
- typeArguments: options.typeArguments
439
- });
440
- }
441
- export interface VaultAdminCapAddressArguments {
442
- vaultId: RawTransactionArgument<string>;
443
- }
444
- export interface VaultAdminCapAddressOptions {
445
- package?: string;
446
- arguments: VaultAdminCapAddressArguments | [
447
- vaultId: RawTransactionArgument<string>
448
- ];
449
- }
450
- /** Derive the canonical VaultAdminCap address for a Vault ID. */
451
- export function vaultAdminCapAddress(options: VaultAdminCapAddressOptions) {
452
- const packageAddress = options.package ?? '@local-pkg/vault';
453
- const argumentsTypes = [
454
- '0x2::object::ID'
455
- ] satisfies (string | null)[];
456
- const parameterNames = ["vaultId"];
457
- return (tx: Transaction) => tx.moveCall({
458
- package: packageAddress,
459
- module: 'vault',
460
- function: 'vault_admin_cap_address',
461
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
462
- });
463
- }
464
318
  export interface VaultIdArguments {
465
319
  self: RawTransactionArgument<string>;
466
320
  }
@@ -487,65 +341,6 @@ export function vaultId(options: VaultIdOptions) {
487
341
  typeArguments: options.typeArguments
488
342
  });
489
343
  }
490
- export interface CapIdArguments {
491
- self: RawTransactionArgument<string>;
492
- }
493
- export interface CapIdOptions {
494
- package?: string;
495
- arguments: CapIdArguments | [
496
- self: RawTransactionArgument<string>
497
- ];
498
- typeArguments: [
499
- string
500
- ];
501
- }
502
- /** The exact capability object permanently assigned to this Vault. */
503
- export function capId(options: CapIdOptions) {
504
- const packageAddress = options.package ?? '@local-pkg/vault';
505
- const argumentsTypes = [
506
- null
507
- ] satisfies (string | null)[];
508
- const parameterNames = ["self"];
509
- return (tx: Transaction) => tx.moveCall({
510
- package: packageAddress,
511
- module: 'vault',
512
- function: 'cap_id',
513
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
514
- typeArguments: options.typeArguments
515
- });
516
- }
517
- export interface IsOccupiedArguments {
518
- self: RawTransactionArgument<string>;
519
- }
520
- export interface IsOccupiedOptions {
521
- package?: string;
522
- arguments: IsOccupiedArguments | [
523
- self: RawTransactionArgument<string>
524
- ];
525
- typeArguments: [
526
- string
527
- ];
528
- }
529
- /**
530
- * Whether the permanent outer capability slot is occupied.
531
- *
532
- * This is the persistent-state custody view. It remains true during a
533
- * transaction-local lease even though the inner Referent is temporarily empty.
534
- */
535
- export function isOccupied(options: IsOccupiedOptions) {
536
- const packageAddress = options.package ?? '@local-pkg/vault';
537
- const argumentsTypes = [
538
- null
539
- ] satisfies (string | null)[];
540
- const parameterNames = ["self"];
541
- return (tx: Transaction) => tx.moveCall({
542
- package: packageAddress,
543
- module: 'vault',
544
- function: 'is_occupied',
545
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
546
- typeArguments: options.typeArguments
547
- });
548
- }
549
344
  export interface AuthorizedPluginsIdArguments {
550
345
  self: RawTransactionArgument<string>;
551
346
  }
@@ -57,8 +57,6 @@ export interface MisoPlatformDeployment {
57
57
  };
58
58
  readonly objects: {
59
59
  readonly releaseRegistry: string;
60
- /** Shared parent used to derive canonical Vault object ids. */
61
- readonly vaultRegistry: string;
62
60
  /** Shared parent used to derive canonical Genre object ids. */
63
61
  readonly genreRegistry: string;
64
62
  };
@@ -70,7 +68,7 @@ export interface MisoPlatformDeployment {
70
68
  /**
71
69
  * Platform deployments bundled with this SDK release.
72
70
  *
73
- * IDs come only from verified immutable deployment output.
71
+ * IDs come only from the verified output of the Ledger-backed deployment run.
74
72
  * Consumers may still pass an explicit complete deployment for custom networks.
75
73
  */
76
74
  export const MISO_PLATFORM_DEPLOYMENTS = {
@@ -87,12 +85,12 @@ export const MISO_PLATFORM_DEPLOYMENTS = {
87
85
  recordingCredits: "0x7096a47b0ba12063c037d6d417bffade758665a3f313574c8ba218823cfb159a",
88
86
  releaseCredits: "0xbe293700ef758c95b69838df6cfa8377b9cad1dd59cbf933974f68b1766d87b5",
89
87
  royaltyPool: "0x8021942b5e91c5ef5e383ad481102ee96f52dd77b9b3dbcdf06bb133cd7c91ed",
90
- vault: "0xfe396139d500e4381adefea72da2e0157c54ee5c38cc8bdcbc4edd551d043230",
91
- vaultCompositionRoyaltyPoolPlugin: "0xbfd9b6c9d3e5635c0beb5472b45566b92f509ed67ae4a661bf928c359f3b438f",
92
- vaultRecordingRoyaltyPoolPlugin: "0x1643c188790a7e756310ce779b279159356a9bf7fe8237edf1e5b24a15422615",
93
- vaultPartyWalletPlugin: "0x0d869fe4291fec02821aed40c38349bac8547f0c690316f2a1a2273ac1f317ed",
88
+ vault: "0x7075ce4bfc2c738e774c94f1eeb7dc532a5f11ead9b4e3815d90dc16053eae9c",
89
+ vaultCompositionRoyaltyPoolPlugin: "0xdd259821c97e887ec7ca20459ef98e3afbb36d2d613b537fbc0027e02c0eb378",
90
+ vaultRecordingRoyaltyPoolPlugin: "0xbb873a4e285a8e987d8b5e53919f35172071493872a342ca4c02a941c2af44e3",
91
+ vaultPartyWalletPlugin: "0xfb600cc71773f4b9a22921ba16906b4ccfef791540402dbd556b555ca7a305f7",
94
92
  routedStake: "0x7a55b1841043efea865d65a6601e057400a79a0aa7bb11e781a25dbe622cbe5f",
95
- vaultCompositionRoutedStakePlugin: "0xf86994ebd0dabecda1b14efc02a2e71b3219a7c043841ad8097dc3683bd088dd",
93
+ vaultCompositionRoutedStakePlugin: "0x59a5aa190ed14c754ef292a23320bd5749bbb781c4990dcd4a8ad1dff60797d4",
96
94
  coverArt: "0x2dae28058b89df93224bacfb9af42fd3ab41f001c2c815fd57fd575024d9a50b",
97
95
  releaseCoverArt: "0x649b18f2bb3d94f6a611a8e4ad3a29dcf8b7bba3f684056d60897a8a5e835106",
98
96
  genre: "0x5091d30e893105abe24adf75223f587361034e90516c6e509897bb86d18d2387",
@@ -100,7 +98,7 @@ export const MISO_PLATFORM_DEPLOYMENTS = {
100
98
  releaseDspLink: "0x2b8e1d7be7a3cbc07e6167c5b5c6511059791b4a2116c1fa97d65cfd871d0bda",
101
99
  releaseGenre: "0x7882367d45efff41ef0cb9e937029a3f8a3cdf5908d83beeb5cbc0cff178d290",
102
100
  releaseKind: "0x3e74c960d9446ae2ebf228456ddc1b099d2090501c9cbcd284a999aa2e774e12",
103
- vaultReleaseRevenueDistributorPlugin: "0x2172dc326fbf226b6cf6eed610f217fb0ff2682d1938e8089f4d6ce21a4999b5",
101
+ vaultReleaseRevenueDistributorPlugin: "0x23b214507e4b4c344916d10367eaceea1f0dd233b609d99329bb98d55d3c1363",
104
102
  recordingAdvisory: "0x28e0e72c5b892fc888a9007afa59ebe04ed8e47f12632ddb42cd685d09c4af2e",
105
103
  recordingLanguage: "0x4b284a9435cf4f48e3785e4485d16be2fcbcef5beaa2b44b6556d9c1028e2c0d",
106
104
  recordingMasterReference: "0x2b06ab58f2d5a915b42fc5879d52241fc72e804b3da782fa752b2d2f242170c0",
@@ -109,7 +107,6 @@ export const MISO_PLATFORM_DEPLOYMENTS = {
109
107
  },
110
108
  objects: {
111
109
  releaseRegistry: "0xf5941ae9640f6f24b75e921da16c95fd23d776b9e6518c275a50a5ce6337c8ba",
112
- vaultRegistry: "0xee17744a0c6f71bbde98d0c2b4cab58929000fd2f65e28a4676164d34758584b",
113
110
  genreRegistry: "0xa83f9c7a340b5b5b6387d1d5933019b45bcedebbae85bbb89bab855a56e90816",
114
111
  },
115
112
  legacy: {
@@ -277,7 +277,6 @@ function custody(
277
277
  return {
278
278
  kind: "vault",
279
279
  owner: selected.owner,
280
- vaultRegistry: p.deployment.objects.vaultRegistry,
281
280
  capType,
282
281
  vaultPackageId: p.deployment.packages.vault,
283
282
  configure,
@@ -411,7 +410,6 @@ function publishComposition(
411
410
  }
412
411
  custodyNewAdminCap(tx, {
413
412
  adminCap: parts.adminCap,
414
- vaultRegistry: p.deployment.objects.vaultRegistry,
415
413
  capType: compositionCapType(p, node.shareType),
416
414
  vaultPackageId: p.deployment.packages.vault,
417
415
  owner: node.custody.owner,
@@ -481,7 +479,6 @@ function publishRecording(
481
479
  }
482
480
  custodyNewAdminCap(tx, {
483
481
  adminCap: parts.adminCap,
484
- vaultRegistry: p.deployment.objects.vaultRegistry,
485
482
  capType: recordingCapType(p, node.shareType),
486
483
  vaultPackageId: p.deployment.packages.vault,
487
484
  owner: node.custody.owner,
@@ -545,7 +542,6 @@ function publishReleaseObject(
545
542
  }
546
543
  custodyNewAdminCap(tx, {
547
544
  adminCap,
548
- vaultRegistry: p.deployment.objects.vaultRegistry,
549
545
  capType: releaseCapType(p),
550
546
  vaultPackageId: p.deployment.packages.vault,
551
547
  owner: node.custody.owner,
@@ -932,12 +928,12 @@ function findByShareType(
932
928
  return matches[0]!.objectId;
933
929
  }
934
930
 
935
- function vaultsByCap(result: PlatformExecResult) {
931
+ function vaultsByWrappedCap(result: PlatformExecResult) {
936
932
  const out = new Map<string, { vaultId: string; vaultAdminCapId: string }>();
937
933
  for (const event of result.events) {
938
934
  if (!event.eventType.includes("::vault::VaultCreatedEvent<")) continue;
939
935
  const parsed = parseVaultCreatedEvent(event.bcs);
940
- out.set(parsed.cap_id, {
936
+ out.set(parsed.wrapped_cap_id, {
941
937
  vaultId: parsed.vault_id,
942
938
  vaultAdminCapId: parsed.vault_admin_cap_id,
943
939
  });
@@ -947,7 +943,7 @@ function vaultsByCap(result: PlatformExecResult) {
947
943
 
948
944
  function authorityOut(
949
945
  result: PlatformExecResult,
950
- vaults: ReturnType<typeof vaultsByCap>,
946
+ vaults: ReturnType<typeof vaultsByWrappedCap>,
951
947
  selected: PublicationCustody,
952
948
  adminCapId: string,
953
949
  capType: string,
@@ -955,7 +951,7 @@ function authorityOut(
955
951
  ): PublicationAuthorityOut {
956
952
  if (selected.kind === "direct") return { kind: "direct", adminCapId };
957
953
  const found = vaults.get(adminCapId);
958
- if (!found) throw new Error(`No VaultCreatedEvent for admin cap ${adminCapId} in ${result.digest}`);
954
+ if (!found) throw new Error(`No VaultCreatedEvent wrapped admin cap ${adminCapId} in ${result.digest}`);
959
955
  return { kind: "vault", ...found, capType, vaultPackageId };
960
956
  }
961
957
 
@@ -964,7 +960,7 @@ export function parseAtomicPublicationResult(
964
960
  p: AtomicPublicationParams,
965
961
  result: PlatformExecResult,
966
962
  ): AtomicPublicationResult {
967
- const vaults = vaultsByCap(result);
963
+ const vaults = vaultsByWrappedCap(result);
968
964
  const createdCompositions = allCreatedByType(result, "::composition::Composition<");
969
965
  const createdRecordings = allCreatedByType(result, "::recording::Recording<");
970
966
  const createdPools = allCreatedByType(result, "::pool::RoyaltyPool<");
@@ -406,7 +406,7 @@ async function resolveVaultedReleaseCaps(
406
406
  const vault = vaultContract.Vault(networkContracts.release.ReleaseAdminCap).parse(
407
407
  object.content,
408
408
  );
409
- const releaseId = vault.cap?.value?.release_id;
409
+ const releaseId = vault.cap.value?.release_id;
410
410
  if (releaseId) releasesByVault.set(object.objectId, releaseId);
411
411
  } catch {
412
412
  // Batch catalog discovery is best-effort per authority, matching the
package/src/vault.ts CHANGED
@@ -17,7 +17,7 @@ import type {
17
17
  TransactionArgument,
18
18
  TransactionObjectArgument,
19
19
  } from "@mysten/sui/transactions";
20
- import { deriveObjectID, normalizeStructTag } from "@mysten/sui/utils";
20
+ import { normalizeStructTag } from "@mysten/sui/utils";
21
21
  import * as vault from "./contracts/vault/vault.ts";
22
22
  import * as compositionRoyaltyPool from "./contracts/composition_royalty_pool/composition_royalty_pool.ts";
23
23
  import * as recordingRoyaltyPool from "./contracts/recording_royalty_pool/recording_royalty_pool.ts";
@@ -145,8 +145,6 @@ export function invokeWithAdminCap(
145
145
  export interface CustodyNewAdminCapParams {
146
146
  /** The freshly-created raw protocol cap, consumed into the Vault. */
147
147
  readonly adminCap: TransactionObjectArgument;
148
- /** Shared singleton from which canonical Vault IDs are derived. */
149
- readonly vaultRegistry: ObjectInput;
150
148
  readonly capType: string;
151
149
  readonly vaultPackageId: string;
152
150
  /** Recipient of the only owner-held authority: VaultAdminCap. */
@@ -164,7 +162,6 @@ export type AdminCapCustody =
164
162
  | {
165
163
  readonly kind: "vault";
166
164
  readonly owner: string | TransactionArgument;
167
- readonly vaultRegistry: ObjectInput;
168
165
  readonly capType: string;
169
166
  readonly vaultPackageId: string;
170
167
  readonly configure?: CustodyNewAdminCapParams["configure"];
@@ -182,7 +179,6 @@ export function disposeNewAdminCap(
182
179
  }
183
180
  custodyNewAdminCap(tx, {
184
181
  adminCap,
185
- vaultRegistry: custody.vaultRegistry,
186
182
  capType: custody.capType,
187
183
  vaultPackageId: custody.vaultPackageId,
188
184
  owner: custody.owner,
@@ -190,60 +186,23 @@ export function disposeNewAdminCap(
190
186
  });
191
187
  }
192
188
 
193
- /** Withdraw the raw capability while leaving its canonical Vault shell intact. */
194
- export function withdrawVaultCapability(
189
+ /** Destroy a vault only while deliberately disposing of its returned raw cap. */
190
+ export function destroyVault(
195
191
  tx: Transaction,
196
192
  params: {
197
193
  readonly vault: ObjectInput;
198
194
  readonly vaultAdminCap: ObjectInput;
199
195
  readonly capType: string;
200
196
  readonly vaultPackageId: string;
201
- },
202
- ): TransactionObjectArgument {
203
- return tx.add(vault.withdrawCap({
204
- package: params.vaultPackageId,
205
- typeArguments: [params.capType],
206
- arguments: [object(tx, params.vault), object(tx, params.vaultAdminCap)],
207
- }));
208
- }
209
-
210
- /** Restore the one exact capability permanently assigned to a Vault. */
211
- export function restoreVaultCapability(
212
- tx: Transaction,
213
- params: {
214
- readonly vault: ObjectInput;
215
- readonly vaultAdminCap: ObjectInput;
216
- readonly adminCap: ObjectInput;
217
- readonly capType: string;
218
- readonly vaultPackageId: string;
197
+ readonly disposition: AdminCapCustody;
219
198
  },
220
199
  ): void {
221
- tx.add(vault.restoreCap({
200
+ const cap = tx.add(vault.destroy({
222
201
  package: params.vaultPackageId,
223
202
  typeArguments: [params.capType],
224
- arguments: [
225
- object(tx, params.vault),
226
- object(tx, params.vaultAdminCap),
227
- object(tx, params.adminCap),
228
- ],
229
- }));
230
- }
231
-
232
- /** Transfer the key-only VaultAdminCap through the Vault module. */
233
- export function transferVaultAdminCap(
234
- tx: Transaction,
235
- params: {
236
- readonly vaultAdminCap: ObjectInput;
237
- readonly owner: string | TransactionArgument;
238
- readonly capType: string;
239
- readonly vaultPackageId: string;
240
- },
241
- ): void {
242
- tx.add(vault.transferAdminCap({
243
- package: params.vaultPackageId,
244
- typeArguments: [params.capType],
245
- arguments: [object(tx, params.vaultAdminCap), params.owner],
203
+ arguments: [object(tx, params.vault), object(tx, params.vaultAdminCap)],
246
204
  }));
205
+ disposeNewAdminCap(tx, cap, params.disposition);
247
206
  }
248
207
 
249
208
  /**
@@ -258,7 +217,7 @@ export function custodyNewAdminCap(
258
217
  vault._new({
259
218
  package: params.vaultPackageId,
260
219
  typeArguments: [params.capType],
261
- arguments: [object(tx, params.vaultRegistry), params.adminCap],
220
+ arguments: [params.adminCap],
262
221
  }),
263
222
  );
264
223
  const vaultObject = requiredVaultResult(created, 0, "vault::_new");
@@ -271,43 +230,7 @@ export function custodyNewAdminCap(
271
230
  arguments: [vaultObject],
272
231
  }),
273
232
  );
274
- transferVaultAdminCap(tx, {
275
- vaultAdminCap,
276
- owner: params.owner,
277
- capType: params.capType,
278
- vaultPackageId: params.vaultPackageId,
279
- });
280
- }
281
-
282
- export interface VaultIdParams {
283
- readonly vaultRegistryId: string;
284
- readonly capId: string;
285
- readonly capType: string;
286
- readonly vaultPackageId: string;
287
- }
288
-
289
- /** Derive the canonical Vault ID without an RPC lookup. */
290
- export function deriveVaultId(params: VaultIdParams): string {
291
- const keyType = normalizeStructTag(
292
- `${params.vaultPackageId}::vault::VaultKey<${params.capType}>`,
293
- );
294
- return deriveObjectID(
295
- params.vaultRegistryId,
296
- keyType,
297
- vault.VaultKey.serialize([params.capId]).toBytes(),
298
- );
299
- }
300
-
301
- /** Derive the canonical VaultAdminCap ID from its Vault ID. */
302
- export function deriveVaultAdminCapId(
303
- vaultId: string,
304
- vaultPackageId: string,
305
- ): string {
306
- return deriveObjectID(
307
- vaultId,
308
- `${vaultPackageId}::vault::VaultAdminCapKey`,
309
- vault.VaultAdminCapKey.serialize([false]).toBytes(),
310
- );
233
+ tx.transferObjects([vaultAdminCap], params.owner);
311
234
  }
312
235
 
313
236
  export interface CompositionRoyaltyPoolPluginParams {