@acala-network/chopsticks-core 1.0.6-1 → 1.1.0

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.
Files changed (34) hide show
  1. package/dist/cjs/blockchain/block-builder.js +6 -6
  2. package/dist/cjs/blockchain/head-state.js +3 -3
  3. package/dist/cjs/blockchain/storage-layer.js +4 -4
  4. package/dist/cjs/blockchain/txpool.js +4 -4
  5. package/dist/cjs/env.js +3 -3
  6. package/dist/cjs/logger.js +4 -4
  7. package/dist/cjs/rpc/index.js +5 -5
  8. package/dist/cjs/rpc/rpc-spec/chainHead_v1.js +51 -15
  9. package/dist/cjs/rpc/rpc-spec/chainSpec_v1.js +4 -4
  10. package/dist/cjs/rpc/rpc-spec/index.js +5 -5
  11. package/dist/cjs/rpc/rpc-spec/transaction_v1.js +3 -3
  12. package/dist/cjs/rpc/shared.js +5 -5
  13. package/dist/cjs/rpc/substrate/archive.d.ts +16 -1
  14. package/dist/cjs/rpc/substrate/archive.js +17 -6
  15. package/dist/cjs/rpc/substrate/author.js +5 -5
  16. package/dist/cjs/rpc/substrate/chain.js +12 -12
  17. package/dist/cjs/rpc/substrate/index.d.ts +4 -1
  18. package/dist/cjs/rpc/substrate/index.js +8 -8
  19. package/dist/cjs/rpc/substrate/payment.js +3 -3
  20. package/dist/cjs/rpc/substrate/state.js +14 -14
  21. package/dist/cjs/rpc/substrate/system.js +12 -12
  22. package/dist/cjs/setup.js +3 -3
  23. package/dist/cjs/utils/decoder.js +5 -5
  24. package/dist/cjs/utils/index.js +16 -16
  25. package/dist/cjs/utils/proof.js +9 -9
  26. package/dist/cjs/wasm-executor/index.js +11 -11
  27. package/dist/cjs/xcm/index.js +4 -4
  28. package/dist/esm/chopsticks-provider.js +89 -98
  29. package/dist/esm/rpc/rpc-spec/chainHead_v1.js +41 -5
  30. package/dist/esm/rpc/substrate/archive.d.ts +16 -1
  31. package/dist/esm/rpc/substrate/archive.js +20 -2
  32. package/dist/esm/rpc/substrate/index.d.ts +4 -1
  33. package/dist/esm/utils/key-cache.js +1 -2
  34. package/package.json +16 -16
