@xelis/sdk 0.5.4 → 0.5.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.
- package/daemon/rpc.d.ts +3 -1
- package/daemon/rpc.js +6 -0
- package/daemon/types.d.ts +26 -1
- 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, GetAccountHistoryResult } 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<GetAccountHistoryResult>>;
|
|
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
|
@@ -129,6 +129,29 @@ export interface GetBlockByHashParams {
|
|
|
129
129
|
export interface GetTopBlockParams {
|
|
130
130
|
include_txs?: boolean;
|
|
131
131
|
}
|
|
132
|
+
export interface GetAccountHistoryParams {
|
|
133
|
+
address: string;
|
|
134
|
+
asset?: string;
|
|
135
|
+
minimum_topoheight?: number;
|
|
136
|
+
maximum_topoheight?: number;
|
|
137
|
+
}
|
|
138
|
+
export interface GetAccountHistoryResult {
|
|
139
|
+
topoheight: number;
|
|
140
|
+
block_timestamp: number;
|
|
141
|
+
hash: string;
|
|
142
|
+
mining?: {
|
|
143
|
+
reward: number;
|
|
144
|
+
};
|
|
145
|
+
burn?: {
|
|
146
|
+
amount: number;
|
|
147
|
+
};
|
|
148
|
+
outgoing?: {
|
|
149
|
+
amount: number;
|
|
150
|
+
};
|
|
151
|
+
incoming?: {
|
|
152
|
+
amount: number;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
132
155
|
export declare enum RPCMethod {
|
|
133
156
|
GetVersion = "get_version",
|
|
134
157
|
GetInfo = "get_info",
|
|
@@ -157,7 +180,9 @@ export declare enum RPCMethod {
|
|
|
157
180
|
GetAccounts = "get_accounts",
|
|
158
181
|
SubmitBlock = "submit_block",
|
|
159
182
|
SubmitTransaction = "submit_transaction",
|
|
160
|
-
CountAccounts = "count_accounts"
|
|
183
|
+
CountAccounts = "count_accounts",
|
|
184
|
+
GetAccountHistory = "get_account_history",
|
|
185
|
+
GetAccountAssets = "get_account_assets"
|
|
161
186
|
}
|
|
162
187
|
export declare enum RPCEvent {
|
|
163
188
|
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, GetAccountHistoryResult } 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<GetAccountHistoryResult>;
|
|
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