@xelis/sdk 0.3.2 → 0.3.3
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/daemon/rpc.d.ts +5 -5
- package/daemon/rpc.js +8 -8
- package/daemon/types.d.ts +15 -0
- package/daemon/websocket.d.ts +5 -5
- package/daemon/websocket.js +8 -8
- package/package.json +1 -1
package/daemon/rpc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Balance, Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetLastBalanceResult, P2PStatusResult, RPCMethod, RPCResponse, Transaction, GetLastBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams } from './types';
|
|
1
|
+
import { Balance, Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetLastBalanceResult, P2PStatusResult, RPCMethod, RPCResponse, Transaction, GetLastBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams } from './types';
|
|
2
2
|
declare class RPC {
|
|
3
3
|
endpoint: string;
|
|
4
4
|
constructor(endpoint: string);
|
|
@@ -9,10 +9,10 @@ declare class RPC {
|
|
|
9
9
|
getTopoHeight(): Promise<RPCResponse<number>>;
|
|
10
10
|
getStableHeight(): Promise<RPCResponse<number>>;
|
|
11
11
|
getBlockTemplate(address: string): Promise<RPCResponse<string>>;
|
|
12
|
-
getBlockAtTopoHeight(
|
|
13
|
-
getBlocksAtHeight(
|
|
14
|
-
getBlockByHash(
|
|
15
|
-
getTopBlock(): Promise<RPCResponse<Block>>;
|
|
12
|
+
getBlockAtTopoHeight(params: GetBlockAtTopoHeightParams): Promise<RPCResponse<Block>>;
|
|
13
|
+
getBlocksAtHeight(params: GetBlocksAtHeightParams): Promise<RPCResponse<Block[]>>;
|
|
14
|
+
getBlockByHash(params: GetBlockByHashParams): Promise<RPCResponse<Block>>;
|
|
15
|
+
getTopBlock(params: GetTopBlockParams): Promise<RPCResponse<Block>>;
|
|
16
16
|
getNonce(address: string): Promise<RPCResponse<number>>;
|
|
17
17
|
getLastBalance(params: GetLastBalanceParams): Promise<RPCResponse<GetLastBalanceResult>>;
|
|
18
18
|
getBalanceAtTopoHeight(params: GetBalanceAtTopoHeightParams): Promise<RPCResponse<Balance>>;
|
package/daemon/rpc.js
CHANGED
|
@@ -40,17 +40,17 @@ class RPC {
|
|
|
40
40
|
getBlockTemplate(address) {
|
|
41
41
|
return this.fetch(RPCMethod.GetBlockTemplate, { address });
|
|
42
42
|
}
|
|
43
|
-
getBlockAtTopoHeight(
|
|
44
|
-
return this.fetch(RPCMethod.GetBlockAtTopoHeight,
|
|
43
|
+
getBlockAtTopoHeight(params) {
|
|
44
|
+
return this.fetch(RPCMethod.GetBlockAtTopoHeight, params);
|
|
45
45
|
}
|
|
46
|
-
getBlocksAtHeight(
|
|
47
|
-
return this.fetch(RPCMethod.GetBlocksAtHeight,
|
|
46
|
+
getBlocksAtHeight(params) {
|
|
47
|
+
return this.fetch(RPCMethod.GetBlocksAtHeight, params);
|
|
48
48
|
}
|
|
49
|
-
getBlockByHash(
|
|
50
|
-
return this.fetch(RPCMethod.GetBlockByHash,
|
|
49
|
+
getBlockByHash(params) {
|
|
50
|
+
return this.fetch(RPCMethod.GetBlockByHash, params);
|
|
51
51
|
}
|
|
52
|
-
getTopBlock() {
|
|
53
|
-
return this.fetch(RPCMethod.GetTopBlock);
|
|
52
|
+
getTopBlock(params) {
|
|
53
|
+
return this.fetch(RPCMethod.GetTopBlock, params);
|
|
54
54
|
}
|
|
55
55
|
getNonce(address) {
|
|
56
56
|
return this.fetch(RPCMethod.GetNonce, { address });
|
package/daemon/types.d.ts
CHANGED
|
@@ -110,6 +110,21 @@ export interface GetAccountsParams {
|
|
|
110
110
|
minimum_topoheight?: number;
|
|
111
111
|
maximum_topoheight?: number;
|
|
112
112
|
}
|
|
113
|
+
export interface GetBlockAtTopoHeightParams {
|
|
114
|
+
topoheight: number;
|
|
115
|
+
include_txs?: boolean;
|
|
116
|
+
}
|
|
117
|
+
export interface GetBlocksAtHeightParams {
|
|
118
|
+
height: number;
|
|
119
|
+
include_txs?: boolean;
|
|
120
|
+
}
|
|
121
|
+
export interface GetBlockByHashParams {
|
|
122
|
+
hash: string;
|
|
123
|
+
include_txs?: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface GetTopBlockParams {
|
|
126
|
+
include_txs?: boolean;
|
|
127
|
+
}
|
|
113
128
|
export declare enum RPCMethod {
|
|
114
129
|
GetVersion = "get_version",
|
|
115
130
|
GetInfo = "get_info",
|
package/daemon/websocket.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { MessageEvent } from 'ws';
|
|
3
3
|
import WebSocket from 'isomorphic-ws';
|
|
4
|
-
import { Block, RPCResponse, GetInfoResult, RPCEvent, RPCEventResult, Transaction, TopoHeightRangeParams, P2PStatusResult, Balance, GetBalanceAtTopoHeightParams, GetLastBalanceResult, HeightRangeParams, BlockOrdered, GetLastBalanceParams, GetAccountsParams } from './types';
|
|
4
|
+
import { Block, RPCResponse, GetInfoResult, RPCEvent, RPCEventResult, Transaction, TopoHeightRangeParams, P2PStatusResult, Balance, GetBalanceAtTopoHeightParams, GetLastBalanceResult, HeightRangeParams, BlockOrdered, GetLastBalanceParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams } from './types';
|
|
5
5
|
declare class WS {
|
|
6
6
|
endpoint: string;
|
|
7
7
|
socket?: WebSocket;
|
|
@@ -28,10 +28,10 @@ declare class WS {
|
|
|
28
28
|
getTopoHeight(): Promise<number>;
|
|
29
29
|
getStableHeight(): Promise<number>;
|
|
30
30
|
getBlockTemplate(address: string): Promise<string>;
|
|
31
|
-
getBlockAtTopoHeight(
|
|
32
|
-
getBlocksAtHeight(
|
|
33
|
-
getBlockByHash(
|
|
34
|
-
getTopBlock(): Promise<Block>;
|
|
31
|
+
getBlockAtTopoHeight(params: GetBlockAtTopoHeightParams): Promise<Block>;
|
|
32
|
+
getBlocksAtHeight(params: GetBlocksAtHeightParams): Promise<Block[]>;
|
|
33
|
+
getBlockByHash(params: GetBlockByHashParams): Promise<Block>;
|
|
34
|
+
getTopBlock(params: GetTopBlockParams): Promise<Block>;
|
|
35
35
|
getNonce(address: string): Promise<number>;
|
|
36
36
|
getLastBalance(params: GetLastBalanceParams): Promise<GetLastBalanceResult>;
|
|
37
37
|
getBalanceAtTopoHeight(params: GetBalanceAtTopoHeightParams): Promise<Balance>;
|
package/daemon/websocket.js
CHANGED
|
@@ -196,17 +196,17 @@ class WS {
|
|
|
196
196
|
getBlockTemplate(address) {
|
|
197
197
|
return this.dataCall(RPCMethod.GetBlockTemplate, { address });
|
|
198
198
|
}
|
|
199
|
-
getBlockAtTopoHeight(
|
|
200
|
-
return this.dataCall(RPCMethod.GetBlockAtTopoHeight,
|
|
199
|
+
getBlockAtTopoHeight(params) {
|
|
200
|
+
return this.dataCall(RPCMethod.GetBlockAtTopoHeight, params);
|
|
201
201
|
}
|
|
202
|
-
getBlocksAtHeight(
|
|
203
|
-
return this.dataCall(RPCMethod.GetBlocksAtHeight,
|
|
202
|
+
getBlocksAtHeight(params) {
|
|
203
|
+
return this.dataCall(RPCMethod.GetBlocksAtHeight, params);
|
|
204
204
|
}
|
|
205
|
-
getBlockByHash(
|
|
206
|
-
return this.dataCall(RPCMethod.GetBlockByHash,
|
|
205
|
+
getBlockByHash(params) {
|
|
206
|
+
return this.dataCall(RPCMethod.GetBlockByHash, params);
|
|
207
207
|
}
|
|
208
|
-
getTopBlock() {
|
|
209
|
-
return this.dataCall(RPCMethod.GetTopBlock);
|
|
208
|
+
getTopBlock(params) {
|
|
209
|
+
return this.dataCall(RPCMethod.GetTopBlock, params);
|
|
210
210
|
}
|
|
211
211
|
getNonce(address) {
|
|
212
212
|
return this.dataCall(RPCMethod.GetNonce, { address });
|
package/package.json
CHANGED