@arcadiasystems/morse-sdk 0.1.1 → 0.1.2
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 +36 -0
- package/README.md +43 -3
- package/dist/errors.d.ts +19 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.format.d.ts +41 -0
- package/dist/errors.format.d.ts.map +1 -0
- package/dist/errors.format.js +200 -0
- package/dist/errors.format.js.map +1 -0
- package/dist/errors.js +21 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/ops/entry-from-bytes.js +1 -1
- package/dist/ops/entry-from-bytes.js.map +1 -1
- package/dist/ops/internal.d.ts.map +1 -1
- package/dist/ops/internal.js +4 -4
- package/dist/ops/internal.js.map +1 -1
- package/dist/read/reader.d.ts.map +1 -1
- package/dist/read/reader.js +52 -17
- package/dist/read/reader.js.map +1 -1
- package/dist/seal/default-adapter.d.ts.map +1 -1
- package/dist/seal/default-adapter.js +8 -5
- package/dist/seal/default-adapter.js.map +1 -1
- package/dist/wallets/keypair-adapter.js +14 -7
- package/dist/wallets/keypair-adapter.js.map +1 -1
- package/dist/walrus/default-adapter.d.ts.map +1 -1
- package/dist/walrus/default-adapter.js +9 -6
- package/dist/walrus/default-adapter.js.map +1 -1
- package/dist/walrus/default-read-adapter.d.ts.map +1 -1
- package/dist/walrus/default-read-adapter.js +8 -8
- package/dist/walrus/default-read-adapter.js.map +1 -1
- package/dist/walrus/http-aggregator-read-adapter.d.ts.map +1 -1
- package/dist/walrus/http-aggregator-read-adapter.js +8 -5
- package/dist/walrus/http-aggregator-read-adapter.js.map +1 -1
- package/dist/walrus/http-publisher-write-adapter.d.ts.map +1 -1
- package/dist/walrus/http-publisher-write-adapter.js +16 -14
- package/dist/walrus/http-publisher-write-adapter.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,42 @@
|
|
|
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.2] - 2026-05-21
|
|
6
|
+
|
|
7
|
+
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).
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`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.
|
|
13
|
+
- **`FormattedError`** interface exported from the public surface.
|
|
14
|
+
- **`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.
|
|
15
|
+
|
|
16
|
+
Per-class translations in `formatUserMessage` cover every error discriminator the SDK throws:
|
|
17
|
+
|
|
18
|
+
- `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`).
|
|
19
|
+
- `SealError`: per-code title and description (`no-access` / `decrypt-failed` / `session-expired` / `rate-limited`).
|
|
20
|
+
- `UncertifiedBlobError`: includes both `blobId` and `blobObjectId` in the description for support traceability.
|
|
21
|
+
- `NotFoundError`: per-`resource` title (publication, collection, entry, revision, publisher-cap, owner-cap, registry, blob); `blob` gets a storage-operator-focused description.
|
|
22
|
+
- `ValidationError` / `TransportError` / `ConfigurationError`: use the existing `message` (which is already user-prose). `TransportError` appends `(operation)` when set.
|
|
23
|
+
- Unknown `MorseError` subclasses fall back to "SDK error" + `message`.
|
|
24
|
+
- Non-`MorseError` throws fall back to "Unexpected error" + `err.message` if Error-shaped.
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- **`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.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- **`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.
|
|
35
|
+
- **`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.
|
|
36
|
+
|
|
37
|
+
### Unchanged
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
5
41
|
## [0.1.1] - 2026-05-17
|
|
6
42
|
|
|
7
43
|
Metadata-only patch. No code, behavior, or API surface change.
|
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).
|
|
@@ -310,7 +328,7 @@ All errors extend `MorseError`. Narrow by class:
|
|
|
310
328
|
| `UnauthorizedError` | - | Client-side auth check failed before submit. |
|
|
311
329
|
| `ContractAbortError` | `module`, `abortCode`, `reason` | Move VM aborted (e.g. `ESlugAlreadyExists`). |
|
|
312
330
|
| `SealError` | `code` (`no-access` / `decrypt-failed` / `session-expired` / `rate-limited`) | Seal authorization or decryption failed. |
|
|
313
|
-
| `TransportError` |
|
|
331
|
+
| `TransportError` | `operation?` (e.g. `sui.getObject`, `walrus.publisher.uploadBlob`, `seal.decrypt`) | RPC, network, or response-parsing failure. |
|
|
314
332
|
| `ConfigurationError` | - | SDK config gap (e.g. unsupported network). |
|
|
315
333
|
| `UncertifiedBlobError` | `blobObjectId`, `blobId` | `addEntryFromBytes` upload succeeded but the combined certify+add_entry tx failed; the blob is uploaded but uncertified. |
|
|
316
334
|
|
|
@@ -325,13 +343,35 @@ try {
|
|
|
325
343
|
} else if (err instanceof NotFoundError && err.resource === "entry") {
|
|
326
344
|
// entry was deleted between read and write
|
|
327
345
|
} else if (err instanceof TransportError) {
|
|
328
|
-
// network blip - retry
|
|
346
|
+
// network blip - retry; err.operation names the failing call (e.g. "sui.getObject")
|
|
329
347
|
} else {
|
|
330
348
|
throw err;
|
|
331
349
|
}
|
|
332
350
|
}
|
|
333
351
|
```
|
|
334
352
|
|
|
353
|
+
### `formatUserMessage`: UI-ready translation
|
|
354
|
+
|
|
355
|
+
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:
|
|
356
|
+
|
|
357
|
+
```ts
|
|
358
|
+
import { formatUserMessage } from "@arcadiasystems/morse-sdk";
|
|
359
|
+
|
|
360
|
+
try {
|
|
361
|
+
await addEntryFromBytes(adapter, config, args);
|
|
362
|
+
} catch (err) {
|
|
363
|
+
if (err instanceof SealError && err.code === "no-access") {
|
|
364
|
+
toast.error("You don't have permission", { description: "Ask the author for access." });
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const { title, description } = formatUserMessage(err);
|
|
368
|
+
toast.error(title, { description });
|
|
369
|
+
// `cause` is preserved on the formatted object for logging.
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
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.
|
|
374
|
+
|
|
335
375
|
## Network configuration
|
|
336
376
|
|
|
337
377
|
```ts
|
package/dist/errors.d.ts
CHANGED
|
@@ -27,8 +27,26 @@ 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
|
-
/**
|
|
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 {
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -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;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AAG,OAAO,CAAC;AAEjE,uCAAuC;AACvC,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE;IACzB,QAAQ,EAAE,CAAC,IAAI,WAAW,GAAG;QAAE,QAAQ,EAAE,IAAI,EAAE,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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AAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,SAAS,GAAG,CAAC;IACnE,OAAO;QACN,KAAK,EAAE,eAAe;QACtB,WAAW;QACX,KAAK,EAAE,GAAG;KACV,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAuB;IACnD,OAAO;QACN,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,GAAG,CAAC,OAAO;QACxB,KAAK,EAAE,GAAG;KACV,CAAC;AACH,CAAC;AAED,aAAa;AAEb,SAAS,kBAAkB,CAAC,GAAe;IAC1C,OAAO;QACN,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,GAAG,CAAC,OAAO;QACxB,KAAK,EAAE,GAAG;KACV,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,GAAY;IAClC,MAAM,WAAW,GAChB,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAC7C,CAAC,CAAC,GAAG,CAAC,OAAO;QACb,CAAC,CAAC,6CAA6C,CAAC;IAClD,OAAO;QACN,KAAK,EAAE,kBAAkB;QACzB,WAAW;QACX,KAAK,EAAE,GAAG;KACV,CAAC;AACH,CAAC"}
|
package/dist/errors.js
CHANGED
|
@@ -34,8 +34,28 @@ export class NotFoundError extends MorseError {
|
|
|
34
34
|
export class UnauthorizedError extends MorseError {
|
|
35
35
|
}
|
|
36
36
|
// Transport
|
|
37
|
-
/**
|
|
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). */
|
package/dist/errors.js.map
CHANGED
|
@@ -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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AC;QACH,CAAC;QACD,OAAO,IAAI,kBAAkB,CAC5B,MAAM,EACN,SAAS,EACT,KAAK,CAAC,IAAI,EACV,qBAAqB,MAAM,KAAK,KAAK,CAAC,IAAI,UAAU,SAAS,MAAM,KAAK,CAAC,WAAW,EAAE,EACtF,OAAO,CACP,CAAC;IACH,CAAC;CACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type { ObjectReader, TransactionExecutor } from "./clients.js";
|
|
|
5
5
|
export { accessPolicyFromU8, accessPolicyToU8, storageModeFromU8, storageModeToU8, toBlobObjectId, toOwnerCapId, toPackageId, toPublicationId, toPublisherCapId, toQuiltPatchId, toRegistryId, toSuiAddress, toSuiObjectId, toWalrusBlobId, } from "./codecs.js";
|
|
6
6
|
export { TESTED_SUBSTRATE } from "./compatibility.js";
|
|
7
7
|
export { DEFAULT_RPC_URLS, type MorseConfigOptions, type MorsePackageConfig, morseConfig, Network, type NetworkConfig, type WalrusEndpoints, } from "./config.js";
|
|
8
|
+
export { type FormattedError, formatUserMessage, } from "./errors.format.js";
|
|
8
9
|
export { ABORT_CODES, type AbortEntry, type AbortModule, ConfigurationError, ContractAbortError, MorseError, NotFoundError, type NotFoundResource, SealError, type SealErrorCode, TransportError, UNKNOWN_ABORT_NAME, UnauthorizedError, UncertifiedBlobError, ValidationError, } from "./errors.js";
|
|
9
10
|
export { type AddEncryptedEntryArgs, type AddEncryptedEntryFromBytesArgs, type AddEntryArgs, type AddEntryFromBytesArgs, type AddEntryFromBytesResult, type AddEntryResult, type AppendDraftRevisionArgs, type AppendEncryptedDraftRevisionArgs, addEncryptedEntry, addEncryptedEntryFromBytes, addEntry, addEntryFromBytes, appendDraftRevision, appendEncryptedDraftRevision, type CreateCollectionArgs, type CreateCollectionResult, type CreatePublicationArgs, type CreatePublicationResult, createCollection, createPublication, type DeleteCollectionArgs, type DeleteCollectionResult, type DeleteEntryArgs, type DeleteEntryResult, type DeletePublicationArgs, type DeletePublicationResult, type DestroyPublisherCapArgs, type DestroyPublisherCapResult, deleteCollection, deleteEntry, deletePublication, destroyPublisherCap, type IssuePublisherCapArgs, type IssuePublisherCapResult, issuePublisherCap, type ProgressCallback, type ProgressEvent, type PublicationConfig, type PublishDirectArgs, type PublishFromDraftArgs, publishDirect, publishFromDraft, type RevisionAppendResult, type RevokePublisherCapArgs, type RevokePublisherCapResult, revokePublisherCap, type TransferOwnershipArgs, type TransferOwnershipResult, type TransferPublisherCapArgs, type TransferPublisherCapResult, transferOwnership, transferPublisherCap, } from "./ops/index.js";
|
|
10
11
|
export { type EntryListPage, type ListEntriesOptions, type ListPublicationsOptions, type ListPublisherCapsOptions, type OwnedPublication, type PublicationListPage, type PublicationReader, type PublisherCapListPage, RpcPublicationReader, type ScanEntriesOptions, } from "./read/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACN,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,WAAW,EACX,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,KAAK,gBAAgB,EACrB,SAAS,EACT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B,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACvB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACN,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,WAAW,EACX,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,eAAe,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,cAAc,EACnB,iBAAiB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,WAAW,EACX,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,KAAK,gBAAgB,EACrB,SAAS,EACT,KAAK,aAAa,EAClB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,8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AAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACvB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export { accessPolicyFromU8, accessPolicyToU8, storageModeFromU8, storageModeToU8, toBlobObjectId, toOwnerCapId, toPackageId, toPublicationId, toPublisherCapId, toQuiltPatchId, toRegistryId, toSuiAddress, toSuiObjectId, toWalrusBlobId, } from "./codecs.js";
|
|
5
5
|
export { TESTED_SUBSTRATE } from "./compatibility.js";
|
|
6
6
|
export { DEFAULT_RPC_URLS, morseConfig, Network, } from "./config.js";
|
|
7
|
+
export { formatUserMessage, } from "./errors.format.js";
|
|
7
8
|
export { ABORT_CODES, ConfigurationError, ContractAbortError, MorseError, NotFoundError, SealError, TransportError, UNKNOWN_ABORT_NAME, UnauthorizedError, UncertifiedBlobError, ValidationError, } from "./errors.js";
|
|
8
9
|
export { addEncryptedEntry, addEncryptedEntryFromBytes, addEntry, addEntryFromBytes, appendDraftRevision, appendEncryptedDraftRevision, createCollection, createPublication, deleteCollection, deleteEntry, deletePublication, destroyPublisherCap, issuePublisherCap, publishDirect, publishFromDraft, revokePublisherCap, transferOwnership, transferPublisherCap, } from "./ops/index.js";
|
|
9
10
|
export { RpcPublicationReader, } from "./read/index.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACN,gBAAgB,EAGhB,WAAW,EACX,OAAO,GAGP,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,WAAW,EAGX,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,aAAa,EAEb,SAAS,EAET,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EASN,iBAAiB,EACjB,0BAA0B,EAC1B,QAAQ,EACR,iBAAiB,EACjB,mBAAmB,EACnB,4BAA4B,EAK5B,gBAAgB,EAChB,iBAAiB,EASjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EAGnB,iBAAiB,EAMjB,aAAa,EACb,gBAAgB,EAIhB,kBAAkB,EAKlB,iBAAiB,EACjB,oBAAoB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EASN,oBAAoB,GAEpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,GAOrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,YAAY,EAYZ,qBAAqB,EAKrB,aAAa,EACb,WAAW,GAOX,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,cAAc,EAMd,oBAAoB,GAGpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,wBAAwB,EACxB,yBAAyB,EAEzB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EAEzB,yBAAyB,EAEzB,mBAAmB,EAInB,sBAAsB,EACtB,oBAAoB,GAepB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,E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@ -116,7 +116,7 @@ export async function addEncryptedEntryFromBytes(adapter, config, args) {
|
|
|
116
116
|
}
|
|
117
117
|
function assertFlowCapable(walrus) {
|
|
118
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.");
|
|
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.", { operation: "sdk.addEntryFromBytes" });
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
async function submitCombinedTx(adapter, tx, args) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-from-bytes.js","sourceRoot":"","sources":["../../src/ops/entry-from-bytes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUxE,OAAO,EACN,mBAAmB,GAInB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA2DrD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACtC,OAAsB,EACtB,MAA0B,EAC1B,IAA2B;IAE3B,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,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AEG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,MAAM,GAClB,MAAM,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/ops/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAEpE;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,OAAO,EAAE,SAAS,EAClB,YAAY,EAAE,MAAM,GAClB,MAAM,CAWR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,sBAAsB,EAC9B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,GACjB,MAAM,CAwBR"}
|
package/dist/ops/internal.js
CHANGED
|
@@ -12,7 +12,7 @@ import { TransportError } from "../errors.js";
|
|
|
12
12
|
export function findCreatedId(receipt, expectedType) {
|
|
13
13
|
const created = receipt.createdObjects.find((object) => object.objectType === expectedType);
|
|
14
14
|
if (!created) {
|
|
15
|
-
throw new TransportError(`Receipt is missing a created object of type ${expectedType}
|
|
15
|
+
throw new TransportError(`Receipt is missing a created object of type ${expectedType}`, { operation: "sdk.findCreatedId" });
|
|
16
16
|
}
|
|
17
17
|
return created.objectId;
|
|
18
18
|
}
|
|
@@ -26,16 +26,16 @@ export function findCreatedId(receipt, expectedType) {
|
|
|
26
26
|
export function decodeU64ReturnValue(values, commandIndex, returnIndex) {
|
|
27
27
|
const command = values[commandIndex];
|
|
28
28
|
if (!command) {
|
|
29
|
-
throw new TransportError(`Simulation has no command at index ${commandIndex} (got ${values.length} commands)
|
|
29
|
+
throw new TransportError(`Simulation has no command at index ${commandIndex} (got ${values.length} commands)`, { operation: "sdk.decodeU64ReturnValue" });
|
|
30
30
|
}
|
|
31
31
|
const bytes = command[returnIndex];
|
|
32
32
|
if (!bytes) {
|
|
33
|
-
throw new TransportError(`Simulation command ${commandIndex} has no return value at index ${returnIndex} (got ${command.length} return values)
|
|
33
|
+
throw new TransportError(`Simulation command ${commandIndex} has no return value at index ${returnIndex} (got ${command.length} return values)`, { operation: "sdk.decodeU64ReturnValue" });
|
|
34
34
|
}
|
|
35
35
|
const decoded = bcs.u64().parse(bytes);
|
|
36
36
|
const asNumber = Number(decoded);
|
|
37
37
|
if (!Number.isSafeInteger(asNumber)) {
|
|
38
|
-
throw new TransportError(`Simulated u64 return value ${decoded} exceeds Number.MAX_SAFE_INTEGER
|
|
38
|
+
throw new TransportError(`Simulated u64 return value ${decoded} exceeds Number.MAX_SAFE_INTEGER`, { operation: "sdk.decodeU64ReturnValue" });
|
|
39
39
|
}
|
|
40
40
|
return asNumber;
|
|
41
41
|
}
|
package/dist/ops/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/ops/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAI9C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC5B,OAAkB,EAClB,YAAoB;IAEpB,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI,CAC1C,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,KAAK,YAAY,CAC9C,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,cAAc,CACvB,+CAA+C,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/ops/internal.ts"],"names":[],"mappings":"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