smoldot 1.0.17 → 2.0.1
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/dist/cjs/index-browser.d.ts +1 -1
- package/dist/cjs/index-browser.js +1 -2
- package/dist/cjs/index-deno.d.ts +1 -1
- package/dist/cjs/index-deno.js +1 -2
- package/dist/cjs/index-nodejs.d.ts +1 -1
- package/dist/cjs/index-nodejs.js +1 -2
- package/dist/cjs/internals/bytecode/wasm0.js +1 -1
- package/dist/cjs/internals/bytecode/wasm1.js +1 -1
- package/dist/cjs/internals/bytecode/wasm2.js +1 -1
- package/dist/cjs/internals/client.js +1 -6
- package/dist/cjs/internals/local-instance.js +1 -1
- package/dist/cjs/no-auto-bytecode-browser.d.ts +1 -1
- package/dist/cjs/no-auto-bytecode-browser.js +1 -2
- package/dist/cjs/no-auto-bytecode-deno.d.ts +1 -1
- package/dist/cjs/no-auto-bytecode-deno.js +1 -2
- package/dist/cjs/no-auto-bytecode-nodejs.d.ts +1 -1
- package/dist/cjs/no-auto-bytecode-nodejs.js +1 -2
- package/dist/cjs/public-types.d.ts +3 -13
- package/dist/cjs/public-types.js +1 -10
- package/dist/mjs/index-browser.d.ts +1 -1
- package/dist/mjs/index-browser.js +1 -1
- package/dist/mjs/index-deno.d.ts +1 -1
- package/dist/mjs/index-deno.js +1 -1
- package/dist/mjs/index-nodejs.d.ts +1 -1
- package/dist/mjs/index-nodejs.js +1 -1
- package/dist/mjs/internals/bytecode/wasm0.js +1 -1
- package/dist/mjs/internals/bytecode/wasm1.js +1 -1
- package/dist/mjs/internals/bytecode/wasm2.js +1 -1
- package/dist/mjs/internals/client.js +2 -7
- package/dist/mjs/internals/local-instance.js +1 -1
- package/dist/mjs/no-auto-bytecode-browser.d.ts +1 -1
- package/dist/mjs/no-auto-bytecode-browser.js +1 -1
- package/dist/mjs/no-auto-bytecode-deno.d.ts +1 -1
- package/dist/mjs/no-auto-bytecode-deno.js +1 -1
- package/dist/mjs/no-auto-bytecode-nodejs.d.ts +1 -1
- package/dist/mjs/no-auto-bytecode-nodejs.js +1 -1
- package/dist/mjs/public-types.d.ts +3 -13
- package/dist/mjs/public-types.js +0 -8
- package/package.json +2 -2
|
@@ -309,15 +309,10 @@ function start(options, wasmModule, platformBindings) {
|
|
|
309
309
|
throw new public_types_js_1.AlreadyDestroyedError();
|
|
310
310
|
if (options.disableJsonRpc)
|
|
311
311
|
throw new public_types_js_1.JsonRpcDisabledError();
|
|
312
|
-
if (request.length >= 64 * 1024 * 1024) {
|
|
313
|
-
throw new public_types_js_1.MalformedJsonRpcError();
|
|
314
|
-
}
|
|
315
|
-
;
|
|
316
312
|
const retVal = state.instance.instance.request(request, chainId);
|
|
317
313
|
switch (retVal) {
|
|
318
314
|
case 0: break;
|
|
319
|
-
case 1: throw new public_types_js_1.
|
|
320
|
-
case 2: throw new public_types_js_1.QueueFullError();
|
|
315
|
+
case 1: throw new public_types_js_1.QueueFullError();
|
|
321
316
|
default: throw new Error("Internal error: unknown json_rpc_send error code: " + retVal);
|
|
322
317
|
}
|
|
323
318
|
},
|
|
@@ -469,7 +469,7 @@ function startLocalInstance(config, wasmModule, eventCallback) {
|
|
|
469
469
|
return {
|
|
470
470
|
request: (request, chainId) => {
|
|
471
471
|
if (!state.instance)
|
|
472
|
-
return
|
|
472
|
+
return 1; // TODO: return a different error code? should be documented
|
|
473
473
|
state.bufferIndices[0] = new TextEncoder().encode(request);
|
|
474
474
|
return state.instance.exports.json_rpc_send(0, chainId) >>> 0;
|
|
475
475
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
2
|
import { Client, ClientOptionsWithBytecode } from './public-types.js';
|
|
3
|
-
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError, JsonRpcDisabledError,
|
|
3
|
+
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError, JsonRpcDisabledError, QueueFullError, LogCallback } from './public-types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
6
6
|
*
|
|
@@ -12,14 +12,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.startWithBytecode = exports.QueueFullError = exports.
|
|
15
|
+
exports.startWithBytecode = exports.QueueFullError = exports.JsonRpcDisabledError = exports.CrashError = exports.AlreadyDestroyedError = exports.AddChainError = void 0;
|
|
16
16
|
const client_js_1 = require("./internals/client.js");
|
|
17
17
|
var public_types_js_1 = require("./public-types.js");
|
|
18
18
|
Object.defineProperty(exports, "AddChainError", { enumerable: true, get: function () { return public_types_js_1.AddChainError; } });
|
|
19
19
|
Object.defineProperty(exports, "AlreadyDestroyedError", { enumerable: true, get: function () { return public_types_js_1.AlreadyDestroyedError; } });
|
|
20
20
|
Object.defineProperty(exports, "CrashError", { enumerable: true, get: function () { return public_types_js_1.CrashError; } });
|
|
21
21
|
Object.defineProperty(exports, "JsonRpcDisabledError", { enumerable: true, get: function () { return public_types_js_1.JsonRpcDisabledError; } });
|
|
22
|
-
Object.defineProperty(exports, "MalformedJsonRpcError", { enumerable: true, get: function () { return public_types_js_1.MalformedJsonRpcError; } });
|
|
23
22
|
Object.defineProperty(exports, "QueueFullError", { enumerable: true, get: function () { return public_types_js_1.QueueFullError; } });
|
|
24
23
|
/**
|
|
25
24
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client, ClientOptionsWithBytecode } from './public-types.js';
|
|
2
|
-
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError,
|
|
2
|
+
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError, QueueFullError, JsonRpcDisabledError, LogCallback } from './public-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
5
5
|
*
|
|
@@ -12,13 +12,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.startWithBytecode = exports.JsonRpcDisabledError = exports.QueueFullError = exports.
|
|
15
|
+
exports.startWithBytecode = exports.JsonRpcDisabledError = exports.QueueFullError = exports.CrashError = exports.AlreadyDestroyedError = exports.AddChainError = void 0;
|
|
16
16
|
const client_js_1 = require("./internals/client.js");
|
|
17
17
|
var public_types_js_1 = require("./public-types.js");
|
|
18
18
|
Object.defineProperty(exports, "AddChainError", { enumerable: true, get: function () { return public_types_js_1.AddChainError; } });
|
|
19
19
|
Object.defineProperty(exports, "AlreadyDestroyedError", { enumerable: true, get: function () { return public_types_js_1.AlreadyDestroyedError; } });
|
|
20
20
|
Object.defineProperty(exports, "CrashError", { enumerable: true, get: function () { return public_types_js_1.CrashError; } });
|
|
21
|
-
Object.defineProperty(exports, "MalformedJsonRpcError", { enumerable: true, get: function () { return public_types_js_1.MalformedJsonRpcError; } });
|
|
22
21
|
Object.defineProperty(exports, "QueueFullError", { enumerable: true, get: function () { return public_types_js_1.QueueFullError; } });
|
|
23
22
|
Object.defineProperty(exports, "JsonRpcDisabledError", { enumerable: true, get: function () { return public_types_js_1.JsonRpcDisabledError; } });
|
|
24
23
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client, ClientOptionsWithBytecode } from './public-types.js';
|
|
2
|
-
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError,
|
|
2
|
+
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError, QueueFullError, JsonRpcDisabledError, LogCallback } from './public-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
5
5
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.
|
|
4
4
|
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.startWithBytecode = exports.JsonRpcDisabledError = exports.QueueFullError = exports.
|
|
6
|
+
exports.startWithBytecode = exports.JsonRpcDisabledError = exports.QueueFullError = exports.CrashError = exports.AlreadyDestroyedError = exports.AddChainError = void 0;
|
|
7
7
|
const client_js_1 = require("./internals/client.js");
|
|
8
8
|
const ws_1 = require("ws");
|
|
9
9
|
const node_perf_hooks_1 = require("node:perf_hooks");
|
|
@@ -13,7 +13,6 @@ var public_types_js_1 = require("./public-types.js");
|
|
|
13
13
|
Object.defineProperty(exports, "AddChainError", { enumerable: true, get: function () { return public_types_js_1.AddChainError; } });
|
|
14
14
|
Object.defineProperty(exports, "AlreadyDestroyedError", { enumerable: true, get: function () { return public_types_js_1.AlreadyDestroyedError; } });
|
|
15
15
|
Object.defineProperty(exports, "CrashError", { enumerable: true, get: function () { return public_types_js_1.CrashError; } });
|
|
16
|
-
Object.defineProperty(exports, "MalformedJsonRpcError", { enumerable: true, get: function () { return public_types_js_1.MalformedJsonRpcError; } });
|
|
17
16
|
Object.defineProperty(exports, "QueueFullError", { enumerable: true, get: function () { return public_types_js_1.QueueFullError; } });
|
|
18
17
|
Object.defineProperty(exports, "JsonRpcDisabledError", { enumerable: true, get: function () { return public_types_js_1.JsonRpcDisabledError; } });
|
|
19
18
|
/**
|
|
@@ -25,12 +25,6 @@ export declare class JsonRpcDisabledError extends Error {
|
|
|
25
25
|
export declare class CrashError extends Error {
|
|
26
26
|
constructor(message: string);
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
29
|
-
* Thrown in case a malformed JSON-RPC request is sent.
|
|
30
|
-
*/
|
|
31
|
-
export declare class MalformedJsonRpcError extends Error {
|
|
32
|
-
constructor();
|
|
33
|
-
}
|
|
34
28
|
/**
|
|
35
29
|
* Thrown in case the buffer of JSON-RPC requests is full and cannot accept any more request.
|
|
36
30
|
*/
|
|
@@ -103,15 +97,12 @@ export interface Chain {
|
|
|
103
97
|
* Be aware that some requests will cause notifications to be sent back using the same callback
|
|
104
98
|
* as the responses.
|
|
105
99
|
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
100
|
+
* If the request is not a valid JSON-RPC request, then a JSON-RPC error response is later
|
|
101
|
+
* generated with an `id` equal to `null`, in accordance with the JSON-RPC 2.0 specification.
|
|
102
|
+
*
|
|
109
103
|
* If, however, the request is a valid JSON-RPC request but that concerns an unknown method, or
|
|
110
104
|
* if for example some parameters are missing, an error response is properly generated and
|
|
111
105
|
* yielded through the JSON-RPC callback.
|
|
112
|
-
* In other words, a {@link MalformedJsonRpcError} is thrown in situations where something
|
|
113
|
-
* is *so wrong* with the request that it is not possible for smoldot to send back an error
|
|
114
|
-
* through the JSON-RPC callback.
|
|
115
106
|
*
|
|
116
107
|
* Two JSON-RPC APIs are supported by smoldot:
|
|
117
108
|
*
|
|
@@ -120,7 +111,6 @@ export interface Chain {
|
|
|
120
111
|
*
|
|
121
112
|
* @param rpc JSON-encoded RPC request.
|
|
122
113
|
*
|
|
123
|
-
* @throws {@link MalformedJsonRpcError} If the payload isn't valid JSON-RPC.
|
|
124
114
|
* @throws {@link QueueFullError} If the queue of JSON-RPC requests of the chain is full.
|
|
125
115
|
* @throws {@link AlreadyDestroyedError} If the chain has been removed or the client has been terminated.
|
|
126
116
|
* @throws {@link JsonRpcDisabledError} If the JSON-RPC system was disabled in the options of the chain.
|
package/dist/cjs/public-types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.
|
|
4
4
|
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.QueueFullError = exports.
|
|
6
|
+
exports.QueueFullError = exports.CrashError = exports.JsonRpcDisabledError = exports.AlreadyDestroyedError = exports.AddChainError = void 0;
|
|
7
7
|
// This program is free software: you can redistribute it and/or modify
|
|
8
8
|
// it under the terms of the GNU General Public License as published by
|
|
9
9
|
// the Free Software Foundation, either version 3 of the License, or
|
|
@@ -56,15 +56,6 @@ class CrashError extends Error {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
exports.CrashError = CrashError;
|
|
59
|
-
/**
|
|
60
|
-
* Thrown in case a malformed JSON-RPC request is sent.
|
|
61
|
-
*/
|
|
62
|
-
class MalformedJsonRpcError extends Error {
|
|
63
|
-
constructor() {
|
|
64
|
-
super("JSON-RPC request is malformed");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.MalformedJsonRpcError = MalformedJsonRpcError;
|
|
68
59
|
/**
|
|
69
60
|
* Thrown in case the buffer of JSON-RPC requests is full and cannot accept any more request.
|
|
70
61
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
2
|
import { Client, ClientOptions } from './public-types.js';
|
|
3
|
-
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError, JsonRpcDisabledError,
|
|
3
|
+
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError, JsonRpcDisabledError, QueueFullError, LogCallback } from './public-types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
6
6
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
|
4
4
|
import { startWithBytecode } from './no-auto-bytecode-browser.js';
|
|
5
5
|
import { compileBytecode } from './bytecode-browser.js';
|
|
6
|
-
export { AddChainError, AlreadyDestroyedError, CrashError, JsonRpcDisabledError,
|
|
6
|
+
export { AddChainError, AlreadyDestroyedError, CrashError, JsonRpcDisabledError, QueueFullError } from './public-types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
9
9
|
*
|
package/dist/mjs/index-deno.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client, ClientOptions } from './public-types.js';
|
|
2
|
-
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError,
|
|
2
|
+
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError, QueueFullError, JsonRpcDisabledError, LogCallback } from './public-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
5
5
|
*
|
package/dist/mjs/index-deno.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
|
4
4
|
import { startWithBytecode } from './no-auto-bytecode-deno.js';
|
|
5
5
|
import { compileBytecode } from './bytecode-deno.js';
|
|
6
|
-
export { AddChainError, AlreadyDestroyedError, CrashError,
|
|
6
|
+
export { AddChainError, AlreadyDestroyedError, CrashError, QueueFullError, JsonRpcDisabledError } from './public-types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
9
9
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client, ClientOptions } from './public-types.js';
|
|
2
|
-
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError,
|
|
2
|
+
export { AddChainError, AddChainOptions, AlreadyDestroyedError, Chain, Client, ClientOptions, ClientOptionsWithBytecode, SmoldotBytecode, CrashError, QueueFullError, JsonRpcDisabledError, LogCallback } from './public-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
5
5
|
*
|
package/dist/mjs/index-nodejs.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
|
|
4
4
|
import { startWithBytecode } from './no-auto-bytecode-nodejs.js';
|
|
5
5
|
import { compileBytecode } from './bytecode-nodejs.js';
|
|
6
|
-
export { AddChainError, AlreadyDestroyedError, CrashError,
|
|
6
|
+
export { AddChainError, AlreadyDestroyedError, CrashError, QueueFullError, JsonRpcDisabledError } from './public-types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Initializes a new client. This is a pre-requisite to connecting to a blockchain.
|
|
9
9
|
*
|