@arcadiasystems/morse-sdk 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +72 -5
  3. package/dist/errors.d.ts +50 -1
  4. package/dist/errors.d.ts.map +1 -1
  5. package/dist/errors.format.d.ts +41 -0
  6. package/dist/errors.format.d.ts.map +1 -0
  7. package/dist/errors.format.js +200 -0
  8. package/dist/errors.format.js.map +1 -0
  9. package/dist/errors.js +45 -1
  10. package/dist/errors.js.map +1 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +2 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/ops/entry-from-bytes.js +1 -1
  16. package/dist/ops/entry-from-bytes.js.map +1 -1
  17. package/dist/ops/internal.d.ts.map +1 -1
  18. package/dist/ops/internal.js +4 -4
  19. package/dist/ops/internal.js.map +1 -1
  20. package/dist/read/reader.d.ts.map +1 -1
  21. package/dist/read/reader.js +52 -17
  22. package/dist/read/reader.js.map +1 -1
  23. package/dist/seal/default-adapter.d.ts.map +1 -1
  24. package/dist/seal/default-adapter.js +8 -5
  25. package/dist/seal/default-adapter.js.map +1 -1
  26. package/dist/wallets/keypair-adapter.js +14 -7
  27. package/dist/wallets/keypair-adapter.js.map +1 -1
  28. package/dist/wallets/wallet-standard-signer.d.ts +20 -2
  29. package/dist/wallets/wallet-standard-signer.d.ts.map +1 -1
  30. package/dist/wallets/wallet-standard-signer.js +96 -4
  31. package/dist/wallets/wallet-standard-signer.js.map +1 -1
  32. package/dist/walrus/default-adapter.d.ts.map +1 -1
  33. package/dist/walrus/default-adapter.js +9 -6
  34. package/dist/walrus/default-adapter.js.map +1 -1
  35. package/dist/walrus/default-read-adapter.d.ts.map +1 -1
  36. package/dist/walrus/default-read-adapter.js +8 -8
  37. package/dist/walrus/default-read-adapter.js.map +1 -1
  38. package/dist/walrus/http-aggregator-read-adapter.d.ts.map +1 -1
  39. package/dist/walrus/http-aggregator-read-adapter.js +8 -5
  40. package/dist/walrus/http-aggregator-read-adapter.js.map +1 -1
  41. package/dist/walrus/http-publisher-write-adapter.d.ts.map +1 -1
  42. package/dist/walrus/http-publisher-write-adapter.js +16 -14
  43. package/dist/walrus/http-publisher-write-adapter.js.map +1 -1
  44. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,63 @@
2
2
 
3
3
  All notable changes to `morse-sdk` will be documented in this file. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
