@acala-network/chopsticks-core 0.9.4-2 → 0.9.4-4

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 (97) hide show
  1. package/dist/cjs/blockchain/inherent/parachain/validation-data.js +1 -13
  2. package/dist/cjs/rpc/substrate/author.js +6 -0
  3. package/dist/cjs/utils/decoder.js +21 -1
  4. package/dist/cjs/wasm-executor/browser-wasm-executor.js +4 -4
  5. package/dist/{types → cjs}/wasm-executor/index.d.ts +6 -4
  6. package/dist/cjs/wasm-executor/index.js +4 -4
  7. package/dist/cjs/wasm-executor/node-wasm-executor.js +4 -4
  8. package/dist/esm/api.d.ts +56 -0
  9. package/dist/esm/blockchain/block-builder.d.ts +15 -0
  10. package/dist/esm/blockchain/block.d.ts +92 -0
  11. package/dist/esm/blockchain/head-state.d.ts +15 -0
  12. package/dist/esm/blockchain/index.d.ts +172 -0
  13. package/dist/esm/blockchain/inherent/index.d.ts +19 -0
  14. package/dist/esm/blockchain/inherent/para-enter.d.ts +7 -0
  15. package/dist/esm/blockchain/inherent/parachain/babe-randomness.d.ts +7 -0
  16. package/dist/esm/blockchain/inherent/parachain/nimbus-author-inherent.d.ts +7 -0
  17. package/dist/esm/blockchain/inherent/parachain/validation-data.d.ts +19 -0
  18. package/dist/esm/blockchain/inherent/parachain/validation-data.js +1 -13
  19. package/dist/esm/blockchain/storage-layer.d.ts +47 -0
  20. package/dist/esm/blockchain/txpool.d.ts +48 -0
  21. package/dist/esm/chopsticks-provider.d.ts +32 -0
  22. package/dist/esm/database.d.ts +26 -0
  23. package/dist/esm/genesis-provider.d.ts +52 -0
  24. package/dist/esm/index.d.ts +28 -0
  25. package/dist/esm/logger.d.ts +7 -0
  26. package/dist/esm/offchain.d.ts +10 -0
  27. package/dist/esm/rpc/index.d.ts +5 -0
  28. package/dist/esm/rpc/shared.d.ts +27 -0
  29. package/dist/esm/rpc/substrate/author.d.ts +28 -0
  30. package/dist/esm/rpc/substrate/author.js +6 -0
  31. package/dist/esm/rpc/substrate/chain.d.ts +45 -0
  32. package/dist/esm/rpc/substrate/index.d.ts +66 -0
  33. package/dist/esm/rpc/substrate/payment.d.ts +16 -0
  34. package/dist/esm/rpc/substrate/state.d.ts +97 -0
  35. package/dist/esm/rpc/substrate/system.d.ts +28 -0
  36. package/dist/esm/schema/index.d.ts +62 -0
  37. package/dist/esm/setup.d.ts +20 -0
  38. package/dist/esm/utils/decoder.d.ts +28 -0
  39. package/dist/esm/utils/decoder.js +21 -1
  40. package/dist/esm/utils/index.d.ts +23 -0
  41. package/dist/esm/utils/key-cache.d.ts +10 -0
  42. package/dist/esm/utils/proof.d.ts +16 -0
  43. package/dist/esm/utils/set-storage.d.ts +7 -0
  44. package/dist/esm/utils/time-travel.d.ts +5 -0
  45. package/dist/esm/utils/well-known-keys.d.ts +7 -0
  46. package/dist/esm/wasm-executor/browser-wasm-executor.js +4 -4
  47. package/dist/esm/wasm-executor/browser-worker.d.ts +4 -0
  48. package/dist/esm/wasm-executor/index.d.ts +82 -0
  49. package/dist/esm/wasm-executor/index.js +4 -4
  50. package/dist/esm/wasm-executor/node-wasm-executor.js +4 -4
  51. package/dist/esm/wasm-executor/node-worker.d.ts +4 -0
  52. package/dist/esm/xcm/downward.d.ts +2 -0
  53. package/dist/esm/xcm/horizontal.d.ts +2 -0
  54. package/dist/esm/xcm/index.d.ts +9 -0
  55. package/dist/esm/xcm/upward.d.ts +2 -0
  56. package/package.json +8 -15
  57. /package/dist/{types → cjs}/api.d.ts +0 -0
  58. /package/dist/{types → cjs}/blockchain/block-builder.d.ts +0 -0
  59. /package/dist/{types → cjs}/blockchain/block.d.ts +0 -0
  60. /package/dist/{types → cjs}/blockchain/head-state.d.ts +0 -0
  61. /package/dist/{types → cjs}/blockchain/index.d.ts +0 -0
  62. /package/dist/{types → cjs}/blockchain/inherent/index.d.ts +0 -0
  63. /package/dist/{types → cjs}/blockchain/inherent/para-enter.d.ts +0 -0
  64. /package/dist/{types → cjs}/blockchain/inherent/parachain/babe-randomness.d.ts +0 -0
  65. /package/dist/{types → cjs}/blockchain/inherent/parachain/nimbus-author-inherent.d.ts +0 -0
  66. /package/dist/{types → cjs}/blockchain/inherent/parachain/validation-data.d.ts +0 -0
  67. /package/dist/{types → cjs}/blockchain/storage-layer.d.ts +0 -0
  68. /package/dist/{types → cjs}/blockchain/txpool.d.ts +0 -0
  69. /package/dist/{types → cjs}/chopsticks-provider.d.ts +0 -0
  70. /package/dist/{types → cjs}/database.d.ts +0 -0
  71. /package/dist/{types → cjs}/genesis-provider.d.ts +0 -0
  72. /package/dist/{types → cjs}/index.d.ts +0 -0
  73. /package/dist/{types → cjs}/logger.d.ts +0 -0
  74. /package/dist/{types → cjs}/offchain.d.ts +0 -0
  75. /package/dist/{types → cjs}/rpc/index.d.ts +0 -0
  76. /package/dist/{types → cjs}/rpc/shared.d.ts +0 -0
  77. /package/dist/{types → cjs}/rpc/substrate/author.d.ts +0 -0
  78. /package/dist/{types → cjs}/rpc/substrate/chain.d.ts +0 -0
  79. /package/dist/{types → cjs}/rpc/substrate/index.d.ts +0 -0
  80. /package/dist/{types → cjs}/rpc/substrate/payment.d.ts +0 -0
  81. /package/dist/{types → cjs}/rpc/substrate/state.d.ts +0 -0
  82. /package/dist/{types → cjs}/rpc/substrate/system.d.ts +0 -0
  83. /package/dist/{types → cjs}/schema/index.d.ts +0 -0
  84. /package/dist/{types → cjs}/setup.d.ts +0 -0
  85. /package/dist/{types → cjs}/utils/decoder.d.ts +0 -0
  86. /package/dist/{types → cjs}/utils/index.d.ts +0 -0
  87. /package/dist/{types → cjs}/utils/key-cache.d.ts +0 -0
  88. /package/dist/{types → cjs}/utils/proof.d.ts +0 -0
  89. /package/dist/{types → cjs}/utils/set-storage.d.ts +0 -0
  90. /package/dist/{types → cjs}/utils/time-travel.d.ts +0 -0
  91. /package/dist/{types → cjs}/utils/well-known-keys.d.ts +0 -0
  92. /package/dist/{types → cjs}/wasm-executor/browser-worker.d.ts +0 -0
  93. /package/dist/{types → cjs}/wasm-executor/node-worker.d.ts +0 -0
  94. /package/dist/{types → cjs}/xcm/downward.d.ts +0 -0
  95. /package/dist/{types → cjs}/xcm/horizontal.d.ts +0 -0
  96. /package/dist/{types → cjs}/xcm/index.d.ts +0 -0
  97. /package/dist/{types → cjs}/xcm/upward.d.ts +0 -0
