@fenelabs/fene-sdk 0.7.1 → 0.7.2

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 CHANGED
@@ -333,6 +333,12 @@ declare class ResonanceClient {
333
333
  getUserAvatar(address: Address): Promise<{
334
334
  url: string;
335
335
  }>;
336
+ /**
337
+ * Upload user avatar
338
+ * @param address The user wallet address (must match authenticated user)
339
+ * @param file The image file to upload (png, jpg, or webp)
340
+ */
341
+ uploadUserAvatar(address: Address, file: File): Promise<UploadResponse>;
336
342
  /**
337
343
  * Get all geo nodes, optionally filtered by role
338
344
  * @param role Optional filter: "validator" or "delegator"
package/dist/index.d.ts CHANGED
@@ -333,6 +333,12 @@ declare class ResonanceClient {
333
333
  getUserAvatar(address: Address): Promise<{
334
334
  url: string;
335
335
  }>;
336
+ /**
337
+ * Upload user avatar
338
+ * @param address The user wallet address (must match authenticated user)
339
+ * @param file The image file to upload (png, jpg, or webp)
340
+ */
341
+ uploadUserAvatar(address: Address, file: File): Promise<UploadResponse>;
336
342
  /**
337
343
  * Get all geo nodes, optionally filtered by role
338
344
  * @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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fenelabs/fene-sdk",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "TypeScript SDK for Fene API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",