@misofm/sdk 0.10.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.
- package/README.md +9 -7
- package/dist/client.d.ts +11 -22
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +16 -32
- package/dist/client.js.map +1 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts +4 -2
- package/dist/contracts/composition_routed_stake/composition_routed_stake.d.ts.map +1 -1
- package/dist/contracts/composition_routed_stake/composition_routed_stake.js +3 -2
- package/dist/contracts/composition_routed_stake/composition_routed_stake.js.map +1 -1
- package/dist/contracts/genre/genre.d.ts +6 -17
- package/dist/contracts/genre/genre.d.ts.map +1 -1
- package/dist/contracts/genre/genre.js +4 -18
- package/dist/contracts/genre/genre.js.map +1 -1
- package/dist/contracts/miso_pressing/certificate.d.ts +37 -26
- package/dist/contracts/miso_pressing/certificate.d.ts.map +1 -1
- package/dist/contracts/miso_pressing/certificate.js +41 -24
- package/dist/contracts/miso_pressing/certificate.js.map +1 -1
- package/dist/contracts/miso_pressing/listing.d.ts +3 -18
- package/dist/contracts/miso_pressing/listing.d.ts.map +1 -1
- package/dist/contracts/miso_pressing/listing.js +3 -18
- package/dist/contracts/miso_pressing/listing.js.map +1 -1
- package/dist/contracts/miso_pressing/pressing.d.ts +6 -37
- package/dist/contracts/miso_pressing/pressing.d.ts.map +1 -1
- package/dist/contracts/miso_pressing/pressing.js +6 -43
- package/dist/contracts/miso_pressing/pressing.js.map +1 -1
- package/dist/contracts/routed_stake/routed_stake.d.ts +0 -14
- package/dist/contracts/routed_stake/routed_stake.d.ts.map +1 -1
- package/dist/contracts/routed_stake/routed_stake.js +0 -14
- package/dist/contracts/routed_stake/routed_stake.js.map +1 -1
- package/dist/contracts/royalty_pool/pool.d.ts +0 -14
- package/dist/contracts/royalty_pool/pool.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/pool.js +0 -14
- package/dist/contracts/royalty_pool/pool.js.map +1 -1
- package/dist/contracts/royalty_pool/stake.d.ts +0 -13
- package/dist/contracts/royalty_pool/stake.d.ts.map +1 -1
- package/dist/contracts/royalty_pool/stake.js +0 -14
- package/dist/contracts/royalty_pool/stake.js.map +1 -1
- package/dist/contracts/vault/vault.d.ts +0 -13
- package/dist/contracts/vault/vault.d.ts.map +1 -1
- package/dist/contracts/vault/vault.js +0 -14
- package/dist/contracts/vault/vault.js.map +1 -1
- package/dist/contracts.d.ts +0 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +0 -1
- package/dist/contracts.js.map +1 -1
- package/dist/cover.d.ts +1 -1
- package/dist/cover.js +1 -1
- package/dist/deployments.d.ts +3 -23
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js.map +1 -1
- package/dist/pressing.d.ts +0 -3
- package/dist/pressing.d.ts.map +1 -1
- package/dist/pressing.js +1 -1
- package/dist/pressing.js.map +1 -1
- package/dist/read/artist.d.ts +2 -3
- package/dist/read/artist.d.ts.map +1 -1
- package/dist/read/artist.js +8 -53
- package/dist/read/artist.js.map +1 -1
- package/dist/read/catalog.js +3 -3
- package/dist/read/catalog.js.map +1 -1
- package/dist/read/client.d.ts +3 -3
- package/dist/read/client.d.ts.map +1 -1
- package/dist/read/client.js +4 -10
- package/dist/read/client.js.map +1 -1
- package/dist/read/config.d.ts +3 -23
- package/dist/read/config.d.ts.map +1 -1
- package/dist/read/config.js.map +1 -1
- package/dist/read/index.d.ts +2 -2
- package/dist/read/index.d.ts.map +1 -1
- package/dist/read/index.js +3 -3
- package/dist/read/index.js.map +1 -1
- package/dist/read/receipts.js +1 -1
- package/dist/read/receipts.js.map +1 -1
- package/dist/read/types.d.ts +0 -11
- package/dist/read/types.d.ts.map +1 -1
- package/dist/read/wallet.js +9 -10
- package/dist/read/wallet.js.map +1 -1
- package/dist/release-extensions.d.ts +4 -10
- package/dist/release-extensions.d.ts.map +1 -1
- package/dist/release-extensions.js +6 -19
- package/dist/release-extensions.js.map +1 -1
- package/dist/release-graph.d.ts.map +1 -1
- package/dist/release-graph.js +7 -1
- package/dist/release-graph.js.map +1 -1
- package/dist/vault.d.ts +1 -1
- package/dist/vault.d.ts.map +1 -1
- package/dist/vault.js +1 -0
- package/dist/vault.js.map +1 -1
- package/package.json +6 -12
- package/src/client.ts +21 -60
- package/src/contracts/composition_routed_stake/composition_routed_stake.ts +7 -4
- package/src/contracts/genre/genre.ts +7 -30
- package/src/contracts/miso_pressing/certificate.ts +64 -29
- package/src/contracts/miso_pressing/listing.ts +4 -33
- package/src/contracts/miso_pressing/pressing.ts +6 -61
- package/src/contracts/routed_stake/routed_stake.ts +0 -27
- package/src/contracts/royalty_pool/pool.ts +0 -27
- package/src/contracts/royalty_pool/stake.ts +0 -26
- package/src/contracts/vault/vault.ts +0 -26
- package/src/contracts.ts +0 -1
- package/src/cover.ts +1 -1
- package/src/deployments.ts +3 -23
- package/src/pressing.ts +1 -4
- package/src/read/artist.ts +9 -66
- package/src/read/catalog.ts +3 -3
- package/src/read/client.ts +6 -13
- package/src/read/config.ts +4 -24
- package/src/read/index.ts +2 -4
- package/src/read/receipts.ts +1 -1
- package/src/read/types.ts +0 -12
- package/src/read/wallet.ts +9 -9
- package/src/release-extensions.ts +6 -29
- package/src/release-graph.ts +7 -1
- package/src/vault.ts +2 -1
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.d.ts +0 -52
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.d.ts.map +0 -1
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.js +0 -37
- package/dist/contracts/release_snapshot_bundle/deps/ori/walrus_data.js.map +0 -1
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.d.ts +0 -91
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.d.ts.map +0 -1
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.js +0 -91
- package/dist/contracts/release_snapshot_bundle/release_snapshot_bundle.js.map +0 -1
- package/src/contracts/release_snapshot_bundle/deps/ori/walrus_data.ts +0 -36
- package/src/contracts/release_snapshot_bundle/release_snapshot_bundle.ts +0 -124
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// intent aggregates these concerns, but every value is written by its own
|
|
6
6
|
// independently deployed extension package.
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { deriveObjectID } from "@mysten/sui/utils";
|
|
9
9
|
import type {
|
|
10
10
|
Transaction,
|
|
11
11
|
TransactionArgument,
|
|
@@ -16,7 +16,6 @@ import * as releaseDescription from "./contracts/release_description/release_des
|
|
|
16
16
|
import * as releaseDspLink from "./contracts/release_dsp_link/release_dsp_link.ts";
|
|
17
17
|
import * as releaseGenre from "./contracts/release_genre/release_genre.ts";
|
|
18
18
|
import * as releaseKind from "./contracts/release_kind/release_kind.ts";
|
|
19
|
-
import * as releaseSnapshotBundle from "./contracts/release_snapshot_bundle/release_snapshot_bundle.ts";
|
|
20
19
|
import { asU64, directAdminCap, invokeWithAdminCap, type AdminCapAuthority, type U64Input } from "./vault.ts";
|
|
21
20
|
|
|
22
21
|
type ReleaseAuthorityInput =
|
|
@@ -92,14 +91,16 @@ export function assertCanonicalGenreName(name: string): void {
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
/** Derive the immutable Genre object
|
|
96
|
-
|
|
94
|
+
/** Derive the immutable Genre object address for a canonical vocabulary name.
|
|
95
|
+
* `genrePackageId` must be the genre package's defining (original publish)
|
|
96
|
+
* address — the on-chain derivation hashes type names with defining IDs. */
|
|
97
|
+
export function deriveGenreAddress(
|
|
97
98
|
genreRegistryId: string,
|
|
98
99
|
genrePackageId: string,
|
|
99
100
|
canonicalName: string,
|
|
100
101
|
): string {
|
|
101
102
|
assertCanonicalGenreName(canonicalName);
|
|
102
|
-
return
|
|
103
|
+
return deriveObjectID(
|
|
103
104
|
genreRegistryId,
|
|
104
105
|
`${genrePackageId}::genre::GenreKey`,
|
|
105
106
|
genre.GenreKey.serialize([canonicalName]).toBytes(),
|
|
@@ -260,27 +261,3 @@ export function setReleaseDspLinks(p: SetReleaseDspLinksParams): TxThunk {
|
|
|
260
261
|
}
|
|
261
262
|
};
|
|
262
263
|
}
|
|
263
|
-
|
|
264
|
-
export type SetReleaseSnapshotBundleParams = ReleaseExtensionTarget & {
|
|
265
|
-
/** Plaintext outer Walrus quilt blob id, as the on-chain u256 value. */
|
|
266
|
-
blobId: bigint | string;
|
|
267
|
-
releaseSnapshotBundlePackageId: string;
|
|
268
|
-
oriPackageId: string;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
/** Attach the write-once release snapshot-bundle pointer. */
|
|
272
|
-
export function setReleaseSnapshotBundle(
|
|
273
|
-
p: SetReleaseSnapshotBundleParams,
|
|
274
|
-
): TxThunk {
|
|
275
|
-
return (tx) => {
|
|
276
|
-
const bundle = tx.moveCall({
|
|
277
|
-
target: `${p.oriPackageId}::walrus_data::new_blob`,
|
|
278
|
-
arguments: [tx.pure.u256(p.blobId)],
|
|
279
|
-
});
|
|
280
|
-
invokeWithAdminCap(tx, authority(p), {
|
|
281
|
-
target: `${p.releaseSnapshotBundlePackageId}::release_snapshot_bundle::set_snapshot_bundle`,
|
|
282
|
-
arguments: [tx.object(p.releaseId), bundle],
|
|
283
|
-
adminCapIndex: 1,
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
}
|
package/src/release-graph.ts
CHANGED
|
@@ -157,7 +157,13 @@ export function publishReleaseGraph(params: PublishReleaseGraphParams): (tx: Tra
|
|
|
157
157
|
type: "0x2::object::ID",
|
|
158
158
|
elements: ordered.map((t) =>
|
|
159
159
|
isFresh(t)
|
|
160
|
-
? tx.
|
|
160
|
+
? tx.moveCall({
|
|
161
|
+
target: "0x2::object::id",
|
|
162
|
+
typeArguments: [
|
|
163
|
+
`${pkg}::recording::Recording<${recTypeArgs(t.recordingIndex).join(",")}>`,
|
|
164
|
+
],
|
|
165
|
+
arguments: [requiredAt(recs, t.recordingIndex, "fresh recording").work],
|
|
166
|
+
})
|
|
161
167
|
: tx.pure.id(t.recordingId),
|
|
162
168
|
),
|
|
163
169
|
});
|
package/src/vault.ts
CHANGED
|
@@ -597,7 +597,7 @@ export function registerCompositionRoutedStake(
|
|
|
597
597
|
/** Unregister a routed stake after pending rewards have been swept. */
|
|
598
598
|
export function unregisterCompositionRoutedStake(
|
|
599
599
|
tx: Transaction,
|
|
600
|
-
params:
|
|
600
|
+
params: ManageCompositionRoutedStakeParams,
|
|
601
601
|
): void {
|
|
602
602
|
tx.add(
|
|
603
603
|
compositionRoutedStake.unregister({
|
|
@@ -610,6 +610,7 @@ export function unregisterCompositionRoutedStake(
|
|
|
610
610
|
arguments: [
|
|
611
611
|
params.vault,
|
|
612
612
|
params.composition,
|
|
613
|
+
params.recording,
|
|
613
614
|
params.routedStake,
|
|
614
615
|
params.royaltyPool,
|
|
615
616
|
params.vaultAdminCap,
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import { MoveEnum, MoveStruct, MoveTuple } from '../../../utils/index.js';
|
|
5
|
-
/**
|
|
6
|
-
* Confidentiality of a stored blob: cleartext, or encrypted with an access policy.
|
|
7
|
-
* Only applies to standalone blobs — a quilt patch is a slice of a shared quilt
|
|
8
|
-
* blob and can never be the direct product of an encryption.
|
|
9
|
-
*/
|
|
10
|
-
export declare const Confidentiality: MoveEnum<{
|
|
11
|
-
/** The blob is stored in the clear. */
|
|
12
|
-
Unencrypted: null;
|
|
13
|
-
/**
|
|
14
|
-
* The blob is AES-encrypted. `dek` is the AES data-encryption key sealed via Seal
|
|
15
|
-
* — a small ciphertext stored on-chain, not the blob bytes. The sealed DEK is
|
|
16
|
-
* itself a Seal `EncryptedObject`, which already carries the decryption-policy
|
|
17
|
-
* package id, so no separate policy field is stored here. Decryption is gated by
|
|
18
|
-
* that policy package's `seal_approve`, not by this library.
|
|
19
|
-
*/
|
|
20
|
-
Encrypted: MoveStruct<{
|
|
21
|
-
dek: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
|
|
22
|
-
length: number;
|
|
23
|
-
}, string>;
|
|
24
|
-
}, "Confidentiality.Encrypted">;
|
|
25
|
-
}, "ori::walrus_data::Confidentiality">;
|
|
26
|
-
/** Represents either a standalone Walrus blob or a patch within a quilt. */
|
|
27
|
-
export declare const WalrusData: MoveEnum<{
|
|
28
|
-
/** A standalone Walrus blob. Fields: blob_id, confidentiality. */
|
|
29
|
-
Blob: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">, MoveEnum<{
|
|
30
|
-
/** The blob is stored in the clear. */
|
|
31
|
-
Unencrypted: null;
|
|
32
|
-
/**
|
|
33
|
-
* The blob is AES-encrypted. `dek` is the AES data-encryption key sealed via Seal
|
|
34
|
-
* — a small ciphertext stored on-chain, not the blob bytes. The sealed DEK is
|
|
35
|
-
* itself a Seal `EncryptedObject`, which already carries the decryption-policy
|
|
36
|
-
* package id, so no separate policy field is stored here. Decryption is gated by
|
|
37
|
-
* that policy package's `seal_approve`, not by this library.
|
|
38
|
-
*/
|
|
39
|
-
Encrypted: MoveStruct<{
|
|
40
|
-
dek: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
|
|
41
|
-
length: number;
|
|
42
|
-
}, string>;
|
|
43
|
-
}, "Confidentiality.Encrypted">;
|
|
44
|
-
}, "ori::walrus_data::Confidentiality">], "WalrusData.Blob">;
|
|
45
|
-
/**
|
|
46
|
-
* A patch within a Walrus quilt. Fields: quilt_id, version, start_index,
|
|
47
|
-
* end_index. Always a plaintext reference into a (possibly separately encrypted)
|
|
48
|
-
* quilt blob.
|
|
49
|
-
*/
|
|
50
|
-
QuiltPatch: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">, import("@mysten/sui/bcs").BcsType<number, number, "u8">, import("@mysten/sui/bcs").BcsType<number, number, "u16">, import("@mysten/sui/bcs").BcsType<number, number, "u16">], "WalrusData.QuiltPatch">;
|
|
51
|
-
}, "ori::walrus_data::WalrusData">;
|
|
52
|
-
//# sourceMappingURL=walrus_data.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"walrus_data.d.ts","sourceRoot":"","sources":["../../../../../src/contracts/release_snapshot_bundle/deps/ori/walrus_data.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAChE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAG1E;;;;GAIG;AACH,eAAO,MAAM,eAAe;IACpB,uCAAuC;;IAEvC;;;;;;OAMG;;;;;;uCAIH,CAAC;AACT,4EAA4E;AAC5E,eAAO,MAAM,UAAU;IACf,kEAAkE;;QAflE,uCAAuC;;QAEvC;;;;;;WAMG;;;;;;;IASH;;;;OAIG;;kCAEH,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import { MoveEnum, MoveStruct, MoveTuple } from '../../../utils/index.js';
|
|
5
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
-
const $moduleName = 'ori::walrus_data';
|
|
7
|
-
/**
|
|
8
|
-
* Confidentiality of a stored blob: cleartext, or encrypted with an access policy.
|
|
9
|
-
* Only applies to standalone blobs — a quilt patch is a slice of a shared quilt
|
|
10
|
-
* blob and can never be the direct product of an encryption.
|
|
11
|
-
*/
|
|
12
|
-
export const Confidentiality = new MoveEnum({ name: `${$moduleName}::Confidentiality`, fields: {
|
|
13
|
-
/** The blob is stored in the clear. */
|
|
14
|
-
Unencrypted: null,
|
|
15
|
-
/**
|
|
16
|
-
* The blob is AES-encrypted. `dek` is the AES data-encryption key sealed via Seal
|
|
17
|
-
* — a small ciphertext stored on-chain, not the blob bytes. The sealed DEK is
|
|
18
|
-
* itself a Seal `EncryptedObject`, which already carries the decryption-policy
|
|
19
|
-
* package id, so no separate policy field is stored here. Decryption is gated by
|
|
20
|
-
* that policy package's `seal_approve`, not by this library.
|
|
21
|
-
*/
|
|
22
|
-
Encrypted: new MoveStruct({ name: `Confidentiality.Encrypted`, fields: {
|
|
23
|
-
dek: bcs.vector(bcs.u8())
|
|
24
|
-
} })
|
|
25
|
-
} });
|
|
26
|
-
/** Represents either a standalone Walrus blob or a patch within a quilt. */
|
|
27
|
-
export const WalrusData = new MoveEnum({ name: `${$moduleName}::WalrusData`, fields: {
|
|
28
|
-
/** A standalone Walrus blob. Fields: blob_id, confidentiality. */
|
|
29
|
-
Blob: new MoveTuple({ name: `WalrusData.Blob`, fields: [bcs.u256(), Confidentiality] }),
|
|
30
|
-
/**
|
|
31
|
-
* A patch within a Walrus quilt. Fields: quilt_id, version, start_index,
|
|
32
|
-
* end_index. Always a plaintext reference into a (possibly separately encrypted)
|
|
33
|
-
* quilt blob.
|
|
34
|
-
*/
|
|
35
|
-
QuiltPatch: new MoveTuple({ name: `WalrusData.QuiltPatch`, fields: [bcs.u256(), bcs.u8(), bcs.u16(), bcs.u16()] })
|
|
36
|
-
} });
|
|
37
|
-
//# sourceMappingURL=walrus_data.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"walrus_data.js","sourceRoot":"","sources":["../../../../../src/contracts/release_snapshot_bundle/deps/ori/walrus_data.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAChE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AACvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,WAAW,mBAAmB,EAAE,MAAM,EAAE;QACvF,uCAAuC;QACvC,WAAW,EAAE,IAAI;QACjB;;;;;;WAMG;QACH,SAAS,EAAE,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,2BAA2B,EAAE,MAAM,EAAE;gBAC/D,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;aAC5B,EAAE,CAAC;KACX,EAAE,CAAC,CAAC;AACT,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,WAAW,cAAc,EAAE,MAAM,EAAE;QAC7E,kEAAkE;QAClE,IAAI,EAAE,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC;QACvF;;;;WAIG;QACH,UAAU,EAAE,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;KACrH,EAAE,CAAC,CAAC"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
/**
|
|
5
|
-
* The on-chain pointer to a release's snapshot bundle: which Walrus quilt is this
|
|
6
|
-
* release's bundle.
|
|
7
|
-
*
|
|
8
|
-
* A snapshot bundle is curated bonus material a buyer gets access to — one Walrus
|
|
9
|
-
* quilt, assembled after the fact. The quilt is self-describing: its plaintext
|
|
10
|
-
* `manifest.json` patch carries all the metadata, its media patches are
|
|
11
|
-
* chunk-encrypted under one AES envelope key, and that key travels Seal-wrapped
|
|
12
|
-
* inside the quilt as its `key.seal` patch. This package therefore stores none of
|
|
13
|
-
* that — no ciphertext, no metadata, no access policy (unlocking by holding a
|
|
14
|
-
* Record is `miso_record_acl`'s concern, in miso-record-extensions). The stored
|
|
15
|
-
* value is the quilt's `WalrusData` blob reference, and nothing else.
|
|
16
|
-
*
|
|
17
|
-
* The slot is write-once: `set_snapshot_bundle` aborts with `EBundleAlreadySet` if
|
|
18
|
-
* a bundle is already set, and there is NO unset, NO remove, and NO replace
|
|
19
|
-
* function. That absence is a product guarantee: the bundle a buyer's Record
|
|
20
|
-
* points at can never be swapped out from under them. More content later means a
|
|
21
|
-
* new Release.
|
|
22
|
-
*/
|
|
23
|
-
import { MoveTuple, MoveStruct, type RawTransactionArgument } from '../utils/index.js';
|
|
24
|
-
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
25
|
-
export declare const ExtensionKey: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">], "@local-pkg/release_snapshot_bundle::release_snapshot_bundle::ExtensionKey">;
|
|
26
|
-
export declare const SnapshotBundleSetEvent: MoveStruct<{
|
|
27
|
-
release_id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
28
|
-
bundle: import("../utils/index.js").MoveEnum<{
|
|
29
|
-
Blob: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">, import("../utils/index.js").MoveEnum<{
|
|
30
|
-
Unencrypted: null;
|
|
31
|
-
Encrypted: MoveStruct<{
|
|
32
|
-
dek: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
|
|
33
|
-
length: number;
|
|
34
|
-
}, string>;
|
|
35
|
-
}, "Confidentiality.Encrypted">;
|
|
36
|
-
}, "ori::walrus_data::Confidentiality">], "WalrusData.Blob">;
|
|
37
|
-
QuiltPatch: MoveTuple<readonly [import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u256">, import("@mysten/sui/bcs").BcsType<number, number, "u8">, import("@mysten/sui/bcs").BcsType<number, number, "u16">, import("@mysten/sui/bcs").BcsType<number, number, "u16">], "WalrusData.QuiltPatch">;
|
|
38
|
-
}, "ori::walrus_data::WalrusData">;
|
|
39
|
-
}, "@local-pkg/release_snapshot_bundle::release_snapshot_bundle::SnapshotBundleSetEvent">;
|
|
40
|
-
export interface SetSnapshotBundleArguments {
|
|
41
|
-
self: RawTransactionArgument<string>;
|
|
42
|
-
cap: RawTransactionArgument<string>;
|
|
43
|
-
bundle: TransactionArgument;
|
|
44
|
-
}
|
|
45
|
-
export interface SetSnapshotBundleOptions {
|
|
46
|
-
package?: string;
|
|
47
|
-
arguments: SetSnapshotBundleArguments | [
|
|
48
|
-
self: RawTransactionArgument<string>,
|
|
49
|
-
cap: RawTransactionArgument<string>,
|
|
50
|
-
bundle: TransactionArgument
|
|
51
|
-
];
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Sets the release's snapshot bundle — once. Aborts with `EBundleAlreadySet` if a
|
|
55
|
-
* bundle is already set; there is no way to unset or replace it.
|
|
56
|
-
*
|
|
57
|
-
* The reference must be a plaintext standalone blob. A quilt patch is a slice of
|
|
58
|
-
* some other quilt, not the bundle's own quilt blob. And the outer quilt blob is
|
|
59
|
-
* plaintext by design: its `manifest.json` patch must be readable, encryption is
|
|
60
|
-
* per-patch inside the quilt, and the Seal-wrapped envelope key travels as the
|
|
61
|
-
* quilt's `key.seal` patch — so an encrypted outer reference is structurally
|
|
62
|
-
* wrong. With no replace function either mistake would be permanent, which is why
|
|
63
|
-
* both checks live on-chain rather than in the client.
|
|
64
|
-
*/
|
|
65
|
-
export declare function setSnapshotBundle(options: SetSnapshotBundleOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
66
|
-
export interface HasSnapshotBundleArguments {
|
|
67
|
-
self: RawTransactionArgument<string>;
|
|
68
|
-
}
|
|
69
|
-
export interface HasSnapshotBundleOptions {
|
|
70
|
-
package?: string;
|
|
71
|
-
arguments: HasSnapshotBundleArguments | [
|
|
72
|
-
self: RawTransactionArgument<string>
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
/** Returns whether a snapshot bundle is set on this release. */
|
|
76
|
-
export declare function hasSnapshotBundle(options: HasSnapshotBundleOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
77
|
-
export interface SnapshotBundleArguments {
|
|
78
|
-
self: RawTransactionArgument<string>;
|
|
79
|
-
}
|
|
80
|
-
export interface SnapshotBundleOptions {
|
|
81
|
-
package?: string;
|
|
82
|
-
arguments: SnapshotBundleArguments | [
|
|
83
|
-
self: RawTransactionArgument<string>
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* The release's snapshot bundle reference. Aborts with `ENoSnapshotBundle` if none
|
|
88
|
-
* is set.
|
|
89
|
-
*/
|
|
90
|
-
export declare function snapshotBundle(options: SnapshotBundleOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
91
|
-
//# sourceMappingURL=release_snapshot_bundle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"release_snapshot_bundle.d.ts","sourceRoot":"","sources":["../../../src/contracts/release_snapshot_bundle/release_snapshot_bundle.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAA0B,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE/G,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGtF,eAAO,MAAM,YAAY,gKAAgF,CAAC;AAC1G,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;yFAG3B,CAAC;AACT,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACrC,GAAG,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,mBAAmB,CAAC;CAC/B;AACD,MAAM,WAAW,wBAAwB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,0BAA0B,GAAG;QACpC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;QACpC,GAAG,EAAE,sBAAsB,CAAC,MAAM,CAAC;QACnC,MAAM,EAAE,mBAAmB;KAC9B,CAAC;CACL;AACD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,IAQvD,IAAI,WAAW,0DAM1B;AACD,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;CACxC;AACD,MAAM,WAAW,wBAAwB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,0BAA0B,GAAG;QACpC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACvC,CAAC;CACL;AACD,gEAAgE;AAChE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,IAMvD,IAAI,WAAW,0DAM1B;AACD,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;CACxC;AACD,MAAM,WAAW,qBAAqB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,uBAAuB,GAAG;QACjC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;KACvC,CAAC;CACL;AACD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,IAMjD,IAAI,WAAW,0DAM1B"}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
/**
|
|
5
|
-
* The on-chain pointer to a release's snapshot bundle: which Walrus quilt is this
|
|
6
|
-
* release's bundle.
|
|
7
|
-
*
|
|
8
|
-
* A snapshot bundle is curated bonus material a buyer gets access to — one Walrus
|
|
9
|
-
* quilt, assembled after the fact. The quilt is self-describing: its plaintext
|
|
10
|
-
* `manifest.json` patch carries all the metadata, its media patches are
|
|
11
|
-
* chunk-encrypted under one AES envelope key, and that key travels Seal-wrapped
|
|
12
|
-
* inside the quilt as its `key.seal` patch. This package therefore stores none of
|
|
13
|
-
* that — no ciphertext, no metadata, no access policy (unlocking by holding a
|
|
14
|
-
* Record is `miso_record_acl`'s concern, in miso-record-extensions). The stored
|
|
15
|
-
* value is the quilt's `WalrusData` blob reference, and nothing else.
|
|
16
|
-
*
|
|
17
|
-
* The slot is write-once: `set_snapshot_bundle` aborts with `EBundleAlreadySet` if
|
|
18
|
-
* a bundle is already set, and there is NO unset, NO remove, and NO replace
|
|
19
|
-
* function. That absence is a product guarantee: the bundle a buyer's Record
|
|
20
|
-
* points at can never be swapped out from under them. More content later means a
|
|
21
|
-
* new Release.
|
|
22
|
-
*/
|
|
23
|
-
import { MoveTuple, MoveStruct, normalizeMoveArguments } from '../utils/index.js';
|
|
24
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
25
|
-
import {} from '@mysten/sui/transactions';
|
|
26
|
-
import * as walrus_data from './deps/ori/walrus_data.js';
|
|
27
|
-
const $moduleName = '@local-pkg/release_snapshot_bundle::release_snapshot_bundle';
|
|
28
|
-
export const ExtensionKey = new MoveTuple({ name: `${$moduleName}::ExtensionKey`, fields: [bcs.bool()] });
|
|
29
|
-
export const SnapshotBundleSetEvent = new MoveStruct({ name: `${$moduleName}::SnapshotBundleSetEvent`, fields: {
|
|
30
|
-
release_id: bcs.Address,
|
|
31
|
-
bundle: walrus_data.WalrusData
|
|
32
|
-
} });
|
|
33
|
-
/**
|
|
34
|
-
* Sets the release's snapshot bundle — once. Aborts with `EBundleAlreadySet` if a
|
|
35
|
-
* bundle is already set; there is no way to unset or replace it.
|
|
36
|
-
*
|
|
37
|
-
* The reference must be a plaintext standalone blob. A quilt patch is a slice of
|
|
38
|
-
* some other quilt, not the bundle's own quilt blob. And the outer quilt blob is
|
|
39
|
-
* plaintext by design: its `manifest.json` patch must be readable, encryption is
|
|
40
|
-
* per-patch inside the quilt, and the Seal-wrapped envelope key travels as the
|
|
41
|
-
* quilt's `key.seal` patch — so an encrypted outer reference is structurally
|
|
42
|
-
* wrong. With no replace function either mistake would be permanent, which is why
|
|
43
|
-
* both checks live on-chain rather than in the client.
|
|
44
|
-
*/
|
|
45
|
-
export function setSnapshotBundle(options) {
|
|
46
|
-
const packageAddress = options.package ?? '@local-pkg/release_snapshot_bundle';
|
|
47
|
-
const argumentsTypes = [
|
|
48
|
-
null,
|
|
49
|
-
null,
|
|
50
|
-
null
|
|
51
|
-
];
|
|
52
|
-
const parameterNames = ["self", "cap", "bundle"];
|
|
53
|
-
return (tx) => tx.moveCall({
|
|
54
|
-
package: packageAddress,
|
|
55
|
-
module: 'release_snapshot_bundle',
|
|
56
|
-
function: 'set_snapshot_bundle',
|
|
57
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
/** Returns whether a snapshot bundle is set on this release. */
|
|
61
|
-
export function hasSnapshotBundle(options) {
|
|
62
|
-
const packageAddress = options.package ?? '@local-pkg/release_snapshot_bundle';
|
|
63
|
-
const argumentsTypes = [
|
|
64
|
-
null
|
|
65
|
-
];
|
|
66
|
-
const parameterNames = ["self"];
|
|
67
|
-
return (tx) => tx.moveCall({
|
|
68
|
-
package: packageAddress,
|
|
69
|
-
module: 'release_snapshot_bundle',
|
|
70
|
-
function: 'has_snapshot_bundle',
|
|
71
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* The release's snapshot bundle reference. Aborts with `ENoSnapshotBundle` if none
|
|
76
|
-
* is set.
|
|
77
|
-
*/
|
|
78
|
-
export function snapshotBundle(options) {
|
|
79
|
-
const packageAddress = options.package ?? '@local-pkg/release_snapshot_bundle';
|
|
80
|
-
const argumentsTypes = [
|
|
81
|
-
null
|
|
82
|
-
];
|
|
83
|
-
const parameterNames = ["self"];
|
|
84
|
-
return (tx) => tx.moveCall({
|
|
85
|
-
package: packageAddress,
|
|
86
|
-
module: 'release_snapshot_bundle',
|
|
87
|
-
function: 'snapshot_bundle',
|
|
88
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=release_snapshot_bundle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"release_snapshot_bundle.js","sourceRoot":"","sources":["../../../src/contracts/release_snapshot_bundle/release_snapshot_bundle.ts"],"names":[],"mappings":"AAAA;;gEAEgE;AAGhE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,sBAAsB,EAA+B,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAA8C,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,WAAW,MAAM,2BAA2B,CAAC;AACzD,MAAM,WAAW,GAAG,6DAA6D,CAAC;AAClF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,GAAG,WAAW,gBAAgB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,WAAW,0BAA0B,EAAE,MAAM,EAAE;QACvG,UAAU,EAAE,GAAG,CAAC,OAAO;QACvB,MAAM,EAAE,WAAW,CAAC,UAAU;KACjC,EAAE,CAAC,CAAC;AAcT;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IAC/D,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,IAAI,oCAAoC,CAAC;IAC/E,MAAM,cAAc,GAAG;QACnB,IAAI;QACJ,IAAI;QACJ,IAAI;KACqB,CAAC;IAC9B,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACjD,OAAO,CAAC,EAAe,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC;QACpC,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,yBAAyB;QACjC,QAAQ,EAAE,qBAAqB;QAC/B,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC;KACvF,CAAC,CAAC;AACP,CAAC;AAUD,gEAAgE;AAChE,MAAM,UAAU,iBAAiB,CAAC,OAAiC;IAC/D,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,IAAI,oCAAoC,CAAC;IAC/E,MAAM,cAAc,GAAG;QACnB,IAAI;KACqB,CAAC;IAC9B,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAe,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC;QACpC,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,yBAAyB;QACjC,QAAQ,EAAE,qBAAqB;QAC/B,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC;KACvF,CAAC,CAAC;AACP,CAAC;AAUD;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAA8B;IACzD,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,IAAI,oCAAoC,CAAC;IAC/E,MAAM,cAAc,GAAG;QACnB,IAAI;KACqB,CAAC;IAC9B,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAe,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC;QACpC,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,yBAAyB;QACjC,QAAQ,EAAE,iBAAiB;QAC3B,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC;KACvF,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
import { MoveEnum, MoveStruct, MoveTuple } from '../../../utils/index.js';
|
|
5
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
6
|
-
const $moduleName = 'ori::walrus_data';
|
|
7
|
-
/**
|
|
8
|
-
* Confidentiality of a stored blob: cleartext, or encrypted with an access policy.
|
|
9
|
-
* Only applies to standalone blobs — a quilt patch is a slice of a shared quilt
|
|
10
|
-
* blob and can never be the direct product of an encryption.
|
|
11
|
-
*/
|
|
12
|
-
export const Confidentiality = new MoveEnum({ name: `${$moduleName}::Confidentiality`, fields: {
|
|
13
|
-
/** The blob is stored in the clear. */
|
|
14
|
-
Unencrypted: null,
|
|
15
|
-
/**
|
|
16
|
-
* The blob is AES-encrypted. `dek` is the AES data-encryption key sealed via Seal
|
|
17
|
-
* — a small ciphertext stored on-chain, not the blob bytes. The sealed DEK is
|
|
18
|
-
* itself a Seal `EncryptedObject`, which already carries the decryption-policy
|
|
19
|
-
* package id, so no separate policy field is stored here. Decryption is gated by
|
|
20
|
-
* that policy package's `seal_approve`, not by this library.
|
|
21
|
-
*/
|
|
22
|
-
Encrypted: new MoveStruct({ name: `Confidentiality.Encrypted`, fields: {
|
|
23
|
-
dek: bcs.vector(bcs.u8())
|
|
24
|
-
} })
|
|
25
|
-
} });
|
|
26
|
-
/** Represents either a standalone Walrus blob or a patch within a quilt. */
|
|
27
|
-
export const WalrusData = new MoveEnum({ name: `${$moduleName}::WalrusData`, fields: {
|
|
28
|
-
/** A standalone Walrus blob. Fields: blob_id, confidentiality. */
|
|
29
|
-
Blob: new MoveTuple({ name: `WalrusData.Blob`, fields: [bcs.u256(), Confidentiality] }),
|
|
30
|
-
/**
|
|
31
|
-
* A patch within a Walrus quilt. Fields: quilt_id, version, start_index,
|
|
32
|
-
* end_index. Always a plaintext reference into a (possibly separately encrypted)
|
|
33
|
-
* quilt blob.
|
|
34
|
-
*/
|
|
35
|
-
QuiltPatch: new MoveTuple({ name: `WalrusData.QuiltPatch`, fields: [bcs.u256(), bcs.u8(), bcs.u16(), bcs.u16()] })
|
|
36
|
-
} });
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The on-chain pointer to a release's snapshot bundle: which Walrus quilt is this
|
|
8
|
-
* release's bundle.
|
|
9
|
-
*
|
|
10
|
-
* A snapshot bundle is curated bonus material a buyer gets access to — one Walrus
|
|
11
|
-
* quilt, assembled after the fact. The quilt is self-describing: its plaintext
|
|
12
|
-
* `manifest.json` patch carries all the metadata, its media patches are
|
|
13
|
-
* chunk-encrypted under one AES envelope key, and that key travels Seal-wrapped
|
|
14
|
-
* inside the quilt as its `key.seal` patch. This package therefore stores none of
|
|
15
|
-
* that — no ciphertext, no metadata, no access policy (unlocking by holding a
|
|
16
|
-
* Record is `miso_record_acl`'s concern, in miso-record-extensions). The stored
|
|
17
|
-
* value is the quilt's `WalrusData` blob reference, and nothing else.
|
|
18
|
-
*
|
|
19
|
-
* The slot is write-once: `set_snapshot_bundle` aborts with `EBundleAlreadySet` if
|
|
20
|
-
* a bundle is already set, and there is NO unset, NO remove, and NO replace
|
|
21
|
-
* function. That absence is a product guarantee: the bundle a buyer's Record
|
|
22
|
-
* points at can never be swapped out from under them. More content later means a
|
|
23
|
-
* new Release.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import { MoveTuple, MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
27
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
28
|
-
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
29
|
-
import * as walrus_data from './deps/ori/walrus_data.js';
|
|
30
|
-
const $moduleName = '@local-pkg/release_snapshot_bundle::release_snapshot_bundle';
|
|
31
|
-
export const ExtensionKey = new MoveTuple({ name: `${$moduleName}::ExtensionKey`, fields: [bcs.bool()] });
|
|
32
|
-
export const SnapshotBundleSetEvent = new MoveStruct({ name: `${$moduleName}::SnapshotBundleSetEvent`, fields: {
|
|
33
|
-
release_id: bcs.Address,
|
|
34
|
-
bundle: walrus_data.WalrusData
|
|
35
|
-
} });
|
|
36
|
-
export interface SetSnapshotBundleArguments {
|
|
37
|
-
self: RawTransactionArgument<string>;
|
|
38
|
-
cap: RawTransactionArgument<string>;
|
|
39
|
-
bundle: TransactionArgument;
|
|
40
|
-
}
|
|
41
|
-
export interface SetSnapshotBundleOptions {
|
|
42
|
-
package?: string;
|
|
43
|
-
arguments: SetSnapshotBundleArguments | [
|
|
44
|
-
self: RawTransactionArgument<string>,
|
|
45
|
-
cap: RawTransactionArgument<string>,
|
|
46
|
-
bundle: TransactionArgument
|
|
47
|
-
];
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Sets the release's snapshot bundle — once. Aborts with `EBundleAlreadySet` if a
|
|
51
|
-
* bundle is already set; there is no way to unset or replace it.
|
|
52
|
-
*
|
|
53
|
-
* The reference must be a plaintext standalone blob. A quilt patch is a slice of
|
|
54
|
-
* some other quilt, not the bundle's own quilt blob. And the outer quilt blob is
|
|
55
|
-
* plaintext by design: its `manifest.json` patch must be readable, encryption is
|
|
56
|
-
* per-patch inside the quilt, and the Seal-wrapped envelope key travels as the
|
|
57
|
-
* quilt's `key.seal` patch — so an encrypted outer reference is structurally
|
|
58
|
-
* wrong. With no replace function either mistake would be permanent, which is why
|
|
59
|
-
* both checks live on-chain rather than in the client.
|
|
60
|
-
*/
|
|
61
|
-
export function setSnapshotBundle(options: SetSnapshotBundleOptions) {
|
|
62
|
-
const packageAddress = options.package ?? '@local-pkg/release_snapshot_bundle';
|
|
63
|
-
const argumentsTypes = [
|
|
64
|
-
null,
|
|
65
|
-
null,
|
|
66
|
-
null
|
|
67
|
-
] satisfies (string | null)[];
|
|
68
|
-
const parameterNames = ["self", "cap", "bundle"];
|
|
69
|
-
return (tx: Transaction) => tx.moveCall({
|
|
70
|
-
package: packageAddress,
|
|
71
|
-
module: 'release_snapshot_bundle',
|
|
72
|
-
function: 'set_snapshot_bundle',
|
|
73
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
export interface HasSnapshotBundleArguments {
|
|
77
|
-
self: RawTransactionArgument<string>;
|
|
78
|
-
}
|
|
79
|
-
export interface HasSnapshotBundleOptions {
|
|
80
|
-
package?: string;
|
|
81
|
-
arguments: HasSnapshotBundleArguments | [
|
|
82
|
-
self: RawTransactionArgument<string>
|
|
83
|
-
];
|
|
84
|
-
}
|
|
85
|
-
/** Returns whether a snapshot bundle is set on this release. */
|
|
86
|
-
export function hasSnapshotBundle(options: HasSnapshotBundleOptions) {
|
|
87
|
-
const packageAddress = options.package ?? '@local-pkg/release_snapshot_bundle';
|
|
88
|
-
const argumentsTypes = [
|
|
89
|
-
null
|
|
90
|
-
] satisfies (string | null)[];
|
|
91
|
-
const parameterNames = ["self"];
|
|
92
|
-
return (tx: Transaction) => tx.moveCall({
|
|
93
|
-
package: packageAddress,
|
|
94
|
-
module: 'release_snapshot_bundle',
|
|
95
|
-
function: 'has_snapshot_bundle',
|
|
96
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
export interface SnapshotBundleArguments {
|
|
100
|
-
self: RawTransactionArgument<string>;
|
|
101
|
-
}
|
|
102
|
-
export interface SnapshotBundleOptions {
|
|
103
|
-
package?: string;
|
|
104
|
-
arguments: SnapshotBundleArguments | [
|
|
105
|
-
self: RawTransactionArgument<string>
|
|
106
|
-
];
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* The release's snapshot bundle reference. Aborts with `ENoSnapshotBundle` if none
|
|
110
|
-
* is set.
|
|
111
|
-
*/
|
|
112
|
-
export function snapshotBundle(options: SnapshotBundleOptions) {
|
|
113
|
-
const packageAddress = options.package ?? '@local-pkg/release_snapshot_bundle';
|
|
114
|
-
const argumentsTypes = [
|
|
115
|
-
null
|
|
116
|
-
] satisfies (string | null)[];
|
|
117
|
-
const parameterNames = ["self"];
|
|
118
|
-
return (tx: Transaction) => tx.moveCall({
|
|
119
|
-
package: packageAddress,
|
|
120
|
-
module: 'release_snapshot_bundle',
|
|
121
|
-
function: 'snapshot_bundle',
|
|
122
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
123
|
-
});
|
|
124
|
-
}
|