@xelis/sdk 0.5.10 → 0.5.11
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 +3 -1
- package/daemon/rpc.js +6 -0
- package/daemon/types.d.ts +14 -3
- package/daemon/types.js +2 -0
- package/daemon/websocket.d.ts +3 -1
- package/daemon/websocket.js +6 -0
- package/lib/websocket.js +4 -0
- package/package.json +2 -2
package/daemon/rpc.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Balance, Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetLastBalanceResult, P2PStatusResult, Transaction, GetLastBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceResult, GetNonceParams, GetAccountHistoryParams, AccounHistory, Peer } from './types';
|
|
1
|
+
import { Balance, Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetLastBalanceResult, P2PStatusResult, Transaction, GetLastBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceResult, GetNonceParams, GetAccountHistoryParams, AccounHistory, Peer, DevFee, DiskSize } from './types';
|
|
2
2
|
import { RPC as BaseRPC } from '../lib/rpc';
|
|
3
3
|
declare class RPC extends BaseRPC {
|
|
4
4
|
getVersion(): Promise<import("../lib/types").RPCResponse<string>>;
|
|
@@ -32,5 +32,7 @@ declare class RPC extends BaseRPC {
|
|
|
32
32
|
getAccountHistory(params: GetAccountHistoryParams): Promise<import("../lib/types").RPCResponse<AccounHistory[]>>;
|
|
33
33
|
getAccountAssets(address: string): Promise<import("../lib/types").RPCResponse<string[]>>;
|
|
34
34
|
getPeers(): Promise<import("../lib/types").RPCResponse<Peer[]>>;
|
|
35
|
+
getDevFeeThresholds(): Promise<import("../lib/types").RPCResponse<DevFee[]>>;
|
|
36
|
+
getSizeOnDisk(): Promise<import("../lib/types").RPCResponse<DiskSize>>;
|
|
35
37
|
}
|
|
36
38
|
export default RPC;
|
package/daemon/rpc.js
CHANGED
|
@@ -94,5 +94,11 @@ class RPC extends BaseRPC {
|
|
|
94
94
|
getPeers() {
|
|
95
95
|
return this.post(RPCMethod.GetPeers);
|
|
96
96
|
}
|
|
97
|
+
getDevFeeThresholds() {
|
|
98
|
+
return this.post(RPCMethod.GetDevFeeThresholds);
|
|
99
|
+
}
|
|
100
|
+
getSizeOnDisk() {
|
|
101
|
+
return this.post(RPCMethod.GetSizeOnDisk);
|
|
102
|
+
}
|
|
97
103
|
}
|
|
98
104
|
export default RPC;
|
package/daemon/types.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ export interface GetInfoResult {
|
|
|
3
3
|
difficulty: number;
|
|
4
4
|
height: number;
|
|
5
5
|
mempool_size: number;
|
|
6
|
-
|
|
6
|
+
circulating_supply: number;
|
|
7
|
+
maximum_supply: number;
|
|
7
8
|
stableheight: number;
|
|
8
|
-
|
|
9
|
+
top_block_hash: string;
|
|
9
10
|
version: string;
|
|
10
11
|
network: string;
|
|
11
12
|
topoheight: number;
|
|
@@ -171,6 +172,14 @@ export interface PeerPeerDisconnected {
|
|
|
171
172
|
peer_id: number;
|
|
172
173
|
peer_addr: string;
|
|
173
174
|
}
|
|
175
|
+
export interface DevFee {
|
|
176
|
+
fee_percentage: number;
|
|
177
|
+
height: number;
|
|
178
|
+
}
|
|
179
|
+
export interface DiskSize {
|
|
180
|
+
size_bytes: number;
|
|
181
|
+
size_formatted: string;
|
|
182
|
+
}
|
|
174
183
|
export declare enum RPCMethod {
|
|
175
184
|
GetVersion = "get_version",
|
|
176
185
|
GetInfo = "get_info",
|
|
@@ -202,7 +211,9 @@ export declare enum RPCMethod {
|
|
|
202
211
|
CountAccounts = "count_accounts",
|
|
203
212
|
GetAccountHistory = "get_account_history",
|
|
204
213
|
GetAccountAssets = "get_account_assets",
|
|
205
|
-
GetPeers = "get_peers"
|
|
214
|
+
GetPeers = "get_peers",
|
|
215
|
+
GetDevFeeThresholds = "get_dev_fee_thresholds",
|
|
216
|
+
GetSizeOnDisk = "get_size_on_disk"
|
|
206
217
|
}
|
|
207
218
|
export declare enum RPCEvent {
|
|
208
219
|
NewBlock = "NewBlock",
|
package/daemon/types.js
CHANGED
|
@@ -31,6 +31,8 @@ export var RPCMethod;
|
|
|
31
31
|
RPCMethod["GetAccountHistory"] = "get_account_history";
|
|
32
32
|
RPCMethod["GetAccountAssets"] = "get_account_assets";
|
|
33
33
|
RPCMethod["GetPeers"] = "get_peers";
|
|
34
|
+
RPCMethod["GetDevFeeThresholds"] = "get_dev_fee_thresholds";
|
|
35
|
+
RPCMethod["GetSizeOnDisk"] = "get_size_on_disk";
|
|
34
36
|
})(RPCMethod || (RPCMethod = {}));
|
|
35
37
|
export var RPCEvent;
|
|
36
38
|
(function (RPCEvent) {
|
package/daemon/websocket.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MessageEvent } from 'ws';
|
|
2
|
-
import { Block, GetInfoResult, RPCEventResult, Transaction, TopoHeightRangeParams, P2PStatusResult, Balance, GetBalanceAtTopoHeightParams, GetLastBalanceResult, HeightRangeParams, BlockOrdered, GetLastBalanceParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceParams, GetNonceResult, GetAccountHistoryParams, AccounHistory, Peer, PeerPeerListUpdated, PeerPeerDisconnected } from './types';
|
|
2
|
+
import { Block, GetInfoResult, RPCEventResult, Transaction, TopoHeightRangeParams, P2PStatusResult, Balance, GetBalanceAtTopoHeightParams, GetLastBalanceResult, HeightRangeParams, BlockOrdered, GetLastBalanceParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceParams, GetNonceResult, GetAccountHistoryParams, AccounHistory, Peer, PeerPeerListUpdated, PeerPeerDisconnected, DevFee, DiskSize } from './types';
|
|
3
3
|
import { WS as BaseWS } from '../lib/websocket';
|
|
4
4
|
declare class WS extends BaseWS {
|
|
5
5
|
onNewBlock(onData: (msgEvent: MessageEvent, data?: Block & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
@@ -41,5 +41,7 @@ declare class WS extends BaseWS {
|
|
|
41
41
|
getAccountHistory(params: GetAccountHistoryParams): Promise<AccounHistory[]>;
|
|
42
42
|
getAccountAssets(address: string): Promise<string[]>;
|
|
43
43
|
getPeers(): Promise<Peer[]>;
|
|
44
|
+
getDevFeeThresholds(): Promise<DevFee[]>;
|
|
45
|
+
getSizeOnDisk(): Promise<DiskSize>;
|
|
44
46
|
}
|
|
45
47
|
export default WS;
|
package/daemon/websocket.js
CHANGED
|
@@ -118,5 +118,11 @@ class WS extends BaseWS {
|
|
|
118
118
|
getPeers() {
|
|
119
119
|
return this.dataCall(RPCMethod.GetPeers);
|
|
120
120
|
}
|
|
121
|
+
getDevFeeThresholds() {
|
|
122
|
+
return this.dataCall(RPCMethod.GetDevFeeThresholds);
|
|
123
|
+
}
|
|
124
|
+
getSizeOnDisk() {
|
|
125
|
+
return this.dataCall(RPCMethod.GetSizeOnDisk);
|
|
126
|
+
}
|
|
121
127
|
}
|
|
122
128
|
export default WS;
|
package/lib/websocket.js
CHANGED
|
@@ -145,6 +145,10 @@ export class WS {
|
|
|
145
145
|
}
|
|
146
146
|
call(method, params) {
|
|
147
147
|
return new Promise((resolve, reject) => {
|
|
148
|
+
if (!this.socket)
|
|
149
|
+
return reject(new Error(`Socket is not initialized.`));
|
|
150
|
+
if (this.socket.readyState !== WebSocket.OPEN)
|
|
151
|
+
return reject(new Error(`Can't send msg. Socket is not opened.`));
|
|
148
152
|
const { data, id } = this.createRequestMethod(method, params);
|
|
149
153
|
let timeoutId = null;
|
|
150
154
|
const onMessage = (msgEvent) => {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.5.
|
|
2
|
+
"version": "0.5.11",
|
|
3
3
|
"name": "@xelis/sdk",
|
|
4
4
|
"description": "Xelis software development kit for JS",
|
|
5
5
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"homepage": "https://github.com/xelis-project/xelis-js-sdk#readme",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "jest",
|
|
12
|
-
"build": "rm -
|
|
12
|
+
"build": "rm -rf ./dist && npx tsc --declaration && cp package.json ./dist && cp README.md ./dist",
|
|
13
13
|
"publish": "cd ./dist && npm publish"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|