@xelis/sdk 0.10.6 → 0.10.9

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.
@@ -212,6 +212,12 @@ var RPC = /** @class */ (function (_super) {
212
212
  RPC.prototype.getContractBalanceAtTopoheight = function (params) {
213
213
  return this.request(types_1.RPCMethod.GetContractBalanceAtTopoheight, params);
214
214
  };
215
+ RPC.prototype.getContractAssets = function (params) {
216
+ return this.request(types_1.RPCMethod.GetContractAssets, params);
217
+ };
218
+ RPC.prototype.getP2PBlockPropagation = function (params) {
219
+ return this.request(types_1.RPCMethod.GetP2PBlockPropagation, params);
220
+ };
215
221
  RPC.prototype.getBlockTemplate = function (address) {
216
222
  return this.request(types_1.RPCMethod.GetBlockTemplate, { address: address });
217
223
  };
@@ -42,8 +42,8 @@ var RPCMethod;
42
42
  RPCMethod["GetAsset"] = "get_asset";
43
43
  RPCMethod["GetAssets"] = "get_assets";
44
44
  RPCMethod["CountAssets"] = "count_assets";
45
- RPCMethod["CountTransactions"] = "count_transactions";
46
45
  RPCMethod["CountAccounts"] = "count_accounts";
46
+ RPCMethod["CountTransactions"] = "count_transactions";
47
47
  RPCMethod["CountContracts"] = "count_contracts";
48
48
  RPCMethod["SubmitTransaction"] = "submit_transaction";
49
49
  RPCMethod["GetTransactionExecutor"] = "get_transaction_executor";
@@ -53,8 +53,8 @@ var RPCMethod;
53
53
  RPCMethod["P2PStatus"] = "p2p_status";
54
54
  RPCMethod["GetPeers"] = "get_peers";
55
55
  RPCMethod["GetMempool"] = "get_mempool";
56
- RPCMethod["GetMempoolCache"] = "get_mempool_cache";
57
56
  RPCMethod["GetMempoolSummary"] = "get_mempool_summary";
57
+ RPCMethod["GetMempoolCache"] = "get_mempool_cache";
58
58
  RPCMethod["GetEstimatedFeeRates"] = "get_estimated_fee_rates";
59
59
  RPCMethod["GetDAGOrder"] = "get_dag_order";
60
60
  RPCMethod["GetBlocksRangeByTopoheight"] = "get_blocks_range_by_topoheight";
@@ -79,6 +79,8 @@ var RPCMethod;
79
79
  RPCMethod["GetContractDataAtTopoheight"] = "get_contract_data_at_topoheight";
80
80
  RPCMethod["GetContractBalance"] = "get_contract_balance";
81
81
  RPCMethod["GetContractBalanceAtTopoheight"] = "get_contract_balance_at_topoheight";
82
+ RPCMethod["GetContractAssets"] = "get_contract_assets";
83
+ RPCMethod["GetP2PBlockPropagation"] = "get_p2p_block_propagation";
82
84
  RPCMethod["GetBlockTemplate"] = "get_block_template";
83
85
  RPCMethod["GetMinerWork"] = "get_miner_work";
84
86
  RPCMethod["SubmitBlock"] = "submit_block";
@@ -94,12 +96,14 @@ var RPCEvent;
94
96
  RPCEvent["TransactionAddedInMempool"] = "transaction_added_in_mempool";
95
97
  RPCEvent["TransactionExecuted"] = "transaction_executed";
96
98
  RPCEvent["InvokeContract"] = "invoke_contract";
99
+ RPCEvent["ContractTransfer"] = "contract_transfer";
100
+ RPCEvent["ContractEvent"] = "contract_event";
97
101
  RPCEvent["DeployContract"] = "deploy_contract";
98
102
  RPCEvent["NewAsset"] = "new_asset";
99
103
  RPCEvent["PeerConnected"] = "peer_connected";
100
104
  RPCEvent["PeerDisconnected"] = "peer_disconnected";
101
- RPCEvent["PeerStateUpdated"] = "peer_state_updated";
102
105
  RPCEvent["PeerPeerListUpdated"] = "peer_peer_list_updated";
106
+ RPCEvent["PeerStateUpdated"] = "peer_state_updated";
103
107
  RPCEvent["PeerPeerDisconnected"] = "peer_peer_disconnected";
104
108
  RPCEvent["NewBlockTemplate"] = "new_block_template";
105
109
  })(RPCEvent = exports.RPCEvent || (exports.RPCEvent = {}));
