@xelis/sdk 0.5.5 → 0.5.7

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 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, GetAccountHistoryResult } from './types';
1
+ import { Balance, Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetLastBalanceResult, P2PStatusResult, Transaction, GetLastBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceResult, GetNonceParams, GetAccountHistoryParams, AccounHistory, Peer } 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>>;
@@ -29,7 +29,8 @@ declare class RPC extends BaseRPC {
29
29
  getAccounts(params: GetAccountsParams): Promise<import("../lib/types").RPCResponse<string[]>>;
30
30
  submitBlock(blockTemplate: string): Promise<import("../lib/types").RPCResponse<boolean>>;
31
31
  submitTransaction(hexData: string): Promise<import("../lib/types").RPCResponse<boolean>>;
32
- getAccountHistory(params: GetAccountHistoryParams): Promise<import("../lib/types").RPCResponse<GetAccountHistoryResult>>;
32
+ getAccountHistory(params: GetAccountHistoryParams): Promise<import("../lib/types").RPCResponse<AccounHistory[]>>;
33
33
  getAccountAssets(address: string): Promise<import("../lib/types").RPCResponse<string[]>>;
34
+ getPeers(): Promise<import("../lib/types").RPCResponse<Peer[]>>;
34
35
  }
35
36
  export default RPC;
package/daemon/rpc.js CHANGED
@@ -91,5 +91,8 @@ class RPC extends BaseRPC {
91
91
  getAccountAssets(address) {
92
92
  return this.post(RPCMethod.GetAccountAssets, { address });
93
93
  }
94
+ getPeers() {
95
+ return this.post(RPCMethod.GetPeers);
96
+ }
94
97
  }
95
98
  export default RPC;
package/daemon/types.d.ts CHANGED
@@ -19,18 +19,15 @@ export interface Block {
19
19
  extra_nonce: string;
20
20
  hash: string;
21
21
  height: number;
22
- miner_tx: {
23
- owner: string;
24
- signature: null;
25
- variant: string;
26
- };
27
22
  miner: string;
28
23
  nonce: number;
29
24
  tips: string[];
30
25
  topoheight: number;
31
26
  total_fees: number;
32
27
  total_size_in_bytes: number;
28
+ transactions?: Transaction[];
33
29
  txs_hashes: string[];
30
+ version: number;
34
31
  }
35
32
  export interface GetLastBalanceParams {
36
33
  address: string;
@@ -77,6 +74,18 @@ export interface HeightRangeParams {
77
74
  export interface RPCEventResult {
78
75
  event: string;
79
76
  }
77
+ export interface Peer {
78
+ addr: string;
79
+ cumulative_difficulty: number;
80
+ height: number;
81
+ id: number;
82
+ last_ping: number;
83
+ pruned_topoheight: number;
84
+ tag: string;
85
+ top_block_hash: string;
86
+ topoheight: number;
87
+ version: string;
88
+ }
80
89
  export interface BlockOrdered {
81
90
  topoheight: number;
82
91
  block_hash: string;
@@ -135,7 +144,7 @@ export interface GetAccountHistoryParams {
135
144
  minimum_topoheight?: number;
136
145
  maximum_topoheight?: number;
137
146
  }
138
- export interface GetAccountHistoryResult {
147
+ export interface AccounHistory {
139
148
  topoheight: number;
140
149
  block_timestamp: number;
141
150
  hash: string;
@@ -182,7 +191,8 @@ export declare enum RPCMethod {
182
191
  SubmitTransaction = "submit_transaction",
183
192
  CountAccounts = "count_accounts",
184
193
  GetAccountHistory = "get_account_history",
185
- GetAccountAssets = "get_account_assets"
194
+ GetAccountAssets = "get_account_assets",
195
+ GetPeers = "get_peers"
186
196
  }
187
197
  export declare enum RPCEvent {
188
198
  NewBlock = "NewBlock",
package/daemon/types.js CHANGED
@@ -30,6 +30,7 @@ export var RPCMethod;
30
30
  RPCMethod["CountAccounts"] = "count_accounts";
31
31
  RPCMethod["GetAccountHistory"] = "get_account_history";
32
32
  RPCMethod["GetAccountAssets"] = "get_account_assets";
33
+ RPCMethod["GetPeers"] = "get_peers";
33
34
  })(RPCMethod || (RPCMethod = {}));
34
35
  export var RPCEvent;
35
36
  (function (RPCEvent) {
@@ -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, GetAccountHistoryResult } 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 } 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>>;
@@ -33,7 +33,8 @@ declare class WS extends BaseWS {
33
33
  submitBlock(blockTemplate: string): Promise<boolean>;
34
34
  submitTransaction(hexData: string): Promise<boolean>;
35
35
  countAccounts(): Promise<number>;
36
- getAccountHistory(params: GetAccountHistoryParams): Promise<GetAccountHistoryResult>;
36
+ getAccountHistory(params: GetAccountHistoryParams): Promise<AccounHistory[]>;
37
37
  getAccountAssets(address: string): Promise<string[]>;
38
+ getPeers(): Promise<Peer[]>;
38
39
  }
39
40
  export default WS;
@@ -100,5 +100,8 @@ class WS extends BaseWS {
100
100
  getAccountAssets(address) {
101
101
  return this.dataCall(RPCMethod.GetAccountAssets, { address });
102
102
  }
103
+ getPeers() {
104
+ return this.dataCall(RPCMethod.GetPeers);
105
+ }
103
106
  }
104
107
  export default WS;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.5",
2
+ "version": "0.5.7",
3
3
  "name": "@xelis/sdk",
4
4
  "description": "Xelis software development kit for JS",
5
5
  "repository": {