UNPKG

2.21 kBJavaScriptView Raw
1export const rpc = {
2 getBlock: {
3 description: 'Get header and body of a relay chain block',
4 params: [
5 {
6 isHistoric: true,
7 isOptional: true,
8 name: 'hash',
9 type: 'BlockHash'
10 }
11 ],
12 type: 'SignedBlock'
13 },
14 getBlockHash: {
15 description: 'Get the block hash for a specific block',
16 params: [
17 {
18 isOptional: true,
19 name: 'blockNumber',
20 type: 'BlockNumber'
21 }
22 ],
23 type: 'BlockHash'
24 },
25 getFinalizedHead: {
26 alias: ['chain_getFinalisedHead'],
27 description: 'Get hash of the last finalized block in the canon chain',
28 params: [],
29 type: 'BlockHash'
30 },
31 getHeader: {
32 alias: ['chain_getHead'],
33 description: 'Retrieves the header for a specific block',
34 params: [
35 {
36 isHistoric: true,
37 isOptional: true,
38 name: 'hash',
39 type: 'BlockHash'
40 }
41 ],
42 type: 'Header'
43 },
44 subscribeAllHeads: {
45 description: 'Retrieves the newest header via subscription',
46 params: [],
47 pubsub: [
48 'allHead',
49 'subscribeAllHeads',
50 'unsubscribeAllHeads'
51 ],
52 type: 'Header'
53 },
54 subscribeFinalizedHeads: {
55 alias: ['chain_subscribeFinalisedHeads', 'chain_unsubscribeFinalisedHeads'],
56 description: 'Retrieves the best finalized header via subscription',
57 params: [],
58 pubsub: [
59 'finalizedHead',
60 'subscribeFinalizedHeads',
61 'unsubscribeFinalizedHeads'
62 ],
63 type: 'Header'
64 },
65 subscribeNewHeads: {
66 alias: ['chain_unsubscribeNewHeads', 'subscribe_newHead', 'unsubscribe_newHead'],
67 description: 'Retrieves the best header via subscription',
68 params: [],
69 // NOTE These still has the aliassed version, compatible with 1.x
70 pubsub: [
71 'newHead',
72 'subscribeNewHead',
73 'unsubscribeNewHead'
74 ],
75 type: 'Header'
76 }
77};