@polkadot/rpc-core 8.9.1 → 8.9.2-10

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/bundle.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { Observable, publishReplay, refCount } from 'rxjs';
4
4
  import { rpcDefinitions } from '@polkadot/types';
5
- import { assert, hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aConcat, u8aToU8a } from '@polkadot/util';
5
+ import { hexToU8a, isFunction, isNull, isUndefined, lazyMethod, logger, memoize, objectSpread, u8aConcat, u8aToU8a } from '@polkadot/util';
6
6
  import { drr, refCountDelay } from "./util/index.js";
7
7
  export { packageInfo } from "./packageInfo.js";
8
8
  export * from "./util/index.js";
@@ -87,7 +87,10 @@ export class RpcCore {
87
87
 
88
88
  constructor(instanceId, registry, provider, userRpc = {}) {
89
89
  // eslint-disable-next-line @typescript-eslint/unbound-method
90
- assert(provider && isFunction(provider.send), 'Expected Provider to API create');
90
+ if (!provider || !isFunction(provider.send)) {
91
+ throw new Error('Expected Provider to API create');
92
+ }
93
+
91
94
  this.#instanceId = instanceId;
92
95
  this.#registryDefault = registry;
93
96
  this.provider = provider;
@@ -335,7 +338,11 @@ export class RpcCore {
335
338
  isOptional
336
339
  }) => !isOptional).length;
337
340
  const optText = reqArgCount === def.params.length ? '' : ` (${def.params.length - reqArgCount} optional)`;
338
- assert(inputs.length >= reqArgCount && inputs.length <= def.params.length, () => `Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
341
+
342
+ if (inputs.length < reqArgCount || inputs.length > def.params.length) {
343
+ throw new Error(`Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
344
+ }
345
+
339
346
  return inputs.map((input, index) => registry.createTypeUnsafe(def.params[index].type, [input], {
340
347
  blockHash
341
348
  }));
package/cjs/bundle.js CHANGED
@@ -125,8 +125,12 @@ class RpcCore {
125
125
 
126
126
  constructor(instanceId, registry, provider) {
127
127
  let userRpc = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
128
+
128
129
  // eslint-disable-next-line @typescript-eslint/unbound-method
129
- (0, _util.assert)(provider && (0, _util.isFunction)(provider.send), 'Expected Provider to API create');
130
+ if (!provider || !(0, _util.isFunction)(provider.send)) {
131
+ throw new Error('Expected Provider to API create');
132
+ }
133
+
130
134
  this.#instanceId = instanceId;
131
135
  this.#registryDefault = registry;
132
136
  this.provider = provider;
@@ -391,7 +395,11 @@ class RpcCore {
391
395
  return !isOptional;
392
396
  }).length;
393
397
  const optText = reqArgCount === def.params.length ? '' : ` (${def.params.length - reqArgCount} optional)`;
394
- (0, _util.assert)(inputs.length >= reqArgCount && inputs.length <= def.params.length, () => `Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
398
+
399
+ if (inputs.length < reqArgCount || inputs.length > def.params.length) {
400
+ throw new Error(`Expected ${def.params.length} parameters${optText}, ${inputs.length} found instead`);
401
+ }
402
+
395
403
  return inputs.map((input, index) => registry.createTypeUnsafe(def.params[index].type, [input], {
396
404
  blockHash
397
405
  }));
@@ -11,6 +11,6 @@ const packageInfo = {
11
11
  name: '@polkadot/rpc-core',
12
12
  path: typeof __dirname === 'string' ? __dirname : 'auto',
13
13
  type: 'cjs',
14
- version: '8.9.1'
14
+ version: '8.9.2-10'
15
15
  };
16
16
  exports.packageInfo = packageInfo;
package/mod.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './index';
package/mod.ts ADDED
@@ -0,0 +1,4 @@
1
+ // Copyright 2017-2022 @polkadot/rpc-core authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './index';
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./cjs/detectPackage.js"
21
21
  ],
22
22
  "type": "module",
23
- "version": "8.9.1",
23
+ "version": "8.9.2-10",
24
24
  "main": "./cjs/index.js",
25
25
  "module": "./index.js",
26
26
  "types": "./index.d.ts",
@@ -47,6 +47,8 @@
47
47
  "require": "./cjs/detectPackage.js",
48
48
  "default": "./detectPackage.js"
49
49
  },
50
+ "./mod.d.ts": "./mod.d.ts",
51
+ "./mod.ts": "./mod.ts",
50
52
  "./package.json": "./package.json",
51
53
  "./packageInfo.js": {
52
54
  "types": "./packageInfo.d.ts",
@@ -96,10 +98,10 @@
96
98
  },
97
99
  "dependencies": {
98
100
  "@babel/runtime": "^7.18.3",
99
- "@polkadot/rpc-augment": "8.9.1",
100
- "@polkadot/rpc-provider": "8.9.1",
101
- "@polkadot/types": "8.9.1",
102
- "@polkadot/util": "^9.5.1",
101
+ "@polkadot/rpc-augment": "8.9.2-10",
102
+ "@polkadot/rpc-provider": "8.9.2-10",
103
+ "@polkadot/types": "8.9.2-10",
104
+ "@polkadot/util": "^9.5.2-15",
103
105
  "rxjs": "^7.5.5"
104
106
  }
105
107
  }
package/packageInfo.js CHANGED
@@ -5,5 +5,5 @@ export const packageInfo = {
5
5
  name: '@polkadot/rpc-core',
6
6
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
7
7
  type: 'esm',
8
- version: '8.9.1'
8
+ version: '8.9.2-10'
9
9
  };