Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@substrate/smoldot-discovery

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@substrate/smoldot-discovery - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

6

dist/commonjs/index.d.ts

@@ -5,3 +5,7 @@ import { type ProviderDetail } from "@substrate/discovery";

export declare const isSmoldotExtension: (provider: ProviderDetail) => provider is SmoldotExtensionProviderDetail;
export declare const getSmoldotExtensionProviders: () => SmoldotExtensionProviderDetail[];
export declare const getSmoldotExtensionProviders: () => Readonly<{
kind: "smoldot-v1";
info: import("@substrate/discovery").ProviderInfo;
provider: Promise<import("./types/index.js").SmoldotExtensionAPI>;
}>[];
//# sourceMappingURL=index.d.ts.map

94

dist/commonjs/types/index.d.ts
import type { ProviderInfo } from "@substrate/discovery";
export type * from "@substrate/discovery";
export type SmoldotExtensionAPI = {
export type SmoldotExtensionAPI = Readonly<{
addChain: AddChain;
addWellKnownChain: AddWellKnownChain;
};
export type SmoldotExtensionProviderDetail = {
}>;
export type SmoldotExtensionProviderDetail = Readonly<{
kind: "smoldot-v1";
info: ProviderInfo;
provider: Promise<SmoldotExtensionAPI>;
};
}>;
/**

@@ -17,8 +17,16 @@ * List of popular chains that are likely to be connected to.

*/
export declare enum WellKnownChain {
polkadot = "polkadot",
ksmcc3 = "ksmcc3",
rococo_v2_2 = "rococo_v2_2",
westend2 = "westend2",
paseo = "paseo"
export declare const WellKnownChain: {
readonly polkadot: "polkadot";
readonly ksmcc3: "ksmcc3";
readonly rococo_v2_2: "rococo_v2_2";
readonly westend2: "westend2";
readonly paseo: "paseo";
};
export type WellKnownChain = (typeof WellKnownChain)[keyof typeof WellKnownChain];
export declare namespace WellKnownChain {
type polkadot = typeof WellKnownChain.polkadot;
type ksmcc3 = typeof WellKnownChain.ksmcc3;
type rococo_v2_2 = typeof WellKnownChain.rococo_v2_2;
type westend2 = typeof WellKnownChain.westend2;
type paseo = typeof WellKnownChain.paseo;
}

@@ -56,4 +64,37 @@ /**

*/
sendJsonRpc(rpc: string): void;
readonly sendJsonRpc: (rpc: string) => void;
/**
* Waits for a JSON-RPC response or notification to be generated.
*
* Each chain contains a buffer of the responses waiting to be sent out. Calling this function
* pulls one element from the buffer. If this function is called at a slower rate than
* responses are generated, then the buffer will eventually become full, at which point calling
* {@link Chain.sendJsonRpc} will throw an exception. The size of this buffer can be configured
* through {@link AddChainOptions.jsonRpcMaxPendingRequests}.
*
* If this function is called multiple times "simultaneously" (generating multiple different
* `Promise`s), each `Promise` will return a different JSON-RPC response or notification. In
* that situation, there is no guarantee in the ordering in which the responses or notifications
* are yielded. Calling this function multiple times "simultaneously" is in general a niche
* corner case that you are encouraged to avoid.
*
* @throws {@link AlreadyDestroyedError} If the chain has been removed or the client has been terminated.
* @throws {@link JsonRpcDisabledError} If the JSON-RPC system was disabled in the options of the chain.
* @throws {@link CrashError} If the background client has crashed.
*/
readonly nextJsonRpcResponse: () => Promise<string>;
/**
* JSON-RPC responses or notifications async iterable.
*
* Each chain contains a buffer of the responses waiting to be sent out. Iterating over this
* pulls one element from the buffer. If the iteration happen at a slower rate than
* responses are generated, then the buffer will eventually become full, at which point calling
* {@link Chain.sendJsonRpc} will throw an exception. The size of this buffer can be configured
* through {@link AddChainOptions.jsonRpcMaxPendingRequests}.
*
* @throws {@link JsonRpcDisabledError} If the JSON-RPC system was disabled in the options of the chain.
* @throws {@link CrashError} If the background client has crashed.
*/
readonly jsonRpcResponses: AsyncIterableIterator<string>;
/**
* Disconnects from the blockchain.

@@ -70,6 +111,6 @@ *

*
* @throws {AlreadyDestroyedError} If the chain has already been removed.
* @throws {CrashError} If the background client has crashed.
* @throws {@link AlreadyDestroyedError} If the chain has already been removed.
* @throws {@link CrashError} If the background client has crashed.
*/
remove(): void;
readonly remove: () => void;
/**

@@ -93,17 +134,15 @@ * Connects to a parachain.

* @param chainSpec Specification of the chain to add.
* @param jsonRpcCallback Callback invoked in response to calling {Chain.sendJsonRpc}.
* This field is optional. If no callback is provided, the client will save up resources by not
* starting the JSON-RPC endpoint, and it is forbidden to call {Chain.sendJsonRpc}.
* Will never be called after ̀{Chain.remove} has been called or if a {CrashError} has been
* generated.
*
* @throws {AddChainError} If the chain can't be added.
* @throws {CrashError} If the background client has crashed.
* @throws {@link AddChainError} If the chain can't be added.
* @throws {@link CrashError} If the background client has crashed.
*/
addChain: AddChain;
readonly addChain: AddChain;
}
export type JsonRpcCallback = (response: string) => void;
export type AddChain = (chainSpec: string, jsonRpcCallback?: JsonRpcCallback, databaseContent?: string) => Promise<Chain>;
export type AddWellKnownChain = (id: WellKnownChain, jsonRpcCallback?: JsonRpcCallback, databaseContent?: string) => Promise<Chain>;
export type AddChainOptions = Readonly<{
disableJsonRpc?: boolean;
databaseContent?: string | undefined;
jsonRpcMaxPendingRequests?: number;
}>;
export type AddChain = (chainSpec: string, options?: AddChainOptions) => Promise<Chain>;
export type AddWellKnownChain = (id: WellKnownChain, options?: AddChainOptions) => Promise<Chain>;
export declare class AlreadyDestroyedError extends Error {

@@ -118,2 +157,5 @@ constructor();

}
export declare class QueueFullError extends Error {
constructor();
}
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonRpcDisabledError = exports.CrashError = exports.AlreadyDestroyedError = exports.WellKnownChain = void 0;
exports.QueueFullError = exports.JsonRpcDisabledError = exports.CrashError = exports.AlreadyDestroyedError = exports.WellKnownChain = void 0;
/**

@@ -9,10 +9,9 @@ * List of popular chains that are likely to be connected to.

*/
var WellKnownChain;
(function (WellKnownChain) {
WellKnownChain["polkadot"] = "polkadot";
WellKnownChain["ksmcc3"] = "ksmcc3";
WellKnownChain["rococo_v2_2"] = "rococo_v2_2";
WellKnownChain["westend2"] = "westend2";
WellKnownChain["paseo"] = "paseo";
})(WellKnownChain || (exports.WellKnownChain = WellKnownChain = {}));
exports.WellKnownChain = {
polkadot: "polkadot",
ksmcc3: "ksmcc3",
rococo_v2_2: "rococo_v2_2",
westend2: "westend2",
paseo: "paseo",
};
class AlreadyDestroyedError extends Error {

@@ -39,2 +38,9 @@ constructor() {

exports.JsonRpcDisabledError = JsonRpcDisabledError;
class QueueFullError extends Error {
constructor() {
super();
this.name = "QueueFullError";
}
}
exports.QueueFullError = QueueFullError;
//# sourceMappingURL=index.js.map

@@ -5,3 +5,7 @@ import { type ProviderDetail } from "@substrate/discovery";

export declare const isSmoldotExtension: (provider: ProviderDetail) => provider is SmoldotExtensionProviderDetail;
export declare const getSmoldotExtensionProviders: () => SmoldotExtensionProviderDetail[];
export declare const getSmoldotExtensionProviders: () => Readonly<{
kind: "smoldot-v1";
info: import("@substrate/discovery").ProviderInfo;
provider: Promise<import("./types/index.js").SmoldotExtensionAPI>;
}>[];
//# sourceMappingURL=index.d.ts.map
import type { ProviderInfo } from "@substrate/discovery";
export type * from "@substrate/discovery";
export type SmoldotExtensionAPI = {
export type SmoldotExtensionAPI = Readonly<{
addChain: AddChain;
addWellKnownChain: AddWellKnownChain;
};
export type SmoldotExtensionProviderDetail = {
}>;
export type SmoldotExtensionProviderDetail = Readonly<{
kind: "smoldot-v1";
info: ProviderInfo;
provider: Promise<SmoldotExtensionAPI>;
};
}>;
/**

@@ -17,8 +17,16 @@ * List of popular chains that are likely to be connected to.

*/
export declare enum WellKnownChain {
polkadot = "polkadot",
ksmcc3 = "ksmcc3",
rococo_v2_2 = "rococo_v2_2",
westend2 = "westend2",
paseo = "paseo"
export declare const WellKnownChain: {
readonly polkadot: "polkadot";
readonly ksmcc3: "ksmcc3";
readonly rococo_v2_2: "rococo_v2_2";
readonly westend2: "westend2";
readonly paseo: "paseo";
};
export type WellKnownChain = (typeof WellKnownChain)[keyof typeof WellKnownChain];
export declare namespace WellKnownChain {
type polkadot = typeof WellKnownChain.polkadot;
type ksmcc3 = typeof WellKnownChain.ksmcc3;
type rococo_v2_2 = typeof WellKnownChain.rococo_v2_2;
type westend2 = typeof WellKnownChain.westend2;
type paseo = typeof WellKnownChain.paseo;
}

@@ -56,4 +64,37 @@ /**

*/
sendJsonRpc(rpc: string): void;
readonly sendJsonRpc: (rpc: string) => void;
/**
* Waits for a JSON-RPC response or notification to be generated.
*
* Each chain contains a buffer of the responses waiting to be sent out. Calling this function
* pulls one element from the buffer. If this function is called at a slower rate than
* responses are generated, then the buffer will eventually become full, at which point calling
* {@link Chain.sendJsonRpc} will throw an exception. The size of this buffer can be configured
* through {@link AddChainOptions.jsonRpcMaxPendingRequests}.
*
* If this function is called multiple times "simultaneously" (generating multiple different
* `Promise`s), each `Promise` will return a different JSON-RPC response or notification. In
* that situation, there is no guarantee in the ordering in which the responses or notifications
* are yielded. Calling this function multiple times "simultaneously" is in general a niche
* corner case that you are encouraged to avoid.
*
* @throws {@link AlreadyDestroyedError} If the chain has been removed or the client has been terminated.
* @throws {@link JsonRpcDisabledError} If the JSON-RPC system was disabled in the options of the chain.
* @throws {@link CrashError} If the background client has crashed.
*/
readonly nextJsonRpcResponse: () => Promise<string>;
/**
* JSON-RPC responses or notifications async iterable.
*
* Each chain contains a buffer of the responses waiting to be sent out. Iterating over this
* pulls one element from the buffer. If the iteration happen at a slower rate than
* responses are generated, then the buffer will eventually become full, at which point calling
* {@link Chain.sendJsonRpc} will throw an exception. The size of this buffer can be configured
* through {@link AddChainOptions.jsonRpcMaxPendingRequests}.
*
* @throws {@link JsonRpcDisabledError} If the JSON-RPC system was disabled in the options of the chain.
* @throws {@link CrashError} If the background client has crashed.
*/
readonly jsonRpcResponses: AsyncIterableIterator<string>;
/**
* Disconnects from the blockchain.

@@ -70,6 +111,6 @@ *

*
* @throws {AlreadyDestroyedError} If the chain has already been removed.
* @throws {CrashError} If the background client has crashed.
* @throws {@link AlreadyDestroyedError} If the chain has already been removed.
* @throws {@link CrashError} If the background client has crashed.
*/
remove(): void;
readonly remove: () => void;
/**

@@ -93,17 +134,15 @@ * Connects to a parachain.

* @param chainSpec Specification of the chain to add.
* @param jsonRpcCallback Callback invoked in response to calling {Chain.sendJsonRpc}.
* This field is optional. If no callback is provided, the client will save up resources by not
* starting the JSON-RPC endpoint, and it is forbidden to call {Chain.sendJsonRpc}.
* Will never be called after ̀{Chain.remove} has been called or if a {CrashError} has been
* generated.
*
* @throws {AddChainError} If the chain can't be added.
* @throws {CrashError} If the background client has crashed.
* @throws {@link AddChainError} If the chain can't be added.
* @throws {@link CrashError} If the background client has crashed.
*/
addChain: AddChain;
readonly addChain: AddChain;
}
export type JsonRpcCallback = (response: string) => void;
export type AddChain = (chainSpec: string, jsonRpcCallback?: JsonRpcCallback, databaseContent?: string) => Promise<Chain>;
export type AddWellKnownChain = (id: WellKnownChain, jsonRpcCallback?: JsonRpcCallback, databaseContent?: string) => Promise<Chain>;
export type AddChainOptions = Readonly<{
disableJsonRpc?: boolean;
databaseContent?: string | undefined;
jsonRpcMaxPendingRequests?: number;
}>;
export type AddChain = (chainSpec: string, options?: AddChainOptions) => Promise<Chain>;
export type AddWellKnownChain = (id: WellKnownChain, options?: AddChainOptions) => Promise<Chain>;
export declare class AlreadyDestroyedError extends Error {

@@ -118,2 +157,5 @@ constructor();

}
export declare class QueueFullError extends Error {
constructor();
}
//# sourceMappingURL=index.d.ts.map

@@ -6,10 +6,9 @@ /**

*/
export var WellKnownChain;
(function (WellKnownChain) {
WellKnownChain["polkadot"] = "polkadot";
WellKnownChain["ksmcc3"] = "ksmcc3";
WellKnownChain["rococo_v2_2"] = "rococo_v2_2";
WellKnownChain["westend2"] = "westend2";
WellKnownChain["paseo"] = "paseo";
})(WellKnownChain || (WellKnownChain = {}));
export const WellKnownChain = {
polkadot: "polkadot",
ksmcc3: "ksmcc3",
rococo_v2_2: "rococo_v2_2",
westend2: "westend2",
paseo: "paseo",
};
export class AlreadyDestroyedError extends Error {

@@ -33,2 +32,8 @@ constructor() {

}
export class QueueFullError extends Error {
constructor() {
super();
this.name = "QueueFullError";
}
}
//# sourceMappingURL=index.js.map
{
"name": "@substrate/smoldot-discovery",
"version": "1.2.0",
"version": "2.0.0",
"author": "Parity Technologies (https://github.com/paritytech)",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc