zano_web3 9.2.0 → 9.2.1

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.
@@ -1,380 +1,380 @@
1
- import axios from "axios";
2
- import Big from "big.js";
3
- import {
4
- AuthData,
5
- AliasAuth,
6
- PkeyAuth,
7
- ValidationParams,
8
- BalanceInfo,
9
- TxInfo,
10
- AliasDetails,
11
- } from "./types";
12
-
13
- import { ZANO_ASSET_ID, ZanoError } from "./utils";
14
- import { APIAsset, APIBalance } from "./types";
15
- import forge from "node-forge";
16
-
17
- interface ConstructorParams {
18
- walletUrl: string;
19
- daemonUrl: string;
20
- walletAuthToken?: string;
21
- }
22
-
23
- interface GetTxsParams {
24
- count: number;
25
- offset: number;
26
- exclude_mining_txs?: boolean;
27
- exclude_unconfirmed?: boolean;
28
- order?: string;
29
- update_provision_info?: boolean;
30
- }
31
-
32
- interface JWTPayload {
33
- body_hash: string,
34
- user: string,
35
- salt: string,
36
- exp: number
37
- }
38
-
39
- class ServerWallet {
40
- private walletUrl: string;
41
- private daemonUrl: string;
42
- private walletAuthToken: string;
43
-
44
- constructor(params: ConstructorParams) {
45
- this.walletUrl = params.walletUrl;
46
- this.daemonUrl = params.daemonUrl;
47
- this.walletAuthToken = params.walletAuthToken || "";
48
- }
49
-
50
- private generateRandomString(length: number) {
51
- const bytes = forge.random.getBytesSync(Math.ceil(length / 2));
52
- const hexString = forge.util.bytesToHex(bytes);
53
- return hexString.substring(0, length);
54
- }
55
-
56
- private createJWSToken(payload: JWTPayload, secretStr: string): string {
57
- const header = { alg: "HS256", typ: "JWT" };
58
- const encodedHeader = Buffer.from(JSON.stringify(header))
59
- .toString("base64")
60
- .replace(/=/g, "");
61
- const encodedPayload = Buffer.from(JSON.stringify(payload))
62
- .toString("base64")
63
- .replace(/=/g, "");
64
-
65
- const signature = forge.hmac.create();
66
- signature.start("sha256", secretStr);
67
- signature.update(`${encodedHeader}.${encodedPayload}`);
68
- const encodedSignature = forge.util
69
- .encode64(signature.digest().getBytes())
70
- .replace(/=/g, "");
71
-
72
- return `${encodedHeader}.${encodedPayload}.${encodedSignature}`;
73
- }
74
-
75
-
76
- private generateAccessToken(httpBody: string) {
77
- // Calculate the SHA-256 hash of the HTTP body
78
- const md = forge.md.sha256.create();
79
- md.update(httpBody);
80
- const bodyHash = md.digest().toHex();
81
-
82
- // Example payload
83
- const payload = {
84
- body_hash: bodyHash,
85
- user: "zano_extension",
86
- salt: this.generateRandomString(64),
87
- exp: Math.floor(Date.now() / 1000) + 60, // Expires in 1 minute
88
- };
89
-
90
- return this.createJWSToken(payload, this.walletAuthToken);
91
- }
92
-
93
-
94
- async fetchDaemon(method: string, params: any) {
95
-
96
-
97
- const data = {
98
- jsonrpc: "2.0",
99
- id: 0,
100
- method: method,
101
- params: params,
102
- };
103
-
104
- const headers = {
105
- "Content-Type": "application/json",
106
- "Zano-Access-Token": this.generateAccessToken(JSON.stringify(data)),
107
- };
108
-
109
- return axios.post(this.daemonUrl, data, { headers });
110
- }
111
-
112
- async fetchWallet(method: string, params: any) {
113
-
114
- const data = {
115
- jsonrpc: "2.0",
116
- id: 0,
117
- method: method,
118
- params: params,
119
- };
120
-
121
- const headers = {
122
- "Content-Type": "application/json",
123
- "Zano-Access-Token": this.generateAccessToken(JSON.stringify(data)),
124
- };
125
-
126
- return axios.post(this.walletUrl, data, { headers });
127
- }
128
-
129
- async updateWalletRpcUrl(rpcUrl: string) {
130
- this.walletUrl = rpcUrl;
131
- }
132
-
133
- async updateDaemonRpcUrl(rpcUrl: string) {
134
- this.daemonUrl = rpcUrl;
135
- }
136
-
137
- async getAssetsList() {
138
- const count = 100;
139
- let offset = 0;
140
- let allAssets: APIAsset[] = [];
141
- let keepFetching = true;
142
-
143
- while (keepFetching) {
144
- try {
145
- const response = await this.fetchDaemon("get_assets_list", {
146
- count,
147
- offset,
148
- });
149
-
150
- const assets = response.data.result.assets;
151
- if (assets.length < count) {
152
- keepFetching = false;
153
- }
154
- allAssets = allAssets.concat(assets);
155
- offset += count;
156
- } catch (error) {
157
- throw new ZanoError(
158
- "Failed to fetch assets list",
159
- "ASSETS_FETCH_ERROR"
160
- );
161
- }
162
- }
163
-
164
- return allAssets as APIAsset[];
165
- }
166
-
167
- async getAssetDetails(assetId: string) {
168
- const assets = await this.getAssetsList();
169
- const asset = assets.find((a) => a.asset_id === assetId);
170
-
171
- if (!asset) {
172
- throw new ZanoError(
173
- `Asset with ID ${assetId} not found`,
174
- "ASSET_NOT_FOUND"
175
- );
176
- }
177
-
178
- return asset as APIAsset;
179
- }
180
-
181
- async getAssetInfo(assetId: string) {
182
- try {
183
- const response = await this.fetchDaemon("get_asset_info", {
184
- asset_id: assetId,
185
- });
186
-
187
- if (response.data.result) {
188
- return response.data.result;
189
- } else {
190
- throw new ZanoError(
191
- `Error fetching info for asset ID ${assetId}`,
192
- "ASSET_INFO_ERROR"
193
- );
194
- }
195
- } catch (error) {
196
- console.error(error);
197
- throw new ZanoError(
198
- "Failed to fetch asset info",
199
- "ASSET_INFO_FETCH_ERROR"
200
- );
201
- }
202
- }
203
-
204
- async sendTransfer(assetId: string, address: string, amount: string) {
205
- let decimalPoint: number;
206
- let auditable: boolean;
207
-
208
- if (assetId === ZANO_ASSET_ID) {
209
- decimalPoint = 12;
210
- } else {
211
- const asset = await this.getAssetDetails(assetId);
212
- decimalPoint = asset.decimal_point;
213
- }
214
-
215
- try {
216
- const response = await this.fetchWallet("getaddress", {});
217
- auditable = response.data.result.address.startsWith("a");
218
- } catch (error) {
219
- throw new ZanoError("Failed to fetch address", "ADDRESS_FETCH_ERROR");
220
- }
221
-
222
- const bigAmount = new Big(amount)
223
- .times(new Big(10).pow(decimalPoint))
224
- .toString();
225
-
226
- try {
227
- const response = await this.fetchWallet("transfer", {
228
- destinations: [{ address, amount: bigAmount, asset_id: assetId }],
229
- fee: "10000000000",
230
- mixin: auditable ? 0 : 15,
231
- });
232
-
233
- if (response.data.result) {
234
- return response.data.result;
235
- } else if (
236
- response.data.error &&
237
- response.data.error.message === "WALLET_RPC_ERROR_CODE_NOT_ENOUGH_MONEY"
238
- ) {
239
- throw new ZanoError("Not enough funds", "NOT_ENOUGH_FUNDS");
240
- } else {
241
- throw new ZanoError("Error sending transfer", "TRANSFER_ERROR");
242
- }
243
- } catch (error) {
244
- if (error instanceof ZanoError) {
245
- throw error;
246
- } else {
247
- throw new ZanoError("Failed to send transfer", "TRANSFER_SEND_ERROR");
248
- }
249
- }
250
- }
251
-
252
- async getAliasByAddress(address: string) {
253
- try {
254
- const response = await this.fetchDaemon("get_alias_by_address", address);
255
-
256
- if (response.data.result) {
257
- return response.data.result;
258
- } else {
259
- throw new ZanoError(
260
- `Error fetching alias for address ${address}`,
261
- "ALIAS_FETCH_ERROR"
262
- );
263
- }
264
- } catch (error) {
265
- throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR");
266
- }
267
- }
268
-
269
- async getBalances() {
270
- try {
271
- const response = await this.fetchWallet("getbalance", {});
272
- const balancesData = response.data.result.balances as APIBalance[];
273
-
274
- const balances = balancesData.map((asset) => ({
275
- name: asset.asset_info.full_name,
276
- ticker: asset.asset_info.ticker,
277
- id: asset.asset_info.asset_id,
278
- amount: new Big(asset.unlocked)
279
- .div(new Big(10).pow(asset.asset_info.decimal_point))
280
- .toString(),
281
- awaiting_in: new Big(asset.awaiting_in).toString(),
282
- awaiting_out: new Big(asset.awaiting_out).toString(),
283
- total: new Big(asset.total).toString(),
284
- unlocked: new Big(asset.unlocked).toString(),
285
- asset_info: asset.asset_info,
286
- }));
287
-
288
- return balances.sort((a, b) => {
289
- if (a.id === ZANO_ASSET_ID) return -1;
290
- if (b.id === ZANO_ASSET_ID) return 1;
291
- return 0;
292
- }) as BalanceInfo[];
293
- } catch (error) {
294
- throw new ZanoError("Failed to fetch balances", "BALANCES_FETCH_ERROR");
295
- }
296
- }
297
-
298
- async validateWallet(authData: AuthData) {
299
- const { message, address, signature } = authData;
300
-
301
- const alias = (authData as AliasAuth).alias || undefined;
302
- const pkey = (authData as PkeyAuth).pkey || undefined;
303
-
304
- if (!message || (!alias && !pkey) || !signature) {
305
- return false;
306
- }
307
-
308
- const validationParams: ValidationParams = {
309
- buff: Buffer.from(message).toString("base64"),
310
- sig: signature,
311
- };
312
-
313
- if (alias) {
314
- validationParams["alias"] = alias;
315
- } else {
316
- validationParams["pkey"] = pkey;
317
- }
318
-
319
- const response = await this.fetchDaemon(
320
- "validate_signature",
321
- validationParams
322
- );
323
-
324
- const valid = response?.data?.result?.status === "OK";
325
-
326
- if (!valid) {
327
- return false;
328
- }
329
-
330
- if (alias) {
331
- const aliasDetailsResponse = await this.fetchDaemon("get_alias_details", {
332
- alias: alias,
333
- });
334
-
335
- const aliasDetails = aliasDetailsResponse?.data?.result?.alias_details;
336
- const aliasAddress = aliasDetails?.address;
337
-
338
- const addressValid = !!aliasAddress && aliasAddress === address;
339
-
340
- if (!addressValid) {
341
- return false;
342
- }
343
- }
344
-
345
- return valid;
346
- }
347
-
348
- async getTxs(params: GetTxsParams) {
349
- const txs = await this.fetchWallet("get_recent_txs_and_info2", {
350
- count: params.count,
351
- exclude_mining_txs: params.exclude_mining_txs || false,
352
- exclude_unconfirmed: params.exclude_unconfirmed || false,
353
- offset: params.offset,
354
- order: params.order || "FROM_END_TO_BEGIN",
355
- update_provision_info: params.update_provision_info || true,
356
- });
357
-
358
- return txs.data.result as TxInfo;
359
- }
360
- async getAliasDetails(alias: string) {
361
- try {
362
- const response = await this.fetchDaemon("get_alias_details", {
363
- alias,
364
- });
365
- if (response.data.result) {
366
- return response.data.result as AliasDetails;
367
- } else {
368
- throw new ZanoError(
369
- `Error fetching alias ${alias}`,
370
- "ALIAS_FETCH_ERROR"
371
- );
372
- }
373
- } catch {
374
- throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR");
375
- }
376
- }
377
-
378
- }
379
-
380
- export default ServerWallet;
1
+ import axios from "axios";
2
+ import Big from "big.js";
3
+ import {
4
+ AuthData,
5
+ AliasAuth,
6
+ PkeyAuth,
7
+ ValidationParams,
8
+ BalanceInfo,
9
+ TxInfo,
10
+ AliasDetails,
11
+ } from "./types";
12
+
13
+ import { ZANO_ASSET_ID, ZanoError } from "./utils";
14
+ import { APIAsset, APIBalance } from "./types";
15
+ import forge from "node-forge";
16
+
17
+ interface ConstructorParams {
18
+ walletUrl: string;
19
+ daemonUrl: string;
20
+ walletAuthToken?: string;
21
+ }
22
+
23
+ interface GetTxsParams {
24
+ count: number;
25
+ offset: number;
26
+ exclude_mining_txs?: boolean;
27
+ exclude_unconfirmed?: boolean;
28
+ order?: string;
29
+ update_provision_info?: boolean;
30
+ }
31
+
32
+ interface JWTPayload {
33
+ body_hash: string,
34
+ user: string,
35
+ salt: string,
36
+ exp: number
37
+ }
38
+
39
+ class ServerWallet {
40
+ private walletUrl: string;
41
+ private daemonUrl: string;
42
+ private walletAuthToken: string;
43
+
44
+ constructor(params: ConstructorParams) {
45
+ this.walletUrl = params.walletUrl;
46
+ this.daemonUrl = params.daemonUrl;
47
+ this.walletAuthToken = params.walletAuthToken || "";
48
+ }
49
+
50
+ private generateRandomString(length: number) {
51
+ const bytes = forge.random.getBytesSync(Math.ceil(length / 2));
52
+ const hexString = forge.util.bytesToHex(bytes);
53
+ return hexString.substring(0, length);
54
+ }
55
+
56
+ private createJWSToken(payload: JWTPayload, secretStr: string): string {
57
+ const header = { alg: "HS256", typ: "JWT" };
58
+ const encodedHeader = Buffer.from(JSON.stringify(header))
59
+ .toString("base64")
60
+ .replace(/=/g, "");
61
+ const encodedPayload = Buffer.from(JSON.stringify(payload))
62
+ .toString("base64")
63
+ .replace(/=/g, "");
64
+
65
+ const signature = forge.hmac.create();
66
+ signature.start("sha256", secretStr);
67
+ signature.update(`${encodedHeader}.${encodedPayload}`);
68
+ const encodedSignature = forge.util
69
+ .encode64(signature.digest().getBytes())
70
+ .replace(/=/g, "");
71
+
72
+ return `${encodedHeader}.${encodedPayload}.${encodedSignature}`;
73
+ }
74
+
75
+
76
+ private generateAccessToken(httpBody: string) {
77
+ // Calculate the SHA-256 hash of the HTTP body
78
+ const md = forge.md.sha256.create();
79
+ md.update(httpBody);
80
+ const bodyHash = md.digest().toHex();
81
+
82
+ // Example payload
83
+ const payload = {
84
+ body_hash: bodyHash,
85
+ user: "zano_extension",
86
+ salt: this.generateRandomString(64),
87
+ exp: Math.floor(Date.now() / 1000) + 60, // Expires in 1 minute
88
+ };
89
+
90
+ return this.createJWSToken(payload, this.walletAuthToken);
91
+ }
92
+
93
+
94
+ async fetchDaemon(method: string, params: any) {
95
+
96
+
97
+ const data = {
98
+ jsonrpc: "2.0",
99
+ id: 0,
100
+ method: method,
101
+ params: params,
102
+ };
103
+
104
+ const headers = {
105
+ "Content-Type": "application/json",
106
+ "Zano-Access-Token": this.generateAccessToken(JSON.stringify(data)),
107
+ };
108
+
109
+ return axios.post(this.daemonUrl, data, { headers });
110
+ }
111
+
112
+ async fetchWallet(method: string, params: any) {
113
+
114
+ const data = {
115
+ jsonrpc: "2.0",
116
+ id: 0,
117
+ method: method,
118
+ params: params,
119
+ };
120
+
121
+ const headers = {
122
+ "Content-Type": "application/json",
123
+ "Zano-Access-Token": this.generateAccessToken(JSON.stringify(data)),
124
+ };
125
+
126
+ return axios.post(this.walletUrl, data, { headers });
127
+ }
128
+
129
+ async updateWalletRpcUrl(rpcUrl: string) {
130
+ this.walletUrl = rpcUrl;
131
+ }
132
+
133
+ async updateDaemonRpcUrl(rpcUrl: string) {
134
+ this.daemonUrl = rpcUrl;
135
+ }
136
+
137
+ async getAssetsList() {
138
+ const count = 100;
139
+ let offset = 0;
140
+ let allAssets: APIAsset[] = [];
141
+ let keepFetching = true;
142
+
143
+ while (keepFetching) {
144
+ try {
145
+ const response = await this.fetchDaemon("get_assets_list", {
146
+ count,
147
+ offset,
148
+ });
149
+
150
+ const assets = response.data.result.assets;
151
+ if (assets.length < count) {
152
+ keepFetching = false;
153
+ }
154
+ allAssets = allAssets.concat(assets);
155
+ offset += count;
156
+ } catch (error) {
157
+ throw new ZanoError(
158
+ "Failed to fetch assets list",
159
+ "ASSETS_FETCH_ERROR"
160
+ );
161
+ }
162
+ }
163
+
164
+ return allAssets as APIAsset[];
165
+ }
166
+
167
+ async getAssetDetails(assetId: string) {
168
+ const assets = await this.getAssetsList();
169
+ const asset = assets.find((a) => a.asset_id === assetId);
170
+
171
+ if (!asset) {
172
+ throw new ZanoError(
173
+ `Asset with ID ${assetId} not found`,
174
+ "ASSET_NOT_FOUND"
175
+ );
176
+ }
177
+
178
+ return asset as APIAsset;
179
+ }
180
+
181
+ async getAssetInfo(assetId: string) {
182
+ try {
183
+ const response = await this.fetchDaemon("get_asset_info", {
184
+ asset_id: assetId,
185
+ });
186
+
187
+ if (response.data.result) {
188
+ return response.data.result;
189
+ } else {
190
+ throw new ZanoError(
191
+ `Error fetching info for asset ID ${assetId}`,
192
+ "ASSET_INFO_ERROR"
193
+ );
194
+ }
195
+ } catch (error) {
196
+ console.error(error);
197
+ throw new ZanoError(
198
+ "Failed to fetch asset info",
199
+ "ASSET_INFO_FETCH_ERROR"
200
+ );
201
+ }
202
+ }
203
+
204
+ async sendTransfer(assetId: string, address: string, amount: string) {
205
+ let decimalPoint: number;
206
+ let auditable: boolean;
207
+
208
+ if (assetId === ZANO_ASSET_ID) {
209
+ decimalPoint = 12;
210
+ } else {
211
+ const asset = await this.getAssetDetails(assetId);
212
+ decimalPoint = asset.decimal_point;
213
+ }
214
+
215
+ try {
216
+ const response = await this.fetchWallet("getaddress", {});
217
+ auditable = response.data.result.address.startsWith("a");
218
+ } catch (error) {
219
+ throw new ZanoError("Failed to fetch address", "ADDRESS_FETCH_ERROR");
220
+ }
221
+
222
+ const bigAmount = new Big(amount)
223
+ .times(new Big(10).pow(decimalPoint))
224
+ .toString();
225
+
226
+ try {
227
+ const response = await this.fetchWallet("transfer", {
228
+ destinations: [{ address, amount: bigAmount, asset_id: assetId }],
229
+ fee: "10000000000",
230
+ mixin: auditable ? 0 : 15,
231
+ });
232
+
233
+ if (response.data.result) {
234
+ return response.data.result;
235
+ } else if (
236
+ response.data.error &&
237
+ response.data.error.message === "WALLET_RPC_ERROR_CODE_NOT_ENOUGH_MONEY"
238
+ ) {
239
+ throw new ZanoError("Not enough funds", "NOT_ENOUGH_FUNDS");
240
+ } else {
241
+ throw new ZanoError("Error sending transfer", "TRANSFER_ERROR");
242
+ }
243
+ } catch (error) {
244
+ if (error instanceof ZanoError) {
245
+ throw error;
246
+ } else {
247
+ throw new ZanoError("Failed to send transfer", "TRANSFER_SEND_ERROR");
248
+ }
249
+ }
250
+ }
251
+
252
+ async getAliasByAddress(address: string) {
253
+ try {
254
+ const response = await this.fetchDaemon("get_alias_by_address", address);
255
+
256
+ if (response.data.result) {
257
+ return response.data.result;
258
+ } else {
259
+ throw new ZanoError(
260
+ `Error fetching alias for address ${address}`,
261
+ "ALIAS_FETCH_ERROR"
262
+ );
263
+ }
264
+ } catch (error) {
265
+ throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR");
266
+ }
267
+ }
268
+
269
+ async getBalances() {
270
+ try {
271
+ const response = await this.fetchWallet("getbalance", {});
272
+ const balancesData = response.data.result.balances as APIBalance[];
273
+
274
+ const balances = balancesData.map((asset) => ({
275
+ name: asset.asset_info.full_name,
276
+ ticker: asset.asset_info.ticker,
277
+ id: asset.asset_info.asset_id,
278
+ amount: new Big(asset.unlocked)
279
+ .div(new Big(10).pow(asset.asset_info.decimal_point))
280
+ .toString(),
281
+ awaiting_in: new Big(asset.awaiting_in).toString(),
282
+ awaiting_out: new Big(asset.awaiting_out).toString(),
283
+ total: new Big(asset.total).toString(),
284
+ unlocked: new Big(asset.unlocked).toString(),
285
+ asset_info: asset.asset_info,
286
+ }));
287
+
288
+ return balances.sort((a, b) => {
289
+ if (a.id === ZANO_ASSET_ID) return -1;
290
+ if (b.id === ZANO_ASSET_ID) return 1;
291
+ return 0;
292
+ }) as BalanceInfo[];
293
+ } catch (error) {
294
+ throw new ZanoError("Failed to fetch balances", "BALANCES_FETCH_ERROR");
295
+ }
296
+ }
297
+
298
+ async validateWallet(authData: AuthData) {
299
+ const { message, address, signature } = authData;
300
+
301
+ const alias = (authData as AliasAuth).alias || undefined;
302
+ const pkey = (authData as PkeyAuth).pkey || undefined;
303
+
304
+ if (!message || (!alias && !pkey) || !signature) {
305
+ return false;
306
+ }
307
+
308
+ const validationParams: ValidationParams = {
309
+ buff: Buffer.from(message).toString("base64"),
310
+ sig: signature,
311
+ };
312
+
313
+ if (alias) {
314
+ validationParams["alias"] = alias;
315
+ } else {
316
+ validationParams["pkey"] = pkey;
317
+ }
318
+
319
+ const response = await this.fetchDaemon(
320
+ "validate_signature",
321
+ validationParams
322
+ );
323
+
324
+ const valid = response?.data?.result?.status === "OK";
325
+
326
+ if (!valid) {
327
+ return false;
328
+ }
329
+
330
+ if (alias) {
331
+ const aliasDetailsResponse = await this.fetchDaemon("get_alias_details", {
332
+ alias: alias,
333
+ });
334
+
335
+ const aliasDetails = aliasDetailsResponse?.data?.result?.alias_details;
336
+ const aliasAddress = aliasDetails?.address;
337
+
338
+ const addressValid = !!aliasAddress && aliasAddress === address;
339
+
340
+ if (!addressValid) {
341
+ return false;
342
+ }
343
+ }
344
+
345
+ return valid;
346
+ }
347
+
348
+ async getTxs(params: GetTxsParams) {
349
+ const txs = await this.fetchWallet("get_recent_txs_and_info2", {
350
+ count: params.count,
351
+ exclude_mining_txs: params.exclude_mining_txs || false,
352
+ exclude_unconfirmed: params.exclude_unconfirmed || false,
353
+ offset: params.offset,
354
+ order: params.order || "FROM_END_TO_BEGIN",
355
+ update_provision_info: params.update_provision_info || true,
356
+ });
357
+
358
+ return txs.data.result as TxInfo;
359
+ }
360
+ async getAliasDetails(alias: string) {
361
+ try {
362
+ const response = await this.fetchDaemon("get_alias_details", {
363
+ alias,
364
+ });
365
+ if (response.data.result) {
366
+ return response.data.result as AliasDetails;
367
+ } else {
368
+ throw new ZanoError(
369
+ `Error fetching alias ${alias}`,
370
+ "ALIAS_FETCH_ERROR"
371
+ );
372
+ }
373
+ } catch {
374
+ throw new ZanoError("Failed to fetch alias", "ALIAS_FETCH_ERROR");
375
+ }
376
+ }
377
+
378
+ }
379
+
380
+ export default ServerWallet;