anymal-protocol 1.0.10 → 1.0.11

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
@@ -18,7 +18,9 @@ declare function useUpdateUserAsVerified(): (recaptchaToken: string | null, docI
18
18
  message: string;
19
19
  } | undefined>;
20
20
 
21
- declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name: string, endpoint: string) => Promise<void>;
21
+ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name: string, endpoint: string) => Promise<{
22
+ success: boolean;
23
+ }>;
22
24
 
23
25
  declare function useMintAnymalNFT(): (pid: string, nftId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
24
26
  success: boolean;
package/dist/index.d.ts CHANGED
@@ -18,7 +18,9 @@ declare function useUpdateUserAsVerified(): (recaptchaToken: string | null, docI
18
18
  message: string;
19
19
  } | undefined>;
20
20
 
21
- declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name: string, endpoint: string) => Promise<void>;
21
+ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name: string, endpoint: string) => Promise<{
22
+ success: boolean;
23
+ }>;
22
24
 
23
25
  declare function useMintAnymalNFT(): (pid: string, nftId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
24
26
  success: boolean;
package/dist/index.js CHANGED
@@ -854,6 +854,9 @@ var import_react8 = require("react");
854
854
  function useUpdateUserName() {
855
855
  return (0, import_react8.useCallback)(
856
856
  async (dbAuthToken, docID, name, endpoint) => {
857
+ if (!name || !dbAuthToken || !docID || !endpoint) {
858
+ return { success: false };
859
+ }
857
860
  try {
858
861
  const mutation = `
859
862
  mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
@@ -880,10 +883,12 @@ function useUpdateUserName() {
880
883
  })
881
884
  });
882
885
  if (!response.ok) {
883
- throw new Error(`HTTP error! Status: ${response.status}`);
886
+ return { success: false };
884
887
  }
888
+ return { success: true };
885
889
  } catch (error) {
886
890
  console.error("Error updating name:", error);
891
+ return { success: false };
887
892
  }
888
893
  },
889
894
  []
package/dist/index.mjs CHANGED
@@ -814,6 +814,9 @@ import { useCallback as useCallback8 } from "react";
814
814
  function useUpdateUserName() {
815
815
  return useCallback8(
816
816
  async (dbAuthToken, docID, name, endpoint) => {
817
+ if (!name || !dbAuthToken || !docID || !endpoint) {
818
+ return { success: false };
819
+ }
817
820
  try {
818
821
  const mutation = `
819
822
  mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
@@ -840,10 +843,12 @@ function useUpdateUserName() {
840
843
  })
841
844
  });
842
845
  if (!response.ok) {
843
- throw new Error(`HTTP error! Status: ${response.status}`);
846
+ return { success: false };
844
847
  }
848
+ return { success: true };
845
849
  } catch (error) {
846
850
  console.error("Error updating name:", error);
851
+ return { success: false };
847
852
  }
848
853
  },
849
854
  []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -8,6 +8,10 @@ export function useUpdateUserName() {
8
8
  name: string,
9
9
  endpoint: string
10
10
  ) => {
11
+ if (!name || !dbAuthToken || !docID || !endpoint) {
12
+ return { success: false };
13
+ }
14
+
11
15
  try {
12
16
  const mutation = `
13
17
  mutation Update_User($docID: [ID], $input: UserMutationInputArg) {
@@ -37,10 +41,13 @@ export function useUpdateUserName() {
37
41
  });
38
42
 
39
43
  if (!response.ok) {
40
- throw new Error(`HTTP error! Status: ${response.status}`);
44
+ return { success: false };
41
45
  }
46
+
47
+ return { success: true };
42
48
  } catch (error) {
43
49
  console.error("Error updating name:", error);
50
+ return { success: false };
44
51
  }
45
52
  },
46
53
  []