@fenelabs/fene-sdk 0.7.1 → 0.7.3
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/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +28 -0
- package/dist/index.mjs +28 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -56,6 +56,7 @@ interface ValidatorSummary {
|
|
|
56
56
|
commission_rate: number;
|
|
57
57
|
status: ValidatorStatus;
|
|
58
58
|
delegator_count: number;
|
|
59
|
+
created_at: number;
|
|
59
60
|
}
|
|
60
61
|
declare enum DelegatorStatus {
|
|
61
62
|
NOT_EXIST = 0,
|
|
@@ -333,6 +334,12 @@ declare class ResonanceClient {
|
|
|
333
334
|
getUserAvatar(address: Address): Promise<{
|
|
334
335
|
url: string;
|
|
335
336
|
}>;
|
|
337
|
+
/**
|
|
338
|
+
* Upload user avatar
|
|
339
|
+
* @param address The user wallet address (must match authenticated user)
|
|
340
|
+
* @param file The image file to upload (png, jpg, or webp)
|
|
341
|
+
*/
|
|
342
|
+
uploadUserAvatar(address: Address, file: File): Promise<UploadResponse>;
|
|
336
343
|
/**
|
|
337
344
|
* Get all geo nodes, optionally filtered by role
|
|
338
345
|
* @param role Optional filter: "validator" or "delegator"
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ interface ValidatorSummary {
|
|
|
56
56
|
commission_rate: number;
|
|
57
57
|
status: ValidatorStatus;
|
|
58
58
|
delegator_count: number;
|
|
59
|
+
created_at: number;
|
|
59
60
|
}
|
|
60
61
|
declare enum DelegatorStatus {
|
|
61
62
|
NOT_EXIST = 0,
|
|
@@ -333,6 +334,12 @@ declare class ResonanceClient {
|
|
|
333
334
|
getUserAvatar(address: Address): Promise<{
|
|
334
335
|
url: string;
|
|
335
336
|
}>;
|
|
337
|
+
/**
|
|
338
|
+
* Upload user avatar
|
|
339
|
+
* @param address The user wallet address (must match authenticated user)
|
|
340
|
+
* @param file The image file to upload (png, jpg, or webp)
|
|
341
|
+
*/
|
|
342
|
+
uploadUserAvatar(address: Address, file: File): Promise<UploadResponse>;
|
|
336
343
|
/**
|
|
337
344
|
* Get all geo nodes, optionally filtered by role
|
|
338
345
|
* @param role Optional filter: "validator" or "delegator"
|
package/dist/index.js
CHANGED
|
@@ -461,6 +461,34 @@ var ResonanceClient = class {
|
|
|
461
461
|
async getUserAvatar(address) {
|
|
462
462
|
return this.request(`/eth/v1/user/${address}/avatar`);
|
|
463
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* Upload user avatar
|
|
466
|
+
* @param address The user wallet address (must match authenticated user)
|
|
467
|
+
* @param file The image file to upload (png, jpg, or webp)
|
|
468
|
+
*/
|
|
469
|
+
async uploadUserAvatar(address, file) {
|
|
470
|
+
const formData = new FormData();
|
|
471
|
+
formData.append("file", file);
|
|
472
|
+
const response = await fetch(
|
|
473
|
+
`${this.baseUrl}/eth/v1/user/${address}/avatar`,
|
|
474
|
+
{
|
|
475
|
+
method: "POST",
|
|
476
|
+
credentials: "include",
|
|
477
|
+
// Send httpOnly cookies
|
|
478
|
+
body: formData
|
|
479
|
+
}
|
|
480
|
+
);
|
|
481
|
+
if (!response.ok) {
|
|
482
|
+
const error = await response.json().catch(() => ({ error: "Upload failed" }));
|
|
483
|
+
throw new ResonanceError(
|
|
484
|
+
"UPLOAD_FAILED",
|
|
485
|
+
error.error || "Failed to upload avatar",
|
|
486
|
+
void 0,
|
|
487
|
+
response.status
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
return response.json();
|
|
491
|
+
}
|
|
464
492
|
// ============================================
|
|
465
493
|
// Geo
|
|
466
494
|
// ============================================
|
package/dist/index.mjs
CHANGED
|
@@ -425,6 +425,34 @@ var ResonanceClient = class {
|
|
|
425
425
|
async getUserAvatar(address) {
|
|
426
426
|
return this.request(`/eth/v1/user/${address}/avatar`);
|
|
427
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* Upload user avatar
|
|
430
|
+
* @param address The user wallet address (must match authenticated user)
|
|
431
|
+
* @param file The image file to upload (png, jpg, or webp)
|
|
432
|
+
*/
|
|
433
|
+
async uploadUserAvatar(address, file) {
|
|
434
|
+
const formData = new FormData();
|
|
435
|
+
formData.append("file", file);
|
|
436
|
+
const response = await fetch(
|
|
437
|
+
`${this.baseUrl}/eth/v1/user/${address}/avatar`,
|
|
438
|
+
{
|
|
439
|
+
method: "POST",
|
|
440
|
+
credentials: "include",
|
|
441
|
+
// Send httpOnly cookies
|
|
442
|
+
body: formData
|
|
443
|
+
}
|
|
444
|
+
);
|
|
445
|
+
if (!response.ok) {
|
|
446
|
+
const error = await response.json().catch(() => ({ error: "Upload failed" }));
|
|
447
|
+
throw new ResonanceError(
|
|
448
|
+
"UPLOAD_FAILED",
|
|
449
|
+
error.error || "Failed to upload avatar",
|
|
450
|
+
void 0,
|
|
451
|
+
response.status
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
return response.json();
|
|
455
|
+
}
|
|
428
456
|
// ============================================
|
|
429
457
|
// Geo
|
|
430
458
|
// ============================================
|
package/package.json
CHANGED