This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
childstate.ts
67 lines (65 loc) · 2.29 KB
/
childstate.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// https://github.com/paritytech/substrate/blob/4d04aba/primitives/storage/src/lib.rs
export type StorageKey = string
export type PrefixedStorageKey = string
export type StorageData = string
// https://github.com/paritytech/substrate/blob/ded44948/client/rpc-api/src/state/helpers.rs#L27
export interface ReadProof {
/** Block hash used to generate the proof */
at: string
/** A proof used to prove that storage entries are included in the storage trie */
proof: string[]
}
// https://github.com/paritytech/substrate/blob/934fbfd/client/rpc-api/src/child_state/mod.rs#L29
export type ChildStateCalls = {
/**
* Returns the keys with prefix from a child storage, leave empty to get all the keys
* @deprecated [2.0.0] Please use `getKeysPaged` with proper paging support
*/
childState_getKeys(
childStorageKey: PrefixedStorageKey,
prefix: StorageKey,
hash?: string,
): StorageKey[]
/**
* Returns the keys with prefix from a child storage with pagination support.
* Up to `count` keys will be returned.
* If `start_key` is passed, return next keys in storage in lexicographic order.
*/
childState_getKeysPaged(
childStorageKey: PrefixedStorageKey,
prefix: StorageKey,
count: number,
startKey?: StorageKey,
hash?: string,
): StorageKey[]
/** Returns a child storage entry at a specific block's state. */
childState_getStorage(
childStorageKey: PrefixedStorageKey,
key: StorageKey,
hash?: string,
): StorageData | null
/** Returns child storage entries for multiple keys at a specific block's state. */
childState_getStorageEntries(
childStorageKey: PrefixedStorageKey,
keys: StorageKey[],
hash?: string,
): (StorageData | null)[]
/** Returns the hash of a child storage entry at a block's state. */
childState_getStorageHash(
childStorageKey: PrefixedStorageKey,
key: StorageKey,
hash?: string,
): string | null
/** Returns the size of a child storage entry at a block's state. */
childState_getStorageSize(
childStorageKey: PrefixedStorageKey,
key: StorageKey,
hash?: string,
): number | null
/** Returns proof of storage for child key entries at a specific block's state. */
state_getChildReadProof(
childStorageKey: PrefixedStorageKey,
keys: StorageKey[],
hash?: string,
): ReadProof
}