+ ## [0.1.3] - 2026-05-21
6
+
7
+ Phantom (Sui) wallet support, plus a structured error class so consumer dapps can render proper UX for unsupported wallets.
8
+
9
+ ### Added
10
+
11
+ - **`WalletStandardSigner.fromAccountAsync(account, callbacks)`**: async variant of `fromAccount` that recovers the real Ed25519 public key from a probe signature when `account.publicKey` is non-canonical. Compliant wallets (Slush, Suiet) go through the sync path with no extra IO; non-canonical wallets (Phantom) get one extra wallet popup at session start for the recovery. The probe message is domain-separated (`"morse-sdk:wallet-pubkey-recovery:" + address`) so it cannot collide with a real transaction. The recovered key is verified to derive to `account.address` before the signer is constructed; a wallet bug that signs with a different key is caught and rejected.
12
+ - **`UnsupportedWalletSchemeError extends ConfigurationError`** with structured fields `code: UnsupportedWalletSchemeCode`, `publicKeyBytes: Readonly<Uint8Array>`, `address: string`, optional `walletName?: string`. The `code` discriminates the failure mode: `non-canonical-pubkey` (sync decode failed, recovery applicable), `malformed-zklogin` (zkLogin-shaped but not decodable, recovery not applicable), `recovery-sig-length` / `recovery-non-ed25519` / `recovery-address-mismatch` (recovery flow failed). Consumer dapps switch on `code` to render the appropriate CTA without parsing message strings.
13
+
14
+ ### Changed
15
+
16
+ - **`fromAccount` now throws `UnsupportedWalletSchemeError`** (still a `ConfigurationError` subclass) instead of plain `ConfigurationError` on unrecognized public-key shapes. Existing consumers narrowing on `ConfigurationError` continue to work without modification; consumers who want structured fields opt in via `instanceof UnsupportedWalletSchemeError`. The error message also updates the suggested remediation from "implement a custom Signer" to "retry with WalletStandardSigner.fromAccountAsync".
17
+
18
+ ### Context
19
+
20
+ Phantom's Sui adapter returns a 59-byte opaque blob in `account.publicKey` instead of the canonical 32 / 33-byte form mandated by wallet-standard. This is a known, undocumented quirk (confirmed in the Sui developer forum; the Sui team's response was "reach out to Phantom"). Earlier versions of `WalletStandardSigner` refused these accounts entirely. The recovery flow added here works because Phantom's `signPersonalMessage` does return Sui's canonical 97-byte `flag || sig || pk` signature blob, so the real public key can be extracted from the last 32 bytes of any signature the wallet produces. We do not trust `account.publicKey` at all on the async path.
21
+
22
+ ### Unchanged
23
+
24
+ No behavior changes for compliant wallets (Slush, Suiet, keypair-backed). `fromAccount` is still synchronous; `fromAccountAsync` is purely additive. Other error classes, public types, and the rest of the SDK surface are byte-identical to 0.1.2.
25
+
26
+ ## [0.1.2] - 2026-05-21
27
+
28
+ Additive UI-translation helper plus three bug fixes in the reader's error mapping. Pre-1.0 patch-bump per the project's pragmatic versioning policy; semver-strict consumers can treat as a minor (one new export, one new optional field, one corrected throw class).
29
+
30
+
31
+ ### Added
32
+
33
+ - **`formatUserMessage(err: unknown): FormattedError`**: translates any `MorseError` (or unknown throw) into a `{ title, description, cause }` triple suitable for toast headers + bodies, dialog titles + content, banner messages. Accepts `unknown` so consumers can call it directly in a `catch` block without narrowing first; non-`MorseError` throws fall back to a generic message. The original error is preserved on `cause` for further narrowing or logging.
34
+ - **`FormattedError`** interface exported from the public surface.
35
+ - **`TransportError.operation?: string`**: optional discriminator naming the failing RPC method, HTTP endpoint, or SDK call (`sui.getObject`, `walrus.publisher.uploadBlob`, `seal.decrypt`, etc.). Lets consumers branch on the failing call without parsing message strings. Populated by every throw site in reader.ts, default + HTTP Walrus adapters, the Seal adapter, and the keypair wallet adapter. Surfaced as a parenthetical tag in `formatUserMessage(...).description` for support traceability.
36
+
37
+ Per-class translations in `formatUserMessage` cover every error discriminator the SDK throws:
38
+
39
+ - `ContractAbortError`: per-reason friendly title (`ESlugAlreadyExists` → "Slug already taken", `EPublisherCapRevoked` → "Access revoked", etc.); description from the existing `ABORT_CODES` table with two overrides where the table's description leaked internal constants (`EInvalidStorageMode`, `EInvalidQuiltPatchId`).
40
+ - `SealError`: per-code title and description (`no-access` / `decrypt-failed` / `session-expired` / `rate-limited`).
41
+ - `UncertifiedBlobError`: includes both `blobId` and `blobObjectId` in the description for support traceability.
42
+ - `NotFoundError`: per-`resource` title (publication, collection, entry, revision, publisher-cap, owner-cap, registry, blob); `blob` gets a storage-operator-focused description.
43
+ - `ValidationError` / `TransportError` / `ConfigurationError`: use the existing `message` (which is already user-prose). `TransportError` appends `(operation)` when set.
44
+ - Unknown `MorseError` subclasses fall back to "SDK error" + `message`.
45
+ - Non-`MorseError` throws fall back to "Unexpected error" + `err.message` if Error-shaped.
46
+
47
+ Copy is intentionally domain-neutral (uses the protocol's own terminology: "publication", "entry", "PublisherCap"). Consumer dapps translating to their domain (blog → post, gallery → image, docs → article) should override per-class in their own catch blocks before falling back to `formatUserMessage` for the rest.
48
+
49
+ ### Changed
50
+
51
+ - **`engines.node: ">=18.0.0"`** added to `package.json` to match the existing README claim. The library already ran on Node 18+ (ESM-only, ES2022, no Node-specific APIs in the public surface) but the engine field only enforced Bun before. npm and pnpm install examples added to the README so the supported install paths are explicit.
52
+
53
+ ### Fixed
54
+
55
+ - **`RpcPublicationReader` now throws `NotFoundError` (not `ValidationError`) when the gRPC client returns an object envelope without `.json`.** Affects `getPublication`, `getPublisherCap`, and `listPublicationsOwnedBy`. The previous behavior contradicted the documented `getPublication` contract and conflated "object does not exist (or wrong type, or mid-deletion)" with "response shape is genuinely malformed." `ValidationError` is still raised when `.json` is present but a per-field branch fails its shape check.
56
+ - **`RpcPublicationReader` now fails fast with `ValidationError` on malformed IDs**, before any network round-trip. Affects `getPublication`, `getPublisherCap`, `listPublicationsOwnedBy`, `listPublisherCapsOwnedBy`, `getEntry`, `getRevision`, `listEntries`, and `scanEntries`. Previously, a string cast through the branded type (`"abc" as PublicationId`, or any JS-side caller) reached the gRPC client and surfaced as `TransportError`. Method inputs are now re-normalized via the same `to*Id` codecs that brand the type initially; additionally, `entryId` / `revisionId` are validated as non-negative integers.
57
+
58
+ ### Unchanged
59
+
60
+ No behavior changes on `ValidationError` field-shape branches, `TransportError` thrown from genuine network failures, or any other error class shapes. Error `message` strings are byte-identical for unchanged branches. Existing consumers narrowing with `instanceof` + property checks continue to work without modification; the new `TransportError.operation` is optional.
61
+
5
62
  ## [0.1.1] - 2026-05-17
6
63
 
7
64
  Metadata-only patch. No code, behavior, or API surface change.
@@ -39,5 +96,7 @@ See `README.md` for the full list. Headlines:
39
96
  - Wallet schemes other than Ed25519 ship as decoders with E2E unverified; `WalletStandardSigner.fromAccount` will accept them, but `@mysten/walrus` and `@mysten/seal` round-trip is not yet smoke-tested for those configurations.
40
97
  - gRPC client only at v0.1.0; the reader and adapter interfaces are typed against `Pick<SuiGrpcClient, ...>`. JSON-RPC fallback is planned for v0.2.0.
41
98
 
99
+ [0.1.3]: https://github.com/arcadiasystems/morse-dcms/releases/tag/v0.1.3
100
+ [0.1.2]: https://github.com/arcadiasystems/morse-dcms/releases/tag/v0.1.2
42
101
  [0.1.1]: https://github.com/arcadiasystems/morse-dcms/releases/tag/v0.1.1
43
102
  [0.1.0]: https://github.com/arcadiasystems/morse-dcms/releases/tag/v0.1.0
package/README.md CHANGED
@@ -8,6 +8,8 @@ Pre-release. Testnet only. The Move contract addresses are baked in via `morseCo
8
8
 
9
9
  ## Install
10
10
 
11
+ Bun:
12
+
11
13
  ```sh
12
14
  bun add @arcadiasystems/morse-sdk @mysten/sui
13
15
  # Optional - install only what you use:
@@ -15,6 +17,22 @@ bun add @mysten/walrus # for DefaultWalrusWriteAdapter
15
17
  bun add @mysten/seal # for DefaultSealAdapter and encrypted entries
16
18
  ```
17
19
 
20
+ npm:
21
+
22
+ ```sh
23
+ npm install @arcadiasystems/morse-sdk @mysten/sui
24
+ npm install @mysten/walrus # optional
25
+ npm install @mysten/seal # optional
26
+ ```
27
+
28
+ pnpm:
29
+
30
+ ```sh
31
+ pnpm add @arcadiasystems/morse-sdk @mysten/sui
32
+ pnpm add @mysten/walrus # optional
33
+ pnpm add @mysten/seal # optional
34
+ ```
35
+
18
36
  `@mysten/sui` is required: the SDK takes types from it (`Transaction`, `Signer`) and you construct the gRPC client and keypairs directly. `@mysten/walrus` and `@mysten/seal` are optional peer dependencies; you only pay the install cost for the surface you actually import.
19
37
 
20
38
  ## Compatibility
@@ -36,7 +54,7 @@ morse-sdk is ESM-only (`"type": "module"` in `package.json`); CommonJS `require`
36
54
  | Runtime | Supported | Notes |
37
55
  | ------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
38
56
  | Bun | >= 1.2.0 | Primary development runtime. Enforced via `engines.bun`. Smoke scripts (`bun run scripts/phase-N-*.ts`) require Bun. |
39
- | Node | >= 18.0 | Library code uses ES2022 features (private class fields, `Error.cause`), `TextEncoder` / `crypto.getRandomValues` / `BigInt` (all stable on Node 18+). |
57
+ | Node | >= 18.0 | Enforced via `engines.node`. Library code uses ES2022 features (private class fields, `Error.cause`), `TextEncoder` / `crypto.getRandomValues` / `BigInt` (all stable on Node 18+). Consumers install with `npm install @arcadiasystems/morse-sdk` or `pnpm add`. |
40
58
  | Browser | Evergreen | Chrome / Edge / Firefox / Safari recent stable. Bundlers (Vite, Webpack, esbuild) handle the rest. No `require`-based polyfills needed. |
41
59
 
42
60
  The SDK does not pull in Node-specific APIs (`fs`, `path`, `process`, `crypto` from `node:crypto`); the public surface is portable across both runtimes. A handful of `@mysten/*` substrate libraries reach into Node-shaped APIs internally — consult their documentation for browser polyfill requirements (typically zero with modern bundlers).
@@ -213,7 +231,8 @@ The full public surface, grouped by concern. Every export carries a JSDoc on its
213
231
  | Export | Purpose |
214
232
  | --- | --- |
215
233
  | `KeypairAdapter` | Server / CLI `WalletAdapter` wrapping a raw `Ed25519Keypair`. |
216
- | `WalletStandardSigner.fromAccount(account, callbacks)` | Browser-side `Signer` for `@mysten/walrus` and `@mysten/seal`; wraps wallet-standard wallets without ever holding the user's key. |
234
+ | `WalletStandardSigner.fromAccount(account, callbacks)` | Browser-side `Signer` for `@mysten/walrus` and `@mysten/seal`; wraps wallet-standard wallets without ever holding the user's key. Sync; throws `UnsupportedWalletSchemeError` on non-canonical `account.publicKey` (e.g. Phantom). |
235
+ | `WalletStandardSigner.fromAccountAsync(account, callbacks)` | Same as `fromAccount`, with signature-based pubkey recovery for wallets that return a non-canonical `account.publicKey`. One extra wallet popup at session start for non-compliant wallets; no extra IO for compliant ones. |
217
236
  | `DefaultWalrusWriteAdapter.fromConfig(config, signer)` | Walrus uploads (blob + quilt). Implements `WalrusFlowCapable` (the 2-popup optimization). |
218
237
  | `DefaultWalrusReadAdapter.fromConfig(config)` | Walrus reads (`readBlob`, `readBlobByObjectId`, `readQuiltPatch`, `readBlobRef`). |
219
238
  | `HttpPublisherWriteAdapter.fromConfig({ publisherUrl, ownerAddress })` | Walrus uploads via a publisher HTTP service (operator pays storage; 1 popup for upload + addEntry). |
@@ -296,8 +315,33 @@ Always construct readers and seal adapters via `fromMorseConfig` (e.g. `RpcPubli
296
315
  | Passkey | Supported (decoder) | - | Accepts raw 33-byte key and `0x06 \|\| 33 raw`. WebAuthn signing inside the wallet; `Signer` surface unchanged. |
297
316
  | ZkLogin | Decoder ships, E2E unverified | - | Variable-length `[1 iss-len][iss][32 addressSeed]` identifier (auto-detects modern vs legacy address derivation). Walrus and Seal `SessionKey` flows have not been smoke-tested with zkLogin signatures; fall back to a keypair account if you see errors. |
298
317
  | MultiSig | Refused | - | Variable-length aggregation of multiple keys; signing semantics differ from `Signer` and have not been wired up. Implement a custom `Signer` subclass if you need it. |
318
+ | Phantom (Sui) | Supported via `fromAccountAsync` | 2026-05-21 | Phantom returns a 59-byte non-canonical blob in `account.publicKey`. `fromAccount` rejects it; `fromAccountAsync` recovers the real Ed25519 key from a probe signature. See subsection below. |
299
319
 
300
- Refused schemes throw `ConfigurationError` at construction time. Surface the message to your user as "this wallet account isn't supported yet" rather than letting the page crash inside Walrus or Seal later.
320
+ Refused schemes throw `UnsupportedWalletSchemeError` (a `ConfigurationError` subclass) at construction time. The error carries the raw `publicKeyBytes`, the reported `address`, and an optional `walletName`, so consumer dapps can render a wallet-specific CTA without parsing message strings.
321
+
322
+ ### Wallets with non-canonical `publicKey` (Phantom)
323
+
324
+ Phantom's Sui adapter returns a 59-byte opaque blob in `account.publicKey` instead of the canonical 32 / 33-byte form mandated by wallet-standard. This is a documented Phantom quirk (see the Sui developer forum thread from August 2025), not an SDK gap.
325
+
326
+ For Phantom-class wallets, use `WalletStandardSigner.fromAccountAsync` instead of `fromAccount`:
327
+
328
+ ```ts
329
+ import { WalletStandardSigner, UnsupportedWalletSchemeError } from "@arcadiasystems/morse-sdk";
330
+
331
+ try {
332
+ const signer = await WalletStandardSigner.fromAccountAsync(account, callbacks);
333
+ // ...
334
+ } catch (err) {
335
+ if (err instanceof UnsupportedWalletSchemeError) {
336
+ // Render: "Your wallet uses an unsupported scheme. Try Slush or Suiet."
337
+ // err.publicKeyBytes, err.address, err.walletName available.
338
+ }
339
+ }
340
+ ```
341
+
342
+ `fromAccountAsync` tries the sync decoder first (no extra IO for compliant wallets), and on failure recovers the real Ed25519 public key by asking the wallet to sign a domain-separated probe message. Sui's canonical signature is `flag || sig || pk` (97 bytes for Ed25519); the last 32 bytes are the raw key. The recovered key is verified to derive to `account.address` before the signer is constructed.
343
+
344
+ Cost: one extra wallet popup at session start for Phantom users. The probe message is `"morse-sdk:wallet-pubkey-recovery:" + address`, wrapped by Sui's `signPersonalMessage` `"Sui Message:"` prefix, so it cannot collide with a real transaction. Compliant wallets pay no extra cost; they take the sync `fromAccount` path inside `fromAccountAsync` and skip the probe.
301
345
 
302
346
  ## Error taxonomy
303
347
 
@@ -310,8 +354,9 @@ All errors extend `MorseError`. Narrow by class:
310
354
  | `UnauthorizedError` | - | Client-side auth check failed before submit. |
311
355
  | `ContractAbortError` | `module`, `abortCode`, `reason` | Move VM aborted (e.g. `ESlugAlreadyExists`). |
312
356
  | `SealError` | `code` (`no-access` / `decrypt-failed` / `session-expired` / `rate-limited`) | Seal authorization or decryption failed. |
313
- | `TransportError` | - | RPC, network, or response-parsing failure. |
357
+ | `TransportError` | `operation?` (e.g. `sui.getObject`, `walrus.publisher.uploadBlob`, `seal.decrypt`) | RPC, network, or response-parsing failure. |
314
358
  | `ConfigurationError` | - | SDK config gap (e.g. unsupported network). |
359
+ | `UnsupportedWalletSchemeError` | `code` (`non-canonical-pubkey` / `malformed-zklogin` / `recovery-sig-length` / `recovery-non-ed25519` / `recovery-address-mismatch`), `publicKeyBytes`, `address`, optional `walletName` | `WalletStandardSigner.fromAccount` rejected the account's `publicKey` shape, or the async recovery flow could not extract a key that derives to `account.address`. |
315
360
  | `UncertifiedBlobError` | `blobObjectId`, `blobId` | `addEntryFromBytes` upload succeeded but the combined certify+add_entry tx failed; the blob is uploaded but uncertified. |
316
361
 
317
362
  ```ts
@@ -325,13 +370,35 @@ try {
325
370
  } else if (err instanceof NotFoundError && err.resource === "entry") {
326
371
  // entry was deleted between read and write
327
372
  } else if (err instanceof TransportError) {
328
- // network blip - retry
373
+ // network blip - retry; err.operation names the failing call (e.g. "sui.getObject")
329
374
  } else {
330
375
  throw err;
331
376
  }
332
377
  }
333
378
  ```
334
379
 
380
+ ### `formatUserMessage`: UI-ready translation
381
+
382
+ For consumer dapps that surface SDK errors in toasts, dialogs, or banners, `formatUserMessage(err)` translates any throw (`MorseError` or otherwise) into a `{ title, description, cause }` triple with domain-neutral copy. Use it as the default branch after your own domain-specific handlers:
383
+
384
+ ```ts
385
+ import { formatUserMessage } from "@arcadiasystems/morse-sdk";
386
+
387
+ try {
388
+ await addEntryFromBytes(adapter, config, args);
389
+ } catch (err) {
390
+ if (err instanceof SealError && err.code === "no-access") {
391
+ toast.error("You don't have permission", { description: "Ask the author for access." });
392
+ return;
393
+ }
394
+ const { title, description } = formatUserMessage(err);
395
+ toast.error(title, { description });
396
+ // `cause` is preserved on the formatted object for logging.
397
+ }
398
+ ```
399
+
400
+ Copy uses the protocol's own terminology ("publication", "entry", "PublisherCap"). For consumer domains (blog → post, gallery → image, docs → article), narrow on the error class first and write your own message; `formatUserMessage` is the fallback for everything else.
401
+
335
402
  ## Network configuration
336
403
 
337
404
  ```ts
package/dist/errors.d.ts CHANGED
@@ -27,12 +27,61 @@ export declare class NotFoundError extends MorseError {
27
27
  /** Authorization check failed client-side, before the transaction was submitted. */
28
28
  export declare class UnauthorizedError extends MorseError {
29
29
  }
30
- /** RPC transport, network, or response-parsing failure. Distinct from contract aborts. */
30
+ /**
31
+ * RPC transport, network, or response-parsing failure. Distinct from contract
32
+ * aborts. Optionally carries an `operation` discriminator naming the RPC
33
+ * method, HTTP endpoint, or SDK call that failed. Consumers can switch on
34
+ * it without parsing the message string. Conventions:
35
+ *
36
+ * - Sui RPC reads: `sui.getObject`, `sui.listOwnedObjects`, etc.
37
+ * - Walrus direct: `walrus.uploadBlob`, `walrus.startBlobUpload`, `walrus.readBlob`, etc.
38
+ * - Walrus HTTP: `walrus.publisher.uploadBlob`, `walrus.aggregator.readBlob`, etc.
39
+ * - Seal: `seal.encrypt`, `seal.decrypt`, `seal.buildApproveTx`.
40
+ *
41
+ * Operation is optional for backward compatibility; pre-0.1.2 throw sites
42
+ * may surface a `TransportError` without it.
43
+ */
31
44
  export declare class TransportError extends MorseError {
45
+ readonly operation?: string;
46
+ constructor(message: string, options?: {
47
+ cause?: unknown;
48
+ operation?: string;
49
+ });
32
50
  }
33
51
  /** SDK configuration gap (e.g. asking for a network with no canonical deployment). */
34
52
  export declare class ConfigurationError extends MorseError {
35
53
  }
54
+ /**
55
+ * Discriminator for `UnsupportedWalletSchemeError`. `non-canonical-pubkey`
56
+ * means `account.publicKey` did not decode at construction time; the rest
57
+ * mean the async recovery flow failed for a specific reason. Consumers
58
+ * branch on `code` rather than message strings, and `fromAccountAsync`
59
+ * only attempts recovery when `code === "non-canonical-pubkey"`.
60
+ */
61
+ export type UnsupportedWalletSchemeCode = "non-canonical-pubkey" | "malformed-zklogin" | "recovery-sig-length" | "recovery-non-ed25519" | "recovery-address-mismatch";
62
+ /**
63
+ * Raised by `WalletStandardSigner.fromAccount` and `fromAccountAsync` when
64
+ * the account's public key cannot be resolved to a verified Ed25519/Secp/
65
+ * Passkey/ZkLogin key matching `account.address`. Narrow on `code` to
66
+ * distinguish the failure mode; carries the raw bytes and reported address
67
+ * for support telemetry and CTA copy. Phantom's Sui adapter is the known
68
+ * source: it returns a 59-byte opaque blob in `account.publicKey`, which
69
+ * surfaces as `code: "non-canonical-pubkey"`.
70
+ */
71
+ export declare class UnsupportedWalletSchemeError extends ConfigurationError {
72
+ readonly code: UnsupportedWalletSchemeCode;
73
+ readonly publicKeyBytes: Readonly<Uint8Array>;
74
+ readonly address: string;
75
+ readonly walletName?: string;
76
+ constructor(message: string, fields: {
77
+ code: UnsupportedWalletSchemeCode;
78
+ publicKeyBytes: Uint8Array;
79
+ address: string;
80
+ walletName?: string;
81
+ }, options?: {
82
+ cause?: unknown;
83
+ });
84
+ }
36
85
  /**
37
86
  * Thrown by `addEntryFromBytes` / `addEncryptedEntryFromBytes` when the
38
87
  * register-and-upload step succeeded (the user already paid for storage and
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,uDAAuD;AACvD,8BAAsB,UAAW,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAI1D;AAID,yEAAyE;AACzE,qBAAa,eAAgB,SAAQ,UAAU;IAC9C,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAEX,OAAO,EAAE,MAAM,EA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MAAM,GAAG,UAAU,CAAA;KAAE;CAsHpE,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,sGAAsG;AACtG,qBAAa,kBAAmB,SAAQ,UAAU;IACjD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAGvB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;IAQ9B,kFAAkF;IAClF,MAAM,CAAC,aAAa,CACnB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAC3B,kBAAkB;CAmBrB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Convert any `MorseError` (or unknown throw) into a `{ title, description }`
3
+ * pair suitable for end-user UI surfaces (toast headers + bodies, dialog
4
+ * titles + content, banner messages). Pure function; preserves the original
5
+ * `cause` for consumers who want to narrow further.
6
+ *
7
+ * Copy is intentionally domain-neutral. The SDK uses the protocol's own
8
+ * terminology ("publication", "entry", "PublisherCap"); consumer dapps
9
+ * translating to their domain (blog → post, gallery → image, docs →
10
+ * article) should override per-class in their own catch blocks.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { formatUserMessage } from "@arcadiasystems/morse-sdk";
15
+ * try { await addEntryFromBytes(...); }
16
+ * catch (err) {
17
+ * const { title, description } = formatUserMessage(err);
18
+ * toast.error(title, { description });
19
+ * }
20
+ * ```
21
+ */
22
+ /** Structured UI-ready translation of an error. */
23
+ export interface FormattedError {
24
+ /** Short headline, suitable for a toast title or dialog header. */
25
+ readonly title: string;
26
+ /** Longer body, suitable for a toast description or dialog content. */
27
+ readonly description: string;
28
+ /** Original error preserved verbatim for narrowing or logging. */
29
+ readonly cause: unknown;
30
+ }
31
+ /**
32
+ * Translate any error into a UI-ready `{ title, description }`. Accepts
33
+ * `unknown` so consumers can use it directly in a catch block without
34
+ * narrowing first; non-`MorseError` throws fall back to a generic message.
35
+ *
36
+ * For domain-specific copy ("blog post" instead of "publication entry"),
37
+ * narrow on the error class first and write your own message, then fall
38
+ * back to `formatUserMessage` for the rest.
39
+ */
40
+ export declare function formatUserMessage(err: unknown): FormattedError;
41
+ //# sourceMappingURL=errors.format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.format.d.ts","sourceRoot":"","sources":["../src/errors.format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAkBH,mDAAmD;AACnD,MAAM,WAAW,cAAc;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAU9D"}
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Convert any `MorseError` (or unknown throw) into a `{ title, description }`
3
+ * pair suitable for end-user UI surfaces (toast headers + bodies, dialog
4
+ * titles + content, banner messages). Pure function; preserves the original
5
+ * `cause` for consumers who want to narrow further.
6
+ *
7
+ * Copy is intentionally domain-neutral. The SDK uses the protocol's own
8
+ * terminology ("publication", "entry", "PublisherCap"); consumer dapps
9
+ * translating to their domain (blog → post, gallery → image, docs →
10
+ * article) should override per-class in their own catch blocks.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { formatUserMessage } from "@arcadiasystems/morse-sdk";
15
+ * try { await addEntryFromBytes(...); }
16
+ * catch (err) {
17
+ * const { title, description } = formatUserMessage(err);
18
+ * toast.error(title, { description });
19
+ * }
20
+ * ```
21
+ */
22
+ import { ABORT_CODES, ConfigurationError, ContractAbortError, MorseError, NotFoundError, SealError, TransportError, UNKNOWN_ABORT_NAME, UncertifiedBlobError, ValidationError, } from "./errors.js";
23
+ /**
24
+ * Translate any error into a UI-ready `{ title, description }`. Accepts
25
+ * `unknown` so consumers can use it directly in a catch block without
26
+ * narrowing first; non-`MorseError` throws fall back to a generic message.
27
+ *
28
+ * For domain-specific copy ("blog post" instead of "publication entry"),
29
+ * narrow on the error class first and write your own message, then fall
30
+ * back to `formatUserMessage` for the rest.
31
+ */
32
+ export function formatUserMessage(err) {
33
+ if (err instanceof ContractAbortError)
34
+ return formatAbort(err);
35
+ if (err instanceof SealError)
36
+ return formatSeal(err);
37
+ if (err instanceof UncertifiedBlobError)
38
+ return formatUncertified(err);
39
+ if (err instanceof NotFoundError)
40
+ return formatNotFound(err);
41
+ if (err instanceof ValidationError)
42
+ return formatValidation(err);
43
+ if (err instanceof TransportError)
44
+ return formatTransport(err);
45
+ if (err instanceof ConfigurationError)
46
+ return formatConfiguration(err);
47
+ if (err instanceof MorseError)
48
+ return formatGenericMorse(err);
49
+ return formatUnknown(err);
50
+ }
51
+ // Title overrides per abort reason; descriptions are overridden only where
52
+ // the ABORT_CODES entry leaks internal constants or BCS byte layouts.
53
+ const ABORT_OVERRIDES = {
54
+ ESlugAlreadyExists: { title: "Slug already taken" },
55
+ EPublisherCapRevoked: { title: "Access revoked" },
56
+ EPublisherCapWrongHolder: { title: "Wrong wallet" },
57
+ EUnauthorized: { title: "Unauthorized" },
58
+ ESealIdRequired: { title: "Seal identity required" },
59
+ ESealIdNotAllowed: { title: "Seal identity not allowed" },
60
+ ESealInvalidId: { title: "Invalid Seal identity" },
61
+ ESealWrongPolicyTag: { title: "Unsupported Seal policy" },
62
+ ESlugEmpty: { title: "Slug required" },
63
+ ESlugTooLong: { title: "Slug too long" },
64
+ ESlugInvalidChar: { title: "Invalid slug character" },
65
+ ESlugInvalidEdgeHyphen: { title: "Invalid slug edge" },
66
+ ECollectionAlreadyExists: { title: "Collection already exists" },
67
+ EEntryNotFound: { title: "Entry not found" },
68
+ ERevisionNotFound: { title: "Revision not found" },
69
+ ENameEmpty: { title: "Name required" },
70
+ EContentTypeEmpty: { title: "Content type required" },
71
+ ENameTooLong: { title: "Name too long" },
72
+ EContentTypeTooLong: { title: "Content type too long" },
73
+ EBlobNotDeletable: { title: "Blob must be deletable" },
74
+ EQuiltPatchIdRequired: { title: "Quilt patch ID required" },
75
+ EQuiltPatchIdNotAllowed: { title: "Quilt patch ID not allowed" },
76
+ EInvalidAccessPolicy: { title: "Invalid access policy" },
77
+ EInvalidStorageMode: {
78
+ title: "Invalid storage mode",
79
+ description: "Storage mode must be Blob or Quilt.",
80
+ },
81
+ EInvalidQuiltPatchId: {
82
+ title: "Invalid quilt patch ID",
83
+ description: "QuiltPatchId must be exactly 37 bytes.",
84
+ },
85
+ [UNKNOWN_ABORT_NAME]: {
86
+ title: "Contract aborted",
87
+ description: "The deployed contract may be newer than this SDK. Upgrade or report the abort code.",
88
+ },
89
+ };
90
+ function formatAbort(err) {
91
+ const override = ABORT_OVERRIDES[err.reason];
92
+ const tableDescription = lookupAbortDescription(err.module, err.abortCode);
93
+ return {
94
+ title: override?.title ?? "Contract aborted",
95
+ description: override?.description ??
96
+ tableDescription ??
97
+ `Contract aborted: ${err.module}::${err.reason} (code ${err.abortCode}).`,
98
+ cause: err,
99
+ };
100
+ }
101
+ function lookupAbortDescription(module, abortCode) {
102
+ return ABORT_CODES[module][abortCode]?.description;
103
+ }
104
+ // Seal
105
+ const SEAL_COPY = {
106
+ "no-access": {
107
+ title: "No access",
108
+ description: "Your wallet does not have permission to decrypt this content.",
109
+ },
110
+ "decrypt-failed": {
111
+ title: "Decryption failed",
112
+ description: "The ciphertext could not be decrypted. It may have been tampered with, or the Seal identity does not match.",
113
+ },
114
+ "session-expired": {
115
+ title: "Session expired",
116
+ description: "Your Seal session key has expired. Sign a new SessionKey to continue.",
117
+ },
118
+ "rate-limited": {
119
+ title: "Rate limited",
120
+ description: "Seal key servers rejected too many requests. Wait a moment and retry.",
121
+ },
122
+ };
123
+ function formatSeal(err) {
124
+ const copy = SEAL_COPY[err.code];
125
+ return { ...copy, cause: err };
126
+ }
127
+ // UncertifiedBlob
128
+ function formatUncertified(err) {
129
+ return {
130
+ title: "Upload incomplete",
131
+ description: `The Walrus blob was uploaded but the on-chain transaction failed. Blob ID: ${err.blobId} (object ${err.blobObjectId}). Retry the operation to attach it, or wait for the storage registration to expire.`,
132
+ cause: err,
133
+ };
134
+ }
135
+ // NotFound
136
+ const NOT_FOUND_TITLES = {
137
+ publication: "Publication not found",
138
+ collection: "Collection not found",
139
+ entry: "Entry not found",
140
+ revision: "Revision not found",
141
+ "publisher-cap": "PublisherCap not found",
142
+ "owner-cap": "OwnerCap not found",
143
+ registry: "Registry not found",
144
+ blob: "Content unavailable",
145
+ };
146
+ function formatNotFound(err) {
147
+ const title = NOT_FOUND_TITLES[err.resource];
148
+ const description = err.resource === "blob"
149
+ ? `The Walrus blob is not retrievable. The storage operator may be having issues, or the blob expired. (id: ${err.identifier})`
150
+ : `No ${err.resource} at ${err.identifier}.`;
151
+ return { title, description, cause: err };
152
+ }
153
+ // Validation / Transport / Configuration
154
+ function formatValidation(err) {
155
+ return {
156
+ title: "Invalid input",
157
+ description: err.field === "" ? err.message : `${err.field}: ${err.message}`,
158
+ cause: err,
159
+ };
160
+ }
161
+ function formatTransport(err) {
162
+ const base = err.message.length > 0
163
+ ? err.message
164
+ : "Could not reach the network. Please retry.";
165
+ // Operation is an internal discriminator (e.g. "sui.getObject"). Surface
166
+ // it as a parenthetical tag so support tickets carry the failing call
167
+ // without forcing consumers to parse `err.cause` themselves.
168
+ const description = err.operation === undefined ? base : `${base} (${err.operation})`;
169
+ return {
170
+ title: "Network issue",
171
+ description,
172
+ cause: err,
173
+ };
174
+ }
175
+ function formatConfiguration(err) {
176
+ return {
177
+ title: "Configuration issue",
178
+ description: err.message,
179
+ cause: err,
180
+ };
181
+ }
182
+ // Catch-alls
183
+ function formatGenericMorse(err) {
184
+ return {
185
+ title: "SDK error",
186
+ description: err.message,
187
+ cause: err,
188
+ };
189
+ }
190
+ function formatUnknown(err) {
191
+ const description = err instanceof Error && err.message.length > 0
192
+ ? err.message
193
+ : "An unexpected error occurred. Please retry.";
194
+ return {
195
+ title: "Unexpected error",
196
+ description,
197
+ cause: err,
198
+ };
199
+ }
200
+ //# sourceMappingURL=errors.format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.format.js","sourceRoot":"","sources":["../src/errors.format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACN,WAAW,EAEX,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,aAAa,EAEb,SAAS,EAET,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,GACf,MAAM,aAAa,CAAC;AAYrB;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC7C,IAAI,GAAG,YAAY,kBAAkB;QAAE,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/D,IAAI,GAAG,YAAY,SAAS;QAAE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;IACrD,IAAI,GAAG,YAAY,oBAAoB;QAAE,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACvE,IAAI,GAAG,YAAY,aAAa;QAAE,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7D,IAAI,GAAG,YAAY,eAAe;QAAE,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACjE,IAAI,GAAG,YAAY,cAAc;QAAE,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;IAC/D,IAAI,GAAG,YAAY,kBAAkB;QAAE,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACvE,IAAI,GAAG,YAA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FoundError extends MorseError {
34
34
  export class UnauthorizedError extends MorseError {
35
35
  }
36
36
  // Transport
37
- /** RPC transport, network, or response-parsing failure. Distinct from contract aborts. */
37
+ /**
38
+ * RPC transport, network, or response-parsing failure. Distinct from contract
39
+ * aborts. Optionally carries an `operation` discriminator naming the RPC
40
+ * method, HTTP endpoint, or SDK call that failed. Consumers can switch on
41
+ * it without parsing the message string. Conventions:
42
+ *
43
+ * - Sui RPC reads: `sui.getObject`, `sui.listOwnedObjects`, etc.
44
+ * - Walrus direct: `walrus.uploadBlob`, `walrus.startBlobUpload`, `walrus.readBlob`, etc.
45
+ * - Walrus HTTP: `walrus.publisher.uploadBlob`, `walrus.aggregator.readBlob`, etc.
46
+ * - Seal: `seal.encrypt`, `seal.decrypt`, `seal.buildApproveTx`.
47
+ *
48
+ * Operation is optional for backward compatibility; pre-0.1.2 throw sites
49
+ * may surface a `TransportError` without it.
50
+ */
38
51
  export class TransportError extends MorseError {
52
+ operation;
53
+ constructor(message, options) {
54
+ super(message, options);
55
+ if (options?.operation !== undefined) {
56
+ this.operation = options.operation;
57
+ }
58
+ }
39
59
  }
40
60
  // Configuration
41
61
  /** SDK configuration gap (e.g. asking for a network with no canonical deployment). */
42
62
  export class ConfigurationError extends MorseError {
43
63
  }
64
+ /**
65
+ * Raised by `WalletStandardSigner.fromAccount` and `fromAccountAsync` when
66
+ * the account's public key cannot be resolved to a verified Ed25519/Secp/
67
+ * Passkey/ZkLogin key matching `account.address`. Narrow on `code` to
68
+ * distinguish the failure mode; carries the raw bytes and reported address
69
+ * for support telemetry and CTA copy. Phantom's Sui adapter is the known
70
+ * source: it returns a 59-byte opaque blob in `account.publicKey`, which
71
+ * surfaces as `code: "non-canonical-pubkey"`.
72
+ */
73
+ export class UnsupportedWalletSchemeError extends ConfigurationError {
74
+ code;
75
+ publicKeyBytes;
76
+ address;
77
+ walletName;
78
+ constructor(message, fields, options) {
79
+ super(message, options);
80
+ this.code = fields.code;
81
+ this.publicKeyBytes = fields.publicKeyBytes;
82
+ this.address = fields.address;
83
+ if (fields.walletName !== undefined) {
84
+ this.walletName = fields.walletName;
85
+ }
86
+ }
87
+ }
44
88
  // Uncertified blob
45
89
  /**
46
90
  * Thrown by `addEntryFromBytes` / `addEncryptedEntryFromBytes` when the
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO;AAEP,uDAAuD;AACvD,MAAM,OAAgB,UAAW,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,OAA6B;QACzD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;IAC7B,CAAC;CACD;AAED,aAAa;AAEb,yEAAyE;AACzE,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAC9C,6DAA6D;IACpD,KAAK,CAAS;IAEvB,YAAY,OAAe,EAAE,KAAa,EAAE,OAA6B;QACxE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;CACD;AAcD,mCAAmC;AACnC,MAAM,OAAO,aAAc,SAAQ,UAAU;IACnC,QAAQ,CAAmB;IAC3B,UAAU,CAAS;IAE5B,YACC,QAA0B,EAC1B,UAAkB,EAClB,OAA6B;QAE7B,KAAK,CAAC,GAAG,QAAQ,eAAe,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;CACD;AAED,eAAe;AAEf,oFAAoF;AACpF,MAAM,OAAO,iBAAkB,SAAQ,UAAU;CAAG;AAEpD,YAAY;AAEZ,0FAA0F;AAC1F,MAAM,OAAO,cAAe,SAAQ,UAAU;CAAG;AAEjD,gBAAgB;AAEhB,sFAAsF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