zano_web3 5.2.0 → 5.4.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/README.md CHANGED
@@ -341,7 +341,7 @@ import { AuthData } from "./types";
341
341
  };
342
342
 
343
343
  try {
344
- const isValid = await zanoServerAPI.validateWallet("http://127.0.0.1:11211/json_rpc", authData);
344
+ const isValid = await zanoServerAPI.validateWallet(authData);
345
345
  console.log("Wallet validation:", isValid ? "Valid" : "Invalid");
346
346
  } catch (error) {
347
347
  console.error("Validation failed:", error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zano_web3",
3
- "version": "5.2.0",
3
+ "version": "5.4.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -186,19 +186,7 @@ class ServerWallet {
186
186
  }
187
187
  };
188
188
 
189
- async validateWallet(rpcUrl: string, authData: AuthData) {
190
-
191
- async function fetchZanoApi(method: string, params: any) {
192
- return await axios.post(
193
- rpcUrl,
194
- {
195
- "id": 0,
196
- "jsonrpc": "2.0",
197
- "method": method,
198
- "params": params,
199
- }
200
- ).then(res => res.data);
201
- }
189
+ async validateWallet(authData: AuthData) {
202
190
 
203
191
  const { message, address, signature } = authData;
204
192
 
@@ -220,26 +208,26 @@ class ServerWallet {
220
208
  validationParams['pkey'] = pkey;
221
209
  }
222
210
 
223
- const response = await fetchZanoApi(
211
+ const response = await this.fetchDaemon(
224
212
  'validate_signature',
225
213
  validationParams
226
214
  );
227
215
 
228
- const valid = response?.result?.status === 'OK';
216
+ const valid = response?.data?.result?.status === 'OK';
229
217
 
230
218
  if (!valid) {
231
219
  return false;
232
220
  }
233
221
 
234
222
  if (alias) {
235
- const aliasDetailsResponse = await fetchZanoApi(
223
+ const aliasDetailsResponse = await this.fetchDaemon(
236
224
  'get_alias_details',
237
225
  {
238
226
  "alias": alias,
239
227
  }
240
228
  );
241
229
 
242
- const aliasDetails = aliasDetailsResponse?.result?.alias_details;
230
+ const aliasDetails = aliasDetailsResponse?.data?.result?.alias_details;
243
231
  const aliasAddress = aliasDetails?.address;
244
232
 
245
233
  const addressValid = !!aliasAddress && aliasAddress === address;
package/web/src/index.ts CHANGED
@@ -5,4 +5,4 @@ export {useZanoWallet};
5
5
 
6
6
  export * from "./types";
7
7
 
8
- export default zanoWallet;
8
+ export {zanoWallet};
package/index.ts DELETED
@@ -1,11 +0,0 @@
1
- import zanoWallet from "./src/web/src/zanoWallet";
2
-
3
- import {useZanoWallet} from "./src/web/src/hooks";
4
- export {useZanoWallet};
5
-
6
- import validateWallet from "./src/server/src/server";
7
- export {validateWallet};
8
-
9
- export * from "./src/web/src/types";
10
-
11
- export default zanoWallet;