@arcadiasystems/morse-sdk 0.1.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/CHANGELOG.md +35 -0
- package/LICENSE +21 -0
- package/README.md +404 -0
- package/dist/clients.d.ts +12 -0
- package/dist/clients.d.ts.map +1 -0
- package/dist/clients.js +6 -0
- package/dist/clients.js.map +1 -0
- package/dist/codecs.d.ts +45 -0
- package/dist/codecs.d.ts.map +1 -0
- package/dist/codecs.js +132 -0
- package/dist/codecs.js.map +1 -0
- package/dist/compatibility.d.ts +22 -0
- package/dist/compatibility.d.ts.map +1 -0
- package/dist/compatibility.js +22 -0
- package/dist/compatibility.js.map +1 -0
- package/dist/config.d.ts +92 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +85 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +101 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +214 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/ops/cap.d.ts +79 -0
- package/dist/ops/cap.d.ts.map +1 -0
- package/dist/ops/cap.js +104 -0
- package/dist/ops/cap.js.map +1 -0
- package/dist/ops/collection.d.ts +50 -0
- package/dist/ops/collection.d.ts.map +1 -0
- package/dist/ops/collection.js +55 -0
- package/dist/ops/collection.js.map +1 -0
- package/dist/ops/entry-from-bytes.d.ts +129 -0
- package/dist/ops/entry-from-bytes.d.ts.map +1 -0
- package/dist/ops/entry-from-bytes.js +137 -0
- package/dist/ops/entry-from-bytes.js.map +1 -0
- package/dist/ops/entry.d.ts +173 -0
- package/dist/ops/entry.d.ts.map +1 -0
- package/dist/ops/entry.js +235 -0
- package/dist/ops/entry.js.map +1 -0
- package/dist/ops/index.d.ts +9 -0
- package/dist/ops/index.d.ts.map +1 -0
- package/dist/ops/index.js +9 -0
- package/dist/ops/index.js.map +1 -0
- package/dist/ops/internal.d.ts +21 -0
- package/dist/ops/internal.d.ts.map +1 -0
- package/dist/ops/internal.js +42 -0
- package/dist/ops/internal.js.map +1 -0
- package/dist/ops/publication.d.ts +74 -0
- package/dist/ops/publication.d.ts.map +1 -0
- package/dist/ops/publication.js +123 -0
- package/dist/ops/publication.js.map +1 -0
- package/dist/ptb/cap.d.ts +36 -0
- package/dist/ptb/cap.d.ts.map +1 -0
- package/dist/ptb/cap.js +44 -0
- package/dist/ptb/cap.js.map +1 -0
- package/dist/ptb/collection.d.ts +27 -0
- package/dist/ptb/collection.d.ts.map +1 -0
- package/dist/ptb/collection.js +33 -0
- package/dist/ptb/collection.js.map +1 -0
- package/dist/ptb/entry.d.ts +104 -0
- package/dist/ptb/entry.d.ts.map +1 -0
- package/dist/ptb/entry.js +155 -0
- package/dist/ptb/entry.js.map +1 -0
- package/dist/ptb/index.d.ts +9 -0
- package/dist/ptb/index.d.ts.map +1 -0
- package/dist/ptb/index.js +9 -0
- package/dist/ptb/index.js.map +1 -0
- package/dist/ptb/internal.d.ts +11 -0
- package/dist/ptb/internal.d.ts.map +1 -0
- package/dist/ptb/internal.js +12 -0
- package/dist/ptb/internal.js.map +1 -0
- package/dist/ptb/publication.d.ts +51 -0
- package/dist/ptb/publication.d.ts.map +1 -0
- package/dist/ptb/publication.js +61 -0
- package/dist/ptb/publication.js.map +1 -0
- package/dist/read/entry-bcs.d.ts +47 -0
- package/dist/read/entry-bcs.d.ts.map +1 -0
- package/dist/read/entry-bcs.js +36 -0
- package/dist/read/entry-bcs.js.map +1 -0
- package/dist/read/index.d.ts +5 -0
- package/dist/read/index.d.ts.map +1 -0
- package/dist/read/index.js +5 -0
- package/dist/read/index.js.map +1 -0
- package/dist/read/reader.d.ts +148 -0
- package/dist/read/reader.d.ts.map +1 -0
- package/dist/read/reader.js +403 -0
- package/dist/read/reader.js.map +1 -0
- package/dist/seal/adapter.d.ts +56 -0
- package/dist/seal/adapter.d.ts.map +1 -0
- package/dist/seal/adapter.js +7 -0
- package/dist/seal/adapter.js.map +1 -0
- package/dist/seal/default-adapter.d.ts +90 -0
- package/dist/seal/default-adapter.d.ts.map +1 -0
- package/dist/seal/default-adapter.js +187 -0
- package/dist/seal/default-adapter.js.map +1 -0
- package/dist/seal/identity.d.ts +31 -0
- package/dist/seal/identity.d.ts.map +1 -0
- package/dist/seal/identity.js +79 -0
- package/dist/seal/identity.js.map +1 -0
- package/dist/seal/index.d.ts +8 -0
- package/dist/seal/index.d.ts.map +1 -0
- package/dist/seal/index.js +7 -0
- package/dist/seal/index.js.map +1 -0
- package/dist/types.d.ts +160 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +33 -0
- package/dist/types.js.map +1 -0
- package/dist/wallets/adapter.d.ts +34 -0
- package/dist/wallets/adapter.d.ts.map +1 -0
- package/dist/wallets/adapter.js +6 -0
- package/dist/wallets/adapter.js.map +1 -0
- package/dist/wallets/index.d.ts +7 -0
- package/dist/wallets/index.d.ts.map +1 -0
- package/dist/wallets/index.js +6 -0
- package/dist/wallets/index.js.map +1 -0
- package/dist/wallets/keypair-adapter.d.ts +31 -0
- package/dist/wallets/keypair-adapter.d.ts.map +1 -0
- package/dist/wallets/keypair-adapter.js +210 -0
- package/dist/wallets/keypair-adapter.js.map +1 -0
- package/dist/wallets/wallet-standard-signer.d.ts +118 -0
- package/dist/wallets/wallet-standard-signer.d.ts.map +1 -0
- package/dist/wallets/wallet-standard-signer.js +207 -0
- package/dist/wallets/wallet-standard-signer.js.map +1 -0
- package/dist/walrus/adapter.d.ts +91 -0
- package/dist/walrus/adapter.d.ts.map +1 -0
- package/dist/walrus/adapter.js +11 -0
- package/dist/walrus/adapter.js.map +1 -0
- package/dist/walrus/default-adapter.d.ts +104 -0
- package/dist/walrus/default-adapter.d.ts.map +1 -0
- package/dist/walrus/default-adapter.js +146 -0
- package/dist/walrus/default-adapter.js.map +1 -0
- package/dist/walrus/default-read-adapter.d.ts +89 -0
- package/dist/walrus/default-read-adapter.d.ts.map +1 -0
- package/dist/walrus/default-read-adapter.js +81 -0
- package/dist/walrus/default-read-adapter.js.map +1 -0
- package/dist/walrus/http-aggregator-read-adapter.d.ts +107 -0
- package/dist/walrus/http-aggregator-read-adapter.d.ts.map +1 -0
- package/dist/walrus/http-aggregator-read-adapter.js +174 -0
- package/dist/walrus/http-aggregator-read-adapter.js.map +1 -0
- package/dist/walrus/http-publisher-write-adapter.d.ts +97 -0
- package/dist/walrus/http-publisher-write-adapter.d.ts.map +1 -0
- package/dist/walrus/http-publisher-write-adapter.js +249 -0
- package/dist/walrus/http-publisher-write-adapter.js.map +1 -0
- package/dist/walrus/index.d.ts +11 -0
- package/dist/walrus/index.d.ts.map +1 -0
- package/dist/walrus/index.js +11 -0
- package/dist/walrus/index.js.map +1 -0
- package/dist/walrus/quilt-patch-id.d.ts +34 -0
- package/dist/walrus/quilt-patch-id.d.ts.map +1 -0
- package/dist/walrus/quilt-patch-id.js +103 -0
- package/dist/walrus/quilt-patch-id.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level entry ops that compose Walrus upload + add_entry into 2 wallet
|
|
3
|
+
* popups instead of 3.
|
|
4
|
+
*
|
|
5
|
+
* Background: a naive `uploadBlob` then `addEntry` flow emits three popups
|
|
6
|
+
* (`register_blob`, `certify_blob`, `add_entry_to_collection`). The first
|
|
7
|
+
* cannot be combined because the off-chain blob upload to storage nodes
|
|
8
|
+
* happens between register and certify. The second and third are both
|
|
9
|
+
* on-chain Sui transactions and can be packed into one PTB.
|
|
10
|
+
*
|
|
11
|
+
* `addEntryFromBytes` and `addEncryptedEntryFromBytes` use the
|
|
12
|
+
* `WalrusFlowCapable.startBlobUpload` capability to drive the register
|
|
13
|
+
* step, then append `add_entry_to_collection` to the certify `Transaction`
|
|
14
|
+
* and submit once. The default `DefaultWalrusWriteAdapter` implements the
|
|
15
|
+
* capability; consumers passing a custom `WalrusWriteAdapter` without
|
|
16
|
+
* `WalrusFlowCapable` get a clear `TransportError` and should compose
|
|
17
|
+
* `walrus.uploadBlob` + `addEntry` (3 popups) instead.
|
|
18
|
+
*/
|
|
19
|
+
import type { MorsePackageConfig } from "../config.js";
|
|
20
|
+
import type { SealAdapter } from "../seal/adapter.js";
|
|
21
|
+
import type { BlobObjectId, PublicationId, PublisherCapId, SealId, WalrusBlobId } from "../types.js";
|
|
22
|
+
import type { WalletAdapter } from "../wallets/adapter.js";
|
|
23
|
+
import { type UploadBlobOptions, type WalrusFlowCapable, type WalrusWriteAdapter } from "../walrus/adapter.js";
|
|
24
|
+
/**
|
|
25
|
+
* Coarse-grained progress phases emitted by `addEntryFromBytes` and
|
|
26
|
+
* `addEncryptedEntryFromBytes` for UI spinners and ETA hints.
|
|
27
|
+
*
|
|
28
|
+
* - `encrypting`: emitted once at the start of `addEncryptedEntryFromBytes`
|
|
29
|
+
* before the Seal call. Not emitted for the unencrypted variant.
|
|
30
|
+
* - `uploading`: emitted before `register_blob` (popup 1) and again before
|
|
31
|
+
* the off-chain upload to storage nodes; UI can keep one spinner up
|
|
32
|
+
* across both.
|
|
33
|
+
* - `submitting`: emitted before the combined `certify_blob + add_entry`
|
|
34
|
+
* PTB (popup 2).
|
|
35
|
+
* - `complete`: emitted after the entry has been successfully added.
|
|
36
|
+
* Equivalent to the function's return; provided for symmetry so a single
|
|
37
|
+
* handler can cover the full lifecycle.
|
|
38
|
+
*/
|
|
39
|
+
export type ProgressEvent = {
|
|
40
|
+
readonly phase: "encrypting";
|
|
41
|
+
} | {
|
|
42
|
+
readonly phase: "uploading";
|
|
43
|
+
} | {
|
|
44
|
+
readonly phase: "submitting";
|
|
45
|
+
} | {
|
|
46
|
+
readonly phase: "complete";
|
|
47
|
+
};
|
|
48
|
+
/** Optional callback shape for progress events. */
|
|
49
|
+
export type ProgressCallback = (event: ProgressEvent) => void;
|
|
50
|
+
/** Result of `addEntryFromBytes` / `addEncryptedEntryFromBytes`. */
|
|
51
|
+
export interface AddEntryFromBytesResult {
|
|
52
|
+
readonly digest: string;
|
|
53
|
+
readonly gasUsedMist: bigint;
|
|
54
|
+
readonly entryId: number;
|
|
55
|
+
/** Always `0` for the entry's first revision; surfaced for symmetry. */
|
|
56
|
+
readonly revisionId: number;
|
|
57
|
+
/** Sui object id of the newly-created `Blob` referenced by the entry. */
|
|
58
|
+
readonly blobObjectId: BlobObjectId;
|
|
59
|
+
/** Walrus content-addressed blob id (43-char URL-safe-base64). */
|
|
60
|
+
readonly blobId: WalrusBlobId;
|
|
61
|
+
}
|
|
62
|
+
/** Args for `addEntryFromBytes`. */
|
|
63
|
+
export interface AddEntryFromBytesArgs {
|
|
64
|
+
readonly walrus: WalrusWriteAdapter & WalrusFlowCapable;
|
|
65
|
+
readonly publicationId: PublicationId;
|
|
66
|
+
readonly publisherCapId: PublisherCapId;
|
|
67
|
+
readonly collectionName: string;
|
|
68
|
+
readonly name: string;
|
|
69
|
+
readonly bytes: Uint8Array;
|
|
70
|
+
readonly contentType: string;
|
|
71
|
+
readonly upload: UploadBlobOptions;
|
|
72
|
+
readonly signal?: AbortSignal;
|
|
73
|
+
/**
|
|
74
|
+
* Optional callback invoked at coarse-grained phase boundaries:
|
|
75
|
+
* `uploading` before the register popup, `submitting` before the combined
|
|
76
|
+
* certify+addEntry popup, `complete` after the entry is added. Errors
|
|
77
|
+
* thrown by the callback are propagated.
|
|
78
|
+
*/
|
|
79
|
+
readonly onProgress?: ProgressCallback;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Upload `bytes` to Walrus and add the resulting blob as a new entry in one
|
|
83
|
+
* collection in 2 wallet popups: register_blob, then a combined
|
|
84
|
+
* certify_blob + add_entry_to_collection PTB.
|
|
85
|
+
*
|
|
86
|
+
* @throws {UncertifiedBlobError} If the second popup fails after upload
|
|
87
|
+
* succeeded; the blob is uploaded but uncertified and storage is held
|
|
88
|
+
* until expiry. The original error is preserved as `cause`.
|
|
89
|
+
* @throws {ContractAbortError} On Move abort during the simulation pass
|
|
90
|
+
* before any popup happens.
|
|
91
|
+
* @throws {TransportError} On RPC, network, or upload-step failure before
|
|
92
|
+
* the blob is uploaded.
|
|
93
|
+
*/
|
|
94
|
+
export declare function addEntryFromBytes(adapter: WalletAdapter, config: MorsePackageConfig, args: AddEntryFromBytesArgs): Promise<AddEntryFromBytesResult>;
|
|
95
|
+
/** Args for `addEncryptedEntryFromBytes`. */
|
|
96
|
+
export interface AddEncryptedEntryFromBytesArgs {
|
|
97
|
+
readonly walrus: WalrusWriteAdapter & WalrusFlowCapable;
|
|
98
|
+
readonly seal: SealAdapter;
|
|
99
|
+
readonly publicationId: PublicationId;
|
|
100
|
+
readonly publisherCapId: PublisherCapId;
|
|
101
|
+
readonly collectionName: string;
|
|
102
|
+
readonly name: string;
|
|
103
|
+
readonly plaintext: Uint8Array;
|
|
104
|
+
readonly contentType: string;
|
|
105
|
+
readonly sealId: SealId;
|
|
106
|
+
readonly upload: UploadBlobOptions;
|
|
107
|
+
readonly signal?: AbortSignal;
|
|
108
|
+
/**
|
|
109
|
+
* Optional callback invoked at coarse-grained phase boundaries:
|
|
110
|
+
* `encrypting` (Seal call), `uploading` (register + off-chain upload),
|
|
111
|
+
* `submitting` (combined certify+addEntry popup), `complete`. Errors
|
|
112
|
+
* thrown by the callback are propagated.
|
|
113
|
+
*/
|
|
114
|
+
readonly onProgress?: ProgressCallback;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Encrypt `plaintext` via Seal, upload the ciphertext to Walrus, and add the
|
|
118
|
+
* resulting blob as a new encrypted entry in 2 wallet popups (encryption is
|
|
119
|
+
* popup-free; popups are register_blob then certify_blob + add_entry).
|
|
120
|
+
*
|
|
121
|
+
* @throws {SealError} If encryption fails (no popup yet).
|
|
122
|
+
* @throws {UncertifiedBlobError} If the second popup fails after upload
|
|
123
|
+
* succeeded.
|
|
124
|
+
* @throws {ContractAbortError} On Move abort during simulation.
|
|
125
|
+
* @throws {TransportError} On RPC, network, or upload-step failure before
|
|
126
|
+
* the blob is uploaded.
|
|
127
|
+
*/
|
|
128
|
+
export declare function addEncryptedEntryFromBytes(adapter: WalletAdapter, config: MorsePackageConfig, args: AddEncryptedEntryFromBytesArgs): Promise<AddEntryFromBytesResult>;
|
|
129
|
+
//# sourceMappingURL=entry-from-bytes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-from-bytes.d.ts","sourceRoot":"","sources":["../../src/ops/entry-from-bytes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,MAAM,EACN,YAAY,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GACtB;IAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AAElC,mDAAmD;AACnD,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;AAE9D,oEAAoE;AACpE,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,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B,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAC/C,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,8BAA8B,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAqClC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level entry ops that compose Walrus upload + add_entry into 2 wallet
|
|
3
|
+
* popups instead of 3.
|
|
4
|
+
*
|
|
5
|
+
* Background: a naive `uploadBlob` then `addEntry` flow emits three popups
|
|
6
|
+
* (`register_blob`, `certify_blob`, `add_entry_to_collection`). The first
|
|
7
|
+
* cannot be combined because the off-chain blob upload to storage nodes
|
|
8
|
+
* happens between register and certify. The second and third are both
|
|
9
|
+
* on-chain Sui transactions and can be packed into one PTB.
|
|
10
|
+
*
|
|
11
|
+
* `addEntryFromBytes` and `addEncryptedEntryFromBytes` use the
|
|
12
|
+
* `WalrusFlowCapable.startBlobUpload` capability to drive the register
|
|
13
|
+
* step, then append `add_entry_to_collection` to the certify `Transaction`
|
|
14
|
+
* and submit once. The default `DefaultWalrusWriteAdapter` implements the
|
|
15
|
+
* capability; consumers passing a custom `WalrusWriteAdapter` without
|
|
16
|
+
* `WalrusFlowCapable` get a clear `TransportError` and should compose
|
|
17
|
+
* `walrus.uploadBlob` + `addEntry` (3 popups) instead.
|
|
18
|
+
*/
|
|
19
|
+
import { TransportError, UncertifiedBlobError } from "../errors.js";
|
|
20
|
+
import { buildAddEncryptedEntry, buildAddEntry } from "../ptb/entry.js";
|
|
21
|
+
import { isWalrusFlowCapable, } from "../walrus/adapter.js";
|
|
22
|
+
import { decodeU64ReturnValue } from "./internal.js";
|
|
23
|
+
/**
|
|
24
|
+
* Upload `bytes` to Walrus and add the resulting blob as a new entry in one
|
|
25
|
+
* collection in 2 wallet popups: register_blob, then a combined
|
|
26
|
+
* certify_blob + add_entry_to_collection PTB.
|
|
27
|
+
*
|
|
28
|
+
* @throws {UncertifiedBlobError} If the second popup fails after upload
|
|
29
|
+
* succeeded; the blob is uploaded but uncertified and storage is held
|
|
30
|
+
* until expiry. The original error is preserved as `cause`.
|
|
31
|
+
* @throws {ContractAbortError} On Move abort during the simulation pass
|
|
32
|
+
* before any popup happens.
|
|
33
|
+
* @throws {TransportError} On RPC, network, or upload-step failure before
|
|
34
|
+
* the blob is uploaded.
|
|
35
|
+
*/
|
|
36
|
+
export async function addEntryFromBytes(adapter, config, args) {
|
|
37
|
+
assertFlowCapable(args.walrus);
|
|
38
|
+
args.onProgress?.({ phase: "uploading" });
|
|
39
|
+
const upload = await args.walrus.startBlobUpload(args.bytes, args.upload);
|
|
40
|
+
try {
|
|
41
|
+
const tx = upload.certifyTransaction;
|
|
42
|
+
buildAddEntry(tx, {
|
|
43
|
+
packageId: config.packageId,
|
|
44
|
+
publication: args.publicationId,
|
|
45
|
+
publisherCap: args.publisherCapId,
|
|
46
|
+
collectionName: args.collectionName,
|
|
47
|
+
name: args.name,
|
|
48
|
+
blobObjectId: upload.blobObjectId,
|
|
49
|
+
contentType: args.contentType,
|
|
50
|
+
});
|
|
51
|
+
args.onProgress?.({ phase: "submitting" });
|
|
52
|
+
const result = await submitCombinedTx(adapter, tx, {
|
|
53
|
+
blobObjectId: upload.blobObjectId,
|
|
54
|
+
blobId: upload.blobId,
|
|
55
|
+
...(args.signal === undefined ? {} : { signal: args.signal }),
|
|
56
|
+
});
|
|
57
|
+
args.onProgress?.({ phase: "complete" });
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
catch (cause) {
|
|
61
|
+
if (cause instanceof UncertifiedBlobError)
|
|
62
|
+
throw cause;
|
|
63
|
+
throw new UncertifiedBlobError(upload.blobObjectId, upload.blobId, {
|
|
64
|
+
cause,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Encrypt `plaintext` via Seal, upload the ciphertext to Walrus, and add the
|
|
70
|
+
* resulting blob as a new encrypted entry in 2 wallet popups (encryption is
|
|
71
|
+
* popup-free; popups are register_blob then certify_blob + add_entry).
|
|
72
|
+
*
|
|
73
|
+
* @throws {SealError} If encryption fails (no popup yet).
|
|
74
|
+
* @throws {UncertifiedBlobError} If the second popup fails after upload
|
|
75
|
+
* succeeded.
|
|
76
|
+
* @throws {ContractAbortError} On Move abort during simulation.
|
|
77
|
+
* @throws {TransportError} On RPC, network, or upload-step failure before
|
|
78
|
+
* the blob is uploaded.
|
|
79
|
+
*/
|
|
80
|
+
export async function addEncryptedEntryFromBytes(adapter, config, args) {
|
|
81
|
+
assertFlowCapable(args.walrus);
|
|
82
|
+
args.onProgress?.({ phase: "encrypting" });
|
|
83
|
+
const { ciphertext } = await args.seal.encrypt(args.plaintext, {
|
|
84
|
+
sealId: args.sealId,
|
|
85
|
+
});
|
|
86
|
+
args.onProgress?.({ phase: "uploading" });
|
|
87
|
+
const upload = await args.walrus.startBlobUpload(ciphertext, args.upload);
|
|
88
|
+
try {
|
|
89
|
+
const tx = upload.certifyTransaction;
|
|
90
|
+
buildAddEncryptedEntry(tx, {
|
|
91
|
+
packageId: config.packageId,
|
|
92
|
+
publication: args.publicationId,
|
|
93
|
+
publisherCap: args.publisherCapId,
|
|
94
|
+
collectionName: args.collectionName,
|
|
95
|
+
name: args.name,
|
|
96
|
+
blobObjectId: upload.blobObjectId,
|
|
97
|
+
contentType: args.contentType,
|
|
98
|
+
sealId: args.sealId,
|
|
99
|
+
});
|
|
100
|
+
args.onProgress?.({ phase: "submitting" });
|
|
101
|
+
const result = await submitCombinedTx(adapter, tx, {
|
|
102
|
+
blobObjectId: upload.blobObjectId,
|
|
103
|
+
blobId: upload.blobId,
|
|
104
|
+
...(args.signal === undefined ? {} : { signal: args.signal }),
|
|
105
|
+
});
|
|
106
|
+
args.onProgress?.({ phase: "complete" });
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
catch (cause) {
|
|
110
|
+
if (cause instanceof UncertifiedBlobError)
|
|
111
|
+
throw cause;
|
|
112
|
+
throw new UncertifiedBlobError(upload.blobObjectId, upload.blobId, {
|
|
113
|
+
cause,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function assertFlowCapable(walrus) {
|
|
118
|
+
if (!isWalrusFlowCapable(walrus)) {
|
|
119
|
+
throw new TransportError("addEntryFromBytes / addEncryptedEntryFromBytes require a WalrusWriteAdapter that implements WalrusFlowCapable (i.e. exposes startBlobUpload). The default DefaultWalrusWriteAdapter does. Custom adapters that do not implement the capability should compose walrus.uploadBlob + addEntry (3 popups) instead.");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async function submitCombinedTx(adapter, tx, args) {
|
|
123
|
+
const simulated = await adapter.simulateTransaction(tx, args.signal);
|
|
124
|
+
// Combined PTB: certify_blob is move call 0, add_entry_to_collection is
|
|
125
|
+
// move call 1; the entryId u64 is the return value of call 1.
|
|
126
|
+
const entryId = decodeU64ReturnValue(simulated, 1, 0);
|
|
127
|
+
const receipt = await adapter.signAndExecuteTransaction(tx, args.signal);
|
|
128
|
+
return {
|
|
129
|
+
digest: receipt.digest,
|
|
130
|
+
gasUsedMist: receipt.gasUsedMist,
|
|
131
|
+
entryId,
|
|
132
|
+
revisionId: 0,
|
|
133
|
+
blobObjectId: args.blobObjectId,
|
|
134
|
+
blobId: args.blobId,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=entry-from-bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AAe,EACf,IAAwB;IAExB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACrE,wEAAwE;IACxE,8DAA8D;IAC9D,MAAM,OAAO,GAAG,oBAAoB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,yBAAyB,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACzE,OAAO;QACN,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO;QACP,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;KACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* High-level entry/revision ops. Non-encrypted, public access policy.
|
|
3
|
+
* Encrypted variants are exposed through a separate set of ops with their
|
|
4
|
+
* own args types.
|
|
5
|
+
*
|
|
6
|
+
* To surface the `u64` returned by Move (`entry_id` on add, `revision_id` on
|
|
7
|
+
* appends/publishes), each id-returning op simulates the PTB first to read
|
|
8
|
+
* the BCS-encoded return value, then signs and executes. Two RPC round-trips
|
|
9
|
+
* per call.
|
|
10
|
+
*
|
|
11
|
+
* Race-window caveat: there is a brief window between the simulate and the
|
|
12
|
+
* execute calls where another transaction can mutate the publication's
|
|
13
|
+
* shared state. In single-publisher write paths this window is narrow and
|
|
14
|
+
* the returned `entryId`/`revisionId` is reliable in practice. Under
|
|
15
|
+
* concurrent writes from multiple `PublisherCap` holders, the simulated
|
|
16
|
+
* id can be invalidated by an interleaving transaction; the SDK does not
|
|
17
|
+
* detect this and the returned id may be stale. Consumers running
|
|
18
|
+
* concurrent writers should treat the returned id as advisory and rely on
|
|
19
|
+
* `reader.listEntries(...)` for the authoritative entry set.
|
|
20
|
+
*/
|
|
21
|
+
import type { MorsePackageConfig } from "../config.js";
|
|
22
|
+
import type { BlobObjectId, PublicationId, PublisherCapId, QuiltPatchId, SealId, TxReceipt } from "../types.js";
|
|
23
|
+
import type { WalletAdapter } from "../wallets/adapter.js";
|
|
24
|
+
export interface AddEntryArgs {
|
|
25
|
+
readonly publicationId: PublicationId;
|
|
26
|
+
readonly publisherCapId: PublisherCapId;
|
|
27
|
+
readonly collectionName: string;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly blobObjectId: BlobObjectId;
|
|
30
|
+
readonly quiltPatchId?: QuiltPatchId;
|
|
31
|
+
readonly contentType: string;
|
|
32
|
+
readonly signal?: AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
export interface AddEntryResult {
|
|
35
|
+
readonly digest: string;
|
|
36
|
+
readonly gasUsedMist: bigint;
|
|
37
|
+
/** Stable monotonic ID assigned to the new entry. */
|
|
38
|
+
readonly entryId: number;
|
|
39
|
+
/** Always `0` for the entry's first revision; surfaced for symmetry with append/publish. */
|
|
40
|
+
readonly revisionId: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Add a new entry to a collection with its first revision, given a
|
|
44
|
+
* pre-uploaded `blobObjectId`. For the typical "upload-then-add" flow,
|
|
45
|
+
* prefer `addEntryFromBytes`, which packs upload + addEntry into 2 wallet
|
|
46
|
+
* popups instead of 3. Use this lower-level form when reusing a blob across
|
|
47
|
+
* multiple entries (deduplication), decoupling upload time from publish
|
|
48
|
+
* time, or pre-uploading from a server.
|
|
49
|
+
*
|
|
50
|
+
* @throws {ContractAbortError} On Move abort.
|
|
51
|
+
* @throws {TransportError} On RPC, network, or response-parsing failure.
|
|
52
|
+
*/
|
|
53
|
+
export declare function addEntry(adapter: WalletAdapter, config: MorsePackageConfig, args: AddEntryArgs): Promise<AddEntryResult>;
|
|
54
|
+
export interface AppendDraftRevisionArgs {
|
|
55
|
+
readonly publicationId: PublicationId;
|
|
56
|
+
readonly publisherCapId: PublisherCapId;
|
|
57
|
+
readonly collectionName: string;
|
|
58
|
+
readonly entryId: number;
|
|
59
|
+
readonly blobObjectId: BlobObjectId;
|
|
60
|
+
readonly quiltPatchId?: QuiltPatchId;
|
|
61
|
+
readonly contentType: string;
|
|
62
|
+
readonly signal?: AbortSignal;
|
|
63
|
+
}
|
|
64
|
+
export interface RevisionAppendResult {
|
|
65
|
+
readonly digest: string;
|
|
66
|
+
readonly gasUsedMist: bigint;
|
|
67
|
+
/** Index of the newly appended revision in the entry's revision vector. */
|
|
68
|
+
readonly revisionId: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Append a draft revision to an existing entry.
|
|
72
|
+
* @throws {ContractAbortError} On Move abort (e.g. entry not found surfaces as
|
|
73
|
+
* `module: "collection", reason: "EEntryNotFound"`).
|
|
74
|
+
* @throws {TransportError} On RPC, network, or response-parsing failure.
|
|
75
|
+
*/
|
|
76
|
+
export declare function appendDraftRevision(adapter: WalletAdapter, config: MorsePackageConfig, args: AppendDraftRevisionArgs): Promise<RevisionAppendResult>;
|
|
77
|
+
export interface PublishFromDraftArgs {
|
|
78
|
+
readonly publicationId: PublicationId;
|
|
79
|
+
readonly publisherCapId: PublisherCapId;
|
|
80
|
+
readonly collectionName: string;
|
|
81
|
+
readonly entryId: number;
|
|
82
|
+
readonly draftRevisionId: number;
|
|
83
|
+
readonly blobObjectId: BlobObjectId;
|
|
84
|
+
readonly quiltPatchId?: QuiltPatchId;
|
|
85
|
+
readonly contentType: string;
|
|
86
|
+
readonly signal?: AbortSignal;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Promote a draft to public. Despite the name, this appends a *new* public
|
|
90
|
+
* revision; `draftRevisionId` is only used by the contract to validate that
|
|
91
|
+
* the draft exists. `blobObjectId`/`quiltPatchId` are the published content
|
|
92
|
+
* and may differ from the draft's.
|
|
93
|
+
* @throws {ContractAbortError} On Move abort.
|
|
94
|
+
* @throws {TransportError} On RPC, network, or response-parsing failure.
|
|
95
|
+
*/
|
|
96
|
+
export declare function publishFromDraft(adapter: WalletAdapter, config: MorsePackageConfig, args: PublishFromDraftArgs): Promise<RevisionAppendResult>;
|
|
97
|
+
export interface PublishDirectArgs {
|
|
98
|
+
readonly publicationId: PublicationId;
|
|
99
|
+
readonly publisherCapId: PublisherCapId;
|
|
100
|
+
readonly collectionName: string;
|
|
101
|
+
readonly entryId: number;
|
|
102
|
+
readonly blobObjectId: BlobObjectId;
|
|
103
|
+
readonly quiltPatchId?: QuiltPatchId;
|
|
104
|
+
readonly contentType: string;
|
|
105
|
+
readonly signal?: AbortSignal;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Append a public, non-encrypted revision in one step (no draft).
|
|
109
|
+
* @throws {ContractAbortError} On Move abort.
|
|
110
|
+
* @throws {TransportError} On RPC, network, or response-parsing failure.
|
|
111
|
+
*/
|
|
112
|
+
export declare function publishDirect(adapter: WalletAdapter, config: MorsePackageConfig, args: PublishDirectArgs): Promise<RevisionAppendResult>;
|
|
113
|
+
export interface DeleteEntryArgs {
|
|
114
|
+
readonly publicationId: PublicationId;
|
|
115
|
+
readonly publisherCapId: PublisherCapId;
|
|
116
|
+
readonly collectionName: string;
|
|
117
|
+
readonly entryId: number;
|
|
118
|
+
readonly signal?: AbortSignal;
|
|
119
|
+
}
|
|
120
|
+
export type DeleteEntryResult = TxReceipt;
|
|
121
|
+
/**
|
|
122
|
+
* Delete an entry from a collection. No client-side preflight.
|
|
123
|
+
* @throws {ContractAbortError} On Move abort. Missing entry surfaces as
|
|
124
|
+
* `module: "collection", reason: "EEntryNotFound"`.
|
|
125
|
+
* @throws {TransportError} On RPC, network, or response-parsing failure.
|
|
126
|
+
*/
|
|
127
|
+
export declare function deleteEntry(adapter: WalletAdapter, config: MorsePackageConfig, args: DeleteEntryArgs): Promise<DeleteEntryResult>;
|
|
128
|
+
export interface AddEncryptedEntryArgs {
|
|
129
|
+
readonly publicationId: PublicationId;
|
|
130
|
+
readonly publisherCapId: PublisherCapId;
|
|
131
|
+
readonly collectionName: string;
|
|
132
|
+
readonly name: string;
|
|
133
|
+
readonly blobObjectId: BlobObjectId;
|
|
134
|
+
readonly quiltPatchId?: QuiltPatchId;
|
|
135
|
+
readonly contentType: string;
|
|
136
|
+
readonly sealId: SealId;
|
|
137
|
+
readonly signal?: AbortSignal;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Add a new entry whose first revision is encrypted under the supplied
|
|
141
|
+
* `sealId` with the Publisher access policy, given pre-encrypted ciphertext
|
|
142
|
+
* already uploaded to Walrus. For the typical encrypt-upload-add flow,
|
|
143
|
+
* prefer `addEncryptedEntryFromBytes`, which handles encryption and 2-popup
|
|
144
|
+
* upload in a single call. Use this lower-level form when ciphertext
|
|
145
|
+
* already exists, you want to attach the same ciphertext to multiple
|
|
146
|
+
* entries, or you upload from a different process than the one calling
|
|
147
|
+
* this op.
|
|
148
|
+
*
|
|
149
|
+
* @throws {ContractAbortError} On Move abort.
|
|
150
|
+
* @throws {TransportError} On RPC, network, or response-parsing failure.
|
|
151
|
+
*/
|
|
152
|
+
export declare function addEncryptedEntry(adapter: WalletAdapter, config: MorsePackageConfig, args: AddEncryptedEntryArgs): Promise<AddEntryResult>;
|
|
153
|
+
export interface AppendEncryptedDraftRevisionArgs {
|
|
154
|
+
readonly publicationId: PublicationId;
|
|
155
|
+
readonly publisherCapId: PublisherCapId;
|
|
156
|
+
readonly collectionName: string;
|
|
157
|
+
readonly entryId: number;
|
|
158
|
+
readonly blobObjectId: BlobObjectId;
|
|
159
|
+
readonly quiltPatchId?: QuiltPatchId;
|
|
160
|
+
readonly contentType: string;
|
|
161
|
+
readonly sealId: SealId;
|
|
162
|
+
readonly signal?: AbortSignal;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Append an encrypted draft revision to an existing entry. Each revision
|
|
166
|
+
* carries its own `sealId`; passing a different identity from the prior
|
|
167
|
+
* revision is valid on-chain.
|
|
168
|
+
*
|
|
169
|
+
* @throws {ContractAbortError} On Move abort.
|
|
170
|
+
* @throws {TransportError} On RPC, network, or response-parsing failure.
|
|
171
|
+
*/
|
|
172
|
+
export declare function appendEncryptedDraftRevision(adapter: WalletAdapter, config: MorsePackageConfig, args: AppendEncryptedDraftRevisionArgs): Promise<RevisionAppendResult>;
|
|
173
|
+
//# sourceMappingURL=entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/ops/entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAUvD,OAAO,KAAK,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,MAAM,EACN,SAAS,EACT,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG3D,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4FAA4F;IAC5F,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED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