@@ -55,6 +55,14 @@ var DaemonMethods = /** @class */ (function () {
55
55
  var _a;
56
56
  return this.ws.listenEvent((_a = {}, _a[this.prefix + types_1.RPCEvent.InvokeContract] = { contract: contract }, _a), onData);
57
57
  };
58
+ DaemonMethods.prototype.onContractTransfer = function (address, onData) {
59
+ var _a;
60
+ return this.ws.listenEvent((_a = {}, _a[this.prefix + types_1.RPCEvent.ContractTransfer] = { address: address }, _a), onData);
61
+ };
62
+ DaemonMethods.prototype.onContractEvent = function (contract, id, onData) {
63
+ var _a;
64
+ return this.ws.listenEvent((_a = {}, _a[this.prefix + types_1.RPCEvent.ContractEvent] = { contract: contract, id: id }, _a), onData);
65
+ };
58
66
  DaemonMethods.prototype.onDeployContract = function (onData) {
59
67
  return this.ws.listenEvent(this.prefix + types_1.RPCEvent.DeployContract, onData);
60
68
  };
@@ -268,6 +276,12 @@ var DaemonMethods = /** @class */ (function () {
268
276
  DaemonMethods.prototype.getContractBalanceAtTopoheight = function (params) {
269
277
  return this.dataCall(types_1.RPCMethod.GetContractBalanceAtTopoheight, params);
270
278
  };
279
+ DaemonMethods.prototype.getContractAssets = function (params) {
280
+ return this.dataCall(types_1.RPCMethod.GetContractAssets, params);
281
+ };
282
+ DaemonMethods.prototype.getP2PBlockPropagation = function (params) {
283
+ return this.dataCall(types_1.RPCMethod.GetP2PBlockPropagation, params);
284
+ };
271
285
  DaemonMethods.prototype.getBlockTemplate = function (address) {
272
286
  return this.dataCall(types_1.RPCMethod.GetBlockTemplate, { address: address });
273
287
  };
@@ -133,7 +133,7 @@ var WSRPC = /** @class */ (function () {
133
133
  };
134
134
  WSRPC.prototype.listenEvent = function (event, onData) {
135
135
  return __awaiter(this, void 0, void 0, function () {
136
- var onMessage, eventData, idRefObject, _a, err, _, closeListen;
136
+ var onMessage, eventData, idRefObject, _a, err, _, eventData_1, closeListen;
137
137
  var _this = this;
138
138
  return __generator(this, function (_b) {
139
139
  switch (_b.label) {
@@ -167,6 +167,9 @@ var WSRPC = /** @class */ (function () {
167
167
  eventData.listeners.push(onMessage);
168
168
  return [3 /*break*/, 3];
169
169
  case 1:
170
+ // important if multiple listenEvent are called without await at least we store listener before getting id
171
+ // avoid trying to subscribe the same event multiple times
172
+ this.events.set(event, { listeners: [onMessage] });
170
173
  idRefObject = {};
171
174
  return [4 /*yield*/, (0, await_to_js_1.to)(this.dataCall("subscribe", { notify: event }, idRefObject))];
172
175
  case 2:
@@ -175,7 +178,9 @@ var WSRPC = /** @class */ (function () {
175
178
  this.clearEvent(event);
176
179
  return [2 /*return*/, Promise.reject(err)];
177
180
  }
178
- this.events.set(event, { listeners: [onMessage], id: idRefObject.id });
181
+ eventData_1 = this.events.get(event);
182
+ if (eventData_1)
183
+ eventData_1.id = idRefObject.id;
179
184
  _b.label = 3;
180
185
  case 3:
181
186
  this.socket && this.socket.addEventListener("message", onMessage);
@@ -191,20 +196,16 @@ var WSRPC = /** @class */ (function () {
191
196
  }
192
197
  // no more listener so we unsubscribe from daemon websocket if socket still open
193
198
  if (listeners.length === 0) {
194
- if (_this.socket && _this.socket.readyState === isomorphic_ws_1["default"].OPEN) {
195
- // we use a grace period to unsubscribe (mostly because of react useEffect and avoid unecessary subscribe)
196
- eventData.unsubscribeTimeoutId = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
197
- return __generator(this, function (_a) {
199
+ // we use a grace period to unsubscribe (mostly because of react useEffect and avoid unecessary subscribe)
200
+ eventData.unsubscribeTimeoutId = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
201
+ return __generator(this, function (_a) {
202
+ if (this.socket && this.socket.readyState === isomorphic_ws_1["default"].OPEN) {
198
203
  this.dataCall("unsubscribe", { notify: event });
199
- this.events["delete"](event);
200
- return [2 /*return*/];
201
- });
202
- }); }, _this.unsubscribeSuspense);
203
- }
204
- else {
205
- // socket is closed so we don't send unsubscribe and no grace period delete right away
206
- _this.events["delete"](event);
207
- }
204
+ }
205
+ this.events["delete"](event);
206
+ return [2 /*return*/];
207
+ });
208
+ }); }, _this.unsubscribeSuspense);
208
209
  }
209
210
  }
210
211
  _this.socket && _this.socket.removeEventListener("message", onMessage);
@@ -70,6 +70,12 @@ var RPC = /** @class */ (function (_super) {
70
70
  RPC.prototype.getTransaction = function (hash) {
71
71
  return this.request(types_1.RPCMethod.GetTransaction, { hash: hash });
72
72
  };
73
+ RPC.prototype.searchTransaction = function (hash) {
74
+ return this.request(types_1.RPCMethod.SearchTransaction, { hash: hash });
75
+ };
76
+ RPC.prototype.dumpTransaction = function (hash) {
77
+ return this.request(types_1.RPCMethod.DumpTransaction, { hash: hash });
78
+ };
73
79
  RPC.prototype.buildTransaction = function (params) {
74
80
  return this.request(types_1.RPCMethod.BuildTransaction, params);
75
81
  };
@@ -40,11 +40,13 @@ var RPCMethod;
40
40
  RPCMethod["GetAssets"] = "get_assets";
41
41
  RPCMethod["GetAsset"] = "get_asset";
42
42
  RPCMethod["GetTransaction"] = "get_transaction";
43
+ RPCMethod["SearchTransaction"] = "search_transaction";
44
+ RPCMethod["DumpTransaction"] = "dump_transaction";
43
45
  RPCMethod["BuildTransaction"] = "build_transaction";
44
46
  RPCMethod["BuildTransactionOffline"] = "build_transaction_offline";
45
47
  RPCMethod["BuildUnsignedTransaction"] = "build_unsigned_transaction";
46
- RPCMethod["SignUnsignedTransaction"] = "sign_unsigned_transaction";
47
48
  RPCMethod["FinalizeUnsignedTransaction"] = "finalize_unsigned_transaction";
49
+ RPCMethod["SignUnsignedTransaction"] = "sign_unsigned_transaction";
48
50
  RPCMethod["ClearTxCache"] = "clear_tx_cache";
49
51
  RPCMethod["ListTransactions"] = "list_transactions";
50
52
  RPCMethod["IsOnline"] = "is_online";
@@ -94,6 +94,12 @@ var WalletMethods = /** @class */ (function () {
94
94
  WalletMethods.prototype.getTransaction = function (hash) {
95
95
  return this.dataCall(types_1.RPCMethod.GetTransaction, { hash: hash });
96
96
  };
97
+ WalletMethods.prototype.searchTransaction = function (hash) {
98
+ return this.dataCall(types_1.RPCMethod.SearchTransaction, { hash: hash });
99
+ };
100
+ WalletMethods.prototype.dumpTransaction = function (hash) {
101
+ return this.dataCall(types_1.RPCMethod.DumpTransaction, { hash: hash });
102
+ };
97
103
  WalletMethods.prototype.buildTransaction = function (params) {
98
104
  return this.dataCall(types_1.RPCMethod.BuildTransaction, params);
99
105
  };
@@ -209,6 +209,12 @@ var RPC = /** @class */ (function (_super) {
209
209
  RPC.prototype.getContractBalanceAtTopoheight = function (params) {
210
210
  return this.request(RPCMethod.GetContractBalanceAtTopoheight, params);
211
211
  };
212
+ RPC.prototype.getContractAssets = function (params) {
213
+ return this.request(RPCMethod.GetContractAssets, params);
214
+ };
215
+ RPC.prototype.getP2PBlockPropagation = function (params) {
216
+ return this.request(RPCMethod.GetP2PBlockPropagation, params);
217
+ };
212
218
  RPC.prototype.getBlockTemplate = function (address) {
213
219
  return this.request(RPCMethod.GetBlockTemplate, { address: address });
214
220
  };
@@ -39,8 +39,8 @@ export var RPCMethod;
39
39
  RPCMethod["GetAsset"] = "get_asset";
40
40
  RPCMethod["GetAssets"] = "get_assets";
41
41
  RPCMethod["CountAssets"] = "count_assets";
42
- RPCMethod["CountTransactions"] = "count_transactions";
43
42
  RPCMethod["CountAccounts"] = "count_accounts";
43
+ RPCMethod["CountTransactions"] = "count_transactions";
44
44
  RPCMethod["CountContracts"] = "count_contracts";
45
45
  RPCMethod["SubmitTransaction"] = "submit_transaction";
46
46
  RPCMethod["GetTransactionExecutor"] = "get_transaction_executor";
@@ -50,8 +50,8 @@ export var RPCMethod;
50
50
  RPCMethod["P2PStatus"] = "p2p_status";
51
51
  RPCMethod["GetPeers"] = "get_peers";
52
52
  RPCMethod["GetMempool"] = "get_mempool";
53
- RPCMethod["GetMempoolCache"] = "get_mempool_cache";
54
53
  RPCMethod["GetMempoolSummary"] = "get_mempool_summary";
54
+ RPCMethod["GetMempoolCache"] = "get_mempool_cache";
55
55
  RPCMethod["GetEstimatedFeeRates"] = "get_estimated_fee_rates";
56
56
  RPCMethod["GetDAGOrder"] = "get_dag_order";
57
57
  RPCMethod["GetBlocksRangeByTopoheight"] = "get_blocks_range_by_topoheight";
@@ -76,6 +76,8 @@ export var RPCMethod;
76
76
  RPCMethod["GetContractDataAtTopoheight"] = "get_contract_data_at_topoheight";
77
77
  RPCMethod["GetContractBalance"] = "get_contract_balance";
78
78
  RPCMethod["GetContractBalanceAtTopoheight"] = "get_contract_balance_at_topoheight";
79
+ RPCMethod["GetContractAssets"] = "get_contract_assets";
80
+ RPCMethod["GetP2PBlockPropagation"] = "get_p2p_block_propagation";
79
81
  RPCMethod["GetBlockTemplate"] = "get_block_template";
80
82
  RPCMethod["GetMinerWork"] = "get_miner_work";
81
83
  RPCMethod["SubmitBlock"] = "submit_block";
@@ -91,12 +93,14 @@ export var RPCEvent;
91
93
  RPCEvent["TransactionAddedInMempool"] = "transaction_added_in_mempool";
92
94
  RPCEvent["TransactionExecuted"] = "transaction_executed";
93
95
  RPCEvent["InvokeContract"] = "invoke_contract";
96
+ RPCEvent["ContractTransfer"] = "contract_transfer";
97
+ RPCEvent["ContractEvent"] = "contract_event";
94
98
  RPCEvent["DeployContract"] = "deploy_contract";
95
99
  RPCEvent["NewAsset"] = "new_asset";
96
100
  RPCEvent["PeerConnected"] = "peer_connected";
97
101
  RPCEvent["PeerDisconnected"] = "peer_disconnected";
98
- RPCEvent["PeerStateUpdated"] = "peer_state_updated";
99
102
  RPCEvent["PeerPeerListUpdated"] = "peer_peer_list_updated";
103
+ RPCEvent["PeerStateUpdated"] = "peer_state_updated";
100
104
  RPCEvent["PeerPeerDisconnected"] = "peer_peer_disconnected";
101
105
  RPCEvent["NewBlockTemplate"] = "new_block_template";
102
106
  })(RPCEvent || (RPCEvent = {}));
@@ -52,6 +52,14 @@ var DaemonMethods = /** @class */ (function () {
52
52
  var _a;
53
53
  return this.ws.listenEvent((_a = {}, _a[this.prefix + RPCEvent.InvokeContract] = { contract: contract }, _a), onData);
54
54
  };
55
+ DaemonMethods.prototype.onContractTransfer = function (address, onData) {
56
+ var _a;
57
+ return this.ws.listenEvent((_a = {}, _a[this.prefix + RPCEvent.ContractTransfer] = { address: address }, _a), onData);
58
+ };
59
+ DaemonMethods.prototype.onContractEvent = function (contract, id, onData) {
60
+ var _a;
61
+ return this.ws.listenEvent((_a = {}, _a[this.prefix + RPCEvent.ContractEvent] = { contract: contract, id: id }, _a), onData);
62
+ };
55
63
  DaemonMethods.prototype.onDeployContract = function (onData) {
56
64
  return this.ws.listenEvent(this.prefix + RPCEvent.DeployContract, onData);
57
65
  };
@@ -265,6 +273,12 @@ var DaemonMethods = /** @class */ (function () {
265
273
  DaemonMethods.prototype.getContractBalanceAtTopoheight = function (params) {
266
274
  return this.dataCall(RPCMethod.GetContractBalanceAtTopoheight, params);
267
275
  };
276
+ DaemonMethods.prototype.getContractAssets = function (params) {
277
+ return this.dataCall(RPCMethod.GetContractAssets, params);
278
+ };
279
+ DaemonMethods.prototype.getP2PBlockPropagation = function (params) {
280
+ return this.dataCall(RPCMethod.GetP2PBlockPropagation, params);
281
+ };
268
282
  DaemonMethods.prototype.getBlockTemplate = function (address) {
269
283
  return this.dataCall(RPCMethod.GetBlockTemplate, { address: address });
270
284
  };
@@ -127,7 +127,7 @@ var WSRPC = /** @class */ (function () {
127
127
  };
128
128
  WSRPC.prototype.listenEvent = function (event, onData) {
129
129
  return __awaiter(this, void 0, void 0, function () {
130
- var onMessage, eventData, idRefObject, _a, err, _, closeListen;
130
+ var onMessage, eventData, idRefObject, _a, err, _, eventData_1, closeListen;
131
131
  var _this = this;
132
132
  return __generator(this, function (_b) {
133
133
  switch (_b.label) {
@@ -161,6 +161,9 @@ var WSRPC = /** @class */ (function () {
161
161
  eventData.listeners.push(onMessage);
162
162
  return [3 /*break*/, 3];
163
163
  case 1:
164
+ // important if multiple listenEvent are called without await at least we store listener before getting id
165
+ // avoid trying to subscribe the same event multiple times
166
+ this.events.set(event, { listeners: [onMessage] });
164
167
  idRefObject = {};
165
168
  return [4 /*yield*/, to(this.dataCall("subscribe", { notify: event }, idRefObject))];
166
169
  case 2:
@@ -169,7 +172,9 @@ var WSRPC = /** @class */ (function () {
169
172
  this.clearEvent(event);
170
173
  return [2 /*return*/, Promise.reject(err)];
171
174
  }
172
- this.events.set(event, { listeners: [onMessage], id: idRefObject.id });
175
+ eventData_1 = this.events.get(event);
176
+ if (eventData_1)
177
+ eventData_1.id = idRefObject.id;
173
178
  _b.label = 3;
174
179
  case 3:
175
180
  this.socket && this.socket.addEventListener("message", onMessage);
@@ -185,20 +190,16 @@ var WSRPC = /** @class */ (function () {
185
190
  }
186
191
  // no more listener so we unsubscribe from daemon websocket if socket still open
187
192
  if (listeners.length === 0) {
188
- if (_this.socket && _this.socket.readyState === WebSocket.OPEN) {
189
- // we use a grace period to unsubscribe (mostly because of react useEffect and avoid unecessary subscribe)
190
- eventData.unsubscribeTimeoutId = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
191
- return __generator(this, function (_a) {
193
+ // we use a grace period to unsubscribe (mostly because of react useEffect and avoid unecessary subscribe)
194
+ eventData.unsubscribeTimeoutId = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
195
+ return __generator(this, function (_a) {
196
+ if (this.socket && this.socket.readyState === WebSocket.OPEN) {
192
197
  this.dataCall("unsubscribe", { notify: event });
193
- this.events["delete"](event);
194
- return [2 /*return*/];
195
- });
196
- }); }, _this.unsubscribeSuspense);
197
- }
198
- else {
199
- // socket is closed so we don't send unsubscribe and no grace period delete right away
200
- _this.events["delete"](event);
201
- }
198
+ }
199
+ this.events["delete"](event);
200
+ return [2 /*return*/];
201
+ });
202
+ }); }, _this.unsubscribeSuspense);
202
203
  }
203
204
  }
204
205
  _this.socket && _this.socket.removeEventListener("message", onMessage);
@@ -67,6 +67,12 @@ var RPC = /** @class */ (function (_super) {
67
67
  RPC.prototype.getTransaction = function (hash) {
68
68
  return this.request(RPCMethod.GetTransaction, { hash: hash });
69
69
  };
70
+ RPC.prototype.searchTransaction = function (hash) {
71
+ return this.request(RPCMethod.SearchTransaction, { hash: hash });
72
+ };
73
+ RPC.prototype.dumpTransaction = function (hash) {
74
+ return this.request(RPCMethod.DumpTransaction, { hash: hash });
75
+ };
70
76
  RPC.prototype.buildTransaction = function (params) {
71
77
  return this.request(RPCMethod.BuildTransaction, params);
72
78
  };
@@ -37,11 +37,13 @@ export var RPCMethod;
37
37
  RPCMethod["GetAssets"] = "get_assets";
38
38
  RPCMethod["GetAsset"] = "get_asset";
39
39
  RPCMethod["GetTransaction"] = "get_transaction";
40
+ RPCMethod["SearchTransaction"] = "search_transaction";
41
+ RPCMethod["DumpTransaction"] = "dump_transaction";
40
42
  RPCMethod["BuildTransaction"] = "build_transaction";
41
43
  RPCMethod["BuildTransactionOffline"] = "build_transaction_offline";
42
44
  RPCMethod["BuildUnsignedTransaction"] = "build_unsigned_transaction";
43
- RPCMethod["SignUnsignedTransaction"] = "sign_unsigned_transaction";
44
45
  RPCMethod["FinalizeUnsignedTransaction"] = "finalize_unsigned_transaction";
46
+ RPCMethod["SignUnsignedTransaction"] = "sign_unsigned_transaction";
45
47
  RPCMethod["ClearTxCache"] = "clear_tx_cache";
46
48
  RPCMethod["ListTransactions"] = "list_transactions";
47
49
  RPCMethod["IsOnline"] = "is_online";
@@ -91,6 +91,12 @@ var WalletMethods = /** @class */ (function () {
91
91
  WalletMethods.prototype.getTransaction = function (hash) {
92
92
  return this.dataCall(RPCMethod.GetTransaction, { hash: hash });
93
93
  };
94
+ WalletMethods.prototype.searchTransaction = function (hash) {
95
+ return this.dataCall(RPCMethod.SearchTransaction, { hash: hash });
96
+ };
97
+ WalletMethods.prototype.dumpTransaction = function (hash) {
98
+ return this.dataCall(RPCMethod.DumpTransaction, { hash: hash });
99
+ };
94
100
  WalletMethods.prototype.buildTransaction = function (params) {
95
101
  return this.dataCall(RPCMethod.BuildTransaction, params);
96
102
  };
@@ -64,6 +64,8 @@ export declare class RPC extends HttpRPC {
64
64
  getContractDataAtTopoheight(params: types.GetContractDataAtTopoheightParams): Promise<unknown>;
65
65
  getContractBalance(params: types.GetContractBalanceParams): Promise<types.GetContractBalanceResult>;
66
66
  getContractBalanceAtTopoheight(params: types.GetContractBalanceAtTopoheightParams): Promise<types.GetContractBalanceAtTopoheightResult>;
67
+ getContractAssets(params: types.GetContractBalanceParams): Promise<string[]>;
68
+ getP2PBlockPropagation(params: types.GetP2pBlockPropagationParams): Promise<types.P2pBlockPropagationResult>;
67
69
  getBlockTemplate(address: string): Promise<types.GetBlockTemplateResult>;
68
70
  getMinerWork(params: types.GetMinerWorkParams): Promise<types.GetMinerWorkResult>;
69
71
  submitBlock(params: types.SubmitBlockParams): Promise<boolean>;
@@ -107,9 +107,18 @@ export interface HeightRangeParams {
107
107
  export interface RPCEventResult {
108
108
  event: string;
109
109
  }
110
- export type PeerPeers = {
111
- [addr: string]: `In` | `Out` | `Both`;
112
- };
110
+ export interface TimedDirection {
111
+ in?: {
112
+ received_at: number;
113
+ };
114
+ out?: {
115
+ sent_at: number;
116
+ };
117
+ both?: {
118
+ received_at: number;
119
+ sent_at: number;
120
+ };
121
+ }
113
122
  export interface Peer {
114
123
  id: number;
115
124
  addr: string;
@@ -121,7 +130,9 @@ export interface Peer {
121
130
  height: number;
122
131
  last_ping: number;
123
132
  pruned_topoheight?: number;
124
- peers: PeerPeers;
133
+ peers: {
134
+ [addr: string]: TimedDirection;
135
+ };
125
136
  cumulative_difficulty: string;
126
137
  connected_on: number;
127
138
  }
@@ -531,6 +542,27 @@ export interface NewContract {
531
542
  block_hash: string;
532
543
  topoheight: number;
533
544
  }
545
+ export interface GetP2pBlockPropagationParams {
546
+ hash: string;
547
+ outgoing: boolean;
548
+ incoming: boolean;
549
+ }
550
+ export interface P2pBlockPropagationResult {
551
+ peers: {
552
+ [id: number]: TimedDirection;
553
+ };
554
+ first_seen?: number;
555
+ processing_at?: number;
556
+ }
557
+ export interface ContractTransfer {
558
+ asset: string;
559
+ amount: number;
560
+ block_hash: string;
561
+ topoheight: number;
562
+ }
563
+ export interface ContractEvent {
564
+ data: any;
565
+ }
534
566
  export declare enum RPCMethod {
535
567
  GetVersion = "get_version",
536
568
  GetHeight = "get_height",
@@ -558,8 +590,8 @@ export declare enum RPCMethod {
558
590
  GetAsset = "get_asset",
559
591
  GetAssets = "get_assets",
560
592
  CountAssets = "count_assets",
561
- CountTransactions = "count_transactions",
562
593
  CountAccounts = "count_accounts",
594
+ CountTransactions = "count_transactions",
563
595
  CountContracts = "count_contracts",
564
596
  SubmitTransaction = "submit_transaction",
565
597
  GetTransactionExecutor = "get_transaction_executor",
@@ -569,8 +601,8 @@ export declare enum RPCMethod {
569
601
  P2PStatus = "p2p_status",
570
602
  GetPeers = "get_peers",
571
603
  GetMempool = "get_mempool",
572
- GetMempoolCache = "get_mempool_cache",
573
604
  GetMempoolSummary = "get_mempool_summary",
605
+ GetMempoolCache = "get_mempool_cache",
574
606
  GetEstimatedFeeRates = "get_estimated_fee_rates",
575
607
  GetDAGOrder = "get_dag_order",
576
608
  GetBlocksRangeByTopoheight = "get_blocks_range_by_topoheight",
@@ -595,6 +627,8 @@ export declare enum RPCMethod {
595
627
  GetContractDataAtTopoheight = "get_contract_data_at_topoheight",
596
628
  GetContractBalance = "get_contract_balance",
597
629
  GetContractBalanceAtTopoheight = "get_contract_balance_at_topoheight",
630
+ GetContractAssets = "get_contract_assets",
631
+ GetP2PBlockPropagation = "get_p2p_block_propagation",
598
632
  GetBlockTemplate = "get_block_template",
599
633
  GetMinerWork = "get_miner_work",
600
634
  SubmitBlock = "submit_block"
@@ -609,12 +643,14 @@ export declare enum RPCEvent {
609
643
  TransactionAddedInMempool = "transaction_added_in_mempool",
610
644
  TransactionExecuted = "transaction_executed",
611
645
  InvokeContract = "invoke_contract",
646
+ ContractTransfer = "contract_transfer",
647
+ ContractEvent = "contract_event",
612
648
  DeployContract = "deploy_contract",
613
649
  NewAsset = "new_asset",
614
650
  PeerConnected = "peer_connected",
615
651
  PeerDisconnected = "peer_disconnected",
616
- PeerStateUpdated = "peer_state_updated",
617
652
  PeerPeerListUpdated = "peer_peer_list_updated",
653
+ PeerStateUpdated = "peer_state_updated",
618
654
  PeerPeerDisconnected = "peer_peer_disconnected",
619
655
  NewBlockTemplate = "new_block_template"
620
656
  }
@@ -15,6 +15,8 @@ export declare class DaemonMethods {
15
15
  onTransactionAddedInMempool(onData: (msgEvent: MessageEvent, data?: types.MempoolTransactionSummary & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
16
16
  onTransactionExecuted(onData: (msgEvent: MessageEvent, data?: types.TransactionExecuted & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
17
17
  onInvokeContract(contract: string, onData: (msgEvent: MessageEvent, data?: types.InvokeContract & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
18
+ onContractTransfer(address: string, onData: (msgEvent: MessageEvent, data?: types.ContractTransfer & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
19
+ onContractEvent(contract: string, id: number, onData: (msgEvent: MessageEvent, data?: types.ContractEvent & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
18
20
  onDeployContract(onData: (msgEvent: MessageEvent, data?: types.NewContract & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
19
21
  onNewAsset(onData: (msgEvent: MessageEvent, data?: types.AssetWithData & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
20
22
  onPeerConnected(onData: (msgEvent: MessageEvent, data?: types.Peer & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
@@ -86,6 +88,8 @@ export declare class DaemonMethods {
86
88
  getContractDataAtTopoheight(params: types.GetContractDataAtTopoheightParams): Promise<unknown>;
87
89
  getContractBalance(params: types.GetContractBalanceParams): Promise<types.GetContractBalanceResult>;
88
90
  getContractBalanceAtTopoheight(params: types.GetContractBalanceAtTopoheightParams): Promise<types.GetContractBalanceAtTopoheightResult>;
91
+ getContractAssets(params: types.GetContractBalanceParams): Promise<string[]>;
92
+ getP2PBlockPropagation(params: types.GetP2pBlockPropagationParams): Promise<types.P2pBlockPropagationResult>;
89
93
  getBlockTemplate(address: string): Promise<string>;
90
94
  getMinerWork(params: types.GetMinerWorkParams): Promise<types.GetMinerWorkResult>;
91
95
  submitBlock(params: types.SubmitBlockParams): Promise<boolean>;
@@ -20,6 +20,8 @@ export declare class RPC extends HttpRPC {
20
20
  }>;
21
21
  getAsset(params: daemonTypes.GetAssetParams): Promise<types.Asset>;
22
22
  getTransaction(hash: string): Promise<types.TransactionEntry>;
23
+ searchTransaction(hash: string): Promise<types.SearchTransactionResult>;
24
+ dumpTransaction(hash: string): Promise<string>;
23
25
  buildTransaction(params: types.BuildTransactionParams): Promise<types.TransactionResponse>;
24
26
  buildTransactionOffline(params: types.BuildTransactionOfflineParams): Promise<types.TransactionResponse>;
25
27
  buildUnsignedTransaction(params: types.BuildTransactionParams): Promise<types.UnsignedTransactionResponse>;
@@ -286,6 +286,11 @@ export interface Query extends QueryValue, QueryElement {
286
286
  and?: Query[];
287
287
  or?: Query[];
288
288
  }
289
+ export interface SearchTransactionResult {
290
+ transaction: TransactionEntry;
291
+ index?: number;
292
+ is_raw_search: boolean;
293
+ }
289
294
  export declare enum RPCMethod {
290
295
  GetVersion = "get_version",
291
296
  GetNetwork = "get_network",
@@ -301,11 +306,13 @@ export declare enum RPCMethod {
301
306
  GetAssets = "get_assets",
302
307
  GetAsset = "get_asset",
303
308
  GetTransaction = "get_transaction",
309
+ SearchTransaction = "search_transaction",
310
+ DumpTransaction = "dump_transaction",
304
311
  BuildTransaction = "build_transaction",
305
312
  BuildTransactionOffline = "build_transaction_offline",
306
313
  BuildUnsignedTransaction = "build_unsigned_transaction",
307
- SignUnsignedTransaction = "sign_unsigned_transaction",
308
314
  FinalizeUnsignedTransaction = "finalize_unsigned_transaction",
315
+ SignUnsignedTransaction = "sign_unsigned_transaction",
309
316
  ClearTxCache = "clear_tx_cache",
310
317
  ListTransactions = "list_transactions",
311
318
  IsOnline = "is_online",
@@ -33,6 +33,8 @@ export declare class WalletMethods {
33
33
  }>;
34
34
  getAsset(params: daemonTypes.GetAssetParams): Promise<types.Asset>;
35
35
  getTransaction(hash: string): Promise<types.TransactionEntry>;
36
+ searchTransaction(hash: string): Promise<types.SearchTransactionResult>;
37
+ dumpTransaction(hash: string): Promise<string>;
36
38
  buildTransaction(params: types.BuildTransactionParams): Promise<types.TransactionResponse>;
37
39
  buildTransactionOffline(params: types.BuildTransactionOfflineParams): Promise<types.TransactionResponse>;
38
40
  buildUnsignedTransaction(params: types.BuildTransactionParams): Promise<types.UnsignedTransactionResponse>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.10.6",
2
+ "version": "0.10.9",
3
3
  "name": "@xelis/sdk",
4
4
  "description": "Xelis software development kit for JS",
5
5
  "exports": {