@@ -0,0 +1,47 @@
1
+ import { Api } from '../api.js';
2
+ import { Database } from '../database.js';
3
+ export declare const enum StorageValueKind {
4
+ Deleted = "Deleted",
5
+ DeletedPrefix = "DeletedPrefix"
6
+ }
7
+ export type StorageValue = string | StorageValueKind | undefined;
8
+ export interface StorageLayerProvider {
9
+ /**
10
+ * Get the value of a storage key.
11
+ */
12
+ get(key: string, cache: boolean): Promise<StorageValue>;
13
+ /**
14
+ * Fold the storage layer into another layer.
15
+ */
16
+ foldInto(into: StorageLayer): Promise<StorageLayerProvider | undefined>;
17
+ /**
18
+ * Fold the storage layer into the parent if it exists.
19
+ */
20
+ fold(): Promise<void>;
21
+ /**
22
+ * Get paged storage keys.
23
+ */
24
+ getKeysPaged(prefix: string, pageSize: number, startKey: string): Promise<string[]>;
25
+ }
26
+ export declare class RemoteStorageLayer implements StorageLayerProvider {
27
+ #private;
28
+ constructor(api: Api, at: string, db: Database | undefined);
29
+ get(key: string, _cache: boolean): Promise<StorageValue>;
30
+ foldInto(_into: StorageLayer): Promise<StorageLayerProvider>;
31
+ fold(): Promise<void>;
32
+ getKeysPaged(prefix: string, pageSize: number, startKey: string): Promise<string[]>;
33
+ }
34
+ export declare class StorageLayer implements StorageLayerProvider {
35
+ #private;
36
+ constructor(parent?: StorageLayerProvider);
37
+ get(key: string, cache: boolean): Promise<StorageValue | undefined>;
38
+ set(key: string, value: StorageValue): void;
39
+ setAll(values: Record<string, StorageValue | null> | [string, StorageValue | null][]): void;
40
+ foldInto(into: StorageLayer): Promise<StorageLayerProvider | undefined>;
41
+ fold(): Promise<void>;
42
+ getKeysPaged(prefix: string, pageSize: number, startKey: string): Promise<string[]>;
43
+ /**
44
+ * Merge the storage layer into the given object, can be used to get sotrage diff.
45
+ */
46
+ mergeInto(into: Record<string, string | null>): Promise<void>;
47
+ }
@@ -0,0 +1,48 @@
1
+ import { EventEmitter } from 'eventemitter3';
2
+ import { HexString } from '@polkadot/util/types';
3
+ import { Blockchain } from './index.js';
4
+ import { InherentProvider } from './inherent/index.js';
5
+ export declare const APPLY_EXTRINSIC_ERROR = "TxPool::ApplyExtrinsicError";
6
+ export declare enum BuildBlockMode {
7
+ /** One block per batch (default) */
8
+ Batch = 0,
9
+ /** One block per tx */
10
+ Instant = 1,
11
+ /** Only build when triggered */
12
+ Manual = 2
13
+ }
14
+ export interface DownwardMessage {
15
+ sentAt: number;
16
+ msg: HexString;
17
+ }
18
+ export interface HorizontalMessage {
19
+ sentAt: number;
20
+ data: HexString;
21
+ }
22
+ export interface BuildBlockParams {
23
+ downwardMessages: DownwardMessage[];
24
+ upwardMessages: Record<number, HexString[]>;
25
+ horizontalMessages: Record<number, HorizontalMessage[]>;
26
+ transactions: HexString[];
27
+ unsafeBlockHeight?: number;
28
+ }
29
+ export declare class TxPool {
30
+ #private;
31
+ readonly event: EventEmitter<string | symbol, any>;
32
+ constructor(chain: Blockchain, inherentProvider: InherentProvider, mode?: BuildBlockMode);
33
+ get pendingExtrinsics(): HexString[];
34
+ get ump(): Record<number, HexString[]>;
35
+ get dmp(): DownwardMessage[];
36
+ get hrmp(): Record<number, HorizontalMessage[]>;
37
+ get mode(): BuildBlockMode;
38
+ set mode(mode: BuildBlockMode);
39
+ clear(): void;
40
+ pendingExtrinsicsBy(address: string): HexString[];
41
+ submitExtrinsic(extrinsic: HexString): Promise<void>;
42
+ submitUpwardMessages(id: number, ump: HexString[]): void;
43
+ submitDownwardMessages(dmp: DownwardMessage[]): void;
44
+ submitHorizontalMessages(id: number, hrmp: HorizontalMessage[]): void;
45
+ buildBlockWithParams(params: BuildBlockParams): Promise<void>;
46
+ buildBlock(params?: Partial<BuildBlockParams>): Promise<void>;
47
+ upcomingBlocks(): Promise<number>;
48
+ }
@@ -0,0 +1,32 @@
1
+ import { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
2
+ import { Blockchain } from './blockchain/index.js';
3
+ import { Database } from './database.js';
4
+ interface SubscriptionHandler {
5
+ callback: ProviderInterfaceCallback;
6
+ type: string;
7
+ }
8
+ /**
9
+ * Provider for local chopsticks chain
10
+ */
11
+ export declare class ChopsticksProvider implements ProviderInterface {
12
+ #private;
13
+ readonly chain: Blockchain;
14
+ constructor(chain: Blockchain);
15
+ static fromEndpoint: (endpoint: string, block?: number | string | null, db?: Database) => Promise<ChopsticksProvider>;
16
+ get hasSubscriptions(): boolean;
17
+ get isClonable(): boolean;
18
+ get isConnected(): boolean;
19
+ get isReady(): Promise<void>;
20
+ clone: () => ChopsticksProvider;
21
+ connect: () => Promise<void>;
22
+ disconnect: () => Promise<void>;
23
+ on: (type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb) => (() => void);
24
+ subscriptionManager: {
25
+ subscribe: (method: string, subid: string, onCancel?: () => void) => (data: any) => void;
26
+ unsubscribe: (subid: string) => void;
27
+ };
28
+ send: <T>(method: string, params: unknown[], _isCacheable?: boolean, subscription?: SubscriptionHandler) => Promise<T>;
29
+ subscribe(type: string, method: string, params: unknown[], callback: ProviderInterfaceCallback): Promise<number | string>;
30
+ unsubscribe(_type: string, method: string, id: number | string): Promise<boolean>;
31
+ }
32
+ export {};
@@ -0,0 +1,26 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ export interface BlockEntry {
3
+ hash: HexString;
4
+ number: number;
5
+ header: HexString;
6
+ parentHash: HexString | null;
7
+ extrinsics: HexString[];
8
+ storageDiff: Record<HexString, HexString | null> | null;
9
+ }
10
+ export interface KeyValueEntry {
11
+ blockHash: string;
12
+ key: string;
13
+ value: string | null;
14
+ }
15
+ export declare class Database {
16
+ constructor(location: string);
17
+ close: () => Promise<void>;
18
+ saveBlock: (block: BlockEntry) => Promise<void>;
19
+ queryBlock: (hash: HexString) => Promise<BlockEntry | null>;
20
+ queryBlockByNumber: (number: number) => Promise<BlockEntry | null>;
21
+ queryHighestBlock: () => Promise<BlockEntry | null>;
22
+ deleteBlock: (hash: HexString) => Promise<void>;
23
+ blocksCount: () => Promise<number>;
24
+ saveStorage: (blockHash: HexString, key: HexString, value: HexString | null) => Promise<void>;
25
+ queryStorage: (blockHash: HexString, key: HexString) => Promise<KeyValueEntry | null>;
26
+ }
@@ -0,0 +1,52 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types';
3
+ import { Genesis } from './schema/index.js';
4
+ import { JsCallback } from './wasm-executor/index.js';
5
+ /**
6
+ * Provider to start a chain from genesis
7
+ */
8
+ export declare class GenesisProvider implements ProviderInterface {
9
+ #private;
10
+ /**
11
+ * @ignore
12
+ * Create a genesis provider
13
+ *
14
+ * @param genesis - genesis file
15
+ * @requires genesis provider
16
+ */
17
+ constructor(genesis: Genesis);
18
+ get isClonable(): boolean;
19
+ clone: () => GenesisProvider;
20
+ get hasSubscriptions(): boolean;
21
+ get isConnected(): boolean;
22
+ get isReady(): Promise<void>;
23
+ connect: () => Promise<void>;
24
+ disconnect: () => Promise<void>;
25
+ on: (type: ProviderInterfaceEmitted, sub: ProviderInterfaceEmitCb) => (() => void);
26
+ get blockHash(): HexString;
27
+ getHeader: () => Promise<{
28
+ blockHash: `0x${string}`;
29
+ number: `0x${string}`;
30
+ stateRoot: `0x${string}`;
31
+ digest: {
32
+ logs: never[];
33
+ };
34
+ }>;
35
+ getBlock: () => Promise<{
36
+ block: {
37
+ header: {
38
+ blockHash: `0x${string}`;
39
+ number: `0x${string}`;
40
+ stateRoot: `0x${string}`;
41
+ digest: {
42
+ logs: never[];
43
+ };
44
+ };
45
+ extrinsics: never[];
46
+ };
47
+ }>;
48
+ get _jsCallback(): JsCallback;
49
+ send: (method: string, params: unknown[], _isCacheable?: boolean) => Promise<any>;
50
+ subscribe: (_type: string, _method: string, _params: unknown[], _cb: ProviderInterfaceCallback) => Promise<number | string>;
51
+ unsubscribe: (_type: string, _method: string, _id: number | string) => Promise<boolean>;
52
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Chopsticks core package. A common package for usage in both server and browser.
3
+ * It contains a local blockchain implementation, a transaction pool, a runtime executor and more!
4
+ *
5
+ * @privateRemarks
6
+ * Above is the package description for `chopsticks-core` package.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ export * from './api.js';
11
+ export * from './blockchain/index.js';
12
+ export * from './blockchain/block.js';
13
+ export * from './blockchain/block-builder.js';
14
+ export * from './blockchain/txpool.js';
15
+ export * from './blockchain/storage-layer.js';
16
+ export * from './blockchain/head-state.js';
17
+ export * from './utils/index.js';
18
+ export * from './wasm-executor/index.js';
19
+ export * from './schema/index.js';
20
+ export * from './xcm/index.js';
21
+ export * from './setup.js';
22
+ export * from './database.js';
23
+ export * from './blockchain/inherent/index.js';
24
+ export * from './logger.js';
25
+ export * from './offchain.js';
26
+ export * from './chopsticks-provider.js';
27
+ export * from './genesis-provider.js';
28
+ export * from './rpc/index.js';
@@ -0,0 +1,7 @@
1
+ export declare const defaultLogger: import("pino").Logger<{
2
+ level: string;
3
+ transport: {
4
+ target: string;
5
+ };
6
+ }>;
7
+ export declare const truncate: (val: any) => any;
@@ -0,0 +1,10 @@
1
+ import { Block } from './blockchain/block.js';
2
+ import { HexString } from '@polkadot/util/types';
3
+ export declare class OffchainWorker {
4
+ readonly pendingExtrinsics: HexString[];
5
+ readonly offchainStorage: Map<string, string | null | undefined>;
6
+ get(key: string): string | null | undefined;
7
+ set(key: string, value: string | null | undefined): void;
8
+ run(block: Block): Promise<void>;
9
+ pushExtrinsic(block: Block, extrinsic: HexString): Promise<`0x${string}`>;
10
+ }
@@ -0,0 +1,5 @@
1
+ import { Handlers } from './shared.js';
2
+ export declare const allHandlers: Handlers;
3
+ export { default as substrate } from './substrate/index.js';
4
+ export { ResponseError } from './shared.js';
5
+ export type { Context, SubscriptionManager, Handler, Handlers } from './shared.js';
@@ -0,0 +1,27 @@
1
+ import { Blockchain } from '../blockchain/index.js';
2
+ export declare const logger: import("pino").default.Logger<{
3
+ level: string;
4
+ transport: {
5
+ target: string;
6
+ };
7
+ }>;
8
+ export declare class ResponseError extends Error {
9
+ code: number;
10
+ constructor(code: number, message: string);
11
+ toJSON(): {
12
+ code: number;
13
+ message: string;
14
+ };
15
+ }
16
+ export interface Context {
17
+ /**
18
+ * The blockchain instance
19
+ */
20
+ chain: Blockchain;
21
+ }
22
+ export interface SubscriptionManager {
23
+ subscribe: (method: string, subid: string, onCancel?: () => void) => (data: any) => void;
24
+ unsubscribe: (subid: string) => void;
25
+ }
26
+ export type Handler<TParams = any, TReturn = any> = (context: Context, params: TParams, subscriptionManager: SubscriptionManager) => Promise<TReturn>;
27
+ export type Handlers = Record<string, Handler>;
@@ -0,0 +1,28 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { Handler } from '../shared.js';
3
+ /**
4
+ * @param context
5
+ * @param params - [`extrinsic`]
6
+ *
7
+ * @return Hash
8
+ */
9
+ export declare const author_submitExtrinsic: Handler<[HexString], HexString>;
10
+ /**
11
+ * @param context
12
+ * @param params - [`extrinsic`]
13
+ * @param subscriptionManager
14
+ *
15
+ * @return subscription id
16
+ */
17
+ export declare const author_submitAndWatchExtrinsic: Handler<[HexString], string>;
18
+ /**
19
+ * @param _context
20
+ * @param params - [`subid`]
21
+ */
22
+ export declare const author_unwatchExtrinsic: Handler<[string], void>;
23
+ /**
24
+ * Get pending extrinsics
25
+ *
26
+ * @return Array of pending extrinsics
27
+ */
28
+ export declare const author_pendingExtrinsics: Handler<void, HexString[]>;
@@ -59,6 +59,12 @@ const logger = defaultLogger.child({
59
59
  callback({
60
60
  ready: null
61
61
  });
62
+ // fake broadcast to alice peer
63
+ callback({
64
+ broadcast: [
65
+ '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
66
+ ]
67
+ });
62
68
  }, 50);
63
69
  } catch (error) {
64
70
  logger.error({
@@ -0,0 +1,45 @@
1
+ import { Header } from '@polkadot/types/interfaces';
2
+ import { HexString } from '@polkadot/util/types';
3
+ import { Handler } from '../shared.js';
4
+ /**
5
+ * @param context
6
+ * @param params - [`blockNumber` | `blockNumber[]` | null]
7
+ *
8
+ * @return Block hash | hash[] | null
9
+ */
10
+ export declare const chain_getBlockHash: Handler<[number | number[] | null], HexString | (HexString | null)[] | null>;
11
+ /**
12
+ * @param context
13
+ * @param params - [`blockhash`]
14
+ *
15
+ * @return Header - see `@polkadot/types/interfaces`
16
+ */
17
+ export declare const chain_getHeader: Handler<[HexString], Header>;
18
+ /**
19
+ * @param context
20
+ * @param params - [`blockhash`]
21
+ *
22
+ * @return Block header and extrinsics
23
+ */
24
+ export declare const chain_getBlock: Handler<[
25
+ HexString
26
+ ], {
27
+ block: {
28
+ header: Header;
29
+ extrinsics: HexString[];
30
+ };
31
+ justifications: null;
32
+ }>;
33
+ /**
34
+ * @param context
35
+ *
36
+ * @return head hash
37
+ */
38
+ export declare const chain_getFinalizedHead: Handler<void, HexString>;
39
+ export declare const chain_subscribeNewHead: Handler<void, string>;
40
+ export declare const chain_subscribeFinalizedHeads: Handler<void, string>;
41
+ export declare const chain_unsubscribeNewHead: Handler<[string], void>;
42
+ export declare const chain_getHead: Handler<[number | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
43
+ export declare const chain_subscribeNewHeads: Handler<void, string>;
44
+ export declare const chain_unsubscribeNewHeads: Handler<[string], void>;
45
+ export declare const chain_unsubscribeFinalizedHeads: Handler<[string], void>;
@@ -0,0 +1,66 @@
1
+ import * as AuthorRPC from './author.js';
2
+ import * as ChainRPC from './chain.js';
3
+ import * as PaymentRPC from './payment.js';
4
+ import * as StateRPC from './state.js';
5
+ import * as SystemRPC from './system.js';
6
+ export { AuthorRPC };
7
+ export { ChainRPC };
8
+ export { PaymentRPC };
9
+ export { StateRPC };
10
+ export { SystemRPC };
11
+ declare const handlers: {
12
+ system_localPeerId: () => Promise<string>;
13
+ system_nodeRoles: () => Promise<string[]>;
14
+ system_localListenAddresses: () => Promise<never[]>;
15
+ system_chain: import("../shared.js").Handler<void, string>;
16
+ system_properties: import("../shared.js").Handler<void, import("../../api.js").ChainProperties>;
17
+ system_name: import("../shared.js").Handler<void, string>;
18
+ system_version: import("../shared.js").Handler<void, string>;
19
+ system_chainType: import("../shared.js").Handler<void, string>;
20
+ system_health: () => Promise<{
21
+ peers: number;
22
+ isSyncing: boolean;
23
+ shouldHavePeers: boolean;
24
+ }>;
25
+ system_dryRun: import("../shared.js").Handler<[`0x${string}`, `0x${string}`], string>;
26
+ system_accountNextIndex: import("../shared.js").Handler<[`0x${string}`], number>;
27
+ state_getRuntimeVersion: import("../shared.js").Handler<[`0x${string}`], import("../../index.js").RuntimeVersion | null>;
28
+ state_getMetadata: import("../shared.js").Handler<[`0x${string}`], `0x${string}` | null>;
29
+ state_getStorage: import("../shared.js").Handler<[`0x${string}`, `0x${string}`], string | null>;
30
+ state_getKeysPaged: import("../shared.js").Handler<[string, number, string, `0x${string}`], string[] | undefined>;
31
+ state_queryStorageAt: import("../shared.js").Handler<[string[], `0x${string}`], [] | [{
32
+ block: `0x${string}`;
33
+ changes: [string, string | null][];
34
+ }]>;
35
+ state_call: import("../shared.js").Handler<[`0x${string}`, `0x${string}`, `0x${string}`], `0x${string}`>;
36
+ state_subscribeRuntimeVersion: import("../shared.js").Handler<[], string>;
37
+ state_unsubscribeRuntimeVersion: import("../shared.js").Handler<[`0x${string}`], void>;
38
+ state_subscribeStorage: import("../shared.js").Handler<[string[]], string>;
39
+ state_unsubscribeStorage: import("../shared.js").Handler<[string], void>;
40
+ childstate_getStorage: import("../shared.js").Handler<[`0x${string}`, `0x${string}`, `0x${string}`], string | null>;
41
+ childstate_getKeysPaged: import("../shared.js").Handler<[`0x${string}`, `0x${string}`, number, `0x${string}`, `0x${string}`], `0x${string}`[] | undefined>;
42
+ payment_queryFeeDetails: import("../shared.js").Handler<[`0x${string}`, `0x${string}`], `0x${string}`>;
43
+ payment_queryInfo: import("../shared.js").Handler<[`0x${string}`, `0x${string}`], `0x${string}`>;
44
+ chain_getBlockHash: import("../shared.js").Handler<[number | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
45
+ chain_getHeader: import("../shared.js").Handler<[`0x${string}`], import("@polkadot/types/interfaces").Header>;
46
+ chain_getBlock: import("../shared.js").Handler<[`0x${string}`], {
47
+ block: {
48
+ header: import("@polkadot/types/interfaces").Header;
49
+ extrinsics: `0x${string}`[];
50
+ };
51
+ justifications: null;
52
+ }>;
53
+ chain_getFinalizedHead: import("../shared.js").Handler<void, `0x${string}`>;
54
+ chain_subscribeNewHead: import("../shared.js").Handler<void, string>;
55
+ chain_subscribeFinalizedHeads: import("../shared.js").Handler<void, string>;
56
+ chain_unsubscribeNewHead: import("../shared.js").Handler<[string], void>;
57
+ chain_getHead: import("../shared.js").Handler<[number | number[] | null], `0x${string}` | (`0x${string}` | null)[] | null>;
58
+ chain_subscribeNewHeads: import("../shared.js").Handler<void, string>;
59
+ chain_unsubscribeNewHeads: import("../shared.js").Handler<[string], void>;
60
+ chain_unsubscribeFinalizedHeads: import("../shared.js").Handler<[string], void>;
61
+ author_submitExtrinsic: import("../shared.js").Handler<[`0x${string}`], `0x${string}`>;
62
+ author_submitAndWatchExtrinsic: import("../shared.js").Handler<[`0x${string}`], string>;
63
+ author_unwatchExtrinsic: import("../shared.js").Handler<[string], void>;
64
+ author_pendingExtrinsics: import("../shared.js").Handler<void, `0x${string}`[]>;
65
+ };
66
+ export default handlers;
@@ -0,0 +1,16 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { Handler } from '../shared.js';
3
+ /**
4
+ * @param context
5
+ * @param params - [`extrinsic`, `blockhash`]
6
+ *
7
+ * @return result in hash
8
+ */
9
+ export declare const payment_queryFeeDetails: Handler<[HexString, HexString], HexString>;
10
+ /**
11
+ * @param context
12
+ * @param params - [`extrinsic`, `blockhash`]
13
+ *
14
+ * @return result in hash
15
+ */
16
+ export declare const payment_queryInfo: Handler<[HexString, HexString], HexString>;
@@ -0,0 +1,97 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { Handler } from '../shared.js';
3
+ import { RuntimeVersion } from '../../wasm-executor/index.js';
4
+ /**
5
+ * @param context
6
+ * @param params - [`blockhash`]
7
+ *
8
+ * @return runtime version
9
+ */
10
+ export declare const state_getRuntimeVersion: Handler<[HexString], RuntimeVersion | null>;
11
+ /**
12
+ * @param context
13
+ * @param params - [`blockhash`]
14
+ *
15
+ * @return metadata
16
+ */
17
+ export declare const state_getMetadata: Handler<[HexString], HexString | null>;
18
+ /**
19
+ * @param context
20
+ * @param params - [`key`, `blockhash`]
21
+ *
22
+ * @return storage value
23
+ */
24
+ export declare const state_getStorage: Handler<[HexString, HexString], string | null>;
25
+ /**
26
+ * @param context
27
+ * @param params - [`prefix`, `pageSize`, `startKey`, `blockhash`]
28
+ *
29
+ * @return paged keys
30
+ */
31
+ export declare const state_getKeysPaged: Handler<[string, number, string, HexString], string[] | undefined>;
32
+ /**
33
+ * @param context
34
+ * @param params - [`keys`, `blockhash`]
35
+ *
36
+ * @return storage values
37
+ */
38
+ export declare const state_queryStorageAt: Handler<[
39
+ string[],
40
+ HexString
41
+ ], [] | [
42
+ {
43
+ block: HexString;
44
+ changes: [string, string | null][];
45
+ }
46
+ ]>;
47
+ /**
48
+ * @param context
49
+ * @param params - [`method`, `data`, `blockhash`]
50
+ *
51
+ * @return result in hash
52
+ */
53
+ export declare const state_call: Handler<[HexString, HexString, HexString], HexString>;
54
+ /**
55
+ * @return subscription id
56
+ */
57
+ export declare const state_subscribeRuntimeVersion: Handler<[], string>;
58
+ /**
59
+ * @param context
60
+ * @param params - [`subid`]
61
+ * @param subscriptionManager
62
+ */
63
+ export declare const state_unsubscribeRuntimeVersion: Handler<[HexString], void>;
64
+ /**
65
+ * @param context
66
+ * @param params - [`keys`]
67
+ * @param subscriptionManager
68
+ *
69
+ * @return subscription id
70
+ */
71
+ export declare const state_subscribeStorage: Handler<[string[]], string>;
72
+ /**
73
+ * @param context
74
+ * @param params - [`subid`]
75
+ * @param subscriptionManager
76
+ */
77
+ export declare const state_unsubscribeStorage: Handler<[string], void>;
78
+ /**
79
+ * @param context
80
+ * @param params - [`child`, `key`, `blockhash`]
81
+ *
82
+ * @return storage valuse
83
+ */
84
+ export declare const childstate_getStorage: Handler<[HexString, HexString, HexString], string | null>;
85
+ /**
86
+ * @param context
87
+ * @param params - [`child`, `prefix`, `pageSize`, `startKey`, `blockhash`]
88
+ *
89
+ * @return paged keys
90
+ */
91
+ export declare const childstate_getKeysPaged: Handler<[
92
+ HexString,
93
+ HexString,
94
+ number,
95
+ HexString,
96
+ HexString
97
+ ], HexString[] | undefined>;
@@ -0,0 +1,28 @@
1
+ import { HexString } from '@polkadot/util/types';
2
+ import { ChainProperties } from '../../api.js';
3
+ import { Handler } from '../shared.js';
4
+ export declare const system_localPeerId: () => Promise<string>;
5
+ export declare const system_nodeRoles: () => Promise<string[]>;
6
+ export declare const system_localListenAddresses: () => Promise<never[]>;
7
+ export declare const system_chain: Handler<void, string>;
8
+ export declare const system_properties: Handler<void, ChainProperties>;
9
+ export declare const system_name: Handler<void, string>;
10
+ export declare const system_version: Handler<void, string>;
11
+ export declare const system_chainType: Handler<void, string>;
12
+ export declare const system_health: () => Promise<{
13
+ peers: number;
14
+ isSyncing: boolean;
15
+ shouldHavePeers: boolean;
16
+ }>;
17
+ /**
18
+ * @param context
19
+ * @param params - [`extrinsic`, `at`]
20
+ *
21
+ * @return ApplyExtrinsicResult (see `@polkadot/types/interfaces`) in hash
22
+ */
23
+ export declare const system_dryRun: Handler<[HexString, HexString], string>;
24
+ /**
25
+ * @param context
26
+ * @param params - [`address`]
27
+ */
28
+ export declare const system_accountNextIndex: Handler<[HexString], number>;
@@ -0,0 +1,62 @@
1
+ import { z } from 'zod';
2
+ export declare const genesisSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ properties: z.ZodObject<{
6
+ ss58Format: z.ZodOptional<z.ZodNumber>;
7
+ tokenDecimals: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>>;
8
+ tokenSymbol: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ ss58Format?: number | undefined;
11
+ tokenDecimals?: number | number[] | undefined;
12
+ tokenSymbol?: string | string[] | undefined;
13
+ }, {
14
+ ss58Format?: number | undefined;
15
+ tokenDecimals?: number | number[] | undefined;
16
+ tokenSymbol?: string | string[] | undefined;
17
+ }>;
18
+ genesis: z.ZodObject<{
19
+ raw: z.ZodObject<{
20
+ top: z.ZodRecord<z.ZodString, z.ZodString>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ top: Record<string, string>;
23
+ }, {
24
+ top: Record<string, string>;
25
+ }>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ raw: {
28
+ top: Record<string, string>;
29
+ };
30
+ }, {
31
+ raw: {
32
+ top: Record<string, string>;
33
+ };
34
+ }>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ name: string;
37
+ id: string;
38
+ properties: {
39
+ ss58Format?: number | undefined;
40
+ tokenDecimals?: number | number[] | undefined;
41
+ tokenSymbol?: string | string[] | undefined;
42
+ };
43
+ genesis: {
44
+ raw: {
45
+ top: Record<string, string>;
46
+ };
47
+ };
48
+ }, {
49
+ name: string;
50
+ id: string;
51
+ properties: {
52
+ ss58Format?: number | undefined;
53
+ tokenDecimals?: number | number[] | undefined;
54
+ tokenSymbol?: string | string[] | undefined;
55
+ };
56
+ genesis: {
57
+ raw: {
58
+ top: Record<string, string>;
59
+ };
60
+ };
61
+ }>;
62
+ export type Genesis = z.infer<typeof genesisSchema>;