@@ -5,41 +5,41 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- system_accountNextIndex: function() {
12
+ get system_accountNextIndex () {
13
13
  return system_accountNextIndex;
14
14
  },
15
- system_chain: function() {
15
+ get system_chain () {
16
16
  return system_chain;
17
17
  },
18
- system_chainType: function() {
18
+ get system_chainType () {
19
19
  return system_chainType;
20
20
  },
21
- system_dryRun: function() {
21
+ get system_dryRun () {
22
22
  return system_dryRun;
23
23
  },
24
- system_health: function() {
24
+ get system_health () {
25
25
  return system_health;
26
26
  },
27
- system_localListenAddresses: function() {
27
+ get system_localListenAddresses () {
28
28
  return system_localListenAddresses;
29
29
  },
30
- system_localPeerId: function() {
30
+ get system_localPeerId () {
31
31
  return system_localPeerId;
32
32
  },
33
- system_name: function() {
33
+ get system_name () {
34
34
  return system_name;
35
35
  },
36
- system_nodeRoles: function() {
36
+ get system_nodeRoles () {
37
37
  return system_nodeRoles;
38
38
  },
39
- system_properties: function() {
39
+ get system_properties () {
40
40
  return system_properties;
41
41
  },
42
- system_version: function() {
42
+ get system_version () {
43
43
  return system_version;
44
44
  }
45
45
  });
package/dist/cjs/setup.js CHANGED
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- processOptions: function() {
12
+ get processOptions () {
13
13
  return processOptions;
14
14
  },
15
- setup: function() {
15
+ get setup () {
16
16
  return setup;
17
17
  }
18
18
  });
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- decodeBlockStorageDiff: function() {
12
+ get decodeBlockStorageDiff () {
13
13
  return decodeBlockStorageDiff;
14
14
  },
15
- decodeKey: function() {
15
+ get decodeKey () {
16
16
  return decodeKey;
17
17
  },
18
- decodeKeyValue: function() {
18
+ get decodeKeyValue () {
19
19
  return decodeKeyValue;
20
20
  },
21
- toStorageObject: function() {
21
+ get toStorageObject () {
22
22
  return toStorageObject;
23
23
  }
24
24
  });
@@ -5,53 +5,53 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- CHILD_PREFIX_LENGTH: function() {
12
+ get CHILD_PREFIX_LENGTH () {
13
13
  return CHILD_PREFIX_LENGTH;
14
14
  },
15
- PREFIX_LENGTH: function() {
15
+ get PREFIX_LENGTH () {
16
16
  return PREFIX_LENGTH;
17
17
  },
18
- compactHex: function() {
18
+ get compactHex () {
19
19
  return compactHex;
20
20
  },
21
- defer: function() {
21
+ get defer () {
22
22
  return defer;
23
23
  },
24
- fetchKeys: function() {
24
+ get fetchKeys () {
25
25
  return fetchKeys;
26
26
  },
27
- fetchKeysToArray: function() {
27
+ get fetchKeysToArray () {
28
28
  return fetchKeysToArray;
29
29
  },
30
- getCurrentSlot: function() {
30
+ get getCurrentSlot () {
31
31
  return getCurrentSlot;
32
32
  },
33
- getCurrentTimestamp: function() {
33
+ get getCurrentTimestamp () {
34
34
  return getCurrentTimestamp;
35
35
  },
36
- getParaId: function() {
36
+ get getParaId () {
37
37
  return getParaId;
38
38
  },
39
- getSlotDuration: function() {
39
+ get getSlotDuration () {
40
40
  return getSlotDuration;
41
41
  },
42
- isPrefixedChildKey: function() {
42
+ get isPrefixedChildKey () {
43
43
  return isPrefixedChildKey;
44
44
  },
45
- isUrl: function() {
45
+ get isUrl () {
46
46
  return isUrl;
47
47
  },
48
- prefixedChildKey: function() {
48
+ get prefixedChildKey () {
49
49
  return prefixedChildKey;
50
50
  },
51
- splitChildKey: function() {
51
+ get splitChildKey () {
52
52
  return splitChildKey;
53
53
  },
54
- stripChildPrefix: function() {
54
+ get stripChildPrefix () {
55
55
  return stripChildPrefix;
56
56
  }
57
57
  });
@@ -5,32 +5,32 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- WELL_KNOWN_KEYS: function() {
12
+ get WELL_KNOWN_KEYS () {
13
13
  return WELL_KNOWN_KEYS;
14
14
  },
15
- dmqMqcHead: function() {
15
+ get dmqMqcHead () {
16
16
  return dmqMqcHead;
17
17
  },
18
- hrmpChannels: function() {
18
+ get hrmpChannels () {
19
19
  return hrmpChannels;
20
20
  },
21
- hrmpEgressChannelIndex: function() {
21
+ get hrmpEgressChannelIndex () {
22
22
  return hrmpEgressChannelIndex;
23
23
  },
24
- hrmpIngressChannelIndex: function() {
24
+ get hrmpIngressChannelIndex () {
25
25
  return hrmpIngressChannelIndex;
26
26
  },
27
- paraHead: function() {
27
+ get paraHead () {
28
28
  return paraHead;
29
29
  },
30
- upgradeGoAheadSignal: function() {
30
+ get upgradeGoAheadSignal () {
31
31
  return upgradeGoAheadSignal;
32
32
  },
33
- upgradeRestrictionSignal: function() {
33
+ get upgradeRestrictionSignal () {
34
34
  return upgradeRestrictionSignal;
35
35
  }
36
36
  });
@@ -5,38 +5,38 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- calculateStateRoot: function() {
12
+ get calculateStateRoot () {
13
13
  return calculateStateRoot;
14
14
  },
15
- createProof: function() {
15
+ get createProof () {
16
16
  return createProof;
17
17
  },
18
- decodeProof: function() {
18
+ get decodeProof () {
19
19
  return decodeProof;
20
20
  },
21
- destroyWorker: function() {
21
+ get destroyWorker () {
22
22
  return destroyWorker;
23
23
  },
24
- emptyTaskHandler: function() {
24
+ get emptyTaskHandler () {
25
25
  return emptyTaskHandler;
26
26
  },
27
- getAuraSlotDuration: function() {
27
+ get getAuraSlotDuration () {
28
28
  return getAuraSlotDuration;
29
29
  },
30
- getRuntimeVersion: function() {
30
+ get getRuntimeVersion () {
31
31
  return getRuntimeVersion;
32
32
  },
33
- getWorker: function() {
33
+ get getWorker () {
34
34
  return getWorker;
35
35
  },
36
- runTask: function() {
36
+ get runTask () {
37
37
  return runTask;
38
38
  },
39
- taskHandler: function() {
39
+ get taskHandler () {
40
40
  return taskHandler;
41
41
  }
42
42
  });
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
5
5
  function _export(target, all) {
6
6
  for(var name in all)Object.defineProperty(target, name, {
7
7
  enumerable: true,
8
- get: all[name]
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- connectParachains: function() {
12
+ get connectParachains () {
13
13
  return connectParachains;
14
14
  },
15
- connectVertical: function() {
15
+ get connectVertical () {
16
16
  return connectVertical;
17
17
  },
18
- xcmLogger: function() {
18
+ get xcmLogger () {
19
19
  return xcmLogger;
20
20
  }
21
21
  });
@@ -12,101 +12,12 @@ const logger = defaultLogger.child({
12
12
  * Provider for local chopsticks chain
13
13
  */ export class ChopsticksProvider {
14
14
  chain;
15
- #isConnected;
16
- #eventemitter;
15
+ #isConnected = false;
16
+ #eventemitter = new EventEmitter();
17
17
  #isReadyPromise;
18
- #subscriptions;
18
+ #subscriptions = {};
19
19
  constructor(chain){
20
20
  this.chain = chain;
21
- this.#isConnected = false;
22
- this.#eventemitter = new EventEmitter();
23
- this.#subscriptions = {};
24
- this.clone = ()=>{
25
- return new ChopsticksProvider(this.chain);
26
- };
27
- this.connect = async ()=>{
28
- this.#isConnected = true;
29
- this.#eventemitter.emit('connected');
30
- };
31
- this.disconnect = async ()=>{
32
- this.#isConnected = false;
33
- this.#eventemitter.emit('disconnected');
34
- };
35
- this.on = (type, sub)=>{
36
- this.#eventemitter.on(type, sub);
37
- return ()=>{
38
- this.#eventemitter.removeListener(type, sub);
39
- };
40
- };
41
- this.subscriptionManager = {
42
- subscribe: (method, subid, onCancel = ()=>{})=>{
43
- const sub = this.#subscriptions[subid];
44
- if (sub) {
45
- sub.onCancel = onCancel;
46
- }
47
- return (data)=>{
48
- logger.debug('subscribe-callback', method, subid, data);
49
- const sub = this.#subscriptions[subid];
50
- if (sub) {
51
- sub.callback(null, data);
52
- } else {
53
- logger.trace(`Unable to find active subscription=${subid}`);
54
- }
55
- };
56
- },
57
- unsubscribe: (subid)=>{
58
- logger.debug('unsubscribe-callback', subid);
59
- const sub = this.#subscriptions[subid];
60
- if (sub) {
61
- sub.onCancel?.();
62
- delete this.#subscriptions[subid];
63
- } else {
64
- logger.trace(`Unable to find active subscription=${subid}`);
65
- }
66
- }
67
- };
68
- this.send = async (method, params, _isCacheable, subscription)=>{
69
- try {
70
- logger.debug('send', {
71
- method,
72
- params
73
- });
74
- const rpcHandler = providerHandlers[method];
75
- if (!rpcHandler) {
76
- logger.error(`Unable to find rpc handler=${method}`);
77
- throw new Error(`Unable to find rpc handler=${method}`);
78
- }
79
- if (subscription) {
80
- logger.debug('subscribe', {
81
- method,
82
- params
83
- });
84
- const subid = await rpcHandler({
85
- chain: this.chain
86
- }, params, this.subscriptionManager);
87
- if (!subid) {
88
- throw new Error(`Unable to subscribe=${method}`);
89
- }
90
- this.#subscriptions[subid] = {
91
- callback: subscription.callback,
92
- method,
93
- params,
94
- type: subscription.type
95
- };
96
- return subid;
97
- }
98
- logger.debug('call', {
99
- method,
100
- params
101
- });
102
- return rpcHandler({
103
- chain: this.chain
104
- }, params, this.subscriptionManager);
105
- } catch (e) {
106
- logger.error('send error.', e);
107
- throw e;
108
- }
109
- };
110
21
  this.#isReadyPromise = new Promise((resolve, reject)=>{
111
22
  this.#eventemitter.once('connected', resolve);
112
23
  this.#eventemitter.once('error', reject);
@@ -133,12 +44,92 @@ const logger = defaultLogger.child({
133
44
  get isReady() {
134
45
  return this.#isReadyPromise;
135
46
  }
136
- clone;
137
- connect;
138
- disconnect;
139
- on;
140
- subscriptionManager;
141
- send;
47
+ clone = ()=>{
48
+ return new ChopsticksProvider(this.chain);
49
+ };
50
+ connect = async ()=>{
51
+ this.#isConnected = true;
52
+ this.#eventemitter.emit('connected');
53
+ };
54
+ disconnect = async ()=>{
55
+ this.#isConnected = false;
56
+ this.#eventemitter.emit('disconnected');
57
+ };
58
+ on = (type, sub)=>{
59
+ this.#eventemitter.on(type, sub);
60
+ return ()=>{
61
+ this.#eventemitter.removeListener(type, sub);
62
+ };
63
+ };
64
+ subscriptionManager = {
65
+ subscribe: (method, subid, onCancel = ()=>{})=>{
66
+ const sub = this.#subscriptions[subid];
67
+ if (sub) {
68
+ sub.onCancel = onCancel;
69
+ }
70
+ return (data)=>{
71
+ logger.debug('subscribe-callback', method, subid, data);
72
+ const sub = this.#subscriptions[subid];
73
+ if (sub) {
74
+ sub.callback(null, data);
75
+ } else {
76
+ logger.trace(`Unable to find active subscription=${subid}`);
77
+ }
78
+ };
79
+ },
80
+ unsubscribe: (subid)=>{
81
+ logger.debug('unsubscribe-callback', subid);
82
+ const sub = this.#subscriptions[subid];
83
+ if (sub) {
84
+ sub.onCancel?.();
85
+ delete this.#subscriptions[subid];
86
+ } else {
87
+ logger.trace(`Unable to find active subscription=${subid}`);
88
+ }
89
+ }
90
+ };
91
+ send = async (method, params, _isCacheable, subscription)=>{
92
+ try {
93
+ logger.debug('send', {
94
+ method,
95
+ params
96
+ });
97
+ const rpcHandler = providerHandlers[method];
98
+ if (!rpcHandler) {
99
+ logger.error(`Unable to find rpc handler=${method}`);
100
+ throw new Error(`Unable to find rpc handler=${method}`);
101
+ }
102
+ if (subscription) {
103
+ logger.debug('subscribe', {
104
+ method,
105
+ params
106
+ });
107
+ const subid = await rpcHandler({
108
+ chain: this.chain
109
+ }, params, this.subscriptionManager);
110
+ if (!subid) {
111
+ throw new Error(`Unable to subscribe=${method}`);
112
+ }
113
+ this.#subscriptions[subid] = {
114
+ callback: subscription.callback,
115
+ method,
116
+ params,
117
+ type: subscription.type
118
+ };
119
+ return subid;
120
+ }
121
+ logger.debug('call', {
122
+ method,
123
+ params
124
+ });
125
+ return rpcHandler({
126
+ chain: this.chain
127
+ }, params, this.subscriptionManager);
128
+ } catch (e) {
129
+ logger.error('send error.', e);
130
+ throw e;
131
+ }
132
+ };
142
133
  subscribe(type, method, params, callback) {
143
134
  return this.send(method, params, false, {
144
135
  callback,
@@ -1,3 +1,4 @@
1
+ import { blake2AsHex } from '@polkadot/util-crypto';
1
2
  import { defaultLogger } from '../../logger.js';
2
3
  import { ResponseError } from '../shared.js';
3
4
  const logger = defaultLogger.child({
@@ -216,6 +217,23 @@ async function getDescendantValues(block, params) {
216
217
  }
217
218
  return null;
218
219
  }
220
+ case 'hash':
221
+ {
222
+ const value = await block.get(sir.key);
223
+ if (value) {
224
+ following.get(followSubscription)?.callback({
225
+ event: 'operationStorageItems',
226
+ operationId,
227
+ items: [
228
+ {
229
+ key: sir.key,
230
+ hash: blake2AsHex(value)
231
+ }
232
+ ]
233
+ });
234
+ }
235
+ return null;
236
+ }
219
237
  case 'descendantsValues':
220
238
  {
221
239
  const { items, next } = await getDescendantValues(block, {
@@ -229,6 +247,25 @@ async function getDescendantValues(block, params) {
229
247
  });
230
248
  return next;
231
249
  }
250
+ case 'descendantsHashes':
251
+ {
252
+ const { items, next } = await getDescendantValues(block, {
253
+ prefix: sir.key,
254
+ startKey: '0x'
255
+ });
256
+ following.get(followSubscription)?.callback({
257
+ event: 'operationStorageItems',
258
+ operationId,
259
+ items: items.map(({ key, value })=>({
260
+ key,
261
+ hash: value !== undefined ? blake2AsHex(value) : undefined
262
+ }))
263
+ });
264
+ return next ? {
265
+ ...next,
266
+ isDescendantHashes: true
267
+ } : null;
268
+ }
232
269
  case 'closestDescendantMerkleValue':
233
270
  {
234
271
  const followingSubscription = following.get(followSubscription);
@@ -249,10 +286,6 @@ async function getDescendantValues(block, params) {
249
286
  });
250
287
  return null;
251
288
  }
252
- default:
253
- // TODO
254
- console.warn(`Storage type not implemented ${sir.type}`);
255
- return null;
256
289
  }
257
290
  };
258
291
  const listResult = await Promise.all(items.map(handleStorageItemRequest));
@@ -329,7 +362,10 @@ const limitReached = {
329
362
  follower.callback({
330
363
  event: 'operationStorageItems',
331
364
  operationId,
332
- items
365
+ items: params.isDescendantHashes ? items.map(({ key, value })=>({
366
+ key,
367
+ hash: value !== undefined ? blake2AsHex(value) : value
368
+ })) : items
333
369
  });
334
370
  return next;
335
371
  };
@@ -7,5 +7,20 @@ import { type Handler } from '../shared.js';
7
7
  * @return Block extrinsics
8
8
  */
9
9
  export declare const archive_unstable_body: Handler<[HexString], HexString[]>;
10
+ /**
11
+ * @param context
12
+ * @param params - [`blockhash`, `method`, `data` ]
13
+ *
14
+ * @return {Object} result The call result.
15
+ * @return {boolean} result.success Whether the call is successful.
16
+ * @return {string} result.value The call result.
17
+ */
18
+ export declare const archive_unstable_call: Handler<[
19
+ HexString,
20
+ string,
21
+ HexString
22
+ ], {
23
+ success: boolean;
24
+ value: `0x${string}`;
25
+ }>;
10
26
  export declare const archive_unstable_hashByHeight: Handler<[number | `0x${string}` | `0x${string}`[] | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
11
- export declare const archive_unstable_call: Handler<[`0x${string}`, `0x${string}`, `0x${string}`], `0x${string}`>;
@@ -1,6 +1,5 @@
1
1
  import { ResponseError } from '../shared.js';
2
2
  import { chain_getBlockHash } from './chain.js';
3
- import { state_call } from './state.js';
4
3
  /**
5
4
  * @param context
6
5
  * @param params - [`blockhash`]
@@ -13,5 +12,24 @@ import { state_call } from './state.js';
13
12
  }
14
13
  return await block.extrinsics;
15
14
  };
15
+ /**
16
+ * @param context
17
+ * @param params - [`blockhash`, `method`, `data` ]
18
+ *
19
+ * @return {Object} result The call result.
20
+ * @return {boolean} result.success Whether the call is successful.
21
+ * @return {string} result.value The call result.
22
+ */ export const archive_unstable_call = async (context, [hash, method, data])=>{
23
+ const block = await context.chain.getBlock(hash);
24
+ if (!block) {
25
+ throw new ResponseError(1, `Block ${hash} not found`);
26
+ }
27
+ const resp = await block.call(method, [
28
+ data
29
+ ]);
30
+ return {
31
+ success: true,
32
+ value: resp.result
33
+ };
34
+ };
16
35
  export const archive_unstable_hashByHeight = chain_getBlockHash;
17
- export const archive_unstable_call = state_call;
@@ -66,7 +66,10 @@ declare const handlers: {
66
66
  author_unwatchExtrinsic: import("../shared.js").Handler<[string], void>;
67
67
  author_pendingExtrinsics: import("../shared.js").Handler<void, import("@polkadot/util/types").HexString[]>;
68
68
  archive_unstable_body: import("../shared.js").Handler<[import("@polkadot/util/types").HexString], import("@polkadot/util/types").HexString[]>;
69
+ archive_unstable_call: import("../shared.js").Handler<[import("@polkadot/util/types").HexString, string, import("@polkadot/util/types").HexString], {
70
+ success: boolean;
71
+ value: `0x${string}`;
72
+ }>;
69
73
  archive_unstable_hashByHeight: import("../shared.js").Handler<[number | `0x${string}` | `0x${string}`[] | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
70
- archive_unstable_call: import("../shared.js").Handler<[`0x${string}`, `0x${string}`, `0x${string}`], `0x${string}`>;
71
74
  };
72
75
  export default handlers;
@@ -3,9 +3,8 @@ export default class KeyCache {
3
3
  prefixLength;
4
4
  constructor(prefixLength){
5
5
  this.prefixLength = prefixLength;
6
- this.ranges = [];
7
6
  }
8
- ranges;
7
+ ranges = [];
9
8
  feed(keys) {
10
9
  const _keys = keys.filter((key)=>key.length >= this.prefixLength);
11
10
  if (_keys.length === 0) return;