@xelis/sdk 0.5.14 → 0.5.16
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/types.d.ts +6 -1
- package/daemon/types.js +1 -0
- package/daemon/websocket.d.ts +5 -1
- package/daemon/websocket.js +12 -0
- package/package.json +2 -2
- package/wallet/websocket.d.ts +4 -1
- package/wallet/websocket.js +9 -0
package/daemon/types.d.ts
CHANGED
|
@@ -96,6 +96,10 @@ export interface BlockOrdered {
|
|
|
96
96
|
block_hash: string;
|
|
97
97
|
block_type: string;
|
|
98
98
|
}
|
|
99
|
+
export interface BlockOrphaned {
|
|
100
|
+
block_hash: string;
|
|
101
|
+
old_topoheight: number;
|
|
102
|
+
}
|
|
99
103
|
export interface Transfer {
|
|
100
104
|
amount: number;
|
|
101
105
|
asset: string;
|
|
@@ -255,5 +259,6 @@ export declare enum RPCEvent {
|
|
|
255
259
|
PeerDisconnected = "peer_disconnected",
|
|
256
260
|
PeerStateUpdated = "peer_state_updated",
|
|
257
261
|
PeerPeerListUpdated = "peer_peer_list_updated",
|
|
258
|
-
PeerPeerDisconnected = "peer_peer_disconnected"
|
|
262
|
+
PeerPeerDisconnected = "peer_peer_disconnected",
|
|
263
|
+
BlockOrphaned = "block_orphaned"
|
|
259
264
|
}
|
package/daemon/types.js
CHANGED
|
@@ -50,4 +50,5 @@ export var RPCEvent;
|
|
|
50
50
|
RPCEvent["PeerStateUpdated"] = "peer_state_updated";
|
|
51
51
|
RPCEvent["PeerPeerListUpdated"] = "peer_peer_list_updated";
|
|
52
52
|
RPCEvent["PeerPeerDisconnected"] = "peer_peer_disconnected";
|
|
53
|
+
RPCEvent["BlockOrphaned"] = "block_orphaned";
|
|
53
54
|
})(RPCEvent || (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, GetBalanceResult, HeightRangeParams, BlockOrdered, GetBalanceParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceParams, GetNonceResult, GetAccountHistoryParams, AccounHistory, Peer, PeerPeerListUpdated, PeerPeerDisconnected, DevFee, DiskSize, AssetWithData } from './types';
|
|
2
|
+
import { Block, GetInfoResult, RPCEventResult, Transaction, TopoHeightRangeParams, P2PStatusResult, Balance, GetBalanceAtTopoHeightParams, GetBalanceResult, HeightRangeParams, BlockOrdered, GetBalanceParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceParams, GetNonceResult, GetAccountHistoryParams, AccounHistory, Peer, PeerPeerListUpdated, PeerPeerDisconnected, DevFee, DiskSize, AssetWithData, AssetData, GetAssetParams, HasBalanceParams, HasBalanceResult, IsTxExecutedInBlockParams, BlockOrphaned } 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>>;
|
|
@@ -12,6 +12,7 @@ declare class WS extends BaseWS {
|
|
|
12
12
|
onPeerPeerDisconnected(onData: (msgEvent: MessageEvent, data?: PeerPeerDisconnected & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
13
13
|
onPeerStateUpdated(onData: (msgEvent: MessageEvent, data?: Peer & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
14
14
|
onNewAsset(onData: (msgEvent: MessageEvent, data?: AssetWithData & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
15
|
+
onBlockOrphaned(onData: (msgEvent: MessageEvent, data?: BlockOrphaned & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
|
|
15
16
|
getVersion(): Promise<string>;
|
|
16
17
|
getInfo(): Promise<GetInfoResult>;
|
|
17
18
|
getHeight(): Promise<number>;
|
|
@@ -24,7 +25,9 @@ declare class WS extends BaseWS {
|
|
|
24
25
|
getTopBlock(params: GetTopBlockParams): Promise<Block>;
|
|
25
26
|
getNonce(params: GetNonceParams): Promise<GetNonceResult>;
|
|
26
27
|
getBalance(params: GetBalanceParams): Promise<GetBalanceResult>;
|
|
28
|
+
hasBalance(params: HasBalanceParams): Promise<HasBalanceResult>;
|
|
27
29
|
getBalanceAtTopoHeight(params: GetBalanceAtTopoHeightParams): Promise<Balance>;
|
|
30
|
+
getAsset(params: GetAssetParams): Promise<AssetData>;
|
|
28
31
|
getAssets(): Promise<string[]>;
|
|
29
32
|
countTransactions(): Promise<number>;
|
|
30
33
|
getTips(): Promise<string[]>;
|
|
@@ -44,5 +47,6 @@ declare class WS extends BaseWS {
|
|
|
44
47
|
getPeers(): Promise<Peer[]>;
|
|
45
48
|
getDevFeeThresholds(): Promise<DevFee[]>;
|
|
46
49
|
getSizeOnDisk(): Promise<DiskSize>;
|
|
50
|
+
isTxExecutedInBlock(params: IsTxExecutedInBlockParams): Promise<boolean>;
|
|
47
51
|
}
|
|
48
52
|
export default WS;
|
package/daemon/websocket.js
CHANGED
|
@@ -31,6 +31,9 @@ class WS extends BaseWS {
|
|
|
31
31
|
onNewAsset(onData) {
|
|
32
32
|
return this.listenEvent(RPCEvent.NewAsset, onData);
|
|
33
33
|
}
|
|
34
|
+
onBlockOrphaned(onData) {
|
|
35
|
+
return this.listenEvent(RPCEvent.BlockOrphaned, onData);
|
|
36
|
+
}
|
|
34
37
|
getVersion() {
|
|
35
38
|
return this.dataCall(RPCMethod.GetVersion);
|
|
36
39
|
}
|
|
@@ -67,9 +70,15 @@ class WS extends BaseWS {
|
|
|
67
70
|
getBalance(params) {
|
|
68
71
|
return this.dataCall(RPCMethod.GetBalance, params);
|
|
69
72
|
}
|
|
73
|
+
hasBalance(params) {
|
|
74
|
+
return this.dataCall(RPCMethod.HasBalance, params);
|
|
75
|
+
}
|
|
70
76
|
getBalanceAtTopoHeight(params) {
|
|
71
77
|
return this.dataCall(RPCMethod.GetBalanceAtTopoHeight, params);
|
|
72
78
|
}
|
|
79
|
+
getAsset(params) {
|
|
80
|
+
return this.dataCall(RPCMethod.GetAsset, params);
|
|
81
|
+
}
|
|
73
82
|
getAssets() {
|
|
74
83
|
return this.dataCall(RPCMethod.GetAssets);
|
|
75
84
|
}
|
|
@@ -127,5 +136,8 @@ class WS extends BaseWS {
|
|
|
127
136
|
getSizeOnDisk() {
|
|
128
137
|
return this.dataCall(RPCMethod.GetSizeOnDisk);
|
|
129
138
|
}
|
|
139
|
+
isTxExecutedInBlock(params) {
|
|
140
|
+
return this.dataCall(RPCMethod.IsTxExecutedInBlock, params);
|
|
141
|
+
}
|
|
130
142
|
}
|
|
131
143
|
export default WS;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.5.
|
|
2
|
+
"version": "0.5.16",
|
|
3
3
|
"name": "@xelis/sdk",
|
|
4
4
|
"description": "Xelis software development kit for JS",
|
|
5
5
|
"repository": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "jest",
|
|
12
12
|
"build": "rm -rf ./dist && npx tsc --declaration && cp package.json ./dist && cp README.md ./dist",
|
|
13
|
-
"publish": "cd ./dist && npm publish"
|
|
13
|
+
"publish-npm": "npm run build && cd ./dist && npm publish"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/jest": "^29.4.0",
|
package/wallet/websocket.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WS as BaseWS } from '../lib/websocket';
|
|
2
|
-
import { Transaction } from '../daemon/types';
|
|
2
|
+
import { GetAssetParams, Transaction } from '../daemon/types';
|
|
3
3
|
import { BuildTransactionParams, BuildTransactionResult, GetAddressParams, ListTransactionParams, SplitAddressParams, SplitAddressResult } from './types';
|
|
4
4
|
declare class WS extends BaseWS {
|
|
5
5
|
getVersion(): Promise<string>;
|
|
@@ -7,11 +7,14 @@ declare class WS extends BaseWS {
|
|
|
7
7
|
getNonce(): Promise<number>;
|
|
8
8
|
getTopoheight(): Promise<number>;
|
|
9
9
|
getAddress(params?: GetAddressParams): Promise<string>;
|
|
10
|
+
rescan(): Promise<void>;
|
|
10
11
|
splitAddress(params: SplitAddressParams): Promise<SplitAddressResult>;
|
|
11
12
|
getBalance(asset?: string): Promise<number>;
|
|
12
13
|
getTrackedAssets(): Promise<string[]>;
|
|
14
|
+
getAssetPrecision(params: GetAssetParams): Promise<number>;
|
|
13
15
|
getTransaction(hash: string): Promise<Transaction>;
|
|
14
16
|
buildTransaction(params: BuildTransactionParams): Promise<BuildTransactionResult>;
|
|
15
17
|
listTransactions(params?: ListTransactionParams): Promise<Transaction[]>;
|
|
18
|
+
isOnline(): Promise<boolean>;
|
|
16
19
|
}
|
|
17
20
|
export default WS;
|
package/wallet/websocket.js
CHANGED
|
@@ -16,6 +16,9 @@ class WS extends BaseWS {
|
|
|
16
16
|
getAddress(params) {
|
|
17
17
|
return this.dataCall(RPCMethod.GetAddress, params);
|
|
18
18
|
}
|
|
19
|
+
rescan() {
|
|
20
|
+
return this.dataCall(RPCMethod.Rescan);
|
|
21
|
+
}
|
|
19
22
|
splitAddress(params) {
|
|
20
23
|
return this.dataCall(RPCMethod.SplitAddress, params);
|
|
21
24
|
}
|
|
@@ -25,6 +28,9 @@ class WS extends BaseWS {
|
|
|
25
28
|
getTrackedAssets() {
|
|
26
29
|
return this.dataCall(RPCMethod.GetTrackedAssets);
|
|
27
30
|
}
|
|
31
|
+
getAssetPrecision(params) {
|
|
32
|
+
return this.dataCall(RPCMethod.GetAssetPrecision, params);
|
|
33
|
+
}
|
|
28
34
|
getTransaction(hash) {
|
|
29
35
|
return this.dataCall(RPCMethod.GetTransaction, { hash });
|
|
30
36
|
}
|
|
@@ -34,5 +40,8 @@ class WS extends BaseWS {
|
|
|
34
40
|
listTransactions(params) {
|
|
35
41
|
return this.dataCall(RPCMethod.GetTransaction, params);
|
|
36
42
|
}
|
|
43
|
+
isOnline() {
|
|
44
|
+
return this.dataCall(RPCMethod.IsOnline);
|
|
45
|
+
}
|
|
37
46
|
}
|
|
38
47
|
export default WS;
|