@xelis/sdk 0.5.12 → 0.5.14

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, AccounHistory, Peer, DevFee, DiskSize } from './types';
1
+ import { Balance, Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetBalanceResult, P2PStatusResult, Transaction, GetBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceResult, GetNonceParams, GetAccountHistoryParams, AccounHistory, Peer, DevFee, DiskSize, HasBalanceParams, HasBalanceResult, AssetData, IsTxExecutedInBlockParams, GetAssetParams } 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>>;
@@ -12,8 +12,10 @@ declare class RPC extends BaseRPC {
12
12
  getBlockByHash(params: GetBlockByHashParams): Promise<import("../lib/types").RPCResponse<Block>>;
13
13
  getTopBlock(params: GetTopBlockParams): Promise<import("../lib/types").RPCResponse<Block>>;
14
14
  getNonce(params: GetNonceParams): Promise<import("../lib/types").RPCResponse<GetNonceResult>>;
15
- getLastBalance(params: GetLastBalanceParams): Promise<import("../lib/types").RPCResponse<GetLastBalanceResult>>;
15
+ getBalance(params: GetBalanceParams): Promise<import("../lib/types").RPCResponse<GetBalanceResult>>;
16
+ hasBalance(params: HasBalanceParams): Promise<import("../lib/types").RPCResponse<HasBalanceResult>>;
16
17
  getBalanceAtTopoHeight(params: GetBalanceAtTopoHeightParams): Promise<import("../lib/types").RPCResponse<Balance>>;
18
+ getAsset(params: GetAssetParams): Promise<import("../lib/types").RPCResponse<AssetData>>;
17
19
  getAssets(): Promise<import("../lib/types").RPCResponse<string[]>>;
18
20
  countTransactions(): Promise<import("../lib/types").RPCResponse<number>>;
19
21
  countAssets(): Promise<import("../lib/types").RPCResponse<number>>;
@@ -34,5 +36,6 @@ declare class RPC extends BaseRPC {
34
36
  getPeers(): Promise<import("../lib/types").RPCResponse<Peer[]>>;
35
37
  getDevFeeThresholds(): Promise<import("../lib/types").RPCResponse<DevFee[]>>;
36
38
  getSizeOnDisk(): Promise<import("../lib/types").RPCResponse<DiskSize>>;
39
+ isTxExecutedInBlock(params: IsTxExecutedInBlockParams): Promise<import("../lib/types").RPCResponse<boolean>>;
37
40
  }
38
41
  export default RPC;
package/daemon/rpc.js CHANGED
@@ -34,12 +34,18 @@ class RPC extends BaseRPC {
34
34
  getNonce(params) {
35
35
  return this.post(RPCMethod.GetNonce, params);
36
36
  }
37
- getLastBalance(params) {
38
- return this.post(RPCMethod.GetLastBalance, params);
37
+ getBalance(params) {
38
+ return this.post(RPCMethod.GetBalance, params);
39
+ }
40
+ hasBalance(params) {
41
+ return this.post(RPCMethod.HasBalance, params);
39
42
  }
40
43
  getBalanceAtTopoHeight(params) {
41
44
  return this.post(RPCMethod.GetBalanceAtTopoHeight, params);
42
45
  }
46
+ getAsset(params) {
47
+ return this.post(RPCMethod.GetAsset, params);
48
+ }
43
49
  getAssets() {
44
50
  return this.post(RPCMethod.GetAssets);
45
51
  }
@@ -100,5 +106,8 @@ class RPC extends BaseRPC {
100
106
  getSizeOnDisk() {
101
107
  return this.post(RPCMethod.GetSizeOnDisk);
102
108
  }
109
+ isTxExecutedInBlock(params) {
110
+ return this.post(RPCMethod.IsTxExecutedInBlock, params);
111
+ }
103
112
  }
104
113
  export default RPC;
package/daemon/types.d.ts CHANGED
@@ -30,7 +30,7 @@ export interface Block {
30
30
  txs_hashes: string[];
31
31
  version: number;
32
32
  }
33
- export interface GetLastBalanceParams {
33
+ export interface GetBalanceParams {
34
34
  address: string;
35
35
  asset: string;
36
36
  }
@@ -52,9 +52,9 @@ export interface Balance {
52
52
  balance: number;
53
53
  previous_topoheight: number;
54
54
  }
55
- export interface GetLastBalanceResult {
55
+ export interface GetBalanceResult {
56
+ version: Balance;
56
57
  topoheight: number;
57
- balance: Balance;
58
58
  }
59
59
  export interface P2PStatusResult {
60
60
  peer_count: number;
@@ -184,11 +184,27 @@ export interface DiskSize {
184
184
  size_formatted: string;
185
185
  }
186
186
  export interface AssetData {
187
+ topoheight: number;
188
+ decimals: number;
189
+ }
190
+ export interface AssetWithData {
191
+ asset: string;
192
+ data: AssetData;
193
+ }
194
+ export interface HasBalanceParams {
195
+ address: string;
196
+ asset: string;
197
+ topoheight: number;
198
+ }
199
+ export interface HasBalanceResult {
200
+ exists: boolean;
201
+ }
202
+ export interface IsTxExecutedInBlockParams {
203
+ tx_hash: string;
204
+ block_hash: string;
205
+ }
206
+ export interface GetAssetParams {
187
207
  asset: string;
188
- data: {
189
- topoheight: number;
190
- decimals: number;
191
- };
192
208
  }
193
209
  export declare enum RPCMethod {
194
210
  GetVersion = "get_version",
@@ -202,8 +218,10 @@ export declare enum RPCMethod {
202
218
  GetBlockByHash = "get_block_by_hash",
203
219
  GetTopBlock = "get_top_block",
204
220
  GetNonce = "get_nonce",
205
- GetLastBalance = "get_last_balance",
221
+ GetBalance = "get_balance",
222
+ HasBalance = "has_balance",
206
223
  GetBalanceAtTopoHeight = "get_balance_at_topoheight",
224
+ GetAsset = "get_asset",
207
225
  GetAssets = "get_assets",
208
226
  CountAssets = "count_assets",
209
227
  CountTransactions = "count_transactions",
@@ -223,7 +241,8 @@ export declare enum RPCMethod {
223
241
  GetAccountAssets = "get_account_assets",
224
242
  GetPeers = "get_peers",
225
243
  GetDevFeeThresholds = "get_dev_fee_thresholds",
226
- GetSizeOnDisk = "get_size_on_disk"
244
+ GetSizeOnDisk = "get_size_on_disk",
245
+ IsTxExecutedInBlock = "is_tx_executed_in_block"
227
246
  }
228
247
  export declare enum RPCEvent {
229
248
  NewBlock = "new_block",
package/daemon/types.js CHANGED
@@ -11,8 +11,10 @@ export var RPCMethod;
11
11
  RPCMethod["GetBlockByHash"] = "get_block_by_hash";
12
12
  RPCMethod["GetTopBlock"] = "get_top_block";
13
13
  RPCMethod["GetNonce"] = "get_nonce";
14
- RPCMethod["GetLastBalance"] = "get_last_balance";
14
+ RPCMethod["GetBalance"] = "get_balance";
15
+ RPCMethod["HasBalance"] = "has_balance";
15
16
  RPCMethod["GetBalanceAtTopoHeight"] = "get_balance_at_topoheight";
17
+ RPCMethod["GetAsset"] = "get_asset";
16
18
  RPCMethod["GetAssets"] = "get_assets";
17
19
  RPCMethod["CountAssets"] = "count_assets";
18
20
  RPCMethod["CountTransactions"] = "count_transactions";
@@ -33,6 +35,7 @@ export var RPCMethod;
33
35
  RPCMethod["GetPeers"] = "get_peers";
34
36
  RPCMethod["GetDevFeeThresholds"] = "get_dev_fee_thresholds";
35
37
  RPCMethod["GetSizeOnDisk"] = "get_size_on_disk";
38
+ RPCMethod["IsTxExecutedInBlock"] = "is_tx_executed_in_block";
36
39
  })(RPCMethod || (RPCMethod = {}));
37
40
  export var RPCEvent;
38
41
  (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, AccounHistory, Peer, PeerPeerListUpdated, PeerPeerDisconnected, DevFee, DiskSize, AssetData } 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 } 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>>;
@@ -11,7 +11,7 @@ declare class WS extends BaseWS {
11
11
  onPeerPeerListUpdated(onData: (msgEvent: MessageEvent, data?: PeerPeerListUpdated & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
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
- onNewAsset(onData: (msgEvent: MessageEvent, data?: AssetData & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
14
+ onNewAsset(onData: (msgEvent: MessageEvent, data?: AssetWithData & RPCEventResult, err?: Error) => void): Promise<() => Promise<void>>;
15
15
  getVersion(): Promise<string>;
16
16
  getInfo(): Promise<GetInfoResult>;
17
17
  getHeight(): Promise<number>;
@@ -23,7 +23,7 @@ declare class WS extends BaseWS {
23
23
  getBlockByHash(params: GetBlockByHashParams): Promise<Block>;
24
24
  getTopBlock(params: GetTopBlockParams): Promise<Block>;
25
25
  getNonce(params: GetNonceParams): Promise<GetNonceResult>;
26
- getLastBalance(params: GetLastBalanceParams): Promise<GetLastBalanceResult>;
26
+ getBalance(params: GetBalanceParams): Promise<GetBalanceResult>;
27
27
  getBalanceAtTopoHeight(params: GetBalanceAtTopoHeightParams): Promise<Balance>;
28
28
  getAssets(): Promise<string[]>;
29
29
  countTransactions(): Promise<number>;
@@ -64,8 +64,8 @@ class WS extends BaseWS {
64
64
  getNonce(params) {
65
65
  return this.dataCall(RPCMethod.GetNonce, params);
66
66
  }
67
- getLastBalance(params) {
68
- return this.dataCall(RPCMethod.GetLastBalance, params);
67
+ getBalance(params) {
68
+ return this.dataCall(RPCMethod.GetBalance, params);
69
69
  }
70
70
  getBalanceAtTopoHeight(params) {
71
71
  return this.dataCall(RPCMethod.GetBalanceAtTopoHeight, params);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.5.12",
2
+ "version": "0.5.14",
3
3
  "name": "@xelis/sdk",
4
4
  "description": "Xelis software development kit for JS",
5
5
  "repository": {
package/wallet/rpc.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Transaction } from '../daemon/types';
1
+ import { Transaction, GetAssetParams } from '../daemon/types';
2
2
  import { GetAddressParams, SplitAddressParams, SplitAddressResult, BuildTransactionParams, BuildTransactionResult, ListTransactionParams } from './types';
3
3
  import { RPC as BaseRPC } from '../lib/rpc';
4
4
  declare class RPC extends BaseRPC {
@@ -6,11 +6,14 @@ declare class RPC extends BaseRPC {
6
6
  getNonce(): Promise<import("../lib/types").RPCResponse<number>>;
7
7
  getTopoheight(): Promise<import("../lib/types").RPCResponse<number>>;
8
8
  getAddress(params?: GetAddressParams): Promise<import("../lib/types").RPCResponse<string>>;
9
+ rescan(): Promise<import("../lib/types").RPCResponse<void>>;
9
10
  splitAddress(params: SplitAddressParams): Promise<import("../lib/types").RPCResponse<SplitAddressResult>>;
10
11
  getBalance(asset?: string): Promise<import("../lib/types").RPCResponse<number>>;
11
12
  getTrackedAssets(): Promise<import("../lib/types").RPCResponse<string[]>>;
13
+ getAssetPrecision(params: GetAssetParams): Promise<import("../lib/types").RPCResponse<number>>;
12
14
  getTransaction(hash: string): Promise<import("../lib/types").RPCResponse<Transaction>>;
13
15
  buildTransaction(params: BuildTransactionParams): Promise<import("../lib/types").RPCResponse<BuildTransactionResult>>;
14
16
  listTransactions(params?: ListTransactionParams): Promise<import("../lib/types").RPCResponse<Transaction[]>>;
17
+ isOnline(): Promise<import("../lib/types").RPCResponse<boolean>>;
15
18
  }
16
19
  export default RPC;
package/wallet/rpc.js CHANGED
@@ -13,6 +13,9 @@ class RPC extends BaseRPC {
13
13
  getAddress(params) {
14
14
  return this.post(RPCMethod.GetAddress, params);
15
15
  }
16
+ rescan() {
17
+ return this.post(RPCMethod.Rescan);
18
+ }
16
19
  splitAddress(params) {
17
20
  return this.post(RPCMethod.SplitAddress, params);
18
21
  }
@@ -22,6 +25,9 @@ class RPC extends BaseRPC {
22
25
  getTrackedAssets() {
23
26
  return this.post(RPCMethod.GetTrackedAssets);
24
27
  }
28
+ getAssetPrecision(params) {
29
+ return this.post(RPCMethod.GetAssetPrecision, params);
30
+ }
25
31
  getTransaction(hash) {
26
32
  return this.post(RPCMethod.GetTransaction, { hash });
27
33
  }
@@ -31,5 +37,8 @@ class RPC extends BaseRPC {
31
37
  listTransactions(params) {
32
38
  return this.post(RPCMethod.ListTransactions, params);
33
39
  }
40
+ isOnline() {
41
+ return this.post(RPCMethod.IsOnline);
42
+ }
34
43
  }
35
44
  export default RPC;
package/wallet/types.d.ts CHANGED
@@ -34,9 +34,14 @@ export declare enum RPCMethod {
34
34
  GetTopoheight = "get_topoheight",
35
35
  GetAddress = "get_address",
36
36
  SplitAddress = "split_address",
37
+ Rescan = "rescan",
37
38
  GetBalance = "get_balance",
38
39
  GetTrackedAssets = "get_tracked_assets",
40
+ GetAssetPrecision = "get_asset_precision",
39
41
  GetTransaction = "get_transaction",
40
42
  BuildTransaction = "build_transaction",
41
- ListTransactions = "list_transactions"
43
+ ListTransactions = "list_transactions",
44
+ IsOnline = "is_online",
45
+ SignData = "sign_data",
46
+ EstimateFees = "estimate_fees"
42
47
  }
package/wallet/types.js CHANGED
@@ -6,9 +6,14 @@ export var RPCMethod;
6
6
  RPCMethod["GetTopoheight"] = "get_topoheight";
7
7
  RPCMethod["GetAddress"] = "get_address";
8
8
  RPCMethod["SplitAddress"] = "split_address";
9
+ RPCMethod["Rescan"] = "rescan";
9
10
  RPCMethod["GetBalance"] = "get_balance";
10
11
  RPCMethod["GetTrackedAssets"] = "get_tracked_assets";
12
+ RPCMethod["GetAssetPrecision"] = "get_asset_precision";
11
13
  RPCMethod["GetTransaction"] = "get_transaction";
12
14
  RPCMethod["BuildTransaction"] = "build_transaction";
13
15
  RPCMethod["ListTransactions"] = "list_transactions";
16
+ RPCMethod["IsOnline"] = "is_online";
17
+ RPCMethod["SignData"] = "sign_data";
18
+ RPCMethod["EstimateFees"] = "estimate_fees";
14
19
  })(RPCMethod || (RPCMethod = {}));