zano_web3 5.2.0 → 5.3.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 +1 -1
- package/package.json +1 -1
- package/server/src/server.ts +5 -17
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(
|
|
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
package/server/src/server.ts
CHANGED
|
@@ -186,19 +186,7 @@ class ServerWallet {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
-
async validateWallet(
|
|
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
|
|
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
|
|
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;
|