anymal-protocol 1.0.54 → 1.0.55
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +63 -4
- package/dist/index.mjs +62 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -142,6 +142,11 @@ declare function useCreateUserAppData(): (appId: string, pid: string, dbAuthToke
|
|
|
142
142
|
data: any;
|
|
143
143
|
} | undefined>;
|
|
144
144
|
|
|
145
|
+
declare function useCreateOrganizationAppData(): (appId: string, pid: string, dbAuthToken: string, endpoint: string) => Promise<{
|
|
146
|
+
success: boolean;
|
|
147
|
+
data: any;
|
|
148
|
+
} | undefined>;
|
|
149
|
+
|
|
145
150
|
declare function useFetchBalance(): (publicClient: any, walletAddress: string, kibbleTokenAddress: string) => Promise<number | undefined>;
|
|
146
151
|
|
|
147
|
-
export { type AnymalNftMetadataInputData, type CreateAnymalInputData, generateBytes32Nonce, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
|
|
152
|
+
export { type AnymalNftMetadataInputData, type CreateAnymalInputData, generateBytes32Nonce, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
|
package/dist/index.d.ts
CHANGED
|
@@ -142,6 +142,11 @@ declare function useCreateUserAppData(): (appId: string, pid: string, dbAuthToke
|
|
|
142
142
|
data: any;
|
|
143
143
|
} | undefined>;
|
|
144
144
|
|
|
145
|
+
declare function useCreateOrganizationAppData(): (appId: string, pid: string, dbAuthToken: string, endpoint: string) => Promise<{
|
|
146
|
+
success: boolean;
|
|
147
|
+
data: any;
|
|
148
|
+
} | undefined>;
|
|
149
|
+
|
|
145
150
|
declare function useFetchBalance(): (publicClient: any, walletAddress: string, kibbleTokenAddress: string) => Promise<number | undefined>;
|
|
146
151
|
|
|
147
|
-
export { type AnymalNftMetadataInputData, type CreateAnymalInputData, generateBytes32Nonce, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
|
|
152
|
+
export { type AnymalNftMetadataInputData, type CreateAnymalInputData, generateBytes32Nonce, useAddAnymalToDatabase, useApproveKibbleToken, useApproveOrgPartialPayment, useCreateOrganizationAppData, useCreateOrganizationBase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessOrgPartialKibblePayment, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateOrgWalletAddress, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
useAddAnymalToDatabase: () => useAddAnymalToDatabase,
|
|
25
25
|
useApproveKibbleToken: () => useApproveKibbleToken,
|
|
26
26
|
useApproveOrgPartialPayment: () => useApproveOrgPartialPayment,
|
|
27
|
+
useCreateOrganizationAppData: () => useCreateOrganizationAppData,
|
|
27
28
|
useCreateOrganizationBase: () => useCreateOrganizationBase,
|
|
28
29
|
useCreateUserAppData: () => useCreateUserAppData,
|
|
29
30
|
useCreateWeb3Account: () => useCreateWeb3Account,
|
|
@@ -1948,8 +1949,8 @@ function useUpdateOrgWalletAddress() {
|
|
|
1948
1949
|
var import_uuid = require("uuid");
|
|
1949
1950
|
var import_viem8 = require("viem");
|
|
1950
1951
|
var generateBytes32Nonce = () => {
|
|
1951
|
-
const
|
|
1952
|
-
return (0, import_viem8.padHex)(`0x${
|
|
1952
|
+
const uuid3 = (0, import_uuid.v4)().replace(/-/g, "");
|
|
1953
|
+
return (0, import_viem8.padHex)(`0x${uuid3}`, { size: 32 });
|
|
1953
1954
|
};
|
|
1954
1955
|
|
|
1955
1956
|
// src/utils/application/useCreateUserAppData.ts
|
|
@@ -2009,11 +2010,68 @@ function useCreateUserAppData() {
|
|
|
2009
2010
|
);
|
|
2010
2011
|
}
|
|
2011
2012
|
|
|
2012
|
-
// src/utils/
|
|
2013
|
+
// src/utils/application/useCreateOrganizationAppData.ts
|
|
2013
2014
|
var import_react23 = require("react");
|
|
2015
|
+
var import_uuid3 = require("uuid");
|
|
2016
|
+
function useCreateOrganizationAppData() {
|
|
2017
|
+
return (0, import_react23.useCallback)(
|
|
2018
|
+
async (appId, pid, dbAuthToken, endpoint) => {
|
|
2019
|
+
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
2020
|
+
const appValues = {
|
|
2021
|
+
id: (0, import_uuid3.v4)(),
|
|
2022
|
+
organizationPid: pid,
|
|
2023
|
+
appId,
|
|
2024
|
+
settings: {
|
|
2025
|
+
darkMode: false
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
try {
|
|
2029
|
+
const mutation = `
|
|
2030
|
+
mutation Create_OrganizationAppSettings($input: [OrganizationAppSettingsMutationInputArg!]) {
|
|
2031
|
+
create_OrganizationAppSettings (input: $input) {
|
|
2032
|
+
_docId
|
|
2033
|
+
id
|
|
2034
|
+
appId
|
|
2035
|
+
settings
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
`;
|
|
2039
|
+
const variables = {
|
|
2040
|
+
input: [appValues]
|
|
2041
|
+
};
|
|
2042
|
+
const response = await fetch(endpoint, {
|
|
2043
|
+
method: "POST",
|
|
2044
|
+
headers: {
|
|
2045
|
+
"Content-Type": "application/json",
|
|
2046
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
2047
|
+
},
|
|
2048
|
+
body: JSON.stringify({ query: mutation, variables })
|
|
2049
|
+
});
|
|
2050
|
+
if (!response.ok) {
|
|
2051
|
+
return { success: false, data: null };
|
|
2052
|
+
}
|
|
2053
|
+
const { data, errors } = await response.json();
|
|
2054
|
+
if (errors) {
|
|
2055
|
+
return { success: false, data: null };
|
|
2056
|
+
}
|
|
2057
|
+
return {
|
|
2058
|
+
success: true,
|
|
2059
|
+
data: data.create_OrganizationAppSettings[0]
|
|
2060
|
+
};
|
|
2061
|
+
} catch (error) {
|
|
2062
|
+
console.error("Error creating application:", error);
|
|
2063
|
+
return { success: false, data: null };
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
[]
|
|
2067
|
+
);
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
// src/utils/balance/useFetchBalance.ts
|
|
2071
|
+
var import_react24 = require("react");
|
|
2014
2072
|
var import_viem9 = require("viem");
|
|
2015
2073
|
function useFetchBalance() {
|
|
2016
|
-
return (0,
|
|
2074
|
+
return (0, import_react24.useCallback)(
|
|
2017
2075
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
2018
2076
|
try {
|
|
2019
2077
|
const balance = await publicClient.readContract({
|
|
@@ -2036,6 +2094,7 @@ function useFetchBalance() {
|
|
|
2036
2094
|
useAddAnymalToDatabase,
|
|
2037
2095
|
useApproveKibbleToken,
|
|
2038
2096
|
useApproveOrgPartialPayment,
|
|
2097
|
+
useCreateOrganizationAppData,
|
|
2039
2098
|
useCreateOrganizationBase,
|
|
2040
2099
|
useCreateUserAppData,
|
|
2041
2100
|
useCreateWeb3Account,
|
package/dist/index.mjs
CHANGED
|
@@ -1899,8 +1899,8 @@ function useUpdateOrgWalletAddress() {
|
|
|
1899
1899
|
import { v4 as uuidv4 } from "uuid";
|
|
1900
1900
|
import { padHex } from "viem";
|
|
1901
1901
|
var generateBytes32Nonce = () => {
|
|
1902
|
-
const
|
|
1903
|
-
return padHex(`0x${
|
|
1902
|
+
const uuid3 = uuidv4().replace(/-/g, "");
|
|
1903
|
+
return padHex(`0x${uuid3}`, { size: 32 });
|
|
1904
1904
|
};
|
|
1905
1905
|
|
|
1906
1906
|
// src/utils/application/useCreateUserAppData.ts
|
|
@@ -1960,11 +1960,68 @@ function useCreateUserAppData() {
|
|
|
1960
1960
|
);
|
|
1961
1961
|
}
|
|
1962
1962
|
|
|
1963
|
-
// src/utils/
|
|
1963
|
+
// src/utils/application/useCreateOrganizationAppData.ts
|
|
1964
1964
|
import { useCallback as useCallback23 } from "react";
|
|
1965
|
+
import { v4 as uuid2 } from "uuid";
|
|
1966
|
+
function useCreateOrganizationAppData() {
|
|
1967
|
+
return useCallback23(
|
|
1968
|
+
async (appId, pid, dbAuthToken, endpoint) => {
|
|
1969
|
+
if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
|
|
1970
|
+
const appValues = {
|
|
1971
|
+
id: uuid2(),
|
|
1972
|
+
organizationPid: pid,
|
|
1973
|
+
appId,
|
|
1974
|
+
settings: {
|
|
1975
|
+
darkMode: false
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
try {
|
|
1979
|
+
const mutation = `
|
|
1980
|
+
mutation Create_OrganizationAppSettings($input: [OrganizationAppSettingsMutationInputArg!]) {
|
|
1981
|
+
create_OrganizationAppSettings (input: $input) {
|
|
1982
|
+
_docId
|
|
1983
|
+
id
|
|
1984
|
+
appId
|
|
1985
|
+
settings
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
`;
|
|
1989
|
+
const variables = {
|
|
1990
|
+
input: [appValues]
|
|
1991
|
+
};
|
|
1992
|
+
const response = await fetch(endpoint, {
|
|
1993
|
+
method: "POST",
|
|
1994
|
+
headers: {
|
|
1995
|
+
"Content-Type": "application/json",
|
|
1996
|
+
Authorization: `Bearer ${dbAuthToken}`
|
|
1997
|
+
},
|
|
1998
|
+
body: JSON.stringify({ query: mutation, variables })
|
|
1999
|
+
});
|
|
2000
|
+
if (!response.ok) {
|
|
2001
|
+
return { success: false, data: null };
|
|
2002
|
+
}
|
|
2003
|
+
const { data, errors } = await response.json();
|
|
2004
|
+
if (errors) {
|
|
2005
|
+
return { success: false, data: null };
|
|
2006
|
+
}
|
|
2007
|
+
return {
|
|
2008
|
+
success: true,
|
|
2009
|
+
data: data.create_OrganizationAppSettings[0]
|
|
2010
|
+
};
|
|
2011
|
+
} catch (error) {
|
|
2012
|
+
console.error("Error creating application:", error);
|
|
2013
|
+
return { success: false, data: null };
|
|
2014
|
+
}
|
|
2015
|
+
},
|
|
2016
|
+
[]
|
|
2017
|
+
);
|
|
2018
|
+
}
|
|
2019
|
+
|
|
2020
|
+
// src/utils/balance/useFetchBalance.ts
|
|
2021
|
+
import { useCallback as useCallback24 } from "react";
|
|
1965
2022
|
import { erc20Abi as erc20Abi3, getAddress } from "viem";
|
|
1966
2023
|
function useFetchBalance() {
|
|
1967
|
-
return
|
|
2024
|
+
return useCallback24(
|
|
1968
2025
|
async (publicClient, walletAddress, kibbleTokenAddress) => {
|
|
1969
2026
|
try {
|
|
1970
2027
|
const balance = await publicClient.readContract({
|
|
@@ -1986,6 +2043,7 @@ export {
|
|
|
1986
2043
|
useAddAnymalToDatabase,
|
|
1987
2044
|
useApproveKibbleToken,
|
|
1988
2045
|
useApproveOrgPartialPayment,
|
|
2046
|
+
useCreateOrganizationAppData,
|
|
1989
2047
|
useCreateOrganizationBase,
|
|
1990
2048
|
useCreateUserAppData,
|
|
1991
2049
|
useCreateWeb3Account,
|
package/package.json
CHANGED