@xelis/sdk 0.10.2 → 0.10.5

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.
@@ -10,17 +10,17 @@ var ErrInvalidNetworkPrefix = "invalid network prefix (xel or xet)";
10
10
  var Address = /** @class */ (function () {
11
11
  function Address(data, hrp) {
12
12
  this.isMainnet = hrp === PrefixAddress;
13
- this.publicKey = data.splice(0, 32);
14
- var addrType = data.splice(0, 1)[0];
15
- switch (addrType) {
16
- case 0:
17
- this.isIntegrated = false;
18
- break;
13
+ this.publicKey = Array.from(data);
14
+ switch (data[32]) {
19
15
  case 1:
20
16
  this.isIntegrated = true;
21
- var reader = new value_1.ValueReader(new Uint8Array(data));
17
+ var extraData = new Uint8Array(this.publicKey.slice(33));
18
+ var reader = new value_1.ValueReader(extraData);
22
19
  this.extraData = reader.read();
23
20
  break;
21
+ case 0:
22
+ this.isIntegrated = false;
23
+ break;
24
24
  default:
25
25
  throw "invalid address type";
26
26
  }
@@ -131,8 +131,11 @@ var RPC = /** @class */ (function (_super) {
131
131
  RPC.prototype.getPeers = function () {
132
132
  return this.request(types_1.RPCMethod.GetPeers);
133
133
  };
134
- RPC.prototype.getMemPool = function () {
135
- return this.request(types_1.RPCMethod.GetMempool);
134
+ RPC.prototype.getMemPool = function (params) {
135
+ return this.request(types_1.RPCMethod.GetMempool, params);
136
+ };
137
+ RPC.prototype.getMempoolSummary = function (params) {
138
+ return this.request(types_1.RPCMethod.GetMempoolSummary, params);
136
139
  };
137
140
  RPC.prototype.getMempoolCache = function (address) {
138
141
  return this.request(types_1.RPCMethod.GetMempoolCache, { address: address });
@@ -54,6 +54,7 @@ var RPCMethod;
54
54
  RPCMethod["GetPeers"] = "get_peers";
55
55
  RPCMethod["GetMempool"] = "get_mempool";
56
56
  RPCMethod["GetMempoolCache"] = "get_mempool_cache";
57
+ RPCMethod["GetMempoolSummary"] = "get_mempool_summary";
57
58
  RPCMethod["GetEstimatedFeeRates"] = "get_estimated_fee_rates";
58
59
  RPCMethod["GetDAGOrder"] = "get_dag_order";
59
60
  RPCMethod["GetBlocksRangeByTopoheight"] = "get_blocks_range_by_topoheight";
@@ -187,8 +187,11 @@ var DaemonMethods = /** @class */ (function () {
187
187
  DaemonMethods.prototype.getPeers = function () {
188
188
  return this.dataCall(types_1.RPCMethod.GetPeers);
189
189
  };
190
- DaemonMethods.prototype.getMemPool = function () {
191
- return this.dataCall(types_1.RPCMethod.GetMempool);
190
+ DaemonMethods.prototype.getMemPool = function (params) {
191
+ return this.dataCall(types_1.RPCMethod.GetMempool, params);
192
+ };
193
+ DaemonMethods.prototype.getMempoolSummary = function (params) {
194
+ return this.dataCall(types_1.RPCMethod.GetMempoolSummary, params);
192
195
  };
193
196
  DaemonMethods.prototype.getMempoolCache = function (address) {
194
197
  return this.dataCall(types_1.RPCMethod.GetMempoolCache, { address: address });
@@ -8,17 +8,17 @@ var ErrInvalidNetworkPrefix = "invalid network prefix (xel or xet)";
8
8
  var Address = /** @class */ (function () {
9
9
  function Address(data, hrp) {
10
10
  this.isMainnet = hrp === PrefixAddress;
11
- this.publicKey = data.splice(0, 32);
12
- var addrType = data.splice(0, 1)[0];
13
- switch (addrType) {
14
- case 0:
15
- this.isIntegrated = false;
16
- break;
11
+ this.publicKey = Array.from(data);
12
+ switch (data[32]) {
17
13
  case 1:
18
14
  this.isIntegrated = true;
19
- var reader = new ValueReader(new Uint8Array(data));
15
+ var extraData = new Uint8Array(this.publicKey.slice(33));
16
+ var reader = new ValueReader(extraData);
20
17
  this.extraData = reader.read();
21
18
  break;
19
+ case 0:
20
+ this.isIntegrated = false;
21
+ break;
22
22
  default:
23
23
  throw "invalid address type";
24
24
  }
@@ -128,8 +128,11 @@ var RPC = /** @class */ (function (_super) {
128
128
  RPC.prototype.getPeers = function () {
129
129
  return this.request(RPCMethod.GetPeers);
130
130
  };
131
- RPC.prototype.getMemPool = function () {
132
- return this.request(RPCMethod.GetMempool);
131
+ RPC.prototype.getMemPool = function (params) {
132
+ return this.request(RPCMethod.GetMempool, params);
133
+ };
134
+ RPC.prototype.getMempoolSummary = function (params) {
135
+ return this.request(RPCMethod.GetMempoolSummary, params);
133
136
  };
134
137
  RPC.prototype.getMempoolCache = function (address) {
135
138
  return this.request(RPCMethod.GetMempoolCache, { address: address });
@@ -51,6 +51,7 @@ export var RPCMethod;
51
51
  RPCMethod["GetPeers"] = "get_peers";
52
52
  RPCMethod["GetMempool"] = "get_mempool";
53
53
  RPCMethod["GetMempoolCache"] = "get_mempool_cache";
54
+ RPCMethod["GetMempoolSummary"] = "get_mempool_summary";
54
55
  RPCMethod["GetEstimatedFeeRates"] = "get_estimated_fee_rates";
55
56
  RPCMethod["GetDAGOrder"] = "get_dag_order";
56
57
  RPCMethod["GetBlocksRangeByTopoheight"] = "get_blocks_range_by_topoheight";
@@ -184,8 +184,11 @@ var DaemonMethods = /** @class */ (function () {
184
184
  DaemonMethods.prototype.getPeers = function () {
185
185
  return this.dataCall(RPCMethod.GetPeers);
186
186
  };
187
- DaemonMethods.prototype.getMemPool = function () {
188
- return this.dataCall(RPCMethod.GetMempool);
187
+ DaemonMethods.prototype.getMemPool = function (params) {
188
+ return this.dataCall(RPCMethod.GetMempool, params);
189
+ };
190
+ DaemonMethods.prototype.getMempoolSummary = function (params) {
191
+ return this.dataCall(RPCMethod.GetMempoolSummary, params);
189
192
  };
190
193
  DaemonMethods.prototype.getMempoolCache = function (address) {
191
194
  return this.dataCall(RPCMethod.GetMempoolCache, { address: address });
@@ -37,7 +37,8 @@ export declare class RPC extends HttpRPC {
37
37
  isTxExecutedInBlock(params: types.IsTxExecutedInBlockParams): Promise<boolean>;
38
38
  p2pStatus(): Promise<types.P2PStatusResult>;
39
39
  getPeers(): Promise<types.GetPeersResult>;
40
- getMemPool(): Promise<types.TransactionResponse[]>;
40
+ getMemPool(params?: types.GetMempoolParams): Promise<types.GetMempoolResult>;
41
+ getMempoolSummary(params?: types.GetMempoolParams): Promise<types.GetMempoolSummaryResult>;
41
42
  getMempoolCache(address: String): Promise<types.GetMempoolCacheResult>;
42
43
  getEstimatedFeeRates(): Promise<types.FeeRatesEstimated>;
43
44
  getDAGOrder(params?: types.TopoheightRangeParams): Promise<string[]>;
@@ -494,6 +494,25 @@ export interface TransactionResponse extends Transaction {
494
494
  in_mempool: boolean;
495
495
  first_seen?: number;
496
496
  }
497
+ export interface GetMempoolParams {
498
+ maximum?: number;
499
+ skip?: number;
500
+ }
501
+ export interface GetMempoolResult {
502
+ total: number;
503
+ transactions: TransactionResponse[];
504
+ }
505
+ export interface MempoolTransactionSummary {
506
+ hash: string;
507
+ source: string;
508
+ fee: number;
509
+ first_seen: number;
510
+ size: number;
511
+ }
512
+ export interface GetMempoolSummaryResult {
513
+ total: number;
514
+ transactions: MempoolTransactionSummary;
515
+ }
497
516
  export interface StableTopoHeightChanged {
498
517
  previous_stable_topoheight: number;
499
518
  new_stable_topoheight: number;
@@ -551,6 +570,7 @@ export declare enum RPCMethod {
551
570
  GetPeers = "get_peers",
552
571
  GetMempool = "get_mempool",
553
572
  GetMempoolCache = "get_mempool_cache",
573
+ GetMempoolSummary = "get_mempool_summary",
554
574
  GetEstimatedFeeRates = "get_estimated_fee_rates",
555
575
  GetDAGOrder = "get_dag_order",
556
576
  GetBlocksRangeByTopoheight = "get_blocks_range_by_topoheight",
@@ -12,7 +12,7 @@ export declare class DaemonMethods {
12
12
  onStableHeightChanged(onData: (msgEvent: MessageEvent, data?: types.StableHeightChanged & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
13
13
  onStableTopoHeightChanged(onData: (msgEvent: MessageEvent, data?: types.StableTopoHeightChanged & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
14
14
  onTransactionOrphaned(onData: (msgEvent: MessageEvent, data?: types.TransactionResponse & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
15
- onTransactionAddedInMempool(onData: (msgEvent: MessageEvent, data?: types.TransactionResponse & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
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
18
  onDeployContract(onData: (msgEvent: MessageEvent, data?: types.NewContract & types.RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
@@ -59,7 +59,8 @@ export declare class DaemonMethods {
59
59
  isTxExecutedInBlock(params: types.IsTxExecutedInBlockParams): Promise<boolean>;
60
60
  p2pStatus(): Promise<types.P2PStatusResult>;
61
61
  getPeers(): Promise<types.GetPeersResult>;
62
- getMemPool(): Promise<types.TransactionResponse[]>;
62
+ getMemPool(params?: types.GetMempoolParams): Promise<types.GetMempoolResult>;
63
+ getMempoolSummary(params?: types.GetMempoolParams): Promise<types.GetMempoolSummaryResult>;
63
64
  getMempoolCache(address: string): Promise<types.GetMempoolCacheResult>;
64
65
  getEstimatedFeeRates(): Promise<types.FeeRatesEstimated>;
65
66
  getDAGOrder(params: types.TopoheightRangeParams): Promise<string[]>;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.10.2",
2
+ "version": "0.10.5",
3
3
  "name": "@xelis/sdk",
4
4
  "description": "Xelis software development kit for JS",
5
5
  "exports": {
File without changes