@xelis/sdk 0.5.4 → 0.5.6
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 +3 -1
- package/daemon/rpc.js +6 -0
- package/daemon/types.d.ts +28 -6
- package/daemon/types.js +2 -0
- package/daemon/websocket.d.ts +3 -1
- package/daemon/websocket.js +6 -0
- package/package.json +1 -1
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 } from './types';
|
|
1
|
+
import { Balance, Block, TopoHeightRangeParams, GetInfoResult, HeightRangeParams, GetLastBalanceResult, P2PStatusResult, Transaction, GetLastBalanceParams, GetBalanceAtTopoHeightParams, GetAccountsParams, GetBlockAtTopoHeightParams, GetBlockByHashParams, GetBlocksAtHeightParams, GetTopBlockParams, GetNonceResult, GetNonceParams, GetAccountHistoryParams, AccounHistory } 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,5 +29,7 @@ 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<AccounHistory[]>>;
|
|
33
|
+
getAccountAssets(address: string): Promise<import("../lib/types").RPCResponse<string[]>>;
|
|
32
34
|
}
|
|
33
35
|
export default RPC;
|
package/daemon/rpc.js
CHANGED
|
@@ -85,5 +85,11 @@ class RPC extends BaseRPC {
|
|
|
85
85
|
submitTransaction(hexData) {
|
|
86
86
|
return this.post(RPCMethod.SubmitTransaction, { data: hexData });
|
|
87
87
|
}
|
|
88
|
+
getAccountHistory(params) {
|
|
89
|
+
return this.post(RPCMethod.GetAccountHistory, params);
|
|
90
|
+
}
|
|
91
|
+
getAccountAssets(address) {
|
|
92
|
+
return this.post(RPCMethod.GetAccountAssets, { address });
|
|
93
|
+
}
|
|
88
94
|
}
|
|
89
95
|
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;
|
|
@@ -129,6 +126,29 @@ export interface GetBlockByHashParams {
|
|
|
129
126
|
export interface GetTopBlockParams {
|
|
130
127
|
include_txs?: boolean;
|
|
131
128
|
}
|
|
129
|
+
export interface GetAccountHistoryParams {
|
|
130
|
+
address: string;
|
|
131
|
+
asset?: string;
|
|
132
|
+
minimum_topoheight?: number;
|
|
133
|
+
maximum_topoheight?: number;
|
|
134
|
+
}
|
|
135
|
+
export interface AccounHistory {
|
|
136
|
+
topoheight: number;
|
|
137
|
+
block_timestamp: number;
|
|
138
|
+
hash: string;
|
|
139
|
+
mining?: {
|
|
140
|
+
reward: number;
|
|
141
|
+
};
|
|
142
|
+
burn?: {
|
|
143
|
+
amount: number;
|
|
144
|
+
};
|
|
145
|
+
outgoing?: {
|
|
146
|
+
amount: number;
|
|
147
|
+
};
|
|
148
|
+
incoming?: {
|
|
149
|
+
amount: number;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
132
152
|
export declare enum RPCMethod {
|
|
133
153
|
GetVersion = "get_version",
|
|
134
154
|
GetInfo = "get_info",
|
|
@@ -157,7 +177,9 @@ export declare enum RPCMethod {
|
|
|
157
177
|
GetAccounts = "get_accounts",
|
|
158
178
|
SubmitBlock = "submit_block",
|
|
159
179
|
SubmitTransaction = "submit_transaction",
|
|
160
|
-
CountAccounts = "count_accounts"
|
|
180
|
+
CountAccounts = "count_accounts",
|
|
181
|
+
GetAccountHistory = "get_account_history",
|
|
182
|
+
GetAccountAssets = "get_account_assets"
|
|
161
183
|
}
|
|
162
184
|
export declare enum RPCEvent {
|
|
163
185
|
NewBlock = "NewBlock",
|
package/daemon/types.js
CHANGED
|
@@ -28,6 +28,8 @@ export var RPCMethod;
|
|
|
28
28
|
RPCMethod["SubmitBlock"] = "submit_block";
|
|
29
29
|
RPCMethod["SubmitTransaction"] = "submit_transaction";
|
|
30
30
|
RPCMethod["CountAccounts"] = "count_accounts";
|
|
31
|
+
RPCMethod["GetAccountHistory"] = "get_account_history";
|
|
32
|
+
RPCMethod["GetAccountAssets"] = "get_account_assets";
|
|
31
33
|
})(RPCMethod || (RPCMethod = {}));
|
|
32
34
|
export var RPCEvent;
|
|
33
35
|
(function (RPCEvent) {
|
package/daemon/websocket.d.ts
CHANGED
|
@@ -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 } 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 } 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,5 +33,7 @@ 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<AccounHistory[]>;
|
|
37
|
+
getAccountAssets(address: string): Promise<string[]>;
|
|
36
38
|
}
|
|
37
39
|
export default WS;
|
package/daemon/websocket.js
CHANGED
|
@@ -94,5 +94,11 @@ class WS extends BaseWS {
|
|
|
94
94
|
countAccounts() {
|
|
95
95
|
return this.dataCall(RPCMethod.CountAccounts);
|
|
96
96
|
}
|
|
97
|
+
getAccountHistory(params) {
|
|
98
|
+
return this.dataCall(RPCMethod.GetAccountHistory, params);
|
|
99
|
+
}
|
|
100
|
+
getAccountAssets(address) {
|
|
101
|
+
return this.dataCall(RPCMethod.GetAccountAssets, { address });
|
|
102
|
+
}
|
|
97
103
|
}
|
|
98
104
|
export default WS;
|
package/package.json
CHANGED