@acala-network/chopsticks-core 1.0.2-1 → 1.0.2
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/api.d.ts +4 -4
- package/dist/cjs/api.js +20 -23
- package/dist/cjs/blockchain/block-builder.d.ts +5 -5
- package/dist/cjs/blockchain/block-builder.js +17 -18
- package/dist/cjs/blockchain/block.d.ts +6 -6
- package/dist/cjs/blockchain/block.js +1 -1
- package/dist/cjs/blockchain/head-state.d.ts +1 -1
- package/dist/cjs/blockchain/index.d.ts +9 -9
- package/dist/cjs/blockchain/index.js +5 -5
- package/dist/cjs/blockchain/inherent/index.d.ts +5 -5
- package/dist/cjs/blockchain/inherent/index.js +1 -1
- package/dist/cjs/blockchain/inherent/para-enter.d.ts +4 -4
- package/dist/cjs/blockchain/inherent/parachain/babe-randomness.d.ts +4 -4
- package/dist/cjs/blockchain/inherent/parachain/nimbus-author-inherent.d.ts +4 -4
- package/dist/cjs/blockchain/inherent/parachain/validation-data.d.ts +4 -4
- package/dist/cjs/blockchain/inherent/parachain/validation-data.js +3 -3
- package/dist/cjs/blockchain/inherent/timestamp.d.ts +3 -3
- package/dist/cjs/blockchain/storage-layer.d.ts +3 -3
- package/dist/cjs/blockchain/storage-layer.js +5 -4
- package/dist/cjs/blockchain/txpool.d.ts +3 -3
- package/dist/cjs/blockchain/txpool.js +2 -2
- package/dist/cjs/chopsticks-provider.d.ts +3 -3
- package/dist/cjs/chopsticks-provider.js +8 -9
- package/dist/cjs/database.d.ts +1 -1
- package/dist/cjs/genesis-provider.d.ts +4 -4
- package/dist/cjs/genesis-provider.js +12 -12
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/logger.js +2 -3
- package/dist/cjs/offchain.d.ts +2 -2
- package/dist/cjs/offchain.js +1 -1
- package/dist/cjs/rpc/dev/new-block.d.ts +5 -5
- package/dist/cjs/rpc/dev/new-block.js +1 -1
- package/dist/cjs/rpc/dev/set-block-build-mode.d.ts +1 -1
- package/dist/cjs/rpc/dev/set-block-build-mode.js +1 -1
- package/dist/cjs/rpc/dev/set-head.d.ts +1 -1
- package/dist/cjs/rpc/dev/set-head.js +1 -1
- package/dist/cjs/rpc/dev/set-runtime-log-level.d.ts +1 -1
- package/dist/cjs/rpc/dev/set-runtime-log-level.js +1 -1
- package/dist/cjs/rpc/dev/set-storage.d.ts +3 -3
- package/dist/cjs/rpc/dev/set-storage.js +1 -1
- package/dist/cjs/rpc/dev/time-travel.d.ts +1 -1
- package/dist/cjs/rpc/dev/time-travel.js +1 -1
- package/dist/cjs/rpc/index.d.ts +1 -1
- package/dist/cjs/rpc/rpc-spec/chainHead_v1.d.ts +11 -2
- package/dist/cjs/rpc/rpc-spec/chainHead_v1.js +33 -2
- package/dist/cjs/rpc/rpc-spec/chainSpec_v1.d.ts +3 -3
- package/dist/cjs/rpc/rpc-spec/transaction_v1.d.ts +2 -2
- package/dist/cjs/rpc/shared.d.ts +1 -1
- package/dist/cjs/rpc/substrate/archive.d.ts +2 -2
- package/dist/cjs/rpc/substrate/author.d.ts +2 -2
- package/dist/cjs/rpc/substrate/author.js +1 -1
- package/dist/cjs/rpc/substrate/chain.d.ts +2 -2
- package/dist/cjs/rpc/substrate/payment.d.ts +2 -2
- package/dist/cjs/rpc/substrate/state.d.ts +3 -3
- package/dist/cjs/rpc/substrate/state.js +1 -1
- package/dist/cjs/rpc/substrate/system.d.ts +3 -3
- package/dist/cjs/setup.d.ts +4 -4
- package/dist/cjs/setup.js +1 -1
- package/dist/cjs/utils/decoder.d.ts +5 -5
- package/dist/cjs/utils/decoder.js +2 -2
- package/dist/cjs/utils/index.d.ts +4 -4
- package/dist/cjs/utils/index.js +1 -1
- package/dist/cjs/utils/key-cache.d.ts +1 -1
- package/dist/cjs/utils/proof.d.ts +3 -3
- package/dist/cjs/utils/set-storage.d.ts +2 -2
- package/dist/cjs/utils/set-storage.js +1 -1
- package/dist/cjs/utils/time-travel.d.ts +1 -1
- package/dist/cjs/utils/well-known-keys.d.ts +2 -2
- package/dist/cjs/utils/well-known-keys.js +2 -2
- package/dist/cjs/wasm-executor/browser-wasm-executor.js +1 -1
- package/dist/cjs/wasm-executor/index.d.ts +3 -3
- package/dist/cjs/wasm-executor/index.js +14 -20
- package/dist/cjs/wasm-executor/node-wasm-executor.js +1 -1
- package/dist/cjs/wasm-executor/node-worker.js +1 -1
- package/dist/cjs/xcm/downward.d.ts +1 -1
- package/dist/cjs/xcm/horizontal.d.ts +1 -1
- package/dist/cjs/xcm/index.d.ts +1 -1
- package/dist/cjs/xcm/index.js +2 -2
- package/dist/cjs/xcm/upward.d.ts +1 -1
- package/dist/esm/api.d.ts +4 -4
- package/dist/esm/api.js +20 -23
- package/dist/esm/blockchain/block-builder.d.ts +5 -5
- package/dist/esm/blockchain/block-builder.js +17 -18
- package/dist/esm/blockchain/block.d.ts +6 -6
- package/dist/esm/blockchain/block.js +1 -1
- package/dist/esm/blockchain/head-state.d.ts +1 -1
- package/dist/esm/blockchain/index.d.ts +9 -9
- package/dist/esm/blockchain/index.js +5 -5
- package/dist/esm/blockchain/inherent/index.d.ts +5 -5
- package/dist/esm/blockchain/inherent/index.js +1 -1
- package/dist/esm/blockchain/inherent/para-enter.d.ts +4 -4
- package/dist/esm/blockchain/inherent/parachain/babe-randomness.d.ts +4 -4
- package/dist/esm/blockchain/inherent/parachain/nimbus-author-inherent.d.ts +4 -4
- package/dist/esm/blockchain/inherent/parachain/validation-data.d.ts +4 -4
- package/dist/esm/blockchain/inherent/parachain/validation-data.js +3 -3
- package/dist/esm/blockchain/inherent/timestamp.d.ts +3 -3
- package/dist/esm/blockchain/storage-layer.d.ts +3 -3
- package/dist/esm/blockchain/storage-layer.js +5 -4
- package/dist/esm/blockchain/txpool.d.ts +3 -3
- package/dist/esm/blockchain/txpool.js +2 -2
- package/dist/esm/chopsticks-provider.d.ts +3 -3
- package/dist/esm/chopsticks-provider.js +8 -9
- package/dist/esm/database.d.ts +1 -1
- package/dist/esm/genesis-provider.d.ts +4 -4
- package/dist/esm/genesis-provider.js +3 -3
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/logger.js +2 -3
- package/dist/esm/offchain.d.ts +2 -2
- package/dist/esm/offchain.js +1 -1
- package/dist/esm/rpc/dev/new-block.d.ts +5 -5
- package/dist/esm/rpc/dev/new-block.js +1 -1
- package/dist/esm/rpc/dev/set-block-build-mode.d.ts +1 -1
- package/dist/esm/rpc/dev/set-block-build-mode.js +1 -1
- package/dist/esm/rpc/dev/set-head.d.ts +1 -1
- package/dist/esm/rpc/dev/set-head.js +1 -1
- package/dist/esm/rpc/dev/set-runtime-log-level.d.ts +1 -1
- package/dist/esm/rpc/dev/set-runtime-log-level.js +1 -1
- package/dist/esm/rpc/dev/set-storage.d.ts +3 -3
- package/dist/esm/rpc/dev/set-storage.js +1 -1
- package/dist/esm/rpc/dev/time-travel.d.ts +1 -1
- package/dist/esm/rpc/dev/time-travel.js +1 -1
- package/dist/esm/rpc/index.d.ts +1 -1
- package/dist/esm/rpc/rpc-spec/chainHead_v1.d.ts +11 -2
- package/dist/esm/rpc/rpc-spec/chainHead_v1.js +42 -2
- package/dist/esm/rpc/rpc-spec/chainSpec_v1.d.ts +3 -3
- package/dist/esm/rpc/rpc-spec/transaction_v1.d.ts +2 -2
- package/dist/esm/rpc/shared.d.ts +1 -1
- package/dist/esm/rpc/substrate/archive.d.ts +2 -2
- package/dist/esm/rpc/substrate/author.d.ts +2 -2
- package/dist/esm/rpc/substrate/author.js +1 -1
- package/dist/esm/rpc/substrate/chain.d.ts +2 -2
- package/dist/esm/rpc/substrate/payment.d.ts +2 -2
- package/dist/esm/rpc/substrate/state.d.ts +3 -3
- package/dist/esm/rpc/substrate/state.js +1 -1
- package/dist/esm/rpc/substrate/system.d.ts +3 -3
- package/dist/esm/setup.d.ts +4 -4
- package/dist/esm/setup.js +1 -1
- package/dist/esm/utils/decoder.d.ts +5 -5
- package/dist/esm/utils/decoder.js +2 -2
- package/dist/esm/utils/index.d.ts +4 -4
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/key-cache.d.ts +1 -1
- package/dist/esm/utils/proof.d.ts +3 -3
- package/dist/esm/utils/set-storage.d.ts +2 -2
- package/dist/esm/utils/set-storage.js +1 -1
- package/dist/esm/utils/time-travel.d.ts +1 -1
- package/dist/esm/utils/well-known-keys.d.ts +2 -2
- package/dist/esm/utils/well-known-keys.js +2 -2
- package/dist/esm/wasm-executor/browser-wasm-executor.js +1 -1
- package/dist/esm/wasm-executor/index.d.ts +3 -3
- package/dist/esm/wasm-executor/index.js +14 -20
- package/dist/esm/wasm-executor/node-wasm-executor.js +1 -1
- package/dist/esm/wasm-executor/node-worker.js +1 -1
- package/dist/esm/xcm/downward.d.ts +1 -1
- package/dist/esm/xcm/horizontal.d.ts +1 -1
- package/dist/esm/xcm/index.d.ts +1 -1
- package/dist/esm/xcm/index.js +2 -2
- package/dist/esm/xcm/upward.d.ts +1 -1
- package/package.json +19 -16
package/dist/cjs/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ChainProperties, Header, SignedBlock } from './index.js';
|
|
1
|
+
import type { ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types';
|
|
2
|
+
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
|
3
|
+
import type { HexString } from '@polkadot/util/types';
|
|
4
|
+
import type { ChainProperties, Header, SignedBlock } from './index.js';
|
|
5
5
|
/**
|
|
6
6
|
* API class. Calls provider to get on-chain data.
|
|
7
7
|
* Either `endpoint` or `genesis` porvider must be provided.
|
package/dist/cjs/api.js
CHANGED
|
@@ -144,14 +144,13 @@ class Api {
|
|
|
144
144
|
];
|
|
145
145
|
if (hash) params.push(hash);
|
|
146
146
|
return this.send('childstate_getStorage', params, !!hash);
|
|
147
|
-
} else {
|
|
148
|
-
// main storage key, use state_getStorage
|
|
149
|
-
const params = [
|
|
150
|
-
key
|
|
151
|
-
];
|
|
152
|
-
if (hash) params.push(hash);
|
|
153
|
-
return this.send('state_getStorage', params, !!hash);
|
|
154
147
|
}
|
|
148
|
+
// main storage key, use state_getStorage
|
|
149
|
+
const params = [
|
|
150
|
+
key
|
|
151
|
+
];
|
|
152
|
+
if (hash) params.push(hash);
|
|
153
|
+
return this.send('state_getStorage', params, !!hash);
|
|
155
154
|
}
|
|
156
155
|
async getKeysPaged(prefix, pageSize, startKey, hash) {
|
|
157
156
|
const [child, storageKey] = (0, _index.splitChildKey)(prefix);
|
|
@@ -166,16 +165,15 @@ class Api {
|
|
|
166
165
|
];
|
|
167
166
|
if (hash) params.push(hash);
|
|
168
167
|
return _class_private_field_get(this, _provider).send('childstate_getKeysPaged', params, !!hash).then((keys)=>keys.map((key)=>(0, _index.prefixedChildKey)(child, key)));
|
|
169
|
-
} else {
|
|
170
|
-
// main storage key, use state_getKeysPaged
|
|
171
|
-
const params = [
|
|
172
|
-
prefix,
|
|
173
|
-
pageSize,
|
|
174
|
-
startKey
|
|
175
|
-
];
|
|
176
|
-
if (hash) params.push(hash);
|
|
177
|
-
return this.send('state_getKeysPaged', params, !!hash);
|
|
178
168
|
}
|
|
169
|
+
// main storage key, use state_getKeysPaged
|
|
170
|
+
const params = [
|
|
171
|
+
prefix,
|
|
172
|
+
pageSize,
|
|
173
|
+
startKey
|
|
174
|
+
];
|
|
175
|
+
if (hash) params.push(hash);
|
|
176
|
+
return this.send('state_getKeysPaged', params, !!hash);
|
|
179
177
|
}
|
|
180
178
|
async getStorageBatch(prefix, keys, hash) {
|
|
181
179
|
const [child] = (0, _index.splitChildKey)(prefix);
|
|
@@ -188,14 +186,13 @@ class Api {
|
|
|
188
186
|
];
|
|
189
187
|
if (hash) params.push(hash);
|
|
190
188
|
return _class_private_field_get(this, _provider).send('childstate_getStorageEntries', params, !!hash).then((values)=>_lodash.default.zip(keys, values));
|
|
191
|
-
} else {
|
|
192
|
-
// main storage key, use state_getStorageAt
|
|
193
|
-
const params = [
|
|
194
|
-
keys
|
|
195
|
-
];
|
|
196
|
-
if (hash) params.push(hash);
|
|
197
|
-
return _class_private_field_get(this, _provider).send('state_queryStorageAt', params, !!hash).then((result)=>result[0]?.['changes'] || []);
|
|
198
189
|
}
|
|
190
|
+
// main storage key, use state_getStorageAt
|
|
191
|
+
const params = [
|
|
192
|
+
keys
|
|
193
|
+
];
|
|
194
|
+
if (hash) params.push(hash);
|
|
195
|
+
return _class_private_field_get(this, _provider).send('state_queryStorageAt', params, !!hash).then((result)=>result[0]?.['changes'] || []);
|
|
199
196
|
}
|
|
200
197
|
async subscribeRemoteNewHeads(cb) {
|
|
201
198
|
if (!_class_private_field_get(this, _provider).hasSubscriptions) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DigestItem, Header, TransactionValidityError } from '@polkadot/types/interfaces';
|
|
1
|
+
import type { DigestItem, Header, TransactionValidityError } from '@polkadot/types/interfaces';
|
|
2
|
+
import type { HexString } from '@polkadot/util/types';
|
|
3
|
+
import type { TaskCallResponse } from '../wasm-executor/index.js';
|
|
2
4
|
import { Block } from './block.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { InherentProvider } from './inherent/index.js';
|
|
6
|
-
import { TaskCallResponse } from '../wasm-executor/index.js';
|
|
5
|
+
import type { InherentProvider } from './inherent/index.js';
|
|
6
|
+
import type { BuildBlockParams } from './txpool.js';
|
|
7
7
|
export declare const genesisDigestLogs: (head: Block) => Promise<DigestItem[]>;
|
|
8
8
|
export declare const newHeader: (head: Block, unsafeBlockHeight?: number) => Promise<Header>;
|
|
9
9
|
export type BuildBlockCallbacks = {
|
|
@@ -25,12 +25,12 @@ _export(exports, {
|
|
|
25
25
|
return newHeader;
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
const _block = require("./block.js");
|
|
29
|
-
const _storagelayer = require("./storage-layer.js");
|
|
30
|
-
const _utilcrypto = require("@polkadot/util-crypto");
|
|
31
28
|
const _util = require("@polkadot/util");
|
|
32
|
-
const
|
|
29
|
+
const _utilcrypto = require("@polkadot/util-crypto");
|
|
33
30
|
const _logger = require("../logger.js");
|
|
31
|
+
const _index = require("../utils/index.js");
|
|
32
|
+
const _block = require("./block.js");
|
|
33
|
+
const _storagelayer = require("./storage-layer.js");
|
|
34
34
|
const logger = _logger.defaultLogger.child({
|
|
35
35
|
name: 'block-builder'
|
|
36
36
|
});
|
|
@@ -57,19 +57,18 @@ const genesisDigestLogs = async (head)=>{
|
|
|
57
57
|
return [
|
|
58
58
|
digest
|
|
59
59
|
];
|
|
60
|
-
} else {
|
|
61
|
-
const newSlot = meta.registry.createType('Slot', currentSlot + 1);
|
|
62
|
-
const consensusEngine = meta.registry.createType('ConsensusEngineId', 'aura');
|
|
63
|
-
const digest = meta.registry.createType('DigestItem', {
|
|
64
|
-
PreRuntime: [
|
|
65
|
-
consensusEngine,
|
|
66
|
-
(0, _util.compactAddLength)(newSlot.toU8a())
|
|
67
|
-
]
|
|
68
|
-
});
|
|
69
|
-
return [
|
|
70
|
-
digest
|
|
71
|
-
];
|
|
72
60
|
}
|
|
61
|
+
const newSlot = meta.registry.createType('Slot', currentSlot + 1);
|
|
62
|
+
const consensusEngine = meta.registry.createType('ConsensusEngineId', 'aura');
|
|
63
|
+
const digest = meta.registry.createType('DigestItem', {
|
|
64
|
+
PreRuntime: [
|
|
65
|
+
consensusEngine,
|
|
66
|
+
(0, _util.compactAddLength)(newSlot.toU8a())
|
|
67
|
+
]
|
|
68
|
+
});
|
|
69
|
+
return [
|
|
70
|
+
digest
|
|
71
|
+
];
|
|
73
72
|
};
|
|
74
73
|
const getConsensus = (header)=>{
|
|
75
74
|
if (header.digest.logs.length === 0) return;
|
|
@@ -137,14 +136,14 @@ const newHeader = async (head, unsafeBlockHeight)=>{
|
|
|
137
136
|
}),
|
|
138
137
|
...consensus.rest
|
|
139
138
|
];
|
|
140
|
-
} else if (consensus?.consensusEngine?.toString()
|
|
139
|
+
} else if (consensus?.consensusEngine?.toString() === 'nmbs') {
|
|
141
140
|
const nmbsKey = (0, _util.stringToHex)('nmbs');
|
|
142
141
|
newLogs = [
|
|
143
142
|
meta.registry.createType('DigestItem', {
|
|
144
143
|
// Using previous block author
|
|
145
144
|
PreRuntime: [
|
|
146
145
|
consensus.consensusEngine,
|
|
147
|
-
parentHeader.digest.logs.find((log)=>log.isPreRuntime && log.asPreRuntime[0].toHex()
|
|
146
|
+
parentHeader.digest.logs.find((log)=>log.isPreRuntime && log.asPreRuntime[0].toHex() === nmbsKey)?.asPreRuntime[1].toHex()
|
|
148
147
|
]
|
|
149
148
|
}),
|
|
150
149
|
...consensus.rest
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Header } from '@polkadot/types/interfaces';
|
|
3
|
-
import {
|
|
4
|
-
import { StorageEntry } from '@polkadot/types/primitive/types';
|
|
1
|
+
import { type TypeRegistry } from '@polkadot/types';
|
|
2
|
+
import type { Header } from '@polkadot/types/interfaces';
|
|
3
|
+
import type { DecoratedMeta } from '@polkadot/types/metadata/decorate/types';
|
|
4
|
+
import type { StorageEntry } from '@polkadot/types/primitive/types';
|
|
5
5
|
import type { HexString } from '@polkadot/util/types';
|
|
6
|
-
import { Blockchain } from './index.js';
|
|
7
|
-
import { StorageLayer, StorageLayerProvider, StorageValue } from './storage-layer.js';
|
|
8
6
|
import type { RuntimeVersion, TaskCallResponse } from '../wasm-executor/index.js';
|
|
7
|
+
import type { Blockchain } from './index.js';
|
|
8
|
+
import { StorageLayer, type StorageLayerProvider, type StorageValue } from './storage-layer.js';
|
|
9
9
|
/**
|
|
10
10
|
* Block class.
|
|
11
11
|
*
|
|
@@ -11,9 +11,9 @@ Object.defineProperty(exports, "Block", {
|
|
|
11
11
|
const _types = require("@polkadot/types");
|
|
12
12
|
const _metadata = require("@polkadot/types/metadata");
|
|
13
13
|
const _util = require("@polkadot/util");
|
|
14
|
-
const _storagelayer = require("./storage-layer.js");
|
|
15
14
|
const _index = require("../utils/index.js");
|
|
16
15
|
const _index1 = require("../wasm-executor/index.js");
|
|
16
|
+
const _storagelayer = require("./storage-layer.js");
|
|
17
17
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
18
18
|
if (privateCollection.has(obj)) {
|
|
19
19
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ApplyExtrinsicResult } from '@polkadot/types/interfaces';
|
|
2
|
-
import { HexString } from '@polkadot/util/types';
|
|
3
1
|
import { TypeRegistry } from '@polkadot/types';
|
|
4
|
-
import {
|
|
2
|
+
import type { ApplyExtrinsicResult } from '@polkadot/types/interfaces';
|
|
5
3
|
import type { TransactionValidity } from '@polkadot/types/interfaces/txqueue';
|
|
6
|
-
import {
|
|
4
|
+
import type { RegisteredTypes } from '@polkadot/types/types';
|
|
5
|
+
import type { HexString } from '@polkadot/util/types';
|
|
6
|
+
import type { Api } from '../api.js';
|
|
7
|
+
import type { Database } from '../database.js';
|
|
8
|
+
import { OffchainWorker } from '../offchain.js';
|
|
9
|
+
import type { RuntimeVersion } from '../wasm-executor/index.js';
|
|
7
10
|
import { Block } from './block.js';
|
|
8
|
-
import { BuildBlockMode, BuildBlockParams, DownwardMessage, HorizontalMessage, TxPool } from './txpool.js';
|
|
9
|
-
import { Database } from '../database.js';
|
|
10
11
|
import { HeadState } from './head-state.js';
|
|
11
|
-
import { InherentProvider } from './inherent/index.js';
|
|
12
|
-
import {
|
|
13
|
-
import { RuntimeVersion } from '../wasm-executor/index.js';
|
|
12
|
+
import type { InherentProvider } from './inherent/index.js';
|
|
13
|
+
import { type BuildBlockMode, type BuildBlockParams, type DownwardMessage, type HorizontalMessage, TxPool } from './txpool.js';
|
|
14
14
|
export interface Options {
|
|
15
15
|
/** API instance, for getting on-chain data. */
|
|
16
16
|
api: Api;
|
|
@@ -9,17 +9,17 @@ Object.defineProperty(exports, "Blockchain", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _types = require("@polkadot/types");
|
|
12
|
-
const _utilcrypto = require("@polkadot/util-crypto");
|
|
13
12
|
const _util = require("@polkadot/types-known/util");
|
|
14
13
|
const _util1 = require("@polkadot/util");
|
|
14
|
+
const _utilcrypto = require("@polkadot/util-crypto");
|
|
15
15
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
16
|
-
const
|
|
17
|
-
const _txpool = require("./txpool.js");
|
|
18
|
-
const _headstate = require("./head-state.js");
|
|
16
|
+
const _logger = require("../logger.js");
|
|
19
17
|
const _offchain = require("../offchain.js");
|
|
20
18
|
const _index = require("../utils/index.js");
|
|
21
|
-
const _logger = require("../logger.js");
|
|
22
19
|
const _blockbuilder = require("./block-builder.js");
|
|
20
|
+
const _block = require("./block.js");
|
|
21
|
+
const _headstate = require("./head-state.js");
|
|
22
|
+
const _txpool = require("./txpool.js");
|
|
23
23
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
24
24
|
if (privateCollection.has(obj)) {
|
|
25
25
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
2
|
+
import type { Block } from '../block.js';
|
|
3
|
+
import type { BuildBlockParams } from '../txpool.js';
|
|
4
4
|
import { ParaInherentEnter } from './para-enter.js';
|
|
5
5
|
import { SetBabeRandomness } from './parachain/babe-randomness.js';
|
|
6
6
|
import { SetNimbusAuthorInherent } from './parachain/nimbus-author-inherent.js';
|
|
7
|
-
import { SetTimestamp } from './timestamp.js';
|
|
8
7
|
import { SetValidationData } from './parachain/validation-data.js';
|
|
8
|
+
import { SetTimestamp } from './timestamp.js';
|
|
9
9
|
export interface InherentProvider {
|
|
10
10
|
createInherents(newBlock: Block, params: BuildBlockParams): Promise<HexString[]>;
|
|
11
11
|
}
|
|
12
|
-
export declare const inherentProviders: (ParaInherentEnter | SetBabeRandomness | SetNimbusAuthorInherent |
|
|
12
|
+
export declare const inherentProviders: (ParaInherentEnter | SetBabeRandomness | SetNimbusAuthorInherent | SetValidationData | SetTimestamp)[];
|
|
@@ -11,8 +11,8 @@ Object.defineProperty(exports, "inherentProviders", {
|
|
|
11
11
|
const _paraenter = require("./para-enter.js");
|
|
12
12
|
const _baberandomness = require("./parachain/babe-randomness.js");
|
|
13
13
|
const _nimbusauthorinherent = require("./parachain/nimbus-author-inherent.js");
|
|
14
|
-
const _timestamp = require("./timestamp.js");
|
|
15
14
|
const _validationdata = require("./parachain/validation-data.js");
|
|
15
|
+
const _timestamp = require("./timestamp.js");
|
|
16
16
|
const inherentProviders = [
|
|
17
17
|
new _timestamp.SetTimestamp(),
|
|
18
18
|
new _validationdata.SetValidationData(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HexString } from '@polkadot/util/types';
|
|
2
|
-
import { Block } from '../block.js';
|
|
3
|
-
import { BuildBlockParams } from '../txpool.js';
|
|
4
|
-
import { InherentProvider } from './index.js';
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
2
|
+
import type { Block } from '../block.js';
|
|
3
|
+
import type { BuildBlockParams } from '../txpool.js';
|
|
4
|
+
import type { InherentProvider } from './index.js';
|
|
5
5
|
export declare class ParaInherentEnter implements InherentProvider {
|
|
6
6
|
createInherents(newBlock: Block, _params: BuildBlockParams): Promise<HexString[]>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HexString } from '@polkadot/util/types';
|
|
2
|
-
import { Block } from '../../block.js';
|
|
3
|
-
import { BuildBlockParams } from '../../txpool.js';
|
|
4
|
-
import { InherentProvider } from '../index.js';
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
2
|
+
import type { Block } from '../../block.js';
|
|
3
|
+
import type { BuildBlockParams } from '../../txpool.js';
|
|
4
|
+
import type { InherentProvider } from '../index.js';
|
|
5
5
|
export declare class SetBabeRandomness implements InherentProvider {
|
|
6
6
|
createInherents(newBlock: Block, _params: BuildBlockParams): Promise<HexString[]>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { InherentProvider } from '../index.js';
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
2
|
+
import type { Block } from '../../block.js';
|
|
3
|
+
import type { BuildBlockParams } from '../../txpool.js';
|
|
4
|
+
import type { InherentProvider } from '../index.js';
|
|
5
5
|
export declare class SetNimbusAuthorInherent implements InherentProvider {
|
|
6
6
|
createInherents(newBlock: Block, _params: BuildBlockParams): Promise<HexString[]>;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HexString } from '@polkadot/util/types';
|
|
2
|
-
import { Block } from '../../block.js';
|
|
3
|
-
import { BuildBlockParams, DownwardMessage, HorizontalMessage } from '../../txpool.js';
|
|
4
|
-
import { InherentProvider } from '../index.js';
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
2
|
+
import type { Block } from '../../block.js';
|
|
3
|
+
import type { BuildBlockParams, DownwardMessage, HorizontalMessage } from '../../txpool.js';
|
|
4
|
+
import type { InherentProvider } from '../index.js';
|
|
5
5
|
export type ValidationData = {
|
|
6
6
|
downwardMessages: DownwardMessage[];
|
|
7
7
|
horizontalMessages: Record<number, HorizontalMessage[]>;
|
|
@@ -8,12 +8,12 @@ Object.defineProperty(exports, "SetValidationData", {
|
|
|
8
8
|
return SetValidationData;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _util = require("@polkadot/util");
|
|
12
11
|
const _types = require("@polkadot/types");
|
|
12
|
+
const _util = require("@polkadot/util");
|
|
13
13
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
14
|
-
const _proof = require("../../../utils/proof.js");
|
|
15
14
|
const _utilcrypto = require("@polkadot/util-crypto");
|
|
16
15
|
const _index = require("../../../utils/index.js");
|
|
16
|
+
const _proof = require("../../../utils/proof.js");
|
|
17
17
|
const _index1 = require("../../../wasm-executor/index.js");
|
|
18
18
|
function _interop_require_default(obj) {
|
|
19
19
|
return obj && obj.__esModule ? obj : {
|
|
@@ -233,7 +233,7 @@ class SetValidationData {
|
|
|
233
233
|
if (params.relayChainStateOverrides) {
|
|
234
234
|
for (const [key, value] of params.relayChainStateOverrides){
|
|
235
235
|
// Remove any entry that matches the key being overridden
|
|
236
|
-
newEntries = newEntries.filter(([k, _])=>k
|
|
236
|
+
newEntries = newEntries.filter(([k, _])=>k !== key);
|
|
237
237
|
// Push override
|
|
238
238
|
newEntries.push([
|
|
239
239
|
key,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { InherentProvider } from './index.js';
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
2
|
+
import type { Block } from '../block.js';
|
|
3
|
+
import type { InherentProvider } from './index.js';
|
|
4
4
|
export declare class SetTimestamp implements InherentProvider {
|
|
5
5
|
createInherents(newBlock: Block): Promise<HexString[]>;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Api } from '../api.js';
|
|
2
|
-
import { Database } from '../database.js';
|
|
3
|
-
export declare
|
|
1
|
+
import type { Api } from '../api.js';
|
|
2
|
+
import type { Database } from '../database.js';
|
|
3
|
+
export declare enum StorageValueKind {
|
|
4
4
|
Deleted = "Deleted",
|
|
5
5
|
DeletedPrefix = "DeletedPrefix"
|
|
6
6
|
}
|
|
@@ -20,8 +20,8 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
23
|
-
const _index = require("../utils/index.js");
|
|
24
23
|
const _logger = require("../logger.js");
|
|
24
|
+
const _index = require("../utils/index.js");
|
|
25
25
|
const _keycache = /*#__PURE__*/ _interop_require_default(require("../utils/key-cache.js"));
|
|
26
26
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
27
27
|
if (privateCollection.has(obj)) {
|
|
@@ -159,7 +159,7 @@ class RemoteStorageLayer {
|
|
|
159
159
|
// batch fetch storage values and save to db, they may be used later
|
|
160
160
|
_class_private_field_get(this, _api).getStorageBatch(prefix, batch, _class_private_field_get(this, _at)).then((storage)=>{
|
|
161
161
|
for (const [key, value] of storage){
|
|
162
|
-
_class_private_field_get(this, _db)
|
|
162
|
+
_class_private_field_get(this, _db)?.saveStorage(_class_private_field_get(this, _at), key, value);
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
165
|
}
|
|
@@ -255,7 +255,8 @@ class StorageLayer {
|
|
|
255
255
|
if (parentBest) {
|
|
256
256
|
if (!maybeBest) {
|
|
257
257
|
return parentBest;
|
|
258
|
-
}
|
|
258
|
+
}
|
|
259
|
+
if (parentBest < maybeBest) {
|
|
259
260
|
return parentBest;
|
|
260
261
|
}
|
|
261
262
|
}
|
|
@@ -271,7 +272,7 @@ class StorageLayer {
|
|
|
271
272
|
const next = await this.findNextKey(prefix, startKey, undefined);
|
|
272
273
|
if (!next) break;
|
|
273
274
|
startKey = next;
|
|
274
|
-
if (await this.get(next, false)
|
|
275
|
+
if (await this.get(next, false) === "Deleted") continue;
|
|
275
276
|
keys.push(next);
|
|
276
277
|
}
|
|
277
278
|
return keys;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
1
2
|
import { EventEmitter } from 'eventemitter3';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { InherentProvider } from './inherent/index.js';
|
|
3
|
+
import type { Blockchain } from './index.js';
|
|
4
|
+
import type { InherentProvider } from './inherent/index.js';
|
|
5
5
|
export declare const APPLY_EXTRINSIC_ERROR = "TxPool::ApplyExtrinsicError";
|
|
6
6
|
export declare enum BuildBlockMode {
|
|
7
7
|
/** One block per batch (default) */
|
|
@@ -19,12 +19,12 @@ _export(exports, {
|
|
|
19
19
|
return TxPool;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
const _eventemitter3 = require("eventemitter3");
|
|
23
22
|
const _toU8a = require("@polkadot/util/hex/toU8a");
|
|
23
|
+
const _eventemitter3 = require("eventemitter3");
|
|
24
24
|
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
25
|
+
const _logger = require("../logger.js");
|
|
25
26
|
const _index = require("../utils/index.js");
|
|
26
27
|
const _blockbuilder = require("./block-builder.js");
|
|
27
|
-
const _logger = require("../logger.js");
|
|
28
28
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
29
29
|
if (privateCollection.has(obj)) {
|
|
30
30
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
|
|
2
|
-
import { Blockchain } from './blockchain/index.js';
|
|
3
|
-
import { Database } from './database.js';
|
|
1
|
+
import type { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
|
|
2
|
+
import type { Blockchain } from './blockchain/index.js';
|
|
3
|
+
import type { Database } from './database.js';
|
|
4
4
|
interface SubscriptionHandler {
|
|
5
5
|
callback: ProviderInterfaceCallback;
|
|
6
6
|
type: string;
|
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "ChopsticksProvider", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _eventemitter3 = require("eventemitter3");
|
|
12
|
-
const _index = require("./rpc/index.js");
|
|
13
12
|
const _logger = require("./logger.js");
|
|
13
|
+
const _index = require("./rpc/index.js");
|
|
14
14
|
const _setup = require("./setup.js");
|
|
15
15
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
16
16
|
if (privateCollection.has(obj)) {
|
|
@@ -205,15 +205,14 @@ class ChopsticksProvider {
|
|
|
205
205
|
type: subscription.type
|
|
206
206
|
};
|
|
207
207
|
return subid;
|
|
208
|
-
} else {
|
|
209
|
-
logger.debug('call', {
|
|
210
|
-
method,
|
|
211
|
-
params
|
|
212
|
-
});
|
|
213
|
-
return rpcHandler({
|
|
214
|
-
chain: this.chain
|
|
215
|
-
}, params, this.subscriptionManager);
|
|
216
208
|
}
|
|
209
|
+
logger.debug('call', {
|
|
210
|
+
method,
|
|
211
|
+
params
|
|
212
|
+
});
|
|
213
|
+
return rpcHandler({
|
|
214
|
+
chain: this.chain
|
|
215
|
+
}, params, this.subscriptionManager);
|
|
217
216
|
} catch (e) {
|
|
218
217
|
logger.error('send error.', e);
|
|
219
218
|
throw e;
|
package/dist/cjs/database.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Genesis } from './schema/index.js';
|
|
4
|
-
import { JsCallback } from './wasm-executor/index.js';
|
|
1
|
+
import type { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
|
|
2
|
+
import type { HexString } from '@polkadot/util/types';
|
|
3
|
+
import { type Genesis } from './schema/index.js';
|
|
4
|
+
import { type JsCallback } from './wasm-executor/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Provider to start a chain from genesis
|
|
7
7
|
*/
|
|
@@ -9,9 +9,9 @@ Object.defineProperty(exports, "GenesisProvider", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _eventemitter3 = require("eventemitter3");
|
|
12
|
-
const _index = require("./
|
|
13
|
-
const _index1 = require("./
|
|
14
|
-
const _index2 = require("./index.js");
|
|
12
|
+
const _index = require("./index.js");
|
|
13
|
+
const _index1 = require("./schema/index.js");
|
|
14
|
+
const _index2 = require("./wasm-executor/index.js");
|
|
15
15
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
16
16
|
if (privateCollection.has(obj)) {
|
|
17
17
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
@@ -85,19 +85,19 @@ class GenesisProvider {
|
|
|
85
85
|
get _jsCallback() {
|
|
86
86
|
const storage = _class_private_field_get(this, _genesis).genesis.raw.top;
|
|
87
87
|
return {
|
|
88
|
-
...
|
|
89
|
-
getStorage: async
|
|
90
|
-
if ((0,
|
|
91
|
-
|
|
88
|
+
..._index2.emptyTaskHandler,
|
|
89
|
+
getStorage: async (key)=>{
|
|
90
|
+
if ((0, _index.isPrefixedChildKey)(key)) {
|
|
91
|
+
_index.defaultLogger.warn({
|
|
92
92
|
key
|
|
93
93
|
}, 'genesis child storage not supported');
|
|
94
94
|
return undefined;
|
|
95
95
|
}
|
|
96
96
|
return storage[key];
|
|
97
97
|
},
|
|
98
|
-
getNextKey: async
|
|
99
|
-
if ((0,
|
|
100
|
-
|
|
98
|
+
getNextKey: async (prefix, key)=>{
|
|
99
|
+
if ((0, _index.isPrefixedChildKey)(key)) {
|
|
100
|
+
_index.defaultLogger.warn({
|
|
101
101
|
prefix,
|
|
102
102
|
key
|
|
103
103
|
}, 'genesis child storage not supported');
|
|
@@ -239,8 +239,8 @@ class GenesisProvider {
|
|
|
239
239
|
_define_property(this, "unsubscribe", async (_type, _method, _id)=>{
|
|
240
240
|
throw Error('unimplemented');
|
|
241
241
|
});
|
|
242
|
-
_class_private_field_set(this, _genesis,
|
|
243
|
-
_class_private_field_set(this, _stateRoot, (0,
|
|
242
|
+
_class_private_field_set(this, _genesis, _index1.genesisSchema.parse(genesis));
|
|
243
|
+
_class_private_field_set(this, _stateRoot, (0, _index2.calculateStateRoot)(Object.entries(_class_private_field_get(this, _genesis).genesis.raw.top).reduce((accu, item)=>{
|
|
244
244
|
accu.push(item);
|
|
245
245
|
return accu;
|
|
246
246
|
}, []), 1));
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/logger.js
CHANGED
|
@@ -46,10 +46,9 @@ const innerTruncate = (level = 0)=>(val)=>{
|
|
|
46
46
|
switch(typeof val){
|
|
47
47
|
case 'string':
|
|
48
48
|
if (val.length > 66 && !verboseLog) {
|
|
49
|
-
return val.slice(0, 34)
|
|
50
|
-
} else {
|
|
51
|
-
return val;
|
|
49
|
+
return `${val.slice(0, 34)}…${val.slice(-32)}`;
|
|
52
50
|
}
|
|
51
|
+
return val;
|
|
53
52
|
case 'object':
|
|
54
53
|
if (Array.isArray(val)) {
|
|
55
54
|
return val.map(innerTruncate(level + 1));
|
package/dist/cjs/offchain.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { HexString } from '@polkadot/util/types';
|
|
2
|
+
import type { Block } from './blockchain/block.js';
|
|
3
3
|
export declare class OffchainWorker {
|
|
4
4
|
readonly pendingExtrinsics: HexString[];
|
|
5
5
|
readonly offchainStorage: Map<string, string | null | undefined>;
|
package/dist/cjs/offchain.js
CHANGED
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "OffchainWorker", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _utilcrypto = require("@polkadot/util-crypto");
|
|
12
|
-
const _logger = require("./logger.js");
|
|
13
12
|
const _rxjs = require("rxjs");
|
|
13
|
+
const _logger = require("./logger.js");
|
|
14
14
|
function _define_property(obj, key, value) {
|
|
15
15
|
if (key in obj) {
|
|
16
16
|
Object.defineProperty(obj, key, {
|