@xelis/sdk 0.11.24 → 0.11.26
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/dist/cjs/daemon/rpc.js +9 -0
- package/dist/cjs/daemon/types.js +5 -1
- package/dist/cjs/daemon/websocket.js +20 -5
- package/dist/cjs/react/daemon.js +2 -2
- package/dist/cjs/rpc/websocket.js +5 -4
- package/dist/cjs/wallet/types.js +3 -0
- package/dist/cjs/wallet/websocket.js +11 -5
- package/dist/esm/daemon/rpc.js +9 -0
- package/dist/esm/daemon/types.js +5 -1
- package/dist/esm/daemon/websocket.js +20 -5
- package/dist/esm/react/daemon.js +2 -2
- package/dist/esm/rpc/websocket.js +5 -4
- package/dist/esm/wallet/types.js +3 -0
- package/dist/esm/wallet/websocket.js +11 -5
- package/dist/types/daemon/rpc.d.ts +3 -0
- package/dist/types/daemon/types.d.ts +30 -4
- package/dist/types/daemon/websocket.d.ts +94 -21
- package/dist/types/rpc/websocket.d.ts +3 -3
- package/dist/types/wallet/types.d.ts +13 -1
- package/dist/types/wallet/websocket.d.ts +46 -10
- package/package.json +1 -1
package/dist/cjs/daemon/rpc.js
CHANGED
|
@@ -127,6 +127,9 @@ class RPC extends http_1.HttpRPC {
|
|
|
127
127
|
getEstimatedFeeRates() {
|
|
128
128
|
return this.request(types_1.RPCMethod.GetEstimatedFeeRates);
|
|
129
129
|
}
|
|
130
|
+
getEstimatedFeePerKB() {
|
|
131
|
+
return this.request(types_1.RPCMethod.GetEstimatedFeePerKB);
|
|
132
|
+
}
|
|
130
133
|
getDAGOrder(params) {
|
|
131
134
|
return this.request(types_1.RPCMethod.GetDAGOrder, params);
|
|
132
135
|
}
|
|
@@ -208,6 +211,12 @@ class RPC extends http_1.HttpRPC {
|
|
|
208
211
|
getContractAssets(params) {
|
|
209
212
|
return this.request(types_1.RPCMethod.GetContractAssets, params);
|
|
210
213
|
}
|
|
214
|
+
getContracts(params) {
|
|
215
|
+
return this.request(types_1.RPCMethod.GetContracts, params);
|
|
216
|
+
}
|
|
217
|
+
getContractDataEntries(params) {
|
|
218
|
+
return this.request(types_1.RPCMethod.GetContractDataEntries, params);
|
|
219
|
+
}
|
|
211
220
|
getP2PBlockPropagation(params) {
|
|
212
221
|
return this.request(types_1.RPCMethod.GetP2PBlockPropagation, params);
|
|
213
222
|
}
|
package/dist/cjs/daemon/types.js
CHANGED
|
@@ -57,6 +57,7 @@ var RPCMethod;
|
|
|
57
57
|
RPCMethod["GetMempoolSummary"] = "get_mempool_summary";
|
|
58
58
|
RPCMethod["GetMempoolCache"] = "get_mempool_cache";
|
|
59
59
|
RPCMethod["GetEstimatedFeeRates"] = "get_estimated_fee_rates";
|
|
60
|
+
RPCMethod["GetEstimatedFeePerKB"] = "get_estimated_fee_per_kb";
|
|
60
61
|
RPCMethod["GetDAGOrder"] = "get_dag_order";
|
|
61
62
|
RPCMethod["GetBlocksRangeByTopoheight"] = "get_blocks_range_by_topoheight";
|
|
62
63
|
RPCMethod["GetBlocksRangeByHeight"] = "get_blocks_range_by_height";
|
|
@@ -84,6 +85,8 @@ var RPCMethod;
|
|
|
84
85
|
RPCMethod["GetContractBalance"] = "get_contract_balance";
|
|
85
86
|
RPCMethod["GetContractBalanceAtTopoheight"] = "get_contract_balance_at_topoheight";
|
|
86
87
|
RPCMethod["GetContractAssets"] = "get_contract_assets";
|
|
88
|
+
RPCMethod["GetContracts"] = "get_contracts";
|
|
89
|
+
RPCMethod["GetContractDataEntries"] = "get_contract_data_entries";
|
|
87
90
|
RPCMethod["GetP2PBlockPropagation"] = "get_p2p_block_propagation";
|
|
88
91
|
RPCMethod["GetBlockTemplate"] = "get_block_template";
|
|
89
92
|
RPCMethod["GetMinerWork"] = "get_miner_work";
|
|
@@ -100,7 +103,8 @@ var RPCEvent;
|
|
|
100
103
|
RPCEvent["TransactionAddedInMempool"] = "transaction_added_in_mempool";
|
|
101
104
|
RPCEvent["TransactionExecuted"] = "transaction_executed";
|
|
102
105
|
RPCEvent["InvokeContract"] = "invoke_contract";
|
|
103
|
-
RPCEvent["
|
|
106
|
+
RPCEvent["ContractTransfers"] = "contract_transfers";
|
|
107
|
+
RPCEvent["InvokeContractError"] = "invoke_contract_error";
|
|
104
108
|
RPCEvent["ContractEvent"] = "contract_event";
|
|
105
109
|
RPCEvent["DeployContract"] = "deploy_contract";
|
|
106
110
|
RPCEvent["NewAsset"] = "new_asset";
|
|
@@ -11,11 +11,17 @@ class DaemonMethods {
|
|
|
11
11
|
dataCall(method, params) {
|
|
12
12
|
return this.ws.dataCall(this.prefix + method, params);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.ws.
|
|
14
|
+
removeListener(event, params, listener) {
|
|
15
|
+
let eventObj = this.prefix + event;
|
|
16
|
+
if (params)
|
|
17
|
+
eventObj = { [eventObj]: params };
|
|
18
|
+
this.ws.removeListener(eventObj, listener);
|
|
19
|
+
}
|
|
20
|
+
addListener(event, params, listener) {
|
|
21
|
+
let eventObj = this.prefix + event;
|
|
22
|
+
if (params)
|
|
23
|
+
eventObj = { [eventObj]: params };
|
|
24
|
+
this.ws.addListener(eventObj, listener);
|
|
19
25
|
}
|
|
20
26
|
getVersion() {
|
|
21
27
|
return this.dataCall(types_1.RPCMethod.GetVersion);
|
|
@@ -140,6 +146,9 @@ class DaemonMethods {
|
|
|
140
146
|
getEstimatedFeeRates() {
|
|
141
147
|
return this.dataCall(types_1.RPCMethod.GetEstimatedFeeRates);
|
|
142
148
|
}
|
|
149
|
+
getEstimatedFeePerKB() {
|
|
150
|
+
return this.dataCall(types_1.RPCMethod.GetEstimatedFeePerKB);
|
|
151
|
+
}
|
|
143
152
|
getDAGOrder(params) {
|
|
144
153
|
return this.dataCall(types_1.RPCMethod.GetDAGOrder, params);
|
|
145
154
|
}
|
|
@@ -221,6 +230,12 @@ class DaemonMethods {
|
|
|
221
230
|
getContractAssets(params) {
|
|
222
231
|
return this.dataCall(types_1.RPCMethod.GetContractAssets, params);
|
|
223
232
|
}
|
|
233
|
+
getContracts(params) {
|
|
234
|
+
return this.dataCall(types_1.RPCMethod.GetContracts, params);
|
|
235
|
+
}
|
|
236
|
+
getContractDataEntries(params) {
|
|
237
|
+
return this.dataCall(types_1.RPCMethod.GetContractDataEntries, params);
|
|
238
|
+
}
|
|
224
239
|
getP2PBlockPropagation(params) {
|
|
225
240
|
return this.dataCall(types_1.RPCMethod.GetP2PBlockPropagation, params);
|
|
226
241
|
}
|
package/dist/cjs/react/daemon.js
CHANGED
|
@@ -94,11 +94,11 @@ const useNodeSocketSubscribe = ({ event, onLoad, onData }, dependencies) => {
|
|
|
94
94
|
return;
|
|
95
95
|
if (typeof onLoad === `function`)
|
|
96
96
|
onLoad();
|
|
97
|
-
nodeSocket.daemon.
|
|
97
|
+
nodeSocket.daemon.addListener(event, onData);
|
|
98
98
|
return () => {
|
|
99
99
|
if (!nodeSocket.daemon)
|
|
100
100
|
return;
|
|
101
|
-
nodeSocket.daemon.
|
|
101
|
+
nodeSocket.daemon.removeListener(event, onData);
|
|
102
102
|
};
|
|
103
103
|
}, [nodeSocket, ...dependencies]);
|
|
104
104
|
};
|
|
@@ -17,7 +17,7 @@ class WSRPC {
|
|
|
17
17
|
this.events = new Map();
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
async
|
|
20
|
+
async removeListener(event, listener) {
|
|
21
21
|
const eventData = this.events.get(event);
|
|
22
22
|
if (eventData) {
|
|
23
23
|
if (eventData.listeners.length > 1) {
|
|
@@ -31,8 +31,8 @@ class WSRPC {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
async
|
|
35
|
-
const listenEvent = () => {
|
|
34
|
+
async addListener(event, listener) {
|
|
35
|
+
const listenEvent = async () => {
|
|
36
36
|
const eventData = this.events.get(event);
|
|
37
37
|
if (eventData) {
|
|
38
38
|
eventData.listeners.push(listener);
|
|
@@ -40,7 +40,8 @@ class WSRPC {
|
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
42
|
let idRefObject = {};
|
|
43
|
-
this.dataCall(`subscribe`, { notify: event }, idRefObject)
|
|
43
|
+
await this.dataCall(`subscribe`, { notify: event }, idRefObject)
|
|
44
|
+
.catch(err => listener(null, err));
|
|
44
45
|
const onMessage = (msgEvent) => {
|
|
45
46
|
const eventData = this.events.get(event);
|
|
46
47
|
if (eventData && typeof msgEvent.data === `string`) {
|
package/dist/cjs/wallet/types.js
CHANGED
|
@@ -77,4 +77,7 @@ var RPCEvent;
|
|
|
77
77
|
RPCEvent["HistorySynced"] = "history_synced";
|
|
78
78
|
RPCEvent["Online"] = "online";
|
|
79
79
|
RPCEvent["Offline"] = "offline";
|
|
80
|
+
RPCEvent["SyncError"] = "sync_error";
|
|
81
|
+
RPCEvent["TrackAsset"] = "track_asset";
|
|
82
|
+
RPCEvent["UntrackAsset"] = "untrack_asset";
|
|
80
83
|
})(RPCEvent = exports.RPCEvent || (exports.RPCEvent = {}));
|
|
@@ -11,11 +11,17 @@ class WalletMethods {
|
|
|
11
11
|
dataCall(method, params) {
|
|
12
12
|
return this.ws.dataCall(this.prefix + method, params);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
this.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.ws.
|
|
14
|
+
removeListener(event, params, listener) {
|
|
15
|
+
let eventObj = this.prefix + event;
|
|
16
|
+
if (params)
|
|
17
|
+
eventObj = { [eventObj]: params };
|
|
18
|
+
this.ws.removeListener(event, listener);
|
|
19
|
+
}
|
|
20
|
+
addListener(event, params, listener) {
|
|
21
|
+
let eventObj = this.prefix + event;
|
|
22
|
+
if (params)
|
|
23
|
+
eventObj = { [eventObj]: params };
|
|
24
|
+
this.ws.addListener(eventObj, listener);
|
|
19
25
|
}
|
|
20
26
|
getVersion() {
|
|
21
27
|
return this.dataCall(types_1.RPCMethod.GetVersion);
|
package/dist/esm/daemon/rpc.js
CHANGED
|
@@ -124,6 +124,9 @@ export class RPC extends HttpRPC {
|
|
|
124
124
|
getEstimatedFeeRates() {
|
|
125
125
|
return this.request(RPCMethod.GetEstimatedFeeRates);
|
|
126
126
|
}
|
|
127
|
+
getEstimatedFeePerKB() {
|
|
128
|
+
return this.request(RPCMethod.GetEstimatedFeePerKB);
|
|
129
|
+
}
|
|
127
130
|
getDAGOrder(params) {
|
|
128
131
|
return this.request(RPCMethod.GetDAGOrder, params);
|
|
129
132
|
}
|
|
@@ -205,6 +208,12 @@ export class RPC extends HttpRPC {
|
|
|
205
208
|
getContractAssets(params) {
|
|
206
209
|
return this.request(RPCMethod.GetContractAssets, params);
|
|
207
210
|
}
|
|
211
|
+
getContracts(params) {
|
|
212
|
+
return this.request(RPCMethod.GetContracts, params);
|
|
213
|
+
}
|
|
214
|
+
getContractDataEntries(params) {
|
|
215
|
+
return this.request(RPCMethod.GetContractDataEntries, params);
|
|
216
|
+
}
|
|
208
217
|
getP2PBlockPropagation(params) {
|
|
209
218
|
return this.request(RPCMethod.GetP2PBlockPropagation, params);
|
|
210
219
|
}
|
package/dist/esm/daemon/types.js
CHANGED
|
@@ -54,6 +54,7 @@ export var RPCMethod;
|
|
|
54
54
|
RPCMethod["GetMempoolSummary"] = "get_mempool_summary";
|
|
55
55
|
RPCMethod["GetMempoolCache"] = "get_mempool_cache";
|
|
56
56
|
RPCMethod["GetEstimatedFeeRates"] = "get_estimated_fee_rates";
|
|
57
|
+
RPCMethod["GetEstimatedFeePerKB"] = "get_estimated_fee_per_kb";
|
|
57
58
|
RPCMethod["GetDAGOrder"] = "get_dag_order";
|
|
58
59
|
RPCMethod["GetBlocksRangeByTopoheight"] = "get_blocks_range_by_topoheight";
|
|
59
60
|
RPCMethod["GetBlocksRangeByHeight"] = "get_blocks_range_by_height";
|
|
@@ -81,6 +82,8 @@ export var RPCMethod;
|
|
|
81
82
|
RPCMethod["GetContractBalance"] = "get_contract_balance";
|
|
82
83
|
RPCMethod["GetContractBalanceAtTopoheight"] = "get_contract_balance_at_topoheight";
|
|
83
84
|
RPCMethod["GetContractAssets"] = "get_contract_assets";
|
|
85
|
+
RPCMethod["GetContracts"] = "get_contracts";
|
|
86
|
+
RPCMethod["GetContractDataEntries"] = "get_contract_data_entries";
|
|
84
87
|
RPCMethod["GetP2PBlockPropagation"] = "get_p2p_block_propagation";
|
|
85
88
|
RPCMethod["GetBlockTemplate"] = "get_block_template";
|
|
86
89
|
RPCMethod["GetMinerWork"] = "get_miner_work";
|
|
@@ -97,7 +100,8 @@ export var RPCEvent;
|
|
|
97
100
|
RPCEvent["TransactionAddedInMempool"] = "transaction_added_in_mempool";
|
|
98
101
|
RPCEvent["TransactionExecuted"] = "transaction_executed";
|
|
99
102
|
RPCEvent["InvokeContract"] = "invoke_contract";
|
|
100
|
-
RPCEvent["
|
|
103
|
+
RPCEvent["ContractTransfers"] = "contract_transfers";
|
|
104
|
+
RPCEvent["InvokeContractError"] = "invoke_contract_error";
|
|
101
105
|
RPCEvent["ContractEvent"] = "contract_event";
|
|
102
106
|
RPCEvent["DeployContract"] = "deploy_contract";
|
|
103
107
|
RPCEvent["NewAsset"] = "new_asset";
|
|
@@ -8,11 +8,17 @@ export class DaemonMethods {
|
|
|
8
8
|
dataCall(method, params) {
|
|
9
9
|
return this.ws.dataCall(this.prefix + method, params);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.ws.
|
|
11
|
+
removeListener(event, params, listener) {
|
|
12
|
+
let eventObj = this.prefix + event;
|
|
13
|
+
if (params)
|
|
14
|
+
eventObj = { [eventObj]: params };
|
|
15
|
+
this.ws.removeListener(eventObj, listener);
|
|
16
|
+
}
|
|
17
|
+
addListener(event, params, listener) {
|
|
18
|
+
let eventObj = this.prefix + event;
|
|
19
|
+
if (params)
|
|
20
|
+
eventObj = { [eventObj]: params };
|
|
21
|
+
this.ws.addListener(eventObj, listener);
|
|
16
22
|
}
|
|
17
23
|
getVersion() {
|
|
18
24
|
return this.dataCall(RPCMethod.GetVersion);
|
|
@@ -137,6 +143,9 @@ export class DaemonMethods {
|
|
|
137
143
|
getEstimatedFeeRates() {
|
|
138
144
|
return this.dataCall(RPCMethod.GetEstimatedFeeRates);
|
|
139
145
|
}
|
|
146
|
+
getEstimatedFeePerKB() {
|
|
147
|
+
return this.dataCall(RPCMethod.GetEstimatedFeePerKB);
|
|
148
|
+
}
|
|
140
149
|
getDAGOrder(params) {
|
|
141
150
|
return this.dataCall(RPCMethod.GetDAGOrder, params);
|
|
142
151
|
}
|
|
@@ -218,6 +227,12 @@ export class DaemonMethods {
|
|
|
218
227
|
getContractAssets(params) {
|
|
219
228
|
return this.dataCall(RPCMethod.GetContractAssets, params);
|
|
220
229
|
}
|
|
230
|
+
getContracts(params) {
|
|
231
|
+
return this.dataCall(RPCMethod.GetContracts, params);
|
|
232
|
+
}
|
|
233
|
+
getContractDataEntries(params) {
|
|
234
|
+
return this.dataCall(RPCMethod.GetContractDataEntries, params);
|
|
235
|
+
}
|
|
221
236
|
getP2PBlockPropagation(params) {
|
|
222
237
|
return this.dataCall(RPCMethod.GetP2PBlockPropagation, params);
|
|
223
238
|
}
|
package/dist/esm/react/daemon.js
CHANGED
|
@@ -64,11 +64,11 @@ export const useNodeSocketSubscribe = ({ event, onLoad, onData }, dependencies)
|
|
|
64
64
|
return;
|
|
65
65
|
if (typeof onLoad === `function`)
|
|
66
66
|
onLoad();
|
|
67
|
-
nodeSocket.daemon.
|
|
67
|
+
nodeSocket.daemon.addListener(event, onData);
|
|
68
68
|
return () => {
|
|
69
69
|
if (!nodeSocket.daemon)
|
|
70
70
|
return;
|
|
71
|
-
nodeSocket.daemon.
|
|
71
|
+
nodeSocket.daemon.removeListener(event, onData);
|
|
72
72
|
};
|
|
73
73
|
}, [nodeSocket, ...dependencies]);
|
|
74
74
|
};
|
|
@@ -11,7 +11,7 @@ export class WSRPC {
|
|
|
11
11
|
this.events = new Map();
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
async
|
|
14
|
+
async removeListener(event, listener) {
|
|
15
15
|
const eventData = this.events.get(event);
|
|
16
16
|
if (eventData) {
|
|
17
17
|
if (eventData.listeners.length > 1) {
|
|
@@ -25,8 +25,8 @@ export class WSRPC {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
async
|
|
29
|
-
const listenEvent = () => {
|
|
28
|
+
async addListener(event, listener) {
|
|
29
|
+
const listenEvent = async () => {
|
|
30
30
|
const eventData = this.events.get(event);
|
|
31
31
|
if (eventData) {
|
|
32
32
|
eventData.listeners.push(listener);
|
|
@@ -34,7 +34,8 @@ export class WSRPC {
|
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
36
|
let idRefObject = {};
|
|
37
|
-
this.dataCall(`subscribe`, { notify: event }, idRefObject)
|
|
37
|
+
await this.dataCall(`subscribe`, { notify: event }, idRefObject)
|
|
38
|
+
.catch(err => listener(null, err));
|
|
38
39
|
const onMessage = (msgEvent) => {
|
|
39
40
|
const eventData = this.events.get(event);
|
|
40
41
|
if (eventData && typeof msgEvent.data === `string`) {
|
package/dist/esm/wallet/types.js
CHANGED
|
@@ -74,4 +74,7 @@ export var RPCEvent;
|
|
|
74
74
|
RPCEvent["HistorySynced"] = "history_synced";
|
|
75
75
|
RPCEvent["Online"] = "online";
|
|
76
76
|
RPCEvent["Offline"] = "offline";
|
|
77
|
+
RPCEvent["SyncError"] = "sync_error";
|
|
78
|
+
RPCEvent["TrackAsset"] = "track_asset";
|
|
79
|
+
RPCEvent["UntrackAsset"] = "untrack_asset";
|
|
77
80
|
})(RPCEvent || (RPCEvent = {}));
|
|
@@ -8,11 +8,17 @@ export class WalletMethods {
|
|
|
8
8
|
dataCall(method, params) {
|
|
9
9
|
return this.ws.dataCall(this.prefix + method, params);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.ws.
|
|
11
|
+
removeListener(event, params, listener) {
|
|
12
|
+
let eventObj = this.prefix + event;
|
|
13
|
+
if (params)
|
|
14
|
+
eventObj = { [eventObj]: params };
|
|
15
|
+
this.ws.removeListener(event, listener);
|
|
16
|
+
}
|
|
17
|
+
addListener(event, params, listener) {
|
|
18
|
+
let eventObj = this.prefix + event;
|
|
19
|
+
if (params)
|
|
20
|
+
eventObj = { [eventObj]: params };
|
|
21
|
+
this.ws.addListener(eventObj, listener);
|
|
16
22
|
}
|
|
17
23
|
getVersion() {
|
|
18
24
|
return this.dataCall(RPCMethod.GetVersion);
|
|
@@ -42,6 +42,7 @@ export declare class RPC extends HttpRPC {
|
|
|
42
42
|
getMempoolSummary(params?: types.GetMempoolParams): Promise<types.GetMempoolSummaryResult>;
|
|
43
43
|
getMempoolCache(address: String): Promise<types.GetMempoolCacheResult>;
|
|
44
44
|
getEstimatedFeeRates(): Promise<types.FeeRatesEstimated>;
|
|
45
|
+
getEstimatedFeePerKB(): Promise<types.PredicatedBaseFeeResult>;
|
|
45
46
|
getDAGOrder(params?: types.TopoheightRangeParams): Promise<string[]>;
|
|
46
47
|
getBlocksRangeByTopoheight(params: types.TopoheightRangeParams): Promise<types.Block[]>;
|
|
47
48
|
getBlocksRangeByHeight(params: types.HeightRangeParams): Promise<types.Block[]>;
|
|
@@ -69,6 +70,8 @@ export declare class RPC extends HttpRPC {
|
|
|
69
70
|
getContractBalance(params: types.GetContractBalanceParams): Promise<types.GetContractBalanceResult>;
|
|
70
71
|
getContractBalanceAtTopoheight(params: types.GetContractBalanceAtTopoheightParams): Promise<types.GetContractBalanceAtTopoheightResult>;
|
|
71
72
|
getContractAssets(params: types.GetContractBalancesParams): Promise<string[]>;
|
|
73
|
+
getContracts(params: types.GetAccountsParams): Promise<string[]>;
|
|
74
|
+
getContractDataEntries(params: types.GetContractDataEntriesParams): Promise<unknown>;
|
|
72
75
|
getP2PBlockPropagation(params: types.GetP2pBlockPropagationParams): Promise<types.P2pBlockPropagationResult>;
|
|
73
76
|
getBlockTemplate(address: string): Promise<types.GetBlockTemplateResult>;
|
|
74
77
|
getMinerWork(params: types.GetMinerWorkParams): Promise<types.GetMinerWorkResult>;
|
|
@@ -358,6 +358,11 @@ export interface AssetData {
|
|
|
358
358
|
export interface AssetWithData extends AssetData {
|
|
359
359
|
asset: string;
|
|
360
360
|
}
|
|
361
|
+
export interface NewAsset {
|
|
362
|
+
asset: string;
|
|
363
|
+
block_hash: string;
|
|
364
|
+
topoheight: number;
|
|
365
|
+
}
|
|
361
366
|
export interface HasBalanceParams {
|
|
362
367
|
address: string;
|
|
363
368
|
asset: string;
|
|
@@ -613,10 +618,16 @@ export interface P2pBlockPropagationResult {
|
|
|
613
618
|
first_seen?: number;
|
|
614
619
|
processing_at?: number;
|
|
615
620
|
}
|
|
616
|
-
export interface
|
|
617
|
-
|
|
618
|
-
|
|
621
|
+
export interface ContractTransfersEntry {
|
|
622
|
+
contract: string;
|
|
623
|
+
caller: string;
|
|
624
|
+
}
|
|
625
|
+
export interface ContractTransfers {
|
|
619
626
|
block_hash: string;
|
|
627
|
+
block_timestamp: number;
|
|
628
|
+
executions: {
|
|
629
|
+
[key: string]: ContractTransfersEntry;
|
|
630
|
+
};
|
|
620
631
|
topoheight: number;
|
|
621
632
|
}
|
|
622
633
|
export interface ContractEventSource {
|
|
@@ -722,6 +733,17 @@ export interface ContractOutputs {
|
|
|
722
733
|
caller: string;
|
|
723
734
|
outputs: ContractLog[];
|
|
724
735
|
}
|
|
736
|
+
export interface PredicatedBaseFeeResult {
|
|
737
|
+
fee_per_kb: number;
|
|
738
|
+
predicated_fee_per_kb: number;
|
|
739
|
+
}
|
|
740
|
+
export interface GetContractDataEntriesParams {
|
|
741
|
+
contract: string;
|
|
742
|
+
minimum_topoheight?: number;
|
|
743
|
+
maximum_topoheight?: number;
|
|
744
|
+
skip?: number;
|
|
745
|
+
maximum?: number;
|
|
746
|
+
}
|
|
725
747
|
export declare enum RPCMethod {
|
|
726
748
|
GetVersion = "get_version",
|
|
727
749
|
GetHeight = "get_height",
|
|
@@ -764,6 +786,7 @@ export declare enum RPCMethod {
|
|
|
764
786
|
GetMempoolSummary = "get_mempool_summary",
|
|
765
787
|
GetMempoolCache = "get_mempool_cache",
|
|
766
788
|
GetEstimatedFeeRates = "get_estimated_fee_rates",
|
|
789
|
+
GetEstimatedFeePerKB = "get_estimated_fee_per_kb",
|
|
767
790
|
GetDAGOrder = "get_dag_order",
|
|
768
791
|
GetBlocksRangeByTopoheight = "get_blocks_range_by_topoheight",
|
|
769
792
|
GetBlocksRangeByHeight = "get_blocks_range_by_height",
|
|
@@ -791,6 +814,8 @@ export declare enum RPCMethod {
|
|
|
791
814
|
GetContractBalance = "get_contract_balance",
|
|
792
815
|
GetContractBalanceAtTopoheight = "get_contract_balance_at_topoheight",
|
|
793
816
|
GetContractAssets = "get_contract_assets",
|
|
817
|
+
GetContracts = "get_contracts",
|
|
818
|
+
GetContractDataEntries = "get_contract_data_entries",
|
|
794
819
|
GetP2PBlockPropagation = "get_p2p_block_propagation",
|
|
795
820
|
GetBlockTemplate = "get_block_template",
|
|
796
821
|
GetMinerWork = "get_miner_work",
|
|
@@ -806,7 +831,8 @@ export declare enum RPCEvent {
|
|
|
806
831
|
TransactionAddedInMempool = "transaction_added_in_mempool",
|
|
807
832
|
TransactionExecuted = "transaction_executed",
|
|
808
833
|
InvokeContract = "invoke_contract",
|
|
809
|
-
|
|
834
|
+
ContractTransfers = "contract_transfers",
|
|
835
|
+
InvokeContractError = "invoke_contract_error",
|
|
810
836
|
ContractEvent = "contract_event",
|
|
811
837
|
DeployContract = "deploy_contract",
|
|
812
838
|
NewAsset = "new_asset",
|
|
@@ -2,33 +2,103 @@ import { RPCEvent } from './types';
|
|
|
2
2
|
import * as types from './types';
|
|
3
3
|
import { WSRPC } from '../rpc/websocket';
|
|
4
4
|
export interface DaemonEventsData {
|
|
5
|
-
[RPCEvent.NewBlock]:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[RPCEvent.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
[RPCEvent.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
[RPCEvent.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[RPCEvent.
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
[RPCEvent.NewBlock]: {
|
|
6
|
+
params: null;
|
|
7
|
+
returnType: types.Block;
|
|
8
|
+
};
|
|
9
|
+
[RPCEvent.BlockOrdered]: {
|
|
10
|
+
params: null;
|
|
11
|
+
returnType: types.BlockOrdered;
|
|
12
|
+
};
|
|
13
|
+
[RPCEvent.BlockOrphaned]: {
|
|
14
|
+
params: null;
|
|
15
|
+
returnType: types.BlockOrphaned;
|
|
16
|
+
};
|
|
17
|
+
[RPCEvent.StableHeightChanged]: {
|
|
18
|
+
params: null;
|
|
19
|
+
returnType: types.StableHeightChanged;
|
|
20
|
+
};
|
|
21
|
+
[RPCEvent.StableTopoHeightChanged]: {
|
|
22
|
+
params: null;
|
|
23
|
+
returnType: types.StableTopoHeightChanged;
|
|
24
|
+
};
|
|
25
|
+
[RPCEvent.TransactionOrphaned]: {
|
|
26
|
+
params: null;
|
|
27
|
+
returnType: types.TransactionResponse;
|
|
28
|
+
};
|
|
29
|
+
[RPCEvent.TransactionAddedInMempool]: {
|
|
30
|
+
params: null;
|
|
31
|
+
returnType: types.MempoolTransactionSummary;
|
|
32
|
+
};
|
|
33
|
+
[RPCEvent.TransactionExecuted]: {
|
|
34
|
+
params: null;
|
|
35
|
+
returnType: types.TransactionExecuted;
|
|
36
|
+
};
|
|
37
|
+
[RPCEvent.InvokeContract]: {
|
|
38
|
+
params: {
|
|
39
|
+
contract: string;
|
|
40
|
+
};
|
|
41
|
+
returnType: types.InvokeContract;
|
|
42
|
+
};
|
|
43
|
+
[RPCEvent.ContractTransfers]: {
|
|
44
|
+
params: {
|
|
45
|
+
address: string;
|
|
46
|
+
};
|
|
47
|
+
returnType: types.ContractTransfers;
|
|
48
|
+
};
|
|
49
|
+
[RPCEvent.InvokeContractError]: {
|
|
50
|
+
params: {
|
|
51
|
+
address: string;
|
|
52
|
+
};
|
|
53
|
+
returnType: null;
|
|
54
|
+
};
|
|
55
|
+
[RPCEvent.ContractEvent]: {
|
|
56
|
+
params: {
|
|
57
|
+
contract: string;
|
|
58
|
+
id: number;
|
|
59
|
+
};
|
|
60
|
+
returnType: types.ContractEvent;
|
|
61
|
+
};
|
|
62
|
+
[RPCEvent.DeployContract]: {
|
|
63
|
+
params: null;
|
|
64
|
+
returnType: types.NewContract;
|
|
65
|
+
};
|
|
66
|
+
[RPCEvent.NewAsset]: {
|
|
67
|
+
params: null;
|
|
68
|
+
returnType: types.NewAsset;
|
|
69
|
+
};
|
|
70
|
+
[RPCEvent.PeerConnected]: {
|
|
71
|
+
params: null;
|
|
72
|
+
returnType: types.Peer;
|
|
73
|
+
};
|
|
74
|
+
[RPCEvent.PeerDisconnected]: {
|
|
75
|
+
params: null;
|
|
76
|
+
returnType: types.Peer;
|
|
77
|
+
};
|
|
78
|
+
[RPCEvent.PeerStateUpdated]: {
|
|
79
|
+
params: null;
|
|
80
|
+
returnType: types.Peer;
|
|
81
|
+
};
|
|
82
|
+
[RPCEvent.PeerPeerListUpdated]: {
|
|
83
|
+
params: null;
|
|
84
|
+
returnType: types.PeerPeerListUpdated;
|
|
85
|
+
};
|
|
86
|
+
[RPCEvent.PeerPeerDisconnected]: {
|
|
87
|
+
params: null;
|
|
88
|
+
returnType: types.PeerPeerDisconnected;
|
|
89
|
+
};
|
|
90
|
+
[RPCEvent.NewBlockTemplate]: {
|
|
91
|
+
params: null;
|
|
92
|
+
returnType: types.GetBlockTemplateResult;
|
|
93
|
+
};
|
|
24
94
|
}
|
|
25
95
|
export declare class DaemonMethods {
|
|
26
96
|
ws: WSRPC;
|
|
27
97
|
prefix: string;
|
|
28
98
|
constructor(ws: WSRPC, prefix?: string);
|
|
29
99
|
dataCall<T>(method: string, params?: any): Promise<T>;
|
|
30
|
-
|
|
31
|
-
|
|
100
|
+
removeListener<K extends keyof DaemonEventsData>(event: K, params: DaemonEventsData[K]["params"], listener: (data?: DaemonEventsData[K]["returnType"], err?: Error) => void): void;
|
|
101
|
+
addListener<K extends keyof DaemonEventsData>(event: K, params: DaemonEventsData[K]["params"], listener: (data?: DaemonEventsData[K]["returnType"], err?: Error) => void): void;
|
|
32
102
|
getVersion(): Promise<string>;
|
|
33
103
|
getHeight(): Promise<number>;
|
|
34
104
|
getTopoheight(): Promise<number>;
|
|
@@ -70,6 +140,7 @@ export declare class DaemonMethods {
|
|
|
70
140
|
getMempoolSummary(params?: types.GetMempoolParams): Promise<types.GetMempoolSummaryResult>;
|
|
71
141
|
getMempoolCache(address: string): Promise<types.GetMempoolCacheResult>;
|
|
72
142
|
getEstimatedFeeRates(): Promise<types.FeeRatesEstimated>;
|
|
143
|
+
getEstimatedFeePerKB(): Promise<types.PredicatedBaseFeeResult>;
|
|
73
144
|
getDAGOrder(params: types.TopoheightRangeParams): Promise<string[]>;
|
|
74
145
|
getBlocksRangeByTopoheight(params: types.TopoheightRangeParams): Promise<types.Block[]>;
|
|
75
146
|
getBlocksRangeByHeight(params: types.HeightRangeParams): Promise<types.Block[]>;
|
|
@@ -97,6 +168,8 @@ export declare class DaemonMethods {
|
|
|
97
168
|
getContractBalance(params: types.GetContractBalanceParams): Promise<types.GetContractBalanceResult>;
|
|
98
169
|
getContractBalanceAtTopoheight(params: types.GetContractBalanceAtTopoheightParams): Promise<types.GetContractBalanceAtTopoheightResult>;
|
|
99
170
|
getContractAssets(params: types.GetContractBalancesParams): Promise<string[]>;
|
|
171
|
+
getContracts(params: types.GetAccountsParams): Promise<string[]>;
|
|
172
|
+
getContractDataEntries(params: types.GetContractDataEntriesParams): Promise<unknown>;
|
|
100
173
|
getP2PBlockPropagation(params: types.GetP2pBlockPropagationParams): Promise<types.P2pBlockPropagationResult>;
|
|
101
174
|
getBlockTemplate(address: string): Promise<string>;
|
|
102
175
|
getMinerWork(params: types.GetMinerWorkParams): Promise<types.GetMinerWorkResult>;
|
|
@@ -15,10 +15,10 @@ export declare class WSRPC {
|
|
|
15
15
|
socket: WebSocket;
|
|
16
16
|
methodIdIncrement: number;
|
|
17
17
|
callTimeout: number;
|
|
18
|
-
events: Map<
|
|
18
|
+
events: Map<any, EventData>;
|
|
19
19
|
constructor(endpoint: string, options?: ClientOptions | ClientRequestArgs);
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
removeListener(event: any, listener: EventDataListener): Promise<void>;
|
|
21
|
+
addListener(event: any, listener: EventDataListener): Promise<void>;
|
|
22
22
|
rawCall<T>(id: number, body: string): Promise<T>;
|
|
23
23
|
dataCall<T>(method: string, params?: any, idRefObj?: IdRefObj): Promise<T>;
|
|
24
24
|
batchCall(requests: RPCRequest[]): Promise<({} | Error)[]>;
|
|
@@ -301,6 +301,15 @@ export interface SearchTransactionResult {
|
|
|
301
301
|
index?: number;
|
|
302
302
|
is_raw_search: boolean;
|
|
303
303
|
}
|
|
304
|
+
export interface SyncError {
|
|
305
|
+
message: string;
|
|
306
|
+
}
|
|
307
|
+
export interface TrackAsset {
|
|
308
|
+
asset: string;
|
|
309
|
+
}
|
|
310
|
+
export interface UntrackAsset {
|
|
311
|
+
asset: string;
|
|
312
|
+
}
|
|
304
313
|
export declare enum RPCMethod {
|
|
305
314
|
GetVersion = "get_version",
|
|
306
315
|
GetNetwork = "get_network",
|
|
@@ -351,5 +360,8 @@ export declare enum RPCEvent {
|
|
|
351
360
|
Rescan = "rescan",
|
|
352
361
|
HistorySynced = "history_synced",
|
|
353
362
|
Online = "online",
|
|
354
|
-
Offline = "offline"
|
|
363
|
+
Offline = "offline",
|
|
364
|
+
SyncError = "sync_error",
|
|
365
|
+
TrackAsset = "track_asset",
|
|
366
|
+
UntrackAsset = "untrack_asset"
|
|
355
367
|
}
|
|
@@ -4,22 +4,58 @@ import { RPCEvent } from './types';
|
|
|
4
4
|
import * as types from './types';
|
|
5
5
|
import { Element } from '../data/element';
|
|
6
6
|
export interface WalletEventsData {
|
|
7
|
-
[RPCEvent.NewTopoheight]:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[RPCEvent.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
[RPCEvent.NewTopoheight]: {
|
|
8
|
+
params: null;
|
|
9
|
+
returnType: types.NewTopoheightResult;
|
|
10
|
+
};
|
|
11
|
+
[RPCEvent.NewAsset]: {
|
|
12
|
+
params: null;
|
|
13
|
+
returnType: daemonTypes.AssetWithData;
|
|
14
|
+
};
|
|
15
|
+
[RPCEvent.NewTransaction]: {
|
|
16
|
+
params: null;
|
|
17
|
+
returnType: types.TransactionEntry;
|
|
18
|
+
};
|
|
19
|
+
[RPCEvent.BalanceChanged]: {
|
|
20
|
+
params: null;
|
|
21
|
+
returnType: types.BalanceChangedResult;
|
|
22
|
+
};
|
|
23
|
+
[RPCEvent.Rescan]: {
|
|
24
|
+
params: null;
|
|
25
|
+
returnType: types.RescanResult;
|
|
26
|
+
};
|
|
27
|
+
[RPCEvent.HistorySynced]: {
|
|
28
|
+
params: null;
|
|
29
|
+
returnType: types.HistorySyncedResult;
|
|
30
|
+
};
|
|
31
|
+
[RPCEvent.Online]: {
|
|
32
|
+
params: null;
|
|
33
|
+
returnType: void;
|
|
34
|
+
};
|
|
35
|
+
[RPCEvent.Offline]: {
|
|
36
|
+
params: null;
|
|
37
|
+
returnType: void;
|
|
38
|
+
};
|
|
39
|
+
[RPCEvent.SyncError]: {
|
|
40
|
+
params: null;
|
|
41
|
+
returnType: types.SyncError;
|
|
42
|
+
};
|
|
43
|
+
[RPCEvent.TrackAsset]: {
|
|
44
|
+
params: null;
|
|
45
|
+
returnType: types.TrackAsset;
|
|
46
|
+
};
|
|
47
|
+
[RPCEvent.UntrackAsset]: {
|
|
48
|
+
params: null;
|
|
49
|
+
returnType: types.UntrackAsset;
|
|
50
|
+
};
|
|
15
51
|
}
|
|
16
52
|
export declare class WalletMethods {
|
|
17
53
|
ws: WSRPC;
|
|
18
54
|
prefix: string;
|
|
19
55
|
constructor(ws: WSRPC, prefix?: string);
|
|
20
56
|
dataCall<T>(method: string, params?: any): Promise<T>;
|
|
21
|
-
|
|
22
|
-
|
|
57
|
+
removeListener<K extends keyof WalletEventsData>(event: K, params: WalletEventsData[K]["params"], listener: (data?: WalletEventsData[K]["returnType"], err?: Error) => void): void;
|
|
58
|
+
addListener<K extends keyof WalletEventsData>(event: K, params: WalletEventsData[K]["params"], listener: (data?: WalletEventsData[K]["returnType"], err?: Error) => void): void;
|
|
23
59
|
getVersion(): Promise<string>;
|
|
24
60
|
getNetwork(): Promise<string>;
|
|
25
61
|
getNonce(): Promise<number>;
|
package/package.json
CHANGED