Registry / http-networking / symbol-openapi-typescript-fetch-client

symbol-openapi-typescript-fetch-client

JSON →
library1.0.3jsnpmunverified

This package, `symbol-openapi-typescript-fetch-client` (version 1.0.3, last published in November 2021), provides a generated OpenAPI client for the Symbol blockchain. It is built using `symbol-openapi-generator` and designed to interact with Symbol nodes via the standard `fetch` API. It ships with TypeScript types, offering type-safe access to Symbol's REST API endpoints as defined by its OpenAPI specification at the time of its generation. However, it's crucial to note that this package is essentially an artifact generated from an older specification and generator. The README itself points users to `symbol-sdk-typescript-javascript`, which has since been deprecated (as of January 2022). For current Symbol blockchain development, the actively maintained `@symbol/symbol-sdk` package should be used instead, as this generated client is not regularly updated and reflects an outdated state of the Symbol ecosystem.

npm install symbol-openapi-typescript-fetch-client
INSTALL
IMPORT
SIG · SYMBOL-OPENAPI-TYP
S
symbol-openapi-typescript-fetch-client
http-networkingjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Configuration
import { Configuration } from 'symbol-openapi-typescript-fetch-client';
const Configuration = require('symbol-openapi-typescript-fetch-client').Configuration;
The library primarily uses ES Module syntax and TypeScript definitions. CommonJS `require` might work for specific exports but is not the idiomatic way for this package.
NodeRoutesApi
import { NodeRoutesApi } from 'symbol-openapi-typescript-fetch-client';
import NodeRoutesApi from 'symbol-openapi-typescript-fetch-client/NodeRoutesApi';
API client classes like `NodeRoutesApi` are named exports from the top-level package, not default exports from sub-paths.
BlockRoutesApi
import { BlockRoutesApi } from 'symbol-openapi-typescript-fetch-client';
Other API classes (e.g., `BlockRoutesApi`, `TransactionRoutesApi`) follow the same named export pattern.

Demonstrates how to initialize the generated Symbol OpenAPI client and fetch basic information about a Symbol node, including its health status and general details.

import { Configuration, NodeRoutesApi } from 'symbol-openapi-typescript-fetch-client'; async function getNodeHealthStatus() { // For Node.js versions < 18, you might need a polyfill: // import fetch from 'node-fetch'; // globalThis.fetch = fetch as any; const nodeUrl = process.env.SYMBOL_NODE_URL ?? 'http://localhost:3000'; try { const config = new Configuration({ basePath: nodeUrl, // You can add headers, API keys, or other configurations here // For example, for a public node, no specific auth is usually needed for node info. }); const nodeApi = new NodeRoutesApi(config); // Fetch the node info const nodeInfo = await nodeApi.getNodeInfo(); console.log('Node Info:', nodeInfo); // Fetch the node health status const healthStatus = await nodeApi.getNodeHealth(); console.log('Node Health Status:', healthStatus); } catch (error) { console.error('Error fetching Symbol node information:', error); if (error instanceof TypeError && error.message.includes('fetch is not defined')) { console.error('Hint: In Node.js environments, ensure `fetch` is available. For Node.js < 18, install `node-fetch` and polyfill `globalThis.fetch`.'); } } } getNodeHealthStatus();
Debug
Known issues
breakingThis package (version 1.0.3) was last published over 4 years ago (November 2021) and is considered abandoned. It reflects an outdated state of the Symbol OpenAPI specification and generator. Using it in new projects is highly discouraged due to potential incompatibilities and lack of updates.
fix
Migrate to the actively maintained `@symbol/symbol-sdk` package for interacting with the Symbol blockchain. If a generated client is strictly required, explore more recent OpenAPI client generators or a more up-to-date generated Symbol client if available.
affects: >=1.0.0
deprecatedThe README for this package explicitly directs users to `symbol-sdk-typescript-javascript` for client development. However, `symbol-sdk-typescript-javascript` itself has been deprecated as of January 2022. This further underscores the outdated nature of `symbol-openapi-typescript-fetch-client` and its recommendations.
fix
Disregard the README's recommendation to use `symbol-sdk-typescript-javascript`. Instead, use `@symbol/symbol-sdk` which is the current, actively supported SDK for Symbol.
affects: >=1.0.0
gotchaThis is a *generated OpenAPI client*, not the comprehensive Symbol SDK. It provides raw API access based on the OpenAPI specification. It lacks higher-level abstractions, utility functions, and domain-specific logic that are present in the full `@symbol/symbol-sdk`.
fix
For complex Symbol application development requiring more than raw API calls, always prefer the `@symbol/symbol-sdk` package. Use this generated client only if you specifically need a minimalistic fetch-based client for an older API version and understand its limitations.
affects: >=1.0.0
gotchaThe client relies on the global `fetch` API. In Node.js environments prior to version 18, `fetch` is not natively available. Running the client in such environments will result in a runtime error.
fix
For Node.js environments older than 18, install `node-fetch` (e.g., `npm install node-fetch`) and polyfill `globalThis.fetch` before making any API calls:
```typescript
import fetch from 'node-fetch';
globalThis.fetch = fetch as any;
// ... then use the generated client
```
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: fetch is not defined
The client attempts to use the `fetch` API, but it's not available in the current JavaScript runtime, specifically in older Node.js versions (pre-18) or environments without a `fetch` polyfill.
fix
For Node.js environments, upgrade to Node.js 18 or newer, or install `node-fetch` and polyfill `globalThis.fetch`:
```typescript
import fetch from 'node-fetch';
globalThis.fetch = fetch as any;
```
Error: unable to verify the first certificate
This error typically occurs when connecting to a Symbol node via HTTPS with a self-signed or untrusted SSL certificate, common in local development environments or private networks without proper certificate authority setup.
fix
For development, you can temporarily disable certificate verification by setting the `NODE_TLS_REJECT_UNAUTHORIZED='0'` environment variable (not recommended for production). Alternatively, configure your environment to trust the certificate or use an HTTP endpoint if available and appropriate for your security model.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
node-fetchoptionalRequired for `fetch` API availability in Node.js environments older than 18, as this client relies on a global `fetch`.
Agent activity
22 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
symbol-openapi-typescript-fetch-client — npm install symbol-openapi-typescript-fetch-client · libregistry