anymal-protocol 1.0.99 → 1.0.101
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 +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +10 -3
- package/dist/index.mjs +10 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -82,10 +82,17 @@ declare function useUpdateAnymalWithNFT(): (anymalPassportId: string, anymalDocI
|
|
|
82
82
|
success: boolean;
|
|
83
83
|
}>;
|
|
84
84
|
|
|
85
|
-
declare function useUploadAnymalImage(): (imageFile: File, type: string, idToken: string, publicKey: string, authServiceBaseUrl: string) => Promise<{
|
|
85
|
+
declare function useUploadAnymalImage(): (imageFile: File, type: string, idToken: string, publicKey: string, authServiceBaseUrl: string, petType: string, breed: string[], lifestage: string, anymalPid: string) => Promise<{
|
|
86
|
+
success: boolean;
|
|
87
|
+
message: string;
|
|
88
|
+
url: null;
|
|
89
|
+
type: string;
|
|
90
|
+
cid?: undefined;
|
|
91
|
+
} | {
|
|
86
92
|
success: boolean;
|
|
87
93
|
message: string;
|
|
88
94
|
url: any;
|
|
95
|
+
cid: any;
|
|
89
96
|
type: string;
|
|
90
97
|
}>;
|
|
91
98
|
|
package/dist/index.d.ts
CHANGED
|
@@ -82,10 +82,17 @@ declare function useUpdateAnymalWithNFT(): (anymalPassportId: string, anymalDocI
|
|
|
82
82
|
success: boolean;
|
|
83
83
|
}>;
|
|
84
84
|
|
|
85
|
-
declare function useUploadAnymalImage(): (imageFile: File, type: string, idToken: string, publicKey: string, authServiceBaseUrl: string) => Promise<{
|
|
85
|
+
declare function useUploadAnymalImage(): (imageFile: File, type: string, idToken: string, publicKey: string, authServiceBaseUrl: string, petType: string, breed: string[], lifestage: string, anymalPid: string) => Promise<{
|
|
86
|
+
success: boolean;
|
|
87
|
+
message: string;
|
|
88
|
+
url: null;
|
|
89
|
+
type: string;
|
|
90
|
+
cid?: undefined;
|
|
91
|
+
} | {
|
|
86
92
|
success: boolean;
|
|
87
93
|
message: string;
|
|
88
94
|
url: any;
|
|
95
|
+
cid: any;
|
|
89
96
|
type: string;
|
|
90
97
|
}>;
|
|
91
98
|
|
package/dist/index.js
CHANGED
|
@@ -1549,7 +1549,7 @@ function toBase64(file) {
|
|
|
1549
1549
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
1550
1550
|
function useUploadAnymalImage() {
|
|
1551
1551
|
return (0, import_react15.useCallback)(
|
|
1552
|
-
async (imageFile, type, idToken, publicKey, authServiceBaseUrl) => {
|
|
1552
|
+
async (imageFile, type, idToken, publicKey, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
1553
1553
|
if (!imageFile || !idToken) {
|
|
1554
1554
|
return {
|
|
1555
1555
|
success: false,
|
|
@@ -1563,7 +1563,11 @@ function useUploadAnymalImage() {
|
|
|
1563
1563
|
const payload = {
|
|
1564
1564
|
appPubKey: publicKey,
|
|
1565
1565
|
imageData: base64Image,
|
|
1566
|
-
imageName: imageFile.name.split(".")[0]
|
|
1566
|
+
imageName: imageFile.name.split(".")[0],
|
|
1567
|
+
petType,
|
|
1568
|
+
breed,
|
|
1569
|
+
lifestage,
|
|
1570
|
+
anymalPid
|
|
1567
1571
|
};
|
|
1568
1572
|
const response = await fetch(`${authServiceBaseUrl}/process-image`, {
|
|
1569
1573
|
method: "POST",
|
|
@@ -1577,8 +1581,9 @@ function useUploadAnymalImage() {
|
|
|
1577
1581
|
if (response.ok) {
|
|
1578
1582
|
return {
|
|
1579
1583
|
success: true,
|
|
1580
|
-
message: "Image
|
|
1584
|
+
message: "Image upload success",
|
|
1581
1585
|
url: data.ipfsUrl,
|
|
1586
|
+
cid: data.cid,
|
|
1582
1587
|
type
|
|
1583
1588
|
};
|
|
1584
1589
|
} else {
|
|
@@ -1586,6 +1591,7 @@ function useUploadAnymalImage() {
|
|
|
1586
1591
|
success: false,
|
|
1587
1592
|
message: "Image failed to upload.",
|
|
1588
1593
|
url: null,
|
|
1594
|
+
cid: null,
|
|
1589
1595
|
type
|
|
1590
1596
|
};
|
|
1591
1597
|
}
|
|
@@ -1594,6 +1600,7 @@ function useUploadAnymalImage() {
|
|
|
1594
1600
|
success: false,
|
|
1595
1601
|
message: `An error occurred during image upload: ${error.message}`,
|
|
1596
1602
|
url: null,
|
|
1603
|
+
cid: null,
|
|
1597
1604
|
type
|
|
1598
1605
|
};
|
|
1599
1606
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1486,7 +1486,7 @@ function toBase64(file) {
|
|
|
1486
1486
|
// src/utils/anymals/useUploadAnymalImage.ts
|
|
1487
1487
|
function useUploadAnymalImage() {
|
|
1488
1488
|
return useCallback15(
|
|
1489
|
-
async (imageFile, type, idToken, publicKey, authServiceBaseUrl) => {
|
|
1489
|
+
async (imageFile, type, idToken, publicKey, authServiceBaseUrl, petType, breed, lifestage, anymalPid) => {
|
|
1490
1490
|
if (!imageFile || !idToken) {
|
|
1491
1491
|
return {
|
|
1492
1492
|
success: false,
|
|
@@ -1500,7 +1500,11 @@ function useUploadAnymalImage() {
|
|
|
1500
1500
|
const payload = {
|
|
1501
1501
|
appPubKey: publicKey,
|
|
1502
1502
|
imageData: base64Image,
|
|
1503
|
-
imageName: imageFile.name.split(".")[0]
|
|
1503
|
+
imageName: imageFile.name.split(".")[0],
|
|
1504
|
+
petType,
|
|
1505
|
+
breed,
|
|
1506
|
+
lifestage,
|
|
1507
|
+
anymalPid
|
|
1504
1508
|
};
|
|
1505
1509
|
const response = await fetch(`${authServiceBaseUrl}/process-image`, {
|
|
1506
1510
|
method: "POST",
|
|
@@ -1514,8 +1518,9 @@ function useUploadAnymalImage() {
|
|
|
1514
1518
|
if (response.ok) {
|
|
1515
1519
|
return {
|
|
1516
1520
|
success: true,
|
|
1517
|
-
message: "Image
|
|
1521
|
+
message: "Image upload success",
|
|
1518
1522
|
url: data.ipfsUrl,
|
|
1523
|
+
cid: data.cid,
|
|
1519
1524
|
type
|
|
1520
1525
|
};
|
|
1521
1526
|
} else {
|
|
@@ -1523,6 +1528,7 @@ function useUploadAnymalImage() {
|
|
|
1523
1528
|
success: false,
|
|
1524
1529
|
message: "Image failed to upload.",
|
|
1525
1530
|
url: null,
|
|
1531
|
+
cid: null,
|
|
1526
1532
|
type
|
|
1527
1533
|
};
|
|
1528
1534
|
}
|
|
@@ -1531,6 +1537,7 @@ function useUploadAnymalImage() {
|
|
|
1531
1537
|
success: false,
|
|
1532
1538
|
message: `An error occurred during image upload: ${error.message}`,
|
|
1533
1539
|
url: null,
|
|
1540
|
+
cid: null,
|
|
1534
1541
|
type
|
|
1535
1542
|
};
|
|
1536
1543
|
}
|
package/package.json
CHANGED