zano_web3 6.4.0 → 6.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zano_web3",
3
- "version": "6.4.0",
3
+ "version": "6.6.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -17,6 +17,15 @@ interface ConstructorParams {
17
17
  daemonUrl: string;
18
18
  }
19
19
 
20
+ interface GetTxsParams {
21
+ count: number;
22
+ offset: number;
23
+ exclude_mining_txs?: boolean;
24
+ exclude_unconfirmed?: boolean;
25
+ order?: string;
26
+ update_provision_info?: boolean;
27
+ }
28
+
20
29
  class ServerWallet {
21
30
  private walletUrl: string;
22
31
  private daemonUrl: string;
@@ -158,6 +167,23 @@ class ServerWallet {
158
167
  }
159
168
  };
160
169
 
170
+ async getAliasByAddress(address: string) {
171
+ try {
172
+ const response = await this.fetchDaemon("get_alias_by_address", address);
173
+
174
+ if (response.data.result) {
175
+ return response.data.result;
176
+ } else {
177
+ throw new ZanoError(
178
+ `Error fetching alias for address ${address}`,
179
+ "ALIAS_FETCH_ERROR"
180
+ );
181
+ }
182
+ } catch (error) {
183
+ throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR");
184
+ }
185
+ }
186
+
161
187
  async getBalances() {
162
188
  try {
163
189
  const response = await this.fetchWallet("getbalance", {});
@@ -239,6 +265,19 @@ class ServerWallet {
239
265
 
240
266
  return valid;
241
267
  }
268
+
269
+ async getTxs(params: GetTxsParams) {
270
+ const txs = await this.fetchWallet("get_recent_txs_and_info2", {
271
+ "count": params.count,
272
+ "exclude_mining_txs": params.exclude_mining_txs || false,
273
+ "exclude_unconfirmed": params.exclude_unconfirmed || false,
274
+ "offset": params.offset,
275
+ "order": params.order || "FROM_END_TO_BEGIN",
276
+ "update_provision_info": params.update_provision_info || true
277
+ });
278
+
279
+ return txs.data.result;
280
+ }
242
281
  }
243
282
 
244
283