anymal-protocol 1.0.21 → 1.0.23

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
@@ -22,6 +22,26 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
22
22
  success: boolean;
23
23
  }>;
24
24
 
25
+ /**
26
+ * Custom hook to fetch notifications from a GraphQL endpoint.
27
+ * Allows filtering notifications by `pid` and optionally other fields.
28
+ *
29
+ * @example
30
+ * const fetchNotifications = useFetchNotifications();
31
+ * const notifications = await fetchNotifications(
32
+ * "user_pid",
33
+ * "auth_token",
34
+ * "https://api.endpoint.com/graphql",
35
+ * {
36
+ * read: { _eq: false }, // Additional filter: unread notifications
37
+ * type: { _in: ["type1", "type2"] }, // Filter by types
38
+ * }
39
+ * );
40
+ *
41
+ * @returns {Promise<Array|Object|null>} A list of notifications if found, null otherwise.
42
+ */
43
+ declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
44
+
25
45
  declare function useMintAnymalNFT(): (pid: string, nftId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
26
46
  success: boolean;
27
47
  message: string;
@@ -60,6 +80,18 @@ declare function useUploadAnymalImage(): (imageFile: File, type: string, idToken
60
80
  type: string;
61
81
  }>;
62
82
 
83
+ declare function useProcessPartialKibblePayment(): (pid: string, nftId: string, orderId: string, dbAuthToken: string, marketplaceContract: string, smartAccount: any, bundlerClient: any, amountInTokens: string, maxTokenPayment: string, nonce: string, deadline: string, backendSignature: string) => Promise<{
84
+ success: boolean;
85
+ message: string;
86
+ }>;
87
+
88
+ declare function useApproveKibbleToken(): (kibbleTokenAddress: string, marketplaceContract: string, amount: string, smartAccount: any, bundlerClient: any) => Promise<{
89
+ success: boolean;
90
+ message: string;
91
+ }>;
92
+
93
+ declare const generateBytes32Nonce: () => `0x${string}`;
94
+
63
95
  declare function useCreateUserAppData(): (appId: string, pid: string, dbAuthToken: string, endpoint: string) => Promise<{
64
96
  success: boolean;
65
97
  data: any;
@@ -67,4 +99,4 @@ declare function useCreateUserAppData(): (appId: string, pid: string, dbAuthToke
67
99
 
68
100
  declare function useFetchBalance(): (publicClient: any, walletAddress: string, kibbleTokenAddress: string) => Promise<number | undefined>;
69
101
 
70
- export { type AnymalNftMetadataInputData, type CreateAnymalInputData, useAddAnymalToDatabase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchBalance, useFetchUserData, useMintAnymalNFT, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
102
+ export { type AnymalNftMetadataInputData, type CreateAnymalInputData, generateBytes32Nonce, useAddAnymalToDatabase, useApproveKibbleToken, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,26 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
22
22
  success: boolean;
23
23
  }>;
24
24
 
25
+ /**
26
+ * Custom hook to fetch notifications from a GraphQL endpoint.
27
+ * Allows filtering notifications by `pid` and optionally other fields.
28
+ *
29
+ * @example
30
+ * const fetchNotifications = useFetchNotifications();
31
+ * const notifications = await fetchNotifications(
32
+ * "user_pid",
33
+ * "auth_token",
34
+ * "https://api.endpoint.com/graphql",
35
+ * {
36
+ * read: { _eq: false }, // Additional filter: unread notifications
37
+ * type: { _in: ["type1", "type2"] }, // Filter by types
38
+ * }
39
+ * );
40
+ *
41
+ * @returns {Promise<Array|Object|null>} A list of notifications if found, null otherwise.
42
+ */
43
+ declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
44
+
25
45
  declare function useMintAnymalNFT(): (pid: string, nftId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
26
46
  success: boolean;
27
47
  message: string;
@@ -60,6 +80,18 @@ declare function useUploadAnymalImage(): (imageFile: File, type: string, idToken
60
80
  type: string;
61
81
  }>;
62
82
 
83
+ declare function useProcessPartialKibblePayment(): (pid: string, nftId: string, orderId: string, dbAuthToken: string, marketplaceContract: string, smartAccount: any, bundlerClient: any, amountInTokens: string, maxTokenPayment: string, nonce: string, deadline: string, backendSignature: string) => Promise<{
84
+ success: boolean;
85
+ message: string;
86
+ }>;
87
+
88
+ declare function useApproveKibbleToken(): (kibbleTokenAddress: string, marketplaceContract: string, amount: string, smartAccount: any, bundlerClient: any) => Promise<{
89
+ success: boolean;
90
+ message: string;
91
+ }>;
92
+
93
+ declare const generateBytes32Nonce: () => `0x${string}`;
94
+
63
95
  declare function useCreateUserAppData(): (appId: string, pid: string, dbAuthToken: string, endpoint: string) => Promise<{
64
96
  success: boolean;
65
97
  data: any;
@@ -67,4 +99,4 @@ declare function useCreateUserAppData(): (appId: string, pid: string, dbAuthToke
67
99
 
68
100
  declare function useFetchBalance(): (publicClient: any, walletAddress: string, kibbleTokenAddress: string) => Promise<number | undefined>;
69
101
 
70
- export { type AnymalNftMetadataInputData, type CreateAnymalInputData, useAddAnymalToDatabase, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchBalance, useFetchUserData, useMintAnymalNFT, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
102
+ export { type AnymalNftMetadataInputData, type CreateAnymalInputData, generateBytes32Nonce, useAddAnymalToDatabase, useApproveKibbleToken, useCreateUserAppData, useCreateWeb3Account, useDeleteAnymalFromDatabase, useFetchBalance, useFetchNotifications, useFetchUserData, useMintAnymalNFT, useProcessPartialKibblePayment, useSaveAnymalMetadata, useUpdateAnymalWithNFT, useUpdateUserAsVerified, useUpdateUserEmail, useUpdateUserName, useUpdateUserPid, useUploadAnymalImage, useVerifyAccount, useVerifyWeb3AuthSession };
package/dist/index.js CHANGED
@@ -20,13 +20,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ generateBytes32Nonce: () => generateBytes32Nonce,
23
24
  useAddAnymalToDatabase: () => useAddAnymalToDatabase,
25
+ useApproveKibbleToken: () => useApproveKibbleToken,
24
26
  useCreateUserAppData: () => useCreateUserAppData,
25
27
  useCreateWeb3Account: () => useCreateWeb3Account,
26
28
  useDeleteAnymalFromDatabase: () => useDeleteAnymalFromDatabase,
27
29
  useFetchBalance: () => useFetchBalance,
30
+ useFetchNotifications: () => useFetchNotifications,
28
31
  useFetchUserData: () => useFetchUserData,
29
32
  useMintAnymalNFT: () => useMintAnymalNFT,
33
+ useProcessPartialKibblePayment: () => useProcessPartialKibblePayment,
30
34
  useSaveAnymalMetadata: () => useSaveAnymalMetadata,
31
35
  useUpdateAnymalWithNFT: () => useUpdateAnymalWithNFT,
32
36
  useUpdateUserAsVerified: () => useUpdateUserAsVerified,
@@ -599,6 +603,7 @@ var VERIFY_ACCOUNT_ABI = [
599
603
  type: "function"
600
604
  }
601
605
  ];
606
+ var MARKETPLACE_ABI = [{ "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": true, "internalType": "string", "name": "anymalNftId", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "PartialPaymentMade", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "PaymentMade", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "refundedAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "RefundProcessed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "SignatureCheckToggled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "authorizer", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_initialOwner", "type": "address" }, { "internalType": "address", "name": "_authorizer", "type": "address" }, { "internalType": "address", "name": "_kibbleToken", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "kibbleToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }, { "internalType": "address", "name": "", "type": "address" }], "name": "paidAmounts", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "orderId", "type": "string" }, { "internalType": "string", "name": "anymalNftId", "type": "string" }, { "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "internalType": "uint256", "name": "maxTokenPayment", "type": "uint256" }, { "internalType": "bytes32", "name": "nonce", "type": "bytes32" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bytes", "name": "backendSignature", "type": "bytes" }], "name": "partialPay", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "orderId", "type": "string" }, { "internalType": "address", "name": "payer", "type": "address" }], "name": "refund", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_authorizer", "type": "address" }], "name": "setAuthorizer", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "setSignatureCheckEnabled", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "signatureCheckEnabled", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "name": "usedNonces", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdrawKibble", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
602
607
 
603
608
  // src/utils/account/useVerifyAccount.ts
604
609
  function useVerifyAccount() {
@@ -897,11 +902,70 @@ function useUpdateUserName() {
897
902
  );
898
903
  }
899
904
 
905
+ // src/utils/account/useFetchNotifications.ts
906
+ var import_react9 = require("react");
907
+ function useFetchNotifications() {
908
+ return (0, import_react9.useCallback)(
909
+ async (pid, dbAuthToken, endpoint, additionalFilters) => {
910
+ if (!pid) {
911
+ throw new Error("The 'pid' field is required.");
912
+ }
913
+ try {
914
+ const query = `
915
+ query Notification($filter: NotificationFilterArg) {
916
+ Notification(filter: $filter) {
917
+ _docID
918
+ action
919
+ id
920
+ pid
921
+ read
922
+ source
923
+ tags
924
+ text
925
+ timeAddedUtc
926
+ timeUpdatedUtc
927
+ type
928
+ }
929
+ }
930
+ `;
931
+ const filter = {
932
+ pid: {
933
+ _eq: pid
934
+ },
935
+ ...additionalFilters || {}
936
+ };
937
+ const variables = { filter };
938
+ const response = await fetch(endpoint, {
939
+ method: "POST",
940
+ headers: {
941
+ "Content-Type": "application/json",
942
+ Authorization: `Bearer ${dbAuthToken}`
943
+ },
944
+ body: JSON.stringify({ query, variables })
945
+ });
946
+ if (!response.ok) {
947
+ throw new Error(`HTTP error! Status: ${response.status}`);
948
+ }
949
+ const data = await response.json();
950
+ if (data?.data?.Notification?.length > 0) {
951
+ return data.data.Notification;
952
+ } else {
953
+ return null;
954
+ }
955
+ } catch (error) {
956
+ console.error("Error fetching notifications:", error);
957
+ return null;
958
+ }
959
+ },
960
+ []
961
+ );
962
+ }
963
+
900
964
  // src/utils/anymals/useMintAnymalNFT.ts
901
965
  var import_viem2 = require("viem");
902
- var import_react9 = require("react");
966
+ var import_react10 = require("react");
903
967
  function useMintAnymalNFT() {
904
- return (0, import_react9.useCallback)(
968
+ return (0, import_react10.useCallback)(
905
969
  async (pid, nftId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
906
970
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
907
971
  return {
@@ -940,9 +1004,9 @@ function useMintAnymalNFT() {
940
1004
  }
941
1005
 
942
1006
  // src/utils/anymals/useAddAnymalToDatabase.ts
943
- var import_react10 = require("react");
1007
+ var import_react11 = require("react");
944
1008
  function useAddAnymalToDatabase() {
945
- return (0, import_react10.useCallback)(
1009
+ return (0, import_react11.useCallback)(
946
1010
  async (dbAuthToken, endpoint, anymalData) => {
947
1011
  if (!dbAuthToken) {
948
1012
  return {
@@ -1007,9 +1071,9 @@ function useAddAnymalToDatabase() {
1007
1071
  }
1008
1072
 
1009
1073
  // src/utils/anymals/useDeleteAnymalFromDatabase.ts
1010
- var import_react11 = require("react");
1074
+ var import_react12 = require("react");
1011
1075
  function useDeleteAnymalFromDatabase() {
1012
- return (0, import_react11.useCallback)(
1076
+ return (0, import_react12.useCallback)(
1013
1077
  async (dbAuthToken, endpoint, anymalDocID) => {
1014
1078
  if (!dbAuthToken || !endpoint || !anymalDocID) return;
1015
1079
  try {
@@ -1047,9 +1111,9 @@ function useDeleteAnymalFromDatabase() {
1047
1111
  }
1048
1112
 
1049
1113
  // src/utils/anymals/useSaveAnymalMetadata.ts
1050
- var import_react12 = require("react");
1114
+ var import_react13 = require("react");
1051
1115
  function useSaveAnymalMetadata() {
1052
- return (0, import_react12.useCallback)(
1116
+ return (0, import_react13.useCallback)(
1053
1117
  async (idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
1054
1118
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
1055
1119
  method: "POST",
@@ -1076,9 +1140,9 @@ function useSaveAnymalMetadata() {
1076
1140
  }
1077
1141
 
1078
1142
  // src/utils/anymals/useUpdateAnymalWithNFT.ts
1079
- var import_react13 = require("react");
1143
+ var import_react14 = require("react");
1080
1144
  function useUpdateAnymalWithNFT() {
1081
- return (0, import_react13.useCallback)(
1145
+ return (0, import_react14.useCallback)(
1082
1146
  async (anymalPassportId, anymalDocId, dbAuthToken, endpoint) => {
1083
1147
  if (!dbAuthToken || !anymalPassportId || !anymalDocId || !endpoint) {
1084
1148
  return {
@@ -1125,7 +1189,7 @@ function useUpdateAnymalWithNFT() {
1125
1189
  }
1126
1190
 
1127
1191
  // src/utils/anymals/useUploadAnymalImage.ts
1128
- var import_react14 = require("react");
1192
+ var import_react15 = require("react");
1129
1193
 
1130
1194
  // src/helpers/UploadImageHelper.tsx
1131
1195
  function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
@@ -1182,7 +1246,7 @@ function toBase64(file) {
1182
1246
 
1183
1247
  // src/utils/anymals/useUploadAnymalImage.ts
1184
1248
  function useUploadAnymalImage() {
1185
- return (0, import_react14.useCallback)(
1249
+ return (0, import_react15.useCallback)(
1186
1250
  async (imageFile, type, idToken, publicKey, authServiceBaseUrl) => {
1187
1251
  if (!imageFile || !idToken) {
1188
1252
  return {
@@ -1236,15 +1300,126 @@ function useUploadAnymalImage() {
1236
1300
  );
1237
1301
  }
1238
1302
 
1239
- // src/utils/application/useCreateUserAppData.ts
1240
- var import_react15 = require("react");
1303
+ // src/utils/marketplace/useProcessPartialKibblePayment.ts
1304
+ var import_viem3 = require("viem");
1305
+ var import_react16 = require("react");
1306
+ function useProcessPartialKibblePayment() {
1307
+ return (0, import_react16.useCallback)(
1308
+ async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
1309
+ if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
1310
+ return {
1311
+ success: false,
1312
+ message: "Missing required parameters for partial payment."
1313
+ };
1314
+ }
1315
+ try {
1316
+ const args = [
1317
+ orderId,
1318
+ // string
1319
+ nftId,
1320
+ // string
1321
+ amountInTokens,
1322
+ // uint256
1323
+ maxTokenPayment,
1324
+ // uint256
1325
+ nonce,
1326
+ // bytes32
1327
+ deadline,
1328
+ // uint256
1329
+ backendSignature
1330
+ // bytes
1331
+ ];
1332
+ console.info({ args });
1333
+ const callData = (0, import_viem3.encodeFunctionData)({
1334
+ abi: MARKETPLACE_ABI,
1335
+ functionName: "partialPay",
1336
+ args
1337
+ });
1338
+ const userOpHash = await bundlerClient.sendUserOperation({
1339
+ account: smartAccount,
1340
+ calls: [
1341
+ {
1342
+ to: marketplaceContract,
1343
+ data: callData
1344
+ }
1345
+ ],
1346
+ maxPriorityFeePerGas: (0, import_viem3.parseGwei)("0.001"),
1347
+ maxFeePerGas: (0, import_viem3.parseGwei)("0.01")
1348
+ });
1349
+ await bundlerClient.waitForUserOperationReceipt({
1350
+ hash: userOpHash
1351
+ });
1352
+ return { success: true, message: "Partial Kibble Payment Processed!" };
1353
+ } catch (error) {
1354
+ const errorMessage = error instanceof Error ? error.message : "An unknown error occurred";
1355
+ return {
1356
+ success: false,
1357
+ message: `Error processing payment: ${errorMessage}`
1358
+ };
1359
+ }
1360
+ },
1361
+ []
1362
+ );
1363
+ }
1364
+
1365
+ // src/utils/marketplace/useApproveKibbleToken.ts
1366
+ var import_viem4 = require("viem");
1367
+ var import_react17 = require("react");
1368
+ function useApproveKibbleToken() {
1369
+ return (0, import_react17.useCallback)(
1370
+ async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
1371
+ try {
1372
+ const callData = (0, import_viem4.encodeFunctionData)({
1373
+ abi: import_viem4.erc20Abi,
1374
+ functionName: "approve",
1375
+ args: [
1376
+ marketplaceContract,
1377
+ // spender address
1378
+ BigInt(amount)
1379
+ // amount to approve
1380
+ ]
1381
+ });
1382
+ const userOpHash = await bundlerClient.sendUserOperation({
1383
+ account: smartAccount,
1384
+ calls: [
1385
+ {
1386
+ to: kibbleTokenAddress,
1387
+ data: callData
1388
+ }
1389
+ ],
1390
+ maxPriorityFeePerGas: (0, import_viem4.parseGwei)("0.001"),
1391
+ maxFeePerGas: (0, import_viem4.parseGwei)("0.01")
1392
+ });
1393
+ await bundlerClient.waitForUserOperationReceipt({
1394
+ hash: userOpHash
1395
+ });
1396
+ return { success: true, message: "Approval transaction completed successfully." };
1397
+ } catch (error) {
1398
+ const errorMessage = error instanceof Error ? error.message : "An unknown error occurred";
1399
+ return { success: false, message: `Error processing approval: ${errorMessage}` };
1400
+ }
1401
+ },
1402
+ []
1403
+ );
1404
+ }
1405
+
1406
+ // src/helpers/NonceHelper.tsx
1241
1407
  var import_uuid = require("uuid");
1408
+ var import_viem5 = require("viem");
1409
+ var generateBytes32Nonce = () => {
1410
+ const uuid2 = (0, import_uuid.v4)().replace(/-/g, "");
1411
+ return (0, import_viem5.padHex)(`0x${uuid2}`, { size: 32 });
1412
+ };
1413
+
1414
+ // src/utils/application/useCreateUserAppData.ts
1415
+ var import_react18 = require("react");
1416
+ var import_uuid2 = require("uuid");
1242
1417
  function useCreateUserAppData() {
1243
- return (0, import_react15.useCallback)(
1418
+ return (0, import_react18.useCallback)(
1244
1419
  async (appId, pid, dbAuthToken, endpoint) => {
1245
1420
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
1246
1421
  const appValues = {
1247
- id: (0, import_uuid.v4)(),
1422
+ id: (0, import_uuid2.v4)(),
1248
1423
  userPid: pid,
1249
1424
  appId,
1250
1425
  settings: {
@@ -1293,17 +1468,17 @@ function useCreateUserAppData() {
1293
1468
  }
1294
1469
 
1295
1470
  // src/utils/balance/useFetchBalance.ts
1296
- var import_react16 = require("react");
1297
- var import_viem3 = require("viem");
1471
+ var import_react19 = require("react");
1472
+ var import_viem6 = require("viem");
1298
1473
  function useFetchBalance() {
1299
- return (0, import_react16.useCallback)(
1474
+ return (0, import_react19.useCallback)(
1300
1475
  async (publicClient, walletAddress, kibbleTokenAddress) => {
1301
1476
  try {
1302
1477
  const balance = await publicClient.readContract({
1303
- address: (0, import_viem3.getAddress)(kibbleTokenAddress),
1304
- abi: import_viem3.erc20Abi,
1478
+ address: (0, import_viem6.getAddress)(kibbleTokenAddress),
1479
+ abi: import_viem6.erc20Abi,
1305
1480
  functionName: "balanceOf",
1306
- args: [(0, import_viem3.getAddress)(walletAddress)]
1481
+ args: [(0, import_viem6.getAddress)(walletAddress)]
1307
1482
  });
1308
1483
  return Number(balance);
1309
1484
  } catch (error) {
@@ -1315,13 +1490,17 @@ function useFetchBalance() {
1315
1490
  }
1316
1491
  // Annotate the CommonJS export names for ESM import in node:
1317
1492
  0 && (module.exports = {
1493
+ generateBytes32Nonce,
1318
1494
  useAddAnymalToDatabase,
1495
+ useApproveKibbleToken,
1319
1496
  useCreateUserAppData,
1320
1497
  useCreateWeb3Account,
1321
1498
  useDeleteAnymalFromDatabase,
1322
1499
  useFetchBalance,
1500
+ useFetchNotifications,
1323
1501
  useFetchUserData,
1324
1502
  useMintAnymalNFT,
1503
+ useProcessPartialKibblePayment,
1325
1504
  useSaveAnymalMetadata,
1326
1505
  useUpdateAnymalWithNFT,
1327
1506
  useUpdateUserAsVerified,
package/dist/index.mjs CHANGED
@@ -558,6 +558,7 @@ var VERIFY_ACCOUNT_ABI = [
558
558
  type: "function"
559
559
  }
560
560
  ];
561
+ var MARKETPLACE_ABI = [{ "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": true, "internalType": "string", "name": "anymalNftId", "type": "string" }, { "indexed": false, "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "PartialPaymentMade", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "PaymentMade", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "string", "name": "orderId", "type": "string" }, { "indexed": true, "internalType": "address", "name": "payer", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "refundedAmount", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "timestamp", "type": "uint256" }], "name": "RefundProcessed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "SignatureCheckToggled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "authorizer", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_initialOwner", "type": "address" }, { "internalType": "address", "name": "_authorizer", "type": "address" }, { "internalType": "address", "name": "_kibbleToken", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "kibbleToken", "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }, { "internalType": "address", "name": "", "type": "address" }], "name": "paidAmounts", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "orderId", "type": "string" }, { "internalType": "string", "name": "anymalNftId", "type": "string" }, { "internalType": "uint256", "name": "amountInTokens", "type": "uint256" }, { "internalType": "uint256", "name": "maxTokenPayment", "type": "uint256" }, { "internalType": "bytes32", "name": "nonce", "type": "bytes32" }, { "internalType": "uint256", "name": "deadline", "type": "uint256" }, { "internalType": "bytes", "name": "backendSignature", "type": "bytes" }], "name": "partialPay", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "string", "name": "orderId", "type": "string" }, { "internalType": "address", "name": "payer", "type": "address" }], "name": "refund", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "_authorizer", "type": "address" }], "name": "setAuthorizer", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bool", "name": "enabled", "type": "bool" }], "name": "setSignatureCheckEnabled", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "signatureCheckEnabled", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "name": "usedNonces", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "withdrawKibble", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
561
562
 
562
563
  // src/utils/account/useVerifyAccount.ts
563
564
  function useVerifyAccount() {
@@ -856,11 +857,70 @@ function useUpdateUserName() {
856
857
  );
857
858
  }
858
859
 
860
+ // src/utils/account/useFetchNotifications.ts
861
+ import { useCallback as useCallback9 } from "react";
862
+ function useFetchNotifications() {
863
+ return useCallback9(
864
+ async (pid, dbAuthToken, endpoint, additionalFilters) => {
865
+ if (!pid) {
866
+ throw new Error("The 'pid' field is required.");
867
+ }
868
+ try {
869
+ const query = `
870
+ query Notification($filter: NotificationFilterArg) {
871
+ Notification(filter: $filter) {
872
+ _docID
873
+ action
874
+ id
875
+ pid
876
+ read
877
+ source
878
+ tags
879
+ text
880
+ timeAddedUtc
881
+ timeUpdatedUtc
882
+ type
883
+ }
884
+ }
885
+ `;
886
+ const filter = {
887
+ pid: {
888
+ _eq: pid
889
+ },
890
+ ...additionalFilters || {}
891
+ };
892
+ const variables = { filter };
893
+ const response = await fetch(endpoint, {
894
+ method: "POST",
895
+ headers: {
896
+ "Content-Type": "application/json",
897
+ Authorization: `Bearer ${dbAuthToken}`
898
+ },
899
+ body: JSON.stringify({ query, variables })
900
+ });
901
+ if (!response.ok) {
902
+ throw new Error(`HTTP error! Status: ${response.status}`);
903
+ }
904
+ const data = await response.json();
905
+ if (data?.data?.Notification?.length > 0) {
906
+ return data.data.Notification;
907
+ } else {
908
+ return null;
909
+ }
910
+ } catch (error) {
911
+ console.error("Error fetching notifications:", error);
912
+ return null;
913
+ }
914
+ },
915
+ []
916
+ );
917
+ }
918
+
859
919
  // src/utils/anymals/useMintAnymalNFT.ts
860
920
  import { encodeFunctionData as encodeFunctionData2, parseGwei as parseGwei2 } from "viem";
861
- import { useCallback as useCallback9 } from "react";
921
+ import { useCallback as useCallback10 } from "react";
862
922
  function useMintAnymalNFT() {
863
- return useCallback9(
923
+ return useCallback10(
864
924
  async (pid, nftId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
865
925
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
866
926
  return {
@@ -899,9 +959,9 @@ function useMintAnymalNFT() {
899
959
  }
900
960
 
901
961
  // src/utils/anymals/useAddAnymalToDatabase.ts
902
- import { useCallback as useCallback10 } from "react";
962
+ import { useCallback as useCallback11 } from "react";
903
963
  function useAddAnymalToDatabase() {
904
- return useCallback10(
964
+ return useCallback11(
905
965
  async (dbAuthToken, endpoint, anymalData) => {
906
966
  if (!dbAuthToken) {
907
967
  return {
@@ -966,9 +1026,9 @@ function useAddAnymalToDatabase() {
966
1026
  }
967
1027
 
968
1028
  // src/utils/anymals/useDeleteAnymalFromDatabase.ts
969
- import { useCallback as useCallback11 } from "react";
1029
+ import { useCallback as useCallback12 } from "react";
970
1030
  function useDeleteAnymalFromDatabase() {
971
- return useCallback11(
1031
+ return useCallback12(
972
1032
  async (dbAuthToken, endpoint, anymalDocID) => {
973
1033
  if (!dbAuthToken || !endpoint || !anymalDocID) return;
974
1034
  try {
@@ -1006,9 +1066,9 @@ function useDeleteAnymalFromDatabase() {
1006
1066
  }
1007
1067
 
1008
1068
  // src/utils/anymals/useSaveAnymalMetadata.ts
1009
- import { useCallback as useCallback12 } from "react";
1069
+ import { useCallback as useCallback13 } from "react";
1010
1070
  function useSaveAnymalMetadata() {
1011
- return useCallback12(
1071
+ return useCallback13(
1012
1072
  async (idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
1013
1073
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
1014
1074
  method: "POST",
@@ -1035,9 +1095,9 @@ function useSaveAnymalMetadata() {
1035
1095
  }
1036
1096
 
1037
1097
  // src/utils/anymals/useUpdateAnymalWithNFT.ts
1038
- import { useCallback as useCallback13 } from "react";
1098
+ import { useCallback as useCallback14 } from "react";
1039
1099
  function useUpdateAnymalWithNFT() {
1040
- return useCallback13(
1100
+ return useCallback14(
1041
1101
  async (anymalPassportId, anymalDocId, dbAuthToken, endpoint) => {
1042
1102
  if (!dbAuthToken || !anymalPassportId || !anymalDocId || !endpoint) {
1043
1103
  return {
@@ -1084,7 +1144,7 @@ function useUpdateAnymalWithNFT() {
1084
1144
  }
1085
1145
 
1086
1146
  // src/utils/anymals/useUploadAnymalImage.ts
1087
- import { useCallback as useCallback14 } from "react";
1147
+ import { useCallback as useCallback15 } from "react";
1088
1148
 
1089
1149
  // src/helpers/UploadImageHelper.tsx
1090
1150
  function resizeImage(file, maxWidth = 800, maxHeight = 800, quality = 0.7) {
@@ -1141,7 +1201,7 @@ function toBase64(file) {
1141
1201
 
1142
1202
  // src/utils/anymals/useUploadAnymalImage.ts
1143
1203
  function useUploadAnymalImage() {
1144
- return useCallback14(
1204
+ return useCallback15(
1145
1205
  async (imageFile, type, idToken, publicKey, authServiceBaseUrl) => {
1146
1206
  if (!imageFile || !idToken) {
1147
1207
  return {
@@ -1195,11 +1255,122 @@ function useUploadAnymalImage() {
1195
1255
  );
1196
1256
  }
1197
1257
 
1258
+ // src/utils/marketplace/useProcessPartialKibblePayment.ts
1259
+ import { encodeFunctionData as encodeFunctionData3, parseGwei as parseGwei3 } from "viem";
1260
+ import { useCallback as useCallback16 } from "react";
1261
+ function useProcessPartialKibblePayment() {
1262
+ return useCallback16(
1263
+ async (pid, nftId, orderId, dbAuthToken, marketplaceContract, smartAccount, bundlerClient, amountInTokens, maxTokenPayment, nonce, deadline, backendSignature) => {
1264
+ if (!orderId || !dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !marketplaceContract || !amountInTokens || !maxTokenPayment || !nonce || !deadline) {
1265
+ return {
1266
+ success: false,
1267
+ message: "Missing required parameters for partial payment."
1268
+ };
1269
+ }
1270
+ try {
1271
+ const args = [
1272
+ orderId,
1273
+ // string
1274
+ nftId,
1275
+ // string
1276
+ amountInTokens,
1277
+ // uint256
1278
+ maxTokenPayment,
1279
+ // uint256
1280
+ nonce,
1281
+ // bytes32
1282
+ deadline,
1283
+ // uint256
1284
+ backendSignature
1285
+ // bytes
1286
+ ];
1287
+ console.info({ args });
1288
+ const callData = encodeFunctionData3({
1289
+ abi: MARKETPLACE_ABI,
1290
+ functionName: "partialPay",
1291
+ args
1292
+ });
1293
+ const userOpHash = await bundlerClient.sendUserOperation({
1294
+ account: smartAccount,
1295
+ calls: [
1296
+ {
1297
+ to: marketplaceContract,
1298
+ data: callData
1299
+ }
1300
+ ],
1301
+ maxPriorityFeePerGas: parseGwei3("0.001"),
1302
+ maxFeePerGas: parseGwei3("0.01")
1303
+ });
1304
+ await bundlerClient.waitForUserOperationReceipt({
1305
+ hash: userOpHash
1306
+ });
1307
+ return { success: true, message: "Partial Kibble Payment Processed!" };
1308
+ } catch (error) {
1309
+ const errorMessage = error instanceof Error ? error.message : "An unknown error occurred";
1310
+ return {
1311
+ success: false,
1312
+ message: `Error processing payment: ${errorMessage}`
1313
+ };
1314
+ }
1315
+ },
1316
+ []
1317
+ );
1318
+ }
1319
+
1320
+ // src/utils/marketplace/useApproveKibbleToken.ts
1321
+ import { encodeFunctionData as encodeFunctionData4, erc20Abi, parseGwei as parseGwei4 } from "viem";
1322
+ import { useCallback as useCallback17 } from "react";
1323
+ function useApproveKibbleToken() {
1324
+ return useCallback17(
1325
+ async (kibbleTokenAddress, marketplaceContract, amount, smartAccount, bundlerClient) => {
1326
+ try {
1327
+ const callData = encodeFunctionData4({
1328
+ abi: erc20Abi,
1329
+ functionName: "approve",
1330
+ args: [
1331
+ marketplaceContract,
1332
+ // spender address
1333
+ BigInt(amount)
1334
+ // amount to approve
1335
+ ]
1336
+ });
1337
+ const userOpHash = await bundlerClient.sendUserOperation({
1338
+ account: smartAccount,
1339
+ calls: [
1340
+ {
1341
+ to: kibbleTokenAddress,
1342
+ data: callData
1343
+ }
1344
+ ],
1345
+ maxPriorityFeePerGas: parseGwei4("0.001"),
1346
+ maxFeePerGas: parseGwei4("0.01")
1347
+ });
1348
+ await bundlerClient.waitForUserOperationReceipt({
1349
+ hash: userOpHash
1350
+ });
1351
+ return { success: true, message: "Approval transaction completed successfully." };
1352
+ } catch (error) {
1353
+ const errorMessage = error instanceof Error ? error.message : "An unknown error occurred";
1354
+ return { success: false, message: `Error processing approval: ${errorMessage}` };
1355
+ }
1356
+ },
1357
+ []
1358
+ );
1359
+ }
1360
+
1361
+ // src/helpers/NonceHelper.tsx
1362
+ import { v4 as uuidv4 } from "uuid";
1363
+ import { padHex } from "viem";
1364
+ var generateBytes32Nonce = () => {
1365
+ const uuid2 = uuidv4().replace(/-/g, "");
1366
+ return padHex(`0x${uuid2}`, { size: 32 });
1367
+ };
1368
+
1198
1369
  // src/utils/application/useCreateUserAppData.ts
1199
- import { useCallback as useCallback15 } from "react";
1370
+ import { useCallback as useCallback18 } from "react";
1200
1371
  import { v4 as uuid } from "uuid";
1201
1372
  function useCreateUserAppData() {
1202
- return useCallback15(
1373
+ return useCallback18(
1203
1374
  async (appId, pid, dbAuthToken, endpoint) => {
1204
1375
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
1205
1376
  const appValues = {
@@ -1252,15 +1423,15 @@ function useCreateUserAppData() {
1252
1423
  }
1253
1424
 
1254
1425
  // src/utils/balance/useFetchBalance.ts
1255
- import { useCallback as useCallback16 } from "react";
1256
- import { erc20Abi, getAddress } from "viem";
1426
+ import { useCallback as useCallback19 } from "react";
1427
+ import { erc20Abi as erc20Abi2, getAddress } from "viem";
1257
1428
  function useFetchBalance() {
1258
- return useCallback16(
1429
+ return useCallback19(
1259
1430
  async (publicClient, walletAddress, kibbleTokenAddress) => {
1260
1431
  try {
1261
1432
  const balance = await publicClient.readContract({
1262
1433
  address: getAddress(kibbleTokenAddress),
1263
- abi: erc20Abi,
1434
+ abi: erc20Abi2,
1264
1435
  functionName: "balanceOf",
1265
1436
  args: [getAddress(walletAddress)]
1266
1437
  });
@@ -1273,13 +1444,17 @@ function useFetchBalance() {
1273
1444
  );
1274
1445
  }
1275
1446
  export {
1447
+ generateBytes32Nonce,
1276
1448
  useAddAnymalToDatabase,
1449
+ useApproveKibbleToken,
1277
1450
  useCreateUserAppData,
1278
1451
  useCreateWeb3Account,
1279
1452
  useDeleteAnymalFromDatabase,
1280
1453
  useFetchBalance,
1454
+ useFetchNotifications,
1281
1455
  useFetchUserData,
1282
1456
  useMintAnymalNFT,
1457
+ useProcessPartialKibblePayment,
1283
1458
  useSaveAnymalMetadata,
1284
1459
  useUpdateAnymalWithNFT,
1285
1460
  useUpdateUserAsVerified,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "A React/TypeScript-based utility library for reusable functions and hooks inside of the Anymal Ecosystem.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -9,7 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "scripts": {
12
- "test": "echo \"Error: no test specified\" && exit 1",
12
+ "test": "jest",
13
13
  "build": "tsup src/index.ts --format cjs,esm --dts",
14
14
  "prepublishOnly": "npm run build"
15
15
  },
@@ -29,9 +29,16 @@
29
29
  "viem": "^2.22.8"
30
30
  },
31
31
  "devDependencies": {
32
+ "@testing-library/jest-dom": "^6.6.3",
33
+ "@testing-library/react": "^16.2.0",
34
+ "@types/jest": "^29.5.14",
32
35
  "@types/react": "^19.0.7",
33
36
  "@types/react-dom": "^19.0.3",
37
+ "jest": "^29.7.0",
38
+ "jest-environment-jsdom": "^29.7.0",
39
+ "ts-jest": "^29.2.5",
34
40
  "tsup": "^8.3.5",
35
- "typescript": "^5.7.3"
41
+ "typescript": "^5.7.3",
42
+ "util": "^0.12.5"
36
43
  }
37
44
  }