File tree Expand file tree Collapse file tree 6 files changed +45
-10
lines changed Expand file tree Collapse file tree 6 files changed +45
-10
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,12 @@ export class WebSocketAPI {
1010 public readonly toriiBaseURL : URL
1111 public readonly adapter : IsomorphicWebSocketAdapter
1212
13+ /**
14+ * Create an instance.
15+ * @param toriiBaseURL Torii base URL
16+ * @param adapter A custom WebSocket adapter. Uses native by default.
17+ * See the {@linkcode [web-socket]} module for more details.
18+ */
1319 public constructor ( toriiBaseURL : URL , adapter ?: IsomorphicWebSocketAdapter ) {
1420 this . toriiBaseURL = toriiBaseURL
1521 this . adapter = adapter ?? nativeWS
Original file line number Diff line number Diff line change 1+ /**
2+ * Types and native implementation of a WebSocket transport.
3+ *
4+ * [The WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)
5+ * is not natively available everywhere. For when it is available, the built-in {@linkcode nativeWS}
6+ * transport is used. For when it is not, consider using
7+ * {@linkcode https://jsr.io/@iroha/client-web-socket-node|@iroha/client-web-socket-node} adapter or providing a custom
8+ * one.
9+ *
10+ * A custom adapter could be passed to the {@linkcode [default].WebSocketAPI | WebSocketAPI} as well as to the
11+ * {@linkcode [default].CreateClientParams | Client}.
12+ *
13+ * ### Note on Bun
14+ *
15+ * Although Bun provides "native" `WebSocket`, it's implementation is not spec-compliant (specifically, it uses Node's `Buffer`).
16+ * Using `@iroha/client-web-socket-node` would work in this case.
17+ *
18+ * @example Using Node.js adapter
19+ * ```ts
20+ * import { WebSocketAPI } from '@iroha/client'
21+ * import ws from '@iroha/client-web-socket-node'
22+ *
23+ * const api = new WebSocketAPI(new URL('http://localhost:8080'), ws)
24+ * ```
25+ *
26+ * @module
27+ */
28+
129export * from './types.ts'
230export { default as nativeWS } from './native.ts'
Original file line number Diff line number Diff line change 11/**
22 * Iroha data model - types and codecs.
33 *
4- * It is based on the `schema.json` generated by Iroha. The schema itself is also available, see the `@iroha/core/data-model/schema` and `@iroha/core/data-model/schema-json` modules.
4+ * It is based on the `schema.json` generated by Iroha. The schema itself is also available,
5+ * see the {@linkcode [data-model/schema]} and {@linkcode [data-model/schema-json]} modules.
56 *
67 * ## Encoding
78 *
Original file line number Diff line number Diff line change 11/**
2- * The Iroha's `schema.json` itself .
2+ * The embedded `schema.json` used to generate this exact version of the package .
33 *
4- * Data model types are generated based on this schema. It could be used as a reference .
4+ * Its types are described in the { @linkcode [data-model/ schema]} module .
55 *
66 * @module
77 */
Original file line number Diff line number Diff line change 11/**
2- * Types describing Iroha's `schema.json` file.
2+ * Types describing Iroha `schema.json` file.
3+ *
4+ * The embedded `schema.json` used to generate this exact version of the package is in the {@linkcode [data-model/schema-json]} module.
35 *
46 * @module
57 */
Original file line number Diff line number Diff line change 66 *
77 * This package consists of the following modules:
88 *
9- * - ` data-model` - the data model
10- * - ` crypto` - cryptographic utilities
11- * - ` codec` - lower-level utilities to work with the codec
9+ * - { @linkcode [ data-model]} - the data model
10+ * - { @linkcode [ crypto]} - cryptographic utilities
11+ * - { @linkcode [ codec]} - lower-level utilities to work with the codec
1212 *
1313 * > [!IMPORTANT]
1414 * > This package includes a WebAssembly module to perform cryptographic operations in a way consistent with Iroha.
1515 * > It is a bit tricky to initialise uniformly across different environments, and **there could be compatibility issues**.
16- * > See the ` crypto` module for more details.
16+ * > See the { @linkcode [ crypto]} module for more details.
1717 *
1818 * ### Iroha Compatibility
1919 *
8585 * assertEquals(account.toString(), raw)
8686 * ```
8787 *
88- * Note that this example requires WASM installation, because account id contains a public key.
89- *
9088 * @module
9189 */
9290
You can’t perform that action at this time.
0 commit comments