anymal-protocol 1.0.25 → 1.0.26

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
@@ -42,7 +42,7 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
42
42
  */
43
43
  declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
44
44
 
45
- declare function useMintAnymalNFT(): (pid: string, nftId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
45
+ declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
46
46
  success: boolean;
47
47
  message: string;
48
48
  }>;
@@ -64,7 +64,7 @@ declare function useAddAnymalToDatabase(): (dbAuthToken: string, endpoint: strin
64
64
 
65
65
  declare function useDeleteAnymalFromDatabase(): (dbAuthToken: string, endpoint: string, anymalDocID: string) => Promise<void>;
66
66
 
67
- declare function useSaveAnymalMetadata(): (idToken: string, publicKey: string, nftMetadataInput: AnymalNftMetadataInputData, authServiceBaseUrl: string) => Promise<{
67
+ declare function useSaveAnymalMetadata(): (userPid: string, anymalTxId: string, idToken: string, publicKey: string, nftMetadataInput: AnymalNftMetadataInputData, authServiceBaseUrl: string) => Promise<{
68
68
  success: boolean;
69
69
  message: any;
70
70
  }>;
package/dist/index.d.ts CHANGED
@@ -42,7 +42,7 @@ declare function useUpdateUserName(): (dbAuthToken: string, docID: string, name:
42
42
  */
43
43
  declare function useFetchNotifications(): (pid: string, dbAuthToken: string, endpoint: string, additionalFilters?: Record<string, any>) => Promise<any>;
44
44
 
45
- declare function useMintAnymalNFT(): (pid: string, nftId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
45
+ declare function useMintAnymalNFT(): (pid: string, nftId: string, anymalTxId: string, dbAuthToken: string, validationContractAddress: string, smartAccount: any, bundlerClient: any) => Promise<{
46
46
  success: boolean;
47
47
  message: string;
48
48
  }>;
@@ -64,7 +64,7 @@ declare function useAddAnymalToDatabase(): (dbAuthToken: string, endpoint: strin
64
64
 
65
65
  declare function useDeleteAnymalFromDatabase(): (dbAuthToken: string, endpoint: string, anymalDocID: string) => Promise<void>;
66
66
 
67
- declare function useSaveAnymalMetadata(): (idToken: string, publicKey: string, nftMetadataInput: AnymalNftMetadataInputData, authServiceBaseUrl: string) => Promise<{
67
+ declare function useSaveAnymalMetadata(): (userPid: string, anymalTxId: string, idToken: string, publicKey: string, nftMetadataInput: AnymalNftMetadataInputData, authServiceBaseUrl: string) => Promise<{
68
68
  success: boolean;
69
69
  message: any;
70
70
  }>;
package/dist/index.js CHANGED
@@ -374,21 +374,27 @@ function useFetchNotifications() {
374
374
  }
375
375
  try {
376
376
  const query = `
377
- query Notification($filter: NotificationFilterArg) {
378
- Notification(filter: $filter) {
379
- _docID
380
- action
381
- id
382
- pid
383
- read
384
- source
385
- tags
386
- text
387
- timeAddedUtc
388
- timeUpdatedUtc
389
- type
377
+ query AnymalNotification($groupBy: [AnymalNotificationField!], $filter: AnymalNotificationFilterArg) {
378
+ AnymalNotification(groupBy: $groupBy, filter: $filter) {
379
+ anymalTxId
380
+ title
381
+ _group {
382
+ source
383
+ action
384
+ anymalTxId
385
+ id
386
+ pid
387
+ read
388
+ source
389
+ tags
390
+ text
391
+ title
392
+ timeAddedUtc
393
+ timeUpdatedUtc
394
+ type
390
395
  }
391
396
  }
397
+ }
392
398
  `;
393
399
  const filter = {
394
400
  pid: {
@@ -396,7 +402,8 @@ function useFetchNotifications() {
396
402
  },
397
403
  ...additionalFilters || {}
398
404
  };
399
- const variables = { filter };
405
+ const groupBy = ["anymalTxId", "title"];
406
+ const variables = { filter, groupBy };
400
407
  const response = await fetch(endpoint, {
401
408
  method: "POST",
402
409
  headers: {
@@ -409,8 +416,8 @@ function useFetchNotifications() {
409
416
  throw new Error(`HTTP error! Status: ${response.status}`);
410
417
  }
411
418
  const data = await response.json();
412
- if (data?.data?.Notification?.length > 0) {
413
- return data.data.Notification;
419
+ if (data?.data?.AnymalNotification?.length > 0) {
420
+ return data.data.AnymalNotification;
414
421
  } else {
415
422
  return null;
416
423
  }
@@ -426,17 +433,15 @@ function useFetchNotifications() {
426
433
  // src/utils/anymals/useMintAnymalNFT.ts
427
434
  var import_viem2 = require("viem");
428
435
  var import_react10 = require("react");
429
- var import_uuid = require("uuid");
430
436
  function useMintAnymalNFT() {
431
437
  return (0, import_react10.useCallback)(
432
- async (pid, nftId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
438
+ async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
433
439
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
434
440
  return {
435
441
  success: false,
436
442
  message: "Missing authentication token OR NFT ID."
437
443
  };
438
444
  }
439
- const anymalTxId = (0, import_uuid.v4)();
440
445
  const callData = (0, import_viem2.encodeFunctionData)({
441
446
  abi: PET_NFT_ABI,
442
447
  functionName: "submitMetadataByCampaignName",
@@ -579,7 +584,7 @@ function useDeleteAnymalFromDatabase() {
579
584
  var import_react13 = require("react");
580
585
  function useSaveAnymalMetadata() {
581
586
  return (0, import_react13.useCallback)(
582
- async (idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
587
+ async (userPid, anymalTxId, idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
583
588
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
584
589
  method: "POST",
585
590
  headers: {
@@ -588,7 +593,9 @@ function useSaveAnymalMetadata() {
588
593
  },
589
594
  body: JSON.stringify({
590
595
  appPubKey: publicKey,
591
- nftMetadataInput
596
+ nftMetadataInput,
597
+ pid: userPid,
598
+ anymalTxId
592
599
  })
593
600
  });
594
601
  const data = await response.json();
@@ -869,22 +876,22 @@ function useApproveKibbleToken() {
869
876
  }
870
877
 
871
878
  // src/helpers/NonceHelper.tsx
872
- var import_uuid2 = require("uuid");
879
+ var import_uuid = require("uuid");
873
880
  var import_viem5 = require("viem");
874
881
  var generateBytes32Nonce = () => {
875
- const uuid2 = (0, import_uuid2.v4)().replace(/-/g, "");
882
+ const uuid2 = (0, import_uuid.v4)().replace(/-/g, "");
876
883
  return (0, import_viem5.padHex)(`0x${uuid2}`, { size: 32 });
877
884
  };
878
885
 
879
886
  // src/utils/application/useCreateUserAppData.ts
880
887
  var import_react18 = require("react");
881
- var import_uuid3 = require("uuid");
888
+ var import_uuid2 = require("uuid");
882
889
  function useCreateUserAppData() {
883
890
  return (0, import_react18.useCallback)(
884
891
  async (appId, pid, dbAuthToken, endpoint) => {
885
892
  if (!dbAuthToken || !pid || !dbAuthToken || !endpoint) return;
886
893
  const appValues = {
887
- id: (0, import_uuid3.v4)(),
894
+ id: (0, import_uuid2.v4)(),
888
895
  userPid: pid,
889
896
  appId,
890
897
  settings: {
package/dist/index.mjs CHANGED
@@ -329,21 +329,27 @@ function useFetchNotifications() {
329
329
  }
330
330
  try {
331
331
  const query = `
332
- query Notification($filter: NotificationFilterArg) {
333
- Notification(filter: $filter) {
334
- _docID
335
- action
336
- id
337
- pid
338
- read
339
- source
340
- tags
341
- text
342
- timeAddedUtc
343
- timeUpdatedUtc
344
- type
332
+ query AnymalNotification($groupBy: [AnymalNotificationField!], $filter: AnymalNotificationFilterArg) {
333
+ AnymalNotification(groupBy: $groupBy, filter: $filter) {
334
+ anymalTxId
335
+ title
336
+ _group {
337
+ source
338
+ action
339
+ anymalTxId
340
+ id
341
+ pid
342
+ read
343
+ source
344
+ tags
345
+ text
346
+ title
347
+ timeAddedUtc
348
+ timeUpdatedUtc
349
+ type
345
350
  }
346
351
  }
352
+ }
347
353
  `;
348
354
  const filter = {
349
355
  pid: {
@@ -351,7 +357,8 @@ function useFetchNotifications() {
351
357
  },
352
358
  ...additionalFilters || {}
353
359
  };
354
- const variables = { filter };
360
+ const groupBy = ["anymalTxId", "title"];
361
+ const variables = { filter, groupBy };
355
362
  const response = await fetch(endpoint, {
356
363
  method: "POST",
357
364
  headers: {
@@ -364,8 +371,8 @@ function useFetchNotifications() {
364
371
  throw new Error(`HTTP error! Status: ${response.status}`);
365
372
  }
366
373
  const data = await response.json();
367
- if (data?.data?.Notification?.length > 0) {
368
- return data.data.Notification;
374
+ if (data?.data?.AnymalNotification?.length > 0) {
375
+ return data.data.AnymalNotification;
369
376
  } else {
370
377
  return null;
371
378
  }
@@ -381,17 +388,15 @@ function useFetchNotifications() {
381
388
  // src/utils/anymals/useMintAnymalNFT.ts
382
389
  import { encodeFunctionData as encodeFunctionData2, parseGwei as parseGwei2 } from "viem";
383
390
  import { useCallback as useCallback10 } from "react";
384
- import { v4 as uuidv4 } from "uuid";
385
391
  function useMintAnymalNFT() {
386
392
  return useCallback10(
387
- async (pid, nftId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
393
+ async (pid, nftId, anymalTxId, dbAuthToken, validationContractAddress, smartAccount, bundlerClient) => {
388
394
  if (!dbAuthToken || !nftId || !bundlerClient || !smartAccount || !pid || !validationContractAddress) {
389
395
  return {
390
396
  success: false,
391
397
  message: "Missing authentication token OR NFT ID."
392
398
  };
393
399
  }
394
- const anymalTxId = uuidv4();
395
400
  const callData = encodeFunctionData2({
396
401
  abi: PET_NFT_ABI,
397
402
  functionName: "submitMetadataByCampaignName",
@@ -534,7 +539,7 @@ function useDeleteAnymalFromDatabase() {
534
539
  import { useCallback as useCallback13 } from "react";
535
540
  function useSaveAnymalMetadata() {
536
541
  return useCallback13(
537
- async (idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
542
+ async (userPid, anymalTxId, idToken, publicKey, nftMetadataInput, authServiceBaseUrl) => {
538
543
  const response = await fetch(`${authServiceBaseUrl}/process-nft`, {
539
544
  method: "POST",
540
545
  headers: {
@@ -543,7 +548,9 @@ function useSaveAnymalMetadata() {
543
548
  },
544
549
  body: JSON.stringify({
545
550
  appPubKey: publicKey,
546
- nftMetadataInput
551
+ nftMetadataInput,
552
+ pid: userPid,
553
+ anymalTxId
547
554
  })
548
555
  });
549
556
  const data = await response.json();
@@ -824,10 +831,10 @@ function useApproveKibbleToken() {
824
831
  }
825
832
 
826
833
  // src/helpers/NonceHelper.tsx
827
- import { v4 as uuidv42 } from "uuid";
834
+ import { v4 as uuidv4 } from "uuid";
828
835
  import { padHex } from "viem";
829
836
  var generateBytes32Nonce = () => {
830
- const uuid2 = uuidv42().replace(/-/g, "");
837
+ const uuid2 = uuidv4().replace(/-/g, "");
831
838
  return padHex(`0x${uuid2}`, { size: 32 });
832
839
  };
833
840
